Exim 4.75 cut & pushed out.
[exim-website.git] / docbook / 4.75 / 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>21 Jan 2011</date>
16 <author><firstname>Exim</firstname><surname>Maintainers</surname></author>
17 <authorinitials>EM</authorinitials>
18 <revhistory><revision>
19   <revnumber>4.75</revnumber>
20   <date>21 Feb 2011</date>
21   <authorinitials>EM</authorinitials>
22 </revision></revhistory>
23 <copyright><year>2011</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.75 of Exim.
202 Substantive changes from the 4.72 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>
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 revisionflag="changed">
2006 If a host is unreachable for a period of time, a number of messages may be
2007 waiting for it by the time it recovers, and sending them in a single SMTP
2008 connection is clearly beneficial. Whenever a delivery to a remote host is
2009 deferred,
2010 <indexterm role="concept">
2011 <primary>hints database</primary>
2012 </indexterm>
2013 Exim makes a note in its hints database, and whenever a successful
2014 SMTP delivery has happened, it looks to see if any other messages are waiting
2015 for the same host. If any are found, they are sent over the same SMTP
2016 connection, subject to a configuration limit as to the maximum number in any
2017 one connection.
2018 </para>
2019 </section>
2020 <section id="SECID21">
2021 <title>Permanent delivery failure</title>
2022 <para>
2023 <indexterm role="concept">
2024 <primary>delivery</primary>
2025 <secondary>permanent failure</secondary>
2026 </indexterm>
2027 <indexterm role="concept">
2028 <primary>bounce message</primary>
2029 <secondary>when generated</secondary>
2030 </indexterm>
2031 When a message cannot be delivered to some or all of its intended recipients, a
2032 bounce message is generated. Temporary delivery failures turn into permanent
2033 errors when their timeout expires. All the addresses that fail in a given
2034 delivery attempt are listed in a single message. If the original message has
2035 many recipients, it is possible for some addresses to fail in one delivery
2036 attempt and others to fail subsequently, giving rise to more than one bounce
2037 message. The wording of bounce messages can be customized by the administrator.
2038 See chapter <xref linkend="CHAPemsgcust"/> for details.
2039 </para>
2040 <para>
2041 <indexterm role="concept">
2042 <primary><emphasis>X-Failed-Recipients:</emphasis> header line</primary>
2043 </indexterm>
2044 Bounce messages contain an <emphasis>X-Failed-Recipients:</emphasis> header line that lists the
2045 failed addresses, for the benefit of programs that try to analyse such messages
2046 automatically.
2047 </para>
2048 <para>
2049 <indexterm role="concept">
2050 <primary>bounce message</primary>
2051 <secondary>recipient of</secondary>
2052 </indexterm>
2053 A bounce message is normally sent to the sender of the original message, as
2054 obtained from the message&#x2019;s envelope. For incoming SMTP messages, this is the
2055 address given in the MAIL command. However, when an address is expanded via a
2056 forward or alias file, an alternative address can be specified for delivery
2057 failures of the generated addresses. For a mailing list expansion (see section
2058 <xref linkend="SECTmailinglists"/>) it is common to direct bounce messages to the manager
2059 of the list.
2060 </para>
2061 </section>
2062 <section id="SECID22">
2063 <title>Failures to deliver bounce messages</title>
2064 <para>
2065 <indexterm role="concept">
2066 <primary>bounce message</primary>
2067 <secondary>failure to deliver</secondary>
2068 </indexterm>
2069 If a bounce message (either locally generated or received from a remote host)
2070 itself suffers a permanent delivery failure, the message is left on the queue,
2071 but it is frozen, awaiting the attention of an administrator. There are options
2072 that can be used to make Exim discard such failed messages, or to keep them
2073 for only a short time (see <option>timeout_frozen_after</option> and
2074 <option>ignore_bounce_errors_after</option>).
2075 </para>
2076 </section>
2077 </chapter>
2078
2079 <chapter id="CHID3">
2080 <title>Building and installing Exim</title>
2081 <para>
2082 <indexterm role="concept" id="IIDbuex" class="startofrange">
2083 <primary>building Exim</primary>
2084 </indexterm>
2085 </para>
2086 <section id="SECID23">
2087 <title>Unpacking</title>
2088 <para>
2089 Exim is distributed as a gzipped or bzipped tar file which, when unpacked,
2090 creates a directory with the name of the current release (for example,
2091 <filename>exim-4.75</filename>) into which the following files are placed:
2092 </para>
2093 <informaltable frame="none">
2094 <tgroup cols="2" colsep="0" rowsep="0">
2095 <colspec colwidth="140pt" align="left"/>
2096 <colspec colwidth="254pt" align="left"/>
2097 <tbody>
2098 <row>
2099 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>ACKNOWLEDGMENTS</filename></entry>
2100 <entry>contains some acknowledgments</entry>
2101 </row>
2102 <row>
2103 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>CHANGES</filename></entry>
2104 <entry>contains a reference to where changes are documented</entry>
2105 </row>
2106 <row>
2107 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>LICENCE</filename></entry>
2108 <entry>the GNU General Public Licence</entry>
2109 </row>
2110 <row>
2111 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>Makefile</filename></entry>
2112 <entry>top-level make file</entry>
2113 </row>
2114 <row>
2115 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>NOTICE</filename></entry>
2116 <entry>conditions for the use of Exim</entry>
2117 </row>
2118 <row>
2119 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>README</filename></entry>
2120 <entry>list of files, directories and simple build instructions</entry>
2121 </row>
2122 </tbody>
2123 </tgroup>
2124 </informaltable>
2125 <para>
2126 Other files whose names begin with <filename>README</filename> may also be present. The
2127 following subdirectories are created:
2128 </para>
2129 <informaltable frame="none">
2130 <tgroup cols="2" colsep="0" rowsep="0">
2131 <colspec colwidth="140pt" align="left"/>
2132 <colspec colwidth="254pt" align="left"/>
2133 <tbody>
2134 <row>
2135 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>Local</filename></entry>
2136 <entry>an empty directory for local configuration files</entry>
2137 </row>
2138 <row>
2139 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>OS</filename></entry>
2140 <entry>OS-specific files</entry>
2141 </row>
2142 <row>
2143 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>doc</filename></entry>
2144 <entry>documentation files</entry>
2145 </row>
2146 <row>
2147 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>exim_monitor</filename></entry>
2148 <entry>source files for the Exim monitor</entry>
2149 </row>
2150 <row>
2151 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>scripts</filename></entry>
2152 <entry>scripts used in the build process</entry>
2153 </row>
2154 <row>
2155 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>src</filename></entry>
2156 <entry>remaining source files</entry>
2157 </row>
2158 <row>
2159 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>util</filename></entry>
2160 <entry>independent utilities</entry>
2161 </row>
2162 </tbody>
2163 </tgroup>
2164 </informaltable>
2165 <para>
2166 The main utility programs are contained in the <filename>src</filename> directory, and are built
2167 with the Exim binary. The <filename>util</filename> directory contains a few optional scripts
2168 that may be useful to some sites.
2169 </para>
2170 </section>
2171 <section id="SECID24">
2172 <title>Multiple machine architectures and operating systems</title>
2173 <para>
2174 <indexterm role="concept">
2175 <primary>building Exim</primary>
2176 <secondary>multiple OS/architectures</secondary>
2177 </indexterm>
2178 The building process for Exim is arranged to make it easy to build binaries for
2179 a number of different architectures and operating systems from the same set of
2180 source files. Compilation does not take place in the <filename>src</filename> directory.
2181 Instead, a <emphasis>build directory</emphasis> is created for each architecture and operating
2182 system.
2183 <indexterm role="concept">
2184 <primary>symbolic link</primary>
2185 <secondary>to build directory</secondary>
2186 </indexterm>
2187 Symbolic links to the sources are installed in this directory, which is where
2188 the actual building takes place. In most cases, Exim can discover the machine
2189 architecture and operating system for itself, but the defaults can be
2190 overridden if necessary.
2191 </para>
2192 </section>
2193 <section id="SECTpcre">
2194 <title>PCRE library</title>
2195 <para>
2196 <indexterm role="concept">
2197 <primary>PCRE library</primary>
2198 </indexterm>
2199 Exim no longer has an embedded PCRE library as the vast majority of
2200 modern systems include PCRE as a system library, although you may need
2201 to install the PCRE or PCRE development package for your operating
2202 system. If your system has a normal PCRE installation the Exim build
2203 process will need no further configuration. If the library or the
2204 headers are in an unusual location you will need to set the PCRE_LIBS
2205 and INCLUDE directives appropriately. If your operating system has no
2206 PCRE support then you will need to obtain and build the current PCRE
2207 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>.
2208 </para>
2209 </section>
2210 <section id="SECTdb">
2211 <title>DBM libraries</title>
2212 <para>
2213 <indexterm role="concept">
2214 <primary>DBM libraries</primary>
2215 <secondary>discussion of</secondary>
2216 </indexterm>
2217 <indexterm role="concept">
2218 <primary>hints database</primary>
2219 <secondary>DBM files used for</secondary>
2220 </indexterm>
2221 Even if you do not use any DBM files in your configuration, Exim still needs a
2222 DBM library in order to operate, because it uses indexed files for its hints
2223 databases. Unfortunately, there are a number of DBM libraries in existence, and
2224 different operating systems often have different ones installed.
2225 </para>
2226 <para>
2227 <indexterm role="concept">
2228 <primary>Solaris</primary>
2229 <secondary>DBM library for</secondary>
2230 </indexterm>
2231 <indexterm role="concept">
2232 <primary>IRIX, DBM library for</primary>
2233 </indexterm>
2234 <indexterm role="concept">
2235 <primary>BSD, DBM library for</primary>
2236 </indexterm>
2237 <indexterm role="concept">
2238 <primary>Linux, DBM library for</primary>
2239 </indexterm>
2240 If you are using Solaris, IRIX, one of the modern BSD systems, or a modern
2241 Linux distribution, the DBM configuration should happen automatically, and you
2242 may be able to ignore this section. Otherwise, you may have to learn more than
2243 you would like about DBM libraries from what follows.
2244 </para>
2245 <para>
2246 <indexterm role="concept">
2247 <primary><emphasis>ndbm</emphasis> DBM library</primary>
2248 </indexterm>
2249 Licensed versions of Unix normally contain a library of DBM functions operating
2250 via the <emphasis>ndbm</emphasis> interface, and this is what Exim expects by default. Free
2251 versions of Unix seem to vary in what they contain as standard. In particular,
2252 some early versions of Linux have no default DBM library, and different
2253 distributors have chosen to bundle different libraries with their packaged
2254 versions. However, the more recent releases seem to have standardized on the
2255 Berkeley DB library.
2256 </para>
2257 <para>
2258 Different DBM libraries have different conventions for naming the files they
2259 use. When a program opens a file called <filename>dbmfile</filename>, there are several
2260 possibilities:
2261 </para>
2262 <orderedlist numeration="arabic">
2263 <listitem>
2264 <para>
2265 A traditional <emphasis>ndbm</emphasis> implementation, such as that supplied as part of
2266 Solaris, operates on two files called <filename>dbmfile.dir</filename> and <filename>dbmfile.pag</filename>.
2267 </para>
2268 </listitem>
2269 <listitem>
2270 <para>
2271 <indexterm role="concept">
2272 <primary><emphasis>gdbm</emphasis> DBM library</primary>
2273 </indexterm>
2274 The GNU library, <emphasis>gdbm</emphasis>, operates on a single file. If used via its <emphasis>ndbm</emphasis>
2275 compatibility interface it makes two different hard links to it with names
2276 <filename>dbmfile.dir</filename> and <filename>dbmfile.pag</filename>, but if used via its native interface, the
2277 file name is used unmodified.
2278 </para>
2279 </listitem>
2280 <listitem>
2281 <para>
2282 <indexterm role="concept">
2283 <primary>Berkeley DB library</primary>
2284 </indexterm>
2285 The Berkeley DB package, if called via its <emphasis>ndbm</emphasis> compatibility interface,
2286 operates on a single file called <filename>dbmfile.db</filename>, but otherwise looks to the
2287 programmer exactly the same as the traditional <emphasis>ndbm</emphasis> implementation.
2288 </para>
2289 </listitem>
2290 <listitem>
2291 <para>
2292 If the Berkeley package is used in its native mode, it operates on a single
2293 file called <filename>dbmfile</filename>; the programmer&#x2019;s interface is somewhat different to
2294 the traditional <emphasis>ndbm</emphasis> interface.
2295 </para>
2296 </listitem>
2297 <listitem>
2298 <para>
2299 To complicate things further, there are several very different versions of the
2300 Berkeley DB package. Version 1.85 was stable for a very long time, releases
2301 2.<emphasis>x</emphasis> and 3.<emphasis>x</emphasis> were current for a while, but the latest versions are now
2302 numbered 4.<emphasis>x</emphasis>. Maintenance of some of the earlier releases has ceased. All
2303 versions of Berkeley DB can be obtained from
2304 <emphasis role="bold"><ulink url="http://www.sleepycat.com/">http://www.sleepycat.com/</ulink></emphasis>.
2305 </para>
2306 </listitem>
2307 <listitem>
2308 <para>
2309 <indexterm role="concept">
2310 <primary><emphasis>tdb</emphasis> DBM library</primary>
2311 </indexterm>
2312 Yet another DBM library, called <emphasis>tdb</emphasis>, is available from
2313 <emphasis role="bold"><ulink url="http://download.sourceforge.net/tdb">http://download.sourceforge.net/tdb</ulink></emphasis>. It has its own interface, and also
2314 operates on a single file.
2315 </para>
2316 </listitem>
2317 </orderedlist>
2318 <para>
2319 <indexterm role="concept">
2320 <primary>USE_DB</primary>
2321 </indexterm>
2322 <indexterm role="concept">
2323 <primary>DBM libraries</primary>
2324 <secondary>configuration for building</secondary>
2325 </indexterm>
2326 Exim and its utilities can be compiled to use any of these interfaces. In order
2327 to use any version of the Berkeley DB package in native mode, you must set
2328 USE_DB in an appropriate configuration file (typically
2329 <filename>Local/Makefile</filename>). For example:
2330 </para>
2331 <literallayout class="monospaced">
2332 USE_DB=yes
2333 </literallayout>
2334 <para>
2335 Similarly, for gdbm you set USE_GDBM, and for tdb you set USE_TDB. An
2336 error is diagnosed if you set more than one of these.
2337 </para>
2338 <para>
2339 At the lowest level, the build-time configuration sets none of these options,
2340 thereby assuming an interface of type (1). However, some operating system
2341 configuration files (for example, those for the BSD operating systems and
2342 Linux) assume type (4) by setting USE_DB as their default, and the
2343 configuration files for Cygwin set USE_GDBM. Anything you set in
2344 <filename>Local/Makefile</filename>, however, overrides these system defaults.
2345 </para>
2346 <para>
2347 As well as setting USE_DB, USE_GDBM, or USE_TDB, it may also be
2348 necessary to set DBMLIB, to cause inclusion of the appropriate library, as
2349 in one of these lines:
2350 </para>
2351 <literallayout class="monospaced">
2352 DBMLIB = -ldb
2353 DBMLIB = -ltdb
2354 </literallayout>
2355 <para>
2356 Settings like that will work if the DBM library is installed in the standard
2357 place. Sometimes it is not, and the library&#x2019;s header file may also not be in
2358 the default path. You may need to set INCLUDE to specify where the header
2359 file is, and to specify the path to the library more fully in DBMLIB, as in
2360 this example:
2361 </para>
2362 <literallayout class="monospaced">
2363 INCLUDE=-I/usr/local/include/db-4.1
2364 DBMLIB=/usr/local/lib/db-4.1/libdb.a
2365 </literallayout>
2366 <para>
2367 There is further detailed discussion about the various DBM libraries in the
2368 file <filename>doc/dbm.discuss.txt</filename> in the Exim distribution.
2369 </para>
2370 </section>
2371 <section id="SECID25">
2372 <title>Pre-building configuration</title>
2373 <para>
2374 <indexterm role="concept">
2375 <primary>building Exim</primary>
2376 <secondary>pre-building configuration</secondary>
2377 </indexterm>
2378 <indexterm role="concept">
2379 <primary>configuration for building Exim</primary>
2380 </indexterm>
2381 <indexterm role="concept">
2382 <primary><filename>Local/Makefile</filename></primary>
2383 </indexterm>
2384 <indexterm role="concept">
2385 <primary><filename>src/EDITME</filename></primary>
2386 </indexterm>
2387 Before building Exim, a local configuration file that specifies options
2388 independent of any operating system has to be created with the name
2389 <filename>Local/Makefile</filename>. A template for this file is supplied as the file
2390 <filename>src/EDITME</filename>, and it contains full descriptions of all the option settings
2391 therein. These descriptions are therefore not repeated here. If you are
2392 building Exim for the first time, the simplest thing to do is to copy
2393 <filename>src/EDITME</filename> to <filename>Local/Makefile</filename>, then read it and edit it appropriately.
2394 </para>
2395 <para>
2396 There are three settings that you must supply, because Exim will not build
2397 without them. They are the location of the run time configuration file
2398 (CONFIGURE_FILE), the directory in which Exim binaries will be installed
2399 (BIN_DIRECTORY), and the identity of the Exim user (EXIM_USER and
2400 maybe EXIM_GROUP as well). The value of CONFIGURE_FILE can in fact be
2401 a colon-separated list of file names; Exim uses the first of them that exists.
2402 </para>
2403 <para>
2404 There are a few other parameters that can be specified either at build time or
2405 at run time, to enable the same binary to be used on a number of different
2406 machines. However, if the locations of Exim&#x2019;s spool directory and log file
2407 directory (if not within the spool directory) are fixed, it is recommended that
2408 you specify them in <filename>Local/Makefile</filename> instead of at run time, so that errors
2409 detected early in Exim&#x2019;s execution (such as a malformed configuration file) can
2410 be logged.
2411 </para>
2412 <para>
2413 <indexterm role="concept">
2414 <primary>content scanning</primary>
2415 <secondary>specifying at build time</secondary>
2416 </indexterm>
2417 Exim&#x2019;s interfaces for calling virus and spam scanning software directly from
2418 access control lists are not compiled by default. If you want to include these
2419 facilities, you need to set
2420 </para>
2421 <literallayout class="monospaced">
2422 WITH_CONTENT_SCAN=yes
2423 </literallayout>
2424 <para>
2425 in your <filename>Local/Makefile</filename>. For details of the facilities themselves, see
2426 chapter <xref linkend="CHAPexiscan"/>.
2427 </para>
2428 <para>
2429 <indexterm role="concept">
2430 <primary><filename>Local/eximon.conf</filename></primary>
2431 </indexterm>
2432 <indexterm role="concept">
2433 <primary><filename>exim_monitor/EDITME</filename></primary>
2434 </indexterm>
2435 If you are going to build the Exim monitor, a similar configuration process is
2436 required. The file <filename>exim_monitor/EDITME</filename> must be edited appropriately for
2437 your installation and saved under the name <filename>Local/eximon.conf</filename>. If you are
2438 happy with the default settings described in <filename>exim_monitor/EDITME</filename>,
2439 <filename>Local/eximon.conf</filename> can be empty, but it must exist.
2440 </para>
2441 <para>
2442 This is all the configuration that is needed in straightforward cases for known
2443 operating systems. However, the building process is set up so that it is easy
2444 to override options that are set by default or by operating-system-specific
2445 configuration files, for example to change the name of the C compiler, which
2446 defaults to <option>gcc</option>. See section <xref linkend="SECToverride"/> below for details of how to
2447 do this.
2448 </para>
2449 </section>
2450 <section id="SECID26">
2451 <title>Support for iconv()</title>
2452 <para>
2453 <indexterm role="concept">
2454 <primary><function>iconv()</function> support</primary>
2455 </indexterm>
2456 <indexterm role="concept">
2457 <primary>RFC 2047</primary>
2458 </indexterm>
2459 The contents of header lines in messages may be encoded according to the rules
2460 described RFC 2047. This makes it possible to transmit characters that are not
2461 in the ASCII character set, and to label them as being in a particular
2462 character set. When Exim is inspecting header lines by means of the <option>$h_</option>
2463 mechanism, it decodes them, and translates them into a specified character set
2464 (default ISO-8859-1). The translation is possible only if the operating system
2465 supports the <function>iconv()</function> function.
2466 </para>
2467 <para>
2468 However, some of the operating systems that supply <function>iconv()</function> do not support
2469 very many conversions. The GNU <option>libiconv</option> library (available from
2470 <emphasis role="bold"><ulink url="http://www.gnu.org/software/libiconv/">http://www.gnu.org/software/libiconv/</ulink></emphasis>) can be installed on such
2471 systems to remedy this deficiency, as well as on systems that do not supply
2472 <function>iconv()</function> at all. After installing <option>libiconv</option>, you should add
2473 </para>
2474 <literallayout class="monospaced">
2475 HAVE_ICONV=yes
2476 </literallayout>
2477 <para>
2478 to your <filename>Local/Makefile</filename> and rebuild Exim.
2479 </para>
2480 </section>
2481 <section id="SECTinctlsssl">
2482 <title>Including TLS/SSL encryption support</title>
2483 <para>
2484 <indexterm role="concept">
2485 <primary>TLS</primary>
2486 <secondary>including support for TLS</secondary>
2487 </indexterm>
2488 <indexterm role="concept">
2489 <primary>encryption</primary>
2490 <secondary>including support for</secondary>
2491 </indexterm>
2492 <indexterm role="concept">
2493 <primary>SUPPORT_TLS</primary>
2494 </indexterm>
2495 <indexterm role="concept">
2496 <primary>OpenSSL</primary>
2497 <secondary>building Exim with</secondary>
2498 </indexterm>
2499 <indexterm role="concept">
2500 <primary>GnuTLS</primary>
2501 <secondary>building Exim with</secondary>
2502 </indexterm>
2503 Exim can be built to support encrypted SMTP connections, using the STARTTLS
2504 command as per RFC 2487. It can also support legacy clients that expect to
2505 start a TLS session immediately on connection to a non-standard port (see the
2506 <option>tls_on_connect_ports</option> runtime option and the <option>-tls-on-connect</option> command
2507 line option).
2508 </para>
2509 <para>
2510 If you want to build Exim with TLS support, you must first install either the
2511 OpenSSL or GnuTLS library. There is no cryptographic code in Exim itself for
2512 implementing SSL.
2513 </para>
2514 <para>
2515 If OpenSSL is installed, you should set
2516 </para>
2517 <literallayout class="monospaced">
2518 SUPPORT_TLS=yes
2519 TLS_LIBS=-lssl -lcrypto
2520 </literallayout>
2521 <para>
2522 in <filename>Local/Makefile</filename>. You may also need to specify the locations of the
2523 OpenSSL library and include files. For example:
2524 </para>
2525 <literallayout class="monospaced">
2526 SUPPORT_TLS=yes
2527 TLS_LIBS=-L/usr/local/openssl/lib -lssl -lcrypto
2528 TLS_INCLUDE=-I/usr/local/openssl/include/
2529 </literallayout>
2530 <para>
2531 <indexterm role="concept">
2532 <primary>USE_GNUTLS</primary>
2533 </indexterm>
2534 If GnuTLS is installed, you should set
2535 </para>
2536 <literallayout class="monospaced">
2537 SUPPORT_TLS=yes
2538 USE_GNUTLS=yes
2539 TLS_LIBS=-lgnutls -ltasn1 -lgcrypt
2540 </literallayout>
2541 <para>
2542 in <filename>Local/Makefile</filename>, and again you may need to specify the locations of the
2543 library and include files. For example:
2544 </para>
2545 <literallayout class="monospaced">
2546 SUPPORT_TLS=yes
2547 USE_GNUTLS=yes
2548 TLS_LIBS=-L/usr/gnu/lib -lgnutls -ltasn1 -lgcrypt
2549 TLS_INCLUDE=-I/usr/gnu/include
2550 </literallayout>
2551 <para>
2552 You do not need to set TLS_INCLUDE if the relevant directory is already
2553 specified in INCLUDE. Details of how to configure Exim to make use of TLS are
2554 given in chapter <xref linkend="CHAPTLS"/>.
2555 </para>
2556 </section>
2557 <section id="SECID27" revisionflag="changed">
2558 <title>Use of tcpwrappers</title>
2559 <para revisionflag="changed">
2560 <indexterm role="concept">
2561 <primary>tcpwrappers, building Exim to support</primary>
2562 </indexterm>
2563 <indexterm role="concept">
2564 <primary>USE_TCP_WRAPPERS</primary>
2565 </indexterm>
2566 <indexterm role="concept">
2567 <primary>TCP_WRAPPERS_DAEMON_NAME</primary>
2568 </indexterm>
2569 <indexterm role="concept">
2570 <primary>tcp_wrappers_daemon_name</primary>
2571 </indexterm>
2572 Exim can be linked with the <emphasis>tcpwrappers</emphasis> library in order to check incoming
2573 SMTP calls using the <emphasis>tcpwrappers</emphasis> control files. This may be a convenient
2574 alternative to Exim&#x2019;s own checking facilities for installations that are
2575 already making use of <emphasis>tcpwrappers</emphasis> for other purposes. To do this, you
2576 should set USE_TCP_WRAPPERS in <filename>Local/Makefile</filename>, arrange for the file
2577 <filename>tcpd.h</filename> to be available at compile time, and also ensure that the library
2578 <filename>libwrap.a</filename> is available at link time, typically by including <option>-lwrap</option> in
2579 EXTRALIBS_EXIM. For example, if <emphasis>tcpwrappers</emphasis> is installed in <filename>/usr/local</filename>,
2580 you might have
2581 </para>
2582 <literallayout class="monospaced" revisionflag="changed">
2583 USE_TCP_WRAPPERS=yes
2584 CFLAGS=-O -I/usr/local/include
2585 EXTRALIBS_EXIM=-L/usr/local/lib -lwrap
2586 </literallayout>
2587 <para revisionflag="changed">
2588 in <filename>Local/Makefile</filename>. The daemon name to use in the <emphasis>tcpwrappers</emphasis> control
2589 files is <quote>exim</quote>. For example, the line
2590 </para>
2591 <literallayout class="monospaced" revisionflag="changed">
2592 exim : LOCAL  192.168.1.  .friendly.domain.example
2593 </literallayout>
2594 <para revisionflag="changed">
2595 in your <filename>/etc/hosts.allow</filename> file allows connections from the local host, from
2596 the subnet 192.168.1.0/24, and from all hosts in <emphasis>friendly.domain.example</emphasis>.
2597 All other connections are denied. The daemon name used by <emphasis>tcpwrappers</emphasis>
2598 can be changed at build time by setting TCP_WRAPPERS_DAEMON_NAME in
2599 in <filename>Local/Makefile</filename>, or by setting tcp_wrappers_daemon_name in the
2600 configure file. Consult the <emphasis>tcpwrappers</emphasis> documentation for
2601 further details.
2602 </para>
2603 </section>
2604 <section id="SECID28">
2605 <title>Including support for IPv6</title>
2606 <para>
2607 <indexterm role="concept">
2608 <primary>IPv6</primary>
2609 <secondary>including support for</secondary>
2610 </indexterm>
2611 Exim contains code for use on systems that have IPv6 support. Setting
2612 <literal>HAVE_IPV6=YES</literal> in <filename>Local/Makefile</filename> causes the IPv6 code to be included;
2613 it may also be necessary to set IPV6_INCLUDE and IPV6_LIBS on systems
2614 where the IPv6 support is not fully integrated into the normal include and
2615 library files.
2616 </para>
2617 <para>
2618 Two different types of DNS record for handling IPv6 addresses have been
2619 defined. AAAA records (analogous to A records for IPv4) are in use, and are
2620 currently seen as the mainstream. Another record type called A6 was proposed
2621 as better than AAAA because it had more flexibility. However, it was felt to be
2622 over-complex, and its status was reduced to <quote>experimental</quote>. It is not known
2623 if anyone is actually using A6 records. Exim has support for A6 records, but
2624 this is included only if you set <literal>SUPPORT_A6=YES</literal> in <filename>Local/Makefile</filename>. The
2625 support has not been tested for some time.
2626 </para>
2627 </section>
2628 <section id="SECTdynamicmodules" revisionflag="changed">
2629 <title>Dynamically loaded lookup module support</title>
2630 <para revisionflag="changed">
2631 <indexterm role="concept">
2632 <primary>lookup modules</primary>
2633 </indexterm>
2634 <indexterm role="concept">
2635 <primary>dynamic modules</primary>
2636 </indexterm>
2637 <indexterm role="concept">
2638 <primary>.so building</primary>
2639 </indexterm>
2640 On some platforms, Exim supports not compiling all lookup types directly into
2641 the main binary, instead putting some into external modules which can be loaded
2642 on demand.
2643 This permits packagers to build Exim with support for lookups with extensive
2644 library dependencies without requiring all users to install all of those
2645 dependencies.
2646 Most, but not all, lookup types can be built this way.
2647 </para>
2648 <para revisionflag="changed">
2649 Set <literal>LOOKUP_MODULE_DIR</literal> to the directory into which the modules will be
2650 installed; Exim will only load modules from that directory, as a security
2651 measure.  You will need to set <literal>CFLAGS_DYNAMIC</literal> if not already defined
2652 for your OS; see <filename>OS/Makefile-Linux</filename> for an example.
2653 Some other requirements for adjusting <literal>EXTRALIBS</literal> may also be necessary,
2654 see <filename>src/EDITME</filename> for details.
2655 </para>
2656 <para revisionflag="changed">
2657 Then, for each module to be loaded dynamically, define the relevant
2658 <literal>LOOKUP_</literal>&lt;<emphasis>lookup_type</emphasis>&gt; flags to have the value "2" instead of "yes".
2659 For example, this will build in lsearch but load sqlite and mysql support
2660 on demand:
2661 </para>
2662 <literallayout class="monospaced" revisionflag="changed">
2663 LOOKUP_LSEARCH=yes
2664 LOOKUP_SQLITE=2
2665 LOOKUP_MYSQL=2
2666 </literallayout>
2667 </section>
2668 <section id="SECID29">
2669 <title>The building process</title>
2670 <para>
2671 <indexterm role="concept">
2672 <primary>build directory</primary>
2673 </indexterm>
2674 Once <filename>Local/Makefile</filename> (and <filename>Local/eximon.conf</filename>, if required) have been
2675 created, run <emphasis>make</emphasis> at the top level. It determines the architecture and
2676 operating system types, and creates a build directory if one does not exist.
2677 For example, on a Sun system running Solaris 8, the directory
2678 <filename>build-SunOS5-5.8-sparc</filename> is created.
2679 <indexterm role="concept">
2680 <primary>symbolic link</primary>
2681 <secondary>to source files</secondary>
2682 </indexterm>
2683 Symbolic links to relevant source files are installed in the build directory.
2684 </para>
2685 <para>
2686 <emphasis role="bold">Warning</emphasis>: The <option>-j</option> (parallel) flag must not be used with <emphasis>make</emphasis>; the
2687 building process fails if it is set.
2688 </para>
2689 <para>
2690 If this is the first time <emphasis>make</emphasis> has been run, it calls a script that builds
2691 a make file inside the build directory, using the configuration files from the
2692 <filename>Local</filename> directory. The new make file is then passed to another instance of
2693 <emphasis>make</emphasis>. This does the real work, building a number of utility scripts, and
2694 then compiling and linking the binaries for the Exim monitor (if configured), a
2695 number of utility programs, and finally Exim itself. The command <literal>make
2696 makefile</literal> can be used to force a rebuild of the make file in the build
2697 directory, should this ever be necessary.
2698 </para>
2699 <para>
2700 If you have problems building Exim, check for any comments there may be in the
2701 <filename>README</filename> file concerning your operating system, and also take a look at the
2702 FAQ, where some common problems are covered.
2703 </para>
2704 </section>
2705 <section id="SECID283">
2706 <title>Output from <quote>make</quote></title>
2707 <para>
2708 The output produced by the <emphasis>make</emphasis> process for compile lines is often very
2709 unreadable, because these lines can be very long. For this reason, the normal
2710 output is suppressed by default, and instead output similar to that which
2711 appears when compiling the 2.6 Linux kernel is generated: just a short line for
2712 each module that is being compiled or linked. However, it is still possible to
2713 get the full output, by calling <emphasis>make</emphasis> like this:
2714 </para>
2715 <literallayout class="monospaced">
2716 FULLECHO='' make -e
2717 </literallayout>
2718 <para>
2719 The value of FULLECHO defaults to <quote>@</quote>, the flag character that suppresses
2720 command reflection in <emphasis>make</emphasis>. When you ask for the full output, it is
2721 given in addition to the short output.
2722 </para>
2723 </section>
2724 <section id="SECToverride">
2725 <title>Overriding build-time options for Exim</title>
2726 <para>
2727 <indexterm role="concept">
2728 <primary>build-time options, overriding</primary>
2729 </indexterm>
2730 The main make file that is created at the beginning of the building process
2731 consists of the concatenation of a number of files which set configuration
2732 values, followed by a fixed set of <emphasis>make</emphasis> instructions. If a value is set
2733 more than once, the last setting overrides any previous ones. This provides a
2734 convenient way of overriding defaults. The files that are concatenated are, in
2735 order:
2736 </para>
2737 <literallayout>
2738 <filename>OS/Makefile-Default</filename>
2739 <filename>OS/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;
2740 <filename>Local/Makefile</filename>
2741 <filename>Local/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;
2742 <filename>Local/Makefile-</filename>&lt;<emphasis>archtype</emphasis>&gt;
2743 <filename>Local/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;-&lt;<emphasis>archtype</emphasis>&gt;
2744 <filename>OS/Makefile-Base</filename>
2745 </literallayout>
2746 <para>
2747 <indexterm role="concept">
2748 <primary><filename>Local/Makefile</filename></primary>
2749 </indexterm>
2750 <indexterm role="concept">
2751 <primary>building Exim</primary>
2752 <secondary>operating system type</secondary>
2753 </indexterm>
2754 <indexterm role="concept">
2755 <primary>building Exim</primary>
2756 <secondary>architecture type</secondary>
2757 </indexterm>
2758 where &lt;<emphasis>ostype</emphasis>&gt; is the operating system type and &lt;<emphasis>archtype</emphasis>&gt; is the
2759 architecture type. <filename>Local/Makefile</filename> is required to exist, and the building
2760 process fails if it is absent. The other three <filename>Local</filename> files are optional,
2761 and are often not needed.
2762 </para>
2763 <para>
2764 The values used for &lt;<emphasis>ostype</emphasis>&gt; and &lt;<emphasis>archtype</emphasis>&gt; are obtained from scripts
2765 called <filename>scripts/os-type</filename> and <filename>scripts/arch-type</filename> respectively. If either of
2766 the environment variables EXIM_OSTYPE or EXIM_ARCHTYPE is set, their
2767 values are used, thereby providing a means of forcing particular settings.
2768 Otherwise, the scripts try to get values from the <option>uname</option> command. If this
2769 fails, the shell variables OSTYPE and ARCHTYPE are inspected. A number
2770 of <emphasis>ad hoc</emphasis> transformations are then applied, to produce the standard names
2771 that Exim expects. You can run these scripts directly from the shell in order
2772 to find out what values are being used on your system.
2773 </para>
2774 <para>
2775 <filename>OS/Makefile-Default</filename> contains comments about the variables that are set
2776 therein. Some (but not all) are mentioned below. If there is something that
2777 needs changing, review the contents of this file and the contents of the make
2778 file for your operating system (<filename>OS/Makefile-&lt;ostype&gt;</filename>) to see what the
2779 default values are.
2780 </para>
2781 <para>
2782 <indexterm role="concept">
2783 <primary>building Exim</primary>
2784 <secondary>overriding default settings</secondary>
2785 </indexterm>
2786 If you need to change any of the values that are set in <filename>OS/Makefile-Default</filename>
2787 or in <filename>OS/Makefile-&lt;ostype&gt;</filename>, or to add any new definitions, you do not
2788 need to change the original files. Instead, you should make the changes by
2789 putting the new values in an appropriate <filename>Local</filename> file. For example,
2790 <indexterm role="concept">
2791 <primary>Tru64-Unix build-time settings</primary>
2792 </indexterm>
2793 when building Exim in many releases of the Tru64-Unix (formerly Digital UNIX,
2794 formerly DEC-OSF1) operating system, it is necessary to specify that the C
2795 compiler is called <emphasis>cc</emphasis> rather than <emphasis>gcc</emphasis>. Also, the compiler must be
2796 called with the option <option>-std1</option>, to make it recognize some of the features of
2797 Standard C that Exim uses. (Most other compilers recognize Standard C by
2798 default.) To do this, you should create a file called <filename>Local/Makefile-OSF1</filename>
2799 containing the lines
2800 </para>
2801 <literallayout class="monospaced">
2802 CC=cc
2803 CFLAGS=-std1
2804 </literallayout>
2805 <para>
2806 If you are compiling for just one operating system, it may be easier to put
2807 these lines directly into <filename>Local/Makefile</filename>.
2808 </para>
2809 <para>
2810 Keeping all your local configuration settings separate from the distributed
2811 files makes it easy to transfer them to new versions of Exim simply by copying
2812 the contents of the <filename>Local</filename> directory.
2813 </para>
2814 <para>
2815 <indexterm role="concept">
2816 <primary>NIS lookup type</primary>
2817 <secondary>including support for</secondary>
2818 </indexterm>
2819 <indexterm role="concept">
2820 <primary>NIS+ lookup type</primary>
2821 <secondary>including support for</secondary>
2822 </indexterm>
2823 <indexterm role="concept">
2824 <primary>LDAP</primary>
2825 <secondary>including support for</secondary>
2826 </indexterm>
2827 <indexterm role="concept">
2828 <primary>lookup</primary>
2829 <secondary>inclusion in binary</secondary>
2830 </indexterm>
2831 Exim contains support for doing LDAP, NIS, NIS+, and other kinds of file
2832 lookup, but not all systems have these components installed, so the default is
2833 not to include the relevant code in the binary. All the different kinds of file
2834 and database lookup that Exim supports are implemented as separate code modules
2835 which are included only if the relevant compile-time options are set. In the
2836 case of LDAP, NIS, and NIS+, the settings for <filename>Local/Makefile</filename> are:
2837 </para>
2838 <literallayout class="monospaced">
2839 LOOKUP_LDAP=yes
2840 LOOKUP_NIS=yes
2841 LOOKUP_NISPLUS=yes
2842 </literallayout>
2843 <para>
2844 and similar settings apply to the other lookup types. They are all listed in
2845 <filename>src/EDITME</filename>. In many cases the relevant include files and interface
2846 libraries need to be installed before compiling Exim.
2847 <indexterm role="concept">
2848 <primary>cdb</primary>
2849 <secondary>including support for</secondary>
2850 </indexterm>
2851 However, there are some optional lookup types (such as cdb) for which
2852 the code is entirely contained within Exim, and no external include
2853 files or libraries are required. When a lookup type is not included in the
2854 binary, attempts to configure Exim to use it cause run time configuration
2855 errors.
2856 </para>
2857 <para>
2858 <indexterm role="concept">
2859 <primary>Perl</primary>
2860 <secondary>including support for</secondary>
2861 </indexterm>
2862 Exim can be linked with an embedded Perl interpreter, allowing Perl
2863 subroutines to be called during string expansion. To enable this facility,
2864 </para>
2865 <literallayout class="monospaced">
2866 EXIM_PERL=perl.o
2867 </literallayout>
2868 <para>
2869 must be defined in <filename>Local/Makefile</filename>. Details of this facility are given in
2870 chapter <xref linkend="CHAPperl"/>.
2871 </para>
2872 <para>
2873 <indexterm role="concept">
2874 <primary>X11 libraries, location of</primary>
2875 </indexterm>
2876 The location of the X11 libraries is something that varies a lot between
2877 operating systems, and there may be different versions of X11 to cope
2878 with. Exim itself makes no use of X11, but if you are compiling the Exim
2879 monitor, the X11 libraries must be available.
2880 The following three variables are set in <filename>OS/Makefile-Default</filename>:
2881 </para>
2882 <literallayout class="monospaced">
2883 X11=/usr/X11R6
2884 XINCLUDE=-I$(X11)/include
2885 XLFLAGS=-L$(X11)/lib
2886 </literallayout>
2887 <para>
2888 These are overridden in some of the operating-system configuration files. For
2889 example, in <filename>OS/Makefile-SunOS5</filename> there is
2890 </para>
2891 <literallayout class="monospaced">
2892 X11=/usr/openwin
2893 XINCLUDE=-I$(X11)/include
2894 XLFLAGS=-L$(X11)/lib -R$(X11)/lib
2895 </literallayout>
2896 <para>
2897 If you need to override the default setting for your operating system, place a
2898 definition of all three of these variables into your
2899 <filename>Local/Makefile-&lt;ostype&gt;</filename> file.
2900 </para>
2901 <para>
2902 <indexterm role="concept">
2903 <primary>EXTRALIBS</primary>
2904 </indexterm>
2905 If you need to add any extra libraries to the link steps, these can be put in a
2906 variable called EXTRALIBS, which appears in all the link commands, but by
2907 default is not defined. In contrast, EXTRALIBS_EXIM is used only on the
2908 command for linking the main Exim binary, and not for any associated utilities.
2909 </para>
2910 <para>
2911 <indexterm role="concept">
2912 <primary>DBM libraries</primary>
2913 <secondary>configuration for building</secondary>
2914 </indexterm>
2915 There is also DBMLIB, which appears in the link commands for binaries that
2916 use DBM functions (see also section <xref linkend="SECTdb"/>). Finally, there is
2917 EXTRALIBS_EXIMON, which appears only in the link step for the Exim monitor
2918 binary, and which can be used, for example, to include additional X11
2919 libraries.
2920 </para>
2921 <para>
2922 <indexterm role="concept">
2923 <primary>configuration file</primary>
2924 <secondary>editing</secondary>
2925 </indexterm>
2926 The make file copes with rebuilding Exim correctly if any of the configuration
2927 files are edited. However, if an optional configuration file is deleted, it is
2928 necessary to touch the associated non-optional file (that is,
2929 <filename>Local/Makefile</filename> or <filename>Local/eximon.conf</filename>) before rebuilding.
2930 </para>
2931 </section>
2932 <section id="SECID30">
2933 <title>OS-specific header files</title>
2934 <para>
2935 <indexterm role="concept">
2936 <primary><filename>os.h</filename></primary>
2937 </indexterm>
2938 <indexterm role="concept">
2939 <primary>building Exim</primary>
2940 <secondary>OS-specific C header files</secondary>
2941 </indexterm>
2942 The <filename>OS</filename> directory contains a number of files with names of the form
2943 <filename>os.h-&lt;ostype&gt;</filename>. These are system-specific C header files that should not
2944 normally need to be changed. There is a list of macro settings that are
2945 recognized in the file <filename>OS/os.configuring</filename>, which should be consulted if you
2946 are porting Exim to a new operating system.
2947 </para>
2948 </section>
2949 <section id="SECID31">
2950 <title>Overriding build-time options for the monitor</title>
2951 <para>
2952 <indexterm role="concept">
2953 <primary>building Eximon</primary>
2954 </indexterm>
2955 A similar process is used for overriding things when building the Exim monitor,
2956 where the files that are involved are
2957 </para>
2958 <literallayout>
2959 <filename>OS/eximon.conf-Default</filename>
2960 <filename>OS/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;
2961 <filename>Local/eximon.conf</filename>
2962 <filename>Local/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;
2963 <filename>Local/eximon.conf-</filename>&lt;<emphasis>archtype</emphasis>&gt;
2964 <filename>Local/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;-&lt;<emphasis>archtype</emphasis>&gt;
2965 </literallayout>
2966 <para>
2967 <indexterm role="concept">
2968 <primary><filename>Local/eximon.conf</filename></primary>
2969 </indexterm>
2970 As with Exim itself, the final three files need not exist, and in this case the
2971 <filename>OS/eximon.conf-&lt;ostype&gt;</filename> file is also optional. The default values in
2972 <filename>OS/eximon.conf-Default</filename> can be overridden dynamically by setting environment
2973 variables of the same name, preceded by EXIMON_. For example, setting
2974 EXIMON_LOG_DEPTH in the environment overrides the value of
2975 LOG_DEPTH at run time.
2976 <indexterm role="concept" startref="IIDbuex" class="endofrange"/>
2977 </para>
2978 </section>
2979 <section id="SECID32">
2980 <title>Installing Exim binaries and scripts</title>
2981 <para>
2982 <indexterm role="concept">
2983 <primary>installing Exim</primary>
2984 </indexterm>
2985 <indexterm role="concept">
2986 <primary>BIN_DIRECTORY</primary>
2987 </indexterm>
2988 The command <literal>make install</literal> runs the <command>exim_install</command> script with no
2989 arguments. The script copies binaries and utility scripts into the directory
2990 whose name is specified by the BIN_DIRECTORY setting in <filename>Local/Makefile</filename>.
2991 <indexterm role="concept">
2992 <primary>setuid</primary>
2993 <secondary>installing Exim with</secondary>
2994 </indexterm>
2995 The install script copies files only if they are newer than the files they are
2996 going to replace. The Exim binary is required to be owned by root and have the
2997 <emphasis>setuid</emphasis> bit set, for normal configurations. Therefore, you must run <literal>make
2998 install</literal> as root so that it can set up the Exim binary in this way. However, in
2999 some special situations (for example, if a host is doing no local deliveries)
3000 it may be possible to run Exim without making the binary setuid root (see
3001 chapter <xref linkend="CHAPsecurity"/> for details).
3002 </para>
3003 <para>
3004 <indexterm role="concept">
3005 <primary>CONFIGURE_FILE</primary>
3006 </indexterm>
3007 Exim&#x2019;s run time configuration file is named by the CONFIGURE_FILE setting
3008 in <filename>Local/Makefile</filename>. If this names a single file, and the file does not
3009 exist, the default configuration file <filename>src/configure.default</filename> is copied there
3010 by the installation script. If a run time configuration file already exists, it
3011 is left alone. If CONFIGURE_FILE is a colon-separated list, naming several
3012 alternative files, no default is installed.
3013 </para>
3014 <para>
3015 <indexterm role="concept">
3016 <primary>system aliases file</primary>
3017 </indexterm>
3018 <indexterm role="concept">
3019 <primary><filename>/etc/aliases</filename></primary>
3020 </indexterm>
3021 One change is made to the default configuration file when it is installed: the
3022 default configuration contains a router that references a system aliases file.
3023 The path to this file is set to the value specified by
3024 SYSTEM_ALIASES_FILE in <filename>Local/Makefile</filename> (<filename>/etc/aliases</filename> by default).
3025 If the system aliases file does not exist, the installation script creates it,
3026 and outputs a comment to the user.
3027 </para>
3028 <para>
3029 The created file contains no aliases, but it does contain comments about the
3030 aliases a site should normally have. Mail aliases have traditionally been
3031 kept in <filename>/etc/aliases</filename>. However, some operating systems are now using
3032 <filename>/etc/mail/aliases</filename>. You should check if yours is one of these, and change
3033 Exim&#x2019;s configuration if necessary.
3034 </para>
3035 <para>
3036 The default configuration uses the local host&#x2019;s name as the only local domain,
3037 and is set up to do local deliveries into the shared directory <filename>/var/mail</filename>,
3038 running as the local user. System aliases and <filename>.forward</filename> files in users&#x2019; home
3039 directories are supported, but no NIS or NIS+ support is configured. Domains
3040 other than the name of the local host are routed using the DNS, with delivery
3041 over SMTP.
3042 </para>
3043 <para>
3044 It is possible to install Exim for special purposes (such as building a binary
3045 distribution) in a private part of the file system. You can do this by a
3046 command such as
3047 </para>
3048 <literallayout class="monospaced">
3049 make DESTDIR=/some/directory/ install
3050 </literallayout>
3051 <para>
3052 This has the effect of pre-pending the specified directory to all the file
3053 paths, except the name of the system aliases file that appears in the default
3054 configuration. (If a default alias file is created, its name <emphasis>is</emphasis> modified.)
3055 For backwards compatibility, ROOT is used if DESTDIR is not set,
3056 but this usage is deprecated.
3057 </para>
3058 <para>
3059 <indexterm role="concept">
3060 <primary>installing Exim</primary>
3061 <secondary>what is not installed</secondary>
3062 </indexterm>
3063 Running <emphasis>make install</emphasis> does not copy the Exim 4 conversion script
3064 <emphasis>convert4r4</emphasis>. You will probably run this only once if you are
3065 upgrading from Exim 3. None of the documentation files in the <filename>doc</filename>
3066 directory are copied, except for the info files when you have set
3067 INFO_DIRECTORY, as described in section <xref linkend="SECTinsinfdoc"/> below.
3068 </para>
3069 <para>
3070 For the utility programs, old versions are renamed by adding the suffix <filename>.O</filename>
3071 to their names. The Exim binary itself, however, is handled differently. It is
3072 installed under a name that includes the version number and the compile number,
3073 for example <filename>exim-4.75-1</filename>. The script then arranges for a symbolic link
3074 called <filename>exim</filename> to point to the binary. If you are updating a previous version
3075 of Exim, the script takes care to ensure that the name <filename>exim</filename> is never absent
3076 from the directory (as seen by other processes).
3077 </para>
3078 <para>
3079 <indexterm role="concept">
3080 <primary>installing Exim</primary>
3081 <secondary>testing the script</secondary>
3082 </indexterm>
3083 If you want to see what the <emphasis>make install</emphasis> will do before running it for
3084 real, you can pass the <option>-n</option> option to the installation script by this
3085 command:
3086 </para>
3087 <literallayout class="monospaced">
3088 make INSTALL_ARG=-n install
3089 </literallayout>
3090 <para>
3091 The contents of the variable INSTALL_ARG are passed to the installation
3092 script. You do not need to be root to run this test. Alternatively, you can run
3093 the installation script directly, but this must be from within the build
3094 directory. For example, from the top-level Exim directory you could use this
3095 command:
3096 </para>
3097 <literallayout class="monospaced">
3098 (cd build-SunOS5-5.5.1-sparc; ../scripts/exim_install -n)
3099 </literallayout>
3100 <para>
3101 <indexterm role="concept">
3102 <primary>installing Exim</primary>
3103 <secondary>install script options</secondary>
3104 </indexterm>
3105 There are two other options that can be supplied to the installation script.
3106 </para>
3107 <itemizedlist>
3108 <listitem>
3109 <para>
3110 <option>-no_chown</option> bypasses the call to change the owner of the installed binary
3111 to root, and the call to make it a setuid binary.
3112 </para>
3113 </listitem>
3114 <listitem>
3115 <para>
3116 <option>-no_symlink</option> bypasses the setting up of the symbolic link <filename>exim</filename> to the
3117 installed binary.
3118 </para>
3119 </listitem>
3120 </itemizedlist>
3121 <para>
3122 INSTALL_ARG can be used to pass these options to the script. For example:
3123 </para>
3124 <literallayout class="monospaced">
3125 make INSTALL_ARG=-no_symlink install
3126 </literallayout>
3127 <para>
3128 The installation script can also be given arguments specifying which files are
3129 to be copied. For example, to install just the Exim binary, and nothing else,
3130 without creating the symbolic link, you could use:
3131 </para>
3132 <literallayout class="monospaced">
3133 make INSTALL_ARG='-no_symlink exim' install
3134 </literallayout>
3135 </section>
3136 <section id="SECTinsinfdoc">
3137 <title>Installing info documentation</title>
3138 <para>
3139 <indexterm role="concept">
3140 <primary>installing Exim</primary>
3141 <secondary><emphasis>info</emphasis> documentation</secondary>
3142 </indexterm>
3143 Not all systems use the GNU <emphasis>info</emphasis> system for documentation, and for this
3144 reason, the Texinfo source of Exim&#x2019;s documentation is not included in the main
3145 distribution. Instead it is available separately from the ftp site (see section
3146 <xref linkend="SECTavail"/>).
3147 </para>
3148 <para>
3149 If you have defined INFO_DIRECTORY in <filename>Local/Makefile</filename> and the Texinfo
3150 source of the documentation is found in the source tree, running <literal>make
3151 install</literal> automatically builds the info files and installs them.
3152 </para>
3153 </section>
3154 <section id="SECID33">
3155 <title>Setting up the spool directory</title>
3156 <para>
3157 <indexterm role="concept">
3158 <primary>spool directory</primary>
3159 <secondary>creating</secondary>
3160 </indexterm>
3161 When it starts up, Exim tries to create its spool directory if it does not
3162 exist. The Exim uid and gid are used for the owner and group of the spool
3163 directory. Sub-directories are automatically created in the spool directory as
3164 necessary.
3165 </para>
3166 </section>
3167 <section id="SECID34">
3168 <title>Testing</title>
3169 <para>
3170 <indexterm role="concept">
3171 <primary>testing</primary>
3172 <secondary>installation</secondary>
3173 </indexterm>
3174 Having installed Exim, you can check that the run time configuration file is
3175 syntactically valid by running the following command, which assumes that the
3176 Exim binary directory is within your PATH environment variable:
3177 </para>
3178 <literallayout class="monospaced">
3179 exim -bV
3180 </literallayout>
3181 <para>
3182 If there are any errors in the configuration file, Exim outputs error messages.
3183 Otherwise it outputs the version number and build date,
3184 the DBM library that is being used, and information about which drivers and
3185 other optional code modules are included in the binary.
3186 Some simple routing tests can be done by using the address testing option. For
3187 example,
3188 </para>
3189 <literallayout>
3190 <literal>exim -bt</literal> &lt;<emphasis>local username</emphasis>&gt;
3191 </literallayout>
3192 <para>
3193 should verify that it recognizes a local mailbox, and
3194 </para>
3195 <literallayout>
3196 <literal>exim -bt</literal> &lt;<emphasis>remote address</emphasis>&gt;
3197 </literallayout>
3198 <para>
3199 a remote one. Then try getting it to deliver mail, both locally and remotely.
3200 This can be done by passing messages directly to Exim, without going through a
3201 user agent. For example:
3202 </para>
3203 <literallayout class="monospaced">
3204 exim -v postmaster@your.domain.example
3205 From: user@your.domain.example
3206 To: postmaster@your.domain.example
3207 Subject: Testing Exim
3208
3209 This is a test message.
3210 ^D
3211 </literallayout>
3212 <para>
3213 The <option>-v</option> option causes Exim to output some verification of what it is doing.
3214 In this case you should see copies of three log lines, one for the message&#x2019;s
3215 arrival, one for its delivery, and one containing <quote>Completed</quote>.
3216 </para>
3217 <para>
3218 <indexterm role="concept">
3219 <primary>delivery</primary>
3220 <secondary>problems with</secondary>
3221 </indexterm>
3222 If you encounter problems, look at Exim&#x2019;s log files (<emphasis>mainlog</emphasis> and
3223 <emphasis>paniclog</emphasis>) to see if there is any relevant information there. Another source
3224 of information is running Exim with debugging turned on, by specifying the
3225 <option>-d</option> option. If a message is stuck on Exim&#x2019;s spool, you can force a delivery
3226 with debugging turned on by a command of the form
3227 </para>
3228 <literallayout>
3229 <literal>exim -d -M</literal> &lt;<emphasis>exim-message-id</emphasis>&gt;
3230 </literallayout>
3231 <para>
3232 You must be root or an <quote>admin user</quote> in order to do this. The <option>-d</option> option
3233 produces rather a lot of output, but you can cut this down to specific areas.
3234 For example, if you use <option>-d-all+route</option> only the debugging information
3235 relevant to routing is included. (See the <option>-d</option> option in chapter
3236 <xref linkend="CHAPcommandline"/> for more details.)
3237 </para>
3238 <para>
3239 <indexterm role="concept">
3240 <primary><quote>sticky</quote> bit</primary>
3241 </indexterm>
3242 <indexterm role="concept">
3243 <primary>lock files</primary>
3244 </indexterm>
3245 One specific problem that has shown up on some sites is the inability to do
3246 local deliveries into a shared mailbox directory, because it does not have the
3247 <quote>sticky bit</quote> set on it. By default, Exim tries to create a lock file before
3248 writing to a mailbox file, and if it cannot create the lock file, the delivery
3249 is deferred. You can get round this either by setting the <quote>sticky bit</quote> on the
3250 directory, or by setting a specific group for local deliveries and allowing
3251 that group to create files in the directory (see the comments above the
3252 <command>local_delivery</command> transport in the default configuration file). Another
3253 approach is to configure Exim not to use lock files, but just to rely on
3254 <function>fcntl()</function> locking instead. However, you should do this only if all user
3255 agents also use <function>fcntl()</function> locking. For further discussion of locking issues,
3256 see chapter <xref linkend="CHAPappendfile"/>.
3257 </para>
3258 <para>
3259 One thing that cannot be tested on a system that is already running an MTA is
3260 the receipt of incoming SMTP mail on the standard SMTP port. However, the
3261 <option>-oX</option> option can be used to run an Exim daemon that listens on some other
3262 port, or <emphasis>inetd</emphasis> can be used to do this. The <option>-bh</option> option and the
3263 <emphasis>exim_checkaccess</emphasis> utility can be used to check out policy controls on
3264 incoming SMTP mail.
3265 </para>
3266 <para>
3267 Testing a new version on a system that is already running Exim can most easily
3268 be done by building a binary with a different CONFIGURE_FILE setting. From
3269 within the run time configuration, all other file and directory names
3270 that Exim uses can be altered, in order to keep it entirely clear of the
3271 production version.
3272 </para>
3273 </section>
3274 <section id="SECID35">
3275 <title>Replacing another MTA with Exim</title>
3276 <para>
3277 <indexterm role="concept">
3278 <primary>replacing another MTA</primary>
3279 </indexterm>
3280 Building and installing Exim for the first time does not of itself put it in
3281 general use. The name by which the system&#x2019;s MTA is called by mail user agents
3282 is either <filename>/usr/sbin/sendmail</filename>, or <filename>/usr/lib/sendmail</filename> (depending on the
3283 operating system), and it is necessary to make this name point to the <emphasis>exim</emphasis>
3284 binary in order to get the user agents to pass messages to Exim. This is
3285 normally done by renaming any existing file and making <filename>/usr/sbin/sendmail</filename>
3286 or <filename>/usr/lib/sendmail</filename>
3287 <indexterm role="concept">
3288 <primary>symbolic link</primary>
3289 <secondary>to <emphasis>exim</emphasis> binary</secondary>
3290 </indexterm>
3291 a symbolic link to the <emphasis>exim</emphasis> binary. It is a good idea to remove any setuid
3292 privilege and executable status from the old MTA. It is then necessary to stop
3293 and restart the mailer daemon, if one is running.
3294 </para>
3295 <para>
3296 <indexterm role="concept">
3297 <primary>FreeBSD, MTA indirection</primary>
3298 </indexterm>
3299 <indexterm role="concept">
3300 <primary><filename>/etc/mail/mailer.conf</filename></primary>
3301 </indexterm>
3302 Some operating systems have introduced alternative ways of switching MTAs. For
3303 example, if you are running FreeBSD, you need to edit the file
3304 <filename>/etc/mail/mailer.conf</filename> instead of setting up a symbolic link as just
3305 described. A typical example of the contents of this file for running Exim is
3306 as follows:
3307 </para>
3308 <literallayout class="monospaced">
3309 sendmail            /usr/exim/bin/exim
3310 send-mail           /usr/exim/bin/exim
3311 mailq               /usr/exim/bin/exim -bp
3312 newaliases          /usr/bin/true
3313 </literallayout>
3314 <para>
3315 Once you have set up the symbolic link, or edited <filename>/etc/mail/mailer.conf</filename>,
3316 your Exim installation is <quote>live</quote>. Check it by sending a message from your
3317 favourite user agent.
3318 </para>
3319 <para>
3320 You should consider what to tell your users about the change of MTA. Exim may
3321 have different capabilities to what was previously running, and there are
3322 various operational differences such as the text of messages produced by
3323 command line options and in bounce messages. If you allow your users to make
3324 use of Exim&#x2019;s filtering capabilities, you should make the document entitled
3325 <emphasis>Exim&#x2019;s interface to mail filtering</emphasis> available to them.
3326 </para>
3327 </section>
3328 <section id="SECID36">
3329 <title>Upgrading Exim</title>
3330 <para>
3331 <indexterm role="concept">
3332 <primary>upgrading Exim</primary>
3333 </indexterm>
3334 If you are already running Exim on your host, building and installing a new
3335 version automatically makes it available to MUAs, or any other programs that
3336 call the MTA directly. However, if you are running an Exim daemon, you do need
3337 to send it a HUP signal, to make it re-execute itself, and thereby pick up the
3338 new binary. You do not need to stop processing mail in order to install a new
3339 version of Exim. The install script does not modify an existing runtime
3340 configuration file.
3341 </para>
3342 </section>
3343 <section id="SECID37">
3344 <title>Stopping the Exim daemon on Solaris</title>
3345 <para>
3346 <indexterm role="concept">
3347 <primary>Solaris</primary>
3348 <secondary>stopping Exim on</secondary>
3349 </indexterm>
3350 The standard command for stopping the mailer daemon on Solaris is
3351 </para>
3352 <literallayout class="monospaced">
3353 /etc/init.d/sendmail stop
3354 </literallayout>
3355 <para>
3356 If <filename>/usr/lib/sendmail</filename> has been turned into a symbolic link, this script
3357 fails to stop Exim because it uses the command <emphasis>ps -e</emphasis> and greps the output
3358 for the text <quote>sendmail</quote>; this is not present because the actual program name
3359 (that is, <quote>exim</quote>) is given by the <emphasis>ps</emphasis> command with these options. A
3360 solution is to replace the line that finds the process id with something like
3361 </para>
3362 <literallayout class="monospaced">
3363 pid=`cat /var/spool/exim/exim-daemon.pid`
3364 </literallayout>
3365 <para>
3366 to obtain the daemon&#x2019;s pid directly from the file that Exim saves it in.
3367 </para>
3368 <para>
3369 Note, however, that stopping the daemon does not <quote>stop Exim</quote>. Messages can
3370 still be received from local processes, and if automatic delivery is configured
3371 (the normal case), deliveries will still occur.
3372 </para>
3373 </section>
3374 </chapter>
3375
3376 <chapter id="CHAPcommandline">
3377 <title>The Exim command line</title>
3378 <para>
3379 <indexterm role="concept" id="IIDclo1" class="startofrange">
3380 <primary>command line</primary>
3381 <secondary>options</secondary>
3382 </indexterm>
3383 <indexterm role="concept" id="IIDclo2" class="startofrange">
3384 <primary>options</primary>
3385 <secondary>command line</secondary>
3386 </indexterm>
3387 Exim&#x2019;s command line takes the standard Unix form of a sequence of options,
3388 each starting with a hyphen character, followed by a number of arguments. The
3389 options are compatible with the main options of Sendmail, and there are also
3390 some additional options, some of which are compatible with Smail 3. Certain
3391 combinations of options do not make sense, and provoke an error if used.
3392 The form of the arguments depends on which options are set.
3393 </para>
3394 <section id="SECID38">
3395 <title>Setting options by program name</title>
3396 <para>
3397 <indexterm role="concept">
3398 <primary><emphasis>mailq</emphasis></primary>
3399 </indexterm>
3400 If Exim is called under the name <emphasis>mailq</emphasis>, it behaves as if the option <option>-bp</option>
3401 were present before any other options.
3402 The <option>-bp</option> option requests a listing of the contents of the mail queue on the
3403 standard output.
3404 This feature is for compatibility with some systems that contain a command of
3405 that name in one of the standard libraries, symbolically linked to
3406 <filename>/usr/sbin/sendmail</filename> or <filename>/usr/lib/sendmail</filename>.
3407 </para>
3408 <para>
3409 <indexterm role="concept">
3410 <primary><emphasis>rsmtp</emphasis></primary>
3411 </indexterm>
3412 If Exim is called under the name <emphasis>rsmtp</emphasis> it behaves as if the option <option>-bS</option>
3413 were present before any other options, for compatibility with Smail. The
3414 <option>-bS</option> option is used for reading in a number of messages in batched SMTP
3415 format.
3416 </para>
3417 <para>
3418 <indexterm role="concept">
3419 <primary><emphasis>rmail</emphasis></primary>
3420 </indexterm>
3421 If Exim is called under the name <emphasis>rmail</emphasis> it behaves as if the <option>-i</option> and
3422 <option>-oee</option> options were present before any other options, for compatibility with
3423 Smail. The name <emphasis>rmail</emphasis> is used as an interface by some UUCP systems.
3424 </para>
3425 <para>
3426 <indexterm role="concept">
3427 <primary><emphasis>runq</emphasis></primary>
3428 </indexterm>
3429 <indexterm role="concept">
3430 <primary>queue runner</primary>
3431 </indexterm>
3432 If Exim is called under the name <emphasis>runq</emphasis> it behaves as if the option <option>-q</option>
3433 were present before any other options, for compatibility with Smail. The <option>-q</option>
3434 option causes a single queue runner process to be started.
3435 </para>
3436 <para>
3437 <indexterm role="concept">
3438 <primary><emphasis>newaliases</emphasis></primary>
3439 </indexterm>
3440 <indexterm role="concept">
3441 <primary>alias file</primary>
3442 <secondary>building</secondary>
3443 </indexterm>
3444 <indexterm role="concept">
3445 <primary>Sendmail compatibility</primary>
3446 <secondary>calling Exim as <emphasis>newaliases</emphasis></secondary>
3447 </indexterm>
3448 If Exim is called under the name <emphasis>newaliases</emphasis> it behaves as if the option
3449 <option>-bi</option> were present before any other options, for compatibility with Sendmail.
3450 This option is used for rebuilding Sendmail&#x2019;s alias file. Exim does not have
3451 the concept of a single alias file, but can be configured to run a given
3452 command if called with the <option>-bi</option> option.
3453 </para>
3454 </section>
3455 <section id="SECTtrustedadmin">
3456 <title>Trusted and admin users</title>
3457 <para>
3458 Some Exim options are available only to <emphasis>trusted users</emphasis> and others are
3459 available only to <emphasis>admin users</emphasis>. In the description below, the phrases <quote>Exim
3460 user</quote> and <quote>Exim group</quote> mean the user and group defined by EXIM_USER and
3461 EXIM_GROUP in <filename>Local/Makefile</filename> or set by the <option>exim_user</option> and
3462 <option>exim_group</option> options. These do not necessarily have to use the name <quote>exim</quote>.
3463 </para>
3464 <itemizedlist>
3465 <listitem>
3466 <para>
3467 <indexterm role="concept">
3468 <primary>trusted users</primary>
3469 <secondary>definition of</secondary>
3470 </indexterm>
3471 <indexterm role="concept">
3472 <primary>user</primary>
3473 <secondary>trusted definition of</secondary>
3474 </indexterm>
3475 The trusted users are root, the Exim user, any user listed in the
3476 <option>trusted_users</option> configuration option, and any user whose current group or any
3477 supplementary group is one of those listed in the <option>trusted_groups</option>
3478 configuration option. Note that the Exim group is not automatically trusted.
3479 </para>
3480 <para>
3481 <indexterm role="concept">
3482 <primary><quote>From</quote> line</primary>
3483 </indexterm>
3484 <indexterm role="concept">
3485 <primary>envelope sender</primary>
3486 </indexterm>
3487 Trusted users are always permitted to use the <option>-f</option> option or a leading
3488 <quote>From&nbsp;</quote> line to specify the envelope sender of a message that is passed to
3489 Exim through the local interface (see the <option>-bm</option> and <option>-f</option> options below).
3490 See the <option>untrusted_set_sender</option> option for a way of permitting non-trusted
3491 users to set envelope senders.
3492 </para>
3493 <para>
3494 <indexterm role="concept">
3495 <primary><emphasis>From:</emphasis> header line</primary>
3496 </indexterm>
3497 <indexterm role="concept">
3498 <primary><emphasis>Sender:</emphasis> header line</primary>
3499 </indexterm>
3500 For a trusted user, there is never any check on the contents of the <emphasis>From:</emphasis>
3501 header line, and a <emphasis>Sender:</emphasis> line is never added. Furthermore, any existing
3502 <emphasis>Sender:</emphasis> line in incoming local (non-TCP/IP) messages is not removed.
3503 </para>
3504 <para>
3505 Trusted users may also specify a host name, host address, interface address,
3506 protocol name, ident value, and authentication data when submitting a message
3507 locally. Thus, they are able to insert messages into Exim&#x2019;s queue locally that
3508 have the characteristics of messages received from a remote host. Untrusted
3509 users may in some circumstances use <option>-f</option>, but can never set the other values
3510 that are available to trusted users.
3511 </para>
3512 </listitem>
3513 <listitem>
3514 <para>
3515 <indexterm role="concept">
3516 <primary>user</primary>
3517 <secondary>admin definition of</secondary>
3518 </indexterm>
3519 <indexterm role="concept">
3520 <primary>admin user</primary>
3521 <secondary>definition of</secondary>
3522 </indexterm>
3523 The admin users are root, the Exim user, and any user that is a member of the
3524 Exim group or of any group listed in the <option>admin_groups</option> configuration option.
3525 The current group does not have to be one of these groups.
3526 </para>
3527 <para>
3528 Admin users are permitted to list the queue, and to carry out certain
3529 operations on messages, for example, to force delivery failures. It is also
3530 necessary to be an admin user in order to see the full information provided by
3531 the Exim monitor, and full debugging output.
3532 </para>
3533 <para>
3534 By default, the use of the <option>-M</option>, <option>-q</option>, <option>-R</option>, and <option>-S</option> options to cause
3535 Exim to attempt delivery of messages on its queue is restricted to admin users.
3536 However, this restriction can be relaxed by setting the <option>prod_requires_admin</option>
3537 option false (that is, specifying <option>no_prod_requires_admin</option>).
3538 </para>
3539 <para>
3540 Similarly, the use of the <option>-bp</option> option to list all the messages in the queue
3541 is restricted to admin users unless <option>queue_list_requires_admin</option> is set
3542 false.
3543 </para>
3544 </listitem>
3545 </itemizedlist>
3546 <para>
3547 <emphasis role="bold">Warning</emphasis>: If you configure your system so that admin users are able to
3548 edit Exim&#x2019;s configuration file, you are giving those users an easy way of
3549 getting root. There is further discussion of this issue at the start of chapter
3550 <xref linkend="CHAPconf"/>.
3551 </para>
3552 </section>
3553 <section id="SECID39">
3554 <title>Command line options</title>
3555 <para>
3556 Exim&#x2019;s command line options are described in alphabetical order below. If none
3557 of the options that specifies a specific action (such as starting the daemon or
3558 a queue runner, or testing an address, or receiving a message in a specific
3559 format, or listing the queue) are present, and there is at least one argument
3560 on the command line, <option>-bm</option> (accept a local message on the standard input,
3561 with the arguments specifying the recipients) is assumed. Otherwise, Exim
3562 outputs a brief message about itself and exits.
3563 </para>
3564 <!-- === Start of command line options === -->
3565 <variablelist>
3566 <varlistentry>
3567 <term><option>--</option></term>
3568 <listitem>
3569 <para>
3570 <indexterm role="option">
3571 <primary>--</primary>
3572 </indexterm>
3573 <indexterm role="concept">
3574 <primary>options</primary>
3575 <secondary>command line; terminating</secondary>
3576 </indexterm>
3577 This is a pseudo-option whose only purpose is to terminate the options and
3578 therefore to cause subsequent command line items to be treated as arguments
3579 rather than options, even if they begin with hyphens.
3580 </para>
3581 </listitem></varlistentry>
3582 <varlistentry>
3583 <term><option>--help</option></term>
3584 <listitem>
3585 <para>
3586 <indexterm role="option">
3587 <primary><option>--help</option></primary>
3588 </indexterm>
3589 This option causes Exim to output a few sentences stating what it is.
3590 The same output is generated if the Exim binary is called with no options and
3591 no arguments.
3592 </para>
3593 </listitem></varlistentry>
3594 <varlistentry revisionflag="changed">
3595 <term><option>--version</option></term>
3596 <listitem>
3597 <para revisionflag="changed">
3598 <indexterm role="option">
3599 <primary><option>--version</option></primary>
3600 </indexterm>
3601 This option is an alias for <option>-bV</option> and causes version information to be
3602 displayed.
3603 </para>
3604 </listitem></varlistentry>
3605 <varlistentry>
3606 <term><option>-B</option>&lt;<emphasis>type</emphasis>&gt;</term>
3607 <listitem>
3608 <para>
3609 <indexterm role="option">
3610 <primary><option>-B</option></primary>
3611 </indexterm>
3612 <indexterm role="concept">
3613 <primary>8-bit characters</primary>
3614 </indexterm>
3615 <indexterm role="concept">
3616 <primary>Sendmail compatibility</primary>
3617 <secondary>8-bit characters</secondary>
3618 </indexterm>
3619 This is a Sendmail option for selecting 7 or 8 bit processing. Exim is 8-bit
3620 clean; it ignores this option.
3621 </para>
3622 </listitem></varlistentry>
3623 <varlistentry>
3624 <term><option>-bd</option></term>
3625 <listitem>
3626 <para>
3627 <indexterm role="option">
3628 <primary><option>-bd</option></primary>
3629 </indexterm>
3630 <indexterm role="concept">
3631 <primary>daemon</primary>
3632 </indexterm>
3633 <indexterm role="concept">
3634 <primary>SMTP</primary>
3635 <secondary>listener</secondary>
3636 </indexterm>
3637 <indexterm role="concept">
3638 <primary>queue runner</primary>
3639 </indexterm>
3640 This option runs Exim as a daemon, awaiting incoming SMTP connections. Usually
3641 the <option>-bd</option> option is combined with the <option>-q</option>&lt;<emphasis>time</emphasis>&gt; option, to specify
3642 that the daemon should also initiate periodic queue runs.
3643 </para>
3644 <para>
3645 The <option>-bd</option> option can be used only by an admin user. If either of the <option>-d</option>
3646 (debugging) or <option>-v</option> (verifying) options are set, the daemon does not
3647 disconnect from the controlling terminal. When running this way, it can be
3648 stopped by pressing ctrl-C.
3649 </para>
3650 <para>
3651 By default, Exim listens for incoming connections to the standard SMTP port on
3652 all the host&#x2019;s running interfaces. However, it is possible to listen on other
3653 ports, on multiple ports, and only on specific interfaces. Chapter
3654 <xref linkend="CHAPinterfaces"/> contains a description of the options that control this.
3655 </para>
3656 <para>
3657 When a listening daemon
3658 <indexterm role="concept">
3659 <primary>daemon</primary>
3660 <secondary>process id (pid)</secondary>
3661 </indexterm>
3662 <indexterm role="concept">
3663 <primary>pid (process id)</primary>
3664 <secondary>of daemon</secondary>
3665 </indexterm>
3666 is started without the use of <option>-oX</option> (that is, without overriding the normal
3667 configuration), it writes its process id to a file called <filename>exim-daemon.pid</filename>
3668 in Exim&#x2019;s spool directory. This location can be overridden by setting
3669 PID_FILE_PATH in <filename>Local/Makefile</filename>. The file is written while Exim is still
3670 running as root.
3671 </para>
3672 <para>
3673 When <option>-oX</option> is used on the command line to start a listening daemon, the
3674 process id is not written to the normal pid file path. However, <option>-oP</option> can be
3675 used to specify a path on the command line if a pid file is required.
3676 </para>
3677 <para>
3678 The SIGHUP signal
3679 <indexterm role="concept">
3680 <primary>SIGHUP</primary>
3681 </indexterm>
3682 <indexterm role="concept">
3683 <primary>daemon</primary>
3684 <secondary>restarting</secondary>
3685 </indexterm>
3686 can be used to cause the daemon to re-execute itself. This should be done
3687 whenever Exim&#x2019;s configuration file, or any file that is incorporated into it by
3688 means of the <option>.include</option> facility, is changed, and also whenever a new version
3689 of Exim is installed. It is not necessary to do this when other files that are
3690 referenced from the configuration (for example, alias files) are changed,
3691 because these are reread each time they are used.
3692 </para>
3693 </listitem></varlistentry>
3694 <varlistentry>
3695 <term><option>-bdf</option></term>
3696 <listitem>
3697 <para>
3698 <indexterm role="option">
3699 <primary><option>-bdf</option></primary>
3700 </indexterm>
3701 This option has the same effect as <option>-bd</option> except that it never disconnects
3702 from the controlling terminal, even when no debugging is specified.
3703 </para>
3704 </listitem></varlistentry>
3705 <varlistentry>
3706 <term><option>-be</option></term>
3707 <listitem>
3708 <para>
3709 <indexterm role="option">
3710 <primary><option>-be</option></primary>
3711 </indexterm>
3712 <indexterm role="concept">
3713 <primary>testing</primary>
3714 <secondary>string expansion</secondary>
3715 </indexterm>
3716 <indexterm role="concept">
3717 <primary>expansion</primary>
3718 <secondary>testing</secondary>
3719 </indexterm>
3720 Run Exim in expansion testing mode. Exim discards its root privilege, to
3721 prevent ordinary users from using this mode to read otherwise inaccessible
3722 files. If no arguments are given, Exim runs interactively, prompting for lines
3723 of data. Otherwise, it processes each argument in turn.
3724 </para>
3725 <para>
3726 If Exim was built with USE_READLINE=yes in <filename>Local/Makefile</filename>, it tries
3727 to load the <option>libreadline</option> library dynamically whenever the <option>-be</option> option is
3728 used without command line arguments. If successful, it uses the <function>readline()</function>
3729 function, which provides extensive line-editing facilities, for reading the
3730 test data. A line history is supported.
3731 </para>
3732 <para>
3733 Long expansion expressions can be split over several lines by using backslash
3734 continuations. As in Exim&#x2019;s run time configuration, white space at the start of
3735 continuation lines is ignored. Each argument or data line is passed through the
3736 string expansion mechanism, and the result is output. Variable values from the
3737 configuration file (for example, <varname>$qualify_domain</varname>) are available, but no
3738 message-specific values (such as <varname>$sender_domain</varname>) are set, because no message
3739 is being processed (but see <option>-bem</option> and <option>-Mset</option>).
3740 </para>
3741 <para>
3742 <emphasis role="bold">Note</emphasis>: If you use this mechanism to test lookups, and you change the data
3743 files or databases you are using, you must exit and restart Exim before trying
3744 the same lookup again. Otherwise, because each Exim process caches the results
3745 of lookups, you will just get the same result as before.
3746 </para>
3747 </listitem></varlistentry>
3748 <varlistentry>
3749 <term><option>-bem</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
3750 <listitem>
3751 <para>
3752 <indexterm role="option">
3753 <primary><option>-bem</option></primary>
3754 </indexterm>
3755 <indexterm role="concept">
3756 <primary>testing</primary>
3757 <secondary>string expansion</secondary>
3758 </indexterm>
3759 <indexterm role="concept">
3760 <primary>expansion</primary>
3761 <secondary>testing</secondary>
3762 </indexterm>
3763 This option operates like <option>-be</option> except that it must be followed by the name
3764 of a file. For example:
3765 </para>
3766 <literallayout class="monospaced">
3767 exim -bem /tmp/testmessage
3768 </literallayout>
3769 <para>
3770 The file is read as a message (as if receiving a locally-submitted non-SMTP
3771 message) before any of the test expansions are done. Thus, message-specific
3772 variables such as <varname>$message_size</varname> and <varname>$header_from:</varname> are available. However,
3773 no <emphasis>Received:</emphasis> header is added to the message. If the <option>-t</option> option is set,
3774 recipients are read from the headers in the normal way, and are shown in the
3775 <varname>$recipients</varname> variable. Note that recipients cannot be given on the command
3776 line, because further arguments are taken as strings to expand (just like
3777 <option>-be</option>).
3778 </para>
3779 </listitem></varlistentry>
3780 <varlistentry>
3781 <term><option>-bF</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
3782 <listitem>
3783 <para>
3784 <indexterm role="option">
3785 <primary><option>-bF</option></primary>
3786 </indexterm>
3787 <indexterm role="concept">
3788 <primary>system filter</primary>
3789 <secondary>testing</secondary>
3790 </indexterm>
3791 <indexterm role="concept">
3792 <primary>testing</primary>
3793 <secondary>system filter</secondary>
3794 </indexterm>
3795 This option is the same as <option>-bf</option> except that it assumes that the filter being
3796 tested is a system filter. The additional commands that are available only in
3797 system filters are recognized.
3798 </para>
3799 </listitem></varlistentry>
3800 <varlistentry>
3801 <term><option>-bf</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
3802 <listitem>
3803 <para>
3804 <indexterm role="option">
3805 <primary><option>-bf</option></primary>
3806 </indexterm>
3807 <indexterm role="concept">
3808 <primary>filter</primary>
3809 <secondary>testing</secondary>
3810 </indexterm>
3811 <indexterm role="concept">
3812 <primary>testing</primary>
3813 <secondary>filter file</secondary>
3814 </indexterm>
3815 <indexterm role="concept">
3816 <primary>forward file</primary>
3817 <secondary>testing</secondary>
3818 </indexterm>
3819 <indexterm role="concept">
3820 <primary>testing</primary>
3821 <secondary>forward file</secondary>
3822 </indexterm>
3823 <indexterm role="concept">
3824 <primary>Sieve filter</primary>
3825 <secondary>testing</secondary>
3826 </indexterm>
3827 This option runs Exim in user filter testing mode; the file is the filter file
3828 to be tested, and a test message must be supplied on the standard input. If
3829 there are no message-dependent tests in the filter, an empty file can be
3830 supplied.
3831 </para>
3832 <para>
3833 If you want to test a system filter file, use <option>-bF</option> instead of <option>-bf</option>. You
3834 can use both <option>-bF</option> and <option>-bf</option> on the same command, in order to test a system
3835 filter and a user filter in the same run. For example:
3836 </para>
3837 <literallayout class="monospaced">
3838 exim -bF /system/filter -bf /user/filter &lt;/test/message
3839 </literallayout>
3840 <para>
3841 This is helpful when the system filter adds header lines or sets filter
3842 variables that are used by the user filter.
3843 </para>
3844 <para>
3845 If the test filter file does not begin with one of the special lines
3846 </para>
3847 <literallayout class="monospaced">
3848 # Exim filter
3849 # Sieve filter
3850 </literallayout>
3851 <para>
3852 it is taken to be a normal <filename>.forward</filename> file, and is tested for validity under
3853 that interpretation. See sections <xref linkend="SECTitenonfilred"/> to
3854 <xref linkend="SECTspecitredli"/> for a description of the possible contents of non-filter
3855 redirection lists.
3856 </para>
3857 <para>
3858 The result of an Exim command that uses <option>-bf</option>, provided no errors are
3859 detected, is a list of the actions that Exim would try to take if presented
3860 with the message for real. More details of filter testing are given in the
3861 separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>.
3862 </para>
3863 <para>
3864 When testing a filter file,
3865 <indexterm role="concept">
3866 <primary><quote>From</quote> line</primary>
3867 </indexterm>
3868 <indexterm role="concept">
3869 <primary>envelope sender</primary>
3870 </indexterm>
3871 <indexterm role="option">
3872 <primary><option>-f</option></primary>
3873 <secondary>for filter testing</secondary>
3874 </indexterm>
3875 the envelope sender can be set by the <option>-f</option> option,
3876 or by a <quote>From&nbsp;</quote> line at the start of the test message. Various parameters
3877 that would normally be taken from the envelope recipient address of the message
3878 can be set by means of additional command line options (see the next four
3879 options).
3880 </para>
3881 </listitem></varlistentry>
3882 <varlistentry>
3883 <term><option>-bfd</option>&nbsp;&lt;<emphasis>domain</emphasis>&gt;</term>
3884 <listitem>
3885 <para>
3886 <indexterm role="option">
3887 <primary><option>-bfd</option></primary>
3888 </indexterm>
3889 <indexterm role="variable">
3890 <primary><varname>$qualify_domain</varname></primary>
3891 </indexterm>
3892 This sets the domain of the recipient address when a filter file is being
3893 tested by means of the <option>-bf</option> option. The default is the value of
3894 <varname>$qualify_domain</varname>.
3895 </para>
3896 </listitem></varlistentry>
3897 <varlistentry>
3898 <term><option>-bfl</option>&nbsp;&lt;<emphasis>local&nbsp;part</emphasis>&gt;</term>
3899 <listitem>
3900 <para>
3901 <indexterm role="option">
3902 <primary><option>-bfl</option></primary>
3903 </indexterm>
3904 This sets the local part of the recipient address when a filter file is being
3905 tested by means of the <option>-bf</option> option. The default is the username of the
3906 process that calls Exim. A local part should be specified with any prefix or
3907 suffix stripped, because that is how it appears to the filter when a message is
3908 actually being delivered.
3909 </para>
3910 </listitem></varlistentry>
3911 <varlistentry>
3912 <term><option>-bfp</option>&nbsp;&lt;<emphasis>prefix</emphasis>&gt;</term>
3913 <listitem>
3914 <para>
3915 <indexterm role="option">
3916 <primary><option>-bfp</option></primary>
3917 </indexterm>
3918 This sets the prefix of the local part of the recipient address when a filter
3919 file is being tested by means of the <option>-bf</option> option. The default is an empty
3920 prefix.
3921 </para>
3922 </listitem></varlistentry>
3923 <varlistentry>
3924 <term><option>-bfs</option>&nbsp;&lt;<emphasis>suffix</emphasis>&gt;</term>
3925 <listitem>
3926 <para>
3927 <indexterm role="option">
3928 <primary><option>-bfs</option></primary>
3929 </indexterm>
3930 This sets the suffix of the local part of the recipient address when a filter
3931 file is being tested by means of the <option>-bf</option> option. The default is an empty
3932 suffix.
3933 </para>
3934 </listitem></varlistentry>
3935 <varlistentry>
3936 <term><option>-bh</option>&nbsp;&lt;<emphasis>IP&nbsp;address</emphasis>&gt;</term>
3937 <listitem>
3938 <para>
3939 <indexterm role="option">
3940 <primary><option>-bh</option></primary>
3941 </indexterm>
3942 <indexterm role="concept">
3943 <primary>testing</primary>
3944 <secondary>incoming SMTP</secondary>
3945 </indexterm>
3946 <indexterm role="concept">
3947 <primary>SMTP</primary>
3948 <secondary>testing incoming</secondary>
3949 </indexterm>
3950 <indexterm role="concept">
3951 <primary>testing</primary>
3952 <secondary>relay control</secondary>
3953 </indexterm>
3954 <indexterm role="concept">
3955 <primary>relaying</primary>
3956 <secondary>testing configuration</secondary>
3957 </indexterm>
3958 <indexterm role="concept">
3959 <primary>policy control</primary>
3960 <secondary>testing</secondary>
3961 </indexterm>
3962 <indexterm role="concept">
3963 <primary>debugging</primary>
3964 <secondary><option>-bh</option> option</secondary>
3965 </indexterm>
3966 This option runs a fake SMTP session as if from the given IP address, using the
3967 standard input and output. The IP address may include a port number at the end,
3968 after a full stop. For example:
3969 </para>
3970 <literallayout class="monospaced">
3971 exim -bh 10.9.8.7.1234
3972 exim -bh fe80::a00:20ff:fe86:a061.5678
3973 </literallayout>
3974 <para>
3975 When an IPv6 address is given, it is converted into canonical form. In the case
3976 of the second example above, the value of <varname>$sender_host_address</varname> after
3977 conversion to the canonical form is
3978 <literal>fe80:0000:0000:0a00:20ff:fe86:a061.5678</literal>.
3979 </para>
3980 <para>
3981 Comments as to what is going on are written to the standard error file. These
3982 include lines beginning with <quote>LOG</quote> for anything that would have been logged.
3983 This facility is provided for testing configuration options for incoming
3984 messages, to make sure they implement the required policy. For example, you can
3985 test your relay controls using <option>-bh</option>.
3986 </para>
3987 <para>
3988 <emphasis role="bold">Warning 1</emphasis>:
3989 <indexterm role="concept">
3990 <primary>RFC 1413</primary>
3991 </indexterm>
3992 You can test features of the configuration that rely on ident (RFC 1413)
3993 information by using the <option>-oMt</option> option. However, Exim cannot actually perform
3994 an ident callout when testing using <option>-bh</option> because there is no incoming SMTP
3995 connection.
3996 </para>
3997 <para>
3998 <emphasis role="bold">Warning 2</emphasis>: Address verification callouts (see section <xref linkend="SECTcallver"/>)
3999 are also skipped when testing using <option>-bh</option>. If you want these callouts to
4000 occur, use <option>-bhc</option> instead.
4001 </para>
4002 <para>
4003 Messages supplied during the testing session are discarded, and nothing is
4004 written to any of the real log files. There may be pauses when DNS (and other)
4005 lookups are taking place, and of course these may time out. The <option>-oMi</option> option
4006 can be used to specify a specific IP interface and port if this is important,
4007 and <option>-oMaa</option> and <option>-oMai</option> can be used to set parameters as if the SMTP
4008 session were authenticated.
4009 </para>
4010 <para>
4011 The <emphasis>exim_checkaccess</emphasis> utility is a <quote>packaged</quote> version of <option>-bh</option> whose
4012 output just states whether a given recipient address from a given host is
4013 acceptable or not. See section <xref linkend="SECTcheckaccess"/>.
4014 </para>
4015 <para>
4016 Features such as authentication and encryption, where the client input is not
4017 plain text, cannot easily be tested with <option>-bh</option>. Instead, you should use a
4018 specialized SMTP test program such as
4019 <emphasis role="bold"><ulink url="http://jetmore.org/john/code/#swaks">swaks</ulink></emphasis>.
4020 </para>
4021 </listitem></varlistentry>
4022 <varlistentry>
4023 <term><option>-bhc</option>&nbsp;&lt;<emphasis>IP&nbsp;address</emphasis>&gt;</term>
4024 <listitem>
4025 <para>
4026 <indexterm role="option">
4027 <primary><option>-bhc</option></primary>
4028 </indexterm>
4029 This option operates in the same way as <option>-bh</option>, except that address
4030 verification callouts are performed if required. This includes consulting and
4031 updating the callout cache database.
4032 </para>
4033 </listitem></varlistentry>
4034 <varlistentry>
4035 <term><option>-bi</option></term>
4036 <listitem>
4037 <para>
4038 <indexterm role="option">
4039 <primary><option>-bi</option></primary>
4040 </indexterm>
4041 <indexterm role="concept">
4042 <primary>alias file</primary>
4043 <secondary>building</secondary>
4044 </indexterm>
4045 <indexterm role="concept">
4046 <primary>building alias file</primary>
4047 </indexterm>
4048 <indexterm role="concept">
4049 <primary>Sendmail compatibility</primary>
4050 <secondary><option>-bi</option> option</secondary>
4051 </indexterm>
4052 Sendmail interprets the <option>-bi</option> option as a request to rebuild its alias file.
4053 Exim does not have the concept of a single alias file, and so it cannot mimic
4054 this behaviour. However, calls to <filename>/usr/lib/sendmail</filename> with the <option>-bi</option> option
4055 tend to appear in various scripts such as NIS make files, so the option must be
4056 recognized.
4057 </para>
4058 <para>
4059 If <option>-bi</option> is encountered, the command specified by the <option>bi_command</option>
4060 configuration option is run, under the uid and gid of the caller of Exim. If
4061 the <option>-oA</option> option is used, its value is passed to the command as an argument.
4062 The command set by <option>bi_command</option> may not contain arguments. The command can
4063 use the <emphasis>exim_dbmbuild</emphasis> utility, or some other means, to rebuild alias files
4064 if this is required. If the <option>bi_command</option> option is not set, calling Exim with
4065 <option>-bi</option> is a no-op.
4066 </para>
4067 </listitem></varlistentry>
4068 <varlistentry>
4069 <term><option>-bm</option></term>
4070 <listitem>
4071 <para>
4072 <indexterm role="option">
4073 <primary><option>-bm</option></primary>
4074 </indexterm>
4075 <indexterm role="concept">
4076 <primary>local message reception</primary>
4077 </indexterm>
4078 This option runs an Exim receiving process that accepts an incoming,
4079 locally-generated message on the current input. The recipients are given as the
4080 command arguments (except when <option>-t</option> is also present &ndash; see below). Each
4081 argument can be a comma-separated list of RFC 2822 addresses. This is the
4082 default option for selecting the overall action of an Exim call; it is assumed
4083 if no other conflicting option is present.
4084 </para>
4085 <para>
4086 If any addresses in the message are unqualified (have no domain), they are
4087 qualified by the values of the <option>qualify_domain</option> or <option>qualify_recipient</option>
4088 options, as appropriate. The <option>-bnq</option> option (see below) provides a way of
4089 suppressing this for special cases.
4090 </para>
4091 <para>
4092 Policy checks on the contents of local messages can be enforced by means of
4093 the non-SMTP ACL. See chapter <xref linkend="CHAPACL"/> for details.
4094 </para>
4095 <para>
4096 <indexterm role="concept">
4097 <primary>return code</primary>
4098 <secondary>for <option>-bm</option></secondary>
4099 </indexterm>
4100 The return code is zero if the message is successfully accepted. Otherwise, the
4101 action is controlled by the <option>-oe</option><emphasis>x</emphasis> option setting &ndash; see below.
4102 </para>
4103 <para>
4104 The format
4105 <indexterm role="concept">
4106 <primary>message</primary>
4107 <secondary>format</secondary>
4108 </indexterm>
4109 <indexterm role="concept">
4110 <primary>format</primary>
4111 <secondary>message</secondary>
4112 </indexterm>
4113 <indexterm role="concept">
4114 <primary><quote>From</quote> line</primary>
4115 </indexterm>
4116 <indexterm role="concept">
4117 <primary>UUCP</primary>
4118 <secondary><quote>From</quote> line</secondary>
4119 </indexterm>
4120 <indexterm role="concept">
4121 <primary>Sendmail compatibility</primary>
4122 <secondary><quote>From</quote> line</secondary>
4123 </indexterm>
4124 of the message must be as defined in RFC 2822, except that, for
4125 compatibility with Sendmail and Smail, a line in one of the forms
4126 </para>
4127 <literallayout class="monospaced">
4128 From sender Fri Jan  5 12:55 GMT 1997
4129 From sender Fri, 5 Jan 97 12:55:01
4130 </literallayout>
4131 <para>
4132 (with the weekday optional, and possibly with additional text after the date)
4133 is permitted to appear at the start of the message. There appears to be no
4134 authoritative specification of the format of this line. Exim recognizes it by
4135 matching against the regular expression defined by the <option>uucp_from_pattern</option>
4136 option, which can be changed if necessary.
4137 </para>
4138 <para>
4139 <indexterm role="option">
4140 <primary><option>-f</option></primary>
4141 <secondary>overriding <quote>From</quote> line</secondary>
4142 </indexterm>
4143 The specified sender is treated as if it were given as the argument to the
4144 <option>-f</option> option, but if a <option>-f</option> option is also present, its argument is used in
4145 preference to the address taken from the message. The caller of Exim must be a
4146 trusted user for the sender of a message to be set in this way.
4147 </para>
4148 </listitem></varlistentry>
4149 <varlistentry>
4150 <term><option>-bnq</option></term>
4151 <listitem>
4152 <para>
4153 <indexterm role="option">
4154 <primary><option>-bnq</option></primary>
4155 </indexterm>
4156 <indexterm role="concept">
4157 <primary>address qualification, suppressing</primary>
4158 </indexterm>
4159 By default, Exim automatically qualifies unqualified addresses (those
4160 without domains) that appear in messages that are submitted locally (that
4161 is, not over TCP/IP). This qualification applies both to addresses in
4162 envelopes, and addresses in header lines. Sender addresses are qualified using
4163 <option>qualify_domain</option>, and recipient addresses using <option>qualify_recipient</option> (which
4164 defaults to the value of <option>qualify_domain</option>).
4165 </para>
4166 <para>
4167 Sometimes, qualification is not wanted. For example, if <option>-bS</option> (batch SMTP) is
4168 being used to re-submit messages that originally came from remote hosts after
4169 content scanning, you probably do not want to qualify unqualified addresses in
4170 header lines. (Such lines will be present only if you have not enabled a header
4171 syntax check in the appropriate ACL.)
4172 </para>
4173 <para>
4174 The <option>-bnq</option> option suppresses all qualification of unqualified addresses in
4175 messages that originate on the local host. When this is used, unqualified
4176 addresses in the envelope provoke errors (causing message rejection) and
4177 unqualified addresses in header lines are left alone.
4178 </para>
4179 </listitem></varlistentry>
4180 <varlistentry>
4181 <term><option>-bP</option></term>
4182 <listitem>
4183 <para>
4184 <indexterm role="option">
4185 <primary><option>-bP</option></primary>
4186 </indexterm>
4187 <indexterm role="concept">
4188 <primary>configuration options</primary>
4189 <secondary>extracting</secondary>
4190 </indexterm>
4191 <indexterm role="concept">
4192 <primary>options</primary>
4193 <secondary>configuration &ndash; extracting</secondary>
4194 </indexterm>
4195 If this option is given with no arguments, it causes the values of all Exim&#x2019;s
4196 main configuration options to be written to the standard output. The values
4197 of one or more specific options can be requested by giving their names as
4198 arguments, for example:
4199 </para>
4200 <literallayout class="monospaced">
4201 exim -bP qualify_domain hold_domains
4202 </literallayout>
4203 <para>
4204 <indexterm role="concept">
4205 <primary>hiding configuration option values</primary>
4206 </indexterm>
4207 <indexterm role="concept">
4208 <primary>configuration options</primary>
4209 <secondary>hiding value of</secondary>
4210 </indexterm>
4211 <indexterm role="concept">
4212 <primary>options</primary>
4213 <secondary>hiding value of</secondary>
4214 </indexterm>
4215 However, any option setting that is preceded by the word <quote>hide</quote> in the
4216 configuration file is not shown in full, except to an admin user. For other
4217 users, the output is as in this example:
4218 </para>
4219 <literallayout class="monospaced">
4220 mysql_servers = &lt;value not displayable&gt;
4221 </literallayout>
4222 <para>
4223 If <option>configure_file</option> is given as an argument, the name of the run time
4224 configuration file is output.
4225 If a list of configuration files was supplied, the value that is output here
4226 is the name of the file that was actually used.
4227 </para>
4228 <para>
4229 <indexterm role="concept">
4230 <primary>daemon</primary>
4231 <secondary>process id (pid)</secondary>
4232 </indexterm>
4233 <indexterm role="concept">
4234 <primary>pid (process id)</primary>
4235 <secondary>of daemon</secondary>
4236 </indexterm>
4237 If <option>log_file_path</option> or <option>pid_file_path</option> are given, the names of the
4238 directories where log files and daemon pid files are written are output,
4239 respectively. If these values are unset, log files are written in a
4240 sub-directory of the spool directory called <option>log</option>, and the pid file is
4241 written directly into the spool directory.
4242 </para>
4243 <para>
4244 If <option>-bP</option> is followed by a name preceded by <literal>+</literal>, for example,
4245 </para>
4246 <literallayout class="monospaced">
4247 exim -bP +local_domains
4248 </literallayout>
4249 <para>
4250 it searches for a matching named list of any type (domain, host, address, or
4251 local part) and outputs what it finds.
4252 </para>
4253 <para>
4254 <indexterm role="concept">
4255 <primary>options</primary>
4256 <secondary>router &ndash; extracting</secondary>
4257 </indexterm>
4258 <indexterm role="concept">
4259 <primary>options</primary>
4260 <secondary>transport &ndash; extracting</secondary>
4261 </indexterm>
4262 <indexterm role="concept">
4263 <primary>options</primary>
4264 <secondary>authenticator &ndash; extracting</secondary>
4265 </indexterm>
4266 If one of the words <option>router</option>, <option>transport</option>, or <option>authenticator</option> is given,
4267 followed by the name of an appropriate driver instance, the option settings for
4268 that driver are output. For example:
4269 </para>
4270 <literallayout class="monospaced">
4271 exim -bP transport local_delivery
4272 </literallayout>
4273 <para>
4274 The generic driver options are output first, followed by the driver&#x2019;s private
4275 options. A list of the names of drivers of a particular type can be obtained by
4276 using one of the words <option>router_list</option>, <option>transport_list</option>, or
4277 <option>authenticator_list</option>, and a complete list of all drivers with their option
4278 settings can be obtained by using <option>routers</option>, <option>transports</option>, or
4279 <option>authenticators</option>.
4280 </para>
4281 <para>
4282 <indexterm role="concept">
4283 <primary>options</primary>
4284 <secondary>macro &ndash; extracting</secondary>
4285 </indexterm>
4286 If invoked by an admin user, then <option>macro</option>, <option>macro_list</option> and <option>macros</option>
4287 are available, similarly to the drivers.  Because macros are sometimes used
4288 for storing passwords, this option is restricted.
4289 The output format is one item per line.
4290 </para>
4291 </listitem></varlistentry>
4292 <varlistentry>
4293 <term><option>-bp</option></term>
4294 <listitem>
4295 <para>
4296 <indexterm role="option">
4297 <primary><option>-bp</option></primary>
4298 </indexterm>
4299 <indexterm role="concept">
4300 <primary>queue</primary>
4301 <secondary>listing messages on</secondary>
4302 </indexterm>
4303 <indexterm role="concept">
4304 <primary>listing</primary>
4305 <secondary>messages on the queue</secondary>
4306 </indexterm>
4307 This option requests a listing of the contents of the mail queue on the
4308 standard output. If the <option>-bp</option> option is followed by a list of message ids,
4309 just those messages are listed. By default, this option can be used only by an
4310 admin user. However, the <option>queue_list_requires_admin</option> option can be set false
4311 to allow any user to see the queue.
4312 </para>
4313 <para>
4314 Each message on the queue is displayed as in the following example:
4315 </para>
4316 <literallayout class="monospaced">
4317 25m  2.9K 0t5C6f-0000c8-00 &lt;alice@wonderland.fict.example&gt;
4318           red.king@looking-glass.fict.example
4319           &lt;other addresses&gt;
4320 </literallayout>
4321 <para>
4322 <indexterm role="concept">
4323 <primary>message</primary>
4324 <secondary>size in queue listing</secondary>
4325 </indexterm>
4326 <indexterm role="concept">
4327 <primary>size</primary>
4328 <secondary>of message</secondary>
4329 </indexterm>
4330 The first line contains the length of time the message has been on the queue
4331 (in this case 25 minutes), the size of the message (2.9K), the unique local
4332 identifier for the message, and the message sender, as contained in the
4333 envelope. For bounce messages, the sender address is empty, and appears as
4334 <quote>&lt;&gt;</quote>. If the message was submitted locally by an untrusted user who overrode
4335 the default sender address, the user&#x2019;s login name is shown in parentheses
4336 before the sender address.
4337 </para>
4338 <para>
4339 <indexterm role="concept">
4340 <primary>frozen messages</primary>
4341 <secondary>in queue listing</secondary>
4342 </indexterm>
4343 If the message is frozen (attempts to deliver it are suspended) then the text
4344 <quote>*** frozen ***</quote> is displayed at the end of this line.
4345 </para>
4346 <para>
4347 The recipients of the message (taken from the envelope, not the headers) are
4348 displayed on subsequent lines. Those addresses to which the message has already
4349 been delivered are marked with the letter D. If an original address gets
4350 expanded into several addresses via an alias or forward file, the original is
4351 displayed with a D only when deliveries for all of its child addresses are
4352 complete.
4353 </para>
4354 </listitem></varlistentry>
4355 <varlistentry>
4356 <term><option>-bpa</option></term>
4357 <listitem>
4358 <para>
4359 <indexterm role="option">
4360 <primary><option>-bpa</option></primary>
4361 </indexterm>
4362 This option operates like <option>-bp</option>, but in addition it shows delivered addresses
4363 that were generated from the original top level address(es) in each message by
4364 alias or forwarding operations. These addresses are flagged with <quote>+D</quote> instead
4365 of just <quote>D</quote>.
4366 </para>
4367 </listitem></varlistentry>
4368 <varlistentry>
4369 <term><option>-bpc</option></term>
4370 <listitem>
4371 <para>
4372 <indexterm role="option">
4373 <primary><option>-bpc</option></primary>
4374 </indexterm>
4375 <indexterm role="concept">
4376 <primary>queue</primary>
4377 <secondary>count of messages on</secondary>
4378 </indexterm>
4379 This option counts the number of messages on the queue, and writes the total
4380 to the standard output. It is restricted to admin users, unless
4381 <option>queue_list_requires_admin</option> is set false.
4382 </para>
4383 </listitem></varlistentry>
4384 <varlistentry>
4385 <term><option>-bpr</option></term>
4386 <listitem>
4387 <para>
4388 <indexterm role="option">
4389 <primary><option>-bpr</option></primary>
4390 </indexterm>
4391 This option operates like <option>-bp</option>, but the output is not sorted into
4392 chronological order of message arrival. This can speed it up when there are
4393 lots of messages on the queue, and is particularly useful if the output is
4394 going to be post-processed in a way that doesn&#x2019;t need the sorting.
4395 </para>
4396 </listitem></varlistentry>
4397 <varlistentry>
4398 <term><option>-bpra</option></term>
4399 <listitem>
4400 <para>
4401 <indexterm role="option">
4402 <primary><option>-bpra</option></primary>
4403 </indexterm>
4404 This option is a combination of <option>-bpr</option> and <option>-bpa</option>.
4405 </para>
4406 </listitem></varlistentry>
4407 <varlistentry>
4408 <term><option>-bpru</option></term>
4409 <listitem>
4410 <para>
4411 <indexterm role="option">
4412 <primary><option>-bpru</option></primary>
4413 </indexterm>
4414 This option is a combination of <option>-bpr</option> and <option>-bpu</option>.
4415 </para>
4416 </listitem></varlistentry>
4417 <varlistentry>
4418 <term><option>-bpu</option></term>
4419 <listitem>
4420 <para>
4421 <indexterm role="option">
4422 <primary><option>-bpu</option></primary>
4423 </indexterm>
4424 This option operates like <option>-bp</option> but shows only undelivered top-level
4425 addresses for each message displayed. Addresses generated by aliasing or
4426 forwarding are not shown, unless the message was deferred after processing by a
4427 router with the <option>one_time</option> option set.
4428 </para>
4429 </listitem></varlistentry>
4430 <varlistentry>
4431 <term><option>-brt</option></term>
4432 <listitem>
4433 <para>
4434 <indexterm role="option">
4435 <primary><option>-brt</option></primary>
4436 </indexterm>
4437 <indexterm role="concept">
4438 <primary>testing</primary>
4439 <secondary>retry configuration</secondary>
4440 </indexterm>
4441 <indexterm role="concept">
4442 <primary>retry</primary>
4443 <secondary>configuration testing</secondary>
4444 </indexterm>
4445 This option is for testing retry rules, and it must be followed by up to three
4446 arguments. It causes Exim to look for a retry rule that matches the values
4447 and to write it to the standard output. For example:
4448 </para>
4449 <literallayout class="monospaced">
4450 exim -brt bach.comp.mus.example
4451 Retry rule: *.comp.mus.example  F,2h,15m; F,4d,30m;
4452 </literallayout>
4453 <para>
4454 See chapter <xref linkend="CHAPretry"/> for a description of Exim&#x2019;s retry rules. The first
4455 argument, which is required, can be a complete address in the form
4456 <emphasis>local_part@domain</emphasis>, or it can be just a domain name. If the second argument
4457 contains a dot, it is interpreted as an optional second domain name; if no
4458 retry rule is found for the first argument, the second is tried. This ties in
4459 with Exim&#x2019;s behaviour when looking for retry rules for remote hosts &ndash; if no
4460 rule is found that matches the host, one that matches the mail domain is
4461 sought. Finally, an argument that is the name of a specific delivery error, as
4462 used in setting up retry rules, can be given. For example:
4463 </para>
4464 <literallayout class="monospaced">
4465 exim -brt haydn.comp.mus.example quota_3d
4466 Retry rule: *@haydn.comp.mus.example quota_3d  F,1h,15m
4467 </literallayout>
4468 </listitem></varlistentry>
4469 <varlistentry>
4470 <term><option>-brw</option></term>
4471 <listitem>
4472 <para>
4473 <indexterm role="option">
4474 <primary><option>-brw</option></primary>
4475 </indexterm>
4476 <indexterm role="concept">
4477 <primary>testing</primary>
4478 <secondary>rewriting</secondary>
4479 </indexterm>
4480 <indexterm role="concept">
4481 <primary>rewriting</primary>
4482 <secondary>testing</secondary>
4483 </indexterm>
4484 This option is for testing address rewriting rules, and it must be followed by
4485 a single argument, consisting of either a local part without a domain, or a
4486 complete address with a fully qualified domain. Exim outputs how this address
4487 would be rewritten for each possible place it might appear. See chapter
4488 <xref linkend="CHAPrewrite"/> for further details.
4489 </para>
4490 </listitem></varlistentry>
4491 <varlistentry>
4492 <term><option>-bS</option></term>
4493 <listitem>
4494 <para>
4495 <indexterm role="option">
4496 <primary><option>-bS</option></primary>
4497 </indexterm>
4498 <indexterm role="concept">
4499 <primary>SMTP</primary>
4500 <secondary>batched incoming</secondary>
4501 </indexterm>
4502 <indexterm role="concept">
4503 <primary>batched SMTP input</primary>
4504 </indexterm>
4505 This option is used for batched SMTP input, which is an alternative interface
4506 for non-interactive local message submission. A number of messages can be
4507 submitted in a single run. However, despite its name, this is not really SMTP
4508 input. Exim reads each message&#x2019;s envelope from SMTP commands on the standard
4509 input, but generates no responses. If the caller is trusted, or
4510 <option>untrusted_set_sender</option> is set, the senders in the SMTP MAIL commands are
4511 believed; otherwise the sender is always the caller of Exim.
4512 </para>
4513 <para>
4514 The message itself is read from the standard input, in SMTP format (leading
4515 dots doubled), terminated by a line containing just a single dot. An error is
4516 provoked if the terminating dot is missing. A further message may then follow.
4517 </para>
4518 <para>
4519 As for other local message submissions, the contents of incoming batch SMTP
4520 messages can be checked using the non-SMTP ACL (see chapter <xref linkend="CHAPACL"/>).
4521 Unqualified addresses are automatically qualified using <option>qualify_domain</option> and
4522 <option>qualify_recipient</option>, as appropriate, unless the <option>-bnq</option> option is used.
4523 </para>
4524 <para>
4525 Some other SMTP commands are recognized in the input. HELO and EHLO act
4526 as RSET; VRFY, EXPN, ETRN, and HELP act as NOOP;
4527 QUIT quits, ignoring the rest of the standard input.
4528 </para>
4529 <para>
4530 <indexterm role="concept">
4531 <primary>return code</primary>
4532 <secondary>for <option>-bS</option></secondary>
4533 </indexterm>
4534 If any error is encountered, reports are written to the standard output and
4535 error streams, and Exim gives up immediately. The return code is 0 if no error
4536 was detected; it is 1 if one or more messages were accepted before the error
4537 was detected; otherwise it is 2.
4538 </para>
4539 <para>
4540 More details of input using batched SMTP are given in section
4541 <xref linkend="SECTincomingbatchedSMTP"/>.
4542 </para>
4543 </listitem></varlistentry>
4544 <varlistentry>
4545 <term><option>-bs</option></term>
4546 <listitem>
4547 <para>
4548 <indexterm role="option">
4549 <primary><option>-bs</option></primary>
4550 </indexterm>
4551 <indexterm role="concept">
4552 <primary>SMTP</primary>
4553 <secondary>local input</secondary>
4554 </indexterm>
4555 <indexterm role="concept">
4556 <primary>local SMTP input</primary>
4557 </indexterm>
4558 This option causes Exim to accept one or more messages by reading SMTP commands
4559 on the standard input, and producing SMTP replies on the standard output. SMTP
4560 policy controls, as defined in ACLs (see chapter <xref linkend="CHAPACL"/>) are applied.
4561 Some user agents use this interface as a way of passing locally-generated
4562 messages to the MTA.
4563 </para>
4564 <para>
4565 In
4566 <indexterm role="concept">
4567 <primary>sender</primary>
4568 <secondary>source of</secondary>
4569 </indexterm>
4570 this usage, if the caller of Exim is trusted, or <option>untrusted_set_sender</option> is
4571 set, the senders of messages are taken from the SMTP MAIL commands.
4572 Otherwise the content of these commands is ignored and the sender is set up as
4573 the calling user. Unqualified addresses are automatically qualified using
4574 <option>qualify_domain</option> and <option>qualify_recipient</option>, as appropriate, unless the
4575 <option>-bnq</option> option is used.
4576 </para>
4577 <para>
4578 <indexterm role="concept">
4579 <primary>inetd</primary>
4580 </indexterm>
4581 The
4582 <option>-bs</option> option is also used to run Exim from <emphasis>inetd</emphasis>, as an alternative to
4583 using a listening daemon. Exim can distinguish the two cases by checking
4584 whether the standard input is a TCP/IP socket. When Exim is called from
4585 <emphasis>inetd</emphasis>, the source of the mail is assumed to be remote, and the comments
4586 above concerning senders and qualification do not apply. In this situation,
4587 Exim behaves in exactly the same way as it does when receiving a message via
4588 the listening daemon.
4589 </para>
4590 </listitem></varlistentry>
4591 <varlistentry revisionflag="changed">
4592 <term><option>-bmalware</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
4593 <listitem>
4594 <para revisionflag="changed">
4595 <indexterm role="option">
4596 <primary><option>-bmalware</option></primary>
4597 </indexterm>
4598 <indexterm role="concept">
4599 <primary>testing</primary>
4600 <secondary>,</secondary>
4601 </indexterm>
4602 <indexterm role="concept">
4603 <primary>malware scan test</primary>
4604 </indexterm>
4605 This debugging option causes Exim to scan the given file,
4606 using the malware scanning framework.  The option of <option>av_scanner</option> influences
4607 this option, so if <option>av_scanner</option>&#x2019;s value is dependent upon an expansion then
4608 the expansion should have defaults which apply to this invocation.  ACLs are
4609 not invoked, so if <option>av_scanner</option> references an ACL variable then that variable
4610 will never be populated and <option>-bmalware</option> will fail.
4611 </para>
4612 <para revisionflag="changed">
4613 Exim will have changed working directory before resolving the filename, so
4614 using fully qualified pathnames is advisable.  Exim will be running as the Exim
4615 user when it tries to open the file, rather than as the invoking user.
4616 This option requires admin privileges.
4617 </para>
4618 <para revisionflag="changed">
4619 The <option>-bmalware</option> option will not be extended to be more generally useful,
4620 there are better tools for file-scanning.  This option exists to help
4621 administrators verify their Exim and AV scanner configuration.
4622 </para>
4623 </listitem></varlistentry>
4624 <varlistentry>
4625 <term><option>-bt</option></term>
4626 <listitem>
4627 <para>
4628 <indexterm role="option">
4629 <primary><option>-bt</option></primary>
4630 </indexterm>
4631 <indexterm role="concept">
4632 <primary>testing</primary>
4633 <secondary>addresses</secondary>
4634 </indexterm>
4635 <indexterm role="concept">
4636 <primary>address</primary>
4637 <secondary>testing</secondary>
4638 </indexterm>
4639 This option runs Exim in address testing mode, in which each argument is taken
4640 as a recipient address to be tested for deliverability. The results are
4641 written to the standard output. If a test fails, and the caller is not an admin
4642 user, no details of the failure are output, because these might contain
4643 sensitive information such as usernames and passwords for database lookups.
4644 </para>
4645 <para>
4646 If no arguments are given, Exim runs in an interactive manner, prompting with a
4647 right angle bracket for addresses to be tested.
4648 </para>
4649 <para>
4650 Unlike the <option>-be</option> test option, you cannot arrange for Exim to use the
4651 <function>readline()</function> function, because it is running as <emphasis>root</emphasis> and there are
4652 security issues.
4653 </para>
4654 <para>
4655 Each address is handled as if it were the recipient address of a message
4656 (compare the <option>-bv</option> option). It is passed to the routers and the result is
4657 written to the standard output. However, any router that has
4658 <option>no_address_test</option> set is bypassed. This can make <option>-bt</option> easier to use for
4659 genuine routing tests if your first router passes everything to a scanner
4660 program.
4661 </para>
4662 <para>
4663 <indexterm role="concept">
4664 <primary>return code</primary>
4665 <secondary>for <option>-bt</option></secondary>
4666 </indexterm>
4667 The return code is 2 if any address failed outright; it is 1 if no address
4668 failed outright but at least one could not be resolved for some reason. Return
4669 code 0 is given only when all addresses succeed.
4670 </para>
4671 <para>
4672 <indexterm role="concept">
4673 <primary>duplicate addresses</primary>
4674 </indexterm>
4675 <emphasis role="bold">Note</emphasis>: When actually delivering a message, Exim removes duplicate recipient
4676 addresses after routing is complete, so that only one delivery takes place.
4677 This does not happen when testing with <option>-bt</option>; the full results of routing are
4678 always shown.
4679 </para>
4680 <para>
4681 <emphasis role="bold">Warning</emphasis>: <option>-bt</option> can only do relatively simple testing. If any of the
4682 routers in the configuration makes any tests on the sender address of a
4683 message,
4684 <indexterm role="option">
4685 <primary><option>-f</option></primary>
4686 <secondary>for address testing</secondary>
4687 </indexterm>
4688 you can use the <option>-f</option> option to set an appropriate sender when running
4689 <option>-bt</option> tests. Without it, the sender is assumed to be the calling user at the
4690 default qualifying domain. However, if you have set up (for example) routers
4691 whose behaviour depends on the contents of an incoming message, you cannot test
4692 those conditions using <option>-bt</option>. The <option>-N</option> option provides a possible way of
4693 doing such tests.
4694 </para>
4695 </listitem></varlistentry>
4696 <varlistentry revisionflag="changed">
4697 <term><option>-bV</option></term>
4698 <listitem>
4699 <para revisionflag="changed">
4700 <indexterm role="option">
4701 <primary><option>-bV</option></primary>
4702 </indexterm>
4703 <indexterm role="concept">
4704 <primary>version number of Exim</primary>
4705 </indexterm>
4706 This option causes Exim to write the current version number, compilation
4707 number, and compilation date of the <emphasis>exim</emphasis> binary to the standard output.
4708 It also lists the DBM library that is being used, the optional modules (such as
4709 specific lookup types), the drivers that are included in the binary, and the
4710 name of the run time configuration file that is in use.
4711 </para>
4712 <para>
4713 As part of its operation, <option>-bV</option> causes Exim to read and syntax check its
4714 configuration file. However, this is a static check only. It cannot check
4715 values that are to be expanded. For example, although a misspelt ACL verb is
4716 detected, an error in the verb&#x2019;s arguments is not. You cannot rely on <option>-bV</option>
4717 alone to discover (for example) all the typos in the configuration; some
4718 realistic testing is needed. The <option>-bh</option> and <option>-N</option> options provide more
4719 dynamic testing facilities.
4720 </para>
4721 </listitem></varlistentry>
4722 <varlistentry>
4723 <term><option>-bv</option></term>
4724 <listitem>
4725 <para>
4726 <indexterm role="option">
4727 <primary><option>-bv</option></primary>
4728 </indexterm>
4729 <indexterm role="concept">
4730 <primary>verifying address</primary>
4731 <secondary>using <option>-bv</option></secondary>
4732 </indexterm>
4733 <indexterm role="concept">
4734 <primary>address</primary>
4735 <secondary>verification</secondary>
4736 </indexterm>
4737 This option runs Exim in address verification mode, in which each argument is
4738 taken as a recipient address to be verified by the routers. (This does
4739 not involve any verification callouts). During normal operation, verification
4740 happens mostly as a consequence processing a <option>verify</option> condition in an ACL
4741 (see chapter <xref linkend="CHAPACL"/>). If you want to test an entire ACL, possibly
4742 including callouts, see the <option>-bh</option> and <option>-bhc</option> options.
4743 </para>
4744 <para>
4745 If verification fails, and the caller is not an admin user, no details of the
4746 failure are output, because these might contain sensitive information such as
4747 usernames and passwords for database lookups.
4748 </para>
4749 <para>
4750 If no arguments are given, Exim runs in an interactive manner, prompting with a
4751 right angle bracket for addresses to be verified.
4752 </para>
4753 <para>
4754 Unlike the <option>-be</option> test option, you cannot arrange for Exim to use the
4755 <function>readline()</function> function, because it is running as <emphasis>exim</emphasis> and there are
4756 security issues.
4757 </para>
4758 <para>
4759 Verification differs from address testing (the <option>-bt</option> option) in that routers
4760 that have <option>no_verify</option> set are skipped, and if the address is accepted by a
4761 router that has <option>fail_verify</option> set, verification fails. The address is
4762 verified as a recipient if <option>-bv</option> is used; to test verification for a sender
4763 address, <option>-bvs</option> should be used.
4764 </para>
4765 <para>
4766 If the <option>-v</option> option is not set, the output consists of a single line for each
4767 address, stating whether it was verified or not, and giving a reason in the
4768 latter case. Without <option>-v</option>, generating more than one address by redirection
4769 causes verification to end successfully, without considering the generated
4770 addresses. However, if just one address is generated, processing continues,
4771 and the generated address must verify successfully for the overall verification
4772 to succeed.
4773 </para>
4774 <para>
4775 When <option>-v</option> is set, more details are given of how the address has been handled,
4776 and in the case of address redirection, all the generated addresses are also
4777 considered. Verification may succeed for some and fail for others.
4778 </para>
4779 <para>
4780 The
4781 <indexterm role="concept">
4782 <primary>return code</primary>
4783 <secondary>for <option>-bv</option></secondary>
4784 </indexterm>
4785 return code is 2 if any address failed outright; it is 1 if no address
4786 failed outright but at least one could not be resolved for some reason. Return
4787 code 0 is given only when all addresses succeed.
4788 </para>
4789 <para>
4790 If any of the routers in the configuration makes any tests on the sender
4791 address of a message, you should use the <option>-f</option> option to set an appropriate
4792 sender when running <option>-bv</option> tests. Without it, the sender is assumed to be the
4793 calling user at the default qualifying domain.
4794 </para>
4795 </listitem></varlistentry>
4796 <varlistentry>
4797 <term><option>-bvs</option></term>
4798 <listitem>
4799 <para>
4800 <indexterm role="option">
4801 <primary><option>-bvs</option></primary>
4802 </indexterm>
4803 This option acts like <option>-bv</option>, but verifies the address as a sender rather
4804 than a recipient address. This affects any rewriting and qualification that
4805 might happen.
4806 </para>
4807 </listitem></varlistentry>
4808 <varlistentry>
4809 <term><option>-C</option>&nbsp;&lt;<emphasis>filelist</emphasis>&gt;</term>
4810 <listitem>
4811 <para>
4812 <indexterm role="option">
4813 <primary><option>-C</option></primary>
4814 </indexterm>
4815 <indexterm role="concept">
4816 <primary>configuration file</primary>
4817 <secondary>alternate</secondary>
4818 </indexterm>
4819 <indexterm role="concept">
4820 <primary>CONFIGURE_FILE</primary>
4821 </indexterm>
4822 <indexterm role="concept">
4823 <primary>alternate configuration file</primary>
4824 </indexterm>
4825 This option causes Exim to find the run time configuration file from the given
4826 list instead of from the list specified by the CONFIGURE_FILE
4827 compile-time setting. Usually, the list will consist of just a single file
4828 name, but it can be a colon-separated list of names. In this case, the first
4829 file that exists is used. Failure to open an existing file stops Exim from
4830 proceeding any further along the list, and an error is generated.
4831 </para>
4832 <para revisionflag="changed">
4833 When this option is used by a caller other than root, and the list is different
4834 from the compiled-in list, Exim gives up its root privilege immediately, and
4835 runs with the real and effective uid and gid set to those of the caller.
4836 However, if a TRUSTED_CONFIG_LIST file is defined in <filename>Local/Makefile</filename>, that
4837 file contains a list of full pathnames, one per line, for configuration files
4838 which are trusted. Root privilege is retained for any configuration file so
4839 listed, as long as the caller is the Exim user (or the user specified in the
4840 CONFIGURE_OWNER option, if any), and as long as the configuration file is
4841 not writeable by inappropriate users or groups.
4842 </para>
4843 <para revisionflag="changed">
4844 Leaving TRUSTED_CONFIG_LIST unset precludes the possibility of testing a
4845 configuration using <option>-C</option> right through message reception and delivery,
4846 even if the caller is root. The reception works, but by that time, Exim is
4847 running as the Exim user, so when it re-executes to regain privilege for the
4848 delivery, the use of <option>-C</option> causes privilege to be lost. However, root can
4849 test reception and delivery using two separate commands (one to put a message
4850 on the queue, using <option>-odq</option>, and another to do the delivery, using <option>-M</option>).
4851 </para>
4852 <para>
4853 If ALT_CONFIG_PREFIX is defined <filename>in Local/Makefile</filename>, it specifies a
4854 prefix string with which any file named in a <option>-C</option> command line option
4855 must start. In addition, the file name must not contain the sequence <literal>/../</literal>.
4856 However, if the value of the <option>-C</option> option is identical to the value of
4857 CONFIGURE_FILE in <filename>Local/Makefile</filename>, Exim ignores <option>-C</option> and proceeds as
4858 usual. There is no default setting for ALT_CONFIG_PREFIX; when it is
4859 unset, any file name can be used with <option>-C</option>.
4860 </para>
4861 <para>
4862 ALT_CONFIG_PREFIX can be used to confine alternative configuration files
4863 to a directory to which only root has access. This prevents someone who has
4864 broken into the Exim account from running a privileged Exim with an arbitrary
4865 configuration file.
4866 </para>
4867 <para>
4868 The <option>-C</option> facility is useful for ensuring that configuration files are
4869 syntactically correct, but cannot be used for test deliveries, unless the
4870 caller is privileged, or unless it is an exotic configuration that does not
4871 require privilege. No check is made on the owner or group of the files
4872 specified by this option.
4873 </para>
4874 </listitem></varlistentry>
4875 <varlistentry>
4876 <term><option>-D</option>&lt;<emphasis>macro</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt;</term>
4877 <listitem>
4878 <para>
4879 <indexterm role="option">
4880 <primary><option>-D</option></primary>
4881 </indexterm>
4882 <indexterm role="concept">
4883 <primary>macro</primary>
4884 <secondary>setting on command line</secondary>
4885 </indexterm>
4886 This option can be used to override macro definitions in the configuration file
4887 (see section <xref linkend="SECTmacrodefs"/>). However, like <option>-C</option>, if it is used by an
4888 unprivileged caller, it causes Exim to give up its root privilege.
4889 If DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the use of <option>-D</option> is
4890 completely disabled, and its use causes an immediate error exit.
4891 </para>
4892 <para revisionflag="changed">
4893 If WHITELIST_D_MACROS is defined in <filename>Local/Makefile</filename> then it should be a
4894 colon-separated list of macros which are considered safe and, if <option>-D</option> only
4895 supplies macros from this list, and the values are acceptable, then Exim will
4896 not give up root privilege if the caller is root, the Exim run-time user, or
4897 the CONFIGURE_OWNER, if set.  This is a transition mechanism and is expected
4898 to be removed in the future.  Acceptable values for the macros satisfy the
4899 regexp: <literal>^[A-Za-z0-9_/.-]*$</literal>
4900 </para>
4901 <para>
4902 The entire option (including equals sign if present) must all be within one
4903 command line item. <option>-D</option> can be used to set the value of a macro to the empty
4904 string, in which case the equals sign is optional. These two commands are
4905 synonymous:
4906 </para>
4907 <literallayout class="monospaced">
4908 exim -DABC  ...
4909 exim -DABC= ...
4910 </literallayout>
4911 <para>
4912 To include spaces in a macro definition item, quotes must be used. If you use
4913 quotes, spaces are permitted around the macro name and the equals sign. For
4914 example:
4915 </para>
4916 <literallayout class="monospaced">
4917 exim '-D ABC = something' ...
4918 </literallayout>
4919 <para>
4920 <option>-D</option> may be repeated up to 10 times on a command line.
4921 </para>
4922 </listitem></varlistentry>
4923 <varlistentry>
4924 <term><option>-d</option>&lt;<emphasis>debug&nbsp;options</emphasis>&gt;</term>
4925 <listitem>
4926 <para>
4927 <indexterm role="option">
4928 <primary><option>-d</option></primary>
4929 </indexterm>
4930 <indexterm role="concept">
4931 <primary>debugging</primary>
4932 <secondary>list of selectors</secondary>
4933 </indexterm>
4934 <indexterm role="concept">
4935 <primary>debugging</primary>
4936 <secondary><option>-d</option> option</secondary>
4937 </indexterm>
4938 This option causes debugging information to be written to the standard
4939 error stream. It is restricted to admin users because debugging output may show
4940 database queries that contain password information. Also, the details of users&#x2019;
4941 filter files should be protected. If a non-admin user uses <option>-d</option>, Exim
4942 writes an error message to the standard error stream and exits with a non-zero
4943 return code.
4944 </para>
4945 <para>
4946 When <option>-d</option> is used, <option>-v</option> is assumed. If <option>-d</option> is given on its own, a lot of
4947 standard debugging data is output. This can be reduced, or increased to include
4948 some more rarely needed information, by directly following <option>-d</option> with a string
4949 made up of names preceded by plus or minus characters. These add or remove sets
4950 of debugging data, respectively. For example, <option>-d+filter</option> adds filter
4951 debugging, whereas <option>-d-all+filter</option> selects only filter debugging. Note that
4952 no spaces are allowed in the debug setting. The available debugging categories
4953 are:
4954 </para>
4955 <literallayout>
4956 <literal>acl            </literal> ACL interpretation
4957 <literal>auth           </literal> authenticators
4958 <literal>deliver        </literal> general delivery logic
4959 <literal>dns            </literal> DNS lookups (see also resolver)
4960 <literal>dnsbl          </literal> DNS black list (aka RBL) code
4961 <literal>exec           </literal> arguments for <function>execv()</function> calls
4962 <literal>expand         </literal> detailed debugging for string expansions
4963 <literal>filter         </literal> filter handling
4964 <literal>hints_lookup   </literal> hints data lookups
4965 <literal>host_lookup    </literal> all types of name-to-IP address handling
4966 <literal>ident          </literal> ident lookup
4967 <literal>interface      </literal> lists of local interfaces
4968 <literal>lists          </literal> matching things in lists
4969 <literal>load           </literal> system load checks
4970 <literal>local_scan     </literal> can be used by <function>local_scan()</function> (see chapter <xref linkend="CHAPlocalscan"/>)
4971 <literal>lookup         </literal> general lookup code and all lookups
4972 <literal>memory         </literal> memory handling
4973 <literal>pid            </literal> add pid to debug output lines
4974 <literal>process_info   </literal> setting info for the process log
4975 <literal>queue_run      </literal> queue runs
4976 <literal>receive        </literal> general message reception logic
4977 <literal>resolver       </literal> turn on the DNS resolver&#x2019;s debugging output
4978 <literal>retry          </literal> retry handling
4979 <literal>rewrite        </literal> address rewriting
4980 <literal>route          </literal> address routing
4981 <literal>timestamp      </literal> add timestamp to debug output lines
4982 <literal>tls            </literal> TLS logic
4983 <literal>transport      </literal> transports
4984 <literal>uid            </literal> changes of uid/gid and looking up uid/gid
4985 <literal>verify         </literal> address verification logic
4986 <literal>all            </literal> almost all of the above (see below), and also <option>-v</option>
4987 </literallayout>
4988 <para>
4989 The <literal>all</literal> option excludes <literal>memory</literal> when used as <literal>+all</literal>, but includes it
4990 for <literal>-all</literal>. The reason for this is that <literal>+all</literal> is something that people
4991 tend to use when generating debug output for Exim maintainers. If <literal>+memory</literal>
4992 is included, an awful lot of output that is very rarely of interest is
4993 generated, so it now has to be explicitly requested. However, <literal>-all</literal> does
4994 turn everything off.
4995 </para>
4996 <para>
4997 <indexterm role="concept">
4998 <primary>resolver, debugging output</primary>
4999 </indexterm>
5000 <indexterm role="concept">
5001 <primary>DNS resolver, debugging output</primary>
5002 </indexterm>
5003 The <literal>resolver</literal> option produces output only if the DNS resolver was compiled
5004 with DEBUG enabled. This is not the case in some operating systems. Also,
5005 unfortunately, debugging output from the DNS resolver is written to stdout
5006 rather than stderr.
5007 </para>
5008 <para>
5009 The default (<option>-d</option> with no argument) omits <literal>expand</literal>, <literal>filter</literal>,
5010 <literal>interface</literal>, <literal>load</literal>, <literal>memory</literal>, <literal>pid</literal>, <literal>resolver</literal>, and <literal>timestamp</literal>.
5011 However, the <literal>pid</literal> selector is forced when debugging is turned on for a
5012 daemon, which then passes it on to any re-executed Exims. Exim also
5013 automatically adds the pid to debug lines when several remote deliveries are
5014 run in parallel.
5015 </para>
5016 <para>
5017 The <literal>timestamp</literal> selector causes the current time to be inserted at the start
5018 of all debug output lines. This can be useful when trying to track down delays
5019 in processing.
5020 </para>
5021 <para>
5022 If the <option>debug_print</option> option is set in any driver, it produces output whenever
5023 any debugging is selected, or if <option>-v</option> is used.
5024 </para>
5025 </listitem></varlistentry>
5026 <varlistentry>
5027 <term><option>-dd</option>&lt;<emphasis>debug&nbsp;options</emphasis>&gt;</term>
5028 <listitem>
5029 <para>
5030 <indexterm role="option">
5031 <primary><option>-dd</option></primary>
5032 </indexterm>
5033 This option behaves exactly like <option>-d</option> except when used on a command that
5034 starts a daemon process. In that case, debugging is turned off for the
5035 subprocesses that the daemon creates. Thus, it is useful for monitoring the
5036 behaviour of the daemon without creating as much output as full debugging does.
5037 </para>
5038 </listitem></varlistentry>
5039 <varlistentry>
5040 <term><option>-dropcr</option></term>
5041 <listitem>
5042 <para>
5043 <indexterm role="option">
5044 <primary><option>-dropcr</option></primary>
5045 </indexterm>
5046 This is an obsolete option that is now a no-op. It used to affect the way Exim
5047 handled CR and LF characters in incoming messages. What happens now is
5048 described in section <xref linkend="SECTlineendings"/>.
5049 </para>
5050 </listitem></varlistentry>
5051 <varlistentry>
5052 <term><option>-E</option></term>
5053 <listitem>
5054 <para>
5055 <indexterm role="option">
5056 <primary><option>-E</option></primary>
5057 </indexterm>
5058 <indexterm role="concept">
5059 <primary>bounce message</primary>
5060 <secondary>generating</secondary>
5061 </indexterm>
5062 This option specifies that an incoming message is a locally-generated delivery
5063 failure report. It is used internally by Exim when handling delivery failures
5064 and is not intended for external use. Its only effect is to stop Exim
5065 generating certain messages to the postmaster, as otherwise message cascades
5066 could occur in some situations. As part of the same option, a message id may
5067 follow the characters <option>-E</option>. If it does, the log entry for the receipt of the
5068 new message contains the id, following <quote>R=</quote>, as a cross-reference.
5069 </para>
5070 </listitem></varlistentry>
5071 <varlistentry>
5072 <term><option>-e</option><emphasis>x</emphasis></term>
5073 <listitem>
5074 <para>
5075 <indexterm role="option">
5076 <primary><option>-e</option><emphasis>x</emphasis></primary>
5077 </indexterm>
5078 There are a number of Sendmail options starting with <option>-oe</option> which seem to be
5079 called by various programs without the leading <option>o</option> in the option. For
5080 example, the <option>vacation</option> program uses <option>-eq</option>. Exim treats all options of the
5081 form <option>-e</option><emphasis>x</emphasis> as synonymous with the corresponding <option>-oe</option><emphasis>x</emphasis> options.
5082 </para>
5083 </listitem></varlistentry>
5084 <varlistentry>
5085 <term><option>-F</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
5086 <listitem>
5087 <para>
5088 <indexterm role="option">
5089 <primary><option>-F</option></primary>
5090 </indexterm>
5091 <indexterm role="concept">
5092 <primary>sender</primary>
5093 <secondary>name</secondary>
5094 </indexterm>
5095 <indexterm role="concept">
5096 <primary>name</primary>
5097 <secondary>of sender</secondary>
5098 </indexterm>
5099 This option sets the sender&#x2019;s full name for use when a locally-generated
5100 message is being accepted. In the absence of this option, the user&#x2019;s <emphasis>gecos</emphasis>
5101 entry from the password data is used. As users are generally permitted to alter
5102 their <emphasis>gecos</emphasis> entries, no security considerations are involved. White space
5103 between <option>-F</option> and the &lt;<emphasis>string</emphasis>&gt; is optional.
5104 </para>
5105 </listitem></varlistentry>
5106 <varlistentry>
5107 <term><option>-f</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
5108 <listitem>
5109 <para>
5110 <indexterm role="option">
5111 <primary><option>-f</option></primary>
5112 </indexterm>
5113 <indexterm role="concept">
5114 <primary>sender</primary>
5115 <secondary>address</secondary>
5116 </indexterm>
5117 <indexterm role="concept">
5118 <primary>address</primary>
5119 <secondary>sender</secondary>
5120 </indexterm>
5121 <indexterm role="concept">
5122 <primary>trusted users</primary>
5123 </indexterm>
5124 <indexterm role="concept">
5125 <primary>envelope sender</primary>
5126 </indexterm>
5127 <indexterm role="concept">
5128 <primary>user</primary>
5129 <secondary>trusted</secondary>
5130 </indexterm>
5131 This option sets the address of the envelope sender of a locally-generated
5132 message (also known as the return path). The option can normally be used only
5133 by a trusted user, but <option>untrusted_set_sender</option> can be set to allow untrusted
5134 users to use it.
5135 </para>
5136 <para>
5137 Processes running as root or the Exim user are always trusted. Other
5138 trusted users are defined by the <option>trusted_users</option> or <option>trusted_groups</option>
5139 options. In the absence of <option>-f</option>, or if the caller is not trusted, the sender
5140 of a local message is set to the caller&#x2019;s login name at the default qualify
5141 domain.
5142 </para>
5143 <para>
5144 There is one exception to the restriction on the use of <option>-f</option>: an empty sender
5145 can be specified by any user, trusted or not, to create a message that can
5146 never provoke a bounce. An empty sender can be specified either as an empty
5147 string, or as a pair of angle brackets with nothing between them, as in these
5148 examples of shell commands:
5149 </para>
5150 <literallayout class="monospaced">
5151 exim -f '&lt;&gt;' user@domain
5152 exim -f "" user@domain
5153 </literallayout>
5154 <para>
5155 In addition, the use of <option>-f</option> is not restricted when testing a filter file
5156 with <option>-bf</option> or when testing or verifying addresses using the <option>-bt</option> or
5157 <option>-bv</option> options.
5158 </para>
5159 <para>
5160 Allowing untrusted users to change the sender address does not of itself make
5161 it possible to send anonymous mail. Exim still checks that the <emphasis>From:</emphasis> header
5162 refers to the local user, and if it does not, it adds a <emphasis>Sender:</emphasis> header,
5163 though this can be overridden by setting <option>no_local_from_check</option>.
5164 </para>
5165 <para>
5166 White
5167 <indexterm role="concept">
5168 <primary><quote>From</quote> line</primary>
5169 </indexterm>
5170 space between <option>-f</option> and the &lt;<emphasis>address</emphasis>&gt; is optional (that is, they can be
5171 given as two arguments or one combined argument). The sender of a
5172 locally-generated message can also be set (when permitted) by an initial
5173 <quote>From&nbsp;</quote> line in the message &ndash; see the description of <option>-bm</option> above &ndash; but
5174 if <option>-f</option> is also present, it overrides <quote>From&nbsp;</quote>.
5175 </para>
5176 </listitem></varlistentry>
5177 <varlistentry>
5178 <term><option>-G</option></term>
5179 <listitem>
5180 <para>
5181 <indexterm role="option">
5182 <primary><option>-G</option></primary>
5183 </indexterm>
5184 <indexterm role="concept">
5185 <primary>Sendmail compatibility</primary>
5186 <secondary><option>-G</option> option ignored</secondary>
5187 </indexterm>
5188 This is a Sendmail option which is ignored by Exim.
5189 </para>
5190 </listitem></varlistentry>
5191 <varlistentry>
5192 <term><option>-h</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
5193 <listitem>
5194 <para>
5195 <indexterm role="option">
5196 <primary><option>-h</option></primary>
5197 </indexterm>
5198 <indexterm role="concept">
5199 <primary>Sendmail compatibility</primary>
5200 <secondary><option>-h</option> option ignored</secondary>
5201 </indexterm>
5202 This option is accepted for compatibility with Sendmail, but has no effect. (In
5203 Sendmail it overrides the <quote>hop count</quote> obtained by counting <emphasis>Received:</emphasis>
5204 headers.)
5205 </para>
5206 </listitem></varlistentry>
5207 <varlistentry>
5208 <term><option>-i</option></term>
5209 <listitem>
5210 <para>
5211 <indexterm role="option">
5212 <primary><option>-i</option></primary>
5213 </indexterm>
5214 <indexterm role="concept">
5215 <primary>Solaris</primary>
5216 <secondary><emphasis>mail</emphasis> command</secondary>
5217 </indexterm>
5218 <indexterm role="concept">
5219 <primary>dot</primary>
5220 <secondary>in incoming non-SMTP message</secondary>
5221 </indexterm>
5222 This option, which has the same effect as <option>-oi</option>, specifies that a dot on a
5223 line by itself should not terminate an incoming, non-SMTP message. I can find
5224 no documentation for this option in Solaris 2.4 Sendmail, but the <emphasis>mailx</emphasis>
5225 command in Solaris 2.4 uses it. See also <option>-ti</option>.
5226 </para>
5227 </listitem></varlistentry>
5228 <varlistentry>
5229 <term><option>-M</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5230 <listitem>
5231 <para>
5232 <indexterm role="option">
5233 <primary><option>-M</option></primary>
5234 </indexterm>
5235 <indexterm role="concept">
5236 <primary>forcing delivery</primary>
5237 </indexterm>
5238 <indexterm role="concept">
5239 <primary>delivery</primary>
5240 <secondary>forcing attempt</secondary>
5241 </indexterm>
5242 <indexterm role="concept">
5243 <primary>frozen messages</primary>
5244 <secondary>forcing delivery</secondary>
5245 </indexterm>
5246 This option requests Exim to run a delivery attempt on each message in turn. If
5247 any of the messages are frozen, they are automatically thawed before the
5248 delivery attempt. The settings of <option>queue_domains</option>, <option>queue_smtp_domains</option>,
5249 and <option>hold_domains</option> are ignored.
5250 </para>
5251 <para>
5252 Retry
5253 <indexterm role="concept">
5254 <primary>hints database</primary>
5255 <secondary>overriding retry hints</secondary>
5256 </indexterm>
5257 hints for any of the addresses are overridden &ndash; Exim tries to deliver even if
5258 the normal retry time has not yet been reached. This option requires the caller
5259 to be an admin user. However, there is an option called <option>prod_requires_admin</option>
5260 which can be set false to relax this restriction (and also the same requirement
5261 for the <option>-q</option>, <option>-R</option>, and <option>-S</option> options).
5262 </para>
5263 <para>
5264 The deliveries happen synchronously, that is, the original Exim process does
5265 not terminate until all the delivery attempts have finished. No output is
5266 produced unless there is a serious error. If you want to see what is happening,
5267 use the <option>-v</option> option as well, or inspect Exim&#x2019;s main log.
5268 </para>
5269 </listitem></varlistentry>
5270 <varlistentry>
5271 <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>
5272 <listitem>
5273 <para>
5274 <indexterm role="option">
5275 <primary><option>-Mar</option></primary>
5276 </indexterm>
5277 <indexterm role="concept">
5278 <primary>message</primary>
5279 <secondary>adding recipients</secondary>
5280 </indexterm>
5281 <indexterm role="concept">
5282 <primary>recipient</primary>
5283 <secondary>adding</secondary>
5284 </indexterm>
5285 This option requests Exim to add the addresses to the list of recipients of the
5286 message (<quote>ar</quote> for <quote>add recipients</quote>). The first argument must be a message
5287 id, and the remaining ones must be email addresses. However, if the message is
5288 active (in the middle of a delivery attempt), it is not altered. This option
5289 can be used only by an admin user.
5290 </para>
5291 </listitem></varlistentry>
5292 <varlistentry>
5293 <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>
5294 <listitem>
5295 <para>
5296 <indexterm role="option">
5297 <primary><option>-MC</option></primary>
5298 </indexterm>
5299 <indexterm role="concept">
5300 <primary>SMTP</primary>
5301 <secondary>passed connection</secondary>
5302 </indexterm>
5303 <indexterm role="concept">
5304 <primary>SMTP</primary>
5305 <secondary>multiple deliveries</secondary>
5306 </indexterm>
5307 <indexterm role="concept">
5308 <primary>multiple SMTP deliveries</primary>
5309 </indexterm>
5310 This option is not intended for use by external callers. It is used internally
5311 by Exim to invoke another instance of itself to deliver a waiting message using
5312 an existing SMTP connection, which is passed as the standard input. Details are
5313 given in chapter <xref linkend="CHAPSMTP"/>. This must be the final option, and the caller
5314 must be root or the Exim user in order to use it.
5315 </para>
5316 </listitem></varlistentry>
5317 <varlistentry>
5318 <term><option>-MCA</option></term>
5319 <listitem>
5320 <para>
5321 <indexterm role="option">
5322 <primary><option>-MCA</option></primary>
5323 </indexterm>
5324 This option is not intended for use by external callers. It is used internally
5325 by Exim in conjunction with the <option>-MC</option> option. It signifies that the
5326 connection to the remote host has been authenticated.
5327 </para>
5328 </listitem></varlistentry>
5329 <varlistentry>
5330 <term><option>-MCP</option></term>
5331 <listitem>
5332 <para>
5333 <indexterm role="option">
5334 <primary><option>-MCP</option></primary>
5335 </indexterm>
5336 This option is not intended for use by external callers. It is used internally
5337 by Exim in conjunction with the <option>-MC</option> option. It signifies that the server to
5338 which Exim is connected supports pipelining.
5339 </para>
5340 </listitem></varlistentry>
5341 <varlistentry>
5342 <term><option>-MCQ</option>&nbsp;&lt;<emphasis>process&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>pipe&nbsp;fd</emphasis>&gt;</term>
5343 <listitem>
5344 <para>
5345 <indexterm role="option">
5346 <primary><option>-MCQ</option></primary>
5347 </indexterm>
5348 This option is not intended for use by external callers. It is used internally
5349 by Exim in conjunction with the <option>-MC</option> option when the original delivery was
5350 started by a queue runner. It passes on the process id of the queue runner,
5351 together with the file descriptor number of an open pipe. Closure of the pipe
5352 signals the final completion of the sequence of processes that are passing
5353 messages through the same SMTP connection.
5354 </para>
5355 </listitem></varlistentry>
5356 <varlistentry>
5357 <term><option>-MCS</option></term>
5358 <listitem>
5359 <para>
5360 <indexterm role="option">
5361 <primary><option>-MCS</option></primary>
5362 </indexterm>
5363 This option is not intended for use by external callers. It is used internally
5364 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
5365 SMTP SIZE option should be used on messages delivered down the existing
5366 connection.
5367 </para>
5368 </listitem></varlistentry>
5369 <varlistentry>
5370 <term><option>-MCT</option></term>
5371 <listitem>
5372 <para>
5373 <indexterm role="option">
5374 <primary><option>-MCT</option></primary>
5375 </indexterm>
5376 This option is not intended for use by external callers. It is used internally
5377 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
5378 host to which Exim is connected supports TLS encryption.
5379 </para>
5380 </listitem></varlistentry>
5381 <varlistentry>
5382 <term><option>-Mc</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5383 <listitem>
5384 <para>
5385 <indexterm role="option">
5386 <primary><option>-Mc</option></primary>
5387 </indexterm>
5388 <indexterm role="concept">
5389 <primary>hints database</primary>
5390 <secondary>not overridden by <option>-Mc</option></secondary>
5391 </indexterm>
5392 <indexterm role="concept">
5393 <primary>delivery</primary>
5394 <secondary>manually started &ndash; not forced</secondary>
5395 </indexterm>
5396 This option requests Exim to run a delivery attempt on each message in turn,
5397 but unlike the <option>-M</option> option, it does check for retry hints, and respects any
5398 that are found. This option is not very useful to external callers. It is
5399 provided mainly for internal use by Exim when it needs to re-invoke itself in
5400 order to regain root privilege for a delivery (see chapter <xref linkend="CHAPsecurity"/>).
5401 However, <option>-Mc</option> can be useful when testing, in order to run a delivery that
5402 respects retry times and other options such as <option>hold_domains</option> that are
5403 overridden when <option>-M</option> is used. Such a delivery does not count as a queue run.
5404 If you want to run a specific delivery as if in a queue run, you should use
5405 <option>-q</option> with a message id argument. A distinction between queue run deliveries
5406 and other deliveries is made in one or two places.
5407 </para>
5408 </listitem></varlistentry>
5409 <varlistentry>
5410 <term><option>-Mes</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
5411 <listitem>
5412 <para>
5413 <indexterm role="option">
5414 <primary><option>-Mes</option></primary>
5415 </indexterm>
5416 <indexterm role="concept">
5417 <primary>message</primary>
5418 <secondary>changing sender</secondary>
5419 </indexterm>
5420 <indexterm role="concept">
5421 <primary>sender</primary>
5422 <secondary>changing</secondary>
5423 </indexterm>
5424 This option requests Exim to change the sender address in the message to the
5425 given address, which must be a fully qualified address or <quote>&lt;&gt;</quote> (<quote>es</quote> for
5426 <quote>edit sender</quote>). There must be exactly two arguments. The first argument must
5427 be a message id, and the second one an email address. However, if the message
5428 is active (in the middle of a delivery attempt), its status is not altered.
5429 This option can be used only by an admin user.
5430 </para>
5431 </listitem></varlistentry>
5432 <varlistentry>
5433 <term><option>-Mf</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5434 <listitem>
5435 <para>
5436 <indexterm role="option">
5437 <primary><option>-Mf</option></primary>
5438 </indexterm>
5439 <indexterm role="concept">
5440 <primary>freezing messages</primary>
5441 </indexterm>
5442 <indexterm role="concept">
5443 <primary>message</primary>
5444 <secondary>manually freezing</secondary>
5445 </indexterm>
5446 This option requests Exim to mark each listed message as <quote>frozen</quote>. This
5447 prevents any delivery attempts taking place until the message is <quote>thawed</quote>,
5448 either manually or as a result of the <option>auto_thaw</option> configuration option.
5449 However, if any of the messages are active (in the middle of a delivery
5450 attempt), their status is not altered. This option can be used only by an admin
5451 user.
5452 </para>
5453 </listitem></varlistentry>
5454 <varlistentry>
5455 <term><option>-Mg</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5456 <listitem>
5457 <para>
5458 <indexterm role="option">
5459 <primary><option>-Mg</option></primary>
5460 </indexterm>
5461 <indexterm role="concept">
5462 <primary>giving up on messages</primary>
5463 </indexterm>
5464 <indexterm role="concept">
5465 <primary>message</primary>
5466 <secondary>abandoning delivery attempts</secondary>
5467 </indexterm>
5468 <indexterm role="concept">
5469 <primary>delivery</primary>
5470 <secondary>abandoning further attempts</secondary>
5471 </indexterm>
5472 This option requests Exim to give up trying to deliver the listed messages,
5473 including any that are frozen. However, if any of the messages are active,
5474 their status is not altered. For non-bounce messages, a delivery error message
5475 is sent to the sender, containing the text <quote>cancelled by administrator</quote>.
5476 Bounce messages are just discarded. This option can be used only by an admin
5477 user.
5478 </para>
5479 </listitem></varlistentry>
5480 <varlistentry>
5481 <term><option>-Mmad</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5482 <listitem>
5483 <para>
5484 <indexterm role="option">
5485 <primary><option>-Mmad</option></primary>
5486 </indexterm>
5487 <indexterm role="concept">
5488 <primary>delivery</primary>
5489 <secondary>cancelling all</secondary>
5490 </indexterm>
5491 This option requests Exim to mark all the recipient addresses in the messages
5492 as already delivered (<quote>mad</quote> for <quote>mark all delivered</quote>). However, if any
5493 message is active (in the middle of a delivery attempt), its status is not
5494 altered. This option can be used only by an admin user.
5495 </para>
5496 </listitem></varlistentry>
5497 <varlistentry>
5498 <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>
5499 <listitem>
5500 <para>
5501 <indexterm role="option">
5502 <primary><option>-Mmd</option></primary>
5503 </indexterm>
5504 <indexterm role="concept">
5505 <primary>delivery</primary>
5506 <secondary>cancelling by address</secondary>
5507 </indexterm>
5508 <indexterm role="concept">
5509 <primary>recipient</primary>
5510 <secondary>removing</secondary>
5511 </indexterm>
5512 <indexterm role="concept">
5513 <primary>removing recipients</primary>
5514 </indexterm>
5515 This option requests Exim to mark the given addresses as already delivered
5516 (<quote>md</quote> for <quote>mark delivered</quote>). The first argument must be a message id, and
5517 the remaining ones must be email addresses. These are matched to recipient
5518 addresses in the message in a case-sensitive manner. If the message is active
5519 (in the middle of a delivery attempt), its status is not altered. This option
5520 can be used only by an admin user.
5521 </para>
5522 </listitem></varlistentry>
5523 <varlistentry>
5524 <term><option>-Mrm</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5525 <listitem>
5526 <para>
5527 <indexterm role="option">
5528 <primary><option>-Mrm</option></primary>
5529 </indexterm>
5530 <indexterm role="concept">
5531 <primary>removing messages</primary>
5532 </indexterm>
5533 <indexterm role="concept">
5534 <primary>abandoning mail</primary>
5535 </indexterm>
5536 <indexterm role="concept">
5537 <primary>message</primary>
5538 <secondary>manually discarding</secondary>
5539 </indexterm>
5540 This option requests Exim to remove the given messages from the queue. No
5541 bounce messages are sent; each message is simply forgotten. However, if any of
5542 the messages are active, their status is not altered. This option can be used
5543 only by an admin user or by the user who originally caused the message to be
5544 placed on the queue.
5545 </para>
5546 </listitem></varlistentry>
5547 <varlistentry>
5548 <term><option>-Mset</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5549 <listitem>
5550 <para>
5551 <indexterm role="option">
5552 <primary><option>-Mset</option></primary>
5553 </indexterm>
5554 <indexterm role="concept">
5555 <primary>testing</primary>
5556 <secondary>string expansion</secondary>
5557 </indexterm>
5558 <indexterm role="concept">
5559 <primary>expansion</primary>
5560 <secondary>testing</secondary>
5561 </indexterm>
5562 This option is useful only in conjunction with <option>-be</option> (that is, when testing
5563 string expansions). Exim loads the given message from its spool before doing
5564 the test expansions, thus setting message-specific variables such as
5565 <varname>$message_size</varname> and the header variables. The <varname>$recipients</varname> variable is made
5566 available. This feature is provided to make it easier to test expansions that
5567 make use of these variables. However, this option can be used only by an admin
5568 user. See also <option>-bem</option>.
5569 </para>
5570 </listitem></varlistentry>
5571 <varlistentry>
5572 <term><option>-Mt</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5573 <listitem>
5574 <para>
5575 <indexterm role="option">
5576 <primary><option>-Mt</option></primary>
5577 </indexterm>
5578 <indexterm role="concept">
5579 <primary>thawing messages</primary>
5580 </indexterm>
5581 <indexterm role="concept">
5582 <primary>unfreezing messages</primary>
5583 </indexterm>
5584 <indexterm role="concept">
5585 <primary>frozen messages</primary>
5586 <secondary>thawing</secondary>
5587 </indexterm>
5588 <indexterm role="concept">
5589 <primary>message</primary>
5590 <secondary>thawing frozen</secondary>
5591 </indexterm>
5592 This option requests Exim to <quote>thaw</quote> any of the listed messages that are
5593 <quote>frozen</quote>, so that delivery attempts can resume. However, if any of the
5594 messages are active, their status is not altered. This option can be used only
5595 by an admin user.
5596 </para>
5597 </listitem></varlistentry>
5598 <varlistentry>
5599 <term><option>-Mvb</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5600 <listitem>
5601 <para>
5602 <indexterm role="option">
5603 <primary><option>-Mvb</option></primary>
5604 </indexterm>
5605 <indexterm role="concept">
5606 <primary>listing</primary>
5607 <secondary>message body</secondary>
5608 </indexterm>
5609 <indexterm role="concept">
5610 <primary>message</primary>
5611 <secondary>listing body of</secondary>
5612 </indexterm>
5613 This option causes the contents of the message body (-D) spool file to be
5614 written to the standard output. This option can be used only by an admin user.
5615 </para>
5616 </listitem></varlistentry>
5617 <varlistentry revisionflag="changed">
5618 <term><option>-Mvc</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5619 <listitem>
5620 <para revisionflag="changed">
5621 <indexterm role="option">
5622 <primary><option>-Mvc</option></primary>
5623 </indexterm>
5624 <indexterm role="concept">
5625 <primary>message</primary>
5626 <secondary>listing in RFC 2822 format</secondary>
5627 </indexterm>
5628 <indexterm role="concept">
5629 <primary>listing</primary>
5630 <secondary>message in RFC 2822 format</secondary>
5631 </indexterm>
5632 This option causes a copy of the complete message (header lines plus body) to
5633 be written to the standard output in RFC 2822 format. This option can be used
5634 only by an admin user.
5635 </para>
5636 </listitem></varlistentry>
5637 <varlistentry>
5638 <term><option>-Mvh</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5639 <listitem>
5640 <para>
5641 <indexterm role="option">
5642 <primary><option>-Mvh</option></primary>
5643 </indexterm>
5644 <indexterm role="concept">
5645 <primary>listing</primary>
5646 <secondary>message headers</secondary>
5647 </indexterm>
5648 <indexterm role="concept">
5649 <primary>header lines</primary>
5650 <secondary>listing</secondary>
5651 </indexterm>
5652 <indexterm role="concept">
5653 <primary>message</primary>
5654 <secondary>listing header lines</secondary>
5655 </indexterm>
5656 This option causes the contents of the message headers (-H) spool file to be
5657 written to the standard output. This option can be used only by an admin user.
5658 </para>
5659 </listitem></varlistentry>
5660 <varlistentry>
5661 <term><option>-Mvl</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5662 <listitem>
5663 <para>
5664 <indexterm role="option">
5665 <primary><option>-Mvl</option></primary>
5666 </indexterm>
5667 <indexterm role="concept">
5668 <primary>listing</primary>
5669 <secondary>message log</secondary>
5670 </indexterm>
5671 <indexterm role="concept">
5672 <primary>message</primary>
5673 <secondary>listing message log</secondary>
5674 </indexterm>
5675 This option causes the contents of the message log spool file to be written to
5676 the standard output. This option can be used only by an admin user.
5677 </para>
5678 </listitem></varlistentry>
5679 <varlistentry>
5680 <term><option>-m</option></term>
5681 <listitem>
5682 <para>
5683 <indexterm role="option">
5684 <primary><option>-m</option></primary>
5685 </indexterm>
5686 This is apparently a synonym for <option>-om</option> that is accepted by Sendmail, so Exim
5687 treats it that way too.
5688 </para>
5689 </listitem></varlistentry>
5690 <varlistentry>
5691 <term><option>-N</option></term>
5692 <listitem>
5693 <para>
5694 <indexterm role="option">
5695 <primary><option>-N</option></primary>
5696 </indexterm>
5697 <indexterm role="concept">
5698 <primary>debugging</primary>
5699 <secondary><option>-N</option> option</secondary>
5700 </indexterm>
5701 <indexterm role="concept">
5702 <primary>debugging</primary>
5703 <secondary>suppressing delivery</secondary>
5704 </indexterm>
5705 This is a debugging option that inhibits delivery of a message at the transport
5706 level. It implies <option>-v</option>. Exim goes through many of the motions of delivery &ndash;
5707 it just doesn&#x2019;t actually transport the message, but instead behaves as if it
5708 had successfully done so. However, it does not make any updates to the retry
5709 database, and the log entries for deliveries are flagged with <quote>*&gt;</quote> rather
5710 than <quote>=&gt;</quote>.
5711 </para>
5712 <para>
5713 Because <option>-N</option> discards any message to which it applies, only root or the Exim
5714 user are allowed to use it with <option>-bd</option>, <option>-q</option>, <option>-R</option> or <option>-M</option>. In other
5715 words, an ordinary user can use it only when supplying an incoming message to
5716 which it will apply. Although transportation never fails when <option>-N</option> is set, an
5717 address may be deferred because of a configuration problem on a transport, or a
5718 routing problem. Once <option>-N</option> has been used for a delivery attempt, it sticks to
5719 the message, and applies to any subsequent delivery attempts that may happen
5720 for that message.
5721 </para>
5722 </listitem></varlistentry>
5723 <varlistentry>
5724 <term><option>-n</option></term>
5725 <listitem>
5726 <para>
5727 <indexterm role="option">
5728 <primary><option>-n</option></primary>
5729 </indexterm>
5730 <indexterm role="concept">
5731 <primary>Sendmail compatibility</primary>
5732 <secondary><option>-n</option> option ignored</secondary>
5733 </indexterm>
5734 This option is interpreted by Sendmail to mean <quote>no aliasing</quote>. It is ignored
5735 by Exim.
5736 </para>
5737 </listitem></varlistentry>
5738 <varlistentry>
5739 <term><option>-O</option>&nbsp;&lt;<emphasis>data</emphasis>&gt;</term>
5740 <listitem>
5741 <para>
5742 <indexterm role="option">
5743 <primary><option>-O</option></primary>
5744 </indexterm>
5745 This option is interpreted by Sendmail to mean <literal>set option</literal>. It is ignored by
5746 Exim.
5747 </para>
5748 </listitem></varlistentry>
5749 <varlistentry>
5750 <term><option>-oA</option>&nbsp;&lt;<emphasis>file&nbsp;name</emphasis>&gt;</term>
5751 <listitem>
5752 <para>
5753 <indexterm role="option">
5754 <primary><option>-oA</option></primary>
5755 </indexterm>
5756 <indexterm role="concept">
5757 <primary>Sendmail compatibility</primary>
5758 <secondary><option>-oA</option> option</secondary>
5759 </indexterm>
5760 This option is used by Sendmail in conjunction with <option>-bi</option> to specify an
5761 alternative alias file name. Exim handles <option>-bi</option> differently; see the
5762 description above.
5763 </para>
5764 </listitem></varlistentry>
5765 <varlistentry>
5766 <term><option>-oB</option>&nbsp;&lt;<emphasis>n</emphasis>&gt;</term>
5767 <listitem>
5768 <para>
5769 <indexterm role="option">
5770 <primary><option>-oB</option></primary>
5771 </indexterm>
5772 <indexterm role="concept">
5773 <primary>SMTP</primary>
5774 <secondary>passed connection</secondary>
5775 </indexterm>
5776 <indexterm role="concept">
5777 <primary>SMTP</primary>
5778 <secondary>multiple deliveries</secondary>
5779 </indexterm>
5780 <indexterm role="concept">
5781 <primary>multiple SMTP deliveries</primary>
5782 </indexterm>
5783 This is a debugging option which limits the maximum number of messages that can
5784 be delivered down one SMTP connection, overriding the value set in any <command>smtp</command>
5785 transport. If &lt;<emphasis>n</emphasis>&gt; is omitted, the limit is set to 1.
5786 </para>
5787 </listitem></varlistentry>
5788 <varlistentry>
5789 <term><option>-odb</option></term>
5790 <listitem>
5791 <para>
5792 <indexterm role="option">
5793 <primary><option>-odb</option></primary>
5794 </indexterm>
5795 <indexterm role="concept">
5796 <primary>background delivery</primary>
5797 </indexterm>
5798 <indexterm role="concept">
5799 <primary>delivery</primary>
5800 <secondary>in the background</secondary>
5801 </indexterm>
5802 This option applies to all modes in which Exim accepts incoming messages,
5803 including the listening daemon. It requests <quote>background</quote> delivery of such
5804 messages, which means that the accepting process automatically starts a
5805 delivery process for each message received, but does not wait for the delivery
5806 processes to finish.
5807 </para>
5808 <para>
5809 When all the messages have been received, the reception process exits,
5810 leaving the delivery processes to finish in their own time. The standard output
5811 and error streams are closed at the start of each delivery process.
5812 This is the default action if none of the <option>-od</option> options are present.
5813 </para>
5814 <para>
5815 If one of the queueing options in the configuration file
5816 (<option>queue_only</option> or <option>queue_only_file</option>, for example) is in effect, <option>-odb</option>
5817 overrides it if <option>queue_only_override</option> is set true, which is the default
5818 setting. If <option>queue_only_override</option> is set false, <option>-odb</option> has no effect.
5819 </para>
5820 </listitem></varlistentry>
5821 <varlistentry>
5822 <term><option>-odf</option></term>
5823 <listitem>
5824 <para>
5825 <indexterm role="option">
5826 <primary><option>-odf</option></primary>
5827 </indexterm>
5828 <indexterm role="concept">
5829 <primary>foreground delivery</primary>
5830 </indexterm>
5831 <indexterm role="concept">
5832 <primary>delivery</primary>
5833 <secondary>in the foreground</secondary>
5834 </indexterm>
5835 This option requests <quote>foreground</quote> (synchronous) delivery when Exim has
5836 accepted a locally-generated message. (For the daemon it is exactly the same as
5837 <option>-odb</option>.) A delivery process is automatically started to deliver the message,
5838 and Exim waits for it to complete before proceeding.
5839 </para>
5840 <para>
5841 The original Exim reception process does not finish until the delivery
5842 process for the final message has ended. The standard error stream is left open
5843 during deliveries.
5844 </para>
5845 <para>
5846 However, like <option>-odb</option>, this option has no effect if <option>queue_only_override</option> is
5847 false and one of the queueing options in the configuration file is in effect.
5848 </para>
5849 <para>
5850 If there is a temporary delivery error during foreground delivery, the
5851 message is left on the queue for later delivery, and the original reception
5852 process exits. See chapter <xref linkend="CHAPnonqueueing"/> for a way of setting up a
5853 restricted configuration that never queues messages.
5854 </para>
5855 </listitem></varlistentry>
5856 <varlistentry>
5857 <term><option>-odi</option></term>
5858 <listitem>
5859 <para>
5860 <indexterm role="option">
5861 <primary><option>-odi</option></primary>
5862 </indexterm>
5863 This option is synonymous with <option>-odf</option>. It is provided for compatibility with
5864 Sendmail.
5865 </para>
5866 </listitem></varlistentry>
5867 <varlistentry>
5868 <term><option>-odq</option></term>
5869 <listitem>
5870 <para>
5871 <indexterm role="option">
5872 <primary><option>-odq</option></primary>
5873 </indexterm>
5874 <indexterm role="concept">
5875 <primary>non-immediate delivery</primary>
5876 </indexterm>
5877 <indexterm role="concept">
5878 <primary>delivery</primary>
5879 <secondary>suppressing immediate</secondary>
5880 </indexterm>
5881 <indexterm role="concept">
5882 <primary>queueing incoming messages</primary>
5883 </indexterm>
5884 This option applies to all modes in which Exim accepts incoming messages,
5885 including the listening daemon. It specifies that the accepting process should
5886 not automatically start a delivery process for each message received. Messages
5887 are placed on the queue, and remain there until a subsequent queue runner
5888 process encounters them. There are several configuration options (such as
5889 <option>queue_only</option>) that can be used to queue incoming messages under certain
5890 conditions. This option overrides all of them and also <option>-odqs</option>. It always
5891 forces queueing.
5892 </para>
5893 </listitem></varlistentry>
5894 <varlistentry>
5895 <term><option>-odqs</option></term>
5896 <listitem>
5897 <para>
5898 <indexterm role="option">
5899 <primary><option>-odqs</option></primary>
5900 </indexterm>
5901 <indexterm role="concept">
5902 <primary>SMTP</primary>
5903 <secondary>delaying delivery</secondary>
5904 </indexterm>
5905 This option is a hybrid between <option>-odb</option>/<option>-odi</option> and <option>-odq</option>.
5906 However, like <option>-odb</option> and <option>-odi</option>, this option has no effect if
5907 <option>queue_only_override</option> is false and one of the queueing options in the
5908 configuration file is in effect.
5909 </para>
5910 <para>
5911 When <option>-odqs</option> does operate, a delivery process is started for each incoming
5912 message, in the background by default, but in the foreground if <option>-odi</option> is
5913 also present. The recipient addresses are routed, and local deliveries are done
5914 in the normal way. However, if any SMTP deliveries are required, they are not
5915 done at this time, so the message remains on the queue until a subsequent queue
5916 runner process encounters it. Because routing was done, Exim knows which
5917 messages are waiting for which hosts, and so a number of messages for the same
5918 host can be sent in a single SMTP connection. The <option>queue_smtp_domains</option>
5919 configuration option has the same effect for specific domains. See also the
5920 <option>-qq</option> option.
5921 </para>
5922 </listitem></varlistentry>
5923 <varlistentry>
5924 <term><option>-oee</option></term>
5925 <listitem>
5926 <para>
5927 <indexterm role="option">
5928 <primary><option>-oee</option></primary>
5929 </indexterm>
5930 <indexterm role="concept">
5931 <primary>error</primary>
5932 <secondary>reporting</secondary>
5933 </indexterm>
5934 If an error is detected while a non-SMTP message is being received (for
5935 example, a malformed address), the error is reported to the sender in a mail
5936 message.
5937 </para>
5938 <para>
5939 <indexterm role="concept">
5940 <primary>return code</primary>
5941 <secondary>for <option>-oee</option></secondary>
5942 </indexterm>
5943 Provided
5944 this error message is successfully sent, the Exim receiving process
5945 exits with a return code of zero. If not, the return code is 2 if the problem
5946 is that the original message has no recipients, or 1 any other error. This is
5947 the default <option>-oe</option><emphasis>x</emphasis> option if Exim is called as <emphasis>rmail</emphasis>.
5948 </para>
5949 </listitem></varlistentry>
5950 <varlistentry>
5951 <term><option>-oem</option></term>
5952 <listitem>
5953 <para>
5954 <indexterm role="option">
5955 <primary><option>-oem</option></primary>
5956 </indexterm>
5957 <indexterm role="concept">
5958 <primary>error</primary>
5959 <secondary>reporting</secondary>
5960 </indexterm>
5961 <indexterm role="concept">
5962 <primary>return code</primary>
5963 <secondary>for <option>-oem</option></secondary>
5964 </indexterm>
5965 This is the same as <option>-oee</option>, except that Exim always exits with a non-zero
5966 return code, whether or not the error message was successfully sent.
5967 This is the default <option>-oe</option><emphasis>x</emphasis> option, unless Exim is called as <emphasis>rmail</emphasis>.
5968 </para>
5969 </listitem></varlistentry>
5970 <varlistentry>
5971 <term><option>-oep</option></term>
5972 <listitem>
5973 <para>
5974 <indexterm role="option">
5975 <primary><option>-oep</option></primary>
5976 </indexterm>
5977 <indexterm role="concept">
5978 <primary>error</primary>
5979 <secondary>reporting</secondary>
5980 </indexterm>
5981 If an error is detected while a non-SMTP message is being received, the
5982 error is reported by writing a message to the standard error file (stderr).
5983 <indexterm role="concept">
5984 <primary>return code</primary>
5985 <secondary>for <option>-oep</option></secondary>
5986 </indexterm>
5987 The return code is 1 for all errors.
5988 </para>
5989 </listitem></varlistentry>
5990 <varlistentry>
5991 <term><option>-oeq</option></term>
5992 <listitem>
5993 <para>
5994 <indexterm role="option">
5995 <primary><option>-oeq</option></primary>
5996 </indexterm>
5997 <indexterm role="concept">
5998 <primary>error</primary>
5999 <secondary>reporting</secondary>
6000 </indexterm>
6001 This option is supported for compatibility with Sendmail, but has the same
6002 effect as <option>-oep</option>.
6003 </para>
6004 </listitem></varlistentry>
6005 <varlistentry>
6006 <term><option>-oew</option></term>
6007 <listitem>
6008 <para>
6009 <indexterm role="option">
6010 <primary><option>-oew</option></primary>
6011 </indexterm>
6012 <indexterm role="concept">
6013 <primary>error</primary>
6014 <secondary>reporting</secondary>
6015 </indexterm>
6016 This option is supported for compatibility with Sendmail, but has the same
6017 effect as <option>-oem</option>.
6018 </para>
6019 </listitem></varlistentry>
6020 <varlistentry>
6021 <term><option>-oi</option></term>
6022 <listitem>
6023 <para>
6024 <indexterm role="option">
6025 <primary><option>-oi</option></primary>
6026 </indexterm>
6027 <indexterm role="concept">
6028 <primary>dot</primary>
6029 <secondary>in incoming non-SMTP message</secondary>
6030 </indexterm>
6031 This option, which has the same effect as <option>-i</option>, specifies that a dot on a
6032 line by itself should not terminate an incoming, non-SMTP message. Otherwise, a
6033 single dot does terminate, though Exim does no special processing for other
6034 lines that start with a dot. This option is set by default if Exim is called as
6035 <emphasis>rmail</emphasis>. See also <option>-ti</option>.
6036 </para>
6037 </listitem></varlistentry>
6038 <varlistentry>
6039 <term><option>-oitrue</option></term>
6040 <listitem>
6041 <para>
6042 <indexterm role="option">
6043 <primary><option>-oitrue</option></primary>
6044 </indexterm>
6045 This option is treated as synonymous with <option>-oi</option>.
6046 </para>
6047 </listitem></varlistentry>
6048 <varlistentry>
6049 <term><option>-oMa</option>&nbsp;&lt;<emphasis>host&nbsp;address</emphasis>&gt;</term>
6050 <listitem>
6051 <para>
6052 <indexterm role="option">
6053 <primary><option>-oMa</option></primary>
6054 </indexterm>
6055 <indexterm role="concept">
6056 <primary>sender</primary>
6057 <secondary>host address, specifying for local message</secondary>
6058 </indexterm>
6059 A number of options starting with <option>-oM</option> can be used to set values associated
6060 with remote hosts on locally-submitted messages (that is, messages not received
6061 over TCP/IP). These options can be used by any caller in conjunction with the
6062 <option>-bh</option>, <option>-be</option>, <option>-bf</option>, <option>-bF</option>, <option>-bt</option>, or <option>-bv</option> testing options. In
6063 other circumstances, they are ignored unless the caller is trusted.
6064 </para>
6065 <para>
6066 The <option>-oMa</option> option sets the sender host address. This may include a port
6067 number at the end, after a full stop (period). For example:
6068 </para>
6069 <literallayout class="monospaced">
6070 exim -bs -oMa 10.9.8.7.1234
6071 </literallayout>
6072 <para>
6073 An alternative syntax is to enclose the IP address in square brackets,
6074 followed by a colon and the port number:
6075 </para>
6076 <literallayout class="monospaced">
6077 exim -bs -oMa [10.9.8.7]:1234
6078 </literallayout>
6079 <para>
6080 The IP address is placed in the <varname>$sender_host_address</varname> variable, and the
6081 port, if present, in <varname>$sender_host_port</varname>. If both <option>-oMa</option> and <option>-bh</option>
6082 are present on the command line, the sender host IP address is taken from
6083 whichever one is last.
6084 </para>
6085 </listitem></varlistentry>
6086 <varlistentry>
6087 <term><option>-oMaa</option>&nbsp;&lt;<emphasis>name</emphasis>&gt;</term>
6088 <listitem>
6089 <para>
6090 <indexterm role="option">
6091 <primary><option>-oMaa</option></primary>
6092 </indexterm>
6093 <indexterm role="concept">
6094 <primary>authentication</primary>
6095 <secondary>name, specifying for local message</secondary>
6096 </indexterm>
6097 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMaa</option>
6098 option sets the value of <varname>$sender_host_authenticated</varname> (the authenticator
6099 name). See chapter <xref linkend="CHAPSMTPAUTH"/> for a discussion of SMTP authentication.
6100 This option can be used with <option>-bh</option> and <option>-bs</option> to set up an
6101 authenticated SMTP session without actually using the SMTP AUTH command.
6102 </para>
6103 </listitem></varlistentry>
6104 <varlistentry>
6105 <term><option>-oMai</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6106 <listitem>
6107 <para>
6108 <indexterm role="option">
6109 <primary><option>-oMai</option></primary>
6110 </indexterm>
6111 <indexterm role="concept">
6112 <primary>authentication</primary>
6113 <secondary>id, specifying for local message</secondary>
6114 </indexterm>
6115 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMai</option>
6116 option sets the value of <varname>$authenticated_id</varname> (the id that was authenticated).
6117 This overrides the default value (the caller&#x2019;s login id, except with <option>-bh</option>,
6118 where there is no default) for messages from local sources. See chapter
6119 <xref linkend="CHAPSMTPAUTH"/> for a discussion of authenticated ids.
6120 </para>
6121 </listitem></varlistentry>
6122 <varlistentry>
6123 <term><option>-oMas</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
6124 <listitem>
6125 <para>
6126 <indexterm role="option">
6127 <primary><option>-oMas</option></primary>
6128 </indexterm>
6129 <indexterm role="concept">
6130 <primary>authentication</primary>
6131 <secondary>sender, specifying for local message</secondary>
6132 </indexterm>
6133 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMas</option>
6134 option sets the authenticated sender value in <varname>$authenticated_sender</varname>. It
6135 overrides the sender address that is created from the caller&#x2019;s login id for
6136 messages from local sources, except when <option>-bh</option> is used, when there is no
6137 default. For both <option>-bh</option> and <option>-bs</option>, an authenticated sender that is
6138 specified on a MAIL command overrides this value. See chapter
6139 <xref linkend="CHAPSMTPAUTH"/> for a discussion of authenticated senders.
6140 </para>
6141 </listitem></varlistentry>
6142 <varlistentry>
6143 <term><option>-oMi</option>&nbsp;&lt;<emphasis>interface&nbsp;address</emphasis>&gt;</term>
6144 <listitem>
6145 <para>
6146 <indexterm role="option">
6147 <primary><option>-oMi</option></primary>
6148 </indexterm>
6149 <indexterm role="concept">
6150 <primary>interface</primary>
6151 <secondary>address, specifying for local message</secondary>
6152 </indexterm>
6153 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMi</option>
6154 option sets the IP interface address value. A port number may be included,
6155 using the same syntax as for <option>-oMa</option>. The interface address is placed in
6156 <varname>$received_ip_address</varname> and the port number, if present, in <varname>$received_port</varname>.
6157 </para>
6158 </listitem></varlistentry>
6159 <varlistentry>
6160 <term><option>-oMr</option>&nbsp;&lt;<emphasis>protocol&nbsp;name</emphasis>&gt;</term>
6161 <listitem>
6162 <para>
6163 <indexterm role="option">
6164 <primary><option>-oMr</option></primary>
6165 </indexterm>
6166 <indexterm role="concept">
6167 <primary>protocol, specifying for local message</primary>
6168 </indexterm>
6169 <indexterm role="variable">
6170 <primary><varname>$received_protocol</varname></primary>
6171 </indexterm>
6172 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMr</option>
6173 option sets the received protocol value that is stored in
6174 <varname>$received_protocol</varname>. However, it does not apply (and is ignored) when <option>-bh</option>
6175 or <option>-bs</option> is used. For <option>-bh</option>, the protocol is forced to one of the standard
6176 SMTP protocol names (see the description of <varname>$received_protocol</varname> in section
6177 <xref linkend="SECTexpvar"/>). For <option>-bs</option>, the protocol is always <quote>local-</quote> followed by
6178 one of those same names. For <option>-bS</option> (batched SMTP) however, the protocol can
6179 be set by <option>-oMr</option>.
6180 </para>
6181 </listitem></varlistentry>
6182 <varlistentry>
6183 <term><option>-oMs</option>&nbsp;&lt;<emphasis>host&nbsp;name</emphasis>&gt;</term>
6184 <listitem>
6185 <para>
6186 <indexterm role="option">
6187 <primary><option>-oMs</option></primary>
6188 </indexterm>
6189 <indexterm role="concept">
6190 <primary>sender</primary>
6191 <secondary>host name, specifying for local message</secondary>
6192 </indexterm>
6193 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMs</option>
6194 option sets the sender host name in <varname>$sender_host_name</varname>. When this option is
6195 present, Exim does not attempt to look up a host name from an IP address; it
6196 uses the name it is given.
6197 </para>
6198 </listitem></varlistentry>
6199 <varlistentry>
6200 <term><option>-oMt</option>&nbsp;&lt;<emphasis>ident&nbsp;string</emphasis>&gt;</term>
6201 <listitem>
6202 <para>
6203 <indexterm role="option">
6204 <primary><option>-oMt</option></primary>
6205 </indexterm>
6206 <indexterm role="concept">
6207 <primary>sender</primary>
6208 <secondary>ident string, specifying for local message</secondary>
6209 </indexterm>
6210 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMt</option>
6211 option sets the sender ident value in <varname>$sender_ident</varname>. The default setting for
6212 local callers is the login id of the calling process, except when <option>-bh</option> is
6213 used, when there is no default.
6214 </para>
6215 </listitem></varlistentry>
6216 <varlistentry>
6217 <term><option>-om</option></term>
6218 <listitem>
6219 <para>
6220 <indexterm role="option">
6221 <primary><option>-om</option></primary>
6222 </indexterm>
6223 <indexterm role="concept">
6224 <primary>Sendmail compatibility</primary>
6225 <secondary><option>-om</option> option ignored</secondary>
6226 </indexterm>
6227 In Sendmail, this option means <quote>me too</quote>, indicating that the sender of a
6228 message should receive a copy of the message if the sender appears in an alias
6229 expansion. Exim always does this, so the option does nothing.
6230 </para>
6231 </listitem></varlistentry>
6232 <varlistentry>
6233 <term><option>-oo</option></term>
6234 <listitem>
6235 <para>
6236 <indexterm role="option">
6237 <primary><option>-oo</option></primary>
6238 </indexterm>
6239 <indexterm role="concept">
6240 <primary>Sendmail compatibility</primary>
6241 <secondary><option>-oo</option> option ignored</secondary>
6242 </indexterm>
6243 This option is ignored. In Sendmail it specifies <quote>old style headers</quote>,
6244 whatever that means.
6245 </para>
6246 </listitem></varlistentry>
6247 <varlistentry>
6248 <term><option>-oP</option>&nbsp;&lt;<emphasis>path</emphasis>&gt;</term>
6249 <listitem>
6250 <para>
6251 <indexterm role="option">
6252 <primary><option>-oP</option></primary>
6253 </indexterm>
6254 <indexterm role="concept">
6255 <primary>pid (process id)</primary>
6256 <secondary>of daemon</secondary>
6257 </indexterm>
6258 <indexterm role="concept">
6259 <primary>daemon</primary>
6260 <secondary>process id (pid)</secondary>
6261 </indexterm>
6262 This option is useful only in conjunction with <option>-bd</option> or <option>-q</option> with a time
6263 value. The option specifies the file to which the process id of the daemon is
6264 written. When <option>-oX</option> is used with <option>-bd</option>, or when <option>-q</option> with a time is used
6265 without <option>-bd</option>, this is the only way of causing Exim to write a pid file,
6266 because in those cases, the normal pid file is not used.
6267 </para>
6268 </listitem></varlistentry>
6269 <varlistentry>
6270 <term><option>-or</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
6271 <listitem>
6272 <para>
6273 <indexterm role="option">
6274 <primary><option>-or</option></primary>
6275 </indexterm>
6276 <indexterm role="concept">
6277 <primary>timeout</primary>
6278 <secondary>for non-SMTP input</secondary>
6279 </indexterm>
6280 This option sets a timeout value for incoming non-SMTP messages. If it is not
6281 set, Exim will wait forever for the standard input. The value can also be set
6282 by the <option>receive_timeout</option> option. The format used for specifying times is
6283 described in section <xref linkend="SECTtimeformat"/>.
6284 </para>
6285 </listitem></varlistentry>
6286 <varlistentry>
6287 <term><option>-os</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
6288 <listitem>
6289 <para>
6290 <indexterm role="option">
6291 <primary><option>-os</option></primary>
6292 </indexterm>
6293 <indexterm role="concept">
6294 <primary>timeout</primary>
6295 <secondary>for SMTP input</secondary>
6296 </indexterm>
6297 <indexterm role="concept">
6298 <primary>SMTP</primary>
6299 <secondary>input timeout</secondary>
6300 </indexterm>
6301 This option sets a timeout value for incoming SMTP messages. The timeout
6302 applies to each SMTP command and block of data. The value can also be set by
6303 the <option>smtp_receive_timeout</option> option; it defaults to 5 minutes. The format used
6304 for specifying times is described in section <xref linkend="SECTtimeformat"/>.
6305 </para>
6306 </listitem></varlistentry>
6307 <varlistentry>
6308 <term><option>-ov</option></term>
6309 <listitem>
6310 <para>
6311 <indexterm role="option">
6312 <primary><option>-ov</option></primary>
6313 </indexterm>
6314 This option has exactly the same effect as <option>-v</option>.
6315 </para>
6316 </listitem></varlistentry>
6317 <varlistentry>
6318 <term><option>-oX</option>&nbsp;&lt;<emphasis>number&nbsp;or&nbsp;string</emphasis>&gt;</term>
6319 <listitem>
6320 <para>
6321 <indexterm role="option">
6322 <primary><option>-oX</option></primary>
6323 </indexterm>
6324 <indexterm role="concept">
6325 <primary>TCP/IP</primary>
6326 <secondary>setting listening ports</secondary>
6327 </indexterm>
6328 <indexterm role="concept">
6329 <primary>TCP/IP</primary>
6330 <secondary>setting listening interfaces</secondary>
6331 </indexterm>
6332 <indexterm role="concept">
6333 <primary>port</primary>
6334 <secondary>receiving TCP/IP</secondary>
6335 </indexterm>
6336 This option is relevant only when the <option>-bd</option> (start listening daemon) option
6337 is also given. It controls which ports and interfaces the daemon uses. Details
6338 of the syntax, and how it interacts with configuration file options, are given
6339 in chapter <xref linkend="CHAPinterfaces"/>. When <option>-oX</option> is used to start a daemon, no pid
6340 file is written unless <option>-oP</option> is also present to specify a pid file name.
6341 </para>
6342 </listitem></varlistentry>
6343 <varlistentry>
6344 <term><option>-pd</option></term>
6345 <listitem>
6346 <para>
6347 <indexterm role="option">
6348 <primary><option>-pd</option></primary>
6349 </indexterm>
6350 <indexterm role="concept">
6351 <primary>Perl</primary>
6352 <secondary>starting the interpreter</secondary>
6353 </indexterm>
6354 This option applies when an embedded Perl interpreter is linked with Exim (see
6355 chapter <xref linkend="CHAPperl"/>). It overrides the setting of the <option>perl_at_start</option>
6356 option, forcing the starting of the interpreter to be delayed until it is
6357 needed.
6358 </para>
6359 </listitem></varlistentry>
6360 <varlistentry>
6361 <term><option>-ps</option></term>
6362 <listitem>
6363 <para>
6364 <indexterm role="option">
6365 <primary><option>-ps</option></primary>
6366 </indexterm>
6367 <indexterm role="concept">
6368 <primary>Perl</primary>
6369 <secondary>starting the interpreter</secondary>
6370 </indexterm>
6371 This option applies when an embedded Perl interpreter is linked with Exim (see
6372 chapter <xref linkend="CHAPperl"/>). It overrides the setting of the <option>perl_at_start</option>
6373 option, forcing the starting of the interpreter to occur as soon as Exim is
6374 started.
6375 </para>
6376 </listitem></varlistentry>
6377 <varlistentry>
6378 <term><option>-p</option>&lt;<emphasis>rval</emphasis>&gt;:&lt;<emphasis>sval</emphasis>&gt;</term>
6379 <listitem>
6380 <para>
6381 <indexterm role="option">
6382 <primary><option>-p</option></primary>
6383 </indexterm>
6384 For compatibility with Sendmail, this option is equivalent to
6385 </para>
6386 <literallayout>
6387 <literal>-oMr</literal> &lt;<emphasis>rval</emphasis>&gt; <literal>-oMs</literal> &lt;<emphasis>sval</emphasis>&gt;
6388 </literallayout>
6389 <para>
6390 It sets the incoming protocol and host name (for trusted callers). The
6391 host name and its colon can be omitted when only the protocol is to be set.
6392 Note the Exim already has two private options, <option>-pd</option> and <option>-ps</option>, that refer
6393 to embedded Perl. It is therefore impossible to set a protocol value of <literal>p</literal>
6394 or <literal>s</literal> using this option (but that does not seem a real limitation).
6395 </para>
6396 </listitem></varlistentry>
6397 <varlistentry>
6398 <term><option>-q</option></term>
6399 <listitem>
6400 <para>
6401 <indexterm role="option">
6402 <primary><option>-q</option></primary>
6403 </indexterm>
6404 <indexterm role="concept">
6405 <primary>queue runner</primary>
6406 <secondary>starting manually</secondary>
6407 </indexterm>
6408 This option is normally restricted to admin users. However, there is a
6409 configuration option called <option>prod_requires_admin</option> which can be set false to
6410 relax this restriction (and also the same requirement for the <option>-M</option>, <option>-R</option>,
6411 and <option>-S</option> options).
6412 </para>
6413 <para>
6414 <indexterm role="concept">
6415 <primary>queue runner</primary>
6416 <secondary>description of operation</secondary>
6417 </indexterm>
6418 The <option>-q</option> option starts one queue runner process. This scans the queue of
6419 waiting messages, and runs a delivery process for each one in turn. It waits
6420 for each delivery process to finish before starting the next one. A delivery
6421 process may not actually do any deliveries if the retry times for the addresses
6422 have not been reached. Use <option>-qf</option> (see below) if you want to override this.
6423 </para>
6424 <para>
6425 If
6426 <indexterm role="concept">
6427 <primary>SMTP</primary>
6428 <secondary>passed connection</secondary>
6429 </indexterm>
6430 <indexterm role="concept">
6431 <primary>SMTP</primary>
6432 <secondary>multiple deliveries</secondary>
6433 </indexterm>
6434 <indexterm role="concept">
6435 <primary>multiple SMTP deliveries</primary>
6436 </indexterm>
6437 the delivery process spawns other processes to deliver other messages down
6438 passed SMTP connections, the queue runner waits for these to finish before
6439 proceeding.
6440 </para>
6441 <para>
6442 When all the queued messages have been considered, the original queue runner
6443 process terminates. In other words, a single pass is made over the waiting
6444 mail, one message at a time. Use <option>-q</option> with a time (see below) if you want
6445 this to be repeated periodically.
6446 </para>
6447 <para>
6448 Exim processes the waiting messages in an unpredictable order. It isn&#x2019;t very
6449 random, but it is likely to be different each time, which is all that matters.
6450 If one particular message screws up a remote MTA, other messages to the same
6451 MTA have a chance of getting through if they get tried first.
6452 </para>
6453 <para>
6454 It is possible to cause the messages to be processed in lexical message id
6455 order, which is essentially the order in which they arrived, by setting the
6456 <option>queue_run_in_order</option> option, but this is not recommended for normal use.
6457 </para>
6458 </listitem></varlistentry>
6459 <varlistentry>
6460 <term><option>-q</option>&lt;<emphasis>qflags</emphasis>&gt;</term>
6461 <listitem>
6462 <para>
6463 The <option>-q</option> option may be followed by one or more flag letters that change its
6464 behaviour. They are all optional, but if more than one is present, they must
6465 appear in the correct order. Each flag is described in a separate item below.
6466 </para>
6467 </listitem></varlistentry>
6468 <varlistentry>
6469 <term><option>-qq...</option></term>
6470 <listitem>
6471 <para>
6472 <indexterm role="option">
6473 <primary><option>-qq</option></primary>
6474 </indexterm>
6475 <indexterm role="concept">
6476 <primary>queue</primary>
6477 <secondary>double scanning</secondary>
6478 </indexterm>
6479 <indexterm role="concept">
6480 <primary>queue</primary>
6481 <secondary>routing</secondary>
6482 </indexterm>
6483 <indexterm role="concept">
6484 <primary>routing</primary>
6485 <secondary>whole queue before delivery</secondary>
6486 </indexterm>
6487 An option starting with <option>-qq</option> requests a two-stage queue run. In the first
6488 stage, the queue is scanned as if the <option>queue_smtp_domains</option> option matched
6489 every domain. Addresses are routed, local deliveries happen, but no remote
6490 transports are run.
6491 </para>
6492 <para>
6493 <indexterm role="concept">
6494 <primary>hints database</primary>
6495 <secondary>remembering routing</secondary>
6496 </indexterm>
6497 The hints database that remembers which messages are waiting for specific hosts
6498 is updated, as if delivery to those hosts had been deferred. After this is
6499 complete, a second, normal queue scan happens, with routing and delivery taking
6500 place as normal. Messages that are routed to the same host should mostly be
6501 delivered down a single SMTP
6502 <indexterm role="concept">
6503 <primary>SMTP</primary>
6504 <secondary>passed connection</secondary>
6505 </indexterm>
6506 <indexterm role="concept">
6507 <primary>SMTP</primary>
6508 <secondary>multiple deliveries</secondary>
6509 </indexterm>
6510 <indexterm role="concept">
6511 <primary>multiple SMTP deliveries</primary>
6512 </indexterm>
6513 connection because of the hints that were set up during the first queue scan.
6514 This option may be useful for hosts that are connected to the Internet
6515 intermittently.
6516 </para>
6517 </listitem></varlistentry>
6518 <varlistentry>
6519 <term><option>-q[q]i...</option></term>
6520 <listitem>
6521 <para>
6522 <indexterm role="option">
6523 <primary><option>-qi</option></primary>
6524 </indexterm>
6525 <indexterm role="concept">
6526 <primary>queue</primary>
6527 <secondary>initial delivery</secondary>
6528 </indexterm>
6529 If the <emphasis>i</emphasis> flag is present, the queue runner runs delivery processes only for
6530 those messages that haven&#x2019;t previously been tried. (<emphasis>i</emphasis> stands for <quote>initial
6531 delivery</quote>.) This can be helpful if you are putting messages on the queue using
6532 <option>-odq</option> and want a queue runner just to process the new messages.
6533 </para>
6534 </listitem></varlistentry>
6535 <varlistentry>
6536 <term><option>-q[q][i]f...</option></term>
6537 <listitem>
6538 <para>
6539 <indexterm role="option">
6540 <primary><option>-qf</option></primary>
6541 </indexterm>
6542 <indexterm role="concept">
6543 <primary>queue</primary>
6544 <secondary>forcing delivery</secondary>
6545 </indexterm>
6546 <indexterm role="concept">
6547 <primary>delivery</primary>
6548 <secondary>forcing in queue run</secondary>
6549 </indexterm>
6550 If one <emphasis>f</emphasis> flag is present, a delivery attempt is forced for each non-frozen
6551 message, whereas without <emphasis>f</emphasis> only those non-frozen addresses that have passed
6552 their retry times are tried.
6553 </para>
6554 </listitem></varlistentry>
6555 <varlistentry>
6556 <term><option>-q[q][i]ff...</option></term>
6557 <listitem>
6558 <para>
6559 <indexterm role="option">
6560 <primary><option>-qff</option></primary>
6561 </indexterm>
6562 <indexterm role="concept">
6563 <primary>frozen messages</primary>
6564 <secondary>forcing delivery</secondary>
6565 </indexterm>
6566 If <emphasis>ff</emphasis> is present, a delivery attempt is forced for every message, whether
6567 frozen or not.
6568 </para>
6569 </listitem></varlistentry>
6570 <varlistentry>
6571 <term><option>-q[q][i][f[f]]l</option></term>
6572 <listitem>
6573 <para>
6574 <indexterm role="option">
6575 <primary><option>-ql</option></primary>
6576 </indexterm>
6577 <indexterm role="concept">
6578 <primary>queue</primary>
6579 <secondary>local deliveries only</secondary>
6580 </indexterm>
6581 The <emphasis>l</emphasis> (the letter <quote>ell</quote>) flag specifies that only local deliveries are to
6582 be done. If a message requires any remote deliveries, it remains on the queue
6583 for later delivery.
6584 </para>
6585 </listitem></varlistentry>
6586 <varlistentry>
6587 <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>
6588 <listitem>
6589 <para>
6590 <indexterm role="concept">
6591 <primary>queue</primary>
6592 <secondary>delivering specific messages</secondary>
6593 </indexterm>
6594 When scanning the queue, Exim can be made to skip over messages whose ids are
6595 lexically less than a given value by following the <option>-q</option> option with a
6596 starting message id. For example:
6597 </para>
6598 <literallayout class="monospaced">
6599 exim -q 0t5C6f-0000c8-00
6600 </literallayout>
6601 <para>
6602 Messages that arrived earlier than <literal>0t5C6f-0000c8-00</literal> are not inspected. If a
6603 second message id is given, messages whose ids are lexically greater than it
6604 are also skipped. If the same id is given twice, for example,
6605 </para>
6606 <literallayout class="monospaced">
6607 exim -q 0t5C6f-0000c8-00 0t5C6f-0000c8-00
6608 </literallayout>
6609 <para>
6610 just one delivery process is started, for that message. This differs from
6611 <option>-M</option> in that retry data is respected, and it also differs from <option>-Mc</option> in
6612 that it counts as a delivery from a queue run. Note that the selection
6613 mechanism does not affect the order in which the messages are scanned. There
6614 are also other ways of selecting specific sets of messages for delivery in a
6615 queue run &ndash; see <option>-R</option> and <option>-S</option>.
6616 </para>
6617 </listitem></varlistentry>
6618 <varlistentry>
6619 <term><option>-q</option>&lt;<emphasis>qflags</emphasis>&gt;&lt;<emphasis>time</emphasis>&gt;</term>
6620 <listitem>
6621 <para>
6622 <indexterm role="concept">
6623 <primary>queue runner</primary>
6624 <secondary>starting periodically</secondary>
6625 </indexterm>
6626 <indexterm role="concept">
6627 <primary>periodic queue running</primary>
6628 </indexterm>
6629 When a time value is present, the <option>-q</option> option causes Exim to run as a daemon,
6630 starting a queue runner process at intervals specified by the given time value
6631 (whose format is described in section <xref linkend="SECTtimeformat"/>). This form of the
6632 <option>-q</option> option is commonly combined with the <option>-bd</option> option, in which case a
6633 single daemon process handles both functions. A common way of starting up a
6634 combined daemon at system boot time is to use a command such as
6635 </para>
6636 <literallayout class="monospaced">
6637 /usr/exim/bin/exim -bd -q30m
6638 </literallayout>
6639 <para>
6640 Such a daemon listens for incoming SMTP calls, and also starts a queue runner
6641 process every 30 minutes.
6642 </para>
6643 <para>
6644 When a daemon is started by <option>-q</option> with a time value, but without <option>-bd</option>, no
6645 pid file is written unless one is explicitly requested by the <option>-oP</option> option.
6646 </para>
6647 </listitem></varlistentry>
6648 <varlistentry>
6649 <term><option>-qR</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6650 <listitem>
6651 <para>
6652 <indexterm role="option">
6653 <primary><option>-qR</option></primary>
6654 </indexterm>
6655 This option is synonymous with <option>-R</option>. It is provided for Sendmail
6656 compatibility.
6657 </para>
6658 </listitem></varlistentry>
6659 <varlistentry>
6660 <term><option>-qS</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6661 <listitem>
6662 <para>
6663 <indexterm role="option">
6664 <primary><option>-qS</option></primary>
6665 </indexterm>
6666 This option is synonymous with <option>-S</option>.
6667 </para>
6668 </listitem></varlistentry>
6669 <varlistentry>
6670 <term><option>-R</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6671 <listitem>
6672 <para>
6673 <indexterm role="option">
6674 <primary><option>-R</option></primary>
6675 </indexterm>
6676 <indexterm role="concept">
6677 <primary>queue runner</primary>
6678 <secondary>for specific recipients</secondary>
6679 </indexterm>
6680 <indexterm role="concept">
6681 <primary>delivery</primary>
6682 <secondary>to given domain</secondary>
6683 </indexterm>
6684 <indexterm role="concept">
6685 <primary>domain</primary>
6686 <secondary>delivery to</secondary>
6687 </indexterm>
6688 The &lt;<emphasis>rsflags</emphasis>&gt; may be empty, in which case the white space before the string
6689 is optional, unless the string is <emphasis>f</emphasis>, <emphasis>ff</emphasis>, <emphasis>r</emphasis>, <emphasis>rf</emphasis>, or <emphasis>rff</emphasis>,
6690 which are the possible values for &lt;<emphasis>rsflags</emphasis>&gt;. White space is required if
6691 &lt;<emphasis>rsflags</emphasis>&gt; is not empty.
6692 </para>
6693 <para>
6694 This option is similar to <option>-q</option> with no time value, that is, it causes Exim to
6695 perform a single queue run, except that, when scanning the messages on the
6696 queue, Exim processes only those that have at least one undelivered recipient
6697 address containing the given string, which is checked in a case-independent
6698 way. If the &lt;<emphasis>rsflags</emphasis>&gt; start with <emphasis>r</emphasis>, &lt;<emphasis>string</emphasis>&gt; is interpreted as a
6699 regular expression; otherwise it is a literal string.
6700 </para>
6701 <para>
6702 If you want to do periodic queue runs for messages with specific recipients,
6703 you can combine <option>-R</option> with <option>-q</option> and a time value. For example:
6704 </para>
6705 <literallayout class="monospaced">
6706 exim -q25m -R @special.domain.example
6707 </literallayout>
6708 <para>
6709 This example does a queue run for messages with recipients in the given domain
6710 every 25 minutes. Any additional flags that are specified with <option>-q</option> are
6711 applied to each queue run.
6712 </para>
6713 <para>
6714 Once a message is selected for delivery by this mechanism, all its addresses
6715 are processed. For the first selected message, Exim overrides any retry
6716 information and forces a delivery attempt for each undelivered address. This
6717 means that if delivery of any address in the first message is successful, any
6718 existing retry information is deleted, and so delivery attempts for that
6719 address in subsequently selected messages (which are processed without forcing)
6720 will run. However, if delivery of any address does not succeed, the retry
6721 information is updated, and in subsequently selected messages, the failing
6722 address will be skipped.
6723 </para>
6724 <para>
6725 <indexterm role="concept">
6726 <primary>frozen messages</primary>
6727 <secondary>forcing delivery</secondary>
6728 </indexterm>
6729 If the &lt;<emphasis>rsflags</emphasis>&gt; contain <emphasis>f</emphasis> or <emphasis>ff</emphasis>, the delivery forcing applies to
6730 all selected messages, not just the first; frozen messages are included when
6731 <emphasis>ff</emphasis> is present.
6732 </para>
6733 <para>
6734 The <option>-R</option> option makes it straightforward to initiate delivery of all messages
6735 to a given domain after a host has been down for some time. When the SMTP
6736 command ETRN is accepted by its ACL (see chapter <xref linkend="CHAPACL"/>), its default
6737 effect is to run Exim with the <option>-R</option> option, but it can be configured to run
6738 an arbitrary command instead.
6739 </para>
6740 </listitem></varlistentry>
6741 <varlistentry>
6742 <term><option>-r</option></term>
6743 <listitem>
6744 <para>
6745 <indexterm role="option">
6746 <primary><option>-r</option></primary>
6747 </indexterm>
6748 This is a documented (for Sendmail) obsolete alternative name for <option>-f</option>.
6749 </para>
6750 </listitem></varlistentry>
6751 <varlistentry>
6752 <term><option>-S</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6753 <listitem>
6754 <para>
6755 <indexterm role="option">
6756 <primary><option>-S</option></primary>
6757 </indexterm>
6758 <indexterm role="concept">
6759 <primary>delivery</primary>
6760 <secondary>from given sender</secondary>
6761 </indexterm>
6762 <indexterm role="concept">
6763 <primary>queue runner</primary>
6764 <secondary>for specific senders</secondary>
6765 </indexterm>
6766 This option acts like <option>-R</option> except that it checks the string against each
6767 message&#x2019;s sender instead of against the recipients. If <option>-R</option> is also set, both
6768 conditions must be met for a message to be selected. If either of the options
6769 has <emphasis>f</emphasis> or <emphasis>ff</emphasis> in its flags, the associated action is taken.
6770 </para>
6771 </listitem></varlistentry>
6772 <varlistentry>
6773 <term><option>-Tqt</option>&nbsp;&lt;<emphasis>times</emphasis>&gt;</term>
6774 <listitem>
6775 <para>
6776 <indexterm role="option">
6777 <primary><option>-Tqt</option></primary>
6778 </indexterm>
6779 This an option that is exclusively for use by the Exim testing suite. It is not
6780 recognized when Exim is run normally. It allows for the setting up of explicit
6781 <quote>queue times</quote> so that various warning/retry features can be tested.
6782 </para>
6783 </listitem></varlistentry>
6784 <varlistentry>
6785 <term><option>-t</option></term>
6786 <listitem>
6787 <para>
6788 <indexterm role="option">
6789 <primary><option>-t</option></primary>
6790 </indexterm>
6791 <indexterm role="concept">
6792 <primary>recipient</primary>
6793 <secondary>extracting from header lines</secondary>
6794 </indexterm>
6795 <indexterm role="concept">
6796 <primary><emphasis>Bcc:</emphasis> header line</primary>
6797 </indexterm>
6798 <indexterm role="concept">
6799 <primary><emphasis>Cc:</emphasis> header line</primary>
6800 </indexterm>
6801 <indexterm role="concept">
6802 <primary><emphasis>To:</emphasis> header line</primary>
6803 </indexterm>
6804 When Exim is receiving a locally-generated, non-SMTP message on its standard
6805 input, the <option>-t</option> option causes the recipients of the message to be obtained
6806 from the <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and <emphasis>Bcc:</emphasis> header lines in the message instead of
6807 from the command arguments. The addresses are extracted before any rewriting
6808 takes place and the <emphasis>Bcc:</emphasis> header line, if present, is then removed.
6809 </para>
6810 <para>
6811 <indexterm role="concept">
6812 <primary>Sendmail compatibility</primary>
6813 <secondary><option>-t</option> option</secondary>
6814 </indexterm>
6815 If the command has any arguments, they specify addresses to which the message
6816 is <emphasis>not</emphasis> to be delivered. That is, the argument addresses are removed from
6817 the recipients list obtained from the headers. This is compatible with Smail 3
6818 and in accordance with the documented behaviour of several versions of
6819 Sendmail, as described in man pages on a number of operating systems (e.g.
6820 Solaris 8, IRIX 6.5, HP-UX 11). However, some versions of Sendmail <emphasis>add</emphasis>
6821 argument addresses to those obtained from the headers, and the O&#x2019;Reilly
6822 Sendmail book documents it that way. Exim can be made to add argument addresses
6823 instead of subtracting them by setting the option
6824 <option>extract_addresses_remove_arguments</option> false.
6825 </para>
6826 <para>
6827 <indexterm role="concept">
6828 <primary><option>Resent-</option> header lines</primary>
6829 <secondary>with <option>-t</option></secondary>
6830 </indexterm>
6831 If there are any <option>Resent-</option> header lines in the message, Exim extracts
6832 recipients from all <emphasis>Resent-To:</emphasis>, <emphasis>Resent-Cc:</emphasis>, and <emphasis>Resent-Bcc:</emphasis> header
6833 lines instead of from <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and <emphasis>Bcc:</emphasis>. This is for compatibility
6834 with Sendmail and other MTAs. (Prior to release 4.20, Exim gave an error if
6835 <option>-t</option> was used in conjunction with <option>Resent-</option> header lines.)
6836 </para>
6837 <para>
6838 RFC 2822 talks about different sets of <option>Resent-</option> header lines (for when a
6839 message is resent several times). The RFC also specifies that they should be
6840 added at the front of the message, and separated by <emphasis>Received:</emphasis> lines. It is
6841 not at all clear how <option>-t</option> should operate in the present of multiple sets,
6842 nor indeed exactly what constitutes a <quote>set</quote>.
6843 In practice, it seems that MUAs do not follow the RFC. The <option>Resent-</option> lines
6844 are often added at the end of the header, and if a message is resent more than
6845 once, it is common for the original set of <option>Resent-</option> headers to be renamed as
6846 <option>X-Resent-</option> when a new set is added. This removes any possible ambiguity.
6847 </para>
6848 </listitem></varlistentry>
6849 <varlistentry>
6850 <term><option>-ti</option></term>
6851 <listitem>
6852 <para>
6853 <indexterm role="option">
6854 <primary><option>-ti</option></primary>
6855 </indexterm>
6856 This option is exactly equivalent to <option>-t</option> <option>-i</option>. It is provided for
6857 compatibility with Sendmail.
6858 </para>
6859 </listitem></varlistentry>
6860 <varlistentry>
6861 <term><option>-tls-on-connect</option></term>
6862 <listitem>
6863 <para>
6864 <indexterm role="option">
6865 <primary><option>-tls-on-connect</option></primary>
6866 </indexterm>
6867 <indexterm role="concept">
6868 <primary>TLS</primary>
6869 <secondary>use without STARTTLS</secondary>
6870 </indexterm>
6871 <indexterm role="concept">
6872 <primary>TLS</primary>
6873 <secondary>automatic start</secondary>
6874 </indexterm>
6875 This option is available when Exim is compiled with TLS support. It forces all
6876 incoming SMTP connections to behave as if the incoming port is listed in the
6877 <option>tls_on_connect_ports</option> option. See section <xref linkend="SECTsupobssmt"/> and chapter
6878 <xref linkend="CHAPTLS"/> for further details.
6879 </para>
6880 </listitem></varlistentry>
6881 <varlistentry>
6882 <term><option>-U</option></term>
6883 <listitem>
6884 <para>
6885 <indexterm role="option">
6886 <primary><option>-U</option></primary>
6887 </indexterm>
6888 <indexterm role="concept">
6889 <primary>Sendmail compatibility</primary>
6890 <secondary><option>-U</option> option ignored</secondary>
6891 </indexterm>
6892 Sendmail uses this option for <quote>initial message submission</quote>, and its
6893 documentation states that in future releases, it may complain about
6894 syntactically invalid messages rather than fixing them when this flag is not
6895 set. Exim ignores this option.
6896 </para>
6897 </listitem></varlistentry>
6898 <varlistentry>
6899 <term><option>-v</option></term>
6900 <listitem>
6901 <para>
6902 <indexterm role="option">
6903 <primary><option>-v</option></primary>
6904 </indexterm>
6905 This option causes Exim to write information to the standard error stream,
6906 describing what it is doing. In particular, it shows the log lines for
6907 receiving and delivering a message, and if an SMTP connection is made, the SMTP
6908 dialogue is shown. Some of the log lines shown may not actually be written to
6909 the log if the setting of <option>log_selector</option> discards them. Any relevant
6910 selectors are shown with each log line. If none are shown, the logging is
6911 unconditional.
6912 </para>
6913 </listitem></varlistentry>
6914 <varlistentry>
6915 <term><option>-x</option></term>
6916 <listitem>
6917 <para>
6918 <indexterm role="option">
6919 <primary><option>-x</option></primary>
6920 </indexterm>
6921 AIX uses <option>-x</option> for a private purpose (<quote>mail from a local mail program has
6922 National Language Support extended characters in the body of the mail item</quote>).
6923 It sets <option>-x</option> when calling the MTA from its <option>mail</option> command. Exim ignores
6924 this option.
6925 </para>
6926 </listitem></varlistentry>
6927 </variablelist>
6928 <para>
6929 <indexterm role="concept" startref="IIDclo1" class="endofrange"/>
6930 <indexterm role="concept" startref="IIDclo2" class="endofrange"/>
6931 </para>
6932 <!-- === End of command line options === -->
6933 </section>
6934 </chapter>
6935
6936 <chapter id="CHAPconf">
6937 <title>The Exim run time configuration file</title>
6938 <titleabbrev>The runtime configuration file</titleabbrev>
6939 <para>
6940 <indexterm role="concept">
6941 <primary>run time configuration</primary>
6942 </indexterm>
6943 <indexterm role="concept">
6944 <primary>configuration file</primary>
6945 <secondary>general description</secondary>
6946 </indexterm>
6947 <indexterm role="concept">
6948 <primary>CONFIGURE_FILE</primary>
6949 </indexterm>
6950 <indexterm role="concept">
6951 <primary>configuration file</primary>
6952 <secondary>errors in</secondary>
6953 </indexterm>
6954 <indexterm role="concept">
6955 <primary>error</primary>
6956 <secondary>in configuration file</secondary>
6957 </indexterm>
6958 <indexterm role="concept">
6959 <primary>return code</primary>
6960 <secondary>for bad configuration</secondary>
6961 </indexterm>
6962 Exim uses a single run time configuration file that is read whenever an Exim
6963 binary is executed. Note that in normal operation, this happens frequently,
6964 because Exim is designed to operate in a distributed manner, without central
6965 control.
6966 </para>
6967 <para>
6968 If a syntax error is detected while reading the configuration file, Exim
6969 writes a message on the standard error, and exits with a non-zero return code.
6970 The message is also written to the panic log. <emphasis role="bold">Note</emphasis>: Only simple syntax
6971 errors can be detected at this time. The values of any expanded options are
6972 not checked until the expansion happens, even when the expansion does not
6973 actually alter the string.
6974 </para>
6975 <para>
6976 The name of the configuration file is compiled into the binary for security
6977 reasons, and is specified by the CONFIGURE_FILE compilation option. In
6978 most configurations, this specifies a single file. However, it is permitted to
6979 give a colon-separated list of file names, in which case Exim uses the first
6980 existing file in the list.
6981 </para>
6982 <para revisionflag="changed">
6983 <indexterm role="concept">
6984 <primary>EXIM_USER</primary>
6985 </indexterm>
6986 <indexterm role="concept">
6987 <primary>EXIM_GROUP</primary>
6988 </indexterm>
6989 <indexterm role="concept">
6990 <primary>CONFIGURE_OWNER</primary>
6991 </indexterm>
6992 <indexterm role="concept">
6993 <primary>CONFIGURE_GROUP</primary>
6994 </indexterm>
6995 <indexterm role="concept">
6996 <primary>configuration file</primary>
6997 <secondary>ownership</secondary>
6998 </indexterm>
6999 <indexterm role="concept">
7000 <primary>ownership</primary>
7001 <secondary>configuration file</secondary>
7002 </indexterm>
7003 The run time configuration file must be owned by root or by the user that is
7004 specified at compile time by the CONFIGURE_OWNER option (if set). The
7005 configuration file must not be world-writeable, or group-writeable unless its
7006 group is the root group or the one specified at compile time by the
7007 CONFIGURE_GROUP option.
7008 </para>
7009 <para revisionflag="changed">
7010 <emphasis role="bold">Warning</emphasis>: In a conventional configuration, where the Exim binary is setuid
7011 to root, anybody who is able to edit the run time configuration file has an
7012 easy way to run commands as root. If you specify a user or group in the
7013 CONFIGURE_OWNER or CONFIGURE_GROUP options, then that user and/or any users
7014 who are members of that group will trivially be able to obtain root privileges.
7015 </para>
7016 <para revisionflag="changed">
7017 Up to Exim version 4.72, the run time configuration file was also permitted to
7018 be writeable by the Exim user and/or group. That has been changed in Exim 4.73
7019 since it offered a simple privilege escalation for any attacker who managed to
7020 compromise the Exim user account.
7021 </para>
7022 <para>
7023 A default configuration file, which will work correctly in simple situations,
7024 is provided in the file <filename>src/configure.default</filename>. If CONFIGURE_FILE
7025 defines just one file name, the installation process copies the default
7026 configuration to a new file of that name if it did not previously exist. If
7027 CONFIGURE_FILE is a list, no default is automatically installed. Chapter
7028 <xref linkend="CHAPdefconfil"/> is a <quote>walk-through</quote> discussion of the default
7029 configuration.
7030 </para>
7031 <section id="SECID40" revisionflag="changed">
7032 <title>Using a different configuration file</title>
7033 <para revisionflag="changed">
7034 <indexterm role="concept">
7035 <primary>configuration file</primary>
7036 <secondary>alternate</secondary>
7037 </indexterm>
7038 A one-off alternate configuration can be specified by the <option>-C</option> command line
7039 option, which may specify a single file or a list of files. However, when
7040 <option>-C</option> is used, Exim gives up its root privilege, unless called by root (or
7041 unless the argument for <option>-C</option> is identical to the built-in value from
7042 CONFIGURE_FILE), or is listed in the TRUSTED_CONFIG_LIST file and the caller
7043 is the Exim user or the user specified in the CONFIGURE_OWNER setting. <option>-C</option>
7044 is useful mainly for checking the syntax of configuration files before
7045 installing them. No owner or group checks are done on a configuration file
7046 specified by <option>-C</option>, if root privilege has been dropped.
7047 </para>
7048 <para revisionflag="changed">
7049 Even the Exim user is not trusted to specify an arbitrary configuration file
7050 with the <option>-C</option> option to be used with root privileges, unless that file is
7051 listed in the TRUSTED_CONFIG_LIST file. This locks out the possibility of
7052 testing a configuration using <option>-C</option> right through message reception and
7053 delivery, even if the caller is root. The reception works, but by that time,
7054 Exim is running as the Exim user, so when it re-execs to regain privilege for
7055 the delivery, the use of <option>-C</option> causes privilege to be lost. However, root
7056 can test reception and delivery using two separate commands (one to put a
7057 message on the queue, using <option>-odq</option>, and another to do the delivery, using
7058 <option>-M</option>).
7059 </para>
7060 <para>
7061 If ALT_CONFIG_PREFIX is defined <filename>in Local/Makefile</filename>, it specifies a
7062 prefix string with which any file named in a <option>-C</option> command line option must
7063 start. In addition, the file name must not contain the sequence <quote><literal>/../</literal></quote>.
7064 There is no default setting for ALT_CONFIG_PREFIX; when it is unset, any file
7065 name can be used with <option>-C</option>.
7066 </para>
7067 <para>
7068 One-off changes to a configuration can be specified by the <option>-D</option> command line
7069 option, which defines and overrides values for macros used inside the
7070 configuration file. However, like <option>-C</option>, the use of this option by a
7071 non-privileged user causes Exim to discard its root privilege.
7072 If DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the use of <option>-D</option> is
7073 completely disabled, and its use causes an immediate error exit.
7074 </para>
7075 <para revisionflag="changed">
7076 The WHITELIST_D_MACROS option in <filename>Local/Makefile</filename> permits the binary builder
7077 to declare certain macro names trusted, such that root privilege will not
7078 necessarily be discarded.
7079 WHITELIST_D_MACROS defines a colon-separated list of macros which are
7080 considered safe and, if <option>-D</option> only supplies macros from this list, and the
7081 values are acceptable, then Exim will not give up root privilege if the caller
7082 is root, the Exim run-time user, or the CONFIGURE_OWNER, if set.  This is a
7083 transition mechanism and is expected to be removed in the future.  Acceptable
7084 values for the macros satisfy the regexp: <literal>^[A-Za-z0-9_/.-]*$</literal>
7085 </para>
7086 <para>
7087 Some sites may wish to use the same Exim binary on different machines that
7088 share a file system, but to use different configuration files on each machine.
7089 If CONFIGURE_FILE_USE_NODE is defined in <filename>Local/Makefile</filename>, Exim first
7090 looks for a file whose name is the configuration file name followed by a dot
7091 and the machine&#x2019;s node name, as obtained from the <function>uname()</function> function. If this
7092 file does not exist, the standard name is tried. This processing occurs for
7093 each file name in the list given by CONFIGURE_FILE or <option>-C</option>.
7094 </para>
7095 <para>
7096 In some esoteric situations different versions of Exim may be run under
7097 different effective uids and the CONFIGURE_FILE_USE_EUID is defined to
7098 help with this. See the comments in <filename>src/EDITME</filename> for details.
7099 </para>
7100 </section>
7101 <section id="SECTconffilfor">
7102 <title>Configuration file format</title>
7103 <para>
7104 <indexterm role="concept">
7105 <primary>configuration file</primary>
7106 <secondary>format of</secondary>
7107 </indexterm>
7108 <indexterm role="concept">
7109 <primary>format</primary>
7110 <secondary>configuration file</secondary>
7111 </indexterm>
7112 Exim&#x2019;s configuration file is divided into a number of different parts. General
7113 option settings must always appear at the start of the file. The other parts
7114 are all optional, and may appear in any order. Each part other than the first
7115 is introduced by the word <quote>begin</quote> followed by the name of the part. The
7116 optional parts are:
7117 </para>
7118 <itemizedlist>
7119 <listitem>
7120 <para>
7121 <emphasis>ACL</emphasis>: Access control lists for controlling incoming SMTP mail (see chapter
7122 <xref linkend="CHAPACL"/>).
7123 </para>
7124 </listitem>
7125 <listitem>
7126 <para>
7127 <indexterm role="concept">
7128 <primary>AUTH</primary>
7129 <secondary>configuration</secondary>
7130 </indexterm>
7131 <emphasis>authenticators</emphasis>: Configuration settings for the authenticator drivers. These
7132 are concerned with the SMTP AUTH command (see chapter <xref linkend="CHAPSMTPAUTH"/>).
7133 </para>
7134 </listitem>
7135 <listitem>
7136 <para>
7137 <emphasis>routers</emphasis>: Configuration settings for the router drivers. Routers process
7138 addresses and determine how the message is to be delivered (see chapters
7139 <xref linkend="CHAProutergeneric"/>&ndash;<xref linkend="CHAPredirect"/>).
7140 </para>
7141 </listitem>
7142 <listitem>
7143 <para>
7144 <emphasis>transports</emphasis>: Configuration settings for the transport drivers. Transports
7145 define mechanisms for copying messages to destinations (see chapters
7146 <xref linkend="CHAPtransportgeneric"/>&ndash;<xref linkend="CHAPsmtptrans"/>).
7147 </para>
7148 </listitem>
7149 <listitem>
7150 <para>
7151 <emphasis>retry</emphasis>: Retry rules, for use when a message cannot be delivered immediately.
7152 If there is no retry section, or if it is empty (that is, no retry rules are
7153 defined), Exim will not retry deliveries. In this situation, temporary errors
7154 are treated the same as permanent errors. Retry rules are discussed in chapter
7155 <xref linkend="CHAPretry"/>.
7156 </para>
7157 </listitem>
7158 <listitem>
7159 <para>
7160 <emphasis>rewrite</emphasis>: Global address rewriting rules, for use when a message arrives and
7161 when new addresses are generated during delivery. Rewriting is discussed in
7162 chapter <xref linkend="CHAPrewrite"/>.
7163 </para>
7164 </listitem>
7165 <listitem>
7166 <para>
7167 <emphasis>local_scan</emphasis>: Private options for the <function>local_scan()</function> function. If you
7168 want to use this feature, you must set
7169 </para>
7170 <literallayout class="monospaced">
7171 LOCAL_SCAN_HAS_OPTIONS=yes
7172 </literallayout>
7173 <para>
7174 in <filename>Local/Makefile</filename> before building Exim. Details of the <function>local_scan()</function>
7175 facility are given in chapter <xref linkend="CHAPlocalscan"/>.
7176 </para>
7177 </listitem>
7178 </itemizedlist>
7179 <para>
7180 <indexterm role="concept">
7181 <primary>configuration file</primary>
7182 <secondary>leading white space in</secondary>
7183 </indexterm>
7184 <indexterm role="concept">
7185 <primary>configuration file</primary>
7186 <secondary>trailing white space in</secondary>
7187 </indexterm>
7188 <indexterm role="concept">
7189 <primary>white space</primary>
7190 <secondary>in configuration file</secondary>
7191 </indexterm>
7192 Leading and trailing white space in configuration lines is always ignored.
7193 </para>
7194 <para>
7195 Blank lines in the file, and lines starting with a # character (ignoring
7196 leading white space) are treated as comments and are ignored. <emphasis role="bold">Note</emphasis>: A
7197 # character other than at the beginning of a line is not treated specially,
7198 and does not introduce a comment.
7199 </para>
7200 <para>
7201 Any non-comment line can be continued by ending it with a backslash. Note that
7202 the general rule for white space means that trailing white space after the
7203 backslash and leading white space at the start of continuation
7204 lines is ignored. Comment lines beginning with # (but not empty lines) may
7205 appear in the middle of a sequence of continuation lines.
7206 </para>
7207 <para>
7208 A convenient way to create a configuration file is to start from the
7209 default, which is supplied in <filename>src/configure.default</filename>, and add, delete, or
7210 change settings as required.
7211 </para>
7212 <para>
7213 The ACLs, retry rules, and rewriting rules have their own syntax which is
7214 described in chapters <xref linkend="CHAPACL"/>, <xref linkend="CHAPretry"/>, and <xref linkend="CHAPrewrite"/>,
7215 respectively. The other parts of the configuration file have some syntactic
7216 items in common, and these are described below, from section <xref linkend="SECTcos"/>
7217 onwards. Before that, the inclusion, macro, and conditional facilities are
7218 described.
7219 </para>
7220 </section>
7221 <section id="SECID41">
7222 <title>File inclusions in the configuration file</title>
7223 <para>
7224 <indexterm role="concept">
7225 <primary>inclusions in configuration file</primary>
7226 </indexterm>
7227 <indexterm role="concept">
7228 <primary>configuration file</primary>
7229 <secondary>including other files</secondary>
7230 </indexterm>
7231 <indexterm role="concept">
7232 <primary><literal>.include</literal> in configuration file</primary>
7233 </indexterm>
7234 <indexterm role="concept">
7235 <primary><literal>.include_if_exists</literal> in configuration file</primary>
7236 </indexterm>
7237 You can include other files inside Exim&#x2019;s run time configuration file by
7238 using this syntax:
7239 </para>
7240 <literallayout>
7241 <literal>.include</literal> &lt;<emphasis>file name</emphasis>&gt;
7242 <literal>.include_if_exists</literal> &lt;<emphasis>file name</emphasis>&gt;
7243 </literallayout>
7244 <para>
7245 on a line by itself. Double quotes round the file name are optional. If you use
7246 the first form, a configuration error occurs if the file does not exist; the
7247 second form does nothing for non-existent files. In all cases, an absolute file
7248 name is required.
7249 </para>
7250 <para>
7251 Includes may be nested to any depth, but remember that Exim reads its
7252 configuration file often, so it is a good idea to keep them to a minimum.
7253 If you change the contents of an included file, you must HUP the daemon,
7254 because an included file is read only when the configuration itself is read.
7255 </para>
7256 <para>
7257 The processing of inclusions happens early, at a physical line level, so, like
7258 comment lines, an inclusion can be used in the middle of an option setting,
7259 for example:
7260 </para>
7261 <literallayout class="monospaced">
7262 hosts_lookup = a.b.c \
7263                .include /some/file
7264 </literallayout>
7265 <para>
7266 Include processing happens after macro processing (see below). Its effect is to
7267 process the lines of the included file as if they occurred inline where the
7268 inclusion appears.
7269 </para>
7270 </section>
7271 <section id="SECTmacrodefs">
7272 <title>Macros in the configuration file</title>
7273 <para>
7274 <indexterm role="concept">
7275 <primary>macro</primary>
7276 <secondary>description of</secondary>
7277 </indexterm>
7278 <indexterm role="concept">
7279 <primary>configuration file</primary>
7280 <secondary>macros</secondary>
7281 </indexterm>
7282 If a line in the main part of the configuration (that is, before the first
7283 <quote>begin</quote> line) begins with an upper case letter, it is taken as a macro
7284 definition, and must be of the form
7285 </para>
7286 <literallayout>
7287 &lt;<emphasis>name</emphasis>&gt; = &lt;<emphasis>rest of line</emphasis>&gt;
7288 </literallayout>
7289 <para>
7290 The name must consist of letters, digits, and underscores, and need not all be
7291 in upper case, though that is recommended. The rest of the line, including any
7292 continuations, is the replacement text, and has leading and trailing white
7293 space removed. Quotes are not removed. The replacement text can never end with
7294 a backslash character, but this doesn&#x2019;t seem to be a serious limitation.
7295 </para>
7296 <para>
7297 Macros may also be defined between router, transport, authenticator, or ACL
7298 definitions. They may not, however, be defined within an individual driver or
7299 ACL, or in the <option>local_scan</option>, retry, or rewrite sections of the configuration.
7300 </para>
7301 </section>
7302 <section id="SECID42">
7303 <title>Macro substitution</title>
7304 <para>
7305 Once a macro is defined, all subsequent lines in the file (and any included
7306 files) are scanned for the macro name; if there are several macros, the line is
7307 scanned for each in turn, in the order in which the macros are defined. The
7308 replacement text is not re-scanned for the current macro, though it is scanned
7309 for subsequently defined macros. For this reason, a macro name may not contain
7310 the name of a previously defined macro as a substring. You could, for example,
7311 define
7312 </para>
7313 <literallayout>
7314 <literal>ABCD_XYZ = </literal>&lt;<emphasis>something</emphasis>&gt;
7315 <literal>ABCD = </literal>&lt;<emphasis>something else</emphasis>&gt;
7316 </literallayout>
7317 <para>
7318 but putting the definitions in the opposite order would provoke a configuration
7319 error. Macro expansion is applied to individual physical lines from the file,
7320 before checking for line continuation or file inclusion (see above). If a line
7321 consists solely of a macro name, and the expansion of the macro is empty, the
7322 line is ignored. A macro at the start of a line may turn the line into a
7323 comment line or a <literal>.include</literal> line.
7324 </para>
7325 </section>
7326 <section id="SECID43">
7327 <title>Redefining macros</title>
7328 <para>
7329 Once defined, the value of a macro can be redefined later in the configuration
7330 (or in an included file). Redefinition is specified by using <emphasis>==</emphasis> instead of
7331 <emphasis>=</emphasis>. For example:
7332 </para>
7333 <literallayout class="monospaced">
7334 MAC =  initial value
7335 ...
7336 MAC == updated value
7337 </literallayout>
7338 <para>
7339 Redefinition does not alter the order in which the macros are applied to the
7340 subsequent lines of the configuration file. It is still the same order in which
7341 the macros were originally defined. All that changes is the macro&#x2019;s value.
7342 Redefinition makes it possible to accumulate values. For example:
7343 </para>
7344 <literallayout class="monospaced">
7345 MAC =  initial value
7346 ...
7347 MAC == MAC and something added
7348 </literallayout>
7349 <para>
7350 This can be helpful in situations where the configuration file is built
7351 from a number of other files.
7352 </para>
7353 </section>
7354 <section id="SECID44">
7355 <title>Overriding macro values</title>
7356 <para>
7357 The values set for macros in the configuration file can be overridden by the
7358 <option>-D</option> command line option, but Exim gives up its root privilege when <option>-D</option> is
7359 used, unless called by root or the Exim user. A definition on the command line
7360 using the <option>-D</option> option causes all definitions and redefinitions within the
7361 file to be ignored.
7362 </para>
7363 </section>
7364 <section id="SECID45">
7365 <title>Example of macro usage</title>
7366 <para>
7367 As an example of macro usage, consider a configuration where aliases are looked
7368 up in a MySQL database. It helps to keep the file less cluttered if long
7369 strings such as SQL statements are defined separately as macros, for example:
7370 </para>
7371 <literallayout class="monospaced">
7372 ALIAS_QUERY = select mailbox from user where \
7373               login='${quote_mysql:$local_part}';
7374 </literallayout>
7375 <para>
7376 This can then be used in a <command>redirect</command> router setting like this:
7377 </para>
7378 <literallayout class="monospaced">
7379 data = ${lookup mysql{ALIAS_QUERY}}
7380 </literallayout>
7381 <para>
7382 In earlier versions of Exim macros were sometimes used for domain, host, or
7383 address lists. In Exim 4 these are handled better by named lists &ndash; see
7384 section <xref linkend="SECTnamedlists"/>.
7385 </para>
7386 </section>
7387 <section id="SECID46">
7388 <title>Conditional skips in the configuration file</title>
7389 <para>
7390 <indexterm role="concept">
7391 <primary>configuration file</primary>
7392 <secondary>conditional skips</secondary>
7393 </indexterm>
7394 <indexterm role="concept">
7395 <primary><literal>.ifdef</literal></primary>
7396 </indexterm>
7397 You can use the directives <literal>.ifdef</literal>, <literal>.ifndef</literal>, <literal>.elifdef</literal>,
7398 <literal>.elifndef</literal>, <literal>.else</literal>, and <literal>.endif</literal> to dynamically include or exclude
7399 portions of the configuration file. The processing happens whenever the file is
7400 read (that is, when an Exim binary starts to run).
7401 </para>
7402 <para>
7403 The implementation is very simple. Instances of the first four directives must
7404 be followed by text that includes the names of one or macros. The condition
7405 that is tested is whether or not any macro substitution has taken place in the
7406 line. Thus:
7407 </para>
7408 <literallayout class="monospaced">
7409 .ifdef AAA
7410 message_size_limit = 50M
7411 .else
7412 message_size_limit = 100M
7413 .endif
7414 </literallayout>
7415 <para>
7416 sets a message size limit of 50M if the macro <literal>AAA</literal> is defined, and 100M
7417 otherwise. If there is more than one macro named on the line, the condition
7418 is true if any of them are defined. That is, it is an <quote>or</quote> condition. To
7419 obtain an <quote>and</quote> condition, you need to use nested <literal>.ifdef</literal>s.
7420 </para>
7421 <para>
7422 Although you can use a macro expansion to generate one of these directives,
7423 it is not very useful, because the condition <quote>there was a macro substitution
7424 in this line</quote> will always be true.
7425 </para>
7426 <para>
7427 Text following <literal>.else</literal> and <literal>.endif</literal> is ignored, and can be used as comment
7428 to clarify complicated nestings.
7429 </para>
7430 </section>
7431 <section id="SECTcos">
7432 <title>Common option syntax</title>
7433 <para>
7434 <indexterm role="concept">
7435 <primary>common option syntax</primary>
7436 </indexterm>
7437 <indexterm role="concept">
7438 <primary>syntax of common options</primary>
7439 </indexterm>
7440 <indexterm role="concept">
7441 <primary>configuration file</primary>
7442 <secondary>common option syntax</secondary>
7443 </indexterm>
7444 For the main set of options, driver options, and <function>local_scan()</function> options,
7445 each setting is on a line by itself, and starts with a name consisting of
7446 lower-case letters and underscores. Many options require a data value, and in
7447 these cases the name must be followed by an equals sign (with optional white
7448 space) and then the value. For example:
7449 </para>
7450 <literallayout class="monospaced">
7451 qualify_domain = mydomain.example.com
7452 </literallayout>
7453 <para>
7454 <indexterm role="concept">
7455 <primary>hiding configuration option values</primary>
7456 </indexterm>
7457 <indexterm role="concept">
7458 <primary>configuration options</primary>
7459 <secondary>hiding value of</secondary>
7460 </indexterm>
7461 <indexterm role="concept">
7462 <primary>options</primary>
7463 <secondary>hiding value of</secondary>
7464 </indexterm>
7465 Some option settings may contain sensitive data, for example, passwords for
7466 accessing databases. To stop non-admin users from using the <option>-bP</option> command
7467 line option to read these values, you can precede the option settings with the
7468 word <quote>hide</quote>. For example:
7469 </para>
7470 <literallayout class="monospaced">
7471 hide mysql_servers = localhost/users/admin/secret-password
7472 </literallayout>
7473 <para>
7474 For non-admin users, such options are displayed like this:
7475 </para>
7476 <literallayout class="monospaced">
7477 mysql_servers = &lt;value not displayable&gt;
7478 </literallayout>
7479 <para>
7480 If <quote>hide</quote> is used on a driver option, it hides the value of that option on
7481 all instances of the same driver.
7482 </para>
7483 <para>
7484 The following sections describe the syntax used for the different data types
7485 that are found in option settings.
7486 </para>
7487 </section>
7488 <section id="SECID47">
7489 <title>Boolean options</title>
7490 <para>
7491 <indexterm role="concept">
7492 <primary>format</primary>
7493 <secondary>boolean</secondary>
7494 </indexterm>
7495 <indexterm role="concept">
7496 <primary>boolean configuration values</primary>
7497 </indexterm>
7498 <indexterm role="option">
7499 <primary><option>no_</option><emphasis>xxx</emphasis></primary>
7500 </indexterm>
7501 <indexterm role="option">
7502 <primary><option>not_</option><emphasis>xxx</emphasis></primary>
7503 </indexterm>
7504 Options whose type is given as boolean are on/off switches. There are two
7505 different ways of specifying such options: with and without a data value. If
7506 the option name is specified on its own without data, the switch is turned on;
7507 if it is preceded by <quote>no_</quote> or <quote>not_</quote> the switch is turned off. However,
7508 boolean options may be followed by an equals sign and one of the words
7509 <quote>true</quote>, <quote>false</quote>, <quote>yes</quote>, or <quote>no</quote>, as an alternative syntax. For example,
7510 the following two settings have exactly the same effect:
7511 </para>
7512 <literallayout class="monospaced">
7513 queue_only
7514 queue_only = true
7515 </literallayout>
7516 <para>
7517 The following two lines also have the same (opposite) effect:
7518 </para>
7519 <literallayout class="monospaced">
7520 no_queue_only
7521 queue_only = false
7522 </literallayout>
7523 <para>
7524 You can use whichever syntax you prefer.
7525 </para>
7526 </section>
7527 <section id="SECID48">
7528 <title>Integer values</title>
7529 <para>
7530 <indexterm role="concept">
7531 <primary>integer configuration values</primary>
7532 </indexterm>
7533 <indexterm role="concept">
7534 <primary>format</primary>
7535 <secondary>integer</secondary>
7536 </indexterm>
7537 If an option&#x2019;s type is given as <quote>integer</quote>, the value can be given in decimal,
7538 hexadecimal, or octal. If it starts with a digit greater than zero, a decimal
7539 number is assumed. Otherwise, it is treated as an octal number unless it starts
7540 with the characters <quote>0x</quote>, in which case the remainder is interpreted as a
7541 hexadecimal number.
7542 </para>
7543 <para>
7544 If an integer value is followed by the letter K, it is multiplied by 1024; if
7545 it is followed by the letter M, it is multiplied by 1024x1024. When the values
7546 of integer option settings are output, values which are an exact multiple of
7547 1024 or 1024x1024 are sometimes, but not always, printed using the letters K
7548 and M. The printing style is independent of the actual input format that was
7549 used.
7550 </para>
7551 </section>
7552 <section id="SECID49">
7553 <title>Octal integer values</title>
7554 <para>
7555 <indexterm role="concept">
7556 <primary>integer format</primary>
7557 </indexterm>
7558 <indexterm role="concept">
7559 <primary>format</primary>
7560 <secondary>octal integer</secondary>
7561 </indexterm>
7562 If an option&#x2019;s type is given as <quote>octal integer</quote>, its value is always
7563 interpreted as an octal number, whether or not it starts with the digit zero.
7564 Such options are always output in octal.
7565 </para>
7566 </section>
7567 <section id="SECID50">
7568 <title>Fixed point numbers</title>
7569 <para>
7570 <indexterm role="concept">
7571 <primary>fixed point configuration values</primary>
7572 </indexterm>
7573 <indexterm role="concept">
7574 <primary>format</primary>
7575 <secondary>fixed point</secondary>
7576 </indexterm>
7577 If an option&#x2019;s type is given as <quote>fixed-point</quote>, its value must be a decimal
7578 integer, optionally followed by a decimal point and up to three further digits.
7579 </para>
7580 </section>
7581 <section id="SECTtimeformat">
7582 <title>Time intervals</title>
7583 <para>
7584 <indexterm role="concept">
7585 <primary>time interval</primary>
7586 <secondary>specifying in configuration</secondary>
7587 </indexterm>
7588 <indexterm role="concept">
7589 <primary>format</primary>
7590 <secondary>time interval</secondary>
7591 </indexterm>
7592 A time interval is specified as a sequence of numbers, each followed by one of
7593 the following letters, with no intervening white space:
7594 </para>
7595 <informaltable frame="none">
7596 <tgroup cols="2" colsep="0" rowsep="0">
7597 <colspec colwidth="30pt" align="left"/>
7598 <colspec colwidth="254pt" align="left"/>
7599 <tbody>
7600 <row>
7601 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>s</option></entry>
7602 <entry>seconds</entry>
7603 </row>
7604 <row>
7605 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>m</option></entry>
7606 <entry>minutes</entry>
7607 </row>
7608 <row>
7609 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>h</option></entry>
7610 <entry>hours</entry>
7611 </row>
7612 <row>
7613 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>d</option></entry>
7614 <entry>days</entry>
7615 </row>
7616 <row>
7617 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>w</option></entry>
7618 <entry>weeks</entry>
7619 </row>
7620 </tbody>
7621 </tgroup>
7622 </informaltable>
7623 <para>
7624 For example, <quote>3h50m</quote> specifies 3 hours and 50 minutes. The values of time
7625 intervals are output in the same format. Exim does not restrict the values; it
7626 is perfectly acceptable, for example, to specify <quote>90m</quote> instead of <quote>1h30m</quote>.
7627 </para>
7628 </section>
7629 <section id="SECTstrings">
7630 <title>String values</title>
7631 <para>
7632 <indexterm role="concept">
7633 <primary>string</primary>
7634 <secondary>format of configuration values</secondary>
7635 </indexterm>
7636 <indexterm role="concept">
7637 <primary>format</primary>
7638 <secondary>string</secondary>
7639 </indexterm>
7640 If an option&#x2019;s type is specified as <quote>string</quote>, the value can be specified with
7641 or without double-quotes. If it does not start with a double-quote, the value
7642 consists of the remainder of the line plus any continuation lines, starting at
7643 the first character after any leading white space, with trailing white space
7644 removed, and with no interpretation of the characters in the string. Because
7645 Exim removes comment lines (those beginning with #) at an early stage, they can
7646 appear in the middle of a multi-line string. The following two settings are
7647 therefore equivalent:
7648 </para>
7649 <literallayout class="monospaced">
7650 trusted_users = uucp:mail
7651 trusted_users = uucp:\
7652                 # This comment line is ignored
7653                 mail
7654 </literallayout>
7655 <para>
7656 <indexterm role="concept">
7657 <primary>string</primary>
7658 <secondary>quoted</secondary>
7659 </indexterm>
7660 <indexterm role="concept">
7661 <primary>escape characters in quoted strings</primary>
7662 </indexterm>
7663 If a string does start with a double-quote, it must end with a closing
7664 double-quote, and any backslash characters other than those used for line
7665 continuation are interpreted as escape characters, as follows:
7666 </para>
7667 <informaltable frame="none">
7668 <tgroup cols="2" colsep="0" rowsep="0">
7669 <colspec colwidth="100pt" align="left"/>
7670 <colspec colwidth="254pt" align="left"/>
7671 <tbody>
7672 <row>
7673 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\\</literal></entry>
7674 <entry>single backslash</entry>
7675 </row>
7676 <row>
7677 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\n</literal></entry>
7678 <entry>newline</entry>
7679 </row>
7680 <row>
7681 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\r</literal></entry>
7682 <entry>carriage return</entry>
7683 </row>
7684 <row>
7685 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\t</literal></entry>
7686 <entry>tab</entry>
7687 </row>
7688 <row>
7689 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\</literal>&lt;<emphasis>octal digits</emphasis>&gt;</entry>
7690 <entry>up to 3 octal digits specify one character</entry>
7691 </row>
7692 <row>
7693 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\x</literal>&lt;<emphasis>hex digits</emphasis>&gt;</entry>
7694 <entry>up to 2 hexadecimal digits specify one character</entry>
7695 </row>
7696 </tbody>
7697 </tgroup>
7698 </informaltable>
7699 <para>
7700 If a backslash is followed by some other character, including a double-quote
7701 character, that character replaces the pair.
7702 </para>
7703 <para>
7704 Quoting is necessary only if you want to make use of the backslash escapes to
7705 insert special characters, or if you need to specify a value with leading or
7706 trailing spaces. These cases are rare, so quoting is almost never needed in
7707 current versions of Exim. In versions of Exim before 3.14, quoting was required
7708 in order to continue lines, so you may come across older configuration files
7709 and examples that apparently quote unnecessarily.
7710 </para>
7711 </section>
7712 <section id="SECID51">
7713 <title>Expanded strings</title>
7714 <para>
7715 <indexterm role="concept">
7716 <primary>expansion</primary>
7717 <secondary>definition of</secondary>
7718 </indexterm>
7719 Some strings in the configuration file are subjected to <emphasis>string expansion</emphasis>,
7720 by which means various parts of the string may be changed according to the
7721 circumstances (see chapter <xref linkend="CHAPexpand"/>). The input syntax for such strings
7722 is as just described; in particular, the handling of backslashes in quoted
7723 strings is done as part of the input process, before expansion takes place.
7724 However, backslash is also an escape character for the expander, so any
7725 backslashes that are required for that reason must be doubled if they are
7726 within a quoted configuration string.
7727 </para>
7728 </section>
7729 <section id="SECID52">
7730 <title>User and group names</title>
7731 <para>
7732 <indexterm role="concept">
7733 <primary>user name</primary>
7734 <secondary>format of</secondary>
7735 </indexterm>
7736 <indexterm role="concept">
7737 <primary>format</primary>
7738 <secondary>user name</secondary>
7739 </indexterm>
7740 <indexterm role="concept">
7741 <primary>groups</primary>
7742 <secondary>name format</secondary>
7743 </indexterm>
7744 <indexterm role="concept">
7745 <primary>format</primary>
7746 <secondary>group name</secondary>
7747 </indexterm>
7748 User and group names are specified as strings, using the syntax described
7749 above, but the strings are interpreted specially. A user or group name must
7750 either consist entirely of digits, or be a name that can be looked up using the
7751 <function>getpwnam()</function> or <function>getgrnam()</function> function, as appropriate.
7752 </para>
7753 </section>
7754 <section id="SECTlistconstruct">
7755 <title>List construction</title>
7756 <para>
7757 <indexterm role="concept">
7758 <primary>list</primary>
7759 <secondary>syntax of in configuration</secondary>
7760 </indexterm>
7761 <indexterm role="concept">
7762 <primary>format</primary>
7763 <secondary>list item in configuration</secondary>
7764 </indexterm>
7765 <indexterm role="concept">
7766 <primary>string</primary>
7767 <secondary>list, definition of</secondary>
7768 </indexterm>
7769 The data for some configuration options is a list of items, with colon as the
7770 default separator. Many of these options are shown with type <quote>string list</quote> in
7771 the descriptions later in this document. Others are listed as <quote>domain list</quote>,
7772 <quote>host list</quote>, <quote>address list</quote>, or <quote>local part list</quote>. Syntactically, they
7773 are all the same; however, those other than <quote>string list</quote> are subject to
7774 particular kinds of interpretation, as described in chapter
7775 <xref linkend="CHAPdomhosaddlists"/>.
7776 </para>
7777 <para>
7778 In all these cases, the entire list is treated as a single string as far as the
7779 input syntax is concerned. The <option>trusted_users</option> setting in section
7780 <xref linkend="SECTstrings"/> above is an example. If a colon is actually needed in an item
7781 in a list, it must be entered as two colons. Leading and trailing white space
7782 on each item in a list is ignored. This makes it possible to include items that
7783 start with a colon, and in particular, certain forms of IPv6 address. For
7784 example, the list
7785 </para>
7786 <literallayout class="monospaced">
7787 local_interfaces = 127.0.0.1 : ::::1
7788 </literallayout>
7789 <para>
7790 contains two IP addresses, the IPv4 address 127.0.0.1 and the IPv6 address ::1.
7791 </para>
7792 <para>
7793 <emphasis role="bold">Note</emphasis>: Although leading and trailing white space is ignored in individual
7794 list items, it is not ignored when parsing the list. The space after the first
7795 colon in the example above is necessary. If it were not there, the list would
7796 be interpreted as the two items 127.0.0.1:: and 1.
7797 </para>
7798 </section>
7799 <section id="SECID53">
7800 <title>Changing list separators</title>
7801 <para>
7802 <indexterm role="concept">
7803 <primary>list separator</primary>
7804 <secondary>changing</secondary>
7805 </indexterm>
7806 <indexterm role="concept">
7807 <primary>IPv6</primary>
7808 <secondary>addresses in lists</secondary>
7809 </indexterm>
7810 Doubling colons in IPv6 addresses is an unwelcome chore, so a mechanism was
7811 introduced to allow the separator character to be changed. If a list begins
7812 with a left angle bracket, followed by any punctuation character, that
7813 character is used instead of colon as the list separator. For example, the list
7814 above can be rewritten to use a semicolon separator like this:
7815 </para>
7816 <literallayout class="monospaced">
7817 local_interfaces = &lt;; 127.0.0.1 ; ::1
7818 </literallayout>
7819 <para>
7820 This facility applies to all lists, with the exception of the list in
7821 <option>log_file_path</option>. It is recommended that the use of non-colon separators be
7822 confined to circumstances where they really are needed.
7823 </para>
7824 <para>
7825 <indexterm role="concept">
7826 <primary>list separator</primary>
7827 <secondary>newline as</secondary>
7828 </indexterm>
7829 <indexterm role="concept">
7830 <primary>newline</primary>
7831 <secondary>as list separator</secondary>
7832 </indexterm>
7833 It is also possible to use newline and other control characters (those with
7834 code values less than 32, plus DEL) as separators in lists. Such separators
7835 must be provided literally at the time the list is processed. For options that
7836 are string-expanded, you can write the separator using a normal escape
7837 sequence. This will be processed by the expander before the string is
7838 interpreted as a list. For example, if a newline-separated list of domains is
7839 generated by a lookup, you can process it directly by a line such as this:
7840 </para>
7841 <literallayout class="monospaced">
7842 domains = &lt;\n ${lookup mysql{.....}}
7843 </literallayout>
7844 <para>
7845 This avoids having to change the list separator in such data. You are unlikely
7846 to want to use a control character as a separator in an option that is not
7847 expanded, because the value is literal text. However, it can be done by giving
7848 the value in quotes. For example:
7849 </para>
7850 <literallayout class="monospaced">
7851 local_interfaces = "&lt;\n 127.0.0.1 \n ::1"
7852 </literallayout>
7853 <para>
7854 Unlike printing character separators, which can be included in list items by
7855 doubling, it is not possible to include a control character as data when it is
7856 set as the separator. Two such characters in succession are interpreted as
7857 enclosing an empty list item.
7858 </para>
7859 </section>
7860 <section id="SECTempitelis">
7861 <title>Empty items in lists</title>
7862 <para>
7863 <indexterm role="concept">
7864 <primary>list</primary>
7865 <secondary>empty item in</secondary>
7866 </indexterm>
7867 An empty item at the end of a list is always ignored. In other words, trailing
7868 separator characters are ignored. Thus, the list in
7869 </para>
7870 <literallayout class="monospaced">
7871 senders = user@domain :
7872 </literallayout>
7873 <para>
7874 contains only a single item. If you want to include an empty string as one item
7875 in a list, it must not be the last item. For example, this list contains three
7876 items, the second of which is empty:
7877 </para>
7878 <literallayout class="monospaced">
7879 senders = user1@domain : : user2@domain
7880 </literallayout>
7881 <para>
7882 <emphasis role="bold">Note</emphasis>: There must be white space between the two colons, as otherwise they
7883 are interpreted as representing a single colon data character (and the list
7884 would then contain just one item). If you want to specify a list that contains
7885 just one, empty item, you can do it as in this example:
7886 </para>
7887 <literallayout class="monospaced">
7888 senders = :
7889 </literallayout>
7890 <para>
7891 In this case, the first item is empty, and the second is discarded because it
7892 is at the end of the list.
7893 </para>
7894 </section>
7895 <section id="SECTfordricon">
7896 <title>Format of driver configurations</title>
7897 <para>
7898 <indexterm role="concept">
7899 <primary>drivers</primary>
7900 <secondary>configuration format</secondary>
7901 </indexterm>
7902 There are separate parts in the configuration for defining routers, transports,
7903 and authenticators. In each part, you are defining a number of driver
7904 instances, each with its own set of options. Each driver instance is defined by
7905 a sequence of lines like this:
7906 </para>
7907 <literallayout>
7908 &lt;<emphasis>instance name</emphasis>&gt;:
7909   &lt;<emphasis>option</emphasis>&gt;
7910   ...
7911   &lt;<emphasis>option</emphasis>&gt;
7912 </literallayout>
7913 <para>
7914 In the following example, the instance name is <command>localuser</command>, and it is
7915 followed by three options settings:
7916 </para>
7917 <literallayout class="monospaced">
7918 localuser:
7919   driver = accept
7920   check_local_user
7921   transport = local_delivery
7922 </literallayout>
7923 <para>
7924 For each driver instance, you specify which Exim code module it uses &ndash; by the
7925 setting of the <option>driver</option> option &ndash; and (optionally) some configuration
7926 settings. For example, in the case of transports, if you want a transport to
7927 deliver with SMTP you would use the <command>smtp</command> driver; if you want to deliver to
7928 a local file you would use the <command>appendfile</command> driver. Each of the drivers is
7929 described in detail in its own separate chapter later in this manual.
7930 </para>
7931 <para>
7932 You can have several routers, transports, or authenticators that are based on
7933 the same underlying driver (each must have a different instance name).
7934 </para>
7935 <para>
7936 The order in which routers are defined is important, because addresses are
7937 passed to individual routers one by one, in order. The order in which
7938 transports are defined does not matter at all. The order in which
7939 authenticators are defined is used only when Exim, as a client, is searching
7940 them to find one that matches an authentication mechanism offered by the
7941 server.
7942 </para>
7943 <para>
7944 <indexterm role="concept">
7945 <primary>generic options</primary>
7946 </indexterm>
7947 <indexterm role="concept">
7948 <primary>options</primary>
7949 <secondary>generic &ndash; definition of</secondary>
7950 </indexterm>
7951 Within a driver instance definition, there are two kinds of option: <emphasis>generic</emphasis>
7952 and <emphasis>private</emphasis>. The generic options are those that apply to all drivers of the
7953 same type (that is, all routers, all transports or all authenticators). The
7954 <option>driver</option> option is a generic option that must appear in every definition.
7955 <indexterm role="concept">
7956 <primary>private options</primary>
7957 </indexterm>
7958 The private options are special for each driver, and none need appear, because
7959 they all have default values.
7960 </para>
7961 <para>
7962 The options may appear in any order, except that the <option>driver</option> option must
7963 precede any private options, since these depend on the particular driver. For
7964 this reason, it is recommended that <option>driver</option> always be the first option.
7965 </para>
7966 <para>
7967 Driver instance names, which are used for reference in log entries and
7968 elsewhere, can be any sequence of letters, digits, and underscores (starting
7969 with a letter) and must be unique among drivers of the same type. A router and
7970 a transport (for example) can each have the same name, but no two router
7971 instances can have the same name. The name of a driver instance should not be
7972 confused with the name of the underlying driver module. For example, the
7973 configuration lines:
7974 </para>
7975 <literallayout class="monospaced">
7976 remote_smtp:
7977   driver = smtp
7978 </literallayout>
7979 <para>
7980 create an instance of the <command>smtp</command> transport driver whose name is
7981 <command>remote_smtp</command>. The same driver code can be used more than once, with
7982 different instance names and different option settings each time. A second
7983 instance of the <command>smtp</command> transport, with different options, might be defined
7984 thus:
7985 </para>
7986 <literallayout class="monospaced">
7987 special_smtp:
7988   driver = smtp
7989   port = 1234
7990   command_timeout = 10s
7991 </literallayout>
7992 <para>
7993 The names <command>remote_smtp</command> and <command>special_smtp</command> would be used to reference
7994 these transport instances from routers, and these names would appear in log
7995 lines.
7996 </para>
7997 <para>
7998 Comment lines may be present in the middle of driver specifications. The full
7999 list of option settings for any particular driver instance, including all the
8000 defaulted values, can be extracted by making use of the <option>-bP</option> command line
8001 option.
8002 </para>
8003 </section>
8004 </chapter>
8005
8006 <chapter id="CHAPdefconfil">
8007 <title>The default configuration file</title>
8008 <para>
8009 <indexterm role="concept" id="IIDconfiwal" class="startofrange">
8010 <primary>configuration file</primary>
8011 <secondary>default <quote>walk through</quote></secondary>
8012 </indexterm>
8013 <indexterm role="concept">
8014 <primary>default</primary>
8015 <secondary>configuration file <quote>walk through</quote></secondary>
8016 </indexterm>
8017 The default configuration file supplied with Exim as <filename>src/configure.default</filename>
8018 is sufficient for a host with simple mail requirements. As an introduction to
8019 the way Exim is configured, this chapter <quote>walks through</quote> the default
8020 configuration, giving brief explanations of the settings. Detailed descriptions
8021 of the options are given in subsequent chapters. The default configuration file
8022 itself contains extensive comments about ways you might want to modify the
8023 initial settings. However, note that there are many options that are not
8024 mentioned at all in the default configuration.
8025 </para>
8026 <section id="SECTdefconfmain">
8027 <title>Main configuration settings</title>
8028 <para>
8029 The main (global) configuration option settings must always come first in the
8030 file. The first thing you&#x2019;ll see in the file, after some initial comments, is
8031 the line
8032 </para>
8033 <literallayout class="monospaced">
8034 # primary_hostname =
8035 </literallayout>
8036 <para>
8037 This is a commented-out setting of the <option>primary_hostname</option> option. Exim needs
8038 to know the official, fully qualified name of your host, and this is where you
8039 can specify it. However, in most cases you do not need to set this option. When
8040 it is unset, Exim uses the <function>uname()</function> system function to obtain the host name.
8041 </para>
8042 <para>
8043 The first three non-comment configuration lines are as follows:
8044 </para>
8045 <literallayout class="monospaced">
8046 domainlist local_domains = @
8047 domainlist relay_to_domains =
8048 hostlist   relay_from_hosts = 127.0.0.1
8049 </literallayout>
8050 <para>
8051 These are not, in fact, option settings. They are definitions of two named
8052 domain lists and one named host list. Exim allows you to give names to lists of
8053 domains, hosts, and email addresses, in order to make it easier to manage the
8054 configuration file (see section <xref linkend="SECTnamedlists"/>).
8055 </para>
8056 <para>
8057 The first line defines a domain list called <emphasis>local_domains</emphasis>; this is used
8058 later in the configuration to identify domains that are to be delivered
8059 on the local host.
8060 </para>
8061 <para>
8062 <indexterm role="concept">
8063 <primary>@ in a domain list</primary>
8064 </indexterm>
8065 There is just one item in this list, the string <quote>@</quote>. This is a special form
8066 of entry which means <quote>the name of the local host</quote>. Thus, if the local host is
8067 called <emphasis>a.host.example</emphasis>, mail to <emphasis>any.user@a.host.example</emphasis> is expected to
8068 be delivered locally. Because the local host&#x2019;s name is referenced indirectly,
8069 the same configuration file can be used on different hosts.
8070 </para>
8071 <para>
8072 The second line defines a domain list called <emphasis>relay_to_domains</emphasis>, but the
8073 list itself is empty. Later in the configuration we will come to the part that
8074 controls mail relaying through the local host; it allows relaying to any
8075 domains in this list. By default, therefore, no relaying on the basis of a mail
8076 domain is permitted.
8077 </para>
8078 <para>
8079 The third line defines a host list called <emphasis>relay_from_hosts</emphasis>. This list is
8080 used later in the configuration to permit relaying from any host or IP address
8081 that matches the list. The default contains just the IP address of the IPv4
8082 loopback interface, which means that processes on the local host are able to
8083 submit mail for relaying by sending it over TCP/IP to that interface. No other
8084 hosts are permitted to submit messages for relaying.
8085 </para>
8086 <para>
8087 Just to be sure there&#x2019;s no misunderstanding: at this point in the configuration
8088 we aren&#x2019;t actually setting up any controls. We are just defining some domains
8089 and hosts that will be used in the controls that are specified later.
8090 </para>
8091 <para>
8092 The next two configuration lines are genuine option settings:
8093 </para>
8094 <literallayout class="monospaced">
8095 acl_smtp_rcpt = acl_check_rcpt
8096 acl_smtp_data = acl_check_data
8097 </literallayout>
8098 <para>
8099 These options specify <emphasis>Access Control Lists</emphasis> (ACLs) that are to be used
8100 during an incoming SMTP session for every recipient of a message (every RCPT
8101 command), and after the contents of the message have been received,
8102 respectively. The names of the lists are <emphasis>acl_check_rcpt</emphasis> and
8103 <emphasis>acl_check_data</emphasis>, and we will come to their definitions below, in the ACL
8104 section of the configuration. The RCPT ACL controls which recipients are
8105 accepted for an incoming message &ndash; if a configuration does not provide an ACL
8106 to check recipients, no SMTP mail can be accepted. The DATA ACL allows the
8107 contents of a message to be checked.
8108 </para>
8109 <para>
8110 Two commented-out option settings are next:
8111 </para>
8112 <literallayout class="monospaced">
8113 # av_scanner = clamd:/tmp/clamd
8114 # spamd_address = 127.0.0.1 783
8115 </literallayout>
8116 <para>
8117 These are example settings that can be used when Exim is compiled with the
8118 content-scanning extension. The first specifies the interface to the virus
8119 scanner, and the second specifies the interface to SpamAssassin. Further
8120 details are given in chapter <xref linkend="CHAPexiscan"/>.
8121 </para>
8122 <para>
8123 Three more commented-out option settings follow:
8124 </para>
8125 <literallayout class="monospaced">
8126 # tls_advertise_hosts = *
8127 # tls_certificate = /etc/ssl/exim.crt
8128 # tls_privatekey = /etc/ssl/exim.pem
8129 </literallayout>
8130 <para>
8131 These are example settings that can be used when Exim is compiled with
8132 support for TLS (aka SSL) as described in section <xref linkend="SECTinctlsssl"/>. The
8133 first one specifies the list of clients that are allowed to use TLS when
8134 connecting to this server; in this case the wildcard means all clients. The
8135 other options specify where Exim should find its TLS certificate and private
8136 key, which together prove the server&#x2019;s identity to any clients that connect.
8137 More details are given in chapter <xref linkend="CHAPTLS"/>.
8138 </para>
8139 <para>
8140 Another two commented-out option settings follow:
8141 </para>
8142 <literallayout class="monospaced">
8143 # daemon_smtp_ports = 25 : 465 : 587
8144 # tls_on_connect_ports = 465
8145 </literallayout>
8146 <para>
8147 <indexterm role="concept">
8148 <primary>port</primary>
8149 <secondary>465 and 587</secondary>
8150 </indexterm>
8151 <indexterm role="concept">
8152 <primary>port</primary>
8153 <secondary>for message submission</secondary>
8154 </indexterm>
8155 <indexterm role="concept">
8156 <primary>message</primary>
8157 <secondary>submission, ports for</secondary>
8158 </indexterm>
8159 <indexterm role="concept">
8160 <primary>ssmtp protocol</primary>
8161 </indexterm>
8162 <indexterm role="concept">
8163 <primary>smtps protocol</primary>
8164 </indexterm>
8165 <indexterm role="concept">
8166 <primary>SMTP</primary>
8167 <secondary>ssmtp protocol</secondary>
8168 </indexterm>
8169 <indexterm role="concept">
8170 <primary>SMTP</primary>
8171 <secondary>smtps protocol</secondary>
8172 </indexterm>
8173 These options provide better support for roaming users who wish to use this
8174 server for message submission. They are not much use unless you have turned on
8175 TLS (as described in the previous paragraph) and authentication (about which
8176 more in section <xref linkend="SECTdefconfauth"/>). The usual SMTP port 25 is often blocked
8177 on end-user networks, so RFC 4409 specifies that message submission should use
8178 port 587 instead. However some software (notably Microsoft Outlook) cannot be
8179 configured to use port 587 correctly, so these settings also enable the
8180 non-standard <quote>smtps</quote> (aka <quote>ssmtp</quote>) port 465 (see section
8181 <xref linkend="SECTsupobssmt"/>).
8182 </para>
8183 <para>
8184 Two more commented-out options settings follow:
8185 </para>
8186 <literallayout class="monospaced">
8187 # qualify_domain =
8188 # qualify_recipient =
8189 </literallayout>
8190 <para>
8191 The first of these specifies a domain that Exim uses when it constructs a
8192 complete email address from a local login name. This is often needed when Exim
8193 receives a message from a local process. If you do not set <option>qualify_domain</option>,
8194 the value of <option>primary_hostname</option> is used. If you set both of these options,
8195 you can have different qualification domains for sender and recipient
8196 addresses. If you set only the first one, its value is used in both cases.
8197 </para>
8198 <para>
8199 <indexterm role="concept">
8200 <primary>domain literal</primary>
8201 <secondary>recognizing format</secondary>
8202 </indexterm>
8203 The following line must be uncommented if you want Exim to recognize
8204 addresses of the form <emphasis>user@[10.11.12.13]</emphasis> that is, with a <quote>domain literal</quote>
8205 (an IP address within square brackets) instead of a named domain.
8206 </para>
8207 <literallayout class="monospaced">
8208 # allow_domain_literals
8209 </literallayout>
8210 <para>
8211 The RFCs still require this form, but many people think that in the modern
8212 Internet it makes little sense to permit mail to be sent to specific hosts by
8213 quoting their IP addresses. This ancient format has been used by people who
8214 try to abuse hosts by using them for unwanted relaying. However, some
8215 people believe there are circumstances (for example, messages addressed to
8216 <emphasis>postmaster</emphasis>) where domain literals are still useful.
8217 </para>
8218 <para>
8219 The next configuration line is a kind of trigger guard:
8220 </para>
8221 <literallayout class="monospaced">
8222 never_users = root
8223 </literallayout>
8224 <para>
8225 It specifies that no delivery must ever be run as the root user. The normal
8226 convention is to set up <emphasis>root</emphasis> as an alias for the system administrator. This
8227 setting is a guard against slips in the configuration.
8228 The list of users specified by <option>never_users</option> is not, however, the complete
8229 list; the build-time configuration in <filename>Local/Makefile</filename> has an option called
8230 FIXED_NEVER_USERS specifying a list that cannot be overridden. The
8231 contents of <option>never_users</option> are added to this list. By default
8232 FIXED_NEVER_USERS also specifies root.
8233 </para>
8234 <para>
8235 When a remote host connects to Exim in order to send mail, the only information
8236 Exim has about the host&#x2019;s identity is its IP address. The next configuration
8237 line,
8238 </para>
8239 <literallayout class="monospaced">
8240 host_lookup = *
8241 </literallayout>
8242 <para>
8243 specifies that Exim should do a reverse DNS lookup on all incoming connections,
8244 in order to get a host name. This improves the quality of the logging
8245 information, but if you feel it is too expensive, you can remove it entirely,
8246 or restrict the lookup to hosts on <quote>nearby</quote> networks.
8247 Note that it is not always possible to find a host name from an IP address,
8248 because not all DNS reverse zones are maintained, and sometimes DNS servers are
8249 unreachable.
8250 </para>
8251 <para>
8252 The next two lines are concerned with <emphasis>ident</emphasis> callbacks, as defined by RFC
8253 1413 (hence their names):
8254 </para>
8255 <literallayout class="monospaced">
8256 rfc1413_hosts = *
8257 rfc1413_query_timeout = 5s
8258 </literallayout>
8259 <para>
8260 These settings cause Exim to make ident callbacks for all incoming SMTP calls.
8261 You can limit the hosts to which these calls are made, or change the timeout
8262 that is used. If you set the timeout to zero, all ident calls are disabled.
8263 Although they are cheap and can provide useful information for tracing problem
8264 messages, some hosts and firewalls have problems with ident calls. This can
8265 result in a timeout instead of an immediate refused connection, leading to
8266 delays on starting up an incoming SMTP session.
8267 </para>
8268 <para>
8269 When Exim receives messages over SMTP connections, it expects all addresses to
8270 be fully qualified with a domain, as required by the SMTP definition. However,
8271 if you are running a server to which simple clients submit messages, you may
8272 find that they send unqualified addresses. The two commented-out options:
8273 </para>
8274 <literallayout class="monospaced">
8275 # sender_unqualified_hosts =
8276 # recipient_unqualified_hosts =
8277 </literallayout>
8278 <para>
8279 show how you can specify hosts that are permitted to send unqualified sender
8280 and recipient addresses, respectively.
8281 </para>
8282 <para>
8283 The <option>percent_hack_domains</option> option is also commented out:
8284 </para>
8285 <literallayout class="monospaced">
8286 # percent_hack_domains =
8287 </literallayout>
8288 <para>
8289 It provides a list of domains for which the <quote>percent hack</quote> is to operate.
8290 This is an almost obsolete form of explicit email routing. If you do not know
8291 anything about it, you can safely ignore this topic.
8292 </para>
8293 <para>
8294 The last two settings in the main part of the default configuration are
8295 concerned with messages that have been <quote>frozen</quote> on Exim&#x2019;s queue. When a
8296 message is frozen, Exim no longer continues to try to deliver it. Freezing
8297 occurs when a bounce message encounters a permanent failure because the sender
8298 address of the original message that caused the bounce is invalid, so the
8299 bounce cannot be delivered. This is probably the most common case, but there
8300 are also other conditions that cause freezing, and frozen messages are not
8301 always bounce messages.
8302 </para>
8303 <literallayout class="monospaced">
8304 ignore_bounce_errors_after = 2d
8305 timeout_frozen_after = 7d
8306 </literallayout>
8307 <para>
8308 The first of these options specifies that failing bounce messages are to be
8309 discarded after 2 days on the queue. The second specifies that any frozen
8310 message (whether a bounce message or not) is to be timed out (and discarded)
8311 after a week. In this configuration, the first setting ensures that no failing
8312 bounce message ever lasts a week.
8313 </para>
8314 </section>
8315 <section id="SECID54">
8316 <title>ACL configuration</title>
8317 <para>
8318 <indexterm role="concept">
8319 <primary>default</primary>
8320 <secondary>ACLs</secondary>
8321 </indexterm>
8322 <indexterm role="concept">
8323 <primary>access control lists (ACLs)</primary>
8324 <secondary>default configuration</secondary>
8325 </indexterm>
8326 In the default configuration, the ACL section follows the main configuration.
8327 It starts with the line
8328 </para>
8329 <literallayout class="monospaced">
8330 begin acl
8331 </literallayout>
8332 <para>
8333 and it contains the definitions of two ACLs, called <emphasis>acl_check_rcpt</emphasis> and
8334 <emphasis>acl_check_data</emphasis>, that were referenced in the settings of <option>acl_smtp_rcpt</option>
8335 and <option>acl_smtp_data</option> above.
8336 </para>
8337 <para>
8338 <indexterm role="concept">
8339 <primary>RCPT</primary>
8340 <secondary>ACL for</secondary>
8341 </indexterm>
8342 The first ACL is used for every RCPT command in an incoming SMTP message. Each
8343 RCPT command specifies one of the message&#x2019;s recipients. The ACL statements
8344 are considered in order, until the recipient address is either accepted or
8345 rejected. The RCPT command is then accepted or rejected, according to the
8346 result of the ACL processing.
8347 </para>
8348 <literallayout class="monospaced">
8349 acl_check_rcpt:
8350 </literallayout>
8351 <para>
8352 This line, consisting of a name terminated by a colon, marks the start of the
8353 ACL, and names it.
8354 </para>
8355 <literallayout class="monospaced">
8356 accept  hosts = :
8357 </literallayout>
8358 <para>
8359 This ACL statement accepts the recipient if the sending host matches the list.
8360 But what does that strange list mean? It doesn&#x2019;t actually contain any host
8361 names or IP addresses. The presence of the colon puts an empty item in the
8362 list; Exim matches this only if the incoming message did not come from a remote
8363 host, because in that case, the remote hostname is empty. The colon is
8364 important. Without it, the list itself is empty, and can never match anything.
8365 </para>
8366 <para>
8367 What this statement is doing is to accept unconditionally all recipients in
8368 messages that are submitted by SMTP from local processes using the standard
8369 input and output (that is, not using TCP/IP). A number of MUAs operate in this
8370 manner.
8371 </para>
8372 <literallayout class="monospaced">
8373 deny    message       = Restricted characters in address
8374         domains       = +local_domains
8375         local_parts   = ^[.] : ^.*[@%!/|]
8376
8377 deny    message       = Restricted characters in address
8378         domains       = !+local_domains
8379         local_parts   = ^[./|] : ^.*[@%!] : ^.*/\\.\\./
8380 </literallayout>
8381 <para>
8382 These statements are concerned with local parts that contain any of the
8383 characters <quote>@</quote>, <quote>%</quote>, <quote>!</quote>, <quote>/</quote>, <quote>|</quote>, or dots in unusual places.
8384 Although these characters are entirely legal in local parts (in the case of
8385 <quote>@</quote> and leading dots, only if correctly quoted), they do not commonly occur
8386 in Internet mail addresses.
8387 </para>
8388 <para>
8389 The first three have in the past been associated with explicitly routed
8390 addresses (percent is still sometimes used &ndash; see the <option>percent_hack_domains</option>
8391 option). Addresses containing these characters are regularly tried by spammers
8392 in an attempt to bypass relaying restrictions, and also by open relay testing
8393 programs. Unless you really need them it is safest to reject these characters
8394 at this early stage. This configuration is heavy-handed in rejecting these
8395 characters for all messages it accepts from remote hosts. This is a deliberate
8396 policy of being as safe as possible.
8397 </para>
8398 <para>
8399 The first rule above is stricter, and is applied to messages that are addressed
8400 to one of the local domains handled by this host. This is implemented by the
8401 first condition, which restricts it to domains that are listed in the
8402 <emphasis>local_domains</emphasis> domain list. The <quote>+</quote> character is used to indicate a
8403 reference to a named list. In this configuration, there is just one domain in
8404 <emphasis>local_domains</emphasis>, but in general there may be many.
8405 </para>
8406 <para>
8407 The second condition on the first statement uses two regular expressions to
8408 block local parts that begin with a dot or contain <quote>@</quote>, <quote>%</quote>, <quote>!</quote>, <quote>/</quote>,
8409 or <quote>|</quote>. If you have local accounts that include these characters, you will
8410 have to modify this rule.
8411 </para>
8412 <para>
8413 Empty components (two dots in a row) are not valid in RFC 2822, but Exim
8414 allows them because they have been encountered in practice. (Consider the
8415 common convention of local parts constructed as
8416 <quote><emphasis>first-initial.second-initial.family-name</emphasis></quote> when applied to someone like
8417 the author of Exim, who has no second initial.) However, a local part starting
8418 with a dot or containing <quote>/../</quote> can cause trouble if it is used as part of a
8419 file name (for example, for a mailing list). This is also true for local parts
8420 that contain slashes. A pipe symbol can also be troublesome if the local part
8421 is incorporated unthinkingly into a shell command line.
8422 </para>
8423 <para>
8424 The second rule above applies to all other domains, and is less strict. This
8425 allows your own users to send outgoing messages to sites that use slashes
8426 and vertical bars in their local parts. It blocks local parts that begin
8427 with a dot, slash, or vertical bar, but allows these characters within the
8428 local part. However, the sequence <quote>/../</quote> is barred. The use of <quote>@</quote>, <quote>%</quote>,
8429 and <quote>!</quote> is blocked, as before. The motivation here is to prevent your users
8430 (or your users&#x2019; viruses) from mounting certain kinds of attack on remote sites.
8431 </para>
8432 <literallayout class="monospaced">
8433 accept  local_parts   = postmaster
8434         domains       = +local_domains
8435 </literallayout>
8436 <para>
8437 This statement, which has two conditions, accepts an incoming address if the
8438 local part is <emphasis>postmaster</emphasis> and the domain is one of those listed in the
8439 <emphasis>local_domains</emphasis> domain list. The <quote>+</quote> character is used to indicate a
8440 reference to a named list. In this configuration, there is just one domain in
8441 <emphasis>local_domains</emphasis>, but in general there may be many.
8442 </para>
8443 <para>
8444 The presence of this statement means that mail to postmaster is never blocked
8445 by any of the subsequent tests. This can be helpful while sorting out problems
8446 in cases where the subsequent tests are incorrectly denying access.
8447 </para>
8448 <literallayout class="monospaced">
8449 require verify        = sender
8450 </literallayout>
8451 <para>
8452 This statement requires the sender address to be verified before any subsequent
8453 ACL statement can be used. If verification fails, the incoming recipient
8454 address is refused. Verification consists of trying to route the address, to
8455 see if a bounce message could be delivered to it. In the case of remote
8456 addresses, basic verification checks only the domain, but <emphasis>callouts</emphasis> can be
8457 used for more verification if required. Section <xref linkend="SECTaddressverification"/>
8458 discusses the details of address verification.
8459 </para>
8460 <literallayout class="monospaced">
8461 accept  hosts         = +relay_from_hosts
8462         control       = submission
8463 </literallayout>
8464 <para>
8465 This statement accepts the address if the message is coming from one of the
8466 hosts that are defined as being allowed to relay through this host. Recipient
8467 verification is omitted here, because in many cases the clients are dumb MUAs
8468 that do not cope well with SMTP error responses. For the same reason, the
8469 second line specifies <quote>submission mode</quote> for messages that are accepted. This
8470 is described in detail in section <xref linkend="SECTsubmodnon"/>; it causes Exim to fix
8471 messages that are deficient in some way, for example, because they lack a
8472 <emphasis>Date:</emphasis> header line. If you are actually relaying out from MTAs, you should
8473 probably add recipient verification here, and disable submission mode.
8474 </para>
8475 <literallayout class="monospaced">
8476 accept  authenticated = *
8477         control       = submission
8478 </literallayout>
8479 <para>
8480 This statement accepts the address if the client host has authenticated itself.
8481 Submission mode is again specified, on the grounds that such messages are most
8482 likely to come from MUAs. The default configuration does not define any
8483 authenticators, though it does include some nearly complete commented-out
8484 examples described in <xref linkend="SECTdefconfauth"/>. This means that no client can in
8485 fact authenticate until you complete the authenticator definitions.
8486 </para>
8487 <literallayout class="monospaced">
8488 require message = relay not permitted
8489         domains = +local_domains : +relay_domains
8490 </literallayout>
8491 <para>
8492 This statement rejects the address if its domain is neither a local domain nor
8493 one of the domains for which this host is a relay.
8494 </para>
8495 <literallayout class="monospaced">
8496 require verify = recipient
8497 </literallayout>
8498 <para>
8499 This statement requires the recipient address to be verified; if verification
8500 fails, the address is rejected.
8501 </para>
8502 <literallayout class="monospaced">
8503 # deny    message     = rejected because $sender_host_address \
8504 #                       is in a black list at $dnslist_domain\n\
8505 #                       $dnslist_text
8506 #         dnslists    = black.list.example
8507 #
8508 # warn    dnslists    = black.list.example
8509 #         add_header  = X-Warning: $sender_host_address is in \
8510 #                       a black list at $dnslist_domain
8511 #         log_message = found in $dnslist_domain
8512 </literallayout>
8513 <para>
8514 These commented-out lines are examples of how you could configure Exim to check
8515 sending hosts against a DNS black list. The first statement rejects messages
8516 from blacklisted hosts, whereas the second just inserts a warning header
8517 line.
8518 </para>
8519 <literallayout class="monospaced">
8520 # require verify = csa
8521 </literallayout>
8522 <para>
8523 This commented-out line is an example of how you could turn on client SMTP
8524 authorization (CSA) checking. Such checks do DNS lookups for special SRV
8525 records.
8526 </para>
8527 <literallayout class="monospaced">
8528 accept
8529 </literallayout>
8530 <para>
8531 The final statement in the first ACL unconditionally accepts any recipient
8532 address that has successfully passed all the previous tests.
8533 </para>
8534 <literallayout class="monospaced">
8535 acl_check_data:
8536 </literallayout>
8537 <para>
8538 This line marks the start of the second ACL, and names it. Most of the contents
8539 of this ACL are commented out:
8540 </para>
8541 <literallayout class="monospaced">
8542 # deny    malware   = *
8543 #         message   = This message contains a virus \
8544 #                     ($malware_name).
8545 </literallayout>
8546 <para>
8547 These lines are examples of how to arrange for messages to be scanned for
8548 viruses when Exim has been compiled with the content-scanning extension, and a
8549 suitable virus scanner is installed. If the message is found to contain a
8550 virus, it is rejected with the given custom error message.
8551 </para>
8552 <literallayout class="monospaced">
8553 # warn    spam      = nobody
8554 #         message   = X-Spam_score: $spam_score\n\
8555 #                     X-Spam_score_int: $spam_score_int\n\
8556 #                     X-Spam_bar: $spam_bar\n\
8557 #                     X-Spam_report: $spam_report
8558 </literallayout>
8559 <para>
8560 These lines are an example of how to arrange for messages to be scanned by
8561 SpamAssassin when Exim has been compiled with the content-scanning extension,
8562 and SpamAssassin has been installed. The SpamAssassin check is run with
8563 <literal>nobody</literal> as its user parameter, and the results are added to the message as a
8564 series of extra header line. In this case, the message is not rejected,
8565 whatever the spam score.
8566 </para>
8567 <literallayout class="monospaced">
8568 accept
8569 </literallayout>
8570 <para>
8571 This final line in the DATA ACL accepts the message unconditionally.
8572 </para>
8573 </section>
8574 <section id="SECID55">
8575 <title>Router configuration</title>
8576 <para>
8577 <indexterm role="concept">
8578 <primary>default</primary>
8579 <secondary>routers</secondary>
8580 </indexterm>
8581 <indexterm role="concept">
8582 <primary>routers</primary>
8583 <secondary>default</secondary>
8584 </indexterm>
8585 The router configuration comes next in the default configuration, introduced
8586 by the line
8587 </para>
8588 <literallayout class="monospaced">
8589 begin routers
8590 </literallayout>
8591 <para>
8592 Routers are the modules in Exim that make decisions about where to send
8593 messages. An address is passed to each router in turn, until it is either
8594 accepted, or failed. This means that the order in which you define the routers
8595 matters. Each router is fully described in its own chapter later in this
8596 manual. Here we give only brief overviews.
8597 </para>
8598 <literallayout class="monospaced">
8599 # domain_literal:
8600 #   driver = ipliteral
8601 #   domains = !+local_domains
8602 #   transport = remote_smtp
8603 </literallayout>
8604 <para>
8605 <indexterm role="concept">
8606 <primary>domain literal</primary>
8607 <secondary>default router</secondary>
8608 </indexterm>
8609 This router is commented out because the majority of sites do not want to
8610 support domain literal addresses (those of the form <emphasis>user@[10.9.8.7]</emphasis>). If
8611 you uncomment this router, you also need to uncomment the setting of
8612 <option>allow_domain_literals</option> in the main part of the configuration.
8613 </para>
8614 <literallayout class="monospaced">
8615 dnslookup:
8616   driver = dnslookup
8617   domains = ! +local_domains
8618   transport = remote_smtp
8619   ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
8620   no_more
8621 </literallayout>
8622 <para>
8623 The first uncommented router handles addresses that do not involve any local
8624 domains. This is specified by the line
8625 </para>
8626 <literallayout class="monospaced">
8627 domains = ! +local_domains
8628 </literallayout>
8629 <para>
8630 The <option>domains</option> option lists the domains to which this router applies, but the
8631 exclamation mark is a negation sign, so the router is used only for domains
8632 that are not in the domain list called <emphasis>local_domains</emphasis> (which was defined at
8633 the start of the configuration). The plus sign before <emphasis>local_domains</emphasis>
8634 indicates that it is referring to a named list. Addresses in other domains are
8635 passed on to the following routers.
8636 </para>
8637 <para>
8638 The name of the router driver is <command>dnslookup</command>,
8639 and is specified by the <option>driver</option> option. Do not be confused by the fact that
8640 the name of this router instance is the same as the name of the driver. The
8641 instance name is arbitrary, but the name set in the <option>driver</option> option must be
8642 one of the driver modules that is in the Exim binary.
8643 </para>
8644 <para>
8645 The <command>dnslookup</command> router routes addresses by looking up their domains in the
8646 DNS in order to obtain a list of hosts to which the address is routed. If the
8647 router succeeds, the address is queued for the <command>remote_smtp</command> transport, as
8648 specified by the <option>transport</option> option. If the router does not find the domain
8649 in the DNS, no further routers are tried because of the <option>no_more</option> setting, so
8650 the address fails and is bounced.
8651 </para>
8652 <para>
8653 The <option>ignore_target_hosts</option> option specifies a list of IP addresses that are to
8654 be entirely ignored. This option is present because a number of cases have been
8655 encountered where MX records in the DNS point to host names
8656 whose IP addresses are 0.0.0.0 or are in the 127 subnet (typically 127.0.0.1).
8657 Completely ignoring these IP addresses causes Exim to fail to route the
8658 email address, so it bounces. Otherwise, Exim would log a routing problem, and
8659 continue to try to deliver the message periodically until the address timed
8660 out.
8661 </para>
8662 <literallayout class="monospaced">
8663 system_aliases:
8664   driver = redirect
8665   allow_fail
8666   allow_defer
8667   data = ${lookup{$local_part}lsearch{/etc/aliases}}
8668 # user = exim
8669   file_transport = address_file
8670   pipe_transport = address_pipe
8671 </literallayout>
8672 <para>
8673 Control reaches this and subsequent routers only for addresses in the local
8674 domains. This router checks to see whether the local part is defined as an
8675 alias in the <filename>/etc/aliases</filename> file, and if so, redirects it according to the
8676 data that it looks up from that file. If no data is found for the local part,
8677 the value of the <option>data</option> option is empty, causing the address to be passed to
8678 the next router.
8679 </para>
8680 <para>
8681 <filename>/etc/aliases</filename> is a conventional name for the system aliases file that is
8682 often used. That is why it is referenced by from the default configuration
8683 file. However, you can change this by setting SYSTEM_ALIASES_FILE in
8684 <filename>Local/Makefile</filename> before building Exim.
8685 </para>
8686 <literallayout class="monospaced">
8687 userforward:
8688   driver = redirect
8689   check_local_user
8690 # local_part_suffix = +* : -*
8691 # local_part_suffix_optional
8692   file = $home/.forward
8693 # allow_filter
8694   no_verify
8695   no_expn
8696   check_ancestor
8697   file_transport = address_file
8698   pipe_transport = address_pipe
8699   reply_transport = address_reply
8700 </literallayout>
8701 <para>
8702 This is the most complicated router in the default configuration. It is another
8703 redirection router, but this time it is looking for forwarding data set up by
8704 individual users. The <option>check_local_user</option> setting specifies a check that the
8705 local part of the address is the login name of a local user. If it is not, the
8706 router is skipped. The two commented options that follow <option>check_local_user</option>,
8707 namely:
8708 </para>
8709 <literallayout class="monospaced">
8710 # local_part_suffix = +* : -*
8711 # local_part_suffix_optional
8712 </literallayout>
8713 <para>
8714 <indexterm role="variable">
8715 <primary><varname>$local_part_suffix</varname></primary>
8716 </indexterm>
8717 show how you can specify the recognition of local part suffixes. If the first
8718 is uncommented, a suffix beginning with either a plus or a minus sign, followed
8719 by any sequence of characters, is removed from the local part and placed in the
8720 variable <varname>$local_part_suffix</varname>. The second suffix option specifies that the
8721 presence of a suffix in the local part is optional. When a suffix is present,
8722 the check for a local login uses the local part with the suffix removed.
8723 </para>
8724 <para>
8725 When a local user account is found, the file called <filename>.forward</filename> in the user&#x2019;s
8726 home directory is consulted. If it does not exist, or is empty, the router
8727 declines. Otherwise, the contents of <filename>.forward</filename> are interpreted as
8728 redirection data (see chapter <xref linkend="CHAPredirect"/> for more details).
8729 </para>
8730 <para>
8731 <indexterm role="concept">
8732 <primary>Sieve filter</primary>
8733 <secondary>enabling in default router</secondary>
8734 </indexterm>
8735 Traditional <filename>.forward</filename> files contain just a list of addresses, pipes, or
8736 files. Exim supports this by default. However, if <option>allow_filter</option> is set (it
8737 is commented out by default), the contents of the file are interpreted as a set
8738 of Exim or Sieve filtering instructions, provided the file begins with <quote>#Exim
8739 filter</quote> or <quote>#Sieve filter</quote>, respectively. User filtering is discussed in the
8740 separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>.
8741 </para>
8742 <para>
8743 The <option>no_verify</option> and <option>no_expn</option> options mean that this router is skipped when
8744 verifying addresses, or when running as a consequence of an SMTP EXPN command.
8745 There are two reasons for doing this:
8746 </para>
8747 <orderedlist numeration="arabic">
8748 <listitem>
8749 <para>
8750 Whether or not a local user has a <filename>.forward</filename> file is not really relevant when
8751 checking an address for validity; it makes sense not to waste resources doing
8752 unnecessary work.
8753 </para>
8754 </listitem>
8755 <listitem>
8756 <para>
8757 More importantly, when Exim is verifying addresses or handling an EXPN
8758 command during an SMTP session, it is running as the Exim user, not as root.
8759 The group is the Exim group, and no additional groups are set up.
8760 It may therefore not be possible for Exim to read users&#x2019; <filename>.forward</filename> files at
8761 this time.
8762 </para>
8763 </listitem>
8764 </orderedlist>
8765 <para>
8766 The setting of <option>check_ancestor</option> prevents the router from generating a new
8767 address that is the same as any previous address that was redirected. (This
8768 works round a problem concerning a bad interaction between aliasing and
8769 forwarding &ndash; see section <xref linkend="SECTredlocmai"/>).
8770 </para>
8771 <para>
8772 The final three option settings specify the transports that are to be used when
8773 forwarding generates a direct delivery to a file, or to a pipe, or sets up an
8774 auto-reply, respectively. For example, if a <filename>.forward</filename> file contains
8775 </para>
8776 <literallayout class="monospaced">
8777 a.nother@elsewhere.example, /home/spqr/archive
8778 </literallayout>
8779 <para>
8780 the delivery to <filename>/home/spqr/archive</filename> is done by running the <option>address_file</option>
8781 transport.
8782 </para>
8783 <literallayout class="monospaced">
8784 localuser:
8785   driver = accept
8786   check_local_user
8787 # local_part_suffix = +* : -*
8788 # local_part_suffix_optional
8789   transport = local_delivery
8790 </literallayout>
8791 <para>
8792 The final router sets up delivery into local mailboxes, provided that the local
8793 part is the name of a local login, by accepting the address and assigning it to
8794 the <command>local_delivery</command> transport. Otherwise, we have reached the end of the
8795 routers, so the address is bounced. The commented suffix settings fulfil the
8796 same purpose as they do for the <command>userforward</command> router.
8797 </para>
8798 </section>
8799 <section id="SECID56">
8800 <title>Transport configuration</title>
8801 <para>
8802 <indexterm role="concept">
8803 <primary>default</primary>
8804 <secondary>transports</secondary>
8805 </indexterm>
8806 <indexterm role="concept">
8807 <primary>transports</primary>
8808 <secondary>default</secondary>
8809 </indexterm>
8810 Transports define mechanisms for actually delivering messages. They operate
8811 only when referenced from routers, so the order in which they are defined does
8812 not matter. The transports section of the configuration starts with
8813 </para>
8814 <literallayout class="monospaced">
8815 begin transports
8816 </literallayout>
8817 <para>
8818 One remote transport and four local transports are defined.
8819 </para>
8820 <literallayout class="monospaced">
8821 remote_smtp:
8822   driver = smtp
8823 </literallayout>
8824 <para>
8825 This transport is used for delivering messages over SMTP connections. All its
8826 options are defaulted. The list of remote hosts comes from the router.
8827 </para>
8828 <literallayout class="monospaced">
8829 local_delivery:
8830   driver = appendfile
8831   file = /var/mail/$local_part
8832   delivery_date_add
8833   envelope_to_add
8834   return_path_add
8835 # group = mail
8836 # mode = 0660
8837 </literallayout>
8838 <para>
8839 This <command>appendfile</command> transport is used for local delivery to user mailboxes in
8840 traditional BSD mailbox format. By default it runs under the uid and gid of the
8841 local user, which requires the sticky bit to be set on the <filename>/var/mail</filename>
8842 directory. Some systems use the alternative approach of running mail deliveries
8843 under a particular group instead of using the sticky bit. The commented options
8844 show how this can be done.
8845 </para>
8846 <para>
8847 Exim adds three headers to the message as it delivers it: <emphasis>Delivery-date:</emphasis>,
8848 <emphasis>Envelope-to:</emphasis> and <emphasis>Return-path:</emphasis>. This action is requested by the three
8849 similarly-named options above.
8850 </para>
8851 <literallayout class="monospaced">
8852 address_pipe:
8853   driver = pipe
8854   return_output
8855 </literallayout>
8856 <para>
8857 This transport is used for handling deliveries to pipes that are generated by
8858 redirection (aliasing or users&#x2019; <filename>.forward</filename> files). The <option>return_output</option>
8859 option specifies that any output generated by the pipe is to be returned to the
8860 sender.
8861 </para>
8862 <literallayout class="monospaced">
8863 address_file:
8864   driver = appendfile
8865   delivery_date_add
8866   envelope_to_add
8867   return_path_add
8868 </literallayout>
8869 <para>
8870 This transport is used for handling deliveries to files that are generated by
8871 redirection. The name of the file is not specified in this instance of
8872 <command>appendfile</command>, because it comes from the <command>redirect</command> router.
8873 </para>
8874 <literallayout class="monospaced">
8875 address_reply:
8876   driver = autoreply
8877 </literallayout>
8878 <para>
8879 This transport is used for handling automatic replies generated by users&#x2019;
8880 filter files.
8881 </para>
8882 </section>
8883 <section id="SECID57">
8884 <title>Default retry rule</title>
8885 <para>
8886 <indexterm role="concept">
8887 <primary>retry</primary>
8888 <secondary>default rule</secondary>
8889 </indexterm>
8890 <indexterm role="concept">
8891 <primary>default</primary>
8892 <secondary>retry rule</secondary>
8893 </indexterm>
8894 The retry section of the configuration file contains rules which affect the way
8895 Exim retries deliveries that cannot be completed at the first attempt. It is
8896 introduced by the line
8897 </para>
8898 <literallayout class="monospaced">
8899 begin retry
8900 </literallayout>
8901 <para>
8902 In the default configuration, there is just one rule, which applies to all
8903 errors:
8904 </para>
8905 <literallayout class="monospaced">
8906 *   *   F,2h,15m; G,16h,1h,1.5; F,4d,6h
8907 </literallayout>
8908 <para>
8909 This causes any temporarily failing address to be retried every 15 minutes for
8910 2 hours, then at intervals starting at one hour and increasing by a factor of
8911 1.5 until 16 hours have passed, then every 6 hours up to 4 days. If an address
8912 is not delivered after 4 days of temporary failure, it is bounced.
8913 </para>
8914 <para>
8915 If the retry section is removed from the configuration, or is empty (that is,
8916 if no retry rules are defined), Exim will not retry deliveries. This turns
8917 temporary errors into permanent errors.
8918 </para>
8919 </section>
8920 <section id="SECID58">
8921 <title>Rewriting configuration</title>
8922 <para>
8923 The rewriting section of the configuration, introduced by
8924 </para>
8925 <literallayout class="monospaced">
8926 begin rewrite
8927 </literallayout>
8928 <para>
8929 contains rules for rewriting addresses in messages as they arrive. There are no
8930 rewriting rules in the default configuration file.
8931 </para>
8932 </section>
8933 <section id="SECTdefconfauth">
8934 <title>Authenticators configuration</title>
8935 <para>
8936 <indexterm role="concept">
8937 <primary>AUTH</primary>
8938 <secondary>configuration</secondary>
8939 </indexterm>
8940 The authenticators section of the configuration, introduced by
8941 </para>
8942 <literallayout class="monospaced">
8943 begin authenticators
8944 </literallayout>
8945 <para>
8946 defines mechanisms for the use of the SMTP AUTH command. The default
8947 configuration file contains two commented-out example authenticators
8948 which support plaintext username/password authentication using the
8949 standard PLAIN mechanism and the traditional but non-standard LOGIN
8950 mechanism, with Exim acting as the server. PLAIN and LOGIN are enough
8951 to support most MUA software.
8952 </para>
8953 <para>
8954 The example PLAIN authenticator looks like this:
8955 </para>
8956 <literallayout class="monospaced">
8957 #PLAIN:
8958 #  driver                  = plaintext
8959 #  server_set_id           = $auth2
8960 #  server_prompts          = :
8961 #  server_condition        = Authentication is not yet configured
8962 #  server_advertise_condition = ${if def:tls_cipher }
8963 </literallayout>
8964 <para>
8965 And the example LOGIN authenticator looks like this:
8966 </para>
8967 <literallayout class="monospaced">
8968 #LOGIN:
8969 #  driver                  = plaintext
8970 #  server_set_id           = $auth1
8971 #  server_prompts          = &lt;| Username: | Password:
8972 #  server_condition        = Authentication is not yet configured
8973 #  server_advertise_condition = ${if def:tls_cipher }
8974 </literallayout>
8975 <para>
8976 The <option>server_set_id</option> option makes Exim remember the authenticated username
8977 in <varname>$authenticated_id</varname>, which can be used later in ACLs or routers. The
8978 <option>server_prompts</option> option configures the <command>plaintext</command> authenticator so
8979 that it implements the details of the specific authentication mechanism,
8980 i.e. PLAIN or LOGIN. The <option>server_advertise_condition</option> setting controls
8981 when Exim offers authentication to clients; in the examples, this is only
8982 when TLS or SSL has been started, so to enable the authenticators you also
8983 need to add support for TLS as described in <xref linkend="SECTdefconfmain"/>.
8984 </para>
8985 <para>
8986 The <option>server_condition</option> setting defines how to verify that the username and
8987 password are correct. In the examples it just produces an error message.
8988 To make the authenticators work, you can use a string expansion
8989 expression like one of the examples in <xref linkend="CHAPplaintext"/>.
8990 </para>
8991 <para>
8992 Beware that the sequence of the parameters to PLAIN and LOGIN differ; the
8993 usercode and password are in different positions.  <xref linkend="CHAPplaintext"/>
8994 covers both.
8995 </para>
8996 <para>
8997 <indexterm role="concept" startref="IIDconfiwal" class="endofrange"/>
8998 </para>
8999 </section>
9000 </chapter>
9001
9002 <chapter id="CHAPregexp">
9003 <title>Regular expressions</title>
9004 <para>
9005 <indexterm role="concept">
9006 <primary>regular expressions</primary>
9007 <secondary>library</secondary>
9008 </indexterm>
9009 <indexterm role="concept">
9010 <primary>PCRE</primary>
9011 </indexterm>
9012 Exim supports the use of regular expressions in many of its options. It
9013 uses the PCRE regular expression library; this provides regular expression
9014 matching that is compatible with Perl 5. The syntax and semantics of
9015 regular expressions is discussed in many Perl reference books, and also in
9016 Jeffrey Friedl&#x2019;s <emphasis>Mastering Regular Expressions</emphasis>, which is published by
9017 O&#x2019;Reilly (see <emphasis role="bold"><ulink url="http://www.oreilly.com/catalog/regex2/">http://www.oreilly.com/catalog/regex2/</ulink></emphasis>).
9018 </para>
9019 <para>
9020 The documentation for the syntax and semantics of the regular expressions that
9021 are supported by PCRE is included in the PCRE distribution, and no further
9022 description is included here. The PCRE functions are called from Exim using
9023 the default option settings (that is, with no PCRE options set), except that
9024 the PCRE_CASELESS option is set when the matching is required to be
9025 case-insensitive.
9026 </para>
9027 <para>
9028 In most cases, when a regular expression is required in an Exim configuration,
9029 it has to start with a circumflex, in order to distinguish it from plain text
9030 or an <quote>ends with</quote> wildcard. In this example of a configuration setting, the
9031 second item in the colon-separated list is a regular expression.
9032 </para>
9033 <literallayout class="monospaced">
9034 domains = a.b.c : ^\\d{3} : *.y.z : ...
9035 </literallayout>
9036 <para>
9037 The doubling of the backslash is required because of string expansion that
9038 precedes interpretation &ndash; see section <xref linkend="SECTlittext"/> for more discussion
9039 of this issue, and a way of avoiding the need for doubling backslashes. The
9040 regular expression that is eventually used in this example contains just one
9041 backslash. The circumflex is included in the regular expression, and has the
9042 normal effect of <quote>anchoring</quote> it to the start of the string that is being
9043 matched.
9044 </para>
9045 <para>
9046 There are, however, two cases where a circumflex is not required for the
9047 recognition of a regular expression: these are the <option>match</option> condition in a
9048 string expansion, and the <option>matches</option> condition in an Exim filter file. In
9049 these cases, the relevant string is always treated as a regular expression; if
9050 it does not start with a circumflex, the expression is not anchored, and can
9051 match anywhere in the subject string.
9052 </para>
9053 <para>
9054 In all cases, if you want a regular expression to match at the end of a string,
9055 you must code the $ metacharacter to indicate this. For example:
9056 </para>
9057 <literallayout class="monospaced">
9058 domains = ^\\d{3}\\.example
9059 </literallayout>
9060 <para>
9061 matches the domain <emphasis>123.example</emphasis>, but it also matches <emphasis>123.example.com</emphasis>.
9062 You need to use:
9063 </para>
9064 <literallayout class="monospaced">
9065 domains = ^\\d{3}\\.example\$
9066 </literallayout>
9067 <para>
9068 if you want <emphasis>example</emphasis> to be the top-level domain. The backslash before the
9069 $ is needed because string expansion also interprets dollar characters.
9070 </para>
9071 </chapter>
9072
9073 <chapter id="CHAPfdlookup">
9074 <title>File and database lookups</title>
9075 <para>
9076 <indexterm role="concept" id="IIDfidalo1" class="startofrange">
9077 <primary>file</primary>
9078 <secondary>lookups</secondary>
9079 </indexterm>
9080 <indexterm role="concept" id="IIDfidalo2" class="startofrange">
9081 <primary>database</primary>
9082 <secondary>lookups</secondary>
9083 </indexterm>
9084 <indexterm role="concept">
9085 <primary>lookup</primary>
9086 <secondary>description of</secondary>
9087 </indexterm>
9088 Exim can be configured to look up data in files or databases as it processes
9089 messages. Two different kinds of syntax are used:
9090 </para>
9091 <orderedlist numeration="arabic">
9092 <listitem>
9093 <para>
9094 A string that is to be expanded may contain explicit lookup requests. These
9095 cause parts of the string to be replaced by data that is obtained from the
9096 lookup. Lookups of this type are conditional expansion items. Different results
9097 can be defined for the cases of lookup success and failure. See chapter
9098 <xref linkend="CHAPexpand"/>, where string expansions are described in detail.
9099 </para>
9100 </listitem>
9101 <listitem>
9102 <para>
9103 Lists of domains, hosts, and email addresses can contain lookup requests as a
9104 way of avoiding excessively long linear lists. In this case, the data that is
9105 returned by the lookup is often (but not always) discarded; whether the lookup
9106 succeeds or fails is what really counts. These kinds of list are described in
9107 chapter <xref linkend="CHAPdomhosaddlists"/>.
9108 </para>
9109 </listitem>
9110 </orderedlist>
9111 <para>
9112 String expansions, lists, and lookups interact with each other in such a way
9113 that there is no order in which to describe any one of them that does not
9114 involve references to the others. Each of these three chapters makes more sense
9115 if you have read the other two first. If you are reading this for the first
9116 time, be aware that some of it will make a lot more sense after you have read
9117 chapters <xref linkend="CHAPdomhosaddlists"/> and <xref linkend="CHAPexpand"/>.
9118 </para>
9119 <section id="SECID60">
9120 <title>Examples of different lookup syntax</title>
9121 <para>
9122 It is easy to confuse the two different kinds of lookup, especially as the
9123 lists that may contain the second kind are always expanded before being
9124 processed as lists. Therefore, they may also contain lookups of the first kind.
9125 Be careful to distinguish between the following two examples:
9126 </para>
9127 <literallayout class="monospaced">
9128 domains = ${lookup{$sender_host_address}lsearch{/some/file}}
9129 domains = lsearch;/some/file
9130 </literallayout>
9131 <para>
9132 The first uses a string expansion, the result of which must be a domain list.
9133 No strings have been specified for a successful or a failing lookup; the
9134 defaults in this case are the looked-up data and an empty string, respectively.
9135 The expansion takes place before the string is processed as a list, and the
9136 file that is searched could contain lines like this:
9137 </para>
9138 <literallayout class="monospaced">
9139 192.168.3.4: domain1:domain2:...
9140 192.168.1.9: domain3:domain4:...
9141 </literallayout>
9142 <para>
9143 When the lookup succeeds, the result of the expansion is a list of domains (and
9144 possibly other types of item that are allowed in domain lists).
9145 </para>
9146 <para>
9147 In the second example, the lookup is a single item in a domain list. It causes
9148 Exim to use a lookup to see if the domain that is being processed can be found
9149 in the file. The file could contains lines like this:
9150 </para>
9151 <literallayout class="monospaced">
9152 domain1:
9153 domain2:
9154 </literallayout>
9155 <para>
9156 Any data that follows the keys is not relevant when checking that the domain
9157 matches the list item.
9158 </para>
9159 <para>
9160 It is possible, though no doubt confusing, to use both kinds of lookup at once.
9161 Consider a file containing lines like this:
9162 </para>
9163 <literallayout class="monospaced">
9164 192.168.5.6: lsearch;/another/file
9165 </literallayout>
9166 <para>
9167 If the value of <varname>$sender_host_address</varname> is 192.168.5.6, expansion of the
9168 first <option>domains</option> setting above generates the second setting, which therefore
9169 causes a second lookup to occur.
9170 </para>
9171 <para>
9172 The rest of this chapter describes the different lookup types that are
9173 available. Any of them can be used in any part of the configuration where a
9174 lookup is permitted.
9175 </para>
9176 </section>
9177 <section id="SECID61">
9178 <title>Lookup types</title>
9179 <para>
9180 <indexterm role="concept">
9181 <primary>lookup</primary>
9182 <secondary>types of</secondary>
9183 </indexterm>
9184 <indexterm role="concept">
9185 <primary>single-key lookup</primary>
9186 <secondary>definition of</secondary>
9187 </indexterm>
9188 Two different types of data lookup are implemented:
9189 </para>
9190 <itemizedlist>
9191 <listitem>
9192 <para>
9193 The <emphasis>single-key</emphasis> type requires the specification of a file in which to look,
9194 and a single key to search for. The key must be a non-empty string for the
9195 lookup to succeed. The lookup type determines how the file is searched.
9196 </para>
9197 </listitem>
9198 <listitem>
9199 <para>
9200 <indexterm role="concept">
9201 <primary>query-style lookup</primary>
9202 <secondary>definition of</secondary>
9203 </indexterm>
9204 The <emphasis>query-style</emphasis> type accepts a generalized database query. No particular
9205 key value is assumed by Exim for query-style lookups. You can use whichever
9206 Exim variables you need to construct the database query.
9207 </para>
9208 </listitem>
9209 </itemizedlist>
9210 <para>
9211 The code for each lookup type is in a separate source file that is included in
9212 the binary of Exim only if the corresponding compile-time option is set. The
9213 default settings in <filename>src/EDITME</filename> are:
9214 </para>
9215 <literallayout class="monospaced">
9216 LOOKUP_DBM=yes
9217 LOOKUP_LSEARCH=yes
9218 </literallayout>
9219 <para>
9220 which means that only linear searching and DBM lookups are included by default.
9221 For some types of lookup (e.g. SQL databases), you need to install appropriate
9222 libraries and header files before building Exim.
9223 </para>
9224 </section>
9225 <section id="SECTsinglekeylookups">
9226 <title>Single-key lookup types</title>
9227 <para>
9228 <indexterm role="concept">
9229 <primary>lookup</primary>
9230 <secondary>single-key types</secondary>
9231 </indexterm>
9232 <indexterm role="concept">
9233 <primary>single-key lookup</primary>
9234 <secondary>list of types</secondary>
9235 </indexterm>
9236 The following single-key lookup types are implemented:
9237 </para>
9238 <itemizedlist>
9239 <listitem>
9240 <para>
9241 <indexterm role="concept">
9242 <primary>cdb</primary>
9243 <secondary>description of</secondary>
9244 </indexterm>
9245 <indexterm role="concept">
9246 <primary>lookup</primary>
9247 <secondary>cdb</secondary>
9248 </indexterm>
9249 <indexterm role="concept">
9250 <primary>binary zero</primary>
9251 <secondary>in lookup key</secondary>
9252 </indexterm>
9253 <command>cdb</command>: The given file is searched as a Constant DataBase file, using the key
9254 string without a terminating binary zero. The cdb format is designed for
9255 indexed files that are read frequently and never updated, except by total
9256 re-creation. As such, it is particularly suitable for large files containing
9257 aliases or other indexed data referenced by an MTA. Information about cdb can
9258 be found in several places:
9259 </para>
9260 <literallayout>
9261 <emphasis role="bold"><ulink url="http://www.pobox.com/~djb/cdb.html">http://www.pobox.com/~djb/cdb.html</ulink></emphasis>
9262 <emphasis role="bold"><ulink url="ftp://ftp.corpit.ru/pub/tinycdb/">ftp://ftp.corpit.ru/pub/tinycdb/</ulink></emphasis>
9263 <emphasis role="bold"><ulink url="http://packages.debian.org/stable/utils/freecdb.html">http://packages.debian.org/stable/utils/freecdb.html</ulink></emphasis>
9264 </literallayout>
9265 <para>
9266 A cdb distribution is not needed in order to build Exim with cdb support,
9267 because the code for reading cdb files is included directly in Exim itself.
9268 However, no means of building or testing cdb files is provided with Exim, so
9269 you need to obtain a cdb distribution in order to do this.
9270 </para>
9271 </listitem>
9272 <listitem>
9273 <para>
9274 <indexterm role="concept">
9275 <primary>DBM</primary>
9276 <secondary>lookup type</secondary>
9277 </indexterm>
9278 <indexterm role="concept">
9279 <primary>lookup</primary>
9280 <secondary>dbm</secondary>
9281 </indexterm>
9282 <indexterm role="concept">
9283 <primary>binary zero</primary>
9284 <secondary>in lookup key</secondary>
9285 </indexterm>
9286 <command>dbm</command>: Calls to DBM library functions are used to extract data from the given
9287 DBM file by looking up the record with the given key. A terminating binary
9288 zero is included in the key that is passed to the DBM library. See section
9289 <xref linkend="SECTdb"/> for a discussion of DBM libraries.
9290 </para>
9291 <para>
9292 <indexterm role="concept">
9293 <primary>Berkeley DB library</primary>
9294 <secondary>file format</secondary>
9295 </indexterm>
9296 For all versions of Berkeley DB, Exim uses the DB_HASH style of database
9297 when building DBM files using the <option>exim_dbmbuild</option> utility. However, when
9298 using Berkeley DB versions 3 or 4, it opens existing databases for reading with
9299 the DB_UNKNOWN option. This enables it to handle any of the types of database
9300 that the library supports, and can be useful for accessing DBM files created by
9301 other applications. (For earlier DB versions, DB_HASH is always used.)
9302 </para>
9303 </listitem>
9304 <listitem>
9305 <para>
9306 <indexterm role="concept">
9307 <primary>lookup</primary>
9308 <secondary>dbmnz</secondary>
9309 </indexterm>
9310 <indexterm role="concept">
9311 <primary>lookup</primary>
9312 <secondary>dbm &ndash; terminating zero</secondary>
9313 </indexterm>
9314 <indexterm role="concept">
9315 <primary>binary zero</primary>
9316 <secondary>in lookup key</secondary>
9317 </indexterm>
9318 <indexterm role="concept">
9319 <primary>Courier</primary>
9320 </indexterm>
9321 <indexterm role="concept">
9322 <primary><filename>/etc/userdbshadow.dat</filename></primary>
9323 </indexterm>
9324 <indexterm role="concept">
9325 <primary>dmbnz lookup type</primary>
9326 </indexterm>
9327 <command>dbmnz</command>: This is the same as <command>dbm</command>, except that a terminating binary zero
9328 is not included in the key that is passed to the DBM library. You may need this
9329 if you want to look up data in files that are created by or shared with some
9330 other application that does not use terminating zeros. For example, you need to
9331 use <command>dbmnz</command> rather than <command>dbm</command> if you want to authenticate incoming SMTP
9332 calls using the passwords from Courier&#x2019;s <filename>/etc/userdbshadow.dat</filename> file. Exim&#x2019;s
9333 utility program for creating DBM files (<emphasis>exim_dbmbuild</emphasis>) includes the zeros
9334 by default, but has an option to omit them (see section <xref linkend="SECTdbmbuild"/>).
9335 </para>
9336 </listitem>
9337 <listitem>
9338 <para>
9339 <indexterm role="concept">
9340 <primary>lookup</primary>
9341 <secondary>dsearch</secondary>
9342 </indexterm>
9343 <indexterm role="concept">
9344 <primary>dsearch lookup type</primary>
9345 </indexterm>
9346 <command>dsearch</command>: The given file must be a directory; this is searched for an entry
9347 whose name is the key by calling the <function>lstat()</function> function. The key may not
9348 contain any forward slash characters. If <function>lstat()</function> succeeds, the result of
9349 the lookup is the name of the entry, which may be a file, directory,
9350 symbolic link, or any other kind of directory entry. An example of how this
9351 lookup can be used to support virtual domains is given in section
9352 <xref linkend="SECTvirtualdomains"/>.
9353 </para>
9354 </listitem>
9355 <listitem>
9356 <para>
9357 <indexterm role="concept">
9358 <primary>lookup</primary>
9359 <secondary>iplsearch</secondary>
9360 </indexterm>
9361 <indexterm role="concept">
9362 <primary>iplsearch lookup type</primary>
9363 </indexterm>
9364 <command>iplsearch</command>: The given file is a text file containing keys and data. A key is
9365 terminated by a colon or white space or the end of the line. The keys in the
9366 file must be IP addresses, or IP addresses with CIDR masks. Keys that involve
9367 IPv6 addresses must be enclosed in quotes to prevent the first internal colon
9368 being interpreted as a key terminator. For example:
9369 </para>
9370 <literallayout class="monospaced">
9371 1.2.3.4:           data for 1.2.3.4
9372 192.168.0.0/16:    data for 192.168.0.0/16
9373 "abcd::cdab":      data for abcd::cdab
9374 "abcd:abcd::/32"   data for abcd:abcd::/32
9375 </literallayout>
9376 <para>
9377 The key for an <command>iplsearch</command> lookup must be an IP address (without a mask). The
9378 file is searched linearly, using the CIDR masks where present, until a matching
9379 key is found. The first key that matches is used; there is no attempt to find a
9380 <quote>best</quote> match. Apart from the way the keys are matched, the processing for
9381 <command>iplsearch</command> is the same as for <command>lsearch</command>.
9382 </para>
9383 <para>
9384 <emphasis role="bold">Warning 1</emphasis>: Unlike most other single-key lookup types, a file of data for
9385 <command>iplsearch</command> can <emphasis>not</emphasis> be turned into a DBM or cdb file, because those
9386 lookup types support only literal keys.
9387 </para>
9388 <para>
9389 <emphasis role="bold">Warning 2</emphasis>: In a host list, you must always use <command>net-iplsearch</command> so that
9390 the implicit key is the host&#x2019;s IP address rather than its name (see section
9391 <xref linkend="SECThoslispatsikey"/>).
9392 </para>
9393 </listitem>
9394 <listitem>
9395 <para>
9396 <indexterm role="concept">
9397 <primary>linear search</primary>
9398 </indexterm>
9399 <indexterm role="concept">
9400 <primary>lookup</primary>
9401 <secondary>lsearch</secondary>
9402 </indexterm>
9403 <indexterm role="concept">
9404 <primary>lsearch lookup type</primary>
9405 </indexterm>
9406 <indexterm role="concept">
9407 <primary>case sensitivity</primary>
9408 <secondary>in lsearch lookup</secondary>
9409 </indexterm>
9410 <command>lsearch</command>: The given file is a text file that is searched linearly for a
9411 line beginning with the search key, terminated by a colon or white space or the
9412 end of the line. The search is case-insensitive; that is, upper and lower case
9413 letters are treated as the same. The first occurrence of the key that is found
9414 in the file is used.
9415 </para>
9416 <para>
9417 White space between the key and the colon is permitted. The remainder of the
9418 line, with leading and trailing white space removed, is the data. This can be
9419 continued onto subsequent lines by starting them with any amount of white
9420 space, but only a single space character is included in the data at such a
9421 junction. If the data begins with a colon, the key must be terminated by a
9422 colon, for example:
9423 </para>
9424 <literallayout class="monospaced">
9425 baduser:  :fail:
9426 </literallayout>
9427 <para>
9428 Empty lines and lines beginning with # are ignored, even if they occur in the
9429 middle of an item. This is the traditional textual format of alias files. Note
9430 that the keys in an <command>lsearch</command> file are literal strings. There is no
9431 wildcarding of any kind.
9432 </para>
9433 <para>
9434 <indexterm role="concept">
9435 <primary>lookup</primary>
9436 <secondary>lsearch &ndash; colons in keys</secondary>
9437 </indexterm>
9438 <indexterm role="concept">
9439 <primary>white space</primary>
9440 <secondary>in lsearch key</secondary>
9441 </indexterm>
9442 In most <command>lsearch</command> files, keys are not required to contain colons or #
9443 characters, or white space. However, if you need this feature, it is available.
9444 If a key begins with a doublequote character, it is terminated only by a
9445 matching quote (or end of line), and the normal escaping rules apply to its
9446 contents (see section <xref linkend="SECTstrings"/>). An optional colon is permitted after
9447 quoted keys (exactly as for unquoted keys). There is no special handling of
9448 quotes for the data part of an <command>lsearch</command> line.
9449 </para>
9450 </listitem>
9451 <listitem>
9452 <para>
9453 <indexterm role="concept">
9454 <primary>NIS lookup type</primary>
9455 </indexterm>
9456 <indexterm role="concept">
9457 <primary>lookup</primary>
9458 <secondary>NIS</secondary>
9459 </indexterm>
9460 <indexterm role="concept">
9461 <primary>binary zero</primary>
9462 <secondary>in lookup key</secondary>
9463 </indexterm>
9464 <command>nis</command>: The given file is the name of a NIS map, and a NIS lookup is done with
9465 the given key, without a terminating binary zero. There is a variant called
9466 <command>nis0</command> which does include the terminating binary zero in the key. This is
9467 reportedly needed for Sun-style alias files. Exim does not recognize NIS
9468 aliases; the full map names must be used.
9469 </para>
9470 </listitem>
9471 <listitem>
9472 <para>
9473 <indexterm role="concept">
9474 <primary>wildlsearch lookup type</primary>
9475 </indexterm>
9476 <indexterm role="concept">
9477 <primary>lookup</primary>
9478 <secondary>wildlsearch</secondary>
9479 </indexterm>
9480 <indexterm role="concept">
9481 <primary>nwildlsearch lookup type</primary>
9482 </indexterm>
9483 <indexterm role="concept">
9484 <primary>lookup</primary>
9485 <secondary>nwildlsearch</secondary>
9486 </indexterm>
9487 <command>wildlsearch</command> or <command>nwildlsearch</command>: These search a file linearly, like
9488 <command>lsearch</command>, but instead of being interpreted as a literal string, each key in
9489 the file may be wildcarded. The difference between these two lookup types is
9490 that for <command>wildlsearch</command>, each key in the file is string-expanded before being
9491 used, whereas for <command>nwildlsearch</command>, no expansion takes place.
9492 </para>
9493 <para>
9494 <indexterm role="concept">
9495 <primary>case sensitivity</primary>
9496 <secondary>in (n)wildlsearch lookup</secondary>
9497 </indexterm>
9498 Like <command>lsearch</command>, the testing is done case-insensitively. However, keys in the
9499 file that are regular expressions can be made case-sensitive by the use of
9500 <literal>(-i)</literal> within the pattern. The following forms of wildcard are recognized:
9501 </para>
9502 <orderedlist numeration="arabic">
9503 <listitem>
9504 <para>
9505 The string may begin with an asterisk to mean <quote>ends with</quote>. For example:
9506 </para>
9507 <literallayout class="monospaced">
9508     *.a.b.c       data for anything.a.b.c
9509     *fish         data for anythingfish
9510 </literallayout>
9511 </listitem>
9512 <listitem>
9513 <para>
9514 The string may begin with a circumflex to indicate a regular expression. For
9515 example, for <command>wildlsearch</command>:
9516 </para>
9517 <literallayout class="monospaced">
9518     ^\N\d+\.a\.b\N    data for &lt;digits&gt;.a.b
9519 </literallayout>
9520 <para>
9521 Note the use of <literal>\N</literal> to disable expansion of the contents of the regular
9522 expression. If you are using <command>nwildlsearch</command>, where the keys are not
9523 string-expanded, the equivalent entry is:
9524 </para>
9525 <literallayout class="monospaced">
9526     ^\d+\.a\.b        data for &lt;digits&gt;.a.b
9527 </literallayout>
9528 <para>
9529 The case-insensitive flag is set at the start of compiling the regular
9530 expression, but it can be turned off by using <literal>(-i)</literal> at an appropriate point.
9531 For example, to make the entire pattern case-sensitive:
9532 </para>
9533 <literallayout class="monospaced">
9534     ^(?-i)\d+\.a\.b        data for &lt;digits&gt;.a.b
9535 </literallayout>
9536 <para>
9537 If the regular expression contains white space or colon characters, you must
9538 either quote it (see <command>lsearch</command> above), or represent these characters in other
9539 ways. For example, <literal>\s</literal> can be used for white space and <literal>\x3A</literal> for a
9540 colon. This may be easier than quoting, because if you quote, you have to
9541 escape all the backslashes inside the quotes.
9542 </para>
9543 <para>
9544 <emphasis role="bold">Note</emphasis>: It is not possible to capture substrings in a regular expression
9545 match for later use, because the results of all lookups are cached. If a lookup
9546 is repeated, the result is taken from the cache, and no actual pattern matching
9547 takes place. The values of all the numeric variables are unset after a
9548 <command>(n)wildlsearch</command> match.
9549 </para>
9550 </listitem>
9551 <listitem>
9552 <para>
9553 Although I cannot see it being of much use, the general matching function that
9554 is used to implement <command>(n)wildlsearch</command> means that the string may begin with a
9555 lookup name terminated by a semicolon, and followed by lookup data. For
9556 example:
9557 </para>
9558 <literallayout class="monospaced">
9559     cdb;/some/file  data for keys that match the file
9560 </literallayout>
9561 <para>
9562 The data that is obtained from the nested lookup is discarded.
9563 </para>
9564 </listitem>
9565 </orderedlist>
9566 <para>
9567 Keys that do not match any of these patterns are interpreted literally. The
9568 continuation rules for the data are the same as for <command>lsearch</command>, and keys may
9569 be followed by optional colons.
9570 </para>
9571 <para>
9572 <emphasis role="bold">Warning</emphasis>: Unlike most other single-key lookup types, a file of data for
9573 <command>(n)wildlsearch</command> can <emphasis>not</emphasis> be turned into a DBM or cdb file, because those
9574 lookup types support only literal keys.
9575 </para>
9576 </listitem>
9577 </itemizedlist>
9578 </section>
9579 <section id="SECID62">
9580 <title>Query-style lookup types</title>
9581 <para>
9582 <indexterm role="concept">
9583 <primary>lookup</primary>
9584 <secondary>query-style types</secondary>
9585 </indexterm>
9586 <indexterm role="concept">
9587 <primary>query-style lookup</primary>
9588 <secondary>list of types</secondary>
9589 </indexterm>
9590 The supported query-style lookup types are listed below. Further details about
9591 many of them are given in later sections.
9592 </para>
9593 <itemizedlist>
9594 <listitem>
9595 <para>
9596 <indexterm role="concept">
9597 <primary>DNS</primary>
9598 <secondary>as a lookup type</secondary>
9599 </indexterm>
9600 <indexterm role="concept">
9601 <primary>lookup</primary>
9602 <secondary>DNS</secondary>
9603 </indexterm>
9604 <command>dnsdb</command>: This does a DNS search for one or more records whose domain names
9605 are given in the supplied query. The resulting data is the contents of the
9606 records. See section <xref linkend="SECTdnsdb"/>.
9607 </para>
9608 </listitem>
9609 <listitem>
9610 <para>
9611 <indexterm role="concept">
9612 <primary>InterBase lookup type</primary>
9613 </indexterm>
9614 <indexterm role="concept">
9615 <primary>lookup</primary>
9616 <secondary>InterBase</secondary>
9617 </indexterm>
9618 <command>ibase</command>: This does a lookup in an InterBase database.
9619 </para>
9620 </listitem>
9621 <listitem>
9622 <para>
9623 <indexterm role="concept">
9624 <primary>LDAP</primary>
9625 <secondary>lookup type</secondary>
9626 </indexterm>
9627 <indexterm role="concept">
9628 <primary>lookup</primary>
9629 <secondary>LDAP</secondary>
9630 </indexterm>
9631 <command>ldap</command>: This does an LDAP lookup using a query in the form of a URL, and
9632 returns attributes from a single entry. There is a variant called <command>ldapm</command>
9633 that permits values from multiple entries to be returned. A third variant
9634 called <command>ldapdn</command> returns the Distinguished Name of a single entry instead of
9635 any attribute values. See section <xref linkend="SECTldap"/>.
9636 </para>
9637 </listitem>
9638 <listitem>
9639 <para>
9640 <indexterm role="concept">
9641 <primary>MySQL</primary>
9642 <secondary>lookup type</secondary>
9643 </indexterm>
9644 <indexterm role="concept">
9645 <primary>lookup</primary>
9646 <secondary>MySQL</secondary>
9647 </indexterm>
9648 <command>mysql</command>: The format of the query is an SQL statement that is passed to a
9649 MySQL database. See section <xref linkend="SECTsql"/>.
9650 </para>
9651 </listitem>
9652 <listitem>
9653 <para>
9654 <indexterm role="concept">
9655 <primary>NIS+ lookup type</primary>
9656 </indexterm>
9657 <indexterm role="concept">
9658 <primary>lookup</primary>
9659 <secondary>NIS+</secondary>
9660 </indexterm>
9661 <command>nisplus</command>: This does a NIS+ lookup using a query that can specify the name of
9662 the field to be returned. See section <xref linkend="SECTnisplus"/>.
9663 </para>
9664 </listitem>
9665 <listitem>
9666 <para>
9667 <indexterm role="concept">
9668 <primary>Oracle</primary>
9669 <secondary>lookup type</secondary>
9670 </indexterm>
9671 <indexterm role="concept">
9672 <primary>lookup</primary>
9673 <secondary>Oracle</secondary>
9674 </indexterm>
9675 <command>oracle</command>: The format of the query is an SQL statement that is passed to an
9676 Oracle database. See section <xref linkend="SECTsql"/>.
9677 </para>
9678 </listitem>
9679 <listitem>
9680 <para>
9681 <indexterm role="concept">
9682 <primary>lookup</primary>
9683 <secondary>passwd</secondary>
9684 </indexterm>
9685 <indexterm role="concept">
9686 <primary>passwd lookup type</primary>
9687 </indexterm>
9688 <indexterm role="concept">
9689 <primary><filename>/etc/passwd</filename></primary>
9690 </indexterm>
9691 <command>passwd</command> is a query-style lookup with queries that are just user names. The
9692 lookup calls <function>getpwnam()</function> to interrogate the system password data, and on
9693 success, the result string is the same as you would get from an <command>lsearch</command>
9694 lookup on a traditional <filename>/etc/passwd file</filename>, though with <literal>*</literal> for the
9695 password value. For example:
9696 </para>
9697 <literallayout class="monospaced">
9698 *:42:42:King Rat:/home/kr:/bin/bash
9699 </literallayout>
9700 </listitem>
9701 <listitem>
9702 <para>
9703 <indexterm role="concept">
9704 <primary>PostgreSQL lookup type</primary>
9705 </indexterm>
9706 <indexterm role="concept">
9707 <primary>lookup</primary>
9708 <secondary>PostgreSQL</secondary>
9709 </indexterm>
9710 <command>pgsql</command>: The format of the query is an SQL statement that is passed to a
9711 PostgreSQL database. See section <xref linkend="SECTsql"/>.
9712 </para>
9713 </listitem>
9714 <listitem>
9715 <para>
9716 <indexterm role="concept">
9717 <primary>sqlite lookup type</primary>
9718 </indexterm>
9719 <indexterm role="concept">
9720 <primary>lookup</primary>
9721 <secondary>sqlite</secondary>
9722 </indexterm>
9723 <command>sqlite</command>: The format of the query is a file name followed by an SQL statement
9724 that is passed to an SQLite database. See section <xref linkend="SECTsqlite"/>.
9725 </para>
9726 </listitem>
9727 <listitem>
9728 <para>
9729 <command>testdb</command>: This is a lookup type that is used for testing Exim. It is
9730 not likely to be useful in normal operation.
9731 </para>
9732 </listitem>
9733 <listitem>
9734 <para>
9735 <indexterm role="concept">
9736 <primary>whoson lookup type</primary>
9737 </indexterm>
9738 <indexterm role="concept">
9739 <primary>lookup</primary>
9740 <secondary>whoson</secondary>
9741 </indexterm>
9742 <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
9743 allows a server to check whether a particular (dynamically allocated) IP
9744 address is currently allocated to a known (trusted) user and, optionally, to
9745 obtain the identity of the said user. For SMTP servers, <emphasis>Whoson</emphasis> was popular
9746 at one time for <quote>POP before SMTP</quote> authentication, but that approach has been
9747 superseded by SMTP authentication. In Exim, <emphasis>Whoson</emphasis> can be used to implement
9748 <quote>POP before SMTP</quote> checking using ACL statements such as
9749 </para>
9750 <literallayout class="monospaced">
9751 require condition = \
9752   ${lookup whoson {$sender_host_address}{yes}{no}}
9753 </literallayout>
9754 <para>
9755 The query consists of a single IP address. The value returned is the name of
9756 the authenticated user, which is stored in the variable <varname>$value</varname>. However, in
9757 this example, the data in <varname>$value</varname> is not used; the result of the lookup is
9758 one of the fixed strings <quote>yes</quote> or <quote>no</quote>.
9759 </para>
9760 </listitem>
9761 </itemizedlist>
9762 </section>
9763 <section id="SECID63">
9764 <title>Temporary errors in lookups</title>
9765 <para>
9766 <indexterm role="concept">
9767 <primary>lookup</primary>
9768 <secondary>temporary error in</secondary>
9769 </indexterm>
9770 Lookup functions can return temporary error codes if the lookup cannot be
9771 completed. For example, an SQL or LDAP database might be unavailable. For this
9772 reason, it is not advisable to use a lookup that might do this for critical
9773 options such as a list of local domains.
9774 </para>
9775 <para>
9776 When a lookup cannot be completed in a router or transport, delivery
9777 of the message (to the relevant address) is deferred, as for any other
9778 temporary error. In other circumstances Exim may assume the lookup has failed,
9779 or may give up altogether.
9780 </para>
9781 </section>
9782 <section id="SECTdefaultvaluelookups">
9783 <title>Default values in single-key lookups</title>
9784 <para>
9785 <indexterm role="concept">
9786 <primary>wildcard lookups</primary>
9787 </indexterm>
9788 <indexterm role="concept">
9789 <primary>lookup</primary>
9790 <secondary>default values</secondary>
9791 </indexterm>
9792 <indexterm role="concept">
9793 <primary>lookup</primary>
9794 <secondary>wildcard</secondary>
9795 </indexterm>
9796 <indexterm role="concept">
9797 <primary>lookup</primary>
9798 <secondary>* added to type</secondary>
9799 </indexterm>
9800 <indexterm role="concept">
9801 <primary>default</primary>
9802 <secondary>in single-key lookups</secondary>
9803 </indexterm>
9804 In this context, a <quote>default value</quote> is a value specified by the administrator
9805 that is to be used if a lookup fails.
9806 </para>
9807 <para>
9808 <emphasis role="bold">Note:</emphasis> This section applies only to single-key lookups. For query-style
9809 lookups, the facilities of the query language must be used. An attempt to
9810 specify a default for a query-style lookup provokes an error.
9811 </para>
9812 <para>
9813 If <quote>*</quote> is added to a single-key lookup type (for example, <option>lsearch*</option>)
9814 and the initial lookup fails, the key <quote>*</quote> is looked up in the file to
9815 provide a default value. See also the section on partial matching below.
9816 </para>
9817 <para>
9818 <indexterm role="concept">
9819 <primary>*@ with single-key lookup</primary>
9820 </indexterm>
9821 <indexterm role="concept">
9822 <primary>lookup</primary>
9823 <secondary>*@ added to type</secondary>
9824 </indexterm>
9825 <indexterm role="concept">
9826 <primary>alias file</primary>
9827 <secondary>per-domain default</secondary>
9828 </indexterm>
9829 Alternatively, if <quote>*@</quote> is added to a single-key lookup type (for example
9830 <option>dbm*@</option>) then, if the initial lookup fails and the key contains an @
9831 character, a second lookup is done with everything before the last @ replaced
9832 by *. This makes it possible to provide per-domain defaults in alias files
9833 that include the domains in the keys. If the second lookup fails (or doesn&#x2019;t
9834 take place because there is no @ in the key), <quote>*</quote> is looked up.
9835 For example, a <command>redirect</command> router might contain:
9836 </para>
9837 <literallayout class="monospaced">
9838 data = ${lookup{$local_part@$domain}lsearch*@{/etc/mix-aliases}}
9839 </literallayout>
9840 <para>
9841 Suppose the address that is being processed is <emphasis>jane@eyre.example</emphasis>. Exim
9842 looks up these keys, in this order:
9843 </para>
9844 <literallayout class="monospaced">
9845 jane@eyre.example
9846 *@eyre.example
9847 *
9848 </literallayout>
9849 <para>
9850 The data is taken from whichever key it finds first. <emphasis role="bold">Note</emphasis>: In an
9851 <command>lsearch</command> file, this does not mean the first of these keys in the file. A
9852 complete scan is done for each key, and only if it is not found at all does
9853 Exim move on to try the next key.
9854 </para>
9855 </section>
9856 <section id="SECTpartiallookup">
9857 <title>Partial matching in single-key lookups</title>
9858 <para>
9859 <indexterm role="concept">
9860 <primary>partial matching</primary>
9861 </indexterm>
9862 <indexterm role="concept">
9863 <primary>wildcard lookups</primary>
9864 </indexterm>
9865 <indexterm role="concept">
9866 <primary>lookup</primary>
9867 <secondary>partial matching</secondary>
9868 </indexterm>
9869 <indexterm role="concept">
9870 <primary>lookup</primary>
9871 <secondary>wildcard</secondary>
9872 </indexterm>
9873 <indexterm role="concept">
9874 <primary>asterisk</primary>
9875 <secondary>in search type</secondary>
9876 </indexterm>
9877 The normal operation of a single-key lookup is to search the file for an exact
9878 match with the given key. However, in a number of situations where domains are
9879 being looked up, it is useful to be able to do partial matching. In this case,
9880 information in the file that has a key starting with <quote>*.</quote> is matched by any
9881 domain that ends with the components that follow the full stop. For example, if
9882 a key in a DBM file is
9883 </para>
9884 <literallayout class="monospaced">
9885 *.dates.fict.example
9886 </literallayout>
9887 <para>
9888 then when partial matching is enabled this is matched by (amongst others)
9889 <emphasis>2001.dates.fict.example</emphasis> and <emphasis>1984.dates.fict.example</emphasis>. It is also matched
9890 by <emphasis>dates.fict.example</emphasis>, if that does not appear as a separate key in the
9891 file.
9892 </para>
9893 <para>
9894 <emphasis role="bold">Note</emphasis>: Partial matching is not available for query-style lookups. It is
9895 also not available for any lookup items in address lists (see section
9896 <xref linkend="SECTaddresslist"/>).
9897 </para>
9898 <para>
9899 Partial matching is implemented by doing a series of separate lookups using
9900 keys constructed by modifying the original subject key. This means that it can
9901 be used with any of the single-key lookup types, provided that
9902 partial matching keys
9903 beginning with a special prefix (default <quote>*.</quote>) are included in the data file.
9904 Keys in the file that do not begin with the prefix are matched only by
9905 unmodified subject keys when partial matching is in use.
9906 </para>
9907 <para>
9908 Partial matching is requested by adding the string <quote>partial-</quote> to the front of
9909 the name of a single-key lookup type, for example, <option>partial-dbm</option>. When this
9910 is done, the subject key is first looked up unmodified; if that fails, <quote>*.</quote>
9911 is added at the start of the subject key, and it is looked up again. If that
9912 fails, further lookups are tried with dot-separated components removed from the
9913 start of the subject key, one-by-one, and <quote>*.</quote> added on the front of what
9914 remains.
9915 </para>
9916 <para>
9917 A minimum number of two non-* components are required. This can be adjusted
9918 by including a number before the hyphen in the search type. For example,
9919 <option>partial3-lsearch</option> specifies a minimum of three non-* components in the
9920 modified keys. Omitting the number is equivalent to <quote>partial2-</quote>. If the
9921 subject key is <emphasis>2250.dates.fict.example</emphasis> then the following keys are looked
9922 up when the minimum number of non-* components is two:
9923 </para>
9924 <literallayout class="monospaced">
9925 2250.dates.fict.example
9926 *.2250.dates.fict.example
9927 *.dates.fict.example
9928 *.fict.example
9929 </literallayout>
9930 <para>
9931 As soon as one key in the sequence is successfully looked up, the lookup
9932 finishes.
9933 </para>
9934 <para>
9935 <indexterm role="concept">
9936 <primary>lookup</primary>
9937 <secondary>partial matching &ndash; changing prefix</secondary>
9938 </indexterm>
9939 <indexterm role="concept">
9940 <primary>prefix</primary>
9941 <secondary>for partial matching</secondary>
9942 </indexterm>
9943 The use of <quote>*.</quote> as the partial matching prefix is a default that can be
9944 changed. The motivation for this feature is to allow Exim to operate with file
9945 formats that are used by other MTAs. A different prefix can be supplied in
9946 parentheses instead of the hyphen after <quote>partial</quote>. For example:
9947 </para>
9948 <literallayout class="monospaced">
9949 domains = partial(.)lsearch;/some/file
9950 </literallayout>
9951 <para>
9952 In this example, if the domain is <emphasis>a.b.c</emphasis>, the sequence of lookups is
9953 <literal>a.b.c</literal>, <literal>.a.b.c</literal>, and <literal>.b.c</literal> (the default minimum of 2 non-wild
9954 components is unchanged). The prefix may consist of any punctuation characters
9955 other than a closing parenthesis. It may be empty, for example:
9956 </para>
9957 <literallayout class="monospaced">
9958 domains = partial1()cdb;/some/file
9959 </literallayout>
9960 <para>
9961 For this example, if the domain is <emphasis>a.b.c</emphasis>, the sequence of lookups is
9962 <literal>a.b.c</literal>, <literal>b.c</literal>, and <literal>c</literal>.
9963 </para>
9964 <para>
9965 If <quote>partial0</quote> is specified, what happens at the end (when the lookup with
9966 just one non-wild component has failed, and the original key is shortened right
9967 down to the null string) depends on the prefix:
9968 </para>
9969 <itemizedlist>
9970 <listitem>
9971 <para>
9972 If the prefix has zero length, the whole lookup fails.
9973 </para>
9974 </listitem>
9975 <listitem>
9976 <para>
9977 If the prefix has length 1, a lookup for just the prefix is done. For
9978 example, the final lookup for <quote>partial0(.)</quote> is for <literal>.</literal> alone.
9979 </para>
9980 </listitem>
9981 <listitem>
9982 <para>
9983 Otherwise, if the prefix ends in a dot, the dot is removed, and the
9984 remainder is looked up. With the default prefix, therefore, the final lookup is
9985 for <quote>*</quote> on its own.
9986 </para>
9987 </listitem>
9988 <listitem>
9989 <para>
9990 Otherwise, the whole prefix is looked up.
9991 </para>
9992 </listitem>
9993 </itemizedlist>
9994 <para>
9995 If the search type ends in <quote>*</quote> or <quote>*@</quote> (see section
9996 <xref linkend="SECTdefaultvaluelookups"/> above), the search for an ultimate default that
9997 this implies happens after all partial lookups have failed. If <quote>partial0</quote> is
9998 specified, adding <quote>*</quote> to the search type has no effect with the default
9999 prefix, because the <quote>*</quote> key is already included in the sequence of partial
10000 lookups. However, there might be a use for lookup types such as
10001 <quote>partial0(.)lsearch*</quote>.
10002 </para>
10003 <para>
10004 The use of <quote>*</quote> in lookup partial matching differs from its use as a wildcard
10005 in domain lists and the like. Partial matching works only in terms of
10006 dot-separated components; a key such as <literal>*fict.example</literal>
10007 in a database file is useless, because the asterisk in a partial matching
10008 subject key is always followed by a dot.
10009 </para>
10010 </section>
10011 <section id="SECID64">
10012 <title>Lookup caching</title>
10013 <para>
10014 <indexterm role="concept">
10015 <primary>lookup</primary>
10016 <secondary>caching</secondary>
10017 </indexterm>
10018 <indexterm role="concept">
10019 <primary>caching</primary>
10020 <secondary>lookup data</secondary>
10021 </indexterm>
10022 Exim caches all lookup results in order to avoid needless repetition of
10023 lookups. However, because (apart from the daemon) Exim operates as a collection
10024 of independent, short-lived processes, this caching applies only within a
10025 single Exim process. There is no inter-process lookup caching facility.
10026 </para>
10027 <para>
10028 For single-key lookups, Exim keeps the relevant files open in case there is
10029 another lookup that needs them. In some types of configuration this can lead to
10030 many files being kept open for messages with many recipients. To avoid hitting
10031 the operating system limit on the number of simultaneously open files, Exim
10032 closes the least recently used file when it needs to open more files than its
10033 own internal limit, which can be changed via the <option>lookup_open_max</option> option.
10034 </para>
10035 <para>
10036 The single-key lookup files are closed and the lookup caches are flushed at
10037 strategic points during delivery &ndash; for example, after all routing is
10038 complete.
10039 </para>
10040 </section>
10041 <section id="SECID65">
10042 <title>Quoting lookup data</title>
10043 <para>
10044 <indexterm role="concept">
10045 <primary>lookup</primary>
10046 <secondary>quoting</secondary>
10047 </indexterm>
10048 <indexterm role="concept">
10049 <primary>quoting</primary>
10050 <secondary>in lookups</secondary>
10051 </indexterm>
10052 When data from an incoming message is included in a query-style lookup, there
10053 is the possibility of special characters in the data messing up the syntax of
10054 the query. For example, a NIS+ query that contains
10055 </para>
10056 <literallayout class="monospaced">
10057 [name=$local_part]
10058 </literallayout>
10059 <para>
10060 will be broken if the local part happens to contain a closing square bracket.
10061 For NIS+, data can be enclosed in double quotes like this:
10062 </para>
10063 <literallayout class="monospaced">
10064 [name="$local_part"]
10065 </literallayout>
10066 <para>
10067 but this still leaves the problem of a double quote in the data. The rule for
10068 NIS+ is that double quotes must be doubled. Other lookup types have different
10069 rules, and to cope with the differing requirements, an expansion operator
10070 of the following form is provided:
10071 </para>
10072 <literallayout class="monospaced">
10073 ${quote_&lt;lookup-type&gt;:&lt;string&gt;}
10074 </literallayout>
10075 <para>
10076 For example, the safest way to write the NIS+ query is
10077 </para>
10078 <literallayout class="monospaced">
10079 [name="${quote_nisplus:$local_part}"]
10080 </literallayout>
10081 <para>
10082 See chapter <xref linkend="CHAPexpand"/> for full coverage of string expansions. The quote
10083 operator can be used for all lookup types, but has no effect for single-key
10084 lookups, since no quoting is ever needed in their key strings.
10085 </para>
10086 </section>
10087 <section id="SECTdnsdb">
10088 <title>More about dnsdb</title>
10089 <para>
10090 <indexterm role="concept">
10091 <primary>dnsdb lookup</primary>
10092 </indexterm>
10093 <indexterm role="concept">
10094 <primary>lookup</primary>
10095 <secondary>dnsdb</secondary>
10096 </indexterm>
10097 <indexterm role="concept">
10098 <primary>DNS</primary>
10099 <secondary>as a lookup type</secondary>
10100 </indexterm>
10101 The <command>dnsdb</command> lookup type uses the DNS as its database. A simple query consists
10102 of a record type and a domain name, separated by an equals sign. For example,
10103 an expansion string could contain:
10104 </para>
10105 <literallayout class="monospaced">
10106 ${lookup dnsdb{mx=a.b.example}{$value}fail}
10107 </literallayout>
10108 <para>
10109 If the lookup succeeds, the result is placed in <varname>$value</varname>, which in this case
10110 is used on its own as the result. If the lookup does not succeed, the
10111 <literal>fail</literal> keyword causes a <emphasis>forced expansion failure</emphasis> &ndash; see section
10112 <xref linkend="SECTforexpfai"/> for an explanation of what this means.
10113 </para>
10114 <para>
10115 The supported DNS record types are A, CNAME, MX, NS, PTR, SRV, and TXT, and,
10116 when Exim is compiled with IPv6 support, AAAA (and A6 if that is also
10117 configured). If no type is given, TXT is assumed. When the type is PTR,
10118 the data can be an IP address, written as normal; inversion and the addition of
10119 <option>in-addr.arpa</option> or <option>ip6.arpa</option> happens automatically. For example:
10120 </para>
10121 <literallayout class="monospaced">
10122 ${lookup dnsdb{ptr=192.168.4.5}{$value}fail}
10123 </literallayout>
10124 <para>
10125 If the data for a PTR record is not a syntactically valid IP address, it is not
10126 altered and nothing is added.
10127 </para>
10128 <para>
10129 <indexterm role="concept">
10130 <primary>MX record</primary>
10131 <secondary>in <command>dnsdb</command> lookup</secondary>
10132 </indexterm>
10133 <indexterm role="concept">
10134 <primary>SRV record</primary>
10135 <secondary>in <command>dnsdb</command> lookup</secondary>
10136 </indexterm>
10137 For an MX lookup, both the preference value and the host name are returned for
10138 each record, separated by a space. For an SRV lookup, the priority, weight,
10139 port, and host name are returned for each record, separated by spaces.
10140 </para>
10141 <para>
10142 For any record type, if multiple records are found (or, for A6 lookups, if a
10143 single record leads to multiple addresses), the data is returned as a
10144 concatenation, with newline as the default separator. The order, of course,
10145 depends on the DNS resolver. You can specify a different separator character
10146 between multiple records by putting a right angle-bracket followed immediately
10147 by the new separator at the start of the query. For example:
10148 </para>
10149 <literallayout class="monospaced">
10150 ${lookup dnsdb{&gt;: a=host1.example}}
10151 </literallayout>
10152 <para>
10153 It is permitted to specify a space as the separator character. Further
10154 white space is ignored.
10155 </para>
10156 <para>
10157 <indexterm role="concept">
10158 <primary>TXT record</primary>
10159 <secondary>in <command>dnsdb</command> lookup</secondary>
10160 </indexterm>
10161 For TXT records with multiple items of data, only the first item is returned,
10162 unless a separator for them is specified using a comma after the separator
10163 character followed immediately by the TXT record item separator. To concatenate
10164 items without a separator, use a semicolon instead.
10165 </para>
10166 <literallayout class="monospaced">
10167 ${lookup dnsdb{&gt;\n,: txt=a.b.example}}
10168 ${lookup dnsdb{&gt;\n; txt=a.b.example}}
10169 </literallayout>
10170 <para>
10171 It is permitted to specify a space as the separator character. Further
10172 white space is ignored.
10173 </para>
10174 </section>
10175 <section id="SECID66">
10176 <title>Pseudo dnsdb record types</title>
10177 <para>
10178 <indexterm role="concept">
10179 <primary>MX record</primary>
10180 <secondary>in <command>dnsdb</command> lookup</secondary>
10181 </indexterm>
10182 By default, both the preference value and the host name are returned for
10183 each MX record, separated by a space. If you want only host names, you can use
10184 the pseudo-type MXH:
10185 </para>
10186 <literallayout class="monospaced">
10187 ${lookup dnsdb{mxh=a.b.example}}
10188 </literallayout>
10189 <para>
10190 In this case, the preference values are omitted, and just the host names are
10191 returned.
10192 </para>
10193 <para>
10194 <indexterm role="concept">
10195 <primary>name server for enclosing domain</primary>
10196 </indexterm>
10197 Another pseudo-type is ZNS (for <quote>zone NS</quote>). It performs a lookup for NS
10198 records on the given domain, but if none are found, it removes the first
10199 component of the domain name, and tries again. This process continues until NS
10200 records are found or there are no more components left (or there is a DNS
10201 error). In other words, it may return the name servers for a top-level domain,
10202 but it never returns the root name servers. If there are no NS records for the
10203 top-level domain, the lookup fails. Consider these examples:
10204 </para>
10205 <literallayout class="monospaced">
10206 ${lookup dnsdb{zns=xxx.quercite.com}}
10207 ${lookup dnsdb{zns=xxx.edu}}
10208 </literallayout>
10209 <para>
10210 Assuming that in each case there are no NS records for the full domain name,
10211 the first returns the name servers for <option>quercite.com</option>, and the second returns
10212 the name servers for <option>edu</option>.
10213 </para>
10214 <para>
10215 You should be careful about how you use this lookup because, unless the
10216 top-level domain does not exist, the lookup always returns some host names. The
10217 sort of use to which this might be put is for seeing if the name servers for a
10218 given domain are on a blacklist. You can probably assume that the name servers
10219 for the high-level domains such as <option>com</option> or <option>co.uk</option> are not going to be on
10220 such a list.
10221 </para>
10222 <para>
10223 <indexterm role="concept">
10224 <primary>CSA</primary>
10225 <secondary>in <command>dnsdb</command> lookup</secondary>
10226 </indexterm>
10227 A third pseudo-type is CSA (Client SMTP Authorization). This looks up SRV
10228 records according to the CSA rules, which are described in section
10229 <xref linkend="SECTverifyCSA"/>. Although <command>dnsdb</command> supports SRV lookups directly, this is
10230 not sufficient because of the extra parent domain search behaviour of CSA. The
10231 result of a successful lookup such as:
10232 </para>
10233 <literallayout class="monospaced">
10234 ${lookup dnsdb {csa=$sender_helo_name}}
10235 </literallayout>
10236 <para>
10237 has two space-separated fields: an authorization code and a target host name.
10238 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
10239 authorization required but absent, or <quote>?</quote> for unknown.
10240 </para>
10241 </section>
10242 <section id="SECID67">
10243 <title>Multiple dnsdb lookups</title>
10244 <para>
10245 In the previous sections, <command>dnsdb</command> lookups for a single domain are described.
10246 However, you can specify a list of domains or IP addresses in a single
10247 <command>dnsdb</command> lookup. The list is specified in the normal Exim way, with colon as
10248 the default separator, but with the ability to change this. For example:
10249 </para>
10250 <literallayout class="monospaced">
10251 ${lookup dnsdb{one.domain.com:two.domain.com}}
10252 ${lookup dnsdb{a=one.host.com:two.host.com}}
10253 ${lookup dnsdb{ptr = &lt;; 1.2.3.4 ; 4.5.6.8}}
10254 </literallayout>
10255 <para>
10256 In order to retain backwards compatibility, there is one special case: if
10257 the lookup type is PTR and no change of separator is specified, Exim looks
10258 to see if the rest of the string is precisely one IPv6 address. In this
10259 case, it does not treat it as a list.
10260 </para>
10261 <para>
10262 The data from each lookup is concatenated, with newline separators by default,
10263 in the same way that multiple DNS records for a single item are handled. A
10264 different separator can be specified, as described above.
10265 </para>
10266 <para>
10267 The <command>dnsdb</command> lookup fails only if all the DNS lookups fail. If there is a
10268 temporary DNS error for any of them, the behaviour is controlled by
10269 an optional keyword followed by a comma that may appear before the record
10270 type. The possible keywords are <quote>defer_strict</quote>, <quote>defer_never</quote>, and
10271 <quote>defer_lax</quote>. With <quote>strict</quote> behaviour, any temporary DNS error causes the
10272 whole lookup to defer. With <quote>never</quote> behaviour, a temporary DNS error is
10273 ignored, and the behaviour is as if the DNS lookup failed to find anything.
10274 With <quote>lax</quote> behaviour, all the queries are attempted, but a temporary DNS
10275 error causes the whole lookup to defer only if none of the other lookups
10276 succeed. The default is <quote>lax</quote>, so the following lookups are equivalent:
10277 </para>
10278 <literallayout class="monospaced">
10279 ${lookup dnsdb{defer_lax,a=one.host.com:two.host.com}}
10280 ${lookup dnsdb{a=one.host.com:two.host.com}}
10281 </literallayout>
10282 <para>
10283 Thus, in the default case, as long as at least one of the DNS lookups
10284 yields some data, the lookup succeeds.
10285 </para>
10286 </section>
10287 <section id="SECTldap">
10288 <title>More about LDAP</title>
10289 <para>
10290 <indexterm role="concept">
10291 <primary>LDAP</primary>
10292 <secondary>lookup, more about</secondary>
10293 </indexterm>
10294 <indexterm role="concept">
10295 <primary>lookup</primary>
10296 <secondary>LDAP</secondary>
10297 </indexterm>
10298 <indexterm role="concept">
10299 <primary>Solaris</primary>
10300 <secondary>LDAP</secondary>
10301 </indexterm>
10302 The original LDAP implementation came from the University of Michigan; this has
10303 become <quote>Open LDAP</quote>, and there are now two different releases. Another
10304 implementation comes from Netscape, and Solaris 7 and subsequent releases
10305 contain inbuilt LDAP support. Unfortunately, though these are all compatible at
10306 the lookup function level, their error handling is different. For this reason
10307 it is necessary to set a compile-time variable when building Exim with LDAP, to
10308 indicate which LDAP library is in use. One of the following should appear in
10309 your <filename>Local/Makefile</filename>:
10310 </para>
10311 <literallayout class="monospaced">
10312 LDAP_LIB_TYPE=UMICHIGAN
10313 LDAP_LIB_TYPE=OPENLDAP1
10314 LDAP_LIB_TYPE=OPENLDAP2
10315 LDAP_LIB_TYPE=NETSCAPE
10316 LDAP_LIB_TYPE=SOLARIS
10317 </literallayout>
10318 <para>
10319 If LDAP_LIB_TYPE is not set, Exim assumes <literal>OPENLDAP1</literal>, which has the
10320 same interface as the University of Michigan version.
10321 </para>
10322 <para>
10323 There are three LDAP lookup types in Exim. These behave slightly differently in
10324 the way they handle the results of a query:
10325 </para>
10326 <itemizedlist>
10327 <listitem>
10328 <para>
10329 <command>ldap</command> requires the result to contain just one entry; if there are more, it
10330 gives an error.
10331 </para>
10332 </listitem>
10333 <listitem>
10334 <para>
10335 <command>ldapdn</command> also requires the result to contain just one entry, but it is the
10336 Distinguished Name that is returned rather than any attribute values.
10337 </para>
10338 </listitem>
10339 <listitem>
10340 <para>
10341 <command>ldapm</command> permits the result to contain more than one entry; the attributes
10342 from all of them are returned.
10343 </para>
10344 </listitem>
10345 </itemizedlist>
10346 <para>
10347 For <command>ldap</command> and <command>ldapm</command>, if a query finds only entries with no attributes,
10348 Exim behaves as if the entry did not exist, and the lookup fails. The format of
10349 the data returned by a successful lookup is described in the next section.
10350 First we explain how LDAP queries are coded.
10351 </para>
10352 </section>
10353 <section id="SECTforldaque">
10354 <title>Format of LDAP queries</title>
10355 <para>
10356 <indexterm role="concept">
10357 <primary>LDAP</primary>
10358 <secondary>query format</secondary>
10359 </indexterm>
10360 An LDAP query takes the form of a URL as defined in RFC 2255. For example, in
10361 the configuration of a <command>redirect</command> router one might have this setting:
10362 </para>
10363 <literallayout class="monospaced">
10364 data = ${lookup ldap \
10365   {ldap:///cn=$local_part,o=University%20of%20Cambridge,\
10366   c=UK?mailbox?base?}}
10367 </literallayout>
10368 <para>
10369 <indexterm role="concept">
10370 <primary>LDAP</primary>
10371 <secondary>with TLS</secondary>
10372 </indexterm>
10373 The URL may begin with <literal>ldap</literal> or <literal>ldaps</literal> if your LDAP library supports
10374 secure (encrypted) LDAP connections. The second of these ensures that an
10375 encrypted TLS connection is used.
10376 </para>
10377 <para revisionflag="changed">
10378 With sufficiently modern LDAP libraries, Exim supports forcing TLS over regular
10379 LDAP connections, rather than the SSL-on-connect <literal>ldaps</literal>.
10380 See the <option>ldap_start_tls</option> option.
10381 </para>
10382 </section>
10383 <section id="SECID68">
10384 <title>LDAP quoting</title>
10385 <para>
10386 <indexterm role="concept">
10387 <primary>LDAP</primary>
10388 <secondary>quoting</secondary>
10389 </indexterm>
10390 Two levels of quoting are required in LDAP queries, the first for LDAP itself
10391 and the second because the LDAP query is represented as a URL. Furthermore,
10392 within an LDAP query, two different kinds of quoting are required. For this
10393 reason, there are two different LDAP-specific quoting operators.
10394 </para>
10395 <para>
10396 The <option>quote_ldap</option> operator is designed for use on strings that are part of
10397 filter specifications. Conceptually, it first does the following conversions on
10398 the string:
10399 </para>
10400 <literallayout class="monospaced">
10401 *   =&gt;   \2A
10402 (   =&gt;   \28
10403 )   =&gt;   \29
10404 \   =&gt;   \5C
10405 </literallayout>
10406 <para>
10407 in accordance with RFC 2254. The resulting string is then quoted according
10408 to the rules for URLs, that is, all non-alphanumeric characters except
10409 </para>
10410 <literallayout class="monospaced">
10411 ! $ ' - . _ ( ) * +
10412 </literallayout>
10413 <para>
10414 are converted to their hex values, preceded by a percent sign. For example:
10415 </para>
10416 <literallayout class="monospaced">
10417 ${quote_ldap: a(bc)*, a&lt;yz&gt;; }
10418 </literallayout>
10419 <para>
10420 yields
10421 </para>
10422 <literallayout class="monospaced">
10423 %20a%5C28bc%5C29%5C2A%2C%20a%3Cyz%3E%3B%20
10424 </literallayout>
10425 <para>
10426 Removing the URL quoting, this is (with a leading and a trailing space):
10427 </para>
10428 <literallayout class="monospaced">
10429 a\28bc\29\2A, a&lt;yz&gt;;
10430 </literallayout>
10431 <para>
10432 The <option>quote_ldap_dn</option> operator is designed for use on strings that are part of
10433 base DN specifications in queries. Conceptually, it first converts the string
10434 by inserting a backslash in front of any of the following characters:
10435 </para>
10436 <literallayout class="monospaced">
10437 , + " \ &lt; &gt; ;
10438 </literallayout>
10439 <para>
10440 It also inserts a backslash before any leading spaces or # characters, and
10441 before any trailing spaces. (These rules are in RFC 2253.) The resulting string
10442 is then quoted according to the rules for URLs. For example:
10443 </para>
10444 <literallayout class="monospaced">
10445 ${quote_ldap_dn: a(bc)*, a&lt;yz&gt;; }
10446 </literallayout>
10447 <para>
10448 yields
10449 </para>
10450 <literallayout class="monospaced">
10451 %5C%20a(bc)*%5C%2C%20a%5C%3Cyz%5C%3E%5C%3B%5C%20
10452 </literallayout>
10453 <para>
10454 Removing the URL quoting, this is (with a trailing space):
10455 </para>
10456 <literallayout class="monospaced">
10457 \ a(bc)*\, a\&lt;yz\&gt;\;\
10458 </literallayout>
10459 <para>
10460 There are some further comments about quoting in the section on LDAP
10461 authentication below.
10462 </para>
10463 </section>
10464 <section id="SECID69">
10465 <title>LDAP connections</title>
10466 <para>
10467 <indexterm role="concept">
10468 <primary>LDAP</primary>
10469 <secondary>connections</secondary>
10470 </indexterm>
10471 The connection to an LDAP server may either be over TCP/IP, or, when OpenLDAP
10472 is in use, via a Unix domain socket. The example given above does not specify
10473 an LDAP server. A server that is reached by TCP/IP can be specified in a query
10474 by starting it with
10475 </para>
10476 <literallayout class="monospaced">
10477 ldap://&lt;hostname&gt;:&lt;port&gt;/...
10478 </literallayout>
10479 <para>
10480 If the port (and preceding colon) are omitted, the standard LDAP port (389) is
10481 used. When no server is specified in a query, a list of default servers is
10482 taken from the <option>ldap_default_servers</option> configuration option. This supplies a
10483 colon-separated list of servers which are tried in turn until one successfully
10484 handles a query, or there is a serious error. Successful handling either
10485 returns the requested data, or indicates that it does not exist. Serious errors
10486 are syntactical, or multiple values when only a single value is expected.
10487 Errors which cause the next server to be tried are connection failures, bind
10488 failures, and timeouts.
10489 </para>
10490 <para>
10491 For each server name in the list, a port number can be given. The standard way
10492 of specifying a host and port is to use a colon separator (RFC 1738). Because
10493 <option>ldap_default_servers</option> is a colon-separated list, such colons have to be
10494 doubled. For example
10495 </para>
10496 <literallayout class="monospaced">
10497 ldap_default_servers = ldap1.example.com::145:ldap2.example.com
10498 </literallayout>
10499 <para>
10500 If <option>ldap_default_servers</option> is unset, a URL with no server name is passed
10501 to the LDAP library with no server name, and the library&#x2019;s default (normally
10502 the local host) is used.
10503 </para>
10504 <para>
10505 If you are using the OpenLDAP library, you can connect to an LDAP server using
10506 a Unix domain socket instead of a TCP/IP connection. This is specified by using
10507 <literal>ldapi</literal> instead of <literal>ldap</literal> in LDAP queries. What follows here applies only
10508 to OpenLDAP. If Exim is compiled with a different LDAP library, this feature is
10509 not available.
10510 </para>
10511 <para>
10512 For this type of connection, instead of a host name for the server, a pathname
10513 for the socket is required, and the port number is not relevant. The pathname
10514 can be specified either as an item in <option>ldap_default_servers</option>, or inline in
10515 the query. In the former case, you can have settings such as
10516 </para>
10517 <literallayout class="monospaced">
10518 ldap_default_servers = /tmp/ldap.sock : backup.ldap.your.domain
10519 </literallayout>
10520 <para>
10521 When the pathname is given in the query, you have to escape the slashes as
10522 <literal>%2F</literal> to fit in with the LDAP URL syntax. For example:
10523 </para>
10524 <literallayout class="monospaced">
10525 ${lookup ldap {ldapi://%2Ftmp%2Fldap.sock/o=...
10526 </literallayout>
10527 <para>
10528 When Exim processes an LDAP lookup and finds that the <quote>hostname</quote> is really
10529 a pathname, it uses the Unix domain socket code, even if the query actually
10530 specifies <literal>ldap</literal> or <literal>ldaps</literal>. In particular, no encryption is used for a
10531 socket connection. This behaviour means that you can use a setting of
10532 <option>ldap_default_servers</option> such as in the example above with traditional <literal>ldap</literal>
10533 or <literal>ldaps</literal> queries, and it will work. First, Exim tries a connection via
10534 the Unix domain socket; if that fails, it tries a TCP/IP connection to the
10535 backup host.
10536 </para>
10537 <para>
10538 If an explicit <literal>ldapi</literal> type is given in a query when a host name is
10539 specified, an error is diagnosed. However, if there are more items in
10540 <option>ldap_default_servers</option>, they are tried. In other words:
10541 </para>
10542 <itemizedlist>
10543 <listitem>
10544 <para>
10545 Using a pathname with <literal>ldap</literal> or <literal>ldaps</literal> forces the use of the Unix domain
10546 interface.
10547 </para>
10548 </listitem>
10549 <listitem>
10550 <para>
10551 Using <literal>ldapi</literal> with a host name causes an error.
10552 </para>
10553 </listitem>
10554 </itemizedlist>
10555 <para>
10556 Using <literal>ldapi</literal> with no host or path in the query, and no setting of
10557 <option>ldap_default_servers</option>, does whatever the library does by default.
10558 </para>
10559 </section>
10560 <section id="SECID70">
10561 <title>LDAP authentication and control information</title>
10562 <para>
10563 <indexterm role="concept">
10564 <primary>LDAP</primary>
10565 <secondary>authentication</secondary>
10566 </indexterm>
10567 The LDAP URL syntax provides no way of passing authentication and other control
10568 information to the server. To make this possible, the URL in an LDAP query may
10569 be preceded by any number of &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt; settings, separated by
10570 spaces. If a value contains spaces it must be enclosed in double quotes, and
10571 when double quotes are used, backslash is interpreted in the usual way inside
10572 them. The following names are recognized:
10573 </para>
10574 <literallayout>
10575 <literal>DEREFERENCE</literal>  set the dereferencing parameter
10576 <literal>NETTIME    </literal>  set a timeout for a network operation
10577 <literal>USER       </literal>  set the DN, for authenticating the LDAP bind
10578 <literal>PASS       </literal>  set the password, likewise
10579 <literal>REFERRALS  </literal>  set the referrals parameter
10580 <literal>SIZE       </literal>  set the limit for the number of entries returned
10581 <literal>TIME       </literal>  set the maximum waiting time for a query
10582 </literallayout>
10583 <para>
10584 The value of the DEREFERENCE parameter must be one of the words <quote>never</quote>,
10585 <quote>searching</quote>, <quote>finding</quote>, or <quote>always</quote>. The value of the REFERRALS parameter
10586 must be <quote>follow</quote> (the default) or <quote>nofollow</quote>. The latter stops the LDAP
10587 library from trying to follow referrals issued by the LDAP server.
10588 </para>
10589 <para>
10590 The name CONNECT is an obsolete name for NETTIME, retained for
10591 backwards compatibility. This timeout (specified as a number of seconds) is
10592 enforced from the client end for operations that can be carried out over a
10593 network. Specifically, it applies to network connections and calls to the
10594 <emphasis>ldap_result()</emphasis> function. If the value is greater than zero, it is used if
10595 LDAP_OPT_NETWORK_TIMEOUT is defined in the LDAP headers (OpenLDAP), or
10596 if LDAP_X_OPT_CONNECT_TIMEOUT is defined in the LDAP headers (Netscape
10597 SDK 4.1). A value of zero forces an explicit setting of <quote>no timeout</quote> for
10598 Netscape SDK; for OpenLDAP no action is taken.
10599 </para>
10600 <para>
10601 The TIME parameter (also a number of seconds) is passed to the server to
10602 set a server-side limit on the time taken to complete a search.
10603 </para>
10604 <para>
10605 Here is an example of an LDAP query in an Exim lookup that uses some of these
10606 values. This is a single line, folded to fit on the page:
10607 </para>
10608 <literallayout class="monospaced">
10609 ${lookup ldap
10610   {user="cn=manager,o=University of Cambridge,c=UK" pass=secret
10611   ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=foo)}
10612   {$value}fail}
10613 </literallayout>
10614 <para>
10615 The encoding of spaces as <literal>%20</literal> is a URL thing which should not be done for
10616 any of the auxiliary data. Exim configuration settings that include lookups
10617 which contain password information should be preceded by <quote>hide</quote> to prevent
10618 non-admin users from using the <option>-bP</option> option to see their values.
10619 </para>
10620 <para>
10621 The auxiliary data items may be given in any order. The default is no
10622 connection timeout (the system timeout is used), no user or password, no limit
10623 on the number of entries returned, and no time limit on queries.
10624 </para>
10625 <para>
10626 When a DN is quoted in the USER= setting for LDAP authentication, Exim
10627 removes any URL quoting that it may contain before passing it LDAP. Apparently
10628 some libraries do this for themselves, but some do not. Removing the URL
10629 quoting has two advantages:
10630 </para>
10631 <itemizedlist>
10632 <listitem>
10633 <para>
10634 It makes it possible to use the same <option>quote_ldap_dn</option> expansion for USER=
10635 DNs as with DNs inside actual queries.
10636 </para>
10637 </listitem>
10638 <listitem>
10639 <para>
10640 It permits spaces inside USER= DNs.
10641 </para>
10642 </listitem>
10643 </itemizedlist>
10644 <para>
10645 For example, a setting such as
10646 </para>
10647 <literallayout class="monospaced">
10648 USER=cn=${quote_ldap_dn:$1}
10649 </literallayout>
10650 <para>
10651 should work even if <varname>$1</varname> contains spaces.
10652 </para>
10653 <para>
10654 Expanded data for the PASS= value should be quoted using the <option>quote</option>
10655 expansion operator, rather than the LDAP quote operators. The only reason this
10656 field needs quoting is to ensure that it conforms to the Exim syntax, which
10657 does not allow unquoted spaces. For example:
10658 </para>
10659 <literallayout class="monospaced">
10660 PASS=${quote:$3}
10661 </literallayout>
10662 <para>
10663 The LDAP authentication mechanism can be used to check passwords as part of
10664 SMTP authentication. See the <option>ldapauth</option> expansion string condition in chapter
10665 <xref linkend="CHAPexpand"/>.
10666 </para>
10667 </section>
10668 <section id="SECID71">
10669 <title>Format of data returned by LDAP</title>
10670 <para>
10671 <indexterm role="concept">
10672 <primary>LDAP</primary>
10673 <secondary>returned data formats</secondary>
10674 </indexterm>
10675 The <command>ldapdn</command> lookup type returns the Distinguished Name from a single entry
10676 as a sequence of values, for example
10677 </para>
10678 <literallayout class="monospaced">
10679 cn=manager, o=University of Cambridge, c=UK
10680 </literallayout>
10681 <para>
10682 The <command>ldap</command> lookup type generates an error if more than one entry matches the
10683 search filter, whereas <command>ldapm</command> permits this case, and inserts a newline in
10684 the result between the data from different entries. It is possible for multiple
10685 values to be returned for both <command>ldap</command> and <command>ldapm</command>, but in the former case
10686 you know that whatever values are returned all came from a single entry in the
10687 directory.
10688 </para>
10689 <para>
10690 In the common case where you specify a single attribute in your LDAP query, the
10691 result is not quoted, and does not contain the attribute name. If the attribute
10692 has multiple values, they are separated by commas.
10693 </para>
10694 <para>
10695 If you specify multiple attributes, the result contains space-separated, quoted
10696 strings, each preceded by the attribute name and an equals sign. Within the
10697 quotes, the quote character, backslash, and newline are escaped with
10698 backslashes, and commas are used to separate multiple values for the attribute.
10699 Apart from the escaping, the string within quotes takes the same form as the
10700 output when a single attribute is requested. Specifying no attributes is the
10701 same as specifying all of an entry&#x2019;s attributes.
10702 </para>
10703 <para>
10704 Here are some examples of the output format. The first line of each pair is an
10705 LDAP query, and the second is the data that is returned. The attribute called
10706 <option>attr1</option> has two values, whereas <option>attr2</option> has only one value:
10707 </para>
10708 <literallayout class="monospaced">
10709 ldap:///o=base?attr1?sub?(uid=fred)
10710 value1.1, value1.2
10711
10712 ldap:///o=base?attr2?sub?(uid=fred)
10713 value two
10714
10715 ldap:///o=base?attr1,attr2?sub?(uid=fred)
10716 attr1="value1.1, value1.2" attr2="value two"
10717
10718 ldap:///o=base??sub?(uid=fred)
10719 objectClass="top" attr1="value1.1, value1.2" attr2="value two"
10720 </literallayout>
10721 <para>
10722 The <option>extract</option> operator in string expansions can be used to pick out
10723 individual fields from data that consists of <emphasis>key</emphasis>=<emphasis>value</emphasis> pairs. You can
10724 make use of Exim&#x2019;s <option>-be</option> option to run expansion tests and thereby check the
10725 results of LDAP lookups.
10726 </para>
10727 </section>
10728 <section id="SECTnisplus">
10729 <title>More about NIS+</title>
10730 <para>
10731 <indexterm role="concept">
10732 <primary>NIS+ lookup type</primary>
10733 </indexterm>
10734 <indexterm role="concept">
10735 <primary>lookup</primary>
10736 <secondary>NIS+</secondary>
10737 </indexterm>
10738 NIS+ queries consist of a NIS+ <emphasis>indexed name</emphasis> followed by an optional colon
10739 and field name. If this is given, the result of a successful query is the
10740 contents of the named field; otherwise the result consists of a concatenation
10741 of <emphasis>field-name=field-value</emphasis> pairs, separated by spaces. Empty values and
10742 values containing spaces are quoted. For example, the query
10743 </para>
10744 <literallayout class="monospaced">
10745 [name=mg1456],passwd.org_dir
10746 </literallayout>
10747 <para>
10748 might return the string
10749 </para>
10750 <literallayout class="monospaced">
10751 name=mg1456 passwd="" uid=999 gid=999 gcos="Martin Guerre"
10752 home=/home/mg1456 shell=/bin/bash shadow=""
10753 </literallayout>
10754 <para>
10755 (split over two lines here to fit on the page), whereas
10756 </para>
10757 <literallayout class="monospaced">
10758 [name=mg1456],passwd.org_dir:gcos
10759 </literallayout>
10760 <para>
10761 would just return
10762 </para>
10763 <literallayout class="monospaced">
10764 Martin Guerre
10765 </literallayout>
10766 <para>
10767 with no quotes. A NIS+ lookup fails if NIS+ returns more than one table entry
10768 for the given indexed key. The effect of the <option>quote_nisplus</option> expansion
10769 operator is to double any quote characters within the text.
10770 </para>
10771 </section>
10772 <section id="SECTsql">
10773 <title>SQL lookups</title>
10774 <para>
10775 <indexterm role="concept">
10776 <primary>SQL lookup types</primary>
10777 </indexterm>
10778 <indexterm role="concept">
10779 <primary>MySQL</primary>
10780 <secondary>lookup type</secondary>
10781 </indexterm>
10782 <indexterm role="concept">
10783 <primary>PostgreSQL lookup type</primary>
10784 </indexterm>
10785 <indexterm role="concept">
10786 <primary>lookup</primary>
10787 <secondary>MySQL</secondary>
10788 </indexterm>
10789 <indexterm role="concept">
10790 <primary>lookup</primary>
10791 <secondary>PostgreSQL</secondary>
10792 </indexterm>
10793 <indexterm role="concept">
10794 <primary>Oracle</primary>
10795 <secondary>lookup type</secondary>
10796 </indexterm>
10797 <indexterm role="concept">
10798 <primary>lookup</primary>
10799 <secondary>Oracle</secondary>
10800 </indexterm>
10801 <indexterm role="concept">
10802 <primary>InterBase lookup type</primary>
10803 </indexterm>
10804 <indexterm role="concept">
10805 <primary>lookup</primary>
10806 <secondary>InterBase</secondary>
10807 </indexterm>
10808 Exim can support lookups in InterBase, MySQL, Oracle, PostgreSQL, and SQLite
10809 databases. Queries for these databases contain SQL statements, so an example
10810 might be
10811 </para>
10812 <literallayout class="monospaced">
10813 ${lookup mysql{select mailbox from users where id='userx'}\
10814   {$value}fail}
10815 </literallayout>
10816 <para>
10817 If the result of the query contains more than one field, the data for each
10818 field in the row is returned, preceded by its name, so the result of
10819 </para>
10820 <literallayout class="monospaced">
10821 ${lookup pgsql{select home,name from users where id='userx'}\
10822   {$value}}
10823 </literallayout>
10824 <para>
10825 might be
10826 </para>
10827 <literallayout class="monospaced">
10828 home=/home/userx name="Mister X"
10829 </literallayout>
10830 <para>
10831 Empty values and values containing spaces are double quoted, with embedded
10832 quotes escaped by a backslash. If the result of the query contains just one
10833 field, the value is passed back verbatim, without a field name, for example:
10834 </para>
10835 <literallayout class="monospaced">
10836 Mister X
10837 </literallayout>
10838 <para>
10839 If the result of the query yields more than one row, it is all concatenated,
10840 with a newline between the data for each row.
10841 </para>
10842 </section>
10843 <section id="SECID72">
10844 <title>More about MySQL, PostgreSQL, Oracle, and InterBase</title>
10845 <para>
10846 <indexterm role="concept">
10847 <primary>MySQL</primary>
10848 <secondary>lookup type</secondary>
10849 </indexterm>
10850 <indexterm role="concept">
10851 <primary>PostgreSQL lookup type</primary>
10852 </indexterm>
10853 <indexterm role="concept">
10854 <primary>lookup</primary>
10855 <secondary>MySQL</secondary>
10856 </indexterm>
10857 <indexterm role="concept">
10858 <primary>lookup</primary>
10859 <secondary>PostgreSQL</secondary>
10860 </indexterm>
10861 <indexterm role="concept">
10862 <primary>Oracle</primary>
10863 <secondary>lookup type</secondary>
10864 </indexterm>
10865 <indexterm role="concept">
10866 <primary>lookup</primary>
10867 <secondary>Oracle</secondary>
10868 </indexterm>
10869 <indexterm role="concept">
10870 <primary>InterBase lookup type</primary>
10871 </indexterm>
10872 <indexterm role="concept">
10873 <primary>lookup</primary>
10874 <secondary>InterBase</secondary>
10875 </indexterm>
10876 If any MySQL, PostgreSQL, Oracle, or InterBase lookups are used, the
10877 <option>mysql_servers</option>, <option>pgsql_servers</option>, <option>oracle_servers</option>, or <option>ibase_servers</option>
10878 option (as appropriate) must be set to a colon-separated list of server
10879 information.
10880 (For MySQL and PostgreSQL only, the global option need not be set if all
10881 queries contain their own server information &ndash; see section
10882 <xref linkend="SECTspeserque"/>.) Each item in the list is a slash-separated list of four
10883 items: host name, database name, user name, and password. In the case of
10884 Oracle, the host name field is used for the <quote>service name</quote>, and the database
10885 name field is not used and should be empty. For example:
10886 </para>
10887 <literallayout class="monospaced">
10888 hide oracle_servers = oracle.plc.example//userx/abcdwxyz
10889 </literallayout>
10890 <para>
10891 Because password data is sensitive, you should always precede the setting with
10892 <quote>hide</quote>, to prevent non-admin users from obtaining the setting via the <option>-bP</option>
10893 option. Here is an example where two MySQL servers are listed:
10894 </para>
10895 <literallayout class="monospaced">
10896 hide mysql_servers = localhost/users/root/secret:\
10897                      otherhost/users/root/othersecret
10898 </literallayout>
10899 <para>
10900 For MySQL and PostgreSQL, a host may be specified as &lt;<emphasis>name</emphasis>&gt;:&lt;<emphasis>port</emphasis>&gt; but
10901 because this is a colon-separated list, the colon has to be doubled. For each
10902 query, these parameter groups are tried in order until a connection is made and
10903 a query is successfully processed. The result of a query may be that no data is
10904 found, but that is still a successful query. In other words, the list of
10905 servers provides a backup facility, not a list of different places to look.
10906 </para>
10907 <para>
10908 The <option>quote_mysql</option>, <option>quote_pgsql</option>, and <option>quote_oracle</option> expansion operators
10909 convert newline, tab, carriage return, and backspace to \n, \t, \r, and \b
10910 respectively, and the characters single-quote, double-quote, and backslash
10911 itself are escaped with backslashes. The <option>quote_pgsql</option> expansion operator, in
10912 addition, escapes the percent and underscore characters. This cannot be done
10913 for MySQL because these escapes are not recognized in contexts where these
10914 characters are not special.
10915 </para>
10916 </section>
10917 <section id="SECTspeserque">
10918 <title>Specifying the server in the query</title>
10919 <para>
10920 For MySQL and PostgreSQL lookups (but not currently for Oracle and InterBase),
10921 it is possible to specify a list of servers with an individual query. This is
10922 done by starting the query with
10923 </para>
10924 <literallayout>
10925 <literal>servers=</literal><emphasis>server1:server2:server3:...</emphasis><literal>;</literal>
10926 </literallayout>
10927 <para>
10928 Each item in the list may take one of two forms:
10929 </para>
10930 <orderedlist numeration="arabic">
10931 <listitem>
10932 <para>
10933 If it contains no slashes it is assumed to be just a host name. The appropriate
10934 global option (<option>mysql_servers</option> or <option>pgsql_servers</option>) is searched for a host
10935 of the same name, and the remaining parameters (database, user, password) are
10936 taken from there.
10937 </para>
10938 </listitem>
10939 <listitem>
10940 <para>
10941 If it contains any slashes, it is taken as a complete parameter set.
10942 </para>
10943 </listitem>
10944 </orderedlist>
10945 <para>
10946 The list of servers is used in exactly the same way as the global list.
10947 Once a connection to a server has happened and a query has been
10948 successfully executed, processing of the lookup ceases.
10949 </para>
10950 <para>
10951 This feature is intended for use in master/slave situations where updates
10952 are occurring and you want to update the master rather than a slave. If the
10953 master is in the list as a backup for reading, you might have a global setting
10954 like this:
10955 </para>
10956 <literallayout class="monospaced">
10957 mysql_servers = slave1/db/name/pw:\
10958                 slave2/db/name/pw:\
10959                 master/db/name/pw
10960 </literallayout>
10961 <para>
10962 In an updating lookup, you could then write:
10963 </para>
10964 <literallayout class="monospaced">
10965 ${lookup mysql{servers=master; UPDATE ...} }
10966 </literallayout>
10967 <para>
10968 That query would then be sent only to the master server. If, on the other hand,
10969 the master is not to be used for reading, and so is not present in the global
10970 option, you can still update it by a query of this form:
10971 </para>
10972 <literallayout class="monospaced">
10973 ${lookup pgsql{servers=master/db/name/pw; UPDATE ...} }
10974 </literallayout>
10975 </section>
10976 <section id="SECID73">
10977 <title>Special MySQL features</title>
10978 <para>
10979 For MySQL, an empty host name or the use of <quote>localhost</quote> in <option>mysql_servers</option>
10980 causes a connection to the server on the local host by means of a Unix domain
10981 socket. An alternate socket can be specified in parentheses. The full syntax of
10982 each item in <option>mysql_servers</option> is:
10983 </para>
10984 <literallayout>
10985 &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;
10986 </literallayout>
10987 <para>
10988 Any of the three sub-parts of the first field can be omitted. For normal use on
10989 the local host it can be left blank or set to just <quote>localhost</quote>.
10990 </para>
10991 <para>
10992 No database need be supplied &ndash; but if it is absent here, it must be given in
10993 the queries.
10994 </para>
10995 <para>
10996 If a MySQL query is issued that does not request any data (an insert, update,
10997 or delete command), the result of the lookup is the number of rows affected.
10998 </para>
10999 <para>
11000 <emphasis role="bold">Warning</emphasis>: This can be misleading. If an update does not actually change
11001 anything (for example, setting a field to the value it already has), the result
11002 is zero because no rows are affected.
11003 </para>
11004 </section>
11005 <section id="SECID74">
11006 <title>Special PostgreSQL features</title>
11007 <para>
11008 PostgreSQL lookups can also use Unix domain socket connections to the database.
11009 This is usually faster and costs less CPU time than a TCP/IP connection.
11010 However it can be used only if the mail server runs on the same machine as the
11011 database server. A configuration line for PostgreSQL via Unix domain sockets
11012 looks like this:
11013 </para>
11014 <literallayout class="monospaced">
11015 hide pgsql_servers = (/tmp/.s.PGSQL.5432)/db/user/password : ...
11016 </literallayout>
11017 <para>
11018 In other words, instead of supplying a host name, a path to the socket is
11019 given. The path name is enclosed in parentheses so that its slashes aren&#x2019;t
11020 visually confused with the delimiters for the other server parameters.
11021 </para>
11022 <para>
11023 If a PostgreSQL query is issued that does not request any data (an insert,
11024 update, or delete command), the result of the lookup is the number of rows
11025 affected.
11026 </para>
11027 </section>
11028 <section id="SECTsqlite">
11029 <title>More about SQLite</title>
11030 <para>
11031 <indexterm role="concept">
11032 <primary>lookup</primary>
11033 <secondary>SQLite</secondary>
11034 </indexterm>
11035 <indexterm role="concept">
11036 <primary>sqlite lookup type</primary>
11037 </indexterm>
11038 SQLite is different to the other SQL lookups because a file name is required in
11039 addition to the SQL query. An SQLite database is a single file, and there is no
11040 daemon as in the other SQL databases. The interface to Exim requires the name
11041 of the file, as an absolute path, to be given at the start of the query. It is
11042 separated from the query by white space. This means that the path name cannot
11043 contain white space. Here is a lookup expansion example:
11044 </para>
11045 <literallayout class="monospaced">
11046 ${lookup sqlite {/some/thing/sqlitedb \
11047   select name from aliases where id='userx';}}
11048 </literallayout>
11049 <para>
11050 In a list, the syntax is similar. For example:
11051 </para>
11052 <literallayout class="monospaced">
11053 domainlist relay_domains = sqlite;/some/thing/sqlitedb \
11054    select * from relays where ip='$sender_host_address';
11055 </literallayout>
11056 <para>
11057 The only character affected by the <option>quote_sqlite</option> operator is a single
11058 quote, which it doubles.
11059 </para>
11060 <para>
11061 The SQLite library handles multiple simultaneous accesses to the database
11062 internally. Multiple readers are permitted, but only one process can
11063 update at once. Attempts to access the database while it is being updated
11064 are rejected after a timeout period, during which the SQLite library
11065 waits for the lock to be released. In Exim, the default timeout is set
11066 to 5 seconds, but it can be changed by means of the <option>sqlite_lock_timeout</option>
11067 option.
11068 <indexterm role="concept" startref="IIDfidalo1" class="endofrange"/>
11069 <indexterm role="concept" startref="IIDfidalo2" class="endofrange"/>
11070 </para>
11071 </section>
11072 </chapter>
11073
11074 <chapter id="CHAPdomhosaddlists">
11075 <title>Domain, host, address, and local part lists</title>
11076 <titleabbrev>Domain, host, and address lists</titleabbrev>
11077 <para>
11078 <indexterm role="concept" id="IIDdohoadli" class="startofrange">
11079 <primary>lists of domains; hosts; etc.</primary>
11080 </indexterm>
11081 A number of Exim configuration options contain lists of domains, hosts,
11082 email addresses, or local parts. For example, the <option>hold_domains</option> option
11083 contains a list of domains whose delivery is currently suspended. These lists
11084 are also used as data in ACL statements (see chapter <xref linkend="CHAPACL"/>), and as
11085 arguments to expansion conditions such as <option>match_domain</option>.
11086 </para>
11087 <para>
11088 Each item in one of these lists is a pattern to be matched against a domain,
11089 host, email address, or local part, respectively. In the sections below, the
11090 different types of pattern for each case are described, but first we cover some
11091 general facilities that apply to all four kinds of list.
11092 </para>
11093 <section id="SECID75">
11094 <title>Expansion of lists</title>
11095 <para>
11096 <indexterm role="concept">
11097 <primary>expansion</primary>
11098 <secondary>of lists</secondary>
11099 </indexterm>
11100 Each list is expanded as a single string before it is used. The result of
11101 expansion must be a list, possibly containing empty items, which is split up
11102 into separate items for matching. By default, colon is the separator character,
11103 but this can be varied if necessary. See sections <xref linkend="SECTlistconstruct"/> and
11104 <xref linkend="SECTempitelis"/> for details of the list syntax; the second of these
11105 discusses the way to specify empty list items.
11106 </para>
11107 <para>
11108 If the string expansion is forced to fail, Exim behaves as if the item it is
11109 testing (domain, host, address, or local part) is not in the list. Other
11110 expansion failures cause temporary errors.
11111 </para>
11112 <para>
11113 If an item in a list is a regular expression, backslashes, dollars and possibly
11114 other special characters in the expression must be protected against
11115 misinterpretation by the string expander. The easiest way to do this is to use
11116 the <literal>\N</literal> expansion feature to indicate that the contents of the regular
11117 expression should not be expanded. For example, in an ACL you might have:
11118 </para>
11119 <literallayout class="monospaced">
11120 deny senders = \N^\d{8}\w@.*\.baddomain\.example$\N : \
11121                ${lookup{$domain}lsearch{/badsenders/bydomain}}
11122 </literallayout>
11123 <para>
11124 The first item is a regular expression that is protected from expansion by
11125 <literal>\N</literal>, whereas the second uses the expansion to obtain a list of unwanted
11126 senders based on the receiving domain.
11127 </para>
11128 </section>
11129 <section id="SECID76">
11130 <title>Negated items in lists</title>
11131 <para>
11132 <indexterm role="concept">
11133 <primary>list</primary>
11134 <secondary>negation</secondary>
11135 </indexterm>
11136 <indexterm role="concept">
11137 <primary>negation</primary>
11138 <secondary>in lists</secondary>
11139 </indexterm>
11140 Items in a list may be positive or negative. Negative items are indicated by a
11141 leading exclamation mark, which may be followed by optional white space. A list
11142 defines a set of items (domains, etc). When Exim processes one of these lists,
11143 it is trying to find out whether a domain, host, address, or local part
11144 (respectively) is in the set that is defined by the list. It works like this:
11145 </para>
11146 <para>
11147 The list is scanned from left to right. If a positive item is matched, the
11148 subject that is being checked is in the set; if a negative item is matched, the
11149 subject is not in the set. If the end of the list is reached without the
11150 subject having matched any of the patterns, it is in the set if the last item
11151 was a negative one, but not if it was a positive one. For example, the list in
11152 </para>
11153 <literallayout class="monospaced">
11154 domainlist relay_domains = !a.b.c : *.b.c
11155 </literallayout>
11156 <para>
11157 matches any domain ending in <emphasis>.b.c</emphasis> except for <emphasis>a.b.c</emphasis>. Domains that match
11158 neither <emphasis>a.b.c</emphasis> nor <emphasis>*.b.c</emphasis> do not match, because the last item in the
11159 list is positive. However, if the setting were
11160 </para>
11161 <literallayout class="monospaced">
11162 domainlist relay_domains = !a.b.c
11163 </literallayout>
11164 <para>
11165 then all domains other than <emphasis>a.b.c</emphasis> would match because the last item in the
11166 list is negative. In other words, a list that ends with a negative item behaves
11167 as if it had an extra item <literal>:*</literal> on the end.
11168 </para>
11169 <para>
11170 Another way of thinking about positive and negative items in lists is to read
11171 the connector as <quote>or</quote> after a positive item and as <quote>and</quote> after a negative
11172 item.
11173 </para>
11174 </section>
11175 <section id="SECTfilnamlis">
11176 <title>File names in lists</title>
11177 <para>
11178 <indexterm role="concept">
11179 <primary>list</primary>
11180 <secondary>file name in</secondary>
11181 </indexterm>
11182 If an item in a domain, host, address, or local part list is an absolute file
11183 name (beginning with a slash character), each line of the file is read and
11184 processed as if it were an independent item in the list, except that further
11185 file names are not allowed,
11186 and no expansion of the data from the file takes place.
11187 Empty lines in the file are ignored, and the file may also contain comment
11188 lines:
11189 </para>
11190 <itemizedlist>
11191 <listitem>
11192 <para>
11193 For domain and host lists, if a # character appears anywhere in a line of the
11194 file, it and all following characters are ignored.
11195 </para>
11196 </listitem>
11197 <listitem>
11198 <para>
11199 Because local parts may legitimately contain # characters, a comment in an
11200 address list or local part list file is recognized only if # is preceded by
11201 white space or the start of the line. For example:
11202 </para>
11203 <literallayout class="monospaced">
11204 not#comment@x.y.z   # but this is a comment
11205 </literallayout>
11206 </listitem>
11207 </itemizedlist>
11208 <para>
11209 Putting a file name in a list has the same effect as inserting each line of the
11210 file as an item in the list (blank lines and comments excepted). However, there
11211 is one important difference: the file is read each time the list is processed,
11212 so if its contents vary over time, Exim&#x2019;s behaviour changes.
11213 </para>
11214 <para>
11215 If a file name is preceded by an exclamation mark, the sense of any match
11216 within the file is inverted. For example, if
11217 </para>
11218 <literallayout class="monospaced">
11219 hold_domains = !/etc/nohold-domains
11220 </literallayout>
11221 <para>
11222 and the file contains the lines
11223 </para>
11224 <literallayout class="monospaced">
11225 !a.b.c
11226 *.b.c
11227 </literallayout>
11228 <para>
11229 then <emphasis>a.b.c</emphasis> is in the set of domains defined by <option>hold_domains</option>, whereas
11230 any domain matching <literal>*.b.c</literal> is not.
11231 </para>
11232 </section>
11233 <section id="SECID77">
11234 <title>An lsearch file is not an out-of-line list</title>
11235 <para>
11236 As will be described in the sections that follow, lookups can be used in lists
11237 to provide indexed methods of checking list membership. There has been some
11238 confusion about the way <command>lsearch</command> lookups work in lists. Because
11239 an <command>lsearch</command> file contains plain text and is scanned sequentially, it is
11240 sometimes thought that it is allowed to contain wild cards and other kinds of
11241 non-constant pattern. This is not the case. The keys in an <command>lsearch</command> file are
11242 always fixed strings, just as for any other single-key lookup type.
11243 </para>
11244 <para>
11245 If you want to use a file to contain wild-card patterns that form part of a
11246 list, just give the file name on its own, without a search type, as described
11247 in the previous section. You could also use the <command>wildlsearch</command> or
11248 <command>nwildlsearch</command>, but there is no advantage in doing this.
11249 </para>
11250 </section>
11251 <section id="SECTnamedlists">
11252 <title>Named lists</title>
11253 <para>
11254 <indexterm role="concept">
11255 <primary>named lists</primary>
11256 </indexterm>
11257 <indexterm role="concept">
11258 <primary>list</primary>
11259 <secondary>named</secondary>
11260 </indexterm>
11261 A list of domains, hosts, email addresses, or local parts can be given a name
11262 which is then used to refer to the list elsewhere in the configuration. This is
11263 particularly convenient if the same list is required in several different
11264 places. It also allows lists to be given meaningful names, which can improve
11265 the readability of the configuration. For example, it is conventional to define
11266 a domain list called <emphasis>local_domains</emphasis> for all the domains that are handled
11267 locally on a host, using a configuration line such as
11268 </para>
11269 <literallayout class="monospaced">
11270 domainlist local_domains = localhost:my.dom.example
11271 </literallayout>
11272 <para>
11273 Named lists are referenced by giving their name preceded by a plus sign, so,
11274 for example, a router that is intended to handle local domains would be
11275 configured with the line
11276 </para>
11277 <literallayout class="monospaced">
11278 domains = +local_domains
11279 </literallayout>
11280 <para>
11281 The first router in a configuration is often one that handles all domains
11282 except the local ones, using a configuration with a negated item like this:
11283 </para>
11284 <literallayout class="monospaced">
11285 dnslookup:
11286   driver = dnslookup
11287   domains = ! +local_domains
11288   transport = remote_smtp
11289   no_more
11290 </literallayout>
11291 <para>
11292 The four kinds of named list are created by configuration lines starting with
11293 the words <option>domainlist</option>, <option>hostlist</option>, <option>addresslist</option>, or <option>localpartlist</option>,
11294 respectively. Then there follows the name that you are defining, followed by an
11295 equals sign and the list itself. For example:
11296 </para>
11297 <literallayout class="monospaced">
11298 hostlist    relay_hosts = 192.168.23.0/24 : my.friend.example
11299 addresslist bad_senders = cdb;/etc/badsenders
11300 </literallayout>
11301 <para>
11302 A named list may refer to other named lists:
11303 </para>
11304 <literallayout class="monospaced">
11305 domainlist  dom1 = first.example : second.example
11306 domainlist  dom2 = +dom1 : third.example
11307 domainlist  dom3 = fourth.example : +dom2 : fifth.example
11308 </literallayout>
11309 <para>
11310 <emphasis role="bold">Warning</emphasis>: If the last item in a referenced list is a negative one, the
11311 effect may not be what you intended, because the negation does not propagate
11312 out to the higher level. For example, consider:
11313 </para>
11314 <literallayout class="monospaced">
11315 domainlist  dom1 = !a.b
11316 domainlist  dom2 = +dom1 : *.b
11317 </literallayout>
11318 <para>
11319 The second list specifies <quote>either in the <option>dom1</option> list or <emphasis>*.b</emphasis></quote>. The first
11320 list specifies just <quote>not <emphasis>a.b</emphasis></quote>, so the domain <emphasis>x.y</emphasis> matches it. That
11321 means it matches the second list as well. The effect is not the same as
11322 </para>
11323 <literallayout class="monospaced">
11324 domainlist  dom2 = !a.b : *.b
11325 </literallayout>
11326 <para>
11327 where <emphasis>x.y</emphasis> does not match. It&#x2019;s best to avoid negation altogether in
11328 referenced lists if you can.
11329 </para>
11330 <para>
11331 Named lists may have a performance advantage. When Exim is routing an
11332 address or checking an incoming message, it caches the result of tests on named
11333 lists. So, if you have a setting such as
11334 </para>
11335 <literallayout class="monospaced">
11336 domains = +local_domains
11337 </literallayout>
11338 <para>
11339 on several of your routers
11340 or in several ACL statements,
11341 the actual test is done only for the first one. However, the caching works only
11342 if there are no expansions within the list itself or any sublists that it
11343 references. In other words, caching happens only for lists that are known to be
11344 the same each time they are referenced.
11345 </para>
11346 <para>
11347 By default, there may be up to 16 named lists of each type. This limit can be
11348 extended by changing a compile-time variable. The use of domain and host lists
11349 is recommended for concepts such as local domains, relay domains, and relay
11350 hosts. The default configuration is set up like this.
11351 </para>
11352 </section>
11353 <section id="SECID78">
11354 <title>Named lists compared with macros</title>
11355 <para>
11356 <indexterm role="concept">
11357 <primary>list</primary>
11358 <secondary>named compared with macro</secondary>
11359 </indexterm>
11360 <indexterm role="concept">
11361 <primary>macro</primary>
11362 <secondary>compared with named list</secondary>
11363 </indexterm>
11364 At first sight, named lists might seem to be no different from macros in the
11365 configuration file. However, macros are just textual substitutions. If you
11366 write
11367 </para>
11368 <literallayout class="monospaced">
11369 ALIST = host1 : host2
11370 auth_advertise_hosts = !ALIST
11371 </literallayout>
11372 <para>
11373 it probably won&#x2019;t do what you want, because that is exactly the same as
11374 </para>
11375 <literallayout class="monospaced">
11376 auth_advertise_hosts = !host1 : host2
11377 </literallayout>
11378 <para>
11379 Notice that the second host name is not negated. However, if you use a host
11380 list, and write
11381 </para>
11382 <literallayout class="monospaced">
11383 hostlist alist = host1 : host2
11384 auth_advertise_hosts = ! +alist
11385 </literallayout>
11386 <para>
11387 the negation applies to the whole list, and so that is equivalent to
11388 </para>
11389 <literallayout class="monospaced">
11390 auth_advertise_hosts = !host1 : !host2
11391 </literallayout>
11392 </section>
11393 <section id="SECID79">
11394 <title>Named list caching</title>
11395 <para>
11396 <indexterm role="concept">
11397 <primary>list</primary>
11398 <secondary>caching of named</secondary>
11399 </indexterm>
11400 <indexterm role="concept">
11401 <primary>caching</primary>
11402 <secondary>named lists</secondary>
11403 </indexterm>
11404 While processing a message, Exim caches the result of checking a named list if
11405 it is sure that the list is the same each time. In practice, this means that
11406 the cache operates only if the list contains no $ characters, which guarantees
11407 that it will not change when it is expanded. Sometimes, however, you may have
11408 an expanded list that you know will be the same each time within a given
11409 message. For example:
11410 </para>
11411 <literallayout class="monospaced">
11412 domainlist special_domains = \
11413            ${lookup{$sender_host_address}cdb{/some/file}}
11414 </literallayout>
11415 <para>
11416 This provides a list of domains that depends only on the sending host&#x2019;s IP
11417 address. If this domain list is referenced a number of times (for example,
11418 in several ACL lines, or in several routers) the result of the check is not
11419 cached by default, because Exim does not know that it is going to be the
11420 same list each time.
11421 </para>
11422 <para>
11423 By appending <literal>_cache</literal> to <literal>domainlist</literal> you can tell Exim to go ahead and
11424 cache the result anyway. For example:
11425 </para>
11426 <literallayout class="monospaced">
11427 domainlist_cache special_domains = ${lookup{...
11428 </literallayout>
11429 <para>
11430 If you do this, you should be absolutely sure that caching is going to do
11431 the right thing in all cases. When in doubt, leave it out.
11432 </para>
11433 </section>
11434 <section id="SECTdomainlist">
11435 <title>Domain lists</title>
11436 <para>
11437 <indexterm role="concept">
11438 <primary>domain list</primary>
11439 <secondary>patterns for</secondary>
11440 </indexterm>
11441 <indexterm role="concept">
11442 <primary>list</primary>
11443 <secondary>domain list</secondary>
11444 </indexterm>
11445 Domain lists contain patterns that are to be matched against a mail domain.
11446 The following types of item may appear in domain lists:
11447 </para>
11448 <itemizedlist>
11449 <listitem>
11450 <para>
11451 <indexterm role="concept">
11452 <primary>primary host name</primary>
11453 </indexterm>
11454 <indexterm role="concept">
11455 <primary>host name</primary>
11456 <secondary>matched in domain list</secondary>
11457 </indexterm>
11458 <indexterm role="option">
11459 <primary><option>primary_hostname</option></primary>
11460 </indexterm>
11461 <indexterm role="concept">
11462 <primary>domain list</primary>
11463 <secondary>matching primary host name</secondary>
11464 </indexterm>
11465 <indexterm role="concept">
11466 <primary>@ in a domain list</primary>
11467 </indexterm>
11468 If a pattern consists of a single @ character, it matches the local host name,
11469 as set by the <option>primary_hostname</option> option (or defaulted). This makes it
11470 possible to use the same configuration file on several different hosts that
11471 differ only in their names.
11472 </para>
11473 </listitem>
11474 <listitem>
11475 <para>
11476 <indexterm role="concept">
11477 <primary>@[] in a domain list</primary>
11478 </indexterm>
11479 <indexterm role="concept">
11480 <primary>domain list</primary>
11481 <secondary>matching local IP interfaces</secondary>
11482 </indexterm>
11483 <indexterm role="concept">
11484 <primary>domain literal</primary>
11485 </indexterm>
11486 If a pattern consists of the string <literal>@[]</literal> it matches an IP address enclosed
11487 in square brackets (as in an email address that contains a domain literal), but
11488 only if that IP address is recognized as local for email routing purposes. The
11489 <option>local_interfaces</option> and <option>extra_local_interfaces</option> options can be used to
11490 control which of a host&#x2019;s several IP addresses are treated as local.
11491 In today&#x2019;s Internet, the use of domain literals is controversial.
11492 </para>
11493 </listitem>
11494 <listitem>
11495 <para>
11496 <indexterm role="concept">
11497 <primary>@mx_any</primary>
11498 </indexterm>
11499 <indexterm role="concept">
11500 <primary>@mx_primary</primary>
11501 </indexterm>
11502 <indexterm role="concept">
11503 <primary>@mx_secondary</primary>
11504 </indexterm>
11505 <indexterm role="concept">
11506 <primary>domain list</primary>
11507 <secondary>matching MX pointers to local host</secondary>
11508 </indexterm>
11509 If a pattern consists of the string <literal>@mx_any</literal> it matches any domain that
11510 has an MX record pointing to the local host or to any host that is listed in
11511 <indexterm role="option">
11512 <primary><option>hosts_treat_as_local</option></primary>
11513 </indexterm>
11514 <option>hosts_treat_as_local</option>. The items <literal>@mx_primary</literal> and <literal>@mx_secondary</literal>
11515 are similar, except that the first matches only when a primary MX target is the
11516 local host, and the second only when no primary MX target is the local host,
11517 but a secondary MX target is. <quote>Primary</quote> means an MX record with the lowest
11518 preference value &ndash; there may of course be more than one of them.
11519 </para>
11520 <para>
11521 The MX lookup that takes place when matching a pattern of this type is
11522 performed with the resolver options for widening names turned off. Thus, for
11523 example, a single-component domain will <emphasis>not</emphasis> be expanded by adding the
11524 resolver&#x2019;s default domain. See the <option>qualify_single</option> and <option>search_parents</option>
11525 options of the <command>dnslookup</command> router for a discussion of domain widening.
11526 </para>
11527 <para>
11528 Sometimes you may want to ignore certain IP addresses when using one of these
11529 patterns. You can specify this by following the pattern with <literal>/ignore=</literal>&lt;<emphasis>ip
11530 list</emphasis>&gt;, where &lt;<emphasis>ip list</emphasis>&gt; is a list of IP addresses. These addresses are
11531 ignored when processing the pattern (compare the <option>ignore_target_hosts</option> option
11532 on a router). For example:
11533 </para>
11534 <literallayout class="monospaced">
11535 domains = @mx_any/ignore=127.0.0.1
11536 </literallayout>
11537 <para>
11538 This example matches any domain that has an MX record pointing to one of
11539 the local host&#x2019;s IP addresses other than 127.0.0.1.
11540 </para>
11541 <para>
11542 The list of IP addresses is in fact processed by the same code that processes
11543 host lists, so it may contain CIDR-coded network specifications and it may also
11544 contain negative items.
11545 </para>
11546 <para>
11547 Because the list of IP addresses is a sublist within a domain list, you have to
11548 be careful about delimiters if there is more than one address. Like any other
11549 list, the default delimiter can be changed. Thus, you might have:
11550 </para>
11551 <literallayout class="monospaced">
11552 domains = @mx_any/ignore=&lt;;127.0.0.1;0.0.0.0 : \
11553           an.other.domain : ...
11554 </literallayout>
11555 <para>
11556 so that the sublist uses semicolons for delimiters. When IPv6 addresses are
11557 involved, it is easiest to change the delimiter for the main list as well:
11558 </para>
11559 <literallayout class="monospaced">
11560 domains = &lt;? @mx_any/ignore=&lt;;127.0.0.1;::1 ? \
11561           an.other.domain ? ...
11562 </literallayout>
11563 </listitem>
11564 <listitem>
11565 <para>
11566 <indexterm role="concept">
11567 <primary>asterisk</primary>
11568 <secondary>in domain list</secondary>
11569 </indexterm>
11570 <indexterm role="concept">
11571 <primary>domain list</primary>
11572 <secondary>asterisk in</secondary>
11573 </indexterm>
11574 <indexterm role="concept">
11575 <primary>domain list</primary>
11576 <secondary>matching <quote>ends with</quote></secondary>
11577 </indexterm>
11578 If a pattern starts with an asterisk, the remaining characters of the pattern
11579 are compared with the terminating characters of the domain. The use of <quote>*</quote> in
11580 domain lists differs from its use in partial matching lookups. In a domain
11581 list, the character following the asterisk need not be a dot, whereas partial
11582 matching works only in terms of dot-separated components. For example, a domain
11583 list item such as <literal>*key.ex</literal> matches <emphasis>donkey.ex</emphasis> as well as
11584 <emphasis>cipher.key.ex</emphasis>.
11585 </para>
11586 </listitem>
11587 <listitem>
11588 <para>
11589 <indexterm role="concept">
11590 <primary>regular expressions</primary>
11591 <secondary>in domain list</secondary>
11592 </indexterm>
11593 <indexterm role="concept">
11594 <primary>domain list</primary>
11595 <secondary>matching regular expression</secondary>
11596 </indexterm>
11597 If a pattern starts with a circumflex character, it is treated as a regular
11598 expression, and matched against the domain using a regular expression matching
11599 function. The circumflex is treated as part of the regular expression.
11600 Email domains are case-independent, so this regular expression match is by
11601 default case-independent, but you can make it case-dependent by starting it
11602 with <literal>(?-i)</literal>. References to descriptions of the syntax of regular expressions
11603 are given in chapter <xref linkend="CHAPregexp"/>.
11604 </para>
11605 <para>
11606 <emphasis role="bold">Warning</emphasis>: Because domain lists are expanded before being processed, you
11607 must escape any backslash and dollar characters in the regular expression, or
11608 use the special <literal>\N</literal> sequence (see chapter <xref linkend="CHAPexpand"/>) to specify that
11609 it is not to be expanded (unless you really do want to build a regular
11610 expression by expansion, of course).
11611 </para>
11612 </listitem>
11613 <listitem>
11614 <para>
11615 <indexterm role="concept">
11616 <primary>lookup</primary>
11617 <secondary>in domain list</secondary>
11618 </indexterm>
11619 <indexterm role="concept">
11620 <primary>domain list</primary>
11621 <secondary>matching by lookup</secondary>
11622 </indexterm>
11623 If a pattern starts with the name of a single-key lookup type followed by a
11624 semicolon (for example, <quote>dbm;</quote> or <quote>lsearch;</quote>), the remainder of the pattern
11625 must be a file name in a suitable format for the lookup type. For example, for
11626 <quote>cdb;</quote> it must be an absolute path:
11627 </para>
11628 <literallayout class="monospaced">
11629 domains = cdb;/etc/mail/local_domains.cdb
11630 </literallayout>
11631 <para>
11632 The appropriate type of lookup is done on the file using the domain name as the
11633 key. In most cases, the data that is looked up is not used; Exim is interested
11634 only in whether or not the key is present in the file. However, when a lookup
11635 is used for the <option>domains</option> option on a router
11636 or a <option>domains</option> condition in an ACL statement, the data is preserved in the
11637 <varname>$domain_data</varname> variable and can be referred to in other router options or
11638 other statements in the same ACL.
11639 </para>
11640 </listitem>
11641 <listitem>
11642 <para>
11643 Any of the single-key lookup type names may be preceded by
11644 <literal>partial</literal>&lt;<emphasis>n</emphasis>&gt;<literal>-</literal>, where the &lt;<emphasis>n</emphasis>&gt; is optional, for example,
11645 </para>
11646 <literallayout class="monospaced">
11647 domains = partial-dbm;/partial/domains
11648 </literallayout>
11649 <para>
11650 This causes partial matching logic to be invoked; a description of how this
11651 works is given in section <xref linkend="SECTpartiallookup"/>.
11652 </para>
11653 </listitem>
11654 <listitem>
11655 <para>
11656 <indexterm role="concept">
11657 <primary>asterisk</primary>
11658 <secondary>in lookup type</secondary>
11659 </indexterm>
11660 Any of the single-key lookup types may be followed by an asterisk. This causes
11661 a default lookup for a key consisting of a single asterisk to be done if the
11662 original lookup fails. This is not a useful feature when using a domain list to
11663 select particular domains (because any domain would match), but it might have
11664 value if the result of the lookup is being used via the <varname>$domain_data</varname>
11665 expansion variable.
11666 </para>
11667 </listitem>
11668 <listitem>
11669 <para>
11670 If the pattern starts with the name of a query-style lookup type followed by a
11671 semicolon (for example, <quote>nisplus;</quote> or <quote>ldap;</quote>), the remainder of the
11672 pattern must be an appropriate query for the lookup type, as described in
11673 chapter <xref linkend="CHAPfdlookup"/>. For example:
11674 </para>
11675 <literallayout class="monospaced">
11676 hold_domains = mysql;select domain from holdlist \
11677   where domain = '$domain';
11678 </literallayout>
11679 <para>
11680 In most cases, the data that is looked up is not used (so for an SQL query, for
11681 example, it doesn&#x2019;t matter what field you select). Exim is interested only in
11682 whether or not the query succeeds. However, when a lookup is used for the
11683 <option>domains</option> option on a router, the data is preserved in the <varname>$domain_data</varname>
11684 variable and can be referred to in other options.
11685 </para>
11686 </listitem>
11687 <listitem>
11688 <para>
11689 <indexterm role="concept">
11690 <primary>domain list</primary>
11691 <secondary>matching literal domain name</secondary>
11692 </indexterm>
11693 If none of the above cases apply, a caseless textual comparison is made
11694 between the pattern and the domain.
11695 </para>
11696 </listitem>
11697 </itemizedlist>
11698 <para>
11699 Here is an example that uses several different kinds of pattern:
11700 </para>
11701 <literallayout class="monospaced">
11702 domainlist funny_domains = \
11703   @ : \
11704   lib.unseen.edu : \
11705   *.foundation.fict.example : \
11706   \N^[1-2]\d{3}\.fict\.example$\N : \
11707   partial-dbm;/opt/data/penguin/book : \
11708   nis;domains.byname : \
11709   nisplus;[name=$domain,status=local],domains.org_dir
11710 </literallayout>
11711 <para>
11712 There are obvious processing trade-offs among the various matching modes. Using
11713 an asterisk is faster than a regular expression, and listing a few names
11714 explicitly probably is too. The use of a file or database lookup is expensive,
11715 but may be the only option if hundreds of names are required. Because the
11716 patterns are tested in order, it makes sense to put the most commonly matched
11717 patterns earlier.
11718 </para>
11719 </section>
11720 <section id="SECThostlist">
11721 <title>Host lists</title>
11722 <para>
11723 <indexterm role="concept">
11724 <primary>host list</primary>
11725 <secondary>patterns in</secondary>
11726 </indexterm>
11727 <indexterm role="concept">
11728 <primary>list</primary>
11729 <secondary>host list</secondary>
11730 </indexterm>
11731 Host lists are used to control what remote hosts are allowed to do. For
11732 example, some hosts may be allowed to use the local host as a relay, and some
11733 may be permitted to use the SMTP ETRN command. Hosts can be identified in
11734 two different ways, by name or by IP address. In a host list, some types of
11735 pattern are matched to a host name, and some are matched to an IP address.
11736 You need to be particularly careful with this when single-key lookups are
11737 involved, to ensure that the right value is being used as the key.
11738 </para>
11739 </section>
11740 <section id="SECID80">
11741 <title>Special host list patterns</title>
11742 <para>
11743 <indexterm role="concept">
11744 <primary>empty item in hosts list</primary>
11745 </indexterm>
11746 <indexterm role="concept">
11747 <primary>host list</primary>
11748 <secondary>empty string in</secondary>
11749 </indexterm>
11750 If a host list item is the empty string, it matches only when no remote host is
11751 involved. This is the case when a message is being received from a local
11752 process using SMTP on the standard input, that is, when a TCP/IP connection is
11753 not used.
11754 </para>
11755 <para>
11756 <indexterm role="concept">
11757 <primary>asterisk</primary>
11758 <secondary>in host list</secondary>
11759 </indexterm>
11760 The special pattern <quote>*</quote> in a host list matches any host or no host. Neither
11761 the IP address nor the name is actually inspected.
11762 </para>
11763 </section>
11764 <section id="SECThoslispatip">
11765 <title>Host list patterns that match by IP address</title>
11766 <para>
11767 <indexterm role="concept">
11768 <primary>host list</primary>
11769 <secondary>matching IP addresses</secondary>
11770 </indexterm>
11771 If an IPv4 host calls an IPv6 host and the call is accepted on an IPv6 socket,
11772 the incoming address actually appears in the IPv6 host as
11773 <literal>::ffff:</literal>&lt;<emphasis>v4address</emphasis>&gt;. When such an address is tested against a host
11774 list, it is converted into a traditional IPv4 address first. (Not all operating
11775 systems accept IPv4 calls on IPv6 sockets, as there have been some security
11776 concerns.)
11777 </para>
11778 <para>
11779 The following types of pattern in a host list check the remote host by
11780 inspecting its IP address:
11781 </para>
11782 <itemizedlist>
11783 <listitem>
11784 <para>
11785 If the pattern is a plain domain name (not a regular expression, not starting
11786 with *, not a lookup of any kind), Exim calls the operating system function
11787 to find the associated IP address(es). Exim uses the newer
11788 <function>getipnodebyname()</function> function when available, otherwise <function>gethostbyname()</function>.
11789 This typically causes a forward DNS lookup of the name. The result is compared
11790 with the IP address of the subject host.
11791 </para>
11792 <para>
11793 If there is a temporary problem (such as a DNS timeout) with the host name
11794 lookup, a temporary error occurs. For example, if the list is being used in an
11795 ACL condition, the ACL gives a <quote>defer</quote> response, usually leading to a
11796 temporary SMTP error code. If no IP address can be found for the host name,
11797 what happens is described in section <xref linkend="SECTbehipnot"/> below.
11798 </para>
11799 </listitem>
11800 <listitem>
11801 <para>
11802 <indexterm role="concept">
11803 <primary>@ in a host list</primary>
11804 </indexterm>
11805 If the pattern is <quote>@</quote>, the primary host name is substituted and used as a
11806 domain name, as just described.
11807 </para>
11808 </listitem>
11809 <listitem>
11810 <para>
11811 If the pattern is an IP address, it is matched against the IP address of the
11812 subject host. IPv4 addresses are given in the normal <quote>dotted-quad</quote> notation.
11813 IPv6 addresses can be given in colon-separated format, but the colons have to
11814 be doubled so as not to be taken as item separators when the default list
11815 separator is used. IPv6 addresses are recognized even when Exim is compiled
11816 without IPv6 support. This means that if they appear in a host list on an
11817 IPv4-only host, Exim will not treat them as host names. They are just addresses
11818 that can never match a client host.
11819 </para>
11820 </listitem>
11821 <listitem>
11822 <para>
11823 <indexterm role="concept">
11824 <primary>@[] in a host list</primary>
11825 </indexterm>
11826 If the pattern is <quote>@[]</quote>, it matches the IP address of any IP interface on
11827 the local host. For example, if the local host is an IPv4 host with one
11828 interface address 10.45.23.56, these two ACL statements have the same effect:
11829 </para>
11830 <literallayout class="monospaced">
11831 accept hosts = 127.0.0.1 : 10.45.23.56
11832 accept hosts = @[]
11833 </literallayout>
11834 </listitem>
11835 <listitem>
11836 <para>
11837 <indexterm role="concept">
11838 <primary>CIDR notation</primary>
11839 </indexterm>
11840 If the pattern is an IP address followed by a slash and a mask length (for
11841 example 10.11.42.0/24), it is matched against the IP address of the subject
11842 host under the given mask. This allows, an entire network of hosts to be
11843 included (or excluded) by a single item. The mask uses CIDR notation; it
11844 specifies the number of address bits that must match, starting from the most
11845 significant end of the address.
11846 </para>
11847 <para>
11848 <emphasis role="bold">Note</emphasis>: The mask is <emphasis>not</emphasis> a count of addresses, nor is it the high number
11849 of a range of addresses. It is the number of bits in the network portion of the
11850 address. The above example specifies a 24-bit netmask, so it matches all 256
11851 addresses in the 10.11.42.0 network. An item such as
11852 </para>
11853 <literallayout class="monospaced">
11854 192.168.23.236/31
11855 </literallayout>
11856 <para>
11857 matches just two addresses, 192.168.23.236 and 192.168.23.237. A mask value of
11858 32 for an IPv4 address is the same as no mask at all; just a single address
11859 matches.
11860 </para>
11861 <para>
11862 Here is another example which shows an IPv4 and an IPv6 network:
11863 </para>
11864 <literallayout class="monospaced">
11865 recipient_unqualified_hosts = 192.168.0.0/16: \
11866                               3ffe::ffff::836f::::/48
11867 </literallayout>
11868 <para>
11869 The doubling of list separator characters applies only when these items
11870 appear inline in a host list. It is not required when indirecting via a file.
11871 For example:
11872 </para>
11873 <literallayout class="monospaced">
11874 recipient_unqualified_hosts = /opt/exim/unqualnets
11875 </literallayout>
11876 <para>
11877 could make use of a file containing
11878 </para>
11879 <literallayout class="monospaced">
11880 172.16.0.0/12
11881 3ffe:ffff:836f::/48
11882 </literallayout>
11883 <para>
11884 to have exactly the same effect as the previous example. When listing IPv6
11885 addresses inline, it is usually more convenient to use the facility for
11886 changing separator characters. This list contains the same two networks:
11887 </para>
11888 <literallayout class="monospaced">
11889 recipient_unqualified_hosts = &lt;; 172.16.0.0/12; \
11890                                  3ffe:ffff:836f::/48
11891 </literallayout>
11892 <para>
11893 The separator is changed to semicolon by the leading <quote>&lt;;</quote> at the start of the
11894 list.
11895 </para>
11896 </listitem>
11897 </itemizedlist>
11898 </section>
11899 <section id="SECThoslispatsikey">
11900 <title>Host list patterns for single-key lookups by host address</title>
11901 <para>
11902 <indexterm role="concept">
11903 <primary>host list</primary>
11904 <secondary>lookup of IP address</secondary>
11905 </indexterm>
11906 When a host is to be identified by a single-key lookup of its complete IP
11907 address, the pattern takes this form:
11908 </para>
11909 <literallayout>
11910 <literal>net-&lt;</literal><emphasis>single-key-search-type</emphasis><literal>&gt;;&lt;</literal><emphasis>search-data</emphasis><literal>&gt;</literal>
11911 </literallayout>
11912 <para>
11913 For example:
11914 </para>
11915 <literallayout class="monospaced">
11916 hosts_lookup = net-cdb;/hosts-by-ip.db
11917 </literallayout>
11918 <para>
11919 The text form of the IP address of the subject host is used as the lookup key.
11920 IPv6 addresses are converted to an unabbreviated form, using lower case
11921 letters, with dots as separators because colon is the key terminator in
11922 <command>lsearch</command> files. [Colons can in fact be used in keys in <command>lsearch</command> files by
11923 quoting the keys, but this is a facility that was added later.] The data
11924 returned by the lookup is not used.
11925 </para>
11926 <para>
11927 <indexterm role="concept">
11928 <primary>IP address</primary>
11929 <secondary>masking</secondary>
11930 </indexterm>
11931 <indexterm role="concept">
11932 <primary>host list</primary>
11933 <secondary>masked IP address</secondary>
11934 </indexterm>
11935 Single-key lookups can also be performed using masked IP addresses, using
11936 patterns of this form:
11937 </para>
11938 <literallayout>
11939 <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>
11940 </literallayout>
11941 <para>
11942 For example:
11943 </para>
11944 <literallayout class="monospaced">
11945 net24-dbm;/networks.db
11946 </literallayout>
11947 <para>
11948 The IP address of the subject host is masked using &lt;<emphasis>number</emphasis>&gt; as the mask
11949 length. A textual string is constructed from the masked value, followed by the
11950 mask, and this is used as the lookup key. For example, if the host&#x2019;s IP address
11951 is 192.168.34.6, the key that is looked up for the above example is
11952 <quote>192.168.34.0/24</quote>.
11953 </para>
11954 <para>
11955 When an IPv6 address is converted to a string, dots are normally used instead
11956 of colons, so that keys in <command>lsearch</command> files need not contain colons (which
11957 terminate <command>lsearch</command> keys). This was implemented some time before the ability
11958 to quote keys was made available in <command>lsearch</command> files. However, the more
11959 recently implemented <command>iplsearch</command> files do require colons in IPv6 keys
11960 (notated using the quoting facility) so as to distinguish them from IPv4 keys.
11961 For this reason, when the lookup type is <command>iplsearch</command>, IPv6 addresses are
11962 converted using colons and not dots. In all cases, full, unabbreviated IPv6
11963 addresses are always used.
11964 </para>
11965 <para>
11966 Ideally, it would be nice to tidy up this anomalous situation by changing to
11967 colons in all cases, given that quoting is now available for <command>lsearch</command>.
11968 However, this would be an incompatible change that might break some existing
11969 configurations.
11970 </para>
11971 <para>
11972 <emphasis role="bold">Warning</emphasis>: Specifying <option>net32-</option> (for an IPv4 address) or <option>net128-</option> (for an
11973 IPv6 address) is not the same as specifying just <option>net-</option> without a number. In
11974 the former case the key strings include the mask value, whereas in the latter
11975 case the IP address is used on its own.
11976 </para>
11977 </section>
11978 <section id="SECThoslispatnam">
11979 <title>Host list patterns that match by host name</title>
11980 <para>
11981 <indexterm role="concept">
11982 <primary>host</primary>
11983 <secondary>lookup failures</secondary>
11984 </indexterm>
11985 <indexterm role="concept">
11986 <primary>unknown host name</primary>
11987 </indexterm>
11988 <indexterm role="concept">
11989 <primary>host list</primary>
11990 <secondary>matching host name</secondary>
11991 </indexterm>
11992 There are several types of pattern that require Exim to know the name of the
11993 remote host. These are either wildcard patterns or lookups by name. (If a
11994 complete hostname is given without any wildcarding, it is used to find an IP
11995 address to match against, as described in the section <xref linkend="SECThoslispatip"/>
11996 above.)
11997 </para>
11998 <para>
11999 If the remote host name is not already known when Exim encounters one of these
12000 patterns, it has to be found from the IP address.
12001 Although many sites on the Internet are conscientious about maintaining reverse
12002 DNS data for their hosts, there are also many that do not do this.
12003 Consequently, a name cannot always be found, and this may lead to unwanted
12004 effects. Take care when configuring host lists with wildcarded name patterns.
12005 Consider what will happen if a name cannot be found.
12006 </para>
12007 <para>
12008 Because of the problems of determining host names from IP addresses, matching
12009 against host names is not as common as matching against IP addresses.
12010 </para>
12011 <para>
12012 By default, in order to find a host name, Exim first does a reverse DNS lookup;
12013 if no name is found in the DNS, the system function (<function>gethostbyaddr()</function> or
12014 <function>getipnodebyaddr()</function> if available) is tried. The order in which these lookups
12015 are done can be changed by setting the <option>host_lookup_order</option> option. For
12016 security, once Exim has found one or more names, it looks up the IP addresses
12017 for these names and compares them with the IP address that it started with.
12018 Only those names whose IP addresses match are accepted. Any other names are
12019 discarded. If no names are left, Exim behaves as if the host name cannot be
12020 found. In the most common case there is only one name and one IP address.
12021 </para>
12022 <para>
12023 There are some options that control what happens if a host name cannot be
12024 found. These are described in section <xref linkend="SECTbehipnot"/> below.
12025 </para>
12026 <para>
12027 <indexterm role="concept">
12028 <primary>host</primary>
12029 <secondary>alias for</secondary>
12030 </indexterm>
12031 <indexterm role="concept">
12032 <primary>alias for host</primary>
12033 </indexterm>
12034 As a result of aliasing, hosts may have more than one name. When processing any
12035 of the following types of pattern, all the host&#x2019;s names are checked:
12036 </para>
12037 <itemizedlist>
12038 <listitem>
12039 <para>
12040 <indexterm role="concept">
12041 <primary>asterisk</primary>
12042 <secondary>in host list</secondary>
12043 </indexterm>
12044 If a pattern starts with <quote>*</quote> the remainder of the item must match the end of
12045 the host name. For example, <literal>*.b.c</literal> matches all hosts whose names end in
12046 <emphasis>.b.c</emphasis>. This special simple form is provided because this is a very common
12047 requirement. Other kinds of wildcarding require the use of a regular
12048 expression.
12049 </para>
12050 </listitem>
12051 <listitem>
12052 <para>
12053 <indexterm role="concept">
12054 <primary>regular expressions</primary>
12055 <secondary>in host list</secondary>
12056 </indexterm>
12057 <indexterm role="concept">
12058 <primary>host list</primary>
12059 <secondary>regular expression in</secondary>
12060 </indexterm>
12061 If the item starts with <quote>^</quote> it is taken to be a regular expression which is
12062 matched against the host name. Host names are case-independent, so this regular
12063 expression match is by default case-independent, but you can make it
12064 case-dependent by starting it with <literal>(?-i)</literal>. References to descriptions of the
12065 syntax of regular expressions are given in chapter <xref linkend="CHAPregexp"/>. For
12066 example,
12067 </para>
12068 <literallayout class="monospaced">
12069 ^(a|b)\.c\.d$
12070 </literallayout>
12071 <para>
12072 is a regular expression that matches either of the two hosts <emphasis>a.c.d</emphasis> or
12073 <emphasis>b.c.d</emphasis>. When a regular expression is used in a host list, you must take care
12074 that backslash and dollar characters are not misinterpreted as part of the
12075 string expansion. The simplest way to do this is to use <literal>\N</literal> to mark that
12076 part of the string as non-expandable. For example:
12077 </para>
12078 <literallayout class="monospaced">
12079 sender_unqualified_hosts = \N^(a|b)\.c\.d$\N : ....
12080 </literallayout>
12081 <para>
12082 <emphasis role="bold">Warning</emphasis>: If you want to match a complete host name, you must include the
12083 <literal>$</literal> terminating metacharacter in the regular expression, as in the above
12084 example. Without it, a match at the start of the host name is all that is
12085 required.
12086 </para>
12087 </listitem>
12088 </itemizedlist>
12089 </section>
12090 <section id="SECTbehipnot">
12091 <title>Behaviour when an IP address or name cannot be found</title>
12092 <para>
12093 <indexterm role="concept">
12094 <primary>host</primary>
12095 <secondary>lookup failures, permanent</secondary>
12096 </indexterm>
12097 While processing a host list, Exim may need to look up an IP address from a
12098 name (see section <xref linkend="SECThoslispatip"/>), or it may need to look up a host name
12099 from an IP address (see section <xref linkend="SECThoslispatnam"/>). In either case, the
12100 behaviour when it fails to find the information it is seeking is the same.
12101 </para>
12102 <para>
12103 <emphasis role="bold">Note</emphasis>: This section applies to permanent lookup failures. It does <emphasis>not</emphasis>
12104 apply to temporary DNS errors, whose handling is described in the next section.
12105 </para>
12106 <para>
12107 <indexterm role="concept">
12108 <primary><literal>+include_unknown</literal></primary>
12109 </indexterm>
12110 <indexterm role="concept">
12111 <primary><literal>+ignore_unknown</literal></primary>
12112 </indexterm>
12113 By default, Exim behaves as if the host does not match the list. This may not
12114 always be what you want to happen. To change Exim&#x2019;s behaviour, the special
12115 items <literal>+include_unknown</literal> or <literal>+ignore_unknown</literal> may appear in the list (at
12116 top level &ndash; they are not recognized in an indirected file).
12117 </para>
12118 <itemizedlist>
12119 <listitem>
12120 <para>
12121 If any item that follows <literal>+include_unknown</literal> requires information that
12122 cannot found, Exim behaves as if the host does match the list. For example,
12123 </para>
12124 <literallayout class="monospaced">
12125 host_reject_connection = +include_unknown:*.enemy.ex
12126 </literallayout>
12127 <para>
12128 rejects connections from any host whose name matches <literal>*.enemy.ex</literal>, and also
12129 any hosts whose name it cannot find.
12130 </para>
12131 </listitem>
12132 <listitem>
12133 <para>
12134 If any item that follows <literal>+ignore_unknown</literal> requires information that cannot
12135 be found, Exim ignores that item and proceeds to the rest of the list. For
12136 example:
12137 </para>
12138 <literallayout class="monospaced">
12139 accept hosts = +ignore_unknown : friend.example : \
12140                192.168.4.5
12141 </literallayout>
12142 <para>
12143 accepts from any host whose name is <emphasis>friend.example</emphasis> and from 192.168.4.5,
12144 whether or not its host name can be found. Without <literal>+ignore_unknown</literal>, if no
12145 name can be found for 192.168.4.5, it is rejected.
12146 </para>
12147 </listitem>
12148 </itemizedlist>
12149 <para>
12150 Both <literal>+include_unknown</literal> and <literal>+ignore_unknown</literal> may appear in the same
12151 list. The effect of each one lasts until the next, or until the end of the
12152 list.
12153 </para>
12154 </section>
12155 <section id="SECTtemdnserr">
12156 <title>Temporary DNS errors when looking up host information</title>
12157 <para>
12158 <indexterm role="concept">
12159 <primary>host</primary>
12160 <secondary>lookup failures, temporary</secondary>
12161 </indexterm>
12162 <indexterm role="concept">
12163 <primary><literal>+include_defer</literal></primary>
12164 </indexterm>
12165 <indexterm role="concept">
12166 <primary><literal>+ignore_defer</literal></primary>
12167 </indexterm>
12168 A temporary DNS lookup failure normally causes a defer action (except when
12169 <option>dns_again_means_nonexist</option> converts it into a permanent error). However,
12170 host lists can include <literal>+ignore_defer</literal> and <literal>+include_defer</literal>, analagous to
12171 <literal>+ignore_unknown</literal> and <literal>+include_unknown</literal>, as described in the previous
12172 section. These options should be used with care, probably only in non-critical
12173 host lists such as whitelists.
12174 </para>
12175 </section>
12176 <section id="SECThoslispatnamsk">
12177 <title>Host list patterns for single-key lookups by host name</title>
12178 <para>
12179 <indexterm role="concept">
12180 <primary>unknown host name</primary>
12181 </indexterm>
12182 <indexterm role="concept">
12183 <primary>host list</primary>
12184 <secondary>matching host name</secondary>
12185 </indexterm>
12186 If a pattern is of the form
12187 </para>
12188 <literallayout>
12189 &lt;<emphasis>single-key-search-type</emphasis>&gt;;&lt;<emphasis>search-data</emphasis>&gt;
12190 </literallayout>
12191 <para>
12192 for example
12193 </para>
12194 <literallayout class="monospaced">
12195 dbm;/host/accept/list
12196 </literallayout>
12197 <para>
12198 a single-key lookup is performed, using the host name as its key. If the
12199 lookup succeeds, the host matches the item. The actual data that is looked up
12200 is not used.
12201 </para>
12202 <para>
12203 <emphasis role="bold">Reminder</emphasis>: With this kind of pattern, you must have host <emphasis>names</emphasis> as
12204 keys in the file, not IP addresses. If you want to do lookups based on IP
12205 addresses, you must precede the search type with <quote>net-</quote> (see section
12206 <xref linkend="SECThoslispatsikey"/>). There is, however, no reason why you could not use
12207 two items in the same list, one doing an address lookup and one doing a name
12208 lookup, both using the same file.
12209 </para>
12210 </section>
12211 <section id="SECID81">
12212 <title>Host list patterns for query-style lookups</title>
12213 <para>
12214 If a pattern is of the form
12215 </para>
12216 <literallayout>
12217 &lt;<emphasis>query-style-search-type</emphasis>&gt;;&lt;<emphasis>query</emphasis>&gt;
12218 </literallayout>
12219 <para>
12220 the query is obeyed, and if it succeeds, the host matches the item. The actual
12221 data that is looked up is not used. The variables <varname>$sender_host_address</varname> and
12222 <varname>$sender_host_name</varname> can be used in the query. For example:
12223 </para>
12224 <literallayout class="monospaced">
12225 hosts_lookup = pgsql;\
12226   select ip from hostlist where ip='$sender_host_address'
12227 </literallayout>
12228 <para>
12229 The value of <varname>$sender_host_address</varname> for an IPv6 address contains colons. You
12230 can use the <option>sg</option> expansion item to change this if you need to. If you want to
12231 use masked IP addresses in database queries, you can use the <option>mask</option> expansion
12232 operator.
12233 </para>
12234 <para>
12235 If the query contains a reference to <varname>$sender_host_name</varname>, Exim automatically
12236 looks up the host name if has not already done so. (See section
12237 <xref linkend="SECThoslispatnam"/> for comments on finding host names.)
12238 </para>
12239 <para>
12240 Historical note: prior to release 4.30, Exim would always attempt to find a
12241 host name before running the query, unless the search type was preceded by
12242 <literal>net-</literal>. This is no longer the case. For backwards compatibility, <literal>net-</literal> is
12243 still recognized for query-style lookups, but its presence or absence has no
12244 effect. (Of course, for single-key lookups, <literal>net-</literal> <emphasis>is</emphasis> important.
12245 See section <xref linkend="SECThoslispatsikey"/>.)
12246 </para>
12247 </section>
12248 <section id="SECTmixwilhos">
12249 <title>Mixing wildcarded host names and addresses in host lists</title>
12250 <para>
12251 <indexterm role="concept">
12252 <primary>host list</primary>
12253 <secondary>mixing names and addresses in</secondary>
12254 </indexterm>
12255 If you have name lookups or wildcarded host names and IP addresses in the same
12256 host list, you should normally put the IP addresses first. For example, in an
12257 ACL you could have:
12258 </para>
12259 <literallayout class="monospaced">
12260 accept hosts = 10.9.8.7 : *.friend.example
12261 </literallayout>
12262 <para>
12263 The reason for this lies in the left-to-right way that Exim processes lists.
12264 It can test IP addresses without doing any DNS lookups, but when it reaches an
12265 item that requires a host name, it fails if it cannot find a host name to
12266 compare with the pattern. If the above list is given in the opposite order, the
12267 <option>accept</option> statement fails for a host whose name cannot be found, even if its
12268 IP address is 10.9.8.7.
12269 </para>
12270 <para>
12271 If you really do want to do the name check first, and still recognize the IP
12272 address, you can rewrite the ACL like this:
12273 </para>
12274 <literallayout class="monospaced">
12275 accept hosts = *.friend.example
12276 accept hosts = 10.9.8.7
12277 </literallayout>
12278 <para>
12279 If the first <option>accept</option> fails, Exim goes on to try the second one. See chapter
12280 <xref linkend="CHAPACL"/> for details of ACLs.
12281 </para>
12282 </section>
12283 <section id="SECTaddresslist">
12284 <title>Address lists</title>
12285 <para>
12286 <indexterm role="concept">
12287 <primary>list</primary>
12288 <secondary>address list</secondary>
12289 </indexterm>
12290 <indexterm role="concept">
12291 <primary>address list</primary>
12292 <secondary>empty item</secondary>
12293 </indexterm>
12294 <indexterm role="concept">
12295 <primary>address list</primary>
12296 <secondary>patterns</secondary>
12297 </indexterm>
12298 Address lists contain patterns that are matched against mail addresses. There
12299 is one special case to be considered: the sender address of a bounce message is
12300 always empty. You can test for this by providing an empty item in an address
12301 list. For example, you can set up a router to process bounce messages by
12302 using this option setting:
12303 </para>
12304 <literallayout class="monospaced">
12305 senders = :
12306 </literallayout>
12307 <para>
12308 The presence of the colon creates an empty item. If you do not provide any
12309 data, the list is empty and matches nothing. The empty sender can also be
12310 detected by a regular expression that matches an empty string,
12311 and by a query-style lookup that succeeds when <varname>$sender_address</varname> is empty.
12312 </para>
12313 <para>
12314 Non-empty items in an address list can be straightforward email addresses. For
12315 example:
12316 </para>
12317 <literallayout class="monospaced">
12318 senders = jbc@askone.example : hs@anacreon.example
12319 </literallayout>
12320 <para>
12321 A certain amount of wildcarding is permitted. If a pattern contains an @
12322 character, but is not a regular expression and does not begin with a
12323 semicolon-terminated lookup type (described below), the local part of the
12324 subject address is compared with the local part of the pattern, which may start
12325 with an asterisk. If the local parts match, the domain is checked in exactly
12326 the same way as for a pattern in a domain list. For example, the domain can be
12327 wildcarded, refer to a named list, or be a lookup:
12328 </para>
12329 <literallayout class="monospaced">
12330 deny senders = *@*.spamming.site:\
12331                *@+hostile_domains:\
12332                bozo@partial-lsearch;/list/of/dodgy/sites:\
12333                *@dbm;/bad/domains.db
12334 </literallayout>
12335 <para>
12336 <indexterm role="concept">
12337 <primary>local part</primary>
12338 <secondary>starting with !</secondary>
12339 </indexterm>
12340 <indexterm role="concept">
12341 <primary>address list</primary>
12342 <secondary>local part starting with !</secondary>
12343 </indexterm>
12344 If a local part that begins with an exclamation mark is required, it has to be
12345 specified using a regular expression, because otherwise the exclamation mark is
12346 treated as a sign of negation, as is standard in lists.
12347 </para>
12348 <para>
12349 If a non-empty pattern that is not a regular expression or a lookup does not
12350 contain an @ character, it is matched against the domain part of the subject
12351 address. The only two formats that are recognized this way are a literal
12352 domain, or a domain pattern that starts with *. In both these cases, the effect
12353 is the same as if <literal>*@</literal> preceded the pattern. For example:
12354 </para>
12355 <literallayout class="monospaced">
12356 deny senders = enemy.domain : *.enemy.domain
12357 </literallayout>
12358 <para>
12359 The following kinds of more complicated address list pattern can match any
12360 address, including the empty address that is characteristic of bounce message
12361 senders:
12362 </para>
12363 <itemizedlist>
12364 <listitem>
12365 <para>
12366 <indexterm role="concept">
12367 <primary>regular expressions</primary>
12368 <secondary>in address list</secondary>
12369 </indexterm>
12370 <indexterm role="concept">
12371 <primary>address list</primary>
12372 <secondary>regular expression in</secondary>
12373 </indexterm>
12374 If (after expansion) a pattern starts with <quote>^</quote>, a regular expression match is
12375 done against the complete address, with the pattern as the regular expression.
12376 You must take care that backslash and dollar characters are not misinterpreted
12377 as part of the string expansion. The simplest way to do this is to use <literal>\N</literal>
12378 to mark that part of the string as non-expandable. For example:
12379 </para>
12380 <literallayout class="monospaced">
12381 deny senders = \N^.*this.*@example\.com$\N : \
12382                \N^\d{8}.+@spamhaus.example$\N : ...
12383 </literallayout>
12384 <para>
12385 The <literal>\N</literal> sequences are removed by the expansion, so these items do indeed
12386 start with <quote>^</quote> by the time they are being interpreted as address patterns.
12387 </para>
12388 </listitem>
12389 <listitem>
12390 <para>
12391 <indexterm role="concept">
12392 <primary>address list</primary>
12393 <secondary>lookup for complete address</secondary>
12394 </indexterm>
12395 Complete addresses can be looked up by using a pattern that starts with a
12396 lookup type terminated by a semicolon, followed by the data for the lookup. For
12397 example:
12398 </para>
12399 <literallayout class="monospaced">
12400 deny senders = cdb;/etc/blocked.senders : \
12401   mysql;select address from blocked where \
12402   address='${quote_mysql:$sender_address}'
12403 </literallayout>
12404 <para>
12405 Both query-style and single-key lookup types can be used. For a single-key
12406 lookup type, Exim uses the complete address as the key. However, empty keys are
12407 not supported for single-key lookups, so a match against the empty address
12408 always fails. This restriction does not apply to query-style lookups.
12409 </para>
12410 <para>
12411 Partial matching for single-key lookups (section <xref linkend="SECTpartiallookup"/>)
12412 cannot be used, and is ignored if specified, with an entry being written to the
12413 panic log.
12414 <indexterm role="concept">
12415 <primary>*@ with single-key lookup</primary>
12416 </indexterm>
12417 However, you can configure lookup defaults, as described in section
12418 <xref linkend="SECTdefaultvaluelookups"/>, but this is useful only for the <quote>*@</quote> type of
12419 default. For example, with this lookup:
12420 </para>
12421 <literallayout class="monospaced">
12422 accept senders = lsearch*@;/some/file
12423 </literallayout>
12424 <para>
12425 the file could contains lines like this:
12426 </para>
12427 <literallayout class="monospaced">
12428 user1@domain1.example
12429 *@domain2.example
12430 </literallayout>
12431 <para>
12432 and for the sender address <emphasis>nimrod@jaeger.example</emphasis>, the sequence of keys
12433 that are tried is:
12434 </para>
12435 <literallayout class="monospaced">
12436 nimrod@jaeger.example
12437 *@jaeger.example
12438 *
12439 </literallayout>
12440 <para>
12441 <emphasis role="bold">Warning 1</emphasis>: Do not include a line keyed by <quote>*</quote> in the file, because that
12442 would mean that every address matches, thus rendering the test useless.
12443 </para>
12444 <para>
12445 <emphasis role="bold">Warning 2</emphasis>: Do not confuse these two kinds of item:
12446 </para>
12447 <literallayout class="monospaced">
12448 deny recipients = dbm*@;/some/file
12449 deny recipients = *@dbm;/some/file
12450 </literallayout>
12451 <para>
12452 The first does a whole address lookup, with defaulting, as just described,
12453 because it starts with a lookup type. The second matches the local part and
12454 domain independently, as described in a bullet point below.
12455 </para>
12456 </listitem>
12457 </itemizedlist>
12458 <para>
12459 The following kinds of address list pattern can match only non-empty addresses.
12460 If the subject address is empty, a match against any of these pattern types
12461 always fails.
12462 </para>
12463 <itemizedlist>
12464 <listitem>
12465 <para>
12466 <indexterm role="concept">
12467 <primary>@@ with single-key lookup</primary>
12468 </indexterm>
12469 <indexterm role="concept">
12470 <primary>address list</primary>
12471 <secondary>@@ lookup type</secondary>
12472 </indexterm>
12473 <indexterm role="concept">
12474 <primary>address list</primary>
12475 <secondary>split local part and domain</secondary>
12476 </indexterm>
12477 If a pattern starts with <quote>@@</quote> followed by a single-key lookup item
12478 (for example, <literal>@@lsearch;/some/file</literal>), the address that is being checked is
12479 split into a local part and a domain. The domain is looked up in the file. If
12480 it is not found, there is no match. If it is found, the data that is looked up
12481 from the file is treated as a colon-separated list of local part patterns, each
12482 of which is matched against the subject local part in turn.
12483 </para>
12484 <para>
12485 <indexterm role="concept">
12486 <primary>asterisk</primary>
12487 <secondary>in address list</secondary>
12488 </indexterm>
12489 The lookup may be a partial one, and/or one involving a search for a default
12490 keyed by <quote>*</quote> (see section <xref linkend="SECTdefaultvaluelookups"/>). The local part
12491 patterns that are looked up can be regular expressions or begin with <quote>*</quote>, or
12492 even be further lookups. They may also be independently negated. For example,
12493 with
12494 </para>
12495 <literallayout class="monospaced">
12496 deny senders = @@dbm;/etc/reject-by-domain
12497 </literallayout>
12498 <para>
12499 the data from which the DBM file is built could contain lines like
12500 </para>
12501 <literallayout class="monospaced">
12502 baddomain.com:  !postmaster : *
12503 </literallayout>
12504 <para>
12505 to reject all senders except <option>postmaster</option> from that domain.
12506 </para>
12507 <para>
12508 <indexterm role="concept">
12509 <primary>local part</primary>
12510 <secondary>starting with !</secondary>
12511 </indexterm>
12512 If a local part that actually begins with an exclamation mark is required, it
12513 has to be specified using a regular expression. In <command>lsearch</command> files, an entry
12514 may be split over several lines by indenting the second and subsequent lines,
12515 but the separating colon must still be included at line breaks. White space
12516 surrounding the colons is ignored. For example:
12517 </para>
12518 <literallayout class="monospaced">
12519 aol.com:  spammer1 : spammer2 : ^[0-9]+$ :
12520 spammer3 : spammer4
12521 </literallayout>
12522 <para>
12523 As in all colon-separated lists in Exim, a colon can be included in an item by
12524 doubling.
12525 </para>
12526 <para>
12527 If the last item in the list starts with a right angle-bracket, the remainder
12528 of the item is taken as a new key to look up in order to obtain a continuation
12529 list of local parts. The new key can be any sequence of characters. Thus one
12530 might have entries like
12531 </para>
12532 <literallayout class="monospaced">
12533 aol.com: spammer1 : spammer 2 : &gt;*
12534 xyz.com: spammer3 : &gt;*
12535 *:       ^\d{8}$
12536 </literallayout>
12537 <para>
12538 in a file that was searched with <option>@@dbm*</option>, to specify a match for 8-digit
12539 local parts for all domains, in addition to the specific local parts listed for
12540 each domain. Of course, using this feature costs another lookup each time a
12541 chain is followed, but the effort needed to maintain the data is reduced.
12542 </para>
12543 <para>
12544 <indexterm role="concept">
12545 <primary>loop</primary>
12546 <secondary>in lookups</secondary>
12547 </indexterm>
12548 It is possible to construct loops using this facility, and in order to catch
12549 them, the chains may be no more than fifty items long.
12550 </para>
12551 </listitem>
12552 <listitem>
12553 <para>
12554 The @@&lt;<emphasis>lookup</emphasis>&gt; style of item can also be used with a query-style
12555 lookup, but in this case, the chaining facility is not available. The lookup
12556 can only return a single list of local parts.
12557 </para>
12558 </listitem>
12559 </itemizedlist>
12560 <para>
12561 <emphasis role="bold">Warning</emphasis>: There is an important difference between the address list items
12562 in these two examples:
12563 </para>
12564 <literallayout class="monospaced">
12565 senders = +my_list
12566 senders = *@+my_list
12567 </literallayout>
12568 <para>
12569 In the first one, <literal>my_list</literal> is a named address list, whereas in the second
12570 example it is a named domain list.
12571 </para>
12572 </section>
12573 <section id="SECTcasletadd">
12574 <title>Case of letters in address lists</title>
12575 <para>
12576 <indexterm role="concept">
12577 <primary>case of local parts</primary>
12578 </indexterm>
12579 <indexterm role="concept">
12580 <primary>address list</primary>
12581 <secondary>case forcing</secondary>
12582 </indexterm>
12583 <indexterm role="concept">
12584 <primary>case forcing in address lists</primary>
12585 </indexterm>
12586 Domains in email addresses are always handled caselessly, but for local parts
12587 case may be significant on some systems (see <option>caseful_local_part</option> for how
12588 Exim deals with this when routing addresses). However, RFC 2505 (<emphasis>Anti-Spam
12589 Recommendations for SMTP MTAs</emphasis>) suggests that matching of addresses to
12590 blocking lists should be done in a case-independent manner. Since most address
12591 lists in Exim are used for this kind of control, Exim attempts to do this by
12592 default.
12593 </para>
12594 <para>
12595 The domain portion of an address is always lowercased before matching it to an
12596 address list. The local part is lowercased by default, and any string
12597 comparisons that take place are done caselessly. This means that the data in
12598 the address list itself, in files included as plain file names, and in any file
12599 that is looked up using the <quote>@@</quote> mechanism, can be in any case. However, the
12600 keys in files that are looked up by a search type other than <command>lsearch</command> (which
12601 works caselessly) must be in lower case, because these lookups are not
12602 case-independent.
12603 </para>
12604 <para>
12605 <indexterm role="concept">
12606 <primary><literal>+caseful</literal></primary>
12607 </indexterm>
12608 To allow for the possibility of caseful address list matching, if an item in
12609 an address list is the string <quote>+caseful</quote>, the original case of the local
12610 part is restored for any comparisons that follow, and string comparisons are no
12611 longer case-independent. This does not affect the domain, which remains in
12612 lower case. However, although independent matches on the domain alone are still
12613 performed caselessly, regular expressions that match against an entire address
12614 become case-sensitive after <quote>+caseful</quote> has been seen.
12615 </para>
12616 </section>
12617 <section id="SECTlocparlis">
12618 <title>Local part lists</title>
12619 <para>
12620 <indexterm role="concept">
12621 <primary>list</primary>
12622 <secondary>local part list</secondary>
12623 </indexterm>
12624 <indexterm role="concept">
12625 <primary>local part</primary>
12626 <secondary>list</secondary>
12627 </indexterm>
12628 Case-sensitivity in local part lists is handled in the same way as for address
12629 lists, as just described. The <quote>+caseful</quote> item can be used if required. In a
12630 setting of the <option>local_parts</option> option in a router with <option>caseful_local_part</option>
12631 set false, the subject is lowercased and the matching is initially
12632 case-insensitive. In this case, <quote>+caseful</quote> will restore case-sensitive
12633 matching in the local part list, but not elsewhere in the router. If
12634 <option>caseful_local_part</option> is set true in a router, matching in the <option>local_parts</option>
12635 option is case-sensitive from the start.
12636 </para>
12637 <para>
12638 If a local part list is indirected to a file (see section <xref linkend="SECTfilnamlis"/>),
12639 comments are handled in the same way as address lists &ndash; they are recognized
12640 only if the # is preceded by white space or the start of the line.
12641 Otherwise, local part lists are matched in the same way as domain lists, except
12642 that the special items that refer to the local host (<literal>@</literal>, <literal>@[]</literal>,
12643 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal>) are not recognized.
12644 Refer to section <xref linkend="SECTdomainlist"/> for details of the other available item
12645 types.
12646 <indexterm role="concept" startref="IIDdohoadli" class="endofrange"/>
12647 </para>
12648 </section>
12649 </chapter>
12650
12651 <chapter id="CHAPexpand">
12652 <title>String expansions</title>
12653 <para>
12654 <indexterm role="concept" id="IIDstrexp" class="startofrange">
12655 <primary>expansion</primary>
12656 <secondary>of strings</secondary>
12657 </indexterm>
12658 Many strings in Exim&#x2019;s run time configuration are expanded before use. Some of
12659 them are expanded every time they are used; others are expanded only once.
12660 </para>
12661 <para>
12662 When a string is being expanded it is copied verbatim from left to right except
12663 when a dollar or backslash character is encountered. A dollar specifies the
12664 start of a portion of the string that is interpreted and replaced as described
12665 below in section <xref linkend="SECTexpansionitems"/> onwards. Backslash is used as an
12666 escape character, as described in the following section.
12667 </para>
12668 <section id="SECTlittext">
12669 <title>Literal text in expanded strings</title>
12670 <para>
12671 <indexterm role="concept">
12672 <primary>expansion</primary>
12673 <secondary>including literal text</secondary>
12674 </indexterm>
12675 An uninterpreted dollar can be included in an expanded string by putting a
12676 backslash in front of it. A backslash can be used to prevent any special
12677 character being treated specially in an expansion, including backslash itself.
12678 If the string appears in quotes in the configuration file, two backslashes are
12679 required because the quotes themselves cause interpretation of backslashes when
12680 the string is read in (see section <xref linkend="SECTstrings"/>).
12681 </para>
12682 <para>
12683 <indexterm role="concept">
12684 <primary>expansion</primary>
12685 <secondary>non-expandable substrings</secondary>
12686 </indexterm>
12687 A portion of the string can specified as non-expandable by placing it between
12688 two occurrences of <literal>\N</literal>. This is particularly useful for protecting regular
12689 expressions, which often contain backslashes and dollar signs. For example:
12690 </para>
12691 <literallayout class="monospaced">
12692 deny senders = \N^\d{8}[a-z]@some\.site\.example$\N
12693 </literallayout>
12694 <para>
12695 On encountering the first <literal>\N</literal>, the expander copies subsequent characters
12696 without interpretation until it reaches the next <literal>\N</literal> or the end of the
12697 string.
12698 </para>
12699 </section>
12700 <section id="SECID82">
12701 <title>Character escape sequences in expanded strings</title>
12702 <para>
12703 <indexterm role="concept">
12704 <primary>expansion</primary>
12705 <secondary>escape sequences</secondary>
12706 </indexterm>
12707 A backslash followed by one of the letters <quote>n</quote>, <quote>r</quote>, or <quote>t</quote> in an
12708 expanded string is recognized as an escape sequence for the character newline,
12709 carriage return, or tab, respectively. A backslash followed by up to three
12710 octal digits is recognized as an octal encoding for a single character, and a
12711 backslash followed by <quote>x</quote> and up to two hexadecimal digits is a hexadecimal
12712 encoding.
12713 </para>
12714 <para>
12715 These escape sequences are also recognized in quoted strings when they are read
12716 in. Their interpretation in expansions as well is useful for unquoted strings,
12717 and for other cases such as looked-up strings that are then expanded.
12718 </para>
12719 </section>
12720 <section id="SECID83">
12721 <title>Testing string expansions</title>
12722 <para>
12723 <indexterm role="concept">
12724 <primary>expansion</primary>
12725 <secondary>testing</secondary>
12726 </indexterm>
12727 <indexterm role="concept">
12728 <primary>testing</primary>
12729 <secondary>string expansion</secondary>
12730 </indexterm>
12731 <indexterm role="option">
12732 <primary><option>-be</option></primary>
12733 </indexterm>
12734 Many expansions can be tested by calling Exim with the <option>-be</option> option. This
12735 takes the command arguments, or lines from the standard input if there are no
12736 arguments, runs them through the string expansion code, and writes the results
12737 to the standard output. Variables based on configuration values are set up, but
12738 since no message is being processed, variables such as <varname>$local_part</varname> have no
12739 value. Nevertheless the <option>-be</option> option can be useful for checking out file and
12740 database lookups, and the use of expansion operators such as <option>sg</option>, <option>substr</option>
12741 and <option>nhash</option>.
12742 </para>
12743 <para>
12744 Exim gives up its root privilege when it is called with the <option>-be</option> option, and
12745 instead runs under the uid and gid it was called with, to prevent users from
12746 using <option>-be</option> for reading files to which they do not have access.
12747 </para>
12748 <para>
12749 <indexterm role="option">
12750 <primary><option>-bem</option></primary>
12751 </indexterm>
12752 If you want to test expansions that include variables whose values are taken
12753 from a message, there are two other options that can be used. The <option>-bem</option>
12754 option is like <option>-be</option> except that it is followed by a file name. The file is
12755 read as a message before doing the test expansions. For example:
12756 </para>
12757 <literallayout class="monospaced">
12758 exim -bem /tmp/test.message '$h_subject:'
12759 </literallayout>
12760 <para>
12761 The <option>-Mset</option> option is used in conjunction with <option>-be</option> and is followed by an
12762 Exim message identifier. For example:
12763 </para>
12764 <literallayout class="monospaced">
12765 exim -be -Mset 1GrA8W-0004WS-LQ '$recipients'
12766 </literallayout>
12767 <para>
12768 This loads the message from Exim&#x2019;s spool before doing the test expansions, and
12769 is therefore restricted to admin users.
12770 </para>
12771 </section>
12772 <section id="SECTforexpfai">
12773 <title>Forced expansion failure</title>
12774 <para>
12775 <indexterm role="concept">
12776 <primary>expansion</primary>
12777 <secondary>forced failure</secondary>
12778 </indexterm>
12779 A number of expansions that are described in the following section have
12780 alternative <quote>true</quote> and <quote>false</quote> substrings, enclosed in brace characters
12781 (which are sometimes called <quote>curly brackets</quote>). Which of the two strings is
12782 used depends on some condition that is evaluated as part of the expansion. If,
12783 instead of a <quote>false</quote> substring, the word <quote>fail</quote> is used (not in braces),
12784 the entire string expansion fails in a way that can be detected by the code
12785 that requested the expansion. This is called <quote>forced expansion failure</quote>, and
12786 its consequences depend on the circumstances. In some cases it is no different
12787 from any other expansion failure, but in others a different action may be
12788 taken. Such variations are mentioned in the documentation of the option that is
12789 being expanded.
12790 </para>
12791 </section>
12792 <section id="SECTexpansionitems">
12793 <title>Expansion items</title>
12794 <para>
12795 The following items are recognized in expanded strings. White space may be used
12796 between sub-items that are keywords or substrings enclosed in braces inside an
12797 outer set of braces, to improve readability. <emphasis role="bold">Warning</emphasis>: Within braces,
12798 white space is significant.
12799 </para>
12800 <variablelist>
12801 <varlistentry>
12802 <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>
12803 <listitem>
12804 <para>
12805 <indexterm role="concept">
12806 <primary>expansion</primary>
12807 <secondary>variables</secondary>
12808 </indexterm>
12809 Substitute the contents of the named variable, for example:
12810 </para>
12811 <literallayout class="monospaced">
12812 $local_part
12813 ${domain}
12814 </literallayout>
12815 <para>
12816 The second form can be used to separate the name from subsequent alphanumeric
12817 characters. This form (using braces) is available only for variables; it does
12818 <emphasis>not</emphasis> apply to message headers. The names of the variables are given in
12819 section <xref linkend="SECTexpvar"/> below. If the name of a non-existent variable is
12820 given, the expansion fails.
12821 </para>
12822 </listitem></varlistentry>
12823 <varlistentry>
12824 <term><emphasis role="bold">${</emphasis>&lt;<emphasis>op</emphasis>&gt;<emphasis role="bold">:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
12825 <listitem>
12826 <para>
12827 <indexterm role="concept">
12828 <primary>expansion</primary>
12829 <secondary>operators</secondary>
12830 </indexterm>
12831 The string is first itself expanded, and then the operation specified by
12832 &lt;<emphasis>op</emphasis>&gt; is applied to it. For example:
12833 </para>
12834 <literallayout class="monospaced">
12835 ${lc:$local_part}
12836 </literallayout>
12837 <para>
12838 The string starts with the first character after the colon, which may be
12839 leading white space. A list of operators is given in section <xref linkend="SECTexpop"/>
12840 below. The operator notation is used for simple expansion items that have just
12841 one argument, because it reduces the number of braces and therefore makes the
12842 string easier to understand.
12843 </para>
12844 </listitem></varlistentry>
12845 <varlistentry>
12846 <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>
12847 <listitem>
12848 <para>
12849 This item inserts <quote>basic</quote> header lines. It is described with the <option>header</option>
12850 expansion item below.
12851 </para>
12852 </listitem></varlistentry>
12853 <varlistentry>
12854 <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>
12855 <listitem>
12856 <para>
12857 <indexterm role="concept">
12858 <primary><option>dlfunc</option></primary>
12859 </indexterm>
12860 This expansion dynamically loads and then calls a locally-written C function.
12861 This functionality is available only if Exim is compiled with
12862 </para>
12863 <literallayout class="monospaced">
12864 EXPAND_DLFUNC=yes
12865 </literallayout>
12866 <para>
12867 set in <filename>Local/Makefile</filename>. Once loaded, Exim remembers the dynamically loaded
12868 object so that it doesn&#x2019;t reload the same object file in the same Exim process
12869 (but of course Exim does start new processes frequently).
12870 </para>
12871 <para>
12872 There may be from zero to eight arguments to the function. When compiling
12873 a local function that is to be called in this way, <filename>local_scan.h</filename> should be
12874 included. The Exim variables and functions that are defined by that API
12875 are also available for dynamically loaded functions. The function itself
12876 must have the following type:
12877 </para>
12878 <literallayout class="monospaced">
12879 int dlfunction(uschar **yield, int argc, uschar *argv[])
12880 </literallayout>
12881 <para>
12882 Where <literal>uschar</literal> is a typedef for <literal>unsigned char</literal> in <filename>local_scan.h</filename>. The
12883 function should return one of the following values:
12884 </para>
12885 <para>
12886 <literal>OK</literal>: Success. The string that is placed in the variable <emphasis>yield</emphasis> is put
12887 into the expanded string that is being built.
12888 </para>
12889 <para>
12890 <literal>FAIL</literal>: A non-forced expansion failure occurs, with the error message taken
12891 from <emphasis>yield</emphasis>, if it is set.
12892 </para>
12893 <para>
12894 <literal>FAIL_FORCED</literal>: A forced expansion failure occurs, with the error message
12895 taken from <emphasis>yield</emphasis> if it is set.
12896 </para>
12897 <para>
12898 <literal>ERROR</literal>: Same as <literal>FAIL</literal>, except that a panic log entry is written.
12899 </para>
12900 <para>
12901 When compiling a function that is to be used in this way with gcc,
12902 you need to add <option>-shared</option> to the gcc command. Also, in the Exim build-time
12903 configuration, you must add <option>-export-dynamic</option> to EXTRALIBS.
12904 </para>
12905 </listitem></varlistentry>
12906 <varlistentry>
12907 <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>
12908 <listitem>
12909 <para>
12910 <indexterm role="concept">
12911 <primary>expansion</primary>
12912 <secondary>extracting substrings by key</secondary>
12913 </indexterm>
12914 <indexterm role="concept">
12915 <primary><option>extract</option></primary>
12916 <secondary>substrings by key</secondary>
12917 </indexterm>
12918 The key and &lt;<emphasis>string1</emphasis>&gt; are first expanded separately. Leading and trailing
12919 white space is removed from the key (but not from any of the strings). The key
12920 must not consist entirely of digits. The expanded &lt;<emphasis>string1</emphasis>&gt; must be of the
12921 form:
12922 </para>
12923 <literallayout>
12924 &lt;<emphasis>key1</emphasis>&gt; = &lt;<emphasis>value1</emphasis>&gt;  &lt;<emphasis>key2</emphasis>&gt; = &lt;<emphasis>value2</emphasis>&gt; ...
12925 </literallayout>
12926 <para>
12927 <indexterm role="variable">
12928 <primary><varname>$value</varname></primary>
12929 </indexterm>
12930 where the equals signs and spaces (but not both) are optional. If any of the
12931 values contain white space, they must be enclosed in double quotes, and any
12932 values that are enclosed in double quotes are subject to escape processing as
12933 described in section <xref linkend="SECTstrings"/>. The expanded &lt;<emphasis>string1</emphasis>&gt; is searched
12934 for the value that corresponds to the key. The search is case-insensitive. If
12935 the key is found, &lt;<emphasis>string2</emphasis>&gt; is expanded, and replaces the whole item;
12936 otherwise &lt;<emphasis>string3</emphasis>&gt; is used. During the expansion of &lt;<emphasis>string2</emphasis>&gt; the
12937 variable <varname>$value</varname> contains the value that has been extracted. Afterwards, it
12938 is restored to any previous value it might have had.
12939 </para>
12940 <para>
12941 If {&lt;<emphasis>string3</emphasis>&gt;} is omitted, the item is replaced by an empty string if the
12942 key is not found. If {&lt;<emphasis>string2</emphasis>&gt;} is also omitted, the value that was
12943 extracted is used. Thus, for example, these two expansions are identical, and
12944 yield <quote>2001</quote>:
12945 </para>
12946 <literallayout class="monospaced">
12947 ${extract{gid}{uid=1984 gid=2001}}
12948 ${extract{gid}{uid=1984 gid=2001}{$value}}
12949 </literallayout>
12950 <para>
12951 Instead of {&lt;<emphasis>string3</emphasis>&gt;} the word <quote>fail</quote> (not in curly brackets) can
12952 appear, for example:
12953 </para>
12954 <literallayout class="monospaced">
12955 ${extract{Z}{A=... B=...}{$value} fail }
12956 </literallayout>
12957 <para>
12958 This forces an expansion failure (see section <xref linkend="SECTforexpfai"/>);
12959 {&lt;<emphasis>string2</emphasis>&gt;} must be present for <quote>fail</quote> to be recognized.
12960 </para>
12961 </listitem></varlistentry>
12962 <varlistentry>
12963 <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>
12964 <listitem>
12965 <para>
12966 <indexterm role="concept">
12967 <primary>expansion</primary>
12968 <secondary>extracting substrings by number</secondary>
12969 </indexterm>
12970 <indexterm role="concept">
12971 <primary><option>extract</option></primary>
12972 <secondary>substrings by number</secondary>
12973 </indexterm>
12974 The &lt;<emphasis>number</emphasis>&gt; argument must consist entirely of decimal digits,
12975 apart from leading and trailing white space, which is ignored.
12976 This is what distinguishes this form of <option>extract</option> from the previous kind. It
12977 behaves in the same way, except that, instead of extracting a named field, it
12978 extracts from &lt;<emphasis>string1</emphasis>&gt; the field whose number is given as the first
12979 argument. You can use <varname>$value</varname> in &lt;<emphasis>string2</emphasis>&gt; or <literal>fail</literal> instead of
12980 &lt;<emphasis>string3</emphasis>&gt; as before.
12981 </para>
12982 <para>
12983 The fields in the string are separated by any one of the characters in the
12984 separator string. These may include space or tab characters.
12985 The first field is numbered one. If the number is negative, the fields are
12986 counted from the end of the string, with the rightmost one numbered -1. If the
12987 number given is zero, the entire string is returned. If the modulus of the
12988 number is greater than the number of fields in the string, the result is the
12989 expansion of &lt;<emphasis>string3</emphasis>&gt;, or the empty string if &lt;<emphasis>string3</emphasis>&gt; is not
12990 provided. For example:
12991 </para>
12992 <literallayout class="monospaced">
12993 ${extract{2}{:}{x:42:99:&amp; Mailer::/bin/bash}}
12994 </literallayout>
12995 <para>
12996 yields <quote>42</quote>, and
12997 </para>
12998 <literallayout class="monospaced">
12999 ${extract{-4}{:}{x:42:99:&amp; Mailer::/bin/bash}}
13000 </literallayout>
13001 <para>
13002 yields <quote>99</quote>. Two successive separators mean that the field between them is
13003 empty (for example, the fifth field above).
13004 </para>
13005 </listitem></varlistentry>
13006 <varlistentry>
13007 <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>
13008 <listitem>
13009 <para>
13010 <indexterm role="concept">
13011 <primary>list</primary>
13012 <secondary>selecting by condition</secondary>
13013 </indexterm>
13014 <indexterm role="concept">
13015 <primary>expansion</primary>
13016 <secondary>selecting from list by condition</secondary>
13017 </indexterm>
13018 <indexterm role="variable">
13019 <primary><varname>$item</varname></primary>
13020 </indexterm>
13021 After expansion, &lt;<emphasis>string</emphasis>&gt; is interpreted as a list, colon-separated by
13022 default, but the separator can be changed in the usual way. For each item
13023 in this list, its value is place in <varname>$item</varname>, and then the condition is
13024 evaluated. If the condition is true, <varname>$item</varname> is added to the output as an
13025 item in a new list; if the condition is false, the item is discarded. The
13026 separator used for the output list is the same as the one used for the
13027 input, but a separator setting is not included in the output. For example:
13028 </para>
13029 <literallayout class="monospaced">
13030 ${filter{a:b:c}{!eq{$item}{b}}
13031 </literallayout>
13032 <para>
13033 yields <literal>a:c</literal>. At the end of the expansion, the value of <varname>$item</varname> is restored
13034 to what it was before. See also the <emphasis role="bold">map</emphasis> and <emphasis role="bold">reduce</emphasis> expansion items.
13035 </para>
13036 </listitem></varlistentry>
13037 <varlistentry>
13038 <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>
13039 <listitem>
13040 <para>
13041 <indexterm role="concept">
13042 <primary>hash function</primary>
13043 <secondary>textual</secondary>
13044 </indexterm>
13045 <indexterm role="concept">
13046 <primary>expansion</primary>
13047 <secondary>textual hash</secondary>
13048 </indexterm>
13049 This is a textual hashing function, and was the first to be implemented in
13050 early versions of Exim. In current releases, there are other hashing functions
13051 (numeric, MD5, and SHA-1), which are described below.
13052 </para>
13053 <para>
13054 The first two strings, after expansion, must be numbers. Call them &lt;<emphasis>m</emphasis>&gt; and
13055 &lt;<emphasis>n</emphasis>&gt;. If you are using fixed values for these numbers, that is, if
13056 &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you can
13057 use the simpler operator notation that avoids some of the braces:
13058 </para>
13059 <literallayout class="monospaced">
13060 ${hash_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
13061 </literallayout>
13062 <para>
13063 The second number is optional (in both notations). If &lt;<emphasis>n</emphasis>&gt; is greater than
13064 or equal to the length of the string, the expansion item returns the string.
13065 Otherwise it computes a new string of length &lt;<emphasis>n</emphasis>&gt; by applying a hashing
13066 function to the string. The new string consists of characters taken from the
13067 first &lt;<emphasis>m</emphasis>&gt; characters of the string
13068 </para>
13069 <literallayout class="monospaced">
13070 abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQWRSTUVWXYZ0123456789
13071 </literallayout>
13072 <para>
13073 If &lt;<emphasis>m</emphasis>&gt; is not present the value 26 is used, so that only lower case
13074 letters appear. For example:
13075 </para>
13076 <literallayout>
13077 <literal>$hash{3}{monty}}           </literal>   yields  <literal>jmg</literal>
13078 <literal>$hash{5}{monty}}           </literal>   yields  <literal>monty</literal>
13079 <literal>$hash{4}{62}{monty python}}</literal>   yields  <literal>fbWx</literal>
13080 </literallayout>
13081 </listitem></varlistentry>
13082 <varlistentry>
13083 <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>
13084 <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>
13085 <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>
13086 <listitem>
13087 <para>
13088 <indexterm role="concept">
13089 <primary>expansion</primary>
13090 <secondary>header insertion</secondary>
13091 </indexterm>
13092 <indexterm role="variable">
13093 <primary><varname>$header_</varname></primary>
13094 </indexterm>
13095 <indexterm role="variable">
13096 <primary><varname>$bheader_</varname></primary>
13097 </indexterm>
13098 <indexterm role="variable">
13099 <primary><varname>$rheader_</varname></primary>
13100 </indexterm>
13101 <indexterm role="concept">
13102 <primary>header lines</primary>
13103 <secondary>in expansion strings</secondary>
13104 </indexterm>
13105 <indexterm role="concept">
13106 <primary>header lines</primary>
13107 <secondary>character sets</secondary>
13108 </indexterm>
13109 <indexterm role="concept">
13110 <primary>header lines</primary>
13111 <secondary>decoding</secondary>
13112 </indexterm>
13113 Substitute the contents of the named message header line, for example
13114 </para>
13115 <literallayout class="monospaced">
13116 $header_reply-to:
13117 </literallayout>
13118 <para>
13119 The newline that terminates a header line is not included in the expansion, but
13120 internal newlines (caused by splitting the header line over several physical
13121 lines) may be present.
13122 </para>
13123 <para>
13124 The difference between <option>rheader</option>, <option>bheader</option>, and <option>header</option> is in the way
13125 the data in the header line is interpreted.
13126 </para>
13127 <itemizedlist>
13128 <listitem>
13129 <para>
13130 <indexterm role="concept">
13131 <primary>white space</primary>
13132 <secondary>in header lines</secondary>
13133 </indexterm>
13134 <option>rheader</option> gives the original <quote>raw</quote> content of the header line, with no
13135 processing at all, and without the removal of leading and trailing white space.
13136 </para>
13137 </listitem>
13138 <listitem>
13139 <para>
13140 <indexterm role="concept">
13141 <primary>base64 encoding</primary>
13142 <secondary>in header lines</secondary>
13143 </indexterm>
13144 <option>bheader</option> removes leading and trailing white space, and then decodes base64
13145 or quoted-printable MIME <quote>words</quote> within the header text, but does no
13146 character set translation. If decoding of what looks superficially like a MIME
13147 <quote>word</quote> fails, the raw string is returned. If decoding
13148 <indexterm role="concept">
13149 <primary>binary zero</primary>
13150 <secondary>in header line</secondary>
13151 </indexterm>
13152 produces a binary zero character, it is replaced by a question mark &ndash; this is
13153 what Exim does for binary zeros that are actually received in header lines.
13154 </para>
13155 </listitem>
13156 <listitem>
13157 <para>
13158 <option>header</option> tries to translate the string as decoded by <option>bheader</option> to a
13159 standard character set. This is an attempt to produce the same string as would
13160 be displayed on a user&#x2019;s MUA. If translation fails, the <option>bheader</option> string is
13161 returned. Translation is attempted only on operating systems that support the
13162 <function>iconv()</function> function. This is indicated by the compile-time macro HAVE_ICONV in
13163 a system Makefile or in <filename>Local/Makefile</filename>.
13164 </para>
13165 </listitem>
13166 </itemizedlist>
13167 <para>
13168 In a filter file, the target character set for <option>header</option> can be specified by a
13169 command of the following form:
13170 </para>
13171 <literallayout class="monospaced">
13172 headers charset "UTF-8"
13173 </literallayout>
13174 <para>
13175 This command affects all references to <varname>$h_</varname> (or <varname>$header_</varname>) expansions in
13176 subsequently obeyed filter commands. In the absence of this command, the target
13177 character set in a filter is taken from the setting of the <option>headers_charset</option>
13178 option in the runtime configuration. The value of this option defaults to the
13179 value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The ultimate default is
13180 ISO-8859-1.
13181 </para>
13182 <para>
13183 Header names follow the syntax of RFC 2822, which states that they may contain
13184 any printing characters except space and colon. Consequently, curly brackets
13185 <emphasis>do not</emphasis> terminate header names, and should not be used to enclose them as
13186 if they were variables. Attempting to do so causes a syntax error.
13187 </para>
13188 <para>
13189 Only header lines that are common to all copies of a message are visible to
13190 this mechanism. These are the original header lines that are received with the
13191 message, and any that are added by an ACL statement or by a system
13192 filter. Header lines that are added to a particular copy of a message by a
13193 router or transport are not accessible.
13194 </para>
13195 <para>
13196 For incoming SMTP messages, no header lines are visible in ACLs that are obeyed
13197 before the DATA ACL, because the header structure is not set up until the
13198 message is received. Header lines that are added in a RCPT ACL (for example)
13199 are saved until the message&#x2019;s incoming header lines are available, at which
13200 point they are added. When a DATA ACL is running, however, header lines added
13201 by earlier ACLs are visible.
13202 </para>
13203 <para>
13204 Upper case and lower case letters are synonymous in header names. If the
13205 following character is white space, the terminating colon may be omitted, but
13206 this is not recommended, because you may then forget it when it is needed. When
13207 white space terminates the header name, it is included in the expanded string.
13208 If the message does not contain the given header, the expansion item is
13209 replaced by an empty string. (See the <option>def</option> condition in section
13210 <xref linkend="SECTexpcond"/> for a means of testing for the existence of a header.)
13211 </para>
13212 <para>
13213 If there is more than one header with the same name, they are all concatenated
13214 to form the substitution string, up to a maximum length of 64K. Unless
13215 <option>rheader</option> is being used, leading and trailing white space is removed from
13216 each header before concatenation, and a completely empty header is ignored. A
13217 newline character is then inserted between non-empty headers, but there is no
13218 newline at the very end. For the <option>header</option> and <option>bheader</option> expansion, for
13219 those headers that contain lists of addresses, a comma is also inserted at the
13220 junctions between headers. This does not happen for the <option>rheader</option> expansion.
13221 </para>
13222 </listitem></varlistentry>
13223 <varlistentry>
13224 <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>
13225 <listitem>
13226 <para>
13227 <indexterm role="concept">
13228 <primary>expansion</primary>
13229 <secondary>hmac hashing</secondary>
13230 </indexterm>
13231 <indexterm role="concept">
13232 <primary><option>hmac</option></primary>
13233 </indexterm>
13234 This function uses cryptographic hashing (either MD5 or SHA-1) to convert a
13235 shared secret and some text into a message authentication code, as specified in
13236 RFC 2104. This differs from <literal>${md5:secret_text...}</literal> or
13237 <literal>${sha1:secret_text...}</literal> in that the hmac step adds a signature to the
13238 cryptographic hash, allowing for authentication that is not possible with MD5
13239 or SHA-1 alone. The hash name must expand to either <literal>md5</literal> or <literal>sha1</literal> at
13240 present. For example:
13241 </para>
13242 <literallayout class="monospaced">
13243 ${hmac{md5}{somesecret}{$primary_hostname $tod_log}}
13244 </literallayout>
13245 <para>
13246 For the hostname <emphasis>mail.example.com</emphasis> and time 2002-10-17 11:30:59, this
13247 produces:
13248 </para>
13249 <literallayout class="monospaced">
13250 dd97e3ba5d1a61b5006108f8c8252953
13251 </literallayout>
13252 <para>
13253 As an example of how this might be used, you might put in the main part of
13254 an Exim configuration:
13255 </para>
13256 <literallayout class="monospaced">
13257 SPAMSCAN_SECRET=cohgheeLei2thahw
13258 </literallayout>
13259 <para>
13260 In a router or a transport you could then have:
13261 </para>
13262 <literallayout class="monospaced">
13263 headers_add = \
13264   X-Spam-Scanned: ${primary_hostname} ${message_exim_id} \
13265   ${hmac{md5}{SPAMSCAN_SECRET}\
13266   {${primary_hostname},${message_exim_id},$h_message-id:}}
13267 </literallayout>
13268 <para>
13269 Then given a message, you can check where it was scanned by looking at the
13270 <emphasis>X-Spam-Scanned:</emphasis> header line. If you know the secret, you can check that
13271 this header line is authentic by recomputing the authentication code from the
13272 host name, message ID and the <emphasis>Message-id:</emphasis> header line. This can be done
13273 using Exim&#x2019;s <option>-be</option> option, or by other means, for example by using the
13274 <emphasis>hmac_md5_hex()</emphasis> function in Perl.
13275 </para>
13276 </listitem></varlistentry>
13277 <varlistentry>
13278 <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>
13279 <listitem>
13280 <para>
13281 <indexterm role="concept">
13282 <primary>expansion</primary>
13283 <secondary>conditional</secondary>
13284 </indexterm>
13285 <indexterm role="concept">
13286 <primary><option>if</option>, expansion item</primary>
13287 </indexterm>
13288 If &lt;<emphasis>condition</emphasis>&gt; is true, &lt;<emphasis>string1</emphasis>&gt; is expanded and replaces the whole
13289 item; otherwise &lt;<emphasis>string2</emphasis>&gt; is used. The available conditions are described
13290 in section <xref linkend="SECTexpcond"/> below. For example:
13291 </para>
13292 <literallayout class="monospaced">
13293 ${if eq {$local_part}{postmaster} {yes}{no} }
13294 </literallayout>
13295 <para>
13296 The second string need not be present; if it is not and the condition is not
13297 true, the item is replaced with nothing. Alternatively, the word <quote>fail</quote> may
13298 be present instead of the second string (without any curly brackets). In this
13299 case, the expansion is forced to fail if the condition is not true (see section
13300 <xref linkend="SECTforexpfai"/>).
13301 </para>
13302 <para>
13303 If both strings are omitted, the result is the string <literal>true</literal> if the condition
13304 is true, and the empty string if the condition is false. This makes it less
13305 cumbersome to write custom ACL and router conditions. For example, instead of
13306 </para>
13307 <literallayout class="monospaced">
13308 condition = ${if &gt;{$acl_m4}{3}{true}{false}}
13309 </literallayout>
13310 <para>
13311 you can use
13312 </para>
13313 <literallayout class="monospaced">
13314 condition = ${if &gt;{$acl_m4}{3}}
13315 </literallayout>
13316 </listitem></varlistentry>
13317 <varlistentry>
13318 <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>
13319 <listitem>
13320 <para>
13321 <indexterm role="concept">
13322 <primary>expansion</primary>
13323 <secondary>string truncation</secondary>
13324 </indexterm>
13325 <indexterm role="concept">
13326 <primary><option>length</option> expansion item</primary>
13327 </indexterm>
13328 The <option>length</option> item is used to extract the initial portion of a string. Both
13329 strings are expanded, and the first one must yield a number, &lt;<emphasis>n</emphasis>&gt;, say. If
13330 you are using a fixed value for the number, that is, if &lt;<emphasis>string1</emphasis>&gt; does not
13331 change when expanded, you can use the simpler operator notation that avoids
13332 some of the braces:
13333 </para>
13334 <literallayout class="monospaced">
13335 ${length_&lt;n&gt;:&lt;string&gt;}
13336 </literallayout>
13337 <para>
13338 The result of this item is either the first &lt;<emphasis>n</emphasis>&gt; characters or the whole
13339 of &lt;<emphasis>string2</emphasis>&gt;, whichever is the shorter. Do not confuse <option>length</option> with
13340 <option>strlen</option>, which gives the length of a string.
13341 </para>
13342 </listitem></varlistentry>
13343 <varlistentry>
13344 <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>
13345 <listitem>
13346 <para>
13347 This is the first of one of two different types of lookup item, which are both
13348 described in the next item.
13349 </para>
13350 </listitem></varlistentry>
13351 <varlistentry>
13352 <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>
13353 <listitem>
13354 <para>
13355 <indexterm role="concept">
13356 <primary>expansion</primary>
13357 <secondary>lookup in</secondary>
13358 </indexterm>
13359 <indexterm role="concept">
13360 <primary>file</primary>
13361 <secondary>lookups</secondary>
13362 </indexterm>
13363 <indexterm role="concept">
13364 <primary>lookup</primary>
13365 <secondary>in expanded string</secondary>
13366 </indexterm>
13367 The two forms of lookup item specify data lookups in files and databases, as
13368 discussed in chapter <xref linkend="CHAPfdlookup"/>. The first form is used for single-key
13369 lookups, and the second is used for query-style lookups. The &lt;<emphasis>key</emphasis>&gt;,
13370 &lt;<emphasis>file</emphasis>&gt;, and &lt;<emphasis>query</emphasis>&gt; strings are expanded before use.
13371 </para>
13372 <para>
13373 If there is any white space in a lookup item which is part of a filter command,
13374 a retry or rewrite rule, a routing rule for the <command>manualroute</command> router, or any
13375 other place where white space is significant, the lookup item must be enclosed
13376 in double quotes. The use of data lookups in users&#x2019; filter files may be locked
13377 out by the system administrator.
13378 </para>
13379 <para>
13380 <indexterm role="variable">
13381 <primary><varname>$value</varname></primary>
13382 </indexterm>
13383 If the lookup succeeds, &lt;<emphasis>string1</emphasis>&gt; is expanded and replaces the entire item.
13384 During its expansion, the variable <varname>$value</varname> contains the data returned by the
13385 lookup. Afterwards it reverts to the value it had previously (at the outer
13386 level it is empty). If the lookup fails, &lt;<emphasis>string2</emphasis>&gt; is expanded and replaces
13387 the entire item. If {&lt;<emphasis>string2</emphasis>&gt;} is omitted, the replacement is the empty
13388 string on failure. If &lt;<emphasis>string2</emphasis>&gt; is provided, it can itself be a nested
13389 lookup, thus providing a mechanism for looking up a default value when the
13390 original lookup fails.
13391 </para>
13392 <para>
13393 If a nested lookup is used as part of &lt;<emphasis>string1</emphasis>&gt;, <varname>$value</varname> contains the
13394 data for the outer lookup while the parameters of the second lookup are
13395 expanded, and also while &lt;<emphasis>string2</emphasis>&gt; of the second lookup is expanded, should
13396 the second lookup fail. Instead of {&lt;<emphasis>string2</emphasis>&gt;} the word <quote>fail</quote> can
13397 appear, and in this case, if the lookup fails, the entire expansion is forced
13398 to fail (see section <xref linkend="SECTforexpfai"/>). If both {&lt;<emphasis>string1</emphasis>&gt;} and
13399 {&lt;<emphasis>string2</emphasis>&gt;} are omitted, the result is the looked up value in the case of a
13400 successful lookup, and nothing in the case of failure.
13401 </para>
13402 <para>
13403 For single-key lookups, the string <quote>partial</quote> is permitted to precede the
13404 search type in order to do partial matching, and * or *@ may follow a search
13405 type to request default lookups if the key does not match (see sections
13406 <xref linkend="SECTdefaultvaluelookups"/> and <xref linkend="SECTpartiallookup"/> for details).
13407 </para>
13408 <para>
13409 <indexterm role="concept">
13410 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
13411 <secondary>in lookup expansion</secondary>
13412 </indexterm>
13413 If a partial search is used, the variables <varname>$1</varname> and <varname>$2</varname> contain the wild
13414 and non-wild parts of the key during the expansion of the replacement text.
13415 They return to their previous values at the end of the lookup item.
13416 </para>
13417 <para>
13418 This example looks up the postmaster alias in the conventional alias file:
13419 </para>
13420 <literallayout class="monospaced">
13421 ${lookup {postmaster} lsearch {/etc/aliases} {$value}}
13422 </literallayout>
13423 <para>
13424 This example uses NIS+ to look up the full name of the user corresponding to
13425 the local part of an address, forcing the expansion to fail if it is not found:
13426 </para>
13427 <literallayout class="monospaced">
13428 ${lookup nisplus {[name=$local_part],passwd.org_dir:gcos} \
13429   {$value}fail}
13430 </literallayout>
13431 </listitem></varlistentry>
13432 <varlistentry>
13433 <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>
13434 <listitem>
13435 <para>
13436 <indexterm role="concept">
13437 <primary>expansion</primary>
13438 <secondary>list creation</secondary>
13439 </indexterm>
13440 <indexterm role="variable">
13441 <primary><varname>$item</varname></primary>
13442 </indexterm>
13443 After expansion, &lt;<emphasis>string1</emphasis>&gt; is interpreted as a list, colon-separated by
13444 default, but the separator can be changed in the usual way. For each item
13445 in this list, its value is place in <varname>$item</varname>, and then &lt;<emphasis>string2</emphasis>&gt; is
13446 expanded and added to the output as an item in a new list. The separator used
13447 for the output list is the same as the one used for the input, but a separator
13448 setting is not included in the output. For example:
13449 </para>
13450 <literallayout class="monospaced">
13451 ${map{a:b:c}{[$item]}} ${map{&lt;- x-y-z}{($item)}}
13452 </literallayout>
13453 <para>
13454 expands to <literal>[a]:[b]:[c] (x)-(y)-(z)</literal>. At the end of the expansion, the
13455 value of <varname>$item</varname> is restored to what it was before. See also the <emphasis role="bold">filter</emphasis>
13456 and <emphasis role="bold">reduce</emphasis> expansion items.
13457 </para>
13458 </listitem></varlistentry>
13459 <varlistentry>
13460 <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>
13461 <listitem>
13462 <para>
13463 <indexterm role="concept">
13464 <primary>expansion</primary>
13465 <secondary>numeric hash</secondary>
13466 </indexterm>
13467 <indexterm role="concept">
13468 <primary>hash function</primary>
13469 <secondary>numeric</secondary>
13470 </indexterm>
13471 The three strings are expanded; the first two must yield numbers. Call them
13472 &lt;<emphasis>n</emphasis>&gt; and &lt;<emphasis>m</emphasis>&gt;. If you are using fixed values for these numbers, that is,
13473 if &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you
13474 can use the simpler operator notation that avoids some of the braces:
13475 </para>
13476 <literallayout class="monospaced">
13477 ${nhash_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
13478 </literallayout>
13479 <para>
13480 The second number is optional (in both notations). If there is only one number,
13481 the result is a number in the range 0&ndash;&lt;<emphasis>n</emphasis>&gt;-1. Otherwise, the string is
13482 processed by a div/mod hash function that returns two numbers, separated by a
13483 slash, in the ranges 0 to &lt;<emphasis>n</emphasis>&gt;-1 and 0 to &lt;<emphasis>m</emphasis>&gt;-1, respectively. For
13484 example,
13485 </para>
13486 <literallayout class="monospaced">
13487 ${nhash{8}{64}{supercalifragilisticexpialidocious}}
13488 </literallayout>
13489 <para>
13490 returns the string <quote>6/33</quote>.
13491 </para>
13492 </listitem></varlistentry>
13493 <varlistentry>
13494 <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>
13495 <listitem>
13496 <para>
13497 <indexterm role="concept">
13498 <primary>Perl</primary>
13499 <secondary>use in expanded string</secondary>
13500 </indexterm>
13501 <indexterm role="concept">
13502 <primary>expansion</primary>
13503 <secondary>calling Perl from</secondary>
13504 </indexterm>
13505 This item is available only if Exim has been built to include an embedded Perl
13506 interpreter. The subroutine name and the arguments are first separately
13507 expanded, and then the Perl subroutine is called with those arguments. No
13508 additional arguments need be given; the maximum number permitted, including the
13509 name of the subroutine, is nine.
13510 </para>
13511 <para>
13512 The return value of the subroutine is inserted into the expanded string, unless
13513 the return value is <option>undef</option>. In that case, the expansion fails in the same
13514 way as an explicit <quote>fail</quote> on a lookup item. The return value is a scalar.
13515 Whatever you return is evaluated in a scalar context. For example, if you
13516 return the name of a Perl vector, the return value is the size of the vector,
13517 not its contents.
13518 </para>
13519 <para>
13520 If the subroutine exits by calling Perl&#x2019;s <option>die</option> function, the expansion fails
13521 with the error message that was passed to <option>die</option>. More details of the embedded
13522 Perl facility are given in chapter <xref linkend="CHAPperl"/>.
13523 </para>
13524 <para>
13525 The <command>redirect</command> router has an option called <option>forbid_filter_perl</option> which locks
13526 out the use of this expansion item in filter files.
13527 </para>
13528 </listitem></varlistentry>
13529 <varlistentry>
13530 <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>
13531 <listitem>
13532 <para>
13533 <indexterm role="concept">
13534 <primary><option>prvs</option> expansion item</primary>
13535 </indexterm>
13536 The first argument is a complete email address and the second is secret
13537 keystring. The third argument, specifying a key number, is optional. If absent,
13538 it defaults to 0. The result of the expansion is a prvs-signed email address,
13539 to be typically used with the <option>return_path</option> option on an <command>smtp</command> transport
13540 as part of a bounce address tag validation (BATV) scheme. For more discussion
13541 and an example, see section <xref linkend="SECTverifyPRVS"/>.
13542 </para>
13543 </listitem></varlistentry>
13544 <varlistentry>
13545 <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>
13546 <listitem>
13547 <para>
13548 <indexterm role="concept">
13549 <primary><option>prvscheck</option> expansion item</primary>
13550 </indexterm>
13551 This expansion item is the complement of the <option>prvs</option> item. It is used for
13552 checking prvs-signed addresses. If the expansion of the first argument does not
13553 yield a syntactically valid prvs-signed address, the whole item expands to the
13554 empty string. When the first argument does expand to a syntactically valid
13555 prvs-signed address, the second argument is expanded, with the prvs-decoded
13556 version of the address and the key number extracted from the address in the
13557 variables <varname>$prvscheck_address</varname> and <varname>$prvscheck_keynum</varname>, respectively.
13558 </para>
13559 <para>
13560 These two variables can be used in the expansion of the second argument to
13561 retrieve the secret. The validity of the prvs-signed address is then checked
13562 against the secret. The result is stored in the variable <varname>$prvscheck_result</varname>,
13563 which is empty for failure or <quote>1</quote> for success.
13564 </para>
13565 <para>
13566 The third argument is optional; if it is missing, it defaults to an empty
13567 string. This argument is now expanded. If the result is an empty string, the
13568 result of the expansion is the decoded version of the address. This is the case
13569 whether or not the signature was valid. Otherwise, the result of the expansion
13570 is the expansion of the third argument.
13571 </para>
13572 <para>
13573 All three variables can be used in the expansion of the third argument.
13574 However, once the expansion is complete, only <varname>$prvscheck_result</varname> remains set.
13575 For more discussion and an example, see section <xref linkend="SECTverifyPRVS"/>.
13576 </para>
13577 </listitem></varlistentry>
13578 <varlistentry>
13579 <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>
13580 <listitem>
13581 <para>
13582 <indexterm role="concept">
13583 <primary>expansion</primary>
13584 <secondary>inserting an entire file</secondary>
13585 </indexterm>
13586 <indexterm role="concept">
13587 <primary>file</primary>
13588 <secondary>inserting into expansion</secondary>
13589 </indexterm>
13590 <indexterm role="concept">
13591 <primary><option>readfile</option> expansion item</primary>
13592 </indexterm>
13593 The file name and end-of-line string are first expanded separately. The file is
13594 then read, and its contents replace the entire item. All newline characters in
13595 the file are replaced by the end-of-line string if it is present. Otherwise,
13596 newlines are left in the string.
13597 String expansion is not applied to the contents of the file. If you want this,
13598 you must wrap the item in an <option>expand</option> operator. If the file cannot be read,
13599 the string expansion fails.
13600 </para>
13601 <para>
13602 The <command>redirect</command> router has an option called <option>forbid_filter_readfile</option> which
13603 locks out the use of this expansion item in filter files.
13604 </para>
13605 </listitem></varlistentry>
13606 <varlistentry>
13607 <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>
13608 <listitem>
13609 <para>
13610 <indexterm role="concept">
13611 <primary>expansion</primary>
13612 <secondary>inserting from a socket</secondary>
13613 </indexterm>
13614 <indexterm role="concept">
13615 <primary>socket, use of in expansion</primary>
13616 </indexterm>
13617 <indexterm role="concept">
13618 <primary><option>readsocket</option> expansion item</primary>
13619 </indexterm>
13620 This item inserts data from a Unix domain or Internet socket into the expanded
13621 string. The minimal way of using it uses just two arguments, as in these
13622 examples:
13623 </para>
13624 <literallayout class="monospaced">
13625 ${readsocket{/socket/name}{request string}}
13626 ${readsocket{inet:some.host:1234}{request string}}
13627 </literallayout>
13628 <para>
13629 For a Unix domain socket, the first substring must be the path to the socket.
13630 For an Internet socket, the first substring must contain <literal>inet:</literal> followed by
13631 a host name or IP address, followed by a colon and a port, which can be a
13632 number or the name of a TCP port in <filename>/etc/services</filename>. An IP address may
13633 optionally be enclosed in square brackets. This is best for IPv6 addresses. For
13634 example:
13635 </para>
13636 <literallayout class="monospaced">
13637 ${readsocket{inet:[::1]:1234}{request string}}
13638 </literallayout>
13639 <para>
13640 Only a single host name may be given, but if looking it up yields more than
13641 one IP address, they are each tried in turn until a connection is made. For
13642 both kinds of socket, Exim makes a connection, writes the request string
13643 (unless it is an empty string) and reads from the socket until an end-of-file
13644 is read. A timeout of 5 seconds is applied. Additional, optional arguments
13645 extend what can be done. Firstly, you can vary the timeout. For example:
13646 </para>
13647 <literallayout class="monospaced">
13648 ${readsocket{/socket/name}{request string}{3s}}
13649 </literallayout>
13650 <para>
13651 A fourth argument allows you to change any newlines that are in the data
13652 that is read, in the same way as for <option>readfile</option> (see above). This example
13653 turns them into spaces:
13654 </para>
13655 <literallayout class="monospaced">
13656 ${readsocket{inet:127.0.0.1:3294}{request string}{3s}{ }}
13657 </literallayout>
13658 <para>
13659 As with all expansions, the substrings are expanded before the processing
13660 happens. Errors in these sub-expansions cause the expansion to fail. In
13661 addition, the following errors can occur:
13662 </para>
13663 <itemizedlist>
13664 <listitem>
13665 <para>
13666 Failure to create a socket file descriptor;
13667 </para>
13668 </listitem>
13669 <listitem>
13670 <para>
13671 Failure to connect the socket;
13672 </para>
13673 </listitem>
13674 <listitem>
13675 <para>
13676 Failure to write the request string;
13677 </para>
13678 </listitem>
13679 <listitem>
13680 <para>
13681 Timeout on reading from the socket.
13682 </para>
13683 </listitem>
13684 </itemizedlist>
13685 <para>
13686 By default, any of these errors causes the expansion to fail. However, if
13687 you supply a fifth substring, it is expanded and used when any of the above
13688 errors occurs. For example:
13689 </para>
13690 <literallayout class="monospaced">
13691 ${readsocket{/socket/name}{request string}{3s}{\n}\
13692   {socket failure}}
13693 </literallayout>
13694 <para>
13695 You can test for the existence of a Unix domain socket by wrapping this
13696 expansion in <literal>${if exists</literal>, but there is a race condition between that test
13697 and the actual opening of the socket, so it is safer to use the fifth argument
13698 if you want to be absolutely sure of avoiding an expansion error for a
13699 non-existent Unix domain socket, or a failure to connect to an Internet socket.
13700 </para>
13701 <para>
13702 The <command>redirect</command> router has an option called <option>forbid_filter_readsocket</option> which
13703 locks out the use of this expansion item in filter files.
13704 </para>
13705 </listitem></varlistentry>
13706 <varlistentry>
13707 <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>
13708 <listitem>
13709 <para>
13710 <indexterm role="concept">
13711 <primary>expansion</primary>
13712 <secondary>reducing a list to a scalar</secondary>
13713 </indexterm>
13714 <indexterm role="concept">
13715 <primary>list</primary>
13716 <secondary>reducing to a scalar</secondary>
13717 </indexterm>
13718 <indexterm role="variable">
13719 <primary><varname>$value</varname></primary>
13720 </indexterm>
13721 <indexterm role="variable">
13722 <primary><varname>$item</varname></primary>
13723 </indexterm>
13724 This operation reduces a list to a single, scalar string. After expansion,
13725 &lt;<emphasis>string1</emphasis>&gt; is interpreted as a list, colon-separated by default, but the
13726 separator can be changed in the usual way. Then &lt;<emphasis>string2</emphasis>&gt; is expanded and
13727 assigned to the <varname>$value</varname> variable. After this, each item in the &lt;<emphasis>string1</emphasis>&gt;
13728 list is assigned to <varname>$item</varname> in turn, and &lt;<emphasis>string3</emphasis>&gt; is expanded for each of
13729 them. The result of that expansion is assigned to <varname>$value</varname> before the next
13730 iteration. When the end of the list is reached, the final value of <varname>$value</varname> is
13731 added to the expansion output. The <emphasis role="bold">reduce</emphasis> expansion item can be used in a
13732 number of ways. For example, to add up a list of numbers:
13733 </para>
13734 <literallayout class="monospaced">
13735 ${reduce {&lt;, 1,2,3}{0}{${eval:$value+$item}}}
13736 </literallayout>
13737 <para>
13738 The result of that expansion would be <literal>6</literal>. The maximum of a list of numbers
13739 can be found:
13740 </para>
13741 <literallayout class="monospaced">
13742 ${reduce {3:0:9:4:6}{0}{${if &gt;{$item}{$value}{$item}{$value}}}}
13743 </literallayout>
13744 <para>
13745 At the end of a <emphasis role="bold">reduce</emphasis> expansion, the values of <varname>$item</varname> and <varname>$value</varname> are
13746 restored to what they were before. See also the <emphasis role="bold">filter</emphasis> and <emphasis role="bold">map</emphasis>
13747 expansion items.
13748 </para>
13749 </listitem></varlistentry>
13750 <varlistentry>
13751 <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>
13752 <listitem>
13753 <para>
13754 This item inserts <quote>raw</quote> header lines. It is described with the <option>header</option>
13755 expansion item above.
13756 </para>
13757 </listitem></varlistentry>
13758 <varlistentry>
13759 <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>
13760 <listitem>
13761 <para>
13762 <indexterm role="concept">
13763 <primary>expansion</primary>
13764 <secondary>running a command</secondary>
13765 </indexterm>
13766 <indexterm role="concept">
13767 <primary><option>run</option> expansion item</primary>
13768 </indexterm>
13769 The command and its arguments are first expanded separately, and then the
13770 command is run in a separate process, but under the same uid and gid. As in
13771 other command executions from Exim, a shell is not used by default. If you want
13772 a shell, you must explicitly code it.
13773 </para>
13774 <para>
13775 The standard input for the command exists, but is empty. The standard output
13776 and standard error are set to the same file descriptor.
13777 <indexterm role="concept">
13778 <primary>return code</primary>
13779 <secondary>from <option>run</option> expansion</secondary>
13780 </indexterm>
13781 <indexterm role="variable">
13782 <primary><varname>$value</varname></primary>
13783 </indexterm>
13784 If the command succeeds (gives a zero return code) &lt;<emphasis>string1</emphasis>&gt; is expanded
13785 and replaces the entire item; during this expansion, the standard output/error
13786 from the command is in the variable <varname>$value</varname>. If the command fails,
13787 &lt;<emphasis>string2</emphasis>&gt;, if present, is expanded and used. Once again, during the
13788 expansion, the standard output/error from the command is in the variable
13789 <varname>$value</varname>.
13790 </para>
13791 <para>
13792 If &lt;<emphasis>string2</emphasis>&gt; is absent, the result is empty. Alternatively, &lt;<emphasis>string2</emphasis>&gt;
13793 can be the word <quote>fail</quote> (not in braces) to force expansion failure if the
13794 command does not succeed. If both strings are omitted, the result is contents
13795 of the standard output/error on success, and nothing on failure.
13796 </para>
13797 <para>
13798 <indexterm role="variable">
13799 <primary><varname>$runrc</varname></primary>
13800 </indexterm>
13801 The return code from the command is put in the variable <varname>$runrc</varname>, and this
13802 remains set afterwards, so in a filter file you can do things like this:
13803 </para>
13804 <literallayout class="monospaced">
13805 if "${run{x y z}{}}$runrc" is 1 then ...
13806   elif $runrc is 2 then ...
13807   ...
13808 endif
13809 </literallayout>
13810 <para>
13811 If execution of the command fails (for example, the command does not exist),
13812 the return code is 127 &ndash; the same code that shells use for non-existent
13813 commands.
13814 </para>
13815 <para>
13816 <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot assume the order in which
13817 option values are expanded, except for those preconditions whose order of
13818 testing is documented. Therefore, you cannot reliably expect to set <varname>$runrc</varname>
13819 by the expansion of one option, and use it in another.
13820 </para>
13821 <para>
13822 The <command>redirect</command> router has an option called <option>forbid_filter_run</option> which locks
13823 out the use of this expansion item in filter files.
13824 </para>
13825 </listitem></varlistentry>
13826 <varlistentry>
13827 <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>
13828 <listitem>
13829 <para>
13830 <indexterm role="concept">
13831 <primary>expansion</primary>
13832 <secondary>string substitution</secondary>
13833 </indexterm>
13834 <indexterm role="concept">
13835 <primary><option>sg</option> expansion item</primary>
13836 </indexterm>
13837 This item works like Perl&#x2019;s substitution operator (s) with the global (/g)
13838 option; hence its name. However, unlike the Perl equivalent, Exim does not
13839 modify the subject string; instead it returns the modified string for insertion
13840 into the overall expansion. The item takes three arguments: the subject string,
13841 a regular expression, and a substitution string. For example:
13842 </para>
13843 <literallayout class="monospaced">
13844 ${sg{abcdefabcdef}{abc}{xyz}}
13845 </literallayout>
13846 <para>
13847 yields <quote>xyzdefxyzdef</quote>. Because all three arguments are expanded before use,
13848 if any $ or \ characters are required in the regular expression or in the
13849 substitution string, they have to be escaped. For example:
13850 </para>
13851 <literallayout class="monospaced">
13852 ${sg{abcdef}{^(...)(...)\$}{\$2\$1}}
13853 </literallayout>
13854 <para>
13855 yields <quote>defabc</quote>, and
13856 </para>
13857 <literallayout class="monospaced">
13858 ${sg{1=A 4=D 3=C}{\N(\d+)=\N}{K\$1=}}
13859 </literallayout>
13860 <para>
13861 yields <quote>K1=A K4=D K3=C</quote>. Note the use of <literal>\N</literal> to protect the contents of
13862 the regular expression from string expansion.
13863 </para>
13864 </listitem></varlistentry>
13865 <varlistentry>
13866 <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>
13867 <listitem>
13868 <para>
13869 <indexterm role="concept">
13870 <primary><option>substr</option> expansion item</primary>
13871 </indexterm>
13872 <indexterm role="concept">
13873 <primary>substring extraction</primary>
13874 </indexterm>
13875 <indexterm role="concept">
13876 <primary>expansion</primary>
13877 <secondary>substring extraction</secondary>
13878 </indexterm>
13879 The three strings are expanded; the first two must yield numbers. Call them
13880 &lt;<emphasis>n</emphasis>&gt; and &lt;<emphasis>m</emphasis>&gt;. If you are using fixed values for these numbers, that is,
13881 if &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you
13882 can use the simpler operator notation that avoids some of the braces:
13883 </para>
13884 <literallayout class="monospaced">
13885 ${substr_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
13886 </literallayout>
13887 <para>
13888 The second number is optional (in both notations).
13889 If it is absent in the simpler format, the preceding underscore must also be
13890 omitted.
13891 </para>
13892 <para>
13893 The <option>substr</option> item can be used to extract more general substrings than
13894 <option>length</option>. The first number, &lt;<emphasis>n</emphasis>&gt;, is a starting offset, and &lt;<emphasis>m</emphasis>&gt; is the
13895 length required. For example
13896 </para>
13897 <literallayout class="monospaced">
13898 ${substr{3}{2}{$local_part}}
13899 </literallayout>
13900 <para>
13901 If the starting offset is greater than the string length the result is the
13902 null string; if the length plus starting offset is greater than the string
13903 length, the result is the right-hand part of the string, starting from the
13904 given offset. The first character in the string has offset zero.
13905 </para>
13906 <para>
13907 The <option>substr</option> expansion item can take negative offset values to count
13908 from the right-hand end of its operand. The last character is offset -1, the
13909 second-last is offset -2, and so on. Thus, for example,
13910 </para>
13911 <literallayout class="monospaced">
13912 ${substr{-5}{2}{1234567}}
13913 </literallayout>
13914 <para>
13915 yields <quote>34</quote>. If the absolute value of a negative offset is greater than the
13916 length of the string, the substring starts at the beginning of the string, and
13917 the length is reduced by the amount of overshoot. Thus, for example,
13918 </para>
13919 <literallayout class="monospaced">
13920 ${substr{-5}{2}{12}}
13921 </literallayout>
13922 <para>
13923 yields an empty string, but
13924 </para>
13925 <literallayout class="monospaced">
13926 ${substr{-3}{2}{12}}
13927 </literallayout>
13928 <para>
13929 yields <quote>1</quote>.
13930 </para>
13931 <para>
13932 When the second number is omitted from <option>substr</option>, the remainder of the string
13933 is taken if the offset is positive. If it is negative, all characters in the
13934 string preceding the offset point are taken. For example, an offset of -1 and
13935 no length, as in these semantically identical examples:
13936 </para>
13937 <literallayout class="monospaced">
13938 ${substr_-1:abcde}
13939 ${substr{-1}{abcde}}
13940 </literallayout>
13941 <para>
13942 yields all but the last character of the string, that is, <quote>abcd</quote>.
13943 </para>
13944 </listitem></varlistentry>
13945 <varlistentry>
13946 <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>
13947 <listitem>
13948 <para>
13949 <indexterm role="concept">
13950 <primary>expansion</primary>
13951 <secondary>character translation</secondary>
13952 </indexterm>
13953 <indexterm role="concept">
13954 <primary><option>tr</option> expansion item</primary>
13955 </indexterm>
13956 This item does single-character translation on its subject string. The second
13957 argument is a list of characters to be translated in the subject string. Each
13958 matching character is replaced by the corresponding character from the
13959 replacement list. For example
13960 </para>
13961 <literallayout class="monospaced">
13962 ${tr{abcdea}{ac}{13}}
13963 </literallayout>
13964 <para>
13965 yields <literal>1b3de1</literal>. If there are duplicates in the second character string, the
13966 last occurrence is used. If the third string is shorter than the second, its
13967 last character is replicated. However, if it is empty, no translation takes
13968 place.
13969 </para>
13970 </listitem></varlistentry>
13971 </variablelist>
13972 </section>
13973 <section id="SECTexpop">
13974 <title>Expansion operators</title>
13975 <para>
13976 <indexterm role="concept">
13977 <primary>expansion</primary>
13978 <secondary>operators</secondary>
13979 </indexterm>
13980 For expansion items that perform transformations on a single argument string,
13981 the <quote>operator</quote> notation is used because it is simpler and uses fewer braces.
13982 The substring is first expanded before the operation is applied to it. The
13983 following operations can be performed:
13984 </para>
13985 <variablelist>
13986 <varlistentry>
13987 <term><emphasis role="bold">${address:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13988 <listitem>
13989 <para>
13990 <indexterm role="concept">
13991 <primary>expansion</primary>
13992 <secondary>RFC 2822 address handling</secondary>
13993 </indexterm>
13994 <indexterm role="concept">
13995 <primary><option>address</option> expansion item</primary>
13996 </indexterm>
13997 The string is interpreted as an RFC 2822 address, as it might appear in a
13998 header line, and the effective address is extracted from it. If the string does
13999 not parse successfully, the result is empty.
14000 </para>
14001 </listitem></varlistentry>
14002 <varlistentry>
14003 <term><emphasis role="bold">${addresses:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14004 <listitem>
14005 <para>
14006 <indexterm role="concept">
14007 <primary>expansion</primary>
14008 <secondary>RFC 2822 address handling</secondary>
14009 </indexterm>
14010 <indexterm role="concept">
14011 <primary><option>addresses</option> expansion item</primary>
14012 </indexterm>
14013 The string (after expansion) is interpreted as a list of addresses in RFC
14014 2822 format, such as can be found in a <emphasis>To:</emphasis> or <emphasis>Cc:</emphasis> header line. The
14015 operative address (<emphasis>local-part@domain</emphasis>) is extracted from each item, and the
14016 result of the expansion is a colon-separated list, with appropriate
14017 doubling of colons should any happen to be present in the email addresses.
14018 Syntactically invalid RFC2822 address items are omitted from the output.
14019 </para>
14020 <para>
14021 It is possible to specify a character other than colon for the output
14022 separator by starting the string with &gt; followed by the new separator
14023 character. For example:
14024 </para>
14025 <literallayout class="monospaced">
14026 ${addresses:&gt;&amp; Chief &lt;ceo@up.stairs&gt;, sec@base.ment (dogsbody)}
14027 </literallayout>
14028 <para>
14029 expands to <literal>ceo@up.stairs&amp;sec@base.ment</literal>. Compare the <emphasis role="bold">address</emphasis> (singular)
14030 expansion item, which extracts the working address from a single RFC2822
14031 address. See the <emphasis role="bold">filter</emphasis>, <emphasis role="bold">map</emphasis>, and <emphasis role="bold">reduce</emphasis> items for ways of
14032 processing lists.
14033 </para>
14034 </listitem></varlistentry>
14035 <varlistentry>
14036 <term><emphasis role="bold">${base62:</emphasis>&lt;<emphasis>digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14037 <listitem>
14038 <para>
14039 <indexterm role="concept">
14040 <primary><option>base62</option> expansion item</primary>
14041 </indexterm>
14042 <indexterm role="concept">
14043 <primary>expansion</primary>
14044 <secondary>conversion to base 62</secondary>
14045 </indexterm>
14046 The string must consist entirely of decimal digits. The number is converted to
14047 base 62 and output as a string of six characters, including leading zeros. In
14048 the few operating environments where Exim uses base 36 instead of base 62 for
14049 its message identifiers (because those systems do not have case-sensitive file
14050 names), base 36 is used by this operator, despite its name. <emphasis role="bold">Note</emphasis>: Just to
14051 be absolutely clear: this is <emphasis>not</emphasis> base64 encoding.
14052 </para>
14053 </listitem></varlistentry>
14054 <varlistentry>
14055 <term><emphasis role="bold">${base62d:</emphasis>&lt;<emphasis>base-62&nbsp;digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14056 <listitem>
14057 <para>
14058 <indexterm role="concept">
14059 <primary><option>base62d</option> expansion item</primary>
14060 </indexterm>
14061 <indexterm role="concept">
14062 <primary>expansion</primary>
14063 <secondary>conversion to base 62</secondary>
14064 </indexterm>
14065 The string must consist entirely of base-62 digits, or, in operating
14066 environments where Exim uses base 36 instead of base 62 for its message
14067 identifiers, base-36 digits. The number is converted to decimal and output as a
14068 string.
14069 </para>
14070 </listitem></varlistentry>
14071 <varlistentry>
14072 <term><emphasis role="bold">${domain:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14073 <listitem>
14074 <para>
14075 <indexterm role="concept">
14076 <primary>domain</primary>
14077 <secondary>extraction</secondary>
14078 </indexterm>
14079 <indexterm role="concept">
14080 <primary>expansion</primary>
14081 <secondary>domain extraction</secondary>
14082 </indexterm>
14083 The string is interpreted as an RFC 2822 address and the domain is extracted
14084 from it. If the string does not parse successfully, the result is empty.
14085 </para>
14086 </listitem></varlistentry>
14087 <varlistentry>
14088 <term><emphasis role="bold">${escape:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14089 <listitem>
14090 <para>
14091 <indexterm role="concept">
14092 <primary>expansion</primary>
14093 <secondary>escaping non-printing characters</secondary>
14094 </indexterm>
14095 <indexterm role="concept">
14096 <primary><option>escape</option> expansion item</primary>
14097 </indexterm>
14098 If the string contains any non-printing characters, they are converted to
14099 escape sequences starting with a backslash. Whether characters with the most
14100 significant bit set (so-called <quote>8-bit characters</quote>) count as printing or not
14101 is controlled by the <option>print_topbitchars</option> option.
14102 </para>
14103 </listitem></varlistentry>
14104 <varlistentry>
14105 <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>
14106 <listitem>
14107 <para>
14108 <indexterm role="concept">
14109 <primary>expansion</primary>
14110 <secondary>expression evaluation</secondary>
14111 </indexterm>
14112 <indexterm role="concept">
14113 <primary>expansion</primary>
14114 <secondary>arithmetic expression</secondary>
14115 </indexterm>
14116 <indexterm role="concept">
14117 <primary><option>eval</option> expansion item</primary>
14118 </indexterm>
14119 These items supports simple arithmetic and bitwise logical operations in
14120 expansion strings. The string (after expansion) must be a conventional
14121 arithmetic expression, but it is limited to basic arithmetic operators, bitwise
14122 logical operators, and parentheses. All operations are carried out using
14123 integer arithmetic. The operator priorities are as follows (the same as in the
14124 C programming language):
14125 </para>
14126 <informaltable frame="none">
14127 <tgroup cols="2" colsep="0" rowsep="0">
14128 <colspec colwidth="70pt" align="left"/>
14129 <colspec colwidth="300pt" align="left"/>
14130 <tbody>
14131 <row>
14132 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>highest:</emphasis></entry>
14133 <entry>not (~), negate (-)</entry>
14134 </row>
14135 <row>
14136 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
14137 <entry>multiply (*), divide (/), remainder (%)</entry>
14138 </row>
14139 <row>
14140 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
14141 <entry>plus (+), minus (-)</entry>
14142 </row>
14143 <row>
14144 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
14145 <entry>shift-left (&lt;&lt;), shift-right (&gt;&gt;)</entry>
14146 </row>
14147 <row>
14148 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
14149 <entry>and (&amp;)</entry>
14150 </row>
14151 <row>
14152 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
14153 <entry>xor (^)</entry>
14154 </row>
14155 <row>
14156 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>lowest:</emphasis></entry>
14157 <entry>or (|)</entry>
14158 </row>
14159 </tbody>
14160 </tgroup>
14161 </informaltable>
14162 <para>
14163 Binary operators with the same priority are evaluated from left to right. White
14164 space is permitted before or after operators.
14165 </para>
14166 <para>
14167 For <option>eval</option>, numbers may be decimal, octal (starting with <quote>0</quote>) or
14168 hexadecimal (starting with <quote>0x</quote>). For <option>eval10</option>, all numbers are taken as
14169 decimal, even if they start with a leading zero; hexadecimal numbers are not
14170 permitted. This can be useful when processing numbers extracted from dates or
14171 times, which often do have leading zeros.
14172 </para>
14173 <para>
14174 A number may be followed by <quote>K</quote> or <quote>M</quote> to multiply it by 1024 or 1024*1024,
14175 respectively. Negative numbers are supported. The result of the computation is
14176 a decimal representation of the answer (without <quote>K</quote> or <quote>M</quote>). For example:
14177 </para>
14178 <literallayout>
14179 <literal>${eval:1+1}            </literal>  yields 2
14180 <literal>${eval:1+2*3}          </literal>  yields 7
14181 <literal>${eval:(1+2)*3}        </literal>  yields 9
14182 <literal>${eval:2+42%5}         </literal>  yields 4
14183 <literal>${eval:0xc&amp;5}          </literal>  yields 4
14184 <literal>${eval:0xc|5}          </literal>  yields 13
14185 <literal>${eval:0xc^5}          </literal>  yields 9
14186 <literal>${eval:0xc&gt;&gt;1}         </literal>  yields 6
14187 <literal>${eval:0xc&lt;&lt;1}         </literal>  yields 24
14188 <literal>${eval:~255&amp;0x1234}    </literal>  yields 4608
14189 <literal>${eval:-(~255&amp;0x1234)} </literal>  yields -4608
14190 </literallayout>
14191 <para>
14192 As a more realistic example, in an ACL you might have
14193 </para>
14194 <literallayout class="monospaced">
14195 deny   message = Too many bad recipients
14196        condition =                    \
14197          ${if and {                   \
14198            {&gt;{$rcpt_count}{10}}       \
14199            {                          \
14200            &lt;                          \
14201              {$recipients_count}      \
14202              {${eval:$rcpt_count/2}}  \
14203            }                          \
14204          }{yes}{no}}
14205 </literallayout>
14206 <para>
14207 The condition is true if there have been more than 10 RCPT commands and
14208 fewer than half of them have resulted in a valid recipient.
14209 </para>
14210 </listitem></varlistentry>
14211 <varlistentry>
14212 <term><emphasis role="bold">${expand:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14213 <listitem>
14214 <para>
14215 <indexterm role="concept">
14216 <primary>expansion</primary>
14217 <secondary>re-expansion of substring</secondary>
14218 </indexterm>
14219 The <option>expand</option> operator causes a string to be expanded for a second time. For
14220 example,
14221 </para>
14222 <literallayout class="monospaced">
14223 ${expand:${lookup{$domain}dbm{/some/file}{$value}}}
14224 </literallayout>
14225 <para>
14226 first looks up a string in a file while expanding the operand for <option>expand</option>,
14227 and then re-expands what it has found.
14228 </para>
14229 </listitem></varlistentry>
14230 <varlistentry>
14231 <term><emphasis role="bold">${from_utf8:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14232 <listitem>
14233 <para>
14234 <indexterm role="concept">
14235 <primary>Unicode</primary>
14236 </indexterm>
14237 <indexterm role="concept">
14238 <primary>UTF-8</primary>
14239 <secondary>conversion from</secondary>
14240 </indexterm>
14241 <indexterm role="concept">
14242 <primary>expansion</primary>
14243 <secondary>UTF-8 conversion</secondary>
14244 </indexterm>
14245 <indexterm role="concept">
14246 <primary><option>from_utf8</option> expansion item</primary>
14247 </indexterm>
14248 The world is slowly moving towards Unicode, although there are no standards for
14249 email yet. However, other applications (including some databases) are starting
14250 to store data in Unicode, using UTF-8 encoding. This operator converts from a
14251 UTF-8 string to an ISO-8859-1 string. UTF-8 code values greater than 255 are
14252 converted to underscores. The input must be a valid UTF-8 string. If it is not,
14253 the result is an undefined sequence of bytes.
14254 </para>
14255 <para>
14256 Unicode code points with values less than 256 are compatible with ASCII and
14257 ISO-8859-1 (also known as Latin-1).
14258 For example, character 169 is the copyright symbol in both cases, though the
14259 way it is encoded is different. In UTF-8, more than one byte is needed for
14260 characters with code values greater than 127, whereas ISO-8859-1 is a
14261 single-byte encoding (but thereby limited to 256 characters). This makes
14262 translation from UTF-8 to ISO-8859-1 straightforward.
14263 </para>
14264 </listitem></varlistentry>
14265 <varlistentry>
14266 <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>
14267 <listitem>
14268 <para>
14269 <indexterm role="concept">
14270 <primary>hash function</primary>
14271 <secondary>textual</secondary>
14272 </indexterm>
14273 <indexterm role="concept">
14274 <primary>expansion</primary>
14275 <secondary>textual hash</secondary>
14276 </indexterm>
14277 The <option>hash</option> operator is a simpler interface to the hashing function that can
14278 be used when the two parameters are fixed numbers (as opposed to strings that
14279 change when expanded). The effect is the same as
14280 </para>
14281 <literallayout class="monospaced">
14282 ${hash{&lt;n&gt;}{&lt;m&gt;}{&lt;string&gt;}}
14283 </literallayout>
14284 <para>
14285 See the description of the general <option>hash</option> item above for details. The
14286 abbreviation <option>h</option> can be used when <option>hash</option> is used as an operator.
14287 </para>
14288 </listitem></varlistentry>
14289 <varlistentry>
14290 <term><emphasis role="bold">${hex2b64:</emphasis>&lt;<emphasis>hexstring</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14291 <listitem>
14292 <para>
14293 <indexterm role="concept">
14294 <primary>base64 encoding</primary>
14295 <secondary>conversion from hex</secondary>
14296 </indexterm>
14297 <indexterm role="concept">
14298 <primary>expansion</primary>
14299 <secondary>hex to base64</secondary>
14300 </indexterm>
14301 <indexterm role="concept">
14302 <primary><option>hex2b64</option> expansion item</primary>
14303 </indexterm>
14304 This operator converts a hex string into one that is base64 encoded. This can
14305 be useful for processing the output of the MD5 and SHA-1 hashing functions.
14306 </para>
14307 </listitem></varlistentry>
14308 <varlistentry>
14309 <term><emphasis role="bold">${lc:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14310 <listitem>
14311 <para>
14312 <indexterm role="concept">
14313 <primary>case forcing in strings</primary>
14314 </indexterm>
14315 <indexterm role="concept">
14316 <primary>string</primary>
14317 <secondary>case forcing</secondary>
14318 </indexterm>
14319 <indexterm role="concept">
14320 <primary>lower casing</primary>
14321 </indexterm>
14322 <indexterm role="concept">
14323 <primary>expansion</primary>
14324 <secondary>case forcing</secondary>
14325 </indexterm>
14326 <indexterm role="concept">
14327 <primary><option>lc</option> expansion item</primary>
14328 </indexterm>
14329 This forces the letters in the string into lower-case, for example:
14330 </para>
14331 <literallayout class="monospaced">
14332 ${lc:$local_part}
14333 </literallayout>
14334 </listitem></varlistentry>
14335 <varlistentry>
14336 <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>
14337 <listitem>
14338 <para>
14339 <indexterm role="concept">
14340 <primary>expansion</primary>
14341 <secondary>string truncation</secondary>
14342 </indexterm>
14343 <indexterm role="concept">
14344 <primary><option>length</option> expansion item</primary>
14345 </indexterm>
14346 The <option>length</option> operator is a simpler interface to the <option>length</option> function that
14347 can be used when the parameter is a fixed number (as opposed to a string that
14348 changes when expanded). The effect is the same as
14349 </para>
14350 <literallayout class="monospaced">
14351 ${length{&lt;number&gt;}{&lt;string&gt;}}
14352 </literallayout>
14353 <para>
14354 See the description of the general <option>length</option> item above for details. Note that
14355 <option>length</option> is not the same as <option>strlen</option>. The abbreviation <option>l</option> can be used
14356 when <option>length</option> is used as an operator.
14357 </para>
14358 </listitem></varlistentry>
14359 <varlistentry>
14360 <term><emphasis role="bold">${local_part:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14361 <listitem>
14362 <para>
14363 <indexterm role="concept">
14364 <primary>expansion</primary>
14365 <secondary>local part extraction</secondary>
14366 </indexterm>
14367 <indexterm role="concept">
14368 <primary><option>local_part</option> expansion item</primary>
14369 </indexterm>
14370 The string is interpreted as an RFC 2822 address and the local part is
14371 extracted from it. If the string does not parse successfully, the result is
14372 empty.
14373 </para>
14374 </listitem></varlistentry>
14375 <varlistentry>
14376 <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>
14377 <listitem>
14378 <para>
14379 <indexterm role="concept">
14380 <primary>masked IP address</primary>
14381 </indexterm>
14382 <indexterm role="concept">
14383 <primary>IP address</primary>
14384 <secondary>masking</secondary>
14385 </indexterm>
14386 <indexterm role="concept">
14387 <primary>CIDR notation</primary>
14388 </indexterm>
14389 <indexterm role="concept">
14390 <primary>expansion</primary>
14391 <secondary>IP address masking</secondary>
14392 </indexterm>
14393 <indexterm role="concept">
14394 <primary><option>mask</option> expansion item</primary>
14395 </indexterm>
14396 If the form of the string to be operated on is not an IP address followed by a
14397 slash and an integer (that is, a network address in CIDR notation), the
14398 expansion fails. Otherwise, this operator converts the IP address to binary,
14399 masks off the least significant bits according to the bit count, and converts
14400 the result back to text, with mask appended. For example,
14401 </para>
14402 <literallayout class="monospaced">
14403 ${mask:10.111.131.206/28}
14404 </literallayout>
14405 <para>
14406 returns the string <quote>10.111.131.192/28</quote>. Since this operation is expected to
14407 be mostly used for looking up masked addresses in files, the result for an IPv6
14408 address uses dots to separate components instead of colons, because colon
14409 terminates a key string in lsearch files. So, for example,
14410 </para>
14411 <literallayout class="monospaced">
14412 ${mask:3ffe:ffff:836f:0a00:000a:0800:200a:c031/99}
14413 </literallayout>
14414 <para>
14415 returns the string
14416 </para>
14417 <literallayout class="monospaced">
14418 3ffe.ffff.836f.0a00.000a.0800.2000.0000/99
14419 </literallayout>
14420 <para>
14421 Letters in IPv6 addresses are always output in lower case.
14422 </para>
14423 </listitem></varlistentry>
14424 <varlistentry>
14425 <term><emphasis role="bold">${md5:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14426 <listitem>
14427 <para>
14428 <indexterm role="concept">
14429 <primary>MD5 hash</primary>
14430 </indexterm>
14431 <indexterm role="concept">
14432 <primary>expansion</primary>
14433 <secondary>MD5 hash</secondary>
14434 </indexterm>
14435 <indexterm role="concept">
14436 <primary><option>md5</option> expansion item</primary>
14437 </indexterm>
14438 The <option>md5</option> operator computes the MD5 hash value of the string, and returns it
14439 as a 32-digit hexadecimal number, in which any letters are in lower case.
14440 </para>
14441 </listitem></varlistentry>
14442 <varlistentry>
14443 <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>
14444 <listitem>
14445 <para>
14446 <indexterm role="concept">
14447 <primary>expansion</primary>
14448 <secondary>numeric hash</secondary>
14449 </indexterm>
14450 <indexterm role="concept">
14451 <primary>hash function</primary>
14452 <secondary>numeric</secondary>
14453 </indexterm>
14454 The <option>nhash</option> operator is a simpler interface to the numeric hashing function
14455 that can be used when the two parameters are fixed numbers (as opposed to
14456 strings that change when expanded). The effect is the same as
14457 </para>
14458 <literallayout class="monospaced">
14459 ${nhash{&lt;n&gt;}{&lt;m&gt;}{&lt;string&gt;}}
14460 </literallayout>
14461 <para>
14462 See the description of the general <option>nhash</option> item above for details.
14463 </para>
14464 </listitem></varlistentry>
14465 <varlistentry>
14466 <term><emphasis role="bold">${quote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14467 <listitem>
14468 <para>
14469 <indexterm role="concept">
14470 <primary>quoting</primary>
14471 <secondary>in string expansions</secondary>
14472 </indexterm>
14473 <indexterm role="concept">
14474 <primary>expansion</primary>
14475 <secondary>quoting</secondary>
14476 </indexterm>
14477 <indexterm role="concept">
14478 <primary><option>quote</option> expansion item</primary>
14479 </indexterm>
14480 The <option>quote</option> operator puts its argument into double quotes if it
14481 is an empty string or
14482 contains anything other than letters, digits, underscores, dots, and hyphens.
14483 Any occurrences of double quotes and backslashes are escaped with a backslash.
14484 Newlines and carriage returns are converted to <literal>\n</literal> and <literal>\r</literal>,
14485 respectively For example,
14486 </para>
14487 <literallayout class="monospaced">
14488 ${quote:ab"*"cd}
14489 </literallayout>
14490 <para>
14491 becomes
14492 </para>
14493 <literallayout class="monospaced">
14494 "ab\"*\"cd"
14495 </literallayout>
14496 <para>
14497 The place where this is useful is when the argument is a substitution from a
14498 variable or a message header.
14499 </para>
14500 </listitem></varlistentry>
14501 <varlistentry>
14502 <term><emphasis role="bold">${quote_local_part:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14503 <listitem>
14504 <para>
14505 <indexterm role="concept">
14506 <primary><option>quote_local_part</option> expansion item</primary>
14507 </indexterm>
14508 This operator is like <option>quote</option>, except that it quotes the string only if
14509 required to do so by the rules of RFC 2822 for quoting local parts. For
14510 example, a plus sign would not cause quoting (but it would for <option>quote</option>).
14511 If you are creating a new email address from the contents of <varname>$local_part</varname>
14512 (or any other unknown data), you should always use this operator.
14513 </para>
14514 </listitem></varlistentry>
14515 <varlistentry>
14516 <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>
14517 <listitem>
14518 <para>
14519 <indexterm role="concept">
14520 <primary>quoting</primary>
14521 <secondary>lookup-specific</secondary>
14522 </indexterm>
14523 This operator applies lookup-specific quoting rules to the string. Each
14524 query-style lookup type has its own quoting rules which are described with
14525 the lookups in chapter <xref linkend="CHAPfdlookup"/>. For example,
14526 </para>
14527 <literallayout class="monospaced">
14528 ${quote_ldap:two * two}
14529 </literallayout>
14530 <para>
14531 returns
14532 </para>
14533 <literallayout class="monospaced">
14534 two%20%5C2A%20two
14535 </literallayout>
14536 <para>
14537 For single-key lookup types, no quoting is ever necessary and this operator
14538 yields an unchanged string.
14539 </para>
14540 </listitem></varlistentry>
14541 <varlistentry>
14542 <term><emphasis role="bold">${randint:</emphasis>&lt;<emphasis>n</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14543 <listitem>
14544 <para>
14545 <indexterm role="concept">
14546 <primary>random number</primary>
14547 </indexterm>
14548 This operator returns a somewhat random number which is less than the
14549 supplied number and is at least 0.  The quality of this randomness depends
14550 on how Exim was built; the values are not suitable for keying material.
14551 If Exim is linked against OpenSSL then RAND_pseudo_bytes() is used.
14552 Otherwise, the implementation may be arc4random(), random() seeded by
14553 srandomdev() or srandom(), or a custom implementation even weaker than
14554 random().
14555 </para>
14556 </listitem></varlistentry>
14557 <varlistentry revisionflag="changed">
14558 <term><emphasis role="bold">${reverse_ip:</emphasis>&lt;<emphasis>ipaddr</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14559 <listitem>
14560 <para revisionflag="changed">
14561 <indexterm role="concept">
14562 <primary>expansion</primary>
14563 <secondary>IP address</secondary>
14564 </indexterm>
14565 This operator reverses an IP address; for IPv4 addresses, the result is in
14566 dotted-quad decimal form, while for IPv6 addreses the result is in
14567 dotted-nibble hexadecimal form.  In both cases, this is the "natural" form
14568 for DNS.  For example,
14569 </para>
14570 <literallayout class="monospaced" revisionflag="changed">
14571 ${reverse_ip:192.0.2.4} and ${reverse_ip:2001:0db8:c42:9:1:abcd:192.0.2.3}
14572 </literallayout>
14573 <para revisionflag="changed">
14574 returns
14575 </para>
14576 <literallayout class="monospaced" revisionflag="changed">
14577 4.2.0.192 and 3.0.2.0.0.0.0.c.d.c.b.a.1.0.0.0.9.0.0.0.2.4.c.0.8.b.d.0.1.0.0.2
14578 </literallayout>
14579 </listitem></varlistentry>
14580 <varlistentry>
14581 <term><emphasis role="bold">${rfc2047:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14582 <listitem>
14583 <para>
14584 <indexterm role="concept">
14585 <primary>expansion</primary>
14586 <secondary>RFC 2047</secondary>
14587 </indexterm>
14588 <indexterm role="concept">
14589 <primary>RFC 2047</primary>
14590 <secondary>expansion operator</secondary>
14591 </indexterm>
14592 <indexterm role="concept">
14593 <primary><option>rfc2047</option> expansion item</primary>
14594 </indexterm>
14595 This operator encodes text according to the rules of RFC 2047. This is an
14596 encoding that is used in header lines to encode non-ASCII characters. It is
14597 assumed that the input string is in the encoding specified by the
14598 <option>headers_charset</option> option, which defaults to ISO-8859-1. If the string
14599 contains only characters in the range 33&ndash;126, and no instances of the
14600 characters
14601 </para>
14602 <literallayout class="monospaced">
14603 ? = ( ) &lt; &gt; @ , ; : \ " . [ ] _
14604 </literallayout>
14605 <para>
14606 it is not modified. Otherwise, the result is the RFC 2047 encoding of the
14607 string, using as many <quote>encoded words</quote> as necessary to encode all the
14608 characters.
14609 </para>
14610 </listitem></varlistentry>
14611 <varlistentry>
14612 <term><emphasis role="bold">${rfc2047d:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14613 <listitem>
14614 <para>
14615 <indexterm role="concept">
14616 <primary>expansion</primary>
14617 <secondary>RFC 2047</secondary>
14618 </indexterm>
14619 <indexterm role="concept">
14620 <primary>RFC 2047</primary>
14621 <secondary>decoding</secondary>
14622 </indexterm>
14623 <indexterm role="concept">
14624 <primary><option>rfc2047d</option> expansion item</primary>
14625 </indexterm>
14626 This operator decodes strings that are encoded as per RFC 2047. Binary zero
14627 bytes are replaced by question marks. Characters are converted into the
14628 character set defined by <option>headers_charset</option>. Overlong RFC 2047 <quote>words</quote> are
14629 not recognized unless <option>check_rfc2047_length</option> is set false.
14630 </para>
14631 <para>
14632 <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
14633 access a header line, RFC 2047 decoding is done automatically. You do not need
14634 to use this operator as well.
14635 </para>
14636 </listitem></varlistentry>
14637 <varlistentry>
14638 <term><emphasis role="bold">${rxquote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14639 <listitem>
14640 <para>
14641 <indexterm role="concept">
14642 <primary>quoting</primary>
14643 <secondary>in regular expressions</secondary>
14644 </indexterm>
14645 <indexterm role="concept">
14646 <primary>regular expressions</primary>
14647 <secondary>quoting</secondary>
14648 </indexterm>
14649 <indexterm role="concept">
14650 <primary><option>rxquote</option> expansion item</primary>
14651 </indexterm>
14652 The <option>rxquote</option> operator inserts a backslash before any non-alphanumeric
14653 characters in its argument. This is useful when substituting the values of
14654 variables or headers inside regular expressions.
14655 </para>
14656 </listitem></varlistentry>
14657 <varlistentry>
14658 <term><emphasis role="bold">${sha1:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14659 <listitem>
14660 <para>
14661 <indexterm role="concept">
14662 <primary>SHA-1 hash</primary>
14663 </indexterm>
14664 <indexterm role="concept">
14665 <primary>expansion</primary>
14666 <secondary>SHA-1 hashing</secondary>
14667 </indexterm>
14668 <indexterm role="concept">
14669 <primary><option>sha2</option> expansion item</primary>
14670 </indexterm>
14671 The <option>sha1</option> operator computes the SHA-1 hash value of the string, and returns
14672 it as a 40-digit hexadecimal number, in which any letters are in upper case.
14673 </para>
14674 </listitem></varlistentry>
14675 <varlistentry>
14676 <term><emphasis role="bold">${stat:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14677 <listitem>
14678 <para>
14679 <indexterm role="concept">
14680 <primary>expansion</primary>
14681 <secondary>statting a file</secondary>
14682 </indexterm>
14683 <indexterm role="concept">
14684 <primary>file</primary>
14685 <secondary>extracting characteristics</secondary>
14686 </indexterm>
14687 <indexterm role="concept">
14688 <primary><option>stat</option> expansion item</primary>
14689 </indexterm>
14690 The string, after expansion, must be a file path. A call to the <function>stat()</function>
14691 function is made for this path. If <function>stat()</function> fails, an error occurs and the
14692 expansion fails. If it succeeds, the data from the stat replaces the item, as a
14693 series of &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt; pairs, where the values are all numerical,
14694 except for the value of <quote>smode</quote>. The names are: <quote>mode</quote> (giving the mode as
14695 a 4-digit octal number), <quote>smode</quote> (giving the mode in symbolic format as a
14696 10-character string, as for the <emphasis>ls</emphasis> command), <quote>inode</quote>, <quote>device</quote>,
14697 <quote>links</quote>, <quote>uid</quote>, <quote>gid</quote>, <quote>size</quote>, <quote>atime</quote>, <quote>mtime</quote>, and <quote>ctime</quote>. You
14698 can extract individual fields using the <option>extract</option> expansion item.
14699 </para>
14700 <para>
14701 The use of the <option>stat</option> expansion in users&#x2019; filter files can be locked out by
14702 the system administrator. <emphasis role="bold">Warning</emphasis>: The file size may be incorrect on 32-bit
14703 systems for files larger than 2GB.
14704 </para>
14705 </listitem></varlistentry>
14706 <varlistentry>
14707 <term><emphasis role="bold">${str2b64:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14708 <listitem>
14709 <para>
14710 <indexterm role="concept">
14711 <primary>expansion</primary>
14712 <secondary>base64 encoding</secondary>
14713 </indexterm>
14714 <indexterm role="concept">
14715 <primary>base64 encoding</primary>
14716 <secondary>in string expansion</secondary>
14717 </indexterm>
14718 <indexterm role="concept">
14719 <primary><option>str2b64</option> expansion item</primary>
14720 </indexterm>
14721 This operator converts a string into one that is base64 encoded.
14722 </para>
14723 </listitem></varlistentry>
14724 <varlistentry>
14725 <term><emphasis role="bold">${strlen:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14726 <listitem>
14727 <para>
14728 <indexterm role="concept">
14729 <primary>expansion</primary>
14730 <secondary>string length</secondary>
14731 </indexterm>
14732 <indexterm role="concept">
14733 <primary>string</primary>
14734 <secondary>length in expansion</secondary>
14735 </indexterm>
14736 <indexterm role="concept">
14737 <primary><option>strlen</option> expansion item</primary>
14738 </indexterm>
14739 The item is replace by the length of the expanded string, expressed as a
14740 decimal number. <emphasis role="bold">Note</emphasis>: Do not confuse <option>strlen</option> with <option>length</option>.
14741 </para>
14742 </listitem></varlistentry>
14743 <varlistentry>
14744 <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>
14745 <listitem>
14746 <para>
14747 <indexterm role="concept">
14748 <primary><option>substr</option> expansion item</primary>
14749 </indexterm>
14750 <indexterm role="concept">
14751 <primary>substring extraction</primary>
14752 </indexterm>
14753 <indexterm role="concept">
14754 <primary>expansion</primary>
14755 <secondary>substring expansion</secondary>
14756 </indexterm>
14757 The <option>substr</option> operator is a simpler interface to the <option>substr</option> function that
14758 can be used when the two parameters are fixed numbers (as opposed to strings
14759 that change when expanded). The effect is the same as
14760 </para>
14761 <literallayout class="monospaced">
14762 ${substr{&lt;start&gt;}{&lt;length&gt;}{&lt;string&gt;}}
14763 </literallayout>
14764 <para>
14765 See the description of the general <option>substr</option> item above for details. The
14766 abbreviation <option>s</option> can be used when <option>substr</option> is used as an operator.
14767 </para>
14768 </listitem></varlistentry>
14769 <varlistentry>
14770 <term><emphasis role="bold">${time_eval:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14771 <listitem>
14772 <para>
14773 <indexterm role="concept">
14774 <primary><option>time_eval</option> expansion item</primary>
14775 </indexterm>
14776 <indexterm role="concept">
14777 <primary>time interval</primary>
14778 <secondary>decoding</secondary>
14779 </indexterm>
14780 This item converts an Exim time interval such as <literal>2d4h5m</literal> into a number of
14781 seconds.
14782 </para>
14783 </listitem></varlistentry>
14784 <varlistentry>
14785 <term><emphasis role="bold">${time_interval:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14786 <listitem>
14787 <para>
14788 <indexterm role="concept">
14789 <primary><option>time_interval</option> expansion item</primary>
14790 </indexterm>
14791 <indexterm role="concept">
14792 <primary>time interval</primary>
14793 <secondary>formatting</secondary>
14794 </indexterm>
14795 The argument (after sub-expansion) must be a sequence of decimal digits that
14796 represents an interval of time as a number of seconds. It is converted into a
14797 number of larger units and output in Exim&#x2019;s normal time format, for example,
14798 <literal>1w3d4h2m6s</literal>.
14799 </para>
14800 </listitem></varlistentry>
14801 <varlistentry>
14802 <term><emphasis role="bold">${uc:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14803 <listitem>
14804 <para>
14805 <indexterm role="concept">
14806 <primary>case forcing in strings</primary>
14807 </indexterm>
14808 <indexterm role="concept">
14809 <primary>string</primary>
14810 <secondary>case forcing</secondary>
14811 </indexterm>
14812 <indexterm role="concept">
14813 <primary>upper casing</primary>
14814 </indexterm>
14815 <indexterm role="concept">
14816 <primary>expansion</primary>
14817 <secondary>case forcing</secondary>
14818 </indexterm>
14819 <indexterm role="concept">
14820 <primary><option>uc</option> expansion item</primary>
14821 </indexterm>
14822 This forces the letters in the string into upper-case.
14823 </para>
14824 </listitem></varlistentry>
14825 </variablelist>
14826 </section>
14827 <section id="SECTexpcond">
14828 <title>Expansion conditions</title>
14829 <para>
14830 <indexterm role="concept" id="IIDexpcond" class="startofrange">
14831 <primary>expansion</primary>
14832 <secondary>conditions</secondary>
14833 </indexterm>
14834 The following conditions are available for testing by the <option>${if</option> construct
14835 while expanding strings:
14836 </para>
14837 <variablelist>
14838 <varlistentry>
14839 <term><emphasis role="bold">!</emphasis>&lt;<emphasis>condition</emphasis>&gt;</term>
14840 <listitem>
14841 <para>
14842 <indexterm role="concept">
14843 <primary>expansion</primary>
14844 <secondary>negating a condition</secondary>
14845 </indexterm>
14846 <indexterm role="concept">
14847 <primary>negation</primary>
14848 <secondary>in expansion condition</secondary>
14849 </indexterm>
14850 Preceding any condition with an exclamation mark negates the result of the
14851 condition.
14852 </para>
14853 </listitem></varlistentry>
14854 <varlistentry>
14855 <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>
14856 <listitem>
14857 <para>
14858 <indexterm role="concept">
14859 <primary>numeric comparison</primary>
14860 </indexterm>
14861 <indexterm role="concept">
14862 <primary>expansion</primary>
14863 <secondary>numeric comparison</secondary>
14864 </indexterm>
14865 There are a number of symbolic operators for doing numeric comparisons. They
14866 are:
14867 </para>
14868 <literallayout>
14869 <literal>=   </literal>   equal
14870 <literal>==  </literal>   equal
14871 <literal>&gt;   </literal>   greater
14872 <literal>&gt;=  </literal>   greater or equal
14873 <literal>&lt;   </literal>   less
14874 <literal>&lt;=  </literal>   less or equal
14875 </literallayout>
14876 <para>
14877 For example:
14878 </para>
14879 <literallayout class="monospaced">
14880 ${if &gt;{$message_size}{10M} ...
14881 </literallayout>
14882 <para>
14883 Note that the general negation operator provides for inequality testing. The
14884 two strings must take the form of optionally signed decimal integers,
14885 optionally followed by one of the letters <quote>K</quote> or <quote>M</quote> (in either upper or
14886 lower case), signifying multiplication by 1024 or 1024*1024, respectively.
14887 As a special case, the numerical value of an empty string is taken as
14888 zero.
14889 </para>
14890 </listitem></varlistentry>
14891 <varlistentry revisionflag="changed">
14892 <term><emphasis role="bold">bool&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14893 <listitem>
14894 <para revisionflag="changed">
14895 <indexterm role="concept">
14896 <primary>expansion</primary>
14897 <secondary>boolean parsing</secondary>
14898 </indexterm>
14899 <indexterm role="concept">
14900 <primary><option>bool</option> expansion condition</primary>
14901 </indexterm>
14902 This condition turns a string holding a true or false representation into
14903 a boolean state.  It parses <quote>true</quote>, <quote>false</quote>, <quote>yes</quote> and <quote>no</quote>
14904 (case-insensitively); also positive integer numbers map to true if non-zero,
14905 false if zero.  Leading and trailing whitespace is ignored.
14906 All other string values will result in expansion failure.
14907 </para>
14908 <para revisionflag="changed">
14909 When combined with ACL variables, this expansion condition will let you
14910 make decisions in one place and act on those decisions in another place.
14911 For example:
14912 </para>
14913 <literallayout class="monospaced" revisionflag="changed">
14914 ${if bool{$acl_m_privileged_sender} ...
14915 </literallayout>
14916 </listitem></varlistentry>
14917 <varlistentry revisionflag="changed">
14918 <term><emphasis role="bold">bool_lax&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14919 <listitem>
14920 <para revisionflag="changed">
14921 <indexterm role="concept">
14922 <primary>expansion</primary>
14923 <secondary>boolean parsing</secondary>
14924 </indexterm>
14925 <indexterm role="concept">
14926 <primary><option>bool_lax</option> expansion condition</primary>
14927 </indexterm>
14928 Like <option>bool</option>, this condition turns a string into a boolean state.  But
14929 where <option>bool</option> accepts a strict set of strings, <option>bool_lax</option> uses the same
14930 loose definition that the Router <option>condition</option> option uses.  The empty string
14931 and the values <quote>false</quote>, <quote>no</quote> and <quote>0</quote> map to false, all others map to
14932 true.  Leading and trailing whitespace is ignored.
14933 </para>
14934 <para revisionflag="changed">
14935 Note that where <quote>bool{00}</quote> is false, <quote>bool_lax{00}</quote> is true.
14936 </para>
14937 </listitem></varlistentry>
14938 <varlistentry>
14939 <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>
14940 <listitem>
14941 <para>
14942 <indexterm role="concept">
14943 <primary>expansion</primary>
14944 <secondary>encrypted comparison</secondary>
14945 </indexterm>
14946 <indexterm role="concept">
14947 <primary>encrypted strings, comparing</primary>
14948 </indexterm>
14949 <indexterm role="concept">
14950 <primary><option>crypteq</option> expansion condition</primary>
14951 </indexterm>
14952 This condition is included in the Exim binary if it is built to support any
14953 authentication mechanisms (see chapter <xref linkend="CHAPSMTPAUTH"/>). Otherwise, it is
14954 necessary to define SUPPORT_CRYPTEQ in <filename>Local/Makefile</filename> to get <option>crypteq</option>
14955 included in the binary.
14956 </para>
14957 <para>
14958 The <option>crypteq</option> condition has two arguments. The first is encrypted and
14959 compared against the second, which is already encrypted. The second string may
14960 be in the LDAP form for storing encrypted strings, which starts with the
14961 encryption type in curly brackets, followed by the data. If the second string
14962 does not begin with <quote>{</quote> it is assumed to be encrypted with <function>crypt()</function> or
14963 <function>crypt16()</function> (see below), since such strings cannot begin with <quote>{</quote>.
14964 Typically this will be a field from a password file. An example of an encrypted
14965 string in LDAP form is:
14966 </para>
14967 <literallayout class="monospaced">
14968 {md5}CY9rzUYh03PK3k6DJie09g==
14969 </literallayout>
14970 <para>
14971 If such a string appears directly in an expansion, the curly brackets have to
14972 be quoted, because they are part of the expansion syntax. For example:
14973 </para>
14974 <literallayout class="monospaced">
14975 ${if crypteq {test}{\{md5\}CY9rzUYh03PK3k6DJie09g==}{yes}{no}}
14976 </literallayout>
14977 <para>
14978 The following encryption types (whose names are matched case-independently) are
14979 supported:
14980 </para>
14981 <itemizedlist>
14982 <listitem>
14983 <para>
14984 <indexterm role="concept">
14985 <primary>MD5 hash</primary>
14986 </indexterm>
14987 <indexterm role="concept">
14988 <primary>base64 encoding</primary>
14989 <secondary>in encrypted password</secondary>
14990 </indexterm>
14991 <option>{md5}</option> computes the MD5 digest of the first string, and expresses this as
14992 printable characters to compare with the remainder of the second string. If the
14993 length of the comparison string is 24, Exim assumes that it is base64 encoded
14994 (as in the above example). If the length is 32, Exim assumes that it is a
14995 hexadecimal encoding of the MD5 digest. If the length not 24 or 32, the
14996 comparison fails.
14997 </para>
14998 </listitem>
14999 <listitem>
15000 <para>
15001 <indexterm role="concept">
15002 <primary>SHA-1 hash</primary>
15003 </indexterm>
15004 <option>{sha1}</option> computes the SHA-1 digest of the first string, and expresses this as
15005 printable characters to compare with the remainder of the second string. If the
15006 length of the comparison string is 28, Exim assumes that it is base64 encoded.
15007 If the length is 40, Exim assumes that it is a hexadecimal encoding of the
15008 SHA-1 digest. If the length is not 28 or 40, the comparison fails.
15009 </para>
15010 </listitem>
15011 <listitem>
15012 <para>
15013 <indexterm role="concept">
15014 <primary><function>crypt()</function></primary>
15015 </indexterm>
15016 <option>{crypt}</option> calls the <function>crypt()</function> function, which traditionally used to use
15017 only the first eight characters of the password. However, in modern operating
15018 systems this is no longer true, and in many cases the entire password is used,
15019 whatever its length.
15020 </para>
15021 </listitem>
15022 <listitem>
15023 <para>
15024 <indexterm role="concept">
15025 <primary><function>crypt16()</function></primary>
15026 </indexterm>
15027 <option>{crypt16}</option> calls the <function>crypt16()</function> function, which was originally created to
15028 use up to 16 characters of the password in some operating systems. Again, in
15029 modern operating systems, more characters may be used.
15030 </para>
15031 </listitem>
15032 </itemizedlist>
15033 <para>
15034 Exim has its own version of <function>crypt16()</function>, which is just a double call to
15035 <function>crypt()</function>. For operating systems that have their own version, setting
15036 HAVE_CRYPT16 in <filename>Local/Makefile</filename> when building Exim causes it to use the
15037 operating system version instead of its own. This option is set by default in
15038 the OS-dependent <filename>Makefile</filename> for those operating systems that are known to
15039 support <function>crypt16()</function>.
15040 </para>
15041 <para>
15042 Some years after Exim&#x2019;s <function>crypt16()</function> was implemented, a user discovered that
15043 it was not using the same algorithm as some operating systems&#x2019; versions. It
15044 turns out that as well as <function>crypt16()</function> there is a function called
15045 <function>bigcrypt()</function> in some operating systems. This may or may not use the same
15046 algorithm, and both of them may be different to Exim&#x2019;s built-in <function>crypt16()</function>.
15047 </para>
15048 <para>
15049 However, since there is now a move away from the traditional <function>crypt()</function>
15050 functions towards using SHA1 and other algorithms, tidying up this area of
15051 Exim is seen as very low priority.
15052 </para>
15053 <para>
15054 If you do not put a encryption type (in curly brackets) in a <option>crypteq</option>
15055 comparison, the default is usually either <literal>{crypt}</literal> or <literal>{crypt16}</literal>, as
15056 determined by the setting of DEFAULT_CRYPT in <filename>Local/Makefile</filename>. The default
15057 default is <literal>{crypt}</literal>. Whatever the default, you can always use either
15058 function by specifying it explicitly in curly brackets.
15059 </para>
15060 </listitem></varlistentry>
15061 <varlistentry>
15062 <term><emphasis role="bold">def:</emphasis>&lt;<emphasis>variable&nbsp;name</emphasis>&gt;</term>
15063 <listitem>
15064 <para>
15065 <indexterm role="concept">
15066 <primary>expansion</primary>
15067 <secondary>checking for empty variable</secondary>
15068 </indexterm>
15069 <indexterm role="concept">
15070 <primary><option>def</option> expansion condition</primary>
15071 </indexterm>
15072 The <option>def</option> condition must be followed by the name of one of the expansion
15073 variables defined in section <xref linkend="SECTexpvar"/>. The condition is true if the
15074 variable does not contain the empty string. For example:
15075 </para>
15076 <literallayout class="monospaced">
15077 ${if def:sender_ident {from $sender_ident}}
15078 </literallayout>
15079 <para>
15080 Note that the variable name is given without a leading <option>$</option> character. If the
15081 variable does not exist, the expansion fails.
15082 </para>
15083 </listitem></varlistentry>
15084 <varlistentry>
15085 <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>
15086 <listitem>
15087 <para>
15088 <indexterm role="concept">
15089 <primary>expansion</primary>
15090 <secondary>checking header line existence</secondary>
15091 </indexterm>
15092 This condition is true if a message is being processed and the named header
15093 exists in the message. For example,
15094 </para>
15095 <literallayout class="monospaced">
15096 ${if def:header_reply-to:{$h_reply-to:}{$h_from:}}
15097 </literallayout>
15098 <para>
15099 <emphasis role="bold">Note</emphasis>: No <option>$</option> appears before <option>header_</option> or <option>h_</option> in the condition, and
15100 the header name must be terminated by a colon if white space does not follow.
15101 </para>
15102 </listitem></varlistentry>
15103 <varlistentry>
15104 <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>
15105 <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>
15106 <listitem>
15107 <para>
15108 <indexterm role="concept">
15109 <primary>string</primary>
15110 <secondary>comparison</secondary>
15111 </indexterm>
15112 <indexterm role="concept">
15113 <primary>expansion</primary>
15114 <secondary>string comparison</secondary>
15115 </indexterm>
15116 <indexterm role="concept">
15117 <primary><option>eq</option> expansion condition</primary>
15118 </indexterm>
15119 <indexterm role="concept">
15120 <primary><option>eqi</option> expansion condition</primary>
15121 </indexterm>
15122 The two substrings are first expanded. The condition is true if the two
15123 resulting strings are identical. For <option>eq</option> the comparison includes the case of
15124 letters, whereas for <option>eqi</option> the comparison is case-independent.
15125 </para>
15126 </listitem></varlistentry>
15127 <varlistentry>
15128 <term><emphasis role="bold">exists&nbsp;{</emphasis>&lt;<emphasis>file&nbsp;name</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15129 <listitem>
15130 <para>
15131 <indexterm role="concept">
15132 <primary>expansion</primary>
15133 <secondary>file existence test</secondary>
15134 </indexterm>
15135 <indexterm role="concept">
15136 <primary>file</primary>
15137 <secondary>existence test</secondary>
15138 </indexterm>
15139 <indexterm role="concept">
15140 <primary><option>exists</option>, expansion condition</primary>
15141 </indexterm>
15142 The substring is first expanded and then interpreted as an absolute path. The
15143 condition is true if the named file (or directory) exists. The existence test
15144 is done by calling the <function>stat()</function> function. The use of the <option>exists</option> test in
15145 users&#x2019; filter files may be locked out by the system administrator.
15146 </para>
15147 </listitem></varlistentry>
15148 <varlistentry>
15149 <term><emphasis role="bold">first_delivery</emphasis></term>
15150 <listitem>
15151 <para>
15152 <indexterm role="concept">
15153 <primary>delivery</primary>
15154 <secondary>first</secondary>
15155 </indexterm>
15156 <indexterm role="concept">
15157 <primary>first delivery</primary>
15158 </indexterm>
15159 <indexterm role="concept">
15160 <primary>expansion</primary>
15161 <secondary>first delivery test</secondary>
15162 </indexterm>
15163 <indexterm role="concept">
15164 <primary><option>first_delivery</option> expansion condition</primary>
15165 </indexterm>
15166 This condition, which has no data, is true during a message&#x2019;s first delivery
15167 attempt. It is false during any subsequent delivery attempts.
15168 </para>
15169 </listitem></varlistentry>
15170 <varlistentry>
15171 <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>
15172 <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>
15173 <listitem>
15174 <para>
15175 <indexterm role="concept">
15176 <primary>list</primary>
15177 <secondary>iterative conditions</secondary>
15178 </indexterm>
15179 <indexterm role="concept">
15180 <primary>expansion</primary>
15181 <secondary><emphasis role="bold">forall</emphasis> condition</secondary>
15182 </indexterm>
15183 <indexterm role="concept">
15184 <primary>expansion</primary>
15185 <secondary><emphasis role="bold">forany</emphasis> condition</secondary>
15186 </indexterm>
15187 <indexterm role="variable">
15188 <primary><varname>$item</varname></primary>
15189 </indexterm>
15190 These conditions iterate over a list. The first argument is expanded to form
15191 the list. By default, the list separator is a colon, but it can be changed by
15192 the normal method. The second argument is interpreted as a condition that is to
15193 be applied to each item in the list in turn. During the interpretation of the
15194 condition, the current list item is placed in a variable called <varname>$item</varname>.
15195 </para>
15196 <itemizedlist>
15197 <listitem>
15198 <para>
15199 For <emphasis role="bold">forany</emphasis>, interpretation stops if the condition is true for any item, and
15200 the result of the whole condition is true. If the condition is false for all
15201 items in the list, the overall condition is false.
15202 </para>
15203 </listitem>
15204 <listitem>
15205 <para>
15206 For <emphasis role="bold">forall</emphasis>, interpretation stops if the condition is false for any item,
15207 and the result of the whole condition is false. If the condition is true for
15208 all items in the list, the overall condition is true.
15209 </para>
15210 </listitem>
15211 </itemizedlist>
15212 <para>
15213 Note that negation of <emphasis role="bold">forany</emphasis> means that the condition must be false for all
15214 items for the overall condition to succeed, and negation of <emphasis role="bold">forall</emphasis> means
15215 that the condition must be false for at least one item. In this example, the
15216 list separator is changed to a comma:
15217 </para>
15218 <literallayout class="monospaced">
15219 ${if forany{&lt;, $recipients}{match{$item}{^user3@}}{yes}{no}}
15220 </literallayout>
15221 <para>
15222 The value of <varname>$item</varname> is saved and restored while <emphasis role="bold">forany</emphasis> or <emphasis role="bold">forall</emphasis> is
15223 being processed, to enable these expansion items to be nested.
15224 </para>
15225 </listitem></varlistentry>
15226 <varlistentry>
15227 <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>
15228 <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>
15229 <listitem>
15230 <para>
15231 <indexterm role="concept">
15232 <primary>string</primary>
15233 <secondary>comparison</secondary>
15234 </indexterm>
15235 <indexterm role="concept">
15236 <primary>expansion</primary>
15237 <secondary>string comparison</secondary>
15238 </indexterm>
15239 <indexterm role="concept">
15240 <primary><option>ge</option> expansion condition</primary>
15241 </indexterm>
15242 <indexterm role="concept">
15243 <primary><option>gei</option> expansion condition</primary>
15244 </indexterm>
15245 The two substrings are first expanded. The condition is true if the first
15246 string is lexically greater than or equal to the second string. For <option>ge</option> the
15247 comparison includes the case of letters, whereas for <option>gei</option> the comparison is
15248 case-independent.
15249 </para>
15250 </listitem></varlistentry>
15251 <varlistentry>
15252 <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>
15253 <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>
15254 <listitem>
15255 <para>
15256 <indexterm role="concept">
15257 <primary>string</primary>
15258 <secondary>comparison</secondary>
15259 </indexterm>
15260 <indexterm role="concept">
15261 <primary>expansion</primary>
15262 <secondary>string comparison</secondary>
15263 </indexterm>
15264 <indexterm role="concept">
15265 <primary><option>gt</option> expansion condition</primary>
15266 </indexterm>
15267 <indexterm role="concept">
15268 <primary><option>gti</option> expansion condition</primary>
15269 </indexterm>
15270 The two substrings are first expanded. The condition is true if the first
15271 string is lexically greater than the second string. For <option>gt</option> the comparison
15272 includes the case of letters, whereas for <option>gti</option> the comparison is
15273 case-independent.
15274 </para>
15275 </listitem></varlistentry>
15276 <varlistentry>
15277 <term><emphasis role="bold">isip&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15278 <term><emphasis role="bold">isip4&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15279 <term><emphasis role="bold">isip6&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15280 <listitem>
15281 <para>
15282 <indexterm role="concept">
15283 <primary>IP address</primary>
15284 <secondary>testing string format</secondary>
15285 </indexterm>
15286 <indexterm role="concept">
15287 <primary>string</primary>
15288 <secondary>testing for IP address</secondary>
15289 </indexterm>
15290 <indexterm role="concept">
15291 <primary><option>isip</option> expansion condition</primary>
15292 </indexterm>
15293 <indexterm role="concept">
15294 <primary><option>isip4</option> expansion condition</primary>
15295 </indexterm>
15296 <indexterm role="concept">
15297 <primary><option>isip6</option> expansion condition</primary>
15298 </indexterm>
15299 The substring is first expanded, and then tested to see if it has the form of
15300 an IP address. Both IPv4 and IPv6 addresses are valid for <option>isip</option>, whereas
15301 <option>isip4</option> and <option>isip6</option> test specifically for IPv4 or IPv6 addresses.
15302 </para>
15303 <para>
15304 For an IPv4 address, the test is for four dot-separated components, each of
15305 which consists of from one to three digits. For an IPv6 address, up to eight
15306 colon-separated components are permitted, each containing from one to four
15307 hexadecimal digits. There may be fewer than eight components if an empty
15308 component (adjacent colons) is present. Only one empty component is permitted.
15309 </para>
15310 <para>
15311 <emphasis role="bold">Note</emphasis>: The checks are just on the form of the address; actual numerical
15312 values are not considered. Thus, for example, 999.999.999.999 passes the IPv4
15313 check. The main use of these tests is to distinguish between IP addresses and
15314 host names, or between IPv4 and IPv6 addresses. For example, you could use
15315 </para>
15316 <literallayout class="monospaced">
15317 ${if isip4{$sender_host_address}...
15318 </literallayout>
15319 <para>
15320 to test which IP version an incoming SMTP connection is using.
15321 </para>
15322 </listitem></varlistentry>
15323 <varlistentry>
15324 <term><emphasis role="bold">ldapauth&nbsp;{</emphasis>&lt;<emphasis>ldap&nbsp;query</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15325 <listitem>
15326 <para>
15327 <indexterm role="concept">
15328 <primary>LDAP</primary>
15329 <secondary>use for authentication</secondary>
15330 </indexterm>
15331 <indexterm role="concept">
15332 <primary>expansion</primary>
15333 <secondary>LDAP authentication test</secondary>
15334 </indexterm>
15335 <indexterm role="concept">
15336 <primary><option>ldapauth</option> expansion condition</primary>
15337 </indexterm>
15338 This condition supports user authentication using LDAP. See section
15339 <xref linkend="SECTldap"/> for details of how to use LDAP in lookups and the syntax of
15340 queries. For this use, the query must contain a user name and password. The
15341 query itself is not used, and can be empty. The condition is true if the
15342 password is not empty, and the user name and password are accepted by the LDAP
15343 server. An empty password is rejected without calling LDAP because LDAP binds
15344 with an empty password are considered anonymous regardless of the username, and
15345 will succeed in most configurations. See chapter <xref linkend="CHAPSMTPAUTH"/> for details
15346 of SMTP authentication, and chapter <xref linkend="CHAPplaintext"/> for an example of how
15347 this can be used.
15348 </para>
15349 </listitem></varlistentry>
15350 <varlistentry>
15351 <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>
15352 <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>
15353 <listitem>
15354 <para>
15355 <indexterm role="concept">
15356 <primary>string</primary>
15357 <secondary>comparison</secondary>
15358 </indexterm>
15359 <indexterm role="concept">
15360 <primary>expansion</primary>
15361 <secondary>string comparison</secondary>
15362 </indexterm>
15363 <indexterm role="concept">
15364 <primary><option>le</option> expansion condition</primary>
15365 </indexterm>
15366 <indexterm role="concept">
15367 <primary><option>lei</option> expansion condition</primary>
15368 </indexterm>
15369 The two substrings are first expanded. The condition is true if the first
15370 string is lexically less than or equal to the second string. For <option>le</option> the
15371 comparison includes the case of letters, whereas for <option>lei</option> the comparison is
15372 case-independent.
15373 </para>
15374 </listitem></varlistentry>
15375 <varlistentry>
15376 <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>
15377 <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>
15378 <listitem>
15379 <para>
15380 <indexterm role="concept">
15381 <primary>string</primary>
15382 <secondary>comparison</secondary>
15383 </indexterm>
15384 <indexterm role="concept">
15385 <primary>expansion</primary>
15386 <secondary>string comparison</secondary>
15387 </indexterm>
15388 <indexterm role="concept">
15389 <primary><option>lt</option> expansion condition</primary>
15390 </indexterm>
15391 <indexterm role="concept">
15392 <primary><option>lti</option> expansion condition</primary>
15393 </indexterm>
15394 The two substrings are first expanded. The condition is true if the first
15395 string is lexically less than the second string. For <option>lt</option> the comparison
15396 includes the case of letters, whereas for <option>lti</option> the comparison is
15397 case-independent.
15398 </para>
15399 </listitem></varlistentry>
15400 <varlistentry>
15401 <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>
15402 <listitem>
15403 <para>
15404 <indexterm role="concept">
15405 <primary>expansion</primary>
15406 <secondary>regular expression comparison</secondary>
15407 </indexterm>
15408 <indexterm role="concept">
15409 <primary>regular expressions</primary>
15410 <secondary>match in expanded string</secondary>
15411 </indexterm>
15412 <indexterm role="concept">
15413 <primary><option>match</option> expansion condition</primary>
15414 </indexterm>
15415 The two substrings are first expanded. The second is then treated as a regular
15416 expression and applied to the first. Because of the pre-expansion, if the
15417 regular expression contains dollar, or backslash characters, they must be
15418 escaped. Care must also be taken if the regular expression contains braces
15419 (curly brackets). A closing brace must be escaped so that it is not taken as a
15420 premature termination of &lt;<emphasis>string2</emphasis>&gt;. The easiest approach is to use the
15421 <literal>\N</literal> feature to disable expansion of the regular expression.
15422 For example,
15423 </para>
15424 <literallayout class="monospaced">
15425 ${if match {$local_part}{\N^\d{3}\N} ...
15426 </literallayout>
15427 <para>
15428 If the whole expansion string is in double quotes, further escaping of
15429 backslashes is also required.
15430 </para>
15431 <para>
15432 The condition is true if the regular expression match succeeds.
15433 The regular expression is not required to begin with a circumflex
15434 metacharacter, but if there is no circumflex, the expression is not anchored,
15435 and it may match anywhere in the subject, not just at the start. If you want
15436 the pattern to match at the end of the subject, you must include the <literal>$</literal>
15437 metacharacter at an appropriate point.
15438 </para>
15439 <para>
15440 <indexterm role="concept">
15441 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
15442 <secondary>in <option>if</option> expansion</secondary>
15443 </indexterm>
15444 At the start of an <option>if</option> expansion the values of the numeric variable
15445 substitutions <varname>$1</varname> etc. are remembered. Obeying a <option>match</option> condition that
15446 succeeds causes them to be reset to the substrings of that condition and they
15447 will have these values during the expansion of the success string. At the end
15448 of the <option>if</option> expansion, the previous values are restored. After testing a
15449 combination of conditions using <option>or</option>, the subsequent values of the numeric
15450 variables are those of the condition that succeeded.
15451 </para>
15452 </listitem></varlistentry>
15453 <varlistentry>
15454 <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>
15455 <listitem>
15456 <para>
15457 <indexterm role="concept">
15458 <primary><option>match_address</option> expansion condition</primary>
15459 </indexterm>
15460 See <emphasis role="bold">match_local_part</emphasis>.
15461 </para>
15462 </listitem></varlistentry>
15463 <varlistentry>
15464 <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>
15465 <listitem>
15466 <para>
15467 <indexterm role="concept">
15468 <primary><option>match_domain</option> expansion condition</primary>
15469 </indexterm>
15470 See <emphasis role="bold">match_local_part</emphasis>.
15471 </para>
15472 </listitem></varlistentry>
15473 <varlistentry>
15474 <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>
15475 <listitem>
15476 <para>
15477 <indexterm role="concept">
15478 <primary><option>match_ip</option> expansion condition</primary>
15479 </indexterm>
15480 This condition matches an IP address to a list of IP address patterns. It must
15481 be followed by two argument strings. The first (after expansion) must be an IP
15482 address or an empty string. The second (after expansion) is a restricted host
15483 list that can match only an IP address, not a host name. For example:
15484 </para>
15485 <literallayout class="monospaced">
15486 ${if match_ip{$sender_host_address}{1.2.3.4:5.6.7.8}{...}{...}}
15487 </literallayout>
15488 <para>
15489 The specific types of host list item that are permitted in the list are:
15490 </para>
15491 <itemizedlist>
15492 <listitem>
15493 <para>
15494 An IP address, optionally with a CIDR mask.
15495 </para>
15496 </listitem>
15497 <listitem>
15498 <para>
15499 A single asterisk, which matches any IP address.
15500 </para>
15501 </listitem>
15502 <listitem>
15503 <para>
15504 An empty item, which matches only if the IP address is empty. This could be
15505 useful for testing for a locally submitted message or one from specific hosts
15506 in a single test such as
15507 </para>
15508 <literallayout class="monospaced">
15509   ${if match_ip{$sender_host_address}{:4.3.2.1:...}{...}{...}}
15510 </literallayout>
15511 <para>
15512 where the first item in the list is the empty string.
15513 </para>
15514 </listitem>
15515 <listitem>
15516 <para>
15517 The item @[] matches any of the local host&#x2019;s interface addresses.
15518 </para>
15519 </listitem>
15520 <listitem>
15521 <para>
15522 Single-key lookups are assumed to be like <quote>net-</quote> style lookups in host lists,
15523 even if <literal>net-</literal> is not specified. There is never any attempt to turn the IP
15524 address into a host name. The most common type of linear search for
15525 <emphasis role="bold">match_ip</emphasis> is likely to be <emphasis role="bold">iplsearch</emphasis>, in which the file can contain CIDR
15526 masks. For example:
15527 </para>
15528 <literallayout class="monospaced">
15529   ${if match_ip{$sender_host_address}{iplsearch;/some/file}...
15530 </literallayout>
15531 <para>
15532 It is of course possible to use other kinds of lookup, and in such a case, you
15533 do need to specify the <literal>net-</literal> prefix if you want to specify a specific
15534 address mask, for example:
15535 </para>
15536 <literallayout class="monospaced">
15537   ${if match_ip{$sender_host_address}{net24-dbm;/some/file}...
15538 </literallayout>
15539 <para>
15540 However, unless you are combining a <option>match_ip</option> condition with others, it is
15541 just as easy to use the fact that a lookup is itself a condition, and write:
15542 </para>
15543 <literallayout class="monospaced">
15544   ${lookup{${mask:$sender_host_address/24}}dbm{/a/file}...
15545 </literallayout>
15546 </listitem>
15547 </itemizedlist>
15548 <para>
15549 Consult section <xref linkend="SECThoslispatip"/> for further details of these patterns.
15550 </para>
15551 </listitem></varlistentry>
15552 <varlistentry>
15553 <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>
15554 <listitem>
15555 <para>
15556 <indexterm role="concept">
15557 <primary>domain list</primary>
15558 <secondary>in expansion condition</secondary>
15559 </indexterm>
15560 <indexterm role="concept">
15561 <primary>address list</primary>
15562 <secondary>in expansion condition</secondary>
15563 </indexterm>
15564 <indexterm role="concept">
15565 <primary>local part</primary>
15566 <secondary>list, in expansion condition</secondary>
15567 </indexterm>
15568 <indexterm role="concept">
15569 <primary><option>match_local_part</option> expansion condition</primary>
15570 </indexterm>
15571 This condition, together with <option>match_address</option> and <option>match_domain</option>, make it
15572 possible to test domain, address, and local part lists within expansions. Each
15573 condition requires two arguments: an item and a list to match. A trivial
15574 example is:
15575 </para>
15576 <literallayout class="monospaced">
15577 ${if match_domain{a.b.c}{x.y.z:a.b.c:p.q.r}{yes}{no}}
15578 </literallayout>
15579 <para>
15580 In each case, the second argument may contain any of the allowable items for a
15581 list of the appropriate type. Also, because the second argument (after
15582 expansion) is a standard form of list, it is possible to refer to a named list.
15583 Thus, you can use conditions like this:
15584 </para>
15585 <literallayout class="monospaced">
15586 ${if match_domain{$domain}{+local_domains}{...
15587 </literallayout>
15588 <para>
15589 <indexterm role="concept">
15590 <primary><literal>+caseful</literal></primary>
15591 </indexterm>
15592 For address lists, the matching starts off caselessly, but the <literal>+caseful</literal>
15593 item can be used, as in all address lists, to cause subsequent items to
15594 have their local parts matched casefully. Domains are always matched
15595 caselessly.
15596 </para>
15597 <para>
15598 <emphasis role="bold">Note</emphasis>: Host lists are <emphasis>not</emphasis> supported in this way. This is because
15599 hosts have two identities: a name and an IP address, and it is not clear
15600 how to specify cleanly how such a test would work. However, IP addresses can be
15601 matched using <option>match_ip</option>.
15602 </para>
15603 </listitem></varlistentry>
15604 <varlistentry>
15605 <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>
15606 <listitem>
15607 <para>
15608 <indexterm role="concept">
15609 <primary>PAM authentication</primary>
15610 </indexterm>
15611 <indexterm role="concept">
15612 <primary>AUTH</primary>
15613 <secondary>with PAM</secondary>
15614 </indexterm>
15615 <indexterm role="concept">
15616 <primary>Solaris</primary>
15617 <secondary>PAM support</secondary>
15618 </indexterm>
15619 <indexterm role="concept">
15620 <primary>expansion</primary>
15621 <secondary>PAM authentication test</secondary>
15622 </indexterm>
15623 <indexterm role="concept">
15624 <primary><option>pam</option> expansion condition</primary>
15625 </indexterm>
15626 <emphasis>Pluggable Authentication Modules</emphasis>
15627 (<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
15628 available in the latest releases of Solaris and in some GNU/Linux
15629 distributions. The Exim support, which is intended for use in conjunction with
15630 the SMTP AUTH command, is available only if Exim is compiled with
15631 </para>
15632 <literallayout class="monospaced">
15633 SUPPORT_PAM=yes
15634 </literallayout>
15635 <para>
15636 in <filename>Local/Makefile</filename>. You probably need to add <option>-lpam</option> to EXTRALIBS, and
15637 in some releases of GNU/Linux <option>-ldl</option> is also needed.
15638 </para>
15639 <para>
15640 The argument string is first expanded, and the result must be a
15641 colon-separated list of strings. Leading and trailing white space is ignored.
15642 The PAM module is initialized with the service name <quote>exim</quote> and the user name
15643 taken from the first item in the colon-separated data string (&lt;<emphasis>string1</emphasis>&gt;).
15644 The remaining items in the data string are passed over in response to requests
15645 from the authentication function. In the simple case there will only be one
15646 request, for a password, so the data consists of just two strings.
15647 </para>
15648 <para>
15649 There can be problems if any of the strings are permitted to contain colon
15650 characters. In the usual way, these have to be doubled to avoid being taken as
15651 separators. If the data is being inserted from a variable, the <option>sg</option> expansion
15652 item can be used to double any existing colons. For example, the configuration
15653 of a LOGIN authenticator might contain this setting:
15654 </para>
15655 <literallayout class="monospaced">
15656 server_condition = ${if pam{$auth1:${sg{$auth2}{:}{::}}}}
15657 </literallayout>
15658 <para>
15659 For a PLAIN authenticator you could use:
15660 </para>
15661 <literallayout class="monospaced">
15662 server_condition = ${if pam{$auth2:${sg{$auth3}{:}{::}}}}
15663 </literallayout>
15664 <para>
15665 In some operating systems, PAM authentication can be done only from a process
15666 running as root. Since Exim is running as the Exim user when receiving
15667 messages, this means that PAM cannot be used directly in those systems.
15668 A patched version of the <emphasis>pam_unix</emphasis> module that comes with the
15669 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>.
15670 The patched module allows one special uid/gid combination, in addition to root,
15671 to authenticate. If you build the patched module to allow the Exim user and
15672 group, PAM can then be used from an Exim authenticator.
15673 </para>
15674 </listitem></varlistentry>
15675 <varlistentry>
15676 <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>
15677 <listitem>
15678 <para>
15679 <indexterm role="concept">
15680 <primary><emphasis>pwcheck</emphasis> daemon</primary>
15681 </indexterm>
15682 <indexterm role="concept">
15683 <primary>Cyrus</primary>
15684 </indexterm>
15685 <indexterm role="concept">
15686 <primary>expansion</primary>
15687 <secondary><emphasis>pwcheck</emphasis> authentication test</secondary>
15688 </indexterm>
15689 <indexterm role="concept">
15690 <primary><option>pwcheck</option> expansion condition</primary>
15691 </indexterm>
15692 This condition supports user authentication using the Cyrus <emphasis>pwcheck</emphasis> daemon.
15693 This is one way of making it possible for passwords to be checked by a process
15694 that is not running as root. <emphasis role="bold">Note</emphasis>: The use of <emphasis>pwcheck</emphasis> is now
15695 deprecated. Its replacement is <emphasis>saslauthd</emphasis> (see below).
15696 </para>
15697 <para>
15698 The pwcheck support is not included in Exim by default. You need to specify
15699 the location of the pwcheck daemon&#x2019;s socket in <filename>Local/Makefile</filename> before
15700 building Exim. For example:
15701 </para>
15702 <literallayout class="monospaced">
15703 CYRUS_PWCHECK_SOCKET=/var/pwcheck/pwcheck
15704 </literallayout>
15705 <para>
15706 You do not need to install the full Cyrus software suite in order to use
15707 the pwcheck daemon. You can compile and install just the daemon alone
15708 from the Cyrus SASL library. Ensure that <emphasis>exim</emphasis> is the only user that has
15709 access to the <filename>/var/pwcheck</filename> directory.
15710 </para>
15711 <para>
15712 The <option>pwcheck</option> condition takes one argument, which must be the user name and
15713 password, separated by a colon. For example, in a LOGIN authenticator
15714 configuration, you might have this:
15715 </para>
15716 <literallayout class="monospaced">
15717 server_condition = ${if pwcheck{$auth1:$auth2}}
15718 </literallayout>
15719 <para>
15720 Again, for a PLAIN authenticator configuration, this would be:
15721 </para>
15722 <literallayout class="monospaced">
15723 server_condition = ${if pwcheck{$auth2:$auth3}}
15724 </literallayout>
15725 </listitem></varlistentry>
15726 <varlistentry>
15727 <term><emphasis role="bold">queue_running</emphasis></term>
15728 <listitem>
15729 <para>
15730 <indexterm role="concept">
15731 <primary>queue runner</primary>
15732 <secondary>detecting when delivering from</secondary>
15733 </indexterm>
15734 <indexterm role="concept">
15735 <primary>expansion</primary>
15736 <secondary>queue runner test</secondary>
15737 </indexterm>
15738 <indexterm role="concept">
15739 <primary><option>queue_running</option> expansion condition</primary>
15740 </indexterm>
15741 This condition, which has no data, is true during delivery attempts that are
15742 initiated by queue runner processes, and false otherwise.
15743 </para>
15744 </listitem></varlistentry>
15745 <varlistentry>
15746 <term><emphasis role="bold">radius&nbsp;{</emphasis>&lt;<emphasis>authentication&nbsp;string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15747 <listitem>
15748 <para>
15749 <indexterm role="concept">
15750 <primary>Radius</primary>
15751 </indexterm>
15752 <indexterm role="concept">
15753 <primary>expansion</primary>
15754 <secondary>Radius authentication</secondary>
15755 </indexterm>
15756 <indexterm role="concept">
15757 <primary><option>radius</option> expansion condition</primary>
15758 </indexterm>
15759 Radius authentication (RFC 2865) is supported in a similar way to PAM. You must
15760 set RADIUS_CONFIG_FILE in <filename>Local/Makefile</filename> to specify the location of
15761 the Radius client configuration file in order to build Exim with Radius
15762 support.
15763 </para>
15764 <para>
15765 With just that one setting, Exim expects to be linked with the <option>radiusclient</option>
15766 library, using the original API. If you are using release 0.4.0 or later of
15767 this library, you need to set
15768 </para>
15769 <literallayout class="monospaced">
15770 RADIUS_LIB_TYPE=RADIUSCLIENTNEW
15771 </literallayout>
15772 <para>
15773 in <filename>Local/Makefile</filename> when building Exim. You can also link Exim with the
15774 <option>libradius</option> library that comes with FreeBSD. To do this, set
15775 </para>
15776 <literallayout class="monospaced">
15777 RADIUS_LIB_TYPE=RADLIB
15778 </literallayout>
15779 <para>
15780 in <filename>Local/Makefile</filename>, in addition to setting RADIUS_CONFIGURE_FILE.
15781 You may also have to supply a suitable setting in EXTRALIBS so that the
15782 Radius library can be found when Exim is linked.
15783 </para>
15784 <para>
15785 The string specified by RADIUS_CONFIG_FILE is expanded and passed to the
15786 Radius client library, which calls the Radius server. The condition is true if
15787 the authentication is successful. For example:
15788 </para>
15789 <literallayout class="monospaced">
15790 server_condition = ${if radius{&lt;arguments&gt;}}
15791 </literallayout>
15792 </listitem></varlistentry>
15793 <varlistentry>
15794 <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>
15795 <listitem>
15796 <para>
15797 <indexterm role="concept">
15798 <primary><emphasis>saslauthd</emphasis> daemon</primary>
15799 </indexterm>
15800 <indexterm role="concept">
15801 <primary>Cyrus</primary>
15802 </indexterm>
15803 <indexterm role="concept">
15804 <primary>expansion</primary>
15805 <secondary><emphasis>saslauthd</emphasis> authentication test</secondary>
15806 </indexterm>
15807 <indexterm role="concept">
15808 <primary><option>saslauthd</option> expansion condition</primary>
15809 </indexterm>
15810 This condition supports user authentication using the Cyrus <emphasis>saslauthd</emphasis>
15811 daemon. This replaces the older <emphasis>pwcheck</emphasis> daemon, which is now deprecated.
15812 Using this daemon is one way of making it possible for passwords to be checked
15813 by a process that is not running as root.
15814 </para>
15815 <para>
15816 The saslauthd support is not included in Exim by default. You need to specify
15817 the location of the saslauthd daemon&#x2019;s socket in <filename>Local/Makefile</filename> before
15818 building Exim. For example:
15819 </para>
15820 <literallayout class="monospaced">
15821 CYRUS_SASLAUTHD_SOCKET=/var/state/saslauthd/mux
15822 </literallayout>
15823 <para>
15824 You do not need to install the full Cyrus software suite in order to use
15825 the saslauthd daemon. You can compile and install just the daemon alone
15826 from the Cyrus SASL library.
15827 </para>
15828 <para>
15829 Up to four arguments can be supplied to the <option>saslauthd</option> condition, but only
15830 two are mandatory. For example:
15831 </para>
15832 <literallayout class="monospaced">
15833 server_condition = ${if saslauthd{{$auth1}{$auth2}}}
15834 </literallayout>
15835 <para>
15836 The service and the realm are optional (which is why the arguments are enclosed
15837 in their own set of braces). For details of the meaning of the service and
15838 realm, and how to run the daemon, consult the Cyrus documentation.
15839 </para>
15840 </listitem></varlistentry>
15841 </variablelist>
15842 </section>
15843 <section id="SECID84">
15844 <title>Combining expansion conditions</title>
15845 <para>
15846 <indexterm role="concept">
15847 <primary>expansion</primary>
15848 <secondary>combining conditions</secondary>
15849 </indexterm>
15850 Several conditions can be tested at once by combining them using the <option>and</option>
15851 and <option>or</option> combination conditions. Note that <option>and</option> and <option>or</option> are complete
15852 conditions on their own, and precede their lists of sub-conditions. Each
15853 sub-condition must be enclosed in braces within the overall braces that contain
15854 the list. No repetition of <option>if</option> is used.
15855 </para>
15856 <variablelist>
15857 <varlistentry>
15858 <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>
15859 <listitem>
15860 <para>
15861 <indexterm role="concept">
15862 <primary><quote>or</quote> expansion condition</primary>
15863 </indexterm>
15864 <indexterm role="concept">
15865 <primary>expansion</primary>
15866 <secondary><quote>or</quote> of conditions</secondary>
15867 </indexterm>
15868 The sub-conditions are evaluated from left to right. The condition is true if
15869 any one of the sub-conditions is true.
15870 For example,
15871 </para>
15872 <literallayout class="monospaced">
15873 ${if or {{eq{$local_part}{spqr}}{eq{$domain}{testing.com}}}...
15874 </literallayout>
15875 <para>
15876 When a true sub-condition is found, the following ones are parsed but not
15877 evaluated. If there are several <quote>match</quote> sub-conditions the values of the
15878 numeric variables afterwards are taken from the first one that succeeds.
15879 </para>
15880 </listitem></varlistentry>
15881 <varlistentry>
15882 <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>
15883 <listitem>
15884 <para>
15885 <indexterm role="concept">
15886 <primary><quote>and</quote> expansion condition</primary>
15887 </indexterm>
15888 <indexterm role="concept">
15889 <primary>expansion</primary>
15890 <secondary><quote>and</quote> of conditions</secondary>
15891 </indexterm>
15892 The sub-conditions are evaluated from left to right. The condition is true if
15893 all of the sub-conditions are true. If there are several <quote>match</quote>
15894 sub-conditions, the values of the numeric variables afterwards are taken from
15895 the last one. When a false sub-condition is found, the following ones are
15896 parsed but not evaluated.
15897 </para>
15898 </listitem></varlistentry>
15899 </variablelist>
15900 <para>
15901 <indexterm role="concept" startref="IIDexpcond" class="endofrange"/>
15902 </para>
15903 </section>
15904 <section id="SECTexpvar">
15905 <title>Expansion variables</title>
15906 <para>
15907 <indexterm role="concept">
15908 <primary>expansion</primary>
15909 <secondary>variables, list of</secondary>
15910 </indexterm>
15911 This section contains an alphabetical list of all the expansion variables. Some
15912 of them are available only when Exim is compiled with specific options such as
15913 support for TLS or the content scanning extension.
15914 </para>
15915 <variablelist>
15916 <varlistentry>
15917 <term><varname>$0</varname>, <varname>$1</varname>, etc</term>
15918 <listitem>
15919 <para>
15920 <indexterm role="concept">
15921 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
15922 </indexterm>
15923 When a <option>match</option> expansion condition succeeds, these variables contain the
15924 captured substrings identified by the regular expression during subsequent
15925 processing of the success string of the containing <option>if</option> expansion item.
15926 However, they do not retain their values afterwards; in fact, their previous
15927 values are restored at the end of processing an <option>if</option> item. The numerical
15928 variables may also be set externally by some other matching process which
15929 precedes the expansion of the string. For example, the commands available in
15930 Exim filter files include an <option>if</option> command with its own regular expression
15931 matching condition.
15932 </para>
15933 </listitem></varlistentry>
15934 <varlistentry>
15935 <term><varname>$acl_c...</varname></term>
15936 <listitem>
15937 <para>
15938 Values can be placed in these variables by the <option>set</option> modifier in an ACL. They
15939 can be given any name that starts with <varname>$acl_c</varname> and is at least six characters
15940 long, but the sixth character must be either a digit or an underscore. For
15941 example: <varname>$acl_c5</varname>, <varname>$acl_c_mycount</varname>. The values of the <varname>$acl_c...</varname>
15942 variables persist throughout the lifetime of an SMTP connection. They can be
15943 used to pass information between ACLs and between different invocations of the
15944 same ACL. When a message is received, the values of these variables are saved
15945 with the message, and can be accessed by filters, routers, and transports
15946 during subsequent delivery.
15947 </para>
15948 </listitem></varlistentry>
15949 <varlistentry>
15950 <term><varname>$acl_m...</varname></term>
15951 <listitem>
15952 <para>
15953 These variables are like the <varname>$acl_c...</varname> variables, except that their values
15954 are reset after a message has been received. Thus, if several messages are
15955 received in one SMTP connection, <varname>$acl_m...</varname> values are not passed on from one
15956 message to the next, as <varname>$acl_c...</varname> values are. The <varname>$acl_m...</varname> variables are
15957 also reset by MAIL, RSET, EHLO, HELO, and after starting a TLS session. When a
15958 message is received, the values of these variables are saved with the message,
15959 and can be accessed by filters, routers, and transports during subsequent
15960 delivery.
15961 </para>
15962 </listitem></varlistentry>
15963 <varlistentry>
15964 <term><varname>$acl_verify_message</varname></term>
15965 <listitem>
15966 <para>
15967 <indexterm role="variable">
15968 <primary><varname>$acl_verify_message</varname></primary>
15969 </indexterm>
15970 After an address verification has failed, this variable contains the failure
15971 message. It retains its value for use in subsequent modifiers. The message can
15972 be preserved by coding like this:
15973 </para>
15974 <literallayout class="monospaced">
15975 warn !verify = sender
15976      set acl_m0 = $acl_verify_message
15977 </literallayout>
15978 <para>
15979 You can use <varname>$acl_verify_message</varname> during the expansion of the <option>message</option> or
15980 <option>log_message</option> modifiers, to include information about the verification
15981 failure.
15982 </para>
15983 </listitem></varlistentry>
15984 <varlistentry>
15985 <term><varname>$address_data</varname></term>
15986 <listitem>
15987 <para>
15988 <indexterm role="variable">
15989 <primary><varname>$address_data</varname></primary>
15990 </indexterm>
15991 This variable is set by means of the <option>address_data</option> option in routers. The
15992 value then remains with the address while it is processed by subsequent routers
15993 and eventually a transport. If the transport is handling multiple addresses,
15994 the value from the first address is used. See chapter <xref linkend="CHAProutergeneric"/>
15995 for more details. <emphasis role="bold">Note</emphasis>: The contents of <varname>$address_data</varname> are visible in
15996 user filter files.
15997 </para>
15998 <para>
15999 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify
16000 a recipient address, the final value is still in the variable for subsequent
16001 conditions and modifiers of the ACL statement. If routing the address caused it
16002 to be redirected to just one address, the child address is also routed as part
16003 of the verification, and in this case the final value of <varname>$address_data</varname> is
16004 from the child&#x2019;s routing.
16005 </para>
16006 <para>
16007 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
16008 sender address, the final value is also preserved, but this time in
16009 <varname>$sender_address_data</varname>, to distinguish it from data from a recipient
16010 address.
16011 </para>
16012 <para>
16013 In both cases (recipient and sender verification), the value does not persist
16014 after the end of the current ACL statement. If you want to preserve
16015 these values for longer, you can save them in ACL variables.
16016 </para>
16017 </listitem></varlistentry>
16018 <varlistentry>
16019 <term><varname>$address_file</varname></term>
16020 <listitem>
16021 <para>
16022 <indexterm role="variable">
16023 <primary><varname>$address_file</varname></primary>
16024 </indexterm>
16025 When, as a result of aliasing, forwarding, or filtering, a message is directed
16026 to a specific file, this variable holds the name of the file when the transport
16027 is running. At other times, the variable is empty. For example, using the
16028 default configuration, if user <option>r2d2</option> has a <filename>.forward</filename> file containing
16029 </para>
16030 <literallayout class="monospaced">
16031 /home/r2d2/savemail
16032 </literallayout>
16033 <para>
16034 then when the <command>address_file</command> transport is running, <varname>$address_file</varname>
16035 contains the text string <literal>/home/r2d2/savemail</literal>.
16036 <indexterm role="concept">
16037 <primary>Sieve filter</primary>
16038 <secondary>value of <varname>$address_file</varname></secondary>
16039 </indexterm>
16040 For Sieve filters, the value may be <quote>inbox</quote> or a relative folder name. It is
16041 then up to the transport configuration to generate an appropriate absolute path
16042 to the relevant file.
16043 </para>
16044 </listitem></varlistentry>
16045 <varlistentry>
16046 <term><varname>$address_pipe</varname></term>
16047 <listitem>
16048 <para>
16049 <indexterm role="variable">
16050 <primary><varname>$address_pipe</varname></primary>
16051 </indexterm>
16052 When, as a result of aliasing or forwarding, a message is directed to a pipe,
16053 this variable holds the pipe command when the transport is running.
16054 </para>
16055 </listitem></varlistentry>
16056 <varlistentry>
16057 <term><varname>$auth1</varname> &ndash; <varname>$auth3</varname></term>
16058 <listitem>
16059 <para>
16060 <indexterm role="variable">
16061 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
16062 </indexterm>
16063 These variables are used in SMTP authenticators (see chapters
16064 <xref linkend="CHAPplaintext"/>&ndash;<xref linkend="CHAPspa"/>). Elsewhere, they are empty.
16065 </para>
16066 </listitem></varlistentry>
16067 <varlistentry>
16068 <term><varname>$authenticated_id</varname></term>
16069 <listitem>
16070 <para>
16071 <indexterm role="concept">
16072 <primary>authentication</primary>
16073 <secondary>id</secondary>
16074 </indexterm>
16075 <indexterm role="variable">
16076 <primary><varname>$authenticated_id</varname></primary>
16077 </indexterm>
16078 When a server successfully authenticates a client it may be configured to
16079 preserve some of the authentication information in the variable
16080 <varname>$authenticated_id</varname> (see chapter <xref linkend="CHAPSMTPAUTH"/>). For example, a
16081 user/password authenticator configuration might preserve the user name for use
16082 in the routers. Note that this is not the same information that is saved in
16083 <varname>$sender_host_authenticated</varname>.
16084 When a message is submitted locally (that is, not over a TCP connection)
16085 the value of <varname>$authenticated_id</varname> is normally the login name of the calling
16086 process. However, a trusted user can override this by means of the <option>-oMai</option>
16087 command line option.
16088 </para>
16089 </listitem></varlistentry>
16090 <varlistentry>
16091 <term><varname>$authenticated_sender</varname></term>
16092 <listitem>
16093 <para>
16094 <indexterm role="concept">
16095 <primary>sender</primary>
16096 <secondary>authenticated</secondary>
16097 </indexterm>
16098 <indexterm role="concept">
16099 <primary>authentication</primary>
16100 <secondary>sender</secondary>
16101 </indexterm>
16102 <indexterm role="concept">
16103 <primary>AUTH</primary>
16104 <secondary>on MAIL command</secondary>
16105 </indexterm>
16106 <indexterm role="variable">
16107 <primary><varname>$authenticated_sender</varname></primary>
16108 </indexterm>
16109 When acting as a server, Exim takes note of the AUTH= parameter on an incoming
16110 SMTP MAIL command if it believes the sender is sufficiently trusted, as
16111 described in section <xref linkend="SECTauthparamail"/>. Unless the data is the string
16112 <quote>&lt;&gt;</quote>, it is set as the authenticated sender of the message, and the value is
16113 available during delivery in the <varname>$authenticated_sender</varname> variable. If the
16114 sender is not trusted, Exim accepts the syntax of AUTH=, but ignores the data.
16115 </para>
16116 <para>
16117 <indexterm role="variable">
16118 <primary><varname>$qualify_domain</varname></primary>
16119 </indexterm>
16120 When a message is submitted locally (that is, not over a TCP connection), the
16121 value of <varname>$authenticated_sender</varname> is an address constructed from the login
16122 name of the calling process and <varname>$qualify_domain</varname>, except that a trusted user
16123 can override this by means of the <option>-oMas</option> command line option.
16124 </para>
16125 </listitem></varlistentry>
16126 <varlistentry>
16127 <term><varname>$authentication_failed</varname></term>
16128 <listitem>
16129 <para>
16130 <indexterm role="concept">
16131 <primary>authentication</primary>
16132 <secondary>failure</secondary>
16133 </indexterm>
16134 <indexterm role="variable">
16135 <primary><varname>$authentication_failed</varname></primary>
16136 </indexterm>
16137 This variable is set to <quote>1</quote> in an Exim server if a client issues an AUTH
16138 command that does not succeed. Otherwise it is set to <quote>0</quote>. This makes it
16139 possible to distinguish between <quote>did not try to authenticate</quote>
16140 (<varname>$sender_host_authenticated</varname> is empty and <varname>$authentication_failed</varname> is set to
16141 <quote>0</quote>) and <quote>tried to authenticate but failed</quote> (<varname>$sender_host_authenticated</varname>
16142 is empty and <varname>$authentication_failed</varname> is set to <quote>1</quote>). Failure includes any
16143 negative response to an AUTH command, including (for example) an attempt to use
16144 an undefined mechanism.
16145 </para>
16146 </listitem></varlistentry>
16147 <varlistentry>
16148 <term><varname>$body_linecount</varname></term>
16149 <listitem>
16150 <para>
16151 <indexterm role="concept">
16152 <primary>message body</primary>
16153 <secondary>line count</secondary>
16154 </indexterm>
16155 <indexterm role="concept">
16156 <primary>body of message</primary>
16157 <secondary>line count</secondary>
16158 </indexterm>
16159 <indexterm role="variable">
16160 <primary><varname>$body_linecount</varname></primary>
16161 </indexterm>
16162 When a message is being received or delivered, this variable contains the
16163 number of lines in the message&#x2019;s body. See also <varname>$message_linecount</varname>.
16164 </para>
16165 </listitem></varlistentry>
16166 <varlistentry>
16167 <term><varname>$body_zerocount</varname></term>
16168 <listitem>
16169 <para>
16170 <indexterm role="concept">
16171 <primary>message body</primary>
16172 <secondary>binary zero count</secondary>
16173 </indexterm>
16174 <indexterm role="concept">
16175 <primary>body of message</primary>
16176 <secondary>binary zero count</secondary>
16177 </indexterm>
16178 <indexterm role="concept">
16179 <primary>binary zero</primary>
16180 <secondary>in message body</secondary>
16181 </indexterm>
16182 <indexterm role="variable">
16183 <primary><varname>$body_zerocount</varname></primary>
16184 </indexterm>
16185 When a message is being received or delivered, this variable contains the
16186 number of binary zero bytes in the message&#x2019;s body.
16187 </para>
16188 </listitem></varlistentry>
16189 <varlistentry>
16190 <term><varname>$bounce_recipient</varname></term>
16191 <listitem>
16192 <para>
16193 <indexterm role="variable">
16194 <primary><varname>$bounce_recipient</varname></primary>
16195 </indexterm>
16196 This is set to the recipient address of a bounce message while Exim is creating
16197 it. It is useful if a customized bounce message text file is in use (see
16198 chapter <xref linkend="CHAPemsgcust"/>).
16199 </para>
16200 </listitem></varlistentry>
16201 <varlistentry>
16202 <term><varname>$bounce_return_size_limit</varname></term>
16203 <listitem>
16204 <para>
16205 <indexterm role="variable">
16206 <primary><varname>$bounce_return_size_limit</varname></primary>
16207 </indexterm>
16208 This contains the value set in the <option>bounce_return_size_limit</option> option, rounded
16209 up to a multiple of 1000. It is useful when a customized error message text
16210 file is in use (see chapter <xref linkend="CHAPemsgcust"/>).
16211 </para>
16212 </listitem></varlistentry>
16213 <varlistentry>
16214 <term><varname>$caller_gid</varname></term>
16215 <listitem>
16216 <para>
16217 <indexterm role="concept">
16218 <primary>gid (group id)</primary>
16219 <secondary>caller</secondary>
16220 </indexterm>
16221 <indexterm role="variable">
16222 <primary><varname>$caller_gid</varname></primary>
16223 </indexterm>
16224 The real group id under which the process that called Exim was running. This is
16225 not the same as the group id of the originator of a message (see
16226 <varname>$originator_gid</varname>). If Exim re-execs itself, this variable in the new
16227 incarnation normally contains the Exim gid.
16228 </para>
16229 </listitem></varlistentry>
16230 <varlistentry>
16231 <term><varname>$caller_uid</varname></term>
16232 <listitem>
16233 <para>
16234 <indexterm role="concept">
16235 <primary>uid (user id)</primary>
16236 <secondary>caller</secondary>
16237 </indexterm>
16238 <indexterm role="variable">
16239 <primary><varname>$caller_uid</varname></primary>
16240 </indexterm>
16241 The real user id under which the process that called Exim was running. This is
16242 not the same as the user id of the originator of a message (see
16243 <varname>$originator_uid</varname>). If Exim re-execs itself, this variable in the new
16244 incarnation normally contains the Exim uid.
16245 </para>
16246 </listitem></varlistentry>
16247 <varlistentry>
16248 <term><varname>$compile_date</varname></term>
16249 <listitem>
16250 <para>
16251 <indexterm role="variable">
16252 <primary><varname>$compile_date</varname></primary>
16253 </indexterm>
16254 The date on which the Exim binary was compiled.
16255 </para>
16256 </listitem></varlistentry>
16257 <varlistentry>
16258 <term><varname>$compile_number</varname></term>
16259 <listitem>
16260 <para>
16261 <indexterm role="variable">
16262 <primary><varname>$compile_number</varname></primary>
16263 </indexterm>
16264 The building process for Exim keeps a count of the number
16265 of times it has been compiled. This serves to distinguish different
16266 compilations of the same version of the program.
16267 </para>
16268 </listitem></varlistentry>
16269 <varlistentry>
16270 <term><varname>$demime_errorlevel</varname></term>
16271 <listitem>
16272 <para>
16273 <indexterm role="variable">
16274 <primary><varname>$demime_errorlevel</varname></primary>
16275 </indexterm>
16276 This variable is available when Exim is compiled with
16277 the content-scanning extension and the obsolete <option>demime</option> condition. For
16278 details, see section <xref linkend="SECTdemimecond"/>.
16279 </para>
16280 </listitem></varlistentry>
16281 <varlistentry>
16282 <term><varname>$demime_reason</varname></term>
16283 <listitem>
16284 <para>
16285 <indexterm role="variable">
16286 <primary><varname>$demime_reason</varname></primary>
16287 </indexterm>
16288 This variable is available when Exim is compiled with the
16289 content-scanning extension and the obsolete <option>demime</option> condition. For details,
16290 see section <xref linkend="SECTdemimecond"/>.
16291 </para>
16292 </listitem></varlistentry>
16293 <varlistentry>
16294 <term><varname>$dnslist_domain</varname></term>
16295 <term><varname>$dnslist_matched</varname></term>
16296 <term><varname>$dnslist_text</varname></term>
16297 <term><varname>$dnslist_value</varname></term>
16298 <listitem>
16299 <para>
16300 <indexterm role="variable">
16301 <primary><varname>$dnslist_domain</varname></primary>
16302 </indexterm>
16303 <indexterm role="variable">
16304 <primary><varname>$dnslist_matched</varname></primary>
16305 </indexterm>
16306 <indexterm role="variable">
16307 <primary><varname>$dnslist_text</varname></primary>
16308 </indexterm>
16309 <indexterm role="variable">
16310 <primary><varname>$dnslist_value</varname></primary>
16311 </indexterm>
16312 <indexterm role="concept">
16313 <primary>black list (DNS)</primary>
16314 </indexterm>
16315 When a DNS (black) list lookup succeeds, these variables are set to contain
16316 the following data from the lookup: the list&#x2019;s domain name, the key that was
16317 looked up, the contents of any associated TXT record, and the value from the
16318 main A record. See section <xref linkend="SECID204"/> for more details.
16319 </para>
16320 </listitem></varlistentry>
16321 <varlistentry>
16322 <term><varname>$domain</varname></term>
16323 <listitem>
16324 <para>
16325 <indexterm role="variable">
16326 <primary><varname>$domain</varname></primary>
16327 </indexterm>
16328 When an address is being routed, or delivered on its own, this variable
16329 contains the domain. Uppercase letters in the domain are converted into lower
16330 case for <varname>$domain</varname>.
16331 </para>
16332 <para>
16333 Global address rewriting happens when a message is received, so the value of
16334 <varname>$domain</varname> during routing and delivery is the value after rewriting. <varname>$domain</varname>
16335 is set during user filtering, but not during system filtering, because a
16336 message may have many recipients and the system filter is called just once.
16337 </para>
16338 <para>
16339 When more than one address is being delivered at once (for example, several
16340 RCPT commands in one SMTP delivery), <varname>$domain</varname> is set only if they all
16341 have the same domain. Transports can be restricted to handling only one domain
16342 at a time if the value of <varname>$domain</varname> is required at transport time &ndash; this is
16343 the default for local transports. For further details of the environment in
16344 which local transports are run, see chapter <xref linkend="CHAPenvironment"/>.
16345 </para>
16346 <para>
16347 <indexterm role="option">
16348 <primary><option>delay_warning_condition</option></primary>
16349 </indexterm>
16350 At the end of a delivery, if all deferred addresses have the same domain, it is
16351 set in <varname>$domain</varname> during the expansion of <option>delay_warning_condition</option>.
16352 </para>
16353 <para>
16354 The <varname>$domain</varname> variable is also used in some other circumstances:
16355 </para>
16356 <itemizedlist>
16357 <listitem>
16358 <para>
16359 When an ACL is running for a RCPT command, <varname>$domain</varname> contains the domain of
16360 the recipient address. The domain of the <emphasis>sender</emphasis> address is in
16361 <varname>$sender_address_domain</varname> at both MAIL time and at RCPT time. <varname>$domain</varname> is not
16362 normally set during the running of the MAIL ACL. However, if the sender address
16363 is verified with a callout during the MAIL ACL, the sender domain is placed in
16364 <varname>$domain</varname> during the expansions of <option>hosts</option>, <option>interface</option>, and <option>port</option> in
16365 the <command>smtp</command> transport.
16366 </para>
16367 </listitem>
16368 <listitem>
16369 <para>
16370 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
16371 <varname>$domain</varname> contains the domain portion of the address that is being rewritten;
16372 it can be used in the expansion of the replacement address, for example, to
16373 rewrite domains by file lookup.
16374 </para>
16375 </listitem>
16376 <listitem>
16377 <para>
16378 With one important exception, whenever a domain list is being scanned,
16379 <varname>$domain</varname> contains the subject domain. <emphasis role="bold">Exception</emphasis>: When a domain list in
16380 a <option>sender_domains</option> condition in an ACL is being processed, the subject domain
16381 is in <varname>$sender_address_domain</varname> and not in <varname>$domain</varname>. It works this way so
16382 that, in a RCPT ACL, the sender domain list can be dependent on the
16383 recipient domain (which is what is in <varname>$domain</varname> at this time).
16384 </para>
16385 </listitem>
16386 <listitem>
16387 <para>
16388 <indexterm role="concept">
16389 <primary>ETRN</primary>
16390 <secondary>value of <varname>$domain</varname></secondary>
16391 </indexterm>
16392 <indexterm role="option">
16393 <primary><option>smtp_etrn_command</option></primary>
16394 </indexterm>
16395 When the <option>smtp_etrn_command</option> option is being expanded, <varname>$domain</varname> contains
16396 the complete argument of the ETRN command (see section <xref linkend="SECTETRN"/>).
16397 </para>
16398 </listitem>
16399 </itemizedlist>
16400 </listitem></varlistentry>
16401 <varlistentry>
16402 <term><varname>$domain_data</varname></term>
16403 <listitem>
16404 <para>
16405 <indexterm role="variable">
16406 <primary><varname>$domain_data</varname></primary>
16407 </indexterm>
16408 When the <option>domains</option> option on a router matches a domain by
16409 means of a lookup, the data read by the lookup is available during the running
16410 of the router as <varname>$domain_data</varname>. In addition, if the driver routes the
16411 address to a transport, the value is available in that transport. If the
16412 transport is handling multiple addresses, the value from the first address is
16413 used.
16414 </para>
16415 <para>
16416 <varname>$domain_data</varname> is also set when the <option>domains</option> condition in an ACL matches a
16417 domain by means of a lookup. The data read by the lookup is available during
16418 the rest of the ACL statement. In all other situations, this variable expands
16419 to nothing.
16420 </para>
16421 </listitem></varlistentry>
16422 <varlistentry>
16423 <term><varname>$exim_gid</varname></term>
16424 <listitem>
16425 <para>
16426 <indexterm role="variable">
16427 <primary><varname>$exim_gid</varname></primary>
16428 </indexterm>
16429 This variable contains the numerical value of the Exim group id.
16430 </para>
16431 </listitem></varlistentry>
16432 <varlistentry>
16433 <term><varname>$exim_path</varname></term>
16434 <listitem>
16435 <para>
16436 <indexterm role="variable">
16437 <primary><varname>$exim_path</varname></primary>
16438 </indexterm>
16439 This variable contains the path to the Exim binary.
16440 </para>
16441 </listitem></varlistentry>
16442 <varlistentry>
16443 <term><varname>$exim_uid</varname></term>
16444 <listitem>
16445 <para>
16446 <indexterm role="variable">
16447 <primary><varname>$exim_uid</varname></primary>
16448 </indexterm>
16449 This variable contains the numerical value of the Exim user id.
16450 </para>
16451 </listitem></varlistentry>
16452 <varlistentry>
16453 <term><varname>$found_extension</varname></term>
16454 <listitem>
16455 <para>
16456 <indexterm role="variable">
16457 <primary><varname>$found_extension</varname></primary>
16458 </indexterm>
16459 This variable is available when Exim is compiled with the
16460 content-scanning extension and the obsolete <option>demime</option> condition. For details,
16461 see section <xref linkend="SECTdemimecond"/>.
16462 </para>
16463 </listitem></varlistentry>
16464 <varlistentry>
16465 <term><varname>$header_</varname>&lt;<emphasis>name</emphasis>&gt;</term>
16466 <listitem>
16467 <para>
16468 This is not strictly an expansion variable. It is expansion syntax for
16469 inserting the message header line with the given name. Note that the name must
16470 be terminated by colon or white space, because it may contain a wide variety of
16471 characters. Note also that braces must <emphasis>not</emphasis> be used.
16472 </para>
16473 </listitem></varlistentry>
16474 <varlistentry>
16475 <term><varname>$home</varname></term>
16476 <listitem>
16477 <para>
16478 <indexterm role="variable">
16479 <primary><varname>$home</varname></primary>
16480 </indexterm>
16481 When the <option>check_local_user</option> option is set for a router, the user&#x2019;s home
16482 directory is placed in <varname>$home</varname> when the check succeeds. In particular, this
16483 means it is set during the running of users&#x2019; filter files. A router may also
16484 explicitly set a home directory for use by a transport; this can be overridden
16485 by a setting on the transport itself.
16486 </para>
16487 <para>
16488 When running a filter test via the <option>-bf</option> option, <varname>$home</varname> is set to the value
16489 of the environment variable HOME.
16490 </para>
16491 </listitem></varlistentry>
16492 <varlistentry>
16493 <term><varname>$host</varname></term>
16494 <listitem>
16495 <para>
16496 <indexterm role="variable">
16497 <primary><varname>$host</varname></primary>
16498 </indexterm>
16499 If a router assigns an address to a transport (any transport), and passes a
16500 list of hosts with the address, the value of <varname>$host</varname> when the transport starts
16501 to run is the name of the first host on the list. Note that this applies both
16502 to local and remote transports.
16503 </para>
16504 <para>
16505 <indexterm role="concept">
16506 <primary>transport</primary>
16507 <secondary>filter</secondary>
16508 </indexterm>
16509 <indexterm role="concept">
16510 <primary>filter</primary>
16511 <secondary>transport filter</secondary>
16512 </indexterm>
16513 For the <command>smtp</command> transport, if there is more than one host, the value of
16514 <varname>$host</varname> changes as the transport works its way through the list. In
16515 particular, when the <command>smtp</command> transport is expanding its options for encryption
16516 using TLS, or for specifying a transport filter (see chapter
16517 <xref linkend="CHAPtransportgeneric"/>), <varname>$host</varname> contains the name of the host to which it
16518 is connected.
16519 </para>
16520 <para>
16521 When used in the client part of an authenticator configuration (see chapter
16522 <xref linkend="CHAPSMTPAUTH"/>), <varname>$host</varname> contains the name of the server to which the
16523 client is connected.
16524 </para>
16525 </listitem></varlistentry>
16526 <varlistentry>
16527 <term><varname>$host_address</varname></term>
16528 <listitem>
16529 <para>
16530 <indexterm role="variable">
16531 <primary><varname>$host_address</varname></primary>
16532 </indexterm>
16533 This variable is set to the remote host&#x2019;s IP address whenever <varname>$host</varname> is set
16534 for a remote connection. It is also set to the IP address that is being checked
16535 when the <option>ignore_target_hosts</option> option is being processed.
16536 </para>
16537 </listitem></varlistentry>
16538 <varlistentry>
16539 <term><varname>$host_data</varname></term>
16540 <listitem>
16541 <para>
16542 <indexterm role="variable">
16543 <primary><varname>$host_data</varname></primary>
16544 </indexterm>
16545 If a <option>hosts</option> condition in an ACL is satisfied by means of a lookup, the
16546 result of the lookup is made available in the <varname>$host_data</varname> variable. This
16547 allows you, for example, to do things like this:
16548 </para>
16549 <literallayout class="monospaced">
16550 deny  hosts = net-lsearch;/some/file
16551 message = $host_data
16552 </literallayout>
16553 </listitem></varlistentry>
16554 <varlistentry>
16555 <term><varname>$host_lookup_deferred</varname></term>
16556 <listitem>
16557 <para>
16558 <indexterm role="concept">
16559 <primary>host name</primary>
16560 <secondary>lookup, failure of</secondary>
16561 </indexterm>
16562 <indexterm role="variable">
16563 <primary><varname>$host_lookup_deferred</varname></primary>
16564 </indexterm>
16565 This variable normally contains <quote>0</quote>, as does <varname>$host_lookup_failed</varname>. When a
16566 message comes from a remote host and there is an attempt to look up the host&#x2019;s
16567 name from its IP address, and the attempt is not successful, one of these
16568 variables is set to <quote>1</quote>.
16569 </para>
16570 <itemizedlist>
16571 <listitem>
16572 <para>
16573 If the lookup receives a definite negative response (for example, a DNS lookup
16574 succeeded, but no records were found), <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
16575 </para>
16576 </listitem>
16577 <listitem>
16578 <para>
16579 If there is any kind of problem during the lookup, such that Exim cannot
16580 tell whether or not the host name is defined (for example, a timeout for a DNS
16581 lookup), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>.
16582 </para>
16583 </listitem>
16584 </itemizedlist>
16585 <para>
16586 Looking up a host&#x2019;s name from its IP address consists of more than just a
16587 single reverse lookup. Exim checks that a forward lookup of at least one of the
16588 names it receives from a reverse lookup yields the original IP address. If this
16589 is not the case, Exim does not accept the looked up name(s), and
16590 <varname>$host_lookup_failed</varname> is set to <quote>1</quote>. Thus, being able to find a name from an
16591 IP address (for example, the existence of a PTR record in the DNS) is not
16592 sufficient on its own for the success of a host name lookup. If the reverse
16593 lookup succeeds, but there is a lookup problem such as a timeout when checking
16594 the result, the name is not accepted, and <varname>$host_lookup_deferred</varname> is set to
16595 <quote>1</quote>. See also <varname>$sender_host_name</varname>.
16596 </para>
16597 </listitem></varlistentry>
16598 <varlistentry>
16599 <term><varname>$host_lookup_failed</varname></term>
16600 <listitem>
16601 <para>
16602 <indexterm role="variable">
16603 <primary><varname>$host_lookup_failed</varname></primary>
16604 </indexterm>
16605 See <varname>$host_lookup_deferred</varname>.
16606 </para>
16607 </listitem></varlistentry>
16608 <varlistentry>
16609 <term><varname>$inode</varname></term>
16610 <listitem>
16611 <para>
16612 <indexterm role="variable">
16613 <primary><varname>$inode</varname></primary>
16614 </indexterm>
16615 The only time this variable is set is while expanding the <option>directory_file</option>
16616 option in the <command>appendfile</command> transport. The variable contains the inode number
16617 of the temporary file which is about to be renamed. It can be used to construct
16618 a unique name for the file.
16619 </para>
16620 </listitem></varlistentry>
16621 <varlistentry>
16622 <term><varname>$interface_address</varname></term>
16623 <listitem>
16624 <para>
16625 <indexterm role="variable">
16626 <primary><varname>$interface_address</varname></primary>
16627 </indexterm>
16628 This is an obsolete name for <varname>$received_ip_address</varname>.
16629 </para>
16630 </listitem></varlistentry>
16631 <varlistentry>
16632 <term><varname>$interface_port</varname></term>
16633 <listitem>
16634 <para>
16635 <indexterm role="variable">
16636 <primary><varname>$interface_port</varname></primary>
16637 </indexterm>
16638 This is an obsolete name for <varname>$received_port</varname>.
16639 </para>
16640 </listitem></varlistentry>
16641 <varlistentry>
16642 <term><varname>$item</varname></term>
16643 <listitem>
16644 <para>
16645 <indexterm role="variable">
16646 <primary><varname>$item</varname></primary>
16647 </indexterm>
16648 This variable is used during the expansion of <emphasis role="bold">forall</emphasis> and <emphasis role="bold">forany</emphasis>
16649 conditions (see section <xref linkend="SECTexpcond"/>), and <emphasis role="bold">filter</emphasis>, <emphasis role="bold">map</emphasis>, and
16650 <emphasis role="bold">reduce</emphasis> items (see section <xref linkend="SECTexpcond"/>). In other circumstances, it is
16651 empty.
16652 </para>
16653 </listitem></varlistentry>
16654 <varlistentry>
16655 <term><varname>$ldap_dn</varname></term>
16656 <listitem>
16657 <para>
16658 <indexterm role="variable">
16659 <primary><varname>$ldap_dn</varname></primary>
16660 </indexterm>
16661 This variable, which is available only when Exim is compiled with LDAP support,
16662 contains the DN from the last entry in the most recently successful LDAP
16663 lookup.
16664 </para>
16665 </listitem></varlistentry>
16666 <varlistentry>
16667 <term><varname>$load_average</varname></term>
16668 <listitem>
16669 <para>
16670 <indexterm role="variable">
16671 <primary><varname>$load_average</varname></primary>
16672 </indexterm>
16673 This variable contains the system load average, multiplied by 1000 so that it
16674 is an integer. For example, if the load average is 0.21, the value of the
16675 variable is 210. The value is recomputed every time the variable is referenced.
16676 </para>
16677 </listitem></varlistentry>
16678 <varlistentry>
16679 <term><varname>$local_part</varname></term>
16680 <listitem>
16681 <para>
16682 <indexterm role="variable">
16683 <primary><varname>$local_part</varname></primary>
16684 </indexterm>
16685 When an address is being routed, or delivered on its own, this
16686 variable contains the local part. When a number of addresses are being
16687 delivered together (for example, multiple RCPT commands in an SMTP
16688 session), <varname>$local_part</varname> is not set.
16689 </para>
16690 <para>
16691 Global address rewriting happens when a message is received, so the value of
16692 <varname>$local_part</varname> during routing and delivery is the value after rewriting.
16693 <varname>$local_part</varname> is set during user filtering, but not during system filtering,
16694 because a message may have many recipients and the system filter is called just
16695 once.
16696 </para>
16697 <para>
16698 <indexterm role="variable">
16699 <primary><varname>$local_part_prefix</varname></primary>
16700 </indexterm>
16701 <indexterm role="variable">
16702 <primary><varname>$local_part_suffix</varname></primary>
16703 </indexterm>
16704 If a local part prefix or suffix has been recognized, it is not included in the
16705 value of <varname>$local_part</varname> during routing and subsequent delivery. The values of
16706 any prefix or suffix are in <varname>$local_part_prefix</varname> and
16707 <varname>$local_part_suffix</varname>, respectively.
16708 </para>
16709 <para>
16710 When a message is being delivered to a file, pipe, or autoreply transport as a
16711 result of aliasing or forwarding, <varname>$local_part</varname> is set to the local part of
16712 the parent address, not to the file name or command (see <varname>$address_file</varname> and
16713 <varname>$address_pipe</varname>).
16714 </para>
16715 <para>
16716 When an ACL is running for a RCPT command, <varname>$local_part</varname> contains the
16717 local part of the recipient address.
16718 </para>
16719 <para>
16720 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
16721 <varname>$local_part</varname> contains the local part of the address that is being rewritten;
16722 it can be used in the expansion of the replacement address, for example.
16723 </para>
16724 <para>
16725 In all cases, all quoting is removed from the local part. For example, for both
16726 the addresses
16727 </para>
16728 <literallayout class="monospaced">
16729 "abc:xyz"@test.example
16730 abc\:xyz@test.example
16731 </literallayout>
16732 <para>
16733 the value of <varname>$local_part</varname> is
16734 </para>
16735 <literallayout class="monospaced">
16736 abc:xyz
16737 </literallayout>
16738 <para>
16739 If you use <varname>$local_part</varname> to create another address, you should always wrap it
16740 inside a quoting operator. For example, in a <command>redirect</command> router you could
16741 have:
16742 </para>
16743 <literallayout class="monospaced">
16744 data = ${quote_local_part:$local_part}@new.domain.example
16745 </literallayout>
16746 <para>
16747 <emphasis role="bold">Note</emphasis>: The value of <varname>$local_part</varname> is normally lower cased. If you want
16748 to process local parts in a case-dependent manner in a router, you can set the
16749 <option>caseful_local_part</option> option (see chapter <xref linkend="CHAProutergeneric"/>).
16750 </para>
16751 </listitem></varlistentry>
16752 <varlistentry>
16753 <term><varname>$local_part_data</varname></term>
16754 <listitem>
16755 <para>
16756 <indexterm role="variable">
16757 <primary><varname>$local_part_data</varname></primary>
16758 </indexterm>
16759 When the <option>local_parts</option> option on a router matches a local part by means of a
16760 lookup, the data read by the lookup is available during the running of the
16761 router as <varname>$local_part_data</varname>. In addition, if the driver routes the address
16762 to a transport, the value is available in that transport. If the transport is
16763 handling multiple addresses, the value from the first address is used.
16764 </para>
16765 <para>
16766 <varname>$local_part_data</varname> is also set when the <option>local_parts</option> condition in an ACL
16767 matches a local part by means of a lookup. The data read by the lookup is
16768 available during the rest of the ACL statement. In all other situations, this
16769 variable expands to nothing.
16770 </para>
16771 </listitem></varlistentry>
16772 <varlistentry>
16773 <term><varname>$local_part_prefix</varname></term>
16774 <listitem>
16775 <para>
16776 <indexterm role="variable">
16777 <primary><varname>$local_part_prefix</varname></primary>
16778 </indexterm>
16779 When an address is being routed or delivered, and a
16780 specific prefix for the local part was recognized, it is available in this
16781 variable, having been removed from <varname>$local_part</varname>.
16782 </para>
16783 </listitem></varlistentry>
16784 <varlistentry>
16785 <term><varname>$local_part_suffix</varname></term>
16786 <listitem>
16787 <para>
16788 <indexterm role="variable">
16789 <primary><varname>$local_part_suffix</varname></primary>
16790 </indexterm>
16791 When an address is being routed or delivered, and a
16792 specific suffix for the local part was recognized, it is available in this
16793 variable, having been removed from <varname>$local_part</varname>.
16794 </para>
16795 </listitem></varlistentry>
16796 <varlistentry>
16797 <term><varname>$local_scan_data</varname></term>
16798 <listitem>
16799 <para>
16800 <indexterm role="variable">
16801 <primary><varname>$local_scan_data</varname></primary>
16802 </indexterm>
16803 This variable contains the text returned by the <function>local_scan()</function> function when
16804 a message is received. See chapter <xref linkend="CHAPlocalscan"/> for more details.
16805 </para>
16806 </listitem></varlistentry>
16807 <varlistentry>
16808 <term><varname>$local_user_gid</varname></term>
16809 <listitem>
16810 <para>
16811 <indexterm role="variable">
16812 <primary><varname>$local_user_gid</varname></primary>
16813 </indexterm>
16814 See <varname>$local_user_uid</varname>.
16815 </para>
16816 </listitem></varlistentry>
16817 <varlistentry>
16818 <term><varname>$local_user_uid</varname></term>
16819 <listitem>
16820 <para>
16821 <indexterm role="variable">
16822 <primary><varname>$local_user_uid</varname></primary>
16823 </indexterm>
16824 This variable and <varname>$local_user_gid</varname> are set to the uid and gid after the
16825 <option>check_local_user</option> router precondition succeeds. This means that their values
16826 are available for the remaining preconditions (<option>senders</option>, <option>require_files</option>,
16827 and <option>condition</option>), for the <option>address_data</option> expansion, and for any
16828 router-specific expansions. At all other times, the values in these variables
16829 are <literal>(uid_t)(-1)</literal> and <literal>(gid_t)(-1)</literal>, respectively.
16830 </para>
16831 </listitem></varlistentry>
16832 <varlistentry>
16833 <term><varname>$localhost_number</varname></term>
16834 <listitem>
16835 <para>
16836 <indexterm role="variable">
16837 <primary><varname>$localhost_number</varname></primary>
16838 </indexterm>
16839 This contains the expanded value of the
16840 <option>localhost_number</option> option. The expansion happens after the main options have
16841 been read.
16842 </para>
16843 </listitem></varlistentry>
16844 <varlistentry>
16845 <term><varname>$log_inodes</varname></term>
16846 <listitem>
16847 <para>
16848 <indexterm role="variable">
16849 <primary><varname>$log_inodes</varname></primary>
16850 </indexterm>
16851 The number of free inodes in the disk partition where Exim&#x2019;s
16852 log files are being written. The value is recalculated whenever the variable is
16853 referenced. If the relevant file system does not have the concept of inodes,
16854 the value of is -1. See also the <option>check_log_inodes</option> option.
16855 </para>
16856 </listitem></varlistentry>
16857 <varlistentry>
16858 <term><varname>$log_space</varname></term>
16859 <listitem>
16860 <para>
16861 <indexterm role="variable">
16862 <primary><varname>$log_space</varname></primary>
16863 </indexterm>
16864 The amount of free space (as a number of kilobytes) in the disk
16865 partition where Exim&#x2019;s log files are being written. The value is recalculated
16866 whenever the variable is referenced. If the operating system does not have the
16867 ability to find the amount of free space (only true for experimental systems),
16868 the space value is -1. See also the <option>check_log_space</option> option.
16869 </para>
16870 </listitem></varlistentry>
16871 <varlistentry>
16872 <term><varname>$mailstore_basename</varname></term>
16873 <listitem>
16874 <para>
16875 <indexterm role="variable">
16876 <primary><varname>$mailstore_basename</varname></primary>
16877 </indexterm>
16878 This variable is set only when doing deliveries in <quote>mailstore</quote> format in the
16879 <command>appendfile</command> transport. During the expansion of the <option>mailstore_prefix</option>,
16880 <option>mailstore_suffix</option>, <option>message_prefix</option>, and <option>message_suffix</option> options, it
16881 contains the basename of the files that are being written, that is, the name
16882 without the <quote>.tmp</quote>, <quote>.env</quote>, or <quote>.msg</quote> suffix. At all other times, this
16883 variable is empty.
16884 </para>
16885 </listitem></varlistentry>
16886 <varlistentry>
16887 <term><varname>$malware_name</varname></term>
16888 <listitem>
16889 <para>
16890 <indexterm role="variable">
16891 <primary><varname>$malware_name</varname></primary>
16892 </indexterm>
16893 This variable is available when Exim is compiled with the
16894 content-scanning extension. It is set to the name of the virus that was found
16895 when the ACL <option>malware</option> condition is true (see section <xref linkend="SECTscanvirus"/>).
16896 </para>
16897 </listitem></varlistentry>
16898 <varlistentry>
16899 <term><varname>$max_received_linelength</varname></term>
16900 <listitem>
16901 <para>
16902 <indexterm role="variable">
16903 <primary><varname>$max_received_linelength</varname></primary>
16904 </indexterm>
16905 <indexterm role="concept">
16906 <primary>maximum</primary>
16907 <secondary>line length</secondary>
16908 </indexterm>
16909 <indexterm role="concept">
16910 <primary>line length</primary>
16911 <secondary>maximum</secondary>
16912 </indexterm>
16913 This variable contains the number of bytes in the longest line that was
16914 received as part of the message, not counting the line termination
16915 character(s).
16916 </para>
16917 </listitem></varlistentry>
16918 <varlistentry>
16919 <term><varname>$message_age</varname></term>
16920 <listitem>
16921 <para>
16922 <indexterm role="concept">
16923 <primary>message</primary>
16924 <secondary>age of</secondary>
16925 </indexterm>
16926 <indexterm role="variable">
16927 <primary><varname>$message_age</varname></primary>
16928 </indexterm>
16929 This variable is set at the start of a delivery attempt to contain the number
16930 of seconds since the message was received. It does not change during a single
16931 delivery attempt.
16932 </para>
16933 </listitem></varlistentry>
16934 <varlistentry>
16935 <term><varname>$message_body</varname></term>
16936 <listitem>
16937 <para>
16938 <indexterm role="concept">
16939 <primary>body of message</primary>
16940 <secondary>expansion variable</secondary>
16941 </indexterm>
16942 <indexterm role="concept">
16943 <primary>message body</primary>
16944 <secondary>in expansion</secondary>
16945 </indexterm>
16946 <indexterm role="concept">
16947 <primary>binary zero</primary>
16948 <secondary>in message body</secondary>
16949 </indexterm>
16950 <indexterm role="variable">
16951 <primary><varname>$message_body</varname></primary>
16952 </indexterm>
16953 <indexterm role="option">
16954 <primary><option>message_body_visible</option></primary>
16955 </indexterm>
16956 This variable contains the initial portion of a message&#x2019;s body while it is
16957 being delivered, and is intended mainly for use in filter files. The maximum
16958 number of characters of the body that are put into the variable is set by the
16959 <option>message_body_visible</option> configuration option; the default is 500.
16960 </para>
16961 <para>
16962 <indexterm role="option">
16963 <primary><option>message_body_newlines</option></primary>
16964 </indexterm>
16965 By default, newlines are converted into spaces in <varname>$message_body</varname>, to make it
16966 easier to search for phrases that might be split over a line break. However,
16967 this can be disabled by setting <option>message_body_newlines</option> to be true. Binary
16968 zeros are always converted into spaces.
16969 </para>
16970 </listitem></varlistentry>
16971 <varlistentry>
16972 <term><varname>$message_body_end</varname></term>
16973 <listitem>
16974 <para>
16975 <indexterm role="concept">
16976 <primary>body of message</primary>
16977 <secondary>expansion variable</secondary>
16978 </indexterm>
16979 <indexterm role="concept">
16980 <primary>message body</primary>
16981 <secondary>in expansion</secondary>
16982 </indexterm>
16983 <indexterm role="variable">
16984 <primary><varname>$message_body_end</varname></primary>
16985 </indexterm>
16986 This variable contains the final portion of a message&#x2019;s
16987 body while it is being delivered. The format and maximum size are as for
16988 <varname>$message_body</varname>.
16989 </para>
16990 </listitem></varlistentry>
16991 <varlistentry>
16992 <term><varname>$message_body_size</varname></term>
16993 <listitem>
16994 <para>
16995 <indexterm role="concept">
16996 <primary>body of message</primary>
16997 <secondary>size</secondary>
16998 </indexterm>
16999 <indexterm role="concept">
17000 <primary>message body</primary>
17001 <secondary>size</secondary>
17002 </indexterm>
17003 <indexterm role="variable">
17004 <primary><varname>$message_body_size</varname></primary>
17005 </indexterm>
17006 When a message is being delivered, this variable contains the size of the body
17007 in bytes. The count starts from the character after the blank line that
17008 separates the body from the header. Newlines are included in the count. See
17009 also <varname>$message_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
17010 </para>
17011 </listitem></varlistentry>
17012 <varlistentry>
17013 <term><varname>$message_exim_id</varname></term>
17014 <listitem>
17015 <para>
17016 <indexterm role="variable">
17017 <primary><varname>$message_exim_id</varname></primary>
17018 </indexterm>
17019 When a message is being received or delivered, this variable contains the
17020 unique message id that is generated and used by Exim to identify the message.
17021 An id is not created for a message until after its header has been successfully
17022 received. <emphasis role="bold">Note</emphasis>: This is <emphasis>not</emphasis> the contents of the <emphasis>Message-ID:</emphasis> header
17023 line; it is the local id that Exim assigns to the message, for example:
17024 <literal>1BXTIK-0001yO-VA</literal>.
17025 </para>
17026 </listitem></varlistentry>
17027 <varlistentry>
17028 <term><varname>$message_headers</varname></term>
17029 <listitem>
17030 <para>
17031 <indexterm role="variable">
17032 <primary><varname>$message_headers</varname></primary>
17033 </indexterm>
17034 This variable contains a concatenation of all the header lines when a message
17035 is being processed, except for lines added by routers or transports. The header
17036 lines are separated by newline characters. Their contents are decoded in the
17037 same way as a header line that is inserted by <option>bheader</option>.
17038 </para>
17039 </listitem></varlistentry>
17040 <varlistentry>
17041 <term><varname>$message_headers_raw</varname></term>
17042 <listitem>
17043 <para>
17044 <indexterm role="variable">
17045 <primary><varname>$message_headers_raw</varname></primary>
17046 </indexterm>
17047 This variable is like <varname>$message_headers</varname> except that no processing of the
17048 contents of header lines is done.
17049 </para>
17050 </listitem></varlistentry>
17051 <varlistentry>
17052 <term><varname>$message_id</varname></term>
17053 <listitem>
17054 <para>
17055 This is an old name for <varname>$message_exim_id</varname>, which is now deprecated.
17056 </para>
17057 </listitem></varlistentry>
17058 <varlistentry>
17059 <term><varname>$message_linecount</varname></term>
17060 <listitem>
17061 <para>
17062 <indexterm role="variable">
17063 <primary><varname>$message_linecount</varname></primary>
17064 </indexterm>
17065 This variable contains the total number of lines in the header and body of the
17066 message. Compare <varname>$body_linecount</varname>, which is the count for the body only.
17067 During the DATA and content-scanning ACLs, <varname>$message_linecount</varname> contains the
17068 number of lines received. Before delivery happens (that is, before filters,
17069 routers, and transports run) the count is increased to include the
17070 <emphasis>Received:</emphasis> header line that Exim standardly adds, and also any other header
17071 lines that are added by ACLs. The blank line that separates the message header
17072 from the body is not counted.
17073 </para>
17074 <para revisionflag="changed">
17075 As with the special case of <varname>$message_size</varname>, during the expansion of the
17076 appendfile transport&#x2019;s maildir_tag option in maildir format, the value of
17077 <varname>$message_linecount</varname> is the precise size of the number of newlines in the
17078 file that has been written (minus one for the blank line between the
17079 header and the body).
17080 </para>
17081 <para>
17082 Here is an example of the use of this variable in a DATA ACL:
17083 </para>
17084 <literallayout class="monospaced">
17085 deny message   = Too many lines in message header
17086      condition = \
17087       ${if &lt;{250}{${eval:$message_linecount - $body_linecount}}}
17088 </literallayout>
17089 <para>
17090 In the MAIL and RCPT ACLs, the value is zero because at that stage the
17091 message has not yet been received.
17092 </para>
17093 </listitem></varlistentry>
17094 <varlistentry>
17095 <term><varname>$message_size</varname></term>
17096 <listitem>
17097 <para>
17098 <indexterm role="concept">
17099 <primary>size</primary>
17100 <secondary>of message</secondary>
17101 </indexterm>
17102 <indexterm role="concept">
17103 <primary>message</primary>
17104 <secondary>size</secondary>
17105 </indexterm>
17106 <indexterm role="variable">
17107 <primary><varname>$message_size</varname></primary>
17108 </indexterm>
17109 When a message is being processed, this variable contains its size in bytes. In
17110 most cases, the size includes those headers that were received with the
17111 message, but not those (such as <emphasis>Envelope-to:</emphasis>) that are added to individual
17112 deliveries as they are written. However, there is one special case: during the
17113 expansion of the <option>maildir_tag</option> option in the <command>appendfile</command> transport while
17114 doing a delivery in maildir format, the value of <varname>$message_size</varname> is the
17115 precise size of the file that has been written. See also
17116 <varname>$message_body_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
17117 </para>
17118 <para>
17119 <indexterm role="concept">
17120 <primary>RCPT</primary>
17121 <secondary>value of <varname>$message_size</varname></secondary>
17122 </indexterm>
17123 While running a per message ACL (mail/rcpt/predata), <varname>$message_size</varname>
17124 contains the size supplied on the MAIL command, or -1 if no size was given. The
17125 value may not, of course, be truthful.
17126 </para>
17127 </listitem></varlistentry>
17128 <varlistentry>
17129 <term><varname>$mime_</varname><emphasis>xxx</emphasis></term>
17130 <listitem>
17131 <para>
17132 A number of variables whose names start with <varname>$mime</varname> are
17133 available when Exim is compiled with the content-scanning extension. For
17134 details, see section <xref linkend="SECTscanmimepart"/>.
17135 </para>
17136 </listitem></varlistentry>
17137 <varlistentry>
17138 <term><varname>$n0</varname> &ndash; <varname>$n9</varname></term>
17139 <listitem>
17140 <para>
17141 These variables are counters that can be incremented by means
17142 of the <option>add</option> command in filter files.
17143 </para>
17144 </listitem></varlistentry>
17145 <varlistentry>
17146 <term><varname>$original_domain</varname></term>
17147 <listitem>
17148 <para>
17149 <indexterm role="variable">
17150 <primary><varname>$domain</varname></primary>
17151 </indexterm>
17152 <indexterm role="variable">
17153 <primary><varname>$original_domain</varname></primary>
17154 </indexterm>
17155 When a top-level address is being processed for delivery, this contains the
17156 same value as <varname>$domain</varname>. However, if a <quote>child</quote> address (for example,
17157 generated by an alias, forward, or filter file) is being processed, this
17158 variable contains the domain of the original address (lower cased). This
17159 differs from <varname>$parent_domain</varname> only when there is more than one level of
17160 aliasing or forwarding. When more than one address is being delivered in a
17161 single transport run, <varname>$original_domain</varname> is not set.
17162 </para>
17163 <para>
17164 If a new address is created by means of a <option>deliver</option> command in a system
17165 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
17166 part <emphasis>system-filter</emphasis> and the default qualify domain.
17167 </para>
17168 </listitem></varlistentry>
17169 <varlistentry>
17170 <term><varname>$original_local_part</varname></term>
17171 <listitem>
17172 <para>
17173 <indexterm role="variable">
17174 <primary><varname>$local_part</varname></primary>
17175 </indexterm>
17176 <indexterm role="variable">
17177 <primary><varname>$original_local_part</varname></primary>
17178 </indexterm>
17179 When a top-level address is being processed for delivery, this contains the
17180 same value as <varname>$local_part</varname>, unless a prefix or suffix was removed from the
17181 local part, because <varname>$original_local_part</varname> always contains the full local
17182 part. When a <quote>child</quote> address (for example, generated by an alias, forward, or
17183 filter file) is being processed, this variable contains the full local part of
17184 the original address.
17185 </para>
17186 <para>
17187 If the router that did the redirection processed the local part
17188 case-insensitively, the value in <varname>$original_local_part</varname> is in lower case.
17189 This variable differs from <varname>$parent_local_part</varname> only when there is more than
17190 one level of aliasing or forwarding. When more than one address is being
17191 delivered in a single transport run, <varname>$original_local_part</varname> is not set.
17192 </para>
17193 <para>
17194 If a new address is created by means of a <option>deliver</option> command in a system
17195 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
17196 part <emphasis>system-filter</emphasis> and the default qualify domain.
17197 </para>
17198 </listitem></varlistentry>
17199 <varlistentry>
17200 <term><varname>$originator_gid</varname></term>
17201 <listitem>
17202 <para>
17203 <indexterm role="concept">
17204 <primary>gid (group id)</primary>
17205 <secondary>of originating user</secondary>
17206 </indexterm>
17207 <indexterm role="concept">
17208 <primary>sender</primary>
17209 <secondary>gid</secondary>
17210 </indexterm>
17211 <indexterm role="variable">
17212 <primary><varname>$caller_gid</varname></primary>
17213 </indexterm>
17214 <indexterm role="variable">
17215 <primary><varname>$originator_gid</varname></primary>
17216 </indexterm>
17217 This variable contains the value of <varname>$caller_gid</varname> that was set when the
17218 message was received. For messages received via the command line, this is the
17219 gid of the sending user. For messages received by SMTP over TCP/IP, this is
17220 normally the gid of the Exim user.
17221 </para>
17222 </listitem></varlistentry>
17223 <varlistentry>
17224 <term><varname>$originator_uid</varname></term>
17225 <listitem>
17226 <para>
17227 <indexterm role="concept">
17228 <primary>uid (user id)</primary>
17229 <secondary>of originating user</secondary>
17230 </indexterm>
17231 <indexterm role="concept">
17232 <primary>sender</primary>
17233 <secondary>uid</secondary>
17234 </indexterm>
17235 <indexterm role="variable">
17236 <primary><varname>$caller_uid</varname></primary>
17237 </indexterm>
17238 <indexterm role="variable">
17239 <primary><varname>$originaltor_uid</varname></primary>
17240 </indexterm>
17241 The value of <varname>$caller_uid</varname> that was set when the message was received. For
17242 messages received via the command line, this is the uid of the sending user.
17243 For messages received by SMTP over TCP/IP, this is normally the uid of the Exim
17244 user.
17245 </para>
17246 </listitem></varlistentry>
17247 <varlistentry>
17248 <term><varname>$parent_domain</varname></term>
17249 <listitem>
17250 <para>
17251 <indexterm role="variable">
17252 <primary><varname>$parent_domain</varname></primary>
17253 </indexterm>
17254 This variable is similar to <varname>$original_domain</varname> (see
17255 above), except that it refers to the immediately preceding parent address.
17256 </para>
17257 </listitem></varlistentry>
17258 <varlistentry>
17259 <term><varname>$parent_local_part</varname></term>
17260 <listitem>
17261 <para>
17262 <indexterm role="variable">
17263 <primary><varname>$parent_local_part</varname></primary>
17264 </indexterm>
17265 This variable is similar to <varname>$original_local_part</varname>
17266 (see above), except that it refers to the immediately preceding parent address.
17267 </para>
17268 </listitem></varlistentry>
17269 <varlistentry>
17270 <term><varname>$pid</varname></term>
17271 <listitem>
17272 <para>
17273 <indexterm role="concept">
17274 <primary>pid (process id)</primary>
17275 <secondary>of current process</secondary>
17276 </indexterm>
17277 <indexterm role="variable">
17278 <primary><varname>$pid</varname></primary>
17279 </indexterm>
17280 This variable contains the current process id.
17281 </para>
17282 </listitem></varlistentry>
17283 <varlistentry>
17284 <term><varname>$pipe_addresses</varname></term>
17285 <listitem>
17286 <para>
17287 <indexterm role="concept">
17288 <primary>filter</primary>
17289 <secondary>transport filter</secondary>
17290 </indexterm>
17291 <indexterm role="concept">
17292 <primary>transport</primary>
17293 <secondary>filter</secondary>
17294 </indexterm>
17295 <indexterm role="variable">
17296 <primary><varname>$pipe_addresses</varname></primary>
17297 </indexterm>
17298 This is not an expansion variable, but is mentioned here because the string
17299 <literal>$pipe_addresses</literal> is handled specially in the command specification for the
17300 <command>pipe</command> transport (chapter <xref linkend="CHAPpipetransport"/>) and in transport filters
17301 (described under <option>transport_filter</option> in chapter <xref linkend="CHAPtransportgeneric"/>).
17302 It cannot be used in general expansion strings, and provokes an <quote>unknown
17303 variable</quote> error if encountered.
17304 </para>
17305 </listitem></varlistentry>
17306 <varlistentry>
17307 <term><varname>$primary_hostname</varname></term>
17308 <listitem>
17309 <para>
17310 <indexterm role="variable">
17311 <primary><varname>$primary_hostname</varname></primary>
17312 </indexterm>
17313 This variable contains the value set by <option>primary_hostname</option> in the
17314 configuration file, or read by the <function>uname()</function> function. If <function>uname()</function> returns
17315 a single-component name, Exim calls <function>gethostbyname()</function> (or
17316 <function>getipnodebyname()</function> where available) in an attempt to acquire a fully
17317 qualified host name. See also <varname>$smtp_active_hostname</varname>.
17318 </para>
17319 </listitem></varlistentry>
17320 <varlistentry>
17321 <term><varname>$prvscheck_address</varname></term>
17322 <listitem>
17323 <para>
17324 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
17325 which is described in sections <xref linkend="SECTexpansionitems"/> and
17326 <xref linkend="SECTverifyPRVS"/>.
17327 </para>
17328 </listitem></varlistentry>
17329 <varlistentry>
17330 <term><varname>$prvscheck_keynum</varname></term>
17331 <listitem>
17332 <para>
17333 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
17334 which is described in sections <xref linkend="SECTexpansionitems"/> and
17335 <xref linkend="SECTverifyPRVS"/>.
17336 </para>
17337 </listitem></varlistentry>
17338 <varlistentry>
17339 <term><varname>$prvscheck_result</varname></term>
17340 <listitem>
17341 <para>
17342 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
17343 which is described in sections <xref linkend="SECTexpansionitems"/> and
17344 <xref linkend="SECTverifyPRVS"/>.
17345 </para>
17346 </listitem></varlistentry>
17347 <varlistentry>
17348 <term><varname>$qualify_domain</varname></term>
17349 <listitem>
17350 <para>
17351 <indexterm role="variable">
17352 <primary><varname>$qualify_domain</varname></primary>
17353 </indexterm>
17354 The value set for the <option>qualify_domain</option> option in the configuration file.
17355 </para>
17356 </listitem></varlistentry>
17357 <varlistentry>
17358 <term><varname>$qualify_recipient</varname></term>
17359 <listitem>
17360 <para>
17361 <indexterm role="variable">
17362 <primary><varname>$qualify_recipient</varname></primary>
17363 </indexterm>
17364 The value set for the <option>qualify_recipient</option> option in the configuration file,
17365 or if not set, the value of <varname>$qualify_domain</varname>.
17366 </para>
17367 </listitem></varlistentry>
17368 <varlistentry>
17369 <term><varname>$rcpt_count</varname></term>
17370 <listitem>
17371 <para>
17372 <indexterm role="variable">
17373 <primary><varname>$rcpt_count</varname></primary>
17374 </indexterm>
17375 When a message is being received by SMTP, this variable contains the number of
17376 RCPT commands received for the current message. If this variable is used in a
17377 RCPT ACL, its value includes the current command.
17378 </para>
17379 </listitem></varlistentry>
17380 <varlistentry>
17381 <term><varname>$rcpt_defer_count</varname></term>
17382 <listitem>
17383 <para>
17384 <indexterm role="variable">
17385 <primary><varname>$rcpt_defer_count</varname></primary>
17386 </indexterm>
17387 <indexterm role="concept">
17388 <primary>4<emphasis>xx</emphasis> responses</primary>
17389 <secondary>count of</secondary>
17390 </indexterm>
17391 When a message is being received by SMTP, this variable contains the number of
17392 RCPT commands in the current message that have previously been rejected with a
17393 temporary (4<emphasis>xx</emphasis>) response.
17394 </para>
17395 </listitem></varlistentry>
17396 <varlistentry>
17397 <term><varname>$rcpt_fail_count</varname></term>
17398 <listitem>
17399 <para>
17400 <indexterm role="variable">
17401 <primary><varname>$rcpt_fail_count</varname></primary>
17402 </indexterm>
17403 When a message is being received by SMTP, this variable contains the number of
17404 RCPT commands in the current message that have previously been rejected with a
17405 permanent (5<emphasis>xx</emphasis>) response.
17406 </para>
17407 </listitem></varlistentry>
17408 <varlistentry>
17409 <term><varname>$received_count</varname></term>
17410 <listitem>
17411 <para>
17412 <indexterm role="variable">
17413 <primary><varname>$received_count</varname></primary>
17414 </indexterm>
17415 This variable contains the number of <emphasis>Received:</emphasis> header lines in the message,
17416 including the one added by Exim (so its value is always greater than zero). It
17417 is available in the DATA ACL, the non-SMTP ACL, and while routing and
17418 delivering.
17419 </para>
17420 </listitem></varlistentry>
17421 <varlistentry>
17422 <term><varname>$received_for</varname></term>
17423 <listitem>
17424 <para>
17425 <indexterm role="variable">
17426 <primary><varname>$received_for</varname></primary>
17427 </indexterm>
17428 If there is only a single recipient address in an incoming message, this
17429 variable contains that address when the <emphasis>Received:</emphasis> header line is being
17430 built. The value is copied after recipient rewriting has happened, but before
17431 the <function>local_scan()</function> function is run.
17432 </para>
17433 </listitem></varlistentry>
17434 <varlistentry>
17435 <term><varname>$received_ip_address</varname></term>
17436 <listitem>
17437 <para>
17438 <indexterm role="variable">
17439 <primary><varname>$received_ip_address</varname></primary>
17440 </indexterm>
17441 As soon as an Exim server starts processing an incoming TCP/IP connection, this
17442 variable is set to the address of the local IP interface, and <varname>$received_port</varname>
17443 is set to the local port number. (The remote IP address and port are in
17444 <varname>$sender_host_address</varname> and <varname>$sender_host_port</varname>.) When testing with <option>-bh</option>,
17445 the port value is -1 unless it has been set using the <option>-oMi</option> command line
17446 option.
17447 </para>
17448 <para>
17449 As well as being useful in ACLs (including the <quote>connect</quote> ACL), these variable
17450 could be used, for example, to make the file name for a TLS certificate depend
17451 on which interface and/or port is being used for the incoming connection. The
17452 values of <varname>$received_ip_address</varname> and <varname>$received_port</varname> are saved with any
17453 messages that are received, thus making these variables available at delivery
17454 time.
17455 </para>
17456 <para>
17457 <emphasis role="bold">Note:</emphasis> There are no equivalent variables for outgoing connections, because
17458 the values are unknown (unless they are explicitly set by options of the
17459 <command>smtp</command> transport).
17460 </para>
17461 </listitem></varlistentry>
17462 <varlistentry>
17463 <term><varname>$received_port</varname></term>
17464 <listitem>
17465 <para>
17466 <indexterm role="variable">
17467 <primary><varname>$received_port</varname></primary>
17468 </indexterm>
17469 See <varname>$received_ip_address</varname>.
17470 </para>
17471 </listitem></varlistentry>
17472 <varlistentry>
17473 <term><varname>$received_protocol</varname></term>
17474 <listitem>
17475 <para>
17476 <indexterm role="variable">
17477 <primary><varname>$received_protocol</varname></primary>
17478 </indexterm>
17479 When a message is being processed, this variable contains the name of the
17480 protocol by which it was received. Most of the names used by Exim are defined
17481 by RFCs 821, 2821, and 3848. They start with <quote>smtp</quote> (the client used HELO) or
17482 <quote>esmtp</quote> (the client used EHLO). This can be followed by <quote>s</quote> for secure
17483 (encrypted) and/or <quote>a</quote> for authenticated. Thus, for example, if the protocol
17484 is set to <quote>esmtpsa</quote>, the message was received over an encrypted SMTP
17485 connection and the client was successfully authenticated.
17486 </para>
17487 <para>
17488 Exim uses the protocol name <quote>smtps</quote> for the case when encryption is
17489 automatically set up on connection without the use of STARTTLS (see
17490 <option>tls_on_connect_ports</option>), and the client uses HELO to initiate the
17491 encrypted SMTP session. The name <quote>smtps</quote> is also used for the rare situation
17492 where the client initially uses EHLO, sets up an encrypted connection using
17493 STARTTLS, and then uses HELO afterwards.
17494 </para>
17495 <para>
17496 The <option>-oMr</option> option provides a way of specifying a custom protocol name for
17497 messages that are injected locally by trusted callers. This is commonly used to
17498 identify messages that are being re-injected after some kind of scanning.
17499 </para>
17500 </listitem></varlistentry>
17501 <varlistentry>
17502 <term><varname>$received_time</varname></term>
17503 <listitem>
17504 <para>
17505 <indexterm role="variable">
17506 <primary><varname>$received_time</varname></primary>
17507 </indexterm>
17508 This variable contains the date and time when the current message was received,
17509 as a number of seconds since the start of the Unix epoch.
17510 </para>
17511 </listitem></varlistentry>
17512 <varlistentry>
17513 <term><varname>$recipient_data</varname></term>
17514 <listitem>
17515 <para>
17516 <indexterm role="variable">
17517 <primary><varname>$recipient_data</varname></primary>
17518 </indexterm>
17519 This variable is set after an indexing lookup success in an ACL <option>recipients</option>
17520 condition. It contains the data from the lookup, and the value remains set
17521 until the next <option>recipients</option> test. Thus, you can do things like this:
17522 </para>
17523 <literallayout>
17524 <literal>require recipients  = cdb*@;/some/file</literal>
17525 <literal>deny    </literal><emphasis>some further test involving</emphasis> <literal>$recipient_data</literal>
17526 </literallayout>
17527 <para>
17528 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
17529 method in the address list, using the semicolon syntax as in the example above.
17530 The variable is not set for a lookup that is used as part of the string
17531 expansion that all such lists undergo before being interpreted.
17532 </para>
17533 </listitem></varlistentry>
17534 <varlistentry>
17535 <term><varname>$recipient_verify_failure</varname></term>
17536 <listitem>
17537 <para>
17538 <indexterm role="variable">
17539 <primary><varname>$recipient_verify_failure</varname></primary>
17540 </indexterm>
17541 In an ACL, when a recipient verification fails, this variable contains
17542 information about the failure. It is set to one of the following words:
17543 </para>
17544 <itemizedlist>
17545 <listitem>
17546 <para>
17547 <quote>qualify</quote>: The address was unqualified (no domain), and the message
17548 was neither local nor came from an exempted host.
17549 </para>
17550 </listitem>
17551 <listitem>
17552 <para>
17553 <quote>route</quote>: Routing failed.
17554 </para>
17555 </listitem>
17556 <listitem>
17557 <para>
17558 <quote>mail</quote>: Routing succeeded, and a callout was attempted; rejection occurred at
17559 or before the MAIL command (that is, on initial connection, HELO, or
17560 MAIL).
17561 </para>
17562 </listitem>
17563 <listitem>
17564 <para>
17565 <quote>recipient</quote>: The RCPT command in a callout was rejected.
17566 </para>
17567 </listitem>
17568 <listitem>
17569 <para>
17570 <quote>postmaster</quote>: The postmaster check in a callout was rejected.
17571 </para>
17572 </listitem>
17573 </itemizedlist>
17574 <para>
17575 The main use of this variable is expected to be to distinguish between
17576 rejections of MAIL and rejections of RCPT.
17577 </para>
17578 </listitem></varlistentry>
17579 <varlistentry>
17580 <term><varname>$recipients</varname></term>
17581 <listitem>
17582 <para>
17583 <indexterm role="variable">
17584 <primary><varname>$recipients</varname></primary>
17585 </indexterm>
17586 This variable contains a list of envelope recipients for a message. A comma and
17587 a space separate the addresses in the replacement text. However, the variable
17588 is not generally available, to prevent exposure of Bcc recipients in
17589 unprivileged users&#x2019; filter files. You can use <varname>$recipients</varname> only in these
17590 cases:
17591 </para>
17592 <orderedlist numeration="arabic">
17593 <listitem>
17594 <para>
17595 In a system filter file.
17596 </para>
17597 </listitem>
17598 <listitem>
17599 <para>
17600 In the ACLs associated with the DATA command and with non-SMTP messages, that
17601 is, the ACLs defined by <option>acl_smtp_predata</option>, <option>acl_smtp_data</option>,
17602 <option>acl_smtp_mime</option>, <option>acl_not_smtp_start</option>, <option>acl_not_smtp</option>, and
17603 <option>acl_not_smtp_mime</option>.
17604 </para>
17605 </listitem>
17606 <listitem>
17607 <para>
17608 From within a <function>local_scan()</function> function.
17609 </para>
17610 </listitem>
17611 </orderedlist>
17612 </listitem></varlistentry>
17613 <varlistentry>
17614 <term><varname>$recipients_count</varname></term>
17615 <listitem>
17616 <para>
17617 <indexterm role="variable">
17618 <primary><varname>$recipients_count</varname></primary>
17619 </indexterm>
17620 When a message is being processed, this variable contains the number of
17621 envelope recipients that came with the message. Duplicates are not excluded
17622 from the count. While a message is being received over SMTP, the number
17623 increases for each accepted recipient. It can be referenced in an ACL.
17624 </para>
17625 </listitem></varlistentry>
17626 <varlistentry>
17627 <term><varname>$regex_match_string</varname></term>
17628 <listitem>
17629 <para>
17630 <indexterm role="variable">
17631 <primary><varname>$regex_match_string</varname></primary>
17632 </indexterm>
17633 This variable is set to contain the matching regular expression after a
17634 <option>regex</option> ACL condition has matched (see section <xref linkend="SECTscanregex"/>).
17635 </para>
17636 </listitem></varlistentry>
17637 <varlistentry>
17638 <term><varname>$reply_address</varname></term>
17639 <listitem>
17640 <para>
17641 <indexterm role="variable">
17642 <primary><varname>$reply_address</varname></primary>
17643 </indexterm>
17644 When a message is being processed, this variable contains the contents of the
17645 <emphasis>Reply-To:</emphasis> header line if one exists and it is not empty, or otherwise the
17646 contents of the <emphasis>From:</emphasis> header line. Apart from the removal of leading
17647 white space, the value is not processed in any way. In particular, no RFC 2047
17648 decoding or character code translation takes place.
17649 </para>
17650 </listitem></varlistentry>
17651 <varlistentry>
17652 <term><varname>$return_path</varname></term>
17653 <listitem>
17654 <para>
17655 <indexterm role="variable">
17656 <primary><varname>$return_path</varname></primary>
17657 </indexterm>
17658 When a message is being delivered, this variable contains the return path &ndash;
17659 the sender field that will be sent as part of the envelope. It is not enclosed
17660 in &lt;&gt; characters. At the start of routing an address, <varname>$return_path</varname> has the
17661 same value as <varname>$sender_address</varname>, but if, for example, an incoming message to a
17662 mailing list has been expanded by a router which specifies a different address
17663 for bounce messages, <varname>$return_path</varname> subsequently contains the new bounce
17664 address, whereas <varname>$sender_address</varname> always contains the original sender address
17665 that was received with the message. In other words, <varname>$sender_address</varname> contains
17666 the incoming envelope sender, and <varname>$return_path</varname> contains the outgoing
17667 envelope sender.
17668 </para>
17669 </listitem></varlistentry>
17670 <varlistentry>
17671 <term><varname>$return_size_limit</varname></term>
17672 <listitem>
17673 <para>
17674 <indexterm role="variable">
17675 <primary><varname>$return_size_limit</varname></primary>
17676 </indexterm>
17677 This is an obsolete name for <varname>$bounce_return_size_limit</varname>.
17678 </para>
17679 </listitem></varlistentry>
17680 <varlistentry>
17681 <term><varname>$runrc</varname></term>
17682 <listitem>
17683 <para>
17684 <indexterm role="concept">
17685 <primary>return code</primary>
17686 <secondary>from <option>run</option> expansion</secondary>
17687 </indexterm>
17688 <indexterm role="variable">
17689 <primary><varname>$runrc</varname></primary>
17690 </indexterm>
17691 This variable contains the return code from a command that is run by the
17692 <option>${run...}</option> expansion item. <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot
17693 assume the order in which option values are expanded, except for those
17694 preconditions whose order of testing is documented. Therefore, you cannot
17695 reliably expect to set <varname>$runrc</varname> by the expansion of one option, and use it in
17696 another.
17697 </para>
17698 </listitem></varlistentry>
17699 <varlistentry>
17700 <term><varname>$self_hostname</varname></term>
17701 <listitem>
17702 <para>
17703 <indexterm role="option">
17704 <primary><option>self</option></primary>
17705 <secondary>value of host name</secondary>
17706 </indexterm>
17707 <indexterm role="variable">
17708 <primary><varname>$self_hostname</varname></primary>
17709 </indexterm>
17710 When an address is routed to a supposedly remote host that turns out to be the
17711 local host, what happens is controlled by the <option>self</option> generic router option.
17712 One of its values causes the address to be passed to another router. When this
17713 happens, <varname>$self_hostname</varname> is set to the name of the local host that the
17714 original router encountered. In other circumstances its contents are null.
17715 </para>
17716 </listitem></varlistentry>
17717 <varlistentry>
17718 <term><varname>$sender_address</varname></term>
17719 <listitem>
17720 <para>
17721 <indexterm role="variable">
17722 <primary><varname>$sender_address</varname></primary>
17723 </indexterm>
17724 When a message is being processed, this variable contains the sender&#x2019;s address
17725 that was received in the message&#x2019;s envelope. The case of letters in the address
17726 is retained, in both the local part and the domain. For bounce messages, the
17727 value of this variable is the empty string. See also <varname>$return_path</varname>.
17728 </para>
17729 </listitem></varlistentry>
17730 <varlistentry>
17731 <term><varname>$sender_address_data</varname></term>
17732 <listitem>
17733 <para>
17734 <indexterm role="variable">
17735 <primary><varname>$address_data</varname></primary>
17736 </indexterm>
17737 <indexterm role="variable">
17738 <primary><varname>$sender_address_data</varname></primary>
17739 </indexterm>
17740 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
17741 sender address, the final value is preserved in <varname>$sender_address_data</varname>, to
17742 distinguish it from data from a recipient address. The value does not persist
17743 after the end of the current ACL statement. If you want to preserve it for
17744 longer, you can save it in an ACL variable.
17745 </para>
17746 </listitem></varlistentry>
17747 <varlistentry>
17748 <term><varname>$sender_address_domain</varname></term>
17749 <listitem>
17750 <para>
17751 <indexterm role="variable">
17752 <primary><varname>$sender_address_domain</varname></primary>
17753 </indexterm>
17754 The domain portion of <varname>$sender_address</varname>.
17755 </para>
17756 </listitem></varlistentry>
17757 <varlistentry>
17758 <term><varname>$sender_address_local_part</varname></term>
17759 <listitem>
17760 <para>
17761 <indexterm role="variable">
17762 <primary><varname>$sender_address_local_part</varname></primary>
17763 </indexterm>
17764 The local part portion of <varname>$sender_address</varname>.
17765 </para>
17766 </listitem></varlistentry>
17767 <varlistentry>
17768 <term><varname>$sender_data</varname></term>
17769 <listitem>
17770 <para>
17771 <indexterm role="variable">
17772 <primary><varname>$sender_data</varname></primary>
17773 </indexterm>
17774 This variable is set after a lookup success in an ACL <option>senders</option> condition or
17775 in a router <option>senders</option> option. It contains the data from the lookup, and the
17776 value remains set until the next <option>senders</option> test. Thus, you can do things like
17777 this:
17778 </para>
17779 <literallayout>
17780 <literal>require senders      = cdb*@;/some/file</literal>
17781 <literal>deny    </literal><emphasis>some further test involving</emphasis> <literal>$sender_data</literal>
17782 </literallayout>
17783 <para>
17784 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
17785 method in the address list, using the semicolon syntax as in the example above.
17786 The variable is not set for a lookup that is used as part of the string
17787 expansion that all such lists undergo before being interpreted.
17788 </para>
17789 </listitem></varlistentry>
17790 <varlistentry>
17791 <term><varname>$sender_fullhost</varname></term>
17792 <listitem>
17793 <para>
17794 <indexterm role="variable">
17795 <primary><varname>$sender_fullhost</varname></primary>
17796 </indexterm>
17797 When a message is received from a remote host, this variable contains the host
17798 name and IP address in a single string. It ends with the IP address in square
17799 brackets, followed by a colon and a port number if the logging of ports is
17800 enabled. The format of the rest of the string depends on whether the host
17801 issued a HELO or EHLO SMTP command, and whether the host name was verified by
17802 looking up its IP address. (Looking up the IP address can be forced by the
17803 <option>host_lookup</option> option, independent of verification.) A plain host name at the
17804 start of the string is a verified host name; if this is not present,
17805 verification either failed or was not requested. A host name in parentheses is
17806 the argument of a HELO or EHLO command. This is omitted if it is identical to
17807 the verified host name or to the host&#x2019;s IP address in square brackets.
17808 </para>
17809 </listitem></varlistentry>
17810 <varlistentry>
17811 <term><varname>$sender_helo_name</varname></term>
17812 <listitem>
17813 <para>
17814 <indexterm role="variable">
17815 <primary><varname>$sender_helo_name</varname></primary>
17816 </indexterm>
17817 When a message is received from a remote host that has issued a HELO or EHLO
17818 command, the argument of that command is placed in this variable. It is also
17819 set if HELO or EHLO is used when a message is received using SMTP locally via
17820 the <option>-bs</option> or <option>-bS</option> options.
17821 </para>
17822 </listitem></varlistentry>
17823 <varlistentry>
17824 <term><varname>$sender_host_address</varname></term>
17825 <listitem>
17826 <para>
17827 <indexterm role="variable">
17828 <primary><varname>$sender_host_address</varname></primary>
17829 </indexterm>
17830 When a message is received from a remote host, this variable contains that
17831 host&#x2019;s IP address. For locally submitted messages, it is empty.
17832 </para>
17833 </listitem></varlistentry>
17834 <varlistentry>
17835 <term><varname>$sender_host_authenticated</varname></term>
17836 <listitem>
17837 <para>
17838 <indexterm role="variable">
17839 <primary><varname>$sender_host_authenticated</varname></primary>
17840 </indexterm>
17841 This variable contains the name (not the public name) of the authenticator
17842 driver that successfully authenticated the client from which the message was
17843 received. It is empty if there was no successful authentication. See also
17844 <varname>$authenticated_id</varname>.
17845 </para>
17846 </listitem></varlistentry>
17847 <varlistentry>
17848 <term><varname>$sender_host_name</varname></term>
17849 <listitem>
17850 <para>
17851 <indexterm role="variable">
17852 <primary><varname>$sender_host_name</varname></primary>
17853 </indexterm>
17854 When a message is received from a remote host, this variable contains the
17855 host&#x2019;s name as obtained by looking up its IP address. For messages received by
17856 other means, this variable is empty.
17857 </para>
17858 <para>
17859 <indexterm role="variable">
17860 <primary><varname>$host_lookup_failed</varname></primary>
17861 </indexterm>
17862 If the host name has not previously been looked up, a reference to
17863 <varname>$sender_host_name</varname> triggers a lookup (for messages from remote hosts).
17864 A looked up name is accepted only if it leads back to the original IP address
17865 via a forward lookup. If either the reverse or the forward lookup fails to find
17866 any data, or if the forward lookup does not yield the original IP address,
17867 <varname>$sender_host_name</varname> remains empty, and <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
17868 </para>
17869 <para>
17870 <indexterm role="variable">
17871 <primary><varname>$host_lookup_deferred</varname></primary>
17872 </indexterm>
17873 However, if either of the lookups cannot be completed (for example, there is a
17874 DNS timeout), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>, and
17875 <varname>$host_lookup_failed</varname> remains set to <quote>0</quote>.
17876 </para>
17877 <para>
17878 Once <varname>$host_lookup_failed</varname> is set to <quote>1</quote>, Exim does not try to look up the
17879 host name again if there is a subsequent reference to <varname>$sender_host_name</varname>
17880 in the same Exim process, but it does try again if <varname>$host_lookup_deferred</varname>
17881 is set to <quote>1</quote>.
17882 </para>
17883 <para>
17884 Exim does not automatically look up every calling host&#x2019;s name. If you want
17885 maximum efficiency, you should arrange your configuration so that it avoids
17886 these lookups altogether. The lookup happens only if one or more of the
17887 following are true:
17888 </para>
17889 <itemizedlist>
17890 <listitem>
17891 <para>
17892 A string containing <varname>$sender_host_name</varname> is expanded.
17893 </para>
17894 </listitem>
17895 <listitem>
17896 <para>
17897 The calling host matches the list in <option>host_lookup</option>. In the default
17898 configuration, this option is set to *, so it must be changed if lookups are
17899 to be avoided. (In the code, the default for <option>host_lookup</option> is unset.)
17900 </para>
17901 </listitem>
17902 <listitem>
17903 <para>
17904 Exim needs the host name in order to test an item in a host list. The items
17905 that require this are described in sections <xref linkend="SECThoslispatnam"/> and
17906 <xref linkend="SECThoslispatnamsk"/>.
17907 </para>
17908 </listitem>
17909 <listitem>
17910 <para>
17911 The calling host matches <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>.
17912 In this case, the host name is required to compare with the name quoted in any
17913 EHLO or HELO commands that the client issues.
17914 </para>
17915 </listitem>
17916 <listitem>
17917 <para>
17918 The remote host issues a EHLO or HELO command that quotes one of the
17919 domains in <option>helo_lookup_domains</option>. The default value of this option is
17920 </para>
17921 <literallayout class="monospaced">
17922   helo_lookup_domains = @ : @[]
17923 </literallayout>
17924 <para>
17925 which causes a lookup if a remote host (incorrectly) gives the server&#x2019;s name or
17926 IP address in an EHLO or HELO command.
17927 </para>
17928 </listitem>
17929 </itemizedlist>
17930 </listitem></varlistentry>
17931 <varlistentry>
17932 <term><varname>$sender_host_port</varname></term>
17933 <listitem>
17934 <para>
17935 <indexterm role="variable">
17936 <primary><varname>$sender_host_port</varname></primary>
17937 </indexterm>
17938 When a message is received from a remote host, this variable contains the port
17939 number that was used on the remote host.
17940 </para>
17941 </listitem></varlistentry>
17942 <varlistentry>
17943 <term><varname>$sender_ident</varname></term>
17944 <listitem>
17945 <para>
17946 <indexterm role="variable">
17947 <primary><varname>$sender_ident</varname></primary>
17948 </indexterm>
17949 When a message is received from a remote host, this variable contains the
17950 identification received in response to an RFC 1413 request. When a message has
17951 been received locally, this variable contains the login name of the user that
17952 called Exim.
17953 </para>
17954 </listitem></varlistentry>
17955 <varlistentry>
17956 <term><varname>$sender_rate_</varname><emphasis>xxx</emphasis></term>
17957 <listitem>
17958 <para>
17959 A number of variables whose names begin <varname>$sender_rate_</varname> are set as part of the
17960 <option>ratelimit</option> ACL condition. Details are given in section
17961 <xref linkend="SECTratelimiting"/>.
17962 </para>
17963 </listitem></varlistentry>
17964 <varlistentry>
17965 <term><varname>$sender_rcvhost</varname></term>
17966 <listitem>
17967 <para>
17968 <indexterm role="concept">
17969 <primary>DNS</primary>
17970 <secondary>reverse lookup</secondary>
17971 </indexterm>
17972 <indexterm role="concept">
17973 <primary>reverse DNS lookup</primary>
17974 </indexterm>
17975 <indexterm role="variable">
17976 <primary><varname>$sender_rcvhost</varname></primary>
17977 </indexterm>
17978 This is provided specifically for use in <emphasis>Received:</emphasis> headers. It starts with
17979 either the verified host name (as obtained from a reverse DNS lookup) or, if
17980 there is no verified host name, the IP address in square brackets. After that
17981 there may be text in parentheses. When the first item is a verified host name,
17982 the first thing in the parentheses is the IP address in square brackets,
17983 followed by a colon and a port number if port logging is enabled. When the
17984 first item is an IP address, the port is recorded as <quote>port=<emphasis>xxxx</emphasis></quote> inside
17985 the parentheses.
17986 </para>
17987 <para>
17988 There may also be items of the form <quote>helo=<emphasis>xxxx</emphasis></quote> if HELO or EHLO
17989 was used and its argument was not identical to the real host name or IP
17990 address, and <quote>ident=<emphasis>xxxx</emphasis></quote> if an RFC 1413 ident string is available. If
17991 all three items are present in the parentheses, a newline and tab are inserted
17992 into the string, to improve the formatting of the <emphasis>Received:</emphasis> header.
17993 </para>
17994 </listitem></varlistentry>
17995 <varlistentry>
17996 <term><varname>$sender_verify_failure</varname></term>
17997 <listitem>
17998 <para>
17999 <indexterm role="variable">
18000 <primary><varname>$sender_verify_failure</varname></primary>
18001 </indexterm>
18002 In an ACL, when a sender verification fails, this variable contains information
18003 about the failure. The details are the same as for
18004 <varname>$recipient_verify_failure</varname>.
18005 </para>
18006 </listitem></varlistentry>
18007 <varlistentry>
18008 <term><varname>$sending_ip_address</varname></term>
18009 <listitem>
18010 <para>
18011 <indexterm role="variable">
18012 <primary><varname>$sending_ip_address</varname></primary>
18013 </indexterm>
18014 This variable is set whenever an outgoing SMTP connection to another host has
18015 been set up. It contains the IP address of the local interface that is being
18016 used. This is useful if a host that has more than one IP address wants to take
18017 on different personalities depending on which one is being used. For incoming
18018 connections, see <varname>$received_ip_address</varname>.
18019 </para>
18020 </listitem></varlistentry>
18021 <varlistentry>
18022 <term><varname>$sending_port</varname></term>
18023 <listitem>
18024 <para>
18025 <indexterm role="variable">
18026 <primary><varname>$sending_port</varname></primary>
18027 </indexterm>
18028 This variable is set whenever an outgoing SMTP connection to another host has
18029 been set up. It contains the local port that is being used. For incoming
18030 connections, see <varname>$received_port</varname>.
18031 </para>
18032 </listitem></varlistentry>
18033 <varlistentry>
18034 <term><varname>$smtp_active_hostname</varname></term>
18035 <listitem>
18036 <para>
18037 <indexterm role="variable">
18038 <primary><varname>$smtp_active_hostname</varname></primary>
18039 </indexterm>
18040 During an incoming SMTP session, this variable contains the value of the active
18041 host name, as specified by the <option>smtp_active_hostname</option> option. The value of
18042 <varname>$smtp_active_hostname</varname> is saved with any message that is received, so its
18043 value can be consulted during routing and delivery.
18044 </para>
18045 </listitem></varlistentry>
18046 <varlistentry>
18047 <term><varname>$smtp_command</varname></term>
18048 <listitem>
18049 <para>
18050 <indexterm role="variable">
18051 <primary><varname>$smtp_command</varname></primary>
18052 </indexterm>
18053 During the processing of an incoming SMTP command, this variable contains the
18054 entire command. This makes it possible to distinguish between HELO and EHLO in
18055 the HELO ACL, and also to distinguish between commands such as these:
18056 </para>
18057 <literallayout class="monospaced">
18058 MAIL FROM:&lt;&gt;
18059 MAIL FROM: &lt;&gt;
18060 </literallayout>
18061 <para>
18062 For a MAIL command, extra parameters such as SIZE can be inspected. For a RCPT
18063 command, the address in <varname>$smtp_command</varname> is the original address before any
18064 rewriting, whereas the values in <varname>$local_part</varname> and <varname>$domain</varname> are taken from
18065 the address after SMTP-time rewriting.
18066 </para>
18067 </listitem></varlistentry>
18068 <varlistentry>
18069 <term><varname>$smtp_command_argument</varname></term>
18070 <listitem>
18071 <para>
18072 <indexterm role="concept">
18073 <primary>SMTP</primary>
18074 <secondary>command, argument for</secondary>
18075 </indexterm>
18076 <indexterm role="variable">
18077 <primary><varname>$smtp_command_argument</varname></primary>
18078 </indexterm>
18079 While an ACL is running to check an SMTP command, this variable contains the
18080 argument, that is, the text that follows the command name, with leading white
18081 space removed. Following the introduction of <varname>$smtp_command</varname>, this variable is
18082 somewhat redundant, but is retained for backwards compatibility.
18083 </para>
18084 </listitem></varlistentry>
18085 <varlistentry>
18086 <term><varname>$smtp_count_at_connection_start</varname></term>
18087 <listitem>
18088 <para>
18089 <indexterm role="variable">
18090 <primary><varname>$smtp_count_at_connection_start</varname></primary>
18091 </indexterm>
18092 This variable is set greater than zero only in processes spawned by the Exim
18093 daemon for handling incoming SMTP connections. The name is deliberately long,
18094 in order to emphasize what the contents are. When the daemon accepts a new
18095 connection, it increments this variable. A copy of the variable is passed to
18096 the child process that handles the connection, but its value is fixed, and
18097 never changes. It is only an approximation of how many incoming connections
18098 there actually are, because many other connections may come and go while a
18099 single connection is being processed. When a child process terminates, the
18100 daemon decrements its copy of the variable.
18101 </para>
18102 </listitem></varlistentry>
18103 <varlistentry>
18104 <term><varname>$sn0</varname> &ndash; <varname>$sn9</varname></term>
18105 <listitem>
18106 <para>
18107 These variables are copies of the values of the <varname>$n0</varname> &ndash; <varname>$n9</varname> accumulators
18108 that were current at the end of the system filter file. This allows a system
18109 filter file to set values that can be tested in users&#x2019; filter files. For
18110 example, a system filter could set a value indicating how likely it is that a
18111 message is junk mail.
18112 </para>
18113 </listitem></varlistentry>
18114 <varlistentry>
18115 <term><varname>$spam_</varname><emphasis>xxx</emphasis></term>
18116 <listitem>
18117 <para>
18118 A number of variables whose names start with <varname>$spam</varname> are available when Exim
18119 is compiled with the content-scanning extension. For details, see section
18120 <xref linkend="SECTscanspamass"/>.
18121 </para>
18122 </listitem></varlistentry>
18123 <varlistentry>
18124 <term><varname>$spool_directory</varname></term>
18125 <listitem>
18126 <para>
18127 <indexterm role="variable">
18128 <primary><varname>$spool_directory</varname></primary>
18129 </indexterm>
18130 The name of Exim&#x2019;s spool directory.
18131 </para>
18132 </listitem></varlistentry>
18133 <varlistentry>
18134 <term><varname>$spool_inodes</varname></term>
18135 <listitem>
18136 <para>
18137 <indexterm role="variable">
18138 <primary><varname>$spool_inodes</varname></primary>
18139 </indexterm>
18140 The number of free inodes in the disk partition where Exim&#x2019;s spool files are
18141 being written. The value is recalculated whenever the variable is referenced.
18142 If the relevant file system does not have the concept of inodes, the value of
18143 is -1. See also the <option>check_spool_inodes</option> option.
18144 </para>
18145 </listitem></varlistentry>
18146 <varlistentry>
18147 <term><varname>$spool_space</varname></term>
18148 <listitem>
18149 <para>
18150 <indexterm role="variable">
18151 <primary><varname>$spool_space</varname></primary>
18152 </indexterm>
18153 The amount of free space (as a number of kilobytes) in the disk partition where
18154 Exim&#x2019;s spool files are being written. The value is recalculated whenever the
18155 variable is referenced. If the operating system does not have the ability to
18156 find the amount of free space (only true for experimental systems), the space
18157 value is -1. For example, to check in an ACL that there is at least 50
18158 megabytes free on the spool, you could write:
18159 </para>
18160 <literallayout class="monospaced">
18161 condition = ${if &gt; {$spool_space}{50000}}
18162 </literallayout>
18163 <para>
18164 See also the <option>check_spool_space</option> option.
18165 </para>
18166 </listitem></varlistentry>
18167 <varlistentry>
18168 <term><varname>$thisaddress</varname></term>
18169 <listitem>
18170 <para>
18171 <indexterm role="variable">
18172 <primary><varname>$thisaddress</varname></primary>
18173 </indexterm>
18174 This variable is set only during the processing of the <option>foranyaddress</option>
18175 command in a filter file. Its use is explained in the description of that
18176 command, which can be found in the separate document entitled <emphasis>Exim&#x2019;s
18177 interfaces to mail filtering</emphasis>.
18178 </para>
18179 </listitem></varlistentry>
18180 <varlistentry>
18181 <term><varname>$tls_certificate_verified</varname></term>
18182 <listitem>
18183 <para>
18184 <indexterm role="variable">
18185 <primary><varname>$tls_certificate_verified</varname></primary>
18186 </indexterm>
18187 This variable is set to <quote>1</quote> if a TLS certificate was verified when the
18188 message was received, and <quote>0</quote> otherwise.
18189 </para>
18190 </listitem></varlistentry>
18191 <varlistentry>
18192 <term><varname>$tls_cipher</varname></term>
18193 <listitem>
18194 <para>
18195 <indexterm role="variable">
18196 <primary><varname>$tls_cipher</varname></primary>
18197 </indexterm>
18198 When a message is received from a remote host over an encrypted SMTP
18199 connection, this variable is set to the cipher suite that was negotiated, for
18200 example DES-CBC3-SHA. In other circumstances, in particular, for message
18201 received over unencrypted connections, the variable is empty. Testing
18202 <varname>$tls_cipher</varname> for emptiness is one way of distinguishing between encrypted and
18203 non-encrypted connections during ACL processing.
18204 </para>
18205 <para>
18206 The <varname>$tls_cipher</varname> variable retains its value during message delivery, except
18207 when an outward SMTP delivery takes place via the <command>smtp</command> transport. In this
18208 case, <varname>$tls_cipher</varname> is cleared before any outgoing SMTP connection is made,
18209 and then set to the outgoing cipher suite if one is negotiated. See chapter
18210 <xref linkend="CHAPTLS"/> for details of TLS support and chapter <xref linkend="CHAPsmtptrans"/> for
18211 details of the <command>smtp</command> transport.
18212 </para>
18213 </listitem></varlistentry>
18214 <varlistentry>
18215 <term><varname>$tls_peerdn</varname></term>
18216 <listitem>
18217 <para>
18218 <indexterm role="variable">
18219 <primary><varname>$tls_peerdn</varname></primary>
18220 </indexterm>
18221 When a message is received from a remote host over an encrypted SMTP
18222 connection, and Exim is configured to request a certificate from the client,
18223 the value of the Distinguished Name of the certificate is made available in the
18224 <varname>$tls_peerdn</varname> during subsequent processing. Like <varname>$tls_cipher</varname>, the
18225 value is retained during message delivery, except during outbound SMTP
18226 deliveries.
18227 </para>
18228 </listitem></varlistentry>
18229 <varlistentry>
18230 <term><varname>$tod_bsdinbox</varname></term>
18231 <listitem>
18232 <para>
18233 <indexterm role="variable">
18234 <primary><varname>$tod_bsdinbox</varname></primary>
18235 </indexterm>
18236 The time of day and the date, in the format required for BSD-style mailbox
18237 files, for example: Thu Oct 17 17:14:09 1995.
18238 </para>
18239 </listitem></varlistentry>
18240 <varlistentry>
18241 <term><varname>$tod_epoch</varname></term>
18242 <listitem>
18243 <para>
18244 <indexterm role="variable">
18245 <primary><varname>$tod_epoch</varname></primary>
18246 </indexterm>
18247 The time and date as a number of seconds since the start of the Unix epoch.
18248 </para>
18249 </listitem></varlistentry>
18250 <varlistentry>
18251 <term><varname>$tod_full</varname></term>
18252 <listitem>
18253 <para>
18254 <indexterm role="variable">
18255 <primary><varname>$tod_full</varname></primary>
18256 </indexterm>
18257 A full version of the time and date, for example: Wed, 16 Oct 1995 09:51:40
18258 +0100. The timezone is always given as a numerical offset from UTC, with
18259 positive values used for timezones that are ahead (east) of UTC, and negative
18260 values for those that are behind (west).
18261 </para>
18262 </listitem></varlistentry>
18263 <varlistentry>
18264 <term><varname>$tod_log</varname></term>
18265 <listitem>
18266 <para>
18267 <indexterm role="variable">
18268 <primary><varname>$tod_log</varname></primary>
18269 </indexterm>
18270 The time and date in the format used for writing Exim&#x2019;s log files, for example:
18271 1995-10-12 15:32:29, but without a timezone.
18272 </para>
18273 </listitem></varlistentry>
18274 <varlistentry>
18275 <term><varname>$tod_logfile</varname></term>
18276 <listitem>
18277 <para>
18278 <indexterm role="variable">
18279 <primary><varname>$tod_logfile</varname></primary>
18280 </indexterm>
18281 This variable contains the date in the format yyyymmdd. This is the format that
18282 is used for datestamping log files when <option>log_file_path</option> contains the <literal>%D</literal>
18283 flag.
18284 </para>
18285 </listitem></varlistentry>
18286 <varlistentry>
18287 <term><varname>$tod_zone</varname></term>
18288 <listitem>
18289 <para>
18290 <indexterm role="variable">
18291 <primary><varname>$tod_zone</varname></primary>
18292 </indexterm>
18293 This variable contains the numerical value of the local timezone, for example:
18294 -0500.
18295 </para>
18296 </listitem></varlistentry>
18297 <varlistentry>
18298 <term><varname>$tod_zulu</varname></term>
18299 <listitem>
18300 <para>
18301 <indexterm role="variable">
18302 <primary><varname>$tod_zulu</varname></primary>
18303 </indexterm>
18304 This variable contains the UTC date and time in <quote>Zulu</quote> format, as specified
18305 by ISO 8601, for example: 20030221154023Z.
18306 </para>
18307 </listitem></varlistentry>
18308 <varlistentry>
18309 <term><varname>$value</varname></term>
18310 <listitem>
18311 <para>
18312 <indexterm role="variable">
18313 <primary><varname>$value</varname></primary>
18314 </indexterm>
18315 This variable contains the result of an expansion lookup, extraction operation,
18316 or external command, as described above. It is also used during a
18317 <emphasis role="bold">reduce</emphasis> expansion.
18318 </para>
18319 </listitem></varlistentry>
18320 <varlistentry>
18321 <term><varname>$version_number</varname></term>
18322 <listitem>
18323 <para>
18324 <indexterm role="variable">
18325 <primary><varname>$version_number</varname></primary>
18326 </indexterm>
18327 The version number of Exim.
18328 </para>
18329 </listitem></varlistentry>
18330 <varlistentry>
18331 <term><varname>$warn_message_delay</varname></term>
18332 <listitem>
18333 <para>
18334 <indexterm role="variable">
18335 <primary><varname>$warn_message_delay</varname></primary>
18336 </indexterm>
18337 This variable is set only during the creation of a message warning about a
18338 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
18339 </para>
18340 </listitem></varlistentry>
18341 <varlistentry>
18342 <term><varname>$warn_message_recipients</varname></term>
18343 <listitem>
18344 <para>
18345 <indexterm role="variable">
18346 <primary><varname>$warn_message_recipients</varname></primary>
18347 </indexterm>
18348 This variable is set only during the creation of a message warning about a
18349 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
18350 </para>
18351 </listitem></varlistentry>
18352 </variablelist>
18353 <para>
18354 <indexterm role="concept" startref="IIDstrexp" class="endofrange"/>
18355 </para>
18356 </section>
18357 </chapter>
18358
18359 <chapter id="CHAPperl">
18360 <title>Embedded Perl</title>
18361 <para>
18362 <indexterm role="concept" id="IIDperl" class="startofrange">
18363 <primary>Perl</primary>
18364 <secondary>calling from Exim</secondary>
18365 </indexterm>
18366 Exim can be built to include an embedded Perl interpreter. When this is done,
18367 Perl subroutines can be called as part of the string expansion process. To make
18368 use of the Perl support, you need version 5.004 or later of Perl installed on
18369 your system. To include the embedded interpreter in the Exim binary, include
18370 the line
18371 </para>
18372 <literallayout class="monospaced">
18373 EXIM_PERL = perl.o
18374 </literallayout>
18375 <para>
18376 in your <filename>Local/Makefile</filename> and then build Exim in the normal way.
18377 </para>
18378 <section id="SECID85">
18379 <title>Setting up so Perl can be used</title>
18380 <para>
18381 <indexterm role="option">
18382 <primary><option>perl_startup</option></primary>
18383 </indexterm>
18384 Access to Perl subroutines is via a global configuration option called
18385 <option>perl_startup</option> and an expansion string operator <option>${perl ...}</option>. If there is
18386 no <option>perl_startup</option> option in the Exim configuration file then no Perl
18387 interpreter is started and there is almost no overhead for Exim (since none of
18388 the Perl library will be paged in unless used). If there is a <option>perl_startup</option>
18389 option then the associated value is taken to be Perl code which is executed in
18390 a newly created Perl interpreter.
18391 </para>
18392 <para>
18393 The value of <option>perl_startup</option> is not expanded in the Exim sense, so you do not
18394 need backslashes before any characters to escape special meanings. The option
18395 should usually be something like
18396 </para>
18397 <literallayout class="monospaced">
18398 perl_startup = do '/etc/exim.pl'
18399 </literallayout>
18400 <para>
18401 where <filename>/etc/exim.pl</filename> is Perl code which defines any subroutines you want to
18402 use from Exim. Exim can be configured either to start up a Perl interpreter as
18403 soon as it is entered, or to wait until the first time it is needed. Starting
18404 the interpreter at the beginning ensures that it is done while Exim still has
18405 its setuid privilege, but can impose an unnecessary overhead if Perl is not in
18406 fact used in a particular run. Also, note that this does not mean that Exim is
18407 necessarily running as root when Perl is called at a later time. By default,
18408 the interpreter is started only when it is needed, but this can be changed in
18409 two ways:
18410 </para>
18411 <itemizedlist>
18412 <listitem>
18413 <para>
18414 <indexterm role="option">
18415 <primary><option>perl_at_start</option></primary>
18416 </indexterm>
18417 Setting <option>perl_at_start</option> (a boolean option) in the configuration requests
18418 a startup when Exim is entered.
18419 </para>
18420 </listitem>
18421 <listitem>
18422 <para>
18423 The command line option <option>-ps</option> also requests a startup when Exim is entered,
18424 overriding the setting of <option>perl_at_start</option>.
18425 </para>
18426 </listitem>
18427 </itemizedlist>
18428 <para>
18429 There is also a command line option <option>-pd</option> (for delay) which suppresses the
18430 initial startup, even if <option>perl_at_start</option> is set.
18431 </para>
18432 </section>
18433 <section id="SECID86">
18434 <title>Calling Perl subroutines</title>
18435 <para>
18436 When the configuration file includes a <option>perl_startup</option> option you can make use
18437 of the string expansion item to call the Perl subroutines that are defined
18438 by the <option>perl_startup</option> code. The operator is used in any of the following
18439 forms:
18440 </para>
18441 <literallayout class="monospaced">
18442 ${perl{foo}}
18443 ${perl{foo}{argument}}
18444 ${perl{foo}{argument1}{argument2} ... }
18445 </literallayout>
18446 <para>
18447 which calls the subroutine <option>foo</option> with the given arguments. A maximum of eight
18448 arguments may be passed. Passing more than this results in an expansion failure
18449 with an error message of the form
18450 </para>
18451 <literallayout class="monospaced">
18452 Too many arguments passed to Perl subroutine "foo" (max is 8)
18453 </literallayout>
18454 <para>
18455 The return value of the Perl subroutine is evaluated in a scalar context before
18456 it is passed back to Exim to be inserted into the expanded string. If the
18457 return value is <emphasis>undef</emphasis>, the expansion is forced to fail in the same way as
18458 an explicit <quote>fail</quote> on an <option>if</option> or <option>lookup</option> item. If the subroutine aborts
18459 by obeying Perl&#x2019;s <option>die</option> function, the expansion fails with the error message
18460 that was passed to <option>die</option>.
18461 </para>
18462 </section>
18463 <section id="SECID87">
18464 <title>Calling Exim functions from Perl</title>
18465 <para>
18466 Within any Perl code called from Exim, the function <emphasis>Exim::expand_string()</emphasis>
18467 is available to call back into Exim&#x2019;s string expansion function. For example,
18468 the Perl code
18469 </para>
18470 <literallayout class="monospaced">
18471 my $lp = Exim::expand_string('$local_part');
18472 </literallayout>
18473 <para>
18474 makes the current Exim <varname>$local_part</varname> available in the Perl variable <varname>$lp</varname>.
18475 Note those are single quotes and not double quotes to protect against
18476 <varname>$local_part</varname> being interpolated as a Perl variable.
18477 </para>
18478 <para>
18479 If the string expansion is forced to fail by a <quote>fail</quote> item, the result of
18480 <emphasis>Exim::expand_string()</emphasis> is <option>undef</option>. If there is a syntax error in the
18481 expansion string, the Perl call from the original expansion string fails with
18482 an appropriate error message, in the same way as if <option>die</option> were used.
18483 </para>
18484 <para>
18485 <indexterm role="concept">
18486 <primary>debugging</primary>
18487 <secondary>from embedded Perl</secondary>
18488 </indexterm>
18489 <indexterm role="concept">
18490 <primary>log</primary>
18491 <secondary>writing from embedded Perl</secondary>
18492 </indexterm>
18493 Two other Exim functions are available for use from within Perl code.
18494 <emphasis>Exim::debug_write()</emphasis> writes a string to the standard error stream if Exim&#x2019;s
18495 debugging is enabled. If you want a newline at the end, you must supply it.
18496 <emphasis>Exim::log_write()</emphasis> writes a string to Exim&#x2019;s main log, adding a leading
18497 timestamp. In this case, you should not supply a terminating newline.
18498 </para>
18499 </section>
18500 <section id="SECID88">
18501 <title>Use of standard output and error by Perl</title>
18502 <para>
18503 <indexterm role="concept">
18504 <primary>Perl</primary>
18505 <secondary>standard output and error</secondary>
18506 </indexterm>
18507 You should not write to the standard error or output streams from within your
18508 Perl code, as it is not defined how these are set up. In versions of Exim
18509 before 4.50, it is possible for the standard output or error to refer to the
18510 SMTP connection during message reception via the daemon. Writing to this stream
18511 is certain to cause chaos. From Exim 4.50 onwards, the standard output and
18512 error streams are connected to <filename>/dev/null</filename> in the daemon. The chaos is
18513 avoided, but the output is lost.
18514 </para>
18515 <para>
18516 <indexterm role="concept">
18517 <primary>Perl</primary>
18518 <secondary>use of <option>warn</option></secondary>
18519 </indexterm>
18520 The Perl <option>warn</option> statement writes to the standard error stream by default.
18521 Calls to <option>warn</option> may be embedded in Perl modules that you use, but over which
18522 you have no control. When Exim starts up the Perl interpreter, it arranges for
18523 output from the <option>warn</option> statement to be written to the Exim main log. You can
18524 change this by including appropriate Perl magic somewhere in your Perl code.
18525 For example, to discard <option>warn</option> output completely, you need this:
18526 </para>
18527 <literallayout class="monospaced">
18528 $SIG{__WARN__} = sub { };
18529 </literallayout>
18530 <para>
18531 Whenever a <option>warn</option> is obeyed, the anonymous subroutine is called. In this
18532 example, the code for the subroutine is empty, so it does nothing, but you can
18533 include any Perl code that you like. The text of the <option>warn</option> message is passed
18534 as the first subroutine argument.
18535 <indexterm role="concept" startref="IIDperl" class="endofrange"/>
18536 </para>
18537 </section>
18538 </chapter>
18539
18540 <chapter id="CHAPinterfaces">
18541 <title>Starting the daemon and the use of network interfaces</title>
18542 <titleabbrev>Starting the daemon</titleabbrev>
18543 <para>
18544 <indexterm role="concept">
18545 <primary>daemon</primary>
18546 <secondary>starting</secondary>
18547 </indexterm>
18548 <indexterm role="concept">
18549 <primary>interface</primary>
18550 <secondary>listening</secondary>
18551 </indexterm>
18552 <indexterm role="concept">
18553 <primary>network interface</primary>
18554 </indexterm>
18555 <indexterm role="concept">
18556 <primary>interface</primary>
18557 <secondary>network</secondary>
18558 </indexterm>
18559 <indexterm role="concept">
18560 <primary>IP address</primary>
18561 <secondary>for listening</secondary>
18562 </indexterm>
18563 <indexterm role="concept">
18564 <primary>daemon</primary>
18565 <secondary>listening IP addresses</secondary>
18566 </indexterm>
18567 <indexterm role="concept">
18568 <primary>TCP/IP</primary>
18569 <secondary>setting listening interfaces</secondary>
18570 </indexterm>
18571 <indexterm role="concept">
18572 <primary>TCP/IP</primary>
18573 <secondary>setting listening ports</secondary>
18574 </indexterm>
18575 A host that is connected to a TCP/IP network may have one or more physical
18576 hardware network interfaces. Each of these interfaces may be configured as one
18577 or more <quote>logical</quote> interfaces, which are the entities that a program actually
18578 works with. Each of these logical interfaces is associated with an IP address.
18579 In addition, TCP/IP software supports <quote>loopback</quote> interfaces (127.0.0.1 in
18580 IPv4 and ::1 in IPv6), which do not use any physical hardware. Exim requires
18581 knowledge about the host&#x2019;s interfaces for use in three different circumstances:
18582 </para>
18583 <orderedlist numeration="arabic">
18584 <listitem>
18585 <para>
18586 When a listening daemon is started, Exim needs to know which interfaces
18587 and ports to listen on.
18588 </para>
18589 </listitem>
18590 <listitem>
18591 <para>
18592 When Exim is routing an address, it needs to know which IP addresses
18593 are associated with local interfaces. This is required for the correct
18594 processing of MX lists by removing the local host and others with the
18595 same or higher priority values. Also, Exim needs to detect cases
18596 when an address is routed to an IP address that in fact belongs to the
18597 local host. Unless the <option>self</option> router option or the <option>allow_localhost</option>
18598 option of the smtp transport is set (as appropriate), this is treated
18599 as an error situation.
18600 </para>
18601 </listitem>
18602 <listitem>
18603 <para>
18604 When Exim connects to a remote host, it may need to know which interface to use
18605 for the outgoing connection.
18606 </para>
18607 </listitem>
18608 </orderedlist>
18609 <para>
18610 Exim&#x2019;s default behaviour is likely to be appropriate in the vast majority
18611 of cases. If your host has only one interface, and you want all its IP
18612 addresses to be treated in the same way, and you are using only the
18613 standard SMTP port, you should not need to take any special action. The
18614 rest of this chapter does not apply to you.
18615 </para>
18616 <para>
18617 In a more complicated situation you may want to listen only on certain
18618 interfaces, or on different ports, and for this reason there are a number of
18619 options that can be used to influence Exim&#x2019;s behaviour. The rest of this
18620 chapter describes how they operate.
18621 </para>
18622 <para>
18623 When a message is received over TCP/IP, the interface and port that were
18624 actually used are set in <varname>$received_ip_address</varname> and <varname>$received_port</varname>.
18625 </para>
18626 <section id="SECID89">
18627 <title>Starting a listening daemon</title>
18628 <para>
18629 When a listening daemon is started (by means of the <option>-bd</option> command line
18630 option), the interfaces and ports on which it listens are controlled by the
18631 following options:
18632 </para>
18633 <itemizedlist>
18634 <listitem>
18635 <para>
18636 <option>daemon_smtp_ports</option> contains a list of default ports. (For backward
18637 compatibility, this option can also be specified in the singular.)
18638 </para>
18639 </listitem>
18640 <listitem>
18641 <para>
18642 <option>local_interfaces</option> contains list of interface IP addresses on which to
18643 listen. Each item may optionally also specify a port.
18644 </para>
18645 </listitem>
18646 </itemizedlist>
18647 <para>
18648 The default list separator in both cases is a colon, but this can be changed as
18649 described in section <xref linkend="SECTlistconstruct"/>. When IPv6 addresses are involved,
18650 it is usually best to change the separator to avoid having to double all the
18651 colons. For example:
18652 </para>
18653 <literallayout class="monospaced">
18654 local_interfaces = &lt;; 127.0.0.1 ; \
18655                       192.168.23.65 ; \
18656                       ::1 ; \
18657                       3ffe:ffff:836f::fe86:a061
18658 </literallayout>
18659 <para>
18660 There are two different formats for specifying a port along with an IP address
18661 in <option>local_interfaces</option>:
18662 </para>
18663 <orderedlist numeration="arabic">
18664 <listitem>
18665 <para>
18666 The port is added onto the address with a dot separator. For example, to listen
18667 on port 1234 on two different IP addresses:
18668 </para>
18669 <literallayout class="monospaced">
18670 local_interfaces = &lt;; 192.168.23.65.1234 ; \
18671                       3ffe:ffff:836f::fe86:a061.1234
18672 </literallayout>
18673 </listitem>
18674 <listitem>
18675 <para>
18676 The IP address is enclosed in square brackets, and the port is added
18677 with a colon separator, for example:
18678 </para>
18679 <literallayout class="monospaced">
18680 local_interfaces = &lt;; [192.168.23.65]:1234 ; \
18681                       [3ffe:ffff:836f::fe86:a061]:1234
18682 </literallayout>
18683 </listitem>
18684 </orderedlist>
18685 <para>
18686 When a port is not specified, the value of <option>daemon_smtp_ports</option> is used. The
18687 default setting contains just one port:
18688 </para>
18689 <literallayout class="monospaced">
18690 daemon_smtp_ports = smtp
18691 </literallayout>
18692 <para>
18693 If more than one port is listed, each interface that does not have its own port
18694 specified listens on all of them. Ports that are listed in
18695 <option>daemon_smtp_ports</option> can be identified either by name (defined in
18696 <filename>/etc/services</filename>) or by number. However, when ports are given with individual
18697 IP addresses in <option>local_interfaces</option>, only numbers (not names) can be used.
18698 </para>
18699 </section>
18700 <section id="SECID90">
18701 <title>Special IP listening addresses</title>
18702 <para>
18703 The addresses 0.0.0.0 and ::0 are treated specially. They are interpreted
18704 as <quote>all IPv4 interfaces</quote> and <quote>all IPv6 interfaces</quote>, respectively. In each
18705 case, Exim tells the TCP/IP stack to <quote>listen on all IPv<emphasis>x</emphasis> interfaces</quote>
18706 instead of setting up separate listening sockets for each interface. The
18707 default value of <option>local_interfaces</option> is
18708 </para>
18709 <literallayout class="monospaced">
18710 local_interfaces = 0.0.0.0
18711 </literallayout>
18712 <para>
18713 when Exim is built without IPv6 support; otherwise it is:
18714 </para>
18715 <literallayout class="monospaced">
18716 local_interfaces = &lt;; ::0 ; 0.0.0.0
18717 </literallayout>
18718 <para>
18719 Thus, by default, Exim listens on all available interfaces, on the SMTP port.
18720 </para>
18721 </section>
18722 <section id="SECID91">
18723 <title>Overriding local_interfaces and daemon_smtp_ports</title>
18724 <para>
18725 The <option>-oX</option> command line option can be used to override the values of
18726 <option>daemon_smtp_ports</option> and/or <option>local_interfaces</option> for a particular daemon
18727 instance. Another way of doing this would be to use macros and the <option>-D</option>
18728 option. However, <option>-oX</option> can be used by any admin user, whereas modification of
18729 the runtime configuration by <option>-D</option> is allowed only when the caller is root or
18730 exim.
18731 </para>
18732 <para>
18733 The value of <option>-oX</option> is a list of items. The default colon separator can be
18734 changed in the usual way if required. If there are any items that do not
18735 contain dots or colons (that is, are not IP addresses), the value of
18736 <option>daemon_smtp_ports</option> is replaced by the list of those items. If there are any
18737 items that do contain dots or colons, the value of <option>local_interfaces</option> is
18738 replaced by those items. Thus, for example,
18739 </para>
18740 <literallayout class="monospaced">
18741 -oX 1225
18742 </literallayout>
18743 <para>
18744 overrides <option>daemon_smtp_ports</option>, but leaves <option>local_interfaces</option> unchanged,
18745 whereas
18746 </para>
18747 <literallayout class="monospaced">
18748 -oX 192.168.34.5.1125
18749 </literallayout>
18750 <para>
18751 overrides <option>local_interfaces</option>, leaving <option>daemon_smtp_ports</option> unchanged.
18752 (However, since <option>local_interfaces</option> now contains no items without ports, the
18753 value of <option>daemon_smtp_ports</option> is no longer relevant in this example.)
18754 </para>
18755 </section>
18756 <section id="SECTsupobssmt">
18757 <title>Support for the obsolete SSMTP (or SMTPS) protocol</title>
18758 <para>
18759 <indexterm role="concept">
18760 <primary>ssmtp protocol</primary>
18761 </indexterm>
18762 <indexterm role="concept">
18763 <primary>smtps protocol</primary>
18764 </indexterm>
18765 <indexterm role="concept">
18766 <primary>SMTP</primary>
18767 <secondary>ssmtp protocol</secondary>
18768 </indexterm>
18769 <indexterm role="concept">
18770 <primary>SMTP</primary>
18771 <secondary>smtps protocol</secondary>
18772 </indexterm>
18773 Exim supports the obsolete SSMTP protocol (also known as SMTPS) that was used
18774 before the STARTTLS command was standardized for SMTP. Some legacy clients
18775 still use this protocol. If the <option>tls_on_connect_ports</option> option is set to a
18776 list of port numbers, connections to those ports must use SSMTP. The most
18777 common use of this option is expected to be
18778 </para>
18779 <literallayout class="monospaced">
18780 tls_on_connect_ports = 465
18781 </literallayout>
18782 <para>
18783 because 465 is the usual port number used by the legacy clients. There is also
18784 a command line option <option>-tls-on-connect</option>, which forces all ports to behave in
18785 this way when a daemon is started.
18786 </para>
18787 <para>
18788 <emphasis role="bold">Warning</emphasis>: Setting <option>tls_on_connect_ports</option> does not of itself cause the
18789 daemon to listen on those ports. You must still specify them in
18790 <option>daemon_smtp_ports</option>, <option>local_interfaces</option>, or the <option>-oX</option> option. (This is
18791 because <option>tls_on_connect_ports</option> applies to <option>inetd</option> connections as well as to
18792 connections via the daemon.)
18793 </para>
18794 </section>
18795 <section id="SECID92">
18796 <title>IPv6 address scopes</title>
18797 <para>
18798 <indexterm role="concept">
18799 <primary>IPv6</primary>
18800 <secondary>address scopes</secondary>
18801 </indexterm>
18802 IPv6 addresses have <quote>scopes</quote>, and a host with multiple hardware interfaces
18803 can, in principle, have the same link-local IPv6 address on different
18804 interfaces. Thus, additional information is needed, over and above the IP
18805 address, to distinguish individual interfaces. A convention of using a
18806 percent sign followed by something (often the interface name) has been
18807 adopted in some cases, leading to addresses like this:
18808 </para>
18809 <literallayout class="monospaced">
18810 fe80::202:b3ff:fe03:45c1%eth0
18811 </literallayout>
18812 <para>
18813 To accommodate this usage, a percent sign followed by an arbitrary string is
18814 allowed at the end of an IPv6 address. By default, Exim calls <function>getaddrinfo()</function>
18815 to convert a textual IPv6 address for actual use. This function recognizes the
18816 percent convention in operating systems that support it, and it processes the
18817 address appropriately. Unfortunately, some older libraries have problems with
18818 <function>getaddrinfo()</function>. If
18819 </para>
18820 <literallayout class="monospaced">
18821 IPV6_USE_INET_PTON=yes
18822 </literallayout>
18823 <para>
18824 is set in <filename>Local/Makefile</filename> (or an OS-dependent Makefile) when Exim is built,
18825 Exim uses <emphasis>inet_pton()</emphasis> to convert a textual IPv6 address for actual use,
18826 instead of <function>getaddrinfo()</function>. (Before version 4.14, it always used this
18827 function.) Of course, this means that the additional functionality of
18828 <function>getaddrinfo()</function> &ndash; recognizing scoped addresses &ndash; is lost.
18829 </para>
18830 </section>
18831 <section id="SECID93">
18832 <title>Disabling IPv6</title>
18833 <para>
18834 <indexterm role="concept">
18835 <primary>IPv6</primary>
18836 <secondary>disabling</secondary>
18837 </indexterm>
18838 Sometimes it happens that an Exim binary that was compiled with IPv6 support is
18839 run on a host whose kernel does not support IPv6. The binary will fall back to
18840 using IPv4, but it may waste resources looking up AAAA records, and trying to
18841 connect to IPv6 addresses, causing delays to mail delivery. If you set the
18842 <indexterm role="option">
18843 <primary><option>disable_ipv6</option></primary>
18844 </indexterm>
18845 <option>disable_ipv6</option> option true, even if the Exim binary has IPv6 support, no IPv6
18846 activities take place. AAAA records are never looked up, and any IPv6 addresses
18847 that are listed in <option>local_interfaces</option>, data for the <command>manualroute</command> router,
18848 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
18849 to handle IPv6 literal addresses.
18850 </para>
18851 <para>
18852 On the other hand, when IPv6 is in use, there may be times when you want to
18853 disable it for certain hosts or domains. You can use the <option>dns_ipv4_lookup</option>
18854 option to globally suppress the lookup of AAAA records for specified domains,
18855 and you can use the <option>ignore_target_hosts</option> generic router option to ignore
18856 IPv6 addresses in an individual router.
18857 </para>
18858 </section>
18859 <section id="SECID94">
18860 <title>Examples of starting a listening daemon</title>
18861 <para>
18862 The default case in an IPv6 environment is
18863 </para>
18864 <literallayout class="monospaced">
18865 daemon_smtp_ports = smtp
18866 local_interfaces = &lt;; ::0 ; 0.0.0.0
18867 </literallayout>
18868 <para>
18869 This specifies listening on the smtp port on all IPv6 and IPv4 interfaces.
18870 Either one or two sockets may be used, depending on the characteristics of
18871 the TCP/IP stack. (This is complicated and messy; for more information,
18872 read the comments in the <filename>daemon.c</filename> source file.)
18873 </para>
18874 <para>
18875 To specify listening on ports 25 and 26 on all interfaces:
18876 </para>
18877 <literallayout class="monospaced">
18878 daemon_smtp_ports = 25 : 26
18879 </literallayout>
18880 <para>
18881 (leaving <option>local_interfaces</option> at the default setting) or, more explicitly:
18882 </para>
18883 <literallayout class="monospaced">
18884 local_interfaces = &lt;; ::0.25     ; ::0.26 \
18885                       0.0.0.0.25 ; 0.0.0.0.26
18886 </literallayout>
18887 <para>
18888 To listen on the default port on all IPv4 interfaces, and on port 26 on the
18889 IPv4 loopback address only:
18890 </para>
18891 <literallayout class="monospaced">
18892 local_interfaces = 0.0.0.0 : 127.0.0.1.26
18893 </literallayout>
18894 <para>
18895 To specify listening on the default port on specific interfaces only:
18896 </para>
18897 <literallayout class="monospaced">
18898 local_interfaces = 192.168.34.67 : 192.168.34.67
18899 </literallayout>
18900 <para>
18901 <emphasis role="bold">Warning</emphasis>: Such a setting excludes listening on the loopback interfaces.
18902 </para>
18903 </section>
18904 <section id="SECTreclocipadd">
18905 <title>Recognizing the local host</title>
18906 <para>
18907 The <option>local_interfaces</option> option is also used when Exim needs to determine
18908 whether or not an IP address refers to the local host. That is, the IP
18909 addresses of all the interfaces on which a daemon is listening are always
18910 treated as local.
18911 </para>
18912 <para>
18913 For this usage, port numbers in <option>local_interfaces</option> are ignored. If either of
18914 the items 0.0.0.0 or ::0 are encountered, Exim gets a complete list of
18915 available interfaces from the operating system, and extracts the relevant
18916 (that is, IPv4 or IPv6) addresses to use for checking.
18917 </para>
18918 <para>
18919 Some systems set up large numbers of virtual interfaces in order to provide
18920 many virtual web servers. In this situation, you may want to listen for
18921 email on only a few of the available interfaces, but nevertheless treat all
18922 interfaces as local when routing. You can do this by setting
18923 <option>extra_local_interfaces</option> to a list of IP addresses, possibly including the
18924 <quote>all</quote> wildcard values. These addresses are recognized as local, but are not
18925 used for listening. Consider this example:
18926 </para>
18927 <literallayout class="monospaced">
18928 local_interfaces = &lt;; 127.0.0.1 ; ::1 ; \
18929                       192.168.53.235 ; \
18930                       3ffe:2101:12:1:a00:20ff:fe86:a061
18931
18932 extra_local_interfaces = &lt;; ::0 ; 0.0.0.0
18933 </literallayout>
18934 <para>
18935 The daemon listens on the loopback interfaces and just one IPv4 and one IPv6
18936 address, but all available interface addresses are treated as local when
18937 Exim is routing.
18938 </para>
18939 <para>
18940 In some environments the local host name may be in an MX list, but with an IP
18941 address that is not assigned to any local interface. In other cases it may be
18942 desirable to treat other host names as if they referred to the local host. Both
18943 these cases can be handled by setting the <option>hosts_treat_as_local</option> option.
18944 This contains host names rather than IP addresses. When a host is referenced
18945 during routing, either via an MX record or directly, it is treated as the local
18946 host if its name matches <option>hosts_treat_as_local</option>, or if any of its IP
18947 addresses match <option>local_interfaces</option> or <option>extra_local_interfaces</option>.
18948 </para>
18949 </section>
18950 <section id="SECID95">
18951 <title>Delivering to a remote host</title>
18952 <para>
18953 Delivery to a remote host is handled by the smtp transport. By default, it
18954 allows the system&#x2019;s TCP/IP functions to choose which interface to use (if
18955 there is more than one) when connecting to a remote host. However, the
18956 <option>interface</option> option can be set to specify which interface is used. See the
18957 description of the smtp transport in chapter <xref linkend="CHAPsmtptrans"/> for more
18958 details.
18959 </para>
18960 </section>
18961 </chapter>
18962
18963 <chapter id="CHAPmainconfig">
18964 <title>Main configuration</title>
18965 <para>
18966 <indexterm role="concept" id="IIDconfima" class="startofrange">
18967 <primary>configuration file</primary>
18968 <secondary>main section</secondary>
18969 </indexterm>
18970 <indexterm role="concept" id="IIDmaiconf" class="startofrange">
18971 <primary>main configuration</primary>
18972 </indexterm>
18973 The first part of the run time configuration file contains three types of item:
18974 </para>
18975 <itemizedlist>
18976 <listitem>
18977 <para>
18978 Macro definitions: These lines start with an upper case letter. See section
18979 <xref linkend="SECTmacrodefs"/> for details of macro processing.
18980 </para>
18981 </listitem>
18982 <listitem>
18983 <para>
18984 Named list definitions: These lines start with one of the words <quote>domainlist</quote>,
18985 <quote>hostlist</quote>, <quote>addresslist</quote>, or <quote>localpartlist</quote>. Their use is described in
18986 section <xref linkend="SECTnamedlists"/>.
18987 </para>
18988 </listitem>
18989 <listitem>
18990 <para>
18991 Main configuration settings: Each setting occupies one line of the file
18992 (with possible continuations). If any setting is preceded by the word
18993 <quote>hide</quote>, the <option>-bP</option> command line option displays its value to admin users
18994 only. See section <xref linkend="SECTcos"/> for a description of the syntax of these option
18995 settings.
18996 </para>
18997 </listitem>
18998 </itemizedlist>
18999 <para>
19000 This chapter specifies all the main configuration options, along with their
19001 types and default values. For ease of finding a particular option, they appear
19002 in alphabetical order in section <xref linkend="SECTalomo"/> below. However, because there
19003 are now so many options, they are first listed briefly in functional groups, as
19004 an aid to finding the name of the option you are looking for. Some options are
19005 listed in more than one group.
19006 </para>
19007 <section id="SECID96">
19008 <title>Miscellaneous</title>
19009 <informaltable frame="none">
19010 <tgroup cols="2" colsep="0" rowsep="0">
19011 <colspec colwidth="196pt" align="left"/>
19012 <colspec colwidth="254pt" align="left"/>
19013 <tbody>
19014 <row>
19015 <entry><option>bi_command</option></entry>
19016 <entry>to run for <option>-bi</option> command line option</entry>
19017 </row>
19018 <row>
19019 <entry><option>disable_ipv6</option></entry>
19020 <entry>do no IPv6 processing</entry>
19021 </row>
19022 <row>
19023 <entry><option>keep_malformed</option></entry>
19024 <entry>for broken files &ndash; should not happen</entry>
19025 </row>
19026 <row>
19027 <entry><option>localhost_number</option></entry>
19028 <entry>for unique message ids in clusters</entry>
19029 </row>
19030 <row>
19031 <entry><option>message_body_newlines</option></entry>
19032 <entry>retain newlines in <varname>$message_body</varname></entry>
19033 </row>
19034 <row>
19035 <entry><option>message_body_visible</option></entry>
19036 <entry>how much to show in <varname>$message_body</varname></entry>
19037 </row>
19038 <row>
19039 <entry><option>mua_wrapper</option></entry>
19040 <entry>run in <quote>MUA wrapper</quote> mode</entry>
19041 </row>
19042 <row>
19043 <entry><option>print_topbitchars</option></entry>
19044 <entry>top-bit characters are printing</entry>
19045 </row>
19046 <row>
19047 <entry><option>timezone</option></entry>
19048 <entry>force time zone</entry>
19049 </row>
19050 </tbody>
19051 </tgroup>
19052 </informaltable>
19053 </section>
19054 <section id="SECID97">
19055 <title>Exim parameters</title>
19056 <informaltable frame="none">
19057 <tgroup cols="2" colsep="0" rowsep="0">
19058 <colspec colwidth="196pt" align="left"/>
19059 <colspec colwidth="254pt" align="left"/>
19060 <tbody>
19061 <row>
19062 <entry><option>exim_group</option></entry>
19063 <entry>override compiled-in value</entry>
19064 </row>
19065 <row>
19066 <entry><option>exim_path</option></entry>
19067 <entry>override compiled-in value</entry>
19068 </row>
19069 <row>
19070 <entry><option>exim_user</option></entry>
19071 <entry>override compiled-in value</entry>
19072 </row>
19073 <row>
19074 <entry><option>primary_hostname</option></entry>
19075 <entry>default from <function>uname()</function></entry>
19076 </row>
19077 <row>
19078 <entry><option>split_spool_directory</option></entry>
19079 <entry>use multiple directories</entry>
19080 </row>
19081 <row>
19082 <entry><option>spool_directory</option></entry>
19083 <entry>override compiled-in value</entry>
19084 </row>
19085 </tbody>
19086 </tgroup>
19087 </informaltable>
19088 </section>
19089 <section id="SECID98">
19090 <title>Privilege controls</title>
19091 <informaltable frame="none">
19092 <tgroup cols="2" colsep="0" rowsep="0">
19093 <colspec colwidth="196pt" align="left"/>
19094 <colspec colwidth="254pt" align="left"/>
19095 <tbody>
19096 <row>
19097 <entry><option>admin_groups</option></entry>
19098 <entry>groups that are Exim admin users</entry>
19099 </row>
19100 <row>
19101 <entry><option>deliver_drop_privilege</option></entry>
19102 <entry>drop root for delivery processes</entry>
19103 </row>
19104 <row>
19105 <entry><option>local_from_check</option></entry>
19106 <entry>insert <emphasis>Sender:</emphasis> if necessary</entry>
19107 </row>
19108 <row>
19109 <entry><option>local_from_prefix</option></entry>
19110 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
19111 </row>
19112 <row>
19113 <entry><option>local_from_suffix</option></entry>
19114 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
19115 </row>
19116 <row>
19117 <entry><option>local_sender_retain</option></entry>
19118 <entry>keep <emphasis>Sender:</emphasis> from untrusted user</entry>
19119 </row>
19120 <row>
19121 <entry><option>never_users</option></entry>
19122 <entry>do not run deliveries as these</entry>
19123 </row>
19124 <row>
19125 <entry><option>prod_requires_admin</option></entry>
19126 <entry>forced delivery requires admin user</entry>
19127 </row>
19128 <row>
19129 <entry><option>queue_list_requires_admin</option></entry>
19130 <entry>queue listing requires admin user</entry>
19131 </row>
19132 <row>
19133 <entry><option>trusted_groups</option></entry>
19134 <entry>groups that are trusted</entry>
19135 </row>
19136 <row>
19137 <entry><option>trusted_users</option></entry>
19138 <entry>users that are trusted</entry>
19139 </row>
19140 </tbody>
19141 </tgroup>
19142 </informaltable>
19143 </section>
19144 <section id="SECID99">
19145 <title>Logging</title>
19146 <informaltable frame="none">
19147 <tgroup cols="2" colsep="0" rowsep="0">
19148 <colspec colwidth="196pt" align="left"/>
19149 <colspec colwidth="254pt" align="left"/>
19150 <tbody>
19151 <row>
19152 <entry><option>hosts_connection_nolog</option></entry>
19153 <entry>exemption from connect logging</entry>
19154 </row>
19155 <row>
19156 <entry><option>log_file_path</option></entry>
19157 <entry>override compiled-in value</entry>
19158 </row>
19159 <row>
19160 <entry><option>log_selector</option></entry>
19161 <entry>set/unset optional logging</entry>
19162 </row>
19163 <row>
19164 <entry><option>log_timezone</option></entry>
19165 <entry>add timezone to log lines</entry>
19166 </row>
19167 <row>
19168 <entry><option>message_logs</option></entry>
19169 <entry>create per-message logs</entry>
19170 </row>
19171 <row>
19172 <entry><option>preserve_message_logs</option></entry>
19173 <entry>after message completion</entry>
19174 </row>
19175 <row>
19176 <entry><option>process_log_path</option></entry>
19177 <entry>for SIGUSR1 and <emphasis>exiwhat</emphasis></entry>
19178 </row>
19179 <row>
19180 <entry><option>syslog_duplication</option></entry>
19181 <entry>controls duplicate log lines on syslog</entry>
19182 </row>
19183 <row>
19184 <entry><option>syslog_facility</option></entry>
19185 <entry>set syslog <quote>facility</quote> field</entry>
19186 </row>
19187 <row>
19188 <entry><option>syslog_processname</option></entry>
19189 <entry>set syslog <quote>ident</quote> field</entry>
19190 </row>
19191 <row>
19192 <entry><option>syslog_timestamp</option></entry>
19193 <entry>timestamp syslog lines</entry>
19194 </row>
19195 <row>
19196 <entry><option>write_rejectlog</option></entry>
19197 <entry>control use of message log</entry>
19198 </row>
19199 </tbody>
19200 </tgroup>
19201 </informaltable>
19202 </section>
19203 <section id="SECID100">
19204 <title>Frozen messages</title>
19205 <informaltable frame="none">
19206 <tgroup cols="2" colsep="0" rowsep="0">
19207 <colspec colwidth="196pt" align="left"/>
19208 <colspec colwidth="254pt" align="left"/>
19209 <tbody>
19210 <row>
19211 <entry><option>auto_thaw</option></entry>
19212 <entry>sets time for retrying frozen messages</entry>
19213 </row>
19214 <row>
19215 <entry><option>freeze_tell</option></entry>
19216 <entry>send message when freezing</entry>
19217 </row>
19218 <row>
19219 <entry><option>move_frozen_messages</option></entry>
19220 <entry>to another directory</entry>
19221 </row>
19222 <row>
19223 <entry><option>timeout_frozen_after</option></entry>
19224 <entry>keep frozen messages only so long</entry>
19225 </row>
19226 </tbody>
19227 </tgroup>
19228 </informaltable>
19229 </section>
19230 <section id="SECID101">
19231 <title>Data lookups</title>
19232 <informaltable frame="none">
19233 <tgroup cols="2" colsep="0" rowsep="0">
19234 <colspec colwidth="196pt" align="left"/>
19235 <colspec colwidth="254pt" align="left"/>
19236 <tbody>
19237 <row>
19238 <entry><option>ibase_servers</option></entry>
19239 <entry>InterBase servers</entry>
19240 </row>
19241 <row>
19242 <entry><option>ldap_ca_cert_dir</option></entry>
19243 <entry>dir of CA certs to verify LDAP server&#x2019;s</entry>
19244 </row>
19245 <row>
19246 <entry><option>ldap_ca_cert_file</option></entry>
19247 <entry>file of CA certs to verify LDAP server&#x2019;s</entry>
19248 </row>
19249 <row>
19250 <entry><option>ldap_cert_file</option></entry>
19251 <entry>client cert file for LDAP</entry>
19252 </row>
19253 <row>
19254 <entry><option>ldap_cert_key</option></entry>
19255 <entry>client key file for LDAP</entry>
19256 </row>
19257 <row>
19258 <entry><option>ldap_cipher_suite</option></entry>
19259 <entry>TLS negotiation preference control</entry>
19260 </row>
19261 <row>
19262 <entry><option>ldap_default_servers</option></entry>
19263 <entry>used if no server in query</entry>
19264 </row>
19265 <row>
19266 <entry><option>ldap_require_cert</option></entry>
19267 <entry>action to take without LDAP server cert</entry>
19268 </row>
19269 <row>
19270 <entry><option>ldap_start_tls</option></entry>
19271 <entry>require TLS within LDAP</entry>
19272 </row>
19273 <row>
19274 <entry><option>ldap_version</option></entry>
19275 <entry>set protocol version</entry>
19276 </row>
19277 <row>
19278 <entry><option>lookup_open_max</option></entry>
19279 <entry>lookup files held open</entry>
19280 </row>
19281 <row>
19282 <entry><option>mysql_servers</option></entry>
19283 <entry>default MySQL servers</entry>
19284 </row>
19285 <row>
19286 <entry><option>oracle_servers</option></entry>
19287 <entry>Oracle servers</entry>
19288 </row>
19289 <row>
19290 <entry><option>pgsql_servers</option></entry>
19291 <entry>default PostgreSQL servers</entry>
19292 </row>
19293 <row>
19294 <entry><option>sqlite_lock_timeout</option></entry>
19295 <entry>as it says</entry>
19296 </row>
19297 </tbody>
19298 </tgroup>
19299 </informaltable>
19300 </section>
19301 <section id="SECID102">
19302 <title>Message ids</title>
19303 <informaltable frame="none">
19304 <tgroup cols="2" colsep="0" rowsep="0">
19305 <colspec colwidth="196pt" align="left"/>
19306 <colspec colwidth="254pt" align="left"/>
19307 <tbody>
19308 <row>
19309 <entry><option>message_id_header_domain</option></entry>
19310 <entry>used to build <emphasis>Message-ID:</emphasis> header</entry>
19311 </row>
19312 <row>
19313 <entry><option>message_id_header_text</option></entry>
19314 <entry>ditto</entry>
19315 </row>
19316 </tbody>
19317 </tgroup>
19318 </informaltable>
19319 </section>
19320 <section id="SECID103">
19321 <title>Embedded Perl Startup</title>
19322 <informaltable frame="none">
19323 <tgroup cols="2" colsep="0" rowsep="0">
19324 <colspec colwidth="196pt" align="left"/>
19325 <colspec colwidth="254pt" align="left"/>
19326 <tbody>
19327 <row>
19328 <entry><option>perl_at_start</option></entry>
19329 <entry>always start the interpreter</entry>
19330 </row>
19331 <row>
19332 <entry><option>perl_startup</option></entry>
19333 <entry>code to obey when starting Perl</entry>
19334 </row>
19335 </tbody>
19336 </tgroup>
19337 </informaltable>
19338 </section>
19339 <section id="SECID104">
19340 <title>Daemon</title>
19341 <informaltable frame="none">
19342 <tgroup cols="2" colsep="0" rowsep="0">
19343 <colspec colwidth="196pt" align="left"/>
19344 <colspec colwidth="254pt" align="left"/>
19345 <tbody>
19346 <row>
19347 <entry><option>daemon_smtp_ports</option></entry>
19348 <entry>default ports</entry>
19349 </row>
19350 <row>
19351 <entry><option>daemon_startup_retries</option></entry>
19352 <entry>number of times to retry</entry>
19353 </row>
19354 <row>
19355 <entry><option>daemon_startup_sleep</option></entry>
19356 <entry>time to sleep between tries</entry>
19357 </row>
19358 <row>
19359 <entry><option>extra_local_interfaces</option></entry>
19360 <entry>not necessarily listened on</entry>
19361 </row>
19362 <row>
19363 <entry><option>local_interfaces</option></entry>
19364 <entry>on which to listen, with optional ports</entry>
19365 </row>
19366 <row>
19367 <entry><option>pid_file_path</option></entry>
19368 <entry>override compiled-in value</entry>
19369 </row>
19370 <row>
19371 <entry><option>queue_run_max</option></entry>
19372 <entry>maximum simultaneous queue runners</entry>
19373 </row>
19374 </tbody>
19375 </tgroup>
19376 </informaltable>
19377 </section>
19378 <section id="SECID105">
19379 <title>Resource control</title>
19380 <informaltable frame="none">
19381 <tgroup cols="2" colsep="0" rowsep="0">
19382 <colspec colwidth="196pt" align="left"/>
19383 <colspec colwidth="254pt" align="left"/>
19384 <tbody>
19385 <row>
19386 <entry><option>check_log_inodes</option></entry>
19387 <entry>before accepting a message</entry>
19388 </row>
19389 <row>
19390 <entry><option>check_log_space</option></entry>
19391 <entry>before accepting a message</entry>
19392 </row>
19393 <row>
19394 <entry><option>check_spool_inodes</option></entry>
19395 <entry>before accepting a message</entry>
19396 </row>
19397 <row>
19398 <entry><option>check_spool_space</option></entry>
19399 <entry>before accepting a message</entry>
19400 </row>
19401 <row>
19402 <entry><option>deliver_queue_load_max</option></entry>
19403 <entry>no queue deliveries if load high</entry>
19404 </row>
19405 <row>
19406 <entry><option>queue_only_load</option></entry>
19407 <entry>queue incoming if load high</entry>
19408 </row>
19409 <row>
19410 <entry><option>queue_only_load_latch</option></entry>
19411 <entry>don&#x2019;t re-evaluate load for each message</entry>
19412 </row>
19413 <row>
19414 <entry><option>queue_run_max</option></entry>
19415 <entry>maximum simultaneous queue runners</entry>
19416 </row>
19417 <row>
19418 <entry><option>remote_max_parallel</option></entry>
19419 <entry>parallel SMTP delivery per message</entry>
19420 </row>
19421 <row>
19422 <entry><option>smtp_accept_max</option></entry>
19423 <entry>simultaneous incoming connections</entry>
19424 </row>
19425 <row>
19426 <entry><option>smtp_accept_max_nonmail</option></entry>
19427 <entry>non-mail commands</entry>
19428 </row>
19429 <row>
19430 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
19431 <entry>hosts to which the limit applies</entry>
19432 </row>
19433 <row>
19434 <entry><option>smtp_accept_max_per_connection</option></entry>
19435 <entry>messages per connection</entry>
19436 </row>
19437 <row>
19438 <entry><option>smtp_accept_max_per_host</option></entry>
19439 <entry>connections from one host</entry>
19440 </row>
19441 <row>
19442 <entry><option>smtp_accept_queue</option></entry>
19443 <entry>queue mail if more connections</entry>
19444 </row>
19445 <row>
19446 <entry><option>smtp_accept_queue_per_connection</option></entry>
19447 <entry>queue if more messages per connection</entry>
19448 </row>
19449 <row>
19450 <entry><option>smtp_accept_reserve</option></entry>
19451 <entry>only reserve hosts if more connections</entry>
19452 </row>
19453 <row>
19454 <entry><option>smtp_check_spool_space</option></entry>
19455 <entry>from SIZE on MAIL command</entry>
19456 </row>
19457 <row>
19458 <entry><option>smtp_connect_backlog</option></entry>
19459 <entry>passed to TCP/IP stack</entry>
19460 </row>
19461 <row>
19462 <entry><option>smtp_load_reserve</option></entry>
19463 <entry>SMTP from reserved hosts if load high</entry>
19464 </row>
19465 <row>
19466 <entry><option>smtp_reserve_hosts</option></entry>
19467 <entry>these are the reserve hosts</entry>
19468 </row>
19469 </tbody>
19470 </tgroup>
19471 </informaltable>
19472 </section>
19473 <section id="SECID106">
19474 <title>Policy controls</title>
19475 <informaltable frame="none">
19476 <tgroup cols="2" colsep="0" rowsep="0">
19477 <colspec colwidth="196pt" align="left"/>
19478 <colspec colwidth="254pt" align="left"/>
19479 <tbody>
19480 <row>
19481 <entry><option>acl_not_smtp</option></entry>
19482 <entry>ACL for non-SMTP messages</entry>
19483 </row>
19484 <row>
19485 <entry><option>acl_not_smtp_mime</option></entry>
19486 <entry>ACL for non-SMTP MIME parts</entry>
19487 </row>
19488 <row>
19489 <entry><option>acl_not_smtp_start</option></entry>
19490 <entry>ACL for start of non-SMTP message</entry>
19491 </row>
19492 <row>
19493 <entry><option>acl_smtp_auth</option></entry>
19494 <entry>ACL for AUTH</entry>
19495 </row>
19496 <row>
19497 <entry><option>acl_smtp_connect</option></entry>
19498 <entry>ACL for connection</entry>
19499 </row>
19500 <row>
19501 <entry><option>acl_smtp_data</option></entry>
19502 <entry>ACL for DATA</entry>
19503 </row>
19504 <row>
19505 <entry><option>acl_smtp_dkim</option></entry>
19506 <entry>ACL for DKIM verification</entry>
19507 </row>
19508 <row>
19509 <entry><option>acl_smtp_etrn</option></entry>
19510 <entry>ACL for ETRN</entry>
19511 </row>
19512 <row>
19513 <entry><option>acl_smtp_expn</option></entry>
19514 <entry>ACL for EXPN</entry>
19515 </row>
19516 <row>
19517 <entry><option>acl_smtp_helo</option></entry>
19518 <entry>ACL for EHLO or HELO</entry>
19519 </row>
19520 <row>
19521 <entry><option>acl_smtp_mail</option></entry>
19522 <entry>ACL for MAIL</entry>
19523 </row>
19524 <row>
19525 <entry><option>acl_smtp_mailauth</option></entry>
19526 <entry>ACL for AUTH on MAIL command</entry>
19527 </row>
19528 <row>
19529 <entry><option>acl_smtp_mime</option></entry>
19530 <entry>ACL for MIME parts</entry>
19531 </row>
19532 <row>
19533 <entry><option>acl_smtp_predata</option></entry>
19534 <entry>ACL for start of data</entry>
19535 </row>
19536 <row>
19537 <entry><option>acl_smtp_quit</option></entry>
19538 <entry>ACL for QUIT</entry>
19539 </row>
19540 <row>
19541 <entry><option>acl_smtp_rcpt</option></entry>
19542 <entry>ACL for RCPT</entry>
19543 </row>
19544 <row>
19545 <entry><option>acl_smtp_starttls</option></entry>
19546 <entry>ACL for STARTTLS</entry>
19547 </row>
19548 <row>
19549 <entry><option>acl_smtp_vrfy</option></entry>
19550 <entry>ACL for VRFY</entry>
19551 </row>
19552 <row>
19553 <entry><option>av_scanner</option></entry>
19554 <entry>specify virus scanner</entry>
19555 </row>
19556 <row>
19557 <entry><option>check_rfc2047_length</option></entry>
19558 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
19559 </row>
19560 <row>
19561 <entry><option>dns_csa_search_limit</option></entry>
19562 <entry>control CSA parent search depth</entry>
19563 </row>
19564 <row>
19565 <entry><option>dns_csa_use_reverse</option></entry>
19566 <entry>en/disable CSA IP reverse search</entry>
19567 </row>
19568 <row>
19569 <entry><option>header_maxsize</option></entry>
19570 <entry>total size of message header</entry>
19571 </row>
19572 <row>
19573 <entry><option>header_line_maxsize</option></entry>
19574 <entry>individual header line limit</entry>
19575 </row>
19576 <row>
19577 <entry><option>helo_accept_junk_hosts</option></entry>
19578 <entry>allow syntactic junk from these hosts</entry>
19579 </row>
19580 <row>
19581 <entry><option>helo_allow_chars</option></entry>
19582 <entry>allow illegal chars in HELO names</entry>
19583 </row>
19584 <row>
19585 <entry><option>helo_lookup_domains</option></entry>
19586 <entry>lookup hostname for these HELO names</entry>
19587 </row>
19588 <row>
19589 <entry><option>helo_try_verify_hosts</option></entry>
19590 <entry>HELO soft-checked for these hosts</entry>
19591 </row>
19592 <row>
19593 <entry><option>helo_verify_hosts</option></entry>
19594 <entry>HELO hard-checked for these hosts</entry>
19595 </row>
19596 <row>
19597 <entry><option>host_lookup</option></entry>
19598 <entry>host name looked up for these hosts</entry>
19599 </row>
19600 <row>
19601 <entry><option>host_lookup_order</option></entry>
19602 <entry>order of DNS and local name lookups</entry>
19603 </row>
19604 <row>
19605 <entry><option>host_reject_connection</option></entry>
19606 <entry>reject connection from these hosts</entry>
19607 </row>
19608 <row>
19609 <entry><option>hosts_treat_as_local</option></entry>
19610 <entry>useful in some cluster configurations</entry>
19611 </row>
19612 <row>
19613 <entry><option>local_scan_timeout</option></entry>
19614 <entry>timeout for <function>local_scan()</function></entry>
19615 </row>
19616 <row>
19617 <entry><option>message_size_limit</option></entry>
19618 <entry>for all messages</entry>
19619 </row>
19620 <row>
19621 <entry><option>percent_hack_domains</option></entry>
19622 <entry>recognize %-hack for these domains</entry>
19623 </row>
19624 <row>
19625 <entry><option>spamd_address</option></entry>
19626 <entry>set interface to SpamAssassin</entry>
19627 </row>
19628 <row>
19629 <entry><option>strict_acl_vars</option></entry>
19630 <entry>object to unset ACL variables</entry>
19631 </row>
19632 </tbody>
19633 </tgroup>
19634 </informaltable>
19635 </section>
19636 <section id="SECID107">
19637 <title>Callout cache</title>
19638 <informaltable frame="none">
19639 <tgroup cols="2" colsep="0" rowsep="0">
19640 <colspec colwidth="196pt" align="left"/>
19641 <colspec colwidth="254pt" align="left"/>
19642 <tbody>
19643 <row>
19644 <entry><option>callout_domain_negative_expire</option></entry>
19645 <entry>timeout for negative domain cache item</entry>
19646 </row>
19647 <row>
19648 <entry><option>callout_domain_positive_expire</option></entry>
19649 <entry>timeout for positive domain cache item</entry>
19650 </row>
19651 <row>
19652 <entry><option>callout_negative_expire</option></entry>
19653 <entry>timeout for negative address cache item</entry>
19654 </row>
19655 <row>
19656 <entry><option>callout_positive_expire</option></entry>
19657 <entry>timeout for positive address cache item</entry>
19658 </row>
19659 <row>
19660 <entry><option>callout_random_local_part</option></entry>
19661 <entry>string to use for <quote>random</quote> testing</entry>
19662 </row>
19663 </tbody>
19664 </tgroup>
19665 </informaltable>
19666 </section>
19667 <section id="SECID108">
19668 <title>TLS</title>
19669 <informaltable frame="none">
19670 <tgroup cols="2" colsep="0" rowsep="0">
19671 <colspec colwidth="196pt" align="left"/>
19672 <colspec colwidth="254pt" align="left"/>
19673 <tbody>
19674 <row>
19675 <entry><option>gnutls_require_kx</option></entry>
19676 <entry>control GnuTLS key exchanges</entry>
19677 </row>
19678 <row>
19679 <entry><option>gnutls_require_mac</option></entry>
19680 <entry>control GnuTLS MAC algorithms</entry>
19681 </row>
19682 <row>
19683 <entry><option>gnutls_require_protocols</option></entry>
19684 <entry>control GnuTLS protocols</entry>
19685 </row>
19686 <row>
19687 <entry><option>gnutls_compat_mode</option></entry>
19688 <entry>use GnuTLS compatibility mode</entry>
19689 </row>
19690 <row>
19691 <entry><option>openssl_options</option></entry>
19692 <entry>adjust OpenSSL compatibility options</entry>
19693 </row>
19694 <row>
19695 <entry><option>tls_advertise_hosts</option></entry>
19696 <entry>advertise TLS to these hosts</entry>
19697 </row>
19698 <row>
19699 <entry><option>tls_certificate</option></entry>
19700 <entry>location of server certificate</entry>
19701 </row>
19702 <row>
19703 <entry><option>tls_crl</option></entry>
19704 <entry>certificate revocation list</entry>
19705 </row>
19706 <row>
19707 <entry><option>tls_dhparam</option></entry>
19708 <entry>DH parameters for server</entry>
19709 </row>
19710 <row>
19711 <entry><option>tls_on_connect_ports</option></entry>
19712 <entry>specify SSMTP (SMTPS) ports</entry>
19713 </row>
19714 <row>
19715 <entry><option>tls_privatekey</option></entry>
19716 <entry>location of server private key</entry>
19717 </row>
19718 <row>
19719 <entry><option>tls_remember_esmtp</option></entry>
19720 <entry>don&#x2019;t reset after starting TLS</entry>
19721 </row>
19722 <row>
19723 <entry><option>tls_require_ciphers</option></entry>
19724 <entry>specify acceptable ciphers</entry>
19725 </row>
19726 <row>
19727 <entry><option>tls_try_verify_hosts</option></entry>
19728 <entry>try to verify client certificate</entry>
19729 </row>
19730 <row>
19731 <entry><option>tls_verify_certificates</option></entry>
19732 <entry>expected client certificates</entry>
19733 </row>
19734 <row>
19735 <entry><option>tls_verify_hosts</option></entry>
19736 <entry>insist on client certificate verify</entry>
19737 </row>
19738 </tbody>
19739 </tgroup>
19740 </informaltable>
19741 </section>
19742 <section id="SECID109">
19743 <title>Local user handling</title>
19744 <informaltable frame="none">
19745 <tgroup cols="2" colsep="0" rowsep="0">
19746 <colspec colwidth="196pt" align="left"/>
19747 <colspec colwidth="254pt" align="left"/>
19748 <tbody>
19749 <row>
19750 <entry><option>finduser_retries</option></entry>
19751 <entry>useful in NIS environments</entry>
19752 </row>
19753 <row>
19754 <entry><option>gecos_name</option></entry>
19755 <entry>used when creating <emphasis>Sender:</emphasis></entry>
19756 </row>
19757 <row>
19758 <entry><option>gecos_pattern</option></entry>
19759 <entry>ditto</entry>
19760 </row>
19761 <row>
19762 <entry><option>max_username_length</option></entry>
19763 <entry>for systems that truncate</entry>
19764 </row>
19765 <row>
19766 <entry><option>unknown_login</option></entry>
19767 <entry>used when no login name found</entry>
19768 </row>
19769 <row>
19770 <entry><option>unknown_username</option></entry>
19771 <entry>ditto</entry>
19772 </row>
19773 <row>
19774 <entry><option>uucp_from_pattern</option></entry>
19775 <entry>for recognizing <quote>From </quote> lines</entry>
19776 </row>
19777 <row>
19778 <entry><option>uucp_from_sender</option></entry>
19779 <entry>ditto</entry>
19780 </row>
19781 </tbody>
19782 </tgroup>
19783 </informaltable>
19784 </section>
19785 <section id="SECID110">
19786 <title>All incoming messages (SMTP and non-SMTP)</title>
19787 <informaltable frame="none">
19788 <tgroup cols="2" colsep="0" rowsep="0">
19789 <colspec colwidth="196pt" align="left"/>
19790 <colspec colwidth="254pt" align="left"/>
19791 <tbody>
19792 <row>
19793 <entry><option>header_maxsize</option></entry>
19794 <entry>total size of message header</entry>
19795 </row>
19796 <row>
19797 <entry><option>header_line_maxsize</option></entry>
19798 <entry>individual header line limit</entry>
19799 </row>
19800 <row>
19801 <entry><option>message_size_limit</option></entry>
19802 <entry>applies to all messages</entry>
19803 </row>
19804 <row>
19805 <entry><option>percent_hack_domains</option></entry>
19806 <entry>recognize %-hack for these domains</entry>
19807 </row>
19808 <row>
19809 <entry><option>received_header_text</option></entry>
19810 <entry>expanded to make <emphasis>Received:</emphasis></entry>
19811 </row>
19812 <row>
19813 <entry><option>received_headers_max</option></entry>
19814 <entry>for mail loop detection</entry>
19815 </row>
19816 <row>
19817 <entry><option>recipients_max</option></entry>
19818 <entry>limit per message</entry>
19819 </row>
19820 <row>
19821 <entry><option>recipients_max_reject</option></entry>
19822 <entry>permanently reject excess recipients</entry>
19823 </row>
19824 </tbody>
19825 </tgroup>
19826 </informaltable>
19827 </section>
19828 <section id="SECID111">
19829 <title>Non-SMTP incoming messages</title>
19830 <informaltable frame="none">
19831 <tgroup cols="2" colsep="0" rowsep="0">
19832 <colspec colwidth="196pt" align="left"/>
19833 <colspec colwidth="254pt" align="left"/>
19834 <tbody>
19835 <row>
19836 <entry><option>receive_timeout</option></entry>
19837 <entry>for non-SMTP messages</entry>
19838 </row>
19839 </tbody>
19840 </tgroup>
19841 </informaltable>
19842 </section>
19843 <section id="SECID112">
19844 <title>Incoming SMTP messages</title>
19845 <para>
19846 See also the <emphasis>Policy controls</emphasis> section above.
19847 </para>
19848 <informaltable frame="none">
19849 <tgroup cols="2" colsep="0" rowsep="0">
19850 <colspec colwidth="196pt" align="left"/>
19851 <colspec colwidth="254pt" align="left"/>
19852 <tbody>
19853 <row>
19854 <entry><option>host_lookup</option></entry>
19855 <entry>host name looked up for these hosts</entry>
19856 </row>
19857 <row>
19858 <entry><option>host_lookup_order</option></entry>
19859 <entry>order of DNS and local name lookups</entry>
19860 </row>
19861 <row>
19862 <entry><option>recipient_unqualified_hosts</option></entry>
19863 <entry>may send unqualified recipients</entry>
19864 </row>
19865 <row>
19866 <entry><option>rfc1413_hosts</option></entry>
19867 <entry>make ident calls to these hosts</entry>
19868 </row>
19869 <row>
19870 <entry><option>rfc1413_query_timeout</option></entry>
19871 <entry>zero disables ident calls</entry>
19872 </row>
19873 <row>
19874 <entry><option>sender_unqualified_hosts</option></entry>
19875 <entry>may send unqualified senders</entry>
19876 </row>
19877 <row>
19878 <entry><option>smtp_accept_keepalive</option></entry>
19879 <entry>some TCP/IP magic</entry>
19880 </row>
19881 <row>
19882 <entry><option>smtp_accept_max</option></entry>
19883 <entry>simultaneous incoming connections</entry>
19884 </row>
19885 <row>
19886 <entry><option>smtp_accept_max_nonmail</option></entry>
19887 <entry>non-mail commands</entry>
19888 </row>
19889 <row>
19890 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
19891 <entry>hosts to which the limit applies</entry>
19892 </row>
19893 <row>
19894 <entry><option>smtp_accept_max_per_connection</option></entry>
19895 <entry>messages per connection</entry>
19896 </row>
19897 <row>
19898 <entry><option>smtp_accept_max_per_host</option></entry>
19899 <entry>connections from one host</entry>
19900 </row>
19901 <row>
19902 <entry><option>smtp_accept_queue</option></entry>
19903 <entry>queue mail if more connections</entry>
19904 </row>
19905 <row>
19906 <entry><option>smtp_accept_queue_per_connection</option></entry>
19907 <entry>queue if more messages per connection</entry>
19908 </row>
19909 <row>
19910 <entry><option>smtp_accept_reserve</option></entry>
19911 <entry>only reserve hosts if more connections</entry>
19912 </row>
19913 <row>
19914 <entry><option>smtp_active_hostname</option></entry>
19915 <entry>host name to use in messages</entry>
19916 </row>
19917 <row>
19918 <entry><option>smtp_banner</option></entry>
19919 <entry>text for welcome banner</entry>
19920 </row>
19921 <row>
19922 <entry><option>smtp_check_spool_space</option></entry>
19923 <entry>from SIZE on MAIL command</entry>
19924 </row>
19925 <row>
19926 <entry><option>smtp_connect_backlog</option></entry>
19927 <entry>passed to TCP/IP stack</entry>
19928 </row>
19929 <row>
19930 <entry><option>smtp_enforce_sync</option></entry>
19931 <entry>of SMTP command/responses</entry>
19932 </row>
19933 <row>
19934 <entry><option>smtp_etrn_command</option></entry>
19935 <entry>what to run for ETRN</entry>
19936 </row>
19937 <row>
19938 <entry><option>smtp_etrn_serialize</option></entry>
19939 <entry>only one at once</entry>
19940 </row>
19941 <row>
19942 <entry><option>smtp_load_reserve</option></entry>
19943 <entry>only reserve hosts if this load</entry>
19944 </row>
19945 <row>
19946 <entry><option>smtp_max_unknown_commands</option></entry>
19947 <entry>before dropping connection</entry>
19948 </row>
19949 <row>
19950 <entry><option>smtp_ratelimit_hosts</option></entry>
19951 <entry>apply ratelimiting to these hosts</entry>
19952 </row>
19953 <row>
19954 <entry><option>smtp_ratelimit_mail</option></entry>
19955 <entry>ratelimit for MAIL commands</entry>
19956 </row>
19957 <row>
19958 <entry><option>smtp_ratelimit_rcpt</option></entry>
19959 <entry>ratelimit for RCPT commands</entry>
19960 </row>
19961 <row>
19962 <entry><option>smtp_receive_timeout</option></entry>
19963 <entry>per command or data line</entry>
19964 </row>
19965 <row>
19966 <entry><option>smtp_reserve_hosts</option></entry>
19967 <entry>these are the reserve hosts</entry>
19968 </row>
19969 <row>
19970 <entry><option>smtp_return_error_details</option></entry>
19971 <entry>give detail on rejections</entry>
19972 </row>
19973 </tbody>
19974 </tgroup>
19975 </informaltable>
19976 </section>
19977 <section id="SECID113">
19978 <title>SMTP extensions</title>
19979 <informaltable frame="none">
19980 <tgroup cols="2" colsep="0" rowsep="0">
19981 <colspec colwidth="196pt" align="left"/>
19982 <colspec colwidth="254pt" align="left"/>
19983 <tbody>
19984 <row>
19985 <entry><option>accept_8bitmime</option></entry>
19986 <entry>advertise 8BITMIME</entry>
19987 </row>
19988 <row>
19989 <entry><option>auth_advertise_hosts</option></entry>
19990 <entry>advertise AUTH to these hosts</entry>
19991 </row>
19992 <row>
19993 <entry><option>ignore_fromline_hosts</option></entry>
19994 <entry>allow <quote>From </quote> from these hosts</entry>
19995 </row>
19996 <row>
19997 <entry><option>ignore_fromline_local</option></entry>
19998 <entry>allow <quote>From </quote> from local SMTP</entry>
19999 </row>
20000 <row>
20001 <entry><option>pipelining_advertise_hosts</option></entry>
20002 <entry>advertise pipelining to these hosts</entry>
20003 </row>
20004 <row>
20005 <entry><option>tls_advertise_hosts</option></entry>
20006 <entry>advertise TLS to these hosts</entry>
20007 </row>
20008 </tbody>
20009 </tgroup>
20010 </informaltable>
20011 </section>
20012 <section id="SECID114">
20013 <title>Processing messages</title>
20014 <informaltable frame="none">
20015 <tgroup cols="2" colsep="0" rowsep="0">
20016 <colspec colwidth="196pt" align="left"/>
20017 <colspec colwidth="254pt" align="left"/>
20018 <tbody>
20019 <row>
20020 <entry><option>allow_domain_literals</option></entry>
20021 <entry>recognize domain literal syntax</entry>
20022 </row>
20023 <row>
20024 <entry><option>allow_mx_to_ip</option></entry>
20025 <entry>allow MX to point to IP address</entry>
20026 </row>
20027 <row>
20028 <entry><option>allow_utf8_domains</option></entry>
20029 <entry>in addresses</entry>
20030 </row>
20031 <row>
20032 <entry><option>check_rfc2047_length</option></entry>
20033 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
20034 </row>
20035 <row>
20036 <entry><option>delivery_date_remove</option></entry>
20037 <entry>from incoming messages</entry>
20038 </row>
20039 <row>
20040 <entry><option>envelope_to_remove</option></entry>
20041 <entry>from incoming messages</entry>
20042 </row>
20043 <row>
20044 <entry><option>extract_addresses_remove_arguments</option></entry>
20045 <entry>affects <option>-t</option> processing</entry>
20046 </row>
20047 <row>
20048 <entry><option>headers_charset</option></entry>
20049 <entry>default for translations</entry>
20050 </row>
20051 <row>
20052 <entry><option>qualify_domain</option></entry>
20053 <entry>default for senders</entry>
20054 </row>
20055 <row>
20056 <entry><option>qualify_recipient</option></entry>
20057 <entry>default for recipients</entry>
20058 </row>
20059 <row>
20060 <entry><option>return_path_remove</option></entry>
20061 <entry>from incoming messages</entry>
20062 </row>
20063 <row>
20064 <entry><option>strip_excess_angle_brackets</option></entry>
20065 <entry>in addresses</entry>
20066 </row>
20067 <row>
20068 <entry><option>strip_trailing_dot</option></entry>
20069 <entry>at end of addresses</entry>
20070 </row>
20071 <row>
20072 <entry><option>untrusted_set_sender</option></entry>
20073 <entry>untrusted can set envelope sender</entry>
20074 </row>
20075 </tbody>
20076 </tgroup>
20077 </informaltable>
20078 </section>
20079 <section id="SECID115">
20080 <title>System filter</title>
20081 <informaltable frame="none">
20082 <tgroup cols="2" colsep="0" rowsep="0">
20083 <colspec colwidth="196pt" align="left"/>
20084 <colspec colwidth="254pt" align="left"/>
20085 <tbody>
20086 <row>
20087 <entry><option>system_filter</option></entry>
20088 <entry>locate system filter</entry>
20089 </row>
20090 <row>
20091 <entry><option>system_filter_directory_transport</option></entry>
20092 <entry>transport for delivery to a directory</entry>
20093 </row>
20094 <row>
20095 <entry><option>system_filter_file_transport</option></entry>
20096 <entry>transport for delivery to a file</entry>
20097 </row>
20098 <row>
20099 <entry><option>system_filter_group</option></entry>
20100 <entry>group for filter running</entry>
20101 </row>
20102 <row>
20103 <entry><option>system_filter_pipe_transport</option></entry>
20104 <entry>transport for delivery to a pipe</entry>
20105 </row>
20106 <row>
20107 <entry><option>system_filter_reply_transport</option></entry>
20108 <entry>transport for autoreply delivery</entry>
20109 </row>
20110 <row>
20111 <entry><option>system_filter_user</option></entry>
20112 <entry>user for filter running</entry>
20113 </row>
20114 </tbody>
20115 </tgroup>
20116 </informaltable>
20117 </section>
20118 <section id="SECID116">
20119 <title>Routing and delivery</title>
20120 <informaltable frame="none">
20121 <tgroup cols="2" colsep="0" rowsep="0">
20122 <colspec colwidth="196pt" align="left"/>
20123 <colspec colwidth="254pt" align="left"/>
20124 <tbody>
20125 <row>
20126 <entry><option>disable_ipv6</option></entry>
20127 <entry>do no IPv6 processing</entry>
20128 </row>
20129 <row>
20130 <entry><option>dns_again_means_nonexist</option></entry>
20131 <entry>for broken domains</entry>
20132 </row>
20133 <row>
20134 <entry><option>dns_check_names_pattern</option></entry>
20135 <entry>pre-DNS syntax check</entry>
20136 </row>
20137 <row>
20138 <entry><option>dns_ipv4_lookup</option></entry>
20139 <entry>only v4 lookup for these domains</entry>
20140 </row>
20141 <row>
20142 <entry><option>dns_retrans</option></entry>
20143 <entry>parameter for resolver</entry>
20144 </row>
20145 <row>
20146 <entry><option>dns_retry</option></entry>
20147 <entry>parameter for resolver</entry>
20148 </row>
20149 <row>
20150 <entry><option>hold_domains</option></entry>
20151 <entry>hold delivery for these domains</entry>
20152 </row>
20153 <row>
20154 <entry><option>local_interfaces</option></entry>
20155 <entry>for routing checks</entry>
20156 </row>
20157 <row>
20158 <entry><option>queue_domains</option></entry>
20159 <entry>no immediate delivery for these</entry>
20160 </row>
20161 <row>
20162 <entry><option>queue_only</option></entry>
20163 <entry>no immediate delivery at all</entry>
20164 </row>
20165 <row>
20166 <entry><option>queue_only_file</option></entry>
20167 <entry>no immediate delivery if file exists</entry>
20168 </row>
20169 <row>
20170 <entry><option>queue_only_load</option></entry>
20171 <entry>no immediate delivery if load is high</entry>
20172 </row>
20173 <row>
20174 <entry><option>queue_only_load_latch</option></entry>
20175 <entry>don&#x2019;t re-evaluate load for each message</entry>
20176 </row>
20177 <row>
20178 <entry><option>queue_only_override</option></entry>
20179 <entry>allow command line to override</entry>
20180 </row>
20181 <row>
20182 <entry><option>queue_run_in_order</option></entry>
20183 <entry>order of arrival</entry>
20184 </row>
20185 <row>
20186 <entry><option>queue_run_max</option></entry>
20187 <entry>of simultaneous queue runners</entry>
20188 </row>
20189 <row>
20190 <entry><option>queue_smtp_domains</option></entry>
20191 <entry>no immediate SMTP delivery for these</entry>
20192 </row>
20193 <row>
20194 <entry><option>remote_max_parallel</option></entry>
20195 <entry>parallel SMTP delivery per message</entry>
20196 </row>
20197 <row>
20198 <entry><option>remote_sort_domains</option></entry>
20199 <entry>order of remote deliveries</entry>
20200 </row>
20201 <row>
20202 <entry><option>retry_data_expire</option></entry>
20203 <entry>timeout for retry data</entry>
20204 </row>
20205 <row>
20206 <entry><option>retry_interval_max</option></entry>
20207 <entry>safety net for retry rules</entry>
20208 </row>
20209 </tbody>
20210 </tgroup>
20211 </informaltable>
20212 </section>
20213 <section id="SECID117">
20214 <title>Bounce and warning messages</title>
20215 <informaltable frame="none">
20216 <tgroup cols="2" colsep="0" rowsep="0">
20217 <colspec colwidth="196pt" align="left"/>
20218 <colspec colwidth="254pt" align="left"/>
20219 <tbody>
20220 <row>
20221 <entry><option>bounce_message_file</option></entry>
20222 <entry>content of bounce</entry>
20223 </row>
20224 <row>
20225 <entry><option>bounce_message_text</option></entry>
20226 <entry>content of bounce</entry>
20227 </row>
20228 <row>
20229 <entry><option>bounce_return_body</option></entry>
20230 <entry>include body if returning message</entry>
20231 </row>
20232 <row>
20233 <entry><option>bounce_return_message</option></entry>
20234 <entry>include original message in bounce</entry>
20235 </row>
20236 <row>
20237 <entry><option>bounce_return_size_limit</option></entry>
20238 <entry>limit on returned message</entry>
20239 </row>
20240 <row>
20241 <entry><option>bounce_sender_authentication</option></entry>
20242 <entry>send authenticated sender with bounce</entry>
20243 </row>
20244 <row>
20245 <entry><option>dsn_from</option></entry>
20246 <entry>set <emphasis>From:</emphasis> contents in bounces</entry>
20247 </row>
20248 <row>
20249 <entry><option>errors_copy</option></entry>
20250 <entry>copy bounce messages</entry>
20251 </row>
20252 <row>
20253 <entry><option>errors_reply_to</option></entry>
20254 <entry><emphasis>Reply-to:</emphasis> in bounces</entry>
20255 </row>
20256 <row>
20257 <entry><option>delay_warning</option></entry>
20258 <entry>time schedule</entry>
20259 </row>
20260 <row>
20261 <entry><option>delay_warning_condition</option></entry>
20262 <entry>condition for warning messages</entry>
20263 </row>
20264 <row>
20265 <entry><option>ignore_bounce_errors_after</option></entry>
20266 <entry>discard undeliverable bounces</entry>
20267 </row>
20268 <row>
20269 <entry><option>smtp_return_error_details</option></entry>
20270 <entry>give detail on rejections</entry>
20271 </row>
20272 <row>
20273 <entry><option>warn_message_file</option></entry>
20274 <entry>content of warning message</entry>
20275 </row>
20276 </tbody>
20277 </tgroup>
20278 </informaltable>
20279 </section>
20280 <section id="SECTalomo">
20281 <title>Alphabetical list of main options</title>
20282 <para>
20283 Those options that undergo string expansion before use are marked with
20284 &dagger;.
20285 </para>
20286 <para>
20287 <indexterm role="option">
20288 <primary><option>accept_8bitmime</option></primary>
20289 </indexterm>
20290 </para>
20291 <informaltable frame="all">
20292 <tgroup cols="4" colsep="0" rowsep="0">
20293 <colspec colwidth="8*" align="left"/>
20294 <colspec colwidth="6*" align="center"/>
20295 <colspec colwidth="6*" align="center"/>
20296 <colspec colwidth="6*" align="right"/>
20297 <tbody>
20298 <row>
20299 <entry><option>accept_8bitmime</option></entry>
20300 <entry>Use: <emphasis>main</emphasis></entry>
20301 <entry>Type: <emphasis>boolean</emphasis></entry>
20302 <entry>Default: <emphasis>false</emphasis></entry>
20303 </row>
20304 </tbody>
20305 </tgroup>
20306 </informaltable>
20307 <para>
20308 <indexterm role="concept">
20309 <primary>8BITMIME</primary>
20310 </indexterm>
20311 <indexterm role="concept">
20312 <primary>8-bit characters</primary>
20313 </indexterm>
20314 This option causes Exim to send 8BITMIME in its response to an SMTP
20315 EHLO command, and to accept the BODY= parameter on MAIL commands.
20316 However, though Exim is 8-bit clean, it is not a protocol converter, and it
20317 takes no steps to do anything special with messages received by this route.
20318 Consequently, this option is turned off by default.
20319 </para>
20320 <para>
20321 <indexterm role="option">
20322 <primary><option>acl_not_smtp</option></primary>
20323 </indexterm>
20324 </para>
20325 <informaltable frame="all">
20326 <tgroup cols="4" colsep="0" rowsep="0">
20327 <colspec colwidth="8*" align="left"/>
20328 <colspec colwidth="6*" align="center"/>
20329 <colspec colwidth="6*" align="center"/>
20330 <colspec colwidth="6*" align="right"/>
20331 <tbody>
20332 <row>
20333 <entry><option>acl_not_smtp</option></entry>
20334 <entry>Use: <emphasis>main</emphasis></entry>
20335 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20336 <entry>Default: <emphasis>unset</emphasis></entry>
20337 </row>
20338 </tbody>
20339 </tgroup>
20340 </informaltable>
20341 <para>
20342 <indexterm role="concept">
20343 <primary>access control lists (ACLs)</primary>
20344 <secondary>for non-SMTP messages</secondary>
20345 </indexterm>
20346 <indexterm role="concept">
20347 <primary>non-SMTP messages</primary>
20348 <secondary>ACLs for</secondary>
20349 </indexterm>
20350 This option defines the ACL that is run when a non-SMTP message has been
20351 read and is on the point of being accepted. See chapter <xref linkend="CHAPACL"/> for
20352 further details.
20353 </para>
20354 <para>
20355 <indexterm role="option">
20356 <primary><option>acl_not_smtp_mime</option></primary>
20357 </indexterm>
20358 </para>
20359 <informaltable frame="all">
20360 <tgroup cols="4" colsep="0" rowsep="0">
20361 <colspec colwidth="8*" align="left"/>
20362 <colspec colwidth="6*" align="center"/>
20363 <colspec colwidth="6*" align="center"/>
20364 <colspec colwidth="6*" align="right"/>
20365 <tbody>
20366 <row>
20367 <entry><option>acl_not_smtp_mime</option></entry>
20368 <entry>Use: <emphasis>main</emphasis></entry>
20369 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20370 <entry>Default: <emphasis>unset</emphasis></entry>
20371 </row>
20372 </tbody>
20373 </tgroup>
20374 </informaltable>
20375 <para>
20376 This option defines the ACL that is run for individual MIME parts of non-SMTP
20377 messages. It operates in exactly the same way as <option>acl_smtp_mime</option> operates for
20378 SMTP messages.
20379 </para>
20380 <para>
20381 <indexterm role="option">
20382 <primary><option>acl_not_smtp_start</option></primary>
20383 </indexterm>
20384 </para>
20385 <informaltable frame="all">
20386 <tgroup cols="4" colsep="0" rowsep="0">
20387 <colspec colwidth="8*" align="left"/>
20388 <colspec colwidth="6*" align="center"/>
20389 <colspec colwidth="6*" align="center"/>
20390 <colspec colwidth="6*" align="right"/>
20391 <tbody>
20392 <row>
20393 <entry><option>acl_not_smtp_start</option></entry>
20394 <entry>Use: <emphasis>main</emphasis></entry>
20395 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20396 <entry>Default: <emphasis>unset</emphasis></entry>
20397 </row>
20398 </tbody>
20399 </tgroup>
20400 </informaltable>
20401 <para>
20402 <indexterm role="concept">
20403 <primary>access control lists (ACLs)</primary>
20404 <secondary>at start of non-SMTP message</secondary>
20405 </indexterm>
20406 <indexterm role="concept">
20407 <primary>non-SMTP messages</primary>
20408 <secondary>ACLs for</secondary>
20409 </indexterm>
20410 This option defines the ACL that is run before Exim starts reading a
20411 non-SMTP message. See chapter <xref linkend="CHAPACL"/> for further details.
20412 </para>
20413 <para>
20414 <indexterm role="option">
20415 <primary><option>acl_smtp_auth</option></primary>
20416 </indexterm>
20417 </para>
20418 <informaltable frame="all">
20419 <tgroup cols="4" colsep="0" rowsep="0">
20420 <colspec colwidth="8*" align="left"/>
20421 <colspec colwidth="6*" align="center"/>
20422 <colspec colwidth="6*" align="center"/>
20423 <colspec colwidth="6*" align="right"/>
20424 <tbody>
20425 <row>
20426 <entry><option>acl_smtp_auth</option></entry>
20427 <entry>Use: <emphasis>main</emphasis></entry>
20428 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20429 <entry>Default: <emphasis>unset</emphasis></entry>
20430 </row>
20431 </tbody>
20432 </tgroup>
20433 </informaltable>
20434 <para>
20435 <indexterm role="concept">
20436 <primary>access control lists (ACLs)</primary>
20437 <secondary>setting up for SMTP commands</secondary>
20438 </indexterm>
20439 <indexterm role="concept">
20440 <primary>AUTH</primary>
20441 <secondary>ACL for</secondary>
20442 </indexterm>
20443 This option defines the ACL that is run when an SMTP AUTH command is
20444 received. See chapter <xref linkend="CHAPACL"/> for further details.
20445 </para>
20446 <para>
20447 <indexterm role="option">
20448 <primary><option>acl_smtp_connect</option></primary>
20449 </indexterm>
20450 </para>
20451 <informaltable frame="all">
20452 <tgroup cols="4" colsep="0" rowsep="0">
20453 <colspec colwidth="8*" align="left"/>
20454 <colspec colwidth="6*" align="center"/>
20455 <colspec colwidth="6*" align="center"/>
20456 <colspec colwidth="6*" align="right"/>
20457 <tbody>
20458 <row>
20459 <entry><option>acl_smtp_connect</option></entry>
20460 <entry>Use: <emphasis>main</emphasis></entry>
20461 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20462 <entry>Default: <emphasis>unset</emphasis></entry>
20463 </row>
20464 </tbody>
20465 </tgroup>
20466 </informaltable>
20467 <para>
20468 <indexterm role="concept">
20469 <primary>access control lists (ACLs)</primary>
20470 <secondary>on SMTP connection</secondary>
20471 </indexterm>
20472 This option defines the ACL that is run when an SMTP connection is received.
20473 See chapter <xref linkend="CHAPACL"/> for further details.
20474 </para>
20475 <para>
20476 <indexterm role="option">
20477 <primary><option>acl_smtp_data</option></primary>
20478 </indexterm>
20479 </para>
20480 <informaltable frame="all">
20481 <tgroup cols="4" colsep="0" rowsep="0">
20482 <colspec colwidth="8*" align="left"/>
20483 <colspec colwidth="6*" align="center"/>
20484 <colspec colwidth="6*" align="center"/>
20485 <colspec colwidth="6*" align="right"/>
20486 <tbody>
20487 <row>
20488 <entry><option>acl_smtp_data</option></entry>
20489 <entry>Use: <emphasis>main</emphasis></entry>
20490 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20491 <entry>Default: <emphasis>unset</emphasis></entry>
20492 </row>
20493 </tbody>
20494 </tgroup>
20495 </informaltable>
20496 <para>
20497 <indexterm role="concept">
20498 <primary>DATA</primary>
20499 <secondary>ACL for</secondary>
20500 </indexterm>
20501 This option defines the ACL that is run after an SMTP DATA command has been
20502 processed and the message itself has been received, but before the final
20503 acknowledgment is sent. See chapter <xref linkend="CHAPACL"/> for further details.
20504 </para>
20505 <para>
20506 <indexterm role="option">
20507 <primary><option>acl_smtp_etrn</option></primary>
20508 </indexterm>
20509 </para>
20510 <informaltable frame="all">
20511 <tgroup cols="4" colsep="0" rowsep="0">
20512 <colspec colwidth="8*" align="left"/>
20513 <colspec colwidth="6*" align="center"/>
20514 <colspec colwidth="6*" align="center"/>
20515 <colspec colwidth="6*" align="right"/>
20516 <tbody>
20517 <row>
20518 <entry><option>acl_smtp_etrn</option></entry>
20519 <entry>Use: <emphasis>main</emphasis></entry>
20520 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20521 <entry>Default: <emphasis>unset</emphasis></entry>
20522 </row>
20523 </tbody>
20524 </tgroup>
20525 </informaltable>
20526 <para>
20527 <indexterm role="concept">
20528 <primary>ETRN</primary>
20529 <secondary>ACL for</secondary>
20530 </indexterm>
20531 This option defines the ACL that is run when an SMTP ETRN command is
20532 received. See chapter <xref linkend="CHAPACL"/> for further details.
20533 </para>
20534 <para>
20535 <indexterm role="option">
20536 <primary><option>acl_smtp_expn</option></primary>
20537 </indexterm>
20538 </para>
20539 <informaltable frame="all">
20540 <tgroup cols="4" colsep="0" rowsep="0">
20541 <colspec colwidth="8*" align="left"/>
20542 <colspec colwidth="6*" align="center"/>
20543 <colspec colwidth="6*" align="center"/>
20544 <colspec colwidth="6*" align="right"/>
20545 <tbody>
20546 <row>
20547 <entry><option>acl_smtp_expn</option></entry>
20548 <entry>Use: <emphasis>main</emphasis></entry>
20549 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20550 <entry>Default: <emphasis>unset</emphasis></entry>
20551 </row>
20552 </tbody>
20553 </tgroup>
20554 </informaltable>
20555 <para>
20556 <indexterm role="concept">
20557 <primary>EXPN</primary>
20558 <secondary>ACL for</secondary>
20559 </indexterm>
20560 This option defines the ACL that is run when an SMTP EXPN command is
20561 received. See chapter <xref linkend="CHAPACL"/> for further details.
20562 </para>
20563 <para>
20564 <indexterm role="option">
20565 <primary><option>acl_smtp_helo</option></primary>
20566 </indexterm>
20567 </para>
20568 <informaltable frame="all">
20569 <tgroup cols="4" colsep="0" rowsep="0">
20570 <colspec colwidth="8*" align="left"/>
20571 <colspec colwidth="6*" align="center"/>
20572 <colspec colwidth="6*" align="center"/>
20573 <colspec colwidth="6*" align="right"/>
20574 <tbody>
20575 <row>
20576 <entry><option>acl_smtp_helo</option></entry>
20577 <entry>Use: <emphasis>main</emphasis></entry>
20578 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20579 <entry>Default: <emphasis>unset</emphasis></entry>
20580 </row>
20581 </tbody>
20582 </tgroup>
20583 </informaltable>
20584 <para>
20585 <indexterm role="concept">
20586 <primary>EHLO</primary>
20587 <secondary>ACL for</secondary>
20588 </indexterm>
20589 <indexterm role="concept">
20590 <primary>HELO</primary>
20591 <secondary>ACL for</secondary>
20592 </indexterm>
20593 This option defines the ACL that is run when an SMTP EHLO or HELO
20594 command is received. See chapter <xref linkend="CHAPACL"/> for further details.
20595 </para>
20596 <para>
20597 <indexterm role="option">
20598 <primary><option>acl_smtp_mail</option></primary>
20599 </indexterm>
20600 </para>
20601 <informaltable frame="all">
20602 <tgroup cols="4" colsep="0" rowsep="0">
20603 <colspec colwidth="8*" align="left"/>
20604 <colspec colwidth="6*" align="center"/>
20605 <colspec colwidth="6*" align="center"/>
20606 <colspec colwidth="6*" align="right"/>
20607 <tbody>
20608 <row>
20609 <entry><option>acl_smtp_mail</option></entry>
20610 <entry>Use: <emphasis>main</emphasis></entry>
20611 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20612 <entry>Default: <emphasis>unset</emphasis></entry>
20613 </row>
20614 </tbody>
20615 </tgroup>
20616 </informaltable>
20617 <para>
20618 <indexterm role="concept">
20619 <primary>MAIL</primary>
20620 <secondary>ACL for</secondary>
20621 </indexterm>
20622 This option defines the ACL that is run when an SMTP MAIL command is
20623 received. See chapter <xref linkend="CHAPACL"/> for further details.
20624 </para>
20625 <para>
20626 <indexterm role="option">
20627 <primary><option>acl_smtp_mailauth</option></primary>
20628 </indexterm>
20629 </para>
20630 <informaltable frame="all">
20631 <tgroup cols="4" colsep="0" rowsep="0">
20632 <colspec colwidth="8*" align="left"/>
20633 <colspec colwidth="6*" align="center"/>
20634 <colspec colwidth="6*" align="center"/>
20635 <colspec colwidth="6*" align="right"/>
20636 <tbody>
20637 <row>
20638 <entry><option>acl_smtp_mailauth</option></entry>
20639 <entry>Use: <emphasis>main</emphasis></entry>
20640 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20641 <entry>Default: <emphasis>unset</emphasis></entry>
20642 </row>
20643 </tbody>
20644 </tgroup>
20645 </informaltable>
20646 <para>
20647 <indexterm role="concept">
20648 <primary>AUTH</primary>
20649 <secondary>on MAIL command</secondary>
20650 </indexterm>
20651 This option defines the ACL that is run when there is an AUTH parameter on
20652 a MAIL command. See chapter <xref linkend="CHAPACL"/> for details of ACLs, and chapter
20653 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
20654 </para>
20655 <para>
20656 <indexterm role="option">
20657 <primary><option>acl_smtp_mime</option></primary>
20658 </indexterm>
20659 </para>
20660 <informaltable frame="all">
20661 <tgroup cols="4" colsep="0" rowsep="0">
20662 <colspec colwidth="8*" align="left"/>
20663 <colspec colwidth="6*" align="center"/>
20664 <colspec colwidth="6*" align="center"/>
20665 <colspec colwidth="6*" align="right"/>
20666 <tbody>
20667 <row>
20668 <entry><option>acl_smtp_mime</option></entry>
20669 <entry>Use: <emphasis>main</emphasis></entry>
20670 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20671 <entry>Default: <emphasis>unset</emphasis></entry>
20672 </row>
20673 </tbody>
20674 </tgroup>
20675 </informaltable>
20676 <para>
20677 <indexterm role="concept">
20678 <primary>MIME content scanning</primary>
20679 <secondary>ACL for</secondary>
20680 </indexterm>
20681 This option is available when Exim is built with the content-scanning
20682 extension. It defines the ACL that is run for each MIME part in a message. See
20683 section <xref linkend="SECTscanmimepart"/> for details.
20684 </para>
20685 <para>
20686 <indexterm role="option">
20687 <primary><option>acl_smtp_predata</option></primary>
20688 </indexterm>
20689 </para>
20690 <informaltable frame="all">
20691 <tgroup cols="4" colsep="0" rowsep="0">
20692 <colspec colwidth="8*" align="left"/>
20693 <colspec colwidth="6*" align="center"/>
20694 <colspec colwidth="6*" align="center"/>
20695 <colspec colwidth="6*" align="right"/>
20696 <tbody>
20697 <row>
20698 <entry><option>acl_smtp_predata</option></entry>
20699 <entry>Use: <emphasis>main</emphasis></entry>
20700 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20701 <entry>Default: <emphasis>unset</emphasis></entry>
20702 </row>
20703 </tbody>
20704 </tgroup>
20705 </informaltable>
20706 <para>
20707 This option defines the ACL that is run when an SMTP DATA command is
20708 received, before the message itself is received. See chapter <xref linkend="CHAPACL"/> for
20709 further details.
20710 </para>
20711 <para>
20712 <indexterm role="option">
20713 <primary><option>acl_smtp_quit</option></primary>
20714 </indexterm>
20715 </para>
20716 <informaltable frame="all">
20717 <tgroup cols="4" colsep="0" rowsep="0">
20718 <colspec colwidth="8*" align="left"/>
20719 <colspec colwidth="6*" align="center"/>
20720 <colspec colwidth="6*" align="center"/>
20721 <colspec colwidth="6*" align="right"/>
20722 <tbody>
20723 <row>
20724 <entry><option>acl_smtp_quit</option></entry>
20725 <entry>Use: <emphasis>main</emphasis></entry>
20726 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20727 <entry>Default: <emphasis>unset</emphasis></entry>
20728 </row>
20729 </tbody>
20730 </tgroup>
20731 </informaltable>
20732 <para>
20733 <indexterm role="concept">
20734 <primary>QUIT, ACL for</primary>
20735 </indexterm>
20736 This option defines the ACL that is run when an SMTP QUIT command is
20737 received. See chapter <xref linkend="CHAPACL"/> for further details.
20738 </para>
20739 <para>
20740 <indexterm role="option">
20741 <primary><option>acl_smtp_rcpt</option></primary>
20742 </indexterm>
20743 </para>
20744 <informaltable frame="all">
20745 <tgroup cols="4" colsep="0" rowsep="0">
20746 <colspec colwidth="8*" align="left"/>
20747 <colspec colwidth="6*" align="center"/>
20748 <colspec colwidth="6*" align="center"/>
20749 <colspec colwidth="6*" align="right"/>
20750 <tbody>
20751 <row>
20752 <entry><option>acl_smtp_rcpt</option></entry>
20753 <entry>Use: <emphasis>main</emphasis></entry>
20754 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20755 <entry>Default: <emphasis>unset</emphasis></entry>
20756 </row>
20757 </tbody>
20758 </tgroup>
20759 </informaltable>
20760 <para>
20761 <indexterm role="concept">
20762 <primary>RCPT</primary>
20763 <secondary>ACL for</secondary>
20764 </indexterm>
20765 This option defines the ACL that is run when an SMTP RCPT command is
20766 received. See chapter <xref linkend="CHAPACL"/> for further details.
20767 </para>
20768 <para>
20769 <indexterm role="option">
20770 <primary><option>acl_smtp_starttls</option></primary>
20771 </indexterm>
20772 </para>
20773 <informaltable frame="all">
20774 <tgroup cols="4" colsep="0" rowsep="0">
20775 <colspec colwidth="8*" align="left"/>
20776 <colspec colwidth="6*" align="center"/>
20777 <colspec colwidth="6*" align="center"/>
20778 <colspec colwidth="6*" align="right"/>
20779 <tbody>
20780 <row>
20781 <entry><option>acl_smtp_starttls</option></entry>
20782 <entry>Use: <emphasis>main</emphasis></entry>
20783 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20784 <entry>Default: <emphasis>unset</emphasis></entry>
20785 </row>
20786 </tbody>
20787 </tgroup>
20788 </informaltable>
20789 <para>
20790 <indexterm role="concept">
20791 <primary>STARTTLS, ACL for</primary>
20792 </indexterm>
20793 This option defines the ACL that is run when an SMTP STARTTLS command is
20794 received. See chapter <xref linkend="CHAPACL"/> for further details.
20795 </para>
20796 <para>
20797 <indexterm role="option">
20798 <primary><option>acl_smtp_vrfy</option></primary>
20799 </indexterm>
20800 </para>
20801 <informaltable frame="all">
20802 <tgroup cols="4" colsep="0" rowsep="0">
20803 <colspec colwidth="8*" align="left"/>
20804 <colspec colwidth="6*" align="center"/>
20805 <colspec colwidth="6*" align="center"/>
20806 <colspec colwidth="6*" align="right"/>
20807 <tbody>
20808 <row>
20809 <entry><option>acl_smtp_vrfy</option></entry>
20810 <entry>Use: <emphasis>main</emphasis></entry>
20811 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20812 <entry>Default: <emphasis>unset</emphasis></entry>
20813 </row>
20814 </tbody>
20815 </tgroup>
20816 </informaltable>
20817 <para>
20818 <indexterm role="concept">
20819 <primary>VRFY</primary>
20820 <secondary>ACL for</secondary>
20821 </indexterm>
20822 This option defines the ACL that is run when an SMTP VRFY command is
20823 received. See chapter <xref linkend="CHAPACL"/> for further details.
20824 </para>
20825 <para>
20826 <indexterm role="option">
20827 <primary><option>admin_groups</option></primary>
20828 </indexterm>
20829 </para>
20830 <informaltable frame="all">
20831 <tgroup cols="4" colsep="0" rowsep="0">
20832 <colspec colwidth="8*" align="left"/>
20833 <colspec colwidth="6*" align="center"/>
20834 <colspec colwidth="6*" align="center"/>
20835 <colspec colwidth="6*" align="right"/>
20836 <tbody>
20837 <row>
20838 <entry><option>admin_groups</option></entry>
20839 <entry>Use: <emphasis>main</emphasis></entry>
20840 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
20841 <entry>Default: <emphasis>unset</emphasis></entry>
20842 </row>
20843 </tbody>
20844 </tgroup>
20845 </informaltable>
20846 <para>
20847 <indexterm role="concept">
20848 <primary>admin user</primary>
20849 </indexterm>
20850 This option is expanded just once, at the start of Exim&#x2019;s processing. If the
20851 current group or any of the supplementary groups of an Exim caller is in this
20852 colon-separated list, the caller has admin privileges. If all your system
20853 programmers are in a specific group, for example, you can give them all Exim
20854 admin privileges by putting that group in <option>admin_groups</option>. However, this does
20855 not permit them to read Exim&#x2019;s spool files (whose group owner is the Exim gid).
20856 To permit this, you have to add individuals to the Exim group.
20857 </para>
20858 <para>
20859 <indexterm role="option">
20860 <primary><option>allow_domain_literals</option></primary>
20861 </indexterm>
20862 </para>
20863 <informaltable frame="all">
20864 <tgroup cols="4" colsep="0" rowsep="0">
20865 <colspec colwidth="8*" align="left"/>
20866 <colspec colwidth="6*" align="center"/>
20867 <colspec colwidth="6*" align="center"/>
20868 <colspec colwidth="6*" align="right"/>
20869 <tbody>
20870 <row>
20871 <entry><option>allow_domain_literals</option></entry>
20872 <entry>Use: <emphasis>main</emphasis></entry>
20873 <entry>Type: <emphasis>boolean</emphasis></entry>
20874 <entry>Default: <emphasis>false</emphasis></entry>
20875 </row>
20876 </tbody>
20877 </tgroup>
20878 </informaltable>
20879 <para>
20880 <indexterm role="concept">
20881 <primary>domain literal</primary>
20882 </indexterm>
20883 If this option is set, the RFC 2822 domain literal format is permitted in
20884 email addresses. The option is not set by default, because the domain literal
20885 format is not normally required these days, and few people know about it. It
20886 has, however, been exploited by mail abusers.
20887 </para>
20888 <para>
20889 Unfortunately, it seems that some DNS black list maintainers are using this
20890 format to report black listing to postmasters. If you want to accept messages
20891 addressed to your hosts by IP address, you need to set
20892 <option>allow_domain_literals</option> true, and also to add <literal>@[]</literal> to the list of local
20893 domains (defined in the named domain list <option>local_domains</option> in the default
20894 configuration). This <quote>magic string</quote> matches the domain literal form of all
20895 the local host&#x2019;s IP addresses.
20896 </para>
20897 <para>
20898 <indexterm role="option">
20899 <primary><option>allow_mx_to_ip</option></primary>
20900 </indexterm>
20901 </para>
20902 <informaltable frame="all">
20903 <tgroup cols="4" colsep="0" rowsep="0">
20904 <colspec colwidth="8*" align="left"/>
20905 <colspec colwidth="6*" align="center"/>
20906 <colspec colwidth="6*" align="center"/>
20907 <colspec colwidth="6*" align="right"/>
20908 <tbody>
20909 <row>
20910 <entry><option>allow_mx_to_ip</option></entry>
20911 <entry>Use: <emphasis>main</emphasis></entry>
20912 <entry>Type: <emphasis>boolean</emphasis></entry>
20913 <entry>Default: <emphasis>false</emphasis></entry>
20914 </row>
20915 </tbody>
20916 </tgroup>
20917 </informaltable>
20918 <para>
20919 <indexterm role="concept">
20920 <primary>MX record</primary>
20921 <secondary>pointing to IP address</secondary>
20922 </indexterm>
20923 It appears that more and more DNS zone administrators are breaking the rules
20924 and putting domain names that look like IP addresses on the right hand side of
20925 MX records. Exim follows the rules and rejects this, giving an error message
20926 that explains the mis-configuration. However, some other MTAs support this
20927 practice, so to avoid <quote>Why can&#x2019;t Exim do this?</quote> complaints,
20928 <option>allow_mx_to_ip</option> exists, in order to enable this heinous activity. It is not
20929 recommended, except when you have no other choice.
20930 </para>
20931 <para>
20932 <indexterm role="option">
20933 <primary><option>allow_utf8_domains</option></primary>
20934 </indexterm>
20935 </para>
20936 <informaltable frame="all">
20937 <tgroup cols="4" colsep="0" rowsep="0">
20938 <colspec colwidth="8*" align="left"/>
20939 <colspec colwidth="6*" align="center"/>
20940 <colspec colwidth="6*" align="center"/>
20941 <colspec colwidth="6*" align="right"/>
20942 <tbody>
20943 <row>
20944 <entry><option>allow_utf8_domains</option></entry>
20945 <entry>Use: <emphasis>main</emphasis></entry>
20946 <entry>Type: <emphasis>boolean</emphasis></entry>
20947 <entry>Default: <emphasis>false</emphasis></entry>
20948 </row>
20949 </tbody>
20950 </tgroup>
20951 </informaltable>
20952 <para>
20953 <indexterm role="concept">
20954 <primary>domain</primary>
20955 <secondary>UTF-8 characters in</secondary>
20956 </indexterm>
20957 <indexterm role="concept">
20958 <primary>UTF-8</primary>
20959 <secondary>in domain name</secondary>
20960 </indexterm>
20961 Lots of discussion is going on about internationalized domain names. One
20962 camp is strongly in favour of just using UTF-8 characters, and it seems
20963 that at least two other MTAs permit this. This option allows Exim users to
20964 experiment if they wish.
20965 </para>
20966 <para>
20967 If it is set true, Exim&#x2019;s domain parsing function allows valid
20968 UTF-8 multicharacters to appear in domain name components, in addition to
20969 letters, digits, and hyphens. However, just setting this option is not
20970 enough; if you want to look up these domain names in the DNS, you must also
20971 adjust the value of <option>dns_check_names_pattern</option> to match the extended form. A
20972 suitable setting is:
20973 </para>
20974 <literallayout class="monospaced">
20975 dns_check_names_pattern = (?i)^(?&gt;(?(1)\.|())[a-z0-9\xc0-\xff]\
20976   (?&gt;[-a-z0-9\x80-\xff]*[a-z0-9\x80-\xbf])?)+$
20977 </literallayout>
20978 <para>
20979 Alternatively, you can just disable this feature by setting
20980 </para>
20981 <literallayout class="monospaced">
20982 dns_check_names_pattern =
20983 </literallayout>
20984 <para>
20985 That is, set the option to an empty string so that no check is done.
20986 </para>
20987 <para>
20988 <indexterm role="option">
20989 <primary><option>auth_advertise_hosts</option></primary>
20990 </indexterm>
20991 </para>
20992 <informaltable frame="all">
20993 <tgroup cols="4" colsep="0" rowsep="0">
20994 <colspec colwidth="8*" align="left"/>
20995 <colspec colwidth="6*" align="center"/>
20996 <colspec colwidth="6*" align="center"/>
20997 <colspec colwidth="6*" align="right"/>
20998 <tbody>
20999 <row>
21000 <entry><option>auth_advertise_hosts</option></entry>
21001 <entry>Use: <emphasis>main</emphasis></entry>
21002 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
21003 <entry>Default: <emphasis>*</emphasis></entry>
21004 </row>
21005 </tbody>
21006 </tgroup>
21007 </informaltable>
21008 <para>
21009 <indexterm role="concept">
21010 <primary>authentication</primary>
21011 <secondary>advertising</secondary>
21012 </indexterm>
21013 <indexterm role="concept">
21014 <primary>AUTH</primary>
21015 <secondary>advertising</secondary>
21016 </indexterm>
21017 If any server authentication mechanisms are configured, Exim advertises them in
21018 response to an EHLO command only if the calling host matches this list.
21019 Otherwise, Exim does not advertise AUTH.
21020 Exim does not accept AUTH commands from clients to which it has not
21021 advertised the availability of AUTH. The advertising of individual
21022 authentication mechanisms can be controlled by the use of the
21023 <option>server_advertise_condition</option> generic authenticator option on the individual
21024 authenticators. See chapter <xref linkend="CHAPSMTPAUTH"/> for further details.
21025 </para>
21026 <para>
21027 Certain mail clients (for example, Netscape) require the user to provide a name
21028 and password for authentication if AUTH is advertised, even though it may
21029 not be needed (the host may accept messages from hosts on its local LAN without
21030 authentication, for example). The <option>auth_advertise_hosts</option> option can be used
21031 to make these clients more friendly by excluding them from the set of hosts to
21032 which Exim advertises AUTH.
21033 </para>
21034 <para>
21035 <indexterm role="concept">
21036 <primary>AUTH</primary>
21037 <secondary>advertising when encrypted</secondary>
21038 </indexterm>
21039 If you want to advertise the availability of AUTH only when the connection
21040 is encrypted using TLS, you can make use of the fact that the value of this
21041 option is expanded, with a setting like this:
21042 </para>
21043 <literallayout class="monospaced">
21044 auth_advertise_hosts = ${if eq{$tls_cipher}{}{}{*}}
21045 </literallayout>
21046 <para>
21047 <indexterm role="variable">
21048 <primary><varname>$tls_cipher</varname></primary>
21049 </indexterm>
21050 If <varname>$tls_cipher</varname> is empty, the session is not encrypted, and the result of
21051 the expansion is empty, thus matching no hosts. Otherwise, the result of the
21052 expansion is *, which matches all hosts.
21053 </para>
21054 <para>
21055 <indexterm role="option">
21056 <primary><option>auto_thaw</option></primary>
21057 </indexterm>
21058 </para>
21059 <informaltable frame="all">
21060 <tgroup cols="4" colsep="0" rowsep="0">
21061 <colspec colwidth="8*" align="left"/>
21062 <colspec colwidth="6*" align="center"/>
21063 <colspec colwidth="6*" align="center"/>
21064 <colspec colwidth="6*" align="right"/>
21065 <tbody>
21066 <row>
21067 <entry><option>auto_thaw</option></entry>
21068 <entry>Use: <emphasis>main</emphasis></entry>
21069 <entry>Type: <emphasis>time</emphasis></entry>
21070 <entry>Default: <emphasis>0s</emphasis></entry>
21071 </row>
21072 </tbody>
21073 </tgroup>
21074 </informaltable>
21075 <para>
21076 <indexterm role="concept">
21077 <primary>thawing messages</primary>
21078 </indexterm>
21079 <indexterm role="concept">
21080 <primary>unfreezing messages</primary>
21081 </indexterm>
21082 If this option is set to a time greater than zero, a queue runner will try a
21083 new delivery attempt on any frozen message, other than a bounce message, if
21084 this much time has passed since it was frozen. This may result in the message
21085 being re-frozen if nothing has changed since the last attempt. It is a way of
21086 saying <quote>keep on trying, even though there are big problems</quote>.
21087 </para>
21088 <para>
21089 <emphasis role="bold">Note</emphasis>: This is an old option, which predates <option>timeout_frozen_after</option> and
21090 <option>ignore_bounce_errors_after</option>. It is retained for compatibility, but it is not
21091 thought to be very useful any more, and its use should probably be avoided.
21092 </para>
21093 <para revisionflag="changed">
21094 <indexterm role="option">
21095 <primary><option>av_scanner</option></primary>
21096 </indexterm>
21097 </para>
21098 <informaltable frame="all" revisionflag="changed">
21099 <tgroup cols="4" colsep="0" rowsep="0">
21100 <colspec colwidth="8*" align="left"/>
21101 <colspec colwidth="6*" align="center"/>
21102 <colspec colwidth="6*" align="center"/>
21103 <colspec colwidth="6*" align="right"/>
21104 <tbody>
21105 <row>
21106 <entry><option>av_scanner</option></entry>
21107 <entry>Use: <emphasis>main</emphasis></entry>
21108 <entry>Type: <emphasis>string</emphasis></entry>
21109 <entry>Default: <emphasis>see below</emphasis></entry>
21110 </row>
21111 </tbody>
21112 </tgroup>
21113 </informaltable>
21114 <para revisionflag="changed">
21115 This option is available if Exim is built with the content-scanning extension.
21116 It specifies which anti-virus scanner to use. The default value is:
21117 </para>
21118 <literallayout class="monospaced" revisionflag="changed">
21119 sophie:/var/run/sophie
21120 </literallayout>
21121 <para revisionflag="changed">
21122 If the value of <option>av_scanner</option> starts with a dollar character, it is expanded
21123 before use. See section <xref linkend="SECTscanvirus"/> for further details.
21124 </para>
21125 <para>
21126 <indexterm role="option">
21127 <primary><option>bi_command</option></primary>
21128 </indexterm>
21129 </para>
21130 <informaltable frame="all">
21131 <tgroup cols="4" colsep="0" rowsep="0">
21132 <colspec colwidth="8*" align="left"/>
21133 <colspec colwidth="6*" align="center"/>
21134 <colspec colwidth="6*" align="center"/>
21135 <colspec colwidth="6*" align="right"/>
21136 <tbody>
21137 <row>
21138 <entry><option>bi_command</option></entry>
21139 <entry>Use: <emphasis>main</emphasis></entry>
21140 <entry>Type: <emphasis>string</emphasis></entry>
21141 <entry>Default: <emphasis>unset</emphasis></entry>
21142 </row>
21143 </tbody>
21144 </tgroup>
21145 </informaltable>
21146 <para>
21147 <indexterm role="option">
21148 <primary><option>-bi</option></primary>
21149 </indexterm>
21150 This option supplies the name of a command that is run when Exim is called with
21151 the <option>-bi</option> option (see chapter <xref linkend="CHAPcommandline"/>). The string value is
21152 just the command name, it is not a complete command line. If an argument is
21153 required, it must come from the <option>-oA</option> command line option.
21154 </para>
21155 <para>
21156 <indexterm role="option">
21157 <primary><option>bounce_message_file</option></primary>
21158 </indexterm>
21159 </para>
21160 <informaltable frame="all">
21161 <tgroup cols="4" colsep="0" rowsep="0">
21162 <colspec colwidth="8*" align="left"/>
21163 <colspec colwidth="6*" align="center"/>
21164 <colspec colwidth="6*" align="center"/>
21165 <colspec colwidth="6*" align="right"/>
21166 <tbody>
21167 <row>
21168 <entry><option>bounce_message_file</option></entry>
21169 <entry>Use: <emphasis>main</emphasis></entry>
21170 <entry>Type: <emphasis>string</emphasis></entry>
21171 <entry>Default: <emphasis>unset</emphasis></entry>
21172 </row>
21173 </tbody>
21174 </tgroup>
21175 </informaltable>
21176 <para>
21177 <indexterm role="concept">
21178 <primary>bounce message</primary>
21179 <secondary>customizing</secondary>
21180 </indexterm>
21181 <indexterm role="concept">
21182 <primary>customizing</primary>
21183 <secondary>bounce message</secondary>
21184 </indexterm>
21185 This option defines a template file containing paragraphs of text to be used
21186 for constructing bounce messages.  Details of the file&#x2019;s contents are given in
21187 chapter <xref linkend="CHAPemsgcust"/>. See also <option>warn_message_file</option>.
21188 </para>
21189 <para>
21190 <indexterm role="option">
21191 <primary><option>bounce_message_text</option></primary>
21192 </indexterm>
21193 </para>
21194 <informaltable frame="all">
21195 <tgroup cols="4" colsep="0" rowsep="0">
21196 <colspec colwidth="8*" align="left"/>
21197 <colspec colwidth="6*" align="center"/>
21198 <colspec colwidth="6*" align="center"/>
21199 <colspec colwidth="6*" align="right"/>
21200 <tbody>
21201 <row>
21202 <entry><option>bounce_message_text</option></entry>
21203 <entry>Use: <emphasis>main</emphasis></entry>
21204 <entry>Type: <emphasis>string</emphasis></entry>
21205 <entry>Default: <emphasis>unset</emphasis></entry>
21206 </row>
21207 </tbody>
21208 </tgroup>
21209 </informaltable>
21210 <para>
21211 When this option is set, its contents are included in the default bounce
21212 message immediately after <quote>This message was created automatically by mail
21213 delivery software.</quote> It is not used if <option>bounce_message_file</option> is set.
21214 </para>
21215 <para>
21216 <indexterm role="option">
21217 <primary><option>bounce_return_body</option></primary>
21218 </indexterm>
21219 </para>
21220 <informaltable frame="all">
21221 <tgroup cols="4" colsep="0" rowsep="0">
21222 <colspec colwidth="8*" align="left"/>
21223 <colspec colwidth="6*" align="center"/>
21224 <colspec colwidth="6*" align="center"/>
21225 <colspec colwidth="6*" align="right"/>
21226 <tbody>
21227 <row>
21228 <entry><option>bounce_return_body</option></entry>
21229 <entry>Use: <emphasis>main</emphasis></entry>
21230 <entry>Type: <emphasis>boolean</emphasis></entry>
21231 <entry>Default: <emphasis>true</emphasis></entry>
21232 </row>
21233 </tbody>
21234 </tgroup>
21235 </informaltable>
21236 <para>
21237 <indexterm role="concept">
21238 <primary>bounce message</primary>
21239 <secondary>including body</secondary>
21240 </indexterm>
21241 This option controls whether the body of an incoming message is included in a
21242 bounce message when <option>bounce_return_message</option> is true. The default setting
21243 causes the entire message, both header and body, to be returned (subject to the
21244 value of <option>bounce_return_size_limit</option>). If this option is false, only the
21245 message header is included. In the case of a non-SMTP message containing an
21246 error that is detected during reception, only those header lines preceding the
21247 point at which the error was detected are returned.
21248 <indexterm role="concept">
21249 <primary>bounce message</primary>
21250 <secondary>including original</secondary>
21251 </indexterm>
21252 </para>
21253 <para>
21254 <indexterm role="option">
21255 <primary><option>bounce_return_message</option></primary>
21256 </indexterm>
21257 </para>
21258 <informaltable frame="all">
21259 <tgroup cols="4" colsep="0" rowsep="0">
21260 <colspec colwidth="8*" align="left"/>
21261 <colspec colwidth="6*" align="center"/>
21262 <colspec colwidth="6*" align="center"/>
21263 <colspec colwidth="6*" align="right"/>
21264 <tbody>
21265 <row>
21266 <entry><option>bounce_return_message</option></entry>
21267 <entry>Use: <emphasis>main</emphasis></entry>
21268 <entry>Type: <emphasis>boolean</emphasis></entry>
21269 <entry>Default: <emphasis>true</emphasis></entry>
21270 </row>
21271 </tbody>
21272 </tgroup>
21273 </informaltable>
21274 <para>
21275 If this option is set false, none of the original message is included in
21276 bounce messages generated by Exim. See also <option>bounce_return_size_limit</option> and
21277 <option>bounce_return_body</option>.
21278 </para>
21279 <para>
21280 <indexterm role="option">
21281 <primary><option>bounce_return_size_limit</option></primary>
21282 </indexterm>
21283 </para>
21284 <informaltable frame="all">
21285 <tgroup cols="4" colsep="0" rowsep="0">
21286 <colspec colwidth="8*" align="left"/>
21287 <colspec colwidth="6*" align="center"/>
21288 <colspec colwidth="6*" align="center"/>
21289 <colspec colwidth="6*" align="right"/>
21290 <tbody>
21291 <row>
21292 <entry><option>bounce_return_size_limit</option></entry>
21293 <entry>Use: <emphasis>main</emphasis></entry>
21294 <entry>Type: <emphasis>integer</emphasis></entry>
21295 <entry>Default: <emphasis>100K</emphasis></entry>
21296 </row>
21297 </tbody>
21298 </tgroup>
21299 </informaltable>
21300 <para>
21301 <indexterm role="concept">
21302 <primary>size</primary>
21303 <secondary>of bounce, limit</secondary>
21304 </indexterm>
21305 <indexterm role="concept">
21306 <primary>bounce message</primary>
21307 <secondary>size limit</secondary>
21308 </indexterm>
21309 <indexterm role="concept">
21310 <primary>limit</primary>
21311 <secondary>bounce message size</secondary>
21312 </indexterm>
21313 This option sets a limit in bytes on the size of messages that are returned to
21314 senders as part of bounce messages when <option>bounce_return_message</option> is true. The
21315 limit should be less than the value of the global <option>message_size_limit</option> and of
21316 any <option>message_size_limit</option> settings on transports, to allow for the bounce text
21317 that Exim generates. If this option is set to zero there is no limit.
21318 </para>
21319 <para>
21320 When the body of any message that is to be included in a bounce message is
21321 greater than the limit, it is truncated, and a comment pointing this out is
21322 added at the top. The actual cutoff may be greater than the value given, owing
21323 to the use of buffering for transferring the message in chunks (typically 8K in
21324 size). The idea is to save bandwidth on those undeliverable 15-megabyte
21325 messages.
21326 </para>
21327 <para>
21328 <indexterm role="option">
21329 <primary><option>bounce_sender_authentication</option></primary>
21330 </indexterm>
21331 </para>
21332 <informaltable frame="all">
21333 <tgroup cols="4" colsep="0" rowsep="0">
21334 <colspec colwidth="8*" align="left"/>
21335 <colspec colwidth="6*" align="center"/>
21336 <colspec colwidth="6*" align="center"/>
21337 <colspec colwidth="6*" align="right"/>
21338 <tbody>
21339 <row>
21340 <entry><option>bounce_sender_authentication</option></entry>
21341 <entry>Use: <emphasis>main</emphasis></entry>
21342 <entry>Type: <emphasis>string</emphasis></entry>
21343 <entry>Default: <emphasis>unset</emphasis></entry>
21344 </row>
21345 </tbody>
21346 </tgroup>
21347 </informaltable>
21348 <para>
21349 <indexterm role="concept">
21350 <primary>bounce message</primary>
21351 <secondary>sender authentication</secondary>
21352 </indexterm>
21353 <indexterm role="concept">
21354 <primary>authentication</primary>
21355 <secondary>bounce message</secondary>
21356 </indexterm>
21357 <indexterm role="concept">
21358 <primary>AUTH</primary>
21359 <secondary>on bounce message</secondary>
21360 </indexterm>
21361 This option provides an authenticated sender address that is sent with any
21362 bounce messages generated by Exim that are sent over an authenticated SMTP
21363 connection. A typical setting might be:
21364 </para>
21365 <literallayout class="monospaced">
21366 bounce_sender_authentication = mailer-daemon@my.domain.example
21367 </literallayout>
21368 <para>
21369 which would cause bounce messages to be sent using the SMTP command:
21370 </para>
21371 <literallayout class="monospaced">
21372 MAIL FROM:&lt;&gt; AUTH=mailer-daemon@my.domain.example
21373 </literallayout>
21374 <para>
21375 The value of <option>bounce_sender_authentication</option> must always be a complete email
21376 address.
21377 </para>
21378 <para>
21379 <indexterm role="option">
21380 <primary><option>callout_domain_negative_expire</option></primary>
21381 </indexterm>
21382 </para>
21383 <informaltable frame="all">
21384 <tgroup cols="4" colsep="0" rowsep="0">
21385 <colspec colwidth="8*" align="left"/>
21386 <colspec colwidth="6*" align="center"/>
21387 <colspec colwidth="6*" align="center"/>
21388 <colspec colwidth="6*" align="right"/>
21389 <tbody>
21390 <row>
21391 <entry><option>callout_domain_negative_expire</option></entry>
21392 <entry>Use: <emphasis>main</emphasis></entry>
21393 <entry>Type: <emphasis>time</emphasis></entry>
21394 <entry>Default: <emphasis>3h</emphasis></entry>
21395 </row>
21396 </tbody>
21397 </tgroup>
21398 </informaltable>
21399 <para>
21400 <indexterm role="concept">
21401 <primary>caching</primary>
21402 <secondary>callout timeouts</secondary>
21403 </indexterm>
21404 <indexterm role="concept">
21405 <primary>callout</primary>
21406 <secondary>caching timeouts</secondary>
21407 </indexterm>
21408 This option specifies the expiry time for negative callout cache data for a
21409 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
21410 section <xref linkend="SECTcallvercache"/> for details of the caching.
21411 </para>
21412 <para>
21413 <indexterm role="option">
21414 <primary><option>callout_domain_positive_expire</option></primary>
21415 </indexterm>
21416 </para>
21417 <informaltable frame="all">
21418 <tgroup cols="4" colsep="0" rowsep="0">
21419 <colspec colwidth="8*" align="left"/>
21420 <colspec colwidth="6*" align="center"/>
21421 <colspec colwidth="6*" align="center"/>
21422 <colspec colwidth="6*" align="right"/>
21423 <tbody>
21424 <row>
21425 <entry><option>callout_domain_positive_expire</option></entry>
21426 <entry>Use: <emphasis>main</emphasis></entry>
21427 <entry>Type: <emphasis>time</emphasis></entry>
21428 <entry>Default: <emphasis>7d</emphasis></entry>
21429 </row>
21430 </tbody>
21431 </tgroup>
21432 </informaltable>
21433 <para>
21434 This option specifies the expiry time for positive callout cache data for a
21435 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
21436 section <xref linkend="SECTcallvercache"/> for details of the caching.
21437 </para>
21438 <para>
21439 <indexterm role="option">
21440 <primary><option>callout_negative_expire</option></primary>
21441 </indexterm>
21442 </para>
21443 <informaltable frame="all">
21444 <tgroup cols="4" colsep="0" rowsep="0">
21445 <colspec colwidth="8*" align="left"/>
21446 <colspec colwidth="6*" align="center"/>
21447 <colspec colwidth="6*" align="center"/>
21448 <colspec colwidth="6*" align="right"/>
21449 <tbody>
21450 <row>
21451 <entry><option>callout_negative_expire</option></entry>
21452 <entry>Use: <emphasis>main</emphasis></entry>
21453 <entry>Type: <emphasis>time</emphasis></entry>
21454 <entry>Default: <emphasis>2h</emphasis></entry>
21455 </row>
21456 </tbody>
21457 </tgroup>
21458 </informaltable>
21459 <para>
21460 This option specifies the expiry time for negative callout cache data for an
21461 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
21462 section <xref linkend="SECTcallvercache"/> for details of the caching.
21463 </para>
21464 <para>
21465 <indexterm role="option">
21466 <primary><option>callout_positive_expire</option></primary>
21467 </indexterm>
21468 </para>
21469 <informaltable frame="all">
21470 <tgroup cols="4" colsep="0" rowsep="0">
21471 <colspec colwidth="8*" align="left"/>
21472 <colspec colwidth="6*" align="center"/>
21473 <colspec colwidth="6*" align="center"/>
21474 <colspec colwidth="6*" align="right"/>
21475 <tbody>
21476 <row>
21477 <entry><option>callout_positive_expire</option></entry>
21478 <entry>Use: <emphasis>main</emphasis></entry>
21479 <entry>Type: <emphasis>time</emphasis></entry>
21480 <entry>Default: <emphasis>24h</emphasis></entry>
21481 </row>
21482 </tbody>
21483 </tgroup>
21484 </informaltable>
21485 <para>
21486 This option specifies the expiry time for positive callout cache data for an
21487 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
21488 section <xref linkend="SECTcallvercache"/> for details of the caching.
21489 </para>
21490 <para>
21491 <indexterm role="option">
21492 <primary><option>callout_random_local_part</option></primary>
21493 </indexterm>
21494 </para>
21495 <informaltable frame="all">
21496 <tgroup cols="4" colsep="0" rowsep="0">
21497 <colspec colwidth="8*" align="left"/>
21498 <colspec colwidth="6*" align="center"/>
21499 <colspec colwidth="6*" align="center"/>
21500 <colspec colwidth="6*" align="right"/>
21501 <tbody>
21502 <row>
21503 <entry><option>callout_random_local_part</option></entry>
21504 <entry>Use: <emphasis>main</emphasis></entry>
21505 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21506 <entry>Default: <emphasis>see below</emphasis></entry>
21507 </row>
21508 </tbody>
21509 </tgroup>
21510 </informaltable>
21511 <para>
21512 This option defines the <quote>random</quote> local part that can be used as part of
21513 callout verification. The default value is
21514 </para>
21515 <literallayout class="monospaced">
21516 $primary_host_name-$tod_epoch-testing
21517 </literallayout>
21518 <para>
21519 See section <xref linkend="CALLaddparcall"/> for details of how this value is used.
21520 </para>
21521 <para>
21522 <indexterm role="option">
21523 <primary><option>check_log_inodes</option></primary>
21524 </indexterm>
21525 </para>
21526 <informaltable frame="all">
21527 <tgroup cols="4" colsep="0" rowsep="0">
21528 <colspec colwidth="8*" align="left"/>
21529 <colspec colwidth="6*" align="center"/>
21530 <colspec colwidth="6*" align="center"/>
21531 <colspec colwidth="6*" align="right"/>
21532 <tbody>
21533 <row>
21534 <entry><option>check_log_inodes</option></entry>
21535 <entry>Use: <emphasis>main</emphasis></entry>
21536 <entry>Type: <emphasis>integer</emphasis></entry>
21537 <entry>Default: <emphasis>0</emphasis></entry>
21538 </row>
21539 </tbody>
21540 </tgroup>
21541 </informaltable>
21542 <para>
21543 See <option>check_spool_space</option> below.
21544 </para>
21545 <para>
21546 <indexterm role="option">
21547 <primary><option>check_log_space</option></primary>
21548 </indexterm>
21549 </para>
21550 <informaltable frame="all">
21551 <tgroup cols="4" colsep="0" rowsep="0">
21552 <colspec colwidth="8*" align="left"/>
21553 <colspec colwidth="6*" align="center"/>
21554 <colspec colwidth="6*" align="center"/>
21555 <colspec colwidth="6*" align="right"/>
21556 <tbody>
21557 <row>
21558 <entry><option>check_log_space</option></entry>
21559 <entry>Use: <emphasis>main</emphasis></entry>
21560 <entry>Type: <emphasis>integer</emphasis></entry>
21561 <entry>Default: <emphasis>0</emphasis></entry>
21562 </row>
21563 </tbody>
21564 </tgroup>
21565 </informaltable>
21566 <para>
21567 See <option>check_spool_space</option> below.
21568 </para>
21569 <para>
21570 <indexterm role="option">
21571 <primary><option>check_rfc2047_length</option></primary>
21572 </indexterm>
21573 <indexterm role="concept">
21574 <primary>RFC 2047</primary>
21575 <secondary>disabling length check</secondary>
21576 </indexterm>
21577 <indexterm role="option">
21578 <primary><option>check_rfc2047_length</option></primary>
21579 </indexterm>
21580 </para>
21581 <informaltable frame="all">
21582 <tgroup cols="4" colsep="0" rowsep="0">
21583 <colspec colwidth="8*" align="left"/>
21584 <colspec colwidth="6*" align="center"/>
21585 <colspec colwidth="6*" align="center"/>
21586 <colspec colwidth="6*" align="right"/>
21587 <tbody>
21588 <row>
21589 <entry><option>check_rfc2047_length</option></entry>
21590 <entry>Use: <emphasis>main</emphasis></entry>
21591 <entry>Type: <emphasis>boolean</emphasis></entry>
21592 <entry>Default: <emphasis>true</emphasis></entry>
21593 </row>
21594 </tbody>
21595 </tgroup>
21596 </informaltable>
21597 <para>
21598 RFC 2047 defines a way of encoding non-ASCII characters in headers using a
21599 system of <quote>encoded words</quote>. The RFC specifies a maximum length for an encoded
21600 word; strings to be encoded that exceed this length are supposed to use
21601 multiple encoded words. By default, Exim does not recognize encoded words that
21602 exceed the maximum length. However, it seems that some software, in violation
21603 of the RFC, generates overlong encoded words. If <option>check_rfc2047_length</option> is
21604 set false, Exim recognizes encoded words of any length.
21605 </para>
21606 <para>
21607 <indexterm role="option">
21608 <primary><option>check_spool_inodes</option></primary>
21609 </indexterm>
21610 </para>
21611 <informaltable frame="all">
21612 <tgroup cols="4" colsep="0" rowsep="0">
21613 <colspec colwidth="8*" align="left"/>
21614 <colspec colwidth="6*" align="center"/>
21615 <colspec colwidth="6*" align="center"/>
21616 <colspec colwidth="6*" align="right"/>
21617 <tbody>
21618 <row>
21619 <entry><option>check_spool_inodes</option></entry>
21620 <entry>Use: <emphasis>main</emphasis></entry>
21621 <entry>Type: <emphasis>integer</emphasis></entry>
21622 <entry>Default: <emphasis>0</emphasis></entry>
21623 </row>
21624 </tbody>
21625 </tgroup>
21626 </informaltable>
21627 <para>
21628 See <option>check_spool_space</option> below.
21629 </para>
21630 <para>
21631 <indexterm role="option">
21632 <primary><option>check_spool_space</option></primary>
21633 </indexterm>
21634 </para>
21635 <informaltable frame="all">
21636 <tgroup cols="4" colsep="0" rowsep="0">
21637 <colspec colwidth="8*" align="left"/>
21638 <colspec colwidth="6*" align="center"/>
21639 <colspec colwidth="6*" align="center"/>
21640 <colspec colwidth="6*" align="right"/>
21641 <tbody>
21642 <row>
21643 <entry><option>check_spool_space</option></entry>
21644 <entry>Use: <emphasis>main</emphasis></entry>
21645 <entry>Type: <emphasis>integer</emphasis></entry>
21646 <entry>Default: <emphasis>0</emphasis></entry>
21647 </row>
21648 </tbody>
21649 </tgroup>
21650 </informaltable>
21651 <para>
21652 <indexterm role="concept">
21653 <primary>checking disk space</primary>
21654 </indexterm>
21655 <indexterm role="concept">
21656 <primary>disk space, checking</primary>
21657 </indexterm>
21658 <indexterm role="concept">
21659 <primary>spool directory</primary>
21660 <secondary>checking space</secondary>
21661 </indexterm>
21662 The four <option>check_...</option> options allow for checking of disk resources before a
21663 message is accepted.
21664 </para>
21665 <para>
21666 <indexterm role="variable">
21667 <primary><varname>$log_inodes</varname></primary>
21668 </indexterm>
21669 <indexterm role="variable">
21670 <primary><varname>$log_space</varname></primary>
21671 </indexterm>
21672 <indexterm role="variable">
21673 <primary><varname>$spool_inodes</varname></primary>
21674 </indexterm>
21675 <indexterm role="variable">
21676 <primary><varname>$spool_space</varname></primary>
21677 </indexterm>
21678 When any of these options are set, they apply to all incoming messages. If you
21679 want to apply different checks to different kinds of message, you can do so by
21680 testing the variables <varname>$log_inodes</varname>, <varname>$log_space</varname>, <varname>$spool_inodes</varname>, and
21681 <varname>$spool_space</varname> in an ACL with appropriate additional conditions.
21682 </para>
21683 <para>
21684 <option>check_spool_space</option> and <option>check_spool_inodes</option> check the spool partition if
21685 either value is greater than zero, for example:
21686 </para>
21687 <literallayout class="monospaced">
21688 check_spool_space = 10M
21689 check_spool_inodes = 100
21690 </literallayout>
21691 <para>
21692 The spool partition is the one that contains the directory defined by
21693 SPOOL_DIRECTORY in <filename>Local/Makefile</filename>. It is used for holding messages in
21694 transit.
21695 </para>
21696 <para>
21697 <option>check_log_space</option> and <option>check_log_inodes</option>  check the partition in which log
21698 files are written if either is greater than zero. These should be set only if
21699 <option>log_file_path</option> and <option>spool_directory</option> refer to different partitions.
21700 </para>
21701 <para>
21702 If there is less space or fewer inodes than requested, Exim refuses to accept
21703 incoming mail. In the case of SMTP input this is done by giving a 452 temporary
21704 error response to the MAIL command. If ESMTP is in use and there was a
21705 SIZE parameter on the MAIL command, its value is added to the
21706 <option>check_spool_space</option> value, and the check is performed even if
21707 <option>check_spool_space</option> is zero, unless <option>no_smtp_check_spool_space</option> is set.
21708 </para>
21709 <para>
21710 The values for <option>check_spool_space</option> and <option>check_log_space</option> are held as a
21711 number of kilobytes. If a non-multiple of 1024 is specified, it is rounded up.
21712 </para>
21713 <para>
21714 For non-SMTP input and for batched SMTP input, the test is done at start-up; on
21715 failure a message is written to stderr and Exim exits with a non-zero code, as
21716 it obviously cannot send an error message of any kind.
21717 </para>
21718 <para>
21719 <indexterm role="option">
21720 <primary><option>daemon_smtp_ports</option></primary>
21721 </indexterm>
21722 </para>
21723 <informaltable frame="all">
21724 <tgroup cols="4" colsep="0" rowsep="0">
21725 <colspec colwidth="8*" align="left"/>
21726 <colspec colwidth="6*" align="center"/>
21727 <colspec colwidth="6*" align="center"/>
21728 <colspec colwidth="6*" align="right"/>
21729 <tbody>
21730 <row>
21731 <entry><option>daemon_smtp_ports</option></entry>
21732 <entry>Use: <emphasis>main</emphasis></entry>
21733 <entry>Type: <emphasis>string</emphasis></entry>
21734 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
21735 </row>
21736 </tbody>
21737 </tgroup>
21738 </informaltable>
21739 <para>
21740 <indexterm role="concept">
21741 <primary>port</primary>
21742 <secondary>for daemon</secondary>
21743 </indexterm>
21744 <indexterm role="concept">
21745 <primary>TCP/IP</primary>
21746 <secondary>setting listening ports</secondary>
21747 </indexterm>
21748 This option specifies one or more default SMTP ports on which the Exim daemon
21749 listens. See chapter <xref linkend="CHAPinterfaces"/> for details of how it is used. For
21750 backward compatibility, <option>daemon_smtp_port</option> (singular) is a synonym.
21751 </para>
21752 <para>
21753 <indexterm role="option">
21754 <primary><option>daemon_startup_retries</option></primary>
21755 </indexterm>
21756 </para>
21757 <informaltable frame="all">
21758 <tgroup cols="4" colsep="0" rowsep="0">
21759 <colspec colwidth="8*" align="left"/>
21760 <colspec colwidth="6*" align="center"/>
21761 <colspec colwidth="6*" align="center"/>
21762 <colspec colwidth="6*" align="right"/>
21763 <tbody>
21764 <row>
21765 <entry><option>daemon_startup_retries</option></entry>
21766 <entry>Use: <emphasis>main</emphasis></entry>
21767 <entry>Type: <emphasis>integer</emphasis></entry>
21768 <entry>Default: <emphasis>9</emphasis></entry>
21769 </row>
21770 </tbody>
21771 </tgroup>
21772 </informaltable>
21773 <para>
21774 <indexterm role="concept">
21775 <primary>daemon startup, retrying</primary>
21776 </indexterm>
21777 This option, along with <option>daemon_startup_sleep</option>, controls the retrying done by
21778 the daemon at startup when it cannot immediately bind a listening socket
21779 (typically because the socket is already in use): <option>daemon_startup_retries</option>
21780 defines the number of retries after the first failure, and
21781 <option>daemon_startup_sleep</option> defines the length of time to wait between retries.
21782 </para>
21783 <para>
21784 <indexterm role="option">
21785 <primary><option>daemon_startup_sleep</option></primary>
21786 </indexterm>
21787 </para>
21788 <informaltable frame="all">
21789 <tgroup cols="4" colsep="0" rowsep="0">
21790 <colspec colwidth="8*" align="left"/>
21791 <colspec colwidth="6*" align="center"/>
21792 <colspec colwidth="6*" align="center"/>
21793 <colspec colwidth="6*" align="right"/>
21794 <tbody>
21795 <row>
21796 <entry><option>daemon_startup_sleep</option></entry>
21797 <entry>Use: <emphasis>main</emphasis></entry>
21798 <entry>Type: <emphasis>time</emphasis></entry>
21799 <entry>Default: <emphasis>30s</emphasis></entry>
21800 </row>
21801 </tbody>
21802 </tgroup>
21803 </informaltable>
21804 <para>
21805 See <option>daemon_startup_retries</option>.
21806 </para>
21807 <para>
21808 <indexterm role="option">
21809 <primary><option>delay_warning</option></primary>
21810 </indexterm>
21811 </para>
21812 <informaltable frame="all">
21813 <tgroup cols="4" colsep="0" rowsep="0">
21814 <colspec colwidth="8*" align="left"/>
21815 <colspec colwidth="6*" align="center"/>
21816 <colspec colwidth="6*" align="center"/>
21817 <colspec colwidth="6*" align="right"/>
21818 <tbody>
21819 <row>
21820 <entry><option>delay_warning</option></entry>
21821 <entry>Use: <emphasis>main</emphasis></entry>
21822 <entry>Type: <emphasis>time list</emphasis></entry>
21823 <entry>Default: <emphasis>24h</emphasis></entry>
21824 </row>
21825 </tbody>
21826 </tgroup>
21827 </informaltable>
21828 <para>
21829 <indexterm role="concept">
21830 <primary>warning of delay</primary>
21831 </indexterm>
21832 <indexterm role="concept">
21833 <primary>delay warning, specifying</primary>
21834 </indexterm>
21835 When a message is delayed, Exim sends a warning message to the sender at
21836 intervals specified by this option. The data is a colon-separated list of times
21837 after which to send warning messages. If the value of the option is an empty
21838 string or a zero time, no warnings are sent. Up to 10 times may be given. If a
21839 message has been on the queue for longer than the last time, the last interval
21840 between the times is used to compute subsequent warning times. For example,
21841 with
21842 </para>
21843 <literallayout class="monospaced">
21844 delay_warning = 4h:8h:24h
21845 </literallayout>
21846 <para>
21847 the first message is sent after 4 hours, the second after 8 hours, and
21848 the third one after 24 hours. After that, messages are sent every 16 hours,
21849 because that is the interval between the last two times on the list. If you set
21850 just one time, it specifies the repeat interval. For example, with:
21851 </para>
21852 <literallayout class="monospaced">
21853 delay_warning = 6h
21854 </literallayout>
21855 <para>
21856 messages are repeated every six hours. To stop warnings after a given time, set
21857 a very large time at the end of the list. For example:
21858 </para>
21859 <literallayout class="monospaced">
21860 delay_warning = 2h:12h:99d
21861 </literallayout>
21862 <para>
21863 <indexterm role="option">
21864 <primary><option>delay_warning_condition</option></primary>
21865 </indexterm>
21866 </para>
21867 <informaltable frame="all">
21868 <tgroup cols="4" colsep="0" rowsep="0">
21869 <colspec colwidth="8*" align="left"/>
21870 <colspec colwidth="6*" align="center"/>
21871 <colspec colwidth="6*" align="center"/>
21872 <colspec colwidth="6*" align="right"/>
21873 <tbody>
21874 <row>
21875 <entry><option>delay_warning_condition</option></entry>
21876 <entry>Use: <emphasis>main</emphasis></entry>
21877 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21878 <entry>Default: <emphasis>see below</emphasis></entry>
21879 </row>
21880 </tbody>
21881 </tgroup>
21882 </informaltable>
21883 <para>
21884 <indexterm role="variable">
21885 <primary><varname>$domain</varname></primary>
21886 </indexterm>
21887 The string is expanded at the time a warning message might be sent. If all the
21888 deferred addresses have the same domain, it is set in <varname>$domain</varname> during the
21889 expansion. Otherwise <varname>$domain</varname> is empty. If the result of the expansion is a
21890 forced failure, an empty string, or a string matching any of <quote>0</quote>, <quote>no</quote> or
21891 <quote>false</quote> (the comparison being done caselessly) then the warning message is
21892 not sent. The default is:
21893 </para>
21894 <literallayout class="monospaced">
21895 delay_warning_condition = ${if or {\
21896   { !eq{$h_list-id:$h_list-post:$h_list-subscribe:}{} }\
21897   { match{$h_precedence:}{(?i)bulk|list|junk} }\
21898   { match{$h_auto-submitted:}{(?i)auto-generated|auto-replied} }\
21899   } {no}{yes}}
21900 </literallayout>
21901 <para>
21902 This suppresses the sending of warnings for messages that contain <emphasis>List-ID:</emphasis>,
21903 <emphasis>List-Post:</emphasis>, or <emphasis>List-Subscribe:</emphasis> headers, or have <quote>bulk</quote>, <quote>list</quote> or
21904 <quote>junk</quote> in a <emphasis>Precedence:</emphasis> header, or have <quote>auto-generated</quote> or
21905 <quote>auto-replied</quote> in an <emphasis>Auto-Submitted:</emphasis> header.
21906 </para>
21907 <para>
21908 <indexterm role="option">
21909 <primary><option>deliver_drop_privilege</option></primary>
21910 </indexterm>
21911 </para>
21912 <informaltable frame="all">
21913 <tgroup cols="4" colsep="0" rowsep="0">
21914 <colspec colwidth="8*" align="left"/>
21915 <colspec colwidth="6*" align="center"/>
21916 <colspec colwidth="6*" align="center"/>
21917 <colspec colwidth="6*" align="right"/>
21918 <tbody>
21919 <row>
21920 <entry><option>deliver_drop_privilege</option></entry>
21921 <entry>Use: <emphasis>main</emphasis></entry>
21922 <entry>Type: <emphasis>boolean</emphasis></entry>
21923 <entry>Default: <emphasis>false</emphasis></entry>
21924 </row>
21925 </tbody>
21926 </tgroup>
21927 </informaltable>
21928 <para>
21929 <indexterm role="concept">
21930 <primary>unprivileged delivery</primary>
21931 </indexterm>
21932 <indexterm role="concept">
21933 <primary>delivery</primary>
21934 <secondary>unprivileged</secondary>
21935 </indexterm>
21936 If this option is set true, Exim drops its root privilege at the start of a
21937 delivery process, and runs as the Exim user throughout. This severely restricts
21938 the kinds of local delivery that are possible, but is viable in certain types
21939 of configuration. There is a discussion about the use of root privilege in
21940 chapter <xref linkend="CHAPsecurity"/>.
21941 </para>
21942 <para>
21943 <indexterm role="option">
21944 <primary><option>deliver_queue_load_max</option></primary>
21945 </indexterm>
21946 </para>
21947 <informaltable frame="all">
21948 <tgroup cols="4" colsep="0" rowsep="0">
21949 <colspec colwidth="8*" align="left"/>
21950 <colspec colwidth="6*" align="center"/>
21951 <colspec colwidth="6*" align="center"/>
21952 <colspec colwidth="6*" align="right"/>
21953 <tbody>
21954 <row>
21955 <entry><option>deliver_queue_load_max</option></entry>
21956 <entry>Use: <emphasis>main</emphasis></entry>
21957 <entry>Type: <emphasis>fixed-point</emphasis></entry>
21958 <entry>Default: <emphasis>unset</emphasis></entry>
21959 </row>
21960 </tbody>
21961 </tgroup>
21962 </informaltable>
21963 <para>
21964 <indexterm role="concept">
21965 <primary>load average</primary>
21966 </indexterm>
21967 <indexterm role="concept">
21968 <primary>queue runner</primary>
21969 <secondary>abandoning</secondary>
21970 </indexterm>
21971 When this option is set, a queue run is abandoned if the system load average
21972 becomes greater than the value of the option. The option has no effect on
21973 ancient operating systems on which Exim cannot determine the load average.
21974 See also <option>queue_only_load</option> and <option>smtp_load_reserve</option>.
21975 </para>
21976 <para>
21977 <indexterm role="option">
21978 <primary><option>delivery_date_remove</option></primary>
21979 </indexterm>
21980 </para>
21981 <informaltable frame="all">
21982 <tgroup cols="4" colsep="0" rowsep="0">
21983 <colspec colwidth="8*" align="left"/>
21984 <colspec colwidth="6*" align="center"/>
21985 <colspec colwidth="6*" align="center"/>
21986 <colspec colwidth="6*" align="right"/>
21987 <tbody>
21988 <row>
21989 <entry><option>delivery_date_remove</option></entry>
21990 <entry>Use: <emphasis>main</emphasis></entry>
21991 <entry>Type: <emphasis>boolean</emphasis></entry>
21992 <entry>Default: <emphasis>true</emphasis></entry>
21993 </row>
21994 </tbody>
21995 </tgroup>
21996 </informaltable>
21997 <para>
21998 <indexterm role="concept">
21999 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
22000 </indexterm>
22001 Exim&#x2019;s transports have an option for adding a <emphasis>Delivery-date:</emphasis> header to a
22002 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
22003 handled. <emphasis>Delivery-date:</emphasis> records the actual time of delivery. Such headers
22004 should not be present in incoming messages, and this option causes them to be
22005 removed at the time the message is received, to avoid any problems that might
22006 occur when a delivered message is subsequently sent on to some other recipient.
22007 </para>
22008 <para>
22009 <indexterm role="option">
22010 <primary><option>disable_fsync</option></primary>
22011 </indexterm>
22012 </para>
22013 <informaltable frame="all">
22014 <tgroup cols="4" colsep="0" rowsep="0">
22015 <colspec colwidth="8*" align="left"/>
22016 <colspec colwidth="6*" align="center"/>
22017 <colspec colwidth="6*" align="center"/>
22018 <colspec colwidth="6*" align="right"/>
22019 <tbody>
22020 <row>
22021 <entry><option>disable_fsync</option></entry>
22022 <entry>Use: <emphasis>main</emphasis></entry>
22023 <entry>Type: <emphasis>boolean</emphasis></entry>
22024 <entry>Default: <emphasis>false</emphasis></entry>
22025 </row>
22026 </tbody>
22027 </tgroup>
22028 </informaltable>
22029 <para>
22030 <indexterm role="concept">
22031 <primary><function>fsync()</function>, disabling</primary>
22032 </indexterm>
22033 This option is available only if Exim was built with the compile-time option
22034 ENABLE_DISABLE_FSYNC. When this is not set, a reference to <option>disable_fsync</option> in
22035 a runtime configuration generates an <quote>unknown option</quote> error. You should not
22036 build Exim with ENABLE_DISABLE_FSYNC or set <option>disable_fsync</option> unless you
22037 really, really, really understand what you are doing. <emphasis>No pre-compiled
22038 distributions of Exim should ever make this option available.</emphasis>
22039 </para>
22040 <para>
22041 When <option>disable_fsync</option> is set true, Exim no longer calls <function>fsync()</function> to force
22042 updated files&#x2019; data to be written to disc before continuing. Unexpected events
22043 such as crashes and power outages may cause data to be lost or scrambled.
22044 Here be Dragons. <emphasis role="bold">Beware.</emphasis>
22045 </para>
22046 <para>
22047 <indexterm role="option">
22048 <primary><option>disable_ipv6</option></primary>
22049 </indexterm>
22050 </para>
22051 <informaltable frame="all">
22052 <tgroup cols="4" colsep="0" rowsep="0">
22053 <colspec colwidth="8*" align="left"/>
22054 <colspec colwidth="6*" align="center"/>
22055 <colspec colwidth="6*" align="center"/>
22056 <colspec colwidth="6*" align="right"/>
22057 <tbody>
22058 <row>
22059 <entry><option>disable_ipv6</option></entry>
22060 <entry>Use: <emphasis>main</emphasis></entry>
22061 <entry>Type: <emphasis>boolean</emphasis></entry>
22062 <entry>Default: <emphasis>false</emphasis></entry>
22063 </row>
22064 </tbody>
22065 </tgroup>
22066 </informaltable>
22067 <para>
22068 <indexterm role="concept">
22069 <primary>IPv6</primary>
22070 <secondary>disabling</secondary>
22071 </indexterm>
22072 If this option is set true, even if the Exim binary has IPv6 support, no IPv6
22073 activities take place. AAAA records are never looked up, and any IPv6 addresses
22074 that are listed in <option>local_interfaces</option>, data for the <option>manualroute</option> router,
22075 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
22076 to handle IPv6 literal addresses.
22077 </para>
22078 <para>
22079 <indexterm role="option">
22080 <primary><option>dns_again_means_nonexist</option></primary>
22081 </indexterm>
22082 </para>
22083 <informaltable frame="all">
22084 <tgroup cols="4" colsep="0" rowsep="0">
22085 <colspec colwidth="8*" align="left"/>
22086 <colspec colwidth="6*" align="center"/>
22087 <colspec colwidth="6*" align="center"/>
22088 <colspec colwidth="6*" align="right"/>
22089 <tbody>
22090 <row>
22091 <entry><option>dns_again_means_nonexist</option></entry>
22092 <entry>Use: <emphasis>main</emphasis></entry>
22093 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
22094 <entry>Default: <emphasis>unset</emphasis></entry>
22095 </row>
22096 </tbody>
22097 </tgroup>
22098 </informaltable>
22099 <para>
22100 <indexterm role="concept">
22101 <primary>DNS</primary>
22102 <secondary><quote>try again</quote> response; overriding</secondary>
22103 </indexterm>
22104 DNS lookups give a <quote>try again</quote> response for the DNS errors
22105 <quote>non-authoritative host not found</quote> and <quote>SERVERFAIL</quote>. This can cause Exim to
22106 keep trying to deliver a message, or to give repeated temporary errors to
22107 incoming mail. Sometimes the effect is caused by a badly set up name server and
22108 may persist for a long time. If a domain which exhibits this problem matches
22109 anything in <option>dns_again_means_nonexist</option>, it is treated as if it did not exist.
22110 This option should be used with care. You can make it apply to reverse lookups
22111 by a setting such as this:
22112 </para>
22113 <literallayout class="monospaced">
22114 dns_again_means_nonexist = *.in-addr.arpa
22115 </literallayout>
22116 <para>
22117 This option applies to all DNS lookups that Exim does. It also applies when the
22118 <function>gethostbyname()</function> or <function>getipnodebyname()</function> functions give temporary errors,
22119 since these are most likely to be caused by DNS lookup problems. The
22120 <command>dnslookup</command> router has some options of its own for controlling what happens
22121 when lookups for MX or SRV records give temporary errors. These more specific
22122 options are applied after this global option.
22123 </para>
22124 <para>
22125 <indexterm role="option">
22126 <primary><option>dns_check_names_pattern</option></primary>
22127 </indexterm>
22128 </para>
22129 <informaltable frame="all">
22130 <tgroup cols="4" colsep="0" rowsep="0">
22131 <colspec colwidth="8*" align="left"/>
22132 <colspec colwidth="6*" align="center"/>
22133 <colspec colwidth="6*" align="center"/>
22134 <colspec colwidth="6*" align="right"/>
22135 <tbody>
22136 <row>
22137 <entry><option>dns_check_names_pattern</option></entry>
22138 <entry>Use: <emphasis>main</emphasis></entry>
22139 <entry>Type: <emphasis>string</emphasis></entry>
22140 <entry>Default: <emphasis>see below</emphasis></entry>
22141 </row>
22142 </tbody>
22143 </tgroup>
22144 </informaltable>
22145 <para>
22146 <indexterm role="concept">
22147 <primary>DNS</primary>
22148 <secondary>pre-check of name syntax</secondary>
22149 </indexterm>
22150 When this option is set to a non-empty string, it causes Exim to check domain
22151 names for characters that are not allowed in host names before handing them to
22152 the DNS resolver, because some resolvers give temporary errors for names that
22153 contain unusual characters. If a domain name contains any unwanted characters,
22154 a <quote>not found</quote> result is forced, and the resolver is not called. The check is
22155 done by matching the domain name against a regular expression, which is the
22156 value of this option. The default pattern is
22157 </para>
22158 <literallayout class="monospaced">
22159 dns_check_names_pattern = \
22160   (?i)^(?&gt;(?(1)\.|())[^\W_](?&gt;[a-z0-9/-]*[^\W_])?)+$
22161 </literallayout>
22162 <para>
22163 which permits only letters, digits, slashes, and hyphens in components, but
22164 they must start and end with a letter or digit. Slashes are not, in fact,
22165 permitted in host names, but they are found in certain NS records (which can be
22166 accessed in Exim by using a <option>dnsdb</option> lookup). If you set
22167 <option>allow_utf8_domains</option>, you must modify this pattern, or set the option to an
22168 empty string.
22169 </para>
22170 <para>
22171 <indexterm role="option">
22172 <primary><option>dns_csa_search_limit</option></primary>
22173 </indexterm>
22174 </para>
22175 <informaltable frame="all">
22176 <tgroup cols="4" colsep="0" rowsep="0">
22177 <colspec colwidth="8*" align="left"/>
22178 <colspec colwidth="6*" align="center"/>
22179 <colspec colwidth="6*" align="center"/>
22180 <colspec colwidth="6*" align="right"/>
22181 <tbody>
22182 <row>
22183 <entry><option>dns_csa_search_limit</option></entry>
22184 <entry>Use: <emphasis>main</emphasis></entry>
22185 <entry>Type: <emphasis>integer</emphasis></entry>
22186 <entry>Default: <emphasis>5</emphasis></entry>
22187 </row>
22188 </tbody>
22189 </tgroup>
22190 </informaltable>
22191 <para>
22192 This option controls the depth of parental searching for CSA SRV records in the
22193 DNS, as described in more detail in section <xref linkend="SECTverifyCSA"/>.
22194 </para>
22195 <para>
22196 <indexterm role="option">
22197 <primary><option>dns_csa_use_reverse</option></primary>
22198 </indexterm>
22199 </para>
22200 <informaltable frame="all">
22201 <tgroup cols="4" colsep="0" rowsep="0">
22202 <colspec colwidth="8*" align="left"/>
22203 <colspec colwidth="6*" align="center"/>
22204 <colspec colwidth="6*" align="center"/>
22205 <colspec colwidth="6*" align="right"/>
22206 <tbody>
22207 <row>
22208 <entry><option>dns_csa_use_reverse</option></entry>
22209 <entry>Use: <emphasis>main</emphasis></entry>
22210 <entry>Type: <emphasis>boolean</emphasis></entry>
22211 <entry>Default: <emphasis>true</emphasis></entry>
22212 </row>
22213 </tbody>
22214 </tgroup>
22215 </informaltable>
22216 <para>
22217 This option controls whether or not an IP address, given as a CSA domain, is
22218 reversed and looked up in the reverse DNS, as described in more detail in
22219 section <xref linkend="SECTverifyCSA"/>.
22220 </para>
22221 <para>
22222 <indexterm role="option">
22223 <primary><option>dns_ipv4_lookup</option></primary>
22224 </indexterm>
22225 </para>
22226 <informaltable frame="all">
22227 <tgroup cols="4" colsep="0" rowsep="0">
22228 <colspec colwidth="8*" align="left"/>
22229 <colspec colwidth="6*" align="center"/>
22230 <colspec colwidth="6*" align="center"/>
22231 <colspec colwidth="6*" align="right"/>
22232 <tbody>
22233 <row>
22234 <entry><option>dns_ipv4_lookup</option></entry>
22235 <entry>Use: <emphasis>main</emphasis></entry>
22236 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
22237 <entry>Default: <emphasis>unset</emphasis></entry>
22238 </row>
22239 </tbody>
22240 </tgroup>
22241 </informaltable>
22242 <para>
22243 <indexterm role="concept">
22244 <primary>IPv6</primary>
22245 <secondary>DNS lookup for AAAA records</secondary>
22246 </indexterm>
22247 <indexterm role="concept">
22248 <primary>DNS</primary>
22249 <secondary>IPv6 lookup for AAAA records</secondary>
22250 </indexterm>
22251 When Exim is compiled with IPv6 support and <option>disable_ipv6</option> is not set, it
22252 looks for IPv6 address records (AAAA records) as well as IPv4 address records
22253 (A records) when trying to find IP addresses for hosts, unless the host&#x2019;s
22254 domain matches this list.
22255 </para>
22256 <para>
22257 This is a fudge to help with name servers that give big delays or otherwise do
22258 not work for the AAAA record type. In due course, when the world&#x2019;s name
22259 servers have all been upgraded, there should be no need for this option.
22260 </para>
22261 <para>
22262 <indexterm role="option">
22263 <primary><option>dns_retrans</option></primary>
22264 </indexterm>
22265 </para>
22266 <informaltable frame="all">
22267 <tgroup cols="4" colsep="0" rowsep="0">
22268 <colspec colwidth="8*" align="left"/>
22269 <colspec colwidth="6*" align="center"/>
22270 <colspec colwidth="6*" align="center"/>
22271 <colspec colwidth="6*" align="right"/>
22272 <tbody>
22273 <row>
22274 <entry><option>dns_retrans</option></entry>
22275 <entry>Use: <emphasis>main</emphasis></entry>
22276 <entry>Type: <emphasis>time</emphasis></entry>
22277 <entry>Default: <emphasis>0s</emphasis></entry>
22278 </row>
22279 </tbody>
22280 </tgroup>
22281 </informaltable>
22282 <para>
22283 <indexterm role="concept">
22284 <primary>DNS</primary>
22285 <secondary>resolver options</secondary>
22286 </indexterm>
22287 The options <option>dns_retrans</option> and <option>dns_retry</option> can be used to set the
22288 retransmission and retry parameters for DNS lookups. Values of zero (the
22289 defaults) leave the system default settings unchanged. The first value is the
22290 time between retries, and the second is the number of retries. It isn&#x2019;t
22291 totally clear exactly how these settings affect the total time a DNS lookup may
22292 take. I haven&#x2019;t found any documentation about timeouts on DNS lookups; these
22293 parameter values are available in the external resolver interface structure,
22294 but nowhere does it seem to describe how they are used or what you might want
22295 to set in them.
22296 </para>
22297 <para>
22298 <indexterm role="option">
22299 <primary><option>dns_retry</option></primary>
22300 </indexterm>
22301 </para>
22302 <informaltable frame="all">
22303 <tgroup cols="4" colsep="0" rowsep="0">
22304 <colspec colwidth="8*" align="left"/>
22305 <colspec colwidth="6*" align="center"/>
22306 <colspec colwidth="6*" align="center"/>
22307 <colspec colwidth="6*" align="right"/>
22308 <tbody>
22309 <row>
22310 <entry><option>dns_retry</option></entry>
22311 <entry>Use: <emphasis>main</emphasis></entry>
22312 <entry>Type: <emphasis>integer</emphasis></entry>
22313 <entry>Default: <emphasis>0</emphasis></entry>
22314 </row>
22315 </tbody>
22316 </tgroup>
22317 </informaltable>
22318 <para>
22319 See <option>dns_retrans</option> above.
22320 </para>
22321 <para>
22322 <indexterm role="option">
22323 <primary><option>drop_cr</option></primary>
22324 </indexterm>
22325 </para>
22326 <informaltable frame="all">
22327 <tgroup cols="4" colsep="0" rowsep="0">
22328 <colspec colwidth="8*" align="left"/>
22329 <colspec colwidth="6*" align="center"/>
22330 <colspec colwidth="6*" align="center"/>
22331 <colspec colwidth="6*" align="right"/>
22332 <tbody>
22333 <row>
22334 <entry><option>drop_cr</option></entry>
22335 <entry>Use: <emphasis>main</emphasis></entry>
22336 <entry>Type: <emphasis>boolean</emphasis></entry>
22337 <entry>Default: <emphasis>false</emphasis></entry>
22338 </row>
22339 </tbody>
22340 </tgroup>
22341 </informaltable>
22342 <para>
22343 This is an obsolete option that is now a no-op. It used to affect the way Exim
22344 handled CR and LF characters in incoming messages. What happens now is
22345 described in section <xref linkend="SECTlineendings"/>.
22346 </para>
22347 <para>
22348 <indexterm role="option">
22349 <primary><option>dsn_from</option></primary>
22350 </indexterm>
22351 </para>
22352 <informaltable frame="all">
22353 <tgroup cols="4" colsep="0" rowsep="0">
22354 <colspec colwidth="8*" align="left"/>
22355 <colspec colwidth="6*" align="center"/>
22356 <colspec colwidth="6*" align="center"/>
22357 <colspec colwidth="6*" align="right"/>
22358 <tbody>
22359 <row>
22360 <entry><option>dsn_from</option></entry>
22361 <entry>Use: <emphasis>main</emphasis></entry>
22362 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22363 <entry>Default: <emphasis>see below</emphasis></entry>
22364 </row>
22365 </tbody>
22366 </tgroup>
22367 </informaltable>
22368 <para>
22369 <indexterm role="concept">
22370 <primary><emphasis>From:</emphasis> header line</primary>
22371 <secondary>in bounces</secondary>
22372 </indexterm>
22373 <indexterm role="concept">
22374 <primary>bounce messages</primary>
22375 <secondary><emphasis>From:</emphasis> line, specifying</secondary>
22376 </indexterm>
22377 This option can be used to vary the contents of <emphasis>From:</emphasis> header lines in
22378 bounces and other automatically generated messages (<quote>Delivery Status
22379 Notifications</quote> &ndash; hence the name of the option). The default setting is:
22380 </para>
22381 <literallayout class="monospaced">
22382 dsn_from = Mail Delivery System &lt;Mailer-Daemon@$qualify_domain&gt;
22383 </literallayout>
22384 <para>
22385 The value is expanded every time it is needed. If the expansion fails, a
22386 panic is logged, and the default value is used.
22387 </para>
22388 <para>
22389 <indexterm role="option">
22390 <primary><option>envelope_to_remove</option></primary>
22391 </indexterm>
22392 </para>
22393 <informaltable frame="all">
22394 <tgroup cols="4" colsep="0" rowsep="0">
22395 <colspec colwidth="8*" align="left"/>
22396 <colspec colwidth="6*" align="center"/>
22397 <colspec colwidth="6*" align="center"/>
22398 <colspec colwidth="6*" align="right"/>
22399 <tbody>
22400 <row>
22401 <entry><option>envelope_to_remove</option></entry>
22402 <entry>Use: <emphasis>main</emphasis></entry>
22403 <entry>Type: <emphasis>boolean</emphasis></entry>
22404 <entry>Default: <emphasis>true</emphasis></entry>
22405 </row>
22406 </tbody>
22407 </tgroup>
22408 </informaltable>
22409 <para>
22410 <indexterm role="concept">
22411 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
22412 </indexterm>
22413 Exim&#x2019;s transports have an option for adding an <emphasis>Envelope-to:</emphasis> header to a
22414 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
22415 handled. <emphasis>Envelope-to:</emphasis> records the original recipient address from the
22416 messages&#x2019;s envelope that caused the delivery to happen. Such headers should not
22417 be present in incoming messages, and this option causes them to be removed at
22418 the time the message is received, to avoid any problems that might occur when a
22419 delivered message is subsequently sent on to some other recipient.
22420 </para>
22421 <para>
22422 <indexterm role="option">
22423 <primary><option>errors_copy</option></primary>
22424 </indexterm>
22425 </para>
22426 <informaltable frame="all">
22427 <tgroup cols="4" colsep="0" rowsep="0">
22428 <colspec colwidth="8*" align="left"/>
22429 <colspec colwidth="6*" align="center"/>
22430 <colspec colwidth="6*" align="center"/>
22431 <colspec colwidth="6*" align="right"/>
22432 <tbody>
22433 <row>
22434 <entry><option>errors_copy</option></entry>
22435 <entry>Use: <emphasis>main</emphasis></entry>
22436 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
22437 <entry>Default: <emphasis>unset</emphasis></entry>
22438 </row>
22439 </tbody>
22440 </tgroup>
22441 </informaltable>
22442 <para>
22443 <indexterm role="concept">
22444 <primary>bounce message</primary>
22445 <secondary>copy to other address</secondary>
22446 </indexterm>
22447 <indexterm role="concept">
22448 <primary>copy of bounce message</primary>
22449 </indexterm>
22450 Setting this option causes Exim to send bcc copies of bounce messages that it
22451 generates to other addresses. <emphasis role="bold">Note</emphasis>: This does not apply to bounce messages
22452 coming from elsewhere. The value of the option is a colon-separated list of
22453 items. Each item consists of a pattern, terminated by white space, followed by
22454 a comma-separated list of email addresses. If a pattern contains spaces, it
22455 must be enclosed in double quotes.
22456 </para>
22457 <para>
22458 Each pattern is processed in the same way as a single item in an address list
22459 (see section <xref linkend="SECTaddresslist"/>). When a pattern matches the recipient of
22460 the bounce message, the message is copied to the addresses on the list. The
22461 items are scanned in order, and once a matching one is found, no further items
22462 are examined. For example:
22463 </para>
22464 <literallayout class="monospaced">
22465 errors_copy = spqr@mydomain   postmaster@mydomain.example :\
22466               rqps@mydomain   hostmaster@mydomain.example,\
22467                               postmaster@mydomain.example
22468 </literallayout>
22469 <para>
22470 <indexterm role="variable">
22471 <primary><varname>$domain</varname></primary>
22472 </indexterm>
22473 <indexterm role="variable">
22474 <primary><varname>$local_part</varname></primary>
22475 </indexterm>
22476 The address list is expanded before use. The expansion variables <varname>$local_part</varname>
22477 and <varname>$domain</varname> are set from the original recipient of the error message, and if
22478 there was any wildcard matching in the pattern, the expansion
22479 <indexterm role="concept">
22480 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
22481 <secondary>in <option>errors_copy</option></secondary>
22482 </indexterm>
22483 variables <varname>$0</varname>, <varname>$1</varname>, etc. are set in the normal way.
22484 </para>
22485 <para>
22486 <indexterm role="option">
22487 <primary><option>errors_reply_to</option></primary>
22488 </indexterm>
22489 </para>
22490 <informaltable frame="all">
22491 <tgroup cols="4" colsep="0" rowsep="0">
22492 <colspec colwidth="8*" align="left"/>
22493 <colspec colwidth="6*" align="center"/>
22494 <colspec colwidth="6*" align="center"/>
22495 <colspec colwidth="6*" align="right"/>
22496 <tbody>
22497 <row>
22498 <entry><option>errors_reply_to</option></entry>
22499 <entry>Use: <emphasis>main</emphasis></entry>
22500 <entry>Type: <emphasis>string</emphasis></entry>
22501 <entry>Default: <emphasis>unset</emphasis></entry>
22502 </row>
22503 </tbody>
22504 </tgroup>
22505 </informaltable>
22506 <para>
22507 <indexterm role="concept">
22508 <primary>bounce message</primary>
22509 <secondary><emphasis>Reply-to:</emphasis> in</secondary>
22510 </indexterm>
22511 By default, Exim&#x2019;s bounce and delivery warning messages contain the header line
22512 </para>
22513 <literallayout>
22514 <literal>From: Mail Delivery System &lt;Mailer-Daemon@</literal><emphasis>qualify-domain</emphasis><literal>&gt;</literal>
22515 </literallayout>
22516 <para>
22517 <indexterm role="option">
22518 <primary><option>quota_warn_message</option></primary>
22519 </indexterm>
22520 where <emphasis>qualify-domain</emphasis> is the value of the <option>qualify_domain</option> option.
22521 A warning message that is generated by the <option>quota_warn_message</option> option in an
22522 <command>appendfile</command> transport may contain its own <emphasis>From:</emphasis> header line that
22523 overrides the default.
22524 </para>
22525 <para>
22526 Experience shows that people reply to bounce messages. If the
22527 <option>errors_reply_to</option> option is set, a <emphasis>Reply-To:</emphasis> header is added to bounce
22528 and warning messages. For example:
22529 </para>
22530 <literallayout class="monospaced">
22531 errors_reply_to = postmaster@my.domain.example
22532 </literallayout>
22533 <para>
22534 The value of the option is not expanded. It must specify a valid RFC 2822
22535 address. However, if a warning message that is generated by the
22536 <option>quota_warn_message</option> option in an <command>appendfile</command> transport contain its
22537 own <emphasis>Reply-To:</emphasis> header line, the value of the <option>errors_reply_to</option> option is
22538 not used.
22539 </para>
22540 <para>
22541 <indexterm role="option">
22542 <primary><option>exim_group</option></primary>
22543 </indexterm>
22544 </para>
22545 <informaltable frame="all">
22546 <tgroup cols="4" colsep="0" rowsep="0">
22547 <colspec colwidth="8*" align="left"/>
22548 <colspec colwidth="6*" align="center"/>
22549 <colspec colwidth="6*" align="center"/>
22550 <colspec colwidth="6*" align="right"/>
22551 <tbody>
22552 <row>
22553 <entry><option>exim_group</option></entry>
22554 <entry>Use: <emphasis>main</emphasis></entry>
22555 <entry>Type: <emphasis>string</emphasis></entry>
22556 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
22557 </row>
22558 </tbody>
22559 </tgroup>
22560 </informaltable>
22561 <para>
22562 <indexterm role="concept">
22563 <primary>gid (group id)</primary>
22564 <secondary>Exim&#x2019;s own</secondary>
22565 </indexterm>
22566 <indexterm role="concept">
22567 <primary>Exim group</primary>
22568 </indexterm>
22569 This option changes the gid under which Exim runs when it gives up root
22570 privilege. The default value is compiled into the binary. The value of this
22571 option is used only when <option>exim_user</option> is also set. Unless it consists entirely
22572 of digits, the string is looked up using <function>getgrnam()</function>, and failure causes a
22573 configuration error. See chapter <xref linkend="CHAPsecurity"/> for a discussion of
22574 security issues.
22575 </para>
22576 <para>
22577 <indexterm role="option">
22578 <primary><option>exim_path</option></primary>
22579 </indexterm>
22580 </para>
22581 <informaltable frame="all">
22582 <tgroup cols="4" colsep="0" rowsep="0">
22583 <colspec colwidth="8*" align="left"/>
22584 <colspec colwidth="6*" align="center"/>
22585 <colspec colwidth="6*" align="center"/>
22586 <colspec colwidth="6*" align="right"/>
22587 <tbody>
22588 <row>
22589 <entry><option>exim_path</option></entry>
22590 <entry>Use: <emphasis>main</emphasis></entry>
22591 <entry>Type: <emphasis>string</emphasis></entry>
22592 <entry>Default: <emphasis>see below</emphasis></entry>
22593 </row>
22594 </tbody>
22595 </tgroup>
22596 </informaltable>
22597 <para>
22598 <indexterm role="concept">
22599 <primary>Exim binary, path name</primary>
22600 </indexterm>
22601 This option specifies the path name of the Exim binary, which is used when Exim
22602 needs to re-exec itself. The default is set up to point to the file <emphasis>exim</emphasis> in
22603 the directory configured at compile time by the BIN_DIRECTORY setting. It
22604 is necessary to change <option>exim_path</option> if, exceptionally, Exim is run from some
22605 other place.
22606 <emphasis role="bold">Warning</emphasis>: Do not use a macro to define the value of this option, because
22607 you will break those Exim utilities that scan the configuration file to find
22608 where the binary is. (They then use the <option>-bP</option> option to extract option
22609 settings such as the value of <option>spool_directory</option>.)
22610 </para>
22611 <para>
22612 <indexterm role="option">
22613 <primary><option>exim_user</option></primary>
22614 </indexterm>
22615 </para>
22616 <informaltable frame="all">
22617 <tgroup cols="4" colsep="0" rowsep="0">
22618 <colspec colwidth="8*" align="left"/>
22619 <colspec colwidth="6*" align="center"/>
22620 <colspec colwidth="6*" align="center"/>
22621 <colspec colwidth="6*" align="right"/>
22622 <tbody>
22623 <row>
22624 <entry><option>exim_user</option></entry>
22625 <entry>Use: <emphasis>main</emphasis></entry>
22626 <entry>Type: <emphasis>string</emphasis></entry>
22627 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
22628 </row>
22629 </tbody>
22630 </tgroup>
22631 </informaltable>
22632 <para>
22633 <indexterm role="concept">
22634 <primary>uid (user id)</primary>
22635 <secondary>Exim&#x2019;s own</secondary>
22636 </indexterm>
22637 <indexterm role="concept">
22638 <primary>Exim user</primary>
22639 </indexterm>
22640 This option changes the uid under which Exim runs when it gives up root
22641 privilege. The default value is compiled into the binary. Ownership of the run
22642 time configuration file and the use of the <option>-C</option> and <option>-D</option> command line
22643 options is checked against the values in the binary, not what is set here.
22644 </para>
22645 <para>
22646 Unless it consists entirely of digits, the string is looked up using
22647 <function>getpwnam()</function>, and failure causes a configuration error. If <option>exim_group</option> is
22648 not also supplied, the gid is taken from the result of <function>getpwnam()</function> if it is
22649 used. See chapter <xref linkend="CHAPsecurity"/> for a discussion of security issues.
22650 </para>
22651 <para>
22652 <indexterm role="option">
22653 <primary><option>extra_local_interfaces</option></primary>
22654 </indexterm>
22655 </para>
22656 <informaltable frame="all">
22657 <tgroup cols="4" colsep="0" rowsep="0">
22658 <colspec colwidth="8*" align="left"/>
22659 <colspec colwidth="6*" align="center"/>
22660 <colspec colwidth="6*" align="center"/>
22661 <colspec colwidth="6*" align="right"/>
22662 <tbody>
22663 <row>
22664 <entry><option>extra_local_interfaces</option></entry>
22665 <entry>Use: <emphasis>main</emphasis></entry>
22666 <entry>Type: <emphasis>string list</emphasis></entry>
22667 <entry>Default: <emphasis>unset</emphasis></entry>
22668 </row>
22669 </tbody>
22670 </tgroup>
22671 </informaltable>
22672 <para>
22673 This option defines network interfaces that are to be considered local when
22674 routing, but which are not used for listening by the daemon. See section
22675 <xref linkend="SECTreclocipadd"/> for details.
22676 </para>
22677 <para>
22678 <indexterm role="option">
22679 <primary><option>extract_addresses_remove_arguments</option></primary>
22680 </indexterm>
22681 </para>
22682 <informaltable frame="all">
22683 <tgroup cols="4" colsep="0" rowsep="0">
22684 <colspec colwidth="8*" align="left"/>
22685 <colspec colwidth="6*" align="center"/>
22686 <colspec colwidth="6*" align="center"/>
22687 <colspec colwidth="6*" align="right"/>
22688 <tbody>
22689 <row>
22690 <entry><option>extract_addresses_remove_ &nbsp;&nbsp;arguments</option></entry>
22691 <entry>Use: <emphasis>main</emphasis></entry>
22692 <entry>Type: <emphasis>boolean</emphasis></entry>
22693 <entry>Default: <emphasis>true</emphasis></entry>
22694 </row>
22695 </tbody>
22696 </tgroup>
22697 </informaltable>
22698 <para>
22699 <indexterm role="option">
22700 <primary><option>-t</option></primary>
22701 </indexterm>
22702 <indexterm role="concept">
22703 <primary>command line</primary>
22704 <secondary>addresses with <option>-t</option></secondary>
22705 </indexterm>
22706 <indexterm role="concept">
22707 <primary>Sendmail compatibility</primary>
22708 <secondary><option>-t</option> option</secondary>
22709 </indexterm>
22710 According to some Sendmail documentation (Sun, IRIX, HP-UX), if any addresses
22711 are present on the command line when the <option>-t</option> option is used to build an
22712 envelope from a message&#x2019;s <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis> and <emphasis>Bcc:</emphasis> headers, the command
22713 line addresses are removed from the recipients list. This is also how Smail
22714 behaves. However, other Sendmail documentation (the O&#x2019;Reilly book) states that
22715 command line addresses are added to those obtained from the header lines. When
22716 <option>extract_addresses_remove_arguments</option> is true (the default), Exim subtracts
22717 argument headers. If it is set false, Exim adds rather than removes argument
22718 addresses.
22719 </para>
22720 <para>
22721 <indexterm role="option">
22722 <primary><option>finduser_retries</option></primary>
22723 </indexterm>
22724 </para>
22725 <informaltable frame="all">
22726 <tgroup cols="4" colsep="0" rowsep="0">
22727 <colspec colwidth="8*" align="left"/>
22728 <colspec colwidth="6*" align="center"/>
22729 <colspec colwidth="6*" align="center"/>
22730 <colspec colwidth="6*" align="right"/>
22731 <tbody>
22732 <row>
22733 <entry><option>finduser_retries</option></entry>
22734 <entry>Use: <emphasis>main</emphasis></entry>
22735 <entry>Type: <emphasis>integer</emphasis></entry>
22736 <entry>Default: <emphasis>0</emphasis></entry>
22737 </row>
22738 </tbody>
22739 </tgroup>
22740 </informaltable>
22741 <para>
22742 <indexterm role="concept">
22743 <primary>NIS, retrying user lookups</primary>
22744 </indexterm>
22745 On systems running NIS or other schemes in which user and group information is
22746 distributed from a remote system, there can be times when <function>getpwnam()</function> and
22747 related functions fail, even when given valid data, because things time out.
22748 Unfortunately these failures cannot be distinguished from genuine <quote>not found</quote>
22749 errors. If <option>finduser_retries</option> is set greater than zero, Exim will try that
22750 many extra times to find a user or a group, waiting for one second between
22751 retries.
22752 </para>
22753 <para>
22754 <indexterm role="concept">
22755 <primary><filename>/etc/passwd</filename></primary>
22756 <secondary>multiple reading of</secondary>
22757 </indexterm>
22758 You should not set this option greater than zero if your user information is in
22759 a traditional <filename>/etc/passwd</filename> file, because it will cause Exim needlessly to
22760 search the file multiple times for non-existent users, and also cause delay.
22761 </para>
22762 <para>
22763 <indexterm role="option">
22764 <primary><option>freeze_tell</option></primary>
22765 </indexterm>
22766 </para>
22767 <informaltable frame="all">
22768 <tgroup cols="4" colsep="0" rowsep="0">
22769 <colspec colwidth="8*" align="left"/>
22770 <colspec colwidth="6*" align="center"/>
22771 <colspec colwidth="6*" align="center"/>
22772 <colspec colwidth="6*" align="right"/>
22773 <tbody>
22774 <row>
22775 <entry><option>freeze_tell</option></entry>
22776 <entry>Use: <emphasis>main</emphasis></entry>
22777 <entry>Type: <emphasis>string list, comma separated</emphasis></entry>
22778 <entry>Default: <emphasis>unset</emphasis></entry>
22779 </row>
22780 </tbody>
22781 </tgroup>
22782 </informaltable>
22783 <para>
22784 <indexterm role="concept">
22785 <primary>freezing messages</primary>
22786 <secondary>sending a message when freezing</secondary>
22787 </indexterm>
22788 On encountering certain errors, or when configured to do so in a system filter,
22789 ACL, or special router, Exim freezes a message. This means that no further
22790 delivery attempts take place until an administrator thaws the message, or the
22791 <option>auto_thaw</option>, <option>ignore_bounce_errors_after</option>, or <option>timeout_frozen_after</option>
22792 feature cause it to be processed. If <option>freeze_tell</option> is set, Exim generates a
22793 warning message whenever it freezes something, unless the message it is
22794 freezing is a locally-generated bounce message. (Without this exception there
22795 is the possibility of looping.) The warning message is sent to the addresses
22796 supplied as the comma-separated value of this option. If several of the
22797 message&#x2019;s addresses cause freezing, only a single message is sent. If the
22798 freezing was automatic, the reason(s) for freezing can be found in the message
22799 log. If you configure freezing in a filter or ACL, you must arrange for any
22800 logging that you require.
22801 </para>
22802 <para>
22803 <indexterm role="option">
22804 <primary><option>gecos_name</option></primary>
22805 </indexterm>
22806 </para>
22807 <informaltable frame="all">
22808 <tgroup cols="4" colsep="0" rowsep="0">
22809 <colspec colwidth="8*" align="left"/>
22810 <colspec colwidth="6*" align="center"/>
22811 <colspec colwidth="6*" align="center"/>
22812 <colspec colwidth="6*" align="right"/>
22813 <tbody>
22814 <row>
22815 <entry><option>gecos_name</option></entry>
22816 <entry>Use: <emphasis>main</emphasis></entry>
22817 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22818 <entry>Default: <emphasis>unset</emphasis></entry>
22819 </row>
22820 </tbody>
22821 </tgroup>
22822 </informaltable>
22823 <para>
22824 <indexterm role="concept">
22825 <primary>HP-UX</primary>
22826 </indexterm>
22827 <indexterm role="concept">
22828 <primary><quote>gecos</quote> field, parsing</primary>
22829 </indexterm>
22830 Some operating systems, notably HP-UX, use the <quote>gecos</quote> field in the system
22831 password file to hold other information in addition to users&#x2019; real names. Exim
22832 looks up this field for use when it is creating <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis>
22833 headers. If either <option>gecos_pattern</option> or <option>gecos_name</option> are unset, the contents
22834 of the field are used unchanged, except that, if an ampersand is encountered,
22835 it is replaced by the user&#x2019;s login name with the first character forced to
22836 upper case, since this is a convention that is observed on many systems.
22837 </para>
22838 <para>
22839 When these options are set, <option>gecos_pattern</option> is treated as a regular
22840 expression that is to be applied to the field (again with &amp; replaced by the
22841 login name), and if it matches, <option>gecos_name</option> is expanded and used as the
22842 user&#x2019;s name.
22843 </para>
22844 <para>
22845 <indexterm role="concept">
22846 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
22847 <secondary>in <option>gecos_name</option></secondary>
22848 </indexterm>
22849 Numeric variables such as <varname>$1</varname>, <varname>$2</varname>, etc. can be used in the expansion to
22850 pick up sub-fields that were matched by the pattern. In HP-UX, where the user&#x2019;s
22851 name terminates at the first comma, the following can be used:
22852 </para>
22853 <literallayout class="monospaced">
22854 gecos_pattern = ([^,]*)
22855 gecos_name = $1
22856 </literallayout>
22857 <para>
22858 <indexterm role="option">
22859 <primary><option>gecos_pattern</option></primary>
22860 </indexterm>
22861 </para>
22862 <informaltable frame="all">
22863 <tgroup cols="4" colsep="0" rowsep="0">
22864 <colspec colwidth="8*" align="left"/>
22865 <colspec colwidth="6*" align="center"/>
22866 <colspec colwidth="6*" align="center"/>
22867 <colspec colwidth="6*" align="right"/>
22868 <tbody>
22869 <row>
22870 <entry><option>gecos_pattern</option></entry>
22871 <entry>Use: <emphasis>main</emphasis></entry>
22872 <entry>Type: <emphasis>string</emphasis></entry>
22873 <entry>Default: <emphasis>unset</emphasis></entry>
22874 </row>
22875 </tbody>
22876 </tgroup>
22877 </informaltable>
22878 <para>
22879 See <option>gecos_name</option> above.
22880 </para>
22881 <para>
22882 <indexterm role="option">
22883 <primary><option>gnutls_require_kx</option></primary>
22884 </indexterm>
22885 </para>
22886 <informaltable frame="all">
22887 <tgroup cols="4" colsep="0" rowsep="0">
22888 <colspec colwidth="8*" align="left"/>
22889 <colspec colwidth="6*" align="center"/>
22890 <colspec colwidth="6*" align="center"/>
22891 <colspec colwidth="6*" align="right"/>
22892 <tbody>
22893 <row>
22894 <entry><option>gnutls_require_kx</option></entry>
22895 <entry>Use: <emphasis>main</emphasis></entry>
22896 <entry>Type: <emphasis>string</emphasis></entry>
22897 <entry>Default: <emphasis>unset</emphasis></entry>
22898 </row>
22899 </tbody>
22900 </tgroup>
22901 </informaltable>
22902 <para>
22903 This option controls the key exchange mechanisms when GnuTLS is used in an Exim
22904 server. For details, see section <xref linkend="SECTreqciphgnu"/>.
22905 </para>
22906 <para>
22907 <indexterm role="option">
22908 <primary><option>gnutls_require_mac</option></primary>
22909 </indexterm>
22910 </para>
22911 <informaltable frame="all">
22912 <tgroup cols="4" colsep="0" rowsep="0">
22913 <colspec colwidth="8*" align="left"/>
22914 <colspec colwidth="6*" align="center"/>
22915 <colspec colwidth="6*" align="center"/>
22916 <colspec colwidth="6*" align="right"/>
22917 <tbody>
22918 <row>
22919 <entry><option>gnutls_require_mac</option></entry>
22920 <entry>Use: <emphasis>main</emphasis></entry>
22921 <entry>Type: <emphasis>string</emphasis></entry>
22922 <entry>Default: <emphasis>unset</emphasis></entry>
22923 </row>
22924 </tbody>
22925 </tgroup>
22926 </informaltable>
22927 <para>
22928 This option controls the MAC algorithms when GnuTLS is used in an Exim
22929 server. For details, see section <xref linkend="SECTreqciphgnu"/>.
22930 </para>
22931 <para>
22932 <indexterm role="option">
22933 <primary><option>gnutls_require_protocols</option></primary>
22934 </indexterm>
22935 </para>
22936 <informaltable frame="all">
22937 <tgroup cols="4" colsep="0" rowsep="0">
22938 <colspec colwidth="8*" align="left"/>
22939 <colspec colwidth="6*" align="center"/>
22940 <colspec colwidth="6*" align="center"/>
22941 <colspec colwidth="6*" align="right"/>
22942 <tbody>
22943 <row>
22944 <entry><option>gnutls_require_protocols</option></entry>
22945 <entry>Use: <emphasis>main</emphasis></entry>
22946 <entry>Type: <emphasis>string</emphasis></entry>
22947 <entry>Default: <emphasis>unset</emphasis></entry>
22948 </row>
22949 </tbody>
22950 </tgroup>
22951 </informaltable>
22952 <para>
22953 This option controls the protocols when GnuTLS is used in an Exim
22954 server. For details, see section <xref linkend="SECTreqciphgnu"/>.
22955 </para>
22956 <para>
22957 <indexterm role="option">
22958 <primary><option>gnutls_compat_mode</option></primary>
22959 </indexterm>
22960 </para>
22961 <informaltable frame="all">
22962 <tgroup cols="4" colsep="0" rowsep="0">
22963 <colspec colwidth="8*" align="left"/>
22964 <colspec colwidth="6*" align="center"/>
22965 <colspec colwidth="6*" align="center"/>
22966 <colspec colwidth="6*" align="right"/>
22967 <tbody>
22968 <row>
22969 <entry><option>gnutls_compat_mode</option></entry>
22970 <entry>Use: <emphasis>main</emphasis></entry>
22971 <entry>Type: <emphasis>boolean</emphasis></entry>
22972 <entry>Default: <emphasis>unset</emphasis></entry>
22973 </row>
22974 </tbody>
22975 </tgroup>
22976 </informaltable>
22977 <para>
22978 This option controls whether GnuTLS is used in compatibility mode in an Exim
22979 server. This reduces security slightly, but improves interworking with older
22980 implementations of TLS.
22981 </para>
22982 <para>
22983 <indexterm role="option">
22984 <primary><option>headers_charset</option></primary>
22985 </indexterm>
22986 </para>
22987 <informaltable frame="all">
22988 <tgroup cols="4" colsep="0" rowsep="0">
22989 <colspec colwidth="8*" align="left"/>
22990 <colspec colwidth="6*" align="center"/>
22991 <colspec colwidth="6*" align="center"/>
22992 <colspec colwidth="6*" align="right"/>
22993 <tbody>
22994 <row>
22995 <entry><option>headers_charset</option></entry>
22996 <entry>Use: <emphasis>main</emphasis></entry>
22997 <entry>Type: <emphasis>string</emphasis></entry>
22998 <entry>Default: <emphasis>see below</emphasis></entry>
22999 </row>
23000 </tbody>
23001 </tgroup>
23002 </informaltable>
23003 <para>
23004 This option sets a default character set for translating from encoded MIME
23005 <quote>words</quote> in header lines, when referenced by an <varname>$h_xxx</varname> expansion item. The
23006 default is the value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The
23007 ultimate default is ISO-8859-1. For more details see the description of header
23008 insertions in section <xref linkend="SECTexpansionitems"/>.
23009 </para>
23010 <para>
23011 <indexterm role="option">
23012 <primary><option>header_maxsize</option></primary>
23013 </indexterm>
23014 </para>
23015 <informaltable frame="all">
23016 <tgroup cols="4" colsep="0" rowsep="0">
23017 <colspec colwidth="8*" align="left"/>
23018 <colspec colwidth="6*" align="center"/>
23019 <colspec colwidth="6*" align="center"/>
23020 <colspec colwidth="6*" align="right"/>
23021 <tbody>
23022 <row>
23023 <entry><option>header_maxsize</option></entry>
23024 <entry>Use: <emphasis>main</emphasis></entry>
23025 <entry>Type: <emphasis>integer</emphasis></entry>
23026 <entry>Default: <emphasis>see below</emphasis></entry>
23027 </row>
23028 </tbody>
23029 </tgroup>
23030 </informaltable>
23031 <para>
23032 <indexterm role="concept">
23033 <primary>header section</primary>
23034 <secondary>maximum size of</secondary>
23035 </indexterm>
23036 <indexterm role="concept">
23037 <primary>limit</primary>
23038 <secondary>size of message header section</secondary>
23039 </indexterm>
23040 This option controls the overall maximum size of a message&#x2019;s header
23041 section. The default is the value of HEADER_MAXSIZE in
23042 <filename>Local/Makefile</filename>; the default for that is 1M. Messages with larger header
23043 sections are rejected.
23044 </para>
23045 <para>
23046 <indexterm role="option">
23047 <primary><option>header_line_maxsize</option></primary>
23048 </indexterm>
23049 </para>
23050 <informaltable frame="all">
23051 <tgroup cols="4" colsep="0" rowsep="0">
23052 <colspec colwidth="8*" align="left"/>
23053 <colspec colwidth="6*" align="center"/>
23054 <colspec colwidth="6*" align="center"/>
23055 <colspec colwidth="6*" align="right"/>
23056 <tbody>
23057 <row>
23058 <entry><option>header_line_maxsize</option></entry>
23059 <entry>Use: <emphasis>main</emphasis></entry>
23060 <entry>Type: <emphasis>integer</emphasis></entry>
23061 <entry>Default: <emphasis>0</emphasis></entry>
23062 </row>
23063 </tbody>
23064 </tgroup>
23065 </informaltable>
23066 <para>
23067 <indexterm role="concept">
23068 <primary>header lines</primary>
23069 <secondary>maximum size of</secondary>
23070 </indexterm>
23071 <indexterm role="concept">
23072 <primary>limit</primary>
23073 <secondary>size of one header line</secondary>
23074 </indexterm>
23075 This option limits the length of any individual header line in a message, after
23076 all the continuations have been joined together. Messages with individual
23077 header lines that are longer than the limit are rejected. The default value of
23078 zero means <quote>no limit</quote>.
23079 </para>
23080 <para>
23081 <indexterm role="option">
23082 <primary><option>helo_accept_junk_hosts</option></primary>
23083 </indexterm>
23084 </para>
23085 <informaltable frame="all">
23086 <tgroup cols="4" colsep="0" rowsep="0">
23087 <colspec colwidth="8*" align="left"/>
23088 <colspec colwidth="6*" align="center"/>
23089 <colspec colwidth="6*" align="center"/>
23090 <colspec colwidth="6*" align="right"/>
23091 <tbody>
23092 <row>
23093 <entry><option>helo_accept_junk_hosts</option></entry>
23094 <entry>Use: <emphasis>main</emphasis></entry>
23095 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
23096 <entry>Default: <emphasis>unset</emphasis></entry>
23097 </row>
23098 </tbody>
23099 </tgroup>
23100 </informaltable>
23101 <para>
23102 <indexterm role="concept">
23103 <primary>HELO</primary>
23104 <secondary>accepting junk data</secondary>
23105 </indexterm>
23106 <indexterm role="concept">
23107 <primary>EHLO</primary>
23108 <secondary>accepting junk data</secondary>
23109 </indexterm>
23110 Exim checks the syntax of HELO and EHLO commands for incoming SMTP
23111 mail, and gives an error response for invalid data. Unfortunately, there are
23112 some SMTP clients that send syntactic junk. They can be accommodated by setting
23113 this option. Note that this is a syntax check only. See <option>helo_verify_hosts</option>
23114 if you want to do semantic checking.
23115 See also <option>helo_allow_chars</option> for a way of extending the permitted character
23116 set.
23117 </para>
23118 <para>
23119 <indexterm role="option">
23120 <primary><option>helo_allow_chars</option></primary>
23121 </indexterm>
23122 </para>
23123 <informaltable frame="all">
23124 <tgroup cols="4" colsep="0" rowsep="0">
23125 <colspec colwidth="8*" align="left"/>
23126 <colspec colwidth="6*" align="center"/>
23127 <colspec colwidth="6*" align="center"/>
23128 <colspec colwidth="6*" align="right"/>
23129 <tbody>
23130 <row>
23131 <entry><option>helo_allow_chars</option></entry>
23132 <entry>Use: <emphasis>main</emphasis></entry>
23133 <entry>Type: <emphasis>string</emphasis></entry>
23134 <entry>Default: <emphasis>unset</emphasis></entry>
23135 </row>
23136 </tbody>
23137 </tgroup>
23138 </informaltable>
23139 <para>
23140 <indexterm role="concept">
23141 <primary>HELO</primary>
23142 <secondary>underscores in</secondary>
23143 </indexterm>
23144 <indexterm role="concept">
23145 <primary>EHLO</primary>
23146 <secondary>underscores in</secondary>
23147 </indexterm>
23148 <indexterm role="concept">
23149 <primary>underscore in EHLO/HELO</primary>
23150 </indexterm>
23151 This option can be set to a string of rogue characters that are permitted in
23152 all EHLO and HELO names in addition to the standard letters, digits,
23153 hyphens, and dots. If you really must allow underscores, you can set
23154 </para>
23155 <literallayout class="monospaced">
23156 helo_allow_chars = _
23157 </literallayout>
23158 <para>
23159 Note that the value is one string, not a list.
23160 </para>
23161 <para>
23162 <indexterm role="option">
23163 <primary><option>helo_lookup_domains</option></primary>
23164 </indexterm>
23165 </para>
23166 <informaltable frame="all">
23167 <tgroup cols="4" colsep="0" rowsep="0">
23168 <colspec colwidth="8*" align="left"/>
23169 <colspec colwidth="6*" align="center"/>
23170 <colspec colwidth="6*" align="center"/>
23171 <colspec colwidth="6*" align="right"/>
23172 <tbody>
23173 <row>
23174 <entry><option>helo_lookup_domains</option></entry>
23175 <entry>Use: <emphasis>main</emphasis></entry>
23176 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
23177 <entry>Default: <emphasis><literal>@:@[]</literal></emphasis></entry>
23178 </row>
23179 </tbody>
23180 </tgroup>
23181 </informaltable>
23182 <para>
23183 <indexterm role="concept">
23184 <primary>HELO</primary>
23185 <secondary>forcing reverse lookup</secondary>
23186 </indexterm>
23187 <indexterm role="concept">
23188 <primary>EHLO</primary>
23189 <secondary>forcing reverse lookup</secondary>
23190 </indexterm>
23191 If the domain given by a client in a HELO or EHLO command matches this
23192 list, a reverse lookup is done in order to establish the host&#x2019;s true name. The
23193 default forces a lookup if the client host gives the server&#x2019;s name or any of
23194 its IP addresses (in brackets), something that broken clients have been seen to
23195 do.
23196 </para>
23197 <para>
23198 <indexterm role="option">
23199 <primary><option>helo_try_verify_hosts</option></primary>
23200 </indexterm>
23201 </para>
23202 <informaltable frame="all">
23203 <tgroup cols="4" colsep="0" rowsep="0">
23204 <colspec colwidth="8*" align="left"/>
23205 <colspec colwidth="6*" align="center"/>
23206 <colspec colwidth="6*" align="center"/>
23207 <colspec colwidth="6*" align="right"/>
23208 <tbody>
23209 <row>
23210 <entry><option>helo_try_verify_hosts</option></entry>
23211 <entry>Use: <emphasis>main</emphasis></entry>
23212 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
23213 <entry>Default: <emphasis>unset</emphasis></entry>
23214 </row>
23215 </tbody>
23216 </tgroup>
23217 </informaltable>
23218 <para>
23219 <indexterm role="concept">
23220 <primary>HELO verifying</primary>
23221 <secondary>optional</secondary>
23222 </indexterm>
23223 <indexterm role="concept">
23224 <primary>EHLO</primary>
23225 <secondary>verifying, optional</secondary>
23226 </indexterm>
23227 By default, Exim just checks the syntax of HELO and EHLO commands (see
23228 <option>helo_accept_junk_hosts</option> and <option>helo_allow_chars</option>). However, some sites like
23229 to do more extensive checking of the data supplied by these commands. The ACL
23230 condition <literal>verify = helo</literal> is provided to make this possible.
23231 Formerly, it was necessary also to set this option (<option>helo_try_verify_hosts</option>)
23232 to force the check to occur. From release 4.53 onwards, this is no longer
23233 necessary. If the check has not been done before <literal>verify = helo</literal> is
23234 encountered, it is done at that time. Consequently, this option is obsolete.
23235 Its specification is retained here for backwards compatibility.
23236 </para>
23237 <para>
23238 When an EHLO or HELO command is received, if the calling host matches
23239 <option>helo_try_verify_hosts</option>, Exim checks that the host name given in the HELO or
23240 EHLO command either:
23241 </para>
23242 <itemizedlist>
23243 <listitem>
23244 <para>
23245 is an IP literal matching the calling address of the host, or
23246 </para>
23247 </listitem>
23248 <listitem>
23249 <para>
23250 <indexterm role="concept">
23251 <primary>DNS</primary>
23252 <secondary>reverse lookup</secondary>
23253 </indexterm>
23254 <indexterm role="concept">
23255 <primary>reverse DNS lookup</primary>
23256 </indexterm>
23257 matches the host name that Exim obtains by doing a reverse lookup of the
23258 calling host address, or
23259 </para>
23260 </listitem>
23261 <listitem>
23262 <para>
23263 when looked up using <function>gethostbyname()</function> (or <function>getipnodebyname()</function> when
23264 available) yields the calling host address.
23265 </para>
23266 </listitem>
23267 </itemizedlist>
23268 <para>
23269 However, the EHLO or HELO command is not rejected if any of the checks
23270 fail. Processing continues, but the result of the check is remembered, and can
23271 be detected later in an ACL by the <literal>verify = helo</literal> condition.
23272 </para>
23273 <para>
23274 <indexterm role="option">
23275 <primary><option>helo_verify_hosts</option></primary>
23276 </indexterm>
23277 </para>
23278 <informaltable frame="all">
23279 <tgroup cols="4" colsep="0" rowsep="0">
23280 <colspec colwidth="8*" align="left"/>
23281 <colspec colwidth="6*" align="center"/>
23282 <colspec colwidth="6*" align="center"/>
23283 <colspec colwidth="6*" align="right"/>
23284 <tbody>
23285 <row>
23286 <entry><option>helo_verify_hosts</option></entry>
23287 <entry>Use: <emphasis>main</emphasis></entry>
23288 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
23289 <entry>Default: <emphasis>unset</emphasis></entry>
23290 </row>
23291 </tbody>
23292 </tgroup>
23293 </informaltable>
23294 <para>
23295 <indexterm role="concept">
23296 <primary>HELO verifying</primary>
23297 <secondary>mandatory</secondary>
23298 </indexterm>
23299 <indexterm role="concept">
23300 <primary>EHLO</primary>
23301 <secondary>verifying, mandatory</secondary>
23302 </indexterm>
23303 Like <option>helo_try_verify_hosts</option>, this option is obsolete, and retained only for
23304 backwards compatibility. For hosts that match this option, Exim checks the host
23305 name given in the HELO or EHLO in the same way as for
23306 <option>helo_try_verify_hosts</option>. If the check fails, the HELO or EHLO command is
23307 rejected with a 550 error, and entries are written to the main and reject logs.
23308 If a MAIL command is received before EHLO or HELO, it is rejected with a 503
23309 error.
23310 </para>
23311 <para>
23312 <indexterm role="option">
23313 <primary><option>hold_domains</option></primary>
23314 </indexterm>
23315 </para>
23316 <informaltable frame="all">
23317 <tgroup cols="4" colsep="0" rowsep="0">
23318 <colspec colwidth="8*" align="left"/>
23319 <colspec colwidth="6*" align="center"/>
23320 <colspec colwidth="6*" align="center"/>
23321 <colspec colwidth="6*" align="right"/>
23322 <tbody>
23323 <row>
23324 <entry><option>hold_domains</option></entry>
23325 <entry>Use: <emphasis>main</emphasis></entry>
23326 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
23327 <entry>Default: <emphasis>unset</emphasis></entry>
23328 </row>
23329 </tbody>
23330 </tgroup>
23331 </informaltable>
23332 <para>
23333 <indexterm role="concept">
23334 <primary>domain</primary>
23335 <secondary>delaying delivery</secondary>
23336 </indexterm>
23337 <indexterm role="concept">
23338 <primary>delivery</primary>
23339 <secondary>delaying certain domains</secondary>
23340 </indexterm>
23341 This option allows mail for particular domains to be held on the queue
23342 manually. The option is overridden if a message delivery is forced with the
23343 <option>-M</option>, <option>-qf</option>, <option>-Rf</option> or <option>-Sf</option> options, and also while testing or
23344 verifying addresses using <option>-bt</option> or <option>-bv</option>. Otherwise, if a domain matches an
23345 item in <option>hold_domains</option>, no routing or delivery for that address is done, and
23346 it is deferred every time the message is looked at.
23347 </para>
23348 <para>
23349 This option is intended as a temporary operational measure for delaying the
23350 delivery of mail while some problem is being sorted out, or some new
23351 configuration tested. If you just want to delay the processing of some
23352 domains until a queue run occurs, you should use <option>queue_domains</option> or
23353 <option>queue_smtp_domains</option>, not <option>hold_domains</option>.
23354 </para>
23355 <para>
23356 A setting of <option>hold_domains</option> does not override Exim&#x2019;s code for removing
23357 messages from the queue if they have been there longer than the longest retry
23358 time in any retry rule. If you want to hold messages for longer than the normal
23359 retry times, insert a dummy retry rule with a long retry time.
23360 </para>
23361 <para>
23362 <indexterm role="option">
23363 <primary><option>host_lookup</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>host_lookup</option></entry>
23375 <entry>Use: <emphasis>main</emphasis></entry>
23376 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
23377 <entry>Default: <emphasis>unset</emphasis></entry>
23378 </row>
23379 </tbody>
23380 </tgroup>
23381 </informaltable>
23382 <para>
23383 <indexterm role="concept">
23384 <primary>host name</primary>
23385 <secondary>lookup, forcing</secondary>
23386 </indexterm>
23387 Exim does not look up the name of a calling host from its IP address unless it
23388 is required to compare against some host list, or the host matches
23389 <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>, or the host matches this
23390 option (which normally contains IP addresses rather than host names). The
23391 default configuration file contains
23392 </para>
23393 <literallayout class="monospaced">
23394 host_lookup = *
23395 </literallayout>
23396 <para>
23397 which causes a lookup to happen for all hosts. If the expense of these lookups
23398 is felt to be too great, the setting can be changed or removed.
23399 </para>
23400 <para>
23401 After a successful reverse lookup, Exim does a forward lookup on the name it
23402 has obtained, to verify that it yields the IP address that it started with. If
23403 this check fails, Exim behaves as if the name lookup failed.
23404 </para>
23405 <para>
23406 <indexterm role="variable">
23407 <primary><varname>$host_lookup_failed</varname></primary>
23408 </indexterm>
23409 <indexterm role="variable">
23410 <primary><varname>$sender_host_name</varname></primary>
23411 </indexterm>
23412 After any kind of failure, the host name (in <varname>$sender_host_name</varname>) remains
23413 unset, and <varname>$host_lookup_failed</varname> is set to the string <quote>1</quote>. See also
23414 <option>dns_again_means_nonexist</option>, <option>helo_lookup_domains</option>, and
23415 <literal>verify = reverse_host_lookup</literal> in ACLs.
23416 </para>
23417 <para>
23418 <indexterm role="option">
23419 <primary><option>host_lookup_order</option></primary>
23420 </indexterm>
23421 </para>
23422 <informaltable frame="all">
23423 <tgroup cols="4" colsep="0" rowsep="0">
23424 <colspec colwidth="8*" align="left"/>
23425 <colspec colwidth="6*" align="center"/>
23426 <colspec colwidth="6*" align="center"/>
23427 <colspec colwidth="6*" align="right"/>
23428 <tbody>
23429 <row>
23430 <entry><option>host_lookup_order</option></entry>
23431 <entry>Use: <emphasis>main</emphasis></entry>
23432 <entry>Type: <emphasis>string list</emphasis></entry>
23433 <entry>Default: <emphasis><literal>bydns:byaddr</literal></emphasis></entry>
23434 </row>
23435 </tbody>
23436 </tgroup>
23437 </informaltable>
23438 <para>
23439 This option specifies the order of different lookup methods when Exim is trying
23440 to find a host name from an IP address. The default is to do a DNS lookup
23441 first, and then to try a local lookup (using <function>gethostbyaddr()</function> or equivalent)
23442 if that fails. You can change the order of these lookups, or omit one entirely,
23443 if you want.
23444 </para>
23445 <para>
23446 <emphasis role="bold">Warning</emphasis>: The <quote>byaddr</quote> method does not always yield aliases when there are
23447 multiple PTR records in the DNS and the IP address is not listed in
23448 <filename>/etc/hosts</filename>. Different operating systems give different results in this
23449 case. That is why the default tries a DNS lookup first.
23450 </para>
23451 <para>
23452 <indexterm role="option">
23453 <primary><option>host_reject_connection</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>host_reject_connection</option></entry>
23465 <entry>Use: <emphasis>main</emphasis></entry>
23466 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
23467 <entry>Default: <emphasis>unset</emphasis></entry>
23468 </row>
23469 </tbody>
23470 </tgroup>
23471 </informaltable>
23472 <para>
23473 <indexterm role="concept">
23474 <primary>host</primary>
23475 <secondary>rejecting connections from</secondary>
23476 </indexterm>
23477 If this option is set, incoming SMTP calls from the hosts listed are rejected
23478 as soon as the connection is made.
23479 This option is obsolete, and retained only for backward compatibility, because
23480 nowadays the ACL specified by <option>acl_smtp_connect</option> can also reject incoming
23481 connections immediately.
23482 </para>
23483 <para>
23484 The ability to give an immediate rejection (either by this option or using an
23485 ACL) is provided for use in unusual cases. Many hosts will just try again,
23486 sometimes without much delay. Normally, it is better to use an ACL to reject
23487 incoming messages at a later stage, such as after RCPT commands. See
23488 chapter <xref linkend="CHAPACL"/>.
23489 </para>
23490 <para>
23491 <indexterm role="option">
23492 <primary><option>hosts_connection_nolog</option></primary>
23493 </indexterm>
23494 </para>
23495 <informaltable frame="all">
23496 <tgroup cols="4" colsep="0" rowsep="0">
23497 <colspec colwidth="8*" align="left"/>
23498 <colspec colwidth="6*" align="center"/>
23499 <colspec colwidth="6*" align="center"/>
23500 <colspec colwidth="6*" align="right"/>
23501 <tbody>
23502 <row>
23503 <entry><option>hosts_connection_nolog</option></entry>
23504 <entry>Use: <emphasis>main</emphasis></entry>
23505 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
23506 <entry>Default: <emphasis>unset</emphasis></entry>
23507 </row>
23508 </tbody>
23509 </tgroup>
23510 </informaltable>
23511 <para>
23512 <indexterm role="concept">
23513 <primary>host</primary>
23514 <secondary>not logging connections from</secondary>
23515 </indexterm>
23516 This option defines a list of hosts for which connection logging does not
23517 happen, even though the <option>smtp_connection</option> log selector is set. For example,
23518 you might want not to log SMTP connections from local processes, or from
23519 127.0.0.1, or from your local LAN. This option is consulted in the main loop of
23520 the daemon; you should therefore strive to restrict its value to a short inline
23521 list of IP addresses and networks. To disable logging SMTP connections from
23522 local processes, you must create a host list with an empty item. For example:
23523 </para>
23524 <literallayout class="monospaced">
23525 hosts_connection_nolog = :
23526 </literallayout>
23527 <para>
23528 If the <option>smtp_connection</option> log selector is not set, this option has no effect.
23529 </para>
23530 <para>
23531 <indexterm role="option">
23532 <primary><option>hosts_treat_as_local</option></primary>
23533 </indexterm>
23534 </para>
23535 <informaltable frame="all">
23536 <tgroup cols="4" colsep="0" rowsep="0">
23537 <colspec colwidth="8*" align="left"/>
23538 <colspec colwidth="6*" align="center"/>
23539 <colspec colwidth="6*" align="center"/>
23540 <colspec colwidth="6*" align="right"/>
23541 <tbody>
23542 <row>
23543 <entry><option>hosts_treat_as_local</option></entry>
23544 <entry>Use: <emphasis>main</emphasis></entry>
23545 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
23546 <entry>Default: <emphasis>unset</emphasis></entry>
23547 </row>
23548 </tbody>
23549 </tgroup>
23550 </informaltable>
23551 <para>
23552 <indexterm role="concept">
23553 <primary>local host</primary>
23554 <secondary>domains treated as</secondary>
23555 </indexterm>
23556 <indexterm role="concept">
23557 <primary>host</primary>
23558 <secondary>treated as local</secondary>
23559 </indexterm>
23560 If this option is set, any host names that match the domain list are treated as
23561 if they were the local host when Exim is scanning host lists obtained from MX
23562 records
23563 or other sources. Note that the value of this option is a domain list, not a
23564 host list, because it is always used to check host names, not IP addresses.
23565 </para>
23566 <para>
23567 This option also applies when Exim is matching the special items
23568 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal> in a domain list (see
23569 section <xref linkend="SECTdomainlist"/>), and when checking the <option>hosts</option> option in the
23570 <command>smtp</command> transport for the local host (see the <option>allow_localhost</option> option in
23571 that transport). See also <option>local_interfaces</option>, <option>extra_local_interfaces</option>, and
23572 chapter <xref linkend="CHAPinterfaces"/>, which contains a discussion about local network
23573 interfaces and recognizing the local host.
23574 </para>
23575 <para>
23576 <indexterm role="option">
23577 <primary><option>ibase_servers</option></primary>
23578 </indexterm>
23579 </para>
23580 <informaltable frame="all">
23581 <tgroup cols="4" colsep="0" rowsep="0">
23582 <colspec colwidth="8*" align="left"/>
23583 <colspec colwidth="6*" align="center"/>
23584 <colspec colwidth="6*" align="center"/>
23585 <colspec colwidth="6*" align="right"/>
23586 <tbody>
23587 <row>
23588 <entry><option>ibase_servers</option></entry>
23589 <entry>Use: <emphasis>main</emphasis></entry>
23590 <entry>Type: <emphasis>string list</emphasis></entry>
23591 <entry>Default: <emphasis>unset</emphasis></entry>
23592 </row>
23593 </tbody>
23594 </tgroup>
23595 </informaltable>
23596 <para>
23597 <indexterm role="concept">
23598 <primary>InterBase</primary>
23599 <secondary>server list</secondary>
23600 </indexterm>
23601 This option provides a list of InterBase servers and associated connection data,
23602 to be used in conjunction with <command>ibase</command> lookups (see section <xref linkend="SECID72"/>).
23603 The option is available only if Exim has been built with InterBase support.
23604 </para>
23605 <para>
23606 <indexterm role="option">
23607 <primary><option>ignore_bounce_errors_after</option></primary>
23608 </indexterm>
23609 </para>
23610 <informaltable frame="all">
23611 <tgroup cols="4" colsep="0" rowsep="0">
23612 <colspec colwidth="8*" align="left"/>
23613 <colspec colwidth="6*" align="center"/>
23614 <colspec colwidth="6*" align="center"/>
23615 <colspec colwidth="6*" align="right"/>
23616 <tbody>
23617 <row>
23618 <entry><option>ignore_bounce_errors_after</option></entry>
23619 <entry>Use: <emphasis>main</emphasis></entry>
23620 <entry>Type: <emphasis>time</emphasis></entry>
23621 <entry>Default: <emphasis>10w</emphasis></entry>
23622 </row>
23623 </tbody>
23624 </tgroup>
23625 </informaltable>
23626 <para>
23627 <indexterm role="concept">
23628 <primary>bounce message</primary>
23629 <secondary>discarding</secondary>
23630 </indexterm>
23631 <indexterm role="concept">
23632 <primary>discarding bounce message</primary>
23633 </indexterm>
23634 This option affects the processing of bounce messages that cannot be delivered,
23635 that is, those that suffer a permanent delivery failure. (Bounce messages that
23636 suffer temporary delivery failures are of course retried in the usual way.)
23637 </para>
23638 <para>
23639 After a permanent delivery failure, bounce messages are frozen,
23640 because there is no sender to whom they can be returned. When a frozen bounce
23641 message has been on the queue for more than the given time, it is unfrozen at
23642 the next queue run, and a further delivery is attempted. If delivery fails
23643 again, the bounce message is discarded. This makes it possible to keep failed
23644 bounce messages around for a shorter time than the normal maximum retry time
23645 for frozen messages. For example,
23646 </para>
23647 <literallayout class="monospaced">
23648 ignore_bounce_errors_after = 12h
23649 </literallayout>
23650 <para>
23651 retries failed bounce message deliveries after 12 hours, discarding any further
23652 failures. If the value of this option is set to a zero time period, bounce
23653 failures are discarded immediately. Setting a very long time (as in the default
23654 value) has the effect of disabling this option. For ways of automatically
23655 dealing with other kinds of frozen message, see <option>auto_thaw</option> and
23656 <option>timeout_frozen_after</option>.
23657 </para>
23658 <para>
23659 <indexterm role="option">
23660 <primary><option>ignore_fromline_hosts</option></primary>
23661 </indexterm>
23662 </para>
23663 <informaltable frame="all">
23664 <tgroup cols="4" colsep="0" rowsep="0">
23665 <colspec colwidth="8*" align="left"/>
23666 <colspec colwidth="6*" align="center"/>
23667 <colspec colwidth="6*" align="center"/>
23668 <colspec colwidth="6*" align="right"/>
23669 <tbody>
23670 <row>
23671 <entry><option>ignore_fromline_hosts</option></entry>
23672 <entry>Use: <emphasis>main</emphasis></entry>
23673 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
23674 <entry>Default: <emphasis>unset</emphasis></entry>
23675 </row>
23676 </tbody>
23677 </tgroup>
23678 </informaltable>
23679 <para>
23680 <indexterm role="concept">
23681 <primary><quote>From</quote> line</primary>
23682 </indexterm>
23683 <indexterm role="concept">
23684 <primary>UUCP</primary>
23685 <secondary><quote>From</quote> line</secondary>
23686 </indexterm>
23687 Some broken SMTP clients insist on sending a UUCP-like <quote>From&nbsp;</quote> line before
23688 the headers of a message. By default this is treated as the start of the
23689 message&#x2019;s body, which means that any following headers are not recognized as
23690 such. Exim can be made to ignore it by setting <option>ignore_fromline_hosts</option> to
23691 match those hosts that insist on sending it. If the sender is actually a local
23692 process rather than a remote host, and is using <option>-bs</option> to inject the messages,
23693 <option>ignore_fromline_local</option> must be set to achieve this effect.
23694 </para>
23695 <para>
23696 <indexterm role="option">
23697 <primary><option>ignore_fromline_local</option></primary>
23698 </indexterm>
23699 </para>
23700 <informaltable frame="all">
23701 <tgroup cols="4" colsep="0" rowsep="0">
23702 <colspec colwidth="8*" align="left"/>
23703 <colspec colwidth="6*" align="center"/>
23704 <colspec colwidth="6*" align="center"/>
23705 <colspec colwidth="6*" align="right"/>
23706 <tbody>
23707 <row>
23708 <entry><option>ignore_fromline_local</option></entry>
23709 <entry>Use: <emphasis>main</emphasis></entry>
23710 <entry>Type: <emphasis>boolean</emphasis></entry>
23711 <entry>Default: <emphasis>false</emphasis></entry>
23712 </row>
23713 </tbody>
23714 </tgroup>
23715 </informaltable>
23716 <para>
23717 See <option>ignore_fromline_hosts</option> above.
23718 </para>
23719 <para>
23720 <indexterm role="option">
23721 <primary><option>keep_malformed</option></primary>
23722 </indexterm>
23723 </para>
23724 <informaltable frame="all">
23725 <tgroup cols="4" colsep="0" rowsep="0">
23726 <colspec colwidth="8*" align="left"/>
23727 <colspec colwidth="6*" align="center"/>
23728 <colspec colwidth="6*" align="center"/>
23729 <colspec colwidth="6*" align="right"/>
23730 <tbody>
23731 <row>
23732 <entry><option>keep_malformed</option></entry>
23733 <entry>Use: <emphasis>main</emphasis></entry>
23734 <entry>Type: <emphasis>time</emphasis></entry>
23735 <entry>Default: <emphasis>4d</emphasis></entry>
23736 </row>
23737 </tbody>
23738 </tgroup>
23739 </informaltable>
23740 <para>
23741 This option specifies the length of time to keep messages whose spool files
23742 have been corrupted in some way. This should, of course, never happen. At the
23743 next attempt to deliver such a message, it gets removed. The incident is
23744 logged.
23745 </para>
23746 <para revisionflag="changed">
23747 <indexterm role="option">
23748 <primary><option>ldap_ca_cert_dir</option></primary>
23749 </indexterm>
23750 </para>
23751 <informaltable frame="all" revisionflag="changed">
23752 <tgroup cols="4" colsep="0" rowsep="0">
23753 <colspec colwidth="8*" align="left"/>
23754 <colspec colwidth="6*" align="center"/>
23755 <colspec colwidth="6*" align="center"/>
23756 <colspec colwidth="6*" align="right"/>
23757 <tbody>
23758 <row>
23759 <entry><option>ldap_ca_cert_dir</option></entry>
23760 <entry>Use: <emphasis>main</emphasis></entry>
23761 <entry>Type: <emphasis>string</emphasis></entry>
23762 <entry>Default: <emphasis>unset</emphasis></entry>
23763 </row>
23764 </tbody>
23765 </tgroup>
23766 </informaltable>
23767 <para revisionflag="changed">
23768 <indexterm role="concept">
23769 <primary>LDAP</primary>
23770 <secondary>,</secondary>
23771 </indexterm>
23772 This option indicates which directory contains CA certificates for verifying
23773 a TLS certificate presented by an LDAP server.
23774 While Exim does not provide a default value, your SSL library may.
23775 Analogous to <option>tls_verify_certificates</option> but as a client-side option for LDAP
23776 and constrained to be a directory.
23777 </para>
23778 <para revisionflag="changed">
23779 <indexterm role="option">
23780 <primary><option>ldap_ca_cert_file</option></primary>
23781 </indexterm>
23782 </para>
23783 <informaltable frame="all" revisionflag="changed">
23784 <tgroup cols="4" colsep="0" rowsep="0">
23785 <colspec colwidth="8*" align="left"/>
23786 <colspec colwidth="6*" align="center"/>
23787 <colspec colwidth="6*" align="center"/>
23788 <colspec colwidth="6*" align="right"/>
23789 <tbody>
23790 <row>
23791 <entry><option>ldap_ca_cert_file</option></entry>
23792 <entry>Use: <emphasis>main</emphasis></entry>
23793 <entry>Type: <emphasis>string</emphasis></entry>
23794 <entry>Default: <emphasis>unset</emphasis></entry>
23795 </row>
23796 </tbody>
23797 </tgroup>
23798 </informaltable>
23799 <para revisionflag="changed">
23800 <indexterm role="concept">
23801 <primary>LDAP</primary>
23802 <secondary>,</secondary>
23803 </indexterm>
23804 This option indicates which file contains CA certificates for verifying
23805 a TLS certificate presented by an LDAP server.
23806 While Exim does not provide a default value, your SSL library may.
23807 Analogous to <option>tls_verify_certificates</option> but as a client-side option for LDAP
23808 and constrained to be a file.
23809 </para>
23810 <para revisionflag="changed">
23811 <indexterm role="option">
23812 <primary><option>ldap_cert_file</option></primary>
23813 </indexterm>
23814 </para>
23815 <informaltable frame="all" revisionflag="changed">
23816 <tgroup cols="4" colsep="0" rowsep="0">
23817 <colspec colwidth="8*" align="left"/>
23818 <colspec colwidth="6*" align="center"/>
23819 <colspec colwidth="6*" align="center"/>
23820 <colspec colwidth="6*" align="right"/>
23821 <tbody>
23822 <row>
23823 <entry><option>ldap_cert_file</option></entry>
23824 <entry>Use: <emphasis>main</emphasis></entry>
23825 <entry>Type: <emphasis>string</emphasis></entry>
23826 <entry>Default: <emphasis>unset</emphasis></entry>
23827 </row>
23828 </tbody>
23829 </tgroup>
23830 </informaltable>
23831 <para revisionflag="changed">
23832 <indexterm role="concept">
23833 <primary>LDAP</primary>
23834 <secondary>TLS client certificate file</secondary>
23835 </indexterm>
23836 This option indicates which file contains an TLS client certificate which
23837 Exim should present to the LDAP server during TLS negotiation.
23838 Should be used together with <option>ldap_cert_key</option>.
23839 </para>
23840 <para revisionflag="changed">
23841 <indexterm role="option">
23842 <primary><option>ldap_cert_key</option></primary>
23843 </indexterm>
23844 </para>
23845 <informaltable frame="all" revisionflag="changed">
23846 <tgroup cols="4" colsep="0" rowsep="0">
23847 <colspec colwidth="8*" align="left"/>
23848 <colspec colwidth="6*" align="center"/>
23849 <colspec colwidth="6*" align="center"/>
23850 <colspec colwidth="6*" align="right"/>
23851 <tbody>
23852 <row>
23853 <entry><option>ldap_cert_key</option></entry>
23854 <entry>Use: <emphasis>main</emphasis></entry>
23855 <entry>Type: <emphasis>string</emphasis></entry>
23856 <entry>Default: <emphasis>unset</emphasis></entry>
23857 </row>
23858 </tbody>
23859 </tgroup>
23860 </informaltable>
23861 <para revisionflag="changed">
23862 <indexterm role="concept">
23863 <primary>LDAP</primary>
23864 <secondary>TLS client key file</secondary>
23865 </indexterm>
23866 This option indicates which file contains the secret/private key to use
23867 to prove identity to the LDAP server during TLS negotiation.
23868 Should be used together with <option>ldap_cert_file</option>, which contains the
23869 identity to be proven.
23870 </para>
23871 <para revisionflag="changed">
23872 <indexterm role="option">
23873 <primary><option>ldap_cipher_suite</option></primary>
23874 </indexterm>
23875 </para>
23876 <informaltable frame="all" revisionflag="changed">
23877 <tgroup cols="4" colsep="0" rowsep="0">
23878 <colspec colwidth="8*" align="left"/>
23879 <colspec colwidth="6*" align="center"/>
23880 <colspec colwidth="6*" align="center"/>
23881 <colspec colwidth="6*" align="right"/>
23882 <tbody>
23883 <row>
23884 <entry><option>ldap_cipher_suite</option></entry>
23885 <entry>Use: <emphasis>main</emphasis></entry>
23886 <entry>Type: <emphasis>string</emphasis></entry>
23887 <entry>Default: <emphasis>unset</emphasis></entry>
23888 </row>
23889 </tbody>
23890 </tgroup>
23891 </informaltable>
23892 <para revisionflag="changed">
23893 <indexterm role="concept">
23894 <primary>LDAP</primary>
23895 <secondary>TLS cipher suite</secondary>
23896 </indexterm>
23897 This controls the TLS cipher-suite negotiation during TLS negotiation with
23898 the LDAP server.  See <xref linkend="SECTreqciphssl"/> for more details of the format of
23899 cipher-suite options with OpenSSL (as used by LDAP client libraries).
23900 </para>
23901 <para>
23902 <indexterm role="option">
23903 <primary><option>ldap_default_servers</option></primary>
23904 </indexterm>
23905 </para>
23906 <informaltable frame="all">
23907 <tgroup cols="4" colsep="0" rowsep="0">
23908 <colspec colwidth="8*" align="left"/>
23909 <colspec colwidth="6*" align="center"/>
23910 <colspec colwidth="6*" align="center"/>
23911 <colspec colwidth="6*" align="right"/>
23912 <tbody>
23913 <row>
23914 <entry><option>ldap_default_servers</option></entry>
23915 <entry>Use: <emphasis>main</emphasis></entry>
23916 <entry>Type: <emphasis>string list</emphasis></entry>
23917 <entry>Default: <emphasis>unset</emphasis></entry>
23918 </row>
23919 </tbody>
23920 </tgroup>
23921 </informaltable>
23922 <para>
23923 <indexterm role="concept">
23924 <primary>LDAP</primary>
23925 <secondary>default servers</secondary>
23926 </indexterm>
23927 This option provides a list of LDAP servers which are tried in turn when an
23928 LDAP query does not contain a server. See section <xref linkend="SECTforldaque"/> for
23929 details of LDAP queries. This option is available only when Exim has been built
23930 with LDAP support.
23931 </para>
23932 <para revisionflag="changed">
23933 <indexterm role="option">
23934 <primary><option>ldap_require_cert</option></primary>
23935 </indexterm>
23936 </para>
23937 <informaltable frame="all" revisionflag="changed">
23938 <tgroup cols="4" colsep="0" rowsep="0">
23939 <colspec colwidth="8*" align="left"/>
23940 <colspec colwidth="6*" align="center"/>
23941 <colspec colwidth="6*" align="center"/>
23942 <colspec colwidth="6*" align="right"/>
23943 <tbody>
23944 <row>
23945 <entry><option>ldap_require_cert</option></entry>
23946 <entry>Use: <emphasis>main</emphasis></entry>
23947 <entry>Type: <emphasis>string</emphasis></entry>
23948 <entry>Default: <emphasis>unset.</emphasis></entry>
23949 </row>
23950 </tbody>
23951 </tgroup>
23952 </informaltable>
23953 <para revisionflag="changed">
23954 <indexterm role="concept">
23955 <primary>LDAP</primary>
23956 <secondary>policy for LDAP server TLS cert presentation</secondary>
23957 </indexterm>
23958 This should be one of the values "hard", "demand", "allow", "try" or "never".
23959 A value other than one of these is interpreted as "never".
23960 See the entry "TLS_REQCERT" in your system man page for ldap.conf(5).
23961 Although Exim does not set a default, the LDAP library probably defaults
23962 to hard/demand.
23963 </para>
23964 <para revisionflag="changed">
23965 <indexterm role="option">
23966 <primary><option>ldap_start_tls</option></primary>
23967 </indexterm>
23968 </para>
23969 <informaltable frame="all" revisionflag="changed">
23970 <tgroup cols="4" colsep="0" rowsep="0">
23971 <colspec colwidth="8*" align="left"/>
23972 <colspec colwidth="6*" align="center"/>
23973 <colspec colwidth="6*" align="center"/>
23974 <colspec colwidth="6*" align="right"/>
23975 <tbody>
23976 <row>
23977 <entry><option>ldap_start_tls</option></entry>
23978 <entry>Use: <emphasis>main</emphasis></entry>
23979 <entry>Type: <emphasis>boolean</emphasis></entry>
23980 <entry>Default: <emphasis>false</emphasis></entry>
23981 </row>
23982 </tbody>
23983 </tgroup>
23984 </informaltable>
23985 <para revisionflag="changed">
23986 <indexterm role="concept">
23987 <primary>LDAP</primary>
23988 <secondary>whether or not to negotiate TLS</secondary>
23989 </indexterm>
23990 If set, Exim will attempt to negotiate TLS with the LDAP server when
23991 connecting on a regular LDAP port.  This is the LDAP equivalent of SMTP&#x2019;s
23992 "STARTTLS".  This is distinct from using "ldaps", which is the LDAP form
23993 of SSL-on-connect.
23994 In the event of failure to negotiate TLS, the action taken is controlled
23995 by <option>ldap_require_cert</option>.
23996 </para>
23997 <para>
23998 <indexterm role="option">
23999 <primary><option>ldap_version</option></primary>
24000 </indexterm>
24001 </para>
24002 <informaltable frame="all">
24003 <tgroup cols="4" colsep="0" rowsep="0">
24004 <colspec colwidth="8*" align="left"/>
24005 <colspec colwidth="6*" align="center"/>
24006 <colspec colwidth="6*" align="center"/>
24007 <colspec colwidth="6*" align="right"/>
24008 <tbody>
24009 <row>
24010 <entry><option>ldap_version</option></entry>
24011 <entry>Use: <emphasis>main</emphasis></entry>
24012 <entry>Type: <emphasis>integer</emphasis></entry>
24013 <entry>Default: <emphasis>unset</emphasis></entry>
24014 </row>
24015 </tbody>
24016 </tgroup>
24017 </informaltable>
24018 <para>
24019 <indexterm role="concept">
24020 <primary>LDAP</primary>
24021 <secondary>protocol version, forcing</secondary>
24022 </indexterm>
24023 This option can be used to force Exim to set a specific protocol version for
24024 LDAP. If it option is unset, it is shown by the <option>-bP</option> command line option as
24025 -1. When this is the case, the default is 3 if LDAP_VERSION3 is defined in
24026 the LDAP headers; otherwise it is 2. This option is available only when Exim
24027 has been built with LDAP support.
24028 </para>
24029 <para>
24030 <indexterm role="option">
24031 <primary><option>local_from_check</option></primary>
24032 </indexterm>
24033 </para>
24034 <informaltable frame="all">
24035 <tgroup cols="4" colsep="0" rowsep="0">
24036 <colspec colwidth="8*" align="left"/>
24037 <colspec colwidth="6*" align="center"/>
24038 <colspec colwidth="6*" align="center"/>
24039 <colspec colwidth="6*" align="right"/>
24040 <tbody>
24041 <row>
24042 <entry><option>local_from_check</option></entry>
24043 <entry>Use: <emphasis>main</emphasis></entry>
24044 <entry>Type: <emphasis>boolean</emphasis></entry>
24045 <entry>Default: <emphasis>true</emphasis></entry>
24046 </row>
24047 </tbody>
24048 </tgroup>
24049 </informaltable>
24050 <para>
24051 <indexterm role="concept">
24052 <primary><emphasis>Sender:</emphasis> header line</primary>
24053 <secondary>disabling addition of</secondary>
24054 </indexterm>
24055 <indexterm role="concept">
24056 <primary><emphasis>From:</emphasis> header line</primary>
24057 <secondary>disabling checking of</secondary>
24058 </indexterm>
24059 When a message is submitted locally (that is, not over a TCP/IP connection) by
24060 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line, and
24061 checks that the <emphasis>From:</emphasis> header line matches the login of the calling user and
24062 the domain specified by <option>qualify_domain</option>.
24063 </para>
24064 <para>
24065 <emphasis role="bold">Note</emphasis>: An unqualified address (no domain) in the <emphasis>From:</emphasis> header in a
24066 locally submitted message is automatically qualified by Exim, unless the
24067 <option>-bnq</option> command line option is used.
24068 </para>
24069 <para>
24070 You can use <option>local_from_prefix</option> and <option>local_from_suffix</option> to permit affixes
24071 on the local part. If the <emphasis>From:</emphasis> header line does not match, Exim adds a
24072 <emphasis>Sender:</emphasis> header with an address constructed from the calling user&#x2019;s login
24073 and the default qualify domain.
24074 </para>
24075 <para>
24076 If <option>local_from_check</option> is set false, the <emphasis>From:</emphasis> header check is disabled,
24077 and no <emphasis>Sender:</emphasis> header is ever added. If, in addition, you want to retain
24078 <emphasis>Sender:</emphasis> header lines supplied by untrusted users, you must also set
24079 <option>local_sender_retain</option> to be true.
24080 </para>
24081 <para>
24082 <indexterm role="concept">
24083 <primary>envelope sender</primary>
24084 </indexterm>
24085 These options affect only the header lines in the message. The envelope sender
24086 is still forced to be the login id at the qualify domain unless
24087 <option>untrusted_set_sender</option> permits the user to supply an envelope sender.
24088 </para>
24089 <para>
24090 For messages received over TCP/IP, an ACL can specify <quote>submission mode</quote> to
24091 request similar header line checking. See section <xref linkend="SECTthesenhea"/>, which
24092 has more details about <emphasis>Sender:</emphasis> processing.
24093 </para>
24094 <para>
24095 <indexterm role="option">
24096 <primary><option>local_from_prefix</option></primary>
24097 </indexterm>
24098 </para>
24099 <informaltable frame="all">
24100 <tgroup cols="4" colsep="0" rowsep="0">
24101 <colspec colwidth="8*" align="left"/>
24102 <colspec colwidth="6*" align="center"/>
24103 <colspec colwidth="6*" align="center"/>
24104 <colspec colwidth="6*" align="right"/>
24105 <tbody>
24106 <row>
24107 <entry><option>local_from_prefix</option></entry>
24108 <entry>Use: <emphasis>main</emphasis></entry>
24109 <entry>Type: <emphasis>string</emphasis></entry>
24110 <entry>Default: <emphasis>unset</emphasis></entry>
24111 </row>
24112 </tbody>
24113 </tgroup>
24114 </informaltable>
24115 <para>
24116 When Exim checks the <emphasis>From:</emphasis> header line of locally submitted messages for
24117 matching the login id (see <option>local_from_check</option> above), it can be configured to
24118 ignore certain prefixes and suffixes in the local part of the address. This is
24119 done by setting <option>local_from_prefix</option> and/or <option>local_from_suffix</option> to
24120 appropriate lists, in the same form as the <option>local_part_prefix</option> and
24121 <option>local_part_suffix</option> router options (see chapter <xref linkend="CHAProutergeneric"/>). For
24122 example, if
24123 </para>
24124 <literallayout class="monospaced">
24125 local_from_prefix = *-
24126 </literallayout>
24127 <para>
24128 is set, a <emphasis>From:</emphasis> line containing
24129 </para>
24130 <literallayout class="monospaced">
24131 From: anything-user@your.domain.example
24132 </literallayout>
24133 <para>
24134 will not cause a <emphasis>Sender:</emphasis> header to be added if <emphasis>user@your.domain.example</emphasis>
24135 matches the actual sender address that is constructed from the login name and
24136 qualify domain.
24137 </para>
24138 <para>
24139 <indexterm role="option">
24140 <primary><option>local_from_suffix</option></primary>
24141 </indexterm>
24142 </para>
24143 <informaltable frame="all">
24144 <tgroup cols="4" colsep="0" rowsep="0">
24145 <colspec colwidth="8*" align="left"/>
24146 <colspec colwidth="6*" align="center"/>
24147 <colspec colwidth="6*" align="center"/>
24148 <colspec colwidth="6*" align="right"/>
24149 <tbody>
24150 <row>
24151 <entry><option>local_from_suffix</option></entry>
24152 <entry>Use: <emphasis>main</emphasis></entry>
24153 <entry>Type: <emphasis>string</emphasis></entry>
24154 <entry>Default: <emphasis>unset</emphasis></entry>
24155 </row>
24156 </tbody>
24157 </tgroup>
24158 </informaltable>
24159 <para>
24160 See <option>local_from_prefix</option> above.
24161 </para>
24162 <para>
24163 <indexterm role="option">
24164 <primary><option>local_interfaces</option></primary>
24165 </indexterm>
24166 </para>
24167 <informaltable frame="all">
24168 <tgroup cols="4" colsep="0" rowsep="0">
24169 <colspec colwidth="8*" align="left"/>
24170 <colspec colwidth="6*" align="center"/>
24171 <colspec colwidth="6*" align="center"/>
24172 <colspec colwidth="6*" align="right"/>
24173 <tbody>
24174 <row>
24175 <entry><option>local_interfaces</option></entry>
24176 <entry>Use: <emphasis>main</emphasis></entry>
24177 <entry>Type: <emphasis>string list</emphasis></entry>
24178 <entry>Default: <emphasis>see below</emphasis></entry>
24179 </row>
24180 </tbody>
24181 </tgroup>
24182 </informaltable>
24183 <para>
24184 This option controls which network interfaces are used by the daemon for
24185 listening; they are also used to identify the local host when routing. Chapter
24186 <xref linkend="CHAPinterfaces"/> contains a full description of this option and the related
24187 options <option>daemon_smtp_ports</option>, <option>extra_local_interfaces</option>,
24188 <option>hosts_treat_as_local</option>, and <option>tls_on_connect_ports</option>. The default value for
24189 <option>local_interfaces</option> is
24190 </para>
24191 <literallayout class="monospaced">
24192 local_interfaces = 0.0.0.0
24193 </literallayout>
24194 <para>
24195 when Exim is built without IPv6 support; otherwise it is
24196 </para>
24197 <literallayout class="monospaced">
24198 local_interfaces = &lt;; ::0 ; 0.0.0.0
24199 </literallayout>
24200 <para>
24201 <indexterm role="option">
24202 <primary><option>local_scan_timeout</option></primary>
24203 </indexterm>
24204 </para>
24205 <informaltable frame="all">
24206 <tgroup cols="4" colsep="0" rowsep="0">
24207 <colspec colwidth="8*" align="left"/>
24208 <colspec colwidth="6*" align="center"/>
24209 <colspec colwidth="6*" align="center"/>
24210 <colspec colwidth="6*" align="right"/>
24211 <tbody>
24212 <row>
24213 <entry><option>local_scan_timeout</option></entry>
24214 <entry>Use: <emphasis>main</emphasis></entry>
24215 <entry>Type: <emphasis>time</emphasis></entry>
24216 <entry>Default: <emphasis>5m</emphasis></entry>
24217 </row>
24218 </tbody>
24219 </tgroup>
24220 </informaltable>
24221 <para>
24222 <indexterm role="concept">
24223 <primary>timeout</primary>
24224 <secondary>for <function>local_scan()</function> function</secondary>
24225 </indexterm>
24226 <indexterm role="concept">
24227 <primary><function>local_scan()</function> function</primary>
24228 <secondary>timeout</secondary>
24229 </indexterm>
24230 This timeout applies to the <function>local_scan()</function> function (see chapter
24231 <xref linkend="CHAPlocalscan"/>). Zero means <quote>no timeout</quote>. If the timeout is exceeded,
24232 the incoming message is rejected with a temporary error if it is an SMTP
24233 message. For a non-SMTP message, the message is dropped and Exim ends with a
24234 non-zero code. The incident is logged on the main and reject logs.
24235 </para>
24236 <para>
24237 <indexterm role="option">
24238 <primary><option>local_sender_retain</option></primary>
24239 </indexterm>
24240 </para>
24241 <informaltable frame="all">
24242 <tgroup cols="4" colsep="0" rowsep="0">
24243 <colspec colwidth="8*" align="left"/>
24244 <colspec colwidth="6*" align="center"/>
24245 <colspec colwidth="6*" align="center"/>
24246 <colspec colwidth="6*" align="right"/>
24247 <tbody>
24248 <row>
24249 <entry><option>local_sender_retain</option></entry>
24250 <entry>Use: <emphasis>main</emphasis></entry>
24251 <entry>Type: <emphasis>boolean</emphasis></entry>
24252 <entry>Default: <emphasis>false</emphasis></entry>
24253 </row>
24254 </tbody>
24255 </tgroup>
24256 </informaltable>
24257 <para>
24258 <indexterm role="concept">
24259 <primary><emphasis>Sender:</emphasis> header line</primary>
24260 <secondary>retaining from local submission</secondary>
24261 </indexterm>
24262 When a message is submitted locally (that is, not over a TCP/IP connection) by
24263 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line. If you
24264 do not want this to happen, you must set <option>local_sender_retain</option>, and you must
24265 also set <option>local_from_check</option> to be false (Exim will complain if you do not).
24266 See also the ACL modifier <literal>control = suppress_local_fixups</literal>. Section
24267 <xref linkend="SECTthesenhea"/> has more details about <emphasis>Sender:</emphasis> processing.
24268 </para>
24269 <para>
24270 <indexterm role="option">
24271 <primary><option>localhost_number</option></primary>
24272 </indexterm>
24273 </para>
24274 <informaltable frame="all">
24275 <tgroup cols="4" colsep="0" rowsep="0">
24276 <colspec colwidth="8*" align="left"/>
24277 <colspec colwidth="6*" align="center"/>
24278 <colspec colwidth="6*" align="center"/>
24279 <colspec colwidth="6*" align="right"/>
24280 <tbody>
24281 <row>
24282 <entry><option>localhost_number</option></entry>
24283 <entry>Use: <emphasis>main</emphasis></entry>
24284 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24285 <entry>Default: <emphasis>unset</emphasis></entry>
24286 </row>
24287 </tbody>
24288 </tgroup>
24289 </informaltable>
24290 <para>
24291 <indexterm role="concept">
24292 <primary>host</primary>
24293 <secondary>locally unique number for</secondary>
24294 </indexterm>
24295 <indexterm role="concept">
24296 <primary>message ids</primary>
24297 <secondary>with multiple hosts</secondary>
24298 </indexterm>
24299 <indexterm role="variable">
24300 <primary><varname>$localhost_number</varname></primary>
24301 </indexterm>
24302 Exim&#x2019;s message ids are normally unique only within the local host. If
24303 uniqueness among a set of hosts is required, each host must set a different
24304 value for the <option>localhost_number</option> option. The string is expanded immediately
24305 after reading the configuration file (so that a number can be computed from the
24306 host name, for example) and the result of the expansion must be a number in the
24307 range 0&ndash;16 (or 0&ndash;10 on operating systems with case-insensitive file
24308 systems). This is available in subsequent string expansions via the variable
24309 <varname>$localhost_number</varname>. When <option>localhost_number is set</option>, the final two
24310 characters of the message id, instead of just being a fractional part of the
24311 time, are computed from the time and the local host number as described in
24312 section <xref linkend="SECTmessiden"/>.
24313 </para>
24314 <para>
24315 <indexterm role="option">
24316 <primary><option>log_file_path</option></primary>
24317 </indexterm>
24318 </para>
24319 <informaltable frame="all">
24320 <tgroup cols="4" colsep="0" rowsep="0">
24321 <colspec colwidth="8*" align="left"/>
24322 <colspec colwidth="6*" align="center"/>
24323 <colspec colwidth="6*" align="center"/>
24324 <colspec colwidth="6*" align="right"/>
24325 <tbody>
24326 <row>
24327 <entry><option>log_file_path</option></entry>
24328 <entry>Use: <emphasis>main</emphasis></entry>
24329 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
24330 <entry>Default: <emphasis>set at compile time</emphasis></entry>
24331 </row>
24332 </tbody>
24333 </tgroup>
24334 </informaltable>
24335 <para>
24336 <indexterm role="concept">
24337 <primary>log</primary>
24338 <secondary>file path for</secondary>
24339 </indexterm>
24340 This option sets the path which is used to determine the names of Exim&#x2019;s log
24341 files, or indicates that logging is to be to syslog, or both. It is expanded
24342 when Exim is entered, so it can, for example, contain a reference to the host
24343 name. If no specific path is set for the log files at compile or run time, they
24344 are written in a sub-directory called <filename>log</filename> in Exim&#x2019;s spool directory.
24345 Chapter <xref linkend="CHAPlog"/> contains further details about Exim&#x2019;s logging, and
24346 section <xref linkend="SECTwhelogwri"/> describes how the contents of <option>log_file_path</option> are
24347 used. If this string is fixed at your installation (contains no expansion
24348 variables) it is recommended that you do not set this option in the
24349 configuration file, but instead supply the path using LOG_FILE_PATH in
24350 <filename>Local/Makefile</filename> so that it is available to Exim for logging errors detected
24351 early on &ndash; in particular, failure to read the configuration file.
24352 </para>
24353 <para>
24354 <indexterm role="option">
24355 <primary><option>log_selector</option></primary>
24356 </indexterm>
24357 </para>
24358 <informaltable frame="all">
24359 <tgroup cols="4" colsep="0" rowsep="0">
24360 <colspec colwidth="8*" align="left"/>
24361 <colspec colwidth="6*" align="center"/>
24362 <colspec colwidth="6*" align="center"/>
24363 <colspec colwidth="6*" align="right"/>
24364 <tbody>
24365 <row>
24366 <entry><option>log_selector</option></entry>
24367 <entry>Use: <emphasis>main</emphasis></entry>
24368 <entry>Type: <emphasis>string</emphasis></entry>
24369 <entry>Default: <emphasis>unset</emphasis></entry>
24370 </row>
24371 </tbody>
24372 </tgroup>
24373 </informaltable>
24374 <para>
24375 <indexterm role="concept">
24376 <primary>log</primary>
24377 <secondary>selectors</secondary>
24378 </indexterm>
24379 This option can be used to reduce or increase the number of things that Exim
24380 writes to its log files. Its argument is made up of names preceded by plus or
24381 minus characters. For example:
24382 </para>
24383 <literallayout class="monospaced">
24384 log_selector = +arguments -retry_defer
24385 </literallayout>
24386 <para>
24387 A list of possible names and what they control is given in the chapter on
24388 logging, in section <xref linkend="SECTlogselector"/>.
24389 </para>
24390 <para>
24391 <indexterm role="option">
24392 <primary><option>log_timezone</option></primary>
24393 </indexterm>
24394 </para>
24395 <informaltable frame="all">
24396 <tgroup cols="4" colsep="0" rowsep="0">
24397 <colspec colwidth="8*" align="left"/>
24398 <colspec colwidth="6*" align="center"/>
24399 <colspec colwidth="6*" align="center"/>
24400 <colspec colwidth="6*" align="right"/>
24401 <tbody>
24402 <row>
24403 <entry><option>log_timezone</option></entry>
24404 <entry>Use: <emphasis>main</emphasis></entry>
24405 <entry>Type: <emphasis>boolean</emphasis></entry>
24406 <entry>Default: <emphasis>false</emphasis></entry>
24407 </row>
24408 </tbody>
24409 </tgroup>
24410 </informaltable>
24411 <para>
24412 <indexterm role="concept">
24413 <primary>log</primary>
24414 <secondary>timezone for entries</secondary>
24415 </indexterm>
24416 <indexterm role="variable">
24417 <primary><varname>$tod_log</varname></primary>
24418 </indexterm>
24419 <indexterm role="variable">
24420 <primary><varname>$tod_zone</varname></primary>
24421 </indexterm>
24422 By default, the timestamps on log lines are in local time without the
24423 timezone. This means that if your timezone changes twice a year, the timestamps
24424 in log lines are ambiguous for an hour when the clocks go back. One way of
24425 avoiding this problem is to set the timezone to UTC. An alternative is to set
24426 <option>log_timezone</option> true. This turns on the addition of the timezone offset to
24427 timestamps in log lines. Turning on this option can add quite a lot to the size
24428 of log files because each line is extended by 6 characters. Note that the
24429 <varname>$tod_log</varname> variable contains the log timestamp without the zone, but there is
24430 another variable called <varname>$tod_zone</varname> that contains just the timezone offset.
24431 </para>
24432 <para>
24433 <indexterm role="option">
24434 <primary><option>lookup_open_max</option></primary>
24435 </indexterm>
24436 </para>
24437 <informaltable frame="all">
24438 <tgroup cols="4" colsep="0" rowsep="0">
24439 <colspec colwidth="8*" align="left"/>
24440 <colspec colwidth="6*" align="center"/>
24441 <colspec colwidth="6*" align="center"/>
24442 <colspec colwidth="6*" align="right"/>
24443 <tbody>
24444 <row>
24445 <entry><option>lookup_open_max</option></entry>
24446 <entry>Use: <emphasis>main</emphasis></entry>
24447 <entry>Type: <emphasis>integer</emphasis></entry>
24448 <entry>Default: <emphasis>25</emphasis></entry>
24449 </row>
24450 </tbody>
24451 </tgroup>
24452 </informaltable>
24453 <para>
24454 <indexterm role="concept">
24455 <primary>too many open files</primary>
24456 </indexterm>
24457 <indexterm role="concept">
24458 <primary>open files, too many</primary>
24459 </indexterm>
24460 <indexterm role="concept">
24461 <primary>file</primary>
24462 <secondary>too many open</secondary>
24463 </indexterm>
24464 <indexterm role="concept">
24465 <primary>lookup</primary>
24466 <secondary>maximum open files</secondary>
24467 </indexterm>
24468 <indexterm role="concept">
24469 <primary>limit</primary>
24470 <secondary>open files for lookups</secondary>
24471 </indexterm>
24472 This option limits the number of simultaneously open files for single-key
24473 lookups that use regular files (that is, <command>lsearch</command>, <command>dbm</command>, and <command>cdb</command>).
24474 Exim normally keeps these files open during routing, because often the same
24475 file is required several times. If the limit is reached, Exim closes the least
24476 recently used file. Note that if you are using the <emphasis>ndbm</emphasis> library, it
24477 actually opens two files for each logical DBM database, though it still counts
24478 as one for the purposes of <option>lookup_open_max</option>. If you are getting <quote>too many
24479 open files</quote> errors with NDBM, you need to reduce the value of
24480 <option>lookup_open_max</option>.
24481 </para>
24482 <para>
24483 <indexterm role="option">
24484 <primary><option>max_username_length</option></primary>
24485 </indexterm>
24486 </para>
24487 <informaltable frame="all">
24488 <tgroup cols="4" colsep="0" rowsep="0">
24489 <colspec colwidth="8*" align="left"/>
24490 <colspec colwidth="6*" align="center"/>
24491 <colspec colwidth="6*" align="center"/>
24492 <colspec colwidth="6*" align="right"/>
24493 <tbody>
24494 <row>
24495 <entry><option>max_username_length</option></entry>
24496 <entry>Use: <emphasis>main</emphasis></entry>
24497 <entry>Type: <emphasis>integer</emphasis></entry>
24498 <entry>Default: <emphasis>0</emphasis></entry>
24499 </row>
24500 </tbody>
24501 </tgroup>
24502 </informaltable>
24503 <para>
24504 <indexterm role="concept">
24505 <primary>length of login name</primary>
24506 </indexterm>
24507 <indexterm role="concept">
24508 <primary>user name</primary>
24509 <secondary>maximum length</secondary>
24510 </indexterm>
24511 <indexterm role="concept">
24512 <primary>limit</primary>
24513 <secondary>user name length</secondary>
24514 </indexterm>
24515 Some operating systems are broken in that they truncate long arguments to
24516 <function>getpwnam()</function> to eight characters, instead of returning <quote>no such user</quote>. If
24517 this option is set greater than zero, any attempt to call <function>getpwnam()</function> with
24518 an argument that is longer behaves as if <function>getpwnam()</function> failed.
24519 </para>
24520 <para>
24521 <indexterm role="option">
24522 <primary><option>message_body_newlines</option></primary>
24523 </indexterm>
24524 </para>
24525 <informaltable frame="all">
24526 <tgroup cols="4" colsep="0" rowsep="0">
24527 <colspec colwidth="8*" align="left"/>
24528 <colspec colwidth="6*" align="center"/>
24529 <colspec colwidth="6*" align="center"/>
24530 <colspec colwidth="6*" align="right"/>
24531 <tbody>
24532 <row>
24533 <entry><option>message_body_newlines</option></entry>
24534 <entry>Use: <emphasis>main</emphasis></entry>
24535 <entry>Type: <emphasis>bool</emphasis></entry>
24536 <entry>Default: <emphasis>false</emphasis></entry>
24537 </row>
24538 </tbody>
24539 </tgroup>
24540 </informaltable>
24541 <para>
24542 <indexterm role="concept">
24543 <primary>message body</primary>
24544 <secondary>newlines in variables</secondary>
24545 </indexterm>
24546 <indexterm role="concept">
24547 <primary>newline</primary>
24548 <secondary>in message body variables</secondary>
24549 </indexterm>
24550 <indexterm role="variable">
24551 <primary><varname>$message_body</varname></primary>
24552 </indexterm>
24553 <indexterm role="variable">
24554 <primary><varname>$message_body_end</varname></primary>
24555 </indexterm>
24556 By default, newlines in the message body are replaced by spaces when setting
24557 the <varname>$message_body</varname> and <varname>$message_body_end</varname> expansion variables. If this
24558 option is set true, this no longer happens.
24559 </para>
24560 <para>
24561 <indexterm role="option">
24562 <primary><option>message_body_visible</option></primary>
24563 </indexterm>
24564 </para>
24565 <informaltable frame="all">
24566 <tgroup cols="4" colsep="0" rowsep="0">
24567 <colspec colwidth="8*" align="left"/>
24568 <colspec colwidth="6*" align="center"/>
24569 <colspec colwidth="6*" align="center"/>
24570 <colspec colwidth="6*" align="right"/>
24571 <tbody>
24572 <row>
24573 <entry><option>message_body_visible</option></entry>
24574 <entry>Use: <emphasis>main</emphasis></entry>
24575 <entry>Type: <emphasis>integer</emphasis></entry>
24576 <entry>Default: <emphasis>500</emphasis></entry>
24577 </row>
24578 </tbody>
24579 </tgroup>
24580 </informaltable>
24581 <para>
24582 <indexterm role="concept">
24583 <primary>body of message</primary>
24584 <secondary>visible size</secondary>
24585 </indexterm>
24586 <indexterm role="concept">
24587 <primary>message body</primary>
24588 <secondary>visible size</secondary>
24589 </indexterm>
24590 <indexterm role="variable">
24591 <primary><varname>$message_body</varname></primary>
24592 </indexterm>
24593 <indexterm role="variable">
24594 <primary><varname>$message_body_end</varname></primary>
24595 </indexterm>
24596 This option specifies how much of a message&#x2019;s body is to be included in the
24597 <varname>$message_body</varname> and <varname>$message_body_end</varname> expansion variables.
24598 </para>
24599 <para>
24600 <indexterm role="option">
24601 <primary><option>message_id_header_domain</option></primary>
24602 </indexterm>
24603 </para>
24604 <informaltable frame="all">
24605 <tgroup cols="4" colsep="0" rowsep="0">
24606 <colspec colwidth="8*" align="left"/>
24607 <colspec colwidth="6*" align="center"/>
24608 <colspec colwidth="6*" align="center"/>
24609 <colspec colwidth="6*" align="right"/>
24610 <tbody>
24611 <row>
24612 <entry><option>message_id_header_domain</option></entry>
24613 <entry>Use: <emphasis>main</emphasis></entry>
24614 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24615 <entry>Default: <emphasis>unset</emphasis></entry>
24616 </row>
24617 </tbody>
24618 </tgroup>
24619 </informaltable>
24620 <para>
24621 <indexterm role="concept">
24622 <primary><emphasis>Message-ID:</emphasis> header line</primary>
24623 </indexterm>
24624 If this option is set, the string is expanded and used as the right hand side
24625 (domain) of the <emphasis>Message-ID:</emphasis> header that Exim creates if a
24626 locally-originated incoming message does not have one. <quote>Locally-originated</quote>
24627 means <quote>not received over TCP/IP.</quote>
24628 Otherwise, the primary host name is used.
24629 Only letters, digits, dot and hyphen are accepted; any other characters are
24630 replaced by hyphens. If the expansion is forced to fail, or if the result is an
24631 empty string, the option is ignored.
24632 </para>
24633 <para>
24634 <indexterm role="option">
24635 <primary><option>message_id_header_text</option></primary>
24636 </indexterm>
24637 </para>
24638 <informaltable frame="all">
24639 <tgroup cols="4" colsep="0" rowsep="0">
24640 <colspec colwidth="8*" align="left"/>
24641 <colspec colwidth="6*" align="center"/>
24642 <colspec colwidth="6*" align="center"/>
24643 <colspec colwidth="6*" align="right"/>
24644 <tbody>
24645 <row>
24646 <entry><option>message_id_header_text</option></entry>
24647 <entry>Use: <emphasis>main</emphasis></entry>
24648 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24649 <entry>Default: <emphasis>unset</emphasis></entry>
24650 </row>
24651 </tbody>
24652 </tgroup>
24653 </informaltable>
24654 <para>
24655 If this variable is set, the string is expanded and used to augment the text of
24656 the <emphasis>Message-id:</emphasis> header that Exim creates if a locally-originated incoming
24657 message does not have one. The text of this header is required by RFC 2822 to
24658 take the form of an address. By default, Exim uses its internal message id as
24659 the local part, and the primary host name as the domain. If this option is set,
24660 it is expanded, and provided the expansion is not forced to fail, and does not
24661 yield an empty string, the result is inserted into the header immediately
24662 before the @, separated from the internal message id by a dot. Any characters
24663 that are illegal in an address are automatically converted into hyphens. This
24664 means that variables such as <varname>$tod_log</varname> can be used, because the spaces and
24665 colons will become hyphens.
24666 </para>
24667 <para>
24668 <indexterm role="option">
24669 <primary><option>message_logs</option></primary>
24670 </indexterm>
24671 </para>
24672 <informaltable frame="all">
24673 <tgroup cols="4" colsep="0" rowsep="0">
24674 <colspec colwidth="8*" align="left"/>
24675 <colspec colwidth="6*" align="center"/>
24676 <colspec colwidth="6*" align="center"/>
24677 <colspec colwidth="6*" align="right"/>
24678 <tbody>
24679 <row>
24680 <entry><option>message_logs</option></entry>
24681 <entry>Use: <emphasis>main</emphasis></entry>
24682 <entry>Type: <emphasis>boolean</emphasis></entry>
24683 <entry>Default: <emphasis>true</emphasis></entry>
24684 </row>
24685 </tbody>
24686 </tgroup>
24687 </informaltable>
24688 <para>
24689 <indexterm role="concept">
24690 <primary>message logs</primary>
24691 <secondary>disabling</secondary>
24692 </indexterm>
24693 <indexterm role="concept">
24694 <primary>log</primary>
24695 <secondary>message log; disabling</secondary>
24696 </indexterm>
24697 If this option is turned off, per-message log files are not created in the
24698 <filename>msglog</filename> spool sub-directory. This reduces the amount of disk I/O required by
24699 Exim, by reducing the number of files involved in handling a message from a
24700 minimum of four (header spool file, body spool file, delivery journal, and
24701 per-message log) to three. The other major I/O activity is Exim&#x2019;s main log,
24702 which is not affected by this option.
24703 </para>
24704 <para>
24705 <indexterm role="option">
24706 <primary><option>message_size_limit</option></primary>
24707 </indexterm>
24708 </para>
24709 <informaltable frame="all">
24710 <tgroup cols="4" colsep="0" rowsep="0">
24711 <colspec colwidth="8*" align="left"/>
24712 <colspec colwidth="6*" align="center"/>
24713 <colspec colwidth="6*" align="center"/>
24714 <colspec colwidth="6*" align="right"/>
24715 <tbody>
24716 <row>
24717 <entry><option>message_size_limit</option></entry>
24718 <entry>Use: <emphasis>main</emphasis></entry>
24719 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24720 <entry>Default: <emphasis>50M</emphasis></entry>
24721 </row>
24722 </tbody>
24723 </tgroup>
24724 </informaltable>
24725 <para>
24726 <indexterm role="concept">
24727 <primary>message</primary>
24728 <secondary>size limit</secondary>
24729 </indexterm>
24730 <indexterm role="concept">
24731 <primary>limit</primary>
24732 <secondary>message size</secondary>
24733 </indexterm>
24734 <indexterm role="concept">
24735 <primary>size</primary>
24736 <secondary>of message, limit</secondary>
24737 </indexterm>
24738 This option limits the maximum size of message that Exim will process. The
24739 value is expanded for each incoming connection so, for example, it can be made
24740 to depend on the IP address of the remote host for messages arriving via
24741 TCP/IP. After expansion, the value must be a sequence of decimal digits,
24742 optionally followed by K or M.
24743 </para>
24744 <para>
24745 <emphasis role="bold">Note</emphasis>: This limit cannot be made to depend on a message&#x2019;s sender or any
24746 other properties of an individual message, because it has to be advertised in
24747 the server&#x2019;s response to EHLO. String expansion failure causes a temporary
24748 error. A value of zero means no limit, but its use is not recommended. See also
24749 <option>bounce_return_size_limit</option>.
24750 </para>
24751 <para>
24752 Incoming SMTP messages are failed with a 552 error if the limit is
24753 exceeded; locally-generated messages either get a stderr message or a delivery
24754 failure message to the sender, depending on the <option>-oe</option> setting. Rejection of
24755 an oversized message is logged in both the main and the reject logs. See also
24756 the generic transport option <option>message_size_limit</option>, which limits the size of
24757 message that an individual transport can process.
24758 </para>
24759 <para revisionflag="changed">
24760 If you use a virus-scanner and set this option to to a value larger than the
24761 maximum size that your virus-scanner is configured to support, you may get
24762 failures triggered by large mails.  The right size to configure for the
24763 virus-scanner depends upon what data is passed and the options in use but it&#x2019;s
24764 probably safest to just set it to a little larger than this value.  Eg, with a
24765 default Exim message size of 50M and a default ClamAV StreamMaxLength of 10M,
24766 some problems may result.
24767 </para>
24768 <para>
24769 <indexterm role="option">
24770 <primary><option>move_frozen_messages</option></primary>
24771 </indexterm>
24772 </para>
24773 <informaltable frame="all">
24774 <tgroup cols="4" colsep="0" rowsep="0">
24775 <colspec colwidth="8*" align="left"/>
24776 <colspec colwidth="6*" align="center"/>
24777 <colspec colwidth="6*" align="center"/>
24778 <colspec colwidth="6*" align="right"/>
24779 <tbody>
24780 <row>
24781 <entry><option>move_frozen_messages</option></entry>
24782 <entry>Use: <emphasis>main</emphasis></entry>
24783 <entry>Type: <emphasis>boolean</emphasis></entry>
24784 <entry>Default: <emphasis>false</emphasis></entry>
24785 </row>
24786 </tbody>
24787 </tgroup>
24788 </informaltable>
24789 <para>
24790 <indexterm role="concept">
24791 <primary>frozen messages</primary>
24792 <secondary>moving</secondary>
24793 </indexterm>
24794 This option, which is available only if Exim has been built with the setting
24795 </para>
24796 <literallayout class="monospaced">
24797 SUPPORT_MOVE_FROZEN_MESSAGES=yes
24798 </literallayout>
24799 <para>
24800 in <filename>Local/Makefile</filename>, causes frozen messages and their message logs to be
24801 moved from the <filename>input</filename> and <filename>msglog</filename> directories on the spool to <filename>Finput</filename>
24802 and <filename>Fmsglog</filename>, respectively. There is currently no support in Exim or the
24803 standard utilities for handling such moved messages, and they do not show up in
24804 lists generated by <option>-bp</option> or by the Exim monitor.
24805 </para>
24806 <para>
24807 <indexterm role="option">
24808 <primary><option>mua_wrapper</option></primary>
24809 </indexterm>
24810 </para>
24811 <informaltable frame="all">
24812 <tgroup cols="4" colsep="0" rowsep="0">
24813 <colspec colwidth="8*" align="left"/>
24814 <colspec colwidth="6*" align="center"/>
24815 <colspec colwidth="6*" align="center"/>
24816 <colspec colwidth="6*" align="right"/>
24817 <tbody>
24818 <row>
24819 <entry><option>mua_wrapper</option></entry>
24820 <entry>Use: <emphasis>main</emphasis></entry>
24821 <entry>Type: <emphasis>boolean</emphasis></entry>
24822 <entry>Default: <emphasis>false</emphasis></entry>
24823 </row>
24824 </tbody>
24825 </tgroup>
24826 </informaltable>
24827 <para>
24828 Setting this option true causes Exim to run in a very restrictive mode in which
24829 it passes messages synchronously to a smart host. Chapter <xref linkend="CHAPnonqueueing"/>
24830 contains a full description of this facility.
24831 </para>
24832 <para>
24833 <indexterm role="option">
24834 <primary><option>mysql_servers</option></primary>
24835 </indexterm>
24836 </para>
24837 <informaltable frame="all">
24838 <tgroup cols="4" colsep="0" rowsep="0">
24839 <colspec colwidth="8*" align="left"/>
24840 <colspec colwidth="6*" align="center"/>
24841 <colspec colwidth="6*" align="center"/>
24842 <colspec colwidth="6*" align="right"/>
24843 <tbody>
24844 <row>
24845 <entry><option>mysql_servers</option></entry>
24846 <entry>Use: <emphasis>main</emphasis></entry>
24847 <entry>Type: <emphasis>string list</emphasis></entry>
24848 <entry>Default: <emphasis>unset</emphasis></entry>
24849 </row>
24850 </tbody>
24851 </tgroup>
24852 </informaltable>
24853 <para>
24854 <indexterm role="concept">
24855 <primary>MySQL</primary>
24856 <secondary>server list</secondary>
24857 </indexterm>
24858 This option provides a list of MySQL servers and associated connection data, to
24859 be used in conjunction with <command>mysql</command> lookups (see section <xref linkend="SECID72"/>). The
24860 option is available only if Exim has been built with MySQL support.
24861 </para>
24862 <para>
24863 <indexterm role="option">
24864 <primary><option>never_users</option></primary>
24865 </indexterm>
24866 </para>
24867 <informaltable frame="all">
24868 <tgroup cols="4" colsep="0" rowsep="0">
24869 <colspec colwidth="8*" align="left"/>
24870 <colspec colwidth="6*" align="center"/>
24871 <colspec colwidth="6*" align="center"/>
24872 <colspec colwidth="6*" align="right"/>
24873 <tbody>
24874 <row>
24875 <entry><option>never_users</option></entry>
24876 <entry>Use: <emphasis>main</emphasis></entry>
24877 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
24878 <entry>Default: <emphasis>unset</emphasis></entry>
24879 </row>
24880 </tbody>
24881 </tgroup>
24882 </informaltable>
24883 <para>
24884 This option is expanded just once, at the start of Exim&#x2019;s processing. Local
24885 message deliveries are normally run in processes that are setuid to the
24886 recipient, and remote deliveries are normally run under Exim&#x2019;s own uid and gid.
24887 It is usually desirable to prevent any deliveries from running as root, as a
24888 safety precaution.
24889 </para>
24890 <para>
24891 When Exim is built, an option called FIXED_NEVER_USERS can be set to a
24892 list of users that must not be used for local deliveries. This list is fixed in
24893 the binary and cannot be overridden by the configuration file. By default, it
24894 contains just the single user name <quote>root</quote>. The <option>never_users</option> runtime option
24895 can be used to add more users to the fixed list.
24896 </para>
24897 <para>
24898 If a message is to be delivered as one of the users on the fixed list or the
24899 <option>never_users</option> list, an error occurs, and delivery is deferred. A common
24900 example is
24901 </para>
24902 <literallayout class="monospaced">
24903 never_users = root:daemon:bin
24904 </literallayout>
24905 <para>
24906 Including root is redundant if it is also on the fixed list, but it does no
24907 harm. This option overrides the <option>pipe_as_creator</option> option of the <command>pipe</command>
24908 transport driver.
24909 </para>
24910 <para revisionflag="changed">
24911 <indexterm role="option">
24912 <primary><option>openssl_options</option></primary>
24913 </indexterm>
24914 </para>
24915 <informaltable frame="all" revisionflag="changed">
24916 <tgroup cols="4" colsep="0" rowsep="0">
24917 <colspec colwidth="8*" align="left"/>
24918 <colspec colwidth="6*" align="center"/>
24919 <colspec colwidth="6*" align="center"/>
24920 <colspec colwidth="6*" align="right"/>
24921 <tbody>
24922 <row>
24923 <entry><option>openssl_options</option></entry>
24924 <entry>Use: <emphasis>main</emphasis></entry>
24925 <entry>Type: <emphasis>string list</emphasis></entry>
24926 <entry>Default: <emphasis>+dont_insert_empty_fragments</emphasis></entry>
24927 </row>
24928 </tbody>
24929 </tgroup>
24930 </informaltable>
24931 <para revisionflag="changed">
24932 <indexterm role="concept">
24933 <primary>OpenSSL </primary>
24934 <secondary>compatibility</secondary>
24935 </indexterm>
24936 This option allows an administrator to adjust the SSL options applied
24937 by OpenSSL to connections.  It is given as a space-separated list of items,
24938 each one to be +added or -subtracted from the current value.  The default
24939 value is one option which happens to have been set historically.  You can
24940 remove all options with:
24941 </para>
24942 <literallayout class="monospaced" revisionflag="changed">
24943 openssl_options = -all
24944 </literallayout>
24945 <para revisionflag="changed">
24946 This option is only available if Exim is built against OpenSSL.  The values
24947 available for this option vary according to the age of your OpenSSL install.
24948 The <quote>all</quote> value controls a subset of flags which are available, typically
24949 the bug workaround options.  The <emphasis>SSL_CTX_set_options</emphasis> man page will
24950 list the values known on your system and Exim should support all the
24951 <quote>bug workaround</quote> options and many of the <quote>modifying</quote> options.  The Exim
24952 names lose the leading <quote>SSL_OP_</quote> and are lower-cased.
24953 </para>
24954 <para revisionflag="changed">
24955 Note that adjusting the options can have severe impact upon the security of
24956 SSL as used by Exim.  It is possible to disable safety checks and shoot
24957 yourself in the foot in various unpleasant ways.  This option should not be
24958 adjusted lightly.  An unrecognised item will be detected at by invoking Exim
24959 with the <option>-bV</option> flag.
24960 </para>
24961 <para revisionflag="changed">
24962 An example:
24963 </para>
24964 <literallayout class="monospaced" revisionflag="changed">
24965 openssl_options = -all +microsoft_big_sslv3_buffer
24966 </literallayout>
24967 <para>
24968 <indexterm role="option">
24969 <primary><option>oracle_servers</option></primary>
24970 </indexterm>
24971 </para>
24972 <informaltable frame="all">
24973 <tgroup cols="4" colsep="0" rowsep="0">
24974 <colspec colwidth="8*" align="left"/>
24975 <colspec colwidth="6*" align="center"/>
24976 <colspec colwidth="6*" align="center"/>
24977 <colspec colwidth="6*" align="right"/>
24978 <tbody>
24979 <row>
24980 <entry><option>oracle_servers</option></entry>
24981 <entry>Use: <emphasis>main</emphasis></entry>
24982 <entry>Type: <emphasis>string list</emphasis></entry>
24983 <entry>Default: <emphasis>unset</emphasis></entry>
24984 </row>
24985 </tbody>
24986 </tgroup>
24987 </informaltable>
24988 <para>
24989 <indexterm role="concept">
24990 <primary>Oracle</primary>
24991 <secondary>server list</secondary>
24992 </indexterm>
24993 This option provides a list of Oracle servers and associated connection data,
24994 to be used in conjunction with <command>oracle</command> lookups (see section <xref linkend="SECID72"/>).
24995 The option is available only if Exim has been built with Oracle support.
24996 </para>
24997 <para>
24998 <indexterm role="option">
24999 <primary><option>percent_hack_domains</option></primary>
25000 </indexterm>
25001 </para>
25002 <informaltable frame="all">
25003 <tgroup cols="4" colsep="0" rowsep="0">
25004 <colspec colwidth="8*" align="left"/>
25005 <colspec colwidth="6*" align="center"/>
25006 <colspec colwidth="6*" align="center"/>
25007 <colspec colwidth="6*" align="right"/>
25008 <tbody>
25009 <row>
25010 <entry><option>percent_hack_domains</option></entry>
25011 <entry>Use: <emphasis>main</emphasis></entry>
25012 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
25013 <entry>Default: <emphasis>unset</emphasis></entry>
25014 </row>
25015 </tbody>
25016 </tgroup>
25017 </informaltable>
25018 <para>
25019 <indexterm role="concept">
25020 <primary><quote>percent hack</quote></primary>
25021 </indexterm>
25022 <indexterm role="concept">
25023 <primary>source routing</primary>
25024 <secondary>in email address</secondary>
25025 </indexterm>
25026 <indexterm role="concept">
25027 <primary>address</primary>
25028 <secondary>source-routed</secondary>
25029 </indexterm>
25030 The <quote>percent hack</quote> is the convention whereby a local part containing a
25031 percent sign is re-interpreted as a new email address, with the percent
25032 replaced by @. This is sometimes called <quote>source routing</quote>, though that term is
25033 also applied to RFC 2822 addresses that begin with an @ character. If this
25034 option is set, Exim implements the percent facility for those domains listed,
25035 but no others. This happens before an incoming SMTP address is tested against
25036 an ACL.
25037 </para>
25038 <para>
25039 <emphasis role="bold">Warning</emphasis>: The <quote>percent hack</quote> has often been abused by people who are
25040 trying to get round relaying restrictions. For this reason, it is best avoided
25041 if at all possible. Unfortunately, a number of less security-conscious MTAs
25042 implement it unconditionally. If you are running Exim on a gateway host, and
25043 routing mail through to internal MTAs without processing the local parts, it is
25044 a good idea to reject recipient addresses with percent characters in their
25045 local parts. Exim&#x2019;s default configuration does this.
25046 </para>
25047 <para>
25048 <indexterm role="option">
25049 <primary><option>perl_at_start</option></primary>
25050 </indexterm>
25051 </para>
25052 <informaltable frame="all">
25053 <tgroup cols="4" colsep="0" rowsep="0">
25054 <colspec colwidth="8*" align="left"/>
25055 <colspec colwidth="6*" align="center"/>
25056 <colspec colwidth="6*" align="center"/>
25057 <colspec colwidth="6*" align="right"/>
25058 <tbody>
25059 <row>
25060 <entry><option>perl_at_start</option></entry>
25061 <entry>Use: <emphasis>main</emphasis></entry>
25062 <entry>Type: <emphasis>boolean</emphasis></entry>
25063 <entry>Default: <emphasis>false</emphasis></entry>
25064 </row>
25065 </tbody>
25066 </tgroup>
25067 </informaltable>
25068 <para>
25069 This option is available only when Exim is built with an embedded Perl
25070 interpreter. See chapter <xref linkend="CHAPperl"/> for details of its use.
25071 </para>
25072 <para>
25073 <indexterm role="option">
25074 <primary><option>perl_startup</option></primary>
25075 </indexterm>
25076 </para>
25077 <informaltable frame="all">
25078 <tgroup cols="4" colsep="0" rowsep="0">
25079 <colspec colwidth="8*" align="left"/>
25080 <colspec colwidth="6*" align="center"/>
25081 <colspec colwidth="6*" align="center"/>
25082 <colspec colwidth="6*" align="right"/>
25083 <tbody>
25084 <row>
25085 <entry><option>perl_startup</option></entry>
25086 <entry>Use: <emphasis>main</emphasis></entry>
25087 <entry>Type: <emphasis>string</emphasis></entry>
25088 <entry>Default: <emphasis>unset</emphasis></entry>
25089 </row>
25090 </tbody>
25091 </tgroup>
25092 </informaltable>
25093 <para>
25094 This option is available only when Exim is built with an embedded Perl
25095 interpreter. See chapter <xref linkend="CHAPperl"/> for details of its use.
25096 </para>
25097 <para>
25098 <indexterm role="option">
25099 <primary><option>pgsql_servers</option></primary>
25100 </indexterm>
25101 </para>
25102 <informaltable frame="all">
25103 <tgroup cols="4" colsep="0" rowsep="0">
25104 <colspec colwidth="8*" align="left"/>
25105 <colspec colwidth="6*" align="center"/>
25106 <colspec colwidth="6*" align="center"/>
25107 <colspec colwidth="6*" align="right"/>
25108 <tbody>
25109 <row>
25110 <entry><option>pgsql_servers</option></entry>
25111 <entry>Use: <emphasis>main</emphasis></entry>
25112 <entry>Type: <emphasis>string list</emphasis></entry>
25113 <entry>Default: <emphasis>unset</emphasis></entry>
25114 </row>
25115 </tbody>
25116 </tgroup>
25117 </informaltable>
25118 <para>
25119 <indexterm role="concept">
25120 <primary>PostgreSQL lookup type</primary>
25121 <secondary>server list</secondary>
25122 </indexterm>
25123 This option provides a list of PostgreSQL servers and associated connection
25124 data, to be used in conjunction with <command>pgsql</command> lookups (see section
25125 <xref linkend="SECID72"/>). The option is available only if Exim has been built with
25126 PostgreSQL support.
25127 </para>
25128 <para>
25129 <indexterm role="option">
25130 <primary><option>pid_file_path</option></primary>
25131 </indexterm>
25132 </para>
25133 <informaltable frame="all">
25134 <tgroup cols="4" colsep="0" rowsep="0">
25135 <colspec colwidth="8*" align="left"/>
25136 <colspec colwidth="6*" align="center"/>
25137 <colspec colwidth="6*" align="center"/>
25138 <colspec colwidth="6*" align="right"/>
25139 <tbody>
25140 <row>
25141 <entry><option>pid_file_path</option></entry>
25142 <entry>Use: <emphasis>main</emphasis></entry>
25143 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25144 <entry>Default: <emphasis>set at compile time</emphasis></entry>
25145 </row>
25146 </tbody>
25147 </tgroup>
25148 </informaltable>
25149 <para>
25150 <indexterm role="concept">
25151 <primary>daemon</primary>
25152 <secondary>pid file path</secondary>
25153 </indexterm>
25154 <indexterm role="concept">
25155 <primary>pid file, path for</primary>
25156 </indexterm>
25157 This option sets the name of the file to which the Exim daemon writes its
25158 process id. The string is expanded, so it can contain, for example, references
25159 to the host name:
25160 </para>
25161 <literallayout class="monospaced">
25162 pid_file_path = /var/log/$primary_hostname/exim.pid
25163 </literallayout>
25164 <para>
25165 If no path is set, the pid is written to the file <filename>exim-daemon.pid</filename> in Exim&#x2019;s
25166 spool directory.
25167 The value set by the option can be overridden by the <option>-oP</option> command line
25168 option. A pid file is not written if a <quote>non-standard</quote> daemon is run by means
25169 of the <option>-oX</option> option, unless a path is explicitly supplied by <option>-oP</option>.
25170 </para>
25171 <para>
25172 <indexterm role="option">
25173 <primary><option>pipelining_advertise_hosts</option></primary>
25174 </indexterm>
25175 </para>
25176 <informaltable frame="all">
25177 <tgroup cols="4" colsep="0" rowsep="0">
25178 <colspec colwidth="8*" align="left"/>
25179 <colspec colwidth="6*" align="center"/>
25180 <colspec colwidth="6*" align="center"/>
25181 <colspec colwidth="6*" align="right"/>
25182 <tbody>
25183 <row>
25184 <entry><option>pipelining_advertise_hosts</option></entry>
25185 <entry>Use: <emphasis>main</emphasis></entry>
25186 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
25187 <entry>Default: <emphasis>*</emphasis></entry>
25188 </row>
25189 </tbody>
25190 </tgroup>
25191 </informaltable>
25192 <para>
25193 <indexterm role="concept">
25194 <primary>PIPELINING</primary>
25195 <secondary>suppressing advertising</secondary>
25196 </indexterm>
25197 This option can be used to suppress the advertisement of the SMTP
25198 PIPELINING extension to specific hosts. See also the <emphasis role="bold">no_pipelining</emphasis>
25199 control in section <xref linkend="SECTcontrols"/>. When PIPELINING is not advertised and
25200 <option>smtp_enforce_sync</option> is true, an Exim server enforces strict synchronization
25201 for each SMTP command and response. When PIPELINING is advertised, Exim assumes
25202 that clients will use it; <quote>out of order</quote> commands that are <quote>expected</quote> do
25203 not count as protocol errors (see <option>smtp_max_synprot_errors</option>).
25204 </para>
25205 <para>
25206 <indexterm role="option">
25207 <primary><option>preserve_message_logs</option></primary>
25208 </indexterm>
25209 </para>
25210 <informaltable frame="all">
25211 <tgroup cols="4" colsep="0" rowsep="0">
25212 <colspec colwidth="8*" align="left"/>
25213 <colspec colwidth="6*" align="center"/>
25214 <colspec colwidth="6*" align="center"/>
25215 <colspec colwidth="6*" align="right"/>
25216 <tbody>
25217 <row>
25218 <entry><option>preserve_message_logs</option></entry>
25219 <entry>Use: <emphasis>main</emphasis></entry>
25220 <entry>Type: <emphasis>boolean</emphasis></entry>
25221 <entry>Default: <emphasis>false</emphasis></entry>
25222 </row>
25223 </tbody>
25224 </tgroup>
25225 </informaltable>
25226 <para>
25227 <indexterm role="concept">
25228 <primary>message logs</primary>
25229 <secondary>preserving</secondary>
25230 </indexterm>
25231 If this option is set, message log files are not deleted when messages are
25232 completed. Instead, they are moved to a sub-directory of the spool directory
25233 called <filename>msglog.OLD</filename>, where they remain available for statistical or debugging
25234 purposes. This is a dangerous option to set on systems with any appreciable
25235 volume of mail. Use with care!
25236 </para>
25237 <para>
25238 <indexterm role="option">
25239 <primary><option>primary_hostname</option></primary>
25240 </indexterm>
25241 </para>
25242 <informaltable frame="all">
25243 <tgroup cols="4" colsep="0" rowsep="0">
25244 <colspec colwidth="8*" align="left"/>
25245 <colspec colwidth="6*" align="center"/>
25246 <colspec colwidth="6*" align="center"/>
25247 <colspec colwidth="6*" align="right"/>
25248 <tbody>
25249 <row>
25250 <entry><option>primary_hostname</option></entry>
25251 <entry>Use: <emphasis>main</emphasis></entry>
25252 <entry>Type: <emphasis>string</emphasis></entry>
25253 <entry>Default: <emphasis>see below</emphasis></entry>
25254 </row>
25255 </tbody>
25256 </tgroup>
25257 </informaltable>
25258 <para>
25259 <indexterm role="concept">
25260 <primary>name</primary>
25261 <secondary>of local host</secondary>
25262 </indexterm>
25263 <indexterm role="concept">
25264 <primary>host</primary>
25265 <secondary>name of local</secondary>
25266 </indexterm>
25267 <indexterm role="concept">
25268 <primary>local host</primary>
25269 <secondary>name of</secondary>
25270 </indexterm>
25271 <indexterm role="variable">
25272 <primary><varname>$primary_hostname</varname></primary>
25273 </indexterm>
25274 This specifies the name of the current host. It is used in the default EHLO or
25275 HELO command for outgoing SMTP messages (changeable via the <option>helo_data</option>
25276 option in the <command>smtp</command> transport), and as the default for <option>qualify_domain</option>.
25277 The value is also used by default in some SMTP response messages from an Exim
25278 server. This can be changed dynamically by setting <option>smtp_active_hostname</option>.
25279 </para>
25280 <para>
25281 If <option>primary_hostname</option> is not set, Exim calls <function>uname()</function> to find the host
25282 name. If this fails, Exim panics and dies. If the name returned by <function>uname()</function>
25283 contains only one component, Exim passes it to <function>gethostbyname()</function> (or
25284 <function>getipnodebyname()</function> when available) in order to obtain the fully qualified
25285 version. The variable <varname>$primary_hostname</varname> contains the host name, whether set
25286 explicitly by this option, or defaulted.
25287 </para>
25288 <para>
25289 <indexterm role="option">
25290 <primary><option>print_topbitchars</option></primary>
25291 </indexterm>
25292 </para>
25293 <informaltable frame="all">
25294 <tgroup cols="4" colsep="0" rowsep="0">
25295 <colspec colwidth="8*" align="left"/>
25296 <colspec colwidth="6*" align="center"/>
25297 <colspec colwidth="6*" align="center"/>
25298 <colspec colwidth="6*" align="right"/>
25299 <tbody>
25300 <row>
25301 <entry><option>print_topbitchars</option></entry>
25302 <entry>Use: <emphasis>main</emphasis></entry>
25303 <entry>Type: <emphasis>boolean</emphasis></entry>
25304 <entry>Default: <emphasis>false</emphasis></entry>
25305 </row>
25306 </tbody>
25307 </tgroup>
25308 </informaltable>
25309 <para>
25310 <indexterm role="concept">
25311 <primary>printing characters</primary>
25312 </indexterm>
25313 <indexterm role="concept">
25314 <primary>8-bit characters</primary>
25315 </indexterm>
25316 By default, Exim considers only those characters whose codes lie in the range
25317 32&ndash;126 to be printing characters. In a number of circumstances (for example,
25318 when writing log entries) non-printing characters are converted into escape
25319 sequences, primarily to avoid messing up the layout. If <option>print_topbitchars</option>
25320 is set, code values of 128 and above are also considered to be printing
25321 characters.
25322 </para>
25323 <para>
25324 This option also affects the header syntax checks performed by the
25325 <command>autoreply</command> transport, and whether Exim uses RFC 2047 encoding of
25326 the user&#x2019;s full name when constructing From: and Sender: addresses (as
25327 described in section <xref linkend="SECTconstr"/>). Setting this option can cause
25328 Exim to generate eight bit message headers that do not conform to the
25329 standards.
25330 </para>
25331 <para>
25332 <indexterm role="option">
25333 <primary><option>process_log_path</option></primary>
25334 </indexterm>
25335 </para>
25336 <informaltable frame="all">
25337 <tgroup cols="4" colsep="0" rowsep="0">
25338 <colspec colwidth="8*" align="left"/>
25339 <colspec colwidth="6*" align="center"/>
25340 <colspec colwidth="6*" align="center"/>
25341 <colspec colwidth="6*" align="right"/>
25342 <tbody>
25343 <row>
25344 <entry><option>process_log_path</option></entry>
25345 <entry>Use: <emphasis>main</emphasis></entry>
25346 <entry>Type: <emphasis>string</emphasis></entry>
25347 <entry>Default: <emphasis>unset</emphasis></entry>
25348 </row>
25349 </tbody>
25350 </tgroup>
25351 </informaltable>
25352 <para>
25353 <indexterm role="concept">
25354 <primary>process log path</primary>
25355 </indexterm>
25356 <indexterm role="concept">
25357 <primary>log</primary>
25358 <secondary>process log</secondary>
25359 </indexterm>
25360 <indexterm role="concept">
25361 <primary><emphasis>exiwhat</emphasis></primary>
25362 </indexterm>
25363 This option sets the name of the file to which an Exim process writes its
25364 <quote>process log</quote> when sent a USR1 signal. This is used by the <emphasis>exiwhat</emphasis>
25365 utility script. If this option is unset, the file called <filename>exim-process.info</filename>
25366 in Exim&#x2019;s spool directory is used. The ability to specify the name explicitly
25367 can be useful in environments where two different Exims are running, using
25368 different spool directories.
25369 </para>
25370 <para>
25371 <indexterm role="option">
25372 <primary><option>prod_requires_admin</option></primary>
25373 </indexterm>
25374 </para>
25375 <informaltable frame="all">
25376 <tgroup cols="4" colsep="0" rowsep="0">
25377 <colspec colwidth="8*" align="left"/>
25378 <colspec colwidth="6*" align="center"/>
25379 <colspec colwidth="6*" align="center"/>
25380 <colspec colwidth="6*" align="right"/>
25381 <tbody>
25382 <row>
25383 <entry><option>prod_requires_admin</option></entry>
25384 <entry>Use: <emphasis>main</emphasis></entry>
25385 <entry>Type: <emphasis>boolean</emphasis></entry>
25386 <entry>Default: <emphasis>true</emphasis></entry>
25387 </row>
25388 </tbody>
25389 </tgroup>
25390 </informaltable>
25391 <para>
25392 <indexterm role="option">
25393 <primary><option>-M</option></primary>
25394 </indexterm>
25395 <indexterm role="option">
25396 <primary><option>-R</option></primary>
25397 </indexterm>
25398 <indexterm role="option">
25399 <primary><option>-q</option></primary>
25400 </indexterm>
25401 The <option>-M</option>, <option>-R</option>, and <option>-q</option> command-line options require the caller to be an
25402 admin user unless <option>prod_requires_admin</option> is set false. See also
25403 <option>queue_list_requires_admin</option>.
25404 </para>
25405 <para>
25406 <indexterm role="option">
25407 <primary><option>qualify_domain</option></primary>
25408 </indexterm>
25409 </para>
25410 <informaltable frame="all">
25411 <tgroup cols="4" colsep="0" rowsep="0">
25412 <colspec colwidth="8*" align="left"/>
25413 <colspec colwidth="6*" align="center"/>
25414 <colspec colwidth="6*" align="center"/>
25415 <colspec colwidth="6*" align="right"/>
25416 <tbody>
25417 <row>
25418 <entry><option>qualify_domain</option></entry>
25419 <entry>Use: <emphasis>main</emphasis></entry>
25420 <entry>Type: <emphasis>string</emphasis></entry>
25421 <entry>Default: <emphasis>see below</emphasis></entry>
25422 </row>
25423 </tbody>
25424 </tgroup>
25425 </informaltable>
25426 <para>
25427 <indexterm role="concept">
25428 <primary>domain</primary>
25429 <secondary>for qualifying addresses</secondary>
25430 </indexterm>
25431 <indexterm role="concept">
25432 <primary>address</primary>
25433 <secondary>qualification</secondary>
25434 </indexterm>
25435 This option specifies the domain name that is added to any envelope sender
25436 addresses that do not have a domain qualification. It also applies to
25437 recipient addresses if <option>qualify_recipient</option> is not set. Unqualified addresses
25438 are accepted by default only for locally-generated messages. Qualification is
25439 also applied to addresses in header lines such as <emphasis>From:</emphasis> and <emphasis>To:</emphasis> for
25440 locally-generated messages, unless the <option>-bnq</option> command line option is used.
25441 </para>
25442 <para>
25443 Messages from external sources must always contain fully qualified addresses,
25444 unless the sending host matches <option>sender_unqualified_hosts</option> or
25445 <option>recipient_unqualified_hosts</option> (as appropriate), in which case incoming
25446 addresses are qualified with <option>qualify_domain</option> or <option>qualify_recipient</option> as
25447 necessary. Internally, Exim always works with fully qualified envelope
25448 addresses. If <option>qualify_domain</option> is not set, it defaults to the
25449 <option>primary_hostname</option> value.
25450 </para>
25451 <para>
25452 <indexterm role="option">
25453 <primary><option>qualify_recipient</option></primary>
25454 </indexterm>
25455 </para>
25456 <informaltable frame="all">
25457 <tgroup cols="4" colsep="0" rowsep="0">
25458 <colspec colwidth="8*" align="left"/>
25459 <colspec colwidth="6*" align="center"/>
25460 <colspec colwidth="6*" align="center"/>
25461 <colspec colwidth="6*" align="right"/>
25462 <tbody>
25463 <row>
25464 <entry><option>qualify_recipient</option></entry>
25465 <entry>Use: <emphasis>main</emphasis></entry>
25466 <entry>Type: <emphasis>string</emphasis></entry>
25467 <entry>Default: <emphasis>see below</emphasis></entry>
25468 </row>
25469 </tbody>
25470 </tgroup>
25471 </informaltable>
25472 <para>
25473 This option allows you to specify a different domain for qualifying recipient
25474 addresses to the one that is used for senders. See <option>qualify_domain</option> above.
25475 </para>
25476 <para>
25477 <indexterm role="option">
25478 <primary><option>queue_domains</option></primary>
25479 </indexterm>
25480 </para>
25481 <informaltable frame="all">
25482 <tgroup cols="4" colsep="0" rowsep="0">
25483 <colspec colwidth="8*" align="left"/>
25484 <colspec colwidth="6*" align="center"/>
25485 <colspec colwidth="6*" align="center"/>
25486 <colspec colwidth="6*" align="right"/>
25487 <tbody>
25488 <row>
25489 <entry><option>queue_domains</option></entry>
25490 <entry>Use: <emphasis>main</emphasis></entry>
25491 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
25492 <entry>Default: <emphasis>unset</emphasis></entry>
25493 </row>
25494 </tbody>
25495 </tgroup>
25496 </informaltable>
25497 <para>
25498 <indexterm role="concept">
25499 <primary>domain</primary>
25500 <secondary>specifying non-immediate delivery</secondary>
25501 </indexterm>
25502 <indexterm role="concept">
25503 <primary>queueing incoming messages</primary>
25504 </indexterm>
25505 <indexterm role="concept">
25506 <primary>message</primary>
25507 <secondary>queueing certain domains</secondary>
25508 </indexterm>
25509 This option lists domains for which immediate delivery is not required.
25510 A delivery process is started whenever a message is received, but only those
25511 domains that do not match are processed. All other deliveries wait until the
25512 next queue run. See also <option>hold_domains</option> and <option>queue_smtp_domains</option>.
25513 </para>
25514 <para>
25515 <indexterm role="option">
25516 <primary><option>queue_list_requires_admin</option></primary>
25517 </indexterm>
25518 </para>
25519 <informaltable frame="all">
25520 <tgroup cols="4" colsep="0" rowsep="0">
25521 <colspec colwidth="8*" align="left"/>
25522 <colspec colwidth="6*" align="center"/>
25523 <colspec colwidth="6*" align="center"/>
25524 <colspec colwidth="6*" align="right"/>
25525 <tbody>
25526 <row>
25527 <entry><option>queue_list_requires_admin</option></entry>
25528 <entry>Use: <emphasis>main</emphasis></entry>
25529 <entry>Type: <emphasis>boolean</emphasis></entry>
25530 <entry>Default: <emphasis>true</emphasis></entry>
25531 </row>
25532 </tbody>
25533 </tgroup>
25534 </informaltable>
25535 <para>
25536 <indexterm role="option">
25537 <primary><option>-bp</option></primary>
25538 </indexterm>
25539 The <option>-bp</option> command-line option, which lists the messages that are on the
25540 queue, requires the caller to be an admin user unless
25541 <option>queue_list_requires_admin</option> is set false. See also <option>prod_requires_admin</option>.
25542 </para>
25543 <para>
25544 <indexterm role="option">
25545 <primary><option>queue_only</option></primary>
25546 </indexterm>
25547 </para>
25548 <informaltable frame="all">
25549 <tgroup cols="4" colsep="0" rowsep="0">
25550 <colspec colwidth="8*" align="left"/>
25551 <colspec colwidth="6*" align="center"/>
25552 <colspec colwidth="6*" align="center"/>
25553 <colspec colwidth="6*" align="right"/>
25554 <tbody>
25555 <row>
25556 <entry><option>queue_only</option></entry>
25557 <entry>Use: <emphasis>main</emphasis></entry>
25558 <entry>Type: <emphasis>boolean</emphasis></entry>
25559 <entry>Default: <emphasis>false</emphasis></entry>
25560 </row>
25561 </tbody>
25562 </tgroup>
25563 </informaltable>
25564 <para>
25565 <indexterm role="concept">
25566 <primary>queueing incoming messages</primary>
25567 </indexterm>
25568 <indexterm role="concept">
25569 <primary>message</primary>
25570 <secondary>queueing unconditionally</secondary>
25571 </indexterm>
25572 If <option>queue_only</option> is set, a delivery process is not automatically started
25573 whenever a message is received. Instead, the message waits on the queue for the
25574 next queue run. Even if <option>queue_only</option> is false, incoming messages may not get
25575 delivered immediately when certain conditions (such as heavy load) occur.
25576 </para>
25577 <para>
25578 The <option>-odq</option> command line has the same effect as <option>queue_only</option>. The <option>-odb</option>
25579 and <option>-odi</option> command line options override <option>queue_only</option> unless
25580 <option>queue_only_override</option> is set false. See also <option>queue_only_file</option>,
25581 <option>queue_only_load</option>, and <option>smtp_accept_queue</option>.
25582 </para>
25583 <para>
25584 <indexterm role="option">
25585 <primary><option>queue_only_file</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>queue_only_file</option></entry>
25597 <entry>Use: <emphasis>main</emphasis></entry>
25598 <entry>Type: <emphasis>string</emphasis></entry>
25599 <entry>Default: <emphasis>unset</emphasis></entry>
25600 </row>
25601 </tbody>
25602 </tgroup>
25603 </informaltable>
25604 <para>
25605 <indexterm role="concept">
25606 <primary>queueing incoming messages</primary>
25607 </indexterm>
25608 <indexterm role="concept">
25609 <primary>message</primary>
25610 <secondary>queueing by file existence</secondary>
25611 </indexterm>
25612 This option can be set to a colon-separated list of absolute path names, each
25613 one optionally preceded by <quote>smtp</quote>. When Exim is receiving a message,
25614 it tests for the existence of each listed path using a call to <function>stat()</function>. For
25615 each path that exists, the corresponding queueing option is set.
25616 For paths with no prefix, <option>queue_only</option> is set; for paths prefixed by
25617 <quote>smtp</quote>, <option>queue_smtp_domains</option> is set to match all domains. So, for example,
25618 </para>
25619 <literallayout class="monospaced">
25620 queue_only_file = smtp/some/file
25621 </literallayout>
25622 <para>
25623 causes Exim to behave as if <option>queue_smtp_domains</option> were set to <quote>*</quote> whenever
25624 <filename>/some/file</filename> exists.
25625 </para>
25626 <para>
25627 <indexterm role="option">
25628 <primary><option>queue_only_load</option></primary>
25629 </indexterm>
25630 </para>
25631 <informaltable frame="all">
25632 <tgroup cols="4" colsep="0" rowsep="0">
25633 <colspec colwidth="8*" align="left"/>
25634 <colspec colwidth="6*" align="center"/>
25635 <colspec colwidth="6*" align="center"/>
25636 <colspec colwidth="6*" align="right"/>
25637 <tbody>
25638 <row>
25639 <entry><option>queue_only_load</option></entry>
25640 <entry>Use: <emphasis>main</emphasis></entry>
25641 <entry>Type: <emphasis>fixed-point</emphasis></entry>
25642 <entry>Default: <emphasis>unset</emphasis></entry>
25643 </row>
25644 </tbody>
25645 </tgroup>
25646 </informaltable>
25647 <para>
25648 <indexterm role="concept">
25649 <primary>load average</primary>
25650 </indexterm>
25651 <indexterm role="concept">
25652 <primary>queueing incoming messages</primary>
25653 </indexterm>
25654 <indexterm role="concept">
25655 <primary>message</primary>
25656 <secondary>queueing by load</secondary>
25657 </indexterm>
25658 If the system load average is higher than this value, incoming messages from
25659 all sources are queued, and no automatic deliveries are started. If this
25660 happens during local or remote SMTP input, all subsequent messages received on
25661 the same SMTP connection are queued by default, whatever happens to the load in
25662 the meantime, but this can be changed by setting <option>queue_only_load_latch</option>
25663 false.
25664 </para>
25665 <para>
25666 Deliveries will subsequently be performed by queue runner processes. This
25667 option has no effect on ancient operating systems on which Exim cannot
25668 determine the load average. See also <option>deliver_queue_load_max</option> and
25669 <option>smtp_load_reserve</option>.
25670 </para>
25671 <para>
25672 <indexterm role="option">
25673 <primary><option>queue_only_load_latch</option></primary>
25674 </indexterm>
25675 </para>
25676 <informaltable frame="all">
25677 <tgroup cols="4" colsep="0" rowsep="0">
25678 <colspec colwidth="8*" align="left"/>
25679 <colspec colwidth="6*" align="center"/>
25680 <colspec colwidth="6*" align="center"/>
25681 <colspec colwidth="6*" align="right"/>
25682 <tbody>
25683 <row>
25684 <entry><option>queue_only_load_latch</option></entry>
25685 <entry>Use: <emphasis>main</emphasis></entry>
25686 <entry>Type: <emphasis>boolean</emphasis></entry>
25687 <entry>Default: <emphasis>true</emphasis></entry>
25688 </row>
25689 </tbody>
25690 </tgroup>
25691 </informaltable>
25692 <para>
25693 <indexterm role="concept">
25694 <primary>load average</primary>
25695 <secondary>re-evaluating per message</secondary>
25696 </indexterm>
25697 When this option is true (the default), once one message has been queued
25698 because the load average is higher than the value set by <option>queue_only_load</option>,
25699 all subsequent messages received on the same SMTP connection are also queued.
25700 This is a deliberate choice; even though the load average may fall below the
25701 threshold, it doesn&#x2019;t seem right to deliver later messages on the same
25702 connection when not delivering earlier ones. However, there are special
25703 circumstances such as very long-lived connections from scanning appliances
25704 where this is not the best strategy. In such cases, <option>queue_only_load_latch</option>
25705 should be set false. This causes the value of the load average to be
25706 re-evaluated for each message.
25707 </para>
25708 <para>
25709 <indexterm role="option">
25710 <primary><option>queue_only_override</option></primary>
25711 </indexterm>
25712 </para>
25713 <informaltable frame="all">
25714 <tgroup cols="4" colsep="0" rowsep="0">
25715 <colspec colwidth="8*" align="left"/>
25716 <colspec colwidth="6*" align="center"/>
25717 <colspec colwidth="6*" align="center"/>
25718 <colspec colwidth="6*" align="right"/>
25719 <tbody>
25720 <row>
25721 <entry><option>queue_only_override</option></entry>
25722 <entry>Use: <emphasis>main</emphasis></entry>
25723 <entry>Type: <emphasis>boolean</emphasis></entry>
25724 <entry>Default: <emphasis>true</emphasis></entry>
25725 </row>
25726 </tbody>
25727 </tgroup>
25728 </informaltable>
25729 <para>
25730 <indexterm role="concept">
25731 <primary>queueing incoming messages</primary>
25732 </indexterm>
25733 When this option is true, the <option>-od</option><emphasis>x</emphasis> command line options override the
25734 setting of <option>queue_only</option> or <option>queue_only_file</option> in the configuration file. If
25735 <option>queue_only_override</option> is set false, the <option>-od</option><emphasis>x</emphasis> options cannot be used
25736 to override; they are accepted, but ignored.
25737 </para>
25738 <para>
25739 <indexterm role="option">
25740 <primary><option>queue_run_in_order</option></primary>
25741 </indexterm>
25742 </para>
25743 <informaltable frame="all">
25744 <tgroup cols="4" colsep="0" rowsep="0">
25745 <colspec colwidth="8*" align="left"/>
25746 <colspec colwidth="6*" align="center"/>
25747 <colspec colwidth="6*" align="center"/>
25748 <colspec colwidth="6*" align="right"/>
25749 <tbody>
25750 <row>
25751 <entry><option>queue_run_in_order</option></entry>
25752 <entry>Use: <emphasis>main</emphasis></entry>
25753 <entry>Type: <emphasis>boolean</emphasis></entry>
25754 <entry>Default: <emphasis>false</emphasis></entry>
25755 </row>
25756 </tbody>
25757 </tgroup>
25758 </informaltable>
25759 <para>
25760 <indexterm role="concept">
25761 <primary>queue runner</primary>
25762 <secondary>processing messages in order</secondary>
25763 </indexterm>
25764 If this option is set, queue runs happen in order of message arrival instead of
25765 in an arbitrary order. For this to happen, a complete list of the entire queue
25766 must be set up before the deliveries start. When the queue is all held in a
25767 single directory (the default), a single list is created for both the ordered
25768 and the non-ordered cases. However, if <option>split_spool_directory</option> is set, a
25769 single list is not created when <option>queue_run_in_order</option> is false. In this case,
25770 the sub-directories are processed one at a time (in a random order), and this
25771 avoids setting up one huge list for the whole queue. Thus, setting
25772 <option>queue_run_in_order</option> with <option>split_spool_directory</option> may degrade performance
25773 when the queue is large, because of the extra work in setting up the single,
25774 large list. In most situations, <option>queue_run_in_order</option> should not be set.
25775 </para>
25776 <para>
25777 <indexterm role="option">
25778 <primary><option>queue_run_max</option></primary>
25779 </indexterm>
25780 </para>
25781 <informaltable frame="all">
25782 <tgroup cols="4" colsep="0" rowsep="0">
25783 <colspec colwidth="8*" align="left"/>
25784 <colspec colwidth="6*" align="center"/>
25785 <colspec colwidth="6*" align="center"/>
25786 <colspec colwidth="6*" align="right"/>
25787 <tbody>
25788 <row>
25789 <entry><option>queue_run_max</option></entry>
25790 <entry>Use: <emphasis>main</emphasis></entry>
25791 <entry>Type: <emphasis>integer</emphasis></entry>
25792 <entry>Default: <emphasis>5</emphasis></entry>
25793 </row>
25794 </tbody>
25795 </tgroup>
25796 </informaltable>
25797 <para>
25798 <indexterm role="concept">
25799 <primary>queue runner</primary>
25800 <secondary>maximum number of</secondary>
25801 </indexterm>
25802 This controls the maximum number of queue runner processes that an Exim daemon
25803 can run simultaneously. This does not mean that it starts them all at once,
25804 but rather that if the maximum number are still running when the time comes to
25805 start another one, it refrains from starting another one. This can happen with
25806 very large queues and/or very sluggish deliveries. This option does not,
25807 however, interlock with other processes, so additional queue runners can be
25808 started by other means, or by killing and restarting the daemon.
25809 </para>
25810 <para>
25811 Setting this option to zero does not suppress queue runs; rather, it disables
25812 the limit, allowing any number of simultaneous queue runner processes to be
25813 run. If you do not want queue runs to occur, omit the <option>-q</option><emphasis>xx</emphasis> setting on
25814 the daemon&#x2019;s command line.
25815 </para>
25816 <para>
25817 <indexterm role="option">
25818 <primary><option>queue_smtp_domains</option></primary>
25819 </indexterm>
25820 </para>
25821 <informaltable frame="all">
25822 <tgroup cols="4" colsep="0" rowsep="0">
25823 <colspec colwidth="8*" align="left"/>
25824 <colspec colwidth="6*" align="center"/>
25825 <colspec colwidth="6*" align="center"/>
25826 <colspec colwidth="6*" align="right"/>
25827 <tbody>
25828 <row>
25829 <entry><option>queue_smtp_domains</option></entry>
25830 <entry>Use: <emphasis>main</emphasis></entry>
25831 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
25832 <entry>Default: <emphasis>unset</emphasis></entry>
25833 </row>
25834 </tbody>
25835 </tgroup>
25836 </informaltable>
25837 <para>
25838 <indexterm role="concept">
25839 <primary>queueing incoming messages</primary>
25840 </indexterm>
25841 <indexterm role="concept">
25842 <primary>message</primary>
25843 <secondary>queueing remote deliveries</secondary>
25844 </indexterm>
25845 When this option is set, a delivery process is started whenever a message is
25846 received, routing is performed, and local deliveries take place.
25847 However, if any SMTP deliveries are required for domains that match
25848 <option>queue_smtp_domains</option>, they are not immediately delivered, but instead the
25849 message waits on the queue for the next queue run. Since routing of the message
25850 has taken place, Exim knows to which remote hosts it must be delivered, and so
25851 when the queue run happens, multiple messages for the same host are delivered
25852 over a single SMTP connection. The <option>-odqs</option> command line option causes all
25853 SMTP deliveries to be queued in this way, and is equivalent to setting
25854 <option>queue_smtp_domains</option> to <quote>*</quote>. See also <option>hold_domains</option> and
25855 <option>queue_domains</option>.
25856 </para>
25857 <para>
25858 <indexterm role="option">
25859 <primary><option>receive_timeout</option></primary>
25860 </indexterm>
25861 </para>
25862 <informaltable frame="all">
25863 <tgroup cols="4" colsep="0" rowsep="0">
25864 <colspec colwidth="8*" align="left"/>
25865 <colspec colwidth="6*" align="center"/>
25866 <colspec colwidth="6*" align="center"/>
25867 <colspec colwidth="6*" align="right"/>
25868 <tbody>
25869 <row>
25870 <entry><option>receive_timeout</option></entry>
25871 <entry>Use: <emphasis>main</emphasis></entry>
25872 <entry>Type: <emphasis>time</emphasis></entry>
25873 <entry>Default: <emphasis>0s</emphasis></entry>
25874 </row>
25875 </tbody>
25876 </tgroup>
25877 </informaltable>
25878 <para>
25879 <indexterm role="concept">
25880 <primary>timeout</primary>
25881 <secondary>for non-SMTP input</secondary>
25882 </indexterm>
25883 This option sets the timeout for accepting a non-SMTP message, that is, the
25884 maximum time that Exim waits when reading a message on the standard input. If
25885 the value is zero, it will wait for ever. This setting is overridden by the
25886 <option>-or</option> command line option. The timeout for incoming SMTP messages is
25887 controlled by <option>smtp_receive_timeout</option>.
25888 </para>
25889 <para>
25890 <indexterm role="option">
25891 <primary><option>received_header_text</option></primary>
25892 </indexterm>
25893 </para>
25894 <informaltable frame="all">
25895 <tgroup cols="4" colsep="0" rowsep="0">
25896 <colspec colwidth="8*" align="left"/>
25897 <colspec colwidth="6*" align="center"/>
25898 <colspec colwidth="6*" align="center"/>
25899 <colspec colwidth="6*" align="right"/>
25900 <tbody>
25901 <row>
25902 <entry><option>received_header_text</option></entry>
25903 <entry>Use: <emphasis>main</emphasis></entry>
25904 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25905 <entry>Default: <emphasis>see below</emphasis></entry>
25906 </row>
25907 </tbody>
25908 </tgroup>
25909 </informaltable>
25910 <para>
25911 <indexterm role="concept">
25912 <primary>customizing</primary>
25913 <secondary><emphasis>Received:</emphasis> header</secondary>
25914 </indexterm>
25915 <indexterm role="concept">
25916 <primary><emphasis>Received:</emphasis> header line</primary>
25917 <secondary>customizing</secondary>
25918 </indexterm>
25919 This string defines the contents of the <emphasis>Received:</emphasis> message header that is
25920 added to each message, except for the timestamp, which is automatically added
25921 on at the end (preceded by a semicolon). The string is expanded each time it is
25922 used. If the expansion yields an empty string, no <emphasis>Received:</emphasis> header line is
25923 added to the message. Otherwise, the string should start with the text
25924 <quote>Received:</quote> and conform to the RFC 2822 specification for <emphasis>Received:</emphasis>
25925 header lines. The default setting is:
25926 </para>
25927 <literallayout class="monospaced">
25928 received_header_text = Received: \
25929   ${if def:sender_rcvhost {from $sender_rcvhost\n\t}\
25930   {${if def:sender_ident \
25931   {from ${quote_local_part:$sender_ident} }}\
25932   ${if def:sender_helo_name {(helo=$sender_helo_name)\n\t}}}}\
25933   by $primary_hostname \
25934   ${if def:received_protocol {with $received_protocol}} \
25935   ${if def:tls_cipher {($tls_cipher)\n\t}}\
25936   (Exim $version_number)\n\t\
25937   ${if def:sender_address \
25938   {(envelope-from &lt;$sender_address&gt;)\n\t}}\
25939   id $message_exim_id\
25940   ${if def:received_for {\n\tfor $received_for}}
25941 </literallayout>
25942 <para>
25943 The reference to the TLS cipher is omitted when Exim is built without TLS
25944 support. The use of conditional expansions ensures that this works for both
25945 locally generated messages and messages received from remote hosts, giving
25946 header lines such as the following:
25947 </para>
25948 <literallayout class="monospaced">
25949 Received: from scrooge.carol.example ([192.168.12.25] ident=root)
25950 by marley.carol.example with esmtp (Exim 4.00)
25951 (envelope-from &lt;bob@carol.example&gt;)
25952 id 16IOWa-00019l-00
25953 for chas@dickens.example; Tue, 25 Dec 2001 14:43:44 +0000
25954 Received: by scrooge.carol.example with local (Exim 4.00)
25955 id 16IOWW-000083-00; Tue, 25 Dec 2001 14:43:41 +0000
25956 </literallayout>
25957 <para>
25958 Until the body of the message has been received, the timestamp is the time when
25959 the message started to be received. Once the body has arrived, and all policy
25960 checks have taken place, the timestamp is updated to the time at which the
25961 message was accepted.
25962 </para>
25963 <para>
25964 <indexterm role="option">
25965 <primary><option>received_headers_max</option></primary>
25966 </indexterm>
25967 </para>
25968 <informaltable frame="all">
25969 <tgroup cols="4" colsep="0" rowsep="0">
25970 <colspec colwidth="8*" align="left"/>
25971 <colspec colwidth="6*" align="center"/>
25972 <colspec colwidth="6*" align="center"/>
25973 <colspec colwidth="6*" align="right"/>
25974 <tbody>
25975 <row>
25976 <entry><option>received_headers_max</option></entry>
25977 <entry>Use: <emphasis>main</emphasis></entry>
25978 <entry>Type: <emphasis>integer</emphasis></entry>
25979 <entry>Default: <emphasis>30</emphasis></entry>
25980 </row>
25981 </tbody>
25982 </tgroup>
25983 </informaltable>
25984 <para>
25985 <indexterm role="concept">
25986 <primary>loop</primary>
25987 <secondary>prevention</secondary>
25988 </indexterm>
25989 <indexterm role="concept">
25990 <primary>mail loop prevention</primary>
25991 </indexterm>
25992 <indexterm role="concept">
25993 <primary><emphasis>Received:</emphasis> header line</primary>
25994 <secondary>counting</secondary>
25995 </indexterm>
25996 When a message is to be delivered, the number of <emphasis>Received:</emphasis> headers is
25997 counted, and if it is greater than this parameter, a mail loop is assumed to
25998 have occurred, the delivery is abandoned, and an error message is generated.
25999 This applies to both local and remote deliveries.
26000 </para>
26001 <para>
26002 <indexterm role="option">
26003 <primary><option>recipient_unqualified_hosts</option></primary>
26004 </indexterm>
26005 </para>
26006 <informaltable frame="all">
26007 <tgroup cols="4" colsep="0" rowsep="0">
26008 <colspec colwidth="8*" align="left"/>
26009 <colspec colwidth="6*" align="center"/>
26010 <colspec colwidth="6*" align="center"/>
26011 <colspec colwidth="6*" align="right"/>
26012 <tbody>
26013 <row>
26014 <entry><option>recipient_unqualified_hosts</option></entry>
26015 <entry>Use: <emphasis>main</emphasis></entry>
26016 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26017 <entry>Default: <emphasis>unset</emphasis></entry>
26018 </row>
26019 </tbody>
26020 </tgroup>
26021 </informaltable>
26022 <para>
26023 <indexterm role="concept">
26024 <primary>unqualified addresses</primary>
26025 </indexterm>
26026 <indexterm role="concept">
26027 <primary>host</primary>
26028 <secondary>unqualified addresses from</secondary>
26029 </indexterm>
26030 This option lists those hosts from which Exim is prepared to accept unqualified
26031 recipient addresses in message envelopes. The addresses are made fully
26032 qualified by the addition of the <option>qualify_recipient</option> value. This option also
26033 affects message header lines. Exim does not reject unqualified recipient
26034 addresses in headers, but it qualifies them only if the message came from a
26035 host that matches <option>recipient_unqualified_hosts</option>,
26036 or if the message was submitted locally (not using TCP/IP), and the <option>-bnq</option>
26037 option was not set.
26038 </para>
26039 <para>
26040 <indexterm role="option">
26041 <primary><option>recipients_max</option></primary>
26042 </indexterm>
26043 </para>
26044 <informaltable frame="all">
26045 <tgroup cols="4" colsep="0" rowsep="0">
26046 <colspec colwidth="8*" align="left"/>
26047 <colspec colwidth="6*" align="center"/>
26048 <colspec colwidth="6*" align="center"/>
26049 <colspec colwidth="6*" align="right"/>
26050 <tbody>
26051 <row>
26052 <entry><option>recipients_max</option></entry>
26053 <entry>Use: <emphasis>main</emphasis></entry>
26054 <entry>Type: <emphasis>integer</emphasis></entry>
26055 <entry>Default: <emphasis>0</emphasis></entry>
26056 </row>
26057 </tbody>
26058 </tgroup>
26059 </informaltable>
26060 <para>
26061 <indexterm role="concept">
26062 <primary>limit</primary>
26063 <secondary>number of recipients</secondary>
26064 </indexterm>
26065 <indexterm role="concept">
26066 <primary>recipient</primary>
26067 <secondary>maximum number</secondary>
26068 </indexterm>
26069 If this option is set greater than zero, it specifies the maximum number of
26070 original recipients for any message. Additional recipients that are generated
26071 by aliasing or forwarding do not count. SMTP messages get a 452 response for
26072 all recipients over the limit; earlier recipients are delivered as normal.
26073 Non-SMTP messages with too many recipients are failed, and no deliveries are
26074 done.
26075 </para>
26076 <para>
26077 <indexterm role="concept">
26078 <primary>RCPT</primary>
26079 <secondary>maximum number of incoming</secondary>
26080 </indexterm>
26081 <emphasis role="bold">Note</emphasis>: The RFCs specify that an SMTP server should accept at least 100
26082 RCPT commands in a single message.
26083 </para>
26084 <para>
26085 <indexterm role="option">
26086 <primary><option>recipients_max_reject</option></primary>
26087 </indexterm>
26088 </para>
26089 <informaltable frame="all">
26090 <tgroup cols="4" colsep="0" rowsep="0">
26091 <colspec colwidth="8*" align="left"/>
26092 <colspec colwidth="6*" align="center"/>
26093 <colspec colwidth="6*" align="center"/>
26094 <colspec colwidth="6*" align="right"/>
26095 <tbody>
26096 <row>
26097 <entry><option>recipients_max_reject</option></entry>
26098 <entry>Use: <emphasis>main</emphasis></entry>
26099 <entry>Type: <emphasis>boolean</emphasis></entry>
26100 <entry>Default: <emphasis>false</emphasis></entry>
26101 </row>
26102 </tbody>
26103 </tgroup>
26104 </informaltable>
26105 <para>
26106 If this option is set true, Exim rejects SMTP messages containing too many
26107 recipients by giving 552 errors to the surplus RCPT commands, and a 554
26108 error to the eventual DATA command. Otherwise (the default) it gives a 452
26109 error to the surplus RCPT commands and accepts the message on behalf of the
26110 initial set of recipients. The remote server should then re-send the message
26111 for the remaining recipients at a later time.
26112 </para>
26113 <para>
26114 <indexterm role="option">
26115 <primary><option>remote_max_parallel</option></primary>
26116 </indexterm>
26117 </para>
26118 <informaltable frame="all">
26119 <tgroup cols="4" colsep="0" rowsep="0">
26120 <colspec colwidth="8*" align="left"/>
26121 <colspec colwidth="6*" align="center"/>
26122 <colspec colwidth="6*" align="center"/>
26123 <colspec colwidth="6*" align="right"/>
26124 <tbody>
26125 <row>
26126 <entry><option>remote_max_parallel</option></entry>
26127 <entry>Use: <emphasis>main</emphasis></entry>
26128 <entry>Type: <emphasis>integer</emphasis></entry>
26129 <entry>Default: <emphasis>2</emphasis></entry>
26130 </row>
26131 </tbody>
26132 </tgroup>
26133 </informaltable>
26134 <para>
26135 <indexterm role="concept">
26136 <primary>delivery</primary>
26137 <secondary>parallelism for remote</secondary>
26138 </indexterm>
26139 This option controls parallel delivery of one message to a number of remote
26140 hosts. If the value is less than 2, parallel delivery is disabled, and Exim
26141 does all the remote deliveries for a message one by one. Otherwise, if a single
26142 message has to be delivered to more than one remote host, or if several copies
26143 have to be sent to the same remote host, up to <option>remote_max_parallel</option>
26144 deliveries are done simultaneously. If more than <option>remote_max_parallel</option>
26145 deliveries are required, the maximum number of processes are started, and as
26146 each one finishes, another is begun. The order of starting processes is the
26147 same as if sequential delivery were being done, and can be controlled by the
26148 <option>remote_sort_domains</option> option. If parallel delivery takes place while running
26149 with debugging turned on, the debugging output from each delivery process is
26150 tagged with its process id.
26151 </para>
26152 <para>
26153 This option controls only the maximum number of parallel deliveries for one
26154 message in one Exim delivery process. Because Exim has no central queue
26155 manager, there is no way of controlling the total number of simultaneous
26156 deliveries if the configuration allows a delivery attempt as soon as a message
26157 is received.
26158 </para>
26159 <para>
26160 <indexterm role="concept">
26161 <primary>number of deliveries</primary>
26162 </indexterm>
26163 <indexterm role="concept">
26164 <primary>delivery</primary>
26165 <secondary>maximum number of</secondary>
26166 </indexterm>
26167 If you want to control the total number of deliveries on the system, you
26168 need to set the <option>queue_only</option> option. This ensures that all incoming messages
26169 are added to the queue without starting a delivery process. Then set up an Exim
26170 daemon to start queue runner processes at appropriate intervals (probably
26171 fairly often, for example, every minute), and limit the total number of queue
26172 runners by setting the <option>queue_run_max</option> parameter. Because each queue runner
26173 delivers only one message at a time, the maximum number of deliveries that can
26174 then take place at once is <option>queue_run_max</option> multiplied by
26175 <option>remote_max_parallel</option>.
26176 </para>
26177 <para>
26178 If it is purely remote deliveries you want to control, use
26179 <option>queue_smtp_domains</option> instead of <option>queue_only</option>. This has the added benefit of
26180 doing the SMTP routing before queueing, so that several messages for the same
26181 host will eventually get delivered down the same connection.
26182 </para>
26183 <para>
26184 <indexterm role="option">
26185 <primary><option>remote_sort_domains</option></primary>
26186 </indexterm>
26187 </para>
26188 <informaltable frame="all">
26189 <tgroup cols="4" colsep="0" rowsep="0">
26190 <colspec colwidth="8*" align="left"/>
26191 <colspec colwidth="6*" align="center"/>
26192 <colspec colwidth="6*" align="center"/>
26193 <colspec colwidth="6*" align="right"/>
26194 <tbody>
26195 <row>
26196 <entry><option>remote_sort_domains</option></entry>
26197 <entry>Use: <emphasis>main</emphasis></entry>
26198 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
26199 <entry>Default: <emphasis>unset</emphasis></entry>
26200 </row>
26201 </tbody>
26202 </tgroup>
26203 </informaltable>
26204 <para>
26205 <indexterm role="concept">
26206 <primary>sorting remote deliveries</primary>
26207 </indexterm>
26208 <indexterm role="concept">
26209 <primary>delivery</primary>
26210 <secondary>sorting remote</secondary>
26211 </indexterm>
26212 When there are a number of remote deliveries for a message, they are sorted by
26213 domain into the order given by this list. For example,
26214 </para>
26215 <literallayout class="monospaced">
26216 remote_sort_domains = *.cam.ac.uk:*.uk
26217 </literallayout>
26218 <para>
26219 would attempt to deliver to all addresses in the <emphasis>cam.ac.uk</emphasis> domain first,
26220 then to those in the <option>uk</option> domain, then to any others.
26221 </para>
26222 <para>
26223 <indexterm role="option">
26224 <primary><option>retry_data_expire</option></primary>
26225 </indexterm>
26226 </para>
26227 <informaltable frame="all">
26228 <tgroup cols="4" colsep="0" rowsep="0">
26229 <colspec colwidth="8*" align="left"/>
26230 <colspec colwidth="6*" align="center"/>
26231 <colspec colwidth="6*" align="center"/>
26232 <colspec colwidth="6*" align="right"/>
26233 <tbody>
26234 <row>
26235 <entry><option>retry_data_expire</option></entry>
26236 <entry>Use: <emphasis>main</emphasis></entry>
26237 <entry>Type: <emphasis>time</emphasis></entry>
26238 <entry>Default: <emphasis>7d</emphasis></entry>
26239 </row>
26240 </tbody>
26241 </tgroup>
26242 </informaltable>
26243 <para>
26244 <indexterm role="concept">
26245 <primary>hints database</primary>
26246 <secondary>data expiry</secondary>
26247 </indexterm>
26248 This option sets a <quote>use before</quote> time on retry information in Exim&#x2019;s hints
26249 database. Any older retry data is ignored. This means that, for example, once a
26250 host has not been tried for 7 days, Exim behaves as if it has no knowledge of
26251 past failures.
26252 </para>
26253 <para>
26254 <indexterm role="option">
26255 <primary><option>retry_interval_max</option></primary>
26256 </indexterm>
26257 </para>
26258 <informaltable frame="all">
26259 <tgroup cols="4" colsep="0" rowsep="0">
26260 <colspec colwidth="8*" align="left"/>
26261 <colspec colwidth="6*" align="center"/>
26262 <colspec colwidth="6*" align="center"/>
26263 <colspec colwidth="6*" align="right"/>
26264 <tbody>
26265 <row>
26266 <entry><option>retry_interval_max</option></entry>
26267 <entry>Use: <emphasis>main</emphasis></entry>
26268 <entry>Type: <emphasis>time</emphasis></entry>
26269 <entry>Default: <emphasis>24h</emphasis></entry>
26270 </row>
26271 </tbody>
26272 </tgroup>
26273 </informaltable>
26274 <para>
26275 <indexterm role="concept">
26276 <primary>retry</primary>
26277 <secondary>limit on interval</secondary>
26278 </indexterm>
26279 <indexterm role="concept">
26280 <primary>limit</primary>
26281 <secondary>on retry interval</secondary>
26282 </indexterm>
26283 Chapter <xref linkend="CHAPretry"/> describes Exim&#x2019;s mechanisms for controlling the
26284 intervals between delivery attempts for messages that cannot be delivered
26285 straight away. This option sets an overall limit to the length of time between
26286 retries. It cannot be set greater than 24 hours; any attempt to do so forces
26287 the default value.
26288 </para>
26289 <para>
26290 <indexterm role="option">
26291 <primary><option>return_path_remove</option></primary>
26292 </indexterm>
26293 </para>
26294 <informaltable frame="all">
26295 <tgroup cols="4" colsep="0" rowsep="0">
26296 <colspec colwidth="8*" align="left"/>
26297 <colspec colwidth="6*" align="center"/>
26298 <colspec colwidth="6*" align="center"/>
26299 <colspec colwidth="6*" align="right"/>
26300 <tbody>
26301 <row>
26302 <entry><option>return_path_remove</option></entry>
26303 <entry>Use: <emphasis>main</emphasis></entry>
26304 <entry>Type: <emphasis>boolean</emphasis></entry>
26305 <entry>Default: <emphasis>true</emphasis></entry>
26306 </row>
26307 </tbody>
26308 </tgroup>
26309 </informaltable>
26310 <para>
26311 <indexterm role="concept">
26312 <primary><emphasis>Return-path:</emphasis> header line</primary>
26313 <secondary>removing</secondary>
26314 </indexterm>
26315 RFC 2821, section 4.4, states that an SMTP server must insert a
26316 <emphasis>Return-path:</emphasis> header line into a message when it makes a <quote>final delivery</quote>.
26317 The <emphasis>Return-path:</emphasis> header preserves the sender address as received in the
26318 MAIL command. This description implies that this header should not be present
26319 in an incoming message. If <option>return_path_remove</option> is true, any existing
26320 <emphasis>Return-path:</emphasis> headers are removed from messages at the time they are
26321 received. Exim&#x2019;s transports have options for adding <emphasis>Return-path:</emphasis> headers at
26322 the time of delivery. They are normally used only for final local deliveries.
26323 </para>
26324 <para>
26325 <indexterm role="option">
26326 <primary><option>return_size_limit</option></primary>
26327 </indexterm>
26328 </para>
26329 <informaltable frame="all">
26330 <tgroup cols="4" colsep="0" rowsep="0">
26331 <colspec colwidth="8*" align="left"/>
26332 <colspec colwidth="6*" align="center"/>
26333 <colspec colwidth="6*" align="center"/>
26334 <colspec colwidth="6*" align="right"/>
26335 <tbody>
26336 <row>
26337 <entry><option>return_size_limit</option></entry>
26338 <entry>Use: <emphasis>main</emphasis></entry>
26339 <entry>Type: <emphasis>integer</emphasis></entry>
26340 <entry>Default: <emphasis>100K</emphasis></entry>
26341 </row>
26342 </tbody>
26343 </tgroup>
26344 </informaltable>
26345 <para>
26346 This option is an obsolete synonym for <option>bounce_return_size_limit</option>.
26347 </para>
26348 <para>
26349 <indexterm role="option">
26350 <primary><option>rfc1413_hosts</option></primary>
26351 </indexterm>
26352 </para>
26353 <informaltable frame="all">
26354 <tgroup cols="4" colsep="0" rowsep="0">
26355 <colspec colwidth="8*" align="left"/>
26356 <colspec colwidth="6*" align="center"/>
26357 <colspec colwidth="6*" align="center"/>
26358 <colspec colwidth="6*" align="right"/>
26359 <tbody>
26360 <row>
26361 <entry><option>rfc1413_hosts</option></entry>
26362 <entry>Use: <emphasis>main</emphasis></entry>
26363 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26364 <entry>Default: <emphasis>*</emphasis></entry>
26365 </row>
26366 </tbody>
26367 </tgroup>
26368 </informaltable>
26369 <para>
26370 <indexterm role="concept">
26371 <primary>RFC 1413</primary>
26372 </indexterm>
26373 <indexterm role="concept">
26374 <primary>host</primary>
26375 <secondary>for RFC 1413 calls</secondary>
26376 </indexterm>
26377 RFC 1413 identification calls are made to any client host which matches an item
26378 in the list.
26379 </para>
26380 <para>
26381 <indexterm role="option">
26382 <primary><option>rfc1413_query_timeout</option></primary>
26383 </indexterm>
26384 </para>
26385 <informaltable frame="all">
26386 <tgroup cols="4" colsep="0" rowsep="0">
26387 <colspec colwidth="8*" align="left"/>
26388 <colspec colwidth="6*" align="center"/>
26389 <colspec colwidth="6*" align="center"/>
26390 <colspec colwidth="6*" align="right"/>
26391 <tbody>
26392 <row>
26393 <entry><option>rfc1413_query_timeout</option></entry>
26394 <entry>Use: <emphasis>main</emphasis></entry>
26395 <entry>Type: <emphasis>time</emphasis></entry>
26396 <entry>Default: <emphasis>5s</emphasis></entry>
26397 </row>
26398 </tbody>
26399 </tgroup>
26400 </informaltable>
26401 <para>
26402 <indexterm role="concept">
26403 <primary>RFC 1413</primary>
26404 <secondary>query timeout</secondary>
26405 </indexterm>
26406 <indexterm role="concept">
26407 <primary>timeout</primary>
26408 <secondary>for RFC 1413 call</secondary>
26409 </indexterm>
26410 This sets the timeout on RFC 1413 identification calls. If it is set to zero,
26411 no RFC 1413 calls are ever made.
26412 </para>
26413 <para>
26414 <indexterm role="option">
26415 <primary><option>sender_unqualified_hosts</option></primary>
26416 </indexterm>
26417 </para>
26418 <informaltable frame="all">
26419 <tgroup cols="4" colsep="0" rowsep="0">
26420 <colspec colwidth="8*" align="left"/>
26421 <colspec colwidth="6*" align="center"/>
26422 <colspec colwidth="6*" align="center"/>
26423 <colspec colwidth="6*" align="right"/>
26424 <tbody>
26425 <row>
26426 <entry><option>sender_unqualified_hosts</option></entry>
26427 <entry>Use: <emphasis>main</emphasis></entry>
26428 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26429 <entry>Default: <emphasis>unset</emphasis></entry>
26430 </row>
26431 </tbody>
26432 </tgroup>
26433 </informaltable>
26434 <para>
26435 <indexterm role="concept">
26436 <primary>unqualified addresses</primary>
26437 </indexterm>
26438 <indexterm role="concept">
26439 <primary>host</primary>
26440 <secondary>unqualified addresses from</secondary>
26441 </indexterm>
26442 This option lists those hosts from which Exim is prepared to accept unqualified
26443 sender addresses. The addresses are made fully qualified by the addition of
26444 <option>qualify_domain</option>. This option also affects message header lines. Exim does
26445 not reject unqualified addresses in headers that contain sender addresses, but
26446 it qualifies them only if the message came from a host that matches
26447 <option>sender_unqualified_hosts</option>, or if the message was submitted locally (not
26448 using TCP/IP), and the <option>-bnq</option> option was not set.
26449 </para>
26450 <para>
26451 <indexterm role="option">
26452 <primary><option>smtp_accept_keepalive</option></primary>
26453 </indexterm>
26454 </para>
26455 <informaltable frame="all">
26456 <tgroup cols="4" colsep="0" rowsep="0">
26457 <colspec colwidth="8*" align="left"/>
26458 <colspec colwidth="6*" align="center"/>
26459 <colspec colwidth="6*" align="center"/>
26460 <colspec colwidth="6*" align="right"/>
26461 <tbody>
26462 <row>
26463 <entry><option>smtp_accept_keepalive</option></entry>
26464 <entry>Use: <emphasis>main</emphasis></entry>
26465 <entry>Type: <emphasis>boolean</emphasis></entry>
26466 <entry>Default: <emphasis>true</emphasis></entry>
26467 </row>
26468 </tbody>
26469 </tgroup>
26470 </informaltable>
26471 <para>
26472 <indexterm role="concept">
26473 <primary>keepalive</primary>
26474 <secondary>on incoming connection</secondary>
26475 </indexterm>
26476 This option controls the setting of the SO_KEEPALIVE option on incoming
26477 TCP/IP socket connections. When set, it causes the kernel to probe idle
26478 connections periodically, by sending packets with <quote>old</quote> sequence numbers. The
26479 other end of the connection should send an acknowledgment if the connection is
26480 still okay or a reset if the connection has been aborted. The reason for doing
26481 this is that it has the beneficial effect of freeing up certain types of
26482 connection that can get stuck when the remote host is disconnected without
26483 tidying up the TCP/IP call properly. The keepalive mechanism takes several
26484 hours to detect unreachable hosts.
26485 </para>
26486 <para>
26487 <indexterm role="option">
26488 <primary><option>smtp_accept_max</option></primary>
26489 </indexterm>
26490 </para>
26491 <informaltable frame="all">
26492 <tgroup cols="4" colsep="0" rowsep="0">
26493 <colspec colwidth="8*" align="left"/>
26494 <colspec colwidth="6*" align="center"/>
26495 <colspec colwidth="6*" align="center"/>
26496 <colspec colwidth="6*" align="right"/>
26497 <tbody>
26498 <row>
26499 <entry><option>smtp_accept_max</option></entry>
26500 <entry>Use: <emphasis>main</emphasis></entry>
26501 <entry>Type: <emphasis>integer</emphasis></entry>
26502 <entry>Default: <emphasis>20</emphasis></entry>
26503 </row>
26504 </tbody>
26505 </tgroup>
26506 </informaltable>
26507 <para>
26508 <indexterm role="concept">
26509 <primary>limit</primary>
26510 <secondary>incoming SMTP connections</secondary>
26511 </indexterm>
26512 <indexterm role="concept">
26513 <primary>SMTP</primary>
26514 <secondary>incoming connection count</secondary>
26515 </indexterm>
26516 <indexterm role="concept">
26517 <primary>inetd</primary>
26518 </indexterm>
26519 This option specifies the maximum number of simultaneous incoming SMTP calls
26520 that Exim will accept. It applies only to the listening daemon; there is no
26521 control (in Exim) when incoming SMTP is being handled by <emphasis>inetd</emphasis>. If the
26522 value is set to zero, no limit is applied. However, it is required to be
26523 non-zero if either <option>smtp_accept_max_per_host</option> or <option>smtp_accept_queue</option> is
26524 set. See also <option>smtp_accept_reserve</option> and <option>smtp_load_reserve</option>.
26525 </para>
26526 <para>
26527 A new SMTP connection is immediately rejected if the <option>smtp_accept_max</option> limit
26528 has been reached. If not, Exim first checks <option>smtp_accept_max_per_host</option>. If
26529 that limit has not been reached for the client host, <option>smtp_accept_reserve</option>
26530 and <option>smtp_load_reserve</option> are then checked before accepting the connection.
26531 </para>
26532 <para>
26533 <indexterm role="option">
26534 <primary><option>smtp_accept_max_nonmail</option></primary>
26535 </indexterm>
26536 </para>
26537 <informaltable frame="all">
26538 <tgroup cols="4" colsep="0" rowsep="0">
26539 <colspec colwidth="8*" align="left"/>
26540 <colspec colwidth="6*" align="center"/>
26541 <colspec colwidth="6*" align="center"/>
26542 <colspec colwidth="6*" align="right"/>
26543 <tbody>
26544 <row>
26545 <entry><option>smtp_accept_max_nonmail</option></entry>
26546 <entry>Use: <emphasis>main</emphasis></entry>
26547 <entry>Type: <emphasis>integer</emphasis></entry>
26548 <entry>Default: <emphasis>10</emphasis></entry>
26549 </row>
26550 </tbody>
26551 </tgroup>
26552 </informaltable>
26553 <para>
26554 <indexterm role="concept">
26555 <primary>limit</primary>
26556 <secondary>non-mail SMTP commands</secondary>
26557 </indexterm>
26558 <indexterm role="concept">
26559 <primary>SMTP</primary>
26560 <secondary>limiting non-mail commands</secondary>
26561 </indexterm>
26562 Exim counts the number of <quote>non-mail</quote> commands in an SMTP session, and drops
26563 the connection if there are too many. This option defines <quote>too many</quote>. The
26564 check catches some denial-of-service attacks, repeated failing AUTHs, or a mad
26565 client looping sending EHLO, for example. The check is applied only if the
26566 client host matches <option>smtp_accept_max_nonmail_hosts</option>.
26567 </para>
26568 <para>
26569 When a new message is expected, one occurrence of RSET is not counted. This
26570 allows a client to send one RSET between messages (this is not necessary,
26571 but some clients do it). Exim also allows one uncounted occurrence of HELO
26572 or EHLO, and one occurrence of STARTTLS between messages. After
26573 starting up a TLS session, another EHLO is expected, and so it too is not
26574 counted. The first occurrence of AUTH in a connection, or immediately
26575 following STARTTLS is not counted. Otherwise, all commands other than
26576 MAIL, RCPT, DATA, and QUIT are counted.
26577 </para>
26578 <para>
26579 <indexterm role="option">
26580 <primary><option>smtp_accept_max_nonmail_hosts</option></primary>
26581 </indexterm>
26582 </para>
26583 <informaltable frame="all">
26584 <tgroup cols="4" colsep="0" rowsep="0">
26585 <colspec colwidth="8*" align="left"/>
26586 <colspec colwidth="6*" align="center"/>
26587 <colspec colwidth="6*" align="center"/>
26588 <colspec colwidth="6*" align="right"/>
26589 <tbody>
26590 <row>
26591 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
26592 <entry>Use: <emphasis>main</emphasis></entry>
26593 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26594 <entry>Default: <emphasis>*</emphasis></entry>
26595 </row>
26596 </tbody>
26597 </tgroup>
26598 </informaltable>
26599 <para>
26600 You can control which hosts are subject to the <option>smtp_accept_max_nonmail</option>
26601 check by setting this option. The default value makes it apply to all hosts. By
26602 changing the value, you can exclude any badly-behaved hosts that you have to
26603 live with.
26604 </para>
26605 <para>
26606 <indexterm role="option">
26607 <primary><option>smtp_accept_max_per_connection</option></primary>
26608 </indexterm>
26609 </para>
26610 <informaltable frame="all">
26611 <tgroup cols="4" colsep="0" rowsep="0">
26612 <colspec colwidth="8*" align="left"/>
26613 <colspec colwidth="6*" align="center"/>
26614 <colspec colwidth="6*" align="center"/>
26615 <colspec colwidth="6*" align="right"/>
26616 <tbody>
26617 <row>
26618 <entry><option>smtp_accept_max_per_ &nbsp;&nbsp;connection</option></entry>
26619 <entry>Use: <emphasis>main</emphasis></entry>
26620 <entry>Type: <emphasis>integer</emphasis></entry>
26621 <entry>Default: <emphasis>1000</emphasis></entry>
26622 </row>
26623 </tbody>
26624 </tgroup>
26625 </informaltable>
26626 <para>
26627 <indexterm role="concept">
26628 <primary>SMTP</primary>
26629 <secondary>limiting incoming message count</secondary>
26630 </indexterm>
26631 <indexterm role="concept">
26632 <primary>limit</primary>
26633 <secondary>messages per SMTP connection</secondary>
26634 </indexterm>
26635 The value of this option limits the number of MAIL commands that Exim is
26636 prepared to accept over a single SMTP connection, whether or not each command
26637 results in the transfer of a message. After the limit is reached, a 421
26638 response is given to subsequent MAIL commands. This limit is a safety
26639 precaution against a client that goes mad (incidents of this type have been
26640 seen).
26641 </para>
26642 <para>
26643 <indexterm role="option">
26644 <primary><option>smtp_accept_max_per_host</option></primary>
26645 </indexterm>
26646 </para>
26647 <informaltable frame="all">
26648 <tgroup cols="4" colsep="0" rowsep="0">
26649 <colspec colwidth="8*" align="left"/>
26650 <colspec colwidth="6*" align="center"/>
26651 <colspec colwidth="6*" align="center"/>
26652 <colspec colwidth="6*" align="right"/>
26653 <tbody>
26654 <row>
26655 <entry><option>smtp_accept_max_per_host</option></entry>
26656 <entry>Use: <emphasis>main</emphasis></entry>
26657 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26658 <entry>Default: <emphasis>unset</emphasis></entry>
26659 </row>
26660 </tbody>
26661 </tgroup>
26662 </informaltable>
26663 <para>
26664 <indexterm role="concept">
26665 <primary>limit</primary>
26666 <secondary>SMTP connections from one host</secondary>
26667 </indexterm>
26668 <indexterm role="concept">
26669 <primary>host</primary>
26670 <secondary>limiting SMTP connections from</secondary>
26671 </indexterm>
26672 This option restricts the number of simultaneous IP connections from a single
26673 host (strictly, from a single IP address) to the Exim daemon. The option is
26674 expanded, to enable different limits to be applied to different hosts by
26675 reference to <varname>$sender_host_address</varname>. Once the limit is reached, additional
26676 connection attempts from the same host are rejected with error code 421. This
26677 is entirely independent of <option>smtp_accept_reserve</option>. The option&#x2019;s default value
26678 of zero imposes no limit. If this option is set greater than zero, it is
26679 required that <option>smtp_accept_max</option> be non-zero.
26680 </para>
26681 <para>
26682 <emphasis role="bold">Warning</emphasis>: When setting this option you should not use any expansion
26683 constructions that take an appreciable amount of time. The expansion and test
26684 happen in the main daemon loop, in order to reject additional connections
26685 without forking additional processes (otherwise a denial-of-service attack
26686 could cause a vast number or processes to be created). While the daemon is
26687 doing this processing, it cannot accept any other incoming connections.
26688 </para>
26689 <para>
26690 <indexterm role="option">
26691 <primary><option>smtp_accept_queue</option></primary>
26692 </indexterm>
26693 </para>
26694 <informaltable frame="all">
26695 <tgroup cols="4" colsep="0" rowsep="0">
26696 <colspec colwidth="8*" align="left"/>
26697 <colspec colwidth="6*" align="center"/>
26698 <colspec colwidth="6*" align="center"/>
26699 <colspec colwidth="6*" align="right"/>
26700 <tbody>
26701 <row>
26702 <entry><option>smtp_accept_queue</option></entry>
26703 <entry>Use: <emphasis>main</emphasis></entry>
26704 <entry>Type: <emphasis>integer</emphasis></entry>
26705 <entry>Default: <emphasis>0</emphasis></entry>
26706 </row>
26707 </tbody>
26708 </tgroup>
26709 </informaltable>
26710 <para>
26711 <indexterm role="concept">
26712 <primary>SMTP</primary>
26713 <secondary>incoming connection count</secondary>
26714 </indexterm>
26715 <indexterm role="concept">
26716 <primary>queueing incoming messages</primary>
26717 </indexterm>
26718 <indexterm role="concept">
26719 <primary>message</primary>
26720 <secondary>queueing by SMTP connection count</secondary>
26721 </indexterm>
26722 If the number of simultaneous incoming SMTP connections being handled via the
26723 listening daemon exceeds this value, messages received by SMTP are just placed
26724 on the queue; no delivery processes are started automatically. The count is
26725 fixed at the start of an SMTP connection. It cannot be updated in the
26726 subprocess that receives messages, and so the queueing or not queueing applies
26727 to all messages received in the same connection.
26728 </para>
26729 <para>
26730 A value of zero implies no limit, and clearly any non-zero value is useful only
26731 if it is less than the <option>smtp_accept_max</option> value (unless that is zero). See
26732 also <option>queue_only</option>, <option>queue_only_load</option>, <option>queue_smtp_domains</option>, and the
26733 various <option>-od</option><emphasis>x</emphasis> command line options.
26734 </para>
26735 <para>
26736 <indexterm role="option">
26737 <primary><option>smtp_accept_queue_per_connection</option></primary>
26738 </indexterm>
26739 </para>
26740 <informaltable frame="all">
26741 <tgroup cols="4" colsep="0" rowsep="0">
26742 <colspec colwidth="8*" align="left"/>
26743 <colspec colwidth="6*" align="center"/>
26744 <colspec colwidth="6*" align="center"/>
26745 <colspec colwidth="6*" align="right"/>
26746 <tbody>
26747 <row>
26748 <entry><option>smtp_accept_queue_per_ &nbsp;&nbsp;connection</option></entry>
26749 <entry>Use: <emphasis>main</emphasis></entry>
26750 <entry>Type: <emphasis>integer</emphasis></entry>
26751 <entry>Default: <emphasis>10</emphasis></entry>
26752 </row>
26753 </tbody>
26754 </tgroup>
26755 </informaltable>
26756 <para>
26757 <indexterm role="concept">
26758 <primary>queueing incoming messages</primary>
26759 </indexterm>
26760 <indexterm role="concept">
26761 <primary>message</primary>
26762 <secondary>queueing by message count</secondary>
26763 </indexterm>
26764 This option limits the number of delivery processes that Exim starts
26765 automatically when receiving messages via SMTP, whether via the daemon or by
26766 the use of <option>-bs</option> or <option>-bS</option>. If the value of the option is greater than zero,
26767 and the number of messages received in a single SMTP session exceeds this
26768 number, subsequent messages are placed on the queue, but no delivery processes
26769 are started. This helps to limit the number of Exim processes when a server
26770 restarts after downtime and there is a lot of mail waiting for it on other
26771 systems. On large systems, the default should probably be increased, and on
26772 dial-in client systems it should probably be set to zero (that is, disabled).
26773 </para>
26774 <para>
26775 <indexterm role="option">
26776 <primary><option>smtp_accept_reserve</option></primary>
26777 </indexterm>
26778 </para>
26779 <informaltable frame="all">
26780 <tgroup cols="4" colsep="0" rowsep="0">
26781 <colspec colwidth="8*" align="left"/>
26782 <colspec colwidth="6*" align="center"/>
26783 <colspec colwidth="6*" align="center"/>
26784 <colspec colwidth="6*" align="right"/>
26785 <tbody>
26786 <row>
26787 <entry><option>smtp_accept_reserve</option></entry>
26788 <entry>Use: <emphasis>main</emphasis></entry>
26789 <entry>Type: <emphasis>integer</emphasis></entry>
26790 <entry>Default: <emphasis>0</emphasis></entry>
26791 </row>
26792 </tbody>
26793 </tgroup>
26794 </informaltable>
26795 <para>
26796 <indexterm role="concept">
26797 <primary>SMTP</primary>
26798 <secondary>incoming call count</secondary>
26799 </indexterm>
26800 <indexterm role="concept">
26801 <primary>host</primary>
26802 <secondary>reserved</secondary>
26803 </indexterm>
26804 When <option>smtp_accept_max</option> is set greater than zero, this option specifies a
26805 number of SMTP connections that are reserved for connections from the hosts
26806 that are specified in <option>smtp_reserve_hosts</option>. The value set in
26807 <option>smtp_accept_max</option> includes this reserve pool. The specified hosts are not
26808 restricted to this number of connections; the option specifies a minimum number
26809 of connection slots for them, not a maximum. It is a guarantee that this group
26810 of hosts can always get at least <option>smtp_accept_reserve</option> connections. However,
26811 the limit specified by <option>smtp_accept_max_per_host</option> is still applied to each
26812 individual host.
26813 </para>
26814 <para>
26815 For example, if <option>smtp_accept_max</option> is set to 50 and <option>smtp_accept_reserve</option> is
26816 set to 5, once there are 45 active connections (from any hosts), new
26817 connections are accepted only from hosts listed in <option>smtp_reserve_hosts</option>,
26818 provided the other criteria for acceptance are met.
26819 </para>
26820 <para>
26821 <indexterm role="option">
26822 <primary><option>smtp_active_hostname</option></primary>
26823 </indexterm>
26824 </para>
26825 <informaltable frame="all">
26826 <tgroup cols="4" colsep="0" rowsep="0">
26827 <colspec colwidth="8*" align="left"/>
26828 <colspec colwidth="6*" align="center"/>
26829 <colspec colwidth="6*" align="center"/>
26830 <colspec colwidth="6*" align="right"/>
26831 <tbody>
26832 <row>
26833 <entry><option>smtp_active_hostname</option></entry>
26834 <entry>Use: <emphasis>main</emphasis></entry>
26835 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26836 <entry>Default: <emphasis>unset</emphasis></entry>
26837 </row>
26838 </tbody>
26839 </tgroup>
26840 </informaltable>
26841 <para>
26842 <indexterm role="concept">
26843 <primary>host</primary>
26844 <secondary>name in SMTP responses</secondary>
26845 </indexterm>
26846 <indexterm role="concept">
26847 <primary>SMTP</primary>
26848 <secondary>host name in responses</secondary>
26849 </indexterm>
26850 <indexterm role="variable">
26851 <primary><varname>$primary_hostname</varname></primary>
26852 </indexterm>
26853 This option is provided for multi-homed servers that want to masquerade as
26854 several different hosts. At the start of an incoming SMTP connection, its value
26855 is expanded and used instead of the value of <varname>$primary_hostname</varname> in SMTP
26856 responses. For example, it is used as domain name in the response to an
26857 incoming HELO or EHLO command.
26858 </para>
26859 <para>
26860 <indexterm role="variable">
26861 <primary><varname>$smtp_active_hostname</varname></primary>
26862 </indexterm>
26863 The active hostname is placed in the <varname>$smtp_active_hostname</varname> variable, which
26864 is saved with any messages that are received. It is therefore available for use
26865 in routers and transports when the message is later delivered.
26866 </para>
26867 <para>
26868 If this option is unset, or if its expansion is forced to fail, or if the
26869 expansion results in an empty string, the value of <varname>$primary_hostname</varname> is
26870 used. Other expansion failures cause a message to be written to the main and
26871 panic logs, and the SMTP command receives a temporary error. Typically, the
26872 value of <option>smtp_active_hostname</option> depends on the incoming interface address.
26873 For example:
26874 </para>
26875 <literallayout class="monospaced">
26876 smtp_active_hostname = ${if eq{$received_ip_address}{10.0.0.1}\
26877   {cox.mydomain}{box.mydomain}}
26878 </literallayout>
26879 <para>
26880 Although <varname>$smtp_active_hostname</varname> is primarily concerned with incoming
26881 messages, it is also used as the default for HELO commands in callout
26882 verification if there is no remote transport from which to obtain a
26883 <option>helo_data</option> value.
26884 </para>
26885 <para>
26886 <indexterm role="option">
26887 <primary><option>smtp_banner</option></primary>
26888 </indexterm>
26889 </para>
26890 <informaltable frame="all">
26891 <tgroup cols="4" colsep="0" rowsep="0">
26892 <colspec colwidth="8*" align="left"/>
26893 <colspec colwidth="6*" align="center"/>
26894 <colspec colwidth="6*" align="center"/>
26895 <colspec colwidth="6*" align="right"/>
26896 <tbody>
26897 <row>
26898 <entry><option>smtp_banner</option></entry>
26899 <entry>Use: <emphasis>main</emphasis></entry>
26900 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26901 <entry>Default: <emphasis>see below</emphasis></entry>
26902 </row>
26903 </tbody>
26904 </tgroup>
26905 </informaltable>
26906 <para>
26907 <indexterm role="concept">
26908 <primary>SMTP</primary>
26909 <secondary>welcome banner</secondary>
26910 </indexterm>
26911 <indexterm role="concept">
26912 <primary>banner for SMTP</primary>
26913 </indexterm>
26914 <indexterm role="concept">
26915 <primary>welcome banner for SMTP</primary>
26916 </indexterm>
26917 <indexterm role="concept">
26918 <primary>customizing</primary>
26919 <secondary>SMTP banner</secondary>
26920 </indexterm>
26921 This string, which is expanded every time it is used, is output as the initial
26922 positive response to an SMTP connection. The default setting is:
26923 </para>
26924 <literallayout class="monospaced">
26925 smtp_banner = $smtp_active_hostname ESMTP Exim \
26926   $version_number $tod_full
26927 </literallayout>
26928 <para>
26929 Failure to expand the string causes a panic error. If you want to create a
26930 multiline response to the initial SMTP connection, use <quote>\n</quote> in the string at
26931 appropriate points, but not at the end. Note that the 220 code is not included
26932 in this string. Exim adds it automatically (several times in the case of a
26933 multiline response).
26934 </para>
26935 <para>
26936 <indexterm role="option">
26937 <primary><option>smtp_check_spool_space</option></primary>
26938 </indexterm>
26939 </para>
26940 <informaltable frame="all">
26941 <tgroup cols="4" colsep="0" rowsep="0">
26942 <colspec colwidth="8*" align="left"/>
26943 <colspec colwidth="6*" align="center"/>
26944 <colspec colwidth="6*" align="center"/>
26945 <colspec colwidth="6*" align="right"/>
26946 <tbody>
26947 <row>
26948 <entry><option>smtp_check_spool_space</option></entry>
26949 <entry>Use: <emphasis>main</emphasis></entry>
26950 <entry>Type: <emphasis>boolean</emphasis></entry>
26951 <entry>Default: <emphasis>true</emphasis></entry>
26952 </row>
26953 </tbody>
26954 </tgroup>
26955 </informaltable>
26956 <para>
26957 <indexterm role="concept">
26958 <primary>checking disk space</primary>
26959 </indexterm>
26960 <indexterm role="concept">
26961 <primary>disk space, checking</primary>
26962 </indexterm>
26963 <indexterm role="concept">
26964 <primary>spool directory</primary>
26965 <secondary>checking space</secondary>
26966 </indexterm>
26967 When this option is set, if an incoming SMTP session encounters the SIZE
26968 option on a MAIL command, it checks that there is enough space in the
26969 spool directory&#x2019;s partition to accept a message of that size, while still
26970 leaving free the amount specified by <option>check_spool_space</option> (even if that value
26971 is zero). If there isn&#x2019;t enough space, a temporary error code is returned.
26972 </para>
26973 <para>
26974 <indexterm role="option">
26975 <primary><option>smtp_connect_backlog</option></primary>
26976 </indexterm>
26977 </para>
26978 <informaltable frame="all">
26979 <tgroup cols="4" colsep="0" rowsep="0">
26980 <colspec colwidth="8*" align="left"/>
26981 <colspec colwidth="6*" align="center"/>
26982 <colspec colwidth="6*" align="center"/>
26983 <colspec colwidth="6*" align="right"/>
26984 <tbody>
26985 <row>
26986 <entry><option>smtp_connect_backlog</option></entry>
26987 <entry>Use: <emphasis>main</emphasis></entry>
26988 <entry>Type: <emphasis>integer</emphasis></entry>
26989 <entry>Default: <emphasis>20</emphasis></entry>
26990 </row>
26991 </tbody>
26992 </tgroup>
26993 </informaltable>
26994 <para>
26995 <indexterm role="concept">
26996 <primary>connection backlog</primary>
26997 </indexterm>
26998 <indexterm role="concept">
26999 <primary>SMTP</primary>
27000 <secondary>connection backlog</secondary>
27001 </indexterm>
27002 <indexterm role="concept">
27003 <primary>backlog of connections</primary>
27004 </indexterm>
27005 This option specifies a maximum number of waiting SMTP connections. Exim passes
27006 this value to the TCP/IP system when it sets up its listener. Once this number
27007 of connections are waiting for the daemon&#x2019;s attention, subsequent connection
27008 attempts are refused at the TCP/IP level. At least, that is what the manuals
27009 say; in some circumstances such connection attempts have been observed to time
27010 out instead. For large systems it is probably a good idea to increase the
27011 value (to 50, say). It also gives some protection against denial-of-service
27012 attacks by SYN flooding.
27013 </para>
27014 <para>
27015 <indexterm role="option">
27016 <primary><option>smtp_enforce_sync</option></primary>
27017 </indexterm>
27018 </para>
27019 <informaltable frame="all">
27020 <tgroup cols="4" colsep="0" rowsep="0">
27021 <colspec colwidth="8*" align="left"/>
27022 <colspec colwidth="6*" align="center"/>
27023 <colspec colwidth="6*" align="center"/>
27024 <colspec colwidth="6*" align="right"/>
27025 <tbody>
27026 <row>
27027 <entry><option>smtp_enforce_sync</option></entry>
27028 <entry>Use: <emphasis>main</emphasis></entry>
27029 <entry>Type: <emphasis>boolean</emphasis></entry>
27030 <entry>Default: <emphasis>true</emphasis></entry>
27031 </row>
27032 </tbody>
27033 </tgroup>
27034 </informaltable>
27035 <para>
27036 <indexterm role="concept">
27037 <primary>SMTP</primary>
27038 <secondary>synchronization checking</secondary>
27039 </indexterm>
27040 <indexterm role="concept">
27041 <primary>synchronization checking in SMTP</primary>
27042 </indexterm>
27043 The SMTP protocol specification requires the client to wait for a response from
27044 the server at certain points in the dialogue. Without PIPELINING these
27045 synchronization points are after every command; with PIPELINING they are
27046 fewer, but they still exist.
27047 </para>
27048 <para>
27049 Some spamming sites send out a complete set of SMTP commands without waiting
27050 for any response. Exim protects against this by rejecting a message if the
27051 client has sent further input when it should not have. The error response <quote>554
27052 SMTP synchronization error</quote> is sent, and the connection is dropped. Testing
27053 for this error cannot be perfect because of transmission delays (unexpected
27054 input may be on its way but not yet received when Exim checks). However, it
27055 does detect many instances.
27056 </para>
27057 <para>
27058 The check can be globally disabled by setting <option>smtp_enforce_sync</option> false.
27059 If you want to disable the check selectively (for example, only for certain
27060 hosts), you can do so by an appropriate use of a <option>control</option> modifier in an ACL
27061 (see section <xref linkend="SECTcontrols"/>). See also <option>pipelining_advertise_hosts</option>.
27062 </para>
27063 <para>
27064 <indexterm role="option">
27065 <primary><option>smtp_etrn_command</option></primary>
27066 </indexterm>
27067 </para>
27068 <informaltable frame="all">
27069 <tgroup cols="4" colsep="0" rowsep="0">
27070 <colspec colwidth="8*" align="left"/>
27071 <colspec colwidth="6*" align="center"/>
27072 <colspec colwidth="6*" align="center"/>
27073 <colspec colwidth="6*" align="right"/>
27074 <tbody>
27075 <row>
27076 <entry><option>smtp_etrn_command</option></entry>
27077 <entry>Use: <emphasis>main</emphasis></entry>
27078 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27079 <entry>Default: <emphasis>unset</emphasis></entry>
27080 </row>
27081 </tbody>
27082 </tgroup>
27083 </informaltable>
27084 <para>
27085 <indexterm role="concept">
27086 <primary>ETRN</primary>
27087 <secondary>command to be run</secondary>
27088 </indexterm>
27089 <indexterm role="variable">
27090 <primary><varname>$domain</varname></primary>
27091 </indexterm>
27092 If this option is set, the given command is run whenever an SMTP ETRN
27093 command is received from a host that is permitted to issue such commands (see
27094 chapter <xref linkend="CHAPACL"/>). The string is split up into separate arguments which
27095 are independently expanded. The expansion variable <varname>$domain</varname> is set to the
27096 argument of the ETRN command, and no syntax checking is done on it. For
27097 example:
27098 </para>
27099 <literallayout class="monospaced">
27100 smtp_etrn_command = /etc/etrn_command $domain \
27101                     $sender_host_address
27102 </literallayout>
27103 <para>
27104 A new process is created to run the command, but Exim does not wait for it to
27105 complete. Consequently, its status cannot be checked. If the command cannot be
27106 run, a line is written to the panic log, but the ETRN caller still receives
27107 a 250 success response. Exim is normally running under its own uid when
27108 receiving SMTP, so it is not possible for it to change the uid before running
27109 the command.
27110 </para>
27111 <para>
27112 <indexterm role="option">
27113 <primary><option>smtp_etrn_serialize</option></primary>
27114 </indexterm>
27115 </para>
27116 <informaltable frame="all">
27117 <tgroup cols="4" colsep="0" rowsep="0">
27118 <colspec colwidth="8*" align="left"/>
27119 <colspec colwidth="6*" align="center"/>
27120 <colspec colwidth="6*" align="center"/>
27121 <colspec colwidth="6*" align="right"/>
27122 <tbody>
27123 <row>
27124 <entry><option>smtp_etrn_serialize</option></entry>
27125 <entry>Use: <emphasis>main</emphasis></entry>
27126 <entry>Type: <emphasis>boolean</emphasis></entry>
27127 <entry>Default: <emphasis>true</emphasis></entry>
27128 </row>
27129 </tbody>
27130 </tgroup>
27131 </informaltable>
27132 <para>
27133 <indexterm role="concept">
27134 <primary>ETRN</primary>
27135 <secondary>serializing</secondary>
27136 </indexterm>
27137 When this option is set, it prevents the simultaneous execution of more than
27138 one identical command as a result of ETRN in an SMTP connection. See
27139 section <xref linkend="SECTETRN"/> for details.
27140 </para>
27141 <para>
27142 <indexterm role="option">
27143 <primary><option>smtp_load_reserve</option></primary>
27144 </indexterm>
27145 </para>
27146 <informaltable frame="all">
27147 <tgroup cols="4" colsep="0" rowsep="0">
27148 <colspec colwidth="8*" align="left"/>
27149 <colspec colwidth="6*" align="center"/>
27150 <colspec colwidth="6*" align="center"/>
27151 <colspec colwidth="6*" align="right"/>
27152 <tbody>
27153 <row>
27154 <entry><option>smtp_load_reserve</option></entry>
27155 <entry>Use: <emphasis>main</emphasis></entry>
27156 <entry>Type: <emphasis>fixed-point</emphasis></entry>
27157 <entry>Default: <emphasis>unset</emphasis></entry>
27158 </row>
27159 </tbody>
27160 </tgroup>
27161 </informaltable>
27162 <para>
27163 <indexterm role="concept">
27164 <primary>load average</primary>
27165 </indexterm>
27166 If the system load average ever gets higher than this, incoming SMTP calls are
27167 accepted only from those hosts that match an entry in <option>smtp_reserve_hosts</option>.
27168 If <option>smtp_reserve_hosts</option> is not set, no incoming SMTP calls are accepted when
27169 the load is over the limit. The option has no effect on ancient operating
27170 systems on which Exim cannot determine the load average. See also
27171 <option>deliver_queue_load_max</option> and <option>queue_only_load</option>.
27172 </para>
27173 <para>
27174 <indexterm role="option">
27175 <primary><option>smtp_max_synprot_errors</option></primary>
27176 </indexterm>
27177 </para>
27178 <informaltable frame="all">
27179 <tgroup cols="4" colsep="0" rowsep="0">
27180 <colspec colwidth="8*" align="left"/>
27181 <colspec colwidth="6*" align="center"/>
27182 <colspec colwidth="6*" align="center"/>
27183 <colspec colwidth="6*" align="right"/>
27184 <tbody>
27185 <row>
27186 <entry><option>smtp_max_synprot_errors</option></entry>
27187 <entry>Use: <emphasis>main</emphasis></entry>
27188 <entry>Type: <emphasis>integer</emphasis></entry>
27189 <entry>Default: <emphasis>3</emphasis></entry>
27190 </row>
27191 </tbody>
27192 </tgroup>
27193 </informaltable>
27194 <para>
27195 <indexterm role="concept">
27196 <primary>SMTP</primary>
27197 <secondary>limiting syntax and protocol errors</secondary>
27198 </indexterm>
27199 <indexterm role="concept">
27200 <primary>limit</primary>
27201 <secondary>SMTP syntax and protocol errors</secondary>
27202 </indexterm>
27203 Exim rejects SMTP commands that contain syntax or protocol errors. In
27204 particular, a syntactically invalid email address, as in this command:
27205 </para>
27206 <literallayout class="monospaced">
27207 RCPT TO:&lt;abc xyz@a.b.c&gt;
27208 </literallayout>
27209 <para>
27210 causes immediate rejection of the command, before any other tests are done.
27211 (The ACL cannot be run if there is no valid address to set up for it.) An
27212 example of a protocol error is receiving RCPT before MAIL. If there are
27213 too many syntax or protocol errors in one SMTP session, the connection is
27214 dropped. The limit is set by this option.
27215 </para>
27216 <para>
27217 <indexterm role="concept">
27218 <primary>PIPELINING</primary>
27219 <secondary>expected errors</secondary>
27220 </indexterm>
27221 When the PIPELINING extension to SMTP is in use, some protocol errors are
27222 <quote>expected</quote>, for instance, a RCPT command after a rejected MAIL command.
27223 Exim assumes that PIPELINING will be used if it advertises it (see
27224 <option>pipelining_advertise_hosts</option>), and in this situation, <quote>expected</quote> errors do
27225 not count towards the limit.
27226 </para>
27227 <para>
27228 <indexterm role="option">
27229 <primary><option>smtp_max_unknown_commands</option></primary>
27230 </indexterm>
27231 </para>
27232 <informaltable frame="all">
27233 <tgroup cols="4" colsep="0" rowsep="0">
27234 <colspec colwidth="8*" align="left"/>
27235 <colspec colwidth="6*" align="center"/>
27236 <colspec colwidth="6*" align="center"/>
27237 <colspec colwidth="6*" align="right"/>
27238 <tbody>
27239 <row>
27240 <entry><option>smtp_max_unknown_commands</option></entry>
27241 <entry>Use: <emphasis>main</emphasis></entry>
27242 <entry>Type: <emphasis>integer</emphasis></entry>
27243 <entry>Default: <emphasis>3</emphasis></entry>
27244 </row>
27245 </tbody>
27246 </tgroup>
27247 </informaltable>
27248 <para>
27249 <indexterm role="concept">
27250 <primary>SMTP</primary>
27251 <secondary>limiting unknown commands</secondary>
27252 </indexterm>
27253 <indexterm role="concept">
27254 <primary>limit</primary>
27255 <secondary>unknown SMTP commands</secondary>
27256 </indexterm>
27257 If there are too many unrecognized commands in an incoming SMTP session, an
27258 Exim server drops the connection. This is a defence against some kinds of abuse
27259 that subvert web
27260 clients
27261 into making connections to SMTP ports; in these circumstances, a number of
27262 non-SMTP command lines are sent first.
27263 </para>
27264 <para>
27265 <indexterm role="option">
27266 <primary><option>smtp_ratelimit_hosts</option></primary>
27267 </indexterm>
27268 </para>
27269 <informaltable frame="all">
27270 <tgroup cols="4" colsep="0" rowsep="0">
27271 <colspec colwidth="8*" align="left"/>
27272 <colspec colwidth="6*" align="center"/>
27273 <colspec colwidth="6*" align="center"/>
27274 <colspec colwidth="6*" align="right"/>
27275 <tbody>
27276 <row>
27277 <entry><option>smtp_ratelimit_hosts</option></entry>
27278 <entry>Use: <emphasis>main</emphasis></entry>
27279 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
27280 <entry>Default: <emphasis>unset</emphasis></entry>
27281 </row>
27282 </tbody>
27283 </tgroup>
27284 </informaltable>
27285 <para>
27286 <indexterm role="concept">
27287 <primary>SMTP</primary>
27288 <secondary>rate limiting</secondary>
27289 </indexterm>
27290 <indexterm role="concept">
27291 <primary>limit</primary>
27292 <secondary>rate of message arrival</secondary>
27293 </indexterm>
27294 <indexterm role="concept">
27295 <primary>RCPT</primary>
27296 <secondary>rate limiting</secondary>
27297 </indexterm>
27298 Some sites find it helpful to be able to limit the rate at which certain hosts
27299 can send them messages, and the rate at which an individual message can specify
27300 recipients.
27301 </para>
27302 <para>
27303 Exim has two rate-limiting facilities. This section describes the older
27304 facility, which can limit rates within a single connection. The newer
27305 <option>ratelimit</option> ACL condition can limit rates across all connections. See section
27306 <xref linkend="SECTratelimiting"/> for details of the newer facility.
27307 </para>
27308 <para>
27309 When a host matches <option>smtp_ratelimit_hosts</option>, the values of
27310 <option>smtp_ratelimit_mail</option> and <option>smtp_ratelimit_rcpt</option> are used to control the
27311 rate of acceptance of MAIL and RCPT commands in a single SMTP session,
27312 respectively. Each option, if set, must contain a set of four comma-separated
27313 values:
27314 </para>
27315 <itemizedlist>
27316 <listitem>
27317 <para>
27318 A threshold, before which there is no rate limiting.
27319 </para>
27320 </listitem>
27321 <listitem>
27322 <para>
27323 An initial time delay. Unlike other times in Exim, numbers with decimal
27324 fractional parts are allowed here.
27325 </para>
27326 </listitem>
27327 <listitem>
27328 <para>
27329 A factor by which to increase the delay each time.
27330 </para>
27331 </listitem>
27332 <listitem>
27333 <para>
27334 A maximum value for the delay. This should normally be less than 5 minutes,
27335 because after that time, the client is liable to timeout the SMTP command.
27336 </para>
27337 </listitem>
27338 </itemizedlist>
27339 <para>
27340 For example, these settings have been used successfully at the site which
27341 first suggested this feature, for controlling mail from their customers:
27342 </para>
27343 <literallayout class="monospaced">
27344 smtp_ratelimit_mail = 2,0.5s,1.05,4m
27345 smtp_ratelimit_rcpt = 4,0.25s,1.015,4m
27346 </literallayout>
27347 <para>
27348 The first setting specifies delays that are applied to MAIL commands after
27349 two have been received over a single connection. The initial delay is 0.5
27350 seconds, increasing by a factor of 1.05 each time. The second setting applies
27351 delays to RCPT commands when more than four occur in a single message.
27352 </para>
27353 <para>
27354 <indexterm role="option">
27355 <primary><option>smtp_ratelimit_mail</option></primary>
27356 </indexterm>
27357 </para>
27358 <informaltable frame="all">
27359 <tgroup cols="4" colsep="0" rowsep="0">
27360 <colspec colwidth="8*" align="left"/>
27361 <colspec colwidth="6*" align="center"/>
27362 <colspec colwidth="6*" align="center"/>
27363 <colspec colwidth="6*" align="right"/>
27364 <tbody>
27365 <row>
27366 <entry><option>smtp_ratelimit_mail</option></entry>
27367 <entry>Use: <emphasis>main</emphasis></entry>
27368 <entry>Type: <emphasis>string</emphasis></entry>
27369 <entry>Default: <emphasis>unset</emphasis></entry>
27370 </row>
27371 </tbody>
27372 </tgroup>
27373 </informaltable>
27374 <para>
27375 See <option>smtp_ratelimit_hosts</option> above.
27376 </para>
27377 <para>
27378 <indexterm role="option">
27379 <primary><option>smtp_ratelimit_rcpt</option></primary>
27380 </indexterm>
27381 </para>
27382 <informaltable frame="all">
27383 <tgroup cols="4" colsep="0" rowsep="0">
27384 <colspec colwidth="8*" align="left"/>
27385 <colspec colwidth="6*" align="center"/>
27386 <colspec colwidth="6*" align="center"/>
27387 <colspec colwidth="6*" align="right"/>
27388 <tbody>
27389 <row>
27390 <entry><option>smtp_ratelimit_rcpt</option></entry>
27391 <entry>Use: <emphasis>main</emphasis></entry>
27392 <entry>Type: <emphasis>string</emphasis></entry>
27393 <entry>Default: <emphasis>unset</emphasis></entry>
27394 </row>
27395 </tbody>
27396 </tgroup>
27397 </informaltable>
27398 <para>
27399 See <option>smtp_ratelimit_hosts</option> above.
27400 </para>
27401 <para>
27402 <indexterm role="option">
27403 <primary><option>smtp_receive_timeout</option></primary>
27404 </indexterm>
27405 </para>
27406 <informaltable frame="all">
27407 <tgroup cols="4" colsep="0" rowsep="0">
27408 <colspec colwidth="8*" align="left"/>
27409 <colspec colwidth="6*" align="center"/>
27410 <colspec colwidth="6*" align="center"/>
27411 <colspec colwidth="6*" align="right"/>
27412 <tbody>
27413 <row>
27414 <entry><option>smtp_receive_timeout</option></entry>
27415 <entry>Use: <emphasis>main</emphasis></entry>
27416 <entry>Type: <emphasis>time</emphasis></entry>
27417 <entry>Default: <emphasis>5m</emphasis></entry>
27418 </row>
27419 </tbody>
27420 </tgroup>
27421 </informaltable>
27422 <para>
27423 <indexterm role="concept">
27424 <primary>timeout</primary>
27425 <secondary>for SMTP input</secondary>
27426 </indexterm>
27427 <indexterm role="concept">
27428 <primary>SMTP</primary>
27429 <secondary>input timeout</secondary>
27430 </indexterm>
27431 This sets a timeout value for SMTP reception. It applies to all forms of SMTP
27432 input, including batch SMTP. If a line of input (either an SMTP command or a
27433 data line) is not received within this time, the SMTP connection is dropped and
27434 the message is abandoned.
27435 A line is written to the log containing one of the following messages:
27436 </para>
27437 <literallayout class="monospaced">
27438 SMTP command timeout on connection from...
27439 SMTP data timeout on connection from...
27440 </literallayout>
27441 <para>
27442 The former means that Exim was expecting to read an SMTP command; the latter
27443 means that it was in the DATA phase, reading the contents of a message.
27444 </para>
27445 <para>
27446 <indexterm role="option">
27447 <primary><option>-os</option></primary>
27448 </indexterm>
27449 The value set by this option can be overridden by the
27450 <option>-os</option> command-line option. A setting of zero time disables the timeout, but
27451 this should never be used for SMTP over TCP/IP. (It can be useful in some cases
27452 of local input using <option>-bs</option> or <option>-bS</option>.) For non-SMTP input, the reception
27453 timeout is controlled by <option>receive_timeout</option> and <option>-or</option>.
27454 </para>
27455 <para>
27456 <indexterm role="option">
27457 <primary><option>smtp_reserve_hosts</option></primary>
27458 </indexterm>
27459 </para>
27460 <informaltable frame="all">
27461 <tgroup cols="4" colsep="0" rowsep="0">
27462 <colspec colwidth="8*" align="left"/>
27463 <colspec colwidth="6*" align="center"/>
27464 <colspec colwidth="6*" align="center"/>
27465 <colspec colwidth="6*" align="right"/>
27466 <tbody>
27467 <row>
27468 <entry><option>smtp_reserve_hosts</option></entry>
27469 <entry>Use: <emphasis>main</emphasis></entry>
27470 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
27471 <entry>Default: <emphasis>unset</emphasis></entry>
27472 </row>
27473 </tbody>
27474 </tgroup>
27475 </informaltable>
27476 <para>
27477 This option defines hosts for which SMTP connections are reserved; see
27478 <option>smtp_accept_reserve</option> and <option>smtp_load_reserve</option> above.
27479 </para>
27480 <para>
27481 <indexterm role="option">
27482 <primary><option>smtp_return_error_details</option></primary>
27483 </indexterm>
27484 </para>
27485 <informaltable frame="all">
27486 <tgroup cols="4" colsep="0" rowsep="0">
27487 <colspec colwidth="8*" align="left"/>
27488 <colspec colwidth="6*" align="center"/>
27489 <colspec colwidth="6*" align="center"/>
27490 <colspec colwidth="6*" align="right"/>
27491 <tbody>
27492 <row>
27493 <entry><option>smtp_return_error_details</option></entry>
27494 <entry>Use: <emphasis>main</emphasis></entry>
27495 <entry>Type: <emphasis>boolean</emphasis></entry>
27496 <entry>Default: <emphasis>false</emphasis></entry>
27497 </row>
27498 </tbody>
27499 </tgroup>
27500 </informaltable>
27501 <para>
27502 <indexterm role="concept">
27503 <primary>SMTP</primary>
27504 <secondary>details policy failures</secondary>
27505 </indexterm>
27506 <indexterm role="concept">
27507 <primary>policy control</primary>
27508 <secondary>rejection, returning details</secondary>
27509 </indexterm>
27510 In the default state, Exim uses bland messages such as
27511 <quote>Administrative prohibition</quote> when it rejects SMTP commands for policy
27512 reasons. Many sysadmins like this because it gives away little information
27513 to spammers. However, some other sysadmins who are applying strict checking
27514 policies want to give out much fuller information about failures. Setting
27515 <option>smtp_return_error_details</option> true causes Exim to be more forthcoming. For
27516 example, instead of <quote>Administrative prohibition</quote>, it might give:
27517 </para>
27518 <literallayout class="monospaced">
27519 550-Rejected after DATA: '&gt;' missing at end of address:
27520 550 failing address in "From" header is: &lt;user@dom.ain
27521 </literallayout>
27522 <para>
27523 <indexterm role="option">
27524 <primary><option>spamd_address</option></primary>
27525 </indexterm>
27526 </para>
27527 <informaltable frame="all">
27528 <tgroup cols="4" colsep="0" rowsep="0">
27529 <colspec colwidth="8*" align="left"/>
27530 <colspec colwidth="6*" align="center"/>
27531 <colspec colwidth="6*" align="center"/>
27532 <colspec colwidth="6*" align="right"/>
27533 <tbody>
27534 <row>
27535 <entry><option>spamd_address</option></entry>
27536 <entry>Use: <emphasis>main</emphasis></entry>
27537 <entry>Type: <emphasis>string</emphasis></entry>
27538 <entry>Default: <emphasis>see below</emphasis></entry>
27539 </row>
27540 </tbody>
27541 </tgroup>
27542 </informaltable>
27543 <para>
27544 This option is available when Exim is compiled with the content-scanning
27545 extension. It specifies how Exim connects to SpamAssassin&#x2019;s <option>spamd</option> daemon.
27546 The default value is
27547 </para>
27548 <literallayout class="monospaced">
27549 127.0.0.1 783
27550 </literallayout>
27551 <para>
27552 See section <xref linkend="SECTscanspamass"/> for more details.
27553 </para>
27554 <para>
27555 <indexterm role="option">
27556 <primary><option>split_spool_directory</option></primary>
27557 </indexterm>
27558 </para>
27559 <informaltable frame="all">
27560 <tgroup cols="4" colsep="0" rowsep="0">
27561 <colspec colwidth="8*" align="left"/>
27562 <colspec colwidth="6*" align="center"/>
27563 <colspec colwidth="6*" align="center"/>
27564 <colspec colwidth="6*" align="right"/>
27565 <tbody>
27566 <row>
27567 <entry><option>split_spool_directory</option></entry>
27568 <entry>Use: <emphasis>main</emphasis></entry>
27569 <entry>Type: <emphasis>boolean</emphasis></entry>
27570 <entry>Default: <emphasis>false</emphasis></entry>
27571 </row>
27572 </tbody>
27573 </tgroup>
27574 </informaltable>
27575 <para>
27576 <indexterm role="concept">
27577 <primary>multiple spool directories</primary>
27578 </indexterm>
27579 <indexterm role="concept">
27580 <primary>spool directory</primary>
27581 <secondary>split</secondary>
27582 </indexterm>
27583 <indexterm role="concept">
27584 <primary>directories, multiple</primary>
27585 </indexterm>
27586 If this option is set, it causes Exim to split its input directory into 62
27587 subdirectories, each with a single alphanumeric character as its name. The
27588 sixth character of the message id is used to allocate messages to
27589 subdirectories; this is the least significant base-62 digit of the time of
27590 arrival of the message.
27591 </para>
27592 <para>
27593 Splitting up the spool in this way may provide better performance on systems
27594 where there are long mail queues, by reducing the number of files in any one
27595 directory. The msglog directory is also split up in a similar way to the input
27596 directory; however, if <option>preserve_message_logs</option> is set, all old msglog files
27597 are still placed in the single directory <filename>msglog.OLD</filename>.
27598 </para>
27599 <para>
27600 It is not necessary to take any special action for existing messages when
27601 changing <option>split_spool_directory</option>. Exim notices messages that are in the
27602 <quote>wrong</quote> place, and continues to process them. If the option is turned off
27603 after a period of being on, the subdirectories will eventually empty and be
27604 automatically deleted.
27605 </para>
27606 <para>
27607 When <option>split_spool_directory</option> is set, the behaviour of queue runner processes
27608 changes. Instead of creating a list of all messages in the queue, and then
27609 trying to deliver each one in turn, it constructs a list of those in one
27610 sub-directory and tries to deliver them, before moving on to the next
27611 sub-directory. The sub-directories are processed in a random order. This
27612 spreads out the scanning of the input directories, and uses less memory. It is
27613 particularly beneficial when there are lots of messages on the queue. However,
27614 if <option>queue_run_in_order</option> is set, none of this new processing happens. The
27615 entire queue has to be scanned and sorted before any deliveries can start.
27616 </para>
27617 <para>
27618 <indexterm role="option">
27619 <primary><option>spool_directory</option></primary>
27620 </indexterm>
27621 </para>
27622 <informaltable frame="all">
27623 <tgroup cols="4" colsep="0" rowsep="0">
27624 <colspec colwidth="8*" align="left"/>
27625 <colspec colwidth="6*" align="center"/>
27626 <colspec colwidth="6*" align="center"/>
27627 <colspec colwidth="6*" align="right"/>
27628 <tbody>
27629 <row>
27630 <entry><option>spool_directory</option></entry>
27631 <entry>Use: <emphasis>main</emphasis></entry>
27632 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27633 <entry>Default: <emphasis>set at compile time</emphasis></entry>
27634 </row>
27635 </tbody>
27636 </tgroup>
27637 </informaltable>
27638 <para>
27639 <indexterm role="concept">
27640 <primary>spool directory</primary>
27641 <secondary>path to</secondary>
27642 </indexterm>
27643 This defines the directory in which Exim keeps its spool, that is, the messages
27644 it is waiting to deliver. The default value is taken from the compile-time
27645 configuration setting, if there is one. If not, this option must be set. The
27646 string is expanded, so it can contain, for example, a reference to
27647 <varname>$primary_hostname</varname>.
27648 </para>
27649 <para>
27650 If the spool directory name is fixed on your installation, it is recommended
27651 that you set it at build time rather than from this option, particularly if the
27652 log files are being written to the spool directory (see <option>log_file_path</option>).
27653 Otherwise log files cannot be used for errors that are detected early on, such
27654 as failures in the configuration file.
27655 </para>
27656 <para>
27657 By using this option to override the compiled-in path, it is possible to run
27658 tests of Exim without using the standard spool.
27659 </para>
27660 <para>
27661 <indexterm role="option">
27662 <primary><option>sqlite_lock_timeout</option></primary>
27663 </indexterm>
27664 </para>
27665 <informaltable frame="all">
27666 <tgroup cols="4" colsep="0" rowsep="0">
27667 <colspec colwidth="8*" align="left"/>
27668 <colspec colwidth="6*" align="center"/>
27669 <colspec colwidth="6*" align="center"/>
27670 <colspec colwidth="6*" align="right"/>
27671 <tbody>
27672 <row>
27673 <entry><option>sqlite_lock_timeout</option></entry>
27674 <entry>Use: <emphasis>main</emphasis></entry>
27675 <entry>Type: <emphasis>time</emphasis></entry>
27676 <entry>Default: <emphasis>5s</emphasis></entry>
27677 </row>
27678 </tbody>
27679 </tgroup>
27680 </informaltable>
27681 <para>
27682 <indexterm role="concept">
27683 <primary>sqlite lookup type</primary>
27684 <secondary>lock timeout</secondary>
27685 </indexterm>
27686 This option controls the timeout that the <command>sqlite</command> lookup uses when trying to
27687 access an SQLite database. See section <xref linkend="SECTsqlite"/> for more details.
27688 </para>
27689 <para>
27690 <indexterm role="option">
27691 <primary><option>strict_acl_vars</option></primary>
27692 </indexterm>
27693 </para>
27694 <informaltable frame="all">
27695 <tgroup cols="4" colsep="0" rowsep="0">
27696 <colspec colwidth="8*" align="left"/>
27697 <colspec colwidth="6*" align="center"/>
27698 <colspec colwidth="6*" align="center"/>
27699 <colspec colwidth="6*" align="right"/>
27700 <tbody>
27701 <row>
27702 <entry><option>strict_acl_vars</option></entry>
27703 <entry>Use: <emphasis>main</emphasis></entry>
27704 <entry>Type: <emphasis>boolean</emphasis></entry>
27705 <entry>Default: <emphasis>false</emphasis></entry>
27706 </row>
27707 </tbody>
27708 </tgroup>
27709 </informaltable>
27710 <para>
27711 <indexterm role="concept">
27712 <primary>access control lists (ACLs)</primary>
27713 <secondary>variables, handling unset</secondary>
27714 </indexterm>
27715 This option controls what happens if a syntactically valid but undefined ACL
27716 variable is referenced. If it is false (the default), an empty string
27717 is substituted; if it is true, an error is generated. See section
27718 <xref linkend="SECTaclvariables"/> for details of ACL variables.
27719 </para>
27720 <para>
27721 <indexterm role="option">
27722 <primary><option>strip_excess_angle_brackets</option></primary>
27723 </indexterm>
27724 </para>
27725 <informaltable frame="all">
27726 <tgroup cols="4" colsep="0" rowsep="0">
27727 <colspec colwidth="8*" align="left"/>
27728 <colspec colwidth="6*" align="center"/>
27729 <colspec colwidth="6*" align="center"/>
27730 <colspec colwidth="6*" align="right"/>
27731 <tbody>
27732 <row>
27733 <entry><option>strip_excess_angle_brackets</option></entry>
27734 <entry>Use: <emphasis>main</emphasis></entry>
27735 <entry>Type: <emphasis>boolean</emphasis></entry>
27736 <entry>Default: <emphasis>false</emphasis></entry>
27737 </row>
27738 </tbody>
27739 </tgroup>
27740 </informaltable>
27741 <para>
27742 <indexterm role="concept">
27743 <primary>angle brackets, excess</primary>
27744 </indexterm>
27745 If this option is set, redundant pairs of angle brackets round <quote>route-addr</quote>
27746 items in addresses are stripped. For example, <emphasis>&lt;&lt;xxx@a.b.c.d&gt;&gt;</emphasis> is
27747 treated as <emphasis>&lt;xxx@a.b.c.d&gt;</emphasis>. If this is in the envelope and the message is
27748 passed on to another MTA, the excess angle brackets are not passed on. If this
27749 option is not set, multiple pairs of angle brackets cause a syntax error.
27750 </para>
27751 <para>
27752 <indexterm role="option">
27753 <primary><option>strip_trailing_dot</option></primary>
27754 </indexterm>
27755 </para>
27756 <informaltable frame="all">
27757 <tgroup cols="4" colsep="0" rowsep="0">
27758 <colspec colwidth="8*" align="left"/>
27759 <colspec colwidth="6*" align="center"/>
27760 <colspec colwidth="6*" align="center"/>
27761 <colspec colwidth="6*" align="right"/>
27762 <tbody>
27763 <row>
27764 <entry><option>strip_trailing_dot</option></entry>
27765 <entry>Use: <emphasis>main</emphasis></entry>
27766 <entry>Type: <emphasis>boolean</emphasis></entry>
27767 <entry>Default: <emphasis>false</emphasis></entry>
27768 </row>
27769 </tbody>
27770 </tgroup>
27771 </informaltable>
27772 <para>
27773 <indexterm role="concept">
27774 <primary>trailing dot on domain</primary>
27775 </indexterm>
27776 <indexterm role="concept">
27777 <primary>dot</primary>
27778 <secondary>trailing on domain</secondary>
27779 </indexterm>
27780 If this option is set, a trailing dot at the end of a domain in an address is
27781 ignored. If this is in the envelope and the message is passed on to another
27782 MTA, the dot is not passed on. If this option is not set, a dot at the end of a
27783 domain causes a syntax error.
27784 However, addresses in header lines are checked only when an ACL requests header
27785 syntax checking.
27786 </para>
27787 <para>
27788 <indexterm role="option">
27789 <primary><option>syslog_duplication</option></primary>
27790 </indexterm>
27791 </para>
27792 <informaltable frame="all">
27793 <tgroup cols="4" colsep="0" rowsep="0">
27794 <colspec colwidth="8*" align="left"/>
27795 <colspec colwidth="6*" align="center"/>
27796 <colspec colwidth="6*" align="center"/>
27797 <colspec colwidth="6*" align="right"/>
27798 <tbody>
27799 <row>
27800 <entry><option>syslog_duplication</option></entry>
27801 <entry>Use: <emphasis>main</emphasis></entry>
27802 <entry>Type: <emphasis>boolean</emphasis></entry>
27803 <entry>Default: <emphasis>true</emphasis></entry>
27804 </row>
27805 </tbody>
27806 </tgroup>
27807 </informaltable>
27808 <para>
27809 <indexterm role="concept">
27810 <primary>syslog</primary>
27811 <secondary>duplicate log lines; suppressing</secondary>
27812 </indexterm>
27813 When Exim is logging to syslog, it writes the log lines for its three
27814 separate logs at different syslog priorities so that they can in principle
27815 be separated on the logging hosts. Some installations do not require this
27816 separation, and in those cases, the duplication of certain log lines is a
27817 nuisance. If <option>syslog_duplication</option> is set false, only one copy of any
27818 particular log line is written to syslog. For lines that normally go to
27819 both the main log and the reject log, the reject log version (possibly
27820 containing message header lines) is written, at LOG_NOTICE priority.
27821 Lines that normally go to both the main and the panic log are written at
27822 the LOG_ALERT priority.
27823 </para>
27824 <para>
27825 <indexterm role="option">
27826 <primary><option>syslog_facility</option></primary>
27827 </indexterm>
27828 </para>
27829 <informaltable frame="all">
27830 <tgroup cols="4" colsep="0" rowsep="0">
27831 <colspec colwidth="8*" align="left"/>
27832 <colspec colwidth="6*" align="center"/>
27833 <colspec colwidth="6*" align="center"/>
27834 <colspec colwidth="6*" align="right"/>
27835 <tbody>
27836 <row>
27837 <entry><option>syslog_facility</option></entry>
27838 <entry>Use: <emphasis>main</emphasis></entry>
27839 <entry>Type: <emphasis>string</emphasis></entry>
27840 <entry>Default: <emphasis>unset</emphasis></entry>
27841 </row>
27842 </tbody>
27843 </tgroup>
27844 </informaltable>
27845 <para>
27846 <indexterm role="concept">
27847 <primary>syslog</primary>
27848 <secondary>facility; setting</secondary>
27849 </indexterm>
27850 This option sets the syslog <quote>facility</quote> name, used when Exim is logging to
27851 syslog. The value must be one of the strings <quote>mail</quote>, <quote>user</quote>, <quote>news</quote>,
27852 <quote>uucp</quote>, <quote>daemon</quote>, or <quote>local<emphasis>x</emphasis></quote> where <emphasis>x</emphasis> is a digit between 0 and 7.
27853 If this option is unset, <quote>mail</quote> is used. See chapter <xref linkend="CHAPlog"/> for
27854 details of Exim&#x2019;s logging.
27855 </para>
27856 <para>
27857 <indexterm role="option">
27858 <primary><option>syslog_processname</option></primary>
27859 </indexterm>
27860 </para>
27861 <informaltable frame="all">
27862 <tgroup cols="4" colsep="0" rowsep="0">
27863 <colspec colwidth="8*" align="left"/>
27864 <colspec colwidth="6*" align="center"/>
27865 <colspec colwidth="6*" align="center"/>
27866 <colspec colwidth="6*" align="right"/>
27867 <tbody>
27868 <row>
27869 <entry><option>syslog_processname</option></entry>
27870 <entry>Use: <emphasis>main</emphasis></entry>
27871 <entry>Type: <emphasis>string</emphasis></entry>
27872 <entry>Default: <emphasis><literal>exim</literal></emphasis></entry>
27873 </row>
27874 </tbody>
27875 </tgroup>
27876 </informaltable>
27877 <para>
27878 <indexterm role="concept">
27879 <primary>syslog</primary>
27880 <secondary>process name; setting</secondary>
27881 </indexterm>
27882 This option sets the syslog <quote>ident</quote> name, used when Exim is logging to
27883 syslog. The value must be no longer than 32 characters. See chapter
27884 <xref linkend="CHAPlog"/> for details of Exim&#x2019;s logging.
27885 </para>
27886 <para>
27887 <indexterm role="option">
27888 <primary><option>syslog_timestamp</option></primary>
27889 </indexterm>
27890 </para>
27891 <informaltable frame="all">
27892 <tgroup cols="4" colsep="0" rowsep="0">
27893 <colspec colwidth="8*" align="left"/>
27894 <colspec colwidth="6*" align="center"/>
27895 <colspec colwidth="6*" align="center"/>
27896 <colspec colwidth="6*" align="right"/>
27897 <tbody>
27898 <row>
27899 <entry><option>syslog_timestamp</option></entry>
27900 <entry>Use: <emphasis>main</emphasis></entry>
27901 <entry>Type: <emphasis>boolean</emphasis></entry>
27902 <entry>Default: <emphasis>true</emphasis></entry>
27903 </row>
27904 </tbody>
27905 </tgroup>
27906 </informaltable>
27907 <para>
27908 <indexterm role="concept">
27909 <primary>syslog</primary>
27910 <secondary>timestamps</secondary>
27911 </indexterm>
27912 If <option>syslog_timestamp</option> is set false, the timestamps on Exim&#x2019;s log lines are
27913 omitted when these lines are sent to syslog. See chapter <xref linkend="CHAPlog"/> for
27914 details of Exim&#x2019;s logging.
27915 </para>
27916 <para>
27917 <indexterm role="option">
27918 <primary><option>system_filter</option></primary>
27919 </indexterm>
27920 </para>
27921 <informaltable frame="all">
27922 <tgroup cols="4" colsep="0" rowsep="0">
27923 <colspec colwidth="8*" align="left"/>
27924 <colspec colwidth="6*" align="center"/>
27925 <colspec colwidth="6*" align="center"/>
27926 <colspec colwidth="6*" align="right"/>
27927 <tbody>
27928 <row>
27929 <entry><option>system_filter</option></entry>
27930 <entry>Use: <emphasis>main</emphasis></entry>
27931 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27932 <entry>Default: <emphasis>unset</emphasis></entry>
27933 </row>
27934 </tbody>
27935 </tgroup>
27936 </informaltable>
27937 <para>
27938 <indexterm role="concept">
27939 <primary>filter</primary>
27940 <secondary>system filter</secondary>
27941 </indexterm>
27942 <indexterm role="concept">
27943 <primary>system filter</primary>
27944 <secondary>specifying</secondary>
27945 </indexterm>
27946 <indexterm role="concept">
27947 <primary>Sieve filter</primary>
27948 <secondary>not available for system filter</secondary>
27949 </indexterm>
27950 This option specifies an Exim filter file that is applied to all messages at
27951 the start of each delivery attempt, before any routing is done. System filters
27952 must be Exim filters; they cannot be Sieve filters. If the system filter
27953 generates any deliveries to files or pipes, or any new mail messages, the
27954 appropriate <option>system_filter_..._transport</option> option(s) must be set, to define
27955 which transports are to be used. Details of this facility are given in chapter
27956 <xref linkend="CHAPsystemfilter"/>.
27957 </para>
27958 <para>
27959 <indexterm role="option">
27960 <primary><option>system_filter_directory_transport</option></primary>
27961 </indexterm>
27962 </para>
27963 <informaltable frame="all">
27964 <tgroup cols="4" colsep="0" rowsep="0">
27965 <colspec colwidth="8*" align="left"/>
27966 <colspec colwidth="6*" align="center"/>
27967 <colspec colwidth="6*" align="center"/>
27968 <colspec colwidth="6*" align="right"/>
27969 <tbody>
27970 <row>
27971 <entry><option>system_filter_directory_transport</option></entry>
27972 <entry>Use: <emphasis>main</emphasis></entry>
27973 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27974 <entry>Default: <emphasis>unset</emphasis></entry>
27975 </row>
27976 </tbody>
27977 </tgroup>
27978 </informaltable>
27979 <para>
27980 <indexterm role="variable">
27981 <primary><varname>$address_file</varname></primary>
27982 </indexterm>
27983 This sets the name of the transport driver that is to be used when the
27984 <option>save</option> command in a system message filter specifies a path ending in <quote>/</quote>,
27985 implying delivery of each message into a separate file in some directory.
27986 During the delivery, the variable <varname>$address_file</varname> contains the path name.
27987 </para>
27988 <para>
27989 <indexterm role="option">
27990 <primary><option>system_filter_file_transport</option></primary>
27991 </indexterm>
27992 </para>
27993 <informaltable frame="all">
27994 <tgroup cols="4" colsep="0" rowsep="0">
27995 <colspec colwidth="8*" align="left"/>
27996 <colspec colwidth="6*" align="center"/>
27997 <colspec colwidth="6*" align="center"/>
27998 <colspec colwidth="6*" align="right"/>
27999 <tbody>
28000 <row>
28001 <entry><option>system_filter_file_transport</option></entry>
28002 <entry>Use: <emphasis>main</emphasis></entry>
28003 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28004 <entry>Default: <emphasis>unset</emphasis></entry>
28005 </row>
28006 </tbody>
28007 </tgroup>
28008 </informaltable>
28009 <para>
28010 <indexterm role="concept">
28011 <primary>file</primary>
28012 <secondary>transport for system filter</secondary>
28013 </indexterm>
28014 This sets the name of the transport driver that is to be used when the <option>save</option>
28015 command in a system message filter specifies a path not ending in <quote>/</quote>. During
28016 the delivery, the variable <varname>$address_file</varname> contains the path name.
28017 </para>
28018 <para>
28019 <indexterm role="option">
28020 <primary><option>system_filter_group</option></primary>
28021 </indexterm>
28022 </para>
28023 <informaltable frame="all">
28024 <tgroup cols="4" colsep="0" rowsep="0">
28025 <colspec colwidth="8*" align="left"/>
28026 <colspec colwidth="6*" align="center"/>
28027 <colspec colwidth="6*" align="center"/>
28028 <colspec colwidth="6*" align="right"/>
28029 <tbody>
28030 <row>
28031 <entry><option>system_filter_group</option></entry>
28032 <entry>Use: <emphasis>main</emphasis></entry>
28033 <entry>Type: <emphasis>string</emphasis></entry>
28034 <entry>Default: <emphasis>unset</emphasis></entry>
28035 </row>
28036 </tbody>
28037 </tgroup>
28038 </informaltable>
28039 <para>
28040 <indexterm role="concept">
28041 <primary>gid (group id)</primary>
28042 <secondary>system filter</secondary>
28043 </indexterm>
28044 This option is used only when <option>system_filter_user</option> is also set. It sets the
28045 gid under which the system filter is run, overriding any gid that is associated
28046 with the user. The value may be numerical or symbolic.
28047 </para>
28048 <para>
28049 <indexterm role="option">
28050 <primary><option>system_filter_pipe_transport</option></primary>
28051 </indexterm>
28052 </para>
28053 <informaltable frame="all">
28054 <tgroup cols="4" colsep="0" rowsep="0">
28055 <colspec colwidth="8*" align="left"/>
28056 <colspec colwidth="6*" align="center"/>
28057 <colspec colwidth="6*" align="center"/>
28058 <colspec colwidth="6*" align="right"/>
28059 <tbody>
28060 <row>
28061 <entry><option>system_filter_pipe_transport</option></entry>
28062 <entry>Use: <emphasis>main</emphasis></entry>
28063 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28064 <entry>Default: <emphasis>unset</emphasis></entry>
28065 </row>
28066 </tbody>
28067 </tgroup>
28068 </informaltable>
28069 <para>
28070 <indexterm role="concept">
28071 <primary><command>pipe</command> transport</primary>
28072 <secondary>for system filter</secondary>
28073 </indexterm>
28074 <indexterm role="variable">
28075 <primary><varname>$address_pipe</varname></primary>
28076 </indexterm>
28077 This specifies the transport driver that is to be used when a <option>pipe</option> command
28078 is used in a system filter. During the delivery, the variable <varname>$address_pipe</varname>
28079 contains the pipe command.
28080 </para>
28081 <para>
28082 <indexterm role="option">
28083 <primary><option>system_filter_reply_transport</option></primary>
28084 </indexterm>
28085 </para>
28086 <informaltable frame="all">
28087 <tgroup cols="4" colsep="0" rowsep="0">
28088 <colspec colwidth="8*" align="left"/>
28089 <colspec colwidth="6*" align="center"/>
28090 <colspec colwidth="6*" align="center"/>
28091 <colspec colwidth="6*" align="right"/>
28092 <tbody>
28093 <row>
28094 <entry><option>system_filter_reply_transport</option></entry>
28095 <entry>Use: <emphasis>main</emphasis></entry>
28096 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28097 <entry>Default: <emphasis>unset</emphasis></entry>
28098 </row>
28099 </tbody>
28100 </tgroup>
28101 </informaltable>
28102 <para>
28103 <indexterm role="concept">
28104 <primary><command>autoreply</command> transport</primary>
28105 <secondary>for system filter</secondary>
28106 </indexterm>
28107 This specifies the transport driver that is to be used when a <option>mail</option> command
28108 is used in a system filter.
28109 </para>
28110 <para revisionflag="changed">
28111 <indexterm role="option">
28112 <primary><option>system_filter_user</option></primary>
28113 </indexterm>
28114 </para>
28115 <informaltable frame="all" revisionflag="changed">
28116 <tgroup cols="4" colsep="0" rowsep="0">
28117 <colspec colwidth="8*" align="left"/>
28118 <colspec colwidth="6*" align="center"/>
28119 <colspec colwidth="6*" align="center"/>
28120 <colspec colwidth="6*" align="right"/>
28121 <tbody>
28122 <row>
28123 <entry><option>system_filter_user</option></entry>
28124 <entry>Use: <emphasis>main</emphasis></entry>
28125 <entry>Type: <emphasis>string</emphasis></entry>
28126 <entry>Default: <emphasis>unset</emphasis></entry>
28127 </row>
28128 </tbody>
28129 </tgroup>
28130 </informaltable>
28131 <para revisionflag="changed">
28132 <indexterm role="concept">
28133 <primary>uid (user id)</primary>
28134 <secondary>system filter</secondary>
28135 </indexterm>
28136 If this option is set to root, the system filter is run in the main Exim
28137 delivery process, as root.  Otherwise, the system filter runs in a separate
28138 process, as the given user, defaulting to the Exim run-time user.
28139 Unless the string consists entirely of digits, it
28140 is looked up in the password data. Failure to find the named user causes a
28141 configuration error. The gid is either taken from the password data, or
28142 specified by <option>system_filter_group</option>. When the uid is specified numerically,
28143 <option>system_filter_group</option> is required to be set.
28144 </para>
28145 <para revisionflag="changed">
28146 If the system filter generates any pipe, file, or reply deliveries, the uid
28147 under which the filter is run is used when transporting them, unless a
28148 transport option overrides.
28149 </para>
28150 <para>
28151 <indexterm role="option">
28152 <primary><option>tcp_nodelay</option></primary>
28153 </indexterm>
28154 </para>
28155 <informaltable frame="all">
28156 <tgroup cols="4" colsep="0" rowsep="0">
28157 <colspec colwidth="8*" align="left"/>
28158 <colspec colwidth="6*" align="center"/>
28159 <colspec colwidth="6*" align="center"/>
28160 <colspec colwidth="6*" align="right"/>
28161 <tbody>
28162 <row>
28163 <entry><option>tcp_nodelay</option></entry>
28164 <entry>Use: <emphasis>main</emphasis></entry>
28165 <entry>Type: <emphasis>boolean</emphasis></entry>
28166 <entry>Default: <emphasis>true</emphasis></entry>
28167 </row>
28168 </tbody>
28169 </tgroup>
28170 </informaltable>
28171 <para>
28172 <indexterm role="concept">
28173 <primary>daemon</primary>
28174 <secondary>TCP_NODELAY on sockets</secondary>
28175 </indexterm>
28176 <indexterm role="concept">
28177 <primary>Nagle algorithm</primary>
28178 </indexterm>
28179 <indexterm role="concept">
28180 <primary>TCP_NODELAY on listening sockets</primary>
28181 </indexterm>
28182 If this option is set false, it stops the Exim daemon setting the
28183 TCP_NODELAY option on its listening sockets. Setting TCP_NODELAY
28184 turns off the <quote>Nagle algorithm</quote>, which is a way of improving network
28185 performance in interactive (character-by-character) situations. Turning it off
28186 should improve Exim&#x2019;s performance a bit, so that is what happens by default.
28187 However, it appears that some broken clients cannot cope, and time out. Hence
28188 this option. It affects only those sockets that are set up for listening by the
28189 daemon. Sockets created by the smtp transport for delivering mail always set
28190 TCP_NODELAY.
28191 </para>
28192 <para>
28193 <indexterm role="option">
28194 <primary><option>timeout_frozen_after</option></primary>
28195 </indexterm>
28196 </para>
28197 <informaltable frame="all">
28198 <tgroup cols="4" colsep="0" rowsep="0">
28199 <colspec colwidth="8*" align="left"/>
28200 <colspec colwidth="6*" align="center"/>
28201 <colspec colwidth="6*" align="center"/>
28202 <colspec colwidth="6*" align="right"/>
28203 <tbody>
28204 <row>
28205 <entry><option>timeout_frozen_after</option></entry>
28206 <entry>Use: <emphasis>main</emphasis></entry>
28207 <entry>Type: <emphasis>time</emphasis></entry>
28208 <entry>Default: <emphasis>0s</emphasis></entry>
28209 </row>
28210 </tbody>
28211 </tgroup>
28212 </informaltable>
28213 <para>
28214 <indexterm role="concept">
28215 <primary>frozen messages</primary>
28216 <secondary>timing out</secondary>
28217 </indexterm>
28218 <indexterm role="concept">
28219 <primary>timeout</primary>
28220 <secondary>frozen messages</secondary>
28221 </indexterm>
28222 If <option>timeout_frozen_after</option> is set to a time greater than zero, a frozen
28223 message of any kind that has been on the queue for longer than the given time
28224 is automatically cancelled at the next queue run. If the frozen message is a
28225 bounce message, it is just discarded; otherwise, a bounce is sent to the
28226 sender, in a similar manner to cancellation by the <option>-Mg</option> command line option.
28227 If you want to timeout frozen bounce messages earlier than other kinds of
28228 frozen message, see <option>ignore_bounce_errors_after</option>.
28229 </para>
28230 <para>
28231 <emphasis role="bold">Note:</emphasis> the default value of zero means no timeouts; with this setting,
28232 frozen messages remain on the queue forever (except for any frozen bounce
28233 messages that are released by <option>ignore_bounce_errors_after</option>).
28234 </para>
28235 <para>
28236 <indexterm role="option">
28237 <primary><option>timezone</option></primary>
28238 </indexterm>
28239 </para>
28240 <informaltable frame="all">
28241 <tgroup cols="4" colsep="0" rowsep="0">
28242 <colspec colwidth="8*" align="left"/>
28243 <colspec colwidth="6*" align="center"/>
28244 <colspec colwidth="6*" align="center"/>
28245 <colspec colwidth="6*" align="right"/>
28246 <tbody>
28247 <row>
28248 <entry><option>timezone</option></entry>
28249 <entry>Use: <emphasis>main</emphasis></entry>
28250 <entry>Type: <emphasis>string</emphasis></entry>
28251 <entry>Default: <emphasis>unset</emphasis></entry>
28252 </row>
28253 </tbody>
28254 </tgroup>
28255 </informaltable>
28256 <para>
28257 <indexterm role="concept">
28258 <primary>timezone, setting</primary>
28259 </indexterm>
28260 The value of <option>timezone</option> is used to set the environment variable TZ while
28261 running Exim (if it is different on entry). This ensures that all timestamps
28262 created by Exim are in the required timezone. If you want all your timestamps
28263 to be in UTC (aka GMT) you should set
28264 </para>
28265 <literallayout class="monospaced">
28266 timezone = UTC
28267 </literallayout>
28268 <para>
28269 The default value is taken from TIMEZONE_DEFAULT in <filename>Local/Makefile</filename>,
28270 or, if that is not set, from the value of the TZ environment variable when Exim
28271 is built. If <option>timezone</option> is set to the empty string, either at build or run
28272 time, any existing TZ variable is removed from the environment when Exim
28273 runs. This is appropriate behaviour for obtaining wall-clock time on some, but
28274 unfortunately not all, operating systems.
28275 </para>
28276 <para>
28277 <indexterm role="option">
28278 <primary><option>tls_advertise_hosts</option></primary>
28279 </indexterm>
28280 </para>
28281 <informaltable frame="all">
28282 <tgroup cols="4" colsep="0" rowsep="0">
28283 <colspec colwidth="8*" align="left"/>
28284 <colspec colwidth="6*" align="center"/>
28285 <colspec colwidth="6*" align="center"/>
28286 <colspec colwidth="6*" align="right"/>
28287 <tbody>
28288 <row>
28289 <entry><option>tls_advertise_hosts</option></entry>
28290 <entry>Use: <emphasis>main</emphasis></entry>
28291 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28292 <entry>Default: <emphasis>unset</emphasis></entry>
28293 </row>
28294 </tbody>
28295 </tgroup>
28296 </informaltable>
28297 <para>
28298 <indexterm role="concept">
28299 <primary>TLS</primary>
28300 <secondary>advertising</secondary>
28301 </indexterm>
28302 <indexterm role="concept">
28303 <primary>encryption</primary>
28304 <secondary>on SMTP connection</secondary>
28305 </indexterm>
28306 <indexterm role="concept">
28307 <primary>SMTP</primary>
28308 <secondary>encrypted connection</secondary>
28309 </indexterm>
28310 When Exim is built with support for TLS encrypted connections, the availability
28311 of the STARTTLS command to set up an encrypted session is advertised in
28312 response to EHLO only to those client hosts that match this option. See
28313 chapter <xref linkend="CHAPTLS"/> for details of Exim&#x2019;s support for TLS.
28314 </para>
28315 <para>
28316 <indexterm role="option">
28317 <primary><option>tls_certificate</option></primary>
28318 </indexterm>
28319 </para>
28320 <informaltable frame="all">
28321 <tgroup cols="4" colsep="0" rowsep="0">
28322 <colspec colwidth="8*" align="left"/>
28323 <colspec colwidth="6*" align="center"/>
28324 <colspec colwidth="6*" align="center"/>
28325 <colspec colwidth="6*" align="right"/>
28326 <tbody>
28327 <row>
28328 <entry><option>tls_certificate</option></entry>
28329 <entry>Use: <emphasis>main</emphasis></entry>
28330 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28331 <entry>Default: <emphasis>unset</emphasis></entry>
28332 </row>
28333 </tbody>
28334 </tgroup>
28335 </informaltable>
28336 <para>
28337 <indexterm role="concept">
28338 <primary>TLS</primary>
28339 <secondary>server certificate; location of</secondary>
28340 </indexterm>
28341 <indexterm role="concept">
28342 <primary>certificate</primary>
28343 <secondary>server, location of</secondary>
28344 </indexterm>
28345 The value of this option is expanded, and must then be the absolute path to a
28346 file which contains the server&#x2019;s certificates. The server&#x2019;s private key is also
28347 assumed to be in this file if <option>tls_privatekey</option> is unset. See chapter
28348 <xref linkend="CHAPTLS"/> for further details.
28349 </para>
28350 <para>
28351 <emphasis role="bold">Note</emphasis>: The certificates defined by this option are used only when Exim is
28352 receiving incoming messages as a server. If you want to supply certificates for
28353 use when sending messages as a client, you must set the <option>tls_certificate</option>
28354 option in the relevant <command>smtp</command> transport.
28355 </para>
28356 <para>
28357 <indexterm role="option">
28358 <primary><option>tls_crl</option></primary>
28359 </indexterm>
28360 </para>
28361 <informaltable frame="all">
28362 <tgroup cols="4" colsep="0" rowsep="0">
28363 <colspec colwidth="8*" align="left"/>
28364 <colspec colwidth="6*" align="center"/>
28365 <colspec colwidth="6*" align="center"/>
28366 <colspec colwidth="6*" align="right"/>
28367 <tbody>
28368 <row>
28369 <entry><option>tls_crl</option></entry>
28370 <entry>Use: <emphasis>main</emphasis></entry>
28371 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28372 <entry>Default: <emphasis>unset</emphasis></entry>
28373 </row>
28374 </tbody>
28375 </tgroup>
28376 </informaltable>
28377 <para>
28378 <indexterm role="concept">
28379 <primary>TLS</primary>
28380 <secondary>server certificate revocation list</secondary>
28381 </indexterm>
28382 <indexterm role="concept">
28383 <primary>certificate</primary>
28384 <secondary>revocation list for server</secondary>
28385 </indexterm>
28386 This option specifies a certificate revocation list. The expanded value must
28387 be the name of a file that contains a CRL in PEM format.
28388 </para>
28389 <para>
28390 <indexterm role="option">
28391 <primary><option>tls_dhparam</option></primary>
28392 </indexterm>
28393 </para>
28394 <informaltable frame="all">
28395 <tgroup cols="4" colsep="0" rowsep="0">
28396 <colspec colwidth="8*" align="left"/>
28397 <colspec colwidth="6*" align="center"/>
28398 <colspec colwidth="6*" align="center"/>
28399 <colspec colwidth="6*" align="right"/>
28400 <tbody>
28401 <row>
28402 <entry><option>tls_dhparam</option></entry>
28403 <entry>Use: <emphasis>main</emphasis></entry>
28404 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28405 <entry>Default: <emphasis>unset</emphasis></entry>
28406 </row>
28407 </tbody>
28408 </tgroup>
28409 </informaltable>
28410 <para>
28411 <indexterm role="concept">
28412 <primary>TLS</primary>
28413 <secondary>D-H parameters for server</secondary>
28414 </indexterm>
28415 The value of this option is expanded, and must then be the absolute path to
28416 a file which contains the server&#x2019;s DH parameter values.
28417 This is used only for OpenSSL. When Exim is linked with GnuTLS, this option is
28418 ignored. See section <xref linkend="SECTopenvsgnu"/> for further details.
28419 </para>
28420 <para>
28421 <indexterm role="option">
28422 <primary><option>tls_on_connect_ports</option></primary>
28423 </indexterm>
28424 </para>
28425 <informaltable frame="all">
28426 <tgroup cols="4" colsep="0" rowsep="0">
28427 <colspec colwidth="8*" align="left"/>
28428 <colspec colwidth="6*" align="center"/>
28429 <colspec colwidth="6*" align="center"/>
28430 <colspec colwidth="6*" align="right"/>
28431 <tbody>
28432 <row>
28433 <entry><option>tls_on_connect_ports</option></entry>
28434 <entry>Use: <emphasis>main</emphasis></entry>
28435 <entry>Type: <emphasis>string list</emphasis></entry>
28436 <entry>Default: <emphasis>unset</emphasis></entry>
28437 </row>
28438 </tbody>
28439 </tgroup>
28440 </informaltable>
28441 <para>
28442 This option specifies a list of incoming SSMTP (aka SMTPS) ports that should
28443 operate the obsolete SSMTP (SMTPS) protocol, where a TLS session is immediately
28444 set up without waiting for the client to issue a STARTTLS command. For
28445 further details, see section <xref linkend="SECTsupobssmt"/>.
28446 </para>
28447 <para>
28448 <indexterm role="option">
28449 <primary><option>tls_privatekey</option></primary>
28450 </indexterm>
28451 </para>
28452 <informaltable frame="all">
28453 <tgroup cols="4" colsep="0" rowsep="0">
28454 <colspec colwidth="8*" align="left"/>
28455 <colspec colwidth="6*" align="center"/>
28456 <colspec colwidth="6*" align="center"/>
28457 <colspec colwidth="6*" align="right"/>
28458 <tbody>
28459 <row>
28460 <entry><option>tls_privatekey</option></entry>
28461 <entry>Use: <emphasis>main</emphasis></entry>
28462 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28463 <entry>Default: <emphasis>unset</emphasis></entry>
28464 </row>
28465 </tbody>
28466 </tgroup>
28467 </informaltable>
28468 <para>
28469 <indexterm role="concept">
28470 <primary>TLS</primary>
28471 <secondary>server private key; location of</secondary>
28472 </indexterm>
28473 The value of this option is expanded, and must then be the absolute path to a
28474 file which contains the server&#x2019;s private key. If this option is unset, or if
28475 the expansion is forced to fail, or the result is an empty string, the private
28476 key is assumed to be in the same file as the server&#x2019;s certificates. See chapter
28477 <xref linkend="CHAPTLS"/> for further details.
28478 </para>
28479 <para>
28480 <indexterm role="option">
28481 <primary><option>tls_remember_esmtp</option></primary>
28482 </indexterm>
28483 </para>
28484 <informaltable frame="all">
28485 <tgroup cols="4" colsep="0" rowsep="0">
28486 <colspec colwidth="8*" align="left"/>
28487 <colspec colwidth="6*" align="center"/>
28488 <colspec colwidth="6*" align="center"/>
28489 <colspec colwidth="6*" align="right"/>
28490 <tbody>
28491 <row>
28492 <entry><option>tls_remember_esmtp</option></entry>
28493 <entry>Use: <emphasis>main</emphasis></entry>
28494 <entry>Type: <emphasis>boolean</emphasis></entry>
28495 <entry>Default: <emphasis>false</emphasis></entry>
28496 </row>
28497 </tbody>
28498 </tgroup>
28499 </informaltable>
28500 <para>
28501 <indexterm role="concept">
28502 <primary>TLS</primary>
28503 <secondary>esmtp state; remembering</secondary>
28504 </indexterm>
28505 <indexterm role="concept">
28506 <primary>TLS</primary>
28507 <secondary>broken clients</secondary>
28508 </indexterm>
28509 If this option is set true, Exim violates the RFCs by remembering that it is in
28510 <quote>esmtp</quote> state after successfully negotiating a TLS session. This provides
28511 support for broken clients that fail to send a new EHLO after starting a
28512 TLS session.
28513 </para>
28514 <para>
28515 <indexterm role="option">
28516 <primary><option>tls_require_ciphers</option></primary>
28517 </indexterm>
28518 </para>
28519 <informaltable frame="all">
28520 <tgroup cols="4" colsep="0" rowsep="0">
28521 <colspec colwidth="8*" align="left"/>
28522 <colspec colwidth="6*" align="center"/>
28523 <colspec colwidth="6*" align="center"/>
28524 <colspec colwidth="6*" align="right"/>
28525 <tbody>
28526 <row>
28527 <entry><option>tls_require_ciphers</option></entry>
28528 <entry>Use: <emphasis>main</emphasis></entry>
28529 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28530 <entry>Default: <emphasis>unset</emphasis></entry>
28531 </row>
28532 </tbody>
28533 </tgroup>
28534 </informaltable>
28535 <para>
28536 <indexterm role="concept">
28537 <primary>TLS</primary>
28538 <secondary>requiring specific ciphers</secondary>
28539 </indexterm>
28540 <indexterm role="concept">
28541 <primary>cipher</primary>
28542 <secondary>requiring specific</secondary>
28543 </indexterm>
28544 This option controls which ciphers can be used for incoming TLS connections.
28545 The <command>smtp</command> transport has an option of the same name for controlling outgoing
28546 connections. This option is expanded for each connection, so can be varied for
28547 different clients if required. The value of this option must be a list of
28548 permitted cipher suites. The OpenSSL and GnuTLS libraries handle cipher control
28549 in somewhat different ways. If GnuTLS is being used, the client controls the
28550 preference order of the available ciphers. Details are given in sections
28551 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
28552 </para>
28553 <para>
28554 <indexterm role="option">
28555 <primary><option>tls_try_verify_hosts</option></primary>
28556 </indexterm>
28557 </para>
28558 <informaltable frame="all">
28559 <tgroup cols="4" colsep="0" rowsep="0">
28560 <colspec colwidth="8*" align="left"/>
28561 <colspec colwidth="6*" align="center"/>
28562 <colspec colwidth="6*" align="center"/>
28563 <colspec colwidth="6*" align="right"/>
28564 <tbody>
28565 <row>
28566 <entry><option>tls_try_verify_hosts</option></entry>
28567 <entry>Use: <emphasis>main</emphasis></entry>
28568 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28569 <entry>Default: <emphasis>unset</emphasis></entry>
28570 </row>
28571 </tbody>
28572 </tgroup>
28573 </informaltable>
28574 <para>
28575 <indexterm role="concept">
28576 <primary>TLS</primary>
28577 <secondary>client certificate verification</secondary>
28578 </indexterm>
28579 <indexterm role="concept">
28580 <primary>certificate</primary>
28581 <secondary>verification of client</secondary>
28582 </indexterm>
28583 See <option>tls_verify_hosts</option> below.
28584 </para>
28585 <para>
28586 <indexterm role="option">
28587 <primary><option>tls_verify_certificates</option></primary>
28588 </indexterm>
28589 </para>
28590 <informaltable frame="all">
28591 <tgroup cols="4" colsep="0" rowsep="0">
28592 <colspec colwidth="8*" align="left"/>
28593 <colspec colwidth="6*" align="center"/>
28594 <colspec colwidth="6*" align="center"/>
28595 <colspec colwidth="6*" align="right"/>
28596 <tbody>
28597 <row>
28598 <entry><option>tls_verify_certificates</option></entry>
28599 <entry>Use: <emphasis>main</emphasis></entry>
28600 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28601 <entry>Default: <emphasis>unset</emphasis></entry>
28602 </row>
28603 </tbody>
28604 </tgroup>
28605 </informaltable>
28606 <para>
28607 <indexterm role="concept">
28608 <primary>TLS</primary>
28609 <secondary>client certificate verification</secondary>
28610 </indexterm>
28611 <indexterm role="concept">
28612 <primary>certificate</primary>
28613 <secondary>verification of client</secondary>
28614 </indexterm>
28615 The value of this option is expanded, and must then be the absolute path to
28616 a file containing permitted certificates for clients that
28617 match <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option>. Alternatively, if you
28618 are using OpenSSL, you can set <option>tls_verify_certificates</option> to the name of a
28619 directory containing certificate files. This does not work with GnuTLS; the
28620 option must be set to the name of a single file if you are using GnuTLS.
28621 </para>
28622 <para revisionflag="changed">
28623 These certificates should be for the certificate authorities trusted, rather
28624 than the public cert of individual clients.  With both OpenSSL and GnuTLS, if
28625 the value is a file then the certificates are sent by Exim as a server to
28626 connecting clients, defining the list of accepted certificate authorities.
28627 Thus the values defined should be considered public data.  To avoid this,
28628 use OpenSSL with a directory.
28629 </para>
28630 <para>
28631 <indexterm role="option">
28632 <primary><option>tls_verify_hosts</option></primary>
28633 </indexterm>
28634 </para>
28635 <informaltable frame="all">
28636 <tgroup cols="4" colsep="0" rowsep="0">
28637 <colspec colwidth="8*" align="left"/>
28638 <colspec colwidth="6*" align="center"/>
28639 <colspec colwidth="6*" align="center"/>
28640 <colspec colwidth="6*" align="right"/>
28641 <tbody>
28642 <row>
28643 <entry><option>tls_verify_hosts</option></entry>
28644 <entry>Use: <emphasis>main</emphasis></entry>
28645 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28646 <entry>Default: <emphasis>unset</emphasis></entry>
28647 </row>
28648 </tbody>
28649 </tgroup>
28650 </informaltable>
28651 <para>
28652 <indexterm role="concept">
28653 <primary>TLS</primary>
28654 <secondary>client certificate verification</secondary>
28655 </indexterm>
28656 <indexterm role="concept">
28657 <primary>certificate</primary>
28658 <secondary>verification of client</secondary>
28659 </indexterm>
28660 This option, along with <option>tls_try_verify_hosts</option>, controls the checking of
28661 certificates from clients. The expected certificates are defined by
28662 <option>tls_verify_certificates</option>, which must be set. A configuration error occurs if
28663 either <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> is set and
28664 <option>tls_verify_certificates</option> is not set.
28665 </para>
28666 <para>
28667 Any client that matches <option>tls_verify_hosts</option> is constrained by
28668 <option>tls_verify_certificates</option>. When the client initiates a TLS session, it must
28669 present one of the listed certificates. If it does not, the connection is
28670 aborted. <emphasis role="bold">Warning</emphasis>: Including a host in <option>tls_verify_hosts</option> does not require
28671 the host to use TLS. It can still send SMTP commands through unencrypted
28672 connections. Forcing a client to use TLS has to be done separately using an
28673 ACL to reject inappropriate commands when the connection is not encrypted.
28674 </para>
28675 <para>
28676 A weaker form of checking is provided by <option>tls_try_verify_hosts</option>. If a client
28677 matches this option (but not <option>tls_verify_hosts</option>), Exim requests a
28678 certificate and checks it against <option>tls_verify_certificates</option>, but does not
28679 abort the connection if there is no certificate or if it does not match. This
28680 state can be detected in an ACL, which makes it possible to implement policies
28681 such as <quote>accept for relay only if a verified certificate has been received,
28682 but accept for local delivery if encrypted, even without a verified
28683 certificate</quote>.
28684 </para>
28685 <para>
28686 Client hosts that match neither of these lists are not asked to present
28687 certificates.
28688 </para>
28689 <para>
28690 <indexterm role="option">
28691 <primary><option>trusted_groups</option></primary>
28692 </indexterm>
28693 </para>
28694 <informaltable frame="all">
28695 <tgroup cols="4" colsep="0" rowsep="0">
28696 <colspec colwidth="8*" align="left"/>
28697 <colspec colwidth="6*" align="center"/>
28698 <colspec colwidth="6*" align="center"/>
28699 <colspec colwidth="6*" align="right"/>
28700 <tbody>
28701 <row>
28702 <entry><option>trusted_groups</option></entry>
28703 <entry>Use: <emphasis>main</emphasis></entry>
28704 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
28705 <entry>Default: <emphasis>unset</emphasis></entry>
28706 </row>
28707 </tbody>
28708 </tgroup>
28709 </informaltable>
28710 <para>
28711 <indexterm role="concept">
28712 <primary>trusted groups</primary>
28713 </indexterm>
28714 <indexterm role="concept">
28715 <primary>groups</primary>
28716 <secondary>trusted</secondary>
28717 </indexterm>
28718 This option is expanded just once, at the start of Exim&#x2019;s processing. If this
28719 option is set, any process that is running in one of the listed groups, or
28720 which has one of them as a supplementary group, is trusted. The groups can be
28721 specified numerically or by name. See section <xref linkend="SECTtrustedadmin"/> for
28722 details of what trusted callers are permitted to do. If neither
28723 <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the Exim user
28724 are trusted.
28725 </para>
28726 <para>
28727 <indexterm role="option">
28728 <primary><option>trusted_users</option></primary>
28729 </indexterm>
28730 </para>
28731 <informaltable frame="all">
28732 <tgroup cols="4" colsep="0" rowsep="0">
28733 <colspec colwidth="8*" align="left"/>
28734 <colspec colwidth="6*" align="center"/>
28735 <colspec colwidth="6*" align="center"/>
28736 <colspec colwidth="6*" align="right"/>
28737 <tbody>
28738 <row>
28739 <entry><option>trusted_users</option></entry>
28740 <entry>Use: <emphasis>main</emphasis></entry>
28741 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
28742 <entry>Default: <emphasis>unset</emphasis></entry>
28743 </row>
28744 </tbody>
28745 </tgroup>
28746 </informaltable>
28747 <para>
28748 <indexterm role="concept">
28749 <primary>trusted users</primary>
28750 </indexterm>
28751 <indexterm role="concept">
28752 <primary>user</primary>
28753 <secondary>trusted</secondary>
28754 </indexterm>
28755 This option is expanded just once, at the start of Exim&#x2019;s processing. If this
28756 option is set, any process that is running as one of the listed users is
28757 trusted. The users can be specified numerically or by name. See section
28758 <xref linkend="SECTtrustedadmin"/> for details of what trusted callers are permitted to do.
28759 If neither <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the
28760 Exim user are trusted.
28761 </para>
28762 <para>
28763 <indexterm role="option">
28764 <primary><option>unknown_login</option></primary>
28765 </indexterm>
28766 </para>
28767 <informaltable frame="all">
28768 <tgroup cols="4" colsep="0" rowsep="0">
28769 <colspec colwidth="8*" align="left"/>
28770 <colspec colwidth="6*" align="center"/>
28771 <colspec colwidth="6*" align="center"/>
28772 <colspec colwidth="6*" align="right"/>
28773 <tbody>
28774 <row>
28775 <entry><option>unknown_login</option></entry>
28776 <entry>Use: <emphasis>main</emphasis></entry>
28777 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28778 <entry>Default: <emphasis>unset</emphasis></entry>
28779 </row>
28780 </tbody>
28781 </tgroup>
28782 </informaltable>
28783 <para>
28784 <indexterm role="concept">
28785 <primary>uid (user id)</primary>
28786 <secondary>unknown caller</secondary>
28787 </indexterm>
28788 <indexterm role="variable">
28789 <primary><varname>$caller_uid</varname></primary>
28790 </indexterm>
28791 This is a specialized feature for use in unusual configurations. By default, if
28792 the uid of the caller of Exim cannot be looked up using <function>getpwuid()</function>, Exim
28793 gives up. The <option>unknown_login</option> option can be used to set a login name to be
28794 used in this circumstance. It is expanded, so values like <option>user$caller_uid</option>
28795 can be set. When <option>unknown_login</option> is used, the value of <option>unknown_username</option>
28796 is used for the user&#x2019;s real name (gecos field), unless this has been set by the
28797 <option>-F</option> option.
28798 </para>
28799 <para>
28800 <indexterm role="option">
28801 <primary><option>unknown_username</option></primary>
28802 </indexterm>
28803 </para>
28804 <informaltable frame="all">
28805 <tgroup cols="4" colsep="0" rowsep="0">
28806 <colspec colwidth="8*" align="left"/>
28807 <colspec colwidth="6*" align="center"/>
28808 <colspec colwidth="6*" align="center"/>
28809 <colspec colwidth="6*" align="right"/>
28810 <tbody>
28811 <row>
28812 <entry><option>unknown_username</option></entry>
28813 <entry>Use: <emphasis>main</emphasis></entry>
28814 <entry>Type: <emphasis>string</emphasis></entry>
28815 <entry>Default: <emphasis>unset</emphasis></entry>
28816 </row>
28817 </tbody>
28818 </tgroup>
28819 </informaltable>
28820 <para>
28821 See <option>unknown_login</option>.
28822 </para>
28823 <para>
28824 <indexterm role="option">
28825 <primary><option>untrusted_set_sender</option></primary>
28826 </indexterm>
28827 </para>
28828 <informaltable frame="all">
28829 <tgroup cols="4" colsep="0" rowsep="0">
28830 <colspec colwidth="8*" align="left"/>
28831 <colspec colwidth="6*" align="center"/>
28832 <colspec colwidth="6*" align="center"/>
28833 <colspec colwidth="6*" align="right"/>
28834 <tbody>
28835 <row>
28836 <entry><option>untrusted_set_sender</option></entry>
28837 <entry>Use: <emphasis>main</emphasis></entry>
28838 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
28839 <entry>Default: <emphasis>unset</emphasis></entry>
28840 </row>
28841 </tbody>
28842 </tgroup>
28843 </informaltable>
28844 <para>
28845 <indexterm role="concept">
28846 <primary>trusted users</primary>
28847 </indexterm>
28848 <indexterm role="concept">
28849 <primary>sender</primary>
28850 <secondary>setting by untrusted user</secondary>
28851 </indexterm>
28852 <indexterm role="concept">
28853 <primary>untrusted user setting sender</primary>
28854 </indexterm>
28855 <indexterm role="concept">
28856 <primary>user</primary>
28857 <secondary>untrusted setting sender</secondary>
28858 </indexterm>
28859 <indexterm role="concept">
28860 <primary>envelope sender</primary>
28861 </indexterm>
28862 When an untrusted user submits a message to Exim using the standard input, Exim
28863 normally creates an envelope sender address from the user&#x2019;s login and the
28864 default qualification domain. Data from the <option>-f</option> option (for setting envelope
28865 senders on non-SMTP messages) or the SMTP MAIL command (if <option>-bs</option> or <option>-bS</option>
28866 is used) is ignored.
28867 </para>
28868 <para>
28869 However, untrusted users are permitted to set an empty envelope sender address,
28870 to declare that a message should never generate any bounces. For example:
28871 </para>
28872 <literallayout class="monospaced">
28873 exim -f '&lt;&gt;' user@domain.example
28874 </literallayout>
28875 <para>
28876 <indexterm role="variable">
28877 <primary><varname>$sender_ident</varname></primary>
28878 </indexterm>
28879 The <option>untrusted_set_sender</option> option allows you to permit untrusted users to set
28880 other envelope sender addresses in a controlled way. When it is set, untrusted
28881 users are allowed to set envelope sender addresses that match any of the
28882 patterns in the list. Like all address lists, the string is expanded. The
28883 identity of the user is in <varname>$sender_ident</varname>, so you can, for example, restrict
28884 users to setting senders that start with their login ids
28885 followed by a hyphen
28886 by a setting like this:
28887 </para>
28888 <literallayout class="monospaced">
28889 untrusted_set_sender = ^$sender_ident-
28890 </literallayout>
28891 <para>
28892 If you want to allow untrusted users to set envelope sender addresses without
28893 restriction, you can use
28894 </para>
28895 <literallayout class="monospaced">
28896 untrusted_set_sender = *
28897 </literallayout>
28898 <para>
28899 The <option>untrusted_set_sender</option> option applies to all forms of local input, but
28900 only to the setting of the envelope sender. It does not permit untrusted users
28901 to use the other options which trusted user can use to override message
28902 parameters. Furthermore, it does not stop Exim from removing an existing
28903 <emphasis>Sender:</emphasis> header in the message, or from adding a <emphasis>Sender:</emphasis> header if
28904 necessary. See <option>local_sender_retain</option> and <option>local_from_check</option> for ways of
28905 overriding these actions. The handling of the <emphasis>Sender:</emphasis> header is also
28906 described in section <xref linkend="SECTthesenhea"/>.
28907 </para>
28908 <para>
28909 The log line for a message&#x2019;s arrival shows the envelope sender following
28910 <quote>&lt;=</quote>. For local messages, the user&#x2019;s login always follows, after <quote>U=</quote>. In
28911 <option>-bp</option> displays, and in the Exim monitor, if an untrusted user sets an
28912 envelope sender address, the user&#x2019;s login is shown in parentheses after the
28913 sender address.
28914 </para>
28915 <para>
28916 <indexterm role="option">
28917 <primary><option>uucp_from_pattern</option></primary>
28918 </indexterm>
28919 </para>
28920 <informaltable frame="all">
28921 <tgroup cols="4" colsep="0" rowsep="0">
28922 <colspec colwidth="8*" align="left"/>
28923 <colspec colwidth="6*" align="center"/>
28924 <colspec colwidth="6*" align="center"/>
28925 <colspec colwidth="6*" align="right"/>
28926 <tbody>
28927 <row>
28928 <entry><option>uucp_from_pattern</option></entry>
28929 <entry>Use: <emphasis>main</emphasis></entry>
28930 <entry>Type: <emphasis>string</emphasis></entry>
28931 <entry>Default: <emphasis>see below</emphasis></entry>
28932 </row>
28933 </tbody>
28934 </tgroup>
28935 </informaltable>
28936 <para>
28937 <indexterm role="concept">
28938 <primary><quote>From</quote> line</primary>
28939 </indexterm>
28940 <indexterm role="concept">
28941 <primary>UUCP</primary>
28942 <secondary><quote>From</quote> line</secondary>
28943 </indexterm>
28944 Some applications that pass messages to an MTA via a command line interface use
28945 an initial line starting with <quote>From&nbsp;</quote> to pass the envelope sender. In
28946 particular, this is used by UUCP software. Exim recognizes such a line by means
28947 of a regular expression that is set in <option>uucp_from_pattern</option>. When the pattern
28948 matches, the sender address is constructed by expanding the contents of
28949 <option>uucp_from_sender</option>, provided that the caller of Exim is a trusted user. The
28950 default pattern recognizes lines in the following two forms:
28951 </para>
28952 <literallayout class="monospaced">
28953 From ph10 Fri Jan  5 12:35 GMT 1996
28954 From ph10 Fri, 7 Jan 97 14:00:00 GMT
28955 </literallayout>
28956 <para>
28957 The pattern can be seen by running
28958 </para>
28959 <literallayout class="monospaced">
28960 exim -bP uucp_from_pattern
28961 </literallayout>
28962 <para>
28963 It checks only up to the hours and minutes, and allows for a 2-digit or 4-digit
28964 year in the second case. The first word after <quote>From&nbsp;</quote> is matched in the
28965 regular expression by a parenthesized subpattern. The default value for
28966 <option>uucp_from_sender</option> is <quote>$1</quote>, which therefore just uses this first word
28967 (<quote>ph10</quote> in the example above) as the message&#x2019;s sender. See also
28968 <option>ignore_fromline_hosts</option>.
28969 </para>
28970 <para>
28971 <indexterm role="option">
28972 <primary><option>uucp_from_sender</option></primary>
28973 </indexterm>
28974 </para>
28975 <informaltable frame="all">
28976 <tgroup cols="4" colsep="0" rowsep="0">
28977 <colspec colwidth="8*" align="left"/>
28978 <colspec colwidth="6*" align="center"/>
28979 <colspec colwidth="6*" align="center"/>
28980 <colspec colwidth="6*" align="right"/>
28981 <tbody>
28982 <row>
28983 <entry><option>uucp_from_sender</option></entry>
28984 <entry>Use: <emphasis>main</emphasis></entry>
28985 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28986 <entry>Default: <emphasis><literal>$1</literal></emphasis></entry>
28987 </row>
28988 </tbody>
28989 </tgroup>
28990 </informaltable>
28991 <para>
28992 See <option>uucp_from_pattern</option> above.
28993 </para>
28994 <para>
28995 <indexterm role="option">
28996 <primary><option>warn_message_file</option></primary>
28997 </indexterm>
28998 </para>
28999 <informaltable frame="all">
29000 <tgroup cols="4" colsep="0" rowsep="0">
29001 <colspec colwidth="8*" align="left"/>
29002 <colspec colwidth="6*" align="center"/>
29003 <colspec colwidth="6*" align="center"/>
29004 <colspec colwidth="6*" align="right"/>
29005 <tbody>
29006 <row>
29007 <entry><option>warn_message_file</option></entry>
29008 <entry>Use: <emphasis>main</emphasis></entry>
29009 <entry>Type: <emphasis>string</emphasis></entry>
29010 <entry>Default: <emphasis>unset</emphasis></entry>
29011 </row>
29012 </tbody>
29013 </tgroup>
29014 </informaltable>
29015 <para>
29016 <indexterm role="concept">
29017 <primary>warning of delay</primary>
29018 <secondary>customizing the message</secondary>
29019 </indexterm>
29020 <indexterm role="concept">
29021 <primary>customizing</primary>
29022 <secondary>warning message</secondary>
29023 </indexterm>
29024 This option defines a template file containing paragraphs of text to be used
29025 for constructing the warning message which is sent by Exim when a message has
29026 been on the queue for a specified amount of time, as specified by
29027 <option>delay_warning</option>. Details of the file&#x2019;s contents are given in chapter
29028 <xref linkend="CHAPemsgcust"/>. See also <option>bounce_message_file</option>.
29029 </para>
29030 <para>
29031 <indexterm role="option">
29032 <primary><option>write_rejectlog</option></primary>
29033 </indexterm>
29034 </para>
29035 <informaltable frame="all">
29036 <tgroup cols="4" colsep="0" rowsep="0">
29037 <colspec colwidth="8*" align="left"/>
29038 <colspec colwidth="6*" align="center"/>
29039 <colspec colwidth="6*" align="center"/>
29040 <colspec colwidth="6*" align="right"/>
29041 <tbody>
29042 <row>
29043 <entry><option>write_rejectlog</option></entry>
29044 <entry>Use: <emphasis>main</emphasis></entry>
29045 <entry>Type: <emphasis>boolean</emphasis></entry>
29046 <entry>Default: <emphasis>true</emphasis></entry>
29047 </row>
29048 </tbody>
29049 </tgroup>
29050 </informaltable>
29051 <para>
29052 <indexterm role="concept">
29053 <primary>reject log</primary>
29054 <secondary>disabling</secondary>
29055 </indexterm>
29056 If this option is set false, Exim no longer writes anything to the reject log.
29057 See chapter <xref linkend="CHAPlog"/> for details of what Exim writes to its logs.
29058 <indexterm role="concept" startref="IIDconfima" class="endofrange"/>
29059 <indexterm role="concept" startref="IIDmaiconf" class="endofrange"/>
29060 </para>
29061 </section>
29062 </chapter>
29063
29064 <chapter id="CHAProutergeneric">
29065 <title>Generic options for routers</title>
29066 <para>
29067 <indexterm role="concept" id="IIDgenoprou1" class="startofrange">
29068 <primary>options</primary>
29069 <secondary>generic; for routers</secondary>
29070 </indexterm>
29071 <indexterm role="concept" id="IIDgenoprou2" class="startofrange">
29072 <primary>generic options</primary>
29073 <secondary>router</secondary>
29074 </indexterm>
29075 This chapter describes the generic options that apply to all routers.
29076 Those that are preconditions are marked with &Dagger; in the <quote>use</quote> field.
29077 </para>
29078 <para>
29079 For a general description of how a router operates, see sections
29080 <xref linkend="SECTrunindrou"/> and <xref linkend="SECTrouprecon"/>. The latter specifies the order in
29081 which the preconditions are tested. The order of expansion of the options that
29082 provide data for a transport is: <option>errors_to</option>, <option>headers_add</option>,
29083 <option>headers_remove</option>, <option>transport</option>.
29084 </para>
29085 <para>
29086 <indexterm role="option">
29087 <primary><option>address_data</option></primary>
29088 </indexterm>
29089 </para>
29090 <informaltable frame="all">
29091 <tgroup cols="4" colsep="0" rowsep="0">
29092 <colspec colwidth="8*" align="left"/>
29093 <colspec colwidth="6*" align="center"/>
29094 <colspec colwidth="6*" align="center"/>
29095 <colspec colwidth="6*" align="right"/>
29096 <tbody>
29097 <row>
29098 <entry><option>address_data</option></entry>
29099 <entry>Use: <emphasis>routers</emphasis></entry>
29100 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29101 <entry>Default: <emphasis>unset</emphasis></entry>
29102 </row>
29103 </tbody>
29104 </tgroup>
29105 </informaltable>
29106 <para>
29107 <indexterm role="concept">
29108 <primary>router</primary>
29109 <secondary>data attached to address</secondary>
29110 </indexterm>
29111 The string is expanded just before the router is run, that is, after all the
29112 precondition tests have succeeded. If the expansion is forced to fail, the
29113 router declines, the value of <option>address_data</option> remains unchanged, and the
29114 <option>more</option> option controls what happens next. Other expansion failures cause
29115 delivery of the address to be deferred.
29116 </para>
29117 <para>
29118 <indexterm role="variable">
29119 <primary><varname>$address_data</varname></primary>
29120 </indexterm>
29121 When the expansion succeeds, the value is retained with the address, and can be
29122 accessed using the variable <varname>$address_data</varname> in the current router, subsequent
29123 routers, and the eventual transport.
29124 </para>
29125 <para>
29126 <emphasis role="bold">Warning</emphasis>: If the current or any subsequent router is a <command>redirect</command> router
29127 that runs a user&#x2019;s filter file, the contents of <varname>$address_data</varname> are accessible
29128 in the filter. This is not normally a problem, because such data is usually
29129 either not confidential or it <quote>belongs</quote> to the current user, but if you do
29130 put confidential data into <varname>$address_data</varname> you need to remember this point.
29131 </para>
29132 <para>
29133 Even if the router declines or passes, the value of <varname>$address_data</varname> remains
29134 with the address, though it can be changed by another <option>address_data</option> setting
29135 on a subsequent router. If a router generates child addresses, the value of
29136 <varname>$address_data</varname> propagates to them. This also applies to the special kind of
29137 <quote>child</quote> that is generated by a router with the <option>unseen</option> option.
29138 </para>
29139 <para>
29140 The idea of <option>address_data</option> is that you can use it to look up a lot of data
29141 for the address once, and then pick out parts of the data later. For example,
29142 you could use a single LDAP lookup to return a string of the form
29143 </para>
29144 <literallayout class="monospaced">
29145 uid=1234 gid=5678 mailbox=/mail/xyz forward=/home/xyz/.forward
29146 </literallayout>
29147 <para>
29148 In the transport you could pick out the mailbox by a setting such as
29149 </para>
29150 <literallayout class="monospaced">
29151 file = ${extract{mailbox}{$address_data}}
29152 </literallayout>
29153 <para>
29154 This makes the configuration file less messy, and also reduces the number of
29155 lookups (though Exim does cache lookups).
29156 </para>
29157 <para>
29158 <indexterm role="variable">
29159 <primary><varname>$sender_address_data</varname></primary>
29160 </indexterm>
29161 <indexterm role="variable">
29162 <primary><varname>$address_data</varname></primary>
29163 </indexterm>
29164 The <option>address_data</option> facility is also useful as a means of passing information
29165 from one router to another, and from a router to a transport. In addition, if
29166 <varname>$address_data</varname> is set by a router when verifying a recipient address from an
29167 ACL, it remains available for use in the rest of the ACL statement. After
29168 verifying a sender, the value is transferred to <varname>$sender_address_data</varname>.
29169 </para>
29170 <para>
29171 <indexterm role="option">
29172 <primary><option>address_test</option></primary>
29173 </indexterm>
29174 </para>
29175 <informaltable frame="all">
29176 <tgroup cols="4" colsep="0" rowsep="0">
29177 <colspec colwidth="8*" align="left"/>
29178 <colspec colwidth="6*" align="center"/>
29179 <colspec colwidth="6*" align="center"/>
29180 <colspec colwidth="6*" align="right"/>
29181 <tbody>
29182 <row>
29183 <entry><option>address_test</option></entry>
29184 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
29185 <entry>Type: <emphasis>boolean</emphasis></entry>
29186 <entry>Default: <emphasis>true</emphasis></entry>
29187 </row>
29188 </tbody>
29189 </tgroup>
29190 </informaltable>
29191 <para>
29192 <indexterm role="option">
29193 <primary><option>-bt</option></primary>
29194 </indexterm>
29195 <indexterm role="concept">
29196 <primary>router</primary>
29197 <secondary>skipping when address testing</secondary>
29198 </indexterm>
29199 If this option is set false, the router is skipped when routing is being tested
29200 by means of the <option>-bt</option> command line option. This can be a convenience when
29201 your first router sends messages to an external scanner, because it saves you
29202 having to set the <quote>already scanned</quote> indicator when testing real address
29203 routing.
29204 </para>
29205 <para>
29206 <indexterm role="option">
29207 <primary><option>cannot_route_message</option></primary>
29208 </indexterm>
29209 </para>
29210 <informaltable frame="all">
29211 <tgroup cols="4" colsep="0" rowsep="0">
29212 <colspec colwidth="8*" align="left"/>
29213 <colspec colwidth="6*" align="center"/>
29214 <colspec colwidth="6*" align="center"/>
29215 <colspec colwidth="6*" align="right"/>
29216 <tbody>
29217 <row>
29218 <entry><option>cannot_route_message</option></entry>
29219 <entry>Use: <emphasis>routers</emphasis></entry>
29220 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29221 <entry>Default: <emphasis>unset</emphasis></entry>
29222 </row>
29223 </tbody>
29224 </tgroup>
29225 </informaltable>
29226 <para>
29227 <indexterm role="concept">
29228 <primary>router</primary>
29229 <secondary>customizing <quote>cannot route</quote> message</secondary>
29230 </indexterm>
29231 <indexterm role="concept">
29232 <primary>customizing</primary>
29233 <secondary><quote>cannot route</quote> message</secondary>
29234 </indexterm>
29235 This option specifies a text message that is used when an address cannot be
29236 routed because Exim has run out of routers. The default message is
29237 <quote>Unrouteable address</quote>. This option is useful only on routers that have
29238 <option>more</option> set false, or on the very last router in a configuration, because the
29239 value that is used is taken from the last router that is considered. This
29240 includes a router that is skipped because its preconditions are not met, as
29241 well as a router that declines. For example, using the default configuration,
29242 you could put:
29243 </para>
29244 <literallayout class="monospaced">
29245 cannot_route_message = Remote domain not found in DNS
29246 </literallayout>
29247 <para>
29248 on the first router, which is a <command>dnslookup</command> router with <option>more</option> set false,
29249 and
29250 </para>
29251 <literallayout class="monospaced">
29252 cannot_route_message = Unknown local user
29253 </literallayout>
29254 <para>
29255 on the final router that checks for local users. If string expansion fails for
29256 this option, the default message is used. Unless the expansion failure was
29257 explicitly forced, a message about the failure is written to the main and panic
29258 logs, in addition to the normal message about the routing failure.
29259 </para>
29260 <para>
29261 <indexterm role="option">
29262 <primary><option>caseful_local_part</option></primary>
29263 </indexterm>
29264 </para>
29265 <informaltable frame="all">
29266 <tgroup cols="4" colsep="0" rowsep="0">
29267 <colspec colwidth="8*" align="left"/>
29268 <colspec colwidth="6*" align="center"/>
29269 <colspec colwidth="6*" align="center"/>
29270 <colspec colwidth="6*" align="right"/>
29271 <tbody>
29272 <row>
29273 <entry><option>caseful_local_part</option></entry>
29274 <entry>Use: <emphasis>routers</emphasis></entry>
29275 <entry>Type: <emphasis>boolean</emphasis></entry>
29276 <entry>Default: <emphasis>false</emphasis></entry>
29277 </row>
29278 </tbody>
29279 </tgroup>
29280 </informaltable>
29281 <para>
29282 <indexterm role="concept">
29283 <primary>case of local parts</primary>
29284 </indexterm>
29285 <indexterm role="concept">
29286 <primary>router</primary>
29287 <secondary>case of local parts</secondary>
29288 </indexterm>
29289 By default, routers handle the local parts of addresses in a case-insensitive
29290 manner, though the actual case is preserved for transmission with the message.
29291 If you want the case of letters to be significant in a router, you must set
29292 this option true. For individual router options that contain address or local
29293 part lists (for example, <option>local_parts</option>), case-sensitive matching can be
29294 turned on by <quote>+caseful</quote> as a list item. See section <xref linkend="SECTcasletadd"/> for
29295 more details.
29296 </para>
29297 <para>
29298 <indexterm role="variable">
29299 <primary><varname>$local_part</varname></primary>
29300 </indexterm>
29301 <indexterm role="variable">
29302 <primary><varname>$original_local_part</varname></primary>
29303 </indexterm>
29304 <indexterm role="variable">
29305 <primary><varname>$parent_local_part</varname></primary>
29306 </indexterm>
29307 The value of the <varname>$local_part</varname> variable is forced to lower case while a
29308 router is running unless <option>caseful_local_part</option> is set. When a router assigns
29309 an address to a transport, the value of <varname>$local_part</varname> when the transport runs
29310 is the same as it was in the router. Similarly, when a router generates child
29311 addresses by aliasing or forwarding, the values of <varname>$original_local_part</varname>
29312 and <varname>$parent_local_part</varname> are those that were used by the redirecting router.
29313 </para>
29314 <para>
29315 This option applies to the processing of an address by a router. When a
29316 recipient address is being processed in an ACL, there is a separate <option>control</option>
29317 modifier that can be used to specify case-sensitive processing within the ACL
29318 (see section <xref linkend="SECTcontrols"/>).
29319 </para>
29320 <para>
29321 <indexterm role="option">
29322 <primary><option>check_local_user</option></primary>
29323 </indexterm>
29324 </para>
29325 <informaltable frame="all">
29326 <tgroup cols="4" colsep="0" rowsep="0">
29327 <colspec colwidth="8*" align="left"/>
29328 <colspec colwidth="6*" align="center"/>
29329 <colspec colwidth="6*" align="center"/>
29330 <colspec colwidth="6*" align="right"/>
29331 <tbody>
29332 <row>
29333 <entry><option>check_local_user</option></entry>
29334 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
29335 <entry>Type: <emphasis>boolean</emphasis></entry>
29336 <entry>Default: <emphasis>false</emphasis></entry>
29337 </row>
29338 </tbody>
29339 </tgroup>
29340 </informaltable>
29341 <para>
29342 <indexterm role="concept">
29343 <primary>local user, checking in router</primary>
29344 </indexterm>
29345 <indexterm role="concept">
29346 <primary>router</primary>
29347 <secondary>checking for local user</secondary>
29348 </indexterm>
29349 <indexterm role="concept">
29350 <primary><filename>/etc/passwd</filename></primary>
29351 </indexterm>
29352 <indexterm role="variable">
29353 <primary><varname>$home</varname></primary>
29354 </indexterm>
29355 When this option is true, Exim checks that the local part of the recipient
29356 address (with affixes removed if relevant) is the name of an account on the
29357 local system. The check is done by calling the <function>getpwnam()</function> function rather
29358 than trying to read <filename>/etc/passwd</filename> directly. This means that other methods of
29359 holding password data (such as NIS) are supported. If the local part is a local
29360 user, <varname>$home</varname> is set from the password data, and can be tested in other
29361 preconditions that are evaluated after this one (the order of evaluation is
29362 given in section <xref linkend="SECTrouprecon"/>). However, the value of <varname>$home</varname> can be
29363 overridden by <option>router_home_directory</option>. If the local part is not a local user,
29364 the router is skipped.
29365 </para>
29366 <para>
29367 If you want to check that the local part is either the name of a local user
29368 or matches something else, you cannot combine <option>check_local_user</option> with a
29369 setting of <option>local_parts</option>, because that specifies the logical <emphasis>and</emphasis> of the
29370 two conditions. However, you can use a <command>passwd</command> lookup in a <option>local_parts</option>
29371 setting to achieve this. For example:
29372 </para>
29373 <literallayout class="monospaced">
29374 local_parts = passwd;$local_part : lsearch;/etc/other/users
29375 </literallayout>
29376 <para>
29377 Note, however, that the side effects of <option>check_local_user</option> (such as setting
29378 up a home directory) do not occur when a <command>passwd</command> lookup is used in a
29379 <option>local_parts</option> (or any other) precondition.
29380 </para>
29381 <para>
29382 <indexterm role="option">
29383 <primary><option>condition</option></primary>
29384 </indexterm>
29385 </para>
29386 <informaltable frame="all">
29387 <tgroup cols="4" colsep="0" rowsep="0">
29388 <colspec colwidth="8*" align="left"/>
29389 <colspec colwidth="6*" align="center"/>
29390 <colspec colwidth="6*" align="center"/>
29391 <colspec colwidth="6*" align="right"/>
29392 <tbody>
29393 <row>
29394 <entry><option>condition</option></entry>
29395 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
29396 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29397 <entry>Default: <emphasis>unset</emphasis></entry>
29398 </row>
29399 </tbody>
29400 </tgroup>
29401 </informaltable>
29402 <para>
29403 <indexterm role="concept">
29404 <primary>router</primary>
29405 <secondary>customized precondition</secondary>
29406 </indexterm>
29407 This option specifies a general precondition test that has to succeed for the
29408 router to be called. The <option>condition</option> option is the last precondition to be
29409 evaluated (see section <xref linkend="SECTrouprecon"/>). The string is expanded, and if the
29410 result is a forced failure, or an empty string, or one of the strings <quote>0</quote> or
29411 <quote>no</quote> or <quote>false</quote> (checked without regard to the case of the letters), the
29412 router is skipped, and the address is offered to the next one.
29413 </para>
29414 <para>
29415 If the result is any other value, the router is run (as this is the last
29416 precondition to be evaluated, all the other preconditions must be true).
29417 </para>
29418 <para revisionflag="changed">
29419 This option is unique in that multiple <option>condition</option> options may be present.
29420 All <option>condition</option> options must succeed.
29421 </para>
29422 <para revisionflag="changed">
29423 The <option>condition</option> option provides a means of applying custom conditions to the
29424 running of routers. Note that in the case of a simple conditional expansion,
29425 the default expansion values are exactly what is wanted. For example:
29426 </para>
29427 <literallayout class="monospaced" revisionflag="changed">
29428 condition = ${if &gt;{$message_age}{600}}
29429 </literallayout>
29430 <para revisionflag="changed">
29431 Because of the default behaviour of the string expansion, this is equivalent to
29432 </para>
29433 <literallayout class="monospaced" revisionflag="changed">
29434 condition = ${if &gt;{$message_age}{600}{true}{}}
29435 </literallayout>
29436 <para revisionflag="changed">
29437 A multiple condition example, which succeeds:
29438 </para>
29439 <literallayout class="monospaced" revisionflag="changed">
29440 condition = ${if &gt;{$message_age}{600}}
29441 condition = ${if !eq{${lc:$local_part}}{postmaster}}
29442 condition = foobar
29443 </literallayout>
29444 <para revisionflag="changed">
29445 If the expansion fails (other than forced failure) delivery is deferred. Some
29446 of the other precondition options are common special cases that could in fact
29447 be specified using <option>condition</option>.
29448 </para>
29449 <para>
29450 <indexterm role="option">
29451 <primary><option>debug_print</option></primary>
29452 </indexterm>
29453 </para>
29454 <informaltable frame="all">
29455 <tgroup cols="4" colsep="0" rowsep="0">
29456 <colspec colwidth="8*" align="left"/>
29457 <colspec colwidth="6*" align="center"/>
29458 <colspec colwidth="6*" align="center"/>
29459 <colspec colwidth="6*" align="right"/>
29460 <tbody>
29461 <row>
29462 <entry><option>debug_print</option></entry>
29463 <entry>Use: <emphasis>routers</emphasis></entry>
29464 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29465 <entry>Default: <emphasis>unset</emphasis></entry>
29466 </row>
29467 </tbody>
29468 </tgroup>
29469 </informaltable>
29470 <para>
29471 <indexterm role="concept">
29472 <primary>testing</primary>
29473 <secondary>variables in drivers</secondary>
29474 </indexterm>
29475 If this option is set and debugging is enabled (see the <option>-d</option> command line
29476 option), the string is expanded and included in the debugging output.
29477 If expansion of the string fails, the error message is written to the debugging
29478 output, and Exim carries on processing.
29479 This option is provided to help with checking out the values of variables and
29480 so on when debugging router configurations. For example, if a <option>condition</option>
29481 option appears not to be working, <option>debug_print</option> can be used to output the
29482 variables it references. The output happens after checks for <option>domains</option>,
29483 <option>local_parts</option>, and <option>check_local_user</option> but before any other preconditions
29484 are tested. A newline is added to the text if it does not end with one.
29485 </para>
29486 <para>
29487 <indexterm role="option">
29488 <primary><option>disable_logging</option></primary>
29489 </indexterm>
29490 </para>
29491 <informaltable frame="all">
29492 <tgroup cols="4" colsep="0" rowsep="0">
29493 <colspec colwidth="8*" align="left"/>
29494 <colspec colwidth="6*" align="center"/>
29495 <colspec colwidth="6*" align="center"/>
29496 <colspec colwidth="6*" align="right"/>
29497 <tbody>
29498 <row>
29499 <entry><option>disable_logging</option></entry>
29500 <entry>Use: <emphasis>routers</emphasis></entry>
29501 <entry>Type: <emphasis>boolean</emphasis></entry>
29502 <entry>Default: <emphasis>false</emphasis></entry>
29503 </row>
29504 </tbody>
29505 </tgroup>
29506 </informaltable>
29507 <para>
29508 If this option is set true, nothing is logged for any routing errors
29509 or for any deliveries caused by this router. You should not set this option
29510 unless you really, really know what you are doing. See also the generic
29511 transport option of the same name.
29512 </para>
29513 <para>
29514 <indexterm role="option">
29515 <primary><option>domains</option></primary>
29516 </indexterm>
29517 </para>
29518 <informaltable frame="all">
29519 <tgroup cols="4" colsep="0" rowsep="0">
29520 <colspec colwidth="8*" align="left"/>
29521 <colspec colwidth="6*" align="center"/>
29522 <colspec colwidth="6*" align="center"/>
29523 <colspec colwidth="6*" align="right"/>
29524 <tbody>
29525 <row>
29526 <entry><option>domains</option></entry>
29527 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
29528 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
29529 <entry>Default: <emphasis>unset</emphasis></entry>
29530 </row>
29531 </tbody>
29532 </tgroup>
29533 </informaltable>
29534 <para>
29535 <indexterm role="concept">
29536 <primary>router</primary>
29537 <secondary>restricting to specific domains</secondary>
29538 </indexterm>
29539 <indexterm role="variable">
29540 <primary><varname>$domain_data</varname></primary>
29541 </indexterm>
29542 If this option is set, the router is skipped unless the current domain matches
29543 the list. If the match is achieved by means of a file lookup, the data that the
29544 lookup returned for the domain is placed in <varname>$domain_data</varname> for use in string
29545 expansions of the driver&#x2019;s private options. See section <xref linkend="SECTrouprecon"/> for
29546 a list of the order in which preconditions are evaluated.
29547 </para>
29548 <para>
29549 <indexterm role="option">
29550 <primary><option>driver</option></primary>
29551 </indexterm>
29552 </para>
29553 <informaltable frame="all">
29554 <tgroup cols="4" colsep="0" rowsep="0">
29555 <colspec colwidth="8*" align="left"/>
29556 <colspec colwidth="6*" align="center"/>
29557 <colspec colwidth="6*" align="center"/>
29558 <colspec colwidth="6*" align="right"/>
29559 <tbody>
29560 <row>
29561 <entry><option>driver</option></entry>
29562 <entry>Use: <emphasis>routers</emphasis></entry>
29563 <entry>Type: <emphasis>string</emphasis></entry>
29564 <entry>Default: <emphasis>unset</emphasis></entry>
29565 </row>
29566 </tbody>
29567 </tgroup>
29568 </informaltable>
29569 <para>
29570 This option must always be set. It specifies which of the available routers is
29571 to be used.
29572 </para>
29573 <para>
29574 <indexterm role="option">
29575 <primary><option>errors_to</option></primary>
29576 </indexterm>
29577 </para>
29578 <informaltable frame="all">
29579 <tgroup cols="4" colsep="0" rowsep="0">
29580 <colspec colwidth="8*" align="left"/>
29581 <colspec colwidth="6*" align="center"/>
29582 <colspec colwidth="6*" align="center"/>
29583 <colspec colwidth="6*" align="right"/>
29584 <tbody>
29585 <row>
29586 <entry><option>errors_to</option></entry>
29587 <entry>Use: <emphasis>routers</emphasis></entry>
29588 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29589 <entry>Default: <emphasis>unset</emphasis></entry>
29590 </row>
29591 </tbody>
29592 </tgroup>
29593 </informaltable>
29594 <para>
29595 <indexterm role="concept">
29596 <primary>envelope sender</primary>
29597 </indexterm>
29598 <indexterm role="concept">
29599 <primary>router</primary>
29600 <secondary>changing address for errors</secondary>
29601 </indexterm>
29602 If a router successfully handles an address, it may assign the address to a
29603 transport for delivery or it may generate child addresses. In both cases, if
29604 there is a delivery problem during later processing, the resulting bounce
29605 message is sent to the address that results from expanding this string,
29606 provided that the address verifies successfully. The <option>errors_to</option> option is
29607 expanded before <option>headers_add</option>, <option>headers_remove</option>, and <option>transport</option>.
29608 </para>
29609 <para>
29610 The <option>errors_to</option> setting associated with an address can be overridden if it
29611 subsequently passes through other routers that have their own <option>errors_to</option>
29612 settings, or if the message is delivered by a transport with a <option>return_path</option>
29613 setting.
29614 </para>
29615 <para>
29616 If <option>errors_to</option> is unset, or the expansion is forced to fail, or the result of
29617 the expansion fails to verify, the errors address associated with the incoming
29618 address is used. At top level, this is the envelope sender. A non-forced
29619 expansion failure causes delivery to be deferred.
29620 </para>
29621 <para>
29622 If an address for which <option>errors_to</option> has been set ends up being delivered over
29623 SMTP, the envelope sender for that delivery is the <option>errors_to</option> value, so that
29624 any bounces that are generated by other MTAs on the delivery route are also
29625 sent there. You can set <option>errors_to</option> to the empty string by either of these
29626 settings:
29627 </para>
29628 <literallayout class="monospaced">
29629 errors_to =
29630 errors_to = ""
29631 </literallayout>
29632 <para>
29633 An expansion item that yields an empty string has the same effect. If you do
29634 this, a locally detected delivery error for addresses processed by this router
29635 no longer gives rise to a bounce message; the error is discarded. If the
29636 address is delivered to a remote host, the return path is set to <literal>&lt;&gt;</literal>, unless
29637 overridden by the <option>return_path</option> option on the transport.
29638 </para>
29639 <para>
29640 <indexterm role="variable">
29641 <primary><varname>$address_data</varname></primary>
29642 </indexterm>
29643 If for some reason you want to discard local errors, but use a non-empty
29644 MAIL command for remote delivery, you can preserve the original return
29645 path in <varname>$address_data</varname> in the router, and reinstate it in the transport by
29646 setting <option>return_path</option>.
29647 </para>
29648 <para>
29649 The most common use of <option>errors_to</option> is to direct mailing list bounces to the
29650 manager of the list, as described in section <xref linkend="SECTmailinglists"/>, or to
29651 implement VERP (Variable Envelope Return Paths) (see section <xref linkend="SECTverp"/>).
29652 </para>
29653 <para>
29654 <indexterm role="option">
29655 <primary><option>expn</option></primary>
29656 </indexterm>
29657 </para>
29658 <informaltable frame="all">
29659 <tgroup cols="4" colsep="0" rowsep="0">
29660 <colspec colwidth="8*" align="left"/>
29661 <colspec colwidth="6*" align="center"/>
29662 <colspec colwidth="6*" align="center"/>
29663 <colspec colwidth="6*" align="right"/>
29664 <tbody>
29665 <row>
29666 <entry><option>expn</option></entry>
29667 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
29668 <entry>Type: <emphasis>boolean</emphasis></entry>
29669 <entry>Default: <emphasis>true</emphasis></entry>
29670 </row>
29671 </tbody>
29672 </tgroup>
29673 </informaltable>
29674 <para>
29675 <indexterm role="concept">
29676 <primary>address</primary>
29677 <secondary>testing</secondary>
29678 </indexterm>
29679 <indexterm role="concept">
29680 <primary>testing</primary>
29681 <secondary>addresses</secondary>
29682 </indexterm>
29683 <indexterm role="concept">
29684 <primary>EXPN</primary>
29685 <secondary>router skipping</secondary>
29686 </indexterm>
29687 <indexterm role="concept">
29688 <primary>router</primary>
29689 <secondary>skipping for EXPN</secondary>
29690 </indexterm>
29691 If this option is turned off, the router is skipped when testing an address
29692 as a result of processing an SMTP EXPN command. You might, for example,
29693 want to turn it off on a router for users&#x2019; <filename>.forward</filename> files, while leaving it
29694 on for the system alias file.
29695 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
29696 are evaluated.
29697 </para>
29698 <para>
29699 The use of the SMTP EXPN command is controlled by an ACL (see chapter
29700 <xref linkend="CHAPACL"/>). When Exim is running an EXPN command, it is similar to testing
29701 an address with <option>-bt</option>. Compare VRFY, whose counterpart is <option>-bv</option>.
29702 </para>
29703 <para>
29704 <indexterm role="option">
29705 <primary><option>fail_verify</option></primary>
29706 </indexterm>
29707 </para>
29708 <informaltable frame="all">
29709 <tgroup cols="4" colsep="0" rowsep="0">
29710 <colspec colwidth="8*" align="left"/>
29711 <colspec colwidth="6*" align="center"/>
29712 <colspec colwidth="6*" align="center"/>
29713 <colspec colwidth="6*" align="right"/>
29714 <tbody>
29715 <row>
29716 <entry><option>fail_verify</option></entry>
29717 <entry>Use: <emphasis>routers</emphasis></entry>
29718 <entry>Type: <emphasis>boolean</emphasis></entry>
29719 <entry>Default: <emphasis>false</emphasis></entry>
29720 </row>
29721 </tbody>
29722 </tgroup>
29723 </informaltable>
29724 <para>
29725 <indexterm role="concept">
29726 <primary>router</primary>
29727 <secondary>forcing verification failure</secondary>
29728 </indexterm>
29729 Setting this option has the effect of setting both <option>fail_verify_sender</option> and
29730 <option>fail_verify_recipient</option> to the same value.
29731 </para>
29732 <para>
29733 <indexterm role="option">
29734 <primary><option>fail_verify_recipient</option></primary>
29735 </indexterm>
29736 </para>
29737 <informaltable frame="all">
29738 <tgroup cols="4" colsep="0" rowsep="0">
29739 <colspec colwidth="8*" align="left"/>
29740 <colspec colwidth="6*" align="center"/>
29741 <colspec colwidth="6*" align="center"/>
29742 <colspec colwidth="6*" align="right"/>
29743 <tbody>
29744 <row>
29745 <entry><option>fail_verify_recipient</option></entry>
29746 <entry>Use: <emphasis>routers</emphasis></entry>
29747 <entry>Type: <emphasis>boolean</emphasis></entry>
29748 <entry>Default: <emphasis>false</emphasis></entry>
29749 </row>
29750 </tbody>
29751 </tgroup>
29752 </informaltable>
29753 <para>
29754 If this option is true and an address is accepted by this router when
29755 verifying a recipient, verification fails.
29756 </para>
29757 <para>
29758 <indexterm role="option">
29759 <primary><option>fail_verify_sender</option></primary>
29760 </indexterm>
29761 </para>
29762 <informaltable frame="all">
29763 <tgroup cols="4" colsep="0" rowsep="0">
29764 <colspec colwidth="8*" align="left"/>
29765 <colspec colwidth="6*" align="center"/>
29766 <colspec colwidth="6*" align="center"/>
29767 <colspec colwidth="6*" align="right"/>
29768 <tbody>
29769 <row>
29770 <entry><option>fail_verify_sender</option></entry>
29771 <entry>Use: <emphasis>routers</emphasis></entry>
29772 <entry>Type: <emphasis>boolean</emphasis></entry>
29773 <entry>Default: <emphasis>false</emphasis></entry>
29774 </row>
29775 </tbody>
29776 </tgroup>
29777 </informaltable>
29778 <para>
29779 If this option is true and an address is accepted by this router when
29780 verifying a sender, verification fails.
29781 </para>
29782 <para>
29783 <indexterm role="option">
29784 <primary><option>fallback_hosts</option></primary>
29785 </indexterm>
29786 </para>
29787 <informaltable frame="all">
29788 <tgroup cols="4" colsep="0" rowsep="0">
29789 <colspec colwidth="8*" align="left"/>
29790 <colspec colwidth="6*" align="center"/>
29791 <colspec colwidth="6*" align="center"/>
29792 <colspec colwidth="6*" align="right"/>
29793 <tbody>
29794 <row>
29795 <entry><option>fallback_hosts</option></entry>
29796 <entry>Use: <emphasis>routers</emphasis></entry>
29797 <entry>Type: <emphasis>string list</emphasis></entry>
29798 <entry>Default: <emphasis>unset</emphasis></entry>
29799 </row>
29800 </tbody>
29801 </tgroup>
29802 </informaltable>
29803 <para>
29804 <indexterm role="concept">
29805 <primary>router</primary>
29806 <secondary>fallback hosts</secondary>
29807 </indexterm>
29808 <indexterm role="concept">
29809 <primary>fallback</primary>
29810 <secondary>hosts specified on router</secondary>
29811 </indexterm>
29812 String expansion is not applied to this option. The argument must be a
29813 colon-separated list of host names or IP addresses. The list separator can be
29814 changed (see section <xref linkend="SECTlistconstruct"/>), and a port can be specified with
29815 each name or address. In fact, the format of each item is exactly the same as
29816 defined for the list of hosts in a <command>manualroute</command> router (see section
29817 <xref linkend="SECTformatonehostitem"/>).
29818 </para>
29819 <para>
29820 If a router queues an address for a remote transport, this host list is
29821 associated with the address, and used instead of the transport&#x2019;s fallback host
29822 list. If <option>hosts_randomize</option> is set on the transport, the order of the list is
29823 randomized for each use. See the <option>fallback_hosts</option> option of the <command>smtp</command>
29824 transport for further details.
29825 </para>
29826 <para>
29827 <indexterm role="option">
29828 <primary><option>group</option></primary>
29829 </indexterm>
29830 </para>
29831 <informaltable frame="all">
29832 <tgroup cols="4" colsep="0" rowsep="0">
29833 <colspec colwidth="8*" align="left"/>
29834 <colspec colwidth="6*" align="center"/>
29835 <colspec colwidth="6*" align="center"/>
29836 <colspec colwidth="6*" align="right"/>
29837 <tbody>
29838 <row>
29839 <entry><option>group</option></entry>
29840 <entry>Use: <emphasis>routers</emphasis></entry>
29841 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29842 <entry>Default: <emphasis>see below</emphasis></entry>
29843 </row>
29844 </tbody>
29845 </tgroup>
29846 </informaltable>
29847 <para>
29848 <indexterm role="concept">
29849 <primary>gid (group id)</primary>
29850 <secondary>local delivery</secondary>
29851 </indexterm>
29852 <indexterm role="concept">
29853 <primary>local transports</primary>
29854 <secondary>uid and gid</secondary>
29855 </indexterm>
29856 <indexterm role="concept">
29857 <primary>transport</primary>
29858 <secondary>local</secondary>
29859 </indexterm>
29860 <indexterm role="concept">
29861 <primary>router</primary>
29862 <secondary>setting group</secondary>
29863 </indexterm>
29864 When a router queues an address for a transport, and the transport does not
29865 specify a group, the group given here is used when running the delivery
29866 process.
29867 The group may be specified numerically or by name. If expansion fails, the
29868 error is logged and delivery is deferred.
29869 The default is unset, unless <option>check_local_user</option> is set, when the default
29870 is taken from the password information. See also <option>initgroups</option> and <option>user</option>
29871 and the discussion in chapter <xref linkend="CHAPenvironment"/>.
29872 </para>
29873 <para>
29874 <indexterm role="option">
29875 <primary><option>headers_add</option></primary>
29876 </indexterm>
29877 </para>
29878 <informaltable frame="all">
29879 <tgroup cols="4" colsep="0" rowsep="0">
29880 <colspec colwidth="8*" align="left"/>
29881 <colspec colwidth="6*" align="center"/>
29882 <colspec colwidth="6*" align="center"/>
29883 <colspec colwidth="6*" align="right"/>
29884 <tbody>
29885 <row>
29886 <entry><option>headers_add</option></entry>
29887 <entry>Use: <emphasis>routers</emphasis></entry>
29888 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29889 <entry>Default: <emphasis>unset</emphasis></entry>
29890 </row>
29891 </tbody>
29892 </tgroup>
29893 </informaltable>
29894 <para>
29895 <indexterm role="concept">
29896 <primary>header lines</primary>
29897 <secondary>adding</secondary>
29898 </indexterm>
29899 <indexterm role="concept">
29900 <primary>router</primary>
29901 <secondary>adding header lines</secondary>
29902 </indexterm>
29903 This option specifies a string of text that is expanded at routing time, and
29904 associated with any addresses that are accepted by the router. However, this
29905 option has no effect when an address is just being verified. The way in which
29906 the text is used to add header lines at transport time is described in section
29907 <xref linkend="SECTheadersaddrem"/>. New header lines are not actually added until the
29908 message is in the process of being transported. This means that references to
29909 header lines in string expansions in the transport&#x2019;s configuration do not
29910 <quote>see</quote> the added header lines.
29911 </para>
29912 <para>
29913 The <option>headers_add</option> option is expanded after <option>errors_to</option>, but before
29914 <option>headers_remove</option> and <option>transport</option>. If the expanded string is empty, or if
29915 the expansion is forced to fail, the option has no effect. Other expansion
29916 failures are treated as configuration errors.
29917 </para>
29918 <para>
29919 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_add</option> option cannot be used for a <command>redirect</command>
29920 router that has the <option>one_time</option> option set.
29921 </para>
29922 <para>
29923 <indexterm role="concept">
29924 <primary>duplicate addresses</primary>
29925 </indexterm>
29926 <indexterm role="option">
29927 <primary><option>unseen</option></primary>
29928 </indexterm>
29929 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
29930 additions are deleted when the address is passed on to subsequent routers.
29931 For a <option>redirect</option> router, if a generated address is the same as the incoming
29932 address, this can lead to duplicate addresses with different header
29933 modifications. Exim does not do duplicate deliveries (except, in certain
29934 circumstances, to pipes -- see section <xref linkend="SECTdupaddr"/>), but it is undefined
29935 which of the duplicates is discarded, so this ambiguous situation should be
29936 avoided. The <option>repeat_use</option> option of the <option>redirect</option> router may be of help.
29937 </para>
29938 <para>
29939 <indexterm role="option">
29940 <primary><option>headers_remove</option></primary>
29941 </indexterm>
29942 </para>
29943 <informaltable frame="all">
29944 <tgroup cols="4" colsep="0" rowsep="0">
29945 <colspec colwidth="8*" align="left"/>
29946 <colspec colwidth="6*" align="center"/>
29947 <colspec colwidth="6*" align="center"/>
29948 <colspec colwidth="6*" align="right"/>
29949 <tbody>
29950 <row>
29951 <entry><option>headers_remove</option></entry>
29952 <entry>Use: <emphasis>routers</emphasis></entry>
29953 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29954 <entry>Default: <emphasis>unset</emphasis></entry>
29955 </row>
29956 </tbody>
29957 </tgroup>
29958 </informaltable>
29959 <para>
29960 <indexterm role="concept">
29961 <primary>header lines</primary>
29962 <secondary>removing</secondary>
29963 </indexterm>
29964 <indexterm role="concept">
29965 <primary>router</primary>
29966 <secondary>removing header lines</secondary>
29967 </indexterm>
29968 This option specifies a string of text that is expanded at routing time, and
29969 associated with any addresses that are accepted by the router. However, this
29970 option has no effect when an address is just being verified. The way in which
29971 the text is used to remove header lines at transport time is described in
29972 section <xref linkend="SECTheadersaddrem"/>. Header lines are not actually removed until
29973 the message is in the process of being transported. This means that references
29974 to header lines in string expansions in the transport&#x2019;s configuration still
29975 <quote>see</quote> the original header lines.
29976 </para>
29977 <para>
29978 The <option>headers_remove</option> option is expanded after <option>errors_to</option> and
29979 <option>headers_add</option>, but before <option>transport</option>. If the expansion is forced to fail,
29980 the option has no effect. Other expansion failures are treated as configuration
29981 errors.
29982 </para>
29983 <para>
29984 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_remove</option> option cannot be used for a <command>redirect</command>
29985 router that has the <option>one_time</option> option set.
29986 </para>
29987 <para>
29988 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
29989 removal requests are deleted when the address is passed on to subsequent
29990 routers, and this can lead to problems with duplicates -- see the similar
29991 warning for <option>headers_add</option> above.
29992 </para>
29993 <para>
29994 <indexterm role="option">
29995 <primary><option>ignore_target_hosts</option></primary>
29996 </indexterm>
29997 </para>
29998 <informaltable frame="all">
29999 <tgroup cols="4" colsep="0" rowsep="0">
30000 <colspec colwidth="8*" align="left"/>
30001 <colspec colwidth="6*" align="center"/>
30002 <colspec colwidth="6*" align="center"/>
30003 <colspec colwidth="6*" align="right"/>
30004 <tbody>
30005 <row>
30006 <entry><option>ignore_target_hosts</option></entry>
30007 <entry>Use: <emphasis>routers</emphasis></entry>
30008 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
30009 <entry>Default: <emphasis>unset</emphasis></entry>
30010 </row>
30011 </tbody>
30012 </tgroup>
30013 </informaltable>
30014 <para>
30015 <indexterm role="concept">
30016 <primary>IP address</primary>
30017 <secondary>discarding</secondary>
30018 </indexterm>
30019 <indexterm role="concept">
30020 <primary>router</primary>
30021 <secondary>discarding IP addresses</secondary>
30022 </indexterm>
30023 Although this option is a host list, it should normally contain IP address
30024 entries rather than names. If any host that is looked up by the router has an
30025 IP address that matches an item in this list, Exim behaves as if that IP
30026 address did not exist. This option allows you to cope with rogue DNS entries
30027 like
30028 </para>
30029 <literallayout class="monospaced">
30030 remote.domain.example.  A  127.0.0.1
30031 </literallayout>
30032 <para>
30033 by setting
30034 </para>
30035 <literallayout class="monospaced">
30036 ignore_target_hosts = 127.0.0.1
30037 </literallayout>
30038 <para>
30039 on the relevant router. If all the hosts found by a <command>dnslookup</command> router are
30040 discarded in this way, the router declines. In a conventional configuration, an
30041 attempt to mail to such a domain would normally provoke the <quote>unrouteable
30042 domain</quote> error, and an attempt to verify an address in the domain would fail.
30043 Similarly, if <option>ignore_target_hosts</option> is set on an <command>ipliteral</command> router, the
30044 router declines if presented with one of the listed addresses.
30045 </para>
30046 <para>
30047 You can use this option to disable the use of IPv4 or IPv6 for mail delivery by
30048 means of the first or the second of the following settings, respectively:
30049 </para>
30050 <literallayout class="monospaced">
30051 ignore_target_hosts = 0.0.0.0/0
30052 ignore_target_hosts = &lt;; 0::0/0
30053 </literallayout>
30054 <para>
30055 The pattern in the first line matches all IPv4 addresses, whereas the pattern
30056 in the second line matches all IPv6 addresses.
30057 </para>
30058 <para>
30059 This option may also be useful for ignoring link-local and site-local IPv6
30060 addresses. Because, like all host lists, the value of <option>ignore_target_hosts</option>
30061 is expanded before use as a list, it is possible to make it dependent on the
30062 domain that is being routed.
30063 </para>
30064 <para>
30065 <indexterm role="variable">
30066 <primary><varname>$host_address</varname></primary>
30067 </indexterm>
30068 During its expansion, <varname>$host_address</varname> is set to the IP address that is being
30069 checked.
30070 </para>
30071 <para>
30072 <indexterm role="option">
30073 <primary><option>initgroups</option></primary>
30074 </indexterm>
30075 </para>
30076 <informaltable frame="all">
30077 <tgroup cols="4" colsep="0" rowsep="0">
30078 <colspec colwidth="8*" align="left"/>
30079 <colspec colwidth="6*" align="center"/>
30080 <colspec colwidth="6*" align="center"/>
30081 <colspec colwidth="6*" align="right"/>
30082 <tbody>
30083 <row>
30084 <entry><option>initgroups</option></entry>
30085 <entry>Use: <emphasis>routers</emphasis></entry>
30086 <entry>Type: <emphasis>boolean</emphasis></entry>
30087 <entry>Default: <emphasis>false</emphasis></entry>
30088 </row>
30089 </tbody>
30090 </tgroup>
30091 </informaltable>
30092 <para>
30093 <indexterm role="concept">
30094 <primary>additional groups</primary>
30095 </indexterm>
30096 <indexterm role="concept">
30097 <primary>groups</primary>
30098 <secondary>additional</secondary>
30099 </indexterm>
30100 <indexterm role="concept">
30101 <primary>local transports</primary>
30102 <secondary>uid and gid</secondary>
30103 </indexterm>
30104 <indexterm role="concept">
30105 <primary>transport</primary>
30106 <secondary>local</secondary>
30107 </indexterm>
30108 If the router queues an address for a transport, and this option is true, and
30109 the uid supplied by the router is not overridden by the transport, the
30110 <function>initgroups()</function> function is called when running the transport to ensure that
30111 any additional groups associated with the uid are set up. See also <option>group</option>
30112 and <option>user</option> and the discussion in chapter <xref linkend="CHAPenvironment"/>.
30113 </para>
30114 <para>
30115 <indexterm role="option">
30116 <primary><option>local_part_prefix</option></primary>
30117 </indexterm>
30118 </para>
30119 <informaltable frame="all">
30120 <tgroup cols="4" colsep="0" rowsep="0">
30121 <colspec colwidth="8*" align="left"/>
30122 <colspec colwidth="6*" align="center"/>
30123 <colspec colwidth="6*" align="center"/>
30124 <colspec colwidth="6*" align="right"/>
30125 <tbody>
30126 <row>
30127 <entry><option>local_part_prefix</option></entry>
30128 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
30129 <entry>Type: <emphasis>string list</emphasis></entry>
30130 <entry>Default: <emphasis>unset</emphasis></entry>
30131 </row>
30132 </tbody>
30133 </tgroup>
30134 </informaltable>
30135 <para>
30136 <indexterm role="concept">
30137 <primary>router</primary>
30138 <secondary>prefix for local part</secondary>
30139 </indexterm>
30140 <indexterm role="concept">
30141 <primary>prefix</primary>
30142 <secondary>for local part, used in router</secondary>
30143 </indexterm>
30144 If this option is set, the router is skipped unless the local part starts with
30145 one of the given strings, or <option>local_part_prefix_optional</option> is true. See
30146 section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions are
30147 evaluated.
30148 </para>
30149 <para>
30150 The list is scanned from left to right, and the first prefix that matches is
30151 used. A limited form of wildcard is available; if the prefix begins with an
30152 asterisk, it matches the longest possible sequence of arbitrary characters at
30153 the start of the local part. An asterisk should therefore always be followed by
30154 some character that does not occur in normal local parts.
30155 <indexterm role="concept">
30156 <primary>multiple mailboxes</primary>
30157 </indexterm>
30158 <indexterm role="concept">
30159 <primary>mailbox</primary>
30160 <secondary>multiple</secondary>
30161 </indexterm>
30162 Wildcarding can be used to set up multiple user mailboxes, as described in
30163 section <xref linkend="SECTmulbox"/>.
30164 </para>
30165 <para>
30166 <indexterm role="variable">
30167 <primary><varname>$local_part</varname></primary>
30168 </indexterm>
30169 <indexterm role="variable">
30170 <primary><varname>$local_part_prefix</varname></primary>
30171 </indexterm>
30172 During the testing of the <option>local_parts</option> option, and while the router is
30173 running, the prefix is removed from the local part, and is available in the
30174 expansion variable <varname>$local_part_prefix</varname>. When a message is being delivered, if
30175 the router accepts the address, this remains true during subsequent delivery by
30176 a transport. In particular, the local part that is transmitted in the RCPT
30177 command for LMTP, SMTP, and BSMTP deliveries has the prefix removed by default.
30178 This behaviour can be overridden by setting <option>rcpt_include_affixes</option> true on
30179 the relevant transport.
30180 </para>
30181 <para>
30182 When an address is being verified, <option>local_part_prefix</option> affects only the
30183 behaviour of the router. If the callout feature of verification is in use, this
30184 means that the full address, including the prefix, will be used during the
30185 callout.
30186 </para>
30187 <para>
30188 The prefix facility is commonly used to handle local parts of the form
30189 <option>owner-something</option>. Another common use is to support local parts of the form
30190 <option>real-username</option> to bypass a user&#x2019;s <filename>.forward</filename> file &ndash; helpful when trying
30191 to tell a user their forwarding is broken &ndash; by placing a router like this one
30192 immediately before the router that handles <filename>.forward</filename> files:
30193 </para>
30194 <literallayout class="monospaced">
30195 real_localuser:
30196   driver = accept
30197   local_part_prefix = real-
30198   check_local_user
30199   transport = local_delivery
30200 </literallayout>
30201 <para>
30202 For security, it would probably be a good idea to restrict the use of this
30203 router to locally-generated messages, using a condition such as this:
30204 </para>
30205 <literallayout class="monospaced">
30206   condition = ${if match {$sender_host_address}\
30207                          {\N^(|127\.0\.0\.1)$\N}}
30208 </literallayout>
30209 <para>
30210 If both <option>local_part_prefix</option> and <option>local_part_suffix</option> are set for a router,
30211 both conditions must be met if not optional. Care must be taken if wildcards
30212 are used in both a prefix and a suffix on the same router. Different
30213 separator characters must be used to avoid ambiguity.
30214 </para>
30215 <para>
30216 <indexterm role="option">
30217 <primary><option>local_part_prefix_optional</option></primary>
30218 </indexterm>
30219 </para>
30220 <informaltable frame="all">
30221 <tgroup cols="4" colsep="0" rowsep="0">
30222 <colspec colwidth="8*" align="left"/>
30223 <colspec colwidth="6*" align="center"/>
30224 <colspec colwidth="6*" align="center"/>
30225 <colspec colwidth="6*" align="right"/>
30226 <tbody>
30227 <row>
30228 <entry><option>local_part_prefix_optional</option></entry>
30229 <entry>Use: <emphasis>routers</emphasis></entry>
30230 <entry>Type: <emphasis>boolean</emphasis></entry>
30231 <entry>Default: <emphasis>false</emphasis></entry>
30232 </row>
30233 </tbody>
30234 </tgroup>
30235 </informaltable>
30236 <para>
30237 See <option>local_part_prefix</option> above.
30238 </para>
30239 <para>
30240 <indexterm role="option">
30241 <primary><option>local_part_suffix</option></primary>
30242 </indexterm>
30243 </para>
30244 <informaltable frame="all">
30245 <tgroup cols="4" colsep="0" rowsep="0">
30246 <colspec colwidth="8*" align="left"/>
30247 <colspec colwidth="6*" align="center"/>
30248 <colspec colwidth="6*" align="center"/>
30249 <colspec colwidth="6*" align="right"/>
30250 <tbody>
30251 <row>
30252 <entry><option>local_part_suffix</option></entry>
30253 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
30254 <entry>Type: <emphasis>string list</emphasis></entry>
30255 <entry>Default: <emphasis>unset</emphasis></entry>
30256 </row>
30257 </tbody>
30258 </tgroup>
30259 </informaltable>
30260 <para>
30261 <indexterm role="concept">
30262 <primary>router</primary>
30263 <secondary>suffix for local part</secondary>
30264 </indexterm>
30265 <indexterm role="concept">
30266 <primary>suffix for local part</primary>
30267 <secondary>used in router</secondary>
30268 </indexterm>
30269 This option operates in the same way as <option>local_part_prefix</option>, except that the
30270 local part must end (rather than start) with the given string, the
30271 <option>local_part_suffix_optional</option> option determines whether the suffix is
30272 mandatory, and the wildcard * character, if present, must be the last
30273 character of the suffix. This option facility is commonly used to handle local
30274 parts of the form <option>something-request</option> and multiple user mailboxes of the form
30275 <option>username-foo</option>.
30276 </para>
30277 <para>
30278 <indexterm role="option">
30279 <primary><option>local_part_suffix_optional</option></primary>
30280 </indexterm>
30281 </para>
30282 <informaltable frame="all">
30283 <tgroup cols="4" colsep="0" rowsep="0">
30284 <colspec colwidth="8*" align="left"/>
30285 <colspec colwidth="6*" align="center"/>
30286 <colspec colwidth="6*" align="center"/>
30287 <colspec colwidth="6*" align="right"/>
30288 <tbody>
30289 <row>
30290 <entry><option>local_part_suffix_optional</option></entry>
30291 <entry>Use: <emphasis>routers</emphasis></entry>
30292 <entry>Type: <emphasis>boolean</emphasis></entry>
30293 <entry>Default: <emphasis>false</emphasis></entry>
30294 </row>
30295 </tbody>
30296 </tgroup>
30297 </informaltable>
30298 <para>
30299 See <option>local_part_suffix</option> above.
30300 </para>
30301 <para>
30302 <indexterm role="option">
30303 <primary><option>local_parts</option></primary>
30304 </indexterm>
30305 </para>
30306 <informaltable frame="all">
30307 <tgroup cols="4" colsep="0" rowsep="0">
30308 <colspec colwidth="8*" align="left"/>
30309 <colspec colwidth="6*" align="center"/>
30310 <colspec colwidth="6*" align="center"/>
30311 <colspec colwidth="6*" align="right"/>
30312 <tbody>
30313 <row>
30314 <entry><option>local_parts</option></entry>
30315 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
30316 <entry>Type: <emphasis>local part list</emphasis>&dagger;<emphasis></emphasis></entry>
30317 <entry>Default: <emphasis>unset</emphasis></entry>
30318 </row>
30319 </tbody>
30320 </tgroup>
30321 </informaltable>
30322 <para>
30323 <indexterm role="concept">
30324 <primary>router</primary>
30325 <secondary>restricting to specific local parts</secondary>
30326 </indexterm>
30327 <indexterm role="concept">
30328 <primary>local part</primary>
30329 <secondary>checking in router</secondary>
30330 </indexterm>
30331 The router is run only if the local part of the address matches the list.
30332 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
30333 are evaluated, and
30334 section <xref linkend="SECTlocparlis"/> for a discussion of local part lists. Because the
30335 string is expanded, it is possible to make it depend on the domain, for
30336 example:
30337 </para>
30338 <literallayout class="monospaced">
30339 local_parts = dbm;/usr/local/specials/$domain
30340 </literallayout>
30341 <para>
30342 <indexterm role="variable">
30343 <primary><varname>$local_part_data</varname></primary>
30344 </indexterm>
30345 If the match is achieved by a lookup, the data that the lookup returned
30346 for the local part is placed in the variable <varname>$local_part_data</varname> for use in
30347 expansions of the router&#x2019;s private options. You might use this option, for
30348 example, if you have a large number of local virtual domains, and you want to
30349 send all postmaster mail to the same place without having to set up an alias in
30350 each virtual domain:
30351 </para>
30352 <literallayout class="monospaced">
30353 postmaster:
30354   driver = redirect
30355   local_parts = postmaster
30356   data = postmaster@real.domain.example
30357 </literallayout>
30358 <para>
30359 <indexterm role="option">
30360 <primary><option>log_as_local</option></primary>
30361 </indexterm>
30362 </para>
30363 <informaltable frame="all">
30364 <tgroup cols="4" colsep="0" rowsep="0">
30365 <colspec colwidth="8*" align="left"/>
30366 <colspec colwidth="6*" align="center"/>
30367 <colspec colwidth="6*" align="center"/>
30368 <colspec colwidth="6*" align="right"/>
30369 <tbody>
30370 <row>
30371 <entry><option>log_as_local</option></entry>
30372 <entry>Use: <emphasis>routers</emphasis></entry>
30373 <entry>Type: <emphasis>boolean</emphasis></entry>
30374 <entry>Default: <emphasis>see below</emphasis></entry>
30375 </row>
30376 </tbody>
30377 </tgroup>
30378 </informaltable>
30379 <para>
30380 <indexterm role="concept">
30381 <primary>log</primary>
30382 <secondary>delivery line</secondary>
30383 </indexterm>
30384 <indexterm role="concept">
30385 <primary>delivery</primary>
30386 <secondary>log line format</secondary>
30387 </indexterm>
30388 Exim has two logging styles for delivery, the idea being to make local
30389 deliveries stand out more visibly from remote ones. In the <quote>local</quote> style, the
30390 recipient address is given just as the local part, without a domain. The use of
30391 this style is controlled by this option. It defaults to true for the <command>accept</command>
30392 router, and false for all the others. This option applies only when a
30393 router assigns an address to a transport. It has no effect on routers that
30394 redirect addresses.
30395 </para>
30396 <para>
30397 <indexterm role="option">
30398 <primary><option>more</option></primary>
30399 </indexterm>
30400 </para>
30401 <informaltable frame="all">
30402 <tgroup cols="4" colsep="0" rowsep="0">
30403 <colspec colwidth="8*" align="left"/>
30404 <colspec colwidth="6*" align="center"/>
30405 <colspec colwidth="6*" align="center"/>
30406 <colspec colwidth="6*" align="right"/>
30407 <tbody>
30408 <row>
30409 <entry><option>more</option></entry>
30410 <entry>Use: <emphasis>routers</emphasis></entry>
30411 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
30412 <entry>Default: <emphasis>true</emphasis></entry>
30413 </row>
30414 </tbody>
30415 </tgroup>
30416 </informaltable>
30417 <para>
30418 The result of string expansion for this option must be a valid boolean value,
30419 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
30420 result causes an error, and delivery is deferred. If the expansion is forced to
30421 fail, the default value for the option (true) is used. Other failures cause
30422 delivery to be deferred.
30423 </para>
30424 <para>
30425 If this option is set false, and the router declines to handle the address, no
30426 further routers are tried, routing fails, and the address is bounced.
30427 <indexterm role="option">
30428 <primary><option>self</option></primary>
30429 </indexterm>
30430 However, if the router explicitly passes an address to the following router by
30431 means of the setting
30432 </para>
30433 <literallayout class="monospaced">
30434 self = pass
30435 </literallayout>
30436 <para>
30437 or otherwise, the setting of <option>more</option> is ignored. Also, the setting of <option>more</option>
30438 does not affect the behaviour if one of the precondition tests fails. In that
30439 case, the address is always passed to the next router.
30440 </para>
30441 <para>
30442 Note that <option>address_data</option> is not considered to be a precondition. If its
30443 expansion is forced to fail, the router declines, and the value of <option>more</option>
30444 controls what happens next.
30445 </para>
30446 <para>
30447 <indexterm role="option">
30448 <primary><option>pass_on_timeout</option></primary>
30449 </indexterm>
30450 </para>
30451 <informaltable frame="all">
30452 <tgroup cols="4" colsep="0" rowsep="0">
30453 <colspec colwidth="8*" align="left"/>
30454 <colspec colwidth="6*" align="center"/>
30455 <colspec colwidth="6*" align="center"/>
30456 <colspec colwidth="6*" align="right"/>
30457 <tbody>
30458 <row>
30459 <entry><option>pass_on_timeout</option></entry>
30460 <entry>Use: <emphasis>routers</emphasis></entry>
30461 <entry>Type: <emphasis>boolean</emphasis></entry>
30462 <entry>Default: <emphasis>false</emphasis></entry>
30463 </row>
30464 </tbody>
30465 </tgroup>
30466 </informaltable>
30467 <para>
30468 <indexterm role="concept">
30469 <primary>timeout</primary>
30470 <secondary>of router</secondary>
30471 </indexterm>
30472 <indexterm role="concept">
30473 <primary>router</primary>
30474 <secondary>timeout</secondary>
30475 </indexterm>
30476 If a router times out during a host lookup, it normally causes deferral of the
30477 address. If <option>pass_on_timeout</option> is set, the address is passed on to the next
30478 router, overriding <option>no_more</option>. This may be helpful for systems that are
30479 intermittently connected to the Internet, or those that want to pass to a smart
30480 host any messages that cannot immediately be delivered.
30481 </para>
30482 <para>
30483 There are occasional other temporary errors that can occur while doing DNS
30484 lookups. They are treated in the same way as a timeout, and this option
30485 applies to all of them.
30486 </para>
30487 <para>
30488 <indexterm role="option">
30489 <primary><option>pass_router</option></primary>
30490 </indexterm>
30491 </para>
30492 <informaltable frame="all">
30493 <tgroup cols="4" colsep="0" rowsep="0">
30494 <colspec colwidth="8*" align="left"/>
30495 <colspec colwidth="6*" align="center"/>
30496 <colspec colwidth="6*" align="center"/>
30497 <colspec colwidth="6*" align="right"/>
30498 <tbody>
30499 <row>
30500 <entry><option>pass_router</option></entry>
30501 <entry>Use: <emphasis>routers</emphasis></entry>
30502 <entry>Type: <emphasis>string</emphasis></entry>
30503 <entry>Default: <emphasis>unset</emphasis></entry>
30504 </row>
30505 </tbody>
30506 </tgroup>
30507 </informaltable>
30508 <para>
30509 <indexterm role="concept">
30510 <primary>router</primary>
30511 <secondary>go to after <quote>pass</quote></secondary>
30512 </indexterm>
30513 Routers that recognize the generic <option>self</option> option (<command>dnslookup</command>,
30514 <command>ipliteral</command>, and <command>manualroute</command>) are able to return <quote>pass</quote>, forcing
30515 routing to continue, and overriding a false setting of <option>more</option>. When one of
30516 these routers returns <quote>pass</quote>, the address is normally handed on to the next
30517 router in sequence. This can be changed by setting <option>pass_router</option> to the name
30518 of another router. However (unlike <option>redirect_router</option>) the named router must
30519 be below the current router, to avoid loops. Note that this option applies only
30520 to the special case of <quote>pass</quote>. It does not apply when a router returns
30521 <quote>decline</quote> because it cannot handle an address.
30522 </para>
30523 <para>
30524 <indexterm role="option">
30525 <primary><option>redirect_router</option></primary>
30526 </indexterm>
30527 </para>
30528 <informaltable frame="all">
30529 <tgroup cols="4" colsep="0" rowsep="0">
30530 <colspec colwidth="8*" align="left"/>
30531 <colspec colwidth="6*" align="center"/>
30532 <colspec colwidth="6*" align="center"/>
30533 <colspec colwidth="6*" align="right"/>
30534 <tbody>
30535 <row>
30536 <entry><option>redirect_router</option></entry>
30537 <entry>Use: <emphasis>routers</emphasis></entry>
30538 <entry>Type: <emphasis>string</emphasis></entry>
30539 <entry>Default: <emphasis>unset</emphasis></entry>
30540 </row>
30541 </tbody>
30542 </tgroup>
30543 </informaltable>
30544 <para>
30545 <indexterm role="concept">
30546 <primary>router</primary>
30547 <secondary>start at after redirection</secondary>
30548 </indexterm>
30549 Sometimes an administrator knows that it is pointless to reprocess addresses
30550 generated from alias or forward files with the same router again. For
30551 example, if an alias file translates real names into login ids there is no
30552 point searching the alias file a second time, especially if it is a large file.
30553 </para>
30554 <para>
30555 The <option>redirect_router</option> option can be set to the name of any router instance.
30556 It causes the routing of any generated addresses to start at the named router
30557 instead of at the first router. This option has no effect if the router in
30558 which it is set does not generate new addresses.
30559 </para>
30560 <para>
30561 <indexterm role="option">
30562 <primary><option>require_files</option></primary>
30563 </indexterm>
30564 </para>
30565 <informaltable frame="all">
30566 <tgroup cols="4" colsep="0" rowsep="0">
30567 <colspec colwidth="8*" align="left"/>
30568 <colspec colwidth="6*" align="center"/>
30569 <colspec colwidth="6*" align="center"/>
30570 <colspec colwidth="6*" align="right"/>
30571 <tbody>
30572 <row>
30573 <entry><option>require_files</option></entry>
30574 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
30575 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
30576 <entry>Default: <emphasis>unset</emphasis></entry>
30577 </row>
30578 </tbody>
30579 </tgroup>
30580 </informaltable>
30581 <para>
30582 <indexterm role="concept">
30583 <primary>file</primary>
30584 <secondary>requiring for router</secondary>
30585 </indexterm>
30586 <indexterm role="concept">
30587 <primary>router</primary>
30588 <secondary>requiring file existence</secondary>
30589 </indexterm>
30590 This option provides a general mechanism for predicating the running of a
30591 router on the existence or non-existence of certain files or directories.
30592 Before running a router, as one of its precondition tests, Exim works its way
30593 through the <option>require_files</option> list, expanding each item separately.
30594 </para>
30595 <para>
30596 Because the list is split before expansion, any colons in expansion items must
30597 be doubled, or the facility for using a different list separator must be used.
30598 If any expansion is forced to fail, the item is ignored. Other expansion
30599 failures cause routing of the address to be deferred.
30600 </para>
30601 <para>
30602 If any expanded string is empty, it is ignored. Otherwise, except as described
30603 below, each string must be a fully qualified file path, optionally preceded by
30604 <quote>!</quote>. The paths are passed to the <function>stat()</function> function to test for the
30605 existence of the files or directories. The router is skipped if any paths not
30606 preceded by <quote>!</quote> do not exist, or if any paths preceded by <quote>!</quote> do exist.
30607 </para>
30608 <para>
30609 <indexterm role="concept">
30610 <primary>NFS</primary>
30611 </indexterm>
30612 If <function>stat()</function> cannot determine whether a file exists or not, delivery of
30613 the message is deferred. This can happen when NFS-mounted filesystems are
30614 unavailable.
30615 </para>
30616 <para>
30617 This option is checked after the <option>domains</option>, <option>local_parts</option>, and <option>senders</option>
30618 options, so you cannot use it to check for the existence of a file in which to
30619 look up a domain, local part, or sender. (See section <xref linkend="SECTrouprecon"/> for a
30620 full list of the order in which preconditions are evaluated.) However, as
30621 these options are all expanded, you can use the <option>exists</option> expansion condition
30622 to make such tests. The <option>require_files</option> option is intended for checking files
30623 that the router may be going to use internally, or which are needed by a
30624 transport (for example <filename>.procmailrc</filename>).
30625 </para>
30626 <para>
30627 During delivery, the <function>stat()</function> function is run as root, but there is a
30628 facility for some checking of the accessibility of a file by another user.
30629 This is not a proper permissions check, but just a <quote>rough</quote> check that
30630 operates as follows:
30631 </para>
30632 <para>
30633 If an item in a <option>require_files</option> list does not contain any forward slash
30634 characters, it is taken to be the user (and optional group, separated by a
30635 comma) to be checked for subsequent files in the list. If no group is specified
30636 but the user is specified symbolically, the gid associated with the uid is
30637 used. For example:
30638 </para>
30639 <literallayout class="monospaced">
30640 require_files = mail:/some/file
30641 require_files = $local_part:$home/.procmailrc
30642 </literallayout>
30643 <para>
30644 If a user or group name in a <option>require_files</option> list does not exist, the
30645 <option>require_files</option> condition fails.
30646 </para>
30647 <para>
30648 Exim performs the check by scanning along the components of the file path, and
30649 checking the access for the given uid and gid. It checks for <quote>x</quote> access on
30650 directories, and <quote>r</quote> access on the final file. Note that this means that file
30651 access control lists, if the operating system has them, are ignored.
30652 </para>
30653 <para>
30654 <emphasis role="bold">Warning 1</emphasis>: When the router is being run to verify addresses for an
30655 incoming SMTP message, Exim is not running as root, but under its own uid. This
30656 may affect the result of a <option>require_files</option> check. In particular, <function>stat()</function>
30657 may yield the error EACCES (<quote>Permission denied</quote>). This means that the Exim
30658 user is not permitted to read one of the directories on the file&#x2019;s path.
30659 </para>
30660 <para>
30661 <emphasis role="bold">Warning 2</emphasis>: Even when Exim is running as root while delivering a message,
30662 <function>stat()</function> can yield EACCES for a file in an NFS directory that is mounted
30663 without root access. In this case, if a check for access by a particular user
30664 is requested, Exim creates a subprocess that runs as that user, and tries the
30665 check again in that process.
30666 </para>
30667 <para>
30668 The default action for handling an unresolved EACCES is to consider it to
30669 be caused by a configuration error, and routing is deferred because the
30670 existence or non-existence of the file cannot be determined. However, in some
30671 circumstances it may be desirable to treat this condition as if the file did
30672 not exist. If the file name (or the exclamation mark that precedes the file
30673 name for non-existence) is preceded by a plus sign, the EACCES error is treated
30674 as if the file did not exist. For example:
30675 </para>
30676 <literallayout class="monospaced">
30677 require_files = +/some/file
30678 </literallayout>
30679 <para>
30680 If the router is not an essential part of verification (for example, it
30681 handles users&#x2019; <filename>.forward</filename> files), another solution is to set the <option>verify</option>
30682 option false so that the router is skipped when verifying.
30683 </para>
30684 <para>
30685 <indexterm role="option">
30686 <primary><option>retry_use_local_part</option></primary>
30687 </indexterm>
30688 </para>
30689 <informaltable frame="all">
30690 <tgroup cols="4" colsep="0" rowsep="0">
30691 <colspec colwidth="8*" align="left"/>
30692 <colspec colwidth="6*" align="center"/>
30693 <colspec colwidth="6*" align="center"/>
30694 <colspec colwidth="6*" align="right"/>
30695 <tbody>
30696 <row>
30697 <entry><option>retry_use_local_part</option></entry>
30698 <entry>Use: <emphasis>routers</emphasis></entry>
30699 <entry>Type: <emphasis>boolean</emphasis></entry>
30700 <entry>Default: <emphasis>see below</emphasis></entry>
30701 </row>
30702 </tbody>
30703 </tgroup>
30704 </informaltable>
30705 <para>
30706 <indexterm role="concept">
30707 <primary>hints database</primary>
30708 <secondary>retry keys</secondary>
30709 </indexterm>
30710 <indexterm role="concept">
30711 <primary>local part</primary>
30712 <secondary>in retry keys</secondary>
30713 </indexterm>
30714 When a delivery suffers a temporary routing failure, a retry record is created
30715 in Exim&#x2019;s hints database. For addresses whose routing depends only on the
30716 domain, the key for the retry record should not involve the local part, but for
30717 other addresses, both the domain and the local part should be included.
30718 Usually, remote routing is of the former kind, and local routing is of the
30719 latter kind.
30720 </para>
30721 <para>
30722 This option controls whether the local part is used to form the key for retry
30723 hints for addresses that suffer temporary errors while being handled by this
30724 router. The default value is true for any router that has <option>check_local_user</option>
30725 set, and false otherwise. Note that this option does not apply to hints keys
30726 for transport delays; they are controlled by a generic transport option of the
30727 same name.
30728 </para>
30729 <para>
30730 The setting of <option>retry_use_local_part</option> applies only to the router on which it
30731 appears. If the router generates child addresses, they are routed
30732 independently; this setting does not become attached to them.
30733 </para>
30734 <para>
30735 <indexterm role="option">
30736 <primary><option>router_home_directory</option></primary>
30737 </indexterm>
30738 </para>
30739 <informaltable frame="all">
30740 <tgroup cols="4" colsep="0" rowsep="0">
30741 <colspec colwidth="8*" align="left"/>
30742 <colspec colwidth="6*" align="center"/>
30743 <colspec colwidth="6*" align="center"/>
30744 <colspec colwidth="6*" align="right"/>
30745 <tbody>
30746 <row>
30747 <entry><option>router_home_directory</option></entry>
30748 <entry>Use: <emphasis>routers</emphasis></entry>
30749 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30750 <entry>Default: <emphasis>unset</emphasis></entry>
30751 </row>
30752 </tbody>
30753 </tgroup>
30754 </informaltable>
30755 <para>
30756 <indexterm role="concept">
30757 <primary>router</primary>
30758 <secondary>home directory for</secondary>
30759 </indexterm>
30760 <indexterm role="concept">
30761 <primary>home directory</primary>
30762 <secondary>for router</secondary>
30763 </indexterm>
30764 <indexterm role="variable">
30765 <primary><varname>$home</varname></primary>
30766 </indexterm>
30767 This option sets a home directory for use while the router is running. (Compare
30768 <option>transport_home_directory</option>, which sets a home directory for later
30769 transporting.) In particular, if used on a <command>redirect</command> router, this option
30770 sets a value for <varname>$home</varname> while a filter is running. The value is expanded;
30771 forced expansion failure causes the option to be ignored &ndash; other failures
30772 cause the router to defer.
30773 </para>
30774 <para>
30775 Expansion of <option>router_home_directory</option> happens immediately after the
30776 <option>check_local_user</option> test (if configured), before any further expansions take
30777 place.
30778 (See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
30779 are evaluated.)
30780 While the router is running, <option>router_home_directory</option> overrides the value of
30781 <varname>$home</varname> that came from <option>check_local_user</option>.
30782 </para>
30783 <para>
30784 When a router accepts an address and assigns it to a local transport (including
30785 the cases when a <command>redirect</command> router generates a pipe, file, or autoreply
30786 delivery), the home directory setting for the transport is taken from the first
30787 of these values that is set:
30788 </para>
30789 <itemizedlist>
30790 <listitem>
30791 <para>
30792 The <option>home_directory</option> option on the transport;
30793 </para>
30794 </listitem>
30795 <listitem>
30796 <para>
30797 The <option>transport_home_directory</option> option on the router;
30798 </para>
30799 </listitem>
30800 <listitem>
30801 <para>
30802 The password data if <option>check_local_user</option> is set on the router;
30803 </para>
30804 </listitem>
30805 <listitem>
30806 <para>
30807 The <option>router_home_directory</option> option on the router.
30808 </para>
30809 </listitem>
30810 </itemizedlist>
30811 <para>
30812 In other words, <option>router_home_directory</option> overrides the password data for the
30813 router, but not for the transport.
30814 </para>
30815 <para>
30816 <indexterm role="option">
30817 <primary><option>self</option></primary>
30818 </indexterm>
30819 </para>
30820 <informaltable frame="all">
30821 <tgroup cols="4" colsep="0" rowsep="0">
30822 <colspec colwidth="8*" align="left"/>
30823 <colspec colwidth="6*" align="center"/>
30824 <colspec colwidth="6*" align="center"/>
30825 <colspec colwidth="6*" align="right"/>
30826 <tbody>
30827 <row>
30828 <entry><option>self</option></entry>
30829 <entry>Use: <emphasis>routers</emphasis></entry>
30830 <entry>Type: <emphasis>string</emphasis></entry>
30831 <entry>Default: <emphasis>freeze</emphasis></entry>
30832 </row>
30833 </tbody>
30834 </tgroup>
30835 </informaltable>
30836 <para>
30837 <indexterm role="concept">
30838 <primary>MX record</primary>
30839 <secondary>pointing to local host</secondary>
30840 </indexterm>
30841 <indexterm role="concept">
30842 <primary>local host</primary>
30843 <secondary>MX pointing to</secondary>
30844 </indexterm>
30845 This option applies to those routers that use a recipient address to find a
30846 list of remote hosts. Currently, these are the <command>dnslookup</command>, <command>ipliteral</command>,
30847 and <command>manualroute</command> routers.
30848 Certain configurations of the <command>queryprogram</command> router can also specify a list
30849 of remote hosts.
30850 Usually such routers are configured to send the message to a remote host via an
30851 <command>smtp</command> transport. The <option>self</option> option specifies what happens when the first
30852 host on the list turns out to be the local host.
30853 The way in which Exim checks for the local host is described in section
30854 <xref linkend="SECTreclocipadd"/>.
30855 </para>
30856 <para>
30857 Normally this situation indicates either an error in Exim&#x2019;s configuration (for
30858 example, the router should be configured not to process this domain), or an
30859 error in the DNS (for example, the MX should not point to this host). For this
30860 reason, the default action is to log the incident, defer the address, and
30861 freeze the message. The following alternatives are provided for use in special
30862 cases:
30863 </para>
30864 <variablelist>
30865 <varlistentry>
30866 <term><option>defer</option></term>
30867 <listitem>
30868 <para>
30869 Delivery of the message is tried again later, but the message is not frozen.
30870 </para>
30871 </listitem></varlistentry>
30872 <varlistentry>
30873 <term><option>reroute</option>: &lt;<emphasis>domain</emphasis>&gt;</term>
30874 <listitem>
30875 <para>
30876 The domain is changed to the given domain, and the address is passed back to
30877 be reprocessed by the routers. No rewriting of headers takes place. This
30878 behaviour is essentially a redirection.
30879 </para>
30880 </listitem></varlistentry>
30881 <varlistentry>
30882 <term><option>reroute: rewrite:</option> &lt;<emphasis>domain</emphasis>&gt;</term>
30883 <listitem>
30884 <para>
30885 The domain is changed to the given domain, and the address is passed back to be
30886 reprocessed by the routers. Any headers that contain the original domain are
30887 rewritten.
30888 </para>
30889 </listitem></varlistentry>
30890 <varlistentry>
30891 <term><option>pass</option></term>
30892 <listitem>
30893 <para>
30894 <indexterm role="option">
30895 <primary><option>more</option></primary>
30896 </indexterm>
30897 <indexterm role="variable">
30898 <primary><varname>$self_hostname</varname></primary>
30899 </indexterm>
30900 The router passes the address to the next router, or to the router named in the
30901 <option>pass_router</option> option if it is set. This overrides <option>no_more</option>. During
30902 subsequent routing and delivery, the variable <varname>$self_hostname</varname> contains the
30903 name of the local host that the router encountered. This can be used to
30904 distinguish between different cases for hosts with multiple names. The
30905 combination
30906 </para>
30907 <literallayout class="monospaced">
30908 self = pass
30909 no_more
30910 </literallayout>
30911 <para>
30912 ensures that only those addresses that routed to the local host are passed on.
30913 Without <option>no_more</option>, addresses that were declined for other reasons would also
30914 be passed to the next router.
30915 </para>
30916 </listitem></varlistentry>
30917 <varlistentry>
30918 <term><option>fail</option></term>
30919 <listitem>
30920 <para>
30921 Delivery fails and an error report is generated.
30922 </para>
30923 </listitem></varlistentry>
30924 <varlistentry>
30925 <term><option>send</option></term>
30926 <listitem>
30927 <para>
30928 <indexterm role="concept">
30929 <primary>local host</primary>
30930 <secondary>sending to</secondary>
30931 </indexterm>
30932 The anomaly is ignored and the address is queued for the transport. This
30933 setting should be used with extreme caution. For an <command>smtp</command> transport, it
30934 makes sense only in cases where the program that is listening on the SMTP port
30935 is not this version of Exim. That is, it must be some other MTA, or Exim with a
30936 different configuration file that handles the domain in another way.
30937 </para>
30938 </listitem></varlistentry>
30939 </variablelist>
30940 <para>
30941 <indexterm role="option">
30942 <primary><option>senders</option></primary>
30943 </indexterm>
30944 </para>
30945 <informaltable frame="all">
30946 <tgroup cols="4" colsep="0" rowsep="0">
30947 <colspec colwidth="8*" align="left"/>
30948 <colspec colwidth="6*" align="center"/>
30949 <colspec colwidth="6*" align="center"/>
30950 <colspec colwidth="6*" align="right"/>
30951 <tbody>
30952 <row>
30953 <entry><option>senders</option></entry>
30954 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
30955 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
30956 <entry>Default: <emphasis>unset</emphasis></entry>
30957 </row>
30958 </tbody>
30959 </tgroup>
30960 </informaltable>
30961 <para>
30962 <indexterm role="concept">
30963 <primary>router</primary>
30964 <secondary>checking senders</secondary>
30965 </indexterm>
30966 If this option is set, the router is skipped unless the message&#x2019;s sender
30967 address matches something on the list.
30968 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
30969 are evaluated.
30970 </para>
30971 <para>
30972 There are issues concerning verification when the running of routers is
30973 dependent on the sender. When Exim is verifying the address in an <option>errors_to</option>
30974 setting, it sets the sender to the null string. When using the <option>-bt</option> option
30975 to check a configuration file, it is necessary also to use the <option>-f</option> option to
30976 set an appropriate sender. For incoming mail, the sender is unset when
30977 verifying the sender, but is available when verifying any recipients. If the
30978 SMTP VRFY command is enabled, it must be used after MAIL if the sender address
30979 matters.
30980 </para>
30981 <para>
30982 <indexterm role="option">
30983 <primary><option>translate_ip_address</option></primary>
30984 </indexterm>
30985 </para>
30986 <informaltable frame="all">
30987 <tgroup cols="4" colsep="0" rowsep="0">
30988 <colspec colwidth="8*" align="left"/>
30989 <colspec colwidth="6*" align="center"/>
30990 <colspec colwidth="6*" align="center"/>
30991 <colspec colwidth="6*" align="right"/>
30992 <tbody>
30993 <row>
30994 <entry><option>translate_ip_address</option></entry>
30995 <entry>Use: <emphasis>routers</emphasis></entry>
30996 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30997 <entry>Default: <emphasis>unset</emphasis></entry>
30998 </row>
30999 </tbody>
31000 </tgroup>
31001 </informaltable>
31002 <para>
31003 <indexterm role="concept">
31004 <primary>IP address</primary>
31005 <secondary>translating</secondary>
31006 </indexterm>
31007 <indexterm role="concept">
31008 <primary>packet radio</primary>
31009 </indexterm>
31010 <indexterm role="concept">
31011 <primary>router</primary>
31012 <secondary>IP address translation</secondary>
31013 </indexterm>
31014 There exist some rare networking situations (for example, packet radio) where
31015 it is helpful to be able to translate IP addresses generated by normal routing
31016 mechanisms into other IP addresses, thus performing a kind of manual IP
31017 routing. This should be done only if the normal IP routing of the TCP/IP stack
31018 is inadequate or broken. Because this is an extremely uncommon requirement, the
31019 code to support this option is not included in the Exim binary unless
31020 SUPPORT_TRANSLATE_IP_ADDRESS=yes is set in <filename>Local/Makefile</filename>.
31021 </para>
31022 <para>
31023 <indexterm role="variable">
31024 <primary><varname>$host_address</varname></primary>
31025 </indexterm>
31026 The <option>translate_ip_address</option> string is expanded for every IP address generated
31027 by the router, with the generated address set in <varname>$host_address</varname>. If the
31028 expansion is forced to fail, no action is taken.
31029 For any other expansion error, delivery of the message is deferred.
31030 If the result of the expansion is an IP address, that replaces the original
31031 address; otherwise the result is assumed to be a host name &ndash; this is looked
31032 up using <function>gethostbyname()</function> (or <function>getipnodebyname()</function> when available) to
31033 produce one or more replacement IP addresses. For example, to subvert all IP
31034 addresses in some specific networks, this could be added to a router:
31035 </para>
31036 <literallayout class="monospaced">
31037 translate_ip_address = \
31038   ${lookup{${mask:$host_address/26}}lsearch{/some/file}\
31039     {$value}fail}}
31040 </literallayout>
31041 <para>
31042 The file would contain lines like
31043 </para>
31044 <literallayout class="monospaced">
31045 10.2.3.128/26    some.host
31046 10.8.4.34/26     10.44.8.15
31047 </literallayout>
31048 <para>
31049 You should not make use of this facility unless you really understand what you
31050 are doing.
31051 </para>
31052 <para>
31053 <indexterm role="option">
31054 <primary><option>transport</option></primary>
31055 </indexterm>
31056 </para>
31057 <informaltable frame="all">
31058 <tgroup cols="4" colsep="0" rowsep="0">
31059 <colspec colwidth="8*" align="left"/>
31060 <colspec colwidth="6*" align="center"/>
31061 <colspec colwidth="6*" align="center"/>
31062 <colspec colwidth="6*" align="right"/>
31063 <tbody>
31064 <row>
31065 <entry><option>transport</option></entry>
31066 <entry>Use: <emphasis>routers</emphasis></entry>
31067 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31068 <entry>Default: <emphasis>unset</emphasis></entry>
31069 </row>
31070 </tbody>
31071 </tgroup>
31072 </informaltable>
31073 <para>
31074 This option specifies the transport to be used when a router accepts an address
31075 and sets it up for delivery. A transport is never needed if a router is used
31076 only for verification. The value of the option is expanded at routing time,
31077 after the expansion of <option>errors_to</option>, <option>headers_add</option>, and <option>headers_remove</option>,
31078 and result must be the name of one of the configured transports. If it is not,
31079 delivery is deferred.
31080 </para>
31081 <para>
31082 The <option>transport</option> option is not used by the <command>redirect</command> router, but it does
31083 have some private options that set up transports for pipe and file deliveries
31084 (see chapter <xref linkend="CHAPredirect"/>).
31085 </para>
31086 <para>
31087 <indexterm role="option">
31088 <primary><option>transport_current_directory</option></primary>
31089 </indexterm>
31090 </para>
31091 <informaltable frame="all">
31092 <tgroup cols="4" colsep="0" rowsep="0">
31093 <colspec colwidth="8*" align="left"/>
31094 <colspec colwidth="6*" align="center"/>
31095 <colspec colwidth="6*" align="center"/>
31096 <colspec colwidth="6*" align="right"/>
31097 <tbody>
31098 <row>
31099 <entry><option>transport_current_directory</option></entry>
31100 <entry>Use: <emphasis>routers</emphasis></entry>
31101 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31102 <entry>Default: <emphasis>unset</emphasis></entry>
31103 </row>
31104 </tbody>
31105 </tgroup>
31106 </informaltable>
31107 <para>
31108 <indexterm role="concept">
31109 <primary>current directory for local transport</primary>
31110 </indexterm>
31111 This option associates a current directory with any address that is routed
31112 to a local transport. This can happen either because a transport is
31113 explicitly configured for the router, or because it generates a delivery to a
31114 file or a pipe. During the delivery process (that is, at transport time), this
31115 option string is expanded and is set as the current directory, unless
31116 overridden by a setting on the transport.
31117 If the expansion fails for any reason, including forced failure, an error is
31118 logged, and delivery is deferred.
31119 See chapter <xref linkend="CHAPenvironment"/> for details of the local delivery
31120 environment.
31121 </para>
31122 <para>
31123 <indexterm role="option">
31124 <primary><option>transport_home_directory</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>transport_home_directory</option></entry>
31136 <entry>Use: <emphasis>routers</emphasis></entry>
31137 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31138 <entry>Default: <emphasis>see below</emphasis></entry>
31139 </row>
31140 </tbody>
31141 </tgroup>
31142 </informaltable>
31143 <para>
31144 <indexterm role="concept">
31145 <primary>home directory</primary>
31146 <secondary>for local transport</secondary>
31147 </indexterm>
31148 This option associates a home directory with any address that is routed to a
31149 local transport. This can happen either because a transport is explicitly
31150 configured for the router, or because it generates a delivery to a file or a
31151 pipe. During the delivery process (that is, at transport time), the option
31152 string is expanded and is set as the home directory, unless overridden by a
31153 setting of <option>home_directory</option> on the transport.
31154 If the expansion fails for any reason, including forced failure, an error is
31155 logged, and delivery is deferred.
31156 </para>
31157 <para>
31158 If the transport does not specify a home directory, and
31159 <option>transport_home_directory</option> is not set for the router, the home directory for
31160 the transport is taken from the password data if <option>check_local_user</option> is set for
31161 the router. Otherwise it is taken from <option>router_home_directory</option> if that option
31162 is set; if not, no home directory is set for the transport.
31163 </para>
31164 <para>
31165 See chapter <xref linkend="CHAPenvironment"/> for further details of the local delivery
31166 environment.
31167 </para>
31168 <para>
31169 <indexterm role="option">
31170 <primary><option>unseen</option></primary>
31171 </indexterm>
31172 </para>
31173 <informaltable frame="all">
31174 <tgroup cols="4" colsep="0" rowsep="0">
31175 <colspec colwidth="8*" align="left"/>
31176 <colspec colwidth="6*" align="center"/>
31177 <colspec colwidth="6*" align="center"/>
31178 <colspec colwidth="6*" align="right"/>
31179 <tbody>
31180 <row>
31181 <entry><option>unseen</option></entry>
31182 <entry>Use: <emphasis>routers</emphasis></entry>
31183 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
31184 <entry>Default: <emphasis>false</emphasis></entry>
31185 </row>
31186 </tbody>
31187 </tgroup>
31188 </informaltable>
31189 <para>
31190 <indexterm role="concept">
31191 <primary>router</primary>
31192 <secondary>carrying on after success</secondary>
31193 </indexterm>
31194 The result of string expansion for this option must be a valid boolean value,
31195 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
31196 result causes an error, and delivery is deferred. If the expansion is forced to
31197 fail, the default value for the option (false) is used. Other failures cause
31198 delivery to be deferred.
31199 </para>
31200 <para>
31201 When this option is set true, routing does not cease if the router accepts the
31202 address. Instead, a copy of the incoming address is passed to the next router,
31203 overriding a false setting of <option>more</option>. There is little point in setting
31204 <option>more</option> false if <option>unseen</option> is always true, but it may be useful in cases when
31205 the value of <option>unseen</option> contains expansion items (and therefore, presumably, is
31206 sometimes true and sometimes false).
31207 </para>
31208 <para>
31209 <indexterm role="concept">
31210 <primary>copy of message (<option>unseen</option> option)</primary>
31211 </indexterm>
31212 Setting the <option>unseen</option> option has a similar effect to the <option>unseen</option> command
31213 qualifier in filter files. It can be used to cause copies of messages to be
31214 delivered to some other destination, while also carrying out a normal delivery.
31215 In effect, the current address is made into a <quote>parent</quote> that has two children
31216 &ndash; one that is delivered as specified by this router, and a clone that goes on
31217 to be routed further. For this reason, <option>unseen</option> may not be combined with the
31218 <option>one_time</option> option in a <command>redirect</command> router.
31219 </para>
31220 <para>
31221 <emphasis role="bold">Warning</emphasis>: Header lines added to the address (or specified for removal) by
31222 this router or by previous routers affect the <quote>unseen</quote> copy of the message
31223 only. The clone that continues to be processed by further routers starts with
31224 no added headers and none specified for removal. For a <option>redirect</option> router, if
31225 a generated address is the same as the incoming address, this can lead to
31226 duplicate addresses with different header modifications. Exim does not do
31227 duplicate deliveries (except, in certain circumstances, to pipes -- see section
31228 <xref linkend="SECTdupaddr"/>), but it is undefined which of the duplicates is discarded,
31229 so this ambiguous situation should be avoided. The <option>repeat_use</option> option of the
31230 <option>redirect</option> router may be of help.
31231 </para>
31232 <para>
31233 Unlike the handling of header modifications, any data that was set by the
31234 <option>address_data</option> option in the current or previous routers <emphasis>is</emphasis> passed on to
31235 subsequent routers.
31236 </para>
31237 <para>
31238 <indexterm role="option">
31239 <primary><option>user</option></primary>
31240 </indexterm>
31241 </para>
31242 <informaltable frame="all">
31243 <tgroup cols="4" colsep="0" rowsep="0">
31244 <colspec colwidth="8*" align="left"/>
31245 <colspec colwidth="6*" align="center"/>
31246 <colspec colwidth="6*" align="center"/>
31247 <colspec colwidth="6*" align="right"/>
31248 <tbody>
31249 <row>
31250 <entry><option>user</option></entry>
31251 <entry>Use: <emphasis>routers</emphasis></entry>
31252 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31253 <entry>Default: <emphasis>see below</emphasis></entry>
31254 </row>
31255 </tbody>
31256 </tgroup>
31257 </informaltable>
31258 <para>
31259 <indexterm role="concept">
31260 <primary>uid (user id)</primary>
31261 <secondary>local delivery</secondary>
31262 </indexterm>
31263 <indexterm role="concept">
31264 <primary>local transports</primary>
31265 <secondary>uid and gid</secondary>
31266 </indexterm>
31267 <indexterm role="concept">
31268 <primary>transport</primary>
31269 <secondary>local</secondary>
31270 </indexterm>
31271 <indexterm role="concept">
31272 <primary>router</primary>
31273 <secondary>user for filter processing</secondary>
31274 </indexterm>
31275 <indexterm role="concept">
31276 <primary>filter</primary>
31277 <secondary>user for processing</secondary>
31278 </indexterm>
31279 When a router queues an address for a transport, and the transport does not
31280 specify a user, the user given here is used when running the delivery process.
31281 The user may be specified numerically or by name. If expansion fails, the
31282 error is logged and delivery is deferred.
31283 This user is also used by the <command>redirect</command> router when running a filter file.
31284 The default is unset, except when <option>check_local_user</option> is set. In this case,
31285 the default is taken from the password information. If the user is specified as
31286 a name, and <option>group</option> is not set, the group associated with the user is used.
31287 See also <option>initgroups</option> and <option>group</option> and the discussion in chapter
31288 <xref linkend="CHAPenvironment"/>.
31289 </para>
31290 <para>
31291 <indexterm role="option">
31292 <primary><option>verify</option></primary>
31293 </indexterm>
31294 </para>
31295 <informaltable frame="all">
31296 <tgroup cols="4" colsep="0" rowsep="0">
31297 <colspec colwidth="8*" align="left"/>
31298 <colspec colwidth="6*" align="center"/>
31299 <colspec colwidth="6*" align="center"/>
31300 <colspec colwidth="6*" align="right"/>
31301 <tbody>
31302 <row>
31303 <entry><option>verify</option></entry>
31304 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
31305 <entry>Type: <emphasis>boolean</emphasis></entry>
31306 <entry>Default: <emphasis>true</emphasis></entry>
31307 </row>
31308 </tbody>
31309 </tgroup>
31310 </informaltable>
31311 <para>
31312 Setting this option has the effect of setting <option>verify_sender</option> and
31313 <option>verify_recipient</option> to the same value.
31314 </para>
31315 <para>
31316 <indexterm role="option">
31317 <primary><option>verify_only</option></primary>
31318 </indexterm>
31319 </para>
31320 <informaltable frame="all">
31321 <tgroup cols="4" colsep="0" rowsep="0">
31322 <colspec colwidth="8*" align="left"/>
31323 <colspec colwidth="6*" align="center"/>
31324 <colspec colwidth="6*" align="center"/>
31325 <colspec colwidth="6*" align="right"/>
31326 <tbody>
31327 <row>
31328 <entry><option>verify_only</option></entry>
31329 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
31330 <entry>Type: <emphasis>boolean</emphasis></entry>
31331 <entry>Default: <emphasis>false</emphasis></entry>
31332 </row>
31333 </tbody>
31334 </tgroup>
31335 </informaltable>
31336 <para>
31337 <indexterm role="concept">
31338 <primary>EXPN</primary>
31339 <secondary>with <option>verify_only</option></secondary>
31340 </indexterm>
31341 <indexterm role="option">
31342 <primary><option>-bv</option></primary>
31343 </indexterm>
31344 <indexterm role="concept">
31345 <primary>router</primary>
31346 <secondary>used only when verifying</secondary>
31347 </indexterm>
31348 If this option is set, the router is used only when verifying an address or
31349 testing with the <option>-bv</option> option, not when actually doing a delivery, testing
31350 with the <option>-bt</option> option, or running the SMTP EXPN command. It can be further
31351 restricted to verifying only senders or recipients by means of
31352 <option>verify_sender</option> and <option>verify_recipient</option>.
31353 </para>
31354 <para>
31355 <emphasis role="bold">Warning</emphasis>: When the router is being run to verify addresses for an incoming
31356 SMTP message, Exim is not running as root, but under its own uid. If the router
31357 accesses any files, you need to make sure that they are accessible to the Exim
31358 user or group.
31359 </para>
31360 <para>
31361 <indexterm role="option">
31362 <primary><option>verify_recipient</option></primary>
31363 </indexterm>
31364 </para>
31365 <informaltable frame="all">
31366 <tgroup cols="4" colsep="0" rowsep="0">
31367 <colspec colwidth="8*" align="left"/>
31368 <colspec colwidth="6*" align="center"/>
31369 <colspec colwidth="6*" align="center"/>
31370 <colspec colwidth="6*" align="right"/>
31371 <tbody>
31372 <row>
31373 <entry><option>verify_recipient</option></entry>
31374 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
31375 <entry>Type: <emphasis>boolean</emphasis></entry>
31376 <entry>Default: <emphasis>true</emphasis></entry>
31377 </row>
31378 </tbody>
31379 </tgroup>
31380 </informaltable>
31381 <para>
31382 If this option is false, the router is skipped when verifying recipient
31383 addresses
31384 or testing recipient verification using <option>-bv</option>.
31385 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
31386 are evaluated.
31387 </para>
31388 <para>
31389 <indexterm role="option">
31390 <primary><option>verify_sender</option></primary>
31391 </indexterm>
31392 </para>
31393 <informaltable frame="all">
31394 <tgroup cols="4" colsep="0" rowsep="0">
31395 <colspec colwidth="8*" align="left"/>
31396 <colspec colwidth="6*" align="center"/>
31397 <colspec colwidth="6*" align="center"/>
31398 <colspec colwidth="6*" align="right"/>
31399 <tbody>
31400 <row>
31401 <entry><option>verify_sender</option></entry>
31402 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
31403 <entry>Type: <emphasis>boolean</emphasis></entry>
31404 <entry>Default: <emphasis>true</emphasis></entry>
31405 </row>
31406 </tbody>
31407 </tgroup>
31408 </informaltable>
31409 <para>
31410 If this option is false, the router is skipped when verifying sender addresses
31411 or testing sender verification using <option>-bvs</option>.
31412 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
31413 are evaluated.
31414 <indexterm role="concept" startref="IIDgenoprou1" class="endofrange"/>
31415 <indexterm role="concept" startref="IIDgenoprou2" class="endofrange"/>
31416 </para>
31417 </chapter>
31418
31419 <chapter id="CHID4">
31420 <title>The accept router</title>
31421 <para>
31422 <indexterm role="concept">
31423 <primary><command>accept</command> router</primary>
31424 </indexterm>
31425 <indexterm role="concept">
31426 <primary>routers</primary>
31427 <secondary><command>accept</command></secondary>
31428 </indexterm>
31429 The <command>accept</command> router has no private options of its own. Unless it is being
31430 used purely for verification (see <option>verify_only</option>) a transport is required to
31431 be defined by the generic <option>transport</option> option. If the preconditions that are
31432 specified by generic options are met, the router accepts the address and queues
31433 it for the given transport. The most common use of this router is for setting
31434 up deliveries to local mailboxes. For example:
31435 </para>
31436 <literallayout class="monospaced">
31437 localusers:
31438   driver = accept
31439   domains = mydomain.example
31440   check_local_user
31441   transport = local_delivery
31442 </literallayout>
31443 <para>
31444 The <option>domains</option> condition in this example checks the domain of the address, and
31445 <option>check_local_user</option> checks that the local part is the login of a local user.
31446 When both preconditions are met, the <command>accept</command> router runs, and queues the
31447 address for the <command>local_delivery</command> transport.
31448 </para>
31449 </chapter>
31450
31451 <chapter id="CHAPdnslookup">
31452 <title>The dnslookup router</title>
31453 <para>
31454 <indexterm role="concept" id="IIDdnsrou1" class="startofrange">
31455 <primary><command>dnslookup</command> router</primary>
31456 </indexterm>
31457 <indexterm role="concept" id="IIDdnsrou2" class="startofrange">
31458 <primary>routers</primary>
31459 <secondary><command>dnslookup</command></secondary>
31460 </indexterm>
31461 The <command>dnslookup</command> router looks up the hosts that handle mail for the
31462 recipient&#x2019;s domain in the DNS. A transport must always be set for this router,
31463 unless <option>verify_only</option> is set.
31464 </para>
31465 <para>
31466 If SRV support is configured (see <option>check_srv</option> below), Exim first searches for
31467 SRV records. If none are found, or if SRV support is not configured,
31468 MX records are looked up. If no MX records exist, address records are sought.
31469 However, <option>mx_domains</option> can be set to disable the direct use of address
31470 records.
31471 </para>
31472 <para>
31473 MX records of equal priority are sorted by Exim into a random order. Exim then
31474 looks for address records for the host names obtained from MX or SRV records.
31475 When a host has more than one IP address, they are sorted into a random order,
31476 except that IPv6 addresses are always sorted before IPv4 addresses. If all the
31477 IP addresses found are discarded by a setting of the <option>ignore_target_hosts</option>
31478 generic option, the router declines.
31479 </para>
31480 <para>
31481 Unless they have the highest priority (lowest MX value), MX records that point
31482 to the local host, or to any host name that matches <option>hosts_treat_as_local</option>,
31483 are discarded, together with any other MX records of equal or lower priority.
31484 </para>
31485 <para>
31486 <indexterm role="concept">
31487 <primary>MX record</primary>
31488 <secondary>pointing to local host</secondary>
31489 </indexterm>
31490 <indexterm role="concept">
31491 <primary>local host</primary>
31492 <secondary>MX pointing to</secondary>
31493 </indexterm>
31494 <indexterm role="option">
31495 <primary><option>self</option></primary>
31496 <secondary>in <command>dnslookup</command> router</secondary>
31497 </indexterm>
31498 If the host pointed to by the highest priority MX record, or looked up as an
31499 address record, is the local host, or matches <option>hosts_treat_as_local</option>, what
31500 happens is controlled by the generic <option>self</option> option.
31501 </para>
31502 <section id="SECTprowitdnsloo">
31503 <title>Problems with DNS lookups</title>
31504 <para>
31505 There have been problems with DNS servers when SRV records are looked up.
31506 Some mis-behaving servers return a DNS error or timeout when a non-existent
31507 SRV record is sought. Similar problems have in the past been reported for
31508 MX records. The global <option>dns_again_means_nonexist</option> option can help with this
31509 problem, but it is heavy-handed because it is a global option.
31510 </para>
31511 <para>
31512 For this reason, there are two options, <option>srv_fail_domains</option> and
31513 <option>mx_fail_domains</option>, that control what happens when a DNS lookup in a
31514 <command>dnslookup</command> router results in a DNS failure or a <quote>try again</quote> response. If
31515 an attempt to look up an SRV or MX record causes one of these results, and the
31516 domain matches the relevant list, Exim behaves as if the DNS had responded <quote>no
31517 such record</quote>. In the case of an SRV lookup, this means that the router
31518 proceeds to look for MX records; in the case of an MX lookup, it proceeds to
31519 look for A or AAAA records, unless the domain matches <option>mx_domains</option>, in which
31520 case routing fails.
31521 </para>
31522 </section>
31523 <section id="SECID118">
31524 <title>Private options for dnslookup</title>
31525 <para>
31526 <indexterm role="concept">
31527 <primary>options</primary>
31528 <secondary><command>dnslookup</command> router</secondary>
31529 </indexterm>
31530 The private options for the <command>dnslookup</command> router are as follows:
31531 </para>
31532 <para>
31533 <indexterm role="option">
31534 <primary><option>check_secondary_mx</option></primary>
31535 </indexterm>
31536 </para>
31537 <informaltable frame="all">
31538 <tgroup cols="4" colsep="0" rowsep="0">
31539 <colspec colwidth="8*" align="left"/>
31540 <colspec colwidth="6*" align="center"/>
31541 <colspec colwidth="6*" align="center"/>
31542 <colspec colwidth="6*" align="right"/>
31543 <tbody>
31544 <row>
31545 <entry><option>check_secondary_mx</option></entry>
31546 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31547 <entry>Type: <emphasis>boolean</emphasis></entry>
31548 <entry>Default: <emphasis>false</emphasis></entry>
31549 </row>
31550 </tbody>
31551 </tgroup>
31552 </informaltable>
31553 <para>
31554 <indexterm role="concept">
31555 <primary>MX record</primary>
31556 <secondary>checking for secondary</secondary>
31557 </indexterm>
31558 If this option is set, the router declines unless the local host is found in
31559 (and removed from) the list of hosts obtained by MX lookup. This can be used to
31560 process domains for which the local host is a secondary mail exchanger
31561 differently to other domains. The way in which Exim decides whether a host is
31562 the local host is described in section <xref linkend="SECTreclocipadd"/>.
31563 </para>
31564 <para>
31565 <indexterm role="option">
31566 <primary><option>check_srv</option></primary>
31567 </indexterm>
31568 </para>
31569 <informaltable frame="all">
31570 <tgroup cols="4" colsep="0" rowsep="0">
31571 <colspec colwidth="8*" align="left"/>
31572 <colspec colwidth="6*" align="center"/>
31573 <colspec colwidth="6*" align="center"/>
31574 <colspec colwidth="6*" align="right"/>
31575 <tbody>
31576 <row>
31577 <entry><option>check_srv</option></entry>
31578 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31579 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31580 <entry>Default: <emphasis>unset</emphasis></entry>
31581 </row>
31582 </tbody>
31583 </tgroup>
31584 </informaltable>
31585 <para>
31586 <indexterm role="concept">
31587 <primary>SRV record</primary>
31588 <secondary>enabling use of</secondary>
31589 </indexterm>
31590 The <command>dnslookup</command> router supports the use of SRV records (see RFC 2782) in
31591 addition to MX and address records. The support is disabled by default. To
31592 enable SRV support, set the <option>check_srv</option> option to the name of the service
31593 required. For example,
31594 </para>
31595 <literallayout class="monospaced">
31596 check_srv = smtp
31597 </literallayout>
31598 <para>
31599 looks for SRV records that refer to the normal smtp service. The option is
31600 expanded, so the service name can vary from message to message or address
31601 to address. This might be helpful if SRV records are being used for a
31602 submission service. If the expansion is forced to fail, the <option>check_srv</option>
31603 option is ignored, and the router proceeds to look for MX records in the
31604 normal way.
31605 </para>
31606 <para>
31607 When the expansion succeeds, the router searches first for SRV records for
31608 the given service (it assumes TCP protocol). A single SRV record with a
31609 host name that consists of just a single dot indicates <quote>no such service for
31610 this domain</quote>; if this is encountered, the router declines. If other kinds of
31611 SRV record are found, they are used to construct a host list for delivery
31612 according to the rules of RFC 2782. MX records are not sought in this case.
31613 </para>
31614 <para>
31615 When no SRV records are found, MX records (and address records) are sought in
31616 the traditional way. In other words, SRV records take precedence over MX
31617 records, just as MX records take precedence over address records. Note that
31618 this behaviour is not sanctioned by RFC 2782, though a previous draft RFC
31619 defined it. It is apparently believed that MX records are sufficient for email
31620 and that SRV records should not be used for this purpose. However, SRV records
31621 have an additional <quote>weight</quote> feature which some people might find useful when
31622 trying to split an SMTP load between hosts of different power.
31623 </para>
31624 <para>
31625 See section <xref linkend="SECTprowitdnsloo"/> above for a discussion of Exim&#x2019;s behaviour
31626 when there is a DNS lookup error.
31627 </para>
31628 <para>
31629 <indexterm role="option">
31630 <primary><option>mx_domains</option></primary>
31631 </indexterm>
31632 </para>
31633 <informaltable frame="all">
31634 <tgroup cols="4" colsep="0" rowsep="0">
31635 <colspec colwidth="8*" align="left"/>
31636 <colspec colwidth="6*" align="center"/>
31637 <colspec colwidth="6*" align="center"/>
31638 <colspec colwidth="6*" align="right"/>
31639 <tbody>
31640 <row>
31641 <entry><option>mx_domains</option></entry>
31642 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31643 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
31644 <entry>Default: <emphasis>unset</emphasis></entry>
31645 </row>
31646 </tbody>
31647 </tgroup>
31648 </informaltable>
31649 <para>
31650 <indexterm role="concept">
31651 <primary>MX record</primary>
31652 <secondary>required to exist</secondary>
31653 </indexterm>
31654 <indexterm role="concept">
31655 <primary>SRV record</primary>
31656 <secondary>required to exist</secondary>
31657 </indexterm>
31658 A domain that matches <option>mx_domains</option> is required to have either an MX or an SRV
31659 record in order to be recognized. (The name of this option could be improved.)
31660 For example, if all the mail hosts in <emphasis>fict.example</emphasis> are known to have MX
31661 records, except for those in <emphasis>discworld.fict.example</emphasis>, you could use this
31662 setting:
31663 </para>
31664 <literallayout class="monospaced">
31665 mx_domains = ! *.discworld.fict.example : *.fict.example
31666 </literallayout>
31667 <para>
31668 This specifies that messages addressed to a domain that matches the list but
31669 has no MX record should be bounced immediately instead of being routed using
31670 the address record.
31671 </para>
31672 <para>
31673 <indexterm role="option">
31674 <primary><option>mx_fail_domains</option></primary>
31675 </indexterm>
31676 </para>
31677 <informaltable frame="all">
31678 <tgroup cols="4" colsep="0" rowsep="0">
31679 <colspec colwidth="8*" align="left"/>
31680 <colspec colwidth="6*" align="center"/>
31681 <colspec colwidth="6*" align="center"/>
31682 <colspec colwidth="6*" align="right"/>
31683 <tbody>
31684 <row>
31685 <entry><option>mx_fail_domains</option></entry>
31686 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31687 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
31688 <entry>Default: <emphasis>unset</emphasis></entry>
31689 </row>
31690 </tbody>
31691 </tgroup>
31692 </informaltable>
31693 <para>
31694 If the DNS lookup for MX records for one of the domains in this list causes a
31695 DNS lookup error, Exim behaves as if no MX records were found. See section
31696 <xref linkend="SECTprowitdnsloo"/> for more discussion.
31697 </para>
31698 <para>
31699 <indexterm role="option">
31700 <primary><option>qualify_single</option></primary>
31701 </indexterm>
31702 </para>
31703 <informaltable frame="all">
31704 <tgroup cols="4" colsep="0" rowsep="0">
31705 <colspec colwidth="8*" align="left"/>
31706 <colspec colwidth="6*" align="center"/>
31707 <colspec colwidth="6*" align="center"/>
31708 <colspec colwidth="6*" align="right"/>
31709 <tbody>
31710 <row>
31711 <entry><option>qualify_single</option></entry>
31712 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31713 <entry>Type: <emphasis>boolean</emphasis></entry>
31714 <entry>Default: <emphasis>true</emphasis></entry>
31715 </row>
31716 </tbody>
31717 </tgroup>
31718 </informaltable>
31719 <para>
31720 <indexterm role="concept">
31721 <primary>DNS</primary>
31722 <secondary>resolver options</secondary>
31723 </indexterm>
31724 <indexterm role="concept">
31725 <primary>DNS</primary>
31726 <secondary>qualifying single-component names</secondary>
31727 </indexterm>
31728 When this option is true, the resolver option RES_DEFNAMES is set for DNS
31729 lookups. Typically, but not standardly, this causes the resolver to qualify
31730 single-component names with the default domain. For example, on a machine
31731 called <emphasis>dictionary.ref.example</emphasis>, the domain <emphasis>thesaurus</emphasis> would be changed to
31732 <emphasis>thesaurus.ref.example</emphasis> inside the resolver. For details of what your
31733 resolver actually does, consult your man pages for <emphasis>resolver</emphasis> and
31734 <emphasis>resolv.conf</emphasis>.
31735 </para>
31736 <para>
31737 <indexterm role="option">
31738 <primary><option>rewrite_headers</option></primary>
31739 </indexterm>
31740 </para>
31741 <informaltable frame="all">
31742 <tgroup cols="4" colsep="0" rowsep="0">
31743 <colspec colwidth="8*" align="left"/>
31744 <colspec colwidth="6*" align="center"/>
31745 <colspec colwidth="6*" align="center"/>
31746 <colspec colwidth="6*" align="right"/>
31747 <tbody>
31748 <row>
31749 <entry><option>rewrite_headers</option></entry>
31750 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31751 <entry>Type: <emphasis>boolean</emphasis></entry>
31752 <entry>Default: <emphasis>true</emphasis></entry>
31753 </row>
31754 </tbody>
31755 </tgroup>
31756 </informaltable>
31757 <para>
31758 <indexterm role="concept">
31759 <primary>rewriting</primary>
31760 <secondary>header lines</secondary>
31761 </indexterm>
31762 <indexterm role="concept">
31763 <primary>header lines</primary>
31764 <secondary>rewriting</secondary>
31765 </indexterm>
31766 If the domain name in the address that is being processed is not fully
31767 qualified, it may be expanded to its full form by a DNS lookup. For example, if
31768 an address is specified as <emphasis>dormouse@teaparty</emphasis>, the domain might be
31769 expanded to <emphasis>teaparty.wonderland.fict.example</emphasis>. Domain expansion can also
31770 occur as a result of setting the <option>widen_domains</option> option. If
31771 <option>rewrite_headers</option> is true, all occurrences of the abbreviated domain name in
31772 any <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-to:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>
31773 header lines of the message are rewritten with the full domain name.
31774 </para>
31775 <para>
31776 This option should be turned off only when it is known that no message is
31777 ever going to be sent outside an environment where the abbreviation makes
31778 sense.
31779 </para>
31780 <para>
31781 When an MX record is looked up in the DNS and matches a wildcard record, name
31782 servers normally return a record containing the name that has been looked up,
31783 making it impossible to detect whether a wildcard was present or not. However,
31784 some name servers have recently been seen to return the wildcard entry. If the
31785 name returned by a DNS lookup begins with an asterisk, it is not used for
31786 header rewriting.
31787 </para>
31788 <para>
31789 <indexterm role="option">
31790 <primary><option>same_domain_copy_routing</option></primary>
31791 </indexterm>
31792 </para>
31793 <informaltable frame="all">
31794 <tgroup cols="4" colsep="0" rowsep="0">
31795 <colspec colwidth="8*" align="left"/>
31796 <colspec colwidth="6*" align="center"/>
31797 <colspec colwidth="6*" align="center"/>
31798 <colspec colwidth="6*" align="right"/>
31799 <tbody>
31800 <row>
31801 <entry><option>same_domain_copy_routing</option></entry>
31802 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31803 <entry>Type: <emphasis>boolean</emphasis></entry>
31804 <entry>Default: <emphasis>false</emphasis></entry>
31805 </row>
31806 </tbody>
31807 </tgroup>
31808 </informaltable>
31809 <para>
31810 <indexterm role="concept">
31811 <primary>address</primary>
31812 <secondary>copying routing</secondary>
31813 </indexterm>
31814 Addresses with the same domain are normally routed by the <command>dnslookup</command> router
31815 to the same list of hosts. However, this cannot be presumed, because the router
31816 options and preconditions may refer to the local part of the address. By
31817 default, therefore, Exim routes each address in a message independently. DNS
31818 servers run caches, so repeated DNS lookups are not normally expensive, and in
31819 any case, personal messages rarely have more than a few recipients.
31820 </para>
31821 <para>
31822 If you are running mailing lists with large numbers of subscribers at the same
31823 domain, and you are using a <command>dnslookup</command> router which is independent of the
31824 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
31825 lookups for identical domains in one message. In this case, when <command>dnslookup</command>
31826 routes an address to a remote transport, any other unrouted addresses in the
31827 message that have the same domain are automatically given the same routing
31828 without processing them independently,
31829 provided the following conditions are met:
31830 </para>
31831 <itemizedlist>
31832 <listitem>
31833 <para>
31834 No router that processed the address specified <option>headers_add</option> or
31835 <option>headers_remove</option>.
31836 </para>
31837 </listitem>
31838 <listitem>
31839 <para>
31840 The router did not change the address in any way, for example, by <quote>widening</quote>
31841 the domain.
31842 </para>
31843 </listitem>
31844 </itemizedlist>
31845 <para>
31846 <indexterm role="option">
31847 <primary><option>search_parents</option></primary>
31848 </indexterm>
31849 </para>
31850 <informaltable frame="all">
31851 <tgroup cols="4" colsep="0" rowsep="0">
31852 <colspec colwidth="8*" align="left"/>
31853 <colspec colwidth="6*" align="center"/>
31854 <colspec colwidth="6*" align="center"/>
31855 <colspec colwidth="6*" align="right"/>
31856 <tbody>
31857 <row>
31858 <entry><option>search_parents</option></entry>
31859 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31860 <entry>Type: <emphasis>boolean</emphasis></entry>
31861 <entry>Default: <emphasis>false</emphasis></entry>
31862 </row>
31863 </tbody>
31864 </tgroup>
31865 </informaltable>
31866 <para>
31867 <indexterm role="concept">
31868 <primary>DNS</primary>
31869 <secondary>resolver options</secondary>
31870 </indexterm>
31871 When this option is true, the resolver option RES_DNSRCH is set for DNS
31872 lookups. This is different from the <option>qualify_single</option> option in that it
31873 applies to domains containing dots. Typically, but not standardly, it causes
31874 the resolver to search for the name in the current domain and in parent
31875 domains. For example, on a machine in the <emphasis>fict.example</emphasis> domain, if looking
31876 up <emphasis>teaparty.wonderland</emphasis> failed, the resolver would try
31877 <emphasis>teaparty.wonderland.fict.example</emphasis>. For details of what your resolver
31878 actually does, consult your man pages for <emphasis>resolver</emphasis> and <emphasis>resolv.conf</emphasis>.
31879 </para>
31880 <para>
31881 Setting this option true can cause problems in domains that have a wildcard MX
31882 record, because any domain that does not have its own MX record matches the
31883 local wildcard.
31884 </para>
31885 <para>
31886 <indexterm role="option">
31887 <primary><option>srv_fail_domains</option></primary>
31888 </indexterm>
31889 </para>
31890 <informaltable frame="all">
31891 <tgroup cols="4" colsep="0" rowsep="0">
31892 <colspec colwidth="8*" align="left"/>
31893 <colspec colwidth="6*" align="center"/>
31894 <colspec colwidth="6*" align="center"/>
31895 <colspec colwidth="6*" align="right"/>
31896 <tbody>
31897 <row>
31898 <entry><option>srv_fail_domains</option></entry>
31899 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31900 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
31901 <entry>Default: <emphasis>unset</emphasis></entry>
31902 </row>
31903 </tbody>
31904 </tgroup>
31905 </informaltable>
31906 <para>
31907 If the DNS lookup for SRV records for one of the domains in this list causes a
31908 DNS lookup error, Exim behaves as if no SRV records were found. See section
31909 <xref linkend="SECTprowitdnsloo"/> for more discussion.
31910 </para>
31911 <para>
31912 <indexterm role="option">
31913 <primary><option>widen_domains</option></primary>
31914 </indexterm>
31915 </para>
31916 <informaltable frame="all">
31917 <tgroup cols="4" colsep="0" rowsep="0">
31918 <colspec colwidth="8*" align="left"/>
31919 <colspec colwidth="6*" align="center"/>
31920 <colspec colwidth="6*" align="center"/>
31921 <colspec colwidth="6*" align="right"/>
31922 <tbody>
31923 <row>
31924 <entry><option>widen_domains</option></entry>
31925 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31926 <entry>Type: <emphasis>string list</emphasis></entry>
31927 <entry>Default: <emphasis>unset</emphasis></entry>
31928 </row>
31929 </tbody>
31930 </tgroup>
31931 </informaltable>
31932 <para>
31933 <indexterm role="concept">
31934 <primary>domain</primary>
31935 <secondary>partial; widening</secondary>
31936 </indexterm>
31937 If a DNS lookup fails and this option is set, each of its strings in turn is
31938 added onto the end of the domain, and the lookup is tried again. For example,
31939 if
31940 </para>
31941 <literallayout class="monospaced">
31942 widen_domains = fict.example:ref.example
31943 </literallayout>
31944 <para>
31945 is set and a lookup of <emphasis>klingon.dictionary</emphasis> fails,
31946 <emphasis>klingon.dictionary.fict.example</emphasis> is looked up, and if this fails,
31947 <emphasis>klingon.dictionary.ref.example</emphasis> is tried. Note that the <option>qualify_single</option>
31948 and <option>search_parents</option> options can cause some widening to be undertaken inside
31949 the DNS resolver. <option>widen_domains</option> is not applied to sender addresses
31950 when verifying, unless <option>rewrite_headers</option> is false (not the default).
31951 </para>
31952 </section>
31953 <section id="SECID119">
31954 <title>Effect of qualify_single and search_parents</title>
31955 <para>
31956 When a domain from an envelope recipient is changed by the resolver as a result
31957 of the <option>qualify_single</option> or <option>search_parents</option> options, Exim rewrites the
31958 corresponding address in the message&#x2019;s header lines unless <option>rewrite_headers</option>
31959 is set false. Exim then re-routes the address, using the full domain.
31960 </para>
31961 <para>
31962 These two options affect only the DNS lookup that takes place inside the router
31963 for the domain of the address that is being routed. They do not affect lookups
31964 such as that implied by
31965 </para>
31966 <literallayout class="monospaced">
31967 domains = @mx_any
31968 </literallayout>
31969 <para>
31970 that may happen while processing a router precondition before the router is
31971 entered. No widening ever takes place for these lookups.
31972 <indexterm role="concept" startref="IIDdnsrou1" class="endofrange"/>
31973 <indexterm role="concept" startref="IIDdnsrou2" class="endofrange"/>
31974 </para>
31975 </section>
31976 </chapter>
31977
31978 <chapter id="CHID5">
31979 <title>The ipliteral router</title>
31980 <para>
31981 <indexterm role="concept">
31982 <primary><command>ipliteral</command> router</primary>
31983 </indexterm>
31984 <indexterm role="concept">
31985 <primary>domain literal</primary>
31986 <secondary>routing</secondary>
31987 </indexterm>
31988 <indexterm role="concept">
31989 <primary>routers</primary>
31990 <secondary><command>ipliteral</command></secondary>
31991 </indexterm>
31992 This router has no private options. Unless it is being used purely for
31993 verification (see <option>verify_only</option>) a transport is required to be defined by the
31994 generic <option>transport</option> option. The router accepts the address if its domain part
31995 takes the form of an RFC 2822 domain literal. For example, the <command>ipliteral</command>
31996 router handles the address
31997 </para>
31998 <literallayout class="monospaced">
31999 root@[192.168.1.1]
32000 </literallayout>
32001 <para>
32002 by setting up delivery to the host with that IP address. IPv4 domain literals
32003 consist of an IPv4 address enclosed in square brackets. IPv6 domain literals
32004 are similar, but the address is preceded by <literal>ipv6:</literal>. For example:
32005 </para>
32006 <literallayout class="monospaced">
32007 postmaster@[ipv6:fe80::a00:20ff:fe86:a061.5678]
32008 </literallayout>
32009 <para>
32010 Exim allows <literal>ipv4:</literal> before IPv4 addresses, for consistency, and on the
32011 grounds that sooner or later somebody will try it.
32012 </para>
32013 <para>
32014 <indexterm role="option">
32015 <primary><option>self</option></primary>
32016 <secondary>in <command>ipliteral</command> router</secondary>
32017 </indexterm>
32018 If the IP address matches something in <option>ignore_target_hosts</option>, the router
32019 declines. If an IP literal turns out to refer to the local host, the generic
32020 <option>self</option> option determines what happens.
32021 </para>
32022 <para>
32023 The RFCs require support for domain literals; however, their use is
32024 controversial in today&#x2019;s Internet. If you want to use this router, you must
32025 also set the main configuration option <option>allow_domain_literals</option>. Otherwise,
32026 Exim will not recognize the domain literal syntax in addresses.
32027 </para>
32028 </chapter>
32029
32030 <chapter id="CHID6">
32031 <title>The iplookup router</title>
32032 <para>
32033 <indexterm role="concept">
32034 <primary><command>iplookup</command> router</primary>
32035 </indexterm>
32036 <indexterm role="concept">
32037 <primary>routers</primary>
32038 <secondary><command>iplookup</command></secondary>
32039 </indexterm>
32040 The <command>iplookup</command> router was written to fulfil a specific requirement in
32041 Cambridge University (which in fact no longer exists). For this reason, it is
32042 not included in the binary of Exim by default. If you want to include it, you
32043 must set
32044 </para>
32045 <literallayout class="monospaced">
32046 ROUTER_IPLOOKUP=yes
32047 </literallayout>
32048 <para>
32049 in your <filename>Local/Makefile</filename> configuration file.
32050 </para>
32051 <para>
32052 The <command>iplookup</command> router routes an address by sending it over a TCP or UDP
32053 connection to one or more specific hosts. The host can then return the same or
32054 a different address &ndash; in effect rewriting the recipient address in the
32055 message&#x2019;s envelope. The new address is then passed on to subsequent routers. If
32056 this process fails, the address can be passed on to other routers, or delivery
32057 can be deferred. Since <command>iplookup</command> is just a rewriting router, a transport
32058 must not be specified for it.
32059 </para>
32060 <para>
32061 <indexterm role="concept">
32062 <primary>options</primary>
32063 <secondary><command>iplookup</command> router</secondary>
32064 </indexterm>
32065 <indexterm role="option">
32066 <primary><option>hosts</option></primary>
32067 </indexterm>
32068 </para>
32069 <informaltable frame="all">
32070 <tgroup cols="4" colsep="0" rowsep="0">
32071 <colspec colwidth="8*" align="left"/>
32072 <colspec colwidth="6*" align="center"/>
32073 <colspec colwidth="6*" align="center"/>
32074 <colspec colwidth="6*" align="right"/>
32075 <tbody>
32076 <row>
32077 <entry><option>hosts</option></entry>
32078 <entry>Use: <emphasis>iplookup</emphasis></entry>
32079 <entry>Type: <emphasis>string</emphasis></entry>
32080 <entry>Default: <emphasis>unset</emphasis></entry>
32081 </row>
32082 </tbody>
32083 </tgroup>
32084 </informaltable>
32085 <para>
32086 This option must be supplied. Its value is a colon-separated list of host
32087 names. The hosts are looked up using <function>gethostbyname()</function>
32088 (or <function>getipnodebyname()</function> when available)
32089 and are tried in order until one responds to the query. If none respond, what
32090 happens is controlled by <option>optional</option>.
32091 </para>
32092 <para>
32093 <indexterm role="option">
32094 <primary><option>optional</option></primary>
32095 </indexterm>
32096 </para>
32097 <informaltable frame="all">
32098 <tgroup cols="4" colsep="0" rowsep="0">
32099 <colspec colwidth="8*" align="left"/>
32100 <colspec colwidth="6*" align="center"/>
32101 <colspec colwidth="6*" align="center"/>
32102 <colspec colwidth="6*" align="right"/>
32103 <tbody>
32104 <row>
32105 <entry><option>optional</option></entry>
32106 <entry>Use: <emphasis>iplookup</emphasis></entry>
32107 <entry>Type: <emphasis>boolean</emphasis></entry>
32108 <entry>Default: <emphasis>false</emphasis></entry>
32109 </row>
32110 </tbody>
32111 </tgroup>
32112 </informaltable>
32113 <para>
32114 If <option>optional</option> is true, if no response is obtained from any host, the address
32115 is passed to the next router, overriding <option>no_more</option>. If <option>optional</option> is false,
32116 delivery to the address is deferred.
32117 </para>
32118 <para>
32119 <indexterm role="option">
32120 <primary><option>port</option></primary>
32121 </indexterm>
32122 </para>
32123 <informaltable frame="all">
32124 <tgroup cols="4" colsep="0" rowsep="0">
32125 <colspec colwidth="8*" align="left"/>
32126 <colspec colwidth="6*" align="center"/>
32127 <colspec colwidth="6*" align="center"/>
32128 <colspec colwidth="6*" align="right"/>
32129 <tbody>
32130 <row>
32131 <entry><option>port</option></entry>
32132 <entry>Use: <emphasis>iplookup</emphasis></entry>
32133 <entry>Type: <emphasis>integer</emphasis></entry>
32134 <entry>Default: <emphasis>0</emphasis></entry>
32135 </row>
32136 </tbody>
32137 </tgroup>
32138 </informaltable>
32139 <para>
32140 <indexterm role="concept">
32141 <primary>port</primary>
32142 <secondary><command>iplookup</command> router</secondary>
32143 </indexterm>
32144 This option must be supplied. It specifies the port number for the TCP or UDP
32145 call.
32146 </para>
32147 <para>
32148 <indexterm role="option">
32149 <primary><option>protocol</option></primary>
32150 </indexterm>
32151 </para>
32152 <informaltable frame="all">
32153 <tgroup cols="4" colsep="0" rowsep="0">
32154 <colspec colwidth="8*" align="left"/>
32155 <colspec colwidth="6*" align="center"/>
32156 <colspec colwidth="6*" align="center"/>
32157 <colspec colwidth="6*" align="right"/>
32158 <tbody>
32159 <row>
32160 <entry><option>protocol</option></entry>
32161 <entry>Use: <emphasis>iplookup</emphasis></entry>
32162 <entry>Type: <emphasis>string</emphasis></entry>
32163 <entry>Default: <emphasis>udp</emphasis></entry>
32164 </row>
32165 </tbody>
32166 </tgroup>
32167 </informaltable>
32168 <para>
32169 This option can be set to <quote>udp</quote> or <quote>tcp</quote> to specify which of the two
32170 protocols is to be used.
32171 </para>
32172 <para>
32173 <indexterm role="option">
32174 <primary><option>query</option></primary>
32175 </indexterm>
32176 </para>
32177 <informaltable frame="all">
32178 <tgroup cols="4" colsep="0" rowsep="0">
32179 <colspec colwidth="8*" align="left"/>
32180 <colspec colwidth="6*" align="center"/>
32181 <colspec colwidth="6*" align="center"/>
32182 <colspec colwidth="6*" align="right"/>
32183 <tbody>
32184 <row>
32185 <entry><option>query</option></entry>
32186 <entry>Use: <emphasis>iplookup</emphasis></entry>
32187 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32188 <entry>Default: <emphasis>see below</emphasis></entry>
32189 </row>
32190 </tbody>
32191 </tgroup>
32192 </informaltable>
32193 <para>
32194 This defines the content of the query that is sent to the remote hosts. The
32195 default value is:
32196 </para>
32197 <literallayout class="monospaced">
32198 $local_part@$domain $local_part@$domain
32199 </literallayout>
32200 <para>
32201 The repetition serves as a way of checking that a response is to the correct
32202 query in the default case (see <option>response_pattern</option> below).
32203 </para>
32204 <para>
32205 <indexterm role="option">
32206 <primary><option>reroute</option></primary>
32207 </indexterm>
32208 </para>
32209 <informaltable frame="all">
32210 <tgroup cols="4" colsep="0" rowsep="0">
32211 <colspec colwidth="8*" align="left"/>
32212 <colspec colwidth="6*" align="center"/>
32213 <colspec colwidth="6*" align="center"/>
32214 <colspec colwidth="6*" align="right"/>
32215 <tbody>
32216 <row>
32217 <entry><option>reroute</option></entry>
32218 <entry>Use: <emphasis>iplookup</emphasis></entry>
32219 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32220 <entry>Default: <emphasis>unset</emphasis></entry>
32221 </row>
32222 </tbody>
32223 </tgroup>
32224 </informaltable>
32225 <para>
32226 If this option is not set, the rerouted address is precisely the byte string
32227 returned by the remote host, up to the first white space, if any. If set, the
32228 string is expanded to form the rerouted address. It can include parts matched
32229 in the response by <option>response_pattern</option> by means of numeric variables such as
32230 <varname>$1</varname>, <varname>$2</varname>, etc. The variable <varname>$0</varname> refers to the entire input string,
32231 whether or not a pattern is in use. In all cases, the rerouted address must end
32232 up in the form <emphasis>local_part@domain</emphasis>.
32233 </para>
32234 <para>
32235 <indexterm role="option">
32236 <primary><option>response_pattern</option></primary>
32237 </indexterm>
32238 </para>
32239 <informaltable frame="all">
32240 <tgroup cols="4" colsep="0" rowsep="0">
32241 <colspec colwidth="8*" align="left"/>
32242 <colspec colwidth="6*" align="center"/>
32243 <colspec colwidth="6*" align="center"/>
32244 <colspec colwidth="6*" align="right"/>
32245 <tbody>
32246 <row>
32247 <entry><option>response_pattern</option></entry>
32248 <entry>Use: <emphasis>iplookup</emphasis></entry>
32249 <entry>Type: <emphasis>string</emphasis></entry>
32250 <entry>Default: <emphasis>unset</emphasis></entry>
32251 </row>
32252 </tbody>
32253 </tgroup>
32254 </informaltable>
32255 <para>
32256 This option can be set to a regular expression that is applied to the string
32257 returned from the remote host. If the pattern does not match the response, the
32258 router declines. If <option>response_pattern</option> is not set, no checking of the
32259 response is done, unless the query was defaulted, in which case there is a
32260 check that the text returned after the first white space is the original
32261 address. This checks that the answer that has been received is in response to
32262 the correct question. For example, if the response is just a new domain, the
32263 following could be used:
32264 </para>
32265 <literallayout class="monospaced">
32266 response_pattern = ^([^@]+)$
32267 reroute = $local_part@$1
32268 </literallayout>
32269 <para>
32270 <indexterm role="option">
32271 <primary><option>timeout</option></primary>
32272 </indexterm>
32273 </para>
32274 <informaltable frame="all">
32275 <tgroup cols="4" colsep="0" rowsep="0">
32276 <colspec colwidth="8*" align="left"/>
32277 <colspec colwidth="6*" align="center"/>
32278 <colspec colwidth="6*" align="center"/>
32279 <colspec colwidth="6*" align="right"/>
32280 <tbody>
32281 <row>
32282 <entry><option>timeout</option></entry>
32283 <entry>Use: <emphasis>iplookup</emphasis></entry>
32284 <entry>Type: <emphasis>time</emphasis></entry>
32285 <entry>Default: <emphasis>5s</emphasis></entry>
32286 </row>
32287 </tbody>
32288 </tgroup>
32289 </informaltable>
32290 <para>
32291 This specifies the amount of time to wait for a response from the remote
32292 machine. The same timeout is used for the <function>connect()</function> function for a TCP
32293 call. It does not apply to UDP.
32294 </para>
32295 </chapter>
32296
32297 <chapter id="CHID7">
32298 <title>The manualroute router</title>
32299 <para>
32300 <indexterm role="concept" id="IIDmanrou1" class="startofrange">
32301 <primary><command>manualroute</command> router</primary>
32302 </indexterm>
32303 <indexterm role="concept" id="IIDmanrou2" class="startofrange">
32304 <primary>routers</primary>
32305 <secondary><command>manualroute</command></secondary>
32306 </indexterm>
32307 <indexterm role="concept">
32308 <primary>domain</primary>
32309 <secondary>manually routing</secondary>
32310 </indexterm>
32311 The <command>manualroute</command> router is so-called because it provides a way of manually
32312 routing an address according to its domain. It is mainly used when you want to
32313 route addresses to remote hosts according to your own rules, bypassing the
32314 normal DNS routing that looks up MX records. However, <command>manualroute</command> can also
32315 route to local transports, a facility that may be useful if you want to save
32316 messages for dial-in hosts in local files.
32317 </para>
32318 <para>
32319 The <command>manualroute</command> router compares a list of domain patterns with the domain
32320 it is trying to route. If there is no match, the router declines. Each pattern
32321 has associated with it a list of hosts and some other optional data, which may
32322 include a transport. The combination of a pattern and its data is called a
32323 <quote>routing rule</quote>. For patterns that do not have an associated transport, the
32324 generic <option>transport</option> option must specify a transport, unless the router is
32325 being used purely for verification (see <option>verify_only</option>).
32326 </para>
32327 <para>
32328 <indexterm role="variable">
32329 <primary><varname>$host</varname></primary>
32330 </indexterm>
32331 In the case of verification, matching the domain pattern is sufficient for the
32332 router to accept the address. When actually routing an address for delivery,
32333 an address that matches a domain pattern is queued for the associated
32334 transport. If the transport is not a local one, a host list must be associated
32335 with the pattern; IP addresses are looked up for the hosts, and these are
32336 passed to the transport along with the mail address. For local transports, a
32337 host list is optional. If it is present, it is passed in <varname>$host</varname> as a single
32338 text string.
32339 </para>
32340 <para>
32341 The list of routing rules can be provided as an inline string in
32342 <option>route_list</option>, or the data can be obtained by looking up the domain in a file
32343 or database by setting <option>route_data</option>. Only one of these settings may appear in
32344 any one instance of <command>manualroute</command>. The format of routing rules is described
32345 below, following the list of private options.
32346 </para>
32347 <section id="SECTprioptman">
32348 <title>Private options for manualroute</title>
32349 <para>
32350 <indexterm role="concept">
32351 <primary>options</primary>
32352 <secondary><command>manualroute</command> router</secondary>
32353 </indexterm>
32354 The private options for the <command>manualroute</command> router are as follows:
32355 </para>
32356 <para>
32357 <indexterm role="option">
32358 <primary><option>host_all_ignored</option></primary>
32359 </indexterm>
32360 </para>
32361 <informaltable frame="all">
32362 <tgroup cols="4" colsep="0" rowsep="0">
32363 <colspec colwidth="8*" align="left"/>
32364 <colspec colwidth="6*" align="center"/>
32365 <colspec colwidth="6*" align="center"/>
32366 <colspec colwidth="6*" align="right"/>
32367 <tbody>
32368 <row>
32369 <entry><option>host_all_ignored</option></entry>
32370 <entry>Use: <emphasis>manualroute</emphasis></entry>
32371 <entry>Type: <emphasis>string</emphasis></entry>
32372 <entry>Default: <emphasis>defer</emphasis></entry>
32373 </row>
32374 </tbody>
32375 </tgroup>
32376 </informaltable>
32377 <para>
32378 See <option>host_find_failed</option>.
32379 </para>
32380 <para>
32381 <indexterm role="option">
32382 <primary><option>host_find_failed</option></primary>
32383 </indexterm>
32384 </para>
32385 <informaltable frame="all">
32386 <tgroup cols="4" colsep="0" rowsep="0">
32387 <colspec colwidth="8*" align="left"/>
32388 <colspec colwidth="6*" align="center"/>
32389 <colspec colwidth="6*" align="center"/>
32390 <colspec colwidth="6*" align="right"/>
32391 <tbody>
32392 <row>
32393 <entry><option>host_find_failed</option></entry>
32394 <entry>Use: <emphasis>manualroute</emphasis></entry>
32395 <entry>Type: <emphasis>string</emphasis></entry>
32396 <entry>Default: <emphasis>freeze</emphasis></entry>
32397 </row>
32398 </tbody>
32399 </tgroup>
32400 </informaltable>
32401 <para>
32402 This option controls what happens when <command>manualroute</command> tries to find an IP
32403 address for a host, and the host does not exist. The option can be set to one
32404 of the following values:
32405 </para>
32406 <literallayout class="monospaced">
32407 decline
32408 defer
32409 fail
32410 freeze
32411 ignore
32412 pass
32413 </literallayout>
32414 <para>
32415 The default (<quote>freeze</quote>) assumes that this state is a serious configuration
32416 error. The difference between <quote>pass</quote> and <quote>decline</quote> is that the former
32417 forces the address to be passed to the next router (or the router defined by
32418 <option>pass_router</option>),
32419 <indexterm role="option">
32420 <primary><option>more</option></primary>
32421 </indexterm>
32422 overriding <option>no_more</option>, whereas the latter passes the address to the next
32423 router only if <option>more</option> is true.
32424 </para>
32425 <para>
32426 The value <quote>ignore</quote> causes Exim to completely ignore a host whose IP address
32427 cannot be found. If all the hosts in the list are ignored, the behaviour is
32428 controlled by the <option>host_all_ignored</option> option. This takes the same values
32429 as <option>host_find_failed</option>, except that it cannot be set to <quote>ignore</quote>.
32430 </para>
32431 <para>
32432 The <option>host_find_failed</option> option applies only to a definite <quote>does not exist</quote>
32433 state; if a host lookup gets a temporary error, delivery is deferred unless the
32434 generic <option>pass_on_timeout</option> option is set.
32435 </para>
32436 <para>
32437 <indexterm role="option">
32438 <primary><option>hosts_randomize</option></primary>
32439 </indexterm>
32440 </para>
32441 <informaltable frame="all">
32442 <tgroup cols="4" colsep="0" rowsep="0">
32443 <colspec colwidth="8*" align="left"/>
32444 <colspec colwidth="6*" align="center"/>
32445 <colspec colwidth="6*" align="center"/>
32446 <colspec colwidth="6*" align="right"/>
32447 <tbody>
32448 <row>
32449 <entry><option>hosts_randomize</option></entry>
32450 <entry>Use: <emphasis>manualroute</emphasis></entry>
32451 <entry>Type: <emphasis>boolean</emphasis></entry>
32452 <entry>Default: <emphasis>false</emphasis></entry>
32453 </row>
32454 </tbody>
32455 </tgroup>
32456 </informaltable>
32457 <para>
32458 <indexterm role="concept">
32459 <primary>randomized host list</primary>
32460 </indexterm>
32461 <indexterm role="concept">
32462 <primary>host</primary>
32463 <secondary>list of; randomized</secondary>
32464 </indexterm>
32465 If this option is set, the order of the items in a host list in a routing rule
32466 is randomized each time the list is used, unless an option in the routing rule
32467 overrides (see below). Randomizing the order of a host list can be used to do
32468 crude load sharing. However, if more than one mail address is routed by the
32469 same router to the same host list, the host lists are considered to be the same
32470 (even though they may be randomized into different orders) for the purpose of
32471 deciding whether to batch the deliveries into a single SMTP transaction.
32472 </para>
32473 <para>
32474 When <option>hosts_randomize</option> is true, a host list may be split
32475 into groups whose order is separately randomized. This makes it possible to
32476 set up MX-like behaviour. The boundaries between groups are indicated by an
32477 item that is just <literal>+</literal> in the host list. For example:
32478 </para>
32479 <literallayout class="monospaced">
32480 route_list = * host1:host2:host3:+:host4:host5
32481 </literallayout>
32482 <para>
32483 The order of the first three hosts and the order of the last two hosts is
32484 randomized for each use, but the first three always end up before the last two.
32485 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored. If a
32486 randomized host list is passed to an <command>smtp</command> transport that also has
32487 <option>hosts_randomize set</option>, the list is not re-randomized.
32488 </para>
32489 <para>
32490 <indexterm role="option">
32491 <primary><option>route_data</option></primary>
32492 </indexterm>
32493 </para>
32494 <informaltable frame="all">
32495 <tgroup cols="4" colsep="0" rowsep="0">
32496 <colspec colwidth="8*" align="left"/>
32497 <colspec colwidth="6*" align="center"/>
32498 <colspec colwidth="6*" align="center"/>
32499 <colspec colwidth="6*" align="right"/>
32500 <tbody>
32501 <row>
32502 <entry><option>route_data</option></entry>
32503 <entry>Use: <emphasis>manualroute</emphasis></entry>
32504 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32505 <entry>Default: <emphasis>unset</emphasis></entry>
32506 </row>
32507 </tbody>
32508 </tgroup>
32509 </informaltable>
32510 <para>
32511 If this option is set, it must expand to yield the data part of a routing rule.
32512 Typically, the expansion string includes a lookup based on the domain. For
32513 example:
32514 </para>
32515 <literallayout class="monospaced">
32516 route_data = ${lookup{$domain}dbm{/etc/routes}}
32517 </literallayout>
32518 <para>
32519 If the expansion is forced to fail, or the result is an empty string, the
32520 router declines. Other kinds of expansion failure cause delivery to be
32521 deferred.
32522 </para>
32523 <para>
32524 <indexterm role="option">
32525 <primary><option>route_list</option></primary>
32526 </indexterm>
32527 </para>
32528 <informaltable frame="all">
32529 <tgroup cols="4" colsep="0" rowsep="0">
32530 <colspec colwidth="8*" align="left"/>
32531 <colspec colwidth="6*" align="center"/>
32532 <colspec colwidth="6*" align="center"/>
32533 <colspec colwidth="6*" align="right"/>
32534 <tbody>
32535 <row>
32536 <entry><option>route_list</option></entry>
32537 <entry>Use: <emphasis>manualroute</emphasis></entry>
32538 <entry>Type: <emphasis>string list</emphasis></entry>
32539 <entry>Default: <emphasis>unset</emphasis></entry>
32540 </row>
32541 </tbody>
32542 </tgroup>
32543 </informaltable>
32544 <para>
32545 This string is a list of routing rules, in the form defined below. Note that,
32546 unlike most string lists, the items are separated by semicolons. This is so
32547 that they may contain colon-separated host lists.
32548 </para>
32549 <para>
32550 <indexterm role="option">
32551 <primary><option>same_domain_copy_routing</option></primary>
32552 </indexterm>
32553 </para>
32554 <informaltable frame="all">
32555 <tgroup cols="4" colsep="0" rowsep="0">
32556 <colspec colwidth="8*" align="left"/>
32557 <colspec colwidth="6*" align="center"/>
32558 <colspec colwidth="6*" align="center"/>
32559 <colspec colwidth="6*" align="right"/>
32560 <tbody>
32561 <row>
32562 <entry><option>same_domain_copy_routing</option></entry>
32563 <entry>Use: <emphasis>manualroute</emphasis></entry>
32564 <entry>Type: <emphasis>boolean</emphasis></entry>
32565 <entry>Default: <emphasis>false</emphasis></entry>
32566 </row>
32567 </tbody>
32568 </tgroup>
32569 </informaltable>
32570 <para>
32571 <indexterm role="concept">
32572 <primary>address</primary>
32573 <secondary>copying routing</secondary>
32574 </indexterm>
32575 Addresses with the same domain are normally routed by the <command>manualroute</command>
32576 router to the same list of hosts. However, this cannot be presumed, because the
32577 router options and preconditions may refer to the local part of the address. By
32578 default, therefore, Exim routes each address in a message independently. DNS
32579 servers run caches, so repeated DNS lookups are not normally expensive, and in
32580 any case, personal messages rarely have more than a few recipients.
32581 </para>
32582 <para>
32583 If you are running mailing lists with large numbers of subscribers at the same
32584 domain, and you are using a <command>manualroute</command> router which is independent of the
32585 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
32586 lookups for identical domains in one message. In this case, when
32587 <command>manualroute</command> routes an address to a remote transport, any other unrouted
32588 addresses in the message that have the same domain are automatically given the
32589 same routing without processing them independently. However, this is only done
32590 if <option>headers_add</option> and <option>headers_remove</option> are unset.
32591 </para>
32592 </section>
32593 <section id="SECID120">
32594 <title>Routing rules in route_list</title>
32595 <para>
32596 The value of <option>route_list</option> is a string consisting of a sequence of routing
32597 rules, separated by semicolons. If a semicolon is needed in a rule, it can be
32598 entered as two semicolons. Alternatively, the list separator can be changed as
32599 described (for colon-separated lists) in section <xref linkend="SECTlistconstruct"/>.
32600 Empty rules are ignored. The format of each rule is
32601 </para>
32602 <literallayout>
32603 &lt;<emphasis>domain pattern</emphasis>&gt;  &lt;<emphasis>list of hosts</emphasis>&gt;  &lt;<emphasis>options</emphasis>&gt;
32604 </literallayout>
32605 <para>
32606 The following example contains two rules, each with a simple domain pattern and
32607 no options:
32608 </para>
32609 <literallayout class="monospaced">
32610 route_list = \
32611   dict.ref.example  mail-1.ref.example:mail-2.ref.example ; \
32612   thes.ref.example  mail-3.ref.example:mail-4.ref.example
32613 </literallayout>
32614 <para>
32615 The three parts of a rule are separated by white space. The pattern and the
32616 list of hosts can be enclosed in quotes if necessary, and if they are, the
32617 usual quoting rules apply. Each rule in a <option>route_list</option> must start with a
32618 single domain pattern, which is the only mandatory item in the rule. The
32619 pattern is in the same format as one item in a domain list (see section
32620 <xref linkend="SECTdomainlist"/>),
32621 except that it may not be the name of an interpolated file.
32622 That is, it may be wildcarded, or a regular expression, or a file or database
32623 lookup (with semicolons doubled, because of the use of semicolon as a separator
32624 in a <option>route_list</option>).
32625 </para>
32626 <para>
32627 The rules in <option>route_list</option> are searched in order until one of the patterns
32628 matches the domain that is being routed. The list of hosts and then options are
32629 then used as described below. If there is no match, the router declines. When
32630 <option>route_list</option> is set, <option>route_data</option> must not be set.
32631 </para>
32632 </section>
32633 <section id="SECID121">
32634 <title>Routing rules in route_data</title>
32635 <para>
32636 The use of <option>route_list</option> is convenient when there are only a small number of
32637 routing rules. For larger numbers, it is easier to use a file or database to
32638 hold the routing information, and use the <option>route_data</option> option instead.
32639 The value of <option>route_data</option> is a list of hosts, followed by (optional) options.
32640 Most commonly, <option>route_data</option> is set as a string that contains an
32641 expansion lookup. For example, suppose we place two routing rules in a file
32642 like this:
32643 </para>
32644 <literallayout class="monospaced">
32645 dict.ref.example:  mail-1.ref.example:mail-2.ref.example
32646 thes.ref.example:  mail-3.ref.example:mail-4.ref.example
32647 </literallayout>
32648 <para>
32649 This data can be accessed by setting
32650 </para>
32651 <literallayout class="monospaced">
32652 route_data = ${lookup{$domain}lsearch{/the/file/name}}
32653 </literallayout>
32654 <para>
32655 Failure of the lookup results in an empty string, causing the router to
32656 decline. However, you do not have to use a lookup in <option>route_data</option>. The only
32657 requirement is that the result of expanding the string is a list of hosts,
32658 possibly followed by options, separated by white space. The list of hosts must
32659 be enclosed in quotes if it contains white space.
32660 </para>
32661 </section>
32662 <section id="SECID122">
32663 <title>Format of the list of hosts</title>
32664 <para>
32665 A list of hosts, whether obtained via <option>route_data</option> or <option>route_list</option>, is
32666 always separately expanded before use. If the expansion fails, the router
32667 declines. The result of the expansion must be a colon-separated list of names
32668 and/or IP addresses, optionally also including ports. The format of each item
32669 in the list is described in the next section. The list separator can be changed
32670 as described in section <xref linkend="SECTlistconstruct"/>.
32671 </para>
32672 <para>
32673 If the list of hosts was obtained from a <option>route_list</option> item, the following
32674 variables are set during its expansion:
32675 </para>
32676 <itemizedlist>
32677 <listitem>
32678 <para>
32679 <indexterm role="concept">
32680 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname>  etc)</primary>
32681 <secondary>in <command>manualroute</command> router</secondary>
32682 </indexterm>
32683 If the domain was matched against a regular expression, the numeric variables
32684 <varname>$1</varname>, <varname>$2</varname>, etc. may be set. For example:
32685 </para>
32686 <literallayout class="monospaced">
32687 route_list = ^domain(\d+)   host-$1.text.example
32688 </literallayout>
32689 </listitem>
32690 <listitem>
32691 <para>
32692 <varname>$0</varname> is always set to the entire domain.
32693 </para>
32694 </listitem>
32695 <listitem>
32696 <para>
32697 <varname>$1</varname> is also set when partial matching is done in a file lookup.
32698 </para>
32699 </listitem>
32700 <listitem>
32701 <para>
32702 <indexterm role="variable">
32703 <primary><varname>$value</varname></primary>
32704 </indexterm>
32705 If the pattern that matched the domain was a lookup item, the data that was
32706 looked up is available in the expansion variable <varname>$value</varname>. For example:
32707 </para>
32708 <literallayout class="monospaced">
32709 route_list = lsearch;;/some/file.routes  $value
32710 </literallayout>
32711 </listitem>
32712 </itemizedlist>
32713 <para>
32714 Note the doubling of the semicolon in the pattern that is necessary because
32715 semicolon is the default route list separator.
32716 </para>
32717 </section>
32718 <section id="SECTformatonehostitem">
32719 <title>Format of one host item</title>
32720 <para>
32721 Each item in the list of hosts is either a host name or an IP address,
32722 optionally with an attached port number. When no port is given, an IP address
32723 is not enclosed in brackets. When a port is specified, it overrides the port
32724 specification on the transport. The port is separated from the name or address
32725 by a colon. This leads to some complications:
32726 </para>
32727 <itemizedlist>
32728 <listitem>
32729 <para>
32730 Because colon is the default separator for the list of hosts, either
32731 the colon that specifies a port must be doubled, or the list separator must
32732 be changed. The following two examples have the same effect:
32733 </para>
32734 <literallayout class="monospaced">
32735 route_list = * "host1.tld::1225 : host2.tld::1226"
32736 route_list = * "&lt;+ host1.tld:1225 + host2.tld:1226"
32737 </literallayout>
32738 </listitem>
32739 <listitem>
32740 <para>
32741 When IPv6 addresses are involved, it gets worse, because they contain
32742 colons of their own. To make this case easier, it is permitted to
32743 enclose an IP address (either v4 or v6) in square brackets if a port
32744 number follows. For example:
32745 </para>
32746 <literallayout class="monospaced">
32747 route_list = * "&lt;/ [10.1.1.1]:1225 / [::1]:1226"
32748 </literallayout>
32749 </listitem>
32750 </itemizedlist>
32751 </section>
32752 <section id="SECThostshowused">
32753 <title>How the list of hosts is used</title>
32754 <para>
32755 When an address is routed to an <command>smtp</command> transport by <command>manualroute</command>, each of
32756 the hosts is tried, in the order specified, when carrying out the SMTP
32757 delivery. However, the order can be changed by setting the <option>hosts_randomize</option>
32758 option, either on the router (see section <xref linkend="SECTprioptman"/> above), or on the
32759 transport.
32760 </para>
32761 <para>
32762 Hosts may be listed by name or by IP address. An unadorned name in the list of
32763 hosts is interpreted as a host name. A name that is followed by <literal>/MX</literal> is
32764 interpreted as an indirection to a sublist of hosts obtained by looking up MX
32765 records in the DNS. For example:
32766 </para>
32767 <literallayout class="monospaced">
32768 route_list = *  x.y.z:p.q.r/MX:e.f.g
32769 </literallayout>
32770 <para>
32771 If this feature is used with a port specifier, the port must come last. For
32772 example:
32773 </para>
32774 <literallayout class="monospaced">
32775 route_list = *  dom1.tld/mx::1225
32776 </literallayout>
32777 <para>
32778 If the <option>hosts_randomize</option> option is set, the order of the items in the list is
32779 randomized before any lookups are done. Exim then scans the list; for any name
32780 that is not followed by <literal>/MX</literal> it looks up an IP address. If this turns out to
32781 be an interface on the local host and the item is not the first in the list,
32782 Exim discards it and any subsequent items. If it is the first item, what
32783 happens is controlled by the
32784 <indexterm role="option">
32785 <primary><option>self</option></primary>
32786 <secondary>in <command>manualroute</command> router</secondary>
32787 </indexterm>
32788 <option>self</option> option of the router.
32789 </para>
32790 <para>
32791 A name on the list that is followed by <literal>/MX</literal> is replaced with the list of
32792 hosts obtained by looking up MX records for the name. This is always a DNS
32793 lookup; the <option>bydns</option> and <option>byname</option> options (see section <xref linkend="SECThowoptused"/>
32794 below) are not relevant here. The order of these hosts is determined by the
32795 preference values in the MX records, according to the usual rules. Because
32796 randomizing happens before the MX lookup, it does not affect the order that is
32797 defined by MX preferences.
32798 </para>
32799 <para>
32800 If the local host is present in the sublist obtained from MX records, but is
32801 not the most preferred host in that list, it and any equally or less
32802 preferred hosts are removed before the sublist is inserted into the main list.
32803 </para>
32804 <para>
32805 If the local host is the most preferred host in the MX list, what happens
32806 depends on where in the original list of hosts the <literal>/MX</literal> item appears. If it
32807 is not the first item (that is, there are previous hosts in the main list),
32808 Exim discards this name and any subsequent items in the main list.
32809 </para>
32810 <para>
32811 If the MX item is first in the list of hosts, and the local host is the
32812 most preferred host, what happens is controlled by the <option>self</option> option of the
32813 router.
32814 </para>
32815 <para>
32816 DNS failures when lookup up the MX records are treated in the same way as DNS
32817 failures when looking up IP addresses: <option>pass_on_timeout</option> and
32818 <option>host_find_failed</option> are used when relevant.
32819 </para>
32820 <para>
32821 The generic <option>ignore_target_hosts</option> option applies to all hosts in the list,
32822 whether obtained from an MX lookup or not.
32823 </para>
32824 </section>
32825 <section id="SECThowoptused">
32826 <title>How the options are used</title>
32827 <para>
32828 The options are a sequence of words; in practice no more than three are ever
32829 present. One of the words can be the name of a transport; this overrides the
32830 <option>transport</option> option on the router for this particular routing rule only. The
32831 other words (if present) control randomization of the list of hosts on a
32832 per-rule basis, and how the IP addresses of the hosts are to be found when
32833 routing to a remote transport. These options are as follows:
32834 </para>
32835 <itemizedlist>
32836 <listitem>
32837 <para>
32838 <option>randomize</option>: randomize the order of the hosts in this list, overriding the
32839 setting of <option>hosts_randomize</option> for this routing rule only.
32840 </para>
32841 </listitem>
32842 <listitem>
32843 <para>
32844 <option>no_randomize</option>: do not randomize the order of the hosts in this list,
32845 overriding the setting of <option>hosts_randomize</option> for this routing rule only.
32846 </para>
32847 </listitem>
32848 <listitem>
32849 <para>
32850 <option>byname</option>: use <function>getipnodebyname()</function> (<function>gethostbyname()</function> on older systems) to
32851 find IP addresses. This function may ultimately cause a DNS lookup, but it may
32852 also look in <filename>/etc/hosts</filename> or other sources of information.
32853 </para>
32854 </listitem>
32855 <listitem>
32856 <para>
32857 <option>bydns</option>: look up address records for the hosts directly in the DNS; fail if
32858 no address records are found. If there is a temporary DNS error (such as a
32859 timeout), delivery is deferred.
32860 </para>
32861 </listitem>
32862 </itemizedlist>
32863 <para>
32864 For example:
32865 </para>
32866 <literallayout class="monospaced">
32867 route_list = domain1  host1:host2:host3  randomize bydns;\
32868              domain2  host4:host5
32869 </literallayout>
32870 <para>
32871 If neither <option>byname</option> nor <option>bydns</option> is given, Exim behaves as follows: First, a
32872 DNS lookup is done. If this yields anything other than HOST_NOT_FOUND, that
32873 result is used. Otherwise, Exim goes on to try a call to <function>getipnodebyname()</function>
32874 or <function>gethostbyname()</function>, and the result of the lookup is the result of that
32875 call.
32876 </para>
32877 <para>
32878 <emphasis role="bold">Warning</emphasis>: It has been discovered that on some systems, if a DNS lookup
32879 called via <function>getipnodebyname()</function> times out, HOST_NOT_FOUND is returned
32880 instead of TRY_AGAIN. That is why the default action is to try a DNS
32881 lookup first. Only if that gives a definite <quote>no such host</quote> is the local
32882 function called.
32883 </para>
32884 <para>
32885 If no IP address for a host can be found, what happens is controlled by the
32886 <option>host_find_failed</option> option.
32887 </para>
32888 <para>
32889 <indexterm role="variable">
32890 <primary><varname>$host</varname></primary>
32891 </indexterm>
32892 When an address is routed to a local transport, IP addresses are not looked up.
32893 The host list is passed to the transport in the <varname>$host</varname> variable.
32894 </para>
32895 </section>
32896 <section id="SECID123">
32897 <title>Manualroute examples</title>
32898 <para>
32899 In some of the examples that follow, the presence of the <option>remote_smtp</option>
32900 transport, as defined in the default configuration file, is assumed:
32901 </para>
32902 <itemizedlist>
32903 <listitem>
32904 <para>
32905 <indexterm role="concept">
32906 <primary>smart host</primary>
32907 <secondary>example router</secondary>
32908 </indexterm>
32909 The <command>manualroute</command> router can be used to forward all external mail to a
32910 <emphasis>smart host</emphasis>. If you have set up, in the main part of the configuration, a
32911 named domain list that contains your local domains, for example:
32912 </para>
32913 <literallayout class="monospaced">
32914 domainlist local_domains = my.domain.example
32915 </literallayout>
32916 <para>
32917 You can arrange for all other domains to be routed to a smart host by making
32918 your first router something like this:
32919 </para>
32920 <literallayout class="monospaced">
32921 smart_route:
32922   driver = manualroute
32923   domains = !+local_domains
32924   transport = remote_smtp
32925   route_list = * smarthost.ref.example
32926 </literallayout>
32927 <para>
32928 This causes all non-local addresses to be sent to the single host
32929 <emphasis>smarthost.ref.example</emphasis>. If a colon-separated list of smart hosts is given,
32930 they are tried in order
32931 (but you can use <option>hosts_randomize</option> to vary the order each time).
32932 Another way of configuring the same thing is this:
32933 </para>
32934 <literallayout class="monospaced">
32935 smart_route:
32936   driver = manualroute
32937   transport = remote_smtp
32938   route_list = !+local_domains  smarthost.ref.example
32939 </literallayout>
32940 <para>
32941 There is no difference in behaviour between these two routers as they stand.
32942 However, they behave differently if <option>no_more</option> is added to them. In the first
32943 example, the router is skipped if the domain does not match the <option>domains</option>
32944 precondition; the following router is always tried. If the router runs, it
32945 always matches the domain and so can never decline. Therefore, <option>no_more</option>
32946 would have no effect. In the second case, the router is never skipped; it
32947 always runs. However, if it doesn&#x2019;t match the domain, it declines. In this case
32948 <option>no_more</option> would prevent subsequent routers from running.
32949 </para>
32950 </listitem>
32951 <listitem>
32952 <para>
32953 <indexterm role="concept">
32954 <primary>mail hub example</primary>
32955 </indexterm>
32956 A <emphasis>mail hub</emphasis> is a host which receives mail for a number of domains via MX
32957 records in the DNS and delivers it via its own private routing mechanism. Often
32958 the final destinations are behind a firewall, with the mail hub being the one
32959 machine that can connect to machines both inside and outside the firewall. The
32960 <command>manualroute</command> router is usually used on a mail hub to route incoming messages
32961 to the correct hosts. For a small number of domains, the routing can be inline,
32962 using the <option>route_list</option> option, but for a larger number a file or database
32963 lookup is easier to manage.
32964 </para>
32965 <para>
32966 If the domain names are in fact the names of the machines to which the mail is
32967 to be sent by the mail hub, the configuration can be quite simple. For
32968 example:
32969 </para>
32970 <literallayout class="monospaced">
32971 hub_route:
32972   driver = manualroute
32973   transport = remote_smtp
32974   route_list = *.rhodes.tvs.example  $domain
32975 </literallayout>
32976 <para>
32977 This configuration routes domains that match <literal>*.rhodes.tvs.example</literal> to hosts
32978 whose names are the same as the mail domains. A similar approach can be taken
32979 if the host name can be obtained from the domain name by a string manipulation
32980 that the expansion facilities can handle. Otherwise, a lookup based on the
32981 domain can be used to find the host:
32982 </para>
32983 <literallayout class="monospaced">
32984 through_firewall:
32985   driver = manualroute
32986   transport = remote_smtp
32987   route_data = ${lookup {$domain} cdb {/internal/host/routes}}
32988 </literallayout>
32989 <para>
32990 The result of the lookup must be the name or IP address of the host (or
32991 hosts) to which the address is to be routed. If the lookup fails, the route
32992 data is empty, causing the router to decline. The address then passes to the
32993 next router.
32994 </para>
32995 </listitem>
32996 <listitem>
32997 <para>
32998 <indexterm role="concept">
32999 <primary>batched SMTP output example</primary>
33000 </indexterm>
33001 <indexterm role="concept">
33002 <primary>SMTP</primary>
33003 <secondary>batched outgoing; example</secondary>
33004 </indexterm>
33005 You can use <command>manualroute</command> to deliver messages to pipes or files in batched
33006 SMTP format for onward transportation by some other means. This is one way of
33007 storing mail for a dial-up host when it is not connected. The route list entry
33008 can be as simple as a single domain name in a configuration like this:
33009 </para>
33010 <literallayout class="monospaced">
33011 save_in_file:
33012   driver = manualroute
33013   transport = batchsmtp_appendfile
33014   route_list = saved.domain.example
33015 </literallayout>
33016 <para>
33017 though often a pattern is used to pick up more than one domain. If there are
33018 several domains or groups of domains with different transport requirements,
33019 different transports can be listed in the routing information:
33020 </para>
33021 <literallayout class="monospaced">
33022 save_in_file:
33023   driver = manualroute
33024   route_list = \
33025     *.saved.domain1.example  $domain  batch_appendfile; \
33026     *.saved.domain2.example  \
33027       ${lookup{$domain}dbm{/domain2/hosts}{$value}fail} \
33028       batch_pipe
33029 </literallayout>
33030 <para>
33031 <indexterm role="variable">
33032 <primary><varname>$domain</varname></primary>
33033 </indexterm>
33034 <indexterm role="variable">
33035 <primary><varname>$host</varname></primary>
33036 </indexterm>
33037 The first of these just passes the domain in the <varname>$host</varname> variable, which
33038 doesn&#x2019;t achieve much (since it is also in <varname>$domain</varname>), but the second does a
33039 file lookup to find a value to pass, causing the router to decline to handle
33040 the address if the lookup fails.
33041 </para>
33042 </listitem>
33043 <listitem>
33044 <para>
33045 <indexterm role="concept">
33046 <primary>UUCP</primary>
33047 <secondary>example of router for</secondary>
33048 </indexterm>
33049 Routing mail directly to UUCP software is a specific case of the use of
33050 <command>manualroute</command> in a gateway to another mail environment. This is an example of
33051 one way it can be done:
33052 </para>
33053 <literallayout class="monospaced">
33054 # Transport
33055 uucp:
33056   driver = pipe
33057   user = nobody
33058   command = /usr/local/bin/uux -r - \
33059     ${substr_-5:$host}!rmail ${local_part}
33060   return_fail_output = true
33061
33062 # Router
33063 uucphost:
33064   transport = uucp
33065   driver = manualroute
33066   route_data = \
33067     ${lookup{$domain}lsearch{/usr/local/exim/uucphosts}}
33068 </literallayout>
33069 <para>
33070 The file <filename>/usr/local/exim/uucphosts</filename> contains entries like
33071 </para>
33072 <literallayout class="monospaced">
33073 darksite.ethereal.example:           darksite.UUCP
33074 </literallayout>
33075 <para>
33076 It can be set up more simply without adding and removing <quote>.UUCP</quote> but this way
33077 makes clear the distinction between the domain name
33078 <emphasis>darksite.ethereal.example</emphasis> and the UUCP host name <emphasis>darksite</emphasis>.
33079 </para>
33080 </listitem>
33081 </itemizedlist>
33082 <para>
33083 <indexterm role="concept" startref="IIDmanrou1" class="endofrange"/>
33084 <indexterm role="concept" startref="IIDmanrou2" class="endofrange"/>
33085 </para>
33086 </section>
33087 </chapter>
33088
33089 <chapter id="CHAPdriverlast">
33090 <title>The queryprogram router</title>
33091 <para>
33092 <indexterm role="concept" id="IIDquerou1" class="startofrange">
33093 <primary><command>queryprogram</command> router</primary>
33094 </indexterm>
33095 <indexterm role="concept" id="IIDquerou2" class="startofrange">
33096 <primary>routers</primary>
33097 <secondary><command>queryprogram</command></secondary>
33098 </indexterm>
33099 <indexterm role="concept">
33100 <primary>routing</primary>
33101 <secondary>by external program</secondary>
33102 </indexterm>
33103 The <command>queryprogram</command> router routes an address by running an external command
33104 and acting on its output. This is an expensive way to route, and is intended
33105 mainly for use in lightly-loaded systems, or for performing experiments.
33106 However, if it is possible to use the precondition options (<option>domains</option>,
33107 <option>local_parts</option>, etc) to skip this router for most addresses, it could sensibly
33108 be used in special cases, even on a busy host. There are the following private
33109 options:
33110 <indexterm role="concept">
33111 <primary>options</primary>
33112 <secondary><command>queryprogram</command> router</secondary>
33113 </indexterm>
33114 </para>
33115 <para>
33116 <indexterm role="option">
33117 <primary><option>command</option></primary>
33118 </indexterm>
33119 </para>
33120 <informaltable frame="all">
33121 <tgroup cols="4" colsep="0" rowsep="0">
33122 <colspec colwidth="8*" align="left"/>
33123 <colspec colwidth="6*" align="center"/>
33124 <colspec colwidth="6*" align="center"/>
33125 <colspec colwidth="6*" align="right"/>
33126 <tbody>
33127 <row>
33128 <entry><option>command</option></entry>
33129 <entry>Use: <emphasis>queryprogram</emphasis></entry>
33130 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33131 <entry>Default: <emphasis>unset</emphasis></entry>
33132 </row>
33133 </tbody>
33134 </tgroup>
33135 </informaltable>
33136 <para>
33137 This option must be set. It specifies the command that is to be run. The
33138 command is split up into a command name and arguments, and then each is
33139 expanded separately (exactly as for a <command>pipe</command> transport, described in chapter
33140 <xref linkend="CHAPpipetransport"/>).
33141 </para>
33142 <para>
33143 <indexterm role="option">
33144 <primary><option>command_group</option></primary>
33145 </indexterm>
33146 </para>
33147 <informaltable frame="all">
33148 <tgroup cols="4" colsep="0" rowsep="0">
33149 <colspec colwidth="8*" align="left"/>
33150 <colspec colwidth="6*" align="center"/>
33151 <colspec colwidth="6*" align="center"/>
33152 <colspec colwidth="6*" align="right"/>
33153 <tbody>
33154 <row>
33155 <entry><option>command_group</option></entry>
33156 <entry>Use: <emphasis>queryprogram</emphasis></entry>
33157 <entry>Type: <emphasis>string</emphasis></entry>
33158 <entry>Default: <emphasis>unset</emphasis></entry>
33159 </row>
33160 </tbody>
33161 </tgroup>
33162 </informaltable>
33163 <para>
33164 <indexterm role="concept">
33165 <primary>gid (group id)</primary>
33166 <secondary>in <command>queryprogram</command> router</secondary>
33167 </indexterm>
33168 This option specifies a gid to be set when running the command while routing an
33169 address for deliver. It must be set if <option>command_user</option> specifies a numerical
33170 uid. If it begins with a digit, it is interpreted as the numerical value of the
33171 gid. Otherwise it is looked up using <function>getgrnam()</function>.
33172 </para>
33173 <para>
33174 <indexterm role="option">
33175 <primary><option>command_user</option></primary>
33176 </indexterm>
33177 </para>
33178 <informaltable frame="all">
33179 <tgroup cols="4" colsep="0" rowsep="0">
33180 <colspec colwidth="8*" align="left"/>
33181 <colspec colwidth="6*" align="center"/>
33182 <colspec colwidth="6*" align="center"/>
33183 <colspec colwidth="6*" align="right"/>
33184 <tbody>
33185 <row>
33186 <entry><option>command_user</option></entry>
33187 <entry>Use: <emphasis>queryprogram</emphasis></entry>
33188 <entry>Type: <emphasis>string</emphasis></entry>
33189 <entry>Default: <emphasis>unset</emphasis></entry>
33190 </row>
33191 </tbody>
33192 </tgroup>
33193 </informaltable>
33194 <para>
33195 <indexterm role="concept">
33196 <primary>uid (user id)</primary>
33197 <secondary>for <command>queryprogram</command></secondary>
33198 </indexterm>
33199 This option must be set. It specifies the uid which is set when running the
33200 command while routing an address for delivery. If the value begins with a digit,
33201 it is interpreted as the numerical value of the uid. Otherwise, it is looked up
33202 using <function>getpwnam()</function> to obtain a value for the uid and, if <option>command_group</option> is
33203 not set, a value for the gid also.
33204 </para>
33205 <para>
33206 <emphasis role="bold">Warning:</emphasis> Changing uid and gid is possible only when Exim is running as
33207 root, which it does during a normal delivery in a conventional configuration.
33208 However, when an address is being verified during message reception, Exim is
33209 usually running as the Exim user, not as root. If the <command>queryprogram</command> router
33210 is called from a non-root process, Exim cannot change uid or gid before running
33211 the command. In this circumstance the command runs under the current uid and
33212 gid.
33213 </para>
33214 <para>
33215 <indexterm role="option">
33216 <primary><option>current_directory</option></primary>
33217 </indexterm>
33218 </para>
33219 <informaltable frame="all">
33220 <tgroup cols="4" colsep="0" rowsep="0">
33221 <colspec colwidth="8*" align="left"/>
33222 <colspec colwidth="6*" align="center"/>
33223 <colspec colwidth="6*" align="center"/>
33224 <colspec colwidth="6*" align="right"/>
33225 <tbody>
33226 <row>
33227 <entry><option>current_directory</option></entry>
33228 <entry>Use: <emphasis>queryprogram</emphasis></entry>
33229 <entry>Type: <emphasis>string</emphasis></entry>
33230 <entry>Default: <emphasis>/</emphasis></entry>
33231 </row>
33232 </tbody>
33233 </tgroup>
33234 </informaltable>
33235 <para>
33236 This option specifies an absolute path which is made the current directory
33237 before running the command.
33238 </para>
33239 <para>
33240 <indexterm role="option">
33241 <primary><option>timeout</option></primary>
33242 </indexterm>
33243 </para>
33244 <informaltable frame="all">
33245 <tgroup cols="4" colsep="0" rowsep="0">
33246 <colspec colwidth="8*" align="left"/>
33247 <colspec colwidth="6*" align="center"/>
33248 <colspec colwidth="6*" align="center"/>
33249 <colspec colwidth="6*" align="right"/>
33250 <tbody>
33251 <row>
33252 <entry><option>timeout</option></entry>
33253 <entry>Use: <emphasis>queryprogram</emphasis></entry>
33254 <entry>Type: <emphasis>time</emphasis></entry>
33255 <entry>Default: <emphasis>1h</emphasis></entry>
33256 </row>
33257 </tbody>
33258 </tgroup>
33259 </informaltable>
33260 <para>
33261 If the command does not complete within the timeout period, its process group
33262 is killed and the message is frozen. A value of zero time specifies no
33263 timeout.
33264 </para>
33265 <para>
33266 The standard output of the command is connected to a pipe, which is read when
33267 the command terminates. It should consist of a single line of output,
33268 containing up to five fields, separated by white space. The maximum length of
33269 the line is 1023 characters. Longer lines are silently truncated. The first
33270 field is one of the following words (case-insensitive):
33271 </para>
33272 <itemizedlist>
33273 <listitem>
33274 <para>
33275 <emphasis>Accept</emphasis>: routing succeeded; the remaining fields specify what to do (see
33276 below).
33277 </para>
33278 </listitem>
33279 <listitem>
33280 <para>
33281 <emphasis>Decline</emphasis>: the router declines; pass the address to the next router, unless
33282 <option>no_more</option> is set.
33283 </para>
33284 </listitem>
33285 <listitem>
33286 <para>
33287 <emphasis>Fail</emphasis>: routing failed; do not pass the address to any more routers. Any
33288 subsequent text on the line is an error message. If the router is run as part
33289 of address verification during an incoming SMTP message, the message is
33290 included in the SMTP response.
33291 </para>
33292 </listitem>
33293 <listitem>
33294 <para>
33295 <emphasis>Defer</emphasis>: routing could not be completed at this time; try again later. Any
33296 subsequent text on the line is an error message which is logged. It is not
33297 included in any SMTP response.
33298 </para>
33299 </listitem>
33300 <listitem>
33301 <para>
33302 <emphasis>Freeze</emphasis>: the same as <emphasis>defer</emphasis>, except that the message is frozen.
33303 </para>
33304 </listitem>
33305 <listitem>
33306 <para>
33307 <emphasis>Pass</emphasis>: pass the address to the next router (or the router specified by
33308 <option>pass_router</option>), overriding <option>no_more</option>.
33309 </para>
33310 </listitem>
33311 <listitem>
33312 <para>
33313 <emphasis>Redirect</emphasis>: the message is redirected. The remainder of the line is a list of
33314 new addresses, which are routed independently, starting with the first router,
33315 or the router specified by <option>redirect_router</option>, if set.
33316 </para>
33317 </listitem>
33318 </itemizedlist>
33319 <para>
33320 When the first word is <emphasis>accept</emphasis>, the remainder of the line consists of a
33321 number of keyed data values, as follows (split into two lines here, to fit on
33322 the page):
33323 </para>
33324 <literallayout class="monospaced">
33325 ACCEPT TRANSPORT=&lt;transport&gt; HOSTS=&lt;list of hosts&gt;
33326 LOOKUP=byname|bydns DATA=&lt;text&gt;
33327 </literallayout>
33328 <para>
33329 The data items can be given in any order, and all are optional. If no transport
33330 is included, the transport specified by the generic <option>transport</option> option is
33331 used. The list of hosts and the lookup type are needed only if the transport is
33332 an <command>smtp</command> transport that does not itself supply a list of hosts.
33333 </para>
33334 <para>
33335 The format of the list of hosts is the same as for the <command>manualroute</command> router.
33336 As well as host names and IP addresses with optional port numbers, as described
33337 in section <xref linkend="SECTformatonehostitem"/>, it may contain names followed by
33338 <literal>/MX</literal> to specify sublists of hosts that are obtained by looking up MX records
33339 (see section <xref linkend="SECThostshowused"/>).
33340 </para>
33341 <para>
33342 If the lookup type is not specified, Exim behaves as follows when trying to
33343 find an IP address for each host: First, a DNS lookup is done. If this yields
33344 anything other than HOST_NOT_FOUND, that result is used. Otherwise, Exim
33345 goes on to try a call to <function>getipnodebyname()</function> or <function>gethostbyname()</function>, and the
33346 result of the lookup is the result of that call.
33347 </para>
33348 <para>
33349 <indexterm role="variable">
33350 <primary><varname>$address_data</varname></primary>
33351 </indexterm>
33352 If the DATA field is set, its value is placed in the <varname>$address_data</varname>
33353 variable. For example, this return line
33354 </para>
33355 <literallayout class="monospaced">
33356 accept hosts=x1.y.example:x2.y.example data="rule1"
33357 </literallayout>
33358 <para>
33359 routes the address to the default transport, passing a list of two hosts. When
33360 the transport runs, the string <quote>rule1</quote> is in <varname>$address_data</varname>.
33361 <indexterm role="concept" startref="IIDquerou1" class="endofrange"/>
33362 <indexterm role="concept" startref="IIDquerou2" class="endofrange"/>
33363 </para>
33364 </chapter>
33365
33366 <chapter id="CHAPredirect">
33367 <title>The redirect router</title>
33368 <para>
33369 <indexterm role="concept" id="IIDredrou1" class="startofrange">
33370 <primary><command>redirect</command> router</primary>
33371 </indexterm>
33372 <indexterm role="concept" id="IIDredrou2" class="startofrange">
33373 <primary>routers</primary>
33374 <secondary><command>redirect</command></secondary>
33375 </indexterm>
33376 <indexterm role="concept">
33377 <primary>alias file</primary>
33378 <secondary>in a <command>redirect</command> router</secondary>
33379 </indexterm>
33380 <indexterm role="concept">
33381 <primary>address redirection</primary>
33382 <secondary><command>redirect</command> router</secondary>
33383 </indexterm>
33384 The <command>redirect</command> router handles several kinds of address redirection. Its most
33385 common uses are for resolving local part aliases from a central alias file
33386 (usually called <filename>/etc/aliases</filename>) and for handling users&#x2019; personal <filename>.forward</filename>
33387 files, but it has many other potential uses. The incoming address can be
33388 redirected in several different ways:
33389 </para>
33390 <itemizedlist>
33391 <listitem>
33392 <para>
33393 It can be replaced by one or more new addresses which are themselves routed
33394 independently.
33395 </para>
33396 </listitem>
33397 <listitem>
33398 <para>
33399 It can be routed to be delivered to a given file or directory.
33400 </para>
33401 </listitem>
33402 <listitem>
33403 <para>
33404 It can be routed to be delivered to a specified pipe command.
33405 </para>
33406 </listitem>
33407 <listitem>
33408 <para>
33409 It can cause an automatic reply to be generated.
33410 </para>
33411 </listitem>
33412 <listitem>
33413 <para>
33414 It can be forced to fail, optionally with a custom error message.
33415 </para>
33416 </listitem>
33417 <listitem>
33418 <para>
33419 It can be temporarily deferred, optionally with a custom message.
33420 </para>
33421 </listitem>
33422 <listitem>
33423 <para>
33424 It can be discarded.
33425 </para>
33426 </listitem>
33427 </itemizedlist>
33428 <para>
33429 The generic <option>transport</option> option must not be set for <command>redirect</command> routers.
33430 However, there are some private options which define transports for delivery to
33431 files and pipes, and for generating autoreplies. See the <option>file_transport</option>,
33432 <option>pipe_transport</option> and <option>reply_transport</option> descriptions below.
33433 </para>
33434 <section id="SECID124">
33435 <title>Redirection data</title>
33436 <para>
33437 The router operates by interpreting a text string which it obtains either by
33438 expanding the contents of the <option>data</option> option, or by reading the entire
33439 contents of a file whose name is given in the <option>file</option> option. These two
33440 options are mutually exclusive. The first is commonly used for handling system
33441 aliases, in a configuration like this:
33442 </para>
33443 <literallayout class="monospaced">
33444 system_aliases:
33445   driver = redirect
33446   data = ${lookup{$local_part}lsearch{/etc/aliases}}
33447 </literallayout>
33448 <para>
33449 If the lookup fails, the expanded string in this example is empty. When the
33450 expansion of <option>data</option> results in an empty string, the router declines. A forced
33451 expansion failure also causes the router to decline; other expansion failures
33452 cause delivery to be deferred.
33453 </para>
33454 <para>
33455 A configuration using <option>file</option> is commonly used for handling users&#x2019;
33456 <filename>.forward</filename> files, like this:
33457 </para>
33458 <literallayout class="monospaced">
33459 userforward:
33460   driver = redirect
33461   check_local_user
33462   file = $home/.forward
33463   no_verify
33464 </literallayout>
33465 <para>
33466 If the file does not exist, or causes no action to be taken (for example, it is
33467 empty or consists only of comments), the router declines. <emphasis role="bold">Warning</emphasis>: This
33468 is not the case when the file contains syntactically valid items that happen to
33469 yield empty addresses, for example, items containing only RFC 2822 address
33470 comments.
33471 </para>
33472 </section>
33473 <section id="SECID125">
33474 <title>Forward files and address verification</title>
33475 <para>
33476 <indexterm role="concept">
33477 <primary>address redirection</primary>
33478 <secondary>while verifying</secondary>
33479 </indexterm>
33480 It is usual to set <option>no_verify</option> on <command>redirect</command> routers which handle users&#x2019;
33481 <filename>.forward</filename> files, as in the example above. There are two reasons for this:
33482 </para>
33483 <itemizedlist>
33484 <listitem>
33485 <para>
33486 When Exim is receiving an incoming SMTP message from a remote host, it is
33487 running under the Exim uid, not as root. Exim is unable to change uid to read
33488 the file as the user, and it may not be able to read it as the Exim user. So in
33489 practice the router may not be able to operate.
33490 </para>
33491 </listitem>
33492 <listitem>
33493 <para>
33494 However, even when the router can operate, the existence of a <filename>.forward</filename> file
33495 is unimportant when verifying an address. What should be checked is whether the
33496 local part is a valid user name or not. Cutting out the redirection processing
33497 saves some resources.
33498 </para>
33499 </listitem>
33500 </itemizedlist>
33501 </section>
33502 <section id="SECID126">
33503 <title>Interpreting redirection data</title>
33504 <para>
33505 <indexterm role="concept">
33506 <primary>Sieve filter</primary>
33507 <secondary>specifying in redirection data</secondary>
33508 </indexterm>
33509 <indexterm role="concept">
33510 <primary>filter</primary>
33511 <secondary>specifying in redirection data</secondary>
33512 </indexterm>
33513 The contents of the data string, whether obtained from <option>data</option> or <option>file</option>,
33514 can be interpreted in two different ways:
33515 </para>
33516 <itemizedlist>
33517 <listitem>
33518 <para>
33519 If the <option>allow_filter</option> option is set true, and the data begins with the text
33520 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote>, it is interpreted as a list of
33521 <emphasis>filtering</emphasis> instructions in the form of an Exim or Sieve filter file,
33522 respectively. Details of the syntax and semantics of filter files are described
33523 in a separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>; this
33524 document is intended for use by end users.
33525 </para>
33526 </listitem>
33527 <listitem>
33528 <para>
33529 Otherwise, the data must be a comma-separated list of redirection items, as
33530 described in the next section.
33531 </para>
33532 </listitem>
33533 </itemizedlist>
33534 <para>
33535 When a message is redirected to a file (a <quote>mail folder</quote>), the file name given
33536 in a non-filter redirection list must always be an absolute path. A filter may
33537 generate a relative path &ndash; how this is handled depends on the transport&#x2019;s
33538 configuration. See section <xref linkend="SECTfildiropt"/> for a discussion of this issue
33539 for the <command>appendfile</command> transport.
33540 </para>
33541 </section>
33542 <section id="SECTitenonfilred">
33543 <title>Items in a non-filter redirection list</title>
33544 <para>
33545 <indexterm role="concept">
33546 <primary>address redirection</primary>
33547 <secondary>non-filter list items</secondary>
33548 </indexterm>
33549 When the redirection data is not an Exim or Sieve filter, for example, if it
33550 comes from a conventional alias or forward file, it consists of a list of
33551 addresses, file names, pipe commands, or certain special items (see section
33552 <xref linkend="SECTspecitredli"/> below). The special items can be individually enabled or
33553 disabled by means of options whose names begin with <option>allow_</option> or <option>forbid_</option>,
33554 depending on their default values. The items in the list are separated by
33555 commas or newlines.
33556 If a comma is required in an item, the entire item must be enclosed in double
33557 quotes.
33558 </para>
33559 <para>
33560 Lines starting with a # character are comments, and are ignored, and # may
33561 also appear following a comma, in which case everything between the # and the
33562 next newline character is ignored.
33563 </para>
33564 <para>
33565 If an item is entirely enclosed in double quotes, these are removed. Otherwise
33566 double quotes are retained because some forms of mail address require their use
33567 (but never to enclose the entire address). In the following description,
33568 <quote>item</quote> refers to what remains after any surrounding double quotes have been
33569 removed.
33570 </para>
33571 <para>
33572 <indexterm role="variable">
33573 <primary><varname>$local_part</varname></primary>
33574 </indexterm>
33575 <emphasis role="bold">Warning</emphasis>: If you use an Exim expansion to construct a redirection address,
33576 and the expansion contains a reference to <varname>$local_part</varname>, you should make use
33577 of the <option>quote_local_part</option> expansion operator, in case the local part contains
33578 special characters. For example, to redirect all mail for the domain
33579 <emphasis>obsolete.example</emphasis>, retaining the existing local part, you could use this
33580 setting:
33581 </para>
33582 <literallayout class="monospaced">
33583 data = ${quote_local_part:$local_part}@newdomain.example
33584 </literallayout>
33585 </section>
33586 <section id="SECTredlocmai">
33587 <title>Redirecting to a local mailbox</title>
33588 <para>
33589 <indexterm role="concept">
33590 <primary>routing</primary>
33591 <secondary>loops in</secondary>
33592 </indexterm>
33593 <indexterm role="concept">
33594 <primary>loop</primary>
33595 <secondary>while routing, avoidance of</secondary>
33596 </indexterm>
33597 <indexterm role="concept">
33598 <primary>address redirection</primary>
33599 <secondary>to local mailbox</secondary>
33600 </indexterm>
33601 A redirection item may safely be the same as the address currently under
33602 consideration. This does not cause a routing loop, because a router is
33603 automatically skipped if any ancestor of the address that is being processed
33604 is the same as the current address and was processed by the current router.
33605 Such an address is therefore passed to the following routers, so it is handled
33606 as if there were no redirection. When making this loop-avoidance test, the
33607 complete local part, including any prefix or suffix, is used.
33608 </para>
33609 <para>
33610 <indexterm role="concept">
33611 <primary>address redirection</primary>
33612 <secondary>local part without domain</secondary>
33613 </indexterm>
33614 Specifying the same local part without a domain is a common usage in personal
33615 filter files when the user wants to have messages delivered to the local
33616 mailbox and also forwarded elsewhere. For example, the user whose login is
33617 <emphasis>cleo</emphasis> might have a <filename>.forward</filename> file containing this:
33618 </para>
33619 <literallayout class="monospaced">
33620 cleo, cleopatra@egypt.example
33621 </literallayout>
33622 <para>
33623 <indexterm role="concept">
33624 <primary>backslash in alias file</primary>
33625 </indexterm>
33626 <indexterm role="concept">
33627 <primary>alias file</primary>
33628 <secondary>backslash in</secondary>
33629 </indexterm>
33630 For compatibility with other MTAs, such unqualified local parts may be
33631 preceded by <quote>\</quote>, but this is not a requirement for loop prevention. However,
33632 it does make a difference if more than one domain is being handled
33633 synonymously.
33634 </para>
33635 <para>
33636 If an item begins with <quote>\</quote> and the rest of the item parses as a valid RFC
33637 2822 address that does not include a domain, the item is qualified using the
33638 domain of the incoming address. In the absence of a leading <quote>\</quote>, unqualified
33639 addresses are qualified using the value in <option>qualify_recipient</option>, but you can
33640 force the incoming domain to be used by setting <option>qualify_preserve_domain</option>.
33641 </para>
33642 <para>
33643 Care must be taken if there are alias names for local users.
33644 Consider an MTA handling a single local domain where the system alias file
33645 contains:
33646 </para>
33647 <literallayout class="monospaced">
33648 Sam.Reman: spqr
33649 </literallayout>
33650 <para>
33651 Now suppose that Sam (whose login id is <emphasis>spqr</emphasis>) wants to save copies of
33652 messages in the local mailbox, and also forward copies elsewhere. He creates
33653 this forward file:
33654 </para>
33655 <literallayout class="monospaced">
33656 Sam.Reman, spqr@reme.elsewhere.example
33657 </literallayout>
33658 <para>
33659 With these settings, an incoming message addressed to <emphasis>Sam.Reman</emphasis> fails. The
33660 <command>redirect</command> router for system aliases does not process <emphasis>Sam.Reman</emphasis> the
33661 second time round, because it has previously routed it,
33662 and the following routers presumably cannot handle the alias. The forward file
33663 should really contain
33664 </para>
33665 <literallayout class="monospaced">
33666 spqr, spqr@reme.elsewhere.example
33667 </literallayout>
33668 <para>
33669 but because this is such a common error, the <option>check_ancestor</option> option (see
33670 below) exists to provide a way to get round it. This is normally set on a
33671 <command>redirect</command> router that is handling users&#x2019; <filename>.forward</filename> files.
33672 </para>
33673 </section>
33674 <section id="SECTspecitredli">
33675 <title>Special items in redirection lists</title>
33676 <para>
33677 In addition to addresses, the following types of item may appear in redirection
33678 lists (that is, in non-filter redirection data):
33679 </para>
33680 <itemizedlist>
33681 <listitem>
33682 <para>
33683 <indexterm role="concept">
33684 <primary>pipe</primary>
33685 <secondary>in redirection list</secondary>
33686 </indexterm>
33687 <indexterm role="concept">
33688 <primary>address redirection</primary>
33689 <secondary>to pipe</secondary>
33690 </indexterm>
33691 An item is treated as a pipe command if it begins with <quote>|</quote> and does not parse
33692 as a valid RFC 2822 address that includes a domain. A transport for running the
33693 command must be specified by the <option>pipe_transport</option> option.
33694 Normally, either the router or the transport specifies a user and a group under
33695 which to run the delivery. The default is to use the Exim user and group.
33696 </para>
33697 <para>
33698 Single or double quotes can be used for enclosing the individual arguments of
33699 the pipe command; no interpretation of escapes is done for single quotes. If
33700 the command contains a comma character, it is necessary to put the whole item
33701 in double quotes, for example:
33702 </para>
33703 <literallayout class="monospaced">
33704 "|/some/command ready,steady,go"
33705 </literallayout>
33706 <para>
33707 since items in redirection lists are terminated by commas. Do not, however,
33708 quote just the command. An item such as
33709 </para>
33710 <literallayout class="monospaced">
33711 |"/some/command ready,steady,go"
33712 </literallayout>
33713 <para>
33714 is interpreted as a pipe with a rather strange command name, and no arguments.
33715 </para>
33716 </listitem>
33717 <listitem>
33718 <para>
33719 <indexterm role="concept">
33720 <primary>file</primary>
33721 <secondary>in redirection list</secondary>
33722 </indexterm>
33723 <indexterm role="concept">
33724 <primary>address redirection</primary>
33725 <secondary>to file</secondary>
33726 </indexterm>
33727 An item is interpreted as a path name if it begins with <quote>/</quote> and does not
33728 parse as a valid RFC 2822 address that includes a domain. For example,
33729 </para>
33730 <literallayout class="monospaced">
33731 /home/world/minbari
33732 </literallayout>
33733 <para>
33734 is treated as a file name, but
33735 </para>
33736 <literallayout class="monospaced">
33737 /s=molari/o=babylon/@x400gate.way
33738 </literallayout>
33739 <para>
33740 is treated as an address. For a file name, a transport must be specified using
33741 the <option>file_transport</option> option. However, if the generated path name ends with a
33742 forward slash character, it is interpreted as a directory name rather than a
33743 file name, and <option>directory_transport</option> is used instead.
33744 </para>
33745 <para>
33746 Normally, either the router or the transport specifies a user and a group under
33747 which to run the delivery. The default is to use the Exim user and group.
33748 </para>
33749 <para>
33750 <indexterm role="concept">
33751 <primary><filename>/dev/null</filename></primary>
33752 </indexterm>
33753 However, if a redirection item is the path <filename>/dev/null</filename>, delivery to it is
33754 bypassed at a high level, and the log entry shows <quote>**bypassed**</quote>
33755 instead of a transport name. In this case the user and group are not used.
33756 </para>
33757 </listitem>
33758 <listitem>
33759 <para>
33760 <indexterm role="concept">
33761 <primary>included address list</primary>
33762 </indexterm>
33763 <indexterm role="concept">
33764 <primary>address redirection</primary>
33765 <secondary>included external list</secondary>
33766 </indexterm>
33767 If an item is of the form
33768 </para>
33769 <literallayout class="monospaced">
33770 :include:&lt;path name&gt;
33771 </literallayout>
33772 <para>
33773 a list of further items is taken from the given file and included at that
33774 point. <emphasis role="bold">Note</emphasis>: Such a file can not be a filter file; it is just an
33775 out-of-line addition to the list. The items in the included list are separated
33776 by commas or newlines and are not subject to expansion. If this is the first
33777 item in an alias list in an <command>lsearch</command> file, a colon must be used to terminate
33778 the alias name. This example is incorrect:
33779 </para>
33780 <literallayout class="monospaced">
33781 list1    :include:/opt/lists/list1
33782 </literallayout>
33783 <para>
33784 It must be given as
33785 </para>
33786 <literallayout class="monospaced">
33787 list1:   :include:/opt/lists/list1
33788 </literallayout>
33789 </listitem>
33790 <listitem>
33791 <para>
33792 <indexterm role="concept">
33793 <primary>address redirection</primary>
33794 <secondary>to black hole</secondary>
33795 </indexterm>
33796 Sometimes you want to throw away mail to a particular local part. Making the
33797 <option>data</option> option expand to an empty string does not work, because that causes
33798 the router to decline. Instead, the alias item
33799 <indexterm role="concept">
33800 <primary>black hole</primary>
33801 </indexterm>
33802 <indexterm role="concept">
33803 <primary>abandoning mail</primary>
33804 </indexterm>
33805 <emphasis>:blackhole:</emphasis> can be used. It does what its name implies. No delivery is
33806 done, and no error message is generated. This has the same effect as specifing
33807 <filename>/dev/null</filename> as a destination, but it can be independently disabled.
33808 </para>
33809 <para>
33810 <emphasis role="bold">Warning</emphasis>: If <emphasis>:blackhole:</emphasis> appears anywhere in a redirection list, no
33811 delivery is done for the original local part, even if other redirection items
33812 are present. If you are generating a multi-item list (for example, by reading a
33813 database) and need the ability to provide a no-op item, you must use
33814 <filename>/dev/null</filename>.
33815 </para>
33816 </listitem>
33817 <listitem>
33818 <para>
33819 <indexterm role="concept">
33820 <primary>delivery</primary>
33821 <secondary>forcing failure</secondary>
33822 </indexterm>
33823 <indexterm role="concept">
33824 <primary>delivery</primary>
33825 <secondary>forcing deferral</secondary>
33826 </indexterm>
33827 <indexterm role="concept">
33828 <primary>failing delivery</primary>
33829 <secondary>forcing</secondary>
33830 </indexterm>
33831 <indexterm role="concept">
33832 <primary>deferred delivery, forcing</primary>
33833 </indexterm>
33834 <indexterm role="concept">
33835 <primary>customizing</primary>
33836 <secondary>failure message</secondary>
33837 </indexterm>
33838 An attempt to deliver a particular address can be deferred or forced to fail by
33839 redirection items of the form
33840 </para>
33841 <literallayout class="monospaced">
33842 :defer:
33843 :fail:
33844 </literallayout>
33845 <para>
33846 respectively. When a redirection list contains such an item, it applies
33847 to the entire redirection; any other items in the list are ignored. Any
33848 text following <emphasis>:fail:</emphasis> or <emphasis>:defer:</emphasis> is placed in the error text
33849 associated with the failure. For example, an alias file might contain:
33850 </para>
33851 <literallayout class="monospaced">
33852 X.Employee:  :fail: Gone away, no forwarding address
33853 </literallayout>
33854 <para>
33855 In the case of an address that is being verified from an ACL or as the subject
33856 of a
33857 <indexterm role="concept">
33858 <primary>VRFY</primary>
33859 <secondary>error text, display of</secondary>
33860 </indexterm>
33861 VRFY command, the text is included in the SMTP error response by
33862 default.
33863 <indexterm role="concept">
33864 <primary>EXPN</primary>
33865 <secondary>error text, display of</secondary>
33866 </indexterm>
33867 The text is not included in the response to an EXPN command. In non-SMTP cases
33868 the text is included in the error message that Exim generates.
33869 </para>
33870 <para>
33871 <indexterm role="concept">
33872 <primary>SMTP</primary>
33873 <secondary>error codes</secondary>
33874 </indexterm>
33875 By default, Exim sends a 451 SMTP code for a <emphasis>:defer:</emphasis>, and 550 for
33876 <emphasis>:fail:</emphasis>. However, if the message starts with three digits followed by a
33877 space, optionally followed by an extended code of the form <emphasis>n.n.n</emphasis>, also
33878 followed by a space, and the very first digit is the same as the default error
33879 code, the code from the message is used instead. If the very first digit is
33880 incorrect, a panic error is logged, and the default code is used. You can
33881 suppress the use of the supplied code in a redirect router by setting the
33882 <option>forbid_smtp_code</option> option true. In this case, any SMTP code is quietly
33883 ignored.
33884 </para>
33885 <para>
33886 <indexterm role="variable">
33887 <primary><varname>$acl_verify_message</varname></primary>
33888 </indexterm>
33889 In an ACL, an explicitly provided message overrides the default, but the
33890 default message is available in the variable <varname>$acl_verify_message</varname> and can
33891 therefore be included in a custom message if this is desired.
33892 </para>
33893 <para>
33894 Normally the error text is the rest of the redirection list &ndash; a comma does
33895 not terminate it &ndash; but a newline does act as a terminator. Newlines are not
33896 normally present in alias expansions. In <command>lsearch</command> lookups they are removed
33897 as part of the continuation process, but they may exist in other kinds of
33898 lookup and in <emphasis>:include:</emphasis> files.
33899 </para>
33900 <para>
33901 During routing for message delivery (as opposed to verification), a redirection
33902 containing <emphasis>:fail:</emphasis> causes an immediate failure of the incoming address,
33903 whereas <emphasis>:defer:</emphasis> causes the message to remain on the queue so that a
33904 subsequent delivery attempt can happen at a later time. If an address is
33905 deferred for too long, it will ultimately fail, because the normal retry
33906 rules still apply.
33907 </para>
33908 </listitem>
33909 <listitem>
33910 <para>
33911 <indexterm role="concept">
33912 <primary>alias file</primary>
33913 <secondary>exception to default</secondary>
33914 </indexterm>
33915 Sometimes it is useful to use a single-key search type with a default (see
33916 chapter <xref linkend="CHAPfdlookup"/>) to look up aliases. However, there may be a need
33917 for exceptions to the default. These can be handled by aliasing them to
33918 <emphasis>:unknown:</emphasis>. This differs from <emphasis>:fail:</emphasis> in that it causes the <command>redirect</command>
33919 router to decline, whereas <emphasis>:fail:</emphasis> forces routing to fail. A lookup which
33920 results in an empty redirection list has the same effect.
33921 </para>
33922 </listitem>
33923 </itemizedlist>
33924 </section>
33925 <section id="SECTdupaddr">
33926 <title>Duplicate addresses</title>
33927 <para>
33928 <indexterm role="concept">
33929 <primary>duplicate addresses</primary>
33930 </indexterm>
33931 <indexterm role="concept">
33932 <primary>address duplicate, discarding</primary>
33933 </indexterm>
33934 <indexterm role="concept">
33935 <primary>pipe</primary>
33936 <secondary>duplicated</secondary>
33937 </indexterm>
33938 Exim removes duplicate addresses from the list to which it is delivering, so as
33939 to deliver just one copy to each address. This does not apply to deliveries
33940 routed to pipes by different immediate parent addresses, but an indirect
33941 aliasing scheme of the type
33942 </para>
33943 <literallayout class="monospaced">
33944 pipe:       |/some/command $local_part
33945 localpart1: pipe
33946 localpart2: pipe
33947 </literallayout>
33948 <para>
33949 does not work with a message that is addressed to both local parts, because
33950 when the second is aliased to the intermediate local part <quote>pipe</quote> it gets
33951 discarded as being the same as a previously handled address. However, a scheme
33952 such as
33953 </para>
33954 <literallayout class="monospaced">
33955 localpart1: |/some/command $local_part
33956 localpart2: |/some/command $local_part
33957 </literallayout>
33958 <para>
33959 does result in two different pipe deliveries, because the immediate parents of
33960 the pipes are distinct.
33961 </para>
33962 </section>
33963 <section id="SECID128">
33964 <title>Repeated redirection expansion</title>
33965 <para>
33966 <indexterm role="concept">
33967 <primary>repeated redirection expansion</primary>
33968 </indexterm>
33969 <indexterm role="concept">
33970 <primary>address redirection</primary>
33971 <secondary>repeated for each delivery attempt</secondary>
33972 </indexterm>
33973 When a message cannot be delivered to all of its recipients immediately,
33974 leading to two or more delivery attempts, redirection expansion is carried out
33975 afresh each time for those addresses whose children were not all previously
33976 delivered. If redirection is being used as a mailing list, this can lead to new
33977 members of the list receiving copies of old messages. The <option>one_time</option> option
33978 can be used to avoid this.
33979 </para>
33980 </section>
33981 <section id="SECID129">
33982 <title>Errors in redirection lists</title>
33983 <para>
33984 <indexterm role="concept">
33985 <primary>address redirection</primary>
33986 <secondary>errors</secondary>
33987 </indexterm>
33988 If <option>skip_syntax_errors</option> is set, a malformed address that causes a parsing
33989 error is skipped, and an entry is written to the main log. This may be useful
33990 for mailing lists that are automatically managed. Otherwise, if an error is
33991 detected while generating the list of new addresses, the original address is
33992 deferred. See also <option>syntax_errors_to</option>.
33993 </para>
33994 </section>
33995 <section id="SECID130">
33996 <title>Private options for the redirect router</title>
33997 <para>
33998 <indexterm role="concept">
33999 <primary>options</primary>
34000 <secondary><command>redirect</command> router</secondary>
34001 </indexterm>
34002 The private options for the <command>redirect</command> router are as follows:
34003 </para>
34004 <para>
34005 <indexterm role="option">
34006 <primary><option>allow_defer</option></primary>
34007 </indexterm>
34008 </para>
34009 <informaltable frame="all">
34010 <tgroup cols="4" colsep="0" rowsep="0">
34011 <colspec colwidth="8*" align="left"/>
34012 <colspec colwidth="6*" align="center"/>
34013 <colspec colwidth="6*" align="center"/>
34014 <colspec colwidth="6*" align="right"/>
34015 <tbody>
34016 <row>
34017 <entry><option>allow_defer</option></entry>
34018 <entry>Use: <emphasis>redirect</emphasis></entry>
34019 <entry>Type: <emphasis>boolean</emphasis></entry>
34020 <entry>Default: <emphasis>false</emphasis></entry>
34021 </row>
34022 </tbody>
34023 </tgroup>
34024 </informaltable>
34025 <para>
34026 Setting this option allows the use of <emphasis>:defer:</emphasis> in non-filter redirection
34027 data, or the <option>defer</option> command in an Exim filter file.
34028 </para>
34029 <para>
34030 <indexterm role="option">
34031 <primary><option>allow_fail</option></primary>
34032 </indexterm>
34033 </para>
34034 <informaltable frame="all">
34035 <tgroup cols="4" colsep="0" rowsep="0">
34036 <colspec colwidth="8*" align="left"/>
34037 <colspec colwidth="6*" align="center"/>
34038 <colspec colwidth="6*" align="center"/>
34039 <colspec colwidth="6*" align="right"/>
34040 <tbody>
34041 <row>
34042 <entry><option>allow_fail</option></entry>
34043 <entry>Use: <emphasis>redirect</emphasis></entry>
34044 <entry>Type: <emphasis>boolean</emphasis></entry>
34045 <entry>Default: <emphasis>false</emphasis></entry>
34046 </row>
34047 </tbody>
34048 </tgroup>
34049 </informaltable>
34050 <para>
34051 <indexterm role="concept">
34052 <primary>failing delivery</primary>
34053 <secondary>from filter</secondary>
34054 </indexterm>
34055 If this option is true, the <emphasis>:fail:</emphasis> item can be used in a redirection list,
34056 and the <option>fail</option> command may be used in an Exim filter file.
34057 </para>
34058 <para>
34059 <indexterm role="option">
34060 <primary><option>allow_filter</option></primary>
34061 </indexterm>
34062 </para>
34063 <informaltable frame="all">
34064 <tgroup cols="4" colsep="0" rowsep="0">
34065 <colspec colwidth="8*" align="left"/>
34066 <colspec colwidth="6*" align="center"/>
34067 <colspec colwidth="6*" align="center"/>
34068 <colspec colwidth="6*" align="right"/>
34069 <tbody>
34070 <row>
34071 <entry><option>allow_filter</option></entry>
34072 <entry>Use: <emphasis>redirect</emphasis></entry>
34073 <entry>Type: <emphasis>boolean</emphasis></entry>
34074 <entry>Default: <emphasis>false</emphasis></entry>
34075 </row>
34076 </tbody>
34077 </tgroup>
34078 </informaltable>
34079 <para>
34080 <indexterm role="concept">
34081 <primary>filter</primary>
34082 <secondary>enabling use of</secondary>
34083 </indexterm>
34084 <indexterm role="concept">
34085 <primary>Sieve filter</primary>
34086 <secondary>enabling use of</secondary>
34087 </indexterm>
34088 Setting this option allows Exim to interpret redirection data that starts with
34089 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote> as a set of filtering instructions. There
34090 are some features of Exim filter files that some administrators may wish to
34091 lock out; see the <option>forbid_filter_</option><emphasis>xxx</emphasis> options below.
34092 </para>
34093 <para>
34094 It is also possible to lock out Exim filters or Sieve filters while allowing
34095 the other type; see <option>forbid_exim_filter</option> and <option>forbid_sieve_filter</option>.
34096 </para>
34097 <para>
34098 The filter is run using the uid and gid set by the generic <option>user</option> and
34099 <option>group</option> options. These take their defaults from the password data if
34100 <option>check_local_user</option> is set, so in the normal case of users&#x2019; personal filter
34101 files, the filter is run as the relevant user. When <option>allow_filter</option> is set
34102 true, Exim insists that either <option>check_local_user</option> or <option>user</option> is set.
34103 </para>
34104 <para>
34105 <indexterm role="option">
34106 <primary><option>allow_freeze</option></primary>
34107 </indexterm>
34108 </para>
34109 <informaltable frame="all">
34110 <tgroup cols="4" colsep="0" rowsep="0">
34111 <colspec colwidth="8*" align="left"/>
34112 <colspec colwidth="6*" align="center"/>
34113 <colspec colwidth="6*" align="center"/>
34114 <colspec colwidth="6*" align="right"/>
34115 <tbody>
34116 <row>
34117 <entry><option>allow_freeze</option></entry>
34118 <entry>Use: <emphasis>redirect</emphasis></entry>
34119 <entry>Type: <emphasis>boolean</emphasis></entry>
34120 <entry>Default: <emphasis>false</emphasis></entry>
34121 </row>
34122 </tbody>
34123 </tgroup>
34124 </informaltable>
34125 <para>
34126 <indexterm role="concept">
34127 <primary>freezing messages</primary>
34128 <secondary>allowing in filter</secondary>
34129 </indexterm>
34130 Setting this option allows the use of the <option>freeze</option> command in an Exim filter.
34131 This command is more normally encountered in system filters, and is disabled by
34132 default for redirection filters because it isn&#x2019;t something you usually want to
34133 let ordinary users do.
34134 </para>
34135 <para>
34136 <indexterm role="option">
34137 <primary><option>check_ancestor</option></primary>
34138 </indexterm>
34139 </para>
34140 <informaltable frame="all">
34141 <tgroup cols="4" colsep="0" rowsep="0">
34142 <colspec colwidth="8*" align="left"/>
34143 <colspec colwidth="6*" align="center"/>
34144 <colspec colwidth="6*" align="center"/>
34145 <colspec colwidth="6*" align="right"/>
34146 <tbody>
34147 <row>
34148 <entry><option>check_ancestor</option></entry>
34149 <entry>Use: <emphasis>redirect</emphasis></entry>
34150 <entry>Type: <emphasis>boolean</emphasis></entry>
34151 <entry>Default: <emphasis>false</emphasis></entry>
34152 </row>
34153 </tbody>
34154 </tgroup>
34155 </informaltable>
34156 <para>
34157 This option is concerned with handling generated addresses that are the same
34158 as some address in the list of redirection ancestors of the current address.
34159 Although it is turned off by default in the code, it is set in the default
34160 configuration file for handling users&#x2019; <filename>.forward</filename> files. It is recommended
34161 for this use of the <command>redirect</command> router.
34162 </para>
34163 <para>
34164 When <option>check_ancestor</option> is set, if a generated address (including the domain)
34165 is the same as any ancestor of the current address, it is replaced by a copy of
34166 the current address. This helps in the case where local part A is aliased to B,
34167 and B has a <filename>.forward</filename> file pointing back to A. For example, within a single
34168 domain, the local part <quote>Joe.Bloggs</quote> is aliased to <quote>jb</quote> and
34169 <filename>&nbsp;jb/.forward</filename> contains:
34170 </para>
34171 <literallayout class="monospaced">
34172 \Joe.Bloggs, &lt;other item(s)&gt;
34173 </literallayout>
34174 <para>
34175 Without the <option>check_ancestor</option> setting, either local part (<quote>jb</quote> or
34176 <quote>joe.bloggs</quote>) gets processed once by each router and so ends up as it was
34177 originally. If <quote>jb</quote> is the real mailbox name, mail to <quote>jb</quote> gets delivered
34178 (having been turned into <quote>joe.bloggs</quote> by the <filename>.forward</filename> file and back to
34179 <quote>jb</quote> by the alias), but mail to <quote>joe.bloggs</quote> fails. Setting
34180 <option>check_ancestor</option> on the <command>redirect</command> router that handles the <filename>.forward</filename>
34181 file prevents it from turning <quote>jb</quote> back into <quote>joe.bloggs</quote> when that was the
34182 original address. See also the <option>repeat_use</option> option below.
34183 </para>
34184 <para>
34185 <indexterm role="option">
34186 <primary><option>check_group</option></primary>
34187 </indexterm>
34188 </para>
34189 <informaltable frame="all">
34190 <tgroup cols="4" colsep="0" rowsep="0">
34191 <colspec colwidth="8*" align="left"/>
34192 <colspec colwidth="6*" align="center"/>
34193 <colspec colwidth="6*" align="center"/>
34194 <colspec colwidth="6*" align="right"/>
34195 <tbody>
34196 <row>
34197 <entry><option>check_group</option></entry>
34198 <entry>Use: <emphasis>redirect</emphasis></entry>
34199 <entry>Type: <emphasis>boolean</emphasis></entry>
34200 <entry>Default: <emphasis>see below</emphasis></entry>
34201 </row>
34202 </tbody>
34203 </tgroup>
34204 </informaltable>
34205 <para>
34206 When the <option>file</option> option is used, the group owner of the file is checked only
34207 when this option is set. The permitted groups are those listed in the
34208 <option>owngroups</option> option, together with the user&#x2019;s default group if
34209 <option>check_local_user</option> is set. If the file has the wrong group, routing is
34210 deferred. The default setting for this option is true if <option>check_local_user</option>
34211 is set and the <option>modemask</option> option permits the group write bit, or if the
34212 <option>owngroups</option> option is set. Otherwise it is false, and no group check occurs.
34213 </para>
34214 <para>
34215 <indexterm role="option">
34216 <primary><option>check_owner</option></primary>
34217 </indexterm>
34218 </para>
34219 <informaltable frame="all">
34220 <tgroup cols="4" colsep="0" rowsep="0">
34221 <colspec colwidth="8*" align="left"/>
34222 <colspec colwidth="6*" align="center"/>
34223 <colspec colwidth="6*" align="center"/>
34224 <colspec colwidth="6*" align="right"/>
34225 <tbody>
34226 <row>
34227 <entry><option>check_owner</option></entry>
34228 <entry>Use: <emphasis>redirect</emphasis></entry>
34229 <entry>Type: <emphasis>boolean</emphasis></entry>
34230 <entry>Default: <emphasis>see below</emphasis></entry>
34231 </row>
34232 </tbody>
34233 </tgroup>
34234 </informaltable>
34235 <para>
34236 When the <option>file</option> option is used, the owner of the file is checked only when
34237 this option is set. If <option>check_local_user</option> is set, the local user is
34238 permitted; otherwise the owner must be one of those listed in the <option>owners</option>
34239 option. The default value for this option is true if <option>check_local_user</option> or
34240 <option>owners</option> is set. Otherwise the default is false, and no owner check occurs.
34241 </para>
34242 <para>
34243 <indexterm role="option">
34244 <primary><option>data</option></primary>
34245 </indexterm>
34246 </para>
34247 <informaltable frame="all">
34248 <tgroup cols="4" colsep="0" rowsep="0">
34249 <colspec colwidth="8*" align="left"/>
34250 <colspec colwidth="6*" align="center"/>
34251 <colspec colwidth="6*" align="center"/>
34252 <colspec colwidth="6*" align="right"/>
34253 <tbody>
34254 <row>
34255 <entry><option>data</option></entry>
34256 <entry>Use: <emphasis>redirect</emphasis></entry>
34257 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34258 <entry>Default: <emphasis>unset</emphasis></entry>
34259 </row>
34260 </tbody>
34261 </tgroup>
34262 </informaltable>
34263 <para>
34264 This option is mutually exclusive with <option>file</option>. One or other of them must be
34265 set, but not both. The contents of <option>data</option> are expanded, and then used as the
34266 list of forwarding items, or as a set of filtering instructions. If the
34267 expansion is forced to fail, or the result is an empty string or a string that
34268 has no effect (consists entirely of comments), the router declines.
34269 </para>
34270 <para>
34271 When filtering instructions are used, the string must begin with <quote>#Exim
34272 filter</quote>, and all comments in the string, including this initial one, must be
34273 terminated with newline characters. For example:
34274 </para>
34275 <literallayout class="monospaced">
34276 data = #Exim filter\n\
34277        if $h_to: contains Exim then save $home/mail/exim endif
34278 </literallayout>
34279 <para>
34280 If you are reading the data from a database where newlines cannot be included,
34281 you can use the <varname>${sg}</varname> expansion item to turn the escape string of your
34282 choice into a newline.
34283 </para>
34284 <para>
34285 <indexterm role="option">
34286 <primary><option>directory_transport</option></primary>
34287 </indexterm>
34288 </para>
34289 <informaltable frame="all">
34290 <tgroup cols="4" colsep="0" rowsep="0">
34291 <colspec colwidth="8*" align="left"/>
34292 <colspec colwidth="6*" align="center"/>
34293 <colspec colwidth="6*" align="center"/>
34294 <colspec colwidth="6*" align="right"/>
34295 <tbody>
34296 <row>
34297 <entry><option>directory_transport</option></entry>
34298 <entry>Use: <emphasis>redirect</emphasis></entry>
34299 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34300 <entry>Default: <emphasis>unset</emphasis></entry>
34301 </row>
34302 </tbody>
34303 </tgroup>
34304 </informaltable>
34305 <para>
34306 A <command>redirect</command> router sets up a direct delivery to a directory when a path name
34307 ending with a slash is specified as a new <quote>address</quote>. The transport used is
34308 specified by this option, which, after expansion, must be the name of a
34309 configured transport. This should normally be an <command>appendfile</command> transport.
34310 </para>
34311 <para>
34312 <indexterm role="option">
34313 <primary><option>file</option></primary>
34314 </indexterm>
34315 </para>
34316 <informaltable frame="all">
34317 <tgroup cols="4" colsep="0" rowsep="0">
34318 <colspec colwidth="8*" align="left"/>
34319 <colspec colwidth="6*" align="center"/>
34320 <colspec colwidth="6*" align="center"/>
34321 <colspec colwidth="6*" align="right"/>
34322 <tbody>
34323 <row>
34324 <entry><option>file</option></entry>
34325 <entry>Use: <emphasis>redirect</emphasis></entry>
34326 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34327 <entry>Default: <emphasis>unset</emphasis></entry>
34328 </row>
34329 </tbody>
34330 </tgroup>
34331 </informaltable>
34332 <para>
34333 This option specifies the name of a file that contains the redirection data. It
34334 is mutually exclusive with the <option>data</option> option. The string is expanded before
34335 use; if the expansion is forced to fail, the router declines. Other expansion
34336 failures cause delivery to be deferred. The result of a successful expansion
34337 must be an absolute path. The entire file is read and used as the redirection
34338 data. If the data is an empty string or a string that has no effect (consists
34339 entirely of comments), the router declines.
34340 </para>
34341 <para>
34342 <indexterm role="concept">
34343 <primary>NFS</primary>
34344 <secondary>checking for file existence</secondary>
34345 </indexterm>
34346 If the attempt to open the file fails with a <quote>does not exist</quote> error, Exim
34347 runs a check on the containing directory,
34348 unless <option>ignore_enotdir</option> is true (see below).
34349 If the directory does not appear to exist, delivery is deferred. This can
34350 happen when users&#x2019; <filename>.forward</filename> files are in NFS-mounted directories, and there
34351 is a mount problem. If the containing directory does exist, but the file does
34352 not, the router declines.
34353 </para>
34354 <para>
34355 <indexterm role="option">
34356 <primary><option>file_transport</option></primary>
34357 </indexterm>
34358 </para>
34359 <informaltable frame="all">
34360 <tgroup cols="4" colsep="0" rowsep="0">
34361 <colspec colwidth="8*" align="left"/>
34362 <colspec colwidth="6*" align="center"/>
34363 <colspec colwidth="6*" align="center"/>
34364 <colspec colwidth="6*" align="right"/>
34365 <tbody>
34366 <row>
34367 <entry><option>file_transport</option></entry>
34368 <entry>Use: <emphasis>redirect</emphasis></entry>
34369 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34370 <entry>Default: <emphasis>unset</emphasis></entry>
34371 </row>
34372 </tbody>
34373 </tgroup>
34374 </informaltable>
34375 <para>
34376 <indexterm role="variable">
34377 <primary><varname>$address_file</varname></primary>
34378 </indexterm>
34379 A <command>redirect</command> router sets up a direct delivery to a file when a path name not
34380 ending in a slash is specified as a new <quote>address</quote>. The transport used is
34381 specified by this option, which, after expansion, must be the name of a
34382 configured transport. This should normally be an <command>appendfile</command> transport. When
34383 it is running, the file name is in <varname>$address_file</varname>.
34384 </para>
34385 <para>
34386 <indexterm role="option">
34387 <primary><option>filter_prepend_home</option></primary>
34388 </indexterm>
34389 </para>
34390 <informaltable frame="all">
34391 <tgroup cols="4" colsep="0" rowsep="0">
34392 <colspec colwidth="8*" align="left"/>
34393 <colspec colwidth="6*" align="center"/>
34394 <colspec colwidth="6*" align="center"/>
34395 <colspec colwidth="6*" align="right"/>
34396 <tbody>
34397 <row>
34398 <entry><option>filter_prepend_home</option></entry>
34399 <entry>Use: <emphasis>redirect</emphasis></entry>
34400 <entry>Type: <emphasis>boolean</emphasis></entry>
34401 <entry>Default: <emphasis>true</emphasis></entry>
34402 </row>
34403 </tbody>
34404 </tgroup>
34405 </informaltable>
34406 <para>
34407 When this option is true, if a <command>save</command> command in an Exim filter specifies a
34408 relative path, and <varname>$home</varname> is defined, it is automatically prepended to the
34409 relative path. If this option is set false, this action does not happen. The
34410 relative path is then passed to the transport unmodified.
34411 </para>
34412 <para>
34413 <indexterm role="option">
34414 <primary><option>forbid_blackhole</option></primary>
34415 </indexterm>
34416 </para>
34417 <informaltable frame="all">
34418 <tgroup cols="4" colsep="0" rowsep="0">
34419 <colspec colwidth="8*" align="left"/>
34420 <colspec colwidth="6*" align="center"/>
34421 <colspec colwidth="6*" align="center"/>
34422 <colspec colwidth="6*" align="right"/>
34423 <tbody>
34424 <row>
34425 <entry><option>forbid_blackhole</option></entry>
34426 <entry>Use: <emphasis>redirect</emphasis></entry>
34427 <entry>Type: <emphasis>boolean</emphasis></entry>
34428 <entry>Default: <emphasis>false</emphasis></entry>
34429 </row>
34430 </tbody>
34431 </tgroup>
34432 </informaltable>
34433 <para>
34434 If this option is true, the <emphasis>:blackhole:</emphasis> item may not appear in a
34435 redirection list.
34436 </para>
34437 <para>
34438 <indexterm role="option">
34439 <primary><option>forbid_exim_filter</option></primary>
34440 </indexterm>
34441 </para>
34442 <informaltable frame="all">
34443 <tgroup cols="4" colsep="0" rowsep="0">
34444 <colspec colwidth="8*" align="left"/>
34445 <colspec colwidth="6*" align="center"/>
34446 <colspec colwidth="6*" align="center"/>
34447 <colspec colwidth="6*" align="right"/>
34448 <tbody>
34449 <row>
34450 <entry><option>forbid_exim_filter</option></entry>
34451 <entry>Use: <emphasis>redirect</emphasis></entry>
34452 <entry>Type: <emphasis>boolean</emphasis></entry>
34453 <entry>Default: <emphasis>false</emphasis></entry>
34454 </row>
34455 </tbody>
34456 </tgroup>
34457 </informaltable>
34458 <para>
34459 If this option is set true, only Sieve filters are permitted when
34460 <option>allow_filter</option> is true.
34461 </para>
34462 <para>
34463 <indexterm role="option">
34464 <primary><option>forbid_file</option></primary>
34465 </indexterm>
34466 </para>
34467 <informaltable frame="all">
34468 <tgroup cols="4" colsep="0" rowsep="0">
34469 <colspec colwidth="8*" align="left"/>
34470 <colspec colwidth="6*" align="center"/>
34471 <colspec colwidth="6*" align="center"/>
34472 <colspec colwidth="6*" align="right"/>
34473 <tbody>
34474 <row>
34475 <entry><option>forbid_file</option></entry>
34476 <entry>Use: <emphasis>redirect</emphasis></entry>
34477 <entry>Type: <emphasis>boolean</emphasis></entry>
34478 <entry>Default: <emphasis>false</emphasis></entry>
34479 </row>
34480 </tbody>
34481 </tgroup>
34482 </informaltable>
34483 <para>
34484 <indexterm role="concept">
34485 <primary>delivery</primary>
34486 <secondary>to file; forbidding</secondary>
34487 </indexterm>
34488 <indexterm role="concept">
34489 <primary>Sieve filter</primary>
34490 <secondary>forbidding delivery to a file</secondary>
34491 </indexterm>
34492 <indexterm role="concept">
34493 <primary>Sieve filter</primary>
34494 <secondary><quote>keep</quote> facility; disabling</secondary>
34495 </indexterm>
34496 If this option is true, this router may not generate a new address that
34497 specifies delivery to a local file or directory, either from a filter or from a
34498 conventional forward file. This option is forced to be true if <option>one_time</option> is
34499 set. It applies to Sieve filters as well as to Exim filters, but if true, it
34500 locks out the Sieve&#x2019;s <quote>keep</quote> facility.
34501 </para>
34502 <para>
34503 <indexterm role="option">
34504 <primary><option>forbid_filter_dlfunc</option></primary>
34505 </indexterm>
34506 </para>
34507 <informaltable frame="all">
34508 <tgroup cols="4" colsep="0" rowsep="0">
34509 <colspec colwidth="8*" align="left"/>
34510 <colspec colwidth="6*" align="center"/>
34511 <colspec colwidth="6*" align="center"/>
34512 <colspec colwidth="6*" align="right"/>
34513 <tbody>
34514 <row>
34515 <entry><option>forbid_filter_dlfunc</option></entry>
34516 <entry>Use: <emphasis>redirect</emphasis></entry>
34517 <entry>Type: <emphasis>boolean</emphasis></entry>
34518 <entry>Default: <emphasis>false</emphasis></entry>
34519 </row>
34520 </tbody>
34521 </tgroup>
34522 </informaltable>
34523 <para>
34524 <indexterm role="concept">
34525 <primary>filter</primary>
34526 <secondary>locking out certain features</secondary>
34527 </indexterm>
34528 If this option is true, string expansions in Exim filters are not allowed to
34529 make use of the <option>dlfunc</option> expansion facility to run dynamically loaded
34530 functions.
34531 </para>
34532 <para>
34533 <indexterm role="option">
34534 <primary><option>forbid_filter_existstest</option></primary>
34535 </indexterm>
34536 </para>
34537 <informaltable frame="all">
34538 <tgroup cols="4" colsep="0" rowsep="0">
34539 <colspec colwidth="8*" align="left"/>
34540 <colspec colwidth="6*" align="center"/>
34541 <colspec colwidth="6*" align="center"/>
34542 <colspec colwidth="6*" align="right"/>
34543 <tbody>
34544 <row>
34545 <entry><option>forbid_filter_existstest</option></entry>
34546 <entry>Use: <emphasis>redirect</emphasis></entry>
34547 <entry>Type: <emphasis>boolean</emphasis></entry>
34548 <entry>Default: <emphasis>false</emphasis></entry>
34549 </row>
34550 </tbody>
34551 </tgroup>
34552 </informaltable>
34553 <para>
34554 <indexterm role="concept">
34555 <primary>expansion</primary>
34556 <secondary>statting a file</secondary>
34557 </indexterm>
34558 If this option is true, string expansions in Exim filters are not allowed to
34559 make use of the <option>exists</option> condition or the <option>stat</option> expansion item.
34560 </para>
34561 <para>
34562 <indexterm role="option">
34563 <primary><option>forbid_filter_logwrite</option></primary>
34564 </indexterm>
34565 </para>
34566 <informaltable frame="all">
34567 <tgroup cols="4" colsep="0" rowsep="0">
34568 <colspec colwidth="8*" align="left"/>
34569 <colspec colwidth="6*" align="center"/>
34570 <colspec colwidth="6*" align="center"/>
34571 <colspec colwidth="6*" align="right"/>
34572 <tbody>
34573 <row>
34574 <entry><option>forbid_filter_logwrite</option></entry>
34575 <entry>Use: <emphasis>redirect</emphasis></entry>
34576 <entry>Type: <emphasis>boolean</emphasis></entry>
34577 <entry>Default: <emphasis>false</emphasis></entry>
34578 </row>
34579 </tbody>
34580 </tgroup>
34581 </informaltable>
34582 <para>
34583 If this option is true, use of the logging facility in Exim filters is not
34584 permitted. Logging is in any case available only if the filter is being run
34585 under some unprivileged uid (which is normally the case for ordinary users&#x2019;
34586 <filename>.forward</filename> files).
34587 </para>
34588 <para>
34589 <indexterm role="option">
34590 <primary><option>forbid_filter_lookup</option></primary>
34591 </indexterm>
34592 </para>
34593 <informaltable frame="all">
34594 <tgroup cols="4" colsep="0" rowsep="0">
34595 <colspec colwidth="8*" align="left"/>
34596 <colspec colwidth="6*" align="center"/>
34597 <colspec colwidth="6*" align="center"/>
34598 <colspec colwidth="6*" align="right"/>
34599 <tbody>
34600 <row>
34601 <entry><option>forbid_filter_lookup</option></entry>
34602 <entry>Use: <emphasis>redirect</emphasis></entry>
34603 <entry>Type: <emphasis>boolean</emphasis></entry>
34604 <entry>Default: <emphasis>false</emphasis></entry>
34605 </row>
34606 </tbody>
34607 </tgroup>
34608 </informaltable>
34609 <para>
34610 If this option is true, string expansions in Exim filter files are not allowed
34611 to make use of <option>lookup</option> items.
34612 </para>
34613 <para>
34614 <indexterm role="option">
34615 <primary><option>forbid_filter_perl</option></primary>
34616 </indexterm>
34617 </para>
34618 <informaltable frame="all">
34619 <tgroup cols="4" colsep="0" rowsep="0">
34620 <colspec colwidth="8*" align="left"/>
34621 <colspec colwidth="6*" align="center"/>
34622 <colspec colwidth="6*" align="center"/>
34623 <colspec colwidth="6*" align="right"/>
34624 <tbody>
34625 <row>
34626 <entry><option>forbid_filter_perl</option></entry>
34627 <entry>Use: <emphasis>redirect</emphasis></entry>
34628 <entry>Type: <emphasis>boolean</emphasis></entry>
34629 <entry>Default: <emphasis>false</emphasis></entry>
34630 </row>
34631 </tbody>
34632 </tgroup>
34633 </informaltable>
34634 <para>
34635 This option has an effect only if Exim is built with embedded Perl support. If
34636 it is true, string expansions in Exim filter files are not allowed to make use
34637 of the embedded Perl support.
34638 </para>
34639 <para>
34640 <indexterm role="option">
34641 <primary><option>forbid_filter_readfile</option></primary>
34642 </indexterm>
34643 </para>
34644 <informaltable frame="all">
34645 <tgroup cols="4" colsep="0" rowsep="0">
34646 <colspec colwidth="8*" align="left"/>
34647 <colspec colwidth="6*" align="center"/>
34648 <colspec colwidth="6*" align="center"/>
34649 <colspec colwidth="6*" align="right"/>
34650 <tbody>
34651 <row>
34652 <entry><option>forbid_filter_readfile</option></entry>
34653 <entry>Use: <emphasis>redirect</emphasis></entry>
34654 <entry>Type: <emphasis>boolean</emphasis></entry>
34655 <entry>Default: <emphasis>false</emphasis></entry>
34656 </row>
34657 </tbody>
34658 </tgroup>
34659 </informaltable>
34660 <para>
34661 If this option is true, string expansions in Exim filter files are not allowed
34662 to make use of <option>readfile</option> items.
34663 </para>
34664 <para>
34665 <indexterm role="option">
34666 <primary><option>forbid_filter_readsocket</option></primary>
34667 </indexterm>
34668 </para>
34669 <informaltable frame="all">
34670 <tgroup cols="4" colsep="0" rowsep="0">
34671 <colspec colwidth="8*" align="left"/>
34672 <colspec colwidth="6*" align="center"/>
34673 <colspec colwidth="6*" align="center"/>
34674 <colspec colwidth="6*" align="right"/>
34675 <tbody>
34676 <row>
34677 <entry><option>forbid_filter_readsocket</option></entry>
34678 <entry>Use: <emphasis>redirect</emphasis></entry>
34679 <entry>Type: <emphasis>boolean</emphasis></entry>
34680 <entry>Default: <emphasis>false</emphasis></entry>
34681 </row>
34682 </tbody>
34683 </tgroup>
34684 </informaltable>
34685 <para>
34686 If this option is true, string expansions in Exim filter files are not allowed
34687 to make use of <option>readsocket</option> items.
34688 </para>
34689 <para>
34690 <indexterm role="option">
34691 <primary><option>forbid_filter_reply</option></primary>
34692 </indexterm>
34693 </para>
34694 <informaltable frame="all">
34695 <tgroup cols="4" colsep="0" rowsep="0">
34696 <colspec colwidth="8*" align="left"/>
34697 <colspec colwidth="6*" align="center"/>
34698 <colspec colwidth="6*" align="center"/>
34699 <colspec colwidth="6*" align="right"/>
34700 <tbody>
34701 <row>
34702 <entry><option>forbid_filter_reply</option></entry>
34703 <entry>Use: <emphasis>redirect</emphasis></entry>
34704 <entry>Type: <emphasis>boolean</emphasis></entry>
34705 <entry>Default: <emphasis>false</emphasis></entry>
34706 </row>
34707 </tbody>
34708 </tgroup>
34709 </informaltable>
34710 <para>
34711 If this option is true, this router may not generate an automatic reply
34712 message. Automatic replies can be generated only from Exim or Sieve filter
34713 files, not from traditional forward files. This option is forced to be true if
34714 <option>one_time</option> is set.
34715 </para>
34716 <para>
34717 <indexterm role="option">
34718 <primary><option>forbid_filter_run</option></primary>
34719 </indexterm>
34720 </para>
34721 <informaltable frame="all">
34722 <tgroup cols="4" colsep="0" rowsep="0">
34723 <colspec colwidth="8*" align="left"/>
34724 <colspec colwidth="6*" align="center"/>
34725 <colspec colwidth="6*" align="center"/>
34726 <colspec colwidth="6*" align="right"/>
34727 <tbody>
34728 <row>
34729 <entry><option>forbid_filter_run</option></entry>
34730 <entry>Use: <emphasis>redirect</emphasis></entry>
34731 <entry>Type: <emphasis>boolean</emphasis></entry>
34732 <entry>Default: <emphasis>false</emphasis></entry>
34733 </row>
34734 </tbody>
34735 </tgroup>
34736 </informaltable>
34737 <para>
34738 If this option is true, string expansions in Exim filter files are not allowed
34739 to make use of <option>run</option> items.
34740 </para>
34741 <para>
34742 <indexterm role="option">
34743 <primary><option>forbid_include</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>forbid_include</option></entry>
34755 <entry>Use: <emphasis>redirect</emphasis></entry>
34756 <entry>Type: <emphasis>boolean</emphasis></entry>
34757 <entry>Default: <emphasis>false</emphasis></entry>
34758 </row>
34759 </tbody>
34760 </tgroup>
34761 </informaltable>
34762 <para>
34763 If this option is true, items of the form
34764 </para>
34765 <literallayout class="monospaced">
34766 :include:&lt;path name&gt;
34767 </literallayout>
34768 <para>
34769 are not permitted in non-filter redirection lists.
34770 </para>
34771 <para>
34772 <indexterm role="option">
34773 <primary><option>forbid_pipe</option></primary>
34774 </indexterm>
34775 </para>
34776 <informaltable frame="all">
34777 <tgroup cols="4" colsep="0" rowsep="0">
34778 <colspec colwidth="8*" align="left"/>
34779 <colspec colwidth="6*" align="center"/>
34780 <colspec colwidth="6*" align="center"/>
34781 <colspec colwidth="6*" align="right"/>
34782 <tbody>
34783 <row>
34784 <entry><option>forbid_pipe</option></entry>
34785 <entry>Use: <emphasis>redirect</emphasis></entry>
34786 <entry>Type: <emphasis>boolean</emphasis></entry>
34787 <entry>Default: <emphasis>false</emphasis></entry>
34788 </row>
34789 </tbody>
34790 </tgroup>
34791 </informaltable>
34792 <para>
34793 <indexterm role="concept">
34794 <primary>delivery</primary>
34795 <secondary>to pipe; forbidding</secondary>
34796 </indexterm>
34797 If this option is true, this router may not generate a new address which
34798 specifies delivery to a pipe, either from an Exim filter or from a conventional
34799 forward file. This option is forced to be true if <option>one_time</option> is set.
34800 </para>
34801 <para>
34802 <indexterm role="option">
34803 <primary><option>forbid_sieve_filter</option></primary>
34804 </indexterm>
34805 </para>
34806 <informaltable frame="all">
34807 <tgroup cols="4" colsep="0" rowsep="0">
34808 <colspec colwidth="8*" align="left"/>
34809 <colspec colwidth="6*" align="center"/>
34810 <colspec colwidth="6*" align="center"/>
34811 <colspec colwidth="6*" align="right"/>
34812 <tbody>
34813 <row>
34814 <entry><option>forbid_sieve_filter</option></entry>
34815 <entry>Use: <emphasis>redirect</emphasis></entry>
34816 <entry>Type: <emphasis>boolean</emphasis></entry>
34817 <entry>Default: <emphasis>false</emphasis></entry>
34818 </row>
34819 </tbody>
34820 </tgroup>
34821 </informaltable>
34822 <para>
34823 If this option is set true, only Exim filters are permitted when
34824 <option>allow_filter</option> is true.
34825 </para>
34826 <para>
34827 <indexterm role="concept">
34828 <primary>SMTP</primary>
34829 <secondary>error codes</secondary>
34830 </indexterm>
34831 <indexterm role="option">
34832 <primary><option>forbid_smtp_code</option></primary>
34833 </indexterm>
34834 </para>
34835 <informaltable frame="all">
34836 <tgroup cols="4" colsep="0" rowsep="0">
34837 <colspec colwidth="8*" align="left"/>
34838 <colspec colwidth="6*" align="center"/>
34839 <colspec colwidth="6*" align="center"/>
34840 <colspec colwidth="6*" align="right"/>
34841 <tbody>
34842 <row>
34843 <entry><option>forbid_smtp_code</option></entry>
34844 <entry>Use: <emphasis>redirect</emphasis></entry>
34845 <entry>Type: <emphasis>boolean</emphasis></entry>
34846 <entry>Default: <emphasis>false</emphasis></entry>
34847 </row>
34848 </tbody>
34849 </tgroup>
34850 </informaltable>
34851 <para>
34852 If this option is set true, any SMTP error codes that are present at the start
34853 of messages specified for <literal>:defer:</literal> or <literal>:fail:</literal> are quietly ignored, and
34854 the default codes (451 and 550, respectively) are always used.
34855 </para>
34856 <para>
34857 <indexterm role="option">
34858 <primary><option>hide_child_in_errmsg</option></primary>
34859 </indexterm>
34860 </para>
34861 <informaltable frame="all">
34862 <tgroup cols="4" colsep="0" rowsep="0">
34863 <colspec colwidth="8*" align="left"/>
34864 <colspec colwidth="6*" align="center"/>
34865 <colspec colwidth="6*" align="center"/>
34866 <colspec colwidth="6*" align="right"/>
34867 <tbody>
34868 <row>
34869 <entry><option>hide_child_in_errmsg</option></entry>
34870 <entry>Use: <emphasis>redirect</emphasis></entry>
34871 <entry>Type: <emphasis>boolean</emphasis></entry>
34872 <entry>Default: <emphasis>false</emphasis></entry>
34873 </row>
34874 </tbody>
34875 </tgroup>
34876 </informaltable>
34877 <para>
34878 <indexterm role="concept">
34879 <primary>bounce message</primary>
34880 <secondary>redirection details; suppressing</secondary>
34881 </indexterm>
34882 If this option is true, it prevents Exim from quoting a child address if it
34883 generates a bounce or delay message for it. Instead it says <quote>an address
34884 generated from &lt;<emphasis>the top level address</emphasis>&gt;</quote>. Of course, this applies only to
34885 bounces generated locally. If a message is forwarded to another host, <emphasis>its</emphasis>
34886 bounce may well quote the generated address.
34887 </para>
34888 <para>
34889 <indexterm role="option">
34890 <primary><option>ignore_eacces</option></primary>
34891 </indexterm>
34892 </para>
34893 <informaltable frame="all">
34894 <tgroup cols="4" colsep="0" rowsep="0">
34895 <colspec colwidth="8*" align="left"/>
34896 <colspec colwidth="6*" align="center"/>
34897 <colspec colwidth="6*" align="center"/>
34898 <colspec colwidth="6*" align="right"/>
34899 <tbody>
34900 <row>
34901 <entry><option>ignore_eacces</option></entry>
34902 <entry>Use: <emphasis>redirect</emphasis></entry>
34903 <entry>Type: <emphasis>boolean</emphasis></entry>
34904 <entry>Default: <emphasis>false</emphasis></entry>
34905 </row>
34906 </tbody>
34907 </tgroup>
34908 </informaltable>
34909 <para>
34910 <indexterm role="concept">
34911 <primary>EACCES</primary>
34912 </indexterm>
34913 If this option is set and an attempt to open a redirection file yields the
34914 EACCES error (permission denied), the <command>redirect</command> router behaves as if the
34915 file did not exist.
34916 </para>
34917 <para>
34918 <indexterm role="option">
34919 <primary><option>ignore_enotdir</option></primary>
34920 </indexterm>
34921 </para>
34922 <informaltable frame="all">
34923 <tgroup cols="4" colsep="0" rowsep="0">
34924 <colspec colwidth="8*" align="left"/>
34925 <colspec colwidth="6*" align="center"/>
34926 <colspec colwidth="6*" align="center"/>
34927 <colspec colwidth="6*" align="right"/>
34928 <tbody>
34929 <row>
34930 <entry><option>ignore_enotdir</option></entry>
34931 <entry>Use: <emphasis>redirect</emphasis></entry>
34932 <entry>Type: <emphasis>boolean</emphasis></entry>
34933 <entry>Default: <emphasis>false</emphasis></entry>
34934 </row>
34935 </tbody>
34936 </tgroup>
34937 </informaltable>
34938 <para>
34939 <indexterm role="concept">
34940 <primary>ENOTDIR</primary>
34941 </indexterm>
34942 If this option is set and an attempt to open a redirection file yields the
34943 ENOTDIR error (something on the path is not a directory), the <command>redirect</command>
34944 router behaves as if the file did not exist.
34945 </para>
34946 <para>
34947 Setting <option>ignore_enotdir</option> has another effect as well: When a <command>redirect</command>
34948 router that has the <option>file</option> option set discovers that the file does not exist
34949 (the ENOENT error), it tries to <function>stat()</function> the parent directory, as a check
34950 against unmounted NFS directories. If the parent can not be statted, delivery
34951 is deferred. However, it seems wrong to do this check when <option>ignore_enotdir</option>
34952 is set, because that option tells Exim to ignore <quote>something on the path is not
34953 a directory</quote> (the ENOTDIR error). This is a confusing area, because it seems
34954 that some operating systems give ENOENT where others give ENOTDIR.
34955 </para>
34956 <para>
34957 <indexterm role="option">
34958 <primary><option>include_directory</option></primary>
34959 </indexterm>
34960 </para>
34961 <informaltable frame="all">
34962 <tgroup cols="4" colsep="0" rowsep="0">
34963 <colspec colwidth="8*" align="left"/>
34964 <colspec colwidth="6*" align="center"/>
34965 <colspec colwidth="6*" align="center"/>
34966 <colspec colwidth="6*" align="right"/>
34967 <tbody>
34968 <row>
34969 <entry><option>include_directory</option></entry>
34970 <entry>Use: <emphasis>redirect</emphasis></entry>
34971 <entry>Type: <emphasis>string</emphasis></entry>
34972 <entry>Default: <emphasis>unset</emphasis></entry>
34973 </row>
34974 </tbody>
34975 </tgroup>
34976 </informaltable>
34977 <para>
34978 If this option is set, the path names of any <emphasis>:include:</emphasis> items in a
34979 redirection list must start with this directory.
34980 </para>
34981 <para>
34982 <indexterm role="option">
34983 <primary><option>modemask</option></primary>
34984 </indexterm>
34985 </para>
34986 <informaltable frame="all">
34987 <tgroup cols="4" colsep="0" rowsep="0">
34988 <colspec colwidth="8*" align="left"/>
34989 <colspec colwidth="6*" align="center"/>
34990 <colspec colwidth="6*" align="center"/>
34991 <colspec colwidth="6*" align="right"/>
34992 <tbody>
34993 <row>
34994 <entry><option>modemask</option></entry>
34995 <entry>Use: <emphasis>redirect</emphasis></entry>
34996 <entry>Type: <emphasis>octal integer</emphasis></entry>
34997 <entry>Default: <emphasis>022</emphasis></entry>
34998 </row>
34999 </tbody>
35000 </tgroup>
35001 </informaltable>
35002 <para>
35003 This specifies mode bits which must not be set for a file specified by the
35004 <option>file</option> option. If any of the forbidden bits are set, delivery is deferred.
35005 </para>
35006 <para>
35007 <indexterm role="option">
35008 <primary><option>one_time</option></primary>
35009 </indexterm>
35010 </para>
35011 <informaltable frame="all">
35012 <tgroup cols="4" colsep="0" rowsep="0">
35013 <colspec colwidth="8*" align="left"/>
35014 <colspec colwidth="6*" align="center"/>
35015 <colspec colwidth="6*" align="center"/>
35016 <colspec colwidth="6*" align="right"/>
35017 <tbody>
35018 <row>
35019 <entry><option>one_time</option></entry>
35020 <entry>Use: <emphasis>redirect</emphasis></entry>
35021 <entry>Type: <emphasis>boolean</emphasis></entry>
35022 <entry>Default: <emphasis>false</emphasis></entry>
35023 </row>
35024 </tbody>
35025 </tgroup>
35026 </informaltable>
35027 <para>
35028 <indexterm role="concept">
35029 <primary>one-time aliasing/forwarding expansion</primary>
35030 </indexterm>
35031 <indexterm role="concept">
35032 <primary>alias file</primary>
35033 <secondary>one-time expansion</secondary>
35034 </indexterm>
35035 <indexterm role="concept">
35036 <primary>forward file</primary>
35037 <secondary>one-time expansion</secondary>
35038 </indexterm>
35039 <indexterm role="concept">
35040 <primary>mailing lists</primary>
35041 <secondary>one-time expansion</secondary>
35042 </indexterm>
35043 <indexterm role="concept">
35044 <primary>address redirection</primary>
35045 <secondary>one-time expansion</secondary>
35046 </indexterm>
35047 Sometimes the fact that Exim re-evaluates aliases and reprocesses redirection
35048 files each time it tries to deliver a message causes a problem when one or more
35049 of the generated addresses fails be delivered at the first attempt. The problem
35050 is not one of duplicate delivery &ndash; Exim is clever enough to handle that &ndash;
35051 but of what happens when the redirection list changes during the time that the
35052 message is on Exim&#x2019;s queue. This is particularly true in the case of mailing
35053 lists, where new subscribers might receive copies of messages that were posted
35054 before they subscribed.
35055 </para>
35056 <para>
35057 If <option>one_time</option> is set and any addresses generated by the router fail to
35058 deliver at the first attempt, the failing addresses are added to the message as
35059 <quote>top level</quote> addresses, and the parent address that generated them is marked
35060 <quote>delivered</quote>. Thus, redirection does not happen again at the next delivery
35061 attempt.
35062 </para>
35063 <para>
35064 <emphasis role="bold">Warning 1</emphasis>: Any header line addition or removal that is specified by this
35065 router would be lost if delivery did not succeed at the first attempt. For this
35066 reason, the <option>headers_add</option> and <option>headers_remove</option> generic options are not
35067 permitted when <option>one_time</option> is set.
35068 </para>
35069 <para>
35070 <emphasis role="bold">Warning 2</emphasis>: To ensure that the router generates only addresses (as opposed
35071 to pipe or file deliveries or auto-replies) <option>forbid_file</option>, <option>forbid_pipe</option>,
35072 and <option>forbid_filter_reply</option> are forced to be true when <option>one_time</option> is set.
35073 </para>
35074 <para>
35075 <emphasis role="bold">Warning 3</emphasis>: The <option>unseen</option> generic router option may not be set with
35076 <option>one_time</option>.
35077 </para>
35078 <para>
35079 The original top-level address is remembered with each of the generated
35080 addresses, and is output in any log messages. However, any intermediate parent
35081 addresses are not recorded. This makes a difference to the log only if
35082 <option>all_parents</option> log selector is set. It is expected that <option>one_time</option> will
35083 typically be used for mailing lists, where there is normally just one level of
35084 expansion.
35085 </para>
35086 <para>
35087 <indexterm role="option">
35088 <primary><option>owners</option></primary>
35089 </indexterm>
35090 </para>
35091 <informaltable frame="all">
35092 <tgroup cols="4" colsep="0" rowsep="0">
35093 <colspec colwidth="8*" align="left"/>
35094 <colspec colwidth="6*" align="center"/>
35095 <colspec colwidth="6*" align="center"/>
35096 <colspec colwidth="6*" align="right"/>
35097 <tbody>
35098 <row>
35099 <entry><option>owners</option></entry>
35100 <entry>Use: <emphasis>redirect</emphasis></entry>
35101 <entry>Type: <emphasis>string list</emphasis></entry>
35102 <entry>Default: <emphasis>unset</emphasis></entry>
35103 </row>
35104 </tbody>
35105 </tgroup>
35106 </informaltable>
35107 <para>
35108 <indexterm role="concept">
35109 <primary>ownership</primary>
35110 <secondary>alias file</secondary>
35111 </indexterm>
35112 <indexterm role="concept">
35113 <primary>ownership</primary>
35114 <secondary>forward file</secondary>
35115 </indexterm>
35116 <indexterm role="concept">
35117 <primary>alias file</primary>
35118 <secondary>ownership</secondary>
35119 </indexterm>
35120 <indexterm role="concept">
35121 <primary>forward file</primary>
35122 <secondary>ownership</secondary>
35123 </indexterm>
35124 This specifies a list of permitted owners for the file specified by <option>file</option>.
35125 This list is in addition to the local user when <option>check_local_user</option> is set.
35126 See <option>check_owner</option> above.
35127 </para>
35128 <para>
35129 <indexterm role="option">
35130 <primary><option>owngroups</option></primary>
35131 </indexterm>
35132 </para>
35133 <informaltable frame="all">
35134 <tgroup cols="4" colsep="0" rowsep="0">
35135 <colspec colwidth="8*" align="left"/>
35136 <colspec colwidth="6*" align="center"/>
35137 <colspec colwidth="6*" align="center"/>
35138 <colspec colwidth="6*" align="right"/>
35139 <tbody>
35140 <row>
35141 <entry><option>owngroups</option></entry>
35142 <entry>Use: <emphasis>redirect</emphasis></entry>
35143 <entry>Type: <emphasis>string list</emphasis></entry>
35144 <entry>Default: <emphasis>unset</emphasis></entry>
35145 </row>
35146 </tbody>
35147 </tgroup>
35148 </informaltable>
35149 <para>
35150 This specifies a list of permitted groups for the file specified by <option>file</option>.
35151 The list is in addition to the local user&#x2019;s primary group when
35152 <option>check_local_user</option> is set. See <option>check_group</option> above.
35153 </para>
35154 <para>
35155 <indexterm role="option">
35156 <primary><option>pipe_transport</option></primary>
35157 </indexterm>
35158 </para>
35159 <informaltable frame="all">
35160 <tgroup cols="4" colsep="0" rowsep="0">
35161 <colspec colwidth="8*" align="left"/>
35162 <colspec colwidth="6*" align="center"/>
35163 <colspec colwidth="6*" align="center"/>
35164 <colspec colwidth="6*" align="right"/>
35165 <tbody>
35166 <row>
35167 <entry><option>pipe_transport</option></entry>
35168 <entry>Use: <emphasis>redirect</emphasis></entry>
35169 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35170 <entry>Default: <emphasis>unset</emphasis></entry>
35171 </row>
35172 </tbody>
35173 </tgroup>
35174 </informaltable>
35175 <para>
35176 <indexterm role="variable">
35177 <primary><varname>$address_pipe</varname></primary>
35178 </indexterm>
35179 A <command>redirect</command> router sets up a direct delivery to a pipe when a string
35180 starting with a vertical bar character is specified as a new <quote>address</quote>. The
35181 transport used is specified by this option, which, after expansion, must be the
35182 name of a configured transport. This should normally be a <command>pipe</command> transport.
35183 When the transport is run, the pipe command is in <varname>$address_pipe</varname>.
35184 </para>
35185 <para>
35186 <indexterm role="option">
35187 <primary><option>qualify_domain</option></primary>
35188 </indexterm>
35189 </para>
35190 <informaltable frame="all">
35191 <tgroup cols="4" colsep="0" rowsep="0">
35192 <colspec colwidth="8*" align="left"/>
35193 <colspec colwidth="6*" align="center"/>
35194 <colspec colwidth="6*" align="center"/>
35195 <colspec colwidth="6*" align="right"/>
35196 <tbody>
35197 <row>
35198 <entry><option>qualify_domain</option></entry>
35199 <entry>Use: <emphasis>redirect</emphasis></entry>
35200 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35201 <entry>Default: <emphasis>unset</emphasis></entry>
35202 </row>
35203 </tbody>
35204 </tgroup>
35205 </informaltable>
35206 <para>
35207 <indexterm role="variable">
35208 <primary><varname>$qualify_recipient</varname></primary>
35209 </indexterm>
35210 If this option is set, and an unqualified address (one without a domain) is
35211 generated, and that address would normally be qualified by the global setting
35212 in <option>qualify_recipient</option>, it is instead qualified with the domain specified by
35213 expanding this string. If the expansion fails, the router declines. If you want
35214 to revert to the default, you can have the expansion generate
35215 <varname>$qualify_recipient</varname>.
35216 </para>
35217 <para>
35218 This option applies to all unqualified addresses generated by Exim filters,
35219 but for traditional <filename>.forward</filename> files, it applies only to addresses that are
35220 not preceded by a backslash. Sieve filters cannot generate unqualified
35221 addresses.
35222 </para>
35223 <para>
35224 <indexterm role="option">
35225 <primary><option>qualify_preserve_domain</option></primary>
35226 </indexterm>
35227 </para>
35228 <informaltable frame="all">
35229 <tgroup cols="4" colsep="0" rowsep="0">
35230 <colspec colwidth="8*" align="left"/>
35231 <colspec colwidth="6*" align="center"/>
35232 <colspec colwidth="6*" align="center"/>
35233 <colspec colwidth="6*" align="right"/>
35234 <tbody>
35235 <row>
35236 <entry><option>qualify_preserve_domain</option></entry>
35237 <entry>Use: <emphasis>redirect</emphasis></entry>
35238 <entry>Type: <emphasis>boolean</emphasis></entry>
35239 <entry>Default: <emphasis>false</emphasis></entry>
35240 </row>
35241 </tbody>
35242 </tgroup>
35243 </informaltable>
35244 <para>
35245 <indexterm role="concept">
35246 <primary>domain</primary>
35247 <secondary>in redirection; preserving</secondary>
35248 </indexterm>
35249 <indexterm role="concept">
35250 <primary>preserving domain in redirection</primary>
35251 </indexterm>
35252 <indexterm role="concept">
35253 <primary>address redirection</primary>
35254 <secondary>domain; preserving</secondary>
35255 </indexterm>
35256 If this option is set, the router&#x2019;s local <option>qualify_domain</option> option must not be
35257 set (a configuration error occurs if it is). If an unqualified address (one
35258 without a domain) is generated, it is qualified with the domain of the parent
35259 address (the immediately preceding ancestor) instead of the global
35260 <option>qualify_recipient</option> value. In the case of a traditional <filename>.forward</filename> file,
35261 this applies whether or not the address is preceded by a backslash.
35262 </para>
35263 <para>
35264 <indexterm role="option">
35265 <primary><option>repeat_use</option></primary>
35266 </indexterm>
35267 </para>
35268 <informaltable frame="all">
35269 <tgroup cols="4" colsep="0" rowsep="0">
35270 <colspec colwidth="8*" align="left"/>
35271 <colspec colwidth="6*" align="center"/>
35272 <colspec colwidth="6*" align="center"/>
35273 <colspec colwidth="6*" align="right"/>
35274 <tbody>
35275 <row>
35276 <entry><option>repeat_use</option></entry>
35277 <entry>Use: <emphasis>redirect</emphasis></entry>
35278 <entry>Type: <emphasis>boolean</emphasis></entry>
35279 <entry>Default: <emphasis>true</emphasis></entry>
35280 </row>
35281 </tbody>
35282 </tgroup>
35283 </informaltable>
35284 <para>
35285 If this option is set false, the router is skipped for a child address that has
35286 any ancestor that was routed by this router. This test happens before any of
35287 the other preconditions are tested. Exim&#x2019;s default anti-looping rules skip
35288 only when the ancestor is the same as the current address. See also
35289 <option>check_ancestor</option> above and the generic <option>redirect_router</option> option.
35290 </para>
35291 <para>
35292 <indexterm role="option">
35293 <primary><option>reply_transport</option></primary>
35294 </indexterm>
35295 </para>
35296 <informaltable frame="all">
35297 <tgroup cols="4" colsep="0" rowsep="0">
35298 <colspec colwidth="8*" align="left"/>
35299 <colspec colwidth="6*" align="center"/>
35300 <colspec colwidth="6*" align="center"/>
35301 <colspec colwidth="6*" align="right"/>
35302 <tbody>
35303 <row>
35304 <entry><option>reply_transport</option></entry>
35305 <entry>Use: <emphasis>redirect</emphasis></entry>
35306 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35307 <entry>Default: <emphasis>unset</emphasis></entry>
35308 </row>
35309 </tbody>
35310 </tgroup>
35311 </informaltable>
35312 <para>
35313 A <command>redirect</command> router sets up an automatic reply when a <option>mail</option> or
35314 <option>vacation</option> command is used in a filter file. The transport used is specified
35315 by this option, which, after expansion, must be the name of a configured
35316 transport. This should normally be an <command>autoreply</command> transport. Other transports
35317 are unlikely to do anything sensible or useful.
35318 </para>
35319 <para>
35320 <indexterm role="option">
35321 <primary><option>rewrite</option></primary>
35322 </indexterm>
35323 </para>
35324 <informaltable frame="all">
35325 <tgroup cols="4" colsep="0" rowsep="0">
35326 <colspec colwidth="8*" align="left"/>
35327 <colspec colwidth="6*" align="center"/>
35328 <colspec colwidth="6*" align="center"/>
35329 <colspec colwidth="6*" align="right"/>
35330 <tbody>
35331 <row>
35332 <entry><option>rewrite</option></entry>
35333 <entry>Use: <emphasis>redirect</emphasis></entry>
35334 <entry>Type: <emphasis>boolean</emphasis></entry>
35335 <entry>Default: <emphasis>true</emphasis></entry>
35336 </row>
35337 </tbody>
35338 </tgroup>
35339 </informaltable>
35340 <para>
35341 <indexterm role="concept">
35342 <primary>address redirection</primary>
35343 <secondary>disabling rewriting</secondary>
35344 </indexterm>
35345 If this option is set false, addresses generated by the router are not
35346 subject to address rewriting. Otherwise, they are treated like new addresses
35347 and are rewritten according to the global rewriting rules.
35348 </para>
35349 <para>
35350 <indexterm role="option">
35351 <primary><option>sieve_subaddress</option></primary>
35352 </indexterm>
35353 </para>
35354 <informaltable frame="all">
35355 <tgroup cols="4" colsep="0" rowsep="0">
35356 <colspec colwidth="8*" align="left"/>
35357 <colspec colwidth="6*" align="center"/>
35358 <colspec colwidth="6*" align="center"/>
35359 <colspec colwidth="6*" align="right"/>
35360 <tbody>
35361 <row>
35362 <entry><option>sieve_subaddress</option></entry>
35363 <entry>Use: <emphasis>redirect</emphasis></entry>
35364 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35365 <entry>Default: <emphasis>unset</emphasis></entry>
35366 </row>
35367 </tbody>
35368 </tgroup>
35369 </informaltable>
35370 <para>
35371 The value of this option is passed to a Sieve filter to specify the
35372 :subaddress part of an address.
35373 </para>
35374 <para>
35375 <indexterm role="option">
35376 <primary><option>sieve_useraddress</option></primary>
35377 </indexterm>
35378 </para>
35379 <informaltable frame="all">
35380 <tgroup cols="4" colsep="0" rowsep="0">
35381 <colspec colwidth="8*" align="left"/>
35382 <colspec colwidth="6*" align="center"/>
35383 <colspec colwidth="6*" align="center"/>
35384 <colspec colwidth="6*" align="right"/>
35385 <tbody>
35386 <row>
35387 <entry><option>sieve_useraddress</option></entry>
35388 <entry>Use: <emphasis>redirect</emphasis></entry>
35389 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35390 <entry>Default: <emphasis>unset</emphasis></entry>
35391 </row>
35392 </tbody>
35393 </tgroup>
35394 </informaltable>
35395 <para>
35396 The value of this option is passed to a Sieve filter to specify the :user part
35397 of an address. However, if it is unset, the entire original local part
35398 (including any prefix or suffix) is used for :user.
35399 </para>
35400 <para>
35401 <indexterm role="option">
35402 <primary><option>sieve_vacation_directory</option></primary>
35403 </indexterm>
35404 </para>
35405 <informaltable frame="all">
35406 <tgroup cols="4" colsep="0" rowsep="0">
35407 <colspec colwidth="8*" align="left"/>
35408 <colspec colwidth="6*" align="center"/>
35409 <colspec colwidth="6*" align="center"/>
35410 <colspec colwidth="6*" align="right"/>
35411 <tbody>
35412 <row>
35413 <entry><option>sieve_vacation_directory</option></entry>
35414 <entry>Use: <emphasis>redirect</emphasis></entry>
35415 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35416 <entry>Default: <emphasis>unset</emphasis></entry>
35417 </row>
35418 </tbody>
35419 </tgroup>
35420 </informaltable>
35421 <para>
35422 <indexterm role="concept">
35423 <primary>Sieve filter</primary>
35424 <secondary>vacation directory</secondary>
35425 </indexterm>
35426 To enable the <quote>vacation</quote> extension for Sieve filters, you must set
35427 <option>sieve_vacation_directory</option> to the directory where vacation databases are held
35428 (do not put anything else in that directory), and ensure that the
35429 <option>reply_transport</option> option refers to an <command>autoreply</command> transport. Each user
35430 needs their own directory; Exim will create it if necessary.
35431 </para>
35432 <para>
35433 <indexterm role="option">
35434 <primary><option>skip_syntax_errors</option></primary>
35435 </indexterm>
35436 </para>
35437 <informaltable frame="all">
35438 <tgroup cols="4" colsep="0" rowsep="0">
35439 <colspec colwidth="8*" align="left"/>
35440 <colspec colwidth="6*" align="center"/>
35441 <colspec colwidth="6*" align="center"/>
35442 <colspec colwidth="6*" align="right"/>
35443 <tbody>
35444 <row>
35445 <entry><option>skip_syntax_errors</option></entry>
35446 <entry>Use: <emphasis>redirect</emphasis></entry>
35447 <entry>Type: <emphasis>boolean</emphasis></entry>
35448 <entry>Default: <emphasis>false</emphasis></entry>
35449 </row>
35450 </tbody>
35451 </tgroup>
35452 </informaltable>
35453 <para>
35454 <indexterm role="concept">
35455 <primary>forward file</primary>
35456 <secondary>broken</secondary>
35457 </indexterm>
35458 <indexterm role="concept">
35459 <primary>address redirection</primary>
35460 <secondary>broken files</secondary>
35461 </indexterm>
35462 <indexterm role="concept">
35463 <primary>alias file</primary>
35464 <secondary>broken</secondary>
35465 </indexterm>
35466 <indexterm role="concept">
35467 <primary>broken alias or forward files</primary>
35468 </indexterm>
35469 <indexterm role="concept">
35470 <primary>ignoring faulty addresses</primary>
35471 </indexterm>
35472 <indexterm role="concept">
35473 <primary>skipping faulty addresses</primary>
35474 </indexterm>
35475 <indexterm role="concept">
35476 <primary>error</primary>
35477 <secondary>skipping bad syntax</secondary>
35478 </indexterm>
35479 If <option>skip_syntax_errors</option> is set, syntactically malformed addresses in
35480 non-filter redirection data are skipped, and each failing address is logged. If
35481 <option>syntax_errors_to</option> is set, a message is sent to the address it defines,
35482 giving details of the failures. If <option>syntax_errors_text</option> is set, its contents
35483 are expanded and placed at the head of the error message generated by
35484 <option>syntax_errors_to</option>. Usually it is appropriate to set <option>syntax_errors_to</option> to
35485 be the same address as the generic <option>errors_to</option> option. The
35486 <option>skip_syntax_errors</option> option is often used when handling mailing lists.
35487 </para>
35488 <para>
35489 If all the addresses in a redirection list are skipped because of syntax
35490 errors, the router declines to handle the original address, and it is passed to
35491 the following routers.
35492 </para>
35493 <para>
35494 If <option>skip_syntax_errors</option> is set when an Exim filter is interpreted, any syntax
35495 error in the filter causes filtering to be abandoned without any action being
35496 taken. The incident is logged, and the router declines to handle the address,
35497 so it is passed to the following routers.
35498 </para>
35499 <para>
35500 <indexterm role="concept">
35501 <primary>Sieve filter</primary>
35502 <secondary>syntax errors in</secondary>
35503 </indexterm>
35504 Syntax errors in a Sieve filter file cause the <quote>keep</quote> action to occur. This
35505 action is specified by RFC 3028. The values of <option>skip_syntax_errors</option>,
35506 <option>syntax_errors_to</option>, and <option>syntax_errors_text</option> are not used.
35507 </para>
35508 <para>
35509 <option>skip_syntax_errors</option> can be used to specify that errors in users&#x2019; forward
35510 lists or filter files should not prevent delivery. The <option>syntax_errors_to</option>
35511 option, used with an address that does not get redirected, can be used to
35512 notify users of these errors, by means of a router like this:
35513 </para>
35514 <literallayout class="monospaced">
35515 userforward:
35516   driver = redirect
35517   allow_filter
35518   check_local_user
35519   file = $home/.forward
35520   file_transport = address_file
35521   pipe_transport = address_pipe
35522   reply_transport = address_reply
35523   no_verify
35524   skip_syntax_errors
35525   syntax_errors_to = real-$local_part@$domain
35526   syntax_errors_text = \
35527    This is an automatically generated message. An error has\n\
35528    been found in your .forward file. Details of the error are\n\
35529    reported below. While this error persists, you will receive\n\
35530    a copy of this message for every message that is addressed\n\
35531    to you. If your .forward file is a filter file, or if it is\n\
35532    a non-filter file containing no valid forwarding addresses,\n\
35533    a copy of each incoming message will be put in your normal\n\
35534    mailbox. If a non-filter file contains at least one valid\n\
35535    forwarding address, forwarding to the valid addresses will\n\
35536    happen, and those will be the only deliveries that occur.
35537 </literallayout>
35538 <para>
35539 You also need a router to ensure that local addresses that are prefixed by
35540 <literal>real-</literal> are recognized, but not forwarded or filtered. For example, you could
35541 put this immediately before the <command>userforward</command> router:
35542 </para>
35543 <literallayout class="monospaced">
35544 real_localuser:
35545   driver = accept
35546   check_local_user
35547   local_part_prefix = real-
35548   transport = local_delivery
35549 </literallayout>
35550 <para>
35551 For security, it would probably be a good idea to restrict the use of this
35552 router to locally-generated messages, using a condition such as this:
35553 </para>
35554 <literallayout class="monospaced">
35555   condition = ${if match {$sender_host_address}\
35556                          {\N^(|127\.0\.0\.1)$\N}}
35557 </literallayout>
35558 <para>
35559 <indexterm role="option">
35560 <primary><option>syntax_errors_text</option></primary>
35561 </indexterm>
35562 </para>
35563 <informaltable frame="all">
35564 <tgroup cols="4" colsep="0" rowsep="0">
35565 <colspec colwidth="8*" align="left"/>
35566 <colspec colwidth="6*" align="center"/>
35567 <colspec colwidth="6*" align="center"/>
35568 <colspec colwidth="6*" align="right"/>
35569 <tbody>
35570 <row>
35571 <entry><option>syntax_errors_text</option></entry>
35572 <entry>Use: <emphasis>redirect</emphasis></entry>
35573 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35574 <entry>Default: <emphasis>unset</emphasis></entry>
35575 </row>
35576 </tbody>
35577 </tgroup>
35578 </informaltable>
35579 <para>
35580 See <option>skip_syntax_errors</option> above.
35581 </para>
35582 <para>
35583 <indexterm role="option">
35584 <primary><option>syntax_errors_to</option></primary>
35585 </indexterm>
35586 </para>
35587 <informaltable frame="all">
35588 <tgroup cols="4" colsep="0" rowsep="0">
35589 <colspec colwidth="8*" align="left"/>
35590 <colspec colwidth="6*" align="center"/>
35591 <colspec colwidth="6*" align="center"/>
35592 <colspec colwidth="6*" align="right"/>
35593 <tbody>
35594 <row>
35595 <entry><option>syntax_errors_to</option></entry>
35596 <entry>Use: <emphasis>redirect</emphasis></entry>
35597 <entry>Type: <emphasis>string</emphasis></entry>
35598 <entry>Default: <emphasis>unset</emphasis></entry>
35599 </row>
35600 </tbody>
35601 </tgroup>
35602 </informaltable>
35603 <para>
35604 See <option>skip_syntax_errors</option> above.
35605 <indexterm role="concept" startref="IIDredrou1" class="endofrange"/>
35606 <indexterm role="concept" startref="IIDredrou2" class="endofrange"/>
35607 </para>
35608 </section>
35609 </chapter>
35610
35611 <chapter id="CHAPenvironment">
35612 <title>Environment for running local transports</title>
35613 <titleabbrev>Environment for local transports</titleabbrev>
35614 <para>
35615 <indexterm role="concept" id="IIDenvlotra1" class="startofrange">
35616 <primary>local transports</primary>
35617 <secondary>environment for</secondary>
35618 </indexterm>
35619 <indexterm role="concept" id="IIDenvlotra2" class="startofrange">
35620 <primary>environment for local transports</primary>
35621 </indexterm>
35622 <indexterm role="concept" id="IIDenvlotra3" class="startofrange">
35623 <primary>transport</primary>
35624 <secondary>local; environment for</secondary>
35625 </indexterm>
35626 Local transports handle deliveries to files and pipes. (The <command>autoreply</command>
35627 transport can be thought of as similar to a pipe.) Exim always runs transports
35628 in subprocesses, under specified uids and gids. Typical deliveries to local
35629 mailboxes run under the uid and gid of the local user.
35630 </para>
35631 <para>
35632 Exim also sets a specific current directory while running the transport; for
35633 some transports a home directory setting is also relevant. The <command>pipe</command>
35634 transport is the only one that sets up environment variables; see section
35635 <xref linkend="SECTpipeenv"/> for details.
35636 </para>
35637 <para>
35638 The values used for the uid, gid, and the directories may come from several
35639 different places. In many cases, the router that handles the address associates
35640 settings with that address as a result of its <option>check_local_user</option>, <option>group</option>,
35641 or <option>user</option> options. However, values may also be given in the transport&#x2019;s own
35642 configuration, and these override anything that comes from the router.
35643 </para>
35644 <section id="SECID131">
35645 <title>Concurrent deliveries</title>
35646 <para>
35647 <indexterm role="concept">
35648 <primary>concurrent deliveries</primary>
35649 </indexterm>
35650 <indexterm role="concept">
35651 <primary>simultaneous deliveries</primary>
35652 </indexterm>
35653 If two different messages for the same local recipient arrive more or less
35654 simultaneously, the two delivery processes are likely to run concurrently. When
35655 the <command>appendfile</command> transport is used to write to a file, Exim applies locking
35656 rules to stop concurrent processes from writing to the same file at the same
35657 time.
35658 </para>
35659 <para>
35660 However, when you use a <command>pipe</command> transport, it is up to you to arrange any
35661 locking that is needed. Here is a silly example:
35662 </para>
35663 <literallayout class="monospaced">
35664 my_transport:
35665   driver = pipe
35666   command = /bin/sh -c 'cat &gt;&gt;/some/file'
35667 </literallayout>
35668 <para>
35669 This is supposed to write the message at the end of the file. However, if two
35670 messages arrive at the same time, the file will be scrambled. You can use the
35671 <option>exim_lock</option> utility program (see section <xref linkend="SECTmailboxmaint"/>) to lock a
35672 file using the same algorithm that Exim itself uses.
35673 </para>
35674 </section>
35675 <section id="SECTenvuidgid">
35676 <title>Uids and gids</title>
35677 <para>
35678 <indexterm role="concept">
35679 <primary>local transports</primary>
35680 <secondary>uid and gid</secondary>
35681 </indexterm>
35682 <indexterm role="concept">
35683 <primary>transport</primary>
35684 <secondary>local; uid and gid</secondary>
35685 </indexterm>
35686 All transports have the options <option>group</option> and <option>user</option>. If <option>group</option> is set, it
35687 overrides any group that the router set in the address, even if <option>user</option> is not
35688 set for the transport. This makes it possible, for example, to run local mail
35689 delivery under the uid of the recipient (set by the router), but in a special
35690 group (set by the transport). For example:
35691 </para>
35692 <literallayout class="monospaced">
35693 # Routers ...
35694 # User/group are set by check_local_user in this router
35695 local_users:
35696   driver = accept
35697   check_local_user
35698   transport = group_delivery
35699
35700 # Transports ...
35701 # This transport overrides the group
35702 group_delivery:
35703   driver = appendfile
35704   file = /var/spool/mail/$local_part
35705   group = mail
35706 </literallayout>
35707 <para>
35708 If <option>user</option> is set for a transport, its value overrides what is set in the
35709 address by the router. If <option>user</option> is non-numeric and <option>group</option> is not set, the
35710 gid associated with the user is used. If <option>user</option> is numeric, <option>group</option> must be
35711 set.
35712 </para>
35713 <para>
35714 <indexterm role="option">
35715 <primary><option>initgroups</option></primary>
35716 </indexterm>
35717 When the uid is taken from the transport&#x2019;s configuration, the <function>initgroups()</function>
35718 function is called for the groups associated with that uid if the
35719 <option>initgroups</option> option is set for the transport. When the uid is not specified
35720 by the transport, but is associated with the address by a router, the option
35721 for calling <function>initgroups()</function> is taken from the router configuration.
35722 </para>
35723 <para>
35724 <indexterm role="concept">
35725 <primary><command>pipe</command> transport</primary>
35726 <secondary>uid for</secondary>
35727 </indexterm>
35728 The <command>pipe</command> transport contains the special option <option>pipe_as_creator</option>. If this
35729 is set and <option>user</option> is not set, the uid of the process that called Exim to
35730 receive the message is used, and if <option>group</option> is not set, the corresponding
35731 original gid is also used.
35732 </para>
35733 <para>
35734 This is the detailed preference order for obtaining a gid; the first of the
35735 following that is set is used:
35736 </para>
35737 <itemizedlist>
35738 <listitem>
35739 <para>
35740 A <option>group</option> setting of the transport;
35741 </para>
35742 </listitem>
35743 <listitem>
35744 <para>
35745 A <option>group</option> setting of the router;
35746 </para>
35747 </listitem>
35748 <listitem>
35749 <para>
35750 A gid associated with a user setting of the router, either as a result of
35751 <option>check_local_user</option> or an explicit non-numeric <option>user</option> setting;
35752 </para>
35753 </listitem>
35754 <listitem>
35755 <para>
35756 The group associated with a non-numeric <option>user</option> setting of the transport;
35757 </para>
35758 </listitem>
35759 <listitem>
35760 <para>
35761 In a <command>pipe</command> transport, the creator&#x2019;s gid if <option>deliver_as_creator</option> is set and
35762 the uid is the creator&#x2019;s uid;
35763 </para>
35764 </listitem>
35765 <listitem>
35766 <para>
35767 The Exim gid if the Exim uid is being used as a default.
35768 </para>
35769 </listitem>
35770 </itemizedlist>
35771 <para>
35772 If, for example, the user is specified numerically on the router and there are
35773 no group settings, no gid is available. In this situation, an error occurs.
35774 This is different for the uid, for which there always is an ultimate default.
35775 The first of the following that is set is used:
35776 </para>
35777 <itemizedlist>
35778 <listitem>
35779 <para>
35780 A <option>user</option> setting of the transport;
35781 </para>
35782 </listitem>
35783 <listitem>
35784 <para>
35785 In a <command>pipe</command> transport, the creator&#x2019;s uid if <option>deliver_as_creator</option> is set;
35786 </para>
35787 </listitem>
35788 <listitem>
35789 <para>
35790 A <option>user</option> setting of the router;
35791 </para>
35792 </listitem>
35793 <listitem>
35794 <para>
35795 A <option>check_local_user</option> setting of the router;
35796 </para>
35797 </listitem>
35798 <listitem>
35799 <para>
35800 The Exim uid.
35801 </para>
35802 </listitem>
35803 </itemizedlist>
35804 <para>
35805 Of course, an error will still occur if the uid that is chosen is on the
35806 <option>never_users</option> list.
35807 </para>
35808 </section>
35809 <section id="SECID132">
35810 <title>Current and home directories</title>
35811 <para>
35812 <indexterm role="concept">
35813 <primary>current directory for local transport</primary>
35814 </indexterm>
35815 <indexterm role="concept">
35816 <primary>home directory</primary>
35817 <secondary>for local transport</secondary>
35818 </indexterm>
35819 <indexterm role="concept">
35820 <primary>transport</primary>
35821 <secondary>local; home directory for</secondary>
35822 </indexterm>
35823 <indexterm role="concept">
35824 <primary>transport</primary>
35825 <secondary>local; current directory for</secondary>
35826 </indexterm>
35827 Routers may set current and home directories for local transports by means of
35828 the <option>transport_current_directory</option> and <option>transport_home_directory</option> options.
35829 However, if the transport&#x2019;s <option>current_directory</option> or <option>home_directory</option> options
35830 are set, they override the router&#x2019;s values. In detail, the home directory
35831 for a local transport is taken from the first of these values that is set:
35832 </para>
35833 <itemizedlist>
35834 <listitem>
35835 <para>
35836 The <option>home_directory</option> option on the transport;
35837 </para>
35838 </listitem>
35839 <listitem>
35840 <para>
35841 The <option>transport_home_directory</option> option on the router;
35842 </para>
35843 </listitem>
35844 <listitem>
35845 <para>
35846 The password data if <option>check_local_user</option> is set on the router;
35847 </para>
35848 </listitem>
35849 <listitem>
35850 <para>
35851 The <option>router_home_directory</option> option on the router.
35852 </para>
35853 </listitem>
35854 </itemizedlist>
35855 <para>
35856 The current directory is taken from the first of these values that is set:
35857 </para>
35858 <itemizedlist>
35859 <listitem>
35860 <para>
35861 The <option>current_directory</option> option on the transport;
35862 </para>
35863 </listitem>
35864 <listitem>
35865 <para>
35866 The <option>transport_current_directory</option> option on the router.
35867 </para>
35868 </listitem>
35869 </itemizedlist>
35870 <para>
35871 If neither the router nor the transport sets a current directory, Exim uses the
35872 value of the home directory, if it is set. Otherwise it sets the current
35873 directory to <filename>/</filename> before running a local transport.
35874 </para>
35875 </section>
35876 <section id="SECID133">
35877 <title>Expansion variables derived from the address</title>
35878 <para>
35879 <indexterm role="variable">
35880 <primary><varname>$domain</varname></primary>
35881 </indexterm>
35882 <indexterm role="variable">
35883 <primary><varname>$local_part</varname></primary>
35884 </indexterm>
35885 <indexterm role="variable">
35886 <primary><varname>$original_domain</varname></primary>
35887 </indexterm>
35888 Normally a local delivery is handling a single address, and in that case the
35889 variables such as <varname>$domain</varname> and <varname>$local_part</varname> are set during local
35890 deliveries. However, in some circumstances more than one address may be handled
35891 at once (for example, while writing batch SMTP for onward transmission by some
35892 other means). In this case, the variables associated with the local part are
35893 never set, <varname>$domain</varname> is set only if all the addresses have the same domain,
35894 and <varname>$original_domain</varname> is never set.
35895 <indexterm role="concept" startref="IIDenvlotra1" class="endofrange"/>
35896 <indexterm role="concept" startref="IIDenvlotra2" class="endofrange"/>
35897 <indexterm role="concept" startref="IIDenvlotra3" class="endofrange"/>
35898 </para>
35899 </section>
35900 </chapter>
35901
35902 <chapter id="CHAPtransportgeneric">
35903 <title>Generic options for transports</title>
35904 <para>
35905 <indexterm role="concept" id="IIDgenoptra1" class="startofrange">
35906 <primary>generic options</primary>
35907 <secondary>transport</secondary>
35908 </indexterm>
35909 <indexterm role="concept" id="IIDgenoptra2" class="startofrange">
35910 <primary>options</primary>
35911 <secondary>generic; for transports</secondary>
35912 </indexterm>
35913 <indexterm role="concept" id="IIDgenoptra3" class="startofrange">
35914 <primary>transport</primary>
35915 <secondary>generic options for</secondary>
35916 </indexterm>
35917 The following generic options apply to all transports:
35918 </para>
35919 <para>
35920 <indexterm role="option">
35921 <primary><option>body_only</option></primary>
35922 </indexterm>
35923 </para>
35924 <informaltable frame="all">
35925 <tgroup cols="4" colsep="0" rowsep="0">
35926 <colspec colwidth="8*" align="left"/>
35927 <colspec colwidth="6*" align="center"/>
35928 <colspec colwidth="6*" align="center"/>
35929 <colspec colwidth="6*" align="right"/>
35930 <tbody>
35931 <row>
35932 <entry><option>body_only</option></entry>
35933 <entry>Use: <emphasis>transports</emphasis></entry>
35934 <entry>Type: <emphasis>boolean</emphasis></entry>
35935 <entry>Default: <emphasis>false</emphasis></entry>
35936 </row>
35937 </tbody>
35938 </tgroup>
35939 </informaltable>
35940 <para>
35941 <indexterm role="concept">
35942 <primary>transport</primary>
35943 <secondary>body only</secondary>
35944 </indexterm>
35945 <indexterm role="concept">
35946 <primary>message</primary>
35947 <secondary>transporting body only</secondary>
35948 </indexterm>
35949 <indexterm role="concept">
35950 <primary>body of message</primary>
35951 <secondary>transporting</secondary>
35952 </indexterm>
35953 If this option is set, the message&#x2019;s headers are not transported. It is
35954 mutually exclusive with <option>headers_only</option>. If it is used with the <command>appendfile</command>
35955 or <command>pipe</command> transports, the settings of <option>message_prefix</option> and
35956 <option>message_suffix</option> should be checked, because this option does not
35957 automatically suppress them.
35958 </para>
35959 <para>
35960 <indexterm role="option">
35961 <primary><option>current_directory</option></primary>
35962 </indexterm>
35963 </para>
35964 <informaltable frame="all">
35965 <tgroup cols="4" colsep="0" rowsep="0">
35966 <colspec colwidth="8*" align="left"/>
35967 <colspec colwidth="6*" align="center"/>
35968 <colspec colwidth="6*" align="center"/>
35969 <colspec colwidth="6*" align="right"/>
35970 <tbody>
35971 <row>
35972 <entry><option>current_directory</option></entry>
35973 <entry>Use: <emphasis>transports</emphasis></entry>
35974 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35975 <entry>Default: <emphasis>unset</emphasis></entry>
35976 </row>
35977 </tbody>
35978 </tgroup>
35979 </informaltable>
35980 <para>
35981 <indexterm role="concept">
35982 <primary>transport</primary>
35983 <secondary>current directory for</secondary>
35984 </indexterm>
35985 This specifies the current directory that is to be set while running the
35986 transport, overriding any value that may have been set by the router.
35987 If the expansion fails for any reason, including forced failure, an error is
35988 logged, and delivery is deferred.
35989 </para>
35990 <para>
35991 <indexterm role="option">
35992 <primary><option>disable_logging</option></primary>
35993 </indexterm>
35994 </para>
35995 <informaltable frame="all">
35996 <tgroup cols="4" colsep="0" rowsep="0">
35997 <colspec colwidth="8*" align="left"/>
35998 <colspec colwidth="6*" align="center"/>
35999 <colspec colwidth="6*" align="center"/>
36000 <colspec colwidth="6*" align="right"/>
36001 <tbody>
36002 <row>
36003 <entry><option>disable_logging</option></entry>
36004 <entry>Use: <emphasis>transports</emphasis></entry>
36005 <entry>Type: <emphasis>boolean</emphasis></entry>
36006 <entry>Default: <emphasis>false</emphasis></entry>
36007 </row>
36008 </tbody>
36009 </tgroup>
36010 </informaltable>
36011 <para>
36012 If this option is set true, nothing is logged for any
36013 deliveries by the transport or for any
36014 transport errors. You should not set this option unless you really, really know
36015 what you are doing.
36016 </para>
36017 <para>
36018 <indexterm role="option">
36019 <primary><option>debug_print</option></primary>
36020 </indexterm>
36021 </para>
36022 <informaltable frame="all">
36023 <tgroup cols="4" colsep="0" rowsep="0">
36024 <colspec colwidth="8*" align="left"/>
36025 <colspec colwidth="6*" align="center"/>
36026 <colspec colwidth="6*" align="center"/>
36027 <colspec colwidth="6*" align="right"/>
36028 <tbody>
36029 <row>
36030 <entry><option>debug_print</option></entry>
36031 <entry>Use: <emphasis>transports</emphasis></entry>
36032 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36033 <entry>Default: <emphasis>unset</emphasis></entry>
36034 </row>
36035 </tbody>
36036 </tgroup>
36037 </informaltable>
36038 <para>
36039 <indexterm role="concept">
36040 <primary>testing</primary>
36041 <secondary>variables in drivers</secondary>
36042 </indexterm>
36043 If this option is set and debugging is enabled (see the <option>-d</option> command line
36044 option), the string is expanded and included in the debugging output when the
36045 transport is run.
36046 If expansion of the string fails, the error message is written to the debugging
36047 output, and Exim carries on processing.
36048 This facility is provided to help with checking out the values of variables and
36049 so on when debugging driver configurations. For example, if a <option>headers_add</option>
36050 option is not working properly, <option>debug_print</option> could be used to output the
36051 variables it references. A newline is added to the text if it does not end with
36052 one.
36053 </para>
36054 <para>
36055 <indexterm role="option">
36056 <primary><option>delivery_date_add</option></primary>
36057 </indexterm>
36058 </para>
36059 <informaltable frame="all">
36060 <tgroup cols="4" colsep="0" rowsep="0">
36061 <colspec colwidth="8*" align="left"/>
36062 <colspec colwidth="6*" align="center"/>
36063 <colspec colwidth="6*" align="center"/>
36064 <colspec colwidth="6*" align="right"/>
36065 <tbody>
36066 <row>
36067 <entry><option>delivery_date_add</option></entry>
36068 <entry>Use: <emphasis>transports</emphasis></entry>
36069 <entry>Type: <emphasis>boolean</emphasis></entry>
36070 <entry>Default: <emphasis>false</emphasis></entry>
36071 </row>
36072 </tbody>
36073 </tgroup>
36074 </informaltable>
36075 <para>
36076 <indexterm role="concept">
36077 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
36078 </indexterm>
36079 If this option is true, a <emphasis>Delivery-date:</emphasis> header is added to the message.
36080 This gives the actual time the delivery was made. As this is not a standard
36081 header, Exim has a configuration option (<option>delivery_date_remove</option>) which
36082 requests its removal from incoming messages, so that delivered messages can
36083 safely be resent to other recipients.
36084 </para>
36085 <para>
36086 <indexterm role="option">
36087 <primary><option>driver</option></primary>
36088 </indexterm>
36089 </para>
36090 <informaltable frame="all">
36091 <tgroup cols="4" colsep="0" rowsep="0">
36092 <colspec colwidth="8*" align="left"/>
36093 <colspec colwidth="6*" align="center"/>
36094 <colspec colwidth="6*" align="center"/>
36095 <colspec colwidth="6*" align="right"/>
36096 <tbody>
36097 <row>
36098 <entry><option>driver</option></entry>
36099 <entry>Use: <emphasis>transports</emphasis></entry>
36100 <entry>Type: <emphasis>string</emphasis></entry>
36101 <entry>Default: <emphasis>unset</emphasis></entry>
36102 </row>
36103 </tbody>
36104 </tgroup>
36105 </informaltable>
36106 <para>
36107 This specifies which of the available transport drivers is to be used.
36108 There is no default, and this option must be set for every transport.
36109 </para>
36110 <para>
36111 <indexterm role="option">
36112 <primary><option>envelope_to_add</option></primary>
36113 </indexterm>
36114 </para>
36115 <informaltable frame="all">
36116 <tgroup cols="4" colsep="0" rowsep="0">
36117 <colspec colwidth="8*" align="left"/>
36118 <colspec colwidth="6*" align="center"/>
36119 <colspec colwidth="6*" align="center"/>
36120 <colspec colwidth="6*" align="right"/>
36121 <tbody>
36122 <row>
36123 <entry><option>envelope_to_add</option></entry>
36124 <entry>Use: <emphasis>transports</emphasis></entry>
36125 <entry>Type: <emphasis>boolean</emphasis></entry>
36126 <entry>Default: <emphasis>false</emphasis></entry>
36127 </row>
36128 </tbody>
36129 </tgroup>
36130 </informaltable>
36131 <para>
36132 <indexterm role="concept">
36133 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
36134 </indexterm>
36135 If this option is true, an <emphasis>Envelope-to:</emphasis> header is added to the message.
36136 This gives the original address(es) in the incoming envelope that caused this
36137 delivery to happen. More than one address may be present if the transport is
36138 configured to handle several addresses at once, or if more than one original
36139 address was redirected to the same final address. As this is not a standard
36140 header, Exim has a configuration option (<option>envelope_to_remove</option>) which requests
36141 its removal from incoming messages, so that delivered messages can safely be
36142 resent to other recipients.
36143 </para>
36144 <para>
36145 <indexterm role="option">
36146 <primary><option>group</option></primary>
36147 </indexterm>
36148 </para>
36149 <informaltable frame="all">
36150 <tgroup cols="4" colsep="0" rowsep="0">
36151 <colspec colwidth="8*" align="left"/>
36152 <colspec colwidth="6*" align="center"/>
36153 <colspec colwidth="6*" align="center"/>
36154 <colspec colwidth="6*" align="right"/>
36155 <tbody>
36156 <row>
36157 <entry><option>group</option></entry>
36158 <entry>Use: <emphasis>transports</emphasis></entry>
36159 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36160 <entry>Default: <emphasis>Exim group</emphasis></entry>
36161 </row>
36162 </tbody>
36163 </tgroup>
36164 </informaltable>
36165 <para>
36166 <indexterm role="concept">
36167 <primary>transport</primary>
36168 <secondary>group; specifying</secondary>
36169 </indexterm>
36170 This option specifies a gid for running the transport process, overriding any
36171 value that the router supplies, and also overriding any value associated with
36172 <option>user</option> (see below).
36173 </para>
36174 <para>
36175 <indexterm role="option">
36176 <primary><option>headers_add</option></primary>
36177 </indexterm>
36178 </para>
36179 <informaltable frame="all">
36180 <tgroup cols="4" colsep="0" rowsep="0">
36181 <colspec colwidth="8*" align="left"/>
36182 <colspec colwidth="6*" align="center"/>
36183 <colspec colwidth="6*" align="center"/>
36184 <colspec colwidth="6*" align="right"/>
36185 <tbody>
36186 <row>
36187 <entry><option>headers_add</option></entry>
36188 <entry>Use: <emphasis>transports</emphasis></entry>
36189 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36190 <entry>Default: <emphasis>unset</emphasis></entry>
36191 </row>
36192 </tbody>
36193 </tgroup>
36194 </informaltable>
36195 <para>
36196 <indexterm role="concept">
36197 <primary>header lines</primary>
36198 <secondary>adding in transport</secondary>
36199 </indexterm>
36200 <indexterm role="concept">
36201 <primary>transport</primary>
36202 <secondary>header lines; adding</secondary>
36203 </indexterm>
36204 This option specifies a string of text that is expanded and added to the header
36205 portion of a message as it is transported, as described in section
36206 <xref linkend="SECTheadersaddrem"/>. Additional header lines can also be specified by
36207 routers. If the result of the expansion is an empty string, or if the expansion
36208 is forced to fail, no action is taken. Other expansion failures are treated as
36209 errors and cause the delivery to be deferred.
36210 </para>
36211 <para>
36212 <indexterm role="option">
36213 <primary><option>headers_only</option></primary>
36214 </indexterm>
36215 </para>
36216 <informaltable frame="all">
36217 <tgroup cols="4" colsep="0" rowsep="0">
36218 <colspec colwidth="8*" align="left"/>
36219 <colspec colwidth="6*" align="center"/>
36220 <colspec colwidth="6*" align="center"/>
36221 <colspec colwidth="6*" align="right"/>
36222 <tbody>
36223 <row>
36224 <entry><option>headers_only</option></entry>
36225 <entry>Use: <emphasis>transports</emphasis></entry>
36226 <entry>Type: <emphasis>boolean</emphasis></entry>
36227 <entry>Default: <emphasis>false</emphasis></entry>
36228 </row>
36229 </tbody>
36230 </tgroup>
36231 </informaltable>
36232 <para>
36233 <indexterm role="concept">
36234 <primary>transport</primary>
36235 <secondary>header lines only</secondary>
36236 </indexterm>
36237 <indexterm role="concept">
36238 <primary>message</primary>
36239 <secondary>transporting headers only</secondary>
36240 </indexterm>
36241 <indexterm role="concept">
36242 <primary>header lines</primary>
36243 <secondary>transporting</secondary>
36244 </indexterm>
36245 If this option is set, the message&#x2019;s body is not transported. It is mutually
36246 exclusive with <option>body_only</option>. If it is used with the <command>appendfile</command> or <command>pipe</command>
36247 transports, the settings of <option>message_prefix</option> and <option>message_suffix</option> should be
36248 checked, since this option does not automatically suppress them.
36249 </para>
36250 <para>
36251 <indexterm role="option">
36252 <primary><option>headers_remove</option></primary>
36253 </indexterm>
36254 </para>
36255 <informaltable frame="all">
36256 <tgroup cols="4" colsep="0" rowsep="0">
36257 <colspec colwidth="8*" align="left"/>
36258 <colspec colwidth="6*" align="center"/>
36259 <colspec colwidth="6*" align="center"/>
36260 <colspec colwidth="6*" align="right"/>
36261 <tbody>
36262 <row>
36263 <entry><option>headers_remove</option></entry>
36264 <entry>Use: <emphasis>transports</emphasis></entry>
36265 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36266 <entry>Default: <emphasis>unset</emphasis></entry>
36267 </row>
36268 </tbody>
36269 </tgroup>
36270 </informaltable>
36271 <para>
36272 <indexterm role="concept">
36273 <primary>header lines</primary>
36274 <secondary>removing</secondary>
36275 </indexterm>
36276 <indexterm role="concept">
36277 <primary>transport</primary>
36278 <secondary>header lines; removing</secondary>
36279 </indexterm>
36280 This option specifies a string that is expanded into a list of header names;
36281 these headers are omitted from the message as it is transported, as described
36282 in section <xref linkend="SECTheadersaddrem"/>. Header removal can also be specified by
36283 routers. If the result of the expansion is an empty string, or if the expansion
36284 is forced to fail, no action is taken. Other expansion failures are treated as
36285 errors and cause the delivery to be deferred.
36286 </para>
36287 <para>
36288 <indexterm role="option">
36289 <primary><option>headers_rewrite</option></primary>
36290 </indexterm>
36291 </para>
36292 <informaltable frame="all">
36293 <tgroup cols="4" colsep="0" rowsep="0">
36294 <colspec colwidth="8*" align="left"/>
36295 <colspec colwidth="6*" align="center"/>
36296 <colspec colwidth="6*" align="center"/>
36297 <colspec colwidth="6*" align="right"/>
36298 <tbody>
36299 <row>
36300 <entry><option>headers_rewrite</option></entry>
36301 <entry>Use: <emphasis>transports</emphasis></entry>
36302 <entry>Type: <emphasis>string</emphasis></entry>
36303 <entry>Default: <emphasis>unset</emphasis></entry>
36304 </row>
36305 </tbody>
36306 </tgroup>
36307 </informaltable>
36308 <para>
36309 <indexterm role="concept">
36310 <primary>transport</primary>
36311 <secondary>header lines; rewriting</secondary>
36312 </indexterm>
36313 <indexterm role="concept">
36314 <primary>rewriting</primary>
36315 <secondary>at transport time</secondary>
36316 </indexterm>
36317 This option allows addresses in header lines to be rewritten at transport time,
36318 that is, as the message is being copied to its destination. The contents of the
36319 option are a colon-separated list of rewriting rules. Each rule is in exactly
36320 the same form as one of the general rewriting rules that are applied when a
36321 message is received. These are described in chapter <xref linkend="CHAPrewrite"/>. For
36322 example,
36323 </para>
36324 <literallayout class="monospaced">
36325 headers_rewrite = a@b c@d f : \
36326                   x@y w@z
36327 </literallayout>
36328 <para>
36329 changes <emphasis>a@b</emphasis> into <emphasis>c@d</emphasis> in <emphasis>From:</emphasis> header lines, and <emphasis>x@y</emphasis> into
36330 <emphasis>w@z</emphasis> in all address-bearing header lines. The rules are applied to the
36331 header lines just before they are written out at transport time, so they affect
36332 only those copies of the message that pass through the transport. However, only
36333 the message&#x2019;s original header lines, and any that were added by a system
36334 filter, are rewritten. If a router or transport adds header lines, they are not
36335 affected by this option. These rewriting rules are <emphasis>not</emphasis> applied to the
36336 envelope. You can change the return path using <option>return_path</option>, but you cannot
36337 change envelope recipients at this time.
36338 </para>
36339 <para>
36340 <indexterm role="option">
36341 <primary><option>home_directory</option></primary>
36342 </indexterm>
36343 </para>
36344 <informaltable frame="all">
36345 <tgroup cols="4" colsep="0" rowsep="0">
36346 <colspec colwidth="8*" align="left"/>
36347 <colspec colwidth="6*" align="center"/>
36348 <colspec colwidth="6*" align="center"/>
36349 <colspec colwidth="6*" align="right"/>
36350 <tbody>
36351 <row>
36352 <entry><option>home_directory</option></entry>
36353 <entry>Use: <emphasis>transports</emphasis></entry>
36354 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36355 <entry>Default: <emphasis>unset</emphasis></entry>
36356 </row>
36357 </tbody>
36358 </tgroup>
36359 </informaltable>
36360 <para>
36361 <indexterm role="concept">
36362 <primary>transport</primary>
36363 <secondary>home directory for</secondary>
36364 </indexterm>
36365 <indexterm role="variable">
36366 <primary><varname>$home</varname></primary>
36367 </indexterm>
36368 This option specifies a home directory setting for a local transport,
36369 overriding any value that may be set by the router. The home directory is
36370 placed in <varname>$home</varname> while expanding the transport&#x2019;s private options. It is also
36371 used as the current directory if no current directory is set by the
36372 <option>current_directory</option> option on the transport or the
36373 <option>transport_current_directory</option> option on the router. If the expansion fails
36374 for any reason, including forced failure, an error is logged, and delivery is
36375 deferred.
36376 </para>
36377 <para>
36378 <indexterm role="option">
36379 <primary><option>initgroups</option></primary>
36380 </indexterm>
36381 </para>
36382 <informaltable frame="all">
36383 <tgroup cols="4" colsep="0" rowsep="0">
36384 <colspec colwidth="8*" align="left"/>
36385 <colspec colwidth="6*" align="center"/>
36386 <colspec colwidth="6*" align="center"/>
36387 <colspec colwidth="6*" align="right"/>
36388 <tbody>
36389 <row>
36390 <entry><option>initgroups</option></entry>
36391 <entry>Use: <emphasis>transports</emphasis></entry>
36392 <entry>Type: <emphasis>boolean</emphasis></entry>
36393 <entry>Default: <emphasis>false</emphasis></entry>
36394 </row>
36395 </tbody>
36396 </tgroup>
36397 </informaltable>
36398 <para>
36399 <indexterm role="concept">
36400 <primary>additional groups</primary>
36401 </indexterm>
36402 <indexterm role="concept">
36403 <primary>groups</primary>
36404 <secondary>additional</secondary>
36405 </indexterm>
36406 <indexterm role="concept">
36407 <primary>transport</primary>
36408 <secondary>group; additional</secondary>
36409 </indexterm>
36410 If this option is true and the uid for the delivery process is provided by the
36411 transport, the <function>initgroups()</function> function is called when running the transport
36412 to ensure that any additional groups associated with the uid are set up.
36413 </para>
36414 <para>
36415 <indexterm role="option">
36416 <primary><option>message_size_limit</option></primary>
36417 </indexterm>
36418 </para>
36419 <informaltable frame="all">
36420 <tgroup cols="4" colsep="0" rowsep="0">
36421 <colspec colwidth="8*" align="left"/>
36422 <colspec colwidth="6*" align="center"/>
36423 <colspec colwidth="6*" align="center"/>
36424 <colspec colwidth="6*" align="right"/>
36425 <tbody>
36426 <row>
36427 <entry><option>message_size_limit</option></entry>
36428 <entry>Use: <emphasis>transports</emphasis></entry>
36429 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36430 <entry>Default: <emphasis>0</emphasis></entry>
36431 </row>
36432 </tbody>
36433 </tgroup>
36434 </informaltable>
36435 <para>
36436 <indexterm role="concept">
36437 <primary>limit</primary>
36438 <secondary>message size per transport</secondary>
36439 </indexterm>
36440 <indexterm role="concept">
36441 <primary>size</primary>
36442 <secondary>of message, limit</secondary>
36443 </indexterm>
36444 <indexterm role="concept">
36445 <primary>transport</primary>
36446 <secondary>message size; limiting</secondary>
36447 </indexterm>
36448 This option controls the size of messages passed through the transport. It is
36449 expanded before use; the result of the expansion must be a sequence of decimal
36450 digits, optionally followed by K or M. If the expansion fails for any reason,
36451 including forced failure, or if the result is not of the required form,
36452 delivery is deferred. If the value is greater than zero and the size of a
36453 message exceeds this limit, the address is failed. If there is any chance that
36454 the resulting bounce message could be routed to the same transport, you should
36455 ensure that <option>return_size_limit</option> is less than the transport&#x2019;s
36456 <option>message_size_limit</option>, as otherwise the bounce message will fail to get
36457 delivered.
36458 </para>
36459 <para>
36460 <indexterm role="option">
36461 <primary><option>rcpt_include_affixes</option></primary>
36462 </indexterm>
36463 </para>
36464 <informaltable frame="all">
36465 <tgroup cols="4" colsep="0" rowsep="0">
36466 <colspec colwidth="8*" align="left"/>
36467 <colspec colwidth="6*" align="center"/>
36468 <colspec colwidth="6*" align="center"/>
36469 <colspec colwidth="6*" align="right"/>
36470 <tbody>
36471 <row>
36472 <entry><option>rcpt_include_affixes</option></entry>
36473 <entry>Use: <emphasis>transports</emphasis></entry>
36474 <entry>Type: <emphasis>boolean</emphasis></entry>
36475 <entry>Default: <emphasis>false</emphasis></entry>
36476 </row>
36477 </tbody>
36478 </tgroup>
36479 </informaltable>
36480 <para>
36481 <indexterm role="concept">
36482 <primary>prefix</primary>
36483 <secondary>for local part, including in envelope</secondary>
36484 </indexterm>
36485 <indexterm role="concept">
36486 <primary>suffix for local part</primary>
36487 <secondary>including in envelope</secondary>
36488 </indexterm>
36489 <indexterm role="concept">
36490 <primary>local part</primary>
36491 <secondary>prefix</secondary>
36492 </indexterm>
36493 <indexterm role="concept">
36494 <primary>local part</primary>
36495 <secondary>suffix</secondary>
36496 </indexterm>
36497 When this option is false (the default), and an address that has had any
36498 affixes (prefixes or suffixes) removed from the local part is delivered by any
36499 form of SMTP or LMTP, the affixes are not included. For example, if a router
36500 that contains
36501 </para>
36502 <literallayout class="monospaced">
36503 local_part_prefix = *-
36504 </literallayout>
36505 <para>
36506 routes the address <emphasis>abc-xyz@some.domain</emphasis> to an SMTP transport, the envelope
36507 is delivered with
36508 </para>
36509 <literallayout class="monospaced">
36510 RCPT TO:&lt;xyz@some.domain&gt;
36511 </literallayout>
36512 <para>
36513 This is also the case when an ACL-time callout is being used to verify a
36514 recipient address. However, if <option>rcpt_include_affixes</option> is set true, the
36515 whole local part is included in the RCPT command. This option applies to BSMTP
36516 deliveries by the <command>appendfile</command> and <command>pipe</command> transports as well as to the
36517 <command>lmtp</command> and <command>smtp</command> transports.
36518 </para>
36519 <para>
36520 <indexterm role="option">
36521 <primary><option>retry_use_local_part</option></primary>
36522 </indexterm>
36523 </para>
36524 <informaltable frame="all">
36525 <tgroup cols="4" colsep="0" rowsep="0">
36526 <colspec colwidth="8*" align="left"/>
36527 <colspec colwidth="6*" align="center"/>
36528 <colspec colwidth="6*" align="center"/>
36529 <colspec colwidth="6*" align="right"/>
36530 <tbody>
36531 <row>
36532 <entry><option>retry_use_local_part</option></entry>
36533 <entry>Use: <emphasis>transports</emphasis></entry>
36534 <entry>Type: <emphasis>boolean</emphasis></entry>
36535 <entry>Default: <emphasis>see below</emphasis></entry>
36536 </row>
36537 </tbody>
36538 </tgroup>
36539 </informaltable>
36540 <para>
36541 <indexterm role="concept">
36542 <primary>hints database</primary>
36543 <secondary>retry keys</secondary>
36544 </indexterm>
36545 When a delivery suffers a temporary failure, a retry record is created
36546 in Exim&#x2019;s hints database. For remote deliveries, the key for the retry record
36547 is based on the name and/or IP address of the failing remote host. For local
36548 deliveries, the key is normally the entire address, including both the local
36549 part and the domain. This is suitable for most common cases of local delivery
36550 temporary failure &ndash; for example, exceeding a mailbox quota should delay only
36551 deliveries to that mailbox, not to the whole domain.
36552 </para>
36553 <para>
36554 However, in some special cases you may want to treat a temporary local delivery
36555 as a failure associated with the domain, and not with a particular local part.
36556 (For example, if you are storing all mail for some domain in files.) You can do
36557 this by setting <option>retry_use_local_part</option> false.
36558 </para>
36559 <para>
36560 For all the local transports, its default value is true. For remote transports,
36561 the default value is false for tidiness, but changing the value has no effect
36562 on a remote transport in the current implementation.
36563 </para>
36564 <para>
36565 <indexterm role="option">
36566 <primary><option>return_path</option></primary>
36567 </indexterm>
36568 </para>
36569 <informaltable frame="all">
36570 <tgroup cols="4" colsep="0" rowsep="0">
36571 <colspec colwidth="8*" align="left"/>
36572 <colspec colwidth="6*" align="center"/>
36573 <colspec colwidth="6*" align="center"/>
36574 <colspec colwidth="6*" align="right"/>
36575 <tbody>
36576 <row>
36577 <entry><option>return_path</option></entry>
36578 <entry>Use: <emphasis>transports</emphasis></entry>
36579 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36580 <entry>Default: <emphasis>unset</emphasis></entry>
36581 </row>
36582 </tbody>
36583 </tgroup>
36584 </informaltable>
36585 <para>
36586 <indexterm role="concept">
36587 <primary>envelope sender</primary>
36588 </indexterm>
36589 <indexterm role="concept">
36590 <primary>transport</primary>
36591 <secondary>return path; changing</secondary>
36592 </indexterm>
36593 <indexterm role="concept">
36594 <primary>return path</primary>
36595 <secondary>changing in transport</secondary>
36596 </indexterm>
36597 If this option is set, the string is expanded at transport time and replaces
36598 the existing return path (envelope sender) value in the copy of the message
36599 that is being delivered. An empty return path is permitted. This feature is
36600 designed for remote deliveries, where the value of this option is used in the
36601 SMTP MAIL command. If you set <option>return_path</option> for a local transport, the
36602 only effect is to change the address that is placed in the <emphasis>Return-path:</emphasis>
36603 header line, if one is added to the message (see the next option).
36604 </para>
36605 <para>
36606 <emphasis role="bold">Note:</emphasis> A changed return path is not logged unless you add
36607 <option>return_path_on_delivery</option> to the log selector.
36608 </para>
36609 <para>
36610 <indexterm role="variable">
36611 <primary><varname>$return_path</varname></primary>
36612 </indexterm>
36613 The expansion can refer to the existing value via <varname>$return_path</varname>. This is
36614 either the message&#x2019;s envelope sender, or an address set by the
36615 <option>errors_to</option> option on a router. If the expansion is forced to fail, no
36616 replacement occurs; if it fails for another reason, delivery is deferred. This
36617 option can be used to support VERP (Variable Envelope Return Paths) &ndash; see
36618 section <xref linkend="SECTverp"/>.
36619 </para>
36620 <para>
36621 <emphasis role="bold">Note</emphasis>: If a delivery error is detected locally, including the case when a
36622 remote server rejects a message at SMTP time, the bounce message is not sent to
36623 the value of this option. It is sent to the previously set errors address.
36624 This defaults to the incoming sender address, but can be changed by setting
36625 <option>errors_to</option> in a router.
36626 </para>
36627 <para>
36628 <indexterm role="option">
36629 <primary><option>return_path_add</option></primary>
36630 </indexterm>
36631 </para>
36632 <informaltable frame="all">
36633 <tgroup cols="4" colsep="0" rowsep="0">
36634 <colspec colwidth="8*" align="left"/>
36635 <colspec colwidth="6*" align="center"/>
36636 <colspec colwidth="6*" align="center"/>
36637 <colspec colwidth="6*" align="right"/>
36638 <tbody>
36639 <row>
36640 <entry><option>return_path_add</option></entry>
36641 <entry>Use: <emphasis>transports</emphasis></entry>
36642 <entry>Type: <emphasis>boolean</emphasis></entry>
36643 <entry>Default: <emphasis>false</emphasis></entry>
36644 </row>
36645 </tbody>
36646 </tgroup>
36647 </informaltable>
36648 <para>
36649 <indexterm role="concept">
36650 <primary><emphasis>Return-path:</emphasis> header line</primary>
36651 </indexterm>
36652 If this option is true, a <emphasis>Return-path:</emphasis> header is added to the message.
36653 Although the return path is normally available in the prefix line of BSD
36654 mailboxes, this is commonly not displayed by MUAs, and so the user does not
36655 have easy access to it.
36656 </para>
36657 <para>
36658 RFC 2821 states that the <emphasis>Return-path:</emphasis> header is added to a message <quote>when
36659 the delivery SMTP server makes the final delivery</quote>. This implies that this
36660 header should not be present in incoming messages. Exim has a configuration
36661 option, <option>return_path_remove</option>, which requests removal of this header from
36662 incoming messages, so that delivered messages can safely be resent to other
36663 recipients.
36664 </para>
36665 <para>
36666 <indexterm role="option">
36667 <primary><option>shadow_condition</option></primary>
36668 </indexterm>
36669 </para>
36670 <informaltable frame="all">
36671 <tgroup cols="4" colsep="0" rowsep="0">
36672 <colspec colwidth="8*" align="left"/>
36673 <colspec colwidth="6*" align="center"/>
36674 <colspec colwidth="6*" align="center"/>
36675 <colspec colwidth="6*" align="right"/>
36676 <tbody>
36677 <row>
36678 <entry><option>shadow_condition</option></entry>
36679 <entry>Use: <emphasis>transports</emphasis></entry>
36680 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36681 <entry>Default: <emphasis>unset</emphasis></entry>
36682 </row>
36683 </tbody>
36684 </tgroup>
36685 </informaltable>
36686 <para>
36687 See <option>shadow_transport</option> below.
36688 </para>
36689 <para>
36690 <indexterm role="option">
36691 <primary><option>shadow_transport</option></primary>
36692 </indexterm>
36693 </para>
36694 <informaltable frame="all">
36695 <tgroup cols="4" colsep="0" rowsep="0">
36696 <colspec colwidth="8*" align="left"/>
36697 <colspec colwidth="6*" align="center"/>
36698 <colspec colwidth="6*" align="center"/>
36699 <colspec colwidth="6*" align="right"/>
36700 <tbody>
36701 <row>
36702 <entry><option>shadow_transport</option></entry>
36703 <entry>Use: <emphasis>transports</emphasis></entry>
36704 <entry>Type: <emphasis>string</emphasis></entry>
36705 <entry>Default: <emphasis>unset</emphasis></entry>
36706 </row>
36707 </tbody>
36708 </tgroup>
36709 </informaltable>
36710 <para>
36711 <indexterm role="concept">
36712 <primary>shadow transport</primary>
36713 </indexterm>
36714 <indexterm role="concept">
36715 <primary>transport</primary>
36716 <secondary>shadow</secondary>
36717 </indexterm>
36718 A local transport may set the <option>shadow_transport</option> option to the name of
36719 another local transport. Shadow remote transports are not supported.
36720 </para>
36721 <para>
36722 Whenever a delivery to the main transport succeeds, and either
36723 <option>shadow_condition</option> is unset, or its expansion does not result in the empty
36724 string or one of the strings <quote>0</quote> or <quote>no</quote> or <quote>false</quote>, the message is also
36725 passed to the shadow transport, with the same delivery address or addresses. If
36726 expansion fails, no action is taken except that non-forced expansion failures
36727 cause a log line to be written.
36728 </para>
36729 <para>
36730 The result of the shadow transport is discarded and does not affect the
36731 subsequent processing of the message. Only a single level of shadowing is
36732 provided; the <option>shadow_transport</option> option is ignored on any transport when it
36733 is running as a shadow. Options concerned with output from pipes are also
36734 ignored. The log line for the successful delivery has an item added on the end,
36735 of the form
36736 </para>
36737 <literallayout class="monospaced">
36738 ST=&lt;shadow transport name&gt;
36739 </literallayout>
36740 <para>
36741 If the shadow transport did not succeed, the error message is put in
36742 parentheses afterwards. Shadow transports can be used for a number of different
36743 purposes, including keeping more detailed log information than Exim normally
36744 provides, and implementing automatic acknowledgment policies based on message
36745 headers that some sites insist on.
36746 </para>
36747 <para>
36748 <indexterm role="option">
36749 <primary><option>transport_filter</option></primary>
36750 </indexterm>
36751 </para>
36752 <informaltable frame="all">
36753 <tgroup cols="4" colsep="0" rowsep="0">
36754 <colspec colwidth="8*" align="left"/>
36755 <colspec colwidth="6*" align="center"/>
36756 <colspec colwidth="6*" align="center"/>
36757 <colspec colwidth="6*" align="right"/>
36758 <tbody>
36759 <row>
36760 <entry><option>transport_filter</option></entry>
36761 <entry>Use: <emphasis>transports</emphasis></entry>
36762 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36763 <entry>Default: <emphasis>unset</emphasis></entry>
36764 </row>
36765 </tbody>
36766 </tgroup>
36767 </informaltable>
36768 <para>
36769 <indexterm role="concept">
36770 <primary>transport</primary>
36771 <secondary>filter</secondary>
36772 </indexterm>
36773 <indexterm role="concept">
36774 <primary>filter</primary>
36775 <secondary>transport filter</secondary>
36776 </indexterm>
36777 This option sets up a filtering (in the Unix shell sense) process for messages
36778 at transport time. It should not be confused with mail filtering as set up by
36779 individual users or via a system filter.
36780 </para>
36781 <para>
36782 When the message is about to be written out, the command specified by
36783 <option>transport_filter</option> is started up in a separate, parallel process, and
36784 the entire message, including the header lines, is passed to it on its standard
36785 input (this in fact is done from a third process, to avoid deadlock). The
36786 command must be specified as an absolute path.
36787 </para>
36788 <para>
36789 The lines of the message that are written to the transport filter are
36790 terminated by newline (<quote>\n</quote>). The message is passed to the filter before any
36791 SMTP-specific processing, such as turning <quote>\n</quote> into <quote>\r\n</quote> and escaping
36792 lines beginning with a dot, and also before any processing implied by the
36793 settings of <option>check_string</option> and <option>escape_string</option> in the <command>appendfile</command> or
36794 <command>pipe</command> transports.
36795 </para>
36796 <para>
36797 The standard error for the filter process is set to the same destination as its
36798 standard output; this is read and written to the message&#x2019;s ultimate
36799 destination. The process that writes the message to the filter, the
36800 filter itself, and the original process that reads the result and delivers it
36801 are all run in parallel, like a shell pipeline.
36802 </para>
36803 <para>
36804 The filter can perform any transformations it likes, but of course should take
36805 care not to break RFC 2822 syntax. Exim does not check the result, except to
36806 test for a final newline when SMTP is in use. All messages transmitted over
36807 SMTP must end with a newline, so Exim supplies one if it is missing.
36808 </para>
36809 <para>
36810 <indexterm role="concept">
36811 <primary>content scanning</primary>
36812 <secondary>per user</secondary>
36813 </indexterm>
36814 A transport filter can be used to provide content-scanning on a per-user basis
36815 at delivery time if the only required effect of the scan is to modify the
36816 message. For example, a content scan could insert a new header line containing
36817 a spam score. This could be interpreted by a filter in the user&#x2019;s MUA. It is
36818 not possible to discard a message at this stage.
36819 </para>
36820 <para>
36821 <indexterm role="concept">
36822 <primary>SMTP</primary>
36823 <secondary>SIZE</secondary>
36824 </indexterm>
36825 A problem might arise if the filter increases the size of a message that is
36826 being sent down an SMTP connection. If the receiving SMTP server has indicated
36827 support for the SIZE parameter, Exim will have sent the size of the message
36828 at the start of the SMTP session. If what is actually sent is substantially
36829 more, the server might reject the message. This can be worked round by setting
36830 the <option>size_addition</option> option on the <command>smtp</command> transport, either to allow for
36831 additions to the message, or to disable the use of SIZE altogether.
36832 </para>
36833 <para>
36834 <indexterm role="variable">
36835 <primary><varname>$pipe_addresses</varname></primary>
36836 </indexterm>
36837 The value of the <option>transport_filter</option> option is the command string for starting
36838 the filter, which is run directly from Exim, not under a shell. The string is
36839 parsed by Exim in the same way as a command string for the <command>pipe</command> transport:
36840 Exim breaks it up into arguments and then expands each argument separately (see
36841 section <xref linkend="SECThowcommandrun"/>). Any kind of expansion failure causes delivery
36842 to be deferred. The special argument <varname>$pipe_addresses</varname> is replaced by a number
36843 of arguments, one for each address that applies to this delivery. (This isn&#x2019;t
36844 an ideal name for this feature here, but as it was already implemented for the
36845 <command>pipe</command> transport, it seemed sensible not to change it.)
36846 </para>
36847 <para>
36848 <indexterm role="variable">
36849 <primary><varname>$host</varname></primary>
36850 </indexterm>
36851 <indexterm role="variable">
36852 <primary><varname>$host_address</varname></primary>
36853 </indexterm>
36854 The expansion variables <varname>$host</varname> and <varname>$host_address</varname> are available when the
36855 transport is a remote one. They contain the name and IP address of the host to
36856 which the message is being sent. For example:
36857 </para>
36858 <literallayout class="monospaced">
36859 transport_filter = /some/directory/transport-filter.pl \
36860   $host $host_address $sender_address $pipe_addresses
36861 </literallayout>
36862 <para>
36863 Two problems arise if you want to use more complicated expansion items to
36864 generate transport filter commands, both of which due to the fact that the
36865 command is split up <emphasis>before</emphasis> expansion.
36866 </para>
36867 <itemizedlist>
36868 <listitem>
36869 <para>
36870 If an expansion item contains white space, you must quote it, so that it is all
36871 part of the same command item. If the entire option setting is one such
36872 expansion item, you have to take care what kind of quoting you use. For
36873 example:
36874 </para>
36875 <literallayout class="monospaced">
36876 transport_filter = '/bin/cmd${if eq{$host}{a.b.c}{1}{2}}'
36877 </literallayout>
36878 <para>
36879 This runs the command <command>/bin/cmd1</command> if the host name is <emphasis>a.b.c</emphasis>, and
36880 <command>/bin/cmd2</command> otherwise. If double quotes had been used, they would have been
36881 stripped by Exim when it read the option&#x2019;s value. When the value is used, if
36882 the single quotes were missing, the line would be split into two items,
36883 <literal>/bin/cmd${if</literal> and <literal>eq{$host}{a.b.c}{1}{2}</literal>, and an error would occur when
36884 Exim tried to expand the first one.
36885 </para>
36886 </listitem>
36887 <listitem>
36888 <para>
36889 Except for the special case of <varname>$pipe_addresses</varname> that is mentioned above, an
36890 expansion cannot generate multiple arguments, or a command name followed by
36891 arguments. Consider this example:
36892 </para>
36893 <literallayout class="monospaced">
36894 transport_filter = ${lookup{$host}lsearch{/a/file}\
36895                     {$value}{/bin/cat}}
36896 </literallayout>
36897 <para>
36898 The result of the lookup is interpreted as the name of the command, even
36899 if it contains white space. The simplest way round this is to use a shell:
36900 </para>
36901 <literallayout class="monospaced">
36902 transport_filter = /bin/sh -c ${lookup{$host}lsearch{/a/file}\
36903                                {$value}{/bin/cat}}
36904 </literallayout>
36905 </listitem>
36906 </itemizedlist>
36907 <para>
36908 The filter process is run under the same uid and gid as the normal delivery.
36909 For remote deliveries this is the Exim uid/gid by default. The command should
36910 normally yield a zero return code. Transport filters are not supposed to fail.
36911 A non-zero code is taken to mean that the transport filter encountered some
36912 serious problem. Delivery of the message is deferred; the message remains on
36913 the queue and is tried again later. It is not possible to cause a message to be
36914 bounced from a transport filter.
36915 </para>
36916 <para>
36917 If a transport filter is set on an autoreply transport, the original message is
36918 passed through the filter as it is being copied into the newly generated
36919 message, which happens if the <option>return_message</option> option is set.
36920 </para>
36921 <para>
36922 <indexterm role="option">
36923 <primary><option>transport_filter_timeout</option></primary>
36924 </indexterm>
36925 </para>
36926 <informaltable frame="all">
36927 <tgroup cols="4" colsep="0" rowsep="0">
36928 <colspec colwidth="8*" align="left"/>
36929 <colspec colwidth="6*" align="center"/>
36930 <colspec colwidth="6*" align="center"/>
36931 <colspec colwidth="6*" align="right"/>
36932 <tbody>
36933 <row>
36934 <entry><option>transport_filter_timeout</option></entry>
36935 <entry>Use: <emphasis>transports</emphasis></entry>
36936 <entry>Type: <emphasis>time</emphasis></entry>
36937 <entry>Default: <emphasis>5m</emphasis></entry>
36938 </row>
36939 </tbody>
36940 </tgroup>
36941 </informaltable>
36942 <para>
36943 <indexterm role="concept">
36944 <primary>transport</primary>
36945 <secondary>filter, timeout</secondary>
36946 </indexterm>
36947 When Exim is reading the output of a transport filter, it a applies a timeout
36948 that can be set by this option. Exceeding the timeout is normally treated as a
36949 temporary delivery failure. However, if a transport filter is used with a
36950 <command>pipe</command> transport, a timeout in the transport filter is treated in the same
36951 way as a timeout in the pipe command itself. By default, a timeout is a hard
36952 error, but if the <command>pipe</command> transport&#x2019;s <option>timeout_defer</option> option is set true, it
36953 becomes a temporary error.
36954 </para>
36955 <para>
36956 <indexterm role="option">
36957 <primary><option>user</option></primary>
36958 </indexterm>
36959 </para>
36960 <informaltable frame="all">
36961 <tgroup cols="4" colsep="0" rowsep="0">
36962 <colspec colwidth="8*" align="left"/>
36963 <colspec colwidth="6*" align="center"/>
36964 <colspec colwidth="6*" align="center"/>
36965 <colspec colwidth="6*" align="right"/>
36966 <tbody>
36967 <row>
36968 <entry><option>user</option></entry>
36969 <entry>Use: <emphasis>transports</emphasis></entry>
36970 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36971 <entry>Default: <emphasis>Exim user</emphasis></entry>
36972 </row>
36973 </tbody>
36974 </tgroup>
36975 </informaltable>
36976 <para>
36977 <indexterm role="concept">
36978 <primary>uid (user id)</primary>
36979 <secondary>local delivery</secondary>
36980 </indexterm>
36981 <indexterm role="concept">
36982 <primary>transport</primary>
36983 <secondary>user, specifying</secondary>
36984 </indexterm>
36985 This option specifies the user under whose uid the delivery process is to be
36986 run, overriding any uid that may have been set by the router. If the user is
36987 given as a name, the uid is looked up from the password data, and the
36988 associated group is taken as the value of the gid to be used if the <option>group</option>
36989 option is not set.
36990 </para>
36991 <para>
36992 For deliveries that use local transports, a user and group are normally
36993 specified explicitly or implicitly (for example, as a result of
36994 <option>check_local_user</option>) by the router or transport.
36995 </para>
36996 <para>
36997 <indexterm role="concept">
36998 <primary>hints database</primary>
36999 <secondary>access by remote transport</secondary>
37000 </indexterm>
37001 For remote transports, you should leave this option unset unless you really are
37002 sure you know what you are doing. When a remote transport is running, it needs
37003 to be able to access Exim&#x2019;s hints databases, because each host may have its own
37004 retry data.
37005 <indexterm role="concept" startref="IIDgenoptra1" class="endofrange"/>
37006 <indexterm role="concept" startref="IIDgenoptra2" class="endofrange"/>
37007 <indexterm role="concept" startref="IIDgenoptra3" class="endofrange"/>
37008 </para>
37009 </chapter>
37010
37011 <chapter id="CHAPbatching">
37012 <title>Address batching in local transports</title>
37013 <titleabbrev>Address batching</titleabbrev>
37014 <para>
37015 <indexterm role="concept">
37016 <primary>transport</primary>
37017 <secondary>local; address batching in</secondary>
37018 </indexterm>
37019 The only remote transport (<command>smtp</command>) is normally configured to handle more than
37020 one address at a time, so that when several addresses are routed to the same
37021 remote host, just one copy of the message is sent. Local transports, however,
37022 normally handle one address at a time. That is, a separate instance of the
37023 transport is run for each address that is routed to the transport. A separate
37024 copy of the message is delivered each time.
37025 </para>
37026 <para>
37027 <indexterm role="concept">
37028 <primary>batched local delivery</primary>
37029 </indexterm>
37030 <indexterm role="option">
37031 <primary><option>batch_max</option></primary>
37032 </indexterm>
37033 <indexterm role="option">
37034 <primary><option>batch_id</option></primary>
37035 </indexterm>
37036 In special cases, it may be desirable to handle several addresses at once in a
37037 local transport, for example:
37038 </para>
37039 <itemizedlist>
37040 <listitem>
37041 <para>
37042 In an <command>appendfile</command> transport, when storing messages in files for later
37043 delivery by some other means, a single copy of the message with multiple
37044 recipients saves space.
37045 </para>
37046 </listitem>
37047 <listitem>
37048 <para>
37049 In an <command>lmtp</command> transport, when delivering over <quote>local SMTP</quote> to some process,
37050 a single copy saves time, and is the normal way LMTP is expected to work.
37051 </para>
37052 </listitem>
37053 <listitem>
37054 <para>
37055 In a <command>pipe</command> transport, when passing the message
37056 to a scanner program or
37057 to some other delivery mechanism such as UUCP, multiple recipients may be
37058 acceptable.
37059 </para>
37060 </listitem>
37061 </itemizedlist>
37062 <para>
37063 These three local transports all have the same options for controlling multiple
37064 (<quote>batched</quote>) deliveries, namely <option>batch_max</option> and <option>batch_id</option>. To save
37065 repeating the information for each transport, these options are described here.
37066 </para>
37067 <para>
37068 The <option>batch_max</option> option specifies the maximum number of addresses that can be
37069 delivered together in a single run of the transport. Its default value is one
37070 (no batching). When more than one address is routed to a transport that has a
37071 <option>batch_max</option> value greater than one, the addresses are delivered in a batch
37072 (that is, in a single run of the transport with multiple recipients), subject
37073 to certain conditions:
37074 </para>
37075 <itemizedlist>
37076 <listitem>
37077 <para>
37078 <indexterm role="variable">
37079 <primary><varname>$local_part</varname></primary>
37080 </indexterm>
37081 If any of the transport&#x2019;s options contain a reference to <varname>$local_part</varname>, no
37082 batching is possible.
37083 </para>
37084 </listitem>
37085 <listitem>
37086 <para>
37087 <indexterm role="variable">
37088 <primary><varname>$domain</varname></primary>
37089 </indexterm>
37090 If any of the transport&#x2019;s options contain a reference to <varname>$domain</varname>, only
37091 addresses with the same domain are batched.
37092 </para>
37093 </listitem>
37094 <listitem>
37095 <para>
37096 <indexterm role="concept">
37097 <primary>customizing</primary>
37098 <secondary>batching condition</secondary>
37099 </indexterm>
37100 If <option>batch_id</option> is set, it is expanded for each address, and only those
37101 addresses with the same expanded value are batched. This allows you to specify
37102 customized batching conditions. Failure of the expansion for any reason,
37103 including forced failure, disables batching, but it does not stop the delivery
37104 from taking place.
37105 </para>
37106 </listitem>
37107 <listitem>
37108 <para>
37109 Batched addresses must also have the same errors address (where to send
37110 delivery errors), the same header additions and removals, the same user and
37111 group for the transport, and if a host list is present, the first host must
37112 be the same.
37113 </para>
37114 </listitem>
37115 </itemizedlist>
37116 <para>
37117 In the case of the <command>appendfile</command> and <command>pipe</command> transports, batching applies
37118 both when the file or pipe command is specified in the transport, and when it
37119 is specified by a <command>redirect</command> router, but all the batched addresses must of
37120 course be routed to the same file or pipe command. These two transports have an
37121 option called <option>use_bsmtp</option>, which causes them to deliver the message in
37122 <quote>batched SMTP</quote> format, with the envelope represented as SMTP commands. The
37123 <option>check_string</option> and <option>escape_string</option> options are forced to the values
37124 </para>
37125 <literallayout class="monospaced">
37126 check_string = "."
37127 escape_string = ".."
37128 </literallayout>
37129 <para>
37130 when batched SMTP is in use. A full description of the batch SMTP mechanism is
37131 given in section <xref linkend="SECTbatchSMTP"/>. The <command>lmtp</command> transport does not have a
37132 <option>use_bsmtp</option> option, because it always delivers using the SMTP protocol.
37133 </para>
37134 <para>
37135 <indexterm role="concept">
37136 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
37137 </indexterm>
37138 If the generic <option>envelope_to_add</option> option is set for a batching transport, the
37139 <emphasis>Envelope-to:</emphasis> header that is added to the message contains all the addresses
37140 that are being processed together. If you are using a batching <command>appendfile</command>
37141 transport without <option>use_bsmtp</option>, the only way to preserve the recipient
37142 addresses is to set the <option>envelope_to_add</option> option.
37143 </para>
37144 <para>
37145 <indexterm role="concept">
37146 <primary><command>pipe</command> transport</primary>
37147 <secondary>with multiple addresses</secondary>
37148 </indexterm>
37149 <indexterm role="variable">
37150 <primary><varname>$pipe_addresses</varname></primary>
37151 </indexterm>
37152 If you are using a <command>pipe</command> transport without BSMTP, and setting the
37153 transport&#x2019;s <option>command</option> option, you can include <varname>$pipe_addresses</varname> as part of
37154 the command. This is not a true variable; it is a bit of magic that causes each
37155 of the recipient addresses to be inserted into the command as a separate
37156 argument. This provides a way of accessing all the addresses that are being
37157 delivered in the batch. <emphasis role="bold">Note:</emphasis> This is not possible for pipe commands that
37158 are specified by a <command>redirect</command> router.
37159 </para>
37160 </chapter>
37161
37162 <chapter id="CHAPappendfile">
37163 <title>The appendfile transport</title>
37164 <para>
37165 <indexterm role="concept" id="IIDapptra1" class="startofrange">
37166 <primary><command>appendfile</command> transport</primary>
37167 </indexterm>
37168 <indexterm role="concept" id="IIDapptra2" class="startofrange">
37169 <primary>transports</primary>
37170 <secondary><command>appendfile</command></secondary>
37171 </indexterm>
37172 <indexterm role="concept">
37173 <primary>directory creation</primary>
37174 </indexterm>
37175 <indexterm role="concept">
37176 <primary>creating directories</primary>
37177 </indexterm>
37178 The <command>appendfile</command> transport delivers a message by appending it to an existing
37179 file, or by creating an entirely new file in a specified directory. Single
37180 files to which messages are appended can be in the traditional Unix mailbox
37181 format, or optionally in the MBX format supported by the Pine MUA and
37182 University of Washington IMAP daemon, <emphasis>inter alia</emphasis>. When each message is
37183 being delivered as a separate file, <quote>maildir</quote> format can optionally be used
37184 to give added protection against failures that happen part-way through the
37185 delivery. A third form of separate-file delivery known as <quote>mailstore</quote> is also
37186 supported. For all file formats, Exim attempts to create as many levels of
37187 directory as necessary, provided that <option>create_directory</option> is set.
37188 </para>
37189 <para>
37190 The code for the optional formats is not included in the Exim binary by
37191 default. It is necessary to set SUPPORT_MBX, SUPPORT_MAILDIR and/or
37192 SUPPORT_MAILSTORE in <filename>Local/Makefile</filename> to have the appropriate code
37193 included.
37194 </para>
37195 <para>
37196 <indexterm role="concept">
37197 <primary>quota</primary>
37198 <secondary>system</secondary>
37199 </indexterm>
37200 Exim recognizes system quota errors, and generates an appropriate message. Exim
37201 also supports its own quota control within the transport, for use when the
37202 system facility is unavailable or cannot be used for some reason.
37203 </para>
37204 <para>
37205 If there is an error while appending to a file (for example, quota exceeded or
37206 partition filled), Exim attempts to reset the file&#x2019;s length and last
37207 modification time back to what they were before. If there is an error while
37208 creating an entirely new file, the new file is removed.
37209 </para>
37210 <para>
37211 Before appending to a file, a number of security checks are made, and the
37212 file is locked. A detailed description is given below, after the list of
37213 private options.
37214 </para>
37215 <para>
37216 The <command>appendfile</command> transport is most commonly used for local deliveries to
37217 users&#x2019; mailboxes. However, it can also be used as a pseudo-remote transport for
37218 putting messages into files for remote delivery by some means other than Exim.
37219 <quote>Batch SMTP</quote> format is often used in this case (see the <option>use_bsmtp</option>
37220 option).
37221 </para>
37222 <section id="SECTfildiropt">
37223 <title>The file and directory options</title>
37224 <para>
37225 The <option>file</option> option specifies a single file, to which the message is appended;
37226 the <option>directory</option> option specifies a directory, in which a new file containing
37227 the message is created. Only one of these two options can be set, and for
37228 normal deliveries to mailboxes, one of them <emphasis>must</emphasis> be set.
37229 </para>
37230 <para>
37231 <indexterm role="variable">
37232 <primary><varname>$address_file</varname></primary>
37233 </indexterm>
37234 <indexterm role="variable">
37235 <primary><varname>$local_part</varname></primary>
37236 </indexterm>
37237 However, <command>appendfile</command> is also used for delivering messages to files or
37238 directories whose names (or parts of names) are obtained from alias,
37239 forwarding, or filtering operations (for example, a <option>save</option> command in a
37240 user&#x2019;s Exim filter). When such a transport is running, <varname>$local_part</varname> contains
37241 the local part that was aliased or forwarded, and <varname>$address_file</varname> contains the
37242 name (or partial name) of the file or directory generated by the redirection
37243 operation. There are two cases:
37244 </para>
37245 <itemizedlist>
37246 <listitem>
37247 <para>
37248 If neither <option>file</option> nor <option>directory</option> is set, the redirection operation
37249 must specify an absolute path (one that begins with <literal>/</literal>). This is the most
37250 common case when users with local accounts use filtering to sort mail into
37251 different folders. See for example, the <command>address_file</command> transport in the
37252 default configuration. If the path ends with a slash, it is assumed to be the
37253 name of a directory. A delivery to a directory can also be forced by setting
37254 <option>maildir_format</option> or <option>mailstore_format</option>.
37255 </para>
37256 </listitem>
37257 <listitem>
37258 <para>
37259 If <option>file</option> or <option>directory</option> is set for a delivery from a redirection, it is
37260 used to determine the file or directory name for the delivery. Normally, the
37261 contents of <varname>$address_file</varname> are used in some way in the string expansion.
37262 </para>
37263 </listitem>
37264 </itemizedlist>
37265 <para>
37266 <indexterm role="concept">
37267 <primary>Sieve filter</primary>
37268 <secondary>configuring <command>appendfile</command></secondary>
37269 </indexterm>
37270 <indexterm role="concept">
37271 <primary>Sieve filter</primary>
37272 <secondary>relative mailbox path handling</secondary>
37273 </indexterm>
37274 As an example of the second case, consider an environment where users do not
37275 have home directories. They may be permitted to use Exim filter commands of the
37276 form:
37277 </para>
37278 <literallayout class="monospaced">
37279 save folder23
37280 </literallayout>
37281 <para>
37282 or Sieve filter commands of the form:
37283 </para>
37284 <literallayout class="monospaced">
37285 require "fileinto";
37286 fileinto "folder23";
37287 </literallayout>
37288 <para>
37289 In this situation, the expansion of <option>file</option> or <option>directory</option> in the transport
37290 must transform the relative path into an appropriate absolute file name. In the
37291 case of Sieve filters, the name <emphasis>inbox</emphasis> must be handled. It is the name that
37292 is used as a result of a <quote>keep</quote> action in the filter. This example shows one
37293 way of handling this requirement:
37294 </para>
37295 <literallayout class="monospaced">
37296 file = ${if eq{$address_file}{inbox} \
37297             {/var/mail/$local_part} \
37298             {${if eq{${substr_0_1:$address_file}}{/} \
37299                   {$address_file} \
37300                   {$home/mail/$address_file} \
37301             }} \
37302        }
37303 </literallayout>
37304 <para>
37305 With this setting of <option>file</option>, <emphasis>inbox</emphasis> refers to the standard mailbox
37306 location, absolute paths are used without change, and other folders are in the
37307 <filename>mail</filename> directory within the home directory.
37308 </para>
37309 <para>
37310 <emphasis role="bold">Note 1</emphasis>: While processing an Exim filter, a relative path such as
37311 <filename>folder23</filename> is turned into an absolute path if a home directory is known to
37312 the router. In particular, this is the case if <option>check_local_user</option> is set. If
37313 you want to prevent this happening at routing time, you can set
37314 <option>router_home_directory</option> empty. This forces the router to pass the relative
37315 path to the transport.
37316 </para>
37317 <para>
37318 <emphasis role="bold">Note 2</emphasis>: An absolute path in <varname>$address_file</varname> is not treated specially;
37319 the <option>file</option> or <option>directory</option> option is still used if it is set.
37320 </para>
37321 </section>
37322 <section id="SECID134">
37323 <title>Private options for appendfile</title>
37324 <para>
37325 <indexterm role="concept">
37326 <primary>options</primary>
37327 <secondary><command>appendfile</command> transport</secondary>
37328 </indexterm>
37329 </para>
37330 <para>
37331 <indexterm role="option">
37332 <primary><option>allow_fifo</option></primary>
37333 </indexterm>
37334 </para>
37335 <informaltable frame="all">
37336 <tgroup cols="4" colsep="0" rowsep="0">
37337 <colspec colwidth="8*" align="left"/>
37338 <colspec colwidth="6*" align="center"/>
37339 <colspec colwidth="6*" align="center"/>
37340 <colspec colwidth="6*" align="right"/>
37341 <tbody>
37342 <row>
37343 <entry><option>allow_fifo</option></entry>
37344 <entry>Use: <emphasis>appendfile</emphasis></entry>
37345 <entry>Type: <emphasis>boolean</emphasis></entry>
37346 <entry>Default: <emphasis>false</emphasis></entry>
37347 </row>
37348 </tbody>
37349 </tgroup>
37350 </informaltable>
37351 <para>
37352 <indexterm role="concept">
37353 <primary>fifo (named pipe)</primary>
37354 </indexterm>
37355 <indexterm role="concept">
37356 <primary>named pipe (fifo)</primary>
37357 </indexterm>
37358 <indexterm role="concept">
37359 <primary>pipe</primary>
37360 <secondary>named (fifo)</secondary>
37361 </indexterm>
37362 Setting this option permits delivery to named pipes (FIFOs) as well as to
37363 regular files. If no process is reading the named pipe at delivery time, the
37364 delivery is deferred.
37365 </para>
37366 <para>
37367 <indexterm role="option">
37368 <primary><option>allow_symlink</option></primary>
37369 </indexterm>
37370 </para>
37371 <informaltable frame="all">
37372 <tgroup cols="4" colsep="0" rowsep="0">
37373 <colspec colwidth="8*" align="left"/>
37374 <colspec colwidth="6*" align="center"/>
37375 <colspec colwidth="6*" align="center"/>
37376 <colspec colwidth="6*" align="right"/>
37377 <tbody>
37378 <row>
37379 <entry><option>allow_symlink</option></entry>
37380 <entry>Use: <emphasis>appendfile</emphasis></entry>
37381 <entry>Type: <emphasis>boolean</emphasis></entry>
37382 <entry>Default: <emphasis>false</emphasis></entry>
37383 </row>
37384 </tbody>
37385 </tgroup>
37386 </informaltable>
37387 <para>
37388 <indexterm role="concept">
37389 <primary>symbolic link</primary>
37390 <secondary>to mailbox</secondary>
37391 </indexterm>
37392 <indexterm role="concept">
37393 <primary>mailbox</primary>
37394 <secondary>symbolic link</secondary>
37395 </indexterm>
37396 By default, <command>appendfile</command> will not deliver if the path name for the file is
37397 that of a symbolic link. Setting this option relaxes that constraint, but there
37398 are security issues involved in the use of symbolic links. Be sure you know
37399 what you are doing if you set this. Details of exactly what this option affects
37400 are included in the discussion which follows this list of options.
37401 </para>
37402 <para>
37403 <indexterm role="option">
37404 <primary><option>batch_id</option></primary>
37405 </indexterm>
37406 </para>
37407 <informaltable frame="all">
37408 <tgroup cols="4" colsep="0" rowsep="0">
37409 <colspec colwidth="8*" align="left"/>
37410 <colspec colwidth="6*" align="center"/>
37411 <colspec colwidth="6*" align="center"/>
37412 <colspec colwidth="6*" align="right"/>
37413 <tbody>
37414 <row>
37415 <entry><option>batch_id</option></entry>
37416 <entry>Use: <emphasis>appendfile</emphasis></entry>
37417 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37418 <entry>Default: <emphasis>unset</emphasis></entry>
37419 </row>
37420 </tbody>
37421 </tgroup>
37422 </informaltable>
37423 <para>
37424 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
37425 However, batching is automatically disabled for <command>appendfile</command> deliveries that
37426 happen as a result of forwarding or aliasing or other redirection directly to a
37427 file.
37428 </para>
37429 <para>
37430 <indexterm role="option">
37431 <primary><option>batch_max</option></primary>
37432 </indexterm>
37433 </para>
37434 <informaltable frame="all">
37435 <tgroup cols="4" colsep="0" rowsep="0">
37436 <colspec colwidth="8*" align="left"/>
37437 <colspec colwidth="6*" align="center"/>
37438 <colspec colwidth="6*" align="center"/>
37439 <colspec colwidth="6*" align="right"/>
37440 <tbody>
37441 <row>
37442 <entry><option>batch_max</option></entry>
37443 <entry>Use: <emphasis>appendfile</emphasis></entry>
37444 <entry>Type: <emphasis>integer</emphasis></entry>
37445 <entry>Default: <emphasis>1</emphasis></entry>
37446 </row>
37447 </tbody>
37448 </tgroup>
37449 </informaltable>
37450 <para>
37451 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
37452 </para>
37453 <para>
37454 <indexterm role="option">
37455 <primary><option>check_group</option></primary>
37456 </indexterm>
37457 </para>
37458 <informaltable frame="all">
37459 <tgroup cols="4" colsep="0" rowsep="0">
37460 <colspec colwidth="8*" align="left"/>
37461 <colspec colwidth="6*" align="center"/>
37462 <colspec colwidth="6*" align="center"/>
37463 <colspec colwidth="6*" align="right"/>
37464 <tbody>
37465 <row>
37466 <entry><option>check_group</option></entry>
37467 <entry>Use: <emphasis>appendfile</emphasis></entry>
37468 <entry>Type: <emphasis>boolean</emphasis></entry>
37469 <entry>Default: <emphasis>false</emphasis></entry>
37470 </row>
37471 </tbody>
37472 </tgroup>
37473 </informaltable>
37474 <para>
37475 When this option is set, the group owner of the file defined by the <option>file</option>
37476 option is checked to see that it is the same as the group under which the
37477 delivery process is running. The default setting is false because the default
37478 file mode is 0600, which means that the group is irrelevant.
37479 </para>
37480 <para>
37481 <indexterm role="option">
37482 <primary><option>check_owner</option></primary>
37483 </indexterm>
37484 </para>
37485 <informaltable frame="all">
37486 <tgroup cols="4" colsep="0" rowsep="0">
37487 <colspec colwidth="8*" align="left"/>
37488 <colspec colwidth="6*" align="center"/>
37489 <colspec colwidth="6*" align="center"/>
37490 <colspec colwidth="6*" align="right"/>
37491 <tbody>
37492 <row>
37493 <entry><option>check_owner</option></entry>
37494 <entry>Use: <emphasis>appendfile</emphasis></entry>
37495 <entry>Type: <emphasis>boolean</emphasis></entry>
37496 <entry>Default: <emphasis>true</emphasis></entry>
37497 </row>
37498 </tbody>
37499 </tgroup>
37500 </informaltable>
37501 <para>
37502 When this option is set, the owner of the file defined by the <option>file</option> option
37503 is checked to ensure that it is the same as the user under which the delivery
37504 process is running.
37505 </para>
37506 <para>
37507 <indexterm role="option">
37508 <primary><option>check_string</option></primary>
37509 </indexterm>
37510 </para>
37511 <informaltable frame="all">
37512 <tgroup cols="4" colsep="0" rowsep="0">
37513 <colspec colwidth="8*" align="left"/>
37514 <colspec colwidth="6*" align="center"/>
37515 <colspec colwidth="6*" align="center"/>
37516 <colspec colwidth="6*" align="right"/>
37517 <tbody>
37518 <row>
37519 <entry><option>check_string</option></entry>
37520 <entry>Use: <emphasis>appendfile</emphasis></entry>
37521 <entry>Type: <emphasis>string</emphasis></entry>
37522 <entry>Default: <emphasis>see below</emphasis></entry>
37523 </row>
37524 </tbody>
37525 </tgroup>
37526 </informaltable>
37527 <para>
37528 <indexterm role="concept">
37529 <primary><quote>From</quote> line</primary>
37530 </indexterm>
37531 As <command>appendfile</command> writes the message, the start of each line is tested for
37532 matching <option>check_string</option>, and if it does, the initial matching characters are
37533 replaced by the contents of <option>escape_string</option>. The value of <option>check_string</option> is
37534 a literal string, not a regular expression, and the case of any letters it
37535 contains is significant.
37536 </para>
37537 <para>
37538 If <option>use_bsmtp</option> is set the values of <option>check_string</option> and <option>escape_string</option>
37539 are forced to <quote>.</quote> and <quote>..</quote> respectively, and any settings in the
37540 configuration are ignored. Otherwise, they default to <quote>From&nbsp;</quote> and
37541 <quote>&gt;From&nbsp;</quote> when the <option>file</option> option is set, and unset when any of the
37542 <option>directory</option>, <option>maildir</option>, or <option>mailstore</option> options are set.
37543 </para>
37544 <para>
37545 The default settings, along with <option>message_prefix</option> and <option>message_suffix</option>, are
37546 suitable for traditional <quote>BSD</quote> mailboxes, where a line beginning with
37547 <quote>From&nbsp;</quote> indicates the start of a new message. All four options need changing
37548 if another format is used. For example, to deliver to mailboxes in MMDF format:
37549 <indexterm role="concept">
37550 <primary>MMDF format mailbox</primary>
37551 </indexterm>
37552 <indexterm role="concept">
37553 <primary>mailbox</primary>
37554 <secondary>MMDF format</secondary>
37555 </indexterm>
37556 </para>
37557 <literallayout class="monospaced">
37558 check_string = "\1\1\1\1\n"
37559 escape_string = "\1\1\1\1 \n"
37560 message_prefix = "\1\1\1\1\n"
37561 message_suffix = "\1\1\1\1\n"
37562 </literallayout>
37563 <para>
37564 <indexterm role="option">
37565 <primary><option>create_directory</option></primary>
37566 </indexterm>
37567 </para>
37568 <informaltable frame="all">
37569 <tgroup cols="4" colsep="0" rowsep="0">
37570 <colspec colwidth="8*" align="left"/>
37571 <colspec colwidth="6*" align="center"/>
37572 <colspec colwidth="6*" align="center"/>
37573 <colspec colwidth="6*" align="right"/>
37574 <tbody>
37575 <row>
37576 <entry><option>create_directory</option></entry>
37577 <entry>Use: <emphasis>appendfile</emphasis></entry>
37578 <entry>Type: <emphasis>boolean</emphasis></entry>
37579 <entry>Default: <emphasis>true</emphasis></entry>
37580 </row>
37581 </tbody>
37582 </tgroup>
37583 </informaltable>
37584 <para>
37585 <indexterm role="concept">
37586 <primary>directory creation</primary>
37587 </indexterm>
37588 When this option is true, Exim attempts to create any missing superior
37589 directories for the file that it is about to write. A created directory&#x2019;s mode
37590 is given by the <option>directory_mode</option> option.
37591 </para>
37592 <para>
37593 The group ownership of a newly created directory is highly dependent on the
37594 operating system (and possibly the file system) that is being used. For
37595 example, in Solaris, if the parent directory has the setgid bit set, its group
37596 is propagated to the child; if not, the currently set group is used. However,
37597 in FreeBSD, the parent&#x2019;s group is always used.
37598 </para>
37599 <para>
37600 <indexterm role="option">
37601 <primary><option>create_file</option></primary>
37602 </indexterm>
37603 </para>
37604 <informaltable frame="all">
37605 <tgroup cols="4" colsep="0" rowsep="0">
37606 <colspec colwidth="8*" align="left"/>
37607 <colspec colwidth="6*" align="center"/>
37608 <colspec colwidth="6*" align="center"/>
37609 <colspec colwidth="6*" align="right"/>
37610 <tbody>
37611 <row>
37612 <entry><option>create_file</option></entry>
37613 <entry>Use: <emphasis>appendfile</emphasis></entry>
37614 <entry>Type: <emphasis>string</emphasis></entry>
37615 <entry>Default: <emphasis>anywhere</emphasis></entry>
37616 </row>
37617 </tbody>
37618 </tgroup>
37619 </informaltable>
37620 <para>
37621 This option constrains the location of files and directories that are created
37622 by this transport. It applies to files defined by the <option>file</option> option and
37623 directories defined by the <option>directory</option> option. In the case of maildir
37624 delivery, it applies to the top level directory, not the maildir directories
37625 beneath.
37626 </para>
37627 <para>
37628 The option must be set to one of the words <quote>anywhere</quote>, <quote>inhome</quote>, or
37629 <quote>belowhome</quote>. In the second and third cases, a home directory must have been
37630 set for the transport. This option is not useful when an explicit file name is
37631 given for normal mailbox deliveries. It is intended for the case when file
37632 names are generated from users&#x2019; <filename>.forward</filename> files. These are usually handled
37633 by an <command>appendfile</command> transport called <option>address_file</option>. See also
37634 <option>file_must_exist</option>.
37635 </para>
37636 <para>
37637 <indexterm role="option">
37638 <primary><option>directory</option></primary>
37639 </indexterm>
37640 </para>
37641 <informaltable frame="all">
37642 <tgroup cols="4" colsep="0" rowsep="0">
37643 <colspec colwidth="8*" align="left"/>
37644 <colspec colwidth="6*" align="center"/>
37645 <colspec colwidth="6*" align="center"/>
37646 <colspec colwidth="6*" align="right"/>
37647 <tbody>
37648 <row>
37649 <entry><option>directory</option></entry>
37650 <entry>Use: <emphasis>appendfile</emphasis></entry>
37651 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37652 <entry>Default: <emphasis>unset</emphasis></entry>
37653 </row>
37654 </tbody>
37655 </tgroup>
37656 </informaltable>
37657 <para>
37658 This option is mutually exclusive with the <option>file</option> option, but one of <option>file</option>
37659 or <option>directory</option> must be set, unless the delivery is the direct result of a
37660 redirection (see section <xref linkend="SECTfildiropt"/>).
37661 </para>
37662 <para>
37663 When <option>directory</option> is set, the string is expanded, and the message is delivered
37664 into a new file or files in or below the given directory, instead of being
37665 appended to a single mailbox file. A number of different formats are provided
37666 (see <option>maildir_format</option> and <option>mailstore_format</option>), and see section
37667 <xref linkend="SECTopdir"/> for further details of this form of delivery.
37668 </para>
37669 <para>
37670 <indexterm role="option">
37671 <primary><option>directory_file</option></primary>
37672 </indexterm>
37673 </para>
37674 <informaltable frame="all">
37675 <tgroup cols="4" colsep="0" rowsep="0">
37676 <colspec colwidth="8*" align="left"/>
37677 <colspec colwidth="6*" align="center"/>
37678 <colspec colwidth="6*" align="center"/>
37679 <colspec colwidth="6*" align="right"/>
37680 <tbody>
37681 <row>
37682 <entry><option>directory_file</option></entry>
37683 <entry>Use: <emphasis>appendfile</emphasis></entry>
37684 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37685 <entry>Default: <emphasis>see below</emphasis></entry>
37686 </row>
37687 </tbody>
37688 </tgroup>
37689 </informaltable>
37690 <para>
37691 <indexterm role="concept">
37692 <primary>base62</primary>
37693 </indexterm>
37694 <indexterm role="variable">
37695 <primary><varname>$inode</varname></primary>
37696 </indexterm>
37697 When <option>directory</option> is set, but neither <option>maildir_format</option> nor
37698 <option>mailstore_format</option> is set, <command>appendfile</command> delivers each message into a file
37699 whose name is obtained by expanding this string. The default value is:
37700 </para>
37701 <literallayout class="monospaced">
37702 q${base62:$tod_epoch}-$inode
37703 </literallayout>
37704 <para>
37705 This generates a unique name from the current time, in base 62 form, and the
37706 inode of the file. The variable <varname>$inode</varname> is available only when expanding this
37707 option.
37708 </para>
37709 <para>
37710 <indexterm role="option">
37711 <primary><option>directory_mode</option></primary>
37712 </indexterm>
37713 </para>
37714 <informaltable frame="all">
37715 <tgroup cols="4" colsep="0" rowsep="0">
37716 <colspec colwidth="8*" align="left"/>
37717 <colspec colwidth="6*" align="center"/>
37718 <colspec colwidth="6*" align="center"/>
37719 <colspec colwidth="6*" align="right"/>
37720 <tbody>
37721 <row>
37722 <entry><option>directory_mode</option></entry>
37723 <entry>Use: <emphasis>appendfile</emphasis></entry>
37724 <entry>Type: <emphasis>octal integer</emphasis></entry>
37725 <entry>Default: <emphasis>0700</emphasis></entry>
37726 </row>
37727 </tbody>
37728 </tgroup>
37729 </informaltable>
37730 <para>
37731 If <command>appendfile</command> creates any directories as a result of the
37732 <option>create_directory</option> option, their mode is specified by this option.
37733 </para>
37734 <para>
37735 <indexterm role="option">
37736 <primary><option>escape_string</option></primary>
37737 </indexterm>
37738 </para>
37739 <informaltable frame="all">
37740 <tgroup cols="4" colsep="0" rowsep="0">
37741 <colspec colwidth="8*" align="left"/>
37742 <colspec colwidth="6*" align="center"/>
37743 <colspec colwidth="6*" align="center"/>
37744 <colspec colwidth="6*" align="right"/>
37745 <tbody>
37746 <row>
37747 <entry><option>escape_string</option></entry>
37748 <entry>Use: <emphasis>appendfile</emphasis></entry>
37749 <entry>Type: <emphasis>string</emphasis></entry>
37750 <entry>Default: <emphasis>see description</emphasis></entry>
37751 </row>
37752 </tbody>
37753 </tgroup>
37754 </informaltable>
37755 <para>
37756 See <option>check_string</option> above.
37757 </para>
37758 <para>
37759 <indexterm role="option">
37760 <primary><option>file</option></primary>
37761 </indexterm>
37762 </para>
37763 <informaltable frame="all">
37764 <tgroup cols="4" colsep="0" rowsep="0">
37765 <colspec colwidth="8*" align="left"/>
37766 <colspec colwidth="6*" align="center"/>
37767 <colspec colwidth="6*" align="center"/>
37768 <colspec colwidth="6*" align="right"/>
37769 <tbody>
37770 <row>
37771 <entry><option>file</option></entry>
37772 <entry>Use: <emphasis>appendfile</emphasis></entry>
37773 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37774 <entry>Default: <emphasis>unset</emphasis></entry>
37775 </row>
37776 </tbody>
37777 </tgroup>
37778 </informaltable>
37779 <para>
37780 This option is mutually exclusive with the <option>directory</option> option, but one of
37781 <option>file</option> or <option>directory</option> must be set, unless the delivery is the direct result
37782 of a redirection (see section <xref linkend="SECTfildiropt"/>). The <option>file</option> option
37783 specifies a single file, to which the message is appended. One or more of
37784 <option>use_fcntl_lock</option>, <option>use_flock_lock</option>, or <option>use_lockfile</option> must be set with
37785 <option>file</option>.
37786 </para>
37787 <para>
37788 <indexterm role="concept">
37789 <primary>NFS</primary>
37790 <secondary>lock file</secondary>
37791 </indexterm>
37792 <indexterm role="concept">
37793 <primary>locking files</primary>
37794 </indexterm>
37795 <indexterm role="concept">
37796 <primary>lock files</primary>
37797 </indexterm>
37798 If you are using more than one host to deliver over NFS into the same
37799 mailboxes, you should always use lock files.
37800 </para>
37801 <para>
37802 The string value is expanded for each delivery, and must yield an absolute
37803 path. The most common settings of this option are variations on one of these
37804 examples:
37805 </para>
37806 <literallayout class="monospaced">
37807 file = /var/spool/mail/$local_part
37808 file = /home/$local_part/inbox
37809 file = $home/inbox
37810 </literallayout>
37811 <para>
37812 <indexterm role="concept">
37813 <primary><quote>sticky</quote> bit</primary>
37814 </indexterm>
37815 In the first example, all deliveries are done into the same directory. If Exim
37816 is configured to use lock files (see <option>use_lockfile</option> below) it must be able to
37817 create a file in the directory, so the <quote>sticky</quote> bit must be turned on for
37818 deliveries to be possible, or alternatively the <option>group</option> option can be used to
37819 run the delivery under a group id which has write access to the directory.
37820 </para>
37821 <para>
37822 <indexterm role="option">
37823 <primary><option>file_format</option></primary>
37824 </indexterm>
37825 </para>
37826 <informaltable frame="all">
37827 <tgroup cols="4" colsep="0" rowsep="0">
37828 <colspec colwidth="8*" align="left"/>
37829 <colspec colwidth="6*" align="center"/>
37830 <colspec colwidth="6*" align="center"/>
37831 <colspec colwidth="6*" align="right"/>
37832 <tbody>
37833 <row>
37834 <entry><option>file_format</option></entry>
37835 <entry>Use: <emphasis>appendfile</emphasis></entry>
37836 <entry>Type: <emphasis>string</emphasis></entry>
37837 <entry>Default: <emphasis>unset</emphasis></entry>
37838 </row>
37839 </tbody>
37840 </tgroup>
37841 </informaltable>
37842 <para>
37843 <indexterm role="concept">
37844 <primary>file</primary>
37845 <secondary>mailbox; checking existing format</secondary>
37846 </indexterm>
37847 This option requests the transport to check the format of an existing file
37848 before adding to it. The check consists of matching a specific string at the
37849 start of the file. The value of the option consists of an even number of
37850 colon-separated strings. The first of each pair is the test string, and the
37851 second is the name of a transport. If the transport associated with a matched
37852 string is not the current transport, control is passed over to the other
37853 transport. For example, suppose the standard <command>local_delivery</command> transport has
37854 this added to it:
37855 </para>
37856 <literallayout class="monospaced">
37857 file_format = "From       : local_delivery :\
37858                \1\1\1\1\n : local_mmdf_delivery"
37859 </literallayout>
37860 <para>
37861 Mailboxes that begin with <quote>From</quote> are still handled by this transport, but if
37862 a mailbox begins with four binary ones followed by a newline, control is passed
37863 to a transport called <option>local_mmdf_delivery</option>, which presumably is configured
37864 to do the delivery in MMDF format. If a mailbox does not exist or is empty, it
37865 is assumed to match the current transport. If the start of a mailbox doesn&#x2019;t
37866 match any string, or if the transport named for a given string is not defined,
37867 delivery is deferred.
37868 </para>
37869 <para>
37870 <indexterm role="option">
37871 <primary><option>file_must_exist</option></primary>
37872 </indexterm>
37873 </para>
37874 <informaltable frame="all">
37875 <tgroup cols="4" colsep="0" rowsep="0">
37876 <colspec colwidth="8*" align="left"/>
37877 <colspec colwidth="6*" align="center"/>
37878 <colspec colwidth="6*" align="center"/>
37879 <colspec colwidth="6*" align="right"/>
37880 <tbody>
37881 <row>
37882 <entry><option>file_must_exist</option></entry>
37883 <entry>Use: <emphasis>appendfile</emphasis></entry>
37884 <entry>Type: <emphasis>boolean</emphasis></entry>
37885 <entry>Default: <emphasis>false</emphasis></entry>
37886 </row>
37887 </tbody>
37888 </tgroup>
37889 </informaltable>
37890 <para>
37891 If this option is true, the file specified by the <option>file</option> option must exist.
37892 A temporary error occurs if it does not, causing delivery to be deferred.
37893 If this option is false, the file is created if it does not exist.
37894 </para>
37895 <para>
37896 <indexterm role="option">
37897 <primary><option>lock_fcntl_timeout</option></primary>
37898 </indexterm>
37899 </para>
37900 <informaltable frame="all">
37901 <tgroup cols="4" colsep="0" rowsep="0">
37902 <colspec colwidth="8*" align="left"/>
37903 <colspec colwidth="6*" align="center"/>
37904 <colspec colwidth="6*" align="center"/>
37905 <colspec colwidth="6*" align="right"/>
37906 <tbody>
37907 <row>
37908 <entry><option>lock_fcntl_timeout</option></entry>
37909 <entry>Use: <emphasis>appendfile</emphasis></entry>
37910 <entry>Type: <emphasis>time</emphasis></entry>
37911 <entry>Default: <emphasis>0s</emphasis></entry>
37912 </row>
37913 </tbody>
37914 </tgroup>
37915 </informaltable>
37916 <para>
37917 <indexterm role="concept">
37918 <primary>timeout</primary>
37919 <secondary>mailbox locking</secondary>
37920 </indexterm>
37921 <indexterm role="concept">
37922 <primary>mailbox</primary>
37923 <secondary>locking, blocking and non-blocking</secondary>
37924 </indexterm>
37925 <indexterm role="concept">
37926 <primary>locking files</primary>
37927 </indexterm>
37928 By default, the <command>appendfile</command> transport uses non-blocking calls to <function>fcntl()</function>
37929 when locking an open mailbox file. If the call fails, the delivery process
37930 sleeps for <option>lock_interval</option> and tries again, up to <option>lock_retries</option> times.
37931 Non-blocking calls are used so that the file is not kept open during the wait
37932 for the lock; the reason for this is to make it as safe as possible for
37933 deliveries over NFS in the case when processes might be accessing an NFS
37934 mailbox without using a lock file. This should not be done, but
37935 misunderstandings and hence misconfigurations are not unknown.
37936 </para>
37937 <para>
37938 On a busy system, however, the performance of a non-blocking lock approach is
37939 not as good as using a blocking lock with a timeout. In this case, the waiting
37940 is done inside the system call, and Exim&#x2019;s delivery process acquires the lock
37941 and can proceed as soon as the previous lock holder releases it.
37942 </para>
37943 <para>
37944 If <option>lock_fcntl_timeout</option> is set to a non-zero time, blocking locks, with that
37945 timeout, are used. There may still be some retrying: the maximum number of
37946 retries is
37947 </para>
37948 <literallayout class="monospaced">
37949 (lock_retries * lock_interval) / lock_fcntl_timeout
37950 </literallayout>
37951 <para>
37952 rounded up to the next whole number. In other words, the total time during
37953 which <command>appendfile</command> is trying to get a lock is roughly the same, unless
37954 <option>lock_fcntl_timeout</option> is set very large.
37955 </para>
37956 <para>
37957 You should consider setting this option if you are getting a lot of delayed
37958 local deliveries because of errors of the form
37959 </para>
37960 <literallayout class="monospaced">
37961 failed to lock mailbox /some/file (fcntl)
37962 </literallayout>
37963 <para>
37964 <indexterm role="option">
37965 <primary><option>lock_flock_timeout</option></primary>
37966 </indexterm>
37967 </para>
37968 <informaltable frame="all">
37969 <tgroup cols="4" colsep="0" rowsep="0">
37970 <colspec colwidth="8*" align="left"/>
37971 <colspec colwidth="6*" align="center"/>
37972 <colspec colwidth="6*" align="center"/>
37973 <colspec colwidth="6*" align="right"/>
37974 <tbody>
37975 <row>
37976 <entry><option>lock_flock_timeout</option></entry>
37977 <entry>Use: <emphasis>appendfile</emphasis></entry>
37978 <entry>Type: <emphasis>time</emphasis></entry>
37979 <entry>Default: <emphasis>0s</emphasis></entry>
37980 </row>
37981 </tbody>
37982 </tgroup>
37983 </informaltable>
37984 <para>
37985 This timeout applies to file locking when using <function>flock()</function> (see
37986 <option>use_flock</option>); the timeout operates in a similar manner to
37987 <option>lock_fcntl_timeout</option>.
37988 </para>
37989 <para>
37990 <indexterm role="option">
37991 <primary><option>lock_interval</option></primary>
37992 </indexterm>
37993 </para>
37994 <informaltable frame="all">
37995 <tgroup cols="4" colsep="0" rowsep="0">
37996 <colspec colwidth="8*" align="left"/>
37997 <colspec colwidth="6*" align="center"/>
37998 <colspec colwidth="6*" align="center"/>
37999 <colspec colwidth="6*" align="right"/>
38000 <tbody>
38001 <row>
38002 <entry><option>lock_interval</option></entry>
38003 <entry>Use: <emphasis>appendfile</emphasis></entry>
38004 <entry>Type: <emphasis>time</emphasis></entry>
38005 <entry>Default: <emphasis>3s</emphasis></entry>
38006 </row>
38007 </tbody>
38008 </tgroup>
38009 </informaltable>
38010 <para>
38011 This specifies the time to wait between attempts to lock the file. See below
38012 for details of locking.
38013 </para>
38014 <para>
38015 <indexterm role="option">
38016 <primary><option>lock_retries</option></primary>
38017 </indexterm>
38018 </para>
38019 <informaltable frame="all">
38020 <tgroup cols="4" colsep="0" rowsep="0">
38021 <colspec colwidth="8*" align="left"/>
38022 <colspec colwidth="6*" align="center"/>
38023 <colspec colwidth="6*" align="center"/>
38024 <colspec colwidth="6*" align="right"/>
38025 <tbody>
38026 <row>
38027 <entry><option>lock_retries</option></entry>
38028 <entry>Use: <emphasis>appendfile</emphasis></entry>
38029 <entry>Type: <emphasis>integer</emphasis></entry>
38030 <entry>Default: <emphasis>10</emphasis></entry>
38031 </row>
38032 </tbody>
38033 </tgroup>
38034 </informaltable>
38035 <para>
38036 This specifies the maximum number of attempts to lock the file. A value of zero
38037 is treated as 1. See below for details of locking.
38038 </para>
38039 <para>
38040 <indexterm role="option">
38041 <primary><option>lockfile_mode</option></primary>
38042 </indexterm>
38043 </para>
38044 <informaltable frame="all">
38045 <tgroup cols="4" colsep="0" rowsep="0">
38046 <colspec colwidth="8*" align="left"/>
38047 <colspec colwidth="6*" align="center"/>
38048 <colspec colwidth="6*" align="center"/>
38049 <colspec colwidth="6*" align="right"/>
38050 <tbody>
38051 <row>
38052 <entry><option>lockfile_mode</option></entry>
38053 <entry>Use: <emphasis>appendfile</emphasis></entry>
38054 <entry>Type: <emphasis>octal integer</emphasis></entry>
38055 <entry>Default: <emphasis>0600</emphasis></entry>
38056 </row>
38057 </tbody>
38058 </tgroup>
38059 </informaltable>
38060 <para>
38061 This specifies the mode of the created lock file, when a lock file is being
38062 used (see <option>use_lockfile</option> and <option>use_mbx_lock</option>).
38063 </para>
38064 <para>
38065 <indexterm role="option">
38066 <primary><option>lockfile_timeout</option></primary>
38067 </indexterm>
38068 </para>
38069 <informaltable frame="all">
38070 <tgroup cols="4" colsep="0" rowsep="0">
38071 <colspec colwidth="8*" align="left"/>
38072 <colspec colwidth="6*" align="center"/>
38073 <colspec colwidth="6*" align="center"/>
38074 <colspec colwidth="6*" align="right"/>
38075 <tbody>
38076 <row>
38077 <entry><option>lockfile_timeout</option></entry>
38078 <entry>Use: <emphasis>appendfile</emphasis></entry>
38079 <entry>Type: <emphasis>time</emphasis></entry>
38080 <entry>Default: <emphasis>30m</emphasis></entry>
38081 </row>
38082 </tbody>
38083 </tgroup>
38084 </informaltable>
38085 <para>
38086 <indexterm role="concept">
38087 <primary>timeout</primary>
38088 <secondary>mailbox locking</secondary>
38089 </indexterm>
38090 When a lock file is being used (see <option>use_lockfile</option>), if a lock file already
38091 exists and is older than this value, it is assumed to have been left behind by
38092 accident, and Exim attempts to remove it.
38093 </para>
38094 <para>
38095 <indexterm role="option">
38096 <primary><option>mailbox_filecount</option></primary>
38097 </indexterm>
38098 </para>
38099 <informaltable frame="all">
38100 <tgroup cols="4" colsep="0" rowsep="0">
38101 <colspec colwidth="8*" align="left"/>
38102 <colspec colwidth="6*" align="center"/>
38103 <colspec colwidth="6*" align="center"/>
38104 <colspec colwidth="6*" align="right"/>
38105 <tbody>
38106 <row>
38107 <entry><option>mailbox_filecount</option></entry>
38108 <entry>Use: <emphasis>appendfile</emphasis></entry>
38109 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38110 <entry>Default: <emphasis>unset</emphasis></entry>
38111 </row>
38112 </tbody>
38113 </tgroup>
38114 </informaltable>
38115 <para>
38116 <indexterm role="concept">
38117 <primary>mailbox</primary>
38118 <secondary>specifying size of</secondary>
38119 </indexterm>
38120 <indexterm role="concept">
38121 <primary>size</primary>
38122 <secondary>of mailbox</secondary>
38123 </indexterm>
38124 If this option is set, it is expanded, and the result is taken as the current
38125 number of files in the mailbox. It must be a decimal number, optionally
38126 followed by K or M. This provides a way of obtaining this information from an
38127 external source that maintains the data.
38128 </para>
38129 <para>
38130 <indexterm role="option">
38131 <primary><option>mailbox_size</option></primary>
38132 </indexterm>
38133 </para>
38134 <informaltable frame="all">
38135 <tgroup cols="4" colsep="0" rowsep="0">
38136 <colspec colwidth="8*" align="left"/>
38137 <colspec colwidth="6*" align="center"/>
38138 <colspec colwidth="6*" align="center"/>
38139 <colspec colwidth="6*" align="right"/>
38140 <tbody>
38141 <row>
38142 <entry><option>mailbox_size</option></entry>
38143 <entry>Use: <emphasis>appendfile</emphasis></entry>
38144 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38145 <entry>Default: <emphasis>unset</emphasis></entry>
38146 </row>
38147 </tbody>
38148 </tgroup>
38149 </informaltable>
38150 <para>
38151 <indexterm role="concept">
38152 <primary>mailbox</primary>
38153 <secondary>specifying size of</secondary>
38154 </indexterm>
38155 <indexterm role="concept">
38156 <primary>size</primary>
38157 <secondary>of mailbox</secondary>
38158 </indexterm>
38159 If this option is set, it is expanded, and the result is taken as the current
38160 size the mailbox. It must be a decimal number, optionally followed by K or M.
38161 This provides a way of obtaining this information from an external source that
38162 maintains the data. This is likely to be helpful for maildir deliveries where
38163 it is computationally expensive to compute the size of a mailbox.
38164 </para>
38165 <para>
38166 <indexterm role="option">
38167 <primary><option>maildir_format</option></primary>
38168 </indexterm>
38169 </para>
38170 <informaltable frame="all">
38171 <tgroup cols="4" colsep="0" rowsep="0">
38172 <colspec colwidth="8*" align="left"/>
38173 <colspec colwidth="6*" align="center"/>
38174 <colspec colwidth="6*" align="center"/>
38175 <colspec colwidth="6*" align="right"/>
38176 <tbody>
38177 <row>
38178 <entry><option>maildir_format</option></entry>
38179 <entry>Use: <emphasis>appendfile</emphasis></entry>
38180 <entry>Type: <emphasis>boolean</emphasis></entry>
38181 <entry>Default: <emphasis>false</emphasis></entry>
38182 </row>
38183 </tbody>
38184 </tgroup>
38185 </informaltable>
38186 <para>
38187 <indexterm role="concept">
38188 <primary>maildir format</primary>
38189 <secondary>specifying</secondary>
38190 </indexterm>
38191 If this option is set with the <option>directory</option> option, the delivery is into a new
38192 file, in the <quote>maildir</quote> format that is used by other mail software. When the
38193 transport is activated directly from a <command>redirect</command> router (for example, the
38194 <command>address_file</command> transport in the default configuration), setting
38195 <option>maildir_format</option> causes the path received from the router to be treated as a
38196 directory, whether or not it ends with <literal>/</literal>. This option is available only if
38197 SUPPORT_MAILDIR is present in <filename>Local/Makefile</filename>. See section
38198 <xref linkend="SECTmaildirdelivery"/> below for further details.
38199 </para>
38200 <para>
38201 <indexterm role="option">
38202 <primary><option>maildir_quota_directory_regex</option></primary>
38203 </indexterm>
38204 </para>
38205 <informaltable frame="all">
38206 <tgroup cols="4" colsep="0" rowsep="0">
38207 <colspec colwidth="8*" align="left"/>
38208 <colspec colwidth="6*" align="center"/>
38209 <colspec colwidth="6*" align="center"/>
38210 <colspec colwidth="6*" align="right"/>
38211 <tbody>
38212 <row>
38213 <entry><option>maildir_quota_directory_regex</option></entry>
38214 <entry>Use: <emphasis>appendfile</emphasis></entry>
38215 <entry>Type: <emphasis>string</emphasis></entry>
38216 <entry>Default: <emphasis>See below</emphasis></entry>
38217 </row>
38218 </tbody>
38219 </tgroup>
38220 </informaltable>
38221 <para>
38222 <indexterm role="concept">
38223 <primary>maildir format</primary>
38224 <secondary>quota; directories included in</secondary>
38225 </indexterm>
38226 <indexterm role="concept">
38227 <primary>quota</primary>
38228 <secondary>maildir; directories included in</secondary>
38229 </indexterm>
38230 This option is relevant only when <option>maildir_use_size_file</option> is set. It defines
38231 a regular expression for specifying directories, relative to the quota
38232 directory (see <option>quota_directory</option>), that should be included in the quota
38233 calculation. The default value is:
38234 </para>
38235 <literallayout class="monospaced">
38236 maildir_quota_directory_regex = ^(?:cur|new|\..*)$
38237 </literallayout>
38238 <para>
38239 This includes the <filename>cur</filename> and <filename>new</filename> directories, and any maildir++ folders
38240 (directories whose names begin with a dot). If you want to exclude the
38241 <filename>Trash</filename>
38242 folder from the count (as some sites do), you need to change this setting to
38243 </para>
38244 <literallayout class="monospaced">
38245 maildir_quota_directory_regex = ^(?:cur|new|\.(?!Trash).*)$
38246 </literallayout>
38247 <para>
38248 This uses a negative lookahead in the regular expression to exclude the
38249 directory whose name is <filename>.Trash</filename>. When a directory is excluded from quota
38250 calculations, quota processing is bypassed for any messages that are delivered
38251 directly into that directory.
38252 </para>
38253 <para>
38254 <indexterm role="option">
38255 <primary><option>maildir_retries</option></primary>
38256 </indexterm>
38257 </para>
38258 <informaltable frame="all">
38259 <tgroup cols="4" colsep="0" rowsep="0">
38260 <colspec colwidth="8*" align="left"/>
38261 <colspec colwidth="6*" align="center"/>
38262 <colspec colwidth="6*" align="center"/>
38263 <colspec colwidth="6*" align="right"/>
38264 <tbody>
38265 <row>
38266 <entry><option>maildir_retries</option></entry>
38267 <entry>Use: <emphasis>appendfile</emphasis></entry>
38268 <entry>Type: <emphasis>integer</emphasis></entry>
38269 <entry>Default: <emphasis>10</emphasis></entry>
38270 </row>
38271 </tbody>
38272 </tgroup>
38273 </informaltable>
38274 <para>
38275 This option specifies the number of times to retry when writing a file in
38276 <quote>maildir</quote> format. See section <xref linkend="SECTmaildirdelivery"/> below.
38277 </para>
38278 <para>
38279 <indexterm role="option">
38280 <primary><option>maildir_tag</option></primary>
38281 </indexterm>
38282 </para>
38283 <informaltable frame="all">
38284 <tgroup cols="4" colsep="0" rowsep="0">
38285 <colspec colwidth="8*" align="left"/>
38286 <colspec colwidth="6*" align="center"/>
38287 <colspec colwidth="6*" align="center"/>
38288 <colspec colwidth="6*" align="right"/>
38289 <tbody>
38290 <row>
38291 <entry><option>maildir_tag</option></entry>
38292 <entry>Use: <emphasis>appendfile</emphasis></entry>
38293 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38294 <entry>Default: <emphasis>unset</emphasis></entry>
38295 </row>
38296 </tbody>
38297 </tgroup>
38298 </informaltable>
38299 <para>
38300 This option applies only to deliveries in maildir format, and is described in
38301 section <xref linkend="SECTmaildirdelivery"/> below.
38302 </para>
38303 <para>
38304 <indexterm role="option">
38305 <primary><option>maildir_use_size_file</option></primary>
38306 </indexterm>
38307 </para>
38308 <informaltable frame="all">
38309 <tgroup cols="4" colsep="0" rowsep="0">
38310 <colspec colwidth="8*" align="left"/>
38311 <colspec colwidth="6*" align="center"/>
38312 <colspec colwidth="6*" align="center"/>
38313 <colspec colwidth="6*" align="right"/>
38314 <tbody>
38315 <row>
38316 <entry><option>maildir_use_size_file</option></entry>
38317 <entry>Use: <emphasis>appendfile</emphasis></entry>
38318 <entry>Type: <emphasis>boolean</emphasis></entry>
38319 <entry>Default: <emphasis>false</emphasis></entry>
38320 </row>
38321 </tbody>
38322 </tgroup>
38323 </informaltable>
38324 <para>
38325 <indexterm role="concept">
38326 <primary>maildir format</primary>
38327 <secondary><filename>maildirsize</filename> file</secondary>
38328 </indexterm>
38329 Setting this option true enables support for <filename>maildirsize</filename> files. Exim
38330 creates a <filename>maildirsize</filename> file in a maildir if one does not exist, taking the
38331 quota from the <option>quota</option> option of the transport. If <option>quota</option> is unset, the
38332 value is zero. See <option>maildir_quota_directory_regex</option> above and section
38333 <xref linkend="SECTmaildirdelivery"/> below for further details.
38334 </para>
38335 <para>
38336 <indexterm role="option">
38337 <primary><option>maildirfolder_create_regex</option></primary>
38338 </indexterm>
38339 </para>
38340 <informaltable frame="all">
38341 <tgroup cols="4" colsep="0" rowsep="0">
38342 <colspec colwidth="8*" align="left"/>
38343 <colspec colwidth="6*" align="center"/>
38344 <colspec colwidth="6*" align="center"/>
38345 <colspec colwidth="6*" align="right"/>
38346 <tbody>
38347 <row>
38348 <entry><option>maildirfolder_create_regex</option></entry>
38349 <entry>Use: <emphasis>appendfile</emphasis></entry>
38350 <entry>Type: <emphasis>string</emphasis></entry>
38351 <entry>Default: <emphasis>unset</emphasis></entry>
38352 </row>
38353 </tbody>
38354 </tgroup>
38355 </informaltable>
38356 <para>
38357 <indexterm role="concept">
38358 <primary>maildir format</primary>
38359 <secondary><filename>maildirfolder</filename> file</secondary>
38360 </indexterm>
38361 <indexterm role="concept">
38362 <primary><filename>maildirfolder</filename>, creating</primary>
38363 </indexterm>
38364 The value of this option is a regular expression. If it is unset, it has no
38365 effect. Otherwise, before a maildir delivery takes place, the pattern is
38366 matched against the name of the maildir directory, that is, the directory
38367 containing the <filename>new</filename> and <filename>tmp</filename> subdirectories that will be used for the
38368 delivery. If there is a match, Exim checks for the existence of a file called
38369 <filename>maildirfolder</filename> in the directory, and creates it if it does not exist.
38370 See section <xref linkend="SECTmaildirdelivery"/> for more details.
38371 </para>
38372 <para>
38373 <indexterm role="option">
38374 <primary><option>mailstore_format</option></primary>
38375 </indexterm>
38376 </para>
38377 <informaltable frame="all">
38378 <tgroup cols="4" colsep="0" rowsep="0">
38379 <colspec colwidth="8*" align="left"/>
38380 <colspec colwidth="6*" align="center"/>
38381 <colspec colwidth="6*" align="center"/>
38382 <colspec colwidth="6*" align="right"/>
38383 <tbody>
38384 <row>
38385 <entry><option>mailstore_format</option></entry>
38386 <entry>Use: <emphasis>appendfile</emphasis></entry>
38387 <entry>Type: <emphasis>boolean</emphasis></entry>
38388 <entry>Default: <emphasis>false</emphasis></entry>
38389 </row>
38390 </tbody>
38391 </tgroup>
38392 </informaltable>
38393 <para>
38394 <indexterm role="concept">
38395 <primary>mailstore format</primary>
38396 <secondary>specifying</secondary>
38397 </indexterm>
38398 If this option is set with the <option>directory</option> option, the delivery is into two
38399 new files in  <quote>mailstore</quote> format. The option is available only if
38400 SUPPORT_MAILSTORE is present in <filename>Local/Makefile</filename>. See section <xref linkend="SECTopdir"/>
38401 below for further details.
38402 </para>
38403 <para>
38404 <indexterm role="option">
38405 <primary><option>mailstore_prefix</option></primary>
38406 </indexterm>
38407 </para>
38408 <informaltable frame="all">
38409 <tgroup cols="4" colsep="0" rowsep="0">
38410 <colspec colwidth="8*" align="left"/>
38411 <colspec colwidth="6*" align="center"/>
38412 <colspec colwidth="6*" align="center"/>
38413 <colspec colwidth="6*" align="right"/>
38414 <tbody>
38415 <row>
38416 <entry><option>mailstore_prefix</option></entry>
38417 <entry>Use: <emphasis>appendfile</emphasis></entry>
38418 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38419 <entry>Default: <emphasis>unset</emphasis></entry>
38420 </row>
38421 </tbody>
38422 </tgroup>
38423 </informaltable>
38424 <para>
38425 This option applies only to deliveries in mailstore format, and is described in
38426 section <xref linkend="SECTopdir"/> below.
38427 </para>
38428 <para>
38429 <indexterm role="option">
38430 <primary><option>mailstore_suffix</option></primary>
38431 </indexterm>
38432 </para>
38433 <informaltable frame="all">
38434 <tgroup cols="4" colsep="0" rowsep="0">
38435 <colspec colwidth="8*" align="left"/>
38436 <colspec colwidth="6*" align="center"/>
38437 <colspec colwidth="6*" align="center"/>
38438 <colspec colwidth="6*" align="right"/>
38439 <tbody>
38440 <row>
38441 <entry><option>mailstore_suffix</option></entry>
38442 <entry>Use: <emphasis>appendfile</emphasis></entry>
38443 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38444 <entry>Default: <emphasis>unset</emphasis></entry>
38445 </row>
38446 </tbody>
38447 </tgroup>
38448 </informaltable>
38449 <para>
38450 This option applies only to deliveries in mailstore format, and is described in
38451 section <xref linkend="SECTopdir"/> below.
38452 </para>
38453 <para>
38454 <indexterm role="option">
38455 <primary><option>mbx_format</option></primary>
38456 </indexterm>
38457 </para>
38458 <informaltable frame="all">
38459 <tgroup cols="4" colsep="0" rowsep="0">
38460 <colspec colwidth="8*" align="left"/>
38461 <colspec colwidth="6*" align="center"/>
38462 <colspec colwidth="6*" align="center"/>
38463 <colspec colwidth="6*" align="right"/>
38464 <tbody>
38465 <row>
38466 <entry><option>mbx_format</option></entry>
38467 <entry>Use: <emphasis>appendfile</emphasis></entry>
38468 <entry>Type: <emphasis>boolean</emphasis></entry>
38469 <entry>Default: <emphasis>false</emphasis></entry>
38470 </row>
38471 </tbody>
38472 </tgroup>
38473 </informaltable>
38474 <para>
38475 <indexterm role="concept">
38476 <primary>locking files</primary>
38477 </indexterm>
38478 <indexterm role="concept">
38479 <primary>file</primary>
38480 <secondary>locking</secondary>
38481 </indexterm>
38482 <indexterm role="concept">
38483 <primary>file</primary>
38484 <secondary>MBX format</secondary>
38485 </indexterm>
38486 <indexterm role="concept">
38487 <primary>MBX format, specifying</primary>
38488 </indexterm>
38489 This option is available only if Exim has been compiled with SUPPORT_MBX
38490 set in <filename>Local/Makefile</filename>. If <option>mbx_format</option> is set with the <option>file</option> option,
38491 the message is appended to the mailbox file in MBX format instead of
38492 traditional Unix format. This format is supported by Pine4 and its associated
38493 IMAP and POP daemons, by means of the <emphasis>c-client</emphasis> library that they all use.
38494 </para>
38495 <para>
38496 <emphasis role="bold">Note</emphasis>: The <option>message_prefix</option> and <option>message_suffix</option> options are not
38497 automatically changed by the use of <option>mbx_format</option>. They should normally be set
38498 empty when using MBX format, so this option almost always appears in this
38499 combination:
38500 </para>
38501 <literallayout class="monospaced">
38502 mbx_format = true
38503 message_prefix =
38504 message_suffix =
38505 </literallayout>
38506 <para>
38507 If none of the locking options are mentioned in the configuration,
38508 <option>use_mbx_lock</option> is assumed and the other locking options default to false. It
38509 is possible to specify the other kinds of locking with <option>mbx_format</option>, but
38510 <option>use_fcntl_lock</option> and <option>use_mbx_lock</option> are mutually exclusive. MBX locking
38511 interworks with <emphasis>c-client</emphasis>, providing for shared access to the mailbox. It
38512 should not be used if any program that does not use this form of locking is
38513 going to access the mailbox, nor should it be used if the mailbox file is NFS
38514 mounted, because it works only when the mailbox is accessed from a single host.
38515 </para>
38516 <para>
38517 If you set <option>use_fcntl_lock</option> with an MBX-format mailbox, you cannot use
38518 the standard version of <emphasis>c-client</emphasis>, because as long as it has a mailbox open
38519 (this means for the whole of a Pine or IMAP session), Exim will not be able to
38520 append messages to it.
38521 </para>
38522 <para>
38523 <indexterm role="option">
38524 <primary><option>message_prefix</option></primary>
38525 </indexterm>
38526 </para>
38527 <informaltable frame="all">
38528 <tgroup cols="4" colsep="0" rowsep="0">
38529 <colspec colwidth="8*" align="left"/>
38530 <colspec colwidth="6*" align="center"/>
38531 <colspec colwidth="6*" align="center"/>
38532 <colspec colwidth="6*" align="right"/>
38533 <tbody>
38534 <row>
38535 <entry><option>message_prefix</option></entry>
38536 <entry>Use: <emphasis>appendfile</emphasis></entry>
38537 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38538 <entry>Default: <emphasis>see below</emphasis></entry>
38539 </row>
38540 </tbody>
38541 </tgroup>
38542 </informaltable>
38543 <para>
38544 <indexterm role="concept">
38545 <primary><quote>From</quote> line</primary>
38546 </indexterm>
38547 The string specified here is expanded and output at the start of every message.
38548 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
38549 in which case it is:
38550 </para>
38551 <literallayout class="monospaced">
38552 message_prefix = "From ${if def:return_path{$return_path}\
38553   {MAILER-DAEMON}} $tod_bsdinbox\n"
38554 </literallayout>
38555 <para>
38556 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
38557 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_prefix</option>.
38558 </para>
38559 <para>
38560 <indexterm role="option">
38561 <primary><option>message_suffix</option></primary>
38562 </indexterm>
38563 </para>
38564 <informaltable frame="all">
38565 <tgroup cols="4" colsep="0" rowsep="0">
38566 <colspec colwidth="8*" align="left"/>
38567 <colspec colwidth="6*" align="center"/>
38568 <colspec colwidth="6*" align="center"/>
38569 <colspec colwidth="6*" align="right"/>
38570 <tbody>
38571 <row>
38572 <entry><option>message_suffix</option></entry>
38573 <entry>Use: <emphasis>appendfile</emphasis></entry>
38574 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38575 <entry>Default: <emphasis>see below</emphasis></entry>
38576 </row>
38577 </tbody>
38578 </tgroup>
38579 </informaltable>
38580 <para>
38581 The string specified here is expanded and output at the end of every message.
38582 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
38583 in which case it is a single newline character. The suffix can be suppressed by
38584 setting
38585 </para>
38586 <literallayout class="monospaced">
38587 message_suffix =
38588 </literallayout>
38589 <para>
38590 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
38591 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_suffix</option>.
38592 </para>
38593 <para>
38594 <indexterm role="option">
38595 <primary><option>mode</option></primary>
38596 </indexterm>
38597 </para>
38598 <informaltable frame="all">
38599 <tgroup cols="4" colsep="0" rowsep="0">
38600 <colspec colwidth="8*" align="left"/>
38601 <colspec colwidth="6*" align="center"/>
38602 <colspec colwidth="6*" align="center"/>
38603 <colspec colwidth="6*" align="right"/>
38604 <tbody>
38605 <row>
38606 <entry><option>mode</option></entry>
38607 <entry>Use: <emphasis>appendfile</emphasis></entry>
38608 <entry>Type: <emphasis>octal integer</emphasis></entry>
38609 <entry>Default: <emphasis>0600</emphasis></entry>
38610 </row>
38611 </tbody>
38612 </tgroup>
38613 </informaltable>
38614 <para>
38615 If the output file is created, it is given this mode. If it already exists and
38616 has wider permissions, they are reduced to this mode. If it has narrower
38617 permissions, an error occurs unless <option>mode_fail_narrower</option> is false. However,
38618 if the delivery is the result of a <option>save</option> command in a filter file specifying
38619 a particular mode, the mode of the output file is always forced to take that
38620 value, and this option is ignored.
38621 </para>
38622 <para>
38623 <indexterm role="option">
38624 <primary><option>mode_fail_narrower</option></primary>
38625 </indexterm>
38626 </para>
38627 <informaltable frame="all">
38628 <tgroup cols="4" colsep="0" rowsep="0">
38629 <colspec colwidth="8*" align="left"/>
38630 <colspec colwidth="6*" align="center"/>
38631 <colspec colwidth="6*" align="center"/>
38632 <colspec colwidth="6*" align="right"/>
38633 <tbody>
38634 <row>
38635 <entry><option>mode_fail_narrower</option></entry>
38636 <entry>Use: <emphasis>appendfile</emphasis></entry>
38637 <entry>Type: <emphasis>boolean</emphasis></entry>
38638 <entry>Default: <emphasis>true</emphasis></entry>
38639 </row>
38640 </tbody>
38641 </tgroup>
38642 </informaltable>
38643 <para>
38644 This option applies in the case when an existing mailbox file has a narrower
38645 mode than that specified by the <option>mode</option> option. If <option>mode_fail_narrower</option> is
38646 true, the delivery is deferred (<quote>mailbox has the wrong mode</quote>); otherwise Exim
38647 continues with the delivery attempt, using the existing mode of the file.
38648 </para>
38649 <para>
38650 <indexterm role="option">
38651 <primary><option>notify_comsat</option></primary>
38652 </indexterm>
38653 </para>
38654 <informaltable frame="all">
38655 <tgroup cols="4" colsep="0" rowsep="0">
38656 <colspec colwidth="8*" align="left"/>
38657 <colspec colwidth="6*" align="center"/>
38658 <colspec colwidth="6*" align="center"/>
38659 <colspec colwidth="6*" align="right"/>
38660 <tbody>
38661 <row>
38662 <entry><option>notify_comsat</option></entry>
38663 <entry>Use: <emphasis>appendfile</emphasis></entry>
38664 <entry>Type: <emphasis>boolean</emphasis></entry>
38665 <entry>Default: <emphasis>false</emphasis></entry>
38666 </row>
38667 </tbody>
38668 </tgroup>
38669 </informaltable>
38670 <para>
38671 If this option is true, the <emphasis>comsat</emphasis> daemon is notified after every
38672 successful delivery to a user mailbox. This is the daemon that notifies logged
38673 on users about incoming mail.
38674 </para>
38675 <para>
38676 <indexterm role="option">
38677 <primary><option>quota</option></primary>
38678 </indexterm>
38679 </para>
38680 <informaltable frame="all">
38681 <tgroup cols="4" colsep="0" rowsep="0">
38682 <colspec colwidth="8*" align="left"/>
38683 <colspec colwidth="6*" align="center"/>
38684 <colspec colwidth="6*" align="center"/>
38685 <colspec colwidth="6*" align="right"/>
38686 <tbody>
38687 <row>
38688 <entry><option>quota</option></entry>
38689 <entry>Use: <emphasis>appendfile</emphasis></entry>
38690 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38691 <entry>Default: <emphasis>unset</emphasis></entry>
38692 </row>
38693 </tbody>
38694 </tgroup>
38695 </informaltable>
38696 <para>
38697 <indexterm role="concept">
38698 <primary>quota</primary>
38699 <secondary>imposed by Exim</secondary>
38700 </indexterm>
38701 This option imposes a limit on the size of the file to which Exim is appending,
38702 or to the total space used in the directory tree when the <option>directory</option> option
38703 is set. In the latter case, computation of the space used is expensive, because
38704 all the files in the directory (and any sub-directories) have to be
38705 individually inspected and their sizes summed. (See <option>quota_size_regex</option> and
38706 <option>maildir_use_size_file</option> for ways to avoid this in environments where users
38707 have no shell access to their mailboxes).
38708 </para>
38709 <para>
38710 As there is no interlock against two simultaneous deliveries into a
38711 multi-file mailbox, it is possible for the quota to be overrun in this case.
38712 For single-file mailboxes, of course, an interlock is a necessity.
38713 </para>
38714 <para>
38715 A file&#x2019;s size is taken as its <emphasis>used</emphasis> value. Because of blocking effects, this
38716 may be a lot less than the actual amount of disk space allocated to the file.
38717 If the sizes of a number of files are being added up, the rounding effect can
38718 become quite noticeable, especially on systems that have large block sizes.
38719 Nevertheless, it seems best to stick to the <emphasis>used</emphasis> figure, because this is
38720 the obvious value which users understand most easily.
38721 </para>
38722 <para>
38723 The value of the option is expanded, and must then be a numerical value
38724 (decimal point allowed), optionally followed by one of the letters K, M, or G,
38725 for kilobytes, megabytes, or gigabytes. If Exim is running on a system with
38726 large file support (Linux and FreeBSD have this), mailboxes larger than 2G can
38727 be handled.
38728 </para>
38729 <para>
38730 <emphasis role="bold">Note</emphasis>: A value of zero is interpreted as <quote>no quota</quote>.
38731 </para>
38732 <para>
38733 The expansion happens while Exim is running as root, before it changes uid for
38734 the delivery. This means that files that are inaccessible to the end user can
38735 be used to hold quota values that are looked up in the expansion. When delivery
38736 fails because this quota is exceeded, the handling of the error is as for
38737 system quota failures.
38738 </para>
38739 <para>
38740 By default, Exim&#x2019;s quota checking mimics system quotas, and restricts the
38741 mailbox to the specified maximum size, though the value is not accurate to the
38742 last byte, owing to separator lines and additional headers that may get added
38743 during message delivery. When a mailbox is nearly full, large messages may get
38744 refused even though small ones are accepted, because the size of the current
38745 message is added to the quota when the check is made. This behaviour can be
38746 changed by setting <option>quota_is_inclusive</option> false. When this is done, the check
38747 for exceeding the quota does not include the current message. Thus, deliveries
38748 continue until the quota has been exceeded; thereafter, no further messages are
38749 delivered. See also <option>quota_warn_threshold</option>.
38750 </para>
38751 <para>
38752 <indexterm role="option">
38753 <primary><option>quota_directory</option></primary>
38754 </indexterm>
38755 </para>
38756 <informaltable frame="all">
38757 <tgroup cols="4" colsep="0" rowsep="0">
38758 <colspec colwidth="8*" align="left"/>
38759 <colspec colwidth="6*" align="center"/>
38760 <colspec colwidth="6*" align="center"/>
38761 <colspec colwidth="6*" align="right"/>
38762 <tbody>
38763 <row>
38764 <entry><option>quota_directory</option></entry>
38765 <entry>Use: <emphasis>appendfile</emphasis></entry>
38766 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38767 <entry>Default: <emphasis>unset</emphasis></entry>
38768 </row>
38769 </tbody>
38770 </tgroup>
38771 </informaltable>
38772 <para>
38773 This option defines the directory to check for quota purposes when delivering
38774 into individual files. The default is the delivery directory, or, if a file
38775 called <filename>maildirfolder</filename> exists in a maildir directory, the parent of the
38776 delivery directory.
38777 </para>
38778 <para>
38779 <indexterm role="option">
38780 <primary><option>quota_filecount</option></primary>
38781 </indexterm>
38782 </para>
38783 <informaltable frame="all">
38784 <tgroup cols="4" colsep="0" rowsep="0">
38785 <colspec colwidth="8*" align="left"/>
38786 <colspec colwidth="6*" align="center"/>
38787 <colspec colwidth="6*" align="center"/>
38788 <colspec colwidth="6*" align="right"/>
38789 <tbody>
38790 <row>
38791 <entry><option>quota_filecount</option></entry>
38792 <entry>Use: <emphasis>appendfile</emphasis></entry>
38793 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38794 <entry>Default: <emphasis>0</emphasis></entry>
38795 </row>
38796 </tbody>
38797 </tgroup>
38798 </informaltable>
38799 <para>
38800 This option applies when the <option>directory</option> option is set. It limits the total
38801 number of files in the directory (compare the inode limit in system quotas). It
38802 can only be used if <option>quota</option> is also set. The value is expanded; an expansion
38803 failure causes delivery to be deferred. A value of zero is interpreted as
38804 <quote>no quota</quote>.
38805 </para>
38806 <para>
38807 <indexterm role="option">
38808 <primary><option>quota_is_inclusive</option></primary>
38809 </indexterm>
38810 </para>
38811 <informaltable frame="all">
38812 <tgroup cols="4" colsep="0" rowsep="0">
38813 <colspec colwidth="8*" align="left"/>
38814 <colspec colwidth="6*" align="center"/>
38815 <colspec colwidth="6*" align="center"/>
38816 <colspec colwidth="6*" align="right"/>
38817 <tbody>
38818 <row>
38819 <entry><option>quota_is_inclusive</option></entry>
38820 <entry>Use: <emphasis>appendfile</emphasis></entry>
38821 <entry>Type: <emphasis>boolean</emphasis></entry>
38822 <entry>Default: <emphasis>true</emphasis></entry>
38823 </row>
38824 </tbody>
38825 </tgroup>
38826 </informaltable>
38827 <para>
38828 See <option>quota</option> above.
38829 </para>
38830 <para>
38831 <indexterm role="option">
38832 <primary><option>quota_size_regex</option></primary>
38833 </indexterm>
38834 </para>
38835 <informaltable frame="all">
38836 <tgroup cols="4" colsep="0" rowsep="0">
38837 <colspec colwidth="8*" align="left"/>
38838 <colspec colwidth="6*" align="center"/>
38839 <colspec colwidth="6*" align="center"/>
38840 <colspec colwidth="6*" align="right"/>
38841 <tbody>
38842 <row>
38843 <entry><option>quota_size_regex</option></entry>
38844 <entry>Use: <emphasis>appendfile</emphasis></entry>
38845 <entry>Type: <emphasis>string</emphasis></entry>
38846 <entry>Default: <emphasis>unset</emphasis></entry>
38847 </row>
38848 </tbody>
38849 </tgroup>
38850 </informaltable>
38851 <para>
38852 This option applies when one of the delivery modes that writes a separate file
38853 for each message is being used. When Exim wants to find the size of one of
38854 these files in order to test the quota, it first checks <option>quota_size_regex</option>.
38855 If this is set to a regular expression that matches the file name, and it
38856 captures one string, that string is interpreted as a representation of the
38857 file&#x2019;s size. The value of <option>quota_size_regex</option> is not expanded.
38858 </para>
38859 <para>
38860 This feature is useful only when users have no shell access to their mailboxes
38861 &ndash; otherwise they could defeat the quota simply by renaming the files. This
38862 facility can be used with maildir deliveries, by setting <option>maildir_tag</option> to add
38863 the file length to the file name. For example:
38864 </para>
38865 <literallayout class="monospaced">
38866 maildir_tag = ,S=$message_size
38867 quota_size_regex = ,S=(\d+)
38868 </literallayout>
38869 <para>
38870 An alternative to <varname>$message_size</varname> is <varname>$message_linecount</varname>, which contains the
38871 number of lines in the message.
38872 </para>
38873 <para>
38874 The regular expression should not assume that the length is at the end of the
38875 file name (even though <option>maildir_tag</option> puts it there) because maildir MUAs
38876 sometimes add other information onto the ends of message file names.
38877 </para>
38878 <para>
38879 Section <xref linkend="SECID136"/> contains further information.
38880 </para>
38881 <para>
38882 <indexterm role="option">
38883 <primary><option>quota_warn_message</option></primary>
38884 </indexterm>
38885 </para>
38886 <informaltable frame="all">
38887 <tgroup cols="4" colsep="0" rowsep="0">
38888 <colspec colwidth="8*" align="left"/>
38889 <colspec colwidth="6*" align="center"/>
38890 <colspec colwidth="6*" align="center"/>
38891 <colspec colwidth="6*" align="right"/>
38892 <tbody>
38893 <row>
38894 <entry><option>quota_warn_message</option></entry>
38895 <entry>Use: <emphasis>appendfile</emphasis></entry>
38896 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38897 <entry>Default: <emphasis>see below</emphasis></entry>
38898 </row>
38899 </tbody>
38900 </tgroup>
38901 </informaltable>
38902 <para>
38903 See below for the use of this option. If it is not set when
38904 <option>quota_warn_threshold</option> is set, it defaults to
38905 </para>
38906 <literallayout class="monospaced">
38907 quota_warn_message = "\
38908   To: $local_part@$domain\n\
38909   Subject: Your mailbox\n\n\
38910   This message is automatically created \
38911   by mail delivery software.\n\n\
38912   The size of your mailbox has exceeded \
38913   a warning threshold that is\n\
38914   set by the system administrator.\n"
38915 </literallayout>
38916 <para>
38917 <indexterm role="option">
38918 <primary><option>quota_warn_threshold</option></primary>
38919 </indexterm>
38920 </para>
38921 <informaltable frame="all">
38922 <tgroup cols="4" colsep="0" rowsep="0">
38923 <colspec colwidth="8*" align="left"/>
38924 <colspec colwidth="6*" align="center"/>
38925 <colspec colwidth="6*" align="center"/>
38926 <colspec colwidth="6*" align="right"/>
38927 <tbody>
38928 <row>
38929 <entry><option>quota_warn_threshold</option></entry>
38930 <entry>Use: <emphasis>appendfile</emphasis></entry>
38931 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38932 <entry>Default: <emphasis>0</emphasis></entry>
38933 </row>
38934 </tbody>
38935 </tgroup>
38936 </informaltable>
38937 <para>
38938 <indexterm role="concept">
38939 <primary>quota</primary>
38940 <secondary>warning threshold</secondary>
38941 </indexterm>
38942 <indexterm role="concept">
38943 <primary>mailbox</primary>
38944 <secondary>size warning</secondary>
38945 </indexterm>
38946 <indexterm role="concept">
38947 <primary>size</primary>
38948 <secondary>of mailbox</secondary>
38949 </indexterm>
38950 This option is expanded in the same way as <option>quota</option> (see above). If the
38951 resulting value is greater than zero, and delivery of the message causes the
38952 size of the file or total space in the directory tree to cross the given
38953 threshold, a warning message is sent. If <option>quota</option> is also set, the threshold
38954 may be specified as a percentage of it by following the value with a percent
38955 sign. For example:
38956 </para>
38957 <literallayout class="monospaced">
38958 quota = 10M
38959 quota_warn_threshold = 75%
38960 </literallayout>
38961 <para>
38962 If <option>quota</option> is not set, a setting of <option>quota_warn_threshold</option> that ends with a
38963 percent sign is ignored.
38964 </para>
38965 <para>
38966 The warning message itself is specified by the <option>quota_warn_message</option> option,
38967 and it must start with a <emphasis>To:</emphasis> header line containing the recipient(s) of the
38968 warning message. These do not necessarily have to include the recipient(s) of
38969 the original message. A <emphasis>Subject:</emphasis> line should also normally be supplied. You
38970 can include any other header lines that you want. If you do not include a
38971 <emphasis>From:</emphasis> line, the default is:
38972 </para>
38973 <literallayout class="monospaced">
38974 From: Mail Delivery System &lt;mailer-daemon@$qualify_domain_sender&gt;
38975 </literallayout>
38976 <para>
38977 <indexterm role="option">
38978 <primary><option>errors_reply_to</option></primary>
38979 </indexterm>
38980 If you supply a <emphasis>Reply-To:</emphasis> line, it overrides the global <option>errors_reply_to</option>
38981 option.
38982 </para>
38983 <para>
38984 The <option>quota</option> option does not have to be set in order to use this option; they
38985 are independent of one another except when the threshold is specified as a
38986 percentage.
38987 </para>
38988 <para>
38989 <indexterm role="option">
38990 <primary><option>use_bsmtp</option></primary>
38991 </indexterm>
38992 </para>
38993 <informaltable frame="all">
38994 <tgroup cols="4" colsep="0" rowsep="0">
38995 <colspec colwidth="8*" align="left"/>
38996 <colspec colwidth="6*" align="center"/>
38997 <colspec colwidth="6*" align="center"/>
38998 <colspec colwidth="6*" align="right"/>
38999 <tbody>
39000 <row>
39001 <entry><option>use_bsmtp</option></entry>
39002 <entry>Use: <emphasis>appendfile</emphasis></entry>
39003 <entry>Type: <emphasis>boolean</emphasis></entry>
39004 <entry>Default: <emphasis>false</emphasis></entry>
39005 </row>
39006 </tbody>
39007 </tgroup>
39008 </informaltable>
39009 <para>
39010 <indexterm role="concept">
39011 <primary>envelope sender</primary>
39012 </indexterm>
39013 If this option is set true, <command>appendfile</command> writes messages in <quote>batch SMTP</quote>
39014 format, with the envelope sender and recipient(s) included as SMTP commands. If
39015 you want to include a leading HELO command with such messages, you can do
39016 so by setting the <option>message_prefix</option> option. See section <xref linkend="SECTbatchSMTP"/>
39017 for details of batch SMTP.
39018 </para>
39019 <para>
39020 <indexterm role="option">
39021 <primary><option>use_crlf</option></primary>
39022 </indexterm>
39023 </para>
39024 <informaltable frame="all">
39025 <tgroup cols="4" colsep="0" rowsep="0">
39026 <colspec colwidth="8*" align="left"/>
39027 <colspec colwidth="6*" align="center"/>
39028 <colspec colwidth="6*" align="center"/>
39029 <colspec colwidth="6*" align="right"/>
39030 <tbody>
39031 <row>
39032 <entry><option>use_crlf</option></entry>
39033 <entry>Use: <emphasis>appendfile</emphasis></entry>
39034 <entry>Type: <emphasis>boolean</emphasis></entry>
39035 <entry>Default: <emphasis>false</emphasis></entry>
39036 </row>
39037 </tbody>
39038 </tgroup>
39039 </informaltable>
39040 <para>
39041 <indexterm role="concept">
39042 <primary>carriage return</primary>
39043 </indexterm>
39044 <indexterm role="concept">
39045 <primary>linefeed</primary>
39046 </indexterm>
39047 This option causes lines to be terminated with the two-character CRLF sequence
39048 (carriage return, linefeed) instead of just a linefeed character. In the case
39049 of batched SMTP, the byte sequence written to the file is then an exact image
39050 of what would be sent down a real SMTP connection.
39051 </para>
39052 <para>
39053 <emphasis role="bold">Note:</emphasis> The contents of the <option>message_prefix</option> and <option>message_suffix</option> options
39054 (which are used to supply the traditional <quote>From&nbsp;</quote> and blank line separators
39055 in Berkeley-style mailboxes) are written verbatim, so must contain their own
39056 carriage return characters if these are needed. In cases where these options
39057 have non-empty defaults, the values end with a single linefeed, so they must be
39058 changed to end with <literal>\r\n</literal> if <option>use_crlf</option> is set.
39059 </para>
39060 <para>
39061 <indexterm role="option">
39062 <primary><option>use_fcntl_lock</option></primary>
39063 </indexterm>
39064 </para>
39065 <informaltable frame="all">
39066 <tgroup cols="4" colsep="0" rowsep="0">
39067 <colspec colwidth="8*" align="left"/>
39068 <colspec colwidth="6*" align="center"/>
39069 <colspec colwidth="6*" align="center"/>
39070 <colspec colwidth="6*" align="right"/>
39071 <tbody>
39072 <row>
39073 <entry><option>use_fcntl_lock</option></entry>
39074 <entry>Use: <emphasis>appendfile</emphasis></entry>
39075 <entry>Type: <emphasis>boolean</emphasis></entry>
39076 <entry>Default: <emphasis>see below</emphasis></entry>
39077 </row>
39078 </tbody>
39079 </tgroup>
39080 </informaltable>
39081 <para>
39082 This option controls the use of the <function>fcntl()</function> function to lock a file for
39083 exclusive use when a message is being appended. It is set by default unless
39084 <option>use_flock_lock</option> is set. Otherwise, it should be turned off only if you know
39085 that all your MUAs use lock file locking. When both <option>use_fcntl_lock</option> and
39086 <option>use_flock_lock</option> are unset, <option>use_lockfile</option> must be set.
39087 </para>
39088 <para>
39089 <indexterm role="option">
39090 <primary><option>use_flock_lock</option></primary>
39091 </indexterm>
39092 </para>
39093 <informaltable frame="all">
39094 <tgroup cols="4" colsep="0" rowsep="0">
39095 <colspec colwidth="8*" align="left"/>
39096 <colspec colwidth="6*" align="center"/>
39097 <colspec colwidth="6*" align="center"/>
39098 <colspec colwidth="6*" align="right"/>
39099 <tbody>
39100 <row>
39101 <entry><option>use_flock_lock</option></entry>
39102 <entry>Use: <emphasis>appendfile</emphasis></entry>
39103 <entry>Type: <emphasis>boolean</emphasis></entry>
39104 <entry>Default: <emphasis>false</emphasis></entry>
39105 </row>
39106 </tbody>
39107 </tgroup>
39108 </informaltable>
39109 <para>
39110 This option is provided to support the use of <function>flock()</function> for file locking, for
39111 the few situations where it is needed. Most modern operating systems support
39112 <function>fcntl()</function> and <function>lockf()</function> locking, and these two functions interwork with
39113 each other. Exim uses <function>fcntl()</function> locking by default.
39114 </para>
39115 <para>
39116 This option is required only if you are using an operating system where
39117 <function>flock()</function> is used by programs that access mailboxes (typically MUAs), and
39118 where <function>flock()</function> does not correctly interwork with <function>fcntl()</function>. You can use
39119 both <function>fcntl()</function> and <function>flock()</function> locking simultaneously if you want.
39120 </para>
39121 <para>
39122 <indexterm role="concept">
39123 <primary>Solaris</primary>
39124 <secondary><function>flock()</function> support</secondary>
39125 </indexterm>
39126 Not all operating systems provide <function>flock()</function>. Some versions of Solaris do not
39127 have it (and some, I think, provide a not quite right version built on top of
39128 <function>lockf()</function>). If the OS does not have <function>flock()</function>, Exim will be built without
39129 the ability to use it, and any attempt to do so will cause a configuration
39130 error.
39131 </para>
39132 <para>
39133 <emphasis role="bold">Warning</emphasis>: <function>flock()</function> locks do not work on NFS files (unless <function>flock()</function>
39134 is just being mapped onto <function>fcntl()</function> by the OS).
39135 </para>
39136 <para>
39137 <indexterm role="option">
39138 <primary><option>use_lockfile</option></primary>
39139 </indexterm>
39140 </para>
39141 <informaltable frame="all">
39142 <tgroup cols="4" colsep="0" rowsep="0">
39143 <colspec colwidth="8*" align="left"/>
39144 <colspec colwidth="6*" align="center"/>
39145 <colspec colwidth="6*" align="center"/>
39146 <colspec colwidth="6*" align="right"/>
39147 <tbody>
39148 <row>
39149 <entry><option>use_lockfile</option></entry>
39150 <entry>Use: <emphasis>appendfile</emphasis></entry>
39151 <entry>Type: <emphasis>boolean</emphasis></entry>
39152 <entry>Default: <emphasis>see below</emphasis></entry>
39153 </row>
39154 </tbody>
39155 </tgroup>
39156 </informaltable>
39157 <para>
39158 If this option is turned off, Exim does not attempt to create a lock file when
39159 appending to a mailbox file. In this situation, the only locking is by
39160 <function>fcntl()</function>. You should only turn <option>use_lockfile</option> off if you are absolutely
39161 sure that every MUA that is ever going to look at your users&#x2019; mailboxes uses
39162 <function>fcntl()</function> rather than a lock file, and even then only when you are not
39163 delivering over NFS from more than one host.
39164 </para>
39165 <para>
39166 <indexterm role="concept">
39167 <primary>NFS</primary>
39168 <secondary>lock file</secondary>
39169 </indexterm>
39170 In order to append to an NFS file safely from more than one host, it is
39171 necessary to take out a lock <emphasis>before</emphasis> opening the file, and the lock file
39172 achieves this. Otherwise, even with <function>fcntl()</function> locking, there is a risk of
39173 file corruption.
39174 </para>
39175 <para>
39176 The <option>use_lockfile</option> option is set by default unless <option>use_mbx_lock</option> is set.
39177 It is not possible to turn both <option>use_lockfile</option> and <option>use_fcntl_lock</option> off,
39178 except when <option>mbx_format</option> is set.
39179 </para>
39180 <para>
39181 <indexterm role="option">
39182 <primary><option>use_mbx_lock</option></primary>
39183 </indexterm>
39184 </para>
39185 <informaltable frame="all">
39186 <tgroup cols="4" colsep="0" rowsep="0">
39187 <colspec colwidth="8*" align="left"/>
39188 <colspec colwidth="6*" align="center"/>
39189 <colspec colwidth="6*" align="center"/>
39190 <colspec colwidth="6*" align="right"/>
39191 <tbody>
39192 <row>
39193 <entry><option>use_mbx_lock</option></entry>
39194 <entry>Use: <emphasis>appendfile</emphasis></entry>
39195 <entry>Type: <emphasis>boolean</emphasis></entry>
39196 <entry>Default: <emphasis>see below</emphasis></entry>
39197 </row>
39198 </tbody>
39199 </tgroup>
39200 </informaltable>
39201 <para>
39202 This option is available only if Exim has been compiled with SUPPORT_MBX
39203 set in <filename>Local/Makefile</filename>. Setting the option specifies that special MBX
39204 locking rules be used. It is set by default if <option>mbx_format</option> is set and none
39205 of the locking options are mentioned in the configuration. The locking rules
39206 are the same as are used by the <emphasis>c-client</emphasis> library that underlies Pine and
39207 the IMAP4 and POP daemons that come with it (see the discussion below). The
39208 rules allow for shared access to the mailbox. However, this kind of locking
39209 does not work when the mailbox is NFS mounted.
39210 </para>
39211 <para>
39212 You can set <option>use_mbx_lock</option> with either (or both) of <option>use_fcntl_lock</option> and
39213 <option>use_flock_lock</option> to control what kind of locking is used in implementing the
39214 MBX locking rules. The default is to use <function>fcntl()</function> if <option>use_mbx_lock</option> is set
39215 without <option>use_fcntl_lock</option> or <option>use_flock_lock</option>.
39216 </para>
39217 </section>
39218 <section id="SECTopappend">
39219 <title>Operational details for appending</title>
39220 <para>
39221 <indexterm role="concept">
39222 <primary>appending to a file</primary>
39223 </indexterm>
39224 <indexterm role="concept">
39225 <primary>file</primary>
39226 <secondary>appending</secondary>
39227 </indexterm>
39228 Before appending to a file, the following preparations are made:
39229 </para>
39230 <itemizedlist>
39231 <listitem>
39232 <para>
39233 If the name of the file is <filename>/dev/null</filename>, no action is taken, and a success
39234 return is given.
39235 </para>
39236 </listitem>
39237 <listitem>
39238 <para>
39239 <indexterm role="concept">
39240 <primary>directory creation</primary>
39241 </indexterm>
39242 If any directories on the file&#x2019;s path are missing, Exim creates them if the
39243 <option>create_directory</option> option is set. A created directory&#x2019;s mode is given by the
39244 <option>directory_mode</option> option.
39245 </para>
39246 </listitem>
39247 <listitem>
39248 <para>
39249 If <option>file_format</option> is set, the format of an existing file is checked. If this
39250 indicates that a different transport should be used, control is passed to that
39251 transport.
39252 </para>
39253 </listitem>
39254 <listitem>
39255 <para>
39256 <indexterm role="concept">
39257 <primary>file</primary>
39258 <secondary>locking</secondary>
39259 </indexterm>
39260 <indexterm role="concept">
39261 <primary>locking files</primary>
39262 </indexterm>
39263 <indexterm role="concept">
39264 <primary>NFS</primary>
39265 <secondary>lock file</secondary>
39266 </indexterm>
39267 If <option>use_lockfile</option> is set, a lock file is built in a way that will work
39268 reliably over NFS, as follows:
39269 </para>
39270 <orderedlist numeration="arabic">
39271 <listitem>
39272 <para>
39273 Create a <quote>hitching post</quote> file whose name is that of the lock file with the
39274 current time, primary host name, and process id added, by opening for writing
39275 as a new file. If this fails with an access error, delivery is deferred.
39276 </para>
39277 </listitem>
39278 <listitem>
39279 <para>
39280 Close the hitching post file, and hard link it to the lock file name.
39281 </para>
39282 </listitem>
39283 <listitem>
39284 <para>
39285 If the call to <function>link()</function> succeeds, creation of the lock file has succeeded.
39286 Unlink the hitching post name.
39287 </para>
39288 </listitem>
39289 <listitem>
39290 <para>
39291 Otherwise, use <function>stat()</function> to get information about the hitching post file, and
39292 then unlink hitching post name. If the number of links is exactly two, creation
39293 of the lock file succeeded but something (for example, an NFS server crash and
39294 restart) caused this fact not to be communicated to the <function>link()</function> call.
39295 </para>
39296 </listitem>
39297 <listitem>
39298 <para>
39299 If creation of the lock file failed, wait for <option>lock_interval</option> and try again,
39300 up to <option>lock_retries</option> times. However, since any program that writes to a
39301 mailbox should complete its task very quickly, it is reasonable to time out old
39302 lock files that are normally the result of user agent and system crashes. If an
39303 existing lock file is older than <option>lockfile_timeout</option> Exim attempts to unlink
39304 it before trying again.
39305 </para>
39306 </listitem>
39307 </orderedlist>
39308 </listitem>
39309 <listitem>
39310 <para>
39311 A call is made to <function>lstat()</function> to discover whether the main file exists, and if
39312 so, what its characteristics are. If <function>lstat()</function> fails for any reason other
39313 than non-existence, delivery is deferred.
39314 </para>
39315 </listitem>
39316 <listitem>
39317 <para>
39318 <indexterm role="concept">
39319 <primary>symbolic link</primary>
39320 <secondary>to mailbox</secondary>
39321 </indexterm>
39322 <indexterm role="concept">
39323 <primary>mailbox</primary>
39324 <secondary>symbolic link</secondary>
39325 </indexterm>
39326 If the file does exist and is a symbolic link, delivery is deferred, unless the
39327 <option>allow_symlink</option> option is set, in which case the ownership of the link is
39328 checked, and then <function>stat()</function> is called to find out about the real file, which
39329 is then subjected to the checks below. The check on the top-level link
39330 ownership prevents one user creating a link for another&#x2019;s mailbox in a sticky
39331 directory, though allowing symbolic links in this case is definitely not a good
39332 idea. If there is a chain of symbolic links, the intermediate ones are not
39333 checked.
39334 </para>
39335 </listitem>
39336 <listitem>
39337 <para>
39338 If the file already exists but is not a regular file, or if the file&#x2019;s owner
39339 and group (if the group is being checked &ndash; see <option>check_group</option> above) are
39340 different from the user and group under which the delivery is running,
39341 delivery is deferred.
39342 </para>
39343 </listitem>
39344 <listitem>
39345 <para>
39346 If the file&#x2019;s permissions are more generous than specified, they are reduced.
39347 If they are insufficient, delivery is deferred, unless <option>mode_fail_narrower</option>
39348 is set false, in which case the delivery is tried using the existing
39349 permissions.
39350 </para>
39351 </listitem>
39352 <listitem>
39353 <para>
39354 The file&#x2019;s inode number is saved, and the file is then opened for appending.
39355 If this fails because the file has vanished, <command>appendfile</command> behaves as if it
39356 hadn&#x2019;t existed (see below). For any other failures, delivery is deferred.
39357 </para>
39358 </listitem>
39359 <listitem>
39360 <para>
39361 If the file is opened successfully, check that the inode number hasn&#x2019;t
39362 changed, that it is still a regular file, and that the owner and permissions
39363 have not changed. If anything is wrong, defer delivery and freeze the message.
39364 </para>
39365 </listitem>
39366 <listitem>
39367 <para>
39368 If the file did not exist originally, defer delivery if the <option>file_must_exist</option>
39369 option is set. Otherwise, check that the file is being created in a permitted
39370 directory if the <option>create_file</option> option is set (deferring on failure), and then
39371 open for writing as a new file, with the O_EXCL and O_CREAT options,
39372 except when dealing with a symbolic link (the <option>allow_symlink</option> option must be
39373 set). In this case, which can happen if the link points to a non-existent file,
39374 the file is opened for writing using O_CREAT but not O_EXCL, because
39375 that prevents link following.
39376 </para>
39377 </listitem>
39378 <listitem>
39379 <para>
39380 <indexterm role="concept">
39381 <primary>loop</primary>
39382 <secondary>while file testing</secondary>
39383 </indexterm>
39384 If opening fails because the file exists, obey the tests given above for
39385 existing files. However, to avoid looping in a situation where the file is
39386 being continuously created and destroyed, the exists/not-exists loop is broken
39387 after 10 repetitions, and the message is then frozen.
39388 </para>
39389 </listitem>
39390 <listitem>
39391 <para>
39392 If opening fails with any other error, defer delivery.
39393 </para>
39394 </listitem>
39395 <listitem>
39396 <para>
39397 <indexterm role="concept">
39398 <primary>file</primary>
39399 <secondary>locking</secondary>
39400 </indexterm>
39401 <indexterm role="concept">
39402 <primary>locking files</primary>
39403 </indexterm>
39404 Once the file is open, unless both <option>use_fcntl_lock</option> and <option>use_flock_lock</option>
39405 are false, it is locked using <function>fcntl()</function> or <function>flock()</function> or both. If
39406 <option>use_mbx_lock</option> is false, an exclusive lock is requested in each case.
39407 However, if <option>use_mbx_lock</option> is true, Exim takes out a shared lock on the open
39408 file, and an exclusive lock on the file whose name is
39409 </para>
39410 <literallayout class="monospaced">
39411 /tmp/.&lt;device-number&gt;.&lt;inode-number&gt;
39412 </literallayout>
39413 <para>
39414 using the device and inode numbers of the open mailbox file, in accordance with
39415 the MBX locking rules. This file is created with a mode that is specified by
39416 the <option>lockfile_mode</option> option.
39417 </para>
39418 <para>
39419 If Exim fails to lock the file, there are two possible courses of action,
39420 depending on the value of the locking timeout. This is obtained from
39421 <option>lock_fcntl_timeout</option> or <option>lock_flock_timeout</option>, as appropriate.
39422 </para>
39423 <para>
39424 If the timeout value is zero, the file is closed, Exim waits for
39425 <option>lock_interval</option>, and then goes back and re-opens the file as above and tries
39426 to lock it again. This happens up to <option>lock_retries</option> times, after which the
39427 delivery is deferred.
39428 </para>
39429 <para>
39430 If the timeout has a value greater than zero, blocking calls to <function>fcntl()</function> or
39431 <function>flock()</function> are used (with the given timeout), so there has already been some
39432 waiting involved by the time locking fails. Nevertheless, Exim does not give up
39433 immediately. It retries up to
39434 </para>
39435 <literallayout class="monospaced">
39436 (lock_retries * lock_interval) / &lt;timeout&gt;
39437 </literallayout>
39438 <para>
39439 times (rounded up).
39440 </para>
39441 </listitem>
39442 </itemizedlist>
39443 <para>
39444 At the end of delivery, Exim closes the file (which releases the <function>fcntl()</function>
39445 and/or <function>flock()</function> locks) and then deletes the lock file if one was created.
39446 </para>
39447 </section>
39448 <section id="SECTopdir">
39449 <title>Operational details for delivery to a new file</title>
39450 <para>
39451 <indexterm role="concept">
39452 <primary>delivery</primary>
39453 <secondary>to single file</secondary>
39454 </indexterm>
39455 <indexterm role="concept">
39456 <primary><quote>From</quote> line</primary>
39457 </indexterm>
39458 When the <option>directory</option> option is set instead of <option>file</option>, each message is
39459 delivered into a newly-created file or set of files. When <command>appendfile</command> is
39460 activated directly from a <command>redirect</command> router, neither <option>file</option> nor
39461 <option>directory</option> is normally set, because the path for delivery is supplied by the
39462 router. (See for example, the <command>address_file</command> transport in the default
39463 configuration.) In this case, delivery is to a new file if either the path name
39464 ends in <literal>/</literal>, or the <option>maildir_format</option> or <option>mailstore_format</option> option is set.
39465 </para>
39466 <para>
39467 No locking is required while writing the message to a new file, so the various
39468 locking options of the transport are ignored. The <quote>From</quote> line that by default
39469 separates messages in a single file is not normally needed, nor is the escaping
39470 of message lines that start with <quote>From</quote>, and there is no need to ensure a
39471 newline at the end of each message. Consequently, the default values for
39472 <option>check_string</option>, <option>message_prefix</option>, and <option>message_suffix</option> are all unset when
39473 any of <option>directory</option>, <option>maildir_format</option>, or <option>mailstore_format</option> is set.
39474 </para>
39475 <para>
39476 If Exim is required to check a <option>quota</option> setting, it adds up the sizes of all
39477 the files in the delivery directory by default. However, you can specify a
39478 different directory by setting <option>quota_directory</option>. Also, for maildir
39479 deliveries (see below) the <filename>maildirfolder</filename> convention is honoured.
39480 </para>
39481 <para>
39482 <indexterm role="concept">
39483 <primary>maildir format</primary>
39484 </indexterm>
39485 <indexterm role="concept">
39486 <primary>mailstore format</primary>
39487 </indexterm>
39488 There are three different ways in which delivery to individual files can be
39489 done, controlled by the settings of the <option>maildir_format</option> and
39490 <option>mailstore_format</option> options. Note that code to support maildir or mailstore
39491 formats is not included in the binary unless SUPPORT_MAILDIR or
39492 SUPPORT_MAILSTORE, respectively, is set in <filename>Local/Makefile</filename>.
39493 </para>
39494 <para>
39495 <indexterm role="concept">
39496 <primary>directory creation</primary>
39497 </indexterm>
39498 In all three cases an attempt is made to create the directory and any necessary
39499 sub-directories if they do not exist, provided that the <option>create_directory</option>
39500 option is set (the default). The location of a created directory can be
39501 constrained by setting <option>create_file</option>. A created directory&#x2019;s mode is given by
39502 the <option>directory_mode</option> option. If creation fails, or if the
39503 <option>create_directory</option> option is not set when creation is required, delivery is
39504 deferred.
39505 </para>
39506 </section>
39507 <section id="SECTmaildirdelivery">
39508 <title>Maildir delivery</title>
39509 <para>
39510 <indexterm role="concept">
39511 <primary>maildir format</primary>
39512 <secondary>description of</secondary>
39513 </indexterm>
39514 If the <option>maildir_format</option> option is true, Exim delivers each message by writing
39515 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
39516 directory that is defined by the <option>directory</option> option (the <quote>delivery
39517 directory</quote>). If the delivery is successful, the file is renamed into the
39518 <filename>new</filename> subdirectory.
39519 </para>
39520 <para>
39521 In the file name, &lt;<emphasis>stime</emphasis>&gt; is the current time of day in seconds, and
39522 &lt;<emphasis>mtime</emphasis>&gt; is the microsecond fraction of the time. After a maildir delivery,
39523 Exim checks that the time-of-day clock has moved on by at least one microsecond
39524 before terminating the delivery process. This guarantees uniqueness for the
39525 file name. However, as a precaution, Exim calls <function>stat()</function> for the file before
39526 opening it. If any response other than ENOENT (does not exist) is given,
39527 Exim waits 2 seconds and tries again, up to <option>maildir_retries</option> times.
39528 </para>
39529 <para>
39530 Before Exim carries out a maildir delivery, it ensures that subdirectories
39531 called <filename>new</filename>, <filename>cur</filename>, and <filename>tmp</filename> exist in the delivery directory. If they
39532 do not exist, Exim tries to create them and any superior directories in their
39533 path, subject to the <option>create_directory</option> and <option>create_file</option> options. If the
39534 <option>maildirfolder_create_regex</option> option is set, and the regular expression it
39535 contains matches the delivery directory, Exim also ensures that a file called
39536 <filename>maildirfolder</filename> exists in the delivery directory. If a missing directory or
39537 <filename>maildirfolder</filename> file cannot be created, delivery is deferred.
39538 </para>
39539 <para>
39540 These features make it possible to use Exim to create all the necessary files
39541 and directories in a maildir mailbox, including subdirectories for maildir++
39542 folders. Consider this example:
39543 </para>
39544 <literallayout class="monospaced">
39545 maildir_format = true
39546 directory = /var/mail/$local_part\
39547            ${if eq{$local_part_suffix}{}{}\
39548            {/.${substr_1:$local_part_suffix}}}
39549 maildirfolder_create_regex = /\.[^/]+$
39550 </literallayout>
39551 <para>
39552 If <varname>$local_part_suffix</varname> is empty (there was no suffix for the local part),
39553 delivery is into a toplevel maildir with a name like <filename>/var/mail/pimbo</filename> (for
39554 the user called <emphasis>pimbo</emphasis>). The pattern in <option>maildirfolder_create_regex</option> does
39555 not match this name, so Exim will not look for or create the file
39556 <filename>/var/mail/pimbo/maildirfolder</filename>, though it will create
39557 <filename>/var/mail/pimbo/{cur,new,tmp}</filename> if necessary.
39558 </para>
39559 <para>
39560 However, if <varname>$local_part_suffix</varname> contains <literal>-eximusers</literal> (for example),
39561 delivery is into the maildir++ folder <filename>/var/mail/pimbo/.eximusers</filename>, which
39562 does match <option>maildirfolder_create_regex</option>. In this case, Exim will create
39563 <filename>/var/mail/pimbo/.eximusers/maildirfolder</filename> as well as the three maildir
39564 directories <filename>/var/mail/pimbo/.eximusers/{cur,new,tmp}</filename>.
39565 </para>
39566 <para>
39567 <emphasis role="bold">Warning:</emphasis> Take care when setting <option>maildirfolder_create_regex</option> that it does
39568 not inadvertently match the toplevel maildir directory, because a
39569 <filename>maildirfolder</filename> file at top level would completely break quota calculations.
39570 </para>
39571 <para>
39572 <indexterm role="concept">
39573 <primary>quota</primary>
39574 <secondary>in maildir delivery</secondary>
39575 </indexterm>
39576 <indexterm role="concept">
39577 <primary>maildir++</primary>
39578 </indexterm>
39579 If Exim is required to check a <option>quota</option> setting before a maildir delivery, and
39580 <option>quota_directory</option> is not set, it looks for a file called <filename>maildirfolder</filename> in
39581 the maildir directory (alongside <filename>new</filename>, <filename>cur</filename>, <filename>tmp</filename>). If this exists,
39582 Exim assumes the directory is a maildir++ folder directory, which is one level
39583 down from the user&#x2019;s top level mailbox directory. This causes it to start at
39584 the parent directory instead of the current directory when calculating the
39585 amount of space used.
39586 </para>
39587 <para>
39588 One problem with delivering into a multi-file mailbox is that it is
39589 computationally expensive to compute the size of the mailbox for quota
39590 checking. Various approaches have been taken to reduce the amount of work
39591 needed. The next two sections describe two of them. A third alternative is to
39592 use some external process for maintaining the size data, and use the expansion
39593 of the <option>mailbox_size</option> option as a way of importing it into Exim.
39594 </para>
39595 </section>
39596 <section id="SECID135">
39597 <title>Using tags to record message sizes</title>
39598 <para>
39599 If <option>maildir_tag</option> is set, the string is expanded for each delivery.
39600 When the maildir file is renamed into the <filename>new</filename> sub-directory, the
39601 tag is added to its name. However, if adding the tag takes the length of the
39602 name to the point where the test <function>stat()</function> call fails with ENAMETOOLONG,
39603 the tag is dropped and the maildir file is created with no tag.
39604 </para>
39605 <para revisionflag="changed">
39606 <indexterm role="variable">
39607 <primary><varname>$message_size</varname></primary>
39608 </indexterm>
39609 Tags can be used to encode the size of files in their names; see
39610 <option>quota_size_regex</option> above for an example. The expansion of <option>maildir_tag</option>
39611 happens after the message has been written. The value of the <varname>$message_size</varname>
39612 variable is set to the number of bytes actually written. If the expansion is
39613 forced to fail, the tag is ignored, but a non-forced failure causes delivery to
39614 be deferred. The expanded tag may contain any printing characters except <quote>/</quote>.
39615 Non-printing characters in the string are ignored; if the resulting string is
39616 empty, it is ignored. If it starts with an alphanumeric character, a leading
39617 colon is inserted; this default has not proven to be the path that popular
39618 maildir implementations have chosen (but changing it in Exim would break
39619 backwards compatibility).
39620 </para>
39621 <para revisionflag="changed">
39622 For one common implementation, you might set:
39623 </para>
39624 <literallayout class="monospaced" revisionflag="changed">
39625 maildir_tag = ,S=${message_size}
39626 </literallayout>
39627 <para revisionflag="changed">
39628 but you should check the documentation of the other software to be sure.
39629 </para>
39630 <para revisionflag="changed">
39631 It is advisable to also set <option>quota_size_regex</option> when setting <option>maildir_tag</option>
39632 as this allows Exim to extract the size from your tag, instead of having to
39633 <function>stat()</function> each message file.
39634 </para>
39635 </section>
39636 <section id="SECID136">
39637 <title>Using a maildirsize file</title>
39638 <para>
39639 <indexterm role="concept">
39640 <primary>quota</primary>
39641 <secondary>in maildir delivery</secondary>
39642 </indexterm>
39643 <indexterm role="concept">
39644 <primary>maildir format</primary>
39645 <secondary><filename>maildirsize</filename> file</secondary>
39646 </indexterm>
39647 If <option>maildir_use_size_file</option> is true, Exim implements the maildir++ rules for
39648 storing quota and message size information in a file called <filename>maildirsize</filename>
39649 within the toplevel maildir directory. If this file does not exist, Exim
39650 creates it, setting the quota from the <option>quota</option> option of the transport. If
39651 the maildir directory itself does not exist, it is created before any attempt
39652 to write a <filename>maildirsize</filename> file.
39653 </para>
39654 <para>
39655 The <filename>maildirsize</filename> file is used to hold information about the sizes of
39656 messages in the maildir, thus speeding up quota calculations. The quota value
39657 in the file is just a cache; if the quota is changed in the transport, the new
39658 value overrides the cached value when the next message is delivered. The cache
39659 is maintained for the benefit of other programs that access the maildir and
39660 need to know the quota.
39661 </para>
39662 <para>
39663 If the <option>quota</option> option in the transport is unset or zero, the <filename>maildirsize</filename>
39664 file is maintained (with a zero quota setting), but no quota is imposed.
39665 </para>
39666 <para>
39667 A regular expression is available for controlling which directories in the
39668 maildir participate in quota calculations when a <filename>maildirsizefile</filename> is in use.
39669 See the description of the <option>maildir_quota_directory_regex</option> option above for
39670 details.
39671 </para>
39672 </section>
39673 <section id="SECID137">
39674 <title>Mailstore delivery</title>
39675 <para>
39676 <indexterm role="concept">
39677 <primary>mailstore format</primary>
39678 <secondary>description of</secondary>
39679 </indexterm>
39680 If the <option>mailstore_format</option> option is true, each message is written as two
39681 files in the given directory. A unique base name is constructed from the
39682 message id and the current delivery process, and the files that are written use
39683 this base name plus the suffixes <filename>.env</filename> and <filename>.msg</filename>. The <filename>.env</filename> file
39684 contains the message&#x2019;s envelope, and the <filename>.msg</filename> file contains the message
39685 itself. The base name is placed in the variable <varname>$mailstore_basename</varname>.
39686 </para>
39687 <para>
39688 During delivery, the envelope is first written to a file with the suffix
39689 <filename>.tmp</filename>. The <filename>.msg</filename> file is then written, and when it is complete, the
39690 <filename>.tmp</filename> file is renamed as the <filename>.env</filename> file. Programs that access messages in
39691 mailstore format should wait for the presence of both a <filename>.msg</filename> and a <filename>.env</filename>
39692 file before accessing either of them. An alternative approach is to wait for
39693 the absence of a <filename>.tmp</filename> file.
39694 </para>
39695 <para>
39696 The envelope file starts with any text defined by the <option>mailstore_prefix</option>
39697 option, expanded and terminated by a newline if there isn&#x2019;t one. Then follows
39698 the sender address on one line, then all the recipient addresses, one per line.
39699 There can be more than one recipient only if the <option>batch_max</option> option is set
39700 greater than one. Finally, <option>mailstore_suffix</option> is expanded and the result
39701 appended to the file, followed by a newline if it does not end with one.
39702 </para>
39703 <para>
39704 If expansion of <option>mailstore_prefix</option> or <option>mailstore_suffix</option> ends with a forced
39705 failure, it is ignored. Other expansion errors are treated as serious
39706 configuration errors, and delivery is deferred. The variable
39707 <varname>$mailstore_basename</varname> is available for use during these expansions.
39708 </para>
39709 </section>
39710 <section id="SECID138">
39711 <title>Non-special new file delivery</title>
39712 <para>
39713 If neither <option>maildir_format</option> nor <option>mailstore_format</option> is set, a single new
39714 file is created directly in the named directory. For example, when delivering
39715 messages into files in batched SMTP format for later delivery to some host (see
39716 section <xref linkend="SECTbatchSMTP"/>), a setting such as
39717 </para>
39718 <literallayout class="monospaced">
39719 directory = /var/bsmtp/$host
39720 </literallayout>
39721 <para>
39722 might be used. A message is written to a file with a temporary name, which is
39723 then renamed when the delivery is complete. The final name is obtained by
39724 expanding the contents of the <option>directory_file</option> option.
39725 <indexterm role="concept" startref="IIDapptra1" class="endofrange"/>
39726 <indexterm role="concept" startref="IIDapptra2" class="endofrange"/>
39727 </para>
39728 </section>
39729 </chapter>
39730
39731 <chapter id="CHID8">
39732 <title>The autoreply transport</title>
39733 <para>
39734 <indexterm role="concept" id="IIDauttra1" class="startofrange">
39735 <primary>transports</primary>
39736 <secondary><command>autoreply</command></secondary>
39737 </indexterm>
39738 <indexterm role="concept" id="IIDauttra2" class="startofrange">
39739 <primary><command>autoreply</command> transport</primary>
39740 </indexterm>
39741 The <command>autoreply</command> transport is not a true transport in that it does not cause
39742 the message to be transmitted. Instead, it generates a new mail message as an
39743 automatic reply to the incoming message. <emphasis>References:</emphasis> and
39744 <emphasis>Auto-Submitted:</emphasis> header lines are included. These are constructed according
39745 to the rules in RFCs 2822 and 3834, respectively.
39746 </para>
39747 <para>
39748 If the router that passes the message to this transport does not have the
39749 <option>unseen</option> option set, the original message (for the current recipient) is not
39750 delivered anywhere. However, when the <option>unseen</option> option is set on the router
39751 that passes the message to this transport, routing of the address continues, so
39752 another router can set up a normal message delivery.
39753 </para>
39754 <para>
39755 The <command>autoreply</command> transport is usually run as the result of mail filtering, a
39756 <quote>vacation</quote> message being the standard example. However, it can also be run
39757 directly from a router like any other transport. To reduce the possibility of
39758 message cascades, messages created by the <command>autoreply</command> transport always have
39759 empty envelope sender addresses, like bounce messages.
39760 </para>
39761 <para>
39762 The parameters of the message to be sent can be specified in the configuration
39763 by options described below. However, these are used only when the address
39764 passed to the transport does not contain its own reply information. When the
39765 transport is run as a consequence of a
39766 <option>mail</option>
39767 or <option>vacation</option> command in a filter file, the parameters of the message are
39768 supplied by the filter, and passed with the address. The transport&#x2019;s options
39769 that define the message are then ignored (so they are not usually set in this
39770 case). The message is specified entirely by the filter or by the transport; it
39771 is never built from a mixture of options. However, the <option>file_optional</option>,
39772 <option>mode</option>, and <option>return_message</option> options apply in all cases.
39773 </para>
39774 <para>
39775 <command>Autoreply</command> is implemented as a local transport. When used as a result of a
39776 command in a user&#x2019;s filter file, <command>autoreply</command> normally runs under the uid and
39777 gid of the user, and with appropriate current and home directories (see chapter
39778 <xref linkend="CHAPenvironment"/>).
39779 </para>
39780 <para>
39781 There is a subtle difference between routing a message to a <command>pipe</command> transport
39782 that generates some text to be returned to the sender, and routing it to an
39783 <command>autoreply</command> transport. This difference is noticeable only if more than one
39784 address from the same message is so handled. In the case of a pipe, the
39785 separate outputs from the different addresses are gathered up and returned to
39786 the sender in a single message, whereas if <command>autoreply</command> is used, a separate
39787 message is generated for each address that is passed to it.
39788 </para>
39789 <para>
39790 Non-printing characters are not permitted in the header lines generated for the
39791 message that <command>autoreply</command> creates, with the exception of newlines that are
39792 immediately followed by white space. If any non-printing characters are found,
39793 the transport defers.
39794 Whether characters with the top bit set count as printing characters or not is
39795 controlled by the <option>print_topbitchars</option> global option.
39796 </para>
39797 <para>
39798 If any of the generic options for manipulating headers (for example,
39799 <option>headers_add</option>) are set on an <command>autoreply</command> transport, they apply to the copy
39800 of the original message that is included in the generated message when
39801 <option>return_message</option> is set. They do not apply to the generated message itself.
39802 </para>
39803 <para>
39804 <indexterm role="variable">
39805 <primary><varname>$sender_address</varname></primary>
39806 </indexterm>
39807 If the <command>autoreply</command> transport receives return code 2 from Exim when it submits
39808 the message, indicating that there were no recipients, it does not treat this
39809 as an error. This means that autoreplies sent to <varname>$sender_address</varname> when this
39810 is empty (because the incoming message is a bounce message) do not cause
39811 problems. They are just discarded.
39812 </para>
39813 <section id="SECID139">
39814 <title>Private options for autoreply</title>
39815 <para>
39816 <indexterm role="concept">
39817 <primary>options</primary>
39818 <secondary><command>autoreply</command> transport</secondary>
39819 </indexterm>
39820 </para>
39821 <para>
39822 <indexterm role="option">
39823 <primary><option>bcc</option></primary>
39824 </indexterm>
39825 </para>
39826 <informaltable frame="all">
39827 <tgroup cols="4" colsep="0" rowsep="0">
39828 <colspec colwidth="8*" align="left"/>
39829 <colspec colwidth="6*" align="center"/>
39830 <colspec colwidth="6*" align="center"/>
39831 <colspec colwidth="6*" align="right"/>
39832 <tbody>
39833 <row>
39834 <entry><option>bcc</option></entry>
39835 <entry>Use: <emphasis>autoreply</emphasis></entry>
39836 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39837 <entry>Default: <emphasis>unset</emphasis></entry>
39838 </row>
39839 </tbody>
39840 </tgroup>
39841 </informaltable>
39842 <para>
39843 This specifies the addresses that are to receive <quote>blind carbon copies</quote> of the
39844 message when the message is specified by the transport.
39845 </para>
39846 <para>
39847 <indexterm role="option">
39848 <primary><option>cc</option></primary>
39849 </indexterm>
39850 </para>
39851 <informaltable frame="all">
39852 <tgroup cols="4" colsep="0" rowsep="0">
39853 <colspec colwidth="8*" align="left"/>
39854 <colspec colwidth="6*" align="center"/>
39855 <colspec colwidth="6*" align="center"/>
39856 <colspec colwidth="6*" align="right"/>
39857 <tbody>
39858 <row>
39859 <entry><option>cc</option></entry>
39860 <entry>Use: <emphasis>autoreply</emphasis></entry>
39861 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39862 <entry>Default: <emphasis>unset</emphasis></entry>
39863 </row>
39864 </tbody>
39865 </tgroup>
39866 </informaltable>
39867 <para>
39868 This specifies recipients of the message and the contents of the <emphasis>Cc:</emphasis> header
39869 when the message is specified by the transport.
39870 </para>
39871 <para>
39872 <indexterm role="option">
39873 <primary><option>file</option></primary>
39874 </indexterm>
39875 </para>
39876 <informaltable frame="all">
39877 <tgroup cols="4" colsep="0" rowsep="0">
39878 <colspec colwidth="8*" align="left"/>
39879 <colspec colwidth="6*" align="center"/>
39880 <colspec colwidth="6*" align="center"/>
39881 <colspec colwidth="6*" align="right"/>
39882 <tbody>
39883 <row>
39884 <entry><option>file</option></entry>
39885 <entry>Use: <emphasis>autoreply</emphasis></entry>
39886 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39887 <entry>Default: <emphasis>unset</emphasis></entry>
39888 </row>
39889 </tbody>
39890 </tgroup>
39891 </informaltable>
39892 <para>
39893 The contents of the file are sent as the body of the message when the message
39894 is specified by the transport. If both <option>file</option> and <option>text</option> are set, the text
39895 string comes first.
39896 </para>
39897 <para>
39898 <indexterm role="option">
39899 <primary><option>file_expand</option></primary>
39900 </indexterm>
39901 </para>
39902 <informaltable frame="all">
39903 <tgroup cols="4" colsep="0" rowsep="0">
39904 <colspec colwidth="8*" align="left"/>
39905 <colspec colwidth="6*" align="center"/>
39906 <colspec colwidth="6*" align="center"/>
39907 <colspec colwidth="6*" align="right"/>
39908 <tbody>
39909 <row>
39910 <entry><option>file_expand</option></entry>
39911 <entry>Use: <emphasis>autoreply</emphasis></entry>
39912 <entry>Type: <emphasis>boolean</emphasis></entry>
39913 <entry>Default: <emphasis>false</emphasis></entry>
39914 </row>
39915 </tbody>
39916 </tgroup>
39917 </informaltable>
39918 <para>
39919 If this is set, the contents of the file named by the <option>file</option> option are
39920 subjected to string expansion as they are added to the message.
39921 </para>
39922 <para>
39923 <indexterm role="option">
39924 <primary><option>file_optional</option></primary>
39925 </indexterm>
39926 </para>
39927 <informaltable frame="all">
39928 <tgroup cols="4" colsep="0" rowsep="0">
39929 <colspec colwidth="8*" align="left"/>
39930 <colspec colwidth="6*" align="center"/>
39931 <colspec colwidth="6*" align="center"/>
39932 <colspec colwidth="6*" align="right"/>
39933 <tbody>
39934 <row>
39935 <entry><option>file_optional</option></entry>
39936 <entry>Use: <emphasis>autoreply</emphasis></entry>
39937 <entry>Type: <emphasis>boolean</emphasis></entry>
39938 <entry>Default: <emphasis>false</emphasis></entry>
39939 </row>
39940 </tbody>
39941 </tgroup>
39942 </informaltable>
39943 <para>
39944 If this option is true, no error is generated if the file named by the <option>file</option>
39945 option or passed with the address does not exist or cannot be read.
39946 </para>
39947 <para>
39948 <indexterm role="option">
39949 <primary><option>from</option></primary>
39950 </indexterm>
39951 </para>
39952 <informaltable frame="all">
39953 <tgroup cols="4" colsep="0" rowsep="0">
39954 <colspec colwidth="8*" align="left"/>
39955 <colspec colwidth="6*" align="center"/>
39956 <colspec colwidth="6*" align="center"/>
39957 <colspec colwidth="6*" align="right"/>
39958 <tbody>
39959 <row>
39960 <entry><option>from</option></entry>
39961 <entry>Use: <emphasis>autoreply</emphasis></entry>
39962 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39963 <entry>Default: <emphasis>unset</emphasis></entry>
39964 </row>
39965 </tbody>
39966 </tgroup>
39967 </informaltable>
39968 <para>
39969 This specifies the contents of the <emphasis>From:</emphasis> header when the message is
39970 specified by the transport.
39971 </para>
39972 <para>
39973 <indexterm role="option">
39974 <primary><option>headers</option></primary>
39975 </indexterm>
39976 </para>
39977 <informaltable frame="all">
39978 <tgroup cols="4" colsep="0" rowsep="0">
39979 <colspec colwidth="8*" align="left"/>
39980 <colspec colwidth="6*" align="center"/>
39981 <colspec colwidth="6*" align="center"/>
39982 <colspec colwidth="6*" align="right"/>
39983 <tbody>
39984 <row>
39985 <entry><option>headers</option></entry>
39986 <entry>Use: <emphasis>autoreply</emphasis></entry>
39987 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39988 <entry>Default: <emphasis>unset</emphasis></entry>
39989 </row>
39990 </tbody>
39991 </tgroup>
39992 </informaltable>
39993 <para>
39994 This specifies additional RFC 2822 headers that are to be added to the message
39995 when the message is specified by the transport. Several can be given by using
39996 <quote>\n</quote> to separate them. There is no check on the format.
39997 </para>
39998 <para>
39999 <indexterm role="option">
40000 <primary><option>log</option></primary>
40001 </indexterm>
40002 </para>
40003 <informaltable frame="all">
40004 <tgroup cols="4" colsep="0" rowsep="0">
40005 <colspec colwidth="8*" align="left"/>
40006 <colspec colwidth="6*" align="center"/>
40007 <colspec colwidth="6*" align="center"/>
40008 <colspec colwidth="6*" align="right"/>
40009 <tbody>
40010 <row>
40011 <entry><option>log</option></entry>
40012 <entry>Use: <emphasis>autoreply</emphasis></entry>
40013 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40014 <entry>Default: <emphasis>unset</emphasis></entry>
40015 </row>
40016 </tbody>
40017 </tgroup>
40018 </informaltable>
40019 <para>
40020 This option names a file in which a record of every message sent is logged when
40021 the message is specified by the transport.
40022 </para>
40023 <para>
40024 <indexterm role="option">
40025 <primary><option>mode</option></primary>
40026 </indexterm>
40027 </para>
40028 <informaltable frame="all">
40029 <tgroup cols="4" colsep="0" rowsep="0">
40030 <colspec colwidth="8*" align="left"/>
40031 <colspec colwidth="6*" align="center"/>
40032 <colspec colwidth="6*" align="center"/>
40033 <colspec colwidth="6*" align="right"/>
40034 <tbody>
40035 <row>
40036 <entry><option>mode</option></entry>
40037 <entry>Use: <emphasis>autoreply</emphasis></entry>
40038 <entry>Type: <emphasis>octal integer</emphasis></entry>
40039 <entry>Default: <emphasis>0600</emphasis></entry>
40040 </row>
40041 </tbody>
40042 </tgroup>
40043 </informaltable>
40044 <para>
40045 If either the log file or the <quote>once</quote> file has to be created, this mode is
40046 used.
40047 </para>
40048 <para>
40049 <indexterm role="option">
40050 <primary><option>never_mail</option></primary>
40051 </indexterm>
40052 </para>
40053 <informaltable frame="all">
40054 <tgroup cols="4" colsep="0" rowsep="0">
40055 <colspec colwidth="8*" align="left"/>
40056 <colspec colwidth="6*" align="center"/>
40057 <colspec colwidth="6*" align="center"/>
40058 <colspec colwidth="6*" align="right"/>
40059 <tbody>
40060 <row>
40061 <entry><option>never_mail</option></entry>
40062 <entry>Use: <emphasis>autoreply</emphasis></entry>
40063 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
40064 <entry>Default: <emphasis>unset</emphasis></entry>
40065 </row>
40066 </tbody>
40067 </tgroup>
40068 </informaltable>
40069 <para>
40070 If any run of the transport creates a message with a recipient that matches any
40071 item in the list, that recipient is quietly discarded. If all recipients are
40072 discarded, no message is created. This applies both when the recipients are
40073 generated by a filter and when they are specified in the transport.
40074 </para>
40075 <para>
40076 <indexterm role="option">
40077 <primary><option>once</option></primary>
40078 </indexterm>
40079 </para>
40080 <informaltable frame="all">
40081 <tgroup cols="4" colsep="0" rowsep="0">
40082 <colspec colwidth="8*" align="left"/>
40083 <colspec colwidth="6*" align="center"/>
40084 <colspec colwidth="6*" align="center"/>
40085 <colspec colwidth="6*" align="right"/>
40086 <tbody>
40087 <row>
40088 <entry><option>once</option></entry>
40089 <entry>Use: <emphasis>autoreply</emphasis></entry>
40090 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40091 <entry>Default: <emphasis>unset</emphasis></entry>
40092 </row>
40093 </tbody>
40094 </tgroup>
40095 </informaltable>
40096 <para>
40097 This option names a file or DBM database in which a record of each <emphasis>To:</emphasis>
40098 recipient is kept when the message is specified by the transport. <emphasis role="bold">Note</emphasis>:
40099 This does not apply to <emphasis>Cc:</emphasis> or <emphasis>Bcc:</emphasis> recipients.
40100 </para>
40101 <para>
40102 If <option>once</option> is unset, or is set to an empty string, the message is always sent.
40103 By default, if <option>once</option> is set to a non-empty file name, the message
40104 is not sent if a potential recipient is already listed in the database.
40105 However, if the <option>once_repeat</option> option specifies a time greater than zero, the
40106 message is sent if that much time has elapsed since a message was last sent to
40107 this recipient. A setting of zero time for <option>once_repeat</option> (the default)
40108 prevents a message from being sent a second time &ndash; in this case, zero means
40109 infinity.
40110 </para>
40111 <para>
40112 If <option>once_file_size</option> is zero, a DBM database is used to remember recipients,
40113 and it is allowed to grow as large as necessary. If <option>once_file_size</option> is set
40114 greater than zero, it changes the way Exim implements the <option>once</option> option.
40115 Instead of using a DBM file to record every recipient it sends to, it uses a
40116 regular file, whose size will never get larger than the given value.
40117 </para>
40118 <para>
40119 In the file, Exim keeps a linear list of recipient addresses and the times at
40120 which they were sent messages. If the file is full when a new address needs to
40121 be added, the oldest address is dropped. If <option>once_repeat</option> is not set, this
40122 means that a given recipient may receive multiple messages, but at
40123 unpredictable intervals that depend on the rate of turnover of addresses in the
40124 file. If <option>once_repeat</option> is set, it specifies a maximum time between repeats.
40125 </para>
40126 <para>
40127 <indexterm role="option">
40128 <primary><option>once_file_size</option></primary>
40129 </indexterm>
40130 </para>
40131 <informaltable frame="all">
40132 <tgroup cols="4" colsep="0" rowsep="0">
40133 <colspec colwidth="8*" align="left"/>
40134 <colspec colwidth="6*" align="center"/>
40135 <colspec colwidth="6*" align="center"/>
40136 <colspec colwidth="6*" align="right"/>
40137 <tbody>
40138 <row>
40139 <entry><option>once_file_size</option></entry>
40140 <entry>Use: <emphasis>autoreply</emphasis></entry>
40141 <entry>Type: <emphasis>integer</emphasis></entry>
40142 <entry>Default: <emphasis>0</emphasis></entry>
40143 </row>
40144 </tbody>
40145 </tgroup>
40146 </informaltable>
40147 <para>
40148 See <option>once</option> above.
40149 </para>
40150 <para>
40151 <indexterm role="option">
40152 <primary><option>once_repeat</option></primary>
40153 </indexterm>
40154 </para>
40155 <informaltable frame="all">
40156 <tgroup cols="4" colsep="0" rowsep="0">
40157 <colspec colwidth="8*" align="left"/>
40158 <colspec colwidth="6*" align="center"/>
40159 <colspec colwidth="6*" align="center"/>
40160 <colspec colwidth="6*" align="right"/>
40161 <tbody>
40162 <row>
40163 <entry><option>once_repeat</option></entry>
40164 <entry>Use: <emphasis>autoreply</emphasis></entry>
40165 <entry>Type: <emphasis>time</emphasis>&dagger;<emphasis></emphasis></entry>
40166 <entry>Default: <emphasis>0s</emphasis></entry>
40167 </row>
40168 </tbody>
40169 </tgroup>
40170 </informaltable>
40171 <para>
40172 See <option>once</option> above.
40173 After expansion, the value of this option must be a valid time value.
40174 </para>
40175 <para>
40176 <indexterm role="option">
40177 <primary><option>reply_to</option></primary>
40178 </indexterm>
40179 </para>
40180 <informaltable frame="all">
40181 <tgroup cols="4" colsep="0" rowsep="0">
40182 <colspec colwidth="8*" align="left"/>
40183 <colspec colwidth="6*" align="center"/>
40184 <colspec colwidth="6*" align="center"/>
40185 <colspec colwidth="6*" align="right"/>
40186 <tbody>
40187 <row>
40188 <entry><option>reply_to</option></entry>
40189 <entry>Use: <emphasis>autoreply</emphasis></entry>
40190 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40191 <entry>Default: <emphasis>unset</emphasis></entry>
40192 </row>
40193 </tbody>
40194 </tgroup>
40195 </informaltable>
40196 <para>
40197 This specifies the contents of the <emphasis>Reply-To:</emphasis> header when the message is
40198 specified by the transport.
40199 </para>
40200 <para>
40201 <indexterm role="option">
40202 <primary><option>return_message</option></primary>
40203 </indexterm>
40204 </para>
40205 <informaltable frame="all">
40206 <tgroup cols="4" colsep="0" rowsep="0">
40207 <colspec colwidth="8*" align="left"/>
40208 <colspec colwidth="6*" align="center"/>
40209 <colspec colwidth="6*" align="center"/>
40210 <colspec colwidth="6*" align="right"/>
40211 <tbody>
40212 <row>
40213 <entry><option>return_message</option></entry>
40214 <entry>Use: <emphasis>autoreply</emphasis></entry>
40215 <entry>Type: <emphasis>boolean</emphasis></entry>
40216 <entry>Default: <emphasis>false</emphasis></entry>
40217 </row>
40218 </tbody>
40219 </tgroup>
40220 </informaltable>
40221 <para>
40222 If this is set, a copy of the original message is returned with the new
40223 message, subject to the maximum size set in the <option>return_size_limit</option> global
40224 configuration option.
40225 </para>
40226 <para>
40227 <indexterm role="option">
40228 <primary><option>subject</option></primary>
40229 </indexterm>
40230 </para>
40231 <informaltable frame="all">
40232 <tgroup cols="4" colsep="0" rowsep="0">
40233 <colspec colwidth="8*" align="left"/>
40234 <colspec colwidth="6*" align="center"/>
40235 <colspec colwidth="6*" align="center"/>
40236 <colspec colwidth="6*" align="right"/>
40237 <tbody>
40238 <row>
40239 <entry><option>subject</option></entry>
40240 <entry>Use: <emphasis>autoreply</emphasis></entry>
40241 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40242 <entry>Default: <emphasis>unset</emphasis></entry>
40243 </row>
40244 </tbody>
40245 </tgroup>
40246 </informaltable>
40247 <para>
40248 This specifies the contents of the <emphasis>Subject:</emphasis> header when the message is
40249 specified by the transport. It is tempting to quote the original subject in
40250 automatic responses. For example:
40251 </para>
40252 <literallayout class="monospaced">
40253 subject = Re: $h_subject:
40254 </literallayout>
40255 <para>
40256 There is a danger in doing this, however. It may allow a third party to
40257 subscribe your users to an opt-in mailing list, provided that the list accepts
40258 bounce messages as subscription confirmations. Well-managed lists require a
40259 non-bounce message to confirm a subscription, so the danger is relatively
40260 small.
40261 </para>
40262 <para>
40263 <indexterm role="option">
40264 <primary><option>text</option></primary>
40265 </indexterm>
40266 </para>
40267 <informaltable frame="all">
40268 <tgroup cols="4" colsep="0" rowsep="0">
40269 <colspec colwidth="8*" align="left"/>
40270 <colspec colwidth="6*" align="center"/>
40271 <colspec colwidth="6*" align="center"/>
40272 <colspec colwidth="6*" align="right"/>
40273 <tbody>
40274 <row>
40275 <entry><option>text</option></entry>
40276 <entry>Use: <emphasis>autoreply</emphasis></entry>
40277 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40278 <entry>Default: <emphasis>unset</emphasis></entry>
40279 </row>
40280 </tbody>
40281 </tgroup>
40282 </informaltable>
40283 <para>
40284 This specifies a single string to be used as the body of the message when the
40285 message is specified by the transport. If both <option>text</option> and <option>file</option> are set,
40286 the text comes first.
40287 </para>
40288 <para>
40289 <indexterm role="option">
40290 <primary><option>to</option></primary>
40291 </indexterm>
40292 </para>
40293 <informaltable frame="all">
40294 <tgroup cols="4" colsep="0" rowsep="0">
40295 <colspec colwidth="8*" align="left"/>
40296 <colspec colwidth="6*" align="center"/>
40297 <colspec colwidth="6*" align="center"/>
40298 <colspec colwidth="6*" align="right"/>
40299 <tbody>
40300 <row>
40301 <entry><option>to</option></entry>
40302 <entry>Use: <emphasis>autoreply</emphasis></entry>
40303 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40304 <entry>Default: <emphasis>unset</emphasis></entry>
40305 </row>
40306 </tbody>
40307 </tgroup>
40308 </informaltable>
40309 <para>
40310 This specifies recipients of the message and the contents of the <emphasis>To:</emphasis> header
40311 when the message is specified by the transport.
40312 <indexterm role="concept" startref="IIDauttra1" class="endofrange"/>
40313 <indexterm role="concept" startref="IIDauttra2" class="endofrange"/>
40314 </para>
40315 </section>
40316 </chapter>
40317
40318 <chapter id="CHAPLMTP">
40319 <title>The lmtp transport</title>
40320 <para>
40321 <indexterm role="concept">
40322 <primary>transports</primary>
40323 <secondary><command>lmtp</command></secondary>
40324 </indexterm>
40325 <indexterm role="concept">
40326 <primary><command>lmtp</command> transport</primary>
40327 </indexterm>
40328 <indexterm role="concept">
40329 <primary>LMTP</primary>
40330 <secondary>over a pipe</secondary>
40331 </indexterm>
40332 <indexterm role="concept">
40333 <primary>LMTP</primary>
40334 <secondary>over a socket</secondary>
40335 </indexterm>
40336 The <command>lmtp</command> transport runs the LMTP protocol (RFC 2033) over a pipe to a
40337 specified command
40338 or by interacting with a Unix domain socket.
40339 This transport is something of a cross between the <command>pipe</command> and <command>smtp</command>
40340 transports. Exim also has support for using LMTP over TCP/IP; this is
40341 implemented as an option for the <command>smtp</command> transport. Because LMTP is expected
40342 to be of minority interest, the default build-time configure in <filename>src/EDITME</filename>
40343 has it commented out. You need to ensure that
40344 </para>
40345 <literallayout class="monospaced">
40346 TRANSPORT_LMTP=yes
40347 </literallayout>
40348 <para>
40349 <indexterm role="concept">
40350 <primary>options</primary>
40351 <secondary><command>lmtp</command> transport</secondary>
40352 </indexterm>
40353 is present in your <filename>Local/Makefile</filename> in order to have the <command>lmtp</command> transport
40354 included in the Exim binary. The private options of the <command>lmtp</command> transport are
40355 as follows:
40356 </para>
40357 <para>
40358 <indexterm role="option">
40359 <primary><option>batch_id</option></primary>
40360 </indexterm>
40361 </para>
40362 <informaltable frame="all">
40363 <tgroup cols="4" colsep="0" rowsep="0">
40364 <colspec colwidth="8*" align="left"/>
40365 <colspec colwidth="6*" align="center"/>
40366 <colspec colwidth="6*" align="center"/>
40367 <colspec colwidth="6*" align="right"/>
40368 <tbody>
40369 <row>
40370 <entry><option>batch_id</option></entry>
40371 <entry>Use: <emphasis>lmtp</emphasis></entry>
40372 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40373 <entry>Default: <emphasis>unset</emphasis></entry>
40374 </row>
40375 </tbody>
40376 </tgroup>
40377 </informaltable>
40378 <para>
40379 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
40380 </para>
40381 <para>
40382 <indexterm role="option">
40383 <primary><option>batch_max</option></primary>
40384 </indexterm>
40385 </para>
40386 <informaltable frame="all">
40387 <tgroup cols="4" colsep="0" rowsep="0">
40388 <colspec colwidth="8*" align="left"/>
40389 <colspec colwidth="6*" align="center"/>
40390 <colspec colwidth="6*" align="center"/>
40391 <colspec colwidth="6*" align="right"/>
40392 <tbody>
40393 <row>
40394 <entry><option>batch_max</option></entry>
40395 <entry>Use: <emphasis>lmtp</emphasis></entry>
40396 <entry>Type: <emphasis>integer</emphasis></entry>
40397 <entry>Default: <emphasis>1</emphasis></entry>
40398 </row>
40399 </tbody>
40400 </tgroup>
40401 </informaltable>
40402 <para>
40403 This limits the number of addresses that can be handled in a single delivery.
40404 Most LMTP servers can handle several addresses at once, so it is normally a
40405 good idea to increase this value. See the description of local delivery
40406 batching in chapter <xref linkend="CHAPbatching"/>.
40407 </para>
40408 <para>
40409 <indexterm role="option">
40410 <primary><option>command</option></primary>
40411 </indexterm>
40412 </para>
40413 <informaltable frame="all">
40414 <tgroup cols="4" colsep="0" rowsep="0">
40415 <colspec colwidth="8*" align="left"/>
40416 <colspec colwidth="6*" align="center"/>
40417 <colspec colwidth="6*" align="center"/>
40418 <colspec colwidth="6*" align="right"/>
40419 <tbody>
40420 <row>
40421 <entry><option>command</option></entry>
40422 <entry>Use: <emphasis>lmtp</emphasis></entry>
40423 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40424 <entry>Default: <emphasis>unset</emphasis></entry>
40425 </row>
40426 </tbody>
40427 </tgroup>
40428 </informaltable>
40429 <para>
40430 This option must be set if <option>socket</option> is not set. The string is a command which
40431 is run in a separate process. It is split up into a command name and list of
40432 arguments, each of which is separately expanded (so expansion cannot change the
40433 number of arguments). The command is run directly, not via a shell. The message
40434 is passed to the new process using the standard input and output to operate the
40435 LMTP protocol.
40436 </para>
40437 <para>
40438 <indexterm role="option">
40439 <primary><option>ignore_quota</option></primary>
40440 </indexterm>
40441 </para>
40442 <informaltable frame="all">
40443 <tgroup cols="4" colsep="0" rowsep="0">
40444 <colspec colwidth="8*" align="left"/>
40445 <colspec colwidth="6*" align="center"/>
40446 <colspec colwidth="6*" align="center"/>
40447 <colspec colwidth="6*" align="right"/>
40448 <tbody>
40449 <row>
40450 <entry><option>ignore_quota</option></entry>
40451 <entry>Use: <emphasis>lmtp</emphasis></entry>
40452 <entry>Type: <emphasis>boolean</emphasis></entry>
40453 <entry>Default: <emphasis>false</emphasis></entry>
40454 </row>
40455 </tbody>
40456 </tgroup>
40457 </informaltable>
40458 <para>
40459 <indexterm role="concept">
40460 <primary>LMTP</primary>
40461 <secondary>ignoring quota errors</secondary>
40462 </indexterm>
40463 If this option is set true, the string <literal>IGNOREQUOTA</literal> is added to RCPT
40464 commands, provided that the LMTP server has advertised support for IGNOREQUOTA
40465 in its response to the LHLO command.
40466 </para>
40467 <para>
40468 <indexterm role="option">
40469 <primary><option>socket</option></primary>
40470 </indexterm>
40471 </para>
40472 <informaltable frame="all">
40473 <tgroup cols="4" colsep="0" rowsep="0">
40474 <colspec colwidth="8*" align="left"/>
40475 <colspec colwidth="6*" align="center"/>
40476 <colspec colwidth="6*" align="center"/>
40477 <colspec colwidth="6*" align="right"/>
40478 <tbody>
40479 <row>
40480 <entry><option>socket</option></entry>
40481 <entry>Use: <emphasis>lmtp</emphasis></entry>
40482 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40483 <entry>Default: <emphasis>unset</emphasis></entry>
40484 </row>
40485 </tbody>
40486 </tgroup>
40487 </informaltable>
40488 <para>
40489 This option must be set if <option>command</option> is not set. The result of expansion must
40490 be the name of a Unix domain socket. The transport connects to the socket and
40491 delivers the message to it using the LMTP protocol.
40492 </para>
40493 <para>
40494 <indexterm role="option">
40495 <primary><option>timeout</option></primary>
40496 </indexterm>
40497 </para>
40498 <informaltable frame="all">
40499 <tgroup cols="4" colsep="0" rowsep="0">
40500 <colspec colwidth="8*" align="left"/>
40501 <colspec colwidth="6*" align="center"/>
40502 <colspec colwidth="6*" align="center"/>
40503 <colspec colwidth="6*" align="right"/>
40504 <tbody>
40505 <row>
40506 <entry><option>timeout</option></entry>
40507 <entry>Use: <emphasis>lmtp</emphasis></entry>
40508 <entry>Type: <emphasis>time</emphasis></entry>
40509 <entry>Default: <emphasis>5m</emphasis></entry>
40510 </row>
40511 </tbody>
40512 </tgroup>
40513 </informaltable>
40514 <para>
40515 The transport is aborted if the created process or Unix domain socket does not
40516 respond to LMTP commands or message input within this timeout. Delivery
40517 is deferred, and will be tried again later. Here is an example of a typical
40518 LMTP transport:
40519 </para>
40520 <literallayout class="monospaced">
40521 lmtp:
40522   driver = lmtp
40523   command = /some/local/lmtp/delivery/program
40524   batch_max = 20
40525   user = exim
40526 </literallayout>
40527 <para>
40528 This delivers up to 20 addresses at a time, in a mixture of domains if
40529 necessary, running as the user <emphasis>exim</emphasis>.
40530 </para>
40531 </chapter>
40532
40533 <chapter id="CHAPpipetransport">
40534 <title>The pipe transport</title>
40535 <para>
40536 <indexterm role="concept" id="IIDpiptra1" class="startofrange">
40537 <primary>transports</primary>
40538 <secondary><command>pipe</command></secondary>
40539 </indexterm>
40540 <indexterm role="concept" id="IIDpiptra2" class="startofrange">
40541 <primary><command>pipe</command> transport</primary>
40542 </indexterm>
40543 The <command>pipe</command> transport is used to deliver messages via a pipe to a command
40544 running in another process. One example is the use of <command>pipe</command> as a
40545 pseudo-remote transport for passing messages to some other delivery mechanism
40546 (such as UUCP). Another is the use by individual users to automatically process
40547 their incoming messages. The <command>pipe</command> transport can be used in one of the
40548 following ways:
40549 </para>
40550 <itemizedlist>
40551 <listitem>
40552 <para>
40553 <indexterm role="variable">
40554 <primary><varname>$local_part</varname></primary>
40555 </indexterm>
40556 A router routes one address to a transport in the normal way, and the
40557 transport is configured as a <command>pipe</command> transport. In this case, <varname>$local_part</varname>
40558 contains the local part of the address (as usual), and the command that is run
40559 is specified by the <option>command</option> option on the transport.
40560 </para>
40561 </listitem>
40562 <listitem>
40563 <para>
40564 <indexterm role="variable">
40565 <primary><varname>$pipe_addresses</varname></primary>
40566 </indexterm>
40567 If the <option>batch_max</option> option is set greater than 1 (the default is 1), the
40568 transport can handle more than one address in a single run. In this case, when
40569 more than one address is routed to the transport, <varname>$local_part</varname> is not set
40570 (because it is not unique). However, the pseudo-variable <varname>$pipe_addresses</varname>
40571 (described in section <xref linkend="SECThowcommandrun"/> below) contains all the addresses
40572 that are routed to the transport.
40573 </para>
40574 </listitem>
40575 <listitem>
40576 <para>
40577 <indexterm role="variable">
40578 <primary><varname>$address_pipe</varname></primary>
40579 </indexterm>
40580 A router redirects an address directly to a pipe command (for example, from an
40581 alias or forward file). In this case, <varname>$address_pipe</varname> contains the text of the
40582 pipe command, and the <option>command</option> option on the transport is ignored. If only
40583 one address is being transported (<option>batch_max</option> is not greater than one, or
40584 only one address was redirected to this pipe command), <varname>$local_part</varname> contains
40585 the local part that was redirected.
40586 </para>
40587 </listitem>
40588 </itemizedlist>
40589 <para>
40590 The <command>pipe</command> transport is a non-interactive delivery method. Exim can also
40591 deliver messages over pipes using the LMTP interactive protocol. This is
40592 implemented by the <command>lmtp</command> transport.
40593 </para>
40594 <para>
40595 In the case when <command>pipe</command> is run as a consequence of an entry in a local user&#x2019;s
40596 <filename>.forward</filename> file, the command runs under the uid and gid of that user. In
40597 other cases, the uid and gid have to be specified explicitly, either on the
40598 transport or on the router that handles the address. Current and <quote>home</quote>
40599 directories are also controllable. See chapter <xref linkend="CHAPenvironment"/> for
40600 details of the local delivery environment and chapter <xref linkend="CHAPbatching"/>
40601 for a discussion of local delivery batching.
40602 </para>
40603 <section id="SECID140">
40604 <title>Concurrent delivery</title>
40605 <para>
40606 If two messages arrive at almost the same time, and both are routed to a pipe
40607 delivery, the two pipe transports may be run concurrently. You must ensure that
40608 any pipe commands you set up are robust against this happening. If the commands
40609 write to a file, the <option>exim_lock</option> utility might be of use.
40610 </para>
40611 </section>
40612 <section id="SECID141">
40613 <title>Returned status and data</title>
40614 <para>
40615 <indexterm role="concept">
40616 <primary><command>pipe</command> transport</primary>
40617 <secondary>returned data</secondary>
40618 </indexterm>
40619 If the command exits with a non-zero return code, the delivery is deemed to
40620 have failed, unless either the <option>ignore_status</option> option is set (in which case
40621 the return code is treated as zero), or the return code is one of those listed
40622 in the <option>temp_errors</option> option, which are interpreted as meaning <quote>try again
40623 later</quote>. In this case, delivery is deferred. Details of a permanent failure are
40624 logged, but are not included in the bounce message, which merely contains
40625 <quote>local delivery failed</quote>.
40626 </para>
40627 <para>
40628 If the command exits on a signal and the <option>freeze_signal</option> option is set then
40629 the message will be frozen in the queue. If that option is not set, a bounce
40630 will be sent as normal.
40631 </para>
40632 <para>
40633 If the return code is greater than 128 and the command being run is a shell
40634 script, it normally means that the script was terminated by a signal whose
40635 value is the return code minus 128. The <option>freeze_signal</option> option does not
40636 apply in this case.
40637 </para>
40638 <para>
40639 If Exim is unable to run the command (that is, if <function>execve()</function> fails), the
40640 return code is set to 127. This is the value that a shell returns if it is
40641 asked to run a non-existent command. The wording for the log line suggests that
40642 a non-existent command may be the problem.
40643 </para>
40644 <para>
40645 The <option>return_output</option> option can affect the result of a pipe delivery. If it is
40646 set and the command produces any output on its standard output or standard
40647 error streams, the command is considered to have failed, even if it gave a zero
40648 return code or if <option>ignore_status</option> is set. The output from the command is
40649 included as part of the bounce message. The <option>return_fail_output</option> option is
40650 similar, except that output is returned only when the command exits with a
40651 failure return code, that is, a value other than zero or a code that matches
40652 <option>temp_errors</option>.
40653 </para>
40654 </section>
40655 <section id="SECThowcommandrun">
40656 <title>How the command is run</title>
40657 <para>
40658 <indexterm role="concept">
40659 <primary><command>pipe</command> transport</primary>
40660 <secondary>path for command</secondary>
40661 </indexterm>
40662 The command line is (by default) broken down into a command name and arguments
40663 by the <command>pipe</command> transport itself. The <option>allow_commands</option> and
40664 <option>restrict_to_path</option> options can be used to restrict the commands that may be
40665 run.
40666 </para>
40667 <para>
40668 <indexterm role="concept">
40669 <primary>quoting</primary>
40670 <secondary>in pipe command</secondary>
40671 </indexterm>
40672 Unquoted arguments are delimited by white space. If an argument appears in
40673 double quotes, backslash is interpreted as an escape character in the usual
40674 way. If an argument appears in single quotes, no escaping is done.
40675 </para>
40676 <para>
40677 String expansion is applied to the command line except when it comes from a
40678 traditional <filename>.forward</filename> file (commands from a filter file are expanded). The
40679 expansion is applied to each argument in turn rather than to the whole line.
40680 For this reason, any string expansion item that contains white space must be
40681 quoted so as to be contained within a single argument. A setting such as
40682 </para>
40683 <literallayout class="monospaced">
40684 command = /some/path ${if eq{$local_part}{postmaster}{xx}{yy}}
40685 </literallayout>
40686 <para>
40687 will not work, because the expansion item gets split between several
40688 arguments. You have to write
40689 </para>
40690 <literallayout class="monospaced">
40691 command = /some/path "${if eq{$local_part}{postmaster}{xx}{yy}}"
40692 </literallayout>
40693 <para>
40694 to ensure that it is all in one argument. The expansion is done in this way,
40695 argument by argument, so that the number of arguments cannot be changed as a
40696 result of expansion, and quotes or backslashes in inserted variables do not
40697 interact with external quoting. However, this leads to problems if you want to
40698 generate multiple arguments (or the command name plus arguments) from a single
40699 expansion. In this situation, the simplest solution is to use a shell. For
40700 example:
40701 </para>
40702 <literallayout class="monospaced">
40703 command = /bin/sh -c ${lookup{$local_part}lsearch{/some/file}}
40704 </literallayout>
40705 <para>
40706 <indexterm role="concept">
40707 <primary>transport</primary>
40708 <secondary>filter</secondary>
40709 </indexterm>
40710 <indexterm role="concept">
40711 <primary>filter</primary>
40712 <secondary>transport filter</secondary>
40713 </indexterm>
40714 <indexterm role="variable">
40715 <primary><varname>$pipe_addresses</varname></primary>
40716 </indexterm>
40717 Special handling takes place when an argument consists of precisely the text
40718 <literal>$pipe_addresses</literal>. This is not a general expansion variable; the only
40719 place this string is recognized is when it appears as an argument for a pipe or
40720 transport filter command. It causes each address that is being handled to be
40721 inserted in the argument list at that point <emphasis>as a separate argument</emphasis>. This
40722 avoids any problems with spaces or shell metacharacters, and is of use when a
40723 <command>pipe</command> transport is handling groups of addresses in a batch.
40724 </para>
40725 <para>
40726 After splitting up into arguments and expansion, the resulting command is run
40727 in a subprocess directly from the transport, <emphasis>not</emphasis> under a shell. The
40728 message that is being delivered is supplied on the standard input, and the
40729 standard output and standard error are both connected to a single pipe that is
40730 read by Exim. The <option>max_output</option> option controls how much output the command
40731 may produce, and the <option>return_output</option> and <option>return_fail_output</option> options
40732 control what is done with it.
40733 </para>
40734 <para>
40735 Not running the command under a shell (by default) lessens the security risks
40736 in cases when a command from a user&#x2019;s filter file is built out of data that was
40737 taken from an incoming message. If a shell is required, it can of course be
40738 explicitly specified as the command to be run. However, there are circumstances
40739 where existing commands (for example, in <filename>.forward</filename> files) expect to be run
40740 under a shell and cannot easily be modified. To allow for these cases, there is
40741 an option called <option>use_shell</option>, which changes the way the <command>pipe</command> transport
40742 works. Instead of breaking up the command line as just described, it expands it
40743 as a single string and passes the result to <filename>/bin/sh</filename>. The
40744 <option>restrict_to_path</option> option and the <varname>$pipe_addresses</varname> facility cannot be used
40745 with <option>use_shell</option>, and the whole mechanism is inherently less secure.
40746 </para>
40747 </section>
40748 <section id="SECTpipeenv">
40749 <title>Environment variables</title>
40750 <para>
40751 <indexterm role="concept">
40752 <primary><command>pipe</command> transport</primary>
40753 <secondary>environment for command</secondary>
40754 </indexterm>
40755 <indexterm role="concept">
40756 <primary>environment for pipe transport</primary>
40757 </indexterm>
40758 The environment variables listed below are set up when the command is invoked.
40759 This list is a compromise for maximum compatibility with other MTAs. Note that
40760 the <option>environment</option> option can be used to add additional variables to this
40761 environment.
40762 </para>
40763 <literallayout>
40764 <literal>DOMAIN            </literal>   the domain of the address
40765 <literal>HOME              </literal>   the home directory, if set
40766 <literal>HOST              </literal>   the host name when called from a router (see below)
40767 <literal>LOCAL_PART        </literal>   see below
40768 <literal>LOCAL_PART_PREFIX </literal>   see below
40769 <literal>LOCAL_PART_SUFFIX </literal>   see below
40770 <literal>LOGNAME           </literal>   see below
40771 <literal>MESSAGE_ID        </literal>   Exim&#x2019;s local ID for the message
40772 <literal>PATH              </literal>   as specified by the <option>path</option> option below
40773 <literal>QUALIFY_DOMAIN    </literal>   the sender qualification domain
40774 <literal>RECIPIENT         </literal>   the complete recipient address
40775 <literal>SENDER            </literal>   the sender of the message (empty if a bounce)
40776 <literal>SHELL             </literal>   <literal>/bin/sh</literal>
40777 <literal>TZ                </literal>   the value of the <option>timezone</option> option, if set
40778 <literal>USER              </literal>   see below
40779 </literallayout>
40780 <para>
40781 When a <command>pipe</command> transport is called directly from (for example) an <command>accept</command>
40782 router, LOCAL_PART is set to the local part of the address. When it is
40783 called as a result of a forward or alias expansion, LOCAL_PART is set to
40784 the local part of the address that was expanded. In both cases, any affixes are
40785 removed from the local part, and made available in LOCAL_PART_PREFIX and
40786 LOCAL_PART_SUFFIX, respectively. LOGNAME and USER are set to the
40787 same value as LOCAL_PART for compatibility with other MTAs.
40788 </para>
40789 <para>
40790 <indexterm role="concept">
40791 <primary>HOST</primary>
40792 </indexterm>
40793 HOST is set only when a <command>pipe</command> transport is called from a router that
40794 associates hosts with an address, typically when using <command>pipe</command> as a
40795 pseudo-remote transport. HOST is set to the first host name specified by
40796 the router.
40797 </para>
40798 <para>
40799 <indexterm role="concept">
40800 <primary>HOME</primary>
40801 </indexterm>
40802 If the transport&#x2019;s generic <option>home_directory</option> option is set, its value is used
40803 for the HOME environment variable. Otherwise, a home directory may be set
40804 by the router&#x2019;s <option>transport_home_directory</option> option, which defaults to the
40805 user&#x2019;s home directory if <option>check_local_user</option> is set.
40806 </para>
40807 </section>
40808 <section id="SECID142">
40809 <title>Private options for pipe</title>
40810 <para>
40811 <indexterm role="concept">
40812 <primary>options</primary>
40813 <secondary><command>pipe</command> transport</secondary>
40814 </indexterm>
40815 </para>
40816 <para>
40817 <indexterm role="option">
40818 <primary><option>allow_commands</option></primary>
40819 </indexterm>
40820 </para>
40821 <informaltable frame="all">
40822 <tgroup cols="4" colsep="0" rowsep="0">
40823 <colspec colwidth="8*" align="left"/>
40824 <colspec colwidth="6*" align="center"/>
40825 <colspec colwidth="6*" align="center"/>
40826 <colspec colwidth="6*" align="right"/>
40827 <tbody>
40828 <row>
40829 <entry><option>allow_commands</option></entry>
40830 <entry>Use: <emphasis>pipe</emphasis></entry>
40831 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
40832 <entry>Default: <emphasis>unset</emphasis></entry>
40833 </row>
40834 </tbody>
40835 </tgroup>
40836 </informaltable>
40837 <para>
40838 <indexterm role="concept">
40839 <primary><command>pipe</command> transport</primary>
40840 <secondary>permitted commands</secondary>
40841 </indexterm>
40842 The string is expanded, and is then interpreted as a colon-separated list of
40843 permitted commands. If <option>restrict_to_path</option> is not set, the only commands
40844 permitted are those in the <option>allow_commands</option> list. They need not be absolute
40845 paths; the <option>path</option> option is still used for relative paths. If
40846 <option>restrict_to_path</option> is set with <option>allow_commands</option>, the command must either be
40847 in the <option>allow_commands</option> list, or a name without any slashes that is found on
40848 the path. In other words, if neither <option>allow_commands</option> nor
40849 <option>restrict_to_path</option> is set, there is no restriction on the command, but
40850 otherwise only commands that are permitted by one or the other are allowed. For
40851 example, if
40852 </para>
40853 <literallayout class="monospaced">
40854 allow_commands = /usr/bin/vacation
40855 </literallayout>
40856 <para>
40857 and <option>restrict_to_path</option> is not set, the only permitted command is
40858 <filename>/usr/bin/vacation</filename>. The <option>allow_commands</option> option may not be set if
40859 <option>use_shell</option> is set.
40860 </para>
40861 <para>
40862 <indexterm role="option">
40863 <primary><option>batch_id</option></primary>
40864 </indexterm>
40865 </para>
40866 <informaltable frame="all">
40867 <tgroup cols="4" colsep="0" rowsep="0">
40868 <colspec colwidth="8*" align="left"/>
40869 <colspec colwidth="6*" align="center"/>
40870 <colspec colwidth="6*" align="center"/>
40871 <colspec colwidth="6*" align="right"/>
40872 <tbody>
40873 <row>
40874 <entry><option>batch_id</option></entry>
40875 <entry>Use: <emphasis>pipe</emphasis></entry>
40876 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40877 <entry>Default: <emphasis>unset</emphasis></entry>
40878 </row>
40879 </tbody>
40880 </tgroup>
40881 </informaltable>
40882 <para>
40883 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
40884 </para>
40885 <para>
40886 <indexterm role="option">
40887 <primary><option>batch_max</option></primary>
40888 </indexterm>
40889 </para>
40890 <informaltable frame="all">
40891 <tgroup cols="4" colsep="0" rowsep="0">
40892 <colspec colwidth="8*" align="left"/>
40893 <colspec colwidth="6*" align="center"/>
40894 <colspec colwidth="6*" align="center"/>
40895 <colspec colwidth="6*" align="right"/>
40896 <tbody>
40897 <row>
40898 <entry><option>batch_max</option></entry>
40899 <entry>Use: <emphasis>pipe</emphasis></entry>
40900 <entry>Type: <emphasis>integer</emphasis></entry>
40901 <entry>Default: <emphasis>1</emphasis></entry>
40902 </row>
40903 </tbody>
40904 </tgroup>
40905 </informaltable>
40906 <para>
40907 This limits the number of addresses that can be handled in a single delivery.
40908 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
40909 </para>
40910 <para>
40911 <indexterm role="option">
40912 <primary><option>check_string</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>check_string</option></entry>
40924 <entry>Use: <emphasis>pipe</emphasis></entry>
40925 <entry>Type: <emphasis>string</emphasis></entry>
40926 <entry>Default: <emphasis>unset</emphasis></entry>
40927 </row>
40928 </tbody>
40929 </tgroup>
40930 </informaltable>
40931 <para>
40932 As <command>pipe</command> writes the message, the start of each line is tested for matching
40933 <option>check_string</option>, and if it does, the initial matching characters are replaced
40934 by the contents of <option>escape_string</option>, provided both are set. The value of
40935 <option>check_string</option> is a literal string, not a regular expression, and the case of
40936 any letters it contains is significant. When <option>use_bsmtp</option> is set, the contents
40937 of <option>check_string</option> and <option>escape_string</option> are forced to values that implement
40938 the SMTP escaping protocol. Any settings made in the configuration file are
40939 ignored.
40940 </para>
40941 <para>
40942 <indexterm role="option">
40943 <primary><option>command</option></primary>
40944 </indexterm>
40945 </para>
40946 <informaltable frame="all">
40947 <tgroup cols="4" colsep="0" rowsep="0">
40948 <colspec colwidth="8*" align="left"/>
40949 <colspec colwidth="6*" align="center"/>
40950 <colspec colwidth="6*" align="center"/>
40951 <colspec colwidth="6*" align="right"/>
40952 <tbody>
40953 <row>
40954 <entry><option>command</option></entry>
40955 <entry>Use: <emphasis>pipe</emphasis></entry>
40956 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40957 <entry>Default: <emphasis>unset</emphasis></entry>
40958 </row>
40959 </tbody>
40960 </tgroup>
40961 </informaltable>
40962 <para>
40963 This option need not be set when <command>pipe</command> is being used to deliver to pipes
40964 obtained directly from address redirections. In other cases, the option must be
40965 set, to provide a command to be run. It need not yield an absolute path (see
40966 the <option>path</option> option below). The command is split up into separate arguments by
40967 Exim, and each argument is separately expanded, as described in section
40968 <xref linkend="SECThowcommandrun"/> above.
40969 </para>
40970 <para>
40971 <indexterm role="option">
40972 <primary><option>environment</option></primary>
40973 </indexterm>
40974 </para>
40975 <informaltable frame="all">
40976 <tgroup cols="4" colsep="0" rowsep="0">
40977 <colspec colwidth="8*" align="left"/>
40978 <colspec colwidth="6*" align="center"/>
40979 <colspec colwidth="6*" align="center"/>
40980 <colspec colwidth="6*" align="right"/>
40981 <tbody>
40982 <row>
40983 <entry><option>environment</option></entry>
40984 <entry>Use: <emphasis>pipe</emphasis></entry>
40985 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40986 <entry>Default: <emphasis>unset</emphasis></entry>
40987 </row>
40988 </tbody>
40989 </tgroup>
40990 </informaltable>
40991 <para>
40992 <indexterm role="concept">
40993 <primary><command>pipe</command> transport</primary>
40994 <secondary>environment for command</secondary>
40995 </indexterm>
40996 <indexterm role="concept">
40997 <primary>environment for <command>pipe</command> transport</primary>
40998 </indexterm>
40999 This option is used to add additional variables to the environment in which the
41000 command runs (see section <xref linkend="SECTpipeenv"/> for the default list). Its value is
41001 a string which is expanded, and then interpreted as a colon-separated list of
41002 environment settings of the form &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt;.
41003 </para>
41004 <para>
41005 <indexterm role="option">
41006 <primary><option>escape_string</option></primary>
41007 </indexterm>
41008 </para>
41009 <informaltable frame="all">
41010 <tgroup cols="4" colsep="0" rowsep="0">
41011 <colspec colwidth="8*" align="left"/>
41012 <colspec colwidth="6*" align="center"/>
41013 <colspec colwidth="6*" align="center"/>
41014 <colspec colwidth="6*" align="right"/>
41015 <tbody>
41016 <row>
41017 <entry><option>escape_string</option></entry>
41018 <entry>Use: <emphasis>pipe</emphasis></entry>
41019 <entry>Type: <emphasis>string</emphasis></entry>
41020 <entry>Default: <emphasis>unset</emphasis></entry>
41021 </row>
41022 </tbody>
41023 </tgroup>
41024 </informaltable>
41025 <para>
41026 See <option>check_string</option> above.
41027 </para>
41028 <para>
41029 <indexterm role="option">
41030 <primary><option>freeze_exec_fail</option></primary>
41031 </indexterm>
41032 </para>
41033 <informaltable frame="all">
41034 <tgroup cols="4" colsep="0" rowsep="0">
41035 <colspec colwidth="8*" align="left"/>
41036 <colspec colwidth="6*" align="center"/>
41037 <colspec colwidth="6*" align="center"/>
41038 <colspec colwidth="6*" align="right"/>
41039 <tbody>
41040 <row>
41041 <entry><option>freeze_exec_fail</option></entry>
41042 <entry>Use: <emphasis>pipe</emphasis></entry>
41043 <entry>Type: <emphasis>boolean</emphasis></entry>
41044 <entry>Default: <emphasis>false</emphasis></entry>
41045 </row>
41046 </tbody>
41047 </tgroup>
41048 </informaltable>
41049 <para>
41050 <indexterm role="concept">
41051 <primary>exec failure</primary>
41052 </indexterm>
41053 <indexterm role="concept">
41054 <primary>failure of exec</primary>
41055 </indexterm>
41056 <indexterm role="concept">
41057 <primary><command>pipe</command> transport</primary>
41058 <secondary>failure of exec</secondary>
41059 </indexterm>
41060 Failure to exec the command in a pipe transport is by default treated like
41061 any other failure while running the command. However, if <option>freeze_exec_fail</option>
41062 is set, failure to exec is treated specially, and causes the message to be
41063 frozen, whatever the setting of <option>ignore_status</option>.
41064 </para>
41065 <para revisionflag="changed">
41066 <indexterm role="option">
41067 <primary><option>freeze_signal</option></primary>
41068 </indexterm>
41069 </para>
41070 <informaltable frame="all" revisionflag="changed">
41071 <tgroup cols="4" colsep="0" rowsep="0">
41072 <colspec colwidth="8*" align="left"/>
41073 <colspec colwidth="6*" align="center"/>
41074 <colspec colwidth="6*" align="center"/>
41075 <colspec colwidth="6*" align="right"/>
41076 <tbody>
41077 <row>
41078 <entry><option>freeze_signal</option></entry>
41079 <entry>Use: <emphasis>pipe</emphasis></entry>
41080 <entry>Type: <emphasis>boolean</emphasis></entry>
41081 <entry>Default: <emphasis>false</emphasis></entry>
41082 </row>
41083 </tbody>
41084 </tgroup>
41085 </informaltable>
41086 <para revisionflag="changed">
41087 <indexterm role="concept">
41088 <primary>signal exit</primary>
41089 </indexterm>
41090 <indexterm role="concept">
41091 <primary><command>pipe</command> transport</primary>
41092 <secondary>,</secondary>
41093 </indexterm>
41094 Normally if the process run by a command in a pipe transport exits on a signal,
41095 a bounce message is sent. If <option>freeze_signal</option> is set, the message will be
41096 frozen in Exim&#x2019;s queue instead.
41097 </para>
41098 <para>
41099 <indexterm role="option">
41100 <primary><option>ignore_status</option></primary>
41101 </indexterm>
41102 </para>
41103 <informaltable frame="all">
41104 <tgroup cols="4" colsep="0" rowsep="0">
41105 <colspec colwidth="8*" align="left"/>
41106 <colspec colwidth="6*" align="center"/>
41107 <colspec colwidth="6*" align="center"/>
41108 <colspec colwidth="6*" align="right"/>
41109 <tbody>
41110 <row>
41111 <entry><option>ignore_status</option></entry>
41112 <entry>Use: <emphasis>pipe</emphasis></entry>
41113 <entry>Type: <emphasis>boolean</emphasis></entry>
41114 <entry>Default: <emphasis>false</emphasis></entry>
41115 </row>
41116 </tbody>
41117 </tgroup>
41118 </informaltable>
41119 <para>
41120 If this option is true, the status returned by the subprocess that is set up to
41121 run the command is ignored, and Exim behaves as if zero had been returned.
41122 Otherwise, a non-zero status or termination by signal causes an error return
41123 from the transport unless the status value is one of those listed in
41124 <option>temp_errors</option>; these cause the delivery to be deferred and tried again later.
41125 </para>
41126 <para>
41127 <emphasis role="bold">Note</emphasis>: This option does not apply to timeouts, which do not return a status.
41128 See the <option>timeout_defer</option> option for how timeouts are handled.
41129 </para>
41130 <para>
41131 <indexterm role="option">
41132 <primary><option>log_defer_output</option></primary>
41133 </indexterm>
41134 </para>
41135 <informaltable frame="all">
41136 <tgroup cols="4" colsep="0" rowsep="0">
41137 <colspec colwidth="8*" align="left"/>
41138 <colspec colwidth="6*" align="center"/>
41139 <colspec colwidth="6*" align="center"/>
41140 <colspec colwidth="6*" align="right"/>
41141 <tbody>
41142 <row>
41143 <entry><option>log_defer_output</option></entry>
41144 <entry>Use: <emphasis>pipe</emphasis></entry>
41145 <entry>Type: <emphasis>boolean</emphasis></entry>
41146 <entry>Default: <emphasis>false</emphasis></entry>
41147 </row>
41148 </tbody>
41149 </tgroup>
41150 </informaltable>
41151 <para>
41152 <indexterm role="concept">
41153 <primary><command>pipe</command> transport</primary>
41154 <secondary>logging output</secondary>
41155 </indexterm>
41156 If this option is set, and the status returned by the command is
41157 one of the codes listed in <option>temp_errors</option> (that is, delivery was deferred),
41158 and any output was produced, the first line of it is written to the main log.
41159 </para>
41160 <para>
41161 <indexterm role="option">
41162 <primary><option>log_fail_output</option></primary>
41163 </indexterm>
41164 </para>
41165 <informaltable frame="all">
41166 <tgroup cols="4" colsep="0" rowsep="0">
41167 <colspec colwidth="8*" align="left"/>
41168 <colspec colwidth="6*" align="center"/>
41169 <colspec colwidth="6*" align="center"/>
41170 <colspec colwidth="6*" align="right"/>
41171 <tbody>
41172 <row>
41173 <entry><option>log_fail_output</option></entry>
41174 <entry>Use: <emphasis>pipe</emphasis></entry>
41175 <entry>Type: <emphasis>boolean</emphasis></entry>
41176 <entry>Default: <emphasis>false</emphasis></entry>
41177 </row>
41178 </tbody>
41179 </tgroup>
41180 </informaltable>
41181 <para>
41182 If this option is set, and the command returns any output, and also ends with a
41183 return code that is neither zero nor one of the return codes listed in
41184 <option>temp_errors</option> (that is, the delivery failed), the first line of output is
41185 written to the main log. This option and <option>log_output</option> are mutually exclusive.
41186 Only one of them may be set.
41187 </para>
41188 <para>
41189 <indexterm role="option">
41190 <primary><option>log_output</option></primary>
41191 </indexterm>
41192 </para>
41193 <informaltable frame="all">
41194 <tgroup cols="4" colsep="0" rowsep="0">
41195 <colspec colwidth="8*" align="left"/>
41196 <colspec colwidth="6*" align="center"/>
41197 <colspec colwidth="6*" align="center"/>
41198 <colspec colwidth="6*" align="right"/>
41199 <tbody>
41200 <row>
41201 <entry><option>log_output</option></entry>
41202 <entry>Use: <emphasis>pipe</emphasis></entry>
41203 <entry>Type: <emphasis>boolean</emphasis></entry>
41204 <entry>Default: <emphasis>false</emphasis></entry>
41205 </row>
41206 </tbody>
41207 </tgroup>
41208 </informaltable>
41209 <para>
41210 If this option is set and the command returns any output, the first line of
41211 output is written to the main log, whatever the return code. This option and
41212 <option>log_fail_output</option> are mutually exclusive. Only one of them may be set.
41213 </para>
41214 <para>
41215 <indexterm role="option">
41216 <primary><option>max_output</option></primary>
41217 </indexterm>
41218 </para>
41219 <informaltable frame="all">
41220 <tgroup cols="4" colsep="0" rowsep="0">
41221 <colspec colwidth="8*" align="left"/>
41222 <colspec colwidth="6*" align="center"/>
41223 <colspec colwidth="6*" align="center"/>
41224 <colspec colwidth="6*" align="right"/>
41225 <tbody>
41226 <row>
41227 <entry><option>max_output</option></entry>
41228 <entry>Use: <emphasis>pipe</emphasis></entry>
41229 <entry>Type: <emphasis>integer</emphasis></entry>
41230 <entry>Default: <emphasis>20K</emphasis></entry>
41231 </row>
41232 </tbody>
41233 </tgroup>
41234 </informaltable>
41235 <para>
41236 This specifies the maximum amount of output that the command may produce on its
41237 standard output and standard error file combined. If the limit is exceeded, the
41238 process running the command is killed. This is intended as a safety measure to
41239 catch runaway processes. The limit is applied independently of the settings of
41240 the options that control what is done with such output (for example,
41241 <option>return_output</option>). Because of buffering effects, the amount of output may
41242 exceed the limit by a small amount before Exim notices.
41243 </para>
41244 <para>
41245 <indexterm role="option">
41246 <primary><option>message_prefix</option></primary>
41247 </indexterm>
41248 </para>
41249 <informaltable frame="all">
41250 <tgroup cols="4" colsep="0" rowsep="0">
41251 <colspec colwidth="8*" align="left"/>
41252 <colspec colwidth="6*" align="center"/>
41253 <colspec colwidth="6*" align="center"/>
41254 <colspec colwidth="6*" align="right"/>
41255 <tbody>
41256 <row>
41257 <entry><option>message_prefix</option></entry>
41258 <entry>Use: <emphasis>pipe</emphasis></entry>
41259 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41260 <entry>Default: <emphasis>see below</emphasis></entry>
41261 </row>
41262 </tbody>
41263 </tgroup>
41264 </informaltable>
41265 <para>
41266 The string specified here is expanded and output at the start of every message.
41267 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is
41268 </para>
41269 <literallayout class="monospaced">
41270 message_prefix = \
41271   From ${if def:return_path{$return_path}{MAILER-DAEMON}}\
41272   ${tod_bsdinbox}\n
41273 </literallayout>
41274 <para>
41275 <indexterm role="concept">
41276 <primary>Cyrus</primary>
41277 </indexterm>
41278 <indexterm role="concept">
41279 <primary><option>tmail</option></primary>
41280 </indexterm>
41281 <indexterm role="concept">
41282 <primary><quote>From</quote> line</primary>
41283 </indexterm>
41284 This is required by the commonly used <filename>/usr/bin/vacation</filename> program.
41285 However, it must <emphasis>not</emphasis> be present if delivery is to the Cyrus IMAP server,
41286 or to the <option>tmail</option> local delivery agent. The prefix can be suppressed by
41287 setting
41288 </para>
41289 <literallayout class="monospaced">
41290 message_prefix =
41291 </literallayout>
41292 <para>
41293 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
41294 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_prefix</option>.
41295 </para>
41296 <para>
41297 <indexterm role="option">
41298 <primary><option>message_suffix</option></primary>
41299 </indexterm>
41300 </para>
41301 <informaltable frame="all">
41302 <tgroup cols="4" colsep="0" rowsep="0">
41303 <colspec colwidth="8*" align="left"/>
41304 <colspec colwidth="6*" align="center"/>
41305 <colspec colwidth="6*" align="center"/>
41306 <colspec colwidth="6*" align="right"/>
41307 <tbody>
41308 <row>
41309 <entry><option>message_suffix</option></entry>
41310 <entry>Use: <emphasis>pipe</emphasis></entry>
41311 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41312 <entry>Default: <emphasis>see below</emphasis></entry>
41313 </row>
41314 </tbody>
41315 </tgroup>
41316 </informaltable>
41317 <para>
41318 The string specified here is expanded and output at the end of every message.
41319 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is a single newline.
41320 The suffix can be suppressed by setting
41321 </para>
41322 <literallayout class="monospaced">
41323 message_suffix =
41324 </literallayout>
41325 <para>
41326 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
41327 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_suffix</option>.
41328 </para>
41329 <para>
41330 <indexterm role="option">
41331 <primary><option>path</option></primary>
41332 </indexterm>
41333 </para>
41334 <informaltable frame="all">
41335 <tgroup cols="4" colsep="0" rowsep="0">
41336 <colspec colwidth="8*" align="left"/>
41337 <colspec colwidth="6*" align="center"/>
41338 <colspec colwidth="6*" align="center"/>
41339 <colspec colwidth="6*" align="right"/>
41340 <tbody>
41341 <row>
41342 <entry><option>path</option></entry>
41343 <entry>Use: <emphasis>pipe</emphasis></entry>
41344 <entry>Type: <emphasis>string</emphasis></entry>
41345 <entry>Default: <emphasis>see below</emphasis></entry>
41346 </row>
41347 </tbody>
41348 </tgroup>
41349 </informaltable>
41350 <para>
41351 This option specifies the string that is set up in the PATH environment
41352 variable of the subprocess. The default is:
41353 </para>
41354 <literallayout class="monospaced">
41355 /bin:/usr/bin
41356 </literallayout>
41357 <para>
41358 If the <option>command</option> option does not yield an absolute path name, the command is
41359 sought in the PATH directories, in the usual way. <emphasis role="bold">Warning</emphasis>: This does not
41360 apply to a command specified as a transport filter.
41361 </para>
41362 <para revisionflag="changed">
41363 <indexterm role="option">
41364 <primary><option>permit_coredump</option></primary>
41365 </indexterm>
41366 </para>
41367 <informaltable frame="all" revisionflag="changed">
41368 <tgroup cols="4" colsep="0" rowsep="0">
41369 <colspec colwidth="8*" align="left"/>
41370 <colspec colwidth="6*" align="center"/>
41371 <colspec colwidth="6*" align="center"/>
41372 <colspec colwidth="6*" align="right"/>
41373 <tbody>
41374 <row>
41375 <entry><option>permit_coredump</option></entry>
41376 <entry>Use: <emphasis>pipe</emphasis></entry>
41377 <entry>Type: <emphasis>boolean</emphasis></entry>
41378 <entry>Default: <emphasis>false</emphasis></entry>
41379 </row>
41380 </tbody>
41381 </tgroup>
41382 </informaltable>
41383 <para revisionflag="changed">
41384 Normally Exim inhibits core-dumps during delivery.  If you have a need to get
41385 a core-dump of a pipe command, enable this command.  This enables core-dumps
41386 during delivery and affects both the Exim binary and the pipe command run.
41387 It is recommended that this option remain off unless and until you have a need
41388 for it and that this only be enabled when needed, as the risk of excessive
41389 resource consumption can be quite high.  Note also that Exim is typically
41390 installed as a setuid binary and most operating systems will inhibit coredumps
41391 of these by default, so further OS-specific action may be required.
41392 </para>
41393 <para>
41394 <indexterm role="option">
41395 <primary><option>pipe_as_creator</option></primary>
41396 </indexterm>
41397 </para>
41398 <informaltable frame="all">
41399 <tgroup cols="4" colsep="0" rowsep="0">
41400 <colspec colwidth="8*" align="left"/>
41401 <colspec colwidth="6*" align="center"/>
41402 <colspec colwidth="6*" align="center"/>
41403 <colspec colwidth="6*" align="right"/>
41404 <tbody>
41405 <row>
41406 <entry><option>pipe_as_creator</option></entry>
41407 <entry>Use: <emphasis>pipe</emphasis></entry>
41408 <entry>Type: <emphasis>boolean</emphasis></entry>
41409 <entry>Default: <emphasis>false</emphasis></entry>
41410 </row>
41411 </tbody>
41412 </tgroup>
41413 </informaltable>
41414 <para>
41415 <indexterm role="concept">
41416 <primary>uid (user id)</primary>
41417 <secondary>local delivery</secondary>
41418 </indexterm>
41419 If the generic <option>user</option> option is not set and this option is true, the delivery
41420 process is run under the uid that was in force when Exim was originally called
41421 to accept the message. If the group id is not otherwise set (via the generic
41422 <option>group</option> option), the gid that was in force when Exim was originally called to
41423 accept the message is used.
41424 </para>
41425 <para>
41426 <indexterm role="option">
41427 <primary><option>restrict_to_path</option></primary>
41428 </indexterm>
41429 </para>
41430 <informaltable frame="all">
41431 <tgroup cols="4" colsep="0" rowsep="0">
41432 <colspec colwidth="8*" align="left"/>
41433 <colspec colwidth="6*" align="center"/>
41434 <colspec colwidth="6*" align="center"/>
41435 <colspec colwidth="6*" align="right"/>
41436 <tbody>
41437 <row>
41438 <entry><option>restrict_to_path</option></entry>
41439 <entry>Use: <emphasis>pipe</emphasis></entry>
41440 <entry>Type: <emphasis>boolean</emphasis></entry>
41441 <entry>Default: <emphasis>false</emphasis></entry>
41442 </row>
41443 </tbody>
41444 </tgroup>
41445 </informaltable>
41446 <para>
41447 When this option is set, any command name not listed in <option>allow_commands</option> must
41448 contain no slashes. The command is searched for only in the directories listed
41449 in the <option>path</option> option. This option is intended for use in the case when a pipe
41450 command has been generated from a user&#x2019;s <filename>.forward</filename> file. This is usually
41451 handled by a <command>pipe</command> transport called <option>address_pipe</option>.
41452 </para>
41453 <para>
41454 <indexterm role="option">
41455 <primary><option>return_fail_output</option></primary>
41456 </indexterm>
41457 </para>
41458 <informaltable frame="all">
41459 <tgroup cols="4" colsep="0" rowsep="0">
41460 <colspec colwidth="8*" align="left"/>
41461 <colspec colwidth="6*" align="center"/>
41462 <colspec colwidth="6*" align="center"/>
41463 <colspec colwidth="6*" align="right"/>
41464 <tbody>
41465 <row>
41466 <entry><option>return_fail_output</option></entry>
41467 <entry>Use: <emphasis>pipe</emphasis></entry>
41468 <entry>Type: <emphasis>boolean</emphasis></entry>
41469 <entry>Default: <emphasis>false</emphasis></entry>
41470 </row>
41471 </tbody>
41472 </tgroup>
41473 </informaltable>
41474 <para>
41475 If this option is true, and the command produced any output and ended with a
41476 return code other than zero or one of the codes listed in <option>temp_errors</option> (that
41477 is, the delivery failed), the output is returned in the bounce message.
41478 However, if the message has a null sender (that is, it is itself a bounce
41479 message), output from the command is discarded. This option and
41480 <option>return_output</option> are mutually exclusive. Only one of them may be set.
41481 </para>
41482 <para>
41483 <indexterm role="option">
41484 <primary><option>return_output</option></primary>
41485 </indexterm>
41486 </para>
41487 <informaltable frame="all">
41488 <tgroup cols="4" colsep="0" rowsep="0">
41489 <colspec colwidth="8*" align="left"/>
41490 <colspec colwidth="6*" align="center"/>
41491 <colspec colwidth="6*" align="center"/>
41492 <colspec colwidth="6*" align="right"/>
41493 <tbody>
41494 <row>
41495 <entry><option>return_output</option></entry>
41496 <entry>Use: <emphasis>pipe</emphasis></entry>
41497 <entry>Type: <emphasis>boolean</emphasis></entry>
41498 <entry>Default: <emphasis>false</emphasis></entry>
41499 </row>
41500 </tbody>
41501 </tgroup>
41502 </informaltable>
41503 <para>
41504 If this option is true, and the command produced any output, the delivery is
41505 deemed to have failed whatever the return code from the command, and the output
41506 is returned in the bounce message. Otherwise, the output is just discarded.
41507 However, if the message has a null sender (that is, it is a bounce message),
41508 output from the command is always discarded, whatever the setting of this
41509 option. This option and <option>return_fail_output</option> are mutually exclusive. Only one
41510 of them may be set.
41511 </para>
41512 <para>
41513 <indexterm role="option">
41514 <primary><option>temp_errors</option></primary>
41515 </indexterm>
41516 </para>
41517 <informaltable frame="all">
41518 <tgroup cols="4" colsep="0" rowsep="0">
41519 <colspec colwidth="8*" align="left"/>
41520 <colspec colwidth="6*" align="center"/>
41521 <colspec colwidth="6*" align="center"/>
41522 <colspec colwidth="6*" align="right"/>
41523 <tbody>
41524 <row>
41525 <entry><option>temp_errors</option></entry>
41526 <entry>Use: <emphasis>pipe</emphasis></entry>
41527 <entry>Type: <emphasis>string list</emphasis></entry>
41528 <entry>Default: <emphasis>see below</emphasis></entry>
41529 </row>
41530 </tbody>
41531 </tgroup>
41532 </informaltable>
41533 <para>
41534 <indexterm role="concept">
41535 <primary><command>pipe</command> transport</primary>
41536 <secondary>temporary failure</secondary>
41537 </indexterm>
41538 This option contains either a colon-separated list of numbers, or a single
41539 asterisk. If <option>ignore_status</option> is false
41540 and <option>return_output</option> is not set,
41541 and the command exits with a non-zero return code, the failure is treated as
41542 temporary and the delivery is deferred if the return code matches one of the
41543 numbers, or if the setting is a single asterisk. Otherwise, non-zero return
41544 codes are treated as permanent errors. The default setting contains the codes
41545 defined by EX_TEMPFAIL and EX_CANTCREAT in <filename>sysexits.h</filename>. If Exim is
41546 compiled on a system that does not define these macros, it assumes values of 75
41547 and 73, respectively.
41548 </para>
41549 <para>
41550 <indexterm role="option">
41551 <primary><option>timeout</option></primary>
41552 </indexterm>
41553 </para>
41554 <informaltable frame="all">
41555 <tgroup cols="4" colsep="0" rowsep="0">
41556 <colspec colwidth="8*" align="left"/>
41557 <colspec colwidth="6*" align="center"/>
41558 <colspec colwidth="6*" align="center"/>
41559 <colspec colwidth="6*" align="right"/>
41560 <tbody>
41561 <row>
41562 <entry><option>timeout</option></entry>
41563 <entry>Use: <emphasis>pipe</emphasis></entry>
41564 <entry>Type: <emphasis>time</emphasis></entry>
41565 <entry>Default: <emphasis>1h</emphasis></entry>
41566 </row>
41567 </tbody>
41568 </tgroup>
41569 </informaltable>
41570 <para>
41571 If the command fails to complete within this time, it is killed. This normally
41572 causes the delivery to fail (but see <option>timeout_defer</option>). A zero time interval
41573 specifies no timeout. In order to ensure that any subprocesses created by the
41574 command are also killed, Exim makes the initial process a process group leader,
41575 and kills the whole process group on a timeout. However, this can be defeated
41576 if one of the processes starts a new process group.
41577 </para>
41578 <para>
41579 <indexterm role="option">
41580 <primary><option>timeout_defer</option></primary>
41581 </indexterm>
41582 </para>
41583 <informaltable frame="all">
41584 <tgroup cols="4" colsep="0" rowsep="0">
41585 <colspec colwidth="8*" align="left"/>
41586 <colspec colwidth="6*" align="center"/>
41587 <colspec colwidth="6*" align="center"/>
41588 <colspec colwidth="6*" align="right"/>
41589 <tbody>
41590 <row>
41591 <entry><option>timeout_defer</option></entry>
41592 <entry>Use: <emphasis>pipe</emphasis></entry>
41593 <entry>Type: <emphasis>boolean</emphasis></entry>
41594 <entry>Default: <emphasis>false</emphasis></entry>
41595 </row>
41596 </tbody>
41597 </tgroup>
41598 </informaltable>
41599 <para>
41600 A timeout in a <command>pipe</command> transport, either in the command that the transport
41601 runs, or in a transport filter that is associated with it, is by default
41602 treated as a hard error, and the delivery fails. However, if <option>timeout_defer</option>
41603 is set true, both kinds of timeout become temporary errors, causing the
41604 delivery to be deferred.
41605 </para>
41606 <para>
41607 <indexterm role="option">
41608 <primary><option>umask</option></primary>
41609 </indexterm>
41610 </para>
41611 <informaltable frame="all">
41612 <tgroup cols="4" colsep="0" rowsep="0">
41613 <colspec colwidth="8*" align="left"/>
41614 <colspec colwidth="6*" align="center"/>
41615 <colspec colwidth="6*" align="center"/>
41616 <colspec colwidth="6*" align="right"/>
41617 <tbody>
41618 <row>
41619 <entry><option>umask</option></entry>
41620 <entry>Use: <emphasis>pipe</emphasis></entry>
41621 <entry>Type: <emphasis>octal integer</emphasis></entry>
41622 <entry>Default: <emphasis>022</emphasis></entry>
41623 </row>
41624 </tbody>
41625 </tgroup>
41626 </informaltable>
41627 <para>
41628 This specifies the umask setting for the subprocess that runs the command.
41629 </para>
41630 <para>
41631 <indexterm role="option">
41632 <primary><option>use_bsmtp</option></primary>
41633 </indexterm>
41634 </para>
41635 <informaltable frame="all">
41636 <tgroup cols="4" colsep="0" rowsep="0">
41637 <colspec colwidth="8*" align="left"/>
41638 <colspec colwidth="6*" align="center"/>
41639 <colspec colwidth="6*" align="center"/>
41640 <colspec colwidth="6*" align="right"/>
41641 <tbody>
41642 <row>
41643 <entry><option>use_bsmtp</option></entry>
41644 <entry>Use: <emphasis>pipe</emphasis></entry>
41645 <entry>Type: <emphasis>boolean</emphasis></entry>
41646 <entry>Default: <emphasis>false</emphasis></entry>
41647 </row>
41648 </tbody>
41649 </tgroup>
41650 </informaltable>
41651 <para>
41652 <indexterm role="concept">
41653 <primary>envelope sender</primary>
41654 </indexterm>
41655 If this option is set true, the <command>pipe</command> transport writes messages in <quote>batch
41656 SMTP</quote> format, with the envelope sender and recipient(s) included as SMTP
41657 commands. If you want to include a leading HELO command with such messages,
41658 you can do so by setting the <option>message_prefix</option> option. See section
41659 <xref linkend="SECTbatchSMTP"/> for details of batch SMTP.
41660 </para>
41661 <para>
41662 <indexterm role="option">
41663 <primary><option>use_classresources</option></primary>
41664 </indexterm>
41665 </para>
41666 <informaltable frame="all">
41667 <tgroup cols="4" colsep="0" rowsep="0">
41668 <colspec colwidth="8*" align="left"/>
41669 <colspec colwidth="6*" align="center"/>
41670 <colspec colwidth="6*" align="center"/>
41671 <colspec colwidth="6*" align="right"/>
41672 <tbody>
41673 <row>
41674 <entry><option>use_classresources</option></entry>
41675 <entry>Use: <emphasis>pipe</emphasis></entry>
41676 <entry>Type: <emphasis>boolean</emphasis></entry>
41677 <entry>Default: <emphasis>false</emphasis></entry>
41678 </row>
41679 </tbody>
41680 </tgroup>
41681 </informaltable>
41682 <para>
41683 <indexterm role="concept">
41684 <primary>class resources (BSD)</primary>
41685 </indexterm>
41686 This option is available only when Exim is running on FreeBSD, NetBSD, or
41687 BSD/OS. If it is set true, the <function>setclassresources()</function> function is used to set
41688 resource limits when a <command>pipe</command> transport is run to perform a delivery. The
41689 limits for the uid under which the pipe is to run are obtained from the login
41690 class database.
41691 </para>
41692 <para>
41693 <indexterm role="option">
41694 <primary><option>use_crlf</option></primary>
41695 </indexterm>
41696 </para>
41697 <informaltable frame="all">
41698 <tgroup cols="4" colsep="0" rowsep="0">
41699 <colspec colwidth="8*" align="left"/>
41700 <colspec colwidth="6*" align="center"/>
41701 <colspec colwidth="6*" align="center"/>
41702 <colspec colwidth="6*" align="right"/>
41703 <tbody>
41704 <row>
41705 <entry><option>use_crlf</option></entry>
41706 <entry>Use: <emphasis>pipe</emphasis></entry>
41707 <entry>Type: <emphasis>boolean</emphasis></entry>
41708 <entry>Default: <emphasis>false</emphasis></entry>
41709 </row>
41710 </tbody>
41711 </tgroup>
41712 </informaltable>
41713 <para>
41714 <indexterm role="concept">
41715 <primary>carriage return</primary>
41716 </indexterm>
41717 <indexterm role="concept">
41718 <primary>linefeed</primary>
41719 </indexterm>
41720 This option causes lines to be terminated with the two-character CRLF sequence
41721 (carriage return, linefeed) instead of just a linefeed character. In the case
41722 of batched SMTP, the byte sequence written to the pipe is then an exact image
41723 of what would be sent down a real SMTP connection.
41724 </para>
41725 <para>
41726 The contents of the <option>message_prefix</option> and <option>message_suffix</option> options are
41727 written verbatim, so must contain their own carriage return characters if these
41728 are needed. When <option>use_bsmtp</option> is not set, the default values for both
41729 <option>message_prefix</option> and <option>message_suffix</option> end with a single linefeed, so their
41730 values must be changed to end with <literal>\r\n</literal> if <option>use_crlf</option> is set.
41731 </para>
41732 <para>
41733 <indexterm role="option">
41734 <primary><option>use_shell</option></primary>
41735 </indexterm>
41736 </para>
41737 <informaltable frame="all">
41738 <tgroup cols="4" colsep="0" rowsep="0">
41739 <colspec colwidth="8*" align="left"/>
41740 <colspec colwidth="6*" align="center"/>
41741 <colspec colwidth="6*" align="center"/>
41742 <colspec colwidth="6*" align="right"/>
41743 <tbody>
41744 <row>
41745 <entry><option>use_shell</option></entry>
41746 <entry>Use: <emphasis>pipe</emphasis></entry>
41747 <entry>Type: <emphasis>boolean</emphasis></entry>
41748 <entry>Default: <emphasis>false</emphasis></entry>
41749 </row>
41750 </tbody>
41751 </tgroup>
41752 </informaltable>
41753 <para>
41754 <indexterm role="variable">
41755 <primary><varname>$pipe_addresses</varname></primary>
41756 </indexterm>
41757 If this option is set, it causes the command to be passed to <filename>/bin/sh</filename>
41758 instead of being run directly from the transport, as described in section
41759 <xref linkend="SECThowcommandrun"/>. This is less secure, but is needed in some situations
41760 where the command is expected to be run under a shell and cannot easily be
41761 modified. The <option>allow_commands</option> and <option>restrict_to_path</option> options, and the
41762 <literal>$pipe_addresses</literal> facility are incompatible with <option>use_shell</option>. The
41763 command is expanded as a single string, and handed to <filename>/bin/sh</filename> as data for
41764 its <option>-c</option> option.
41765 </para>
41766 </section>
41767 <section id="SECID143">
41768 <title>Using an external local delivery agent</title>
41769 <para>
41770 <indexterm role="concept">
41771 <primary>local delivery</primary>
41772 <secondary>using an external agent</secondary>
41773 </indexterm>
41774 <indexterm role="concept">
41775 <primary><emphasis>procmail</emphasis></primary>
41776 </indexterm>
41777 <indexterm role="concept">
41778 <primary>external local delivery</primary>
41779 </indexterm>
41780 <indexterm role="concept">
41781 <primary>delivery</primary>
41782 <secondary><emphasis>procmail</emphasis></secondary>
41783 </indexterm>
41784 <indexterm role="concept">
41785 <primary>delivery</primary>
41786 <secondary>by external agent</secondary>
41787 </indexterm>
41788 The <command>pipe</command> transport can be used to pass all messages that require local
41789 delivery to a separate local delivery agent such as <option>procmail</option>. When doing
41790 this, care must be taken to ensure that the pipe is run under an appropriate
41791 uid and gid. In some configurations one wants this to be a uid that is trusted
41792 by the delivery agent to supply the correct sender of the message. It may be
41793 necessary to recompile or reconfigure the delivery agent so that it trusts an
41794 appropriate user. The following is an example transport and router
41795 configuration for <option>procmail</option>:
41796 </para>
41797 <literallayout class="monospaced">
41798 # transport
41799 procmail_pipe:
41800   driver = pipe
41801   command = /usr/local/bin/procmail -d $local_part
41802   return_path_add
41803   delivery_date_add
41804   envelope_to_add
41805   check_string = "From "
41806   escape_string = "&gt;From "
41807   umask = 077
41808   user = $local_part
41809   group = mail
41810
41811 # router
41812 procmail:
41813   driver = accept
41814   check_local_user
41815   transport = procmail_pipe
41816 </literallayout>
41817 <para>
41818 In this example, the pipe is run as the local user, but with the group set to
41819 <emphasis>mail</emphasis>. An alternative is to run the pipe as a specific user such as <emphasis>mail</emphasis>
41820 or <emphasis>exim</emphasis>, but in this case you must arrange for <option>procmail</option> to trust that
41821 user to supply a correct sender address. If you do not specify either a
41822 <option>group</option> or a <option>user</option> option, the pipe command is run as the local user. The
41823 home directory is the user&#x2019;s home directory by default.
41824 </para>
41825 <para>
41826 <emphasis role="bold">Note</emphasis>: The command that the pipe transport runs does <emphasis>not</emphasis> begin with
41827 </para>
41828 <literallayout class="monospaced">
41829 IFS=" "
41830 </literallayout>
41831 <para>
41832 as shown in some <option>procmail</option> documentation, because Exim does not by default
41833 use a shell to run pipe commands.
41834 </para>
41835 <para>
41836 <indexterm role="concept">
41837 <primary>Cyrus</primary>
41838 </indexterm>
41839 The next example shows a transport and a router for a system where local
41840 deliveries are handled by the Cyrus IMAP server.
41841 </para>
41842 <literallayout class="monospaced">
41843 # transport
41844 local_delivery_cyrus:
41845   driver = pipe
41846   command = /usr/cyrus/bin/deliver \
41847             -m ${substr_1:$local_part_suffix} -- $local_part
41848   user = cyrus
41849   group = mail
41850   return_output
41851   log_output
41852   message_prefix =
41853   message_suffix =
41854
41855 # router
41856 local_user_cyrus:
41857   driver = accept
41858   check_local_user
41859   local_part_suffix = .*
41860   transport = local_delivery_cyrus
41861 </literallayout>
41862 <para>
41863 Note the unsetting of <option>message_prefix</option> and <option>message_suffix</option>, and the use of
41864 <option>return_output</option> to cause any text written by Cyrus to be returned to the
41865 sender.
41866 <indexterm role="concept" startref="IIDpiptra1" class="endofrange"/>
41867 <indexterm role="concept" startref="IIDpiptra2" class="endofrange"/>
41868 </para>
41869 </section>
41870 </chapter>
41871
41872 <chapter id="CHAPsmtptrans">
41873 <title>The smtp transport</title>
41874 <para>
41875 <indexterm role="concept" id="IIDsmttra1" class="startofrange">
41876 <primary>transports</primary>
41877 <secondary><command>smtp</command></secondary>
41878 </indexterm>
41879 <indexterm role="concept" id="IIDsmttra2" class="startofrange">
41880 <primary><command>smtp</command> transport</primary>
41881 </indexterm>
41882 The <command>smtp</command> transport delivers messages over TCP/IP connections using the SMTP
41883 or LMTP protocol. The list of hosts to try can either be taken from the address
41884 that is being processed (having been set up by the router), or specified
41885 explicitly for the transport. Timeout and retry processing (see chapter
41886 <xref linkend="CHAPretry"/>) is applied to each IP address independently.
41887 </para>
41888 <section id="SECID144">
41889 <title>Multiple messages on a single connection</title>
41890 <para>
41891 The sending of multiple messages over a single TCP/IP connection can arise in
41892 two ways:
41893 </para>
41894 <itemizedlist>
41895 <listitem>
41896 <para>
41897 If a message contains more than <option>max_rcpt</option> (see below) addresses that are
41898 routed to the same host, more than one copy of the message has to be sent to
41899 that host. In this situation, multiple copies may be sent in a single run of
41900 the <command>smtp</command> transport over a single TCP/IP connection. (What Exim actually
41901 does when it has too many addresses to send in one message also depends on the
41902 value of the global <option>remote_max_parallel</option> option. Details are given in
41903 section <xref linkend="SECToutSMTPTCP"/>.)
41904 </para>
41905 </listitem>
41906 <listitem>
41907 <para>
41908 <indexterm role="concept">
41909 <primary>hints database</primary>
41910 <secondary>remembering routing</secondary>
41911 </indexterm>
41912 When a message has been successfully delivered over a TCP/IP connection, Exim
41913 looks in its hints database to see if there are any other messages awaiting a
41914 connection to the same host. If there are, a new delivery process is started
41915 for one of them, and the current TCP/IP connection is passed on to it. The new
41916 process may in turn send multiple copies and possibly create yet another
41917 process.
41918 </para>
41919 </listitem>
41920 </itemizedlist>
41921 <para>
41922 For each copy sent over the same TCP/IP connection, a sequence counter is
41923 incremented, and if it ever gets to the value of <option>connection_max_messages</option>,
41924 no further messages are sent over that connection.
41925 </para>
41926 </section>
41927 <section id="SECID145">
41928 <title>Use of the $host and $host_address variables</title>
41929 <para>
41930 <indexterm role="variable">
41931 <primary><varname>$host</varname></primary>
41932 </indexterm>
41933 <indexterm role="variable">
41934 <primary><varname>$host_address</varname></primary>
41935 </indexterm>
41936 At the start of a run of the <command>smtp</command> transport, the values of <varname>$host</varname> and
41937 <varname>$host_address</varname> are the name and IP address of the first host on the host list
41938 passed by the router. However, when the transport is about to connect to a
41939 specific host, and while it is connected to that host, <varname>$host</varname> and
41940 <varname>$host_address</varname> are set to the values for that host. These are the values
41941 that are in force when the <option>helo_data</option>, <option>hosts_try_auth</option>, <option>interface</option>,
41942 <option>serialize_hosts</option>, and the various TLS options are expanded.
41943 </para>
41944 </section>
41945 <section id="usecippeer">
41946 <title>Use of $tls_cipher and $tls_peerdn</title>
41947 <para>
41948 <indexterm role="variable">
41949 <primary><varname>$tls_cipher</varname></primary>
41950 </indexterm>
41951 <indexterm role="variable">
41952 <primary><varname>$tls_peerdn</varname></primary>
41953 </indexterm>
41954 At the start of a run of the <command>smtp</command> transport, the values of <varname>$tls_cipher</varname>
41955 and <varname>$tls_peerdn</varname> are the values that were set when the message was received.
41956 These are the values that are used for options that are expanded before any
41957 SMTP connections are made. Just before each connection is made, these two
41958 variables are emptied. If TLS is subsequently started, they are set to the
41959 appropriate values for the outgoing connection, and these are the values that
41960 are in force when any authenticators are run and when the
41961 <option>authenticated_sender</option> option is expanded.
41962 </para>
41963 </section>
41964 <section id="SECID146">
41965 <title>Private options for smtp</title>
41966 <para>
41967 <indexterm role="concept">
41968 <primary>options</primary>
41969 <secondary><command>smtp</command> transport</secondary>
41970 </indexterm>
41971 The private options of the <command>smtp</command> transport are as follows:
41972 </para>
41973 <para>
41974 <indexterm role="option">
41975 <primary><option>address_retry_include_sender</option></primary>
41976 </indexterm>
41977 </para>
41978 <informaltable frame="all">
41979 <tgroup cols="4" colsep="0" rowsep="0">
41980 <colspec colwidth="8*" align="left"/>
41981 <colspec colwidth="6*" align="center"/>
41982 <colspec colwidth="6*" align="center"/>
41983 <colspec colwidth="6*" align="right"/>
41984 <tbody>
41985 <row>
41986 <entry><option>address_retry_include_sender</option></entry>
41987 <entry>Use: <emphasis>smtp</emphasis></entry>
41988 <entry>Type: <emphasis>boolean</emphasis></entry>
41989 <entry>Default: <emphasis>true</emphasis></entry>
41990 </row>
41991 </tbody>
41992 </tgroup>
41993 </informaltable>
41994 <para>
41995 <indexterm role="concept">
41996 <primary>4<emphasis>xx</emphasis> responses</primary>
41997 <secondary>retrying after</secondary>
41998 </indexterm>
41999 When an address is delayed because of a 4<emphasis>xx</emphasis> response to a RCPT command, it
42000 is the combination of sender and recipient that is delayed in subsequent queue
42001 runs until the retry time is reached. You can delay the recipient without
42002 reference to the sender (which is what earlier versions of Exim did), by
42003 setting <option>address_retry_include_sender</option> false. However, this can lead to
42004 problems with servers that regularly issue 4<emphasis>xx</emphasis> responses to RCPT commands.
42005 </para>
42006 <para>
42007 <indexterm role="option">
42008 <primary><option>allow_localhost</option></primary>
42009 </indexterm>
42010 </para>
42011 <informaltable frame="all">
42012 <tgroup cols="4" colsep="0" rowsep="0">
42013 <colspec colwidth="8*" align="left"/>
42014 <colspec colwidth="6*" align="center"/>
42015 <colspec colwidth="6*" align="center"/>
42016 <colspec colwidth="6*" align="right"/>
42017 <tbody>
42018 <row>
42019 <entry><option>allow_localhost</option></entry>
42020 <entry>Use: <emphasis>smtp</emphasis></entry>
42021 <entry>Type: <emphasis>boolean</emphasis></entry>
42022 <entry>Default: <emphasis>false</emphasis></entry>
42023 </row>
42024 </tbody>
42025 </tgroup>
42026 </informaltable>
42027 <para>
42028 <indexterm role="concept">
42029 <primary>local host</primary>
42030 <secondary>sending to</secondary>
42031 </indexterm>
42032 <indexterm role="concept">
42033 <primary>fallback</primary>
42034 <secondary>hosts specified on transport</secondary>
42035 </indexterm>
42036 When a host specified in <option>hosts</option> or <option>fallback_hosts</option> (see below) turns out
42037 to be the local host, or is listed in <option>hosts_treat_as_local</option>, delivery is
42038 deferred by default. However, if <option>allow_localhost</option> is set, Exim goes on to do
42039 the delivery anyway. This should be used only in special cases when the
42040 configuration ensures that no looping will result (for example, a differently
42041 configured Exim is listening on the port to which the message is sent).
42042 </para>
42043 <para>
42044 <indexterm role="option">
42045 <primary><option>authenticated_sender</option></primary>
42046 </indexterm>
42047 </para>
42048 <informaltable frame="all">
42049 <tgroup cols="4" colsep="0" rowsep="0">
42050 <colspec colwidth="8*" align="left"/>
42051 <colspec colwidth="6*" align="center"/>
42052 <colspec colwidth="6*" align="center"/>
42053 <colspec colwidth="6*" align="right"/>
42054 <tbody>
42055 <row>
42056 <entry><option>authenticated_sender</option></entry>
42057 <entry>Use: <emphasis>smtp</emphasis></entry>
42058 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42059 <entry>Default: <emphasis>unset</emphasis></entry>
42060 </row>
42061 </tbody>
42062 </tgroup>
42063 </informaltable>
42064 <para>
42065 <indexterm role="concept">
42066 <primary>Cyrus</primary>
42067 </indexterm>
42068 When Exim has authenticated as a client, or if <option>authenticated_sender_force</option>
42069 is true, this option sets a value for the AUTH= item on outgoing MAIL commands,
42070 overriding any existing authenticated sender value. If the string expansion is
42071 forced to fail, the option is ignored. Other expansion failures cause delivery
42072 to be deferred. If the result of expansion is an empty string, that is also
42073 ignored.
42074 </para>
42075 <para>
42076 The expansion happens after the outgoing connection has been made and TLS
42077 started, if required. This means that the <varname>$host</varname>, <varname>$host_address</varname>,
42078 <varname>$tls_cipher</varname>, and <varname>$tls_peerdn</varname> variables are set according to the
42079 particular connection.
42080 </para>
42081 <para>
42082 If the SMTP session is not authenticated, the expansion of
42083 <option>authenticated_sender</option> still happens (and can cause the delivery to be
42084 deferred if it fails), but no AUTH= item is added to MAIL commands
42085 unless <option>authenticated_sender_force</option> is true.
42086 </para>
42087 <para>
42088 This option allows you to use the <command>smtp</command> transport in LMTP mode to
42089 deliver mail to Cyrus IMAP and provide the proper local part as the
42090 <quote>authenticated sender</quote>, via a setting such as:
42091 </para>
42092 <literallayout class="monospaced">
42093 authenticated_sender = $local_part
42094 </literallayout>
42095 <para>
42096 This removes the need for IMAP subfolders to be assigned special ACLs to
42097 allow direct delivery to those subfolders.
42098 </para>
42099 <para>
42100 Because of expected uses such as that just described for Cyrus (when no
42101 domain is involved), there is no checking on the syntax of the provided
42102 value.
42103 </para>
42104 <para>
42105 <indexterm role="option">
42106 <primary><option>authenticated_sender_force</option></primary>
42107 </indexterm>
42108 </para>
42109 <informaltable frame="all">
42110 <tgroup cols="4" colsep="0" rowsep="0">
42111 <colspec colwidth="8*" align="left"/>
42112 <colspec colwidth="6*" align="center"/>
42113 <colspec colwidth="6*" align="center"/>
42114 <colspec colwidth="6*" align="right"/>
42115 <tbody>
42116 <row>
42117 <entry><option>authenticated_sender_force</option></entry>
42118 <entry>Use: <emphasis>smtp</emphasis></entry>
42119 <entry>Type: <emphasis>boolean</emphasis></entry>
42120 <entry>Default: <emphasis>false</emphasis></entry>
42121 </row>
42122 </tbody>
42123 </tgroup>
42124 </informaltable>
42125 <para>
42126 If this option is set true, the <option>authenticated_sender</option> option&#x2019;s value
42127 is used for the AUTH= item on outgoing MAIL commands, even if Exim has not
42128 authenticated as a client.
42129 </para>
42130 <para>
42131 <indexterm role="option">
42132 <primary><option>command_timeout</option></primary>
42133 </indexterm>
42134 </para>
42135 <informaltable frame="all">
42136 <tgroup cols="4" colsep="0" rowsep="0">
42137 <colspec colwidth="8*" align="left"/>
42138 <colspec colwidth="6*" align="center"/>
42139 <colspec colwidth="6*" align="center"/>
42140 <colspec colwidth="6*" align="right"/>
42141 <tbody>
42142 <row>
42143 <entry><option>command_timeout</option></entry>
42144 <entry>Use: <emphasis>smtp</emphasis></entry>
42145 <entry>Type: <emphasis>time</emphasis></entry>
42146 <entry>Default: <emphasis>5m</emphasis></entry>
42147 </row>
42148 </tbody>
42149 </tgroup>
42150 </informaltable>
42151 <para>
42152 This sets a timeout for receiving a response to an SMTP command that has been
42153 sent out. It is also used when waiting for the initial banner line from the
42154 remote host. Its value must not be zero.
42155 </para>
42156 <para>
42157 <indexterm role="option">
42158 <primary><option>connect_timeout</option></primary>
42159 </indexterm>
42160 </para>
42161 <informaltable frame="all">
42162 <tgroup cols="4" colsep="0" rowsep="0">
42163 <colspec colwidth="8*" align="left"/>
42164 <colspec colwidth="6*" align="center"/>
42165 <colspec colwidth="6*" align="center"/>
42166 <colspec colwidth="6*" align="right"/>
42167 <tbody>
42168 <row>
42169 <entry><option>connect_timeout</option></entry>
42170 <entry>Use: <emphasis>smtp</emphasis></entry>
42171 <entry>Type: <emphasis>time</emphasis></entry>
42172 <entry>Default: <emphasis>5m</emphasis></entry>
42173 </row>
42174 </tbody>
42175 </tgroup>
42176 </informaltable>
42177 <para>
42178 This sets a timeout for the <function>connect()</function> function, which sets up a TCP/IP call
42179 to a remote host. A setting of zero allows the system timeout (typically
42180 several minutes) to act. To have any effect, the value of this option must be
42181 less than the system timeout. However, it has been observed that on some
42182 systems there is no system timeout, which is why the default value for this
42183 option is 5 minutes, a value recommended by RFC 1123.
42184 </para>
42185 <para>
42186 <indexterm role="option">
42187 <primary><option>connection_max_messages</option></primary>
42188 </indexterm>
42189 </para>
42190 <informaltable frame="all">
42191 <tgroup cols="4" colsep="0" rowsep="0">
42192 <colspec colwidth="8*" align="left"/>
42193 <colspec colwidth="6*" align="center"/>
42194 <colspec colwidth="6*" align="center"/>
42195 <colspec colwidth="6*" align="right"/>
42196 <tbody>
42197 <row>
42198 <entry><option>connection_max_messages</option></entry>
42199 <entry>Use: <emphasis>smtp</emphasis></entry>
42200 <entry>Type: <emphasis>integer</emphasis></entry>
42201 <entry>Default: <emphasis>500</emphasis></entry>
42202 </row>
42203 </tbody>
42204 </tgroup>
42205 </informaltable>
42206 <para>
42207 <indexterm role="concept">
42208 <primary>SMTP</primary>
42209 <secondary>passed connection</secondary>
42210 </indexterm>
42211 <indexterm role="concept">
42212 <primary>SMTP</primary>
42213 <secondary>multiple deliveries</secondary>
42214 </indexterm>
42215 <indexterm role="concept">
42216 <primary>multiple SMTP deliveries</primary>
42217 </indexterm>
42218 This controls the maximum number of separate message deliveries that are sent
42219 over a single TCP/IP connection. If the value is zero, there is no limit.
42220 For testing purposes, this value can be overridden by the <option>-oB</option> command line
42221 option.
42222 </para>
42223 <para>
42224 <indexterm role="option">
42225 <primary><option>data_timeout</option></primary>
42226 </indexterm>
42227 </para>
42228 <informaltable frame="all">
42229 <tgroup cols="4" colsep="0" rowsep="0">
42230 <colspec colwidth="8*" align="left"/>
42231 <colspec colwidth="6*" align="center"/>
42232 <colspec colwidth="6*" align="center"/>
42233 <colspec colwidth="6*" align="right"/>
42234 <tbody>
42235 <row>
42236 <entry><option>data_timeout</option></entry>
42237 <entry>Use: <emphasis>smtp</emphasis></entry>
42238 <entry>Type: <emphasis>time</emphasis></entry>
42239 <entry>Default: <emphasis>5m</emphasis></entry>
42240 </row>
42241 </tbody>
42242 </tgroup>
42243 </informaltable>
42244 <para>
42245 This sets a timeout for the transmission of each block in the data portion of
42246 the message. As a result, the overall timeout for a message depends on the size
42247 of the message. Its value must not be zero. See also <option>final_timeout</option>.
42248 </para>
42249 <para>
42250 <indexterm role="option">
42251 <primary><option>delay_after_cutoff</option></primary>
42252 </indexterm>
42253 </para>
42254 <informaltable frame="all">
42255 <tgroup cols="4" colsep="0" rowsep="0">
42256 <colspec colwidth="8*" align="left"/>
42257 <colspec colwidth="6*" align="center"/>
42258 <colspec colwidth="6*" align="center"/>
42259 <colspec colwidth="6*" align="right"/>
42260 <tbody>
42261 <row>
42262 <entry><option>delay_after_cutoff</option></entry>
42263 <entry>Use: <emphasis>smtp</emphasis></entry>
42264 <entry>Type: <emphasis>boolean</emphasis></entry>
42265 <entry>Default: <emphasis>true</emphasis></entry>
42266 </row>
42267 </tbody>
42268 </tgroup>
42269 </informaltable>
42270 <para>
42271 This option controls what happens when all remote IP addresses for a given
42272 domain have been inaccessible for so long that they have passed their retry
42273 cutoff times.
42274 </para>
42275 <para>
42276 In the default state, if the next retry time has not been reached for any of
42277 them, the address is bounced without trying any deliveries. In other words,
42278 Exim delays retrying an IP address after the final cutoff time until a new
42279 retry time is reached, and can therefore bounce an address without ever trying
42280 a delivery, when machines have been down for a long time. Some people are
42281 unhappy at this prospect, so...
42282 </para>
42283 <para>
42284 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
42285 addresses are past their final cutoff time, Exim tries to deliver to those
42286 IP addresses that have not been tried since the message arrived. If there are
42287 none, of if they all fail, the address is bounced. In other words, it does not
42288 delay when a new message arrives, but immediately tries those expired IP
42289 addresses that haven&#x2019;t been tried since the message arrived. If there is a
42290 continuous stream of messages for the dead hosts, unsetting
42291 <option>delay_after_cutoff</option> means that there will be many more attempts to deliver
42292 to them.
42293 </para>
42294 <para>
42295 <indexterm role="option">
42296 <primary><option>dns_qualify_single</option></primary>
42297 </indexterm>
42298 </para>
42299 <informaltable frame="all">
42300 <tgroup cols="4" colsep="0" rowsep="0">
42301 <colspec colwidth="8*" align="left"/>
42302 <colspec colwidth="6*" align="center"/>
42303 <colspec colwidth="6*" align="center"/>
42304 <colspec colwidth="6*" align="right"/>
42305 <tbody>
42306 <row>
42307 <entry><option>dns_qualify_single</option></entry>
42308 <entry>Use: <emphasis>smtp</emphasis></entry>
42309 <entry>Type: <emphasis>boolean</emphasis></entry>
42310 <entry>Default: <emphasis>true</emphasis></entry>
42311 </row>
42312 </tbody>
42313 </tgroup>
42314 </informaltable>
42315 <para>
42316 If the <option>hosts</option> or <option>fallback_hosts</option> option is being used,
42317 and the <option>gethostbyname</option> option is false,
42318 the RES_DEFNAMES resolver option is set. See the <option>qualify_single</option> option
42319 in chapter <xref linkend="CHAPdnslookup"/> for more details.
42320 </para>
42321 <para>
42322 <indexterm role="option">
42323 <primary><option>dns_search_parents</option></primary>
42324 </indexterm>
42325 </para>
42326 <informaltable frame="all">
42327 <tgroup cols="4" colsep="0" rowsep="0">
42328 <colspec colwidth="8*" align="left"/>
42329 <colspec colwidth="6*" align="center"/>
42330 <colspec colwidth="6*" align="center"/>
42331 <colspec colwidth="6*" align="right"/>
42332 <tbody>
42333 <row>
42334 <entry><option>dns_search_parents</option></entry>
42335 <entry>Use: <emphasis>smtp</emphasis></entry>
42336 <entry>Type: <emphasis>boolean</emphasis></entry>
42337 <entry>Default: <emphasis>false</emphasis></entry>
42338 </row>
42339 </tbody>
42340 </tgroup>
42341 </informaltable>
42342 <para>
42343 If the <option>hosts</option> or <option>fallback_hosts</option> option is being used, and the
42344 <option>gethostbyname</option> option is false, the RES_DNSRCH resolver option is set.
42345 See the <option>search_parents</option> option in chapter <xref linkend="CHAPdnslookup"/> for more
42346 details.
42347 </para>
42348 <para>
42349 <indexterm role="option">
42350 <primary><option>fallback_hosts</option></primary>
42351 </indexterm>
42352 </para>
42353 <informaltable frame="all">
42354 <tgroup cols="4" colsep="0" rowsep="0">
42355 <colspec colwidth="8*" align="left"/>
42356 <colspec colwidth="6*" align="center"/>
42357 <colspec colwidth="6*" align="center"/>
42358 <colspec colwidth="6*" align="right"/>
42359 <tbody>
42360 <row>
42361 <entry><option>fallback_hosts</option></entry>
42362 <entry>Use: <emphasis>smtp</emphasis></entry>
42363 <entry>Type: <emphasis>string list</emphasis></entry>
42364 <entry>Default: <emphasis>unset</emphasis></entry>
42365 </row>
42366 </tbody>
42367 </tgroup>
42368 </informaltable>
42369 <para>
42370 <indexterm role="concept">
42371 <primary>fallback</primary>
42372 <secondary>hosts specified on transport</secondary>
42373 </indexterm>
42374 String expansion is not applied to this option. The argument must be a
42375 colon-separated list of host names or IP addresses, optionally also including
42376 port numbers, though the separator can be changed, as described in section
42377 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
42378 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
42379 in section <xref linkend="SECTformatonehostitem"/>.
42380 </para>
42381 <para>
42382 Fallback hosts can also be specified on routers, which associate them with the
42383 addresses they process. As for the <option>hosts</option> option without <option>hosts_override</option>,
42384 <option>fallback_hosts</option> specified on the transport is used only if the address does
42385 not have its own associated fallback host list. Unlike <option>hosts</option>, a setting of
42386 <option>fallback_hosts</option> on an address is not overridden by <option>hosts_override</option>.
42387 However, <option>hosts_randomize</option> does apply to fallback host lists.
42388 </para>
42389 <para>
42390 If Exim is unable to deliver to any of the hosts for a particular address, and
42391 the errors are not permanent rejections, the address is put on a separate
42392 transport queue with its host list replaced by the fallback hosts, unless the
42393 address was routed via MX records and the current host was in the original MX
42394 list. In that situation, the fallback host list is not used.
42395 </para>
42396 <para>
42397 Once normal deliveries are complete, the fallback queue is delivered by
42398 re-running the same transports with the new host lists. If several failing
42399 addresses have the same fallback hosts (and <option>max_rcpt</option> permits it), a single
42400 copy of the message is sent.
42401 </para>
42402 <para>
42403 The resolution of the host names on the fallback list is controlled by the
42404 <option>gethostbyname</option> option, as for the <option>hosts</option> option. Fallback hosts apply
42405 both to cases when the host list comes with the address and when it is taken
42406 from <option>hosts</option>. This option provides a <quote>use a smart host only if delivery
42407 fails</quote> facility.
42408 </para>
42409 <para>
42410 <indexterm role="option">
42411 <primary><option>final_timeout</option></primary>
42412 </indexterm>
42413 </para>
42414 <informaltable frame="all">
42415 <tgroup cols="4" colsep="0" rowsep="0">
42416 <colspec colwidth="8*" align="left"/>
42417 <colspec colwidth="6*" align="center"/>
42418 <colspec colwidth="6*" align="center"/>
42419 <colspec colwidth="6*" align="right"/>
42420 <tbody>
42421 <row>
42422 <entry><option>final_timeout</option></entry>
42423 <entry>Use: <emphasis>smtp</emphasis></entry>
42424 <entry>Type: <emphasis>time</emphasis></entry>
42425 <entry>Default: <emphasis>10m</emphasis></entry>
42426 </row>
42427 </tbody>
42428 </tgroup>
42429 </informaltable>
42430 <para>
42431 This is the timeout that applies while waiting for the response to the final
42432 line containing just <quote>.</quote> that terminates a message. Its value must not be
42433 zero.
42434 </para>
42435 <para>
42436 <indexterm role="option">
42437 <primary><option>gethostbyname</option></primary>
42438 </indexterm>
42439 </para>
42440 <informaltable frame="all">
42441 <tgroup cols="4" colsep="0" rowsep="0">
42442 <colspec colwidth="8*" align="left"/>
42443 <colspec colwidth="6*" align="center"/>
42444 <colspec colwidth="6*" align="center"/>
42445 <colspec colwidth="6*" align="right"/>
42446 <tbody>
42447 <row>
42448 <entry><option>gethostbyname</option></entry>
42449 <entry>Use: <emphasis>smtp</emphasis></entry>
42450 <entry>Type: <emphasis>boolean</emphasis></entry>
42451 <entry>Default: <emphasis>false</emphasis></entry>
42452 </row>
42453 </tbody>
42454 </tgroup>
42455 </informaltable>
42456 <para>
42457 If this option is true when the <option>hosts</option> and/or <option>fallback_hosts</option> options are
42458 being used, names are looked up using <function>gethostbyname()</function>
42459 (or <function>getipnodebyname()</function> when available)
42460 instead of using the DNS. Of course, that function may in fact use the DNS, but
42461 it may also consult other sources of information such as <filename>/etc/hosts</filename>.
42462 </para>
42463 <para>
42464 <indexterm role="option">
42465 <primary><option>gnutls_require_kx</option></primary>
42466 </indexterm>
42467 </para>
42468 <informaltable frame="all">
42469 <tgroup cols="4" colsep="0" rowsep="0">
42470 <colspec colwidth="8*" align="left"/>
42471 <colspec colwidth="6*" align="center"/>
42472 <colspec colwidth="6*" align="center"/>
42473 <colspec colwidth="6*" align="right"/>
42474 <tbody>
42475 <row>
42476 <entry><option>gnutls_require_kx</option></entry>
42477 <entry>Use: <emphasis>smtp</emphasis></entry>
42478 <entry>Type: <emphasis>string</emphasis></entry>
42479 <entry>Default: <emphasis>unset</emphasis></entry>
42480 </row>
42481 </tbody>
42482 </tgroup>
42483 </informaltable>
42484 <para>
42485 This option controls the key exchange mechanisms when GnuTLS is used in an Exim
42486 client. For details, see section <xref linkend="SECTreqciphgnu"/>.
42487 </para>
42488 <para>
42489 <indexterm role="option">
42490 <primary><option>gnutls_require_mac</option></primary>
42491 </indexterm>
42492 </para>
42493 <informaltable frame="all">
42494 <tgroup cols="4" colsep="0" rowsep="0">
42495 <colspec colwidth="8*" align="left"/>
42496 <colspec colwidth="6*" align="center"/>
42497 <colspec colwidth="6*" align="center"/>
42498 <colspec colwidth="6*" align="right"/>
42499 <tbody>
42500 <row>
42501 <entry><option>gnutls_require_mac</option></entry>
42502 <entry>Use: <emphasis>smtp</emphasis></entry>
42503 <entry>Type: <emphasis>string</emphasis></entry>
42504 <entry>Default: <emphasis>unset</emphasis></entry>
42505 </row>
42506 </tbody>
42507 </tgroup>
42508 </informaltable>
42509 <para>
42510 This option controls the MAC algorithms when GnuTLS is used in an Exim
42511 client. For details, see section <xref linkend="SECTreqciphgnu"/>.
42512 </para>
42513 <para>
42514 <indexterm role="option">
42515 <primary><option>gnutls_require_protocols</option></primary>
42516 </indexterm>
42517 </para>
42518 <informaltable frame="all">
42519 <tgroup cols="4" colsep="0" rowsep="0">
42520 <colspec colwidth="8*" align="left"/>
42521 <colspec colwidth="6*" align="center"/>
42522 <colspec colwidth="6*" align="center"/>
42523 <colspec colwidth="6*" align="right"/>
42524 <tbody>
42525 <row>
42526 <entry><option>gnutls_require_protocols</option></entry>
42527 <entry>Use: <emphasis>smtp</emphasis></entry>
42528 <entry>Type: <emphasis>string</emphasis></entry>
42529 <entry>Default: <emphasis>unset</emphasis></entry>
42530 </row>
42531 </tbody>
42532 </tgroup>
42533 </informaltable>
42534 <para>
42535 This option controls the protocols when GnuTLS is used in an Exim
42536 client. For details, see section <xref linkend="SECTreqciphgnu"/>.
42537 </para>
42538 <para>
42539 <indexterm role="option">
42540 <primary><option>gnutls_compat_mode</option></primary>
42541 </indexterm>
42542 </para>
42543 <informaltable frame="all">
42544 <tgroup cols="4" colsep="0" rowsep="0">
42545 <colspec colwidth="8*" align="left"/>
42546 <colspec colwidth="6*" align="center"/>
42547 <colspec colwidth="6*" align="center"/>
42548 <colspec colwidth="6*" align="right"/>
42549 <tbody>
42550 <row>
42551 <entry><option>gnutls_compat_mode</option></entry>
42552 <entry>Use: <emphasis>smtp</emphasis></entry>
42553 <entry>Type: <emphasis>boolean</emphasis></entry>
42554 <entry>Default: <emphasis>unset</emphasis></entry>
42555 </row>
42556 </tbody>
42557 </tgroup>
42558 </informaltable>
42559 <para>
42560 This option controls whether GnuTLS is used in compatibility mode in an Exim
42561 server. This reduces security slightly, but improves interworking with older
42562 implementations of TLS.
42563 </para>
42564 <para>
42565 <indexterm role="option">
42566 <primary><option>helo_data</option></primary>
42567 </indexterm>
42568 </para>
42569 <informaltable frame="all">
42570 <tgroup cols="4" colsep="0" rowsep="0">
42571 <colspec colwidth="8*" align="left"/>
42572 <colspec colwidth="6*" align="center"/>
42573 <colspec colwidth="6*" align="center"/>
42574 <colspec colwidth="6*" align="right"/>
42575 <tbody>
42576 <row>
42577 <entry><option>helo_data</option></entry>
42578 <entry>Use: <emphasis>smtp</emphasis></entry>
42579 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42580 <entry>Default: <emphasis>see below</emphasis></entry>
42581 </row>
42582 </tbody>
42583 </tgroup>
42584 </informaltable>
42585 <para>
42586 <indexterm role="concept">
42587 <primary>HELO</primary>
42588 <secondary>argument, setting</secondary>
42589 </indexterm>
42590 <indexterm role="concept">
42591 <primary>EHLO</primary>
42592 <secondary>argument, setting</secondary>
42593 </indexterm>
42594 <indexterm role="concept">
42595 <primary>LHLO argument setting</primary>
42596 </indexterm>
42597 The value of this option is expanded after a connection to a another host has
42598 been set up. The result is used as the argument for the EHLO, HELO, or LHLO
42599 command that starts the outgoing SMTP or LMTP session. The default value of the
42600 option is:
42601 </para>
42602 <literallayout class="monospaced">
42603 $primary_hostname
42604 </literallayout>
42605 <para>
42606 During the expansion, the variables <varname>$host</varname> and <varname>$host_address</varname> are set to
42607 the identity of the remote host, and the variables <varname>$sending_ip_address</varname> and
42608 <varname>$sending_port</varname> are set to the local IP address and port number that are being
42609 used. These variables can be used to generate different values for different
42610 servers or different local IP addresses. For example, if you want the string
42611 that is used for <option>helo_data</option> to be obtained by a DNS lookup of the outgoing
42612 interface address, you could use this:
42613 </para>
42614 <literallayout class="monospaced">
42615 helo_data = ${lookup dnsdb{ptr=$sending_ip_address}{$value}\
42616   {$primary_hostname}}
42617 </literallayout>
42618 <para>
42619 The use of <option>helo_data</option> applies both to sending messages and when doing
42620 callouts.
42621 </para>
42622 <para>
42623 <indexterm role="option">
42624 <primary><option>hosts</option></primary>
42625 </indexterm>
42626 </para>
42627 <informaltable frame="all">
42628 <tgroup cols="4" colsep="0" rowsep="0">
42629 <colspec colwidth="8*" align="left"/>
42630 <colspec colwidth="6*" align="center"/>
42631 <colspec colwidth="6*" align="center"/>
42632 <colspec colwidth="6*" align="right"/>
42633 <tbody>
42634 <row>
42635 <entry><option>hosts</option></entry>
42636 <entry>Use: <emphasis>smtp</emphasis></entry>
42637 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
42638 <entry>Default: <emphasis>unset</emphasis></entry>
42639 </row>
42640 </tbody>
42641 </tgroup>
42642 </informaltable>
42643 <para>
42644 Hosts are associated with an address by a router such as <command>dnslookup</command>, which
42645 finds the hosts by looking up the address domain in the DNS, or by
42646 <command>manualroute</command>, which has lists of hosts in its configuration. However,
42647 email addresses can be passed to the <command>smtp</command> transport by any router, and not
42648 all of them can provide an associated list of hosts.
42649 </para>
42650 <para>
42651 The <option>hosts</option> option specifies a list of hosts to be used if the address being
42652 processed does not have any hosts associated with it. The hosts specified by
42653 <option>hosts</option> are also used, whether or not the address has its own hosts, if
42654 <option>hosts_override</option> is set.
42655 </para>
42656 <para>
42657 The string is first expanded, before being interpreted as a colon-separated
42658 list of host names or IP addresses, possibly including port numbers. The
42659 separator may be changed to something other than colon, as described in section
42660 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
42661 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
42662 in section <xref linkend="SECTformatonehostitem"/>. However, note that the <literal>/MX</literal> facility
42663 of the <command>manualroute</command> router is not available here.
42664 </para>
42665 <para>
42666 If the expansion fails, delivery is deferred. Unless the failure was caused by
42667 the inability to complete a lookup, the error is logged to the panic log as
42668 well as the main log. Host names are looked up either by searching directly for
42669 address records in the DNS or by calling <function>gethostbyname()</function> (or
42670 <function>getipnodebyname()</function> when available), depending on the setting of the
42671 <option>gethostbyname</option> option. When Exim is compiled with IPv6 support, if a host
42672 that is looked up in the DNS has both IPv4 and IPv6 addresses, both types of
42673 address are used.
42674 </para>
42675 <para>
42676 During delivery, the hosts are tried in order, subject to their retry status,
42677 unless <option>hosts_randomize</option> is set.
42678 </para>
42679 <para>
42680 <indexterm role="option">
42681 <primary><option>hosts_avoid_esmtp</option></primary>
42682 </indexterm>
42683 </para>
42684 <informaltable frame="all">
42685 <tgroup cols="4" colsep="0" rowsep="0">
42686 <colspec colwidth="8*" align="left"/>
42687 <colspec colwidth="6*" align="center"/>
42688 <colspec colwidth="6*" align="center"/>
42689 <colspec colwidth="6*" align="right"/>
42690 <tbody>
42691 <row>
42692 <entry><option>hosts_avoid_esmtp</option></entry>
42693 <entry>Use: <emphasis>smtp</emphasis></entry>
42694 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
42695 <entry>Default: <emphasis>unset</emphasis></entry>
42696 </row>
42697 </tbody>
42698 </tgroup>
42699 </informaltable>
42700 <para>
42701 <indexterm role="concept">
42702 <primary>ESMTP, avoiding use of</primary>
42703 </indexterm>
42704 <indexterm role="concept">
42705 <primary>HELO</primary>
42706 <secondary>forcing use of</secondary>
42707 </indexterm>
42708 <indexterm role="concept">
42709 <primary>EHLO</primary>
42710 <secondary>avoiding use of</secondary>
42711 </indexterm>
42712 <indexterm role="concept">
42713 <primary>PIPELINING</primary>
42714 <secondary>avoiding the use of</secondary>
42715 </indexterm>
42716 This option is for use with broken hosts that announce ESMTP facilities (for
42717 example, PIPELINING) and then fail to implement them properly. When a host
42718 matches <option>hosts_avoid_esmtp</option>, Exim sends HELO rather than EHLO at the
42719 start of the SMTP session. This means that it cannot use any of the ESMTP
42720 facilities such as AUTH, PIPELINING, SIZE, and STARTTLS.
42721 </para>
42722 <para>
42723 <indexterm role="option">
42724 <primary><option>hosts_avoid_pipelining</option></primary>
42725 </indexterm>
42726 </para>
42727 <informaltable frame="all">
42728 <tgroup cols="4" colsep="0" rowsep="0">
42729 <colspec colwidth="8*" align="left"/>
42730 <colspec colwidth="6*" align="center"/>
42731 <colspec colwidth="6*" align="center"/>
42732 <colspec colwidth="6*" align="right"/>
42733 <tbody>
42734 <row>
42735 <entry><option>hosts_avoid_pipelining</option></entry>
42736 <entry>Use: <emphasis>smtp</emphasis></entry>
42737 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
42738 <entry>Default: <emphasis>unset</emphasis></entry>
42739 </row>
42740 </tbody>
42741 </tgroup>
42742 </informaltable>
42743 <para>
42744 <indexterm role="concept">
42745 <primary>PIPELINING</primary>
42746 <secondary>avoiding the use of</secondary>
42747 </indexterm>
42748 Exim will not use the SMTP PIPELINING extension when delivering to any host
42749 that matches this list, even if the server host advertises PIPELINING support.
42750 </para>
42751 <para>
42752 <indexterm role="option">
42753 <primary><option>hosts_avoid_tls</option></primary>
42754 </indexterm>
42755 </para>
42756 <informaltable frame="all">
42757 <tgroup cols="4" colsep="0" rowsep="0">
42758 <colspec colwidth="8*" align="left"/>
42759 <colspec colwidth="6*" align="center"/>
42760 <colspec colwidth="6*" align="center"/>
42761 <colspec colwidth="6*" align="right"/>
42762 <tbody>
42763 <row>
42764 <entry><option>hosts_avoid_tls</option></entry>
42765 <entry>Use: <emphasis>smtp</emphasis></entry>
42766 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
42767 <entry>Default: <emphasis>unset</emphasis></entry>
42768 </row>
42769 </tbody>
42770 </tgroup>
42771 </informaltable>
42772 <para>
42773 <indexterm role="concept">
42774 <primary>TLS</primary>
42775 <secondary>avoiding for certain hosts</secondary>
42776 </indexterm>
42777 Exim will not try to start a TLS session when delivering to any host that
42778 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
42779 </para>
42780 <para>
42781 <indexterm role="option">
42782 <primary><option>hosts_max_try</option></primary>
42783 </indexterm>
42784 </para>
42785 <informaltable frame="all">
42786 <tgroup cols="4" colsep="0" rowsep="0">
42787 <colspec colwidth="8*" align="left"/>
42788 <colspec colwidth="6*" align="center"/>
42789 <colspec colwidth="6*" align="center"/>
42790 <colspec colwidth="6*" align="right"/>
42791 <tbody>
42792 <row>
42793 <entry><option>hosts_max_try</option></entry>
42794 <entry>Use: <emphasis>smtp</emphasis></entry>
42795 <entry>Type: <emphasis>integer</emphasis></entry>
42796 <entry>Default: <emphasis>5</emphasis></entry>
42797 </row>
42798 </tbody>
42799 </tgroup>
42800 </informaltable>
42801 <para>
42802 <indexterm role="concept">
42803 <primary>host</primary>
42804 <secondary>maximum number to try</secondary>
42805 </indexterm>
42806 <indexterm role="concept">
42807 <primary>limit</primary>
42808 <secondary>number of hosts tried</secondary>
42809 </indexterm>
42810 <indexterm role="concept">
42811 <primary>limit</primary>
42812 <secondary>number of MX tried</secondary>
42813 </indexterm>
42814 <indexterm role="concept">
42815 <primary>MX record</primary>
42816 <secondary>maximum tried</secondary>
42817 </indexterm>
42818 This option limits the number of IP addresses that are tried for any one
42819 delivery in cases where there are temporary delivery errors. Section
42820 <xref linkend="SECTvalhosmax"/> describes in detail how the value of this option is used.
42821 </para>
42822 <para>
42823 <indexterm role="option">
42824 <primary><option>hosts_max_try_hardlimit</option></primary>
42825 </indexterm>
42826 </para>
42827 <informaltable frame="all">
42828 <tgroup cols="4" colsep="0" rowsep="0">
42829 <colspec colwidth="8*" align="left"/>
42830 <colspec colwidth="6*" align="center"/>
42831 <colspec colwidth="6*" align="center"/>
42832 <colspec colwidth="6*" align="right"/>
42833 <tbody>
42834 <row>
42835 <entry><option>hosts_max_try_hardlimit</option></entry>
42836 <entry>Use: <emphasis>smtp</emphasis></entry>
42837 <entry>Type: <emphasis>integer</emphasis></entry>
42838 <entry>Default: <emphasis>50</emphasis></entry>
42839 </row>
42840 </tbody>
42841 </tgroup>
42842 </informaltable>
42843 <para>
42844 This is an additional check on the maximum number of IP addresses that Exim
42845 tries for any one delivery. Section <xref linkend="SECTvalhosmax"/> describes its use and
42846 why it exists.
42847 </para>
42848 <para>
42849 <indexterm role="option">
42850 <primary><option>hosts_nopass_tls</option></primary>
42851 </indexterm>
42852 </para>
42853 <informaltable frame="all">
42854 <tgroup cols="4" colsep="0" rowsep="0">
42855 <colspec colwidth="8*" align="left"/>
42856 <colspec colwidth="6*" align="center"/>
42857 <colspec colwidth="6*" align="center"/>
42858 <colspec colwidth="6*" align="right"/>
42859 <tbody>
42860 <row>
42861 <entry><option>hosts_nopass_tls</option></entry>
42862 <entry>Use: <emphasis>smtp</emphasis></entry>
42863 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
42864 <entry>Default: <emphasis>unset</emphasis></entry>
42865 </row>
42866 </tbody>
42867 </tgroup>
42868 </informaltable>
42869 <para>
42870 <indexterm role="concept">
42871 <primary>TLS</primary>
42872 <secondary>passing connection</secondary>
42873 </indexterm>
42874 <indexterm role="concept">
42875 <primary>multiple SMTP deliveries</primary>
42876 </indexterm>
42877 <indexterm role="concept">
42878 <primary>TLS</primary>
42879 <secondary>multiple message deliveries</secondary>
42880 </indexterm>
42881 For any host that matches this list, a connection on which a TLS session has
42882 been started will not be passed to a new delivery process for sending another
42883 message on the same connection. See section <xref linkend="SECTmulmessam"/> for an
42884 explanation of when this might be needed.
42885 </para>
42886 <para>
42887 <indexterm role="option">
42888 <primary><option>hosts_override</option></primary>
42889 </indexterm>
42890 </para>
42891 <informaltable frame="all">
42892 <tgroup cols="4" colsep="0" rowsep="0">
42893 <colspec colwidth="8*" align="left"/>
42894 <colspec colwidth="6*" align="center"/>
42895 <colspec colwidth="6*" align="center"/>
42896 <colspec colwidth="6*" align="right"/>
42897 <tbody>
42898 <row>
42899 <entry><option>hosts_override</option></entry>
42900 <entry>Use: <emphasis>smtp</emphasis></entry>
42901 <entry>Type: <emphasis>boolean</emphasis></entry>
42902 <entry>Default: <emphasis>false</emphasis></entry>
42903 </row>
42904 </tbody>
42905 </tgroup>
42906 </informaltable>
42907 <para>
42908 If this option is set and the <option>hosts</option> option is also set, any hosts that are
42909 attached to the address are ignored, and instead the hosts specified by the
42910 <option>hosts</option> option are always used. This option does not apply to
42911 <option>fallback_hosts</option>.
42912 </para>
42913 <para>
42914 <indexterm role="option">
42915 <primary><option>hosts_randomize</option></primary>
42916 </indexterm>
42917 </para>
42918 <informaltable frame="all">
42919 <tgroup cols="4" colsep="0" rowsep="0">
42920 <colspec colwidth="8*" align="left"/>
42921 <colspec colwidth="6*" align="center"/>
42922 <colspec colwidth="6*" align="center"/>
42923 <colspec colwidth="6*" align="right"/>
42924 <tbody>
42925 <row>
42926 <entry><option>hosts_randomize</option></entry>
42927 <entry>Use: <emphasis>smtp</emphasis></entry>
42928 <entry>Type: <emphasis>boolean</emphasis></entry>
42929 <entry>Default: <emphasis>false</emphasis></entry>
42930 </row>
42931 </tbody>
42932 </tgroup>
42933 </informaltable>
42934 <para>
42935 <indexterm role="concept">
42936 <primary>randomized host list</primary>
42937 </indexterm>
42938 <indexterm role="concept">
42939 <primary>host</primary>
42940 <secondary>list of; randomized</secondary>
42941 </indexterm>
42942 <indexterm role="concept">
42943 <primary>fallback</primary>
42944 <secondary>randomized hosts</secondary>
42945 </indexterm>
42946 If this option is set, and either the list of hosts is taken from the
42947 <option>hosts</option> or the <option>fallback_hosts</option> option, or the hosts supplied by the router
42948 were not obtained from MX records (this includes fallback hosts from the
42949 router), and were not randomized by the router, the order of trying the hosts
42950 is randomized each time the transport runs. Randomizing the order of a host
42951 list can be used to do crude load sharing.
42952 </para>
42953 <para>
42954 When <option>hosts_randomize</option> is true, a host list may be split into groups whose
42955 order is separately randomized. This makes it possible to set up MX-like
42956 behaviour. The boundaries between groups are indicated by an item that is just
42957 <literal>+</literal> in the host list. For example:
42958 </para>
42959 <literallayout class="monospaced">
42960 hosts = host1:host2:host3:+:host4:host5
42961 </literallayout>
42962 <para>
42963 The order of the first three hosts and the order of the last two hosts is
42964 randomized for each use, but the first three always end up before the last two.
42965 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored.
42966 </para>
42967 <para>
42968 <indexterm role="option">
42969 <primary><option>hosts_require_auth</option></primary>
42970 </indexterm>
42971 </para>
42972 <informaltable frame="all">
42973 <tgroup cols="4" colsep="0" rowsep="0">
42974 <colspec colwidth="8*" align="left"/>
42975 <colspec colwidth="6*" align="center"/>
42976 <colspec colwidth="6*" align="center"/>
42977 <colspec colwidth="6*" align="right"/>
42978 <tbody>
42979 <row>
42980 <entry><option>hosts_require_auth</option></entry>
42981 <entry>Use: <emphasis>smtp</emphasis></entry>
42982 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
42983 <entry>Default: <emphasis>unset</emphasis></entry>
42984 </row>
42985 </tbody>
42986 </tgroup>
42987 </informaltable>
42988 <para>
42989 <indexterm role="concept">
42990 <primary>authentication</primary>
42991 <secondary>required by client</secondary>
42992 </indexterm>
42993 This option provides a list of servers for which authentication must succeed
42994 before Exim will try to transfer a message. If authentication fails for
42995 servers which are not in this list, Exim tries to send unauthenticated. If
42996 authentication fails for one of these servers, delivery is deferred. This
42997 temporary error is detectable in the retry rules, so it can be turned into a
42998 hard failure if required. See also <option>hosts_try_auth</option>, and chapter
42999 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
43000 </para>
43001 <para>
43002 <indexterm role="option">
43003 <primary><option>hosts_require_tls</option></primary>
43004 </indexterm>
43005 </para>
43006 <informaltable frame="all">
43007 <tgroup cols="4" colsep="0" rowsep="0">
43008 <colspec colwidth="8*" align="left"/>
43009 <colspec colwidth="6*" align="center"/>
43010 <colspec colwidth="6*" align="center"/>
43011 <colspec colwidth="6*" align="right"/>
43012 <tbody>
43013 <row>
43014 <entry><option>hosts_require_tls</option></entry>
43015 <entry>Use: <emphasis>smtp</emphasis></entry>
43016 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
43017 <entry>Default: <emphasis>unset</emphasis></entry>
43018 </row>
43019 </tbody>
43020 </tgroup>
43021 </informaltable>
43022 <para>
43023 <indexterm role="concept">
43024 <primary>TLS</primary>
43025 <secondary>requiring for certain servers</secondary>
43026 </indexterm>
43027 Exim will insist on using a TLS session when delivering to any host that
43028 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
43029 <emphasis role="bold">Note</emphasis>: This option affects outgoing mail only. To insist on TLS for
43030 incoming messages, use an appropriate ACL.
43031 </para>
43032 <para>
43033 <indexterm role="option">
43034 <primary><option>hosts_try_auth</option></primary>
43035 </indexterm>
43036 </para>
43037 <informaltable frame="all">
43038 <tgroup cols="4" colsep="0" rowsep="0">
43039 <colspec colwidth="8*" align="left"/>
43040 <colspec colwidth="6*" align="center"/>
43041 <colspec colwidth="6*" align="center"/>
43042 <colspec colwidth="6*" align="right"/>
43043 <tbody>
43044 <row>
43045 <entry><option>hosts_try_auth</option></entry>
43046 <entry>Use: <emphasis>smtp</emphasis></entry>
43047 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
43048 <entry>Default: <emphasis>unset</emphasis></entry>
43049 </row>
43050 </tbody>
43051 </tgroup>
43052 </informaltable>
43053 <para>
43054 <indexterm role="concept">
43055 <primary>authentication</primary>
43056 <secondary>optional in client</secondary>
43057 </indexterm>
43058 This option provides a list of servers to which, provided they announce
43059 authentication support, Exim will attempt to authenticate as a client when it
43060 connects. If authentication fails, Exim will try to transfer the message
43061 unauthenticated. See also <option>hosts_require_auth</option>, and chapter
43062 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
43063 </para>
43064 <para>
43065 <indexterm role="option">
43066 <primary><option>interface</option></primary>
43067 </indexterm>
43068 </para>
43069 <informaltable frame="all">
43070 <tgroup cols="4" colsep="0" rowsep="0">
43071 <colspec colwidth="8*" align="left"/>
43072 <colspec colwidth="6*" align="center"/>
43073 <colspec colwidth="6*" align="center"/>
43074 <colspec colwidth="6*" align="right"/>
43075 <tbody>
43076 <row>
43077 <entry><option>interface</option></entry>
43078 <entry>Use: <emphasis>smtp</emphasis></entry>
43079 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
43080 <entry>Default: <emphasis>unset</emphasis></entry>
43081 </row>
43082 </tbody>
43083 </tgroup>
43084 </informaltable>
43085 <para>
43086 <indexterm role="concept">
43087 <primary>bind IP address</primary>
43088 </indexterm>
43089 <indexterm role="concept">
43090 <primary>IP address</primary>
43091 <secondary>binding</secondary>
43092 </indexterm>
43093 <indexterm role="variable">
43094 <primary><varname>$host</varname></primary>
43095 </indexterm>
43096 <indexterm role="variable">
43097 <primary><varname>$host_address</varname></primary>
43098 </indexterm>
43099 This option specifies which interface to bind to when making an outgoing SMTP
43100 call. The value is an IP address, not an interface name such as
43101 <literal>eth0</literal>. Do not confuse this with the interface address that was used when a
43102 message was received, which is in <varname>$received_ip_address</varname>, formerly known as
43103 <varname>$interface_address</varname>. The name was changed to minimize confusion with the
43104 outgoing interface address. There is no variable that contains an outgoing
43105 interface address because, unless it is set by this option, its value is
43106 unknown.
43107 </para>
43108 <para>
43109 During the expansion of the <option>interface</option> option the variables <varname>$host</varname> and
43110 <varname>$host_address</varname> refer to the host to which a connection is about to be made
43111 during the expansion of the string. Forced expansion failure, or an empty
43112 string result causes the option to be ignored. Otherwise, after expansion, the
43113 string must be a list of IP addresses, colon-separated by default, but the
43114 separator can be changed in the usual way. For example:
43115 </para>
43116 <literallayout class="monospaced">
43117 interface = &lt;; 192.168.123.123 ; 3ffe:ffff:836f::fe86:a061
43118 </literallayout>
43119 <para>
43120 The first interface of the correct type (IPv4 or IPv6) is used for the outgoing
43121 connection. If none of them are the correct type, the option is ignored. If
43122 <option>interface</option> is not set, or is ignored, the system&#x2019;s IP functions choose which
43123 interface to use if the host has more than one.
43124 </para>
43125 <para>
43126 <indexterm role="option">
43127 <primary><option>keepalive</option></primary>
43128 </indexterm>
43129 </para>
43130 <informaltable frame="all">
43131 <tgroup cols="4" colsep="0" rowsep="0">
43132 <colspec colwidth="8*" align="left"/>
43133 <colspec colwidth="6*" align="center"/>
43134 <colspec colwidth="6*" align="center"/>
43135 <colspec colwidth="6*" align="right"/>
43136 <tbody>
43137 <row>
43138 <entry><option>keepalive</option></entry>
43139 <entry>Use: <emphasis>smtp</emphasis></entry>
43140 <entry>Type: <emphasis>boolean</emphasis></entry>
43141 <entry>Default: <emphasis>true</emphasis></entry>
43142 </row>
43143 </tbody>
43144 </tgroup>
43145 </informaltable>
43146 <para>
43147 <indexterm role="concept">
43148 <primary>keepalive</primary>
43149 <secondary>on outgoing connection</secondary>
43150 </indexterm>
43151 This option controls the setting of SO_KEEPALIVE on outgoing TCP/IP socket
43152 connections. When set, it causes the kernel to probe idle connections
43153 periodically, by sending packets with <quote>old</quote> sequence numbers. The other end
43154 of the connection should send a acknowledgment if the connection is still okay
43155 or a reset if the connection has been aborted. The reason for doing this is
43156 that it has the beneficial effect of freeing up certain types of connection
43157 that can get stuck when the remote host is disconnected without tidying up the
43158 TCP/IP call properly. The keepalive mechanism takes several hours to detect
43159 unreachable hosts.
43160 </para>
43161 <para>
43162 <indexterm role="option">
43163 <primary><option>lmtp_ignore_quota</option></primary>
43164 </indexterm>
43165 </para>
43166 <informaltable frame="all">
43167 <tgroup cols="4" colsep="0" rowsep="0">
43168 <colspec colwidth="8*" align="left"/>
43169 <colspec colwidth="6*" align="center"/>
43170 <colspec colwidth="6*" align="center"/>
43171 <colspec colwidth="6*" align="right"/>
43172 <tbody>
43173 <row>
43174 <entry><option>lmtp_ignore_quota</option></entry>
43175 <entry>Use: <emphasis>smtp</emphasis></entry>
43176 <entry>Type: <emphasis>boolean</emphasis></entry>
43177 <entry>Default: <emphasis>false</emphasis></entry>
43178 </row>
43179 </tbody>
43180 </tgroup>
43181 </informaltable>
43182 <para>
43183 <indexterm role="concept">
43184 <primary>LMTP</primary>
43185 <secondary>ignoring quota errors</secondary>
43186 </indexterm>
43187 If this option is set true when the <option>protocol</option> option is set to <quote>lmtp</quote>, the
43188 string <literal>IGNOREQUOTA</literal> is added to RCPT commands, provided that the LMTP server
43189 has advertised support for IGNOREQUOTA in its response to the LHLO command.
43190 </para>
43191 <para>
43192 <indexterm role="option">
43193 <primary><option>max_rcpt</option></primary>
43194 </indexterm>
43195 </para>
43196 <informaltable frame="all">
43197 <tgroup cols="4" colsep="0" rowsep="0">
43198 <colspec colwidth="8*" align="left"/>
43199 <colspec colwidth="6*" align="center"/>
43200 <colspec colwidth="6*" align="center"/>
43201 <colspec colwidth="6*" align="right"/>
43202 <tbody>
43203 <row>
43204 <entry><option>max_rcpt</option></entry>
43205 <entry>Use: <emphasis>smtp</emphasis></entry>
43206 <entry>Type: <emphasis>integer</emphasis></entry>
43207 <entry>Default: <emphasis>100</emphasis></entry>
43208 </row>
43209 </tbody>
43210 </tgroup>
43211 </informaltable>
43212 <para>
43213 <indexterm role="concept">
43214 <primary>RCPT</primary>
43215 <secondary>maximum number of outgoing</secondary>
43216 </indexterm>
43217 This option limits the number of RCPT commands that are sent in a single
43218 SMTP message transaction. Each set of addresses is treated independently, and
43219 so can cause parallel connections to the same host if <option>remote_max_parallel</option>
43220 permits this.
43221 </para>
43222 <para>
43223 <indexterm role="option">
43224 <primary><option>multi_domain</option></primary>
43225 </indexterm>
43226 </para>
43227 <informaltable frame="all">
43228 <tgroup cols="4" colsep="0" rowsep="0">
43229 <colspec colwidth="8*" align="left"/>
43230 <colspec colwidth="6*" align="center"/>
43231 <colspec colwidth="6*" align="center"/>
43232 <colspec colwidth="6*" align="right"/>
43233 <tbody>
43234 <row>
43235 <entry><option>multi_domain</option></entry>
43236 <entry>Use: <emphasis>smtp</emphasis></entry>
43237 <entry>Type: <emphasis>boolean</emphasis></entry>
43238 <entry>Default: <emphasis>true</emphasis></entry>
43239 </row>
43240 </tbody>
43241 </tgroup>
43242 </informaltable>
43243 <para>
43244 <indexterm role="variable">
43245 <primary><varname>$domain</varname></primary>
43246 </indexterm>
43247 When this option is set, the <command>smtp</command> transport can handle a number of
43248 addresses containing a mixture of different domains provided they all resolve
43249 to the same list of hosts. Turning the option off restricts the transport to
43250 handling only one domain at a time. This is useful if you want to use
43251 <varname>$domain</varname> in an expansion for the transport, because it is set only when there
43252 is a single domain involved in a remote delivery.
43253 </para>
43254 <para>
43255 <indexterm role="option">
43256 <primary><option>port</option></primary>
43257 </indexterm>
43258 </para>
43259 <informaltable frame="all">
43260 <tgroup cols="4" colsep="0" rowsep="0">
43261 <colspec colwidth="8*" align="left"/>
43262 <colspec colwidth="6*" align="center"/>
43263 <colspec colwidth="6*" align="center"/>
43264 <colspec colwidth="6*" align="right"/>
43265 <tbody>
43266 <row>
43267 <entry><option>port</option></entry>
43268 <entry>Use: <emphasis>smtp</emphasis></entry>
43269 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43270 <entry>Default: <emphasis>see below</emphasis></entry>
43271 </row>
43272 </tbody>
43273 </tgroup>
43274 </informaltable>
43275 <para>
43276 <indexterm role="concept">
43277 <primary>port</primary>
43278 <secondary>sending TCP/IP</secondary>
43279 </indexterm>
43280 <indexterm role="concept">
43281 <primary>TCP/IP</primary>
43282 <secondary>setting outgoing port</secondary>
43283 </indexterm>
43284 This option specifies the TCP/IP port on the server to which Exim connects.
43285 <emphasis role="bold">Note:</emphasis> Do not confuse this with the port that was used when a message was
43286 received, which is in <varname>$received_port</varname>, formerly known as <varname>$interface_port</varname>.
43287 The name was changed to minimize confusion with the outgoing port. There is no
43288 variable that contains an outgoing port.
43289 </para>
43290 <para>
43291 If the value of this option begins with a digit it is taken as a port number;
43292 otherwise it is looked up using <function>getservbyname()</function>. The default value is
43293 normally <quote>smtp</quote>, but if <option>protocol</option> is set to <quote>lmtp</quote>, the default is
43294 <quote>lmtp</quote>. If the expansion fails, or if a port number cannot be found, delivery
43295 is deferred.
43296 </para>
43297 <para>
43298 <indexterm role="option">
43299 <primary><option>protocol</option></primary>
43300 </indexterm>
43301 </para>
43302 <informaltable frame="all">
43303 <tgroup cols="4" colsep="0" rowsep="0">
43304 <colspec colwidth="8*" align="left"/>
43305 <colspec colwidth="6*" align="center"/>
43306 <colspec colwidth="6*" align="center"/>
43307 <colspec colwidth="6*" align="right"/>
43308 <tbody>
43309 <row>
43310 <entry><option>protocol</option></entry>
43311 <entry>Use: <emphasis>smtp</emphasis></entry>
43312 <entry>Type: <emphasis>string</emphasis></entry>
43313 <entry>Default: <emphasis>smtp</emphasis></entry>
43314 </row>
43315 </tbody>
43316 </tgroup>
43317 </informaltable>
43318 <para>
43319 <indexterm role="concept">
43320 <primary>LMTP</primary>
43321 <secondary>over TCP/IP</secondary>
43322 </indexterm>
43323 If this option is set to <quote>lmtp</quote> instead of <quote>smtp</quote>, the default value for
43324 the <option>port</option> option changes to <quote>lmtp</quote>, and the transport operates the LMTP
43325 protocol (RFC 2033) instead of SMTP. This protocol is sometimes used for local
43326 deliveries into closed message stores. Exim also has support for running LMTP
43327 over a pipe to a local process &ndash; see chapter <xref linkend="CHAPLMTP"/>.
43328 </para>
43329 <para>
43330 <indexterm role="option">
43331 <primary><option>retry_include_ip_address</option></primary>
43332 </indexterm>
43333 </para>
43334 <informaltable frame="all">
43335 <tgroup cols="4" colsep="0" rowsep="0">
43336 <colspec colwidth="8*" align="left"/>
43337 <colspec colwidth="6*" align="center"/>
43338 <colspec colwidth="6*" align="center"/>
43339 <colspec colwidth="6*" align="right"/>
43340 <tbody>
43341 <row>
43342 <entry><option>retry_include_ip_address</option></entry>
43343 <entry>Use: <emphasis>smtp</emphasis></entry>
43344 <entry>Type: <emphasis>boolean</emphasis></entry>
43345 <entry>Default: <emphasis>true</emphasis></entry>
43346 </row>
43347 </tbody>
43348 </tgroup>
43349 </informaltable>
43350 <para>
43351 Exim normally includes both the host name and the IP address in the key it
43352 constructs for indexing retry data after a temporary delivery failure. This
43353 means that when one of several IP addresses for a host is failing, it gets
43354 tried periodically (controlled by the retry rules), but use of the other IP
43355 addresses is not affected.
43356 </para>
43357 <para>
43358 However, in some dialup environments hosts are assigned a different IP address
43359 each time they connect. In this situation the use of the IP address as part of
43360 the retry key leads to undesirable behaviour. Setting this option false causes
43361 Exim to use only the host name. This should normally be done on a separate
43362 instance of the <command>smtp</command> transport, set up specially to handle the dialup
43363 hosts.
43364 </para>
43365 <para>
43366 <indexterm role="option">
43367 <primary><option>serialize_hosts</option></primary>
43368 </indexterm>
43369 </para>
43370 <informaltable frame="all">
43371 <tgroup cols="4" colsep="0" rowsep="0">
43372 <colspec colwidth="8*" align="left"/>
43373 <colspec colwidth="6*" align="center"/>
43374 <colspec colwidth="6*" align="center"/>
43375 <colspec colwidth="6*" align="right"/>
43376 <tbody>
43377 <row>
43378 <entry><option>serialize_hosts</option></entry>
43379 <entry>Use: <emphasis>smtp</emphasis></entry>
43380 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
43381 <entry>Default: <emphasis>unset</emphasis></entry>
43382 </row>
43383 </tbody>
43384 </tgroup>
43385 </informaltable>
43386 <para>
43387 <indexterm role="concept">
43388 <primary>serializing connections</primary>
43389 </indexterm>
43390 <indexterm role="concept">
43391 <primary>host</primary>
43392 <secondary>serializing connections</secondary>
43393 </indexterm>
43394 Because Exim operates in a distributed manner, if several messages for the same
43395 host arrive at around the same time, more than one simultaneous connection to
43396 the remote host can occur. This is not usually a problem except when there is a
43397 slow link between the hosts. In that situation it may be helpful to restrict
43398 Exim to one connection at a time. This can be done by setting
43399 <option>serialize_hosts</option> to match the relevant hosts.
43400 </para>
43401 <para>
43402 <indexterm role="concept">
43403 <primary>hints database</primary>
43404 <secondary>serializing deliveries to a host</secondary>
43405 </indexterm>
43406 Exim implements serialization by means of a hints database in which a record is
43407 written whenever a process connects to one of the restricted hosts. The record
43408 is deleted when the connection is completed. Obviously there is scope for
43409 records to get left lying around if there is a system or program crash. To
43410 guard against this, Exim ignores any records that are more than six hours old.
43411 </para>
43412 <para>
43413 If you set up this kind of serialization, you should also arrange to delete the
43414 relevant hints database whenever your system reboots. The names of the files
43415 start with <filename>misc</filename> and they are kept in the <filename>spool/db</filename> directory. There
43416 may be one or two files, depending on the type of DBM in use. The same files
43417 are used for ETRN serialization.
43418 </para>
43419 <para>
43420 <indexterm role="option">
43421 <primary><option>size_addition</option></primary>
43422 </indexterm>
43423 </para>
43424 <informaltable frame="all">
43425 <tgroup cols="4" colsep="0" rowsep="0">
43426 <colspec colwidth="8*" align="left"/>
43427 <colspec colwidth="6*" align="center"/>
43428 <colspec colwidth="6*" align="center"/>
43429 <colspec colwidth="6*" align="right"/>
43430 <tbody>
43431 <row>
43432 <entry><option>size_addition</option></entry>
43433 <entry>Use: <emphasis>smtp</emphasis></entry>
43434 <entry>Type: <emphasis>integer</emphasis></entry>
43435 <entry>Default: <emphasis>1024</emphasis></entry>
43436 </row>
43437 </tbody>
43438 </tgroup>
43439 </informaltable>
43440 <para>
43441 <indexterm role="concept">
43442 <primary>SMTP</primary>
43443 <secondary>SIZE</secondary>
43444 </indexterm>
43445 <indexterm role="concept">
43446 <primary>message</primary>
43447 <secondary>size issue for transport filter</secondary>
43448 </indexterm>
43449 <indexterm role="concept">
43450 <primary>size</primary>
43451 <secondary>of message</secondary>
43452 </indexterm>
43453 <indexterm role="concept">
43454 <primary>transport</primary>
43455 <secondary>filter</secondary>
43456 </indexterm>
43457 <indexterm role="concept">
43458 <primary>filter</primary>
43459 <secondary>transport filter</secondary>
43460 </indexterm>
43461 If a remote SMTP server indicates that it supports the SIZE option of the
43462 MAIL command, Exim uses this to pass over the message size at the start of
43463 an SMTP transaction. It adds the value of <option>size_addition</option> to the value it
43464 sends, to allow for headers and other text that may be added during delivery by
43465 configuration options or in a transport filter. It may be necessary to increase
43466 this if a lot of text is added to messages.
43467 </para>
43468 <para>
43469 Alternatively, if the value of <option>size_addition</option> is set negative, it disables
43470 the use of the SIZE option altogether.
43471 </para>
43472 <para>
43473 <indexterm role="option">
43474 <primary><option>tls_certificate</option></primary>
43475 </indexterm>
43476 </para>
43477 <informaltable frame="all">
43478 <tgroup cols="4" colsep="0" rowsep="0">
43479 <colspec colwidth="8*" align="left"/>
43480 <colspec colwidth="6*" align="center"/>
43481 <colspec colwidth="6*" align="center"/>
43482 <colspec colwidth="6*" align="right"/>
43483 <tbody>
43484 <row>
43485 <entry><option>tls_certificate</option></entry>
43486 <entry>Use: <emphasis>smtp</emphasis></entry>
43487 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43488 <entry>Default: <emphasis>unset</emphasis></entry>
43489 </row>
43490 </tbody>
43491 </tgroup>
43492 </informaltable>
43493 <para>
43494 <indexterm role="concept">
43495 <primary>TLS</primary>
43496 <secondary>client certificate, location of</secondary>
43497 </indexterm>
43498 <indexterm role="concept">
43499 <primary>certificate</primary>
43500 <secondary>client, location of</secondary>
43501 </indexterm>
43502 <indexterm role="variable">
43503 <primary><varname>$host</varname></primary>
43504 </indexterm>
43505 <indexterm role="variable">
43506 <primary><varname>$host_address</varname></primary>
43507 </indexterm>
43508 The value of this option must be the absolute path to a file which contains the
43509 client&#x2019;s certificate, for possible use when sending a message over an encrypted
43510 connection. The values of <varname>$host</varname> and <varname>$host_address</varname> are set to the name and
43511 address of the server during the expansion. See chapter <xref linkend="CHAPTLS"/> for
43512 details of TLS.
43513 </para>
43514 <para>
43515 <emphasis role="bold">Note</emphasis>: This option must be set if you want Exim to be able to use a TLS
43516 certificate when sending messages as a client. The global option of the same
43517 name specifies the certificate for Exim as a server; it is not automatically
43518 assumed that the same certificate should be used when Exim is operating as a
43519 client.
43520 </para>
43521 <para>
43522 <indexterm role="option">
43523 <primary><option>tls_crl</option></primary>
43524 </indexterm>
43525 </para>
43526 <informaltable frame="all">
43527 <tgroup cols="4" colsep="0" rowsep="0">
43528 <colspec colwidth="8*" align="left"/>
43529 <colspec colwidth="6*" align="center"/>
43530 <colspec colwidth="6*" align="center"/>
43531 <colspec colwidth="6*" align="right"/>
43532 <tbody>
43533 <row>
43534 <entry><option>tls_crl</option></entry>
43535 <entry>Use: <emphasis>smtp</emphasis></entry>
43536 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43537 <entry>Default: <emphasis>unset</emphasis></entry>
43538 </row>
43539 </tbody>
43540 </tgroup>
43541 </informaltable>
43542 <para>
43543 <indexterm role="concept">
43544 <primary>TLS</primary>
43545 <secondary>client certificate revocation list</secondary>
43546 </indexterm>
43547 <indexterm role="concept">
43548 <primary>certificate</primary>
43549 <secondary>revocation list for client</secondary>
43550 </indexterm>
43551 This option specifies a certificate revocation list. The expanded value must
43552 be the name of a file that contains a CRL in PEM format.
43553 </para>
43554 <para>
43555 <indexterm role="option">
43556 <primary><option>tls_privatekey</option></primary>
43557 </indexterm>
43558 </para>
43559 <informaltable frame="all">
43560 <tgroup cols="4" colsep="0" rowsep="0">
43561 <colspec colwidth="8*" align="left"/>
43562 <colspec colwidth="6*" align="center"/>
43563 <colspec colwidth="6*" align="center"/>
43564 <colspec colwidth="6*" align="right"/>
43565 <tbody>
43566 <row>
43567 <entry><option>tls_privatekey</option></entry>
43568 <entry>Use: <emphasis>smtp</emphasis></entry>
43569 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43570 <entry>Default: <emphasis>unset</emphasis></entry>
43571 </row>
43572 </tbody>
43573 </tgroup>
43574 </informaltable>
43575 <para>
43576 <indexterm role="concept">
43577 <primary>TLS</primary>
43578 <secondary>client private key, location of</secondary>
43579 </indexterm>
43580 <indexterm role="variable">
43581 <primary><varname>$host</varname></primary>
43582 </indexterm>
43583 <indexterm role="variable">
43584 <primary><varname>$host_address</varname></primary>
43585 </indexterm>
43586 The value of this option must be the absolute path to a file which contains the
43587 client&#x2019;s private key. This is used when sending a message over an encrypted
43588 connection using a client certificate. The values of <varname>$host</varname> and
43589 <varname>$host_address</varname> are set to the name and address of the server during the
43590 expansion. If this option is unset, or the expansion is forced to fail, or the
43591 result is an empty string, the private key is assumed to be in the same file as
43592 the certificate. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
43593 </para>
43594 <para>
43595 <indexterm role="option">
43596 <primary><option>tls_require_ciphers</option></primary>
43597 </indexterm>
43598 </para>
43599 <informaltable frame="all">
43600 <tgroup cols="4" colsep="0" rowsep="0">
43601 <colspec colwidth="8*" align="left"/>
43602 <colspec colwidth="6*" align="center"/>
43603 <colspec colwidth="6*" align="center"/>
43604 <colspec colwidth="6*" align="right"/>
43605 <tbody>
43606 <row>
43607 <entry><option>tls_require_ciphers</option></entry>
43608 <entry>Use: <emphasis>smtp</emphasis></entry>
43609 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43610 <entry>Default: <emphasis>unset</emphasis></entry>
43611 </row>
43612 </tbody>
43613 </tgroup>
43614 </informaltable>
43615 <para>
43616 <indexterm role="concept">
43617 <primary>TLS</primary>
43618 <secondary>requiring specific ciphers</secondary>
43619 </indexterm>
43620 <indexterm role="concept">
43621 <primary>cipher</primary>
43622 <secondary>requiring specific</secondary>
43623 </indexterm>
43624 <indexterm role="variable">
43625 <primary><varname>$host</varname></primary>
43626 </indexterm>
43627 <indexterm role="variable">
43628 <primary><varname>$host_address</varname></primary>
43629 </indexterm>
43630 The value of this option must be a list of permitted cipher suites, for use
43631 when setting up an outgoing encrypted connection. (There is a global option of
43632 the same name for controlling incoming connections.) The values of <varname>$host</varname> and
43633 <varname>$host_address</varname> are set to the name and address of the server during the
43634 expansion. See chapter <xref linkend="CHAPTLS"/> for details of TLS; note that this option
43635 is used in different ways by OpenSSL and GnuTLS (see sections
43636 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>). For GnuTLS, the order of the
43637 ciphers is a preference order.
43638 </para>
43639 <para>
43640 <indexterm role="option">
43641 <primary><option>tls_tempfail_tryclear</option></primary>
43642 </indexterm>
43643 </para>
43644 <informaltable frame="all">
43645 <tgroup cols="4" colsep="0" rowsep="0">
43646 <colspec colwidth="8*" align="left"/>
43647 <colspec colwidth="6*" align="center"/>
43648 <colspec colwidth="6*" align="center"/>
43649 <colspec colwidth="6*" align="right"/>
43650 <tbody>
43651 <row>
43652 <entry><option>tls_tempfail_tryclear</option></entry>
43653 <entry>Use: <emphasis>smtp</emphasis></entry>
43654 <entry>Type: <emphasis>boolean</emphasis></entry>
43655 <entry>Default: <emphasis>true</emphasis></entry>
43656 </row>
43657 </tbody>
43658 </tgroup>
43659 </informaltable>
43660 <para>
43661 <indexterm role="concept">
43662 <primary>4<emphasis>xx</emphasis> responses</primary>
43663 <secondary>to STARTTLS</secondary>
43664 </indexterm>
43665 When the server host is not in <option>hosts_require_tls</option>, and there is a problem in
43666 setting up a TLS session, this option determines whether or not Exim should try
43667 to deliver the message unencrypted. If it is set false, delivery to the
43668 current host is deferred; if there are other hosts, they are tried. If this
43669 option is set true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis>
43670 response to STARTTLS. Also, if STARTTLS is accepted, but the subsequent
43671 TLS negotiation fails, Exim closes the current connection (because it is in an
43672 unknown state), opens a new one to the same host, and then tries the delivery
43673 in clear.
43674 </para>
43675 <para>
43676 <indexterm role="option">
43677 <primary><option>tls_verify_certificates</option></primary>
43678 </indexterm>
43679 </para>
43680 <informaltable frame="all">
43681 <tgroup cols="4" colsep="0" rowsep="0">
43682 <colspec colwidth="8*" align="left"/>
43683 <colspec colwidth="6*" align="center"/>
43684 <colspec colwidth="6*" align="center"/>
43685 <colspec colwidth="6*" align="right"/>
43686 <tbody>
43687 <row>
43688 <entry><option>tls_verify_certificates</option></entry>
43689 <entry>Use: <emphasis>smtp</emphasis></entry>
43690 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43691 <entry>Default: <emphasis>unset</emphasis></entry>
43692 </row>
43693 </tbody>
43694 </tgroup>
43695 </informaltable>
43696 <para>
43697 <indexterm role="concept">
43698 <primary>TLS</primary>
43699 <secondary>server certificate verification</secondary>
43700 </indexterm>
43701 <indexterm role="concept">
43702 <primary>certificate</primary>
43703 <secondary>verification of server</secondary>
43704 </indexterm>
43705 <indexterm role="variable">
43706 <primary><varname>$host</varname></primary>
43707 </indexterm>
43708 <indexterm role="variable">
43709 <primary><varname>$host_address</varname></primary>
43710 </indexterm>
43711 The value of this option must be the absolute path to a file containing
43712 permitted server certificates, for use when setting up an encrypted connection.
43713 Alternatively, if you are using OpenSSL, you can set
43714 <option>tls_verify_certificates</option> to the name of a directory containing certificate
43715 files. This does not work with GnuTLS; the option must be set to the name of a
43716 single file if you are using GnuTLS. The values of <varname>$host</varname> and
43717 <varname>$host_address</varname> are set to the name and address of the server during the
43718 expansion of this option. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
43719 </para>
43720 </section>
43721 <section id="SECTvalhosmax">
43722 <title>How the limits for the number of hosts to try are used</title>
43723 <para>
43724 <indexterm role="concept">
43725 <primary>host</primary>
43726 <secondary>maximum number to try</secondary>
43727 </indexterm>
43728 <indexterm role="concept">
43729 <primary>limit</primary>
43730 <secondary>hosts; maximum number tried</secondary>
43731 </indexterm>
43732 There are two options that are concerned with the number of hosts that are
43733 tried when an SMTP delivery takes place. They are <option>hosts_max_try</option> and
43734 <option>hosts_max_try_hardlimit</option>.
43735 </para>
43736 <para>
43737 The <option>hosts_max_try</option> option limits the number of hosts that are tried
43738 for a single delivery. However, despite the term <quote>host</quote> in its name, the
43739 option actually applies to each IP address independently. In other words, a
43740 multihomed host is treated as several independent hosts, just as it is for
43741 retrying.
43742 </para>
43743 <para>
43744 Many of the larger ISPs have multiple MX records which often point to
43745 multihomed hosts. As a result, a list of a dozen or more IP addresses may be
43746 created as a result of routing one of these domains.
43747 </para>
43748 <para>
43749 Trying every single IP address on such a long list does not seem sensible; if
43750 several at the top of the list fail, it is reasonable to assume there is some
43751 problem that is likely to affect all of them. Roughly speaking, the value of
43752 <option>hosts_max_try</option> is the maximum number that are tried before deferring the
43753 delivery. However, the logic cannot be quite that simple.
43754 </para>
43755 <para>
43756 Firstly, IP addresses that are skipped because their retry times have not
43757 arrived do not count, and in addition, addresses that are past their retry
43758 limits are also not counted, even when they are tried. This means that when
43759 some IP addresses are past their retry limits, more than the value of
43760 <option>hosts_max_retry</option> may be tried. The reason for this behaviour is to ensure
43761 that all IP addresses are considered before timing out an email address (but
43762 see below for an exception).
43763 </para>
43764 <para>
43765 Secondly, when the <option>hosts_max_try</option> limit is reached, Exim looks down the host
43766 list to see if there is a subsequent host with a different (higher valued) MX.
43767 If there is, that host is considered next, and the current IP address is used
43768 but not counted. This behaviour helps in the case of a domain with a retry rule
43769 that hardly ever delays any hosts, as is now explained:
43770 </para>
43771 <para>
43772 Consider the case of a long list of hosts with one MX value, and a few with a
43773 higher MX value. If <option>hosts_max_try</option> is small (the default is 5) only a few
43774 hosts at the top of the list are tried at first. With the default retry rule,
43775 which specifies increasing retry times, the higher MX hosts are eventually
43776 tried when those at the top of the list are skipped because they have not
43777 reached their retry times.
43778 </para>
43779 <para>
43780 However, it is common practice to put a fixed short retry time on domains for
43781 large ISPs, on the grounds that their servers are rarely down for very long.
43782 Unfortunately, these are exactly the domains that tend to resolve to long lists
43783 of hosts. The short retry time means that the lowest MX hosts are tried every
43784 time. The attempts may be in a different order because of random sorting, but
43785 without the special MX check, the higher MX hosts would never be tried until
43786 all the lower MX hosts had timed out (which might be several days), because
43787 there are always some lower MX hosts that have reached their retry times. With
43788 the special check, Exim considers at least one IP address from each MX value at
43789 every delivery attempt, even if the <option>hosts_max_try</option> limit has already been
43790 reached.
43791 </para>
43792 <para>
43793 The above logic means that <option>hosts_max_try</option> is not a hard limit, and in
43794 particular, Exim normally eventually tries all the IP addresses before timing
43795 out an email address. When <option>hosts_max_try</option> was implemented, this seemed a
43796 reasonable thing to do. Recently, however, some lunatic DNS configurations have
43797 been set up with hundreds of IP addresses for some domains. It can
43798 take a very long time indeed for an address to time out in these cases.
43799 </para>
43800 <para>
43801 The <option>hosts_max_try_hardlimit</option> option was added to help with this problem.
43802 Exim never tries more than this number of IP addresses; if it hits this limit
43803 and they are all timed out, the email address is bounced, even though not all
43804 possible IP addresses have been tried.
43805 <indexterm role="concept" startref="IIDsmttra1" class="endofrange"/>
43806 <indexterm role="concept" startref="IIDsmttra2" class="endofrange"/>
43807 </para>
43808 </section>
43809 </chapter>
43810
43811 <chapter id="CHAPrewrite">
43812 <title>Address rewriting</title>
43813 <para>
43814 <indexterm role="concept" id="IIDaddrew" class="startofrange">
43815 <primary>rewriting</primary>
43816 <secondary>addresses</secondary>
43817 </indexterm>
43818 There are some circumstances in which Exim automatically rewrites domains in
43819 addresses. The two most common are when an address is given without a domain
43820 (referred to as an <quote>unqualified address</quote>) or when an address contains an
43821 abbreviated domain that is expanded by DNS lookup.
43822 </para>
43823 <para>
43824 Unqualified envelope addresses are accepted only for locally submitted
43825 messages, or for messages that are received from hosts matching
43826 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
43827 appropriate. Unqualified addresses in header lines are qualified if they are in
43828 locally submitted messages, or messages from hosts that are permitted to send
43829 unqualified envelope addresses. Otherwise, unqualified addresses in header
43830 lines are neither qualified nor rewritten.
43831 </para>
43832 <para>
43833 One situation in which Exim does <emphasis>not</emphasis> automatically rewrite a domain is
43834 when it is the name of a CNAME record in the DNS. The older RFCs suggest that
43835 such a domain should be rewritten using the <quote>canonical</quote> name, and some MTAs
43836 do this. The new RFCs do not contain this suggestion.
43837 </para>
43838 <section id="SECID147">
43839 <title>Explicitly configured address rewriting</title>
43840 <para>
43841 This chapter describes the rewriting rules that can be used in the
43842 main rewrite section of the configuration file, and also in the generic
43843 <option>headers_rewrite</option> option that can be set on any transport.
43844 </para>
43845 <para>
43846 Some people believe that configured address rewriting is a Mortal Sin.
43847 Others believe that life is not possible without it. Exim provides the
43848 facility; you do not have to use it.
43849 </para>
43850 <para>
43851 The main rewriting rules that appear in the <quote>rewrite</quote> section of the
43852 configuration file are applied to addresses in incoming messages, both envelope
43853 addresses and addresses in header lines. Each rule specifies the types of
43854 address to which it applies.
43855 </para>
43856 <para>
43857 Whether or not addresses in header lines are rewritten depends on the origin of
43858 the headers and the type of rewriting. Global rewriting, that is, rewriting
43859 rules from the rewrite section of the configuration file, is applied only to
43860 those headers that were received with the message. Header lines that are added
43861 by ACLs or by a system filter or by individual routers or transports (which
43862 are specific to individual recipient addresses) are not rewritten by the global
43863 rules.
43864 </para>
43865 <para>
43866 Rewriting at transport time, by means of the <option>headers_rewrite</option> option,
43867 applies all headers except those added by routers and transports. That is, as
43868 well as the headers that were received with the message, it also applies to
43869 headers that were added by an ACL or a system filter.
43870 </para>
43871 <para>
43872 In general, rewriting addresses from your own system or domain has some
43873 legitimacy. Rewriting other addresses should be done only with great care and
43874 in special circumstances. The author of Exim believes that rewriting should be
43875 used sparingly, and mainly for <quote>regularizing</quote> addresses in your own domains.
43876 Although it can sometimes be used as a routing tool, this is very strongly
43877 discouraged.
43878 </para>
43879 <para>
43880 There are two commonly encountered circumstances where rewriting is used, as
43881 illustrated by these examples:
43882 </para>
43883 <itemizedlist>
43884 <listitem>
43885 <para>
43886 The company whose domain is <emphasis>hitch.fict.example</emphasis> has a number of hosts that
43887 exchange mail with each other behind a firewall, but there is only a single
43888 gateway to the outer world. The gateway rewrites <emphasis>*.hitch.fict.example</emphasis> as
43889 <emphasis>hitch.fict.example</emphasis> when sending mail off-site.
43890 </para>
43891 </listitem>
43892 <listitem>
43893 <para>
43894 A host rewrites the local parts of its own users so that, for example,
43895 <emphasis>fp42@hitch.fict.example</emphasis> becomes <emphasis>Ford.Prefect@hitch.fict.example</emphasis>.
43896 </para>
43897 </listitem>
43898 </itemizedlist>
43899 </section>
43900 <section id="SECID148">
43901 <title>When does rewriting happen?</title>
43902 <para>
43903 <indexterm role="concept">
43904 <primary>rewriting</primary>
43905 <secondary>timing of</secondary>
43906 </indexterm>
43907 <indexterm role="concept">
43908 <primary>access control lists (ACLs)</primary>
43909 <secondary>rewriting addresses in</secondary>
43910 </indexterm>
43911 Configured address rewriting can take place at several different stages of a
43912 message&#x2019;s processing.
43913 </para>
43914 <para>
43915 <indexterm role="variable">
43916 <primary><varname>$sender_address</varname></primary>
43917 </indexterm>
43918 At the start of an ACL for MAIL, the sender address may have been rewritten
43919 by a special SMTP-time rewrite rule (see section <xref linkend="SECTrewriteS"/>), but no
43920 ordinary rewrite rules have yet been applied. If, however, the sender address
43921 is verified in the ACL, it is rewritten before verification, and remains
43922 rewritten thereafter. The subsequent value of <varname>$sender_address</varname> is the
43923 rewritten address. This also applies if sender verification happens in a
43924 RCPT ACL. Otherwise, when the sender address is not verified, it is
43925 rewritten as soon as a message&#x2019;s header lines have been received.
43926 </para>
43927 <para>
43928 <indexterm role="variable">
43929 <primary><varname>$domain</varname></primary>
43930 </indexterm>
43931 <indexterm role="variable">
43932 <primary><varname>$local_part</varname></primary>
43933 </indexterm>
43934 Similarly, at the start of an ACL for RCPT, the current recipient&#x2019;s address
43935 may have been rewritten by a special SMTP-time rewrite rule, but no ordinary
43936 rewrite rules have yet been applied to it. However, the behaviour is different
43937 from the sender address when a recipient is verified. The address is rewritten
43938 for the verification, but the rewriting is not remembered at this stage. The
43939 value of <varname>$local_part</varname> and <varname>$domain</varname> after verification are always the same
43940 as they were before (that is, they contain the unrewritten &ndash; except for
43941 SMTP-time rewriting &ndash; address).
43942 </para>
43943 <para>
43944 As soon as a message&#x2019;s header lines have been received, all the envelope
43945 recipient addresses are permanently rewritten, and rewriting is also applied to
43946 the addresses in the header lines (if configured). This happens before adding
43947 any header lines that were specified in MAIL or RCPT ACLs, and
43948 <indexterm role="concept">
43949 <primary><function>local_scan()</function> function</primary>
43950 <secondary>address rewriting; timing of</secondary>
43951 </indexterm>
43952 before the DATA ACL and <function>local_scan()</function> functions are run.
43953 </para>
43954 <para>
43955 When an address is being routed, either for delivery or for verification,
43956 rewriting is applied immediately to child addresses that are generated by
43957 redirection, unless <option>no_rewrite</option> is set on the router.
43958 </para>
43959 <para>
43960 <indexterm role="concept">
43961 <primary>envelope sender</primary>
43962 <secondary>rewriting at transport time</secondary>
43963 </indexterm>
43964 <indexterm role="concept">
43965 <primary>rewriting</primary>
43966 <secondary>at transport time</secondary>
43967 </indexterm>
43968 <indexterm role="concept">
43969 <primary>header lines</primary>
43970 <secondary>rewriting at transport time</secondary>
43971 </indexterm>
43972 At transport time, additional rewriting of addresses in header lines can be
43973 specified by setting the generic <option>headers_rewrite</option> option on a transport.
43974 This option contains rules that are identical in form to those in the rewrite
43975 section of the configuration file. They are applied to the original message
43976 header lines and any that were added by ACLs or a system filter. They are not
43977 applied to header lines that are added by routers or the transport.
43978 </para>
43979 <para>
43980 The outgoing envelope sender can be rewritten by means of the <option>return_path</option>
43981 transport option. However, it is not possible to rewrite envelope recipients at
43982 transport time.
43983 </para>
43984 </section>
43985 <section id="SECID149">
43986 <title>Testing the rewriting rules that apply on input</title>
43987 <para>
43988 <indexterm role="concept">
43989 <primary>rewriting</primary>
43990 <secondary>testing</secondary>
43991 </indexterm>
43992 <indexterm role="concept">
43993 <primary>testing</primary>
43994 <secondary>rewriting</secondary>
43995 </indexterm>
43996 Exim&#x2019;s input rewriting configuration appears in a part of the run time
43997 configuration file headed by <quote>begin rewrite</quote>. It can be tested by the
43998 <option>-brw</option> command line option. This takes an address (which can be a full RFC
43999 2822 address) as its argument. The output is a list of how the address would be
44000 transformed by the rewriting rules for each of the different places it might
44001 appear in an incoming message, that is, for each different header and for the
44002 envelope sender and recipient fields. For example,
44003 </para>
44004 <literallayout class="monospaced">
44005 exim -brw ph10@exim.workshop.example
44006 </literallayout>
44007 <para>
44008 might produce the output
44009 </para>
44010 <literallayout class="monospaced">
44011 sender: Philip.Hazel@exim.workshop.example
44012 from: Philip.Hazel@exim.workshop.example
44013 to: ph10@exim.workshop.example
44014 cc: ph10@exim.workshop.example
44015 bcc: ph10@exim.workshop.example
44016 reply-to: Philip.Hazel@exim.workshop.example
44017 env-from: Philip.Hazel@exim.workshop.example
44018 env-to: ph10@exim.workshop.example
44019 </literallayout>
44020 <para>
44021 which shows that rewriting has been set up for that address when used in any of
44022 the source fields, but not when it appears as a recipient address. At the
44023 present time, there is no equivalent way of testing rewriting rules that are
44024 set for a particular transport.
44025 </para>
44026 </section>
44027 <section id="SECID150">
44028 <title>Rewriting rules</title>
44029 <para>
44030 <indexterm role="concept">
44031 <primary>rewriting</primary>
44032 <secondary>rules</secondary>
44033 </indexterm>
44034 The rewrite section of the configuration file consists of lines of rewriting
44035 rules in the form
44036 </para>
44037 <literallayout>
44038 &lt;<emphasis>source pattern</emphasis>&gt;  &lt;<emphasis>replacement</emphasis>&gt;  &lt;<emphasis>flags</emphasis>&gt;
44039 </literallayout>
44040 <para>
44041 Rewriting rules that are specified for the <option>headers_rewrite</option> generic
44042 transport option are given as a colon-separated list. Each item in the list
44043 takes the same form as a line in the main rewriting configuration (except that
44044 any colons must be doubled, of course).
44045 </para>
44046 <para>
44047 The formats of source patterns and replacement strings are described below.
44048 Each is terminated by white space, unless enclosed in double quotes, in which
44049 case normal quoting conventions apply inside the quotes. The flags are single
44050 characters which may appear in any order. Spaces and tabs between them are
44051 ignored.
44052 </para>
44053 <para>
44054 For each address that could potentially be rewritten, the rules are scanned in
44055 order, and replacements for the address from earlier rules can themselves be
44056 replaced by later rules (but see the <quote>q</quote> and <quote>R</quote> flags).
44057 </para>
44058 <para>
44059 The order in which addresses are rewritten is undefined, may change between
44060 releases, and must not be relied on, with one exception: when a message is
44061 received, the envelope sender is always rewritten first, before any header
44062 lines are rewritten. For example, the replacement string for a rewrite of an
44063 address in <emphasis>To:</emphasis> must not assume that the message&#x2019;s address in <emphasis>From:</emphasis> has
44064 (or has not) already been rewritten. However, a rewrite of <emphasis>From:</emphasis> may assume
44065 that the envelope sender has already been rewritten.
44066 </para>
44067 <para>
44068 <indexterm role="variable">
44069 <primary><varname>$domain</varname></primary>
44070 </indexterm>
44071 <indexterm role="variable">
44072 <primary><varname>$local_part</varname></primary>
44073 </indexterm>
44074 The variables <varname>$local_part</varname> and <varname>$domain</varname> can be used in the replacement
44075 string to refer to the address that is being rewritten. Note that lookup-driven
44076 rewriting can be done by a rule of the form
44077 </para>
44078 <literallayout class="monospaced">
44079 *@*   ${lookup ...
44080 </literallayout>
44081 <para>
44082 where the lookup key uses <varname>$1</varname> and <varname>$2</varname> or <varname>$local_part</varname> and <varname>$domain</varname> to
44083 refer to the address that is being rewritten.
44084 </para>
44085 </section>
44086 <section id="SECID151">
44087 <title>Rewriting patterns</title>
44088 <para>
44089 <indexterm role="concept">
44090 <primary>rewriting</primary>
44091 <secondary>patterns</secondary>
44092 </indexterm>
44093 <indexterm role="concept">
44094 <primary>address list</primary>
44095 <secondary>in a rewriting pattern</secondary>
44096 </indexterm>
44097 The source pattern in a rewriting rule is any item which may appear in an
44098 address list (see section <xref linkend="SECTaddresslist"/>). It is in fact processed as a
44099 single-item address list, which means that it is expanded before being tested
44100 against the address. As always, if you use a regular expression as a pattern,
44101 you must take care to escape dollar and backslash characters, or use the <literal>\N</literal>
44102 facility to suppress string expansion within the regular expression.
44103 </para>
44104 <para>
44105 Domains in patterns should be given in lower case. Local parts in patterns are
44106 case-sensitive. If you want to do case-insensitive matching of local parts, you
44107 can use a regular expression that starts with <literal>^(?i)</literal>.
44108 </para>
44109 <para>
44110 <indexterm role="concept">
44111 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
44112 <secondary>in rewriting rules</secondary>
44113 </indexterm>
44114 After matching, the numerical variables <varname>$1</varname>, <varname>$2</varname>, etc. may be set,
44115 depending on the type of match which occurred. These can be used in the
44116 replacement string to insert portions of the incoming address. <varname>$0</varname> always
44117 refers to the complete incoming address. When a regular expression is used, the
44118 numerical variables are set from its capturing subexpressions. For other types
44119 of pattern they are set as follows:
44120 </para>
44121 <itemizedlist>
44122 <listitem>
44123 <para>
44124 If a local part or domain starts with an asterisk, the numerical variables
44125 refer to the character strings matched by asterisks, with <varname>$1</varname> associated with
44126 the first asterisk, and <varname>$2</varname> with the second, if present. For example, if the
44127 pattern
44128 </para>
44129 <literallayout class="monospaced">
44130 *queen@*.fict.example
44131 </literallayout>
44132 <para>
44133 is matched against the address <emphasis>hearts-queen@wonderland.fict.example</emphasis> then
44134 </para>
44135 <literallayout class="monospaced">
44136 $0 = hearts-queen@wonderland.fict.example
44137 $1 = hearts-
44138 $2 = wonderland
44139 </literallayout>
44140 <para>
44141 Note that if the local part does not start with an asterisk, but the domain
44142 does, it is <varname>$1</varname> that contains the wild part of the domain.
44143 </para>
44144 </listitem>
44145 <listitem>
44146 <para>
44147 If the domain part of the pattern is a partial lookup, the wild and fixed parts
44148 of the domain are placed in the next available numerical variables. Suppose,
44149 for example, that the address <emphasis>foo@bar.baz.example</emphasis> is processed by a
44150 rewriting rule of the form
44151 </para>
44152 <literallayout>
44153 <literal>*@partial-dbm;/some/dbm/file</literal>    &lt;<emphasis>replacement string</emphasis>&gt;
44154 </literallayout>
44155 <para>
44156 and the key in the file that matches the domain is <literal>*.baz.example</literal>. Then
44157 </para>
44158 <literallayout class="monospaced">
44159 $1 = foo
44160 $2 = bar
44161 $3 = baz.example
44162 </literallayout>
44163 <para>
44164 If the address <emphasis>foo@baz.example</emphasis> is looked up, this matches the same
44165 wildcard file entry, and in this case <varname>$2</varname> is set to the empty string, but
44166 <varname>$3</varname> is still set to <emphasis>baz.example</emphasis>. If a non-wild key is matched in a
44167 partial lookup, <varname>$2</varname> is again set to the empty string and <varname>$3</varname> is set to the
44168 whole domain. For non-partial domain lookups, no numerical variables are set.
44169 </para>
44170 </listitem>
44171 </itemizedlist>
44172 </section>
44173 <section id="SECID152">
44174 <title>Rewriting replacements</title>
44175 <para>
44176 <indexterm role="concept">
44177 <primary>rewriting</primary>
44178 <secondary>replacements</secondary>
44179 </indexterm>
44180 If the replacement string for a rule is a single asterisk, addresses that
44181 match the pattern and the flags are <emphasis>not</emphasis> rewritten, and no subsequent
44182 rewriting rules are scanned. For example,
44183 </para>
44184 <literallayout class="monospaced">
44185 hatta@lookingglass.fict.example  *  f
44186 </literallayout>
44187 <para>
44188 specifies that <emphasis>hatta@lookingglass.fict.example</emphasis> is never to be rewritten in
44189 <emphasis>From:</emphasis> headers.
44190 </para>
44191 <para>
44192 <indexterm role="variable">
44193 <primary><varname>$domain</varname></primary>
44194 </indexterm>
44195 <indexterm role="variable">
44196 <primary><varname>$local_part</varname></primary>
44197 </indexterm>
44198 If the replacement string is not a single asterisk, it is expanded, and must
44199 yield a fully qualified address. Within the expansion, the variables
44200 <varname>$local_part</varname> and <varname>$domain</varname> refer to the address that is being rewritten.
44201 Any letters they contain retain their original case &ndash; they are not lower
44202 cased. The numerical variables are set up according to the type of pattern that
44203 matched the address, as described above. If the expansion is forced to fail by
44204 the presence of <quote>fail</quote> in a conditional or lookup item, rewriting by the
44205 current rule is abandoned, but subsequent rules may take effect. Any other
44206 expansion failure causes the entire rewriting operation to be abandoned, and an
44207 entry written to the panic log.
44208 </para>
44209 </section>
44210 <section id="SECID153">
44211 <title>Rewriting flags</title>
44212 <para>
44213 There are three different kinds of flag that may appear on rewriting rules:
44214 </para>
44215 <itemizedlist>
44216 <listitem>
44217 <para>
44218 Flags that specify which headers and envelope addresses to rewrite: E, F, T, b,
44219 c, f, h, r, s, t.
44220 </para>
44221 </listitem>
44222 <listitem>
44223 <para>
44224 A flag that specifies rewriting at SMTP time: S.
44225 </para>
44226 </listitem>
44227 <listitem>
44228 <para>
44229 Flags that control the rewriting process: Q, q, R, w.
44230 </para>
44231 </listitem>
44232 </itemizedlist>
44233 <para>
44234 For rules that are part of the <option>headers_rewrite</option> generic transport option,
44235 E, F, T, and S are not permitted.
44236 </para>
44237 </section>
44238 <section id="SECID154">
44239 <title>Flags specifying which headers and envelope addresses to rewrite</title>
44240 <para>
44241 <indexterm role="concept">
44242 <primary>rewriting</primary>
44243 <secondary>flags</secondary>
44244 </indexterm>
44245 If none of the following flag letters, nor the <quote>S</quote> flag (see section
44246 <xref linkend="SECTrewriteS"/>) are present, a main rewriting rule applies to all headers
44247 and to both the sender and recipient fields of the envelope, whereas a
44248 transport-time rewriting rule just applies to all headers. Otherwise, the
44249 rewriting rule is skipped unless the relevant addresses are being processed.
44250 </para>
44251 <literallayout>
44252 <literal>E</literal>       rewrite all envelope fields
44253 <literal>F</literal>       rewrite the envelope From field
44254 <literal>T</literal>       rewrite the envelope To field
44255 <literal>b</literal>       rewrite the <emphasis>Bcc:</emphasis> header
44256 <literal>c</literal>       rewrite the <emphasis>Cc:</emphasis> header
44257 <literal>f</literal>       rewrite the <emphasis>From:</emphasis> header
44258 <literal>h</literal>       rewrite all headers
44259 <literal>r</literal>       rewrite the <emphasis>Reply-To:</emphasis> header
44260 <literal>s</literal>       rewrite the <emphasis>Sender:</emphasis> header
44261 <literal>t</literal>       rewrite the <emphasis>To:</emphasis> header
44262 </literallayout>
44263 <para>
44264 "All headers" means all of the headers listed above that can be selected
44265 individually, plus their <emphasis>Resent-</emphasis> versions. It does not include
44266 other headers such as <emphasis>Subject:</emphasis> etc.
44267 </para>
44268 <para>
44269 You should be particularly careful about rewriting <emphasis>Sender:</emphasis> headers, and
44270 restrict this to special known cases in your own domains.
44271 </para>
44272 </section>
44273 <section id="SECTrewriteS">
44274 <title>The SMTP-time rewriting flag</title>
44275 <para>
44276 <indexterm role="concept">
44277 <primary>SMTP</primary>
44278 <secondary>rewriting malformed addresses</secondary>
44279 </indexterm>
44280 <indexterm role="concept">
44281 <primary>RCPT</primary>
44282 <secondary>rewriting argument of</secondary>
44283 </indexterm>
44284 <indexterm role="concept">
44285 <primary>MAIL</primary>
44286 <secondary>rewriting argument of</secondary>
44287 </indexterm>
44288 The rewrite flag <quote>S</quote> specifies a rewrite of incoming envelope addresses at
44289 SMTP time, as soon as an address is received in a MAIL or RCPT command, and
44290 before any other processing; even before syntax checking. The pattern is
44291 required to be a regular expression, and it is matched against the whole of the
44292 data for the command, including any surrounding angle brackets.
44293 </para>
44294 <para>
44295 <indexterm role="variable">
44296 <primary><varname>$domain</varname></primary>
44297 </indexterm>
44298 <indexterm role="variable">
44299 <primary><varname>$local_part</varname></primary>
44300 </indexterm>
44301 This form of rewrite rule allows for the handling of addresses that are not
44302 compliant with RFCs 2821 and 2822 (for example, <quote>bang paths</quote> in batched SMTP
44303 input). Because the input is not required to be a syntactically valid address,
44304 the variables <varname>$local_part</varname> and <varname>$domain</varname> are not available during the
44305 expansion of the replacement string. The result of rewriting replaces the
44306 original address in the MAIL or RCPT command.
44307 </para>
44308 </section>
44309 <section id="SECID155">
44310 <title>Flags controlling the rewriting process</title>
44311 <para>
44312 There are four flags which control the way the rewriting process works. These
44313 take effect only when a rule is invoked, that is, when the address is of the
44314 correct type (matches the flags) and matches the pattern:
44315 </para>
44316 <itemizedlist>
44317 <listitem>
44318 <para>
44319 If the <quote>Q</quote> flag is set on a rule, the rewritten address is permitted to be an
44320 unqualified local part. It is qualified with <option>qualify_recipient</option>. In the
44321 absence of <quote>Q</quote> the rewritten address must always include a domain.
44322 </para>
44323 </listitem>
44324 <listitem>
44325 <para>
44326 If the <quote>q</quote> flag is set on a rule, no further rewriting rules are considered,
44327 even if no rewriting actually takes place because of a <quote>fail</quote> in the
44328 expansion. The <quote>q</quote> flag is not effective if the address is of the wrong type
44329 (does not match the flags) or does not match the pattern.
44330 </para>
44331 </listitem>
44332 <listitem>
44333 <para>
44334 The <quote>R</quote> flag causes a successful rewriting rule to be re-applied to the new
44335 address, up to ten times. It can be combined with the <quote>q</quote> flag, to stop
44336 rewriting once it fails to match (after at least one successful rewrite).
44337 </para>
44338 </listitem>
44339 <listitem>
44340 <para>
44341 <indexterm role="concept">
44342 <primary>rewriting</primary>
44343 <secondary>whole addresses</secondary>
44344 </indexterm>
44345 When an address in a header is rewritten, the rewriting normally applies only
44346 to the working part of the address, with any comments and RFC 2822 <quote>phrase</quote>
44347 left unchanged. For example, rewriting might change
44348 </para>
44349 <literallayout class="monospaced">
44350 From: Ford Prefect &lt;fp42@restaurant.hitch.fict.example&gt;
44351 </literallayout>
44352 <para>
44353 into
44354 </para>
44355 <literallayout class="monospaced">
44356 From: Ford Prefect &lt;prefectf@hitch.fict.example&gt;
44357 </literallayout>
44358 <para>
44359 <indexterm role="concept">
44360 <primary>RFC 2047</primary>
44361 </indexterm>
44362 Sometimes there is a need to replace the whole address item, and this can be
44363 done by adding the flag letter <quote>w</quote> to a rule. If this is set on a rule that
44364 causes an address in a header line to be rewritten, the entire address is
44365 replaced, not just the working part. The replacement must be a complete RFC
44366 2822 address, including the angle brackets if necessary. If text outside angle
44367 brackets contains a character whose value is greater than 126 or less than 32
44368 (except for tab), the text is encoded according to RFC 2047. The character set
44369 is taken from <option>headers_charset</option>, which defaults to ISO-8859-1.
44370 </para>
44371 <para>
44372 When the <quote>w</quote> flag is set on a rule that causes an envelope address to be
44373 rewritten, all but the working part of the replacement address is discarded.
44374 </para>
44375 </listitem>
44376 </itemizedlist>
44377 </section>
44378 <section id="SECID156">
44379 <title>Rewriting examples</title>
44380 <para>
44381 Here is an example of the two common rewriting paradigms:
44382 </para>
44383 <literallayout class="monospaced">
44384 *@*.hitch.fict.example  $1@hitch.fict.example
44385 *@hitch.fict.example    ${lookup{$1}dbm{/etc/realnames}\
44386                      {$value}fail}@hitch.fict.example bctfrF
44387 </literallayout>
44388 <para>
44389 Note the use of <quote>fail</quote> in the lookup expansion in the second rule, forcing
44390 the string expansion to fail if the lookup does not succeed. In this context it
44391 has the effect of leaving the original address unchanged, but Exim goes on to
44392 consider subsequent rewriting rules, if any, because the <quote>q</quote> flag is not
44393 present in that rule. An alternative to <quote>fail</quote> would be to supply <varname>$1</varname>
44394 explicitly, which would cause the rewritten address to be the same as before,
44395 at the cost of a small bit of processing. Not supplying either of these is an
44396 error, since the rewritten address would then contain no local part.
44397 </para>
44398 <para>
44399 The first example above replaces the domain with a superior, more general
44400 domain. This may not be desirable for certain local parts. If the rule
44401 </para>
44402 <literallayout class="monospaced">
44403 root@*.hitch.fict.example  *
44404 </literallayout>
44405 <para>
44406 were inserted before the first rule, rewriting would be suppressed for the
44407 local part <emphasis>root</emphasis> at any domain ending in <emphasis>hitch.fict.example</emphasis>.
44408 </para>
44409 <para>
44410 Rewriting can be made conditional on a number of tests, by making use of
44411 <varname>${if</varname> in the expansion item. For example, to apply a rewriting rule only to
44412 messages that originate outside the local host:
44413 </para>
44414 <literallayout class="monospaced">
44415 *@*.hitch.fict.example  "${if !eq {$sender_host_address}{}\
44416                          {$1@hitch.fict.example}fail}"
44417 </literallayout>
44418 <para>
44419 The replacement string is quoted in this example because it contains white
44420 space.
44421 </para>
44422 <para>
44423 <indexterm role="concept">
44424 <primary>rewriting</primary>
44425 <secondary>bang paths</secondary>
44426 </indexterm>
44427 <indexterm role="concept">
44428 <primary>bang paths</primary>
44429 <secondary>rewriting</secondary>
44430 </indexterm>
44431 Exim does not handle addresses in the form of <quote>bang paths</quote>. If it sees such
44432 an address it treats it as an unqualified local part which it qualifies with
44433 the local qualification domain (if the source of the message is local or if the
44434 remote host is permitted to send unqualified addresses). Rewriting can
44435 sometimes be used to handle simple bang paths with a fixed number of
44436 components. For example, the rule
44437 </para>
44438 <literallayout class="monospaced">
44439 \N^([^!]+)!(.*)@your.domain.example$\N   $2@$1
44440 </literallayout>
44441 <para>
44442 rewrites a two-component bang path <emphasis>host.name!user</emphasis> as the domain address
44443 <emphasis>user@host.name</emphasis>. However, there is a security implication in using this as
44444 a global rewriting rule for envelope addresses. It can provide a backdoor
44445 method for using your system as a relay, because the incoming addresses appear
44446 to be local. If the bang path addresses are received via SMTP, it is safer to
44447 use the <quote>S</quote> flag to rewrite them as they are received, so that relay checking
44448 can be done on the rewritten addresses.
44449 <indexterm role="concept" startref="IIDaddrew" class="endofrange"/>
44450 </para>
44451 </section>
44452 </chapter>
44453
44454 <chapter id="CHAPretry">
44455 <title>Retry configuration</title>
44456 <para>
44457 <indexterm role="concept" id="IIDretconf1" class="startofrange">
44458 <primary>retry</primary>
44459 <secondary>configuration, description of</secondary>
44460 </indexterm>
44461 <indexterm role="concept" id="IIDregconf2" class="startofrange">
44462 <primary>configuration file</primary>
44463 <secondary>retry section</secondary>
44464 </indexterm>
44465 The <quote>retry</quote> section of the runtime configuration file contains a list of
44466 retry rules that control how often Exim tries to deliver messages that cannot
44467 be delivered at the first attempt. If there are no retry rules (the section is
44468 empty or not present), there are no retries. In this situation, temporary
44469 errors are treated as permanent. The default configuration contains a single,
44470 general-purpose retry rule (see section <xref linkend="SECID57"/>). The <option>-brt</option> command
44471 line option can be used to test which retry rule will be used for a given
44472 address, domain and error.
44473 </para>
44474 <para>
44475 The most common cause of retries is temporary failure to deliver to a remote
44476 host because the host is down, or inaccessible because of a network problem.
44477 Exim&#x2019;s retry processing in this case is applied on a per-host (strictly, per IP
44478 address) basis, not on a per-message basis. Thus, if one message has recently
44479 been delayed, delivery of a new message to the same host is not immediately
44480 tried, but waits for the host&#x2019;s retry time to arrive. If the <option>retry_defer</option>
44481 log selector is set, the message
44482 <indexterm role="concept">
44483 <primary>retry</primary>
44484 <secondary>time not reached</secondary>
44485 </indexterm>
44486 <quote>retry time not reached</quote> is written to the main log whenever a delivery is
44487 skipped for this reason. Section <xref linkend="SECToutSMTPerr"/> contains more details of
44488 the handling of errors during remote deliveries.
44489 </para>
44490 <para>
44491 Retry processing applies to routing as well as to delivering, except as covered
44492 in the next paragraph. The retry rules do not distinguish between these
44493 actions. It is not possible, for example, to specify different behaviour for
44494 failures to route the domain <emphasis>snark.fict.example</emphasis> and failures to deliver to
44495 the host <emphasis>snark.fict.example</emphasis>. I didn&#x2019;t think anyone would ever need this
44496 added complication, so did not implement it. However, although they share the
44497 same retry rule, the actual retry times for routing and transporting a given
44498 domain are maintained independently.
44499 </para>
44500 <para>
44501 When a delivery is not part of a queue run (typically an immediate delivery on
44502 receipt of a message), the routers are always run, and local deliveries are
44503 always attempted, even if retry times are set for them. This makes for better
44504 behaviour if one particular message is causing problems (for example, causing
44505 quota overflow, or provoking an error in a filter file). If such a delivery
44506 suffers a temporary failure, the retry data is updated as normal, and
44507 subsequent delivery attempts from queue runs occur only when the retry time for
44508 the local address is reached.
44509 </para>
44510 <section id="SECID157">
44511 <title>Changing retry rules</title>
44512 <para>
44513 If you change the retry rules in your configuration, you should consider
44514 whether or not to delete the retry data that is stored in Exim&#x2019;s spool area in
44515 files with names like <filename>db/retry</filename>. Deleting any of Exim&#x2019;s hints files is
44516 always safe; that is why they are called <quote>hints</quote>.
44517 </para>
44518 <para>
44519 The hints retry data contains suggested retry times based on the previous
44520 rules. In the case of a long-running problem with a remote host, it might
44521 record the fact that the host has timed out. If your new rules increase the
44522 timeout time for such a host, you should definitely remove the old retry data
44523 and let Exim recreate it, based on the new rules. Otherwise Exim might bounce
44524 messages that it should now be retaining.
44525 </para>
44526 </section>
44527 <section id="SECID158">
44528 <title>Format of retry rules</title>
44529 <para>
44530 <indexterm role="concept">
44531 <primary>retry</primary>
44532 <secondary>rules</secondary>
44533 </indexterm>
44534 Each retry rule occupies one line and consists of three or four parts,
44535 separated by white space: a pattern, an error name, an optional list of sender
44536 addresses, and a list of retry parameters. The pattern and sender lists must be
44537 enclosed in double quotes if they contain white space. The rules are searched
44538 in order until one is found where the pattern, error name, and sender list (if
44539 present) match the failing host or address, the error that occurred, and the
44540 message&#x2019;s sender, respectively.
44541 </para>
44542 <para>
44543 The pattern is any single item that may appear in an address list (see section
44544 <xref linkend="SECTaddresslist"/>). It is in fact processed as a one-item address list,
44545 which means that it is expanded before being tested against the address that
44546 has been delayed. A negated address list item is permitted. Address
44547 list processing treats a plain domain name as if it were preceded by <quote>*@</quote>,
44548 which makes it possible for many retry rules to start with just a domain. For
44549 example,
44550 </para>
44551 <literallayout class="monospaced">
44552 lookingglass.fict.example        *  F,24h,30m;
44553 </literallayout>
44554 <para>
44555 provides a rule for any address in the <emphasis>lookingglass.fict.example</emphasis> domain,
44556 whereas
44557 </para>
44558 <literallayout class="monospaced">
44559 alice@lookingglass.fict.example  *  F,24h,30m;
44560 </literallayout>
44561 <para>
44562 applies only to temporary failures involving the local part <option>alice</option>.
44563 In practice, almost all rules start with a domain name pattern without a local
44564 part.
44565 </para>
44566 <para>
44567 <indexterm role="concept">
44568 <primary>regular expressions</primary>
44569 <secondary>in retry rules</secondary>
44570 </indexterm>
44571 <emphasis role="bold">Warning</emphasis>: If you use a regular expression in a routing rule pattern, it
44572 must match a complete address, not just a domain, because that is how regular
44573 expressions work in address lists.
44574 </para>
44575 <literallayout>
44576 <literal>^\Nxyz\d+\.abc\.example$\N        *  G,1h,10m,2</literal>     <option>Wrong</option>
44577 <literal>^\N[^@]+@xyz\d+\.abc\.example$\N  *  G,1h,10m,2</literal>     <option>Right</option>
44578 </literallayout>
44579 </section>
44580 <section id="SECID159">
44581 <title>Choosing which retry rule to use for address errors</title>
44582 <para>
44583 When Exim is looking for a retry rule after a routing attempt has failed (for
44584 example, after a DNS timeout), each line in the retry configuration is tested
44585 against the complete address only if <option>retry_use_local_part</option> is set for the
44586 router. Otherwise, only the domain is used, except when matching against a
44587 regular expression, when the local part of the address is replaced with <quote>*</quote>.
44588 A domain on its own can match a domain pattern, or a pattern that starts with
44589 <quote>*@</quote>. By default, <option>retry_use_local_part</option> is true for routers where
44590 <option>check_local_user</option> is true, and false for other routers.
44591 </para>
44592 <para>
44593 Similarly, when Exim is looking for a retry rule after a local delivery has
44594 failed (for example, after a mailbox full error), each line in the retry
44595 configuration is tested against the complete address only if
44596 <option>retry_use_local_part</option> is set for the transport (it defaults true for all
44597 local transports).
44598 </para>
44599 <para>
44600 <indexterm role="concept">
44601 <primary>4<emphasis>xx</emphasis> responses</primary>
44602 <secondary>retry rules for</secondary>
44603 </indexterm>
44604 However, when Exim is looking for a retry rule after a remote delivery attempt
44605 suffers an address error (a 4<emphasis>xx</emphasis> SMTP response for a recipient address), the
44606 whole address is always used as the key when searching the retry rules. The
44607 rule that is found is used to create a retry time for the combination of the
44608 failing address and the message&#x2019;s sender. It is the combination of sender and
44609 recipient that is delayed in subsequent queue runs until its retry time is
44610 reached. You can delay the recipient without regard to the sender by setting
44611 <option>address_retry_include_sender</option> false in the <command>smtp</command> transport but this can
44612 lead to problems with servers that regularly issue 4<emphasis>xx</emphasis> responses to RCPT
44613 commands.
44614 </para>
44615 </section>
44616 <section id="SECID160">
44617 <title>Choosing which retry rule to use for host and message errors</title>
44618 <para>
44619 For a temporary error that is not related to an individual address (for
44620 example, a connection timeout), each line in the retry configuration is checked
44621 twice. First, the name of the remote host is used as a domain name (preceded by
44622 <quote>*@</quote> when matching a regular expression). If this does not match the line,
44623 the domain from the email address is tried in a similar fashion. For example,
44624 suppose the MX records for <emphasis>a.b.c.example</emphasis> are
44625 </para>
44626 <literallayout class="monospaced">
44627 a.b.c.example  MX  5  x.y.z.example
44628                MX  6  p.q.r.example
44629                MX  7  m.n.o.example
44630 </literallayout>
44631 <para>
44632 and the retry rules are
44633 </para>
44634 <literallayout class="monospaced">
44635 p.q.r.example    *      F,24h,30m;
44636 a.b.c.example    *      F,4d,45m;
44637 </literallayout>
44638 <para>
44639 and a delivery to the host <emphasis>x.y.z.example</emphasis> suffers a connection failure. The
44640 first rule matches neither the host nor the domain, so Exim looks at the second
44641 rule. This does not match the host, but it does match the domain, so it is used
44642 to calculate the retry time for the host <emphasis>x.y.z.example</emphasis>. Meanwhile, Exim
44643 tries to deliver to <emphasis>p.q.r.example</emphasis>. If this also suffers a host error, the
44644 first retry rule is used, because it matches the host.
44645 </para>
44646 <para>
44647 In other words, temporary failures to deliver to host <emphasis>p.q.r.example</emphasis> use the
44648 first rule to determine retry times, but for all the other hosts for the domain
44649 <emphasis>a.b.c.example</emphasis>, the second rule is used. The second rule is also used if
44650 routing to <emphasis>a.b.c.example</emphasis> suffers a temporary failure.
44651 </para>
44652 <para>
44653 <emphasis role="bold">Note</emphasis>: The host name is used when matching the patterns, not its IP address.
44654 However, if a message is routed directly to an IP address without the use of a
44655 host name, for example, if a <command>manualroute</command> router contains a setting such as:
44656 </para>
44657 <literallayout class="monospaced">
44658 route_list = *.a.example  192.168.34.23
44659 </literallayout>
44660 <para>
44661 then the <quote>host name</quote> that is used when searching for a retry rule is the
44662 textual form of the IP address.
44663 </para>
44664 </section>
44665 <section id="SECID161">
44666 <title>Retry rules for specific errors</title>
44667 <para>
44668 <indexterm role="concept">
44669 <primary>retry</primary>
44670 <secondary>specific errors; specifying</secondary>
44671 </indexterm>
44672 The second field in a retry rule is the name of a particular error, or an
44673 asterisk, which matches any error. The errors that can be tested for are:
44674 </para>
44675 <variablelist>
44676 <varlistentry>
44677 <term><option>auth_failed</option></term>
44678 <listitem>
44679 <para>
44680 Authentication failed when trying to send to a host in the
44681 <option>hosts_require_auth</option> list in an <command>smtp</command> transport.
44682 </para>
44683 </listitem></varlistentry>
44684 <varlistentry>
44685 <term><option>data_4xx</option></term>
44686 <listitem>
44687 <para>
44688 A 4<emphasis>xx</emphasis> error was received for an outgoing DATA command, either immediately
44689 after the command, or after sending the message&#x2019;s data.
44690 </para>
44691 </listitem></varlistentry>
44692 <varlistentry>
44693 <term><option>mail_4xx</option></term>
44694 <listitem>
44695 <para>
44696 A 4<emphasis>xx</emphasis> error was received for an outgoing MAIL command.
44697 </para>
44698 </listitem></varlistentry>
44699 <varlistentry>
44700 <term><option>rcpt_4xx</option></term>
44701 <listitem>
44702 <para>
44703 A 4<emphasis>xx</emphasis> error was received for an outgoing RCPT command.
44704 </para>
44705 </listitem></varlistentry>
44706 </variablelist>
44707 <para>
44708 For the three 4<emphasis>xx</emphasis> errors, either the first or both of the x&#x2019;s can be given
44709 as specific digits, for example: <literal>mail_45x</literal> or <literal>rcpt_436</literal>. For example, to
44710 recognize 452 errors given to RCPT commands for addresses in a certain domain,
44711 and have retries every ten minutes with a one-hour timeout, you could set up a
44712 retry rule of this form:
44713 </para>
44714 <literallayout class="monospaced">
44715 the.domain.name  rcpt_452   F,1h,10m
44716 </literallayout>
44717 <para>
44718 These errors apply to both outgoing SMTP (the <command>smtp</command> transport) and outgoing
44719 LMTP (either the <command>lmtp</command> transport, or the <command>smtp</command> transport in LMTP mode).
44720 </para>
44721 <variablelist>
44722 <varlistentry>
44723 <term><option>lost_connection</option></term>
44724 <listitem>
44725 <para>
44726 A server unexpectedly closed the SMTP connection. There may, of course,
44727 legitimate reasons for this (host died, network died), but if it repeats a lot
44728 for the same host, it indicates something odd.
44729 </para>
44730 </listitem></varlistentry>
44731 <varlistentry>
44732 <term><option>refused_MX</option></term>
44733 <listitem>
44734 <para>
44735 A connection to a host obtained from an MX record was refused.
44736 </para>
44737 </listitem></varlistentry>
44738 <varlistentry>
44739 <term><option>refused_A</option></term>
44740 <listitem>
44741 <para>
44742 A connection to a host not obtained from an MX record was refused.
44743 </para>
44744 </listitem></varlistentry>
44745 <varlistentry>
44746 <term><option>refused</option></term>
44747 <listitem>
44748 <para>
44749 A connection was refused.
44750 </para>
44751 </listitem></varlistentry>
44752 <varlistentry>
44753 <term><option>timeout_connect_MX</option></term>
44754 <listitem>
44755 <para>
44756 A connection attempt to a host obtained from an MX record timed out.
44757 </para>
44758 </listitem></varlistentry>
44759 <varlistentry>
44760 <term><option>timeout_connect_A</option></term>
44761 <listitem>
44762 <para>
44763 A connection attempt to a host not obtained from an MX record timed out.
44764 </para>
44765 </listitem></varlistentry>
44766 <varlistentry>
44767 <term><option>timeout_connect</option></term>
44768 <listitem>
44769 <para>
44770 A connection attempt timed out.
44771 </para>
44772 </listitem></varlistentry>
44773 <varlistentry>
44774 <term><option>timeout_MX</option></term>
44775 <listitem>
44776 <para>
44777 There was a timeout while connecting or during an SMTP session with a host
44778 obtained from an MX record.
44779 </para>
44780 </listitem></varlistentry>
44781 <varlistentry>
44782 <term><option>timeout_A</option></term>
44783 <listitem>
44784 <para>
44785 There was a timeout while connecting or during an SMTP session with a host not
44786 obtained from an MX record.
44787 </para>
44788 </listitem></varlistentry>
44789 <varlistentry>
44790 <term><option>timeout</option></term>
44791 <listitem>
44792 <para>
44793 There was a timeout while connecting or during an SMTP session.
44794 </para>
44795 </listitem></varlistentry>
44796 <varlistentry>
44797 <term><option>tls_required</option></term>
44798 <listitem>
44799 <para>
44800 The server was required to use TLS (it matched <option>hosts_require_tls</option> in the
44801 <command>smtp</command> transport), but either did not offer TLS, or it responded with 4<emphasis>xx</emphasis>
44802 to STARTTLS, or there was a problem setting up the TLS connection.
44803 </para>
44804 </listitem></varlistentry>
44805 <varlistentry>
44806 <term><option>quota</option></term>
44807 <listitem>
44808 <para>
44809 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
44810 transport.
44811 </para>
44812 </listitem></varlistentry>
44813 <varlistentry>
44814 <term><option>quota_</option>&lt;<emphasis>time</emphasis>&gt;</term>
44815 <listitem>
44816 <para>
44817 <indexterm role="concept">
44818 <primary>quota</primary>
44819 <secondary>error testing in retry rule</secondary>
44820 </indexterm>
44821 <indexterm role="concept">
44822 <primary>retry</primary>
44823 <secondary>quota error testing</secondary>
44824 </indexterm>
44825 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
44826 transport, and the mailbox has not been accessed for &lt;<emphasis>time</emphasis>&gt;. For example,
44827 <emphasis>quota_4d</emphasis> applies to a quota error when the mailbox has not been accessed
44828 for four days.
44829 </para>
44830 </listitem></varlistentry>
44831 </variablelist>
44832 <para>
44833 <indexterm role="concept">
44834 <primary>mailbox</primary>
44835 <secondary>time of last read</secondary>
44836 </indexterm>
44837 The idea of <option>quota_</option>&lt;<emphasis>time</emphasis>&gt; is to make it possible to have shorter
44838 timeouts when the mailbox is full and is not being read by its owner. Ideally,
44839 it should be based on the last time that the user accessed the mailbox.
44840 However, it is not always possible to determine this. Exim uses the following
44841 heuristic rules:
44842 </para>
44843 <itemizedlist>
44844 <listitem>
44845 <para>
44846 If the mailbox is a single file, the time of last access (the <quote>atime</quote>) is
44847 used. As no new messages are being delivered (because the mailbox is over
44848 quota), Exim does not access the file, so this is the time of last user access.
44849 </para>
44850 </listitem>
44851 <listitem>
44852 <para>
44853 <indexterm role="concept">
44854 <primary>maildir format</primary>
44855 <secondary>time of last read</secondary>
44856 </indexterm>
44857 For a maildir delivery, the time of last modification of the <filename>new</filename>
44858 subdirectory is used. As the mailbox is over quota, no new files are created in
44859 the <filename>new</filename> subdirectory, because no new messages are being delivered. Any
44860 change to the <filename>new</filename> subdirectory is therefore assumed to be the result of an
44861 MUA moving a new message to the <filename>cur</filename> directory when it is first read. The
44862 time that is used is therefore the last time that the user read a new message.
44863 </para>
44864 </listitem>
44865 <listitem>
44866 <para>
44867 For other kinds of multi-file mailbox, the time of last access cannot be
44868 obtained, so a retry rule that uses this type of error field is never matched.
44869 </para>
44870 </listitem>
44871 </itemizedlist>
44872 <para>
44873 The quota errors apply both to system-enforced quotas and to Exim&#x2019;s own quota
44874 mechanism in the <command>appendfile</command> transport. The <emphasis>quota</emphasis> error also applies
44875 when a local delivery is deferred because a partition is full (the ENOSPC
44876 error).
44877 </para>
44878 </section>
44879 <section id="SECID162">
44880 <title>Retry rules for specified senders</title>
44881 <para>
44882 <indexterm role="concept">
44883 <primary>retry</primary>
44884 <secondary>rules; sender-specific</secondary>
44885 </indexterm>
44886 You can specify retry rules that apply only when the failing message has a
44887 specific sender. In particular, this can be used to define retry rules that
44888 apply only to bounce messages. The third item in a retry rule can be of this
44889 form:
44890 </para>
44891 <literallayout>
44892 <literal>senders=</literal>&lt;<emphasis>address list</emphasis>&gt;
44893 </literallayout>
44894 <para>
44895 The retry timings themselves are then the fourth item. For example:
44896 </para>
44897 <literallayout class="monospaced">
44898 *   rcpt_4xx   senders=:   F,1h,30m
44899 </literallayout>
44900 <para>
44901 matches recipient 4<emphasis>xx</emphasis> errors for bounce messages sent to any address at any
44902 host. If the address list contains white space, it must be enclosed in quotes.
44903 For example:
44904 </para>
44905 <literallayout class="monospaced">
44906 a.domain  rcpt_452  senders="xb.dom : yc.dom"  G,8h,10m,1.5
44907 </literallayout>
44908 <para>
44909 <emphasis role="bold">Warning</emphasis>: This facility can be unhelpful if it is used for host errors
44910 (which do not depend on the recipient). The reason is that the sender is used
44911 only to match the retry rule. Once the rule has been found for a host error,
44912 its contents are used to set a retry time for the host, and this will apply to
44913 all messages, not just those with specific senders.
44914 </para>
44915 <para>
44916 When testing retry rules using <option>-brt</option>, you can supply a sender using the
44917 <option>-f</option> command line option, like this:
44918 </para>
44919 <literallayout class="monospaced">
44920 exim -f "" -brt user@dom.ain
44921 </literallayout>
44922 <para>
44923 If you do not set <option>-f</option> with <option>-brt</option>, a retry rule that contains a senders
44924 list is never matched.
44925 </para>
44926 </section>
44927 <section id="SECID163">
44928 <title>Retry parameters</title>
44929 <para>
44930 <indexterm role="concept">
44931 <primary>retry</primary>
44932 <secondary>parameters in rules</secondary>
44933 </indexterm>
44934 The third (or fourth, if a senders list is present) field in a retry rule is a
44935 sequence of retry parameter sets, separated by semicolons. Each set consists of
44936 </para>
44937 <literallayout>
44938 &lt;<emphasis>letter</emphasis>&gt;,&lt;<emphasis>cutoff time</emphasis>&gt;,&lt;<emphasis>arguments</emphasis>&gt;
44939 </literallayout>
44940 <para>
44941 The letter identifies the algorithm for computing a new retry time; the cutoff
44942 time is the time beyond which this algorithm no longer applies, and the
44943 arguments vary the algorithm&#x2019;s action. The cutoff time is measured from the
44944 time that the first failure for the domain (combined with the local part if
44945 relevant) was detected, not from the time the message was received.
44946 </para>
44947 <para>
44948 <indexterm role="concept">
44949 <primary>retry</primary>
44950 <secondary>algorithms</secondary>
44951 </indexterm>
44952 <indexterm role="concept">
44953 <primary>retry</primary>
44954 <secondary>fixed intervals</secondary>
44955 </indexterm>
44956 <indexterm role="concept">
44957 <primary>retry</primary>
44958 <secondary>increasing intervals</secondary>
44959 </indexterm>
44960 <indexterm role="concept">
44961 <primary>retry</primary>
44962 <secondary>random intervals</secondary>
44963 </indexterm>
44964 The available algorithms are:
44965 </para>
44966 <itemizedlist>
44967 <listitem>
44968 <para>
44969 <emphasis>F</emphasis>: retry at fixed intervals. There is a single time parameter specifying
44970 the interval.
44971 </para>
44972 </listitem>
44973 <listitem>
44974 <para>
44975 <emphasis>G</emphasis>: retry at geometrically increasing intervals. The first argument
44976 specifies a starting value for the interval, and the second a multiplier, which
44977 is used to increase the size of the interval at each retry.
44978 </para>
44979 </listitem>
44980 <listitem>
44981 <para>
44982 <emphasis>H</emphasis>: retry at randomized intervals. The arguments are as for <emphasis>G</emphasis>. For each
44983 retry, the previous interval is multiplied by the factor in order to get a
44984 maximum for the next interval. The minimum interval is the first argument of
44985 the parameter, and an actual interval is chosen randomly between them. Such a
44986 rule has been found to be helpful in cluster configurations when all the
44987 members of the cluster restart at once, and may therefore synchronize their
44988 queue processing times.
44989 </para>
44990 </listitem>
44991 </itemizedlist>
44992 <para>
44993 When computing the next retry time, the algorithm definitions are scanned in
44994 order until one whose cutoff time has not yet passed is reached. This is then
44995 used to compute a new retry time that is later than the current time. In the
44996 case of fixed interval retries, this simply means adding the interval to the
44997 current time. For geometrically increasing intervals, retry intervals are
44998 computed from the rule&#x2019;s parameters until one that is greater than the previous
44999 interval is found. The main configuration variable
45000 <indexterm role="concept">
45001 <primary>limit</primary>
45002 <secondary>retry interval</secondary>
45003 </indexterm>
45004 <indexterm role="concept">
45005 <primary>retry</primary>
45006 <secondary>interval, maximum</secondary>
45007 </indexterm>
45008 <indexterm role="option">
45009 <primary><option>retry_interval_max</option></primary>
45010 </indexterm>
45011 <option>retry_interval_max</option> limits the maximum interval between retries. It
45012 cannot be set greater than <literal>24h</literal>, which is its default value.
45013 </para>
45014 <para>
45015 A single remote domain may have a number of hosts associated with it, and each
45016 host may have more than one IP address. Retry algorithms are selected on the
45017 basis of the domain name, but are applied to each IP address independently. If,
45018 for example, a host has two IP addresses and one is unusable, Exim will
45019 generate retry times for it and will not try to use it until its next retry
45020 time comes. Thus the good IP address is likely to be tried first most of the
45021 time.
45022 </para>
45023 <para>
45024 <indexterm role="concept">
45025 <primary>hints database</primary>
45026 <secondary>use for retrying</secondary>
45027 </indexterm>
45028 Retry times are hints rather than promises. Exim does not make any attempt to
45029 run deliveries exactly at the computed times. Instead, a queue runner process
45030 starts delivery processes for delayed messages periodically, and these attempt
45031 new deliveries only for those addresses that have passed their next retry time.
45032 If a new message arrives for a deferred address, an immediate delivery attempt
45033 occurs only if the address has passed its retry time. In the absence of new
45034 messages, the minimum time between retries is the interval between queue runner
45035 processes. There is not much point in setting retry times of five minutes if
45036 your queue runners happen only once an hour, unless there are a significant
45037 number of incoming messages (which might be the case on a system that is
45038 sending everything to a smart host, for example).
45039 </para>
45040 <para>
45041 The data in the retry hints database can be inspected by using the
45042 <emphasis>exim_dumpdb</emphasis> or <emphasis>exim_fixdb</emphasis> utility programs (see chapter
45043 <xref linkend="CHAPutils"/>). The latter utility can also be used to change the data. The
45044 <emphasis>exinext</emphasis> utility script can be used to find out what the next retry times
45045 are for the hosts associated with a particular mail domain, and also for local
45046 deliveries that have been deferred.
45047 </para>
45048 </section>
45049 <section id="SECID164">
45050 <title>Retry rule examples</title>
45051 <para>
45052 Here are some example retry rules:
45053 </para>
45054 <literallayout class="monospaced">
45055 alice@wonderland.fict.example quota_5d  F,7d,3h
45056 wonderland.fict.example       quota_5d
45057 wonderland.fict.example       *         F,1h,15m; G,2d,1h,2;
45058 lookingglass.fict.example     *         F,24h,30m;
45059 *                 refused_A   F,2h,20m;
45060 *                 *           F,2h,15m; G,16h,1h,1.5; F,5d,8h
45061 </literallayout>
45062 <para>
45063 The first rule sets up special handling for mail to
45064 <emphasis>alice@wonderland.fict.example</emphasis> when there is an over-quota error and the
45065 mailbox has not been read for at least 5 days. Retries continue every three
45066 hours for 7 days. The second rule handles over-quota errors for all other local
45067 parts at <emphasis>wonderland.fict.example</emphasis>; the absence of a local part has the same
45068 effect as supplying <quote>*@</quote>. As no retry algorithms are supplied, messages that
45069 fail are bounced immediately if the mailbox has not been read for at least 5
45070 days.
45071 </para>
45072 <para>
45073 The third rule handles all other errors at <emphasis>wonderland.fict.example</emphasis>; retries
45074 happen every 15 minutes for an hour, then with geometrically increasing
45075 intervals until two days have passed since a delivery first failed. After the
45076 first hour there is a delay of one hour, then two hours, then four hours, and
45077 so on (this is a rather extreme example).
45078 </para>
45079 <para>
45080 The fourth rule controls retries for the domain <emphasis>lookingglass.fict.example</emphasis>.
45081 They happen every 30 minutes for 24 hours only. The remaining two rules handle
45082 all other domains, with special action for connection refusal from hosts that
45083 were not obtained from an MX record.
45084 </para>
45085 <para>
45086 The final rule in a retry configuration should always have asterisks in the
45087 first two fields so as to provide a general catch-all for any addresses that do
45088 not have their own special handling. This example tries every 15 minutes for 2
45089 hours, then with intervals starting at one hour and increasing by a factor of
45090 1.5 up to 16 hours, then every 8 hours up to 5 days.
45091 </para>
45092 </section>
45093 <section id="SECID165">
45094 <title>Timeout of retry data</title>
45095 <para>
45096 <indexterm role="concept">
45097 <primary>timeout</primary>
45098 <secondary>of retry data</secondary>
45099 </indexterm>
45100 <indexterm role="option">
45101 <primary><option>retry_data_expire</option></primary>
45102 </indexterm>
45103 <indexterm role="concept">
45104 <primary>hints database</primary>
45105 <secondary>data expiry</secondary>
45106 </indexterm>
45107 <indexterm role="concept">
45108 <primary>retry</primary>
45109 <secondary>timeout of data</secondary>
45110 </indexterm>
45111 Exim timestamps the data that it writes to its retry hints database. When it
45112 consults the data during a delivery it ignores any that is older than the value
45113 set in <option>retry_data_expire</option> (default 7 days). If, for example, a host hasn&#x2019;t
45114 been tried for 7 days, Exim will try to deliver to it immediately a message
45115 arrives, and if that fails, it will calculate a retry time as if it were
45116 failing for the first time.
45117 </para>
45118 <para>
45119 This improves the behaviour for messages routed to rarely-used hosts such as MX
45120 backups. If such a host was down at one time, and happens to be down again when
45121 Exim tries a month later, using the old retry data would imply that it had been
45122 down all the time, which is not a justified assumption.
45123 </para>
45124 <para>
45125 If a host really is permanently dead, this behaviour causes a burst of retries
45126 every now and again, but only if messages routed to it are rare. If there is a
45127 message at least once every 7 days the retry data never expires.
45128 </para>
45129 </section>
45130 <section id="SECID166">
45131 <title>Long-term failures</title>
45132 <para>
45133 <indexterm role="concept">
45134 <primary>delivery failure, long-term</primary>
45135 </indexterm>
45136 <indexterm role="concept">
45137 <primary>retry</primary>
45138 <secondary>after long-term failure</secondary>
45139 </indexterm>
45140 Special processing happens when an email address has been failing for so long
45141 that the cutoff time for the last algorithm is reached. For example, using the
45142 default retry rule:
45143 </para>
45144 <literallayout class="monospaced">
45145 * * F,2h,15m; G,16h,1h,1.5; F,4d,6h
45146 </literallayout>
45147 <para>
45148 the cutoff time is four days. Reaching the retry cutoff is independent of how
45149 long any specific message has been failing; it is the length of continuous
45150 failure for the recipient address that counts.
45151 </para>
45152 <para>
45153 When the cutoff time is reached for a local delivery, or for all the IP
45154 addresses associated with a remote delivery, a subsequent delivery failure
45155 causes Exim to give up on the address, and a bounce message is generated.
45156 In order to cater for new messages that use the failing address, a next retry
45157 time is still computed from the final algorithm, and is used as follows:
45158 </para>
45159 <para>
45160 For local deliveries, one delivery attempt is always made for any subsequent
45161 messages. If this delivery fails, the address fails immediately. The
45162 post-cutoff retry time is not used.
45163 </para>
45164 <para>
45165 If the delivery is remote, there are two possibilities, controlled by the
45166 <indexterm role="option">
45167 <primary><option>delay_after_cutoff</option></primary>
45168 </indexterm>
45169 <option>delay_after_cutoff</option> option of the <command>smtp</command> transport. The option is true by
45170 default. Until the post-cutoff retry time for one of the IP addresses is
45171 reached, the failing email address is bounced immediately, without a delivery
45172 attempt taking place. After that time, one new delivery attempt is made to
45173 those IP addresses that are past their retry times, and if that still fails,
45174 the address is bounced and new retry times are computed.
45175 </para>
45176 <para>
45177 In other words, when all the hosts for a given email address have been failing
45178 for a long time, Exim bounces rather then defers until one of the hosts&#x2019; retry
45179 times is reached. Then it tries once, and bounces if that attempt fails. This
45180 behaviour ensures that few resources are wasted in repeatedly trying to deliver
45181 to a broken destination, but if the host does recover, Exim will eventually
45182 notice.
45183 </para>
45184 <para>
45185 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
45186 addresses are past their final cutoff time, Exim tries to deliver to those IP
45187 addresses that have not been tried since the message arrived. If there are
45188 no suitable IP addresses, or if they all fail, the address is bounced. In other
45189 words, it does not delay when a new message arrives, but tries the expired
45190 addresses immediately, unless they have been tried since the message arrived.
45191 If there is a continuous stream of messages for the failing domains, setting
45192 <option>delay_after_cutoff</option> false means that there will be many more attempts to
45193 deliver to permanently failing IP addresses than when <option>delay_after_cutoff</option> is
45194 true.
45195 </para>
45196 </section>
45197 <section id="SECID167">
45198 <title>Deliveries that work intermittently</title>
45199 <para>
45200 <indexterm role="concept">
45201 <primary>retry</primary>
45202 <secondary>intermittently working deliveries</secondary>
45203 </indexterm>
45204 Some additional logic is needed to cope with cases where a host is
45205 intermittently available, or when a message has some attribute that prevents
45206 its delivery when others to the same address get through. In this situation,
45207 because some messages are successfully delivered, the <quote>retry clock</quote> for the
45208 host or address keeps getting reset by the successful deliveries, and so
45209 failing messages remain on the queue for ever because the cutoff time is never
45210 reached.
45211 </para>
45212 <para>
45213 Two exceptional actions are applied to prevent this happening. The first
45214 applies to errors that are related to a message rather than a remote host.
45215 Section <xref linkend="SECToutSMTPerr"/> has a discussion of the different kinds of error;
45216 examples of message-related errors are 4<emphasis>xx</emphasis> responses to MAIL or DATA
45217 commands, and quota failures. For this type of error, if a message&#x2019;s arrival
45218 time is earlier than the <quote>first failed</quote> time for the error, the earlier time
45219 is used when scanning the retry rules to decide when to try next and when to
45220 time out the address.
45221 </para>
45222 <para>
45223 The exceptional second action applies in all cases. If a message has been on
45224 the queue for longer than the cutoff time of any applicable retry rule for a
45225 given address, a delivery is attempted for that address, even if it is not yet
45226 time, and if this delivery fails, the address is timed out. A new retry time is
45227 not computed in this case, so that other messages for the same address are
45228 considered immediately.
45229 <indexterm role="concept" startref="IIDretconf1" class="endofrange"/>
45230 <indexterm role="concept" startref="IIDregconf2" class="endofrange"/>
45231 </para>
45232 </section>
45233 </chapter>
45234
45235 <chapter id="CHAPSMTPAUTH">
45236 <title>SMTP authentication</title>
45237 <para>
45238 <indexterm role="concept" id="IIDauthconf1" class="startofrange">
45239 <primary>SMTP</primary>
45240 <secondary>authentication configuration</secondary>
45241 </indexterm>
45242 <indexterm role="concept" id="IIDauthconf2" class="startofrange">
45243 <primary>authentication</primary>
45244 </indexterm>
45245 The <quote>authenticators</quote> section of Exim&#x2019;s run time configuration is concerned
45246 with SMTP authentication. This facility is an extension to the SMTP protocol,
45247 described in RFC 2554, which allows a client SMTP host to authenticate itself
45248 to a server. This is a common way for a server to recognize clients that are
45249 permitted to use it as a relay. SMTP authentication is not of relevance to the
45250 transfer of mail between servers that have no managerial connection with each
45251 other.
45252 </para>
45253 <para>
45254 <indexterm role="concept">
45255 <primary>AUTH</primary>
45256 <secondary>description of</secondary>
45257 </indexterm>
45258 Very briefly, the way SMTP authentication works is as follows:
45259 </para>
45260 <itemizedlist>
45261 <listitem>
45262 <para>
45263 The server advertises a number of authentication <emphasis>mechanisms</emphasis> in response to
45264 the client&#x2019;s EHLO command.
45265 </para>
45266 </listitem>
45267 <listitem>
45268 <para>
45269 The client issues an AUTH command, naming a specific mechanism. The command
45270 may, optionally, contain some authentication data.
45271 </para>
45272 </listitem>
45273 <listitem>
45274 <para>
45275 The server may issue one or more <emphasis>challenges</emphasis>, to which the client must send
45276 appropriate responses. In simple authentication mechanisms, the challenges are
45277 just prompts for user names and passwords. The server does not have to issue
45278 any challenges &ndash; in some mechanisms the relevant data may all be transmitted
45279 with the AUTH command.
45280 </para>
45281 </listitem>
45282 <listitem>
45283 <para>
45284 The server either accepts or denies authentication.
45285 </para>
45286 </listitem>
45287 <listitem>
45288 <para>
45289 If authentication succeeds, the client may optionally make use of the AUTH
45290 option on the MAIL command to pass an authenticated sender in subsequent
45291 mail transactions. Authentication lasts for the remainder of the SMTP
45292 connection.
45293 </para>
45294 </listitem>
45295 <listitem>
45296 <para>
45297 If authentication fails, the client may give up, or it may try a different
45298 authentication mechanism, or it may try transferring mail over the
45299 unauthenticated connection.
45300 </para>
45301 </listitem>
45302 </itemizedlist>
45303 <para>
45304 If you are setting up a client, and want to know which authentication
45305 mechanisms the server supports, you can use Telnet to connect to port 25 (the
45306 SMTP port) on the server, and issue an EHLO command. The response to this
45307 includes the list of supported mechanisms. For example:
45308 </para>
45309 <literallayout>
45310 <literal>$ </literal><emphasis role="bold"><literal>telnet server.example 25</literal></emphasis>
45311 <literal>Trying 192.168.34.25...</literal>
45312 <literal>Connected to server.example.</literal>
45313 <literal>Escape character is &#x0027;^]&#x0027;.</literal>
45314 <literal>220 server.example ESMTP Exim 4.20 ...</literal>
45315 <emphasis role="bold"><literal>ehlo client.example</literal></emphasis>
45316 <literal>250-server.example Hello client.example [10.8.4.5]</literal>
45317 <literal>250-SIZE 52428800</literal>
45318 <literal>250-PIPELINING</literal>
45319 <literal>250-AUTH PLAIN</literal>
45320 <literal>250 HELP</literal>
45321 </literallayout>
45322 <para>
45323 The second-last line of this example output shows that the server supports
45324 authentication using the PLAIN mechanism. In Exim, the different authentication
45325 mechanisms are configured by specifying <emphasis>authenticator</emphasis> drivers. Like the
45326 routers and transports, which authenticators are included in the binary is
45327 controlled by build-time definitions. The following are currently available,
45328 included by setting
45329 </para>
45330 <literallayout class="monospaced">
45331 AUTH_CRAM_MD5=yes
45332 AUTH_CYRUS_SASL=yes
45333 AUTH_PLAINTEXT=yes
45334 AUTH_SPA=yes
45335 </literallayout>
45336 <para>
45337 in <filename>Local/Makefile</filename>, respectively. The first of these supports the CRAM-MD5
45338 authentication mechanism (RFC 2195), and the second provides an interface to
45339 the Cyrus SASL authentication library. The third can be configured to support
45340 the PLAIN authentication mechanism (RFC 2595) or the LOGIN mechanism, which is
45341 not formally documented, but used by several MUAs. The fourth authenticator
45342 supports Microsoft&#x2019;s <emphasis>Secure Password Authentication</emphasis> mechanism.
45343 </para>
45344 <para>
45345 The authenticators are configured using the same syntax as other drivers (see
45346 section <xref linkend="SECTfordricon"/>). If no authenticators are required, no
45347 authentication section need be present in the configuration file. Each
45348 authenticator can in principle have both server and client functions. When Exim
45349 is receiving SMTP mail, it is acting as a server; when it is sending out
45350 messages over SMTP, it is acting as a client. Authenticator configuration
45351 options are provided for use in both these circumstances.
45352 </para>
45353 <para>
45354 To make it clear which options apply to which situation, the prefixes
45355 <option>server_</option> and <option>client_</option> are used on option names that are specific to
45356 either the server or the client function, respectively. Server and client
45357 functions are disabled if none of their options are set. If an authenticator is
45358 to be used for both server and client functions, a single definition, using
45359 both sets of options, is required. For example:
45360 </para>
45361 <literallayout class="monospaced">
45362 cram:
45363   driver = cram_md5
45364   public_name = CRAM-MD5
45365   server_secret = ${if eq{$auth1}{ph10}{secret1}fail}
45366   client_name = ph10
45367   client_secret = secret2
45368 </literallayout>
45369 <para>
45370 The <option>server_</option> option is used when Exim is acting as a server, and the
45371 <option>client_</option> options when it is acting as a client.
45372 </para>
45373 <para>
45374 Descriptions of the individual authenticators are given in subsequent chapters.
45375 The remainder of this chapter covers the generic options for the
45376 authenticators, followed by general discussion of the way authentication works
45377 in Exim.
45378 </para>
45379 <section id="SECID168">
45380 <title>Generic options for authenticators</title>
45381 <para>
45382 <indexterm role="concept">
45383 <primary>authentication</primary>
45384 <secondary>generic options</secondary>
45385 </indexterm>
45386 <indexterm role="concept">
45387 <primary>options</primary>
45388 <secondary>generic; for authenticators</secondary>
45389 </indexterm>
45390 </para>
45391 <para>
45392 <indexterm role="option">
45393 <primary><option>client_condition</option></primary>
45394 </indexterm>
45395 </para>
45396 <informaltable frame="all">
45397 <tgroup cols="4" colsep="0" rowsep="0">
45398 <colspec colwidth="8*" align="left"/>
45399 <colspec colwidth="6*" align="center"/>
45400 <colspec colwidth="6*" align="center"/>
45401 <colspec colwidth="6*" align="right"/>
45402 <tbody>
45403 <row>
45404 <entry><option>client_condition</option></entry>
45405 <entry>Use: <emphasis>authenticators</emphasis></entry>
45406 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45407 <entry>Default: <emphasis>unset</emphasis></entry>
45408 </row>
45409 </tbody>
45410 </tgroup>
45411 </informaltable>
45412 <para>
45413 When Exim is authenticating as a client, it skips any authenticator whose
45414 <option>client_condition</option> expansion yields <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>. This can be
45415 used, for example, to skip plain text authenticators when the connection is not
45416 encrypted by a setting such as:
45417 </para>
45418 <literallayout class="monospaced">
45419 client_condition = ${if !eq{$tls_cipher}{}}
45420 </literallayout>
45421 <para>
45422 (Older documentation incorrectly states that <varname>$tls_cipher</varname> contains the cipher
45423 used for incoming messages. In fact, during SMTP delivery, it contains the
45424 cipher used for the delivery.)
45425 </para>
45426 <para>
45427 <indexterm role="option">
45428 <primary><option>driver</option></primary>
45429 </indexterm>
45430 </para>
45431 <informaltable frame="all">
45432 <tgroup cols="4" colsep="0" rowsep="0">
45433 <colspec colwidth="8*" align="left"/>
45434 <colspec colwidth="6*" align="center"/>
45435 <colspec colwidth="6*" align="center"/>
45436 <colspec colwidth="6*" align="right"/>
45437 <tbody>
45438 <row>
45439 <entry><option>driver</option></entry>
45440 <entry>Use: <emphasis>authenticators</emphasis></entry>
45441 <entry>Type: <emphasis>string</emphasis></entry>
45442 <entry>Default: <emphasis>unset</emphasis></entry>
45443 </row>
45444 </tbody>
45445 </tgroup>
45446 </informaltable>
45447 <para>
45448 This option must always be set. It specifies which of the available
45449 authenticators is to be used.
45450 </para>
45451 <para>
45452 <indexterm role="option">
45453 <primary><option>public_name</option></primary>
45454 </indexterm>
45455 </para>
45456 <informaltable frame="all">
45457 <tgroup cols="4" colsep="0" rowsep="0">
45458 <colspec colwidth="8*" align="left"/>
45459 <colspec colwidth="6*" align="center"/>
45460 <colspec colwidth="6*" align="center"/>
45461 <colspec colwidth="6*" align="right"/>
45462 <tbody>
45463 <row>
45464 <entry><option>public_name</option></entry>
45465 <entry>Use: <emphasis>authenticators</emphasis></entry>
45466 <entry>Type: <emphasis>string</emphasis></entry>
45467 <entry>Default: <emphasis>unset</emphasis></entry>
45468 </row>
45469 </tbody>
45470 </tgroup>
45471 </informaltable>
45472 <para>
45473 This option specifies the name of the authentication mechanism that the driver
45474 implements, and by which it is known to the outside world. These names should
45475 contain only upper case letters, digits, underscores, and hyphens (RFC 2222),
45476 but Exim in fact matches them caselessly. If <option>public_name</option> is not set, it
45477 defaults to the driver&#x2019;s instance name.
45478 </para>
45479 <para>
45480 <indexterm role="option">
45481 <primary><option>server_advertise_condition</option></primary>
45482 </indexterm>
45483 </para>
45484 <informaltable frame="all">
45485 <tgroup cols="4" colsep="0" rowsep="0">
45486 <colspec colwidth="8*" align="left"/>
45487 <colspec colwidth="6*" align="center"/>
45488 <colspec colwidth="6*" align="center"/>
45489 <colspec colwidth="6*" align="right"/>
45490 <tbody>
45491 <row>
45492 <entry><option>server_advertise_condition</option></entry>
45493 <entry>Use: <emphasis>authenticators</emphasis></entry>
45494 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45495 <entry>Default: <emphasis>unset</emphasis></entry>
45496 </row>
45497 </tbody>
45498 </tgroup>
45499 </informaltable>
45500 <para>
45501 When a server is about to advertise an authentication mechanism, the condition
45502 is expanded. If it yields the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the
45503 mechanism is not advertised.
45504 If the expansion fails, the mechanism is not advertised. If the failure was not
45505 forced, and was not caused by a lookup defer, the incident is logged.
45506 See section <xref linkend="SECTauthexiser"/> below for further discussion.
45507 </para>
45508 <para>
45509 <indexterm role="option">
45510 <primary><option>server_condition</option></primary>
45511 </indexterm>
45512 </para>
45513 <informaltable frame="all">
45514 <tgroup cols="4" colsep="0" rowsep="0">
45515 <colspec colwidth="8*" align="left"/>
45516 <colspec colwidth="6*" align="center"/>
45517 <colspec colwidth="6*" align="center"/>
45518 <colspec colwidth="6*" align="right"/>
45519 <tbody>
45520 <row>
45521 <entry><option>server_condition</option></entry>
45522 <entry>Use: <emphasis>authenticators</emphasis></entry>
45523 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45524 <entry>Default: <emphasis>unset</emphasis></entry>
45525 </row>
45526 </tbody>
45527 </tgroup>
45528 </informaltable>
45529 <para>
45530 This option must be set for a <option>plaintext</option> server authenticator, where it
45531 is used directly to control authentication. See section <xref linkend="SECTplainserver"/>
45532 for details.
45533 </para>
45534 <para>
45535 For the other authenticators, <option>server_condition</option> can be used as an additional
45536 authentication or authorization mechanism that is applied after the other
45537 authenticator conditions succeed. If it is set, it is expanded when the
45538 authenticator would otherwise return a success code. If the expansion is forced
45539 to fail, authentication fails. Any other expansion failure causes a temporary
45540 error code to be returned. If the result of a successful expansion is an empty
45541 string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
45542 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds. For any
45543 other result, a temporary error code is returned, with the expanded string as
45544 the error text.
45545 </para>
45546 <para>
45547 <indexterm role="option">
45548 <primary><option>server_debug_print</option></primary>
45549 </indexterm>
45550 </para>
45551 <informaltable frame="all">
45552 <tgroup cols="4" colsep="0" rowsep="0">
45553 <colspec colwidth="8*" align="left"/>
45554 <colspec colwidth="6*" align="center"/>
45555 <colspec colwidth="6*" align="center"/>
45556 <colspec colwidth="6*" align="right"/>
45557 <tbody>
45558 <row>
45559 <entry><option>server_debug_print</option></entry>
45560 <entry>Use: <emphasis>authenticators</emphasis></entry>
45561 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45562 <entry>Default: <emphasis>unset</emphasis></entry>
45563 </row>
45564 </tbody>
45565 </tgroup>
45566 </informaltable>
45567 <para>
45568 If this option is set and authentication debugging is enabled (see the <option>-d</option>
45569 command line option), the string is expanded and included in the debugging
45570 output when the authenticator is run as a server. This can help with checking
45571 out the values of variables.
45572 If expansion of the string fails, the error message is written to the debugging
45573 output, and Exim carries on processing.
45574 </para>
45575 <para>
45576 <indexterm role="option">
45577 <primary><option>server_set_id</option></primary>
45578 </indexterm>
45579 </para>
45580 <informaltable frame="all">
45581 <tgroup cols="4" colsep="0" rowsep="0">
45582 <colspec colwidth="8*" align="left"/>
45583 <colspec colwidth="6*" align="center"/>
45584 <colspec colwidth="6*" align="center"/>
45585 <colspec colwidth="6*" align="right"/>
45586 <tbody>
45587 <row>
45588 <entry><option>server_set_id</option></entry>
45589 <entry>Use: <emphasis>authenticators</emphasis></entry>
45590 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45591 <entry>Default: <emphasis>unset</emphasis></entry>
45592 </row>
45593 </tbody>
45594 </tgroup>
45595 </informaltable>
45596 <para>
45597 <indexterm role="variable">
45598 <primary><varname>$authenticated_id</varname></primary>
45599 </indexterm>
45600 When an Exim server successfully authenticates a client, this string is
45601 expanded using data from the authentication, and preserved for any incoming
45602 messages in the variable <varname>$authenticated_id</varname>. It is also included in the log
45603 lines for incoming messages. For example, a user/password authenticator
45604 configuration might preserve the user name that was used to authenticate, and
45605 refer to it subsequently during delivery of the message.
45606 If expansion fails, the option is ignored.
45607 </para>
45608 <para>
45609 <indexterm role="option">
45610 <primary><option>server_mail_auth_condition</option></primary>
45611 </indexterm>
45612 </para>
45613 <informaltable frame="all">
45614 <tgroup cols="4" colsep="0" rowsep="0">
45615 <colspec colwidth="8*" align="left"/>
45616 <colspec colwidth="6*" align="center"/>
45617 <colspec colwidth="6*" align="center"/>
45618 <colspec colwidth="6*" align="right"/>
45619 <tbody>
45620 <row>
45621 <entry><option>server_mail_auth_condition</option></entry>
45622 <entry>Use: <emphasis>authenticators</emphasis></entry>
45623 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45624 <entry>Default: <emphasis>unset</emphasis></entry>
45625 </row>
45626 </tbody>
45627 </tgroup>
45628 </informaltable>
45629 <para>
45630 This option allows a server to discard authenticated sender addresses supplied
45631 as part of MAIL commands in SMTP connections that are authenticated by the
45632 driver on which <option>server_mail_auth_condition</option> is set. The option is not used
45633 as part of the authentication process; instead its (unexpanded) value is
45634 remembered for later use.
45635 How it is used is described in the following section.
45636 </para>
45637 </section>
45638 <section id="SECTauthparamail">
45639 <title>The AUTH parameter on MAIL commands</title>
45640 <para>
45641 <indexterm role="concept">
45642 <primary>authentication</primary>
45643 <secondary>sender; authenticated</secondary>
45644 </indexterm>
45645 <indexterm role="concept">
45646 <primary>AUTH</primary>
45647 <secondary>on MAIL command</secondary>
45648 </indexterm>
45649 When a client supplied an AUTH= item on a MAIL command, Exim applies
45650 the following checks before accepting it as the authenticated sender of the
45651 message:
45652 </para>
45653 <itemizedlist>
45654 <listitem>
45655 <para>
45656 If the connection is not using extended SMTP (that is, HELO was used rather
45657 than EHLO), the use of AUTH= is a syntax error.
45658 </para>
45659 </listitem>
45660 <listitem>
45661 <para>
45662 If the value of the AUTH= parameter is <quote>&lt;&gt;</quote>, it is ignored.
45663 </para>
45664 </listitem>
45665 <listitem>
45666 <para>
45667 <indexterm role="variable">
45668 <primary><varname>$authenticated_sender</varname></primary>
45669 </indexterm>
45670 If <option>acl_smtp_mailauth</option> is defined, the ACL it specifies is run. While it is
45671 running, the value of <varname>$authenticated_sender</varname> is set to the value obtained
45672 from the AUTH= parameter. If the ACL does not yield <quote>accept</quote>, the value of
45673 <varname>$authenticated_sender</varname> is deleted. The <option>acl_smtp_mailauth</option> ACL may not
45674 return <quote>drop</quote> or <quote>discard</quote>. If it defers, a temporary error code (451) is
45675 given for the MAIL command.
45676 </para>
45677 </listitem>
45678 <listitem>
45679 <para>
45680 If <option>acl_smtp_mailauth</option> is not defined, the value of the AUTH= parameter
45681 is accepted and placed in <varname>$authenticated_sender</varname> only if the client has
45682 authenticated.
45683 </para>
45684 </listitem>
45685 <listitem>
45686 <para>
45687 If the AUTH= value was accepted by either of the two previous rules, and
45688 the client has authenticated, and the authenticator has a setting for the
45689 <option>server_mail_auth_condition</option>, the condition is checked at this point. The
45690 valued that was saved from the authenticator is expanded. If the expansion
45691 fails, or yields an empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the value of
45692 <varname>$authenticated_sender</varname> is deleted. If the expansion yields any other value,
45693 the value of <varname>$authenticated_sender</varname> is retained and passed on with the
45694 message.
45695 </para>
45696 </listitem>
45697 </itemizedlist>
45698 <para>
45699 When <varname>$authenticated_sender</varname> is set for a message, it is passed on to other
45700 hosts to which Exim authenticates as a client. Do not confuse this value with
45701 <varname>$authenticated_id</varname>, which is a string obtained from the authentication
45702 process, and which is not usually a complete email address.
45703 </para>
45704 <para>
45705 <indexterm role="variable">
45706 <primary><varname>$sender_address</varname></primary>
45707 </indexterm>
45708 Whenever an AUTH= value is ignored, the incident is logged. The ACL for
45709 MAIL, if defined, is run after AUTH= is accepted or ignored. It can
45710 therefore make use of <varname>$authenticated_sender</varname>. The converse is not true: the
45711 value of <varname>$sender_address</varname> is not yet set up when the <option>acl_smtp_mailauth</option>
45712 ACL is run.
45713 </para>
45714 </section>
45715 <section id="SECTauthexiser">
45716 <title>Authentication on an Exim server</title>
45717 <para>
45718 <indexterm role="concept">
45719 <primary>authentication</primary>
45720 <secondary>on an Exim server</secondary>
45721 </indexterm>
45722 When Exim receives an EHLO command, it advertises the public names of those
45723 authenticators that are configured as servers, subject to the following
45724 conditions:
45725 </para>
45726 <itemizedlist>
45727 <listitem>
45728 <para>
45729 The client host must match <option>auth_advertise_hosts</option> (default *).
45730 </para>
45731 </listitem>
45732 <listitem>
45733 <para>
45734 It the <option>server_advertise_condition</option> option is set, its expansion must not
45735 yield the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>.
45736 </para>
45737 </listitem>
45738 </itemizedlist>
45739 <para>
45740 The order in which the authenticators are defined controls the order in which
45741 the mechanisms are advertised.
45742 </para>
45743 <para>
45744 Some mail clients (for example, some versions of Netscape) require the user to
45745 provide a name and password for authentication whenever AUTH is advertised,
45746 even though authentication may not in fact be needed (for example, Exim may be
45747 set up to allow unconditional relaying from the client by an IP address check).
45748 You can make such clients more friendly by not advertising AUTH to them.
45749 For example, if clients on the 10.9.8.0/24 network are permitted (by the ACL
45750 that runs for RCPT) to relay without authentication, you should set
45751 </para>
45752 <literallayout class="monospaced">
45753 auth_advertise_hosts = ! 10.9.8.0/24
45754 </literallayout>
45755 <para>
45756 so that no authentication mechanisms are advertised to them.
45757 </para>
45758 <para>
45759 The <option>server_advertise_condition</option> controls the advertisement of individual
45760 authentication mechanisms. For example, it can be used to restrict the
45761 advertisement of a particular mechanism to encrypted connections, by a setting
45762 such as:
45763 </para>
45764 <literallayout class="monospaced">
45765 server_advertise_condition = ${if eq{$tls_cipher}{}{no}{yes}}
45766 </literallayout>
45767 <para>
45768 <indexterm role="variable">
45769 <primary><varname>$tls_cipher</varname></primary>
45770 </indexterm>
45771 If the session is encrypted, <varname>$tls_cipher</varname> is not empty, and so the expansion
45772 yields <quote>yes</quote>, which allows the advertisement to happen.
45773 </para>
45774 <para>
45775 When an Exim server receives an AUTH command from a client, it rejects it
45776 immediately if AUTH was not advertised in response to an earlier EHLO
45777 command. This is the case if
45778 </para>
45779 <itemizedlist>
45780 <listitem>
45781 <para>
45782 The client host does not match <option>auth_advertise_hosts</option>; or
45783 </para>
45784 </listitem>
45785 <listitem>
45786 <para>
45787 No authenticators are configured with server options; or
45788 </para>
45789 </listitem>
45790 <listitem>
45791 <para>
45792 Expansion of <option>server_advertise_condition</option> blocked the advertising of all the
45793 server authenticators.
45794 </para>
45795 </listitem>
45796 </itemizedlist>
45797 <para>
45798 Otherwise, Exim runs the ACL specified by <option>acl_smtp_auth</option> in order
45799 to decide whether to accept the command. If <option>acl_smtp_auth</option> is not set,
45800 AUTH is accepted from any client host.
45801 </para>
45802 <para>
45803 If AUTH is not rejected by the ACL, Exim searches its configuration for a
45804 server authentication mechanism that was advertised in response to EHLO and
45805 that matches the one named in the AUTH command. If it finds one, it runs
45806 the appropriate authentication protocol, and authentication either succeeds or
45807 fails. If there is no matching advertised mechanism, the AUTH command is
45808 rejected with a 504 error.
45809 </para>
45810 <para>
45811 <indexterm role="variable">
45812 <primary><varname>$received_protocol</varname></primary>
45813 </indexterm>
45814 <indexterm role="variable">
45815 <primary><varname>$sender_host_authenticated</varname></primary>
45816 </indexterm>
45817 When a message is received from an authenticated host, the value of
45818 <varname>$received_protocol</varname> is set to <quote>esmtpa</quote> or <quote>esmtpsa</quote> instead of <quote>esmtp</quote>
45819 or <quote>esmtps</quote>, and <varname>$sender_host_authenticated</varname> contains the name (not the
45820 public name) of the authenticator driver that successfully authenticated the
45821 client from which the message was received. This variable is empty if there was
45822 no successful authentication.
45823 </para>
45824 </section>
45825 <section id="SECID169">
45826 <title>Testing server authentication</title>
45827 <para>
45828 <indexterm role="concept">
45829 <primary>authentication</primary>
45830 <secondary>testing a server</secondary>
45831 </indexterm>
45832 <indexterm role="concept">
45833 <primary>AUTH</primary>
45834 <secondary>testing a server</secondary>
45835 </indexterm>
45836 <indexterm role="concept">
45837 <primary>base64 encoding</primary>
45838 <secondary>creating authentication test data</secondary>
45839 </indexterm>
45840 Exim&#x2019;s <option>-bh</option> option can be useful for testing server authentication
45841 configurations. The data for the AUTH command has to be sent using base64
45842 encoding. A quick way to produce such data for testing is the following Perl
45843 script:
45844 </para>
45845 <literallayout class="monospaced">
45846 use MIME::Base64;
45847 printf ("%s", encode_base64(eval "\"$ARGV[0]\""));
45848 </literallayout>
45849 <para>
45850 <indexterm role="concept">
45851 <primary>binary zero</primary>
45852 <secondary>in authentication data</secondary>
45853 </indexterm>
45854 This interprets its argument as a Perl string, and then encodes it. The
45855 interpretation as a Perl string allows binary zeros, which are required for
45856 some kinds of authentication, to be included in the data. For example, a
45857 command line to run this script on such data might be
45858 </para>
45859 <literallayout class="monospaced">
45860 encode '\0user\0password'
45861 </literallayout>
45862 <para>
45863 Note the use of single quotes to prevent the shell interpreting the
45864 backslashes, so that they can be interpreted by Perl to specify characters
45865 whose code value is zero.
45866 </para>
45867 <para>
45868 <emphasis role="bold">Warning 1</emphasis>: If either of the user or password strings starts with an octal
45869 digit, you must use three zeros instead of one after the leading backslash. If
45870 you do not, the octal digit that starts your string will be incorrectly
45871 interpreted as part of the code for the first character.
45872 </para>
45873 <para>
45874 <emphasis role="bold">Warning 2</emphasis>: If there are characters in the strings that Perl interprets
45875 specially, you must use a Perl escape to prevent them being misinterpreted. For
45876 example, a command such as
45877 </para>
45878 <literallayout class="monospaced">
45879 encode '\0user@domain.com\0pas$$word'
45880 </literallayout>
45881 <para>
45882 gives an incorrect answer because of the unescaped <quote>@</quote> and <quote>$</quote> characters.
45883 </para>
45884 <para>
45885 If you have the <option>mimencode</option> command installed, another way to do produce
45886 base64-encoded strings is to run the command
45887 </para>
45888 <literallayout class="monospaced">
45889 echo -e -n `\0user\0password' | mimencode
45890 </literallayout>
45891 <para>
45892 The <option>-e</option> option of <option>echo</option> enables the interpretation of backslash escapes
45893 in the argument, and the <option>-n</option> option specifies no newline at the end of its
45894 output. However, not all versions of <option>echo</option> recognize these options, so you
45895 should check your version before relying on this suggestion.
45896 </para>
45897 </section>
45898 <section id="SECID170">
45899 <title>Authentication by an Exim client</title>
45900 <para>
45901 <indexterm role="concept">
45902 <primary>authentication</primary>
45903 <secondary>on an Exim client</secondary>
45904 </indexterm>
45905 The <command>smtp</command> transport has two options called <option>hosts_require_auth</option> and
45906 <option>hosts_try_auth</option>. When the <command>smtp</command> transport connects to a server that
45907 announces support for authentication, and the host matches an entry in either
45908 of these options, Exim (as a client) tries to authenticate as follows:
45909 </para>
45910 <itemizedlist>
45911 <listitem>
45912 <para>
45913 For each authenticator that is configured as a client, in the order in which
45914 they are defined in the configuration, it searches the authentication
45915 mechanisms announced by the server for one whose name matches the public name
45916 of the authenticator.
45917 </para>
45918 </listitem>
45919 <listitem>
45920 <para>
45921 <indexterm role="variable">
45922 <primary><varname>$host</varname></primary>
45923 </indexterm>
45924 <indexterm role="variable">
45925 <primary><varname>$host_address</varname></primary>
45926 </indexterm>
45927 When it finds one that matches, it runs the authenticator&#x2019;s client code. The
45928 variables <varname>$host</varname> and <varname>$host_address</varname> are available for any string expansions
45929 that the client might do. They are set to the server&#x2019;s name and IP address. If
45930 any expansion is forced to fail, the authentication attempt is abandoned, and
45931 Exim moves on to the next authenticator. Otherwise an expansion failure causes
45932 delivery to be deferred.
45933 </para>
45934 </listitem>
45935 <listitem>
45936 <para>
45937 If the result of the authentication attempt is a temporary error or a timeout,
45938 Exim abandons trying to send the message to the host for the moment. It will
45939 try again later. If there are any backup hosts available, they are tried in the
45940 usual way.
45941 </para>
45942 </listitem>
45943 <listitem>
45944 <para>
45945 If the response to authentication is a permanent error (5<emphasis>xx</emphasis> code), Exim
45946 carries on searching the list of authenticators and tries another one if
45947 possible. If all authentication attempts give permanent errors, or if there are
45948 no attempts because no mechanisms match (or option expansions force failure),
45949 what happens depends on whether the host matches <option>hosts_require_auth</option> or
45950 <option>hosts_try_auth</option>. In the first case, a temporary error is generated, and
45951 delivery is deferred. The error can be detected in the retry rules, and thereby
45952 turned into a permanent error if you wish. In the second case, Exim tries to
45953 deliver the message unauthenticated.
45954 </para>
45955 </listitem>
45956 </itemizedlist>
45957 <para>
45958 <indexterm role="concept">
45959 <primary>AUTH</primary>
45960 <secondary>on MAIL command</secondary>
45961 </indexterm>
45962 When Exim has authenticated itself to a remote server, it adds the AUTH
45963 parameter to the MAIL commands it sends, if it has an authenticated sender for
45964 the message. If the message came from a remote host, the authenticated sender
45965 is the one that was receiving on an incoming MAIL command, provided that the
45966 incoming connection was authenticated and the <option>server_mail_auth</option> condition
45967 allowed the authenticated sender to be retained. If a local process calls Exim
45968 to send a message, the sender address that is built from the login name and
45969 <option>qualify_domain</option> is treated as authenticated. However, if the
45970 <option>authenticated_sender</option> option is set on the <command>smtp</command> transport, it overrides
45971 the authenticated sender that was received with the message.
45972 <indexterm role="concept" startref="IIDauthconf1" class="endofrange"/>
45973 <indexterm role="concept" startref="IIDauthconf2" class="endofrange"/>
45974 </para>
45975 </section>
45976 </chapter>
45977
45978 <chapter id="CHAPplaintext">
45979 <title>The plaintext authenticator</title>
45980 <para>
45981 <indexterm role="concept" id="IIDplaiauth1" class="startofrange">
45982 <primary><command>plaintext</command> authenticator</primary>
45983 </indexterm>
45984 <indexterm role="concept" id="IIDplaiauth2" class="startofrange">
45985 <primary>authenticators</primary>
45986 <secondary><command>plaintext</command></secondary>
45987 </indexterm>
45988 The <command>plaintext</command> authenticator can be configured to support the PLAIN and
45989 LOGIN authentication mechanisms, both of which transfer authentication data as
45990 plain (unencrypted) text (though base64 encoded). The use of plain text is a
45991 security risk; you are strongly advised to insist on the use of SMTP encryption
45992 (see chapter <xref linkend="CHAPTLS"/>) if you use the PLAIN or LOGIN mechanisms. If you do
45993 use unencrypted plain text, you should not use the same passwords for SMTP
45994 connections as you do for login accounts.
45995 </para>
45996 <section id="SECID171">
45997 <title>Plaintext options</title>
45998 <para>
45999 <indexterm role="concept">
46000 <primary>options</primary>
46001 <secondary><command>plaintext</command> authenticator (server)</secondary>
46002 </indexterm>
46003 When configured as a server, <command>plaintext</command> uses the following options:
46004 </para>
46005 <para>
46006 <indexterm role="option">
46007 <primary><option>server_condition</option></primary>
46008 </indexterm>
46009 </para>
46010 <informaltable frame="all">
46011 <tgroup cols="4" colsep="0" rowsep="0">
46012 <colspec colwidth="8*" align="left"/>
46013 <colspec colwidth="6*" align="center"/>
46014 <colspec colwidth="6*" align="center"/>
46015 <colspec colwidth="6*" align="right"/>
46016 <tbody>
46017 <row>
46018 <entry><option>server_condition</option></entry>
46019 <entry>Use: <emphasis>authenticators</emphasis></entry>
46020 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46021 <entry>Default: <emphasis>unset</emphasis></entry>
46022 </row>
46023 </tbody>
46024 </tgroup>
46025 </informaltable>
46026 <para>
46027 This is actually a global authentication option, but it must be set in order to
46028 configure the <command>plaintext</command> driver as a server. Its use is described below.
46029 </para>
46030 <para>
46031 <indexterm role="option">
46032 <primary><option>server_prompts</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_prompts</option></entry>
46044 <entry>Use: <emphasis>plaintext</emphasis></entry>
46045 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46046 <entry>Default: <emphasis>unset</emphasis></entry>
46047 </row>
46048 </tbody>
46049 </tgroup>
46050 </informaltable>
46051 <para>
46052 The contents of this option, after expansion, must be a colon-separated list of
46053 prompt strings. If expansion fails, a temporary authentication rejection is
46054 given.
46055 </para>
46056 </section>
46057 <section id="SECTplainserver">
46058 <title>Using plaintext in a server</title>
46059 <para>
46060 <indexterm role="concept">
46061 <primary>AUTH</primary>
46062 <secondary>in <command>plaintext</command> authenticator</secondary>
46063 </indexterm>
46064 <indexterm role="concept">
46065 <primary>binary zero</primary>
46066 <secondary>in <command>plaintext</command> authenticator</secondary>
46067 </indexterm>
46068 <indexterm role="concept">
46069 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
46070 <secondary>in <command>plaintext</command> authenticator</secondary>
46071 </indexterm>
46072 <indexterm role="variable">
46073 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
46074 </indexterm>
46075 <indexterm role="concept">
46076 <primary>base64 encoding</primary>
46077 <secondary>in <command>plaintext</command> authenticator</secondary>
46078 </indexterm>
46079 </para>
46080 <para>
46081 When running as a server, <command>plaintext</command> performs the authentication test by
46082 expanding a string. The data sent by the client with the AUTH command, or in
46083 response to subsequent prompts, is base64 encoded, and so may contain any byte
46084 values when decoded. If any data is supplied with the command, it is treated as
46085 a list of strings, separated by NULs (binary zeros), the first three of which
46086 are placed in the expansion variables <varname>$auth1</varname>, <varname>$auth2</varname>, and <varname>$auth3</varname>
46087 (neither LOGIN nor PLAIN uses more than three strings).
46088 </para>
46089 <para>
46090 For compatibility with previous releases of Exim, the values are also placed in
46091 the expansion variables <varname>$1</varname>, <varname>$2</varname>, and <varname>$3</varname>. However, the use of these
46092 variables for this purpose is now deprecated, as it can lead to confusion in
46093 string expansions that also use them for other things.
46094 </para>
46095 <para>
46096 If there are more strings in <option>server_prompts</option> than the number of strings
46097 supplied with the AUTH command, the remaining prompts are used to obtain more
46098 data. Each response from the client may be a list of NUL-separated strings.
46099 </para>
46100 <para>
46101 <indexterm role="variable">
46102 <primary><varname>$authenticated_id</varname></primary>
46103 </indexterm>
46104 Once a sufficient number of data strings have been received,
46105 <option>server_condition</option> is expanded. If the expansion is forced to fail,
46106 authentication fails. Any other expansion failure causes a temporary error code
46107 to be returned. If the result of a successful expansion is an empty string,
46108 <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
46109 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds and the
46110 generic <option>server_set_id</option> option is expanded and saved in <varname>$authenticated_id</varname>.
46111 For any other result, a temporary error code is returned, with the expanded
46112 string as the error text.
46113 </para>
46114 <para>
46115 <emphasis role="bold">Warning</emphasis>: If you use a lookup in the expansion to find the user&#x2019;s
46116 password, be sure to make the authentication fail if the user is unknown.
46117 There are good and bad examples at the end of the next section.
46118 </para>
46119 </section>
46120 <section id="SECID172">
46121 <title>The PLAIN authentication mechanism</title>
46122 <para>
46123 <indexterm role="concept">
46124 <primary>PLAIN authentication mechanism</primary>
46125 </indexterm>
46126 <indexterm role="concept">
46127 <primary>authentication</primary>
46128 <secondary>PLAIN mechanism</secondary>
46129 </indexterm>
46130 <indexterm role="concept">
46131 <primary>binary zero</primary>
46132 <secondary>in <command>plaintext</command> authenticator</secondary>
46133 </indexterm>
46134 The PLAIN authentication mechanism (RFC 2595) specifies that three strings be
46135 sent as one item of data (that is, one combined string containing two NUL
46136 separators). The data is sent either as part of the AUTH command, or
46137 subsequently in response to an empty prompt from the server.
46138 </para>
46139 <para>
46140 The second and third strings are a user name and a corresponding password.
46141 Using a single fixed user name and password as an example, this could be
46142 configured as follows:
46143 </para>
46144 <literallayout class="monospaced">
46145 fixed_plain:
46146   driver = plaintext
46147   public_name = PLAIN
46148   server_prompts = :
46149   server_condition = \
46150     ${if and {{eq{$auth2}{username}}{eq{$auth3}{mysecret}}}}
46151   server_set_id = $auth2
46152 </literallayout>
46153 <para>
46154 Note that the default result strings from <option>if</option> (<quote>true</quote> or an empty string)
46155 are exactly what we want here, so they need not be specified. Obviously, if the
46156 password contains expansion-significant characters such as dollar, backslash,
46157 or closing brace, they have to be escaped.
46158 </para>
46159 <para>
46160 The <option>server_prompts</option> setting specifies a single, empty prompt (empty items at
46161 the end of a string list are ignored). If all the data comes as part of the
46162 AUTH command, as is commonly the case, the prompt is not used. This
46163 authenticator is advertised in the response to EHLO as
46164 </para>
46165 <literallayout class="monospaced">
46166 250-AUTH PLAIN
46167 </literallayout>
46168 <para>
46169 and a client host can authenticate itself by sending the command
46170 </para>
46171 <literallayout class="monospaced">
46172 AUTH PLAIN AHVzZXJuYW1lAG15c2VjcmV0
46173 </literallayout>
46174 <para>
46175 As this contains three strings (more than the number of prompts), no further
46176 data is required from the client. Alternatively, the client may just send
46177 </para>
46178 <literallayout class="monospaced">
46179 AUTH PLAIN
46180 </literallayout>
46181 <para>
46182 to initiate authentication, in which case the server replies with an empty
46183 prompt. The client must respond with the combined data string.
46184 </para>
46185 <para>
46186 The data string is base64 encoded, as required by the RFC. This example,
46187 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;
46188 represents a zero byte. This is split up into three strings, the first of which
46189 is empty. The <option>server_condition</option> option in the authenticator checks that the
46190 second two are <literal>username</literal> and <literal>mysecret</literal> respectively.
46191 </para>
46192 <para>
46193 Having just one fixed user name and password, as in this example, is not very
46194 realistic, though for a small organization with only a handful of
46195 authenticating clients it could make sense.
46196 </para>
46197 <para>
46198 A more sophisticated instance of this authenticator could use the user name in
46199 <varname>$auth2</varname> to look up a password in a file or database, and maybe do an encrypted
46200 comparison (see <option>crypteq</option> in chapter <xref linkend="CHAPexpand"/>). Here is a example of
46201 this approach, where the passwords are looked up in a DBM file. <emphasis role="bold">Warning</emphasis>:
46202 This is an incorrect example:
46203 </para>
46204 <literallayout class="monospaced">
46205 server_condition = \
46206   ${if eq{$auth3}{${lookup{$auth2}dbm{/etc/authpwd}}}}
46207 </literallayout>
46208 <para>
46209 The expansion uses the user name (<varname>$auth2</varname>) as the key to look up a password,
46210 which it then compares to the supplied password (<varname>$auth3</varname>). Why is this example
46211 incorrect? It works fine for existing users, but consider what happens if a
46212 non-existent user name is given. The lookup fails, but as no success/failure
46213 strings are given for the lookup, it yields an empty string. Thus, to defeat
46214 the authentication, all a client has to do is to supply a non-existent user
46215 name and an empty password. The correct way of writing this test is:
46216 </para>
46217 <literallayout class="monospaced">
46218 server_condition = ${lookup{$auth2}dbm{/etc/authpwd}\
46219   {${if eq{$value}{$auth3}}} {false}}
46220 </literallayout>
46221 <para>
46222 In this case, if the lookup succeeds, the result is checked; if the lookup
46223 fails, <quote>false</quote> is returned and authentication fails. If <option>crypteq</option> is being
46224 used instead of <option>eq</option>, the first example is in fact safe, because <option>crypteq</option>
46225 always fails if its second argument is empty. However, the second way of
46226 writing the test makes the logic clearer.
46227 </para>
46228 </section>
46229 <section id="SECID173">
46230 <title>The LOGIN authentication mechanism</title>
46231 <para>
46232 <indexterm role="concept">
46233 <primary>LOGIN authentication mechanism</primary>
46234 </indexterm>
46235 <indexterm role="concept">
46236 <primary>authentication</primary>
46237 <secondary>LOGIN mechanism</secondary>
46238 </indexterm>
46239 The LOGIN authentication mechanism is not documented in any RFC, but is in use
46240 in a number of programs. No data is sent with the AUTH command. Instead, a
46241 user name and password are supplied separately, in response to prompts. The
46242 plaintext authenticator can be configured to support this as in this example:
46243 </para>
46244 <literallayout class="monospaced">
46245 fixed_login:
46246   driver = plaintext
46247   public_name = LOGIN
46248   server_prompts = User Name : Password
46249   server_condition = \
46250     ${if and {{eq{$auth1}{username}}{eq{$auth2}{mysecret}}}}
46251   server_set_id = $auth1
46252 </literallayout>
46253 <para>
46254 Because of the way plaintext operates, this authenticator accepts data supplied
46255 with the AUTH command (in contravention of the specification of LOGIN), but
46256 if the client does not supply it (as is the case for LOGIN clients), the prompt
46257 strings are used to obtain two data items.
46258 </para>
46259 <para revisionflag="changed">
46260 Some clients are very particular about the precise text of the prompts. For
46261 example, Outlook Express is reported to recognize only <quote>Username:</quote> and
46262 <quote>Password:</quote>. Here is an example of a LOGIN authenticator that uses those
46263 strings. It uses the <option>ldapauth</option> expansion condition to check the user
46264 name and password by binding to an LDAP server:
46265 </para>
46266 <literallayout class="monospaced" revisionflag="changed">
46267 login:
46268   driver = plaintext
46269   public_name = LOGIN
46270   server_prompts = Username:: : Password::
46271   server_condition = ${if and{{ \
46272     !eq{}{$auth1} }{ \
46273     ldapauth{user="cn=${quote_ldap_dn:$auth1},ou=people,o=example.org" \
46274              pass=${quote:$auth2} \
46275              ldap://ldap.example.org/} }} }
46276   server_set_id = uid=$auth1,ou=people,o=example.org
46277 </literallayout>
46278 <para revisionflag="changed">
46279 We have to check that the username is not empty before using it, because LDAP
46280 does not permit empty DN components. We must also use the <option>quote_ldap_dn</option>
46281 operator to correctly quote the DN for authentication. However, the basic
46282 <option>quote</option> operator, rather than any of the LDAP quoting operators, is the
46283 correct one to use for the password, because quoting is needed only to make
46284 the password conform to the Exim syntax. At the LDAP level, the password is an
46285 uninterpreted string.
46286 </para>
46287 </section>
46288 <section id="SECID174">
46289 <title>Support for different kinds of authentication</title>
46290 <para>
46291 A number of string expansion features are provided for the purpose of
46292 interfacing to different ways of user authentication. These include checking
46293 traditionally encrypted passwords from <filename>/etc/passwd</filename> (or equivalent), PAM,
46294 Radius, <option>ldapauth</option>, <emphasis>pwcheck</emphasis>, and <emphasis>saslauthd</emphasis>. For details see section
46295 <xref linkend="SECTexpcond"/>.
46296 </para>
46297 </section>
46298 <section id="SECID175">
46299 <title>Using plaintext in a client</title>
46300 <para>
46301 <indexterm role="concept">
46302 <primary>options</primary>
46303 <secondary><command>plaintext</command> authenticator (client)</secondary>
46304 </indexterm>
46305 The <command>plaintext</command> authenticator has two client options:
46306 </para>
46307 <para>
46308 <indexterm role="option">
46309 <primary><option>client_ignore_invalid_base64</option></primary>
46310 </indexterm>
46311 </para>
46312 <informaltable frame="all">
46313 <tgroup cols="4" colsep="0" rowsep="0">
46314 <colspec colwidth="8*" align="left"/>
46315 <colspec colwidth="6*" align="center"/>
46316 <colspec colwidth="6*" align="center"/>
46317 <colspec colwidth="6*" align="right"/>
46318 <tbody>
46319 <row>
46320 <entry><option>client_ignore_invalid_base64</option></entry>
46321 <entry>Use: <emphasis>plaintext</emphasis></entry>
46322 <entry>Type: <emphasis>boolean</emphasis></entry>
46323 <entry>Default: <emphasis>false</emphasis></entry>
46324 </row>
46325 </tbody>
46326 </tgroup>
46327 </informaltable>
46328 <para>
46329 If the client receives a server prompt that is not a valid base64 string,
46330 authentication is abandoned by default. However, if this option is set true,
46331 the error in the challenge is ignored and the client sends the response as
46332 usual.
46333 </para>
46334 <para>
46335 <indexterm role="option">
46336 <primary><option>client_send</option></primary>
46337 </indexterm>
46338 </para>
46339 <informaltable frame="all">
46340 <tgroup cols="4" colsep="0" rowsep="0">
46341 <colspec colwidth="8*" align="left"/>
46342 <colspec colwidth="6*" align="center"/>
46343 <colspec colwidth="6*" align="center"/>
46344 <colspec colwidth="6*" align="right"/>
46345 <tbody>
46346 <row>
46347 <entry><option>client_send</option></entry>
46348 <entry>Use: <emphasis>plaintext</emphasis></entry>
46349 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46350 <entry>Default: <emphasis>unset</emphasis></entry>
46351 </row>
46352 </tbody>
46353 </tgroup>
46354 </informaltable>
46355 <para>
46356 The string is a colon-separated list of authentication data strings. Each
46357 string is independently expanded before being sent to the server. The first
46358 string is sent with the AUTH command; any more strings are sent in response
46359 to prompts from the server. Before each string is expanded, the value of the
46360 most recent prompt is placed in the next <varname>$auth</varname>&lt;<emphasis>n</emphasis>&gt; variable, starting
46361 with <varname>$auth1</varname> for the first prompt. Up to three prompts are stored in this
46362 way. Thus, the prompt that is received in response to sending the first string
46363 (with the AUTH command) can be used in the expansion of the second string, and
46364 so on. If an invalid base64 string is received when
46365 <option>client_ignore_invalid_base64</option> is set, an empty string is put in the
46366 <varname>$auth</varname>&lt;<emphasis>n</emphasis>&gt; variable.
46367 </para>
46368 <para>
46369 <emphasis role="bold">Note</emphasis>: You cannot use expansion to create multiple strings, because
46370 splitting takes priority and happens first.
46371 </para>
46372 <para>
46373 Because the PLAIN authentication mechanism requires NUL (binary zero) bytes in
46374 the data, further processing is applied to each string before it is sent. If
46375 there are any single circumflex characters in the string, they are converted to
46376 NULs. Should an actual circumflex be required as data, it must be doubled in
46377 the string.
46378 </para>
46379 <para>
46380 This is an example of a client configuration that implements the PLAIN
46381 authentication mechanism with a fixed user name and password:
46382 </para>
46383 <literallayout class="monospaced">
46384 fixed_plain:
46385   driver = plaintext
46386   public_name = PLAIN
46387   client_send = ^username^mysecret
46388 </literallayout>
46389 <para>
46390 The lack of colons means that the entire text is sent with the AUTH
46391 command, with the circumflex characters converted to NULs. A similar example
46392 that uses the LOGIN mechanism is:
46393 </para>
46394 <literallayout class="monospaced">
46395 fixed_login:
46396   driver = plaintext
46397   public_name = LOGIN
46398   client_send = : username : mysecret
46399 </literallayout>
46400 <para>
46401 The initial colon means that the first string is empty, so no data is sent with
46402 the AUTH command itself. The remaining strings are sent in response to
46403 prompts.
46404 <indexterm role="concept" startref="IIDplaiauth1" class="endofrange"/>
46405 <indexterm role="concept" startref="IIDplaiauth2" class="endofrange"/>
46406 </para>
46407 </section>
46408 </chapter>
46409
46410 <chapter id="CHID9">
46411 <title>The cram_md5 authenticator</title>
46412 <para>
46413 <indexterm role="concept" id="IIDcramauth1" class="startofrange">
46414 <primary><command>cram_md5</command> authenticator</primary>
46415 </indexterm>
46416 <indexterm role="concept" id="IIDcramauth2" class="startofrange">
46417 <primary>authenticators</primary>
46418 <secondary><command>cram_md5</command></secondary>
46419 </indexterm>
46420 <indexterm role="concept">
46421 <primary>CRAM-MD5 authentication mechanism</primary>
46422 </indexterm>
46423 <indexterm role="concept">
46424 <primary>authentication</primary>
46425 <secondary>CRAM-MD5 mechanism</secondary>
46426 </indexterm>
46427 The CRAM-MD5 authentication mechanism is described in RFC 2195. The server
46428 sends a challenge string to the client, and the response consists of a user
46429 name and the CRAM-MD5 digest of the challenge string combined with a secret
46430 string (password) which is known to both server and client. Thus, the secret
46431 is not sent over the network as plain text, which makes this authenticator more
46432 secure than <command>plaintext</command>. However, the downside is that the secret has to be
46433 available in plain text at either end.
46434 </para>
46435 <section id="SECID176">
46436 <title>Using cram_md5 as a server</title>
46437 <para>
46438 <indexterm role="concept">
46439 <primary>options</primary>
46440 <secondary><command>cram_md5</command> authenticator (server)</secondary>
46441 </indexterm>
46442 This authenticator has one server option, which must be set to configure the
46443 authenticator as a server:
46444 </para>
46445 <para>
46446 <indexterm role="option">
46447 <primary><option>server_secret</option></primary>
46448 </indexterm>
46449 </para>
46450 <informaltable frame="all">
46451 <tgroup cols="4" colsep="0" rowsep="0">
46452 <colspec colwidth="8*" align="left"/>
46453 <colspec colwidth="6*" align="center"/>
46454 <colspec colwidth="6*" align="center"/>
46455 <colspec colwidth="6*" align="right"/>
46456 <tbody>
46457 <row>
46458 <entry><option>server_secret</option></entry>
46459 <entry>Use: <emphasis>cram_md5</emphasis></entry>
46460 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46461 <entry>Default: <emphasis>unset</emphasis></entry>
46462 </row>
46463 </tbody>
46464 </tgroup>
46465 </informaltable>
46466 <para>
46467 <indexterm role="concept">
46468 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
46469 <secondary>in <command>cram_md5</command> authenticator</secondary>
46470 </indexterm>
46471 When the server receives the client&#x2019;s response, the user name is placed in
46472 the expansion variable <varname>$auth1</varname>, and <option>server_secret</option> is expanded to
46473 obtain the password for that user. The server then computes the CRAM-MD5 digest
46474 that the client should have sent, and checks that it received the correct
46475 string. If the expansion of <option>server_secret</option> is forced to fail, authentication
46476 fails. If the expansion fails for some other reason, a temporary error code is
46477 returned to the client.
46478 </para>
46479 <para>
46480 For compatibility with previous releases of Exim, the user name is also placed
46481 in <varname>$1</varname>. However, the use of this variables for this purpose is now
46482 deprecated, as it can lead to confusion in string expansions that also use
46483 numeric variables for other things.
46484 </para>
46485 <para>
46486 For example, the following authenticator checks that the user name given by the
46487 client is <quote>ph10</quote>, and if so, uses <quote>secret</quote> as the password. For any other
46488 user name, authentication fails.
46489 </para>
46490 <literallayout class="monospaced">
46491 fixed_cram:
46492   driver = cram_md5
46493   public_name = CRAM-MD5
46494   server_secret = ${if eq{$auth1}{ph10}{secret}fail}
46495   server_set_id = $auth1
46496 </literallayout>
46497 <para>
46498 <indexterm role="variable">
46499 <primary><varname>$authenticated_id</varname></primary>
46500 </indexterm>
46501 If authentication succeeds, the setting of <option>server_set_id</option> preserves the user
46502 name in <varname>$authenticated_id</varname>. A more typical configuration might look up the
46503 secret string in a file, using the user name as the key. For example:
46504 </para>
46505 <literallayout class="monospaced">
46506 lookup_cram:
46507   driver = cram_md5
46508   public_name = CRAM-MD5
46509   server_secret = ${lookup{$auth1}lsearch{/etc/authpwd}\
46510                   {$value}fail}
46511   server_set_id = $auth1
46512 </literallayout>
46513 <para>
46514 Note that this expansion explicitly forces failure if the lookup fails
46515 because <varname>$auth1</varname> contains an unknown user name.
46516 </para>
46517 </section>
46518 <section id="SECID177">
46519 <title>Using cram_md5 as a client</title>
46520 <para>
46521 <indexterm role="concept">
46522 <primary>options</primary>
46523 <secondary><command>cram_md5</command> authenticator (client)</secondary>
46524 </indexterm>
46525 When used as a client, the <command>cram_md5</command> authenticator has two options:
46526 </para>
46527 <para>
46528 <indexterm role="option">
46529 <primary><option>client_name</option></primary>
46530 </indexterm>
46531 </para>
46532 <informaltable frame="all">
46533 <tgroup cols="4" colsep="0" rowsep="0">
46534 <colspec colwidth="8*" align="left"/>
46535 <colspec colwidth="6*" align="center"/>
46536 <colspec colwidth="6*" align="center"/>
46537 <colspec colwidth="6*" align="right"/>
46538 <tbody>
46539 <row>
46540 <entry><option>client_name</option></entry>
46541 <entry>Use: <emphasis>cram_md5</emphasis></entry>
46542 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46543 <entry>Default: <emphasis>the primary host name</emphasis></entry>
46544 </row>
46545 </tbody>
46546 </tgroup>
46547 </informaltable>
46548 <para>
46549 This string is expanded, and the result used as the user name data when
46550 computing the response to the server&#x2019;s challenge.
46551 </para>
46552 <para>
46553 <indexterm role="option">
46554 <primary><option>client_secret</option></primary>
46555 </indexterm>
46556 </para>
46557 <informaltable frame="all">
46558 <tgroup cols="4" colsep="0" rowsep="0">
46559 <colspec colwidth="8*" align="left"/>
46560 <colspec colwidth="6*" align="center"/>
46561 <colspec colwidth="6*" align="center"/>
46562 <colspec colwidth="6*" align="right"/>
46563 <tbody>
46564 <row>
46565 <entry><option>client_secret</option></entry>
46566 <entry>Use: <emphasis>cram_md5</emphasis></entry>
46567 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46568 <entry>Default: <emphasis>unset</emphasis></entry>
46569 </row>
46570 </tbody>
46571 </tgroup>
46572 </informaltable>
46573 <para>
46574 This option must be set for the authenticator to work as a client. Its value is
46575 expanded and the result used as the secret string when computing the response.
46576 </para>
46577 <para>
46578 <indexterm role="variable">
46579 <primary><varname>$host</varname></primary>
46580 </indexterm>
46581 <indexterm role="variable">
46582 <primary><varname>$host_address</varname></primary>
46583 </indexterm>
46584 Different user names and secrets can be used for different servers by referring
46585 to <varname>$host</varname> or <varname>$host_address</varname> in the options. Forced failure of either
46586 expansion string is treated as an indication that this authenticator is not
46587 prepared to handle this case. Exim moves on to the next configured client
46588 authenticator. Any other expansion failure causes Exim to give up trying to
46589 send the message to the current server.
46590 </para>
46591 <para>
46592 A simple example configuration of a <command>cram_md5</command> authenticator, using fixed
46593 strings, is:
46594 </para>
46595 <literallayout class="monospaced">
46596 fixed_cram:
46597   driver = cram_md5
46598   public_name = CRAM-MD5
46599   client_name = ph10
46600   client_secret = secret
46601 </literallayout>
46602 <para>
46603 <indexterm role="concept" startref="IIDcramauth1" class="endofrange"/>
46604 <indexterm role="concept" startref="IIDcramauth2" class="endofrange"/>
46605 </para>
46606 </section>
46607 </chapter>
46608
46609 <chapter id="CHID10">
46610 <title>The cyrus_sasl authenticator</title>
46611 <para>
46612 <indexterm role="concept" id="IIDcyrauth1" class="startofrange">
46613 <primary><command>cyrus_sasl</command> authenticator</primary>
46614 </indexterm>
46615 <indexterm role="concept" id="IIDcyrauth2" class="startofrange">
46616 <primary>authenticators</primary>
46617 <secondary><command>cyrus_sasl</command></secondary>
46618 </indexterm>
46619 <indexterm role="concept">
46620 <primary>Cyrus</primary>
46621 <secondary>SASL library</secondary>
46622 </indexterm>
46623 <indexterm role="concept">
46624 <primary>Kerberos</primary>
46625 </indexterm>
46626 The code for this authenticator was provided by Matthew Byng-Maddick of A L
46627 Digital Ltd (<emphasis role="bold"><ulink url="http://www.aldigital.co.uk">http://www.aldigital.co.uk</ulink></emphasis>).
46628 </para>
46629 <para>
46630 The <command>cyrus_sasl</command> authenticator provides server support for the Cyrus SASL
46631 library implementation of the RFC 2222 (<quote>Simple Authentication and Security
46632 Layer</quote>). This library supports a number of authentication mechanisms,
46633 including PLAIN and LOGIN, but also several others that Exim does not support
46634 directly. In particular, there is support for Kerberos authentication.
46635 </para>
46636 <para>
46637 The <command>cyrus_sasl</command> authenticator provides a gatewaying mechanism directly to
46638 the Cyrus interface, so if your Cyrus library can do, for example, CRAM-MD5,
46639 then so can the <command>cyrus_sasl</command> authenticator. By default it uses the public
46640 name of the driver to determine which mechanism to support.
46641 </para>
46642 <para>
46643 Where access to some kind of secret file is required, for example in GSSAPI
46644 or CRAM-MD5, it is worth noting that the authenticator runs as the Exim
46645 user, and that the Cyrus SASL library has no way of escalating privileges
46646 by default. You may also find you need to set environment variables,
46647 depending on the driver you are using.
46648 </para>
46649 <para>
46650 The application name provided by Exim is <quote>exim</quote>, so various SASL options may
46651 be set in <filename>exim.conf</filename> in your SASL directory. If you are using GSSAPI for
46652 Kerberos, note that because of limitations in the GSSAPI interface,
46653 changing the server keytab might need to be communicated down to the Kerberos
46654 layer independently. The mechanism for doing so is dependent upon the Kerberos
46655 implementation. For example, for Heimdal, the environment variable KRB5_KTNAME
46656 may be set to point to an alternative keytab file. Exim will pass this
46657 variable through from its own inherited environment when started as root or the
46658 Exim user. The keytab file needs to be readable by the Exim user.
46659 </para>
46660 <section id="SECID178">
46661 <title>Using cyrus_sasl as a server</title>
46662 <para>
46663 The <command>cyrus_sasl</command> authenticator has four private options. It puts the username
46664 (on a successful authentication) into <varname>$auth1</varname>. For compatibility with
46665 previous releases of Exim, the username is also placed in <varname>$1</varname>. However, the
46666 use of this variable for this purpose is now deprecated, as it can lead to
46667 confusion in string expansions that also use numeric variables for other
46668 things.
46669 </para>
46670 <para>
46671 <indexterm role="option">
46672 <primary><option>server_hostname</option></primary>
46673 </indexterm>
46674 </para>
46675 <informaltable frame="all">
46676 <tgroup cols="4" colsep="0" rowsep="0">
46677 <colspec colwidth="8*" align="left"/>
46678 <colspec colwidth="6*" align="center"/>
46679 <colspec colwidth="6*" align="center"/>
46680 <colspec colwidth="6*" align="right"/>
46681 <tbody>
46682 <row>
46683 <entry><option>server_hostname</option></entry>
46684 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
46685 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46686 <entry>Default: <emphasis>see below</emphasis></entry>
46687 </row>
46688 </tbody>
46689 </tgroup>
46690 </informaltable>
46691 <para>
46692 This option selects the hostname that is used when communicating with the
46693 library. The default value is <literal>$primary_hostname</literal>. It is up to the underlying
46694 SASL plug-in what it does with this data.
46695 </para>
46696 <para>
46697 <indexterm role="option">
46698 <primary><option>server_mech</option></primary>
46699 </indexterm>
46700 </para>
46701 <informaltable frame="all">
46702 <tgroup cols="4" colsep="0" rowsep="0">
46703 <colspec colwidth="8*" align="left"/>
46704 <colspec colwidth="6*" align="center"/>
46705 <colspec colwidth="6*" align="center"/>
46706 <colspec colwidth="6*" align="right"/>
46707 <tbody>
46708 <row>
46709 <entry><option>server_mech</option></entry>
46710 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
46711 <entry>Type: <emphasis>string</emphasis></entry>
46712 <entry>Default: <emphasis>see below</emphasis></entry>
46713 </row>
46714 </tbody>
46715 </tgroup>
46716 </informaltable>
46717 <para>
46718 This option selects the authentication mechanism this driver should use. The
46719 default is the value of the generic <option>public_name</option> option. This option allows
46720 you to use a different underlying mechanism from the advertised name. For
46721 example:
46722 </para>
46723 <literallayout class="monospaced">
46724 sasl:
46725   driver = cyrus_sasl
46726   public_name = X-ANYTHING
46727   server_mech = CRAM-MD5
46728   server_set_id = $auth1
46729 </literallayout>
46730 <para>
46731 <indexterm role="option">
46732 <primary><option>server_realm</option></primary>
46733 </indexterm>
46734 </para>
46735 <informaltable frame="all">
46736 <tgroup cols="4" colsep="0" rowsep="0">
46737 <colspec colwidth="8*" align="left"/>
46738 <colspec colwidth="6*" align="center"/>
46739 <colspec colwidth="6*" align="center"/>
46740 <colspec colwidth="6*" align="right"/>
46741 <tbody>
46742 <row>
46743 <entry><option>server_realm</option></entry>
46744 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
46745 <entry>Type: <emphasis>string</emphasis></entry>
46746 <entry>Default: <emphasis>unset</emphasis></entry>
46747 </row>
46748 </tbody>
46749 </tgroup>
46750 </informaltable>
46751 <para>
46752 This specifies the SASL realm that the server claims to be in.
46753 </para>
46754 <para>
46755 <indexterm role="option">
46756 <primary><option>server_service</option></primary>
46757 </indexterm>
46758 </para>
46759 <informaltable frame="all">
46760 <tgroup cols="4" colsep="0" rowsep="0">
46761 <colspec colwidth="8*" align="left"/>
46762 <colspec colwidth="6*" align="center"/>
46763 <colspec colwidth="6*" align="center"/>
46764 <colspec colwidth="6*" align="right"/>
46765 <tbody>
46766 <row>
46767 <entry><option>server_service</option></entry>
46768 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
46769 <entry>Type: <emphasis>string</emphasis></entry>
46770 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
46771 </row>
46772 </tbody>
46773 </tgroup>
46774 </informaltable>
46775 <para>
46776 This is the SASL service that the server claims to implement.
46777 </para>
46778 <para>
46779 For straightforward cases, you do not need to set any of the authenticator&#x2019;s
46780 private options. All you need to do is to specify an appropriate mechanism as
46781 the public name. Thus, if you have a SASL library that supports CRAM-MD5 and
46782 PLAIN, you could have two authenticators as follows:
46783 </para>
46784 <literallayout class="monospaced">
46785 sasl_cram_md5:
46786   driver = cyrus_sasl
46787   public_name = CRAM-MD5
46788   server_set_id = $auth1
46789
46790 sasl_plain:
46791   driver = cyrus_sasl
46792   public_name = PLAIN
46793   server_set_id = $auth2
46794 </literallayout>
46795 <para>
46796 Cyrus SASL does implement the LOGIN authentication method, even though it is
46797 not a standard method. It is disabled by default in the source distribution,
46798 but it is present in many binary distributions.
46799 <indexterm role="concept" startref="IIDcyrauth1" class="endofrange"/>
46800 <indexterm role="concept" startref="IIDcyrauth2" class="endofrange"/>
46801 </para>
46802 </section>
46803 </chapter>
46804
46805 <chapter id="CHAPdovecot">
46806 <title>The dovecot authenticator</title>
46807 <para>
46808 <indexterm role="concept" id="IIDdcotauth1" class="startofrange">
46809 <primary><command>dovecot</command> authenticator</primary>
46810 </indexterm>
46811 <indexterm role="concept" id="IIDdcotauth2" class="startofrange">
46812 <primary>authenticators</primary>
46813 <secondary><command>dovecot</command></secondary>
46814 </indexterm>
46815 This authenticator is an interface to the authentication facility of the
46816 Dovecot POP/IMAP server, which can support a number of authentication methods.
46817 If you are using Dovecot to authenticate POP/IMAP clients, it might be helpful
46818 to use the same mechanisms for SMTP authentication. This is a server
46819 authenticator only. There is only one option:
46820 </para>
46821 <para>
46822 <indexterm role="option">
46823 <primary><option>server_socket</option></primary>
46824 </indexterm>
46825 </para>
46826 <informaltable frame="all">
46827 <tgroup cols="4" colsep="0" rowsep="0">
46828 <colspec colwidth="8*" align="left"/>
46829 <colspec colwidth="6*" align="center"/>
46830 <colspec colwidth="6*" align="center"/>
46831 <colspec colwidth="6*" align="right"/>
46832 <tbody>
46833 <row>
46834 <entry><option>server_socket</option></entry>
46835 <entry>Use: <emphasis>dovecot</emphasis></entry>
46836 <entry>Type: <emphasis>string</emphasis></entry>
46837 <entry>Default: <emphasis>unset</emphasis></entry>
46838 </row>
46839 </tbody>
46840 </tgroup>
46841 </informaltable>
46842 <para>
46843 This option must specify the socket that is the interface to Dovecot
46844 authentication. The <option>public_name</option> option must specify an authentication
46845 mechanism that Dovecot is configured to support. You can have several
46846 authenticators for different mechanisms. For example:
46847 </para>
46848 <literallayout class="monospaced">
46849 dovecot_plain:
46850   driver = dovecot
46851   public_name = PLAIN
46852   server_socket = /var/run/dovecot/auth-client
46853   server_set_id = $auth2
46854
46855 dovecot_ntlm:
46856   driver = dovecot
46857   public_name = NTLM
46858   server_socket = /var/run/dovecot/auth-client
46859   server_set_id = $auth1
46860 </literallayout>
46861 <para>
46862 If the SMTP connection is encrypted, or if <varname>$sender_host_address</varname> is equal to
46863 <varname>$received_ip_address</varname> (that is, the connection is local), the <quote>secured</quote>
46864 option is passed in the Dovecot authentication command. If, for a TLS
46865 connection, a client certificate has been verified, the <quote>valid-client-cert</quote>
46866 option is passed. When authentication succeeds, the identity of the user
46867 who authenticated is placed in <varname>$auth1</varname>.
46868 <indexterm role="concept" startref="IIDdcotauth1" class="endofrange"/>
46869 <indexterm role="concept" startref="IIDdcotauth2" class="endofrange"/>
46870 </para>
46871 </chapter>
46872
46873 <chapter id="CHAPspa">
46874 <title>The spa authenticator</title>
46875 <para>
46876 <indexterm role="concept" id="IIDspaauth1" class="startofrange">
46877 <primary><command>spa</command> authenticator</primary>
46878 </indexterm>
46879 <indexterm role="concept" id="IIDspaauth2" class="startofrange">
46880 <primary>authenticators</primary>
46881 <secondary><command>spa</command></secondary>
46882 </indexterm>
46883 <indexterm role="concept">
46884 <primary>authentication</primary>
46885 <secondary>Microsoft Secure Password</secondary>
46886 </indexterm>
46887 <indexterm role="concept">
46888 <primary>authentication</primary>
46889 <secondary>NTLM</secondary>
46890 </indexterm>
46891 <indexterm role="concept">
46892 <primary>Microsoft Secure Password Authentication</primary>
46893 </indexterm>
46894 <indexterm role="concept">
46895 <primary>NTLM authentication</primary>
46896 </indexterm>
46897 The <command>spa</command> authenticator provides client support for Microsoft&#x2019;s <emphasis>Secure
46898 Password Authentication</emphasis> mechanism,
46899 which is also sometimes known as NTLM (NT LanMan). The code for client side of
46900 this authenticator was contributed by Marc Prud&#x2019;hommeaux, and much of it is
46901 taken from the Samba project (<emphasis role="bold"><ulink url="http://www.samba.org">http://www.samba.org</ulink></emphasis>). The code for the
46902 server side was subsequently contributed by Tom Kistner. The mechanism works as
46903 follows:
46904 </para>
46905 <itemizedlist>
46906 <listitem>
46907 <para>
46908 After the AUTH command has been accepted, the client sends an SPA
46909 authentication request based on the user name and optional domain.
46910 </para>
46911 </listitem>
46912 <listitem>
46913 <para>
46914 The server sends back a challenge.
46915 </para>
46916 </listitem>
46917 <listitem>
46918 <para>
46919 The client builds a challenge response which makes use of the user&#x2019;s password
46920 and sends it to the server, which then accepts or rejects it.
46921 </para>
46922 </listitem>
46923 </itemizedlist>
46924 <para>
46925 Encryption is used to protect the password in transit.
46926 </para>
46927 <section id="SECID179">
46928 <title>Using spa as a server</title>
46929 <para>
46930 <indexterm role="concept">
46931 <primary>options</primary>
46932 <secondary><command>spa</command> authenticator (server)</secondary>
46933 </indexterm>
46934 The <command>spa</command> authenticator has just one server option:
46935 </para>
46936 <para>
46937 <indexterm role="option">
46938 <primary><option>server_password</option></primary>
46939 </indexterm>
46940 </para>
46941 <informaltable frame="all">
46942 <tgroup cols="4" colsep="0" rowsep="0">
46943 <colspec colwidth="8*" align="left"/>
46944 <colspec colwidth="6*" align="center"/>
46945 <colspec colwidth="6*" align="center"/>
46946 <colspec colwidth="6*" align="right"/>
46947 <tbody>
46948 <row>
46949 <entry><option>server_password</option></entry>
46950 <entry>Use: <emphasis>spa</emphasis></entry>
46951 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46952 <entry>Default: <emphasis>unset</emphasis></entry>
46953 </row>
46954 </tbody>
46955 </tgroup>
46956 </informaltable>
46957 <para>
46958 <indexterm role="concept">
46959 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
46960 <secondary>in <command>spa</command> authenticator</secondary>
46961 </indexterm>
46962 This option is expanded, and the result must be the cleartext password for the
46963 authenticating user, whose name is at this point in <varname>$auth1</varname>. For
46964 compatibility with previous releases of Exim, the user name is also placed in
46965 <varname>$1</varname>. However, the use of this variable for this purpose is now deprecated, as
46966 it can lead to confusion in string expansions that also use numeric variables
46967 for other things. For example:
46968 </para>
46969 <literallayout class="monospaced">
46970 spa:
46971   driver = spa
46972   public_name = NTLM
46973   server_password = \
46974     ${lookup{$auth1}lsearch{/etc/exim/spa_clearpass}{$value}fail}
46975 </literallayout>
46976 <para>
46977 If the expansion is forced to fail, authentication fails. Any other expansion
46978 failure causes a temporary error code to be returned.
46979 </para>
46980 </section>
46981 <section id="SECID180">
46982 <title>Using spa as a client</title>
46983 <para>
46984 <indexterm role="concept">
46985 <primary>options</primary>
46986 <secondary><command>spa</command> authenticator (client)</secondary>
46987 </indexterm>
46988 The <command>spa</command> authenticator has the following client options:
46989 </para>
46990 <para>
46991 <indexterm role="option">
46992 <primary><option>client_domain</option></primary>
46993 </indexterm>
46994 </para>
46995 <informaltable frame="all">
46996 <tgroup cols="4" colsep="0" rowsep="0">
46997 <colspec colwidth="8*" align="left"/>
46998 <colspec colwidth="6*" align="center"/>
46999 <colspec colwidth="6*" align="center"/>
47000 <colspec colwidth="6*" align="right"/>
47001 <tbody>
47002 <row>
47003 <entry><option>client_domain</option></entry>
47004 <entry>Use: <emphasis>spa</emphasis></entry>
47005 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47006 <entry>Default: <emphasis>unset</emphasis></entry>
47007 </row>
47008 </tbody>
47009 </tgroup>
47010 </informaltable>
47011 <para>
47012 This option specifies an optional domain for the authentication.
47013 </para>
47014 <para>
47015 <indexterm role="option">
47016 <primary><option>client_password</option></primary>
47017 </indexterm>
47018 </para>
47019 <informaltable frame="all">
47020 <tgroup cols="4" colsep="0" rowsep="0">
47021 <colspec colwidth="8*" align="left"/>
47022 <colspec colwidth="6*" align="center"/>
47023 <colspec colwidth="6*" align="center"/>
47024 <colspec colwidth="6*" align="right"/>
47025 <tbody>
47026 <row>
47027 <entry><option>client_password</option></entry>
47028 <entry>Use: <emphasis>spa</emphasis></entry>
47029 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47030 <entry>Default: <emphasis>unset</emphasis></entry>
47031 </row>
47032 </tbody>
47033 </tgroup>
47034 </informaltable>
47035 <para>
47036 This option specifies the user&#x2019;s password, and must be set.
47037 </para>
47038 <para>
47039 <indexterm role="option">
47040 <primary><option>client_username</option></primary>
47041 </indexterm>
47042 </para>
47043 <informaltable frame="all">
47044 <tgroup cols="4" colsep="0" rowsep="0">
47045 <colspec colwidth="8*" align="left"/>
47046 <colspec colwidth="6*" align="center"/>
47047 <colspec colwidth="6*" align="center"/>
47048 <colspec colwidth="6*" align="right"/>
47049 <tbody>
47050 <row>
47051 <entry><option>client_username</option></entry>
47052 <entry>Use: <emphasis>spa</emphasis></entry>
47053 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47054 <entry>Default: <emphasis>unset</emphasis></entry>
47055 </row>
47056 </tbody>
47057 </tgroup>
47058 </informaltable>
47059 <para>
47060 This option specifies the user name, and must be set. Here is an example of a
47061 configuration of this authenticator for use with the mail servers at
47062 <emphasis>msn.com</emphasis>:
47063 </para>
47064 <literallayout class="monospaced">
47065 msn:
47066   driver = spa
47067   public_name = MSN
47068   client_username = msn/msn_username
47069   client_password = msn_plaintext_password
47070   client_domain = DOMAIN_OR_UNSET
47071 </literallayout>
47072 <para>
47073 <indexterm role="concept" startref="IIDspaauth1" class="endofrange"/>
47074 <indexterm role="concept" startref="IIDspaauth2" class="endofrange"/>
47075 </para>
47076 </section>
47077 </chapter>
47078
47079 <chapter id="CHAPTLS">
47080 <title>Encrypted SMTP connections using TLS/SSL</title>
47081 <titleabbrev>Encrypted SMTP connections</titleabbrev>
47082 <para>
47083 <indexterm role="concept" id="IIDencsmtp1" class="startofrange">
47084 <primary>encryption</primary>
47085 <secondary>on SMTP connection</secondary>
47086 </indexterm>
47087 <indexterm role="concept" id="IIDencsmtp2" class="startofrange">
47088 <primary>SMTP</primary>
47089 <secondary>encryption</secondary>
47090 </indexterm>
47091 <indexterm role="concept">
47092 <primary>TLS</primary>
47093 <secondary>on SMTP connection</secondary>
47094 </indexterm>
47095 <indexterm role="concept">
47096 <primary>OpenSSL</primary>
47097 </indexterm>
47098 <indexterm role="concept">
47099 <primary>GnuTLS</primary>
47100 </indexterm>
47101 Support for TLS (Transport Layer Security), formerly known as SSL (Secure
47102 Sockets Layer), is implemented by making use of the OpenSSL library or the
47103 GnuTLS library (Exim requires GnuTLS release 1.0 or later). There is no
47104 cryptographic code in the Exim distribution itself for implementing TLS. In
47105 order to use this feature you must install OpenSSL or GnuTLS, and then build a
47106 version of Exim that includes TLS support (see section <xref linkend="SECTinctlsssl"/>).
47107 You also need to understand the basic concepts of encryption at a managerial
47108 level, and in particular, the way that public keys, private keys, and
47109 certificates are used.
47110 </para>
47111 <para>
47112 RFC 3207 defines how SMTP connections can make use of encryption. Once a
47113 connection is established, the client issues a STARTTLS command. If the
47114 server accepts this, the client and the server negotiate an encryption
47115 mechanism. If the negotiation succeeds, the data that subsequently passes
47116 between them is encrypted.
47117 </para>
47118 <para>
47119 Exim&#x2019;s ACLs can detect whether the current SMTP session is encrypted or not,
47120 and if so, what cipher suite is in use, whether the client supplied a
47121 certificate, and whether or not that certificate was verified. This makes it
47122 possible for an Exim server to deny or accept certain commands based on the
47123 encryption state.
47124 </para>
47125 <para>
47126 <emphasis role="bold">Warning</emphasis>: Certain types of firewall and certain anti-virus products can
47127 disrupt TLS connections. You need to turn off SMTP scanning for these products
47128 in order to get TLS to work.
47129 </para>
47130 <section id="SECID284">
47131 <title>Support for the legacy <quote>ssmtp</quote> (aka <quote>smtps</quote>) protocol</title>
47132 <para>
47133 <indexterm role="concept">
47134 <primary>ssmtp protocol</primary>
47135 </indexterm>
47136 <indexterm role="concept">
47137 <primary>smtps protocol</primary>
47138 </indexterm>
47139 <indexterm role="concept">
47140 <primary>SMTP</primary>
47141 <secondary>ssmtp protocol</secondary>
47142 </indexterm>
47143 <indexterm role="concept">
47144 <primary>SMTP</primary>
47145 <secondary>smtps protocol</secondary>
47146 </indexterm>
47147 Early implementations of encrypted SMTP used a different TCP port from normal
47148 SMTP, and expected an encryption negotiation to start immediately, instead of
47149 waiting for a STARTTLS command from the client using the standard SMTP
47150 port. The protocol was called <quote>ssmtp</quote> or <quote>smtps</quote>, and port 465 was
47151 allocated for this purpose.
47152 </para>
47153 <para>
47154 This approach was abandoned when encrypted SMTP was standardized, but there are
47155 still some legacy clients that use it. Exim supports these clients by means of
47156 the <option>tls_on_connect_ports</option> global option. Its value must be a list of port
47157 numbers; the most common use is expected to be:
47158 </para>
47159 <literallayout class="monospaced">
47160 tls_on_connect_ports = 465
47161 </literallayout>
47162 <para>
47163 The port numbers specified by this option apply to all SMTP connections, both
47164 via the daemon and via <emphasis>inetd</emphasis>. You still need to specify all the ports that
47165 the daemon uses (by setting <option>daemon_smtp_ports</option> or <option>local_interfaces</option> or
47166 the <option>-oX</option> command line option) because <option>tls_on_connect_ports</option> does not add
47167 an extra port &ndash; rather, it specifies different behaviour on a port that is
47168 defined elsewhere.
47169 </para>
47170 <para>
47171 There is also a <option>-tls-on-connect</option> command line option. This overrides
47172 <option>tls_on_connect_ports</option>; it forces the legacy behaviour for all ports.
47173 </para>
47174 </section>
47175 <section id="SECTopenvsgnu">
47176 <title>OpenSSL vs GnuTLS</title>
47177 <para>
47178 <indexterm role="concept">
47179 <primary>TLS</primary>
47180 <secondary>OpenSSL <emphasis>vs</emphasis> GnuTLS</secondary>
47181 </indexterm>
47182 The first TLS support in Exim was implemented using OpenSSL. Support for GnuTLS
47183 followed later, when the first versions of GnuTLS were released. To build Exim
47184 to use GnuTLS, you need to set
47185 </para>
47186 <literallayout class="monospaced">
47187 USE_GNUTLS=yes
47188 </literallayout>
47189 <para>
47190 in Local/Makefile, in addition to
47191 </para>
47192 <literallayout class="monospaced">
47193 SUPPORT_TLS=yes
47194 </literallayout>
47195 <para>
47196 You must also set TLS_LIBS and TLS_INCLUDE appropriately, so that the
47197 include files and libraries for GnuTLS can be found.
47198 </para>
47199 <para>
47200 There are some differences in usage when using GnuTLS instead of OpenSSL:
47201 </para>
47202 <itemizedlist>
47203 <listitem>
47204 <para>
47205 The <option>tls_verify_certificates</option> option must contain the name of a file, not the
47206 name of a directory (for OpenSSL it can be either).
47207 </para>
47208 </listitem>
47209 <listitem>
47210 <para>
47211 The <option>tls_dhparam</option> option is ignored, because early versions of GnuTLS had no
47212 facility for varying its Diffie-Hellman parameters. I understand that this has
47213 changed, but Exim has not been updated to provide this facility.
47214 </para>
47215 </listitem>
47216 <listitem>
47217 <para>
47218 <indexterm role="variable">
47219 <primary><varname>$tls_peerdn</varname></primary>
47220 </indexterm>
47221 Distinguished Name (DN) strings reported by the OpenSSL library use a slash for
47222 separating fields; GnuTLS uses commas, in accordance with RFC 2253. This
47223 affects the value of the <varname>$tls_peerdn</varname> variable.
47224 </para>
47225 </listitem>
47226 <listitem>
47227 <para>
47228 OpenSSL identifies cipher suites using hyphens as separators, for example:
47229 DES-CBC3-SHA. GnuTLS uses underscores, for example: RSA_ARCFOUR_SHA. What is
47230 more, OpenSSL complains if underscores are present in a cipher list. To make
47231 life simpler, Exim changes underscores to hyphens for OpenSSL and hyphens to
47232 underscores for GnuTLS when processing lists of cipher suites in the
47233 <option>tls_require_ciphers</option> options (the global option and the <command>smtp</command> transport
47234 option).
47235 </para>
47236 </listitem>
47237 <listitem>
47238 <para>
47239 The <option>tls_require_ciphers</option> options operate differently, as described in the
47240 sections <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
47241 </para>
47242 </listitem>
47243 </itemizedlist>
47244 </section>
47245 <section id="SECID181">
47246 <title>GnuTLS parameter computation</title>
47247 <para>
47248 GnuTLS uses D-H parameters that may take a substantial amount of time
47249 to compute. It is unreasonable to re-compute them for every TLS session.
47250 Therefore, Exim keeps this data in a file in its spool directory, called
47251 <filename>gnutls-params</filename>. The file is owned by the Exim user and is readable only by
47252 its owner. Every Exim process that start up GnuTLS reads the D-H
47253 parameters from this file. If the file does not exist, the first Exim process
47254 that needs it computes the data and writes it to a temporary file which is
47255 renamed once it is complete. It does not matter if several Exim processes do
47256 this simultaneously (apart from wasting a few resources). Once a file is in
47257 place, new Exim processes immediately start using it.
47258 </para>
47259 <para>
47260 For maximum security, the parameters that are stored in this file should be
47261 recalculated periodically, the frequency depending on your paranoia level.
47262 Arranging this is easy in principle; just delete the file when you want new
47263 values to be computed. However, there may be a problem. The calculation of new
47264 parameters needs random numbers, and these are obtained from <filename>/dev/random</filename>.
47265 If the system is not very active, <filename>/dev/random</filename> may delay returning data
47266 until enough randomness (entropy) is available. This may cause Exim to hang for
47267 a substantial amount of time, causing timeouts on incoming connections.
47268 </para>
47269 <para>
47270 The solution is to generate the parameters externally to Exim. They are stored
47271 in <filename>gnutls-params</filename> in PEM format, which means that they can be generated
47272 externally using the <command>certtool</command> command that is part of GnuTLS.
47273 </para>
47274 <para>
47275 To replace the parameters with new ones, instead of deleting the file
47276 and letting Exim re-create it, you can generate new parameters using
47277 <command>certtool</command> and, when this has been done, replace Exim&#x2019;s cache file by
47278 renaming. The relevant commands are something like this:
47279 </para>
47280 <literallayout class="monospaced">
47281 # rm -f new-params
47282 # touch new-params
47283 # chown exim:exim new-params
47284 # chmod 0400 new-params
47285 # certtool --generate-privkey --bits 512 &gt;new-params
47286 # echo "" &gt;&gt;new-params
47287 # certtool --generate-dh-params --bits 1024 &gt;&gt; new-params
47288 # mv new-params gnutls-params
47289 </literallayout>
47290 <para>
47291 If Exim never has to generate the parameters itself, the possibility of
47292 stalling is removed.
47293 </para>
47294 </section>
47295 <section id="SECTreqciphssl">
47296 <title>Requiring specific ciphers in OpenSSL</title>
47297 <para>
47298 <indexterm role="concept">
47299 <primary>TLS</primary>
47300 <secondary>requiring specific ciphers (OpenSSL)</secondary>
47301 </indexterm>
47302 <indexterm role="option">
47303 <primary><option>tls_require_ciphers</option></primary>
47304 <secondary>OpenSSL</secondary>
47305 </indexterm>
47306 There is a function in the OpenSSL library that can be passed a list of cipher
47307 suites before the cipher negotiation takes place. This specifies which ciphers
47308 are acceptable. The list is colon separated and may contain names like
47309 DES-CBC3-SHA. Exim passes the expanded value of <option>tls_require_ciphers</option>
47310 directly to this function call. The following quotation from the OpenSSL
47311 documentation specifies what forms of item are allowed in the cipher string:
47312 </para>
47313 <itemizedlist>
47314 <listitem>
47315 <para>
47316 It can consist of a single cipher suite such as RC4-SHA.
47317 </para>
47318 </listitem>
47319 <listitem>
47320 <para>
47321 It can represent a list of cipher suites containing a certain algorithm,
47322 or cipher suites of a certain type. For example SHA1 represents all
47323 ciphers suites using the digest algorithm SHA1 and SSLv3 represents all
47324 SSL v3 algorithms.
47325 </para>
47326 </listitem>
47327 <listitem>
47328 <para>
47329 Lists of cipher suites can be combined in a single cipher string using
47330 the + character. This is used as a logical and operation. For example
47331 SHA1+DES represents all cipher suites containing the SHA1 and the DES
47332 algorithms.
47333 </para>
47334 </listitem>
47335 </itemizedlist>
47336 <para>
47337 Each cipher string can be optionally preceded by one of the characters <literal>!</literal>,
47338 <literal>-</literal> or <literal>+</literal>.
47339 </para>
47340 <itemizedlist>
47341 <listitem>
47342 <para>
47343 If <literal>!</literal> is used, the ciphers are permanently deleted from the list. The
47344 ciphers deleted can never reappear in the list even if they are explicitly
47345 stated.
47346 </para>
47347 </listitem>
47348 <listitem>
47349 <para>
47350 If <literal>-</literal> is used, the ciphers are deleted from the list, but some or all
47351 of the ciphers can be added again by later options.
47352 </para>
47353 </listitem>
47354 <listitem>
47355 <para>
47356 If <literal>+</literal> is used, the ciphers are moved to the end of the list. This
47357 option does not add any new ciphers; it just moves matching existing ones.
47358 </para>
47359 </listitem>
47360 </itemizedlist>
47361 <para>
47362 If none of these characters is present, the string is interpreted as
47363 a list of ciphers to be appended to the current preference list. If the list
47364 includes any ciphers already present they will be ignored: that is, they will
47365 not be moved to the end of the list.
47366 </para>
47367 </section>
47368 <section id="SECTreqciphgnu">
47369 <title>Requiring specific ciphers or other parameters in GnuTLS</title>
47370 <para>
47371 <indexterm role="concept">
47372 <primary>GnuTLS</primary>
47373 <secondary>specifying parameters for</secondary>
47374 </indexterm>
47375 <indexterm role="concept">
47376 <primary>TLS</primary>
47377 <secondary>specifying ciphers (GnuTLS)</secondary>
47378 </indexterm>
47379 <indexterm role="concept">
47380 <primary>TLS</primary>
47381 <secondary>specifying key exchange methods (GnuTLS)</secondary>
47382 </indexterm>
47383 <indexterm role="concept">
47384 <primary>TLS</primary>
47385 <secondary>specifying MAC algorithms (GnuTLS)</secondary>
47386 </indexterm>
47387 <indexterm role="concept">
47388 <primary>TLS</primary>
47389 <secondary>specifying protocols (GnuTLS)</secondary>
47390 </indexterm>
47391 <indexterm role="option">
47392 <primary><option>tls_require_ciphers</option></primary>
47393 <secondary>GnuTLS</secondary>
47394 </indexterm>
47395 The GnuTLS library allows the caller to specify separate lists of permitted key
47396 exchange methods, main cipher algorithms, MAC algorithms, and protocols.
47397 Unfortunately, these lists are numerical, and the library does not have a
47398 function for turning names into numbers. Consequently, lists of recognized
47399 names have to be built into the application. The permitted key exchange
47400 methods, ciphers, and MAC algorithms may be used in any combination to form a
47401 cipher suite. This is unlike OpenSSL, where complete cipher suite names are
47402 passed to its control function.
47403 </para>
47404 <para>
47405 For compatibility with OpenSSL, the <option>tls_require_ciphers</option> option can be set
47406 to complete cipher suite names such as RSA_ARCFOUR_SHA, but for GnuTLS this
47407 option controls only the cipher algorithms. Exim searches each item in the
47408 list for the name of an available algorithm. For example, if the list
47409 contains RSA_AES_SHA, then AES is recognized, and the behaviour is exactly
47410 the same as if just AES were given.
47411 </para>
47412 <para>
47413 <indexterm role="option">
47414 <primary><option>gnutls_require_kx</option></primary>
47415 </indexterm>
47416 <indexterm role="option">
47417 <primary><option>gnutls_require_mac</option></primary>
47418 </indexterm>
47419 <indexterm role="option">
47420 <primary><option>gnutls_require_protocols</option></primary>
47421 </indexterm>
47422 There are additional options called <option>gnutls_require_kx</option>,
47423 <option>gnutls_require_mac</option>, and <option>gnutls_require_protocols</option> that can be used to
47424 restrict the key exchange methods, MAC algorithms, and protocols, respectively.
47425 These options are ignored if OpenSSL is in use.
47426 </para>
47427 <para>
47428 All four options are available as global options, controlling how Exim
47429 behaves as a server, and also as options of the <command>smtp</command> transport, controlling
47430 how Exim behaves as a client. All the values are string expanded. After
47431 expansion, the values must be colon-separated lists, though the separator
47432 can be changed in the usual way.
47433 </para>
47434 <para>
47435 Each of the four lists starts out with a default set of algorithms. If the
47436 first item in a list does <emphasis>not</emphasis> start with an exclamation mark, all the
47437 default items are deleted. In this case, only those that are explicitly
47438 specified can be used. If the first item in a list <emphasis>does</emphasis> start with an
47439 exclamation mark, the defaults are left on the list.
47440 </para>
47441 <para>
47442 Then, any item that starts with an exclamation mark causes the relevant
47443 entry to be removed from the list, and any item that does not start with an
47444 exclamation mark causes a new entry to be added to the list. Unrecognized
47445 items in the list are ignored. Thus:
47446 </para>
47447 <literallayout class="monospaced">
47448 tls_require_ciphers = !ARCFOUR
47449 </literallayout>
47450 <para>
47451 allows all the defaults except ARCFOUR, whereas
47452 </para>
47453 <literallayout class="monospaced">
47454 tls_require_ciphers = AES : 3DES
47455 </literallayout>
47456 <para>
47457 allows only cipher suites that use AES or 3DES.
47458 </para>
47459 <para>
47460 For <option>tls_require_ciphers</option> the recognized names are AES_256, AES_128, AES
47461 (both of the preceding), 3DES, ARCFOUR_128, ARCFOUR_40, and ARCFOUR (both of
47462 the preceding). The default list does not contain all of these; it just has
47463 AES_256, AES_128, 3DES, and ARCFOUR_128.
47464 </para>
47465 <para>
47466 For <option>gnutls_require_kx</option>, the recognized names are DHE_RSA, RSA (which
47467 includes DHE_RSA), DHE_DSS, and DHE (which includes both DHE_RSA and
47468 DHE_DSS). The default list contains RSA, DHE_DSS, DHE_RSA.
47469 </para>
47470 <para>
47471 For <option>gnutls_require_mac</option>, the recognized names are SHA (synonym SHA1), and
47472 MD5. The default list contains SHA, MD5.
47473 </para>
47474 <para>
47475 For <option>gnutls_require_protocols</option>, the recognized names are TLS1 and SSL3.
47476 The default list contains TLS1, SSL3.
47477 </para>
47478 <para>
47479 In a server, the order of items in these lists is unimportant. The server
47480 advertises the availability of all the relevant cipher suites. However, in a
47481 client, the order in the <option>tls_require_ciphers</option> list specifies a preference
47482 order for the cipher algorithms. The first one in the client&#x2019;s list that is
47483 also advertised by the server is tried first. The default order is as listed
47484 above.
47485 </para>
47486 </section>
47487 <section id="SECID182">
47488 <title>Configuring an Exim server to use TLS</title>
47489 <para>
47490 <indexterm role="concept">
47491 <primary>TLS</primary>
47492 <secondary>configuring an Exim server</secondary>
47493 </indexterm>
47494 When Exim has been built with TLS support, it advertises the availability of
47495 the STARTTLS command to client hosts that match <option>tls_advertise_hosts</option>,
47496 but not to any others. The default value of this option is unset, which means
47497 that STARTTLS is not advertised at all. This default is chosen because you
47498 need to set some other options in order to make TLS available, and also it is
47499 sensible for systems that want to use TLS only as a client.
47500 </para>
47501 <para>
47502 If a client issues a STARTTLS command and there is some configuration
47503 problem in the server, the command is rejected with a 454 error. If the client
47504 persists in trying to issue SMTP commands, all except QUIT are rejected
47505 with the error
47506 </para>
47507 <literallayout class="monospaced">
47508 554 Security failure
47509 </literallayout>
47510 <para>
47511 If a STARTTLS command is issued within an existing TLS session, it is
47512 rejected with a 554 error code.
47513 </para>
47514 <para>
47515 To enable TLS operations on a server, you must set <option>tls_advertise_hosts</option> to
47516 match some hosts. You can, of course, set it to * to match all hosts.
47517 However, this is not all you need to do. TLS sessions to a server won&#x2019;t work
47518 without some further configuration at the server end.
47519 </para>
47520 <para>
47521 It is rumoured that all existing clients that support TLS/SSL use RSA
47522 encryption. To make this work you need to set, in the server,
47523 </para>
47524 <literallayout class="monospaced">
47525 tls_certificate = /some/file/name
47526 tls_privatekey = /some/file/name
47527 </literallayout>
47528 <para>
47529 These options are, in fact, expanded strings, so you can make them depend on
47530 the identity of the client that is connected if you wish. The first file
47531 contains the server&#x2019;s X509 certificate, and the second contains the private key
47532 that goes with it. These files need to be readable by the Exim user, and must
47533 always be given as full path names. They can be the same file if both the
47534 certificate and the key are contained within it. If <option>tls_privatekey</option> is not
47535 set, or if its expansion is forced to fail or results in an empty string, this
47536 is assumed to be the case. The certificate file may also contain intermediate
47537 certificates that need to be sent to the client to enable it to authenticate
47538 the server&#x2019;s certificate.
47539 </para>
47540 <para>
47541 If you do not understand about certificates and keys, please try to find a
47542 source of this background information, which is not Exim-specific. (There are a
47543 few comments below in section <xref linkend="SECTcerandall"/>.)
47544 </para>
47545 <para>
47546 <emphasis role="bold">Note</emphasis>: These options do not apply when Exim is operating as a client &ndash;
47547 they apply only in the case of a server. If you need to use a certificate in an
47548 Exim client, you must set the options of the same names in an <command>smtp</command>
47549 transport.
47550 </para>
47551 <para>
47552 With just these options, an Exim server will be able to use TLS. It does not
47553 require the client to have a certificate (but see below for how to insist on
47554 this). There is one other option that may be needed in other situations. If
47555 </para>
47556 <literallayout class="monospaced">
47557 tls_dhparam = /some/file/name
47558 </literallayout>
47559 <para>
47560 is set, the SSL library is initialized for the use of Diffie-Hellman ciphers
47561 with the parameters contained in the file. This increases the set of cipher
47562 suites that the server supports. See the command
47563 </para>
47564 <literallayout class="monospaced">
47565 openssl dhparam
47566 </literallayout>
47567 <para>
47568 for a way of generating this data. At present, <option>tls_dhparam</option> is used only
47569 when Exim is linked with OpenSSL. It is ignored if GnuTLS is being used.
47570 </para>
47571 <para>
47572 The strings supplied for these three options are expanded every time a client
47573 host connects. It is therefore possible to use different certificates and keys
47574 for different hosts, if you so wish, by making use of the client&#x2019;s IP address
47575 in <varname>$sender_host_address</varname> to control the expansion. If a string expansion is
47576 forced to fail, Exim behaves as if the option is not set.
47577 </para>
47578 <para>
47579 <indexterm role="concept">
47580 <primary>cipher</primary>
47581 <secondary>logging</secondary>
47582 </indexterm>
47583 <indexterm role="concept">
47584 <primary>log</primary>
47585 <secondary>TLS cipher</secondary>
47586 </indexterm>
47587 <indexterm role="variable">
47588 <primary><varname>$tls_cipher</varname></primary>
47589 </indexterm>
47590 The variable <varname>$tls_cipher</varname> is set to the cipher suite that was negotiated for
47591 an incoming TLS connection. It is included in the <emphasis>Received:</emphasis> header of an
47592 incoming message (by default &ndash; you can, of course, change this), and it is
47593 also included in the log line that records a message&#x2019;s arrival, keyed by
47594 <quote>X=</quote>, unless the <option>tls_cipher</option> log selector is turned off. The <option>encrypted</option>
47595 condition can be used to test for specific cipher suites in ACLs.
47596 (For outgoing SMTP deliveries, <varname>$tls_cipher</varname> is reset &ndash; see section
47597 <xref linkend="SECID185"/>.)
47598 </para>
47599 <para>
47600 Once TLS has been established, the ACLs that run for subsequent SMTP commands
47601 can check the name of the cipher suite and vary their actions accordingly. The
47602 cipher suite names vary, depending on which TLS library is being used. For
47603 example, OpenSSL uses the name DES-CBC3-SHA for the cipher suite which in other
47604 contexts is known as TLS_RSA_WITH_3DES_EDE_CBC_SHA. Check the OpenSSL or GnuTLS
47605 documentation for more details.
47606 </para>
47607 </section>
47608 <section id="SECID183">
47609 <title>Requesting and verifying client certificates</title>
47610 <para>
47611 <indexterm role="concept">
47612 <primary>certificate</primary>
47613 <secondary>verification of client</secondary>
47614 </indexterm>
47615 <indexterm role="concept">
47616 <primary>TLS</primary>
47617 <secondary>client certificate verification</secondary>
47618 </indexterm>
47619 If you want an Exim server to request a certificate when negotiating a TLS
47620 session with a client, you must set either <option>tls_verify_hosts</option> or
47621 <option>tls_try_verify_hosts</option>. You can, of course, set either of them to * to
47622 apply to all TLS connections. For any host that matches one of these options,
47623 Exim requests a certificate as part of the setup of the TLS session. The
47624 contents of the certificate are verified by comparing it with a list of
47625 expected certificates. These must be available in a file or,
47626 for OpenSSL only (not GnuTLS), a directory, identified by
47627 <option>tls_verify_certificates</option>.
47628 </para>
47629 <para>
47630 A file can contain multiple certificates, concatenated end to end. If a
47631 directory is used
47632 (OpenSSL only),
47633 each certificate must be in a separate file, with a name (or a symbolic link)
47634 of the form &lt;<emphasis>hash</emphasis>&gt;.0, where &lt;<emphasis>hash</emphasis>&gt; is a hash value constructed from the
47635 certificate. You can compute the relevant hash by running the command
47636 </para>
47637 <literallayout class="monospaced">
47638 openssl x509 -hash -noout -in /cert/file
47639 </literallayout>
47640 <para>
47641 where <filename>/cert/file</filename> contains a single certificate.
47642 </para>
47643 <para>
47644 The difference between <option>tls_verify_hosts</option> and <option>tls_try_verify_hosts</option> is
47645 what happens if the client does not supply a certificate, or if the certificate
47646 does not match any of the certificates in the collection named by
47647 <option>tls_verify_certificates</option>. If the client matches <option>tls_verify_hosts</option>, the
47648 attempt to set up a TLS session is aborted, and the incoming connection is
47649 dropped. If the client matches <option>tls_try_verify_hosts</option>, the (encrypted) SMTP
47650 session continues. ACLs that run for subsequent SMTP commands can detect the
47651 fact that no certificate was verified, and vary their actions accordingly. For
47652 example, you can insist on a certificate before accepting a message for
47653 relaying, but not when the message is destined for local delivery.
47654 </para>
47655 <para>
47656 <indexterm role="variable">
47657 <primary><varname>$tls_peerdn</varname></primary>
47658 </indexterm>
47659 When a client supplies a certificate (whether it verifies or not), the value of
47660 the Distinguished Name of the certificate is made available in the variable
47661 <varname>$tls_peerdn</varname> during subsequent processing of the message.
47662 </para>
47663 <para>
47664 <indexterm role="concept">
47665 <primary>log</primary>
47666 <secondary>distinguished name</secondary>
47667 </indexterm>
47668 Because it is often a long text string, it is not included in the log line or
47669 <emphasis>Received:</emphasis> header by default. You can arrange for it to be logged, keyed by
47670 <quote>DN=</quote>, by setting the <option>tls_peerdn</option> log selector, and you can use
47671 <option>received_header_text</option> to change the <emphasis>Received:</emphasis> header. When no
47672 certificate is supplied, <varname>$tls_peerdn</varname> is empty.
47673 </para>
47674 </section>
47675 <section id="SECID184">
47676 <title>Revoked certificates</title>
47677 <para>
47678 <indexterm role="concept">
47679 <primary>TLS</primary>
47680 <secondary>revoked certificates</secondary>
47681 </indexterm>
47682 <indexterm role="concept">
47683 <primary>revocation list</primary>
47684 </indexterm>
47685 <indexterm role="concept">
47686 <primary>certificate</primary>
47687 <secondary>revocation list</secondary>
47688 </indexterm>
47689 Certificate issuing authorities issue Certificate Revocation Lists (CRLs) when
47690 certificates are revoked. If you have such a list, you can pass it to an Exim
47691 server using the global option called <option>tls_crl</option> and to an Exim client using
47692 an identically named option for the <command>smtp</command> transport. In each case, the value
47693 of the option is expanded and must then be the name of a file that contains a
47694 CRL in PEM format.
47695 </para>
47696 </section>
47697 <section id="SECID185">
47698 <title>Configuring an Exim client to use TLS</title>
47699 <para>
47700 <indexterm role="concept">
47701 <primary>cipher</primary>
47702 <secondary>logging</secondary>
47703 </indexterm>
47704 <indexterm role="concept">
47705 <primary>log</primary>
47706 <secondary>TLS cipher</secondary>
47707 </indexterm>
47708 <indexterm role="concept">
47709 <primary>log</primary>
47710 <secondary>distinguished name</secondary>
47711 </indexterm>
47712 <indexterm role="concept">
47713 <primary>TLS</primary>
47714 <secondary>configuring an Exim client</secondary>
47715 </indexterm>
47716 The <option>tls_cipher</option> and <option>tls_peerdn</option> log selectors apply to outgoing SMTP
47717 deliveries as well as to incoming, the latter one causing logging of the
47718 server certificate&#x2019;s DN. The remaining client configuration for TLS is all
47719 within the <command>smtp</command> transport.
47720 </para>
47721 <para>
47722 It is not necessary to set any options to have TLS work in the <command>smtp</command>
47723 transport. If Exim is built with TLS support, and TLS is advertised by a
47724 server, the <command>smtp</command> transport always tries to start a TLS session. However,
47725 this can be prevented by setting <option>hosts_avoid_tls</option> (an option of the
47726 transport) to a list of server hosts for which TLS should not be used.
47727 </para>
47728 <para>
47729 If you do not want Exim to attempt to send messages unencrypted when an attempt
47730 to set up an encrypted connection fails in any way, you can set
47731 <option>hosts_require_tls</option> to a list of hosts for which encryption is mandatory. For
47732 those hosts, delivery is always deferred if an encrypted connection cannot be
47733 set up. If there are any other hosts for the address, they are tried in the
47734 usual way.
47735 </para>
47736 <para>
47737 When the server host is not in <option>hosts_require_tls</option>, Exim may try to deliver
47738 the message unencrypted. It always does this if the response to STARTTLS is
47739 a 5<emphasis>xx</emphasis> code. For a temporary error code, or for a failure to negotiate a TLS
47740 session after a success response code, what happens is controlled by the
47741 <option>tls_tempfail_tryclear</option> option of the <command>smtp</command> transport. If it is false,
47742 delivery to this host is deferred, and other hosts (if available) are tried. If
47743 it is true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis> response to
47744 STARTTLS, and if STARTTLS is accepted, but the subsequent TLS
47745 negotiation fails, Exim closes the current connection (because it is in an
47746 unknown state), opens a new one to the same host, and then tries the delivery
47747 unencrypted.
47748 </para>
47749 <para>
47750 The <option>tls_certificate</option> and <option>tls_privatekey</option> options of the <command>smtp</command>
47751 transport provide the client with a certificate, which is passed to the server
47752 if it requests it. If the server is Exim, it will request a certificate only if
47753 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> matches the client.
47754 </para>
47755 <para>
47756 If the <option>tls_verify_certificates</option> option is set on the <command>smtp</command> transport, it
47757 must name a file or,
47758 for OpenSSL only (not GnuTLS), a directory, that contains a collection of
47759 expected server certificates. The client verifies the server&#x2019;s certificate
47760 against this collection, taking into account any revoked certificates that are
47761 in the list defined by <option>tls_crl</option>.
47762 </para>
47763 <para>
47764 If
47765 <option>tls_require_ciphers</option> is set on the <command>smtp</command> transport, it must contain a
47766 list of permitted cipher suites. If either of these checks fails, delivery to
47767 the current host is abandoned, and the <command>smtp</command> transport tries to deliver to
47768 alternative hosts, if any.
47769 </para>
47770 <para>
47771  <emphasis role="bold">Note</emphasis>:
47772 These options must be set in the <command>smtp</command> transport for Exim to use TLS when it
47773 is operating as a client. Exim does not assume that a server certificate (set
47774 by the global options of the same name) should also be used when operating as a
47775 client.
47776 </para>
47777 <para>
47778 <indexterm role="variable">
47779 <primary><varname>$host</varname></primary>
47780 </indexterm>
47781 <indexterm role="variable">
47782 <primary><varname>$host_address</varname></primary>
47783 </indexterm>
47784 All the TLS options in the <command>smtp</command> transport are expanded before use, with
47785 <varname>$host</varname> and <varname>$host_address</varname> containing the name and address of the server to
47786 which the client is connected. Forced failure of an expansion causes Exim to
47787 behave as if the relevant option were unset.
47788 </para>
47789 <para>
47790 <indexterm role="variable">
47791 <primary><varname>$tls_cipher</varname></primary>
47792 </indexterm>
47793 <indexterm role="variable">
47794 <primary><varname>$tls_peerdn</varname></primary>
47795 </indexterm>
47796 Before an SMTP connection is established, the <varname>$tls_cipher</varname> and <varname>$tls_peerdn</varname>
47797 variables are emptied. (Until the first connection, they contain the values
47798 that were set when the message was received.) If STARTTLS is subsequently
47799 successfully obeyed, these variables are set to the relevant values for the
47800 outgoing connection.
47801 </para>
47802 </section>
47803 <section id="SECTmulmessam">
47804 <title>Multiple messages on the same encrypted TCP/IP connection</title>
47805 <para>
47806 <indexterm role="concept">
47807 <primary>multiple SMTP deliveries with TLS</primary>
47808 </indexterm>
47809 <indexterm role="concept">
47810 <primary>TLS</primary>
47811 <secondary>multiple message deliveries</secondary>
47812 </indexterm>
47813 Exim sends multiple messages down the same TCP/IP connection by starting up
47814 an entirely new delivery process for each message, passing the socket from
47815 one process to the next. This implementation does not fit well with the use
47816 of TLS, because there is quite a lot of state information associated with a TLS
47817 connection, not just a socket identification. Passing all the state information
47818 to a new process is not feasible. Consequently, Exim shuts down an existing TLS
47819 session before passing the socket to a new process. The new process may then
47820 try to start a new TLS session, and if successful, may try to re-authenticate
47821 if AUTH is in use, before sending the next message.
47822 </para>
47823 <para>
47824 The RFC is not clear as to whether or not an SMTP session continues in clear
47825 after TLS has been shut down, or whether TLS may be restarted again later, as
47826 just described. However, if the server is Exim, this shutdown and
47827 reinitialization works. It is not known which (if any) other servers operate
47828 successfully if the client closes a TLS session and continues with unencrypted
47829 SMTP, but there are certainly some that do not work. For such servers, Exim
47830 should not pass the socket to another process, because the failure of the
47831 subsequent attempt to use it would cause Exim to record a temporary host error,
47832 and delay other deliveries to that host.
47833 </para>
47834 <para>
47835 To test for this case, Exim sends an EHLO command to the server after
47836 closing down the TLS session. If this fails in any way, the connection is
47837 closed instead of being passed to a new delivery process, but no retry
47838 information is recorded.
47839 </para>
47840 <para>
47841 There is also a manual override; you can set <option>hosts_nopass_tls</option> on the
47842 <command>smtp</command> transport to match those hosts for which Exim should not pass
47843 connections to new processes if TLS has been used.
47844 </para>
47845 </section>
47846 <section id="SECTcerandall">
47847 <title>Certificates and all that</title>
47848 <para>
47849 <indexterm role="concept">
47850 <primary>certificate</primary>
47851 <secondary>references to discussion</secondary>
47852 </indexterm>
47853 In order to understand fully how TLS works, you need to know about
47854 certificates, certificate signing, and certificate authorities. This is not the
47855 place to give a tutorial, especially as I do not know very much about it
47856 myself. Some helpful introduction can be found in the FAQ for the SSL addition
47857 to Apache, currently at
47858 </para>
47859 <literallayout>
47860 <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>
47861 </literallayout>
47862 <para>
47863 Other parts of the <emphasis>modssl</emphasis> documentation are also helpful, and have
47864 links to further files.
47865 Eric Rescorla&#x2019;s book, <emphasis>SSL and TLS</emphasis>, published by Addison-Wesley (ISBN
47866 0-201-61598-3), contains both introductory and more in-depth descriptions.
47867 Some sample programs taken from the book are available from
47868 </para>
47869 <literallayout>
47870 <emphasis role="bold"><ulink url="http://www.rtfm.com/openssl-examples/">http://www.rtfm.com/openssl-examples/</ulink></emphasis>
47871 </literallayout>
47872 </section>
47873 <section id="SECID186">
47874 <title>Certificate chains</title>
47875 <para>
47876 The file named by <option>tls_certificate</option> may contain more than one
47877 certificate. This is useful in the case where the certificate that is being
47878 sent is validated by an intermediate certificate which the other end does
47879 not have. Multiple certificates must be in the correct order in the file.
47880 First the host&#x2019;s certificate itself, then the first intermediate
47881 certificate to validate the issuer of the host certificate, then the next
47882 intermediate certificate to validate the issuer of the first intermediate
47883 certificate, and so on, until finally (optionally) the root certificate.
47884 The root certificate must already be trusted by the recipient for
47885 validation to succeed, of course, but if it&#x2019;s not preinstalled, sending the
47886 root certificate along with the rest makes it available for the user to
47887 install if the receiving end is a client MUA that can interact with a user.
47888 </para>
47889 </section>
47890 <section id="SECID187">
47891 <title>Self-signed certificates</title>
47892 <para>
47893 <indexterm role="concept">
47894 <primary>certificate</primary>
47895 <secondary>self-signed</secondary>
47896 </indexterm>
47897 You can create a self-signed certificate using the <emphasis>req</emphasis> command provided
47898 with OpenSSL, like this:
47899 </para>
47900 <literallayout class="monospaced">
47901 openssl req -x509 -newkey rsa:1024 -keyout file1 -out file2 \
47902             -days 9999 -nodes
47903 </literallayout>
47904 <para>
47905 <filename>file1</filename> and <filename>file2</filename> can be the same file; the key and the certificate are
47906 delimited and so can be identified independently. The <option>-days</option> option
47907 specifies a period for which the certificate is valid. The <option>-nodes</option> option is
47908 important: if you do not set it, the key is encrypted with a passphrase
47909 that you are prompted for, and any use that is made of the key causes more
47910 prompting for the passphrase. This is not helpful if you are going to use
47911 this certificate and key in an MTA, where prompting is not possible.
47912 </para>
47913 <para>
47914 A self-signed certificate made in this way is sufficient for testing, and
47915 may be adequate for all your requirements if you are mainly interested in
47916 encrypting transfers, and not in secure identification.
47917 </para>
47918 <para>
47919 However, many clients require that the certificate presented by the server be a
47920 user (also called <quote>leaf</quote> or <quote>site</quote>) certificate, and not a self-signed
47921 certificate. In this situation, the self-signed certificate described above
47922 must be installed on the client host as a trusted root <emphasis>certification
47923 authority</emphasis> (CA), and the certificate used by Exim must be a user certificate
47924 signed with that self-signed certificate.
47925 </para>
47926 <para>
47927 For information on creating self-signed CA certificates and using them to sign
47928 user certificates, see the <emphasis>General implementation overview</emphasis> chapter of the
47929 Open-source PKI book, available online at
47930 <emphasis role="bold"><ulink url="http://ospkibook.sourceforge.net/">http://ospkibook.sourceforge.net/</ulink></emphasis>.
47931 <indexterm role="concept" startref="IIDencsmtp1" class="endofrange"/>
47932 <indexterm role="concept" startref="IIDencsmtp2" class="endofrange"/>
47933 </para>
47934 </section>
47935 </chapter>
47936
47937 <chapter id="CHAPACL">
47938 <title>Access control lists</title>
47939 <para>
47940 <indexterm role="concept" id="IIDacl" class="startofrange">
47941 <primary>access control lists (ACLs)</primary>
47942 <secondary>description</secondary>
47943 </indexterm>
47944 <indexterm role="concept">
47945 <primary>control of incoming mail</primary>
47946 </indexterm>
47947 <indexterm role="concept">
47948 <primary>message</primary>
47949 <secondary>controlling incoming</secondary>
47950 </indexterm>
47951 <indexterm role="concept">
47952 <primary>policy control</primary>
47953 <secondary>access control lists</secondary>
47954 </indexterm>
47955 Access Control Lists (ACLs) are defined in a separate section of the run time
47956 configuration file, headed by <quote>begin acl</quote>. Each ACL definition starts with a
47957 name, terminated by a colon. Here is a complete ACL section that contains just
47958 one very small ACL:
47959 </para>
47960 <literallayout class="monospaced">
47961 begin acl
47962 small_acl:
47963   accept   hosts = one.host.only
47964 </literallayout>
47965 <para>
47966 You can have as many lists as you like in the ACL section, and the order in
47967 which they appear does not matter. The lists are self-terminating.
47968 </para>
47969 <para>
47970 The majority of ACLs are used to control Exim&#x2019;s behaviour when it receives
47971 certain SMTP commands. This applies both to incoming TCP/IP connections, and
47972 when a local process submits a message using SMTP by specifying the <option>-bs</option>
47973 option. The most common use is for controlling which recipients are accepted
47974 in incoming messages. In addition, you can define an ACL that is used to check
47975 local non-SMTP messages. The default configuration file contains an example of
47976 a realistic ACL for checking RCPT commands. This is discussed in chapter
47977 <xref linkend="CHAPdefconfil"/>.
47978 </para>
47979 <section id="SECID188">
47980 <title>Testing ACLs</title>
47981 <para>
47982 The <option>-bh</option> command line option provides a way of testing your ACL
47983 configuration locally by running a fake SMTP session with which you interact.
47984 The host <emphasis>relay-test.mail-abuse.org</emphasis> provides a service for checking your
47985 relaying configuration (see section <xref linkend="SECTcheralcon"/> for more details).
47986 </para>
47987 </section>
47988 <section id="SECID189">
47989 <title>Specifying when ACLs are used</title>
47990 <para>
47991 <indexterm role="concept">
47992 <primary>access control lists (ACLs)</primary>
47993 <secondary>options for specifying</secondary>
47994 </indexterm>
47995 In order to cause an ACL to be used, you have to name it in one of the relevant
47996 options in the main part of the configuration. These options are:
47997 <indexterm role="concept">
47998 <primary>AUTH</primary>
47999 <secondary>ACL for</secondary>
48000 </indexterm>
48001 <indexterm role="concept">
48002 <primary>DATA</primary>
48003 <secondary>ACLs for</secondary>
48004 </indexterm>
48005 <indexterm role="concept">
48006 <primary>ETRN</primary>
48007 <secondary>ACL for</secondary>
48008 </indexterm>
48009 <indexterm role="concept">
48010 <primary>EXPN</primary>
48011 <secondary>ACL for</secondary>
48012 </indexterm>
48013 <indexterm role="concept">
48014 <primary>HELO</primary>
48015 <secondary>ACL for</secondary>
48016 </indexterm>
48017 <indexterm role="concept">
48018 <primary>EHLO</primary>
48019 <secondary>ACL for</secondary>
48020 </indexterm>
48021 <indexterm role="concept">
48022 <primary>MAIL</primary>
48023 <secondary>ACL for</secondary>
48024 </indexterm>
48025 <indexterm role="concept">
48026 <primary>QUIT, ACL for</primary>
48027 </indexterm>
48028 <indexterm role="concept">
48029 <primary>RCPT</primary>
48030 <secondary>ACL for</secondary>
48031 </indexterm>
48032 <indexterm role="concept">
48033 <primary>STARTTLS, ACL for</primary>
48034 </indexterm>
48035 <indexterm role="concept">
48036 <primary>VRFY</primary>
48037 <secondary>ACL for</secondary>
48038 </indexterm>
48039 <indexterm role="concept">
48040 <primary>SMTP</primary>
48041 <secondary>connection, ACL for</secondary>
48042 </indexterm>
48043 <indexterm role="concept">
48044 <primary>non-SMTP messages</primary>
48045 <secondary>ACLs for</secondary>
48046 </indexterm>
48047 <indexterm role="concept">
48048 <primary>MIME content scanning</primary>
48049 <secondary>ACL for</secondary>
48050 </indexterm>
48051 </para>
48052 <informaltable frame="none">
48053 <tgroup cols="2" colsep="0" rowsep="0">
48054 <colspec colwidth="140pt" align="left"/>
48055 <colspec colwidth="254pt" align="left"/>
48056 <tbody>
48057 <row>
48058 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp</option></entry>
48059 <entry>ACL for non-SMTP messages</entry>
48060 </row>
48061 <row>
48062 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp_mime</option></entry>
48063 <entry>ACL for non-SMTP MIME parts</entry>
48064 </row>
48065 <row>
48066 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp_start</option></entry>
48067 <entry>ACL at start of non-SMTP message</entry>
48068 </row>
48069 <row>
48070 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_auth</option></entry>
48071 <entry>ACL for AUTH</entry>
48072 </row>
48073 <row>
48074 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_connect</option></entry>
48075 <entry>ACL for start of SMTP connection</entry>
48076 </row>
48077 <row>
48078 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_data</option></entry>
48079 <entry>ACL after DATA is complete</entry>
48080 </row>
48081 <row>
48082 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_etrn</option></entry>
48083 <entry>ACL for ETRN</entry>
48084 </row>
48085 <row>
48086 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_expn</option></entry>
48087 <entry>ACL for EXPN</entry>
48088 </row>
48089 <row>
48090 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_helo</option></entry>
48091 <entry>ACL for HELO or EHLO</entry>
48092 </row>
48093 <row>
48094 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mail</option></entry>
48095 <entry>ACL for MAIL</entry>
48096 </row>
48097 <row>
48098 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mailauth</option></entry>
48099 <entry>ACL for the AUTH parameter of MAIL</entry>
48100 </row>
48101 <row>
48102 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mime</option></entry>
48103 <entry>ACL for content-scanning MIME parts</entry>
48104 </row>
48105 <row>
48106 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_notquit</option></entry>
48107 <entry>ACL for non-QUIT terminations</entry>
48108 </row>
48109 <row>
48110 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_predata</option></entry>
48111 <entry>ACL at start of DATA command</entry>
48112 </row>
48113 <row>
48114 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_quit</option></entry>
48115 <entry>ACL for QUIT</entry>
48116 </row>
48117 <row>
48118 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_rcpt</option></entry>
48119 <entry>ACL for RCPT</entry>
48120 </row>
48121 <row>
48122 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_starttls</option></entry>
48123 <entry>ACL for STARTTLS</entry>
48124 </row>
48125 <row>
48126 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_vrfy</option></entry>
48127 <entry>ACL for VRFY</entry>
48128 </row>
48129 </tbody>
48130 </tgroup>
48131 </informaltable>
48132 <para>
48133 For example, if you set
48134 </para>
48135 <literallayout class="monospaced">
48136 acl_smtp_rcpt = small_acl
48137 </literallayout>
48138 <para>
48139 the little ACL defined above is used whenever Exim receives a RCPT command
48140 in an SMTP dialogue. The majority of policy tests on incoming messages can be
48141 done when RCPT commands arrive. A rejection of RCPT should cause the
48142 sending MTA to give up on the recipient address contained in the RCPT
48143 command, whereas rejection at other times may cause the client MTA to keep on
48144 trying to deliver the message. It is therefore recommended that you do as much
48145 testing as possible at RCPT time.
48146 </para>
48147 </section>
48148 <section id="SECID190">
48149 <title>The non-SMTP ACLs</title>
48150 <para>
48151 <indexterm role="concept">
48152 <primary>non-SMTP messages</primary>
48153 <secondary>ACLs for</secondary>
48154 </indexterm>
48155 The non-SMTP ACLs apply to all non-interactive incoming messages, that is, they
48156 apply to batched SMTP as well as to non-SMTP messages. (Batched SMTP is not
48157 really SMTP.) Many of the ACL conditions (for example, host tests, and tests on
48158 the state of the SMTP connection such as encryption and authentication) are not
48159 relevant and are forbidden in these ACLs. However, the sender and recipients
48160 are known, so the <option>senders</option> and <option>sender_domains</option> conditions and the
48161 <varname>$sender_address</varname> and <varname>$recipients</varname> variables can be used. Variables such as
48162 <varname>$authenticated_sender</varname> are also available. You can specify added header lines
48163 in any of these ACLs.
48164 </para>
48165 <para>
48166 The <option>acl_not_smtp_start</option> ACL is run right at the start of receiving a
48167 non-SMTP message, before any of the message has been read. (This is the
48168 analogue of the <option>acl_smtp_predata</option> ACL for SMTP input.) In the case of
48169 batched SMTP input, it runs after the DATA command has been reached. The
48170 result of this ACL is ignored; it cannot be used to reject a message. If you
48171 really need to, you could set a value in an ACL variable here and reject based
48172 on that in the <option>acl_not_smtp</option> ACL. However, this ACL can be used to set
48173 controls, and in particular, it can be used to set
48174 </para>
48175 <literallayout class="monospaced">
48176 control = suppress_local_fixups
48177 </literallayout>
48178 <para>
48179 This cannot be used in the other non-SMTP ACLs because by the time they are
48180 run, it is too late.
48181 </para>
48182 <para>
48183 The <option>acl_not_smtp_mime</option> ACL is available only when Exim is compiled with the
48184 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
48185 </para>
48186 <para>
48187 The <option>acl_not_smtp</option> ACL is run just before the <function>local_scan()</function> function. Any
48188 kind of rejection is treated as permanent, because there is no way of sending a
48189 temporary error for these kinds of message.
48190 </para>
48191 </section>
48192 <section id="SECID191">
48193 <title>The SMTP connect ACL</title>
48194 <para>
48195 <indexterm role="concept">
48196 <primary>SMTP</primary>
48197 <secondary>connection, ACL for</secondary>
48198 </indexterm>
48199 <indexterm role="option">
48200 <primary><option>smtp_banner</option></primary>
48201 </indexterm>
48202 The ACL test specified by <option>acl_smtp_connect</option> happens at the start of an SMTP
48203 session, after the test specified by <option>host_reject_connection</option> (which is now
48204 an anomaly) and any TCP Wrappers testing (if configured). If the connection is
48205 accepted by an <option>accept</option> verb that has a <option>message</option> modifier, the contents of
48206 the message override the banner message that is otherwise specified by the
48207 <option>smtp_banner</option> option.
48208 </para>
48209 </section>
48210 <section id="SECID192">
48211 <title>The EHLO/HELO ACL</title>
48212 <para>
48213 <indexterm role="concept">
48214 <primary>EHLO</primary>
48215 <secondary>ACL for</secondary>
48216 </indexterm>
48217 <indexterm role="concept">
48218 <primary>HELO</primary>
48219 <secondary>ACL for</secondary>
48220 </indexterm>
48221 The ACL test specified by <option>acl_smtp_helo</option> happens when the client issues an
48222 EHLO or HELO command, after the tests specified by <option>helo_accept_junk_hosts</option>,
48223 <option>helo_allow_chars</option>, <option>helo_verify_hosts</option>, and <option>helo_try_verify_hosts</option>.
48224 Note that a client may issue more than one EHLO or HELO command in an SMTP
48225 session, and indeed is required to issue a new EHLO or HELO after successfully
48226 setting up encryption following a STARTTLS command.
48227 </para>
48228 <para>
48229 If the command is accepted by an <option>accept</option> verb that has a <option>message</option>
48230 modifier, the message may not contain more than one line (it will be truncated
48231 at the first newline and a panic logged if it does). Such a message cannot
48232 affect the EHLO options that are listed on the second and subsequent lines of
48233 an EHLO response.
48234 </para>
48235 </section>
48236 <section id="SECID193">
48237 <title>The DATA ACLs</title>
48238 <para>
48239 <indexterm role="concept">
48240 <primary>DATA</primary>
48241 <secondary>ACLs for</secondary>
48242 </indexterm>
48243 Two ACLs are associated with the DATA command, because it is two-stage
48244 command, with two responses being sent to the client.
48245 When the DATA command is received, the ACL defined by <option>acl_smtp_predata</option>
48246 is obeyed. This gives you control after all the RCPT commands, but before
48247 the message itself is received. It offers the opportunity to give a negative
48248 response to the DATA command before the data is transmitted. Header lines
48249 added by MAIL or RCPT ACLs are not visible at this time, but any that
48250 are defined here are visible when the <option>acl_smtp_data</option> ACL is run.
48251 </para>
48252 <para>
48253 You cannot test the contents of the message, for example, to verify addresses
48254 in the headers, at RCPT time or when the DATA command is received. Such
48255 tests have to appear in the ACL that is run after the message itself has been
48256 received, before the final response to the DATA command is sent. This is
48257 the ACL specified by <option>acl_smtp_data</option>, which is the second ACL that is
48258 associated with the DATA command.
48259 </para>
48260 <para>
48261 For both of these ACLs, it is not possible to reject individual recipients. An
48262 error response rejects the entire message. Unfortunately, it is known that some
48263 MTAs do not treat hard (5<emphasis>xx</emphasis>) responses to the DATA command (either
48264 before or after the data) correctly &ndash; they keep the message on their queues
48265 and try again later, but that is their problem, though it does waste some of
48266 your resources.
48267 </para>
48268 </section>
48269 <section id="SECTDKIMACL" revisionflag="changed">
48270 <title>The SMTP DKIM ACL</title>
48271 <para revisionflag="changed">
48272 The <option>acl_smtp_dkim</option> ACL is available only when Exim is compiled with DKIM support
48273 enabled (which is the default).
48274 </para>
48275 <para revisionflag="changed">
48276 The ACL test specified by <option>acl_smtp_dkim</option> happens after a message has been
48277 received, and is executed for each DKIM signature found in a message.  If not
48278 otherwise specified, the default action is to accept.
48279 </para>
48280 <para revisionflag="changed">
48281 For details on the operation of DKIM, see chapter <xref linkend="CHID12"/>.
48282 </para>
48283 </section>
48284 <section id="SECID194">
48285 <title>The SMTP MIME ACL</title>
48286 <para>
48287 The <option>acl_smtp_mime</option> option is available only when Exim is compiled with the
48288 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
48289 </para>
48290 </section>
48291 <section id="SECTQUITACL">
48292 <title>The QUIT ACL</title>
48293 <para>
48294 <indexterm role="concept">
48295 <primary>QUIT, ACL for</primary>
48296 </indexterm>
48297 The ACL for the SMTP QUIT command is anomalous, in that the outcome of the ACL
48298 does not affect the response code to QUIT, which is always 221. Thus, the ACL
48299 does not in fact control any access. For this reason, the only verbs that are
48300 permitted are <option>accept</option> and <option>warn</option>.
48301 </para>
48302 <para>
48303 This ACL can be used for tasks such as custom logging at the end of an SMTP
48304 session. For example, you can use ACL variables in other ACLs to count
48305 messages, recipients, etc., and log the totals at QUIT time using one or
48306 more <option>logwrite</option> modifiers on a <option>warn</option> verb.
48307 </para>
48308 <para>
48309 <emphasis role="bold">Warning</emphasis>: Only the <varname>$acl_c</varname><emphasis>x</emphasis> variables can be used for this, because
48310 the <varname>$acl_m</varname><emphasis>x</emphasis> variables are reset at the end of each incoming message.
48311 </para>
48312 <para>
48313 You do not need to have a final <option>accept</option>, but if you do, you can use a
48314 <option>message</option> modifier to specify custom text that is sent as part of the 221
48315 response to QUIT.
48316 </para>
48317 <para>
48318 This ACL is run only for a <quote>normal</quote> QUIT. For certain kinds of disastrous
48319 failure (for example, failure to open a log file, or when Exim is bombing out
48320 because it has detected an unrecoverable error), all SMTP commands from the
48321 client are given temporary error responses until QUIT is received or the
48322 connection is closed. In these special cases, the QUIT ACL does not run.
48323 </para>
48324 </section>
48325 <section id="SECTNOTQUITACL">
48326 <title>The not-QUIT ACL</title>
48327 <para>
48328 <indexterm role="variable">
48329 <primary><varname>$acl_smtp_notquit</varname></primary>
48330 </indexterm>
48331 The not-QUIT ACL, specified by <option>acl_smtp_notquit</option>, is run in most cases when
48332 an SMTP session ends without sending QUIT. However, when Exim itself is is bad
48333 trouble, such as being unable to write to its log files, this ACL is not run,
48334 because it might try to do things (such as write to log files) that make the
48335 situation even worse.
48336 </para>
48337 <para>
48338 Like the QUIT ACL, this ACL is provided to make it possible to do customized
48339 logging or to gather statistics, and its outcome is ignored. The <option>delay</option>
48340 modifier is forbidden in this ACL, and the only permitted verbs are <option>accept</option>
48341 and <option>warn</option>.
48342 </para>
48343 <para>
48344 <indexterm role="variable">
48345 <primary><varname>$smtp_notquit_reason</varname></primary>
48346 </indexterm>
48347 When the not-QUIT ACL is running, the variable <varname>$smtp_notquit_reason</varname> is set
48348 to a string that indicates the reason for the termination of the SMTP
48349 connection. The possible values are:
48350 </para>
48351 <informaltable frame="none">
48352 <tgroup cols="2" colsep="0" rowsep="0">
48353 <colspec colwidth="196pt" align="left"/>
48354 <colspec colwidth="254pt" align="left"/>
48355 <tbody>
48356 <row>
48357 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>acl-drop</literal></entry>
48358 <entry>Another ACL issued a <option>drop</option> command</entry>
48359 </row>
48360 <row>
48361 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>bad-commands</literal></entry>
48362 <entry>Too many unknown or non-mail commands</entry>
48363 </row>
48364 <row>
48365 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>command-timeout</literal></entry>
48366 <entry>Timeout while reading SMTP commands</entry>
48367 </row>
48368 <row>
48369 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>connection-lost</literal></entry>
48370 <entry>The SMTP connection has been lost</entry>
48371 </row>
48372 <row>
48373 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>data-timeout</literal></entry>
48374 <entry>Timeout while reading message data</entry>
48375 </row>
48376 <row>
48377 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>local-scan-error</literal></entry>
48378 <entry>The <function>local_scan()</function> function crashed</entry>
48379 </row>
48380 <row>
48381 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>local-scan-timeout</literal></entry>
48382 <entry>The <function>local_scan()</function> function timed out</entry>
48383 </row>
48384 <row>
48385 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>signal-exit</literal></entry>
48386 <entry>SIGTERM or SIGINT</entry>
48387 </row>
48388 <row>
48389 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>synchronization-error</literal></entry>
48390 <entry>SMTP synchronization error</entry>
48391 </row>
48392 <row>
48393 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>tls-failed</literal></entry>
48394 <entry>TLS failed to start</entry>
48395 </row>
48396 </tbody>
48397 </tgroup>
48398 </informaltable>
48399 <para>
48400 In most cases when an SMTP connection is closed without having received QUIT,
48401 Exim sends an SMTP response message before actually closing the connection.
48402 With the exception of the <literal>acl-drop</literal> case, the default message can be
48403 overridden by the <option>message</option> modifier in the not-QUIT ACL. In the case of a
48404 <option>drop</option> verb in another ACL, it is the message from the other ACL that is
48405 used.
48406 </para>
48407 </section>
48408 <section id="SECID195">
48409 <title>Finding an ACL to use</title>
48410 <para>
48411 <indexterm role="concept">
48412 <primary>access control lists (ACLs)</primary>
48413 <secondary>finding which to use</secondary>
48414 </indexterm>
48415 The value of an <option>acl_smtp_</option><emphasis>xxx</emphasis> option is expanded before use, so
48416 you can use different ACLs in different circumstances. For example,
48417 </para>
48418 <literallayout class="monospaced">
48419 acl_smtp_rcpt = ${if ={25}{$interface_port} \
48420                      {acl_check_rcpt} {acl_check_rcpt_submit} }
48421 </literallayout>
48422 <para>
48423 In the default configuration file there are some example settings for
48424 providing an RFC 4409 message submission service on port 587 and a
48425 non-standard <quote>smtps</quote> service on port 465. You can use a string
48426 expansion like this to choose an ACL for MUAs on these ports which is
48427 more appropriate for this purpose than the default ACL on port 25.
48428 </para>
48429 <para>
48430 The expanded string does not have to be the name of an ACL in the
48431 configuration file; there are other possibilities. Having expanded the
48432 string, Exim searches for an ACL as follows:
48433 </para>
48434 <itemizedlist>
48435 <listitem>
48436 <para>
48437 If the string begins with a slash, Exim uses it as a file name, and reads its
48438 contents as an ACL. The lines are processed in the same way as lines in the
48439 Exim configuration file. In particular, continuation lines are supported, blank
48440 lines are ignored, as are lines whose first non-whitespace character is <quote>#</quote>.
48441 If the file does not exist or cannot be read, an error occurs (typically
48442 causing a temporary failure of whatever caused the ACL to be run). For example:
48443 </para>
48444 <literallayout class="monospaced">
48445 acl_smtp_data = /etc/acls/\
48446   ${lookup{$sender_host_address}lsearch\
48447   {/etc/acllist}{$value}{default}}
48448 </literallayout>
48449 <para>
48450 This looks up an ACL file to use on the basis of the host&#x2019;s IP address, falling
48451 back to a default if the lookup fails. If an ACL is successfully read from a
48452 file, it is retained in memory for the duration of the Exim process, so that it
48453 can be re-used without having to re-read the file.
48454 </para>
48455 </listitem>
48456 <listitem>
48457 <para>
48458 If the string does not start with a slash, and does not contain any spaces,
48459 Exim searches the ACL section of the configuration for an ACL whose name
48460 matches the string.
48461 </para>
48462 </listitem>
48463 <listitem>
48464 <para>
48465 If no named ACL is found, or if the string contains spaces, Exim parses
48466 the string as an inline ACL. This can save typing in cases where you just
48467 want to have something like
48468 </para>
48469 <literallayout class="monospaced">
48470 acl_smtp_vrfy = accept
48471 </literallayout>
48472 <para>
48473 in order to allow free use of the VRFY command. Such a string may contain
48474 newlines; it is processed in the same way as an ACL that is read from a file.
48475 </para>
48476 </listitem>
48477 </itemizedlist>
48478 </section>
48479 <section id="SECID196">
48480 <title>ACL return codes</title>
48481 <para>
48482 <indexterm role="concept">
48483 <primary>access control lists (ACLs)</primary>
48484 <secondary>return codes</secondary>
48485 </indexterm>
48486 Except for the QUIT ACL, which does not affect the SMTP return code (see
48487 section <xref linkend="SECTQUITACL"/> above), the result of running an ACL is either
48488 <quote>accept</quote> or <quote>deny</quote>, or, if some test cannot be completed (for example, if a
48489 database is down), <quote>defer</quote>. These results cause 2<emphasis>xx</emphasis>, 5<emphasis>xx</emphasis>, and 4<emphasis>xx</emphasis>
48490 return codes, respectively, to be used in the SMTP dialogue. A fourth return,
48491 <quote>error</quote>, occurs when there is an error such as invalid syntax in the ACL.
48492 This also causes a 4<emphasis>xx</emphasis> return code.
48493 </para>
48494 <para>
48495 For the non-SMTP ACL, <quote>defer</quote> and <quote>error</quote> are treated in the same way as
48496 <quote>deny</quote>, because there is no mechanism for passing temporary errors to the
48497 submitters of non-SMTP messages.
48498 </para>
48499 <para>
48500 ACLs that are relevant to message reception may also return <quote>discard</quote>. This
48501 has the effect of <quote>accept</quote>, but causes either the entire message or an
48502 individual recipient address to be discarded. In other words, it is a
48503 blackholing facility. Use it with care.
48504 </para>
48505 <para>
48506 If the ACL for MAIL returns <quote>discard</quote>, all recipients are discarded, and no
48507 ACL is run for subsequent RCPT commands. The effect of <quote>discard</quote> in a
48508 RCPT ACL is to discard just the one recipient address. If there are no
48509 recipients left when the message&#x2019;s data is received, the DATA ACL is not
48510 run. A <quote>discard</quote> return from the DATA or the non-SMTP ACL discards all the
48511 remaining recipients. The <quote>discard</quote> return is not permitted for the
48512 <option>acl_smtp_predata</option> ACL.
48513 </para>
48514 <para>
48515 <indexterm role="concept">
48516 <primary><function>local_scan()</function> function</primary>
48517 <secondary>when all recipients discarded</secondary>
48518 </indexterm>
48519 The <function>local_scan()</function> function is always run, even if there are no remaining
48520 recipients; it may create new recipients.
48521 </para>
48522 </section>
48523 <section id="SECID197">
48524 <title>Unset ACL options</title>
48525 <para>
48526 <indexterm role="concept">
48527 <primary>access control lists (ACLs)</primary>
48528 <secondary>unset options</secondary>
48529 </indexterm>
48530 The default actions when any of the <option>acl_</option><emphasis>xxx</emphasis> options are unset are not
48531 all the same. <emphasis role="bold">Note</emphasis>: These defaults apply only when the relevant ACL is
48532 not defined at all. For any defined ACL, the default action when control
48533 reaches the end of the ACL statements is <quote>deny</quote>.
48534 </para>
48535 <para>
48536 For <option>acl_smtp_quit</option> and <option>acl_not_smtp_start</option> there is no default because
48537 these two are ACLs that are used only for their side effects. They cannot be
48538 used to accept or reject anything.
48539 </para>
48540 <para>
48541 For <option>acl_not_smtp</option>, <option>acl_smtp_auth</option>, <option>acl_smtp_connect</option>,
48542 <option>acl_smtp_data</option>, <option>acl_smtp_helo</option>, <option>acl_smtp_mail</option>, <option>acl_smtp_mailauth</option>,
48543 <option>acl_smtp_mime</option>, <option>acl_smtp_predata</option>, and <option>acl_smtp_starttls</option>, the action
48544 when the ACL is not defined is <quote>accept</quote>.
48545 </para>
48546 <para>
48547 For the others (<option>acl_smtp_etrn</option>, <option>acl_smtp_expn</option>, <option>acl_smtp_rcpt</option>, and
48548 <option>acl_smtp_vrfy</option>), the action when the ACL is not defined is <quote>deny</quote>.
48549 This means that <option>acl_smtp_rcpt</option> must be defined in order to receive any
48550 messages over an SMTP connection. For an example, see the ACL in the default
48551 configuration file.
48552 </para>
48553 </section>
48554 <section id="SECID198">
48555 <title>Data for message ACLs</title>
48556 <para>
48557 <indexterm role="concept">
48558 <primary>access control lists (ACLs)</primary>
48559 <secondary>data for message ACL</secondary>
48560 </indexterm>
48561 <indexterm role="variable">
48562 <primary><varname>$domain</varname></primary>
48563 </indexterm>
48564 <indexterm role="variable">
48565 <primary><varname>$local_part</varname></primary>
48566 </indexterm>
48567 <indexterm role="variable">
48568 <primary><varname>$sender_address</varname></primary>
48569 </indexterm>
48570 <indexterm role="variable">
48571 <primary><varname>$sender_host_address</varname></primary>
48572 </indexterm>
48573 <indexterm role="variable">
48574 <primary><varname>$smtp_command</varname></primary>
48575 </indexterm>
48576 When a MAIL or RCPT ACL, or either of the DATA ACLs, is running, the variables
48577 that contain information about the host and the message&#x2019;s sender (for example,
48578 <varname>$sender_host_address</varname> and <varname>$sender_address</varname>) are set, and can be used in ACL
48579 statements. In the case of RCPT (but not MAIL or DATA), <varname>$domain</varname> and
48580 <varname>$local_part</varname> are set from the argument address. The entire SMTP command
48581 is available in <varname>$smtp_command</varname>.
48582 </para>
48583 <para>
48584 When an ACL for the AUTH parameter of MAIL is running, the variables that
48585 contain information about the host are set, but <varname>$sender_address</varname> is not yet
48586 set. Section <xref linkend="SECTauthparamail"/> contains a discussion of this parameter and
48587 how it is used.
48588 </para>
48589 <para>
48590 <indexterm role="variable">
48591 <primary><varname>$message_size</varname></primary>
48592 </indexterm>
48593 The <varname>$message_size</varname> variable is set to the value of the SIZE parameter on
48594 the MAIL command at MAIL, RCPT and pre-data time, or to -1 if
48595 that parameter is not given. The value is updated to the true message size by
48596 the time the final DATA ACL is run (after the message data has been
48597 received).
48598 </para>
48599 <para>
48600 <indexterm role="variable">
48601 <primary><varname>$rcpt_count</varname></primary>
48602 </indexterm>
48603 <indexterm role="variable">
48604 <primary><varname>$recipients_count</varname></primary>
48605 </indexterm>
48606 The <varname>$rcpt_count</varname> variable increases by one for each RCPT command received.
48607 The <varname>$recipients_count</varname> variable increases by one each time a RCPT command is
48608 accepted, so while an ACL for RCPT is being processed, it contains the number
48609 of previously accepted recipients. At DATA time (for both the DATA ACLs),
48610 <varname>$rcpt_count</varname> contains the total number of RCPT commands, and
48611 <varname>$recipients_count</varname> contains the total number of accepted recipients.
48612 </para>
48613 </section>
48614 <section id="SECTdatfornon">
48615 <title>Data for non-message ACLs</title>
48616 <para>
48617 <indexterm role="concept">
48618 <primary>access control lists (ACLs)</primary>
48619 <secondary>data for non-message ACL</secondary>
48620 </indexterm>
48621 <indexterm role="variable">
48622 <primary><varname>$smtp_command_argument</varname></primary>
48623 </indexterm>
48624 <indexterm role="variable">
48625 <primary><varname>$smtp_command</varname></primary>
48626 </indexterm>
48627 When an ACL is being run for AUTH, EHLO, ETRN, EXPN, HELO, STARTTLS, or VRFY,
48628 the remainder of the SMTP command line is placed in <varname>$smtp_command_argument</varname>,
48629 and the entire SMTP command is available in <varname>$smtp_command</varname>.
48630 These variables can be tested using a <option>condition</option> condition. For example,
48631 here is an ACL for use with AUTH, which insists that either the session is
48632 encrypted, or the CRAM-MD5 authentication method is used. In other words, it
48633 does not permit authentication methods that use cleartext passwords on
48634 unencrypted connections.
48635 </para>
48636 <literallayout class="monospaced">
48637 acl_check_auth:
48638   accept encrypted = *
48639   accept condition = ${if eq{${uc:$smtp_command_argument}}\
48640                      {CRAM-MD5}}
48641   deny   message   = TLS encryption or CRAM-MD5 required
48642 </literallayout>
48643 <para>
48644 (Another way of applying this restriction is to arrange for the authenticators
48645 that use cleartext passwords not to be advertised when the connection is not
48646 encrypted. You can use the generic <option>server_advertise_condition</option> authenticator
48647 option to do this.)
48648 </para>
48649 </section>
48650 <section id="SECID199">
48651 <title>Format of an ACL</title>
48652 <para>
48653 <indexterm role="concept">
48654 <primary>access control lists (ACLs)</primary>
48655 <secondary>format of</secondary>
48656 </indexterm>
48657 <indexterm role="concept">
48658 <primary>access control lists (ACLs)</primary>
48659 <secondary>verbs, definition of</secondary>
48660 </indexterm>
48661 An individual ACL consists of a number of statements. Each statement starts
48662 with a verb, optionally followed by a number of conditions and <quote>modifiers</quote>.
48663 Modifiers can change the way the verb operates, define error and log messages,
48664 set variables, insert delays, and vary the processing of accepted messages.
48665 </para>
48666 <para>
48667 If all the conditions are met, the verb is obeyed. The same condition may be
48668 used (with different arguments) more than once in the same statement. This
48669 provides a means of specifying an <quote>and</quote> conjunction between conditions. For
48670 example:
48671 </para>
48672 <literallayout class="monospaced">
48673 deny  dnslists = list1.example
48674 dnslists = list2.example
48675 </literallayout>
48676 <para>
48677 If there are no conditions, the verb is always obeyed. Exim stops evaluating
48678 the conditions and modifiers when it reaches a condition that fails. What
48679 happens then depends on the verb (and in one case, on a special modifier). Not
48680 all the conditions make sense at every testing point. For example, you cannot
48681 test a sender address in the ACL that is run for a VRFY command.
48682 </para>
48683 </section>
48684 <section id="SECID200">
48685 <title>ACL verbs</title>
48686 <para>
48687 The ACL verbs are as follows:
48688 </para>
48689 <itemizedlist>
48690 <listitem>
48691 <para>
48692 <indexterm role="concept">
48693 <primary><option>accept</option> ACL verb</primary>
48694 </indexterm>
48695 <option>accept</option>: If all the conditions are met, the ACL returns <quote>accept</quote>. If any
48696 of the conditions are not met, what happens depends on whether <option>endpass</option>
48697 appears among the conditions (for syntax see below). If the failing condition
48698 is before <option>endpass</option>, control is passed to the next ACL statement; if it is
48699 after <option>endpass</option>, the ACL returns <quote>deny</quote>. Consider this statement, used to
48700 check a RCPT command:
48701 </para>
48702 <literallayout class="monospaced">
48703 accept domains = +local_domains
48704 endpass
48705 verify = recipient
48706 </literallayout>
48707 <para>
48708 If the recipient domain does not match the <option>domains</option> condition, control
48709 passes to the next statement. If it does match, the recipient is verified, and
48710 the command is accepted if verification succeeds. However, if verification
48711 fails, the ACL yields <quote>deny</quote>, because the failing condition is after
48712 <option>endpass</option>.
48713 </para>
48714 <para>
48715 The <option>endpass</option> feature has turned out to be confusing to many people, so its
48716 use is not recommended nowadays. It is always possible to rewrite an ACL so
48717 that <option>endpass</option> is not needed, and it is no longer used in the default
48718 configuration.
48719 </para>
48720 <para>
48721 <indexterm role="concept">
48722 <primary><option>message</option> ACL modifier</primary>
48723 <secondary>with <option>accept</option></secondary>
48724 </indexterm>
48725 If a <option>message</option> modifier appears on an <option>accept</option> statement, its action
48726 depends on whether or not <option>endpass</option> is present. In the absence of <option>endpass</option>
48727 (when an <option>accept</option> verb either accepts or passes control to the next
48728 statement), <option>message</option> can be used to vary the message that is sent when an
48729 SMTP command is accepted. For example, in a RCPT ACL you could have:
48730 </para>
48731 <literallayout>
48732 <literal>accept  </literal>&lt;<emphasis>some conditions</emphasis>&gt;
48733 <literal>        message = OK, I will allow you through today</literal>
48734 </literallayout>
48735 <para>
48736 You can specify an SMTP response code, optionally followed by an <quote>extended
48737 response code</quote> at the start of the message, but the first digit must be the
48738 same as would be sent by default, which is 2 for an <option>accept</option> verb.
48739 </para>
48740 <para>
48741 If <option>endpass</option> is present in an <option>accept</option> statement, <option>message</option> specifies
48742 an error message that is used when access is denied. This behaviour is retained
48743 for backward compatibility, but current <quote>best practice</quote> is to avoid the use
48744 of <option>endpass</option>.
48745 </para>
48746 </listitem>
48747 <listitem>
48748 <para>
48749 <indexterm role="concept">
48750 <primary><option>defer</option> ACL verb</primary>
48751 </indexterm>
48752 <option>defer</option>: If all the conditions are true, the ACL returns <quote>defer</quote> which, in
48753 an SMTP session, causes a 4<emphasis>xx</emphasis> response to be given. For a non-SMTP ACL,
48754 <option>defer</option> is the same as <option>deny</option>, because there is no way of sending a
48755 temporary error. For a RCPT command, <option>defer</option> is much the same as using a
48756 <command>redirect</command> router and <literal>:defer:</literal> while verifying, but the <option>defer</option> verb can
48757 be used in any ACL, and even for a recipient it might be a simpler approach.
48758 </para>
48759 </listitem>
48760 <listitem>
48761 <para>
48762 <indexterm role="concept">
48763 <primary><option>deny</option> ACL verb</primary>
48764 </indexterm>
48765 <option>deny</option>: If all the conditions are met, the ACL returns <quote>deny</quote>. If any of
48766 the conditions are not met, control is passed to the next ACL statement. For
48767 example,
48768 </para>
48769 <literallayout class="monospaced">
48770 deny dnslists = blackholes.mail-abuse.org
48771 </literallayout>
48772 <para>
48773 rejects commands from hosts that are on a DNS black list.
48774 </para>
48775 </listitem>
48776 <listitem>
48777 <para>
48778 <indexterm role="concept">
48779 <primary><option>discard</option> ACL verb</primary>
48780 </indexterm>
48781 <option>discard</option>: This verb behaves like <option>accept</option>, except that it returns
48782 <quote>discard</quote> from the ACL instead of <quote>accept</quote>. It is permitted only on ACLs
48783 that are concerned with receiving messages. When all the conditions are true,
48784 the sending entity receives a <quote>success</quote> response. However, <option>discard</option> causes
48785 recipients to be discarded. If it is used in an ACL for RCPT, just the one
48786 recipient is discarded; if used for MAIL, DATA or in the non-SMTP ACL, all the
48787 message&#x2019;s recipients are discarded. Recipients that are discarded before DATA
48788 do not appear in the log line when the <option>received_recipients</option> log selector is set.
48789 </para>
48790 <para>
48791 If the <option>log_message</option> modifier is set when <option>discard</option> operates,
48792 its contents are added to the line that is automatically written to the log.
48793 The <option>message</option> modifier operates exactly as it does for <option>accept</option>.
48794 </para>
48795 </listitem>
48796 <listitem>
48797 <para>
48798 <indexterm role="concept">
48799 <primary><option>drop</option> ACL verb</primary>
48800 </indexterm>
48801 <option>drop</option>: This verb behaves like <option>deny</option>, except that an SMTP connection is
48802 forcibly closed after the 5<emphasis>xx</emphasis> error message has been sent. For example:
48803 </para>
48804 <literallayout class="monospaced">
48805 drop   message   = I don't take more than 20 RCPTs
48806        condition = ${if &gt; {$rcpt_count}{20}}
48807 </literallayout>
48808 <para>
48809 There is no difference between <option>deny</option> and <option>drop</option> for the connect-time ACL.
48810 The connection is always dropped after sending a 550 response.
48811 </para>
48812 </listitem>
48813 <listitem>
48814 <para>
48815 <indexterm role="concept">
48816 <primary><option>require</option> ACL verb</primary>
48817 </indexterm>
48818 <option>require</option>: If all the conditions are met, control is passed to the next ACL
48819 statement. If any of the conditions are not met, the ACL returns <quote>deny</quote>. For
48820 example, when checking a RCPT command,
48821 </para>
48822 <literallayout class="monospaced">
48823 require message = Sender did not verify
48824         verify  = sender
48825 </literallayout>
48826 <para>
48827 passes control to subsequent statements only if the message&#x2019;s sender can be
48828 verified. Otherwise, it rejects the command. Note the positioning of the
48829 <option>message</option> modifier, before the <option>verify</option> condition. The reason for this is
48830 discussed in section <xref linkend="SECTcondmodproc"/>.
48831 </para>
48832 </listitem>
48833 <listitem>
48834 <para>
48835 <indexterm role="concept">
48836 <primary><option>warn</option> ACL verb</primary>
48837 </indexterm>
48838 <option>warn</option>: If all the conditions are true, a line specified by the
48839 <option>log_message</option> modifier is written to Exim&#x2019;s main log. Control always passes
48840 to the next ACL statement. If any condition is false, the log line is not
48841 written. If an identical log line is requested several times in the same
48842 message, only one copy is actually written to the log. If you want to force
48843 duplicates to be written, use the <option>logwrite</option> modifier instead.
48844 </para>
48845 <para>
48846 If <option>log_message</option> is not present, a <option>warn</option> verb just checks its conditions
48847 and obeys any <quote>immediate</quote> modifiers (such as <option>control</option>, <option>set</option>,
48848 <option>logwrite</option>, and <option>add_header</option>) that appear before the first failing
48849 condition. There is more about adding header lines in section
48850 <xref linkend="SECTaddheadacl"/>.
48851 </para>
48852 <para>
48853 If any condition on a <option>warn</option> statement cannot be completed (that is, there is
48854 some sort of defer), the log line specified by <option>log_message</option> is not written.
48855 This does not include the case of a forced failure from a lookup, which
48856 is considered to be a successful completion. After a defer, no further
48857 conditions or modifiers in the <option>warn</option> statement are processed. The incident
48858 is logged, and the ACL continues to be processed, from the next statement
48859 onwards.
48860 </para>
48861 <para>
48862 <indexterm role="variable">
48863 <primary><varname>$acl_verify_message</varname></primary>
48864 </indexterm>
48865 When one of the <option>warn</option> conditions is an address verification that fails, the
48866 text of the verification failure message is in <varname>$acl_verify_message</varname>. If you
48867 want this logged, you must set it up explicitly. For example:
48868 </para>
48869 <literallayout class="monospaced">
48870 warn   !verify = sender
48871        log_message = sender verify failed: $acl_verify_message
48872 </literallayout>
48873 </listitem>
48874 </itemizedlist>
48875 <para>
48876 At the end of each ACL there is an implicit unconditional <option>deny</option>.
48877 </para>
48878 <para>
48879 As you can see from the examples above, the conditions and modifiers are
48880 written one to a line, with the first one on the same line as the verb, and
48881 subsequent ones on following lines. If you have a very long condition, you can
48882 continue it onto several physical lines by the usual backslash continuation
48883 mechanism. It is conventional to align the conditions vertically.
48884 </para>
48885 </section>
48886 <section id="SECTaclvariables">
48887 <title>ACL variables</title>
48888 <para>
48889 <indexterm role="concept">
48890 <primary>access control lists (ACLs)</primary>
48891 <secondary>variables</secondary>
48892 </indexterm>
48893 There are some special variables that can be set during ACL processing. They
48894 can be used to pass information between different ACLs, different invocations
48895 of the same ACL in the same SMTP connection, and between ACLs and the routers,
48896 transports, and filters that are used to deliver a message. The names of these
48897 variables must begin with <varname>$acl_c</varname> or <varname>$acl_m</varname>, followed either by a digit or
48898 an underscore, but the remainder of the name can be any sequence of
48899 alphanumeric characters and underscores that you choose. There is no limit on
48900 the number of ACL variables. The two sets act as follows:
48901 </para>
48902 <itemizedlist>
48903 <listitem>
48904 <para>
48905 The values of those variables whose names begin with <varname>$acl_c</varname> persist
48906 throughout an SMTP connection. They are never reset. Thus, a value that is set
48907 while receiving one message is still available when receiving the next message
48908 on the same SMTP connection.
48909 </para>
48910 </listitem>
48911 <listitem>
48912 <para>
48913 The values of those variables whose names begin with <varname>$acl_m</varname> persist only
48914 while a message is being received. They are reset afterwards. They are also
48915 reset by MAIL, RSET, EHLO, HELO, and after starting up a TLS session.
48916 </para>
48917 </listitem>
48918 </itemizedlist>
48919 <para>
48920 When a message is accepted, the current values of all the ACL variables are
48921 preserved with the message and are subsequently made available at delivery
48922 time. The ACL variables are set by a modifier called <option>set</option>. For example:
48923 </para>
48924 <literallayout class="monospaced">
48925 accept hosts = whatever
48926        set acl_m4 = some value
48927 accept authenticated = *
48928        set acl_c_auth = yes
48929 </literallayout>
48930 <para>
48931 <emphasis role="bold">Note</emphasis>: A leading dollar sign is not used when naming a variable that is to
48932 be set. If you want to set a variable without taking any action, you can use a
48933 <option>warn</option> verb without any other modifiers or conditions.
48934 </para>
48935 <para>
48936 <indexterm role="option">
48937 <primary><option>strict_acl_vars</option></primary>
48938 </indexterm>
48939 What happens if a syntactically valid but undefined ACL variable is
48940 referenced depends on the setting of the <option>strict_acl_vars</option> option. If it is
48941 false (the default), an empty string is substituted; if it is true, an
48942 error is generated.
48943 </para>
48944 <para>
48945 Versions of Exim before 4.64 have a limited set of numbered variables, but
48946 their names are compatible, so there is no problem with upgrading.
48947 </para>
48948 </section>
48949 <section id="SECTcondmodproc">
48950 <title>Condition and modifier processing</title>
48951 <para>
48952 <indexterm role="concept">
48953 <primary>access control lists (ACLs)</primary>
48954 <secondary>conditions; processing</secondary>
48955 </indexterm>
48956 <indexterm role="concept">
48957 <primary>access control lists (ACLs)</primary>
48958 <secondary>modifiers; processing</secondary>
48959 </indexterm>
48960 An exclamation mark preceding a condition negates its result. For example:
48961 </para>
48962 <literallayout class="monospaced">
48963 deny   domains = *.dom.example
48964       !verify  = recipient
48965 </literallayout>
48966 <para>
48967 causes the ACL to return <quote>deny</quote> if the recipient domain ends in
48968 <emphasis>dom.example</emphasis> and the recipient address cannot be verified. Sometimes
48969 negation can be used on the right-hand side of a condition. For example, these
48970 two statements are equivalent:
48971 </para>
48972 <literallayout class="monospaced">
48973 deny  hosts = !192.168.3.4
48974 deny !hosts =  192.168.3.4
48975 </literallayout>
48976 <para>
48977 However, for many conditions (<option>verify</option> being a good example), only left-hand
48978 side negation of the whole condition is possible.
48979 </para>
48980 <para>
48981 The arguments of conditions and modifiers are expanded. A forced failure
48982 of an expansion causes a condition to be ignored, that is, it behaves as if the
48983 condition is true. Consider these two statements:
48984 </para>
48985 <literallayout class="monospaced">
48986 accept  senders = ${lookup{$host_name}lsearch\
48987                   {/some/file}{$value}fail}
48988 accept  senders = ${lookup{$host_name}lsearch\
48989                   {/some/file}{$value}{}}
48990 </literallayout>
48991 <para>
48992 Each attempts to look up a list of acceptable senders. If the lookup succeeds,
48993 the returned list is searched, but if the lookup fails the behaviour is
48994 different in the two cases. The <option>fail</option> in the first statement causes the
48995 condition to be ignored, leaving no further conditions. The <option>accept</option> verb
48996 therefore succeeds. The second statement, however, generates an empty list when
48997 the lookup fails. No sender can match an empty list, so the condition fails,
48998 and therefore the <option>accept</option> also fails.
48999 </para>
49000 <para>
49001 ACL modifiers appear mixed in with conditions in ACL statements. Some of them
49002 specify actions that are taken as the conditions for a statement are checked;
49003 others specify text for messages that are used when access is denied or a
49004 warning is generated. The <option>control</option> modifier affects the way an incoming
49005 message is handled.
49006 </para>
49007 <para>
49008 The positioning of the modifiers in an ACL statement important, because the
49009 processing of a verb ceases as soon as its outcome is known. Only those
49010 modifiers that have already been encountered will take effect. For example,
49011 consider this use of the <option>message</option> modifier:
49012 </para>
49013 <literallayout class="monospaced">
49014 require message = Can't verify sender
49015         verify  = sender
49016         message = Can't verify recipient
49017         verify  = recipient
49018         message = This message cannot be used
49019 </literallayout>
49020 <para>
49021 If sender verification fails, Exim knows that the result of the statement is
49022 <quote>deny</quote>, so it goes no further. The first <option>message</option> modifier has been seen,
49023 so its text is used as the error message. If sender verification succeeds, but
49024 recipient verification fails, the second message is used. If recipient
49025 verification succeeds, the third message becomes <quote>current</quote>, but is never used
49026 because there are no more conditions to cause failure.
49027 </para>
49028 <para>
49029 For the <option>deny</option> verb, on the other hand, it is always the last <option>message</option>
49030 modifier that is used, because all the conditions must be true for rejection to
49031 happen. Specifying more than one <option>message</option> modifier does not make sense, and
49032 the message can even be specified after all the conditions. For example:
49033 </para>
49034 <literallayout class="monospaced">
49035 deny   hosts = ...
49036       !senders = *@my.domain.example
49037        message = Invalid sender from client host
49038 </literallayout>
49039 <para>
49040 The <quote>deny</quote> result does not happen until the end of the statement is reached,
49041 by which time Exim has set up the message.
49042 </para>
49043 </section>
49044 <section id="SECTACLmodi">
49045 <title>ACL modifiers</title>
49046 <para>
49047 <indexterm role="concept">
49048 <primary>access control lists (ACLs)</primary>
49049 <secondary>modifiers; list of</secondary>
49050 </indexterm>
49051 The ACL modifiers are as follows:
49052 </para>
49053 <variablelist>
49054 <varlistentry>
49055 <term><emphasis role="bold">add_header</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
49056 <listitem>
49057 <para>
49058 This modifier specifies one or more header lines that are to be added to an
49059 incoming message, assuming, of course, that the message is ultimately
49060 accepted. For details, see section <xref linkend="SECTaddheadacl"/>.
49061 </para>
49062 </listitem></varlistentry>
49063 <varlistentry>
49064 <term><emphasis role="bold">continue</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
49065 <listitem>
49066 <para>
49067 <indexterm role="concept">
49068 <primary><option>continue</option> ACL modifier</primary>
49069 </indexterm>
49070 <indexterm role="concept">
49071 <primary>database</primary>
49072 <secondary>updating in ACL</secondary>
49073 </indexterm>
49074 This modifier does nothing of itself, and processing of the ACL always
49075 continues with the next condition or modifier. The value of <option>continue</option> is in
49076 the side effects of expanding its argument. Typically this could be used to
49077 update a database. It is really just a syntactic tidiness, to avoid having to
49078 write rather ugly lines like this:
49079 </para>
49080 <literallayout>
49081 <literal>condition = ${if eq{0}{</literal>&lt;<emphasis>some expansion</emphasis>&gt;<literal>}{true}{true}}</literal>
49082 </literallayout>
49083 <para>
49084 Instead, all you need is
49085 </para>
49086 <literallayout>
49087 <literal>continue = </literal>&lt;<emphasis>some expansion</emphasis>&gt;
49088 </literallayout>
49089 </listitem></varlistentry>
49090 <varlistentry>
49091 <term><emphasis role="bold">control</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
49092 <listitem>
49093 <para>
49094 <indexterm role="concept">
49095 <primary><option>control</option> ACL modifier</primary>
49096 </indexterm>
49097 This modifier affects the subsequent processing of the SMTP connection or of an
49098 incoming message that is accepted. The effect of the first type of control
49099 lasts for the duration of the connection, whereas the effect of the second type
49100 lasts only until the current message has been received. The message-specific
49101 controls always apply to the whole message, not to individual recipients,
49102 even if the <option>control</option> modifier appears in a RCPT ACL.
49103 </para>
49104 <para>
49105 As there are now quite a few controls that can be applied, they are described
49106 separately in section <xref linkend="SECTcontrols"/>. The <option>control</option> modifier can be used
49107 in several different ways. For example:
49108 </para>
49109 <itemizedlist>
49110 <listitem>
49111 <para>
49112 It can be at the end of an <option>accept</option> statement:
49113 </para>
49114 <literallayout class="monospaced">
49115     accept  ...some conditions
49116             control = queue_only
49117 </literallayout>
49118 <para>
49119 In this case, the control is applied when this statement yields <quote>accept</quote>, in
49120 other words, when the conditions are all true.
49121 </para>
49122 </listitem>
49123 <listitem>
49124 <para>
49125 It can be in the middle of an <option>accept</option> statement:
49126 </para>
49127 <literallayout class="monospaced">
49128     accept  ...some conditions...
49129             control = queue_only
49130             ...some more conditions...
49131 </literallayout>
49132 <para>
49133 If the first set of conditions are true, the control is applied, even if the
49134 statement does not accept because one of the second set of conditions is false.
49135 In this case, some subsequent statement must yield <quote>accept</quote> for the control
49136 to be relevant.
49137 </para>
49138 </listitem>
49139 <listitem>
49140 <para>
49141 It can be used with <option>warn</option> to apply the control, leaving the
49142 decision about accepting or denying to a subsequent verb. For
49143 example:
49144 </para>
49145 <literallayout class="monospaced">
49146     warn    ...some conditions...
49147             control = freeze
49148     accept  ...
49149 </literallayout>
49150 <para>
49151 This example of <option>warn</option> does not contain <option>message</option>, <option>log_message</option>, or
49152 <option>logwrite</option>, so it does not add anything to the message and does not write a
49153 log entry.
49154 </para>
49155 </listitem>
49156 <listitem>
49157 <para>
49158 If you want to apply a control unconditionally, you can use it with a
49159 <option>require</option> verb. For example:
49160 </para>
49161 <literallayout class="monospaced">
49162     require  control = no_multiline_responses
49163 </literallayout>
49164 </listitem>
49165 </itemizedlist>
49166 </listitem></varlistentry>
49167 <varlistentry>
49168 <term><emphasis role="bold">delay</emphasis>&nbsp;=&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
49169 <listitem>
49170 <para>
49171 <indexterm role="concept">
49172 <primary><option>delay</option> ACL modifier</primary>
49173 </indexterm>
49174 <indexterm role="option">
49175 <primary><option>-bh</option></primary>
49176 </indexterm>
49177 This modifier may appear in any ACL. It causes Exim to wait for the time
49178 interval before proceeding. However, when testing Exim using the <option>-bh</option>
49179 option, the delay is not actually imposed (an appropriate message is output
49180 instead). The time is given in the usual Exim notation, and the delay happens
49181 as soon as the modifier is processed. In an SMTP session, pending output is
49182 flushed before the delay is imposed.
49183 </para>
49184 <para>
49185 Like <option>control</option>, <option>delay</option> can be used with <option>accept</option> or <option>deny</option>, for
49186 example:
49187 </para>
49188 <literallayout class="monospaced">
49189 deny    ...some conditions...
49190         delay = 30s
49191 </literallayout>
49192 <para>
49193 The delay happens if all the conditions are true, before the statement returns
49194 <quote>deny</quote>. Compare this with:
49195 </para>
49196 <literallayout class="monospaced">
49197 deny    delay = 30s
49198         ...some conditions...
49199 </literallayout>
49200 <para>
49201 which waits for 30s before processing the conditions. The <option>delay</option> modifier
49202 can also be used with <option>warn</option> and together with <option>control</option>:
49203 </para>
49204 <literallayout class="monospaced">
49205 warn    ...some conditions...
49206         delay = 2m
49207         control = freeze
49208 accept  ...
49209 </literallayout>
49210 <para>
49211 If <option>delay</option> is encountered when the SMTP PIPELINING extension is in use,
49212 responses to several commands are no longer buffered and sent in one packet (as
49213 they would normally be) because all output is flushed before imposing the
49214 delay. This optimization is disabled so that a number of small delays do not
49215 appear to the client as one large aggregated delay that might provoke an
49216 unwanted timeout. You can, however, disable output flushing for <option>delay</option> by
49217 using a <option>control</option> modifier to set <option>no_delay_flush</option>.
49218 </para>
49219 </listitem></varlistentry>
49220 <varlistentry>
49221 <term><emphasis role="bold">endpass</emphasis></term>
49222 <listitem>
49223 <para>
49224 <indexterm role="concept">
49225 <primary><option>endpass</option> ACL modifier</primary>
49226 </indexterm>
49227 This modifier, which has no argument, is recognized only in <option>accept</option> and
49228 <option>discard</option> statements. It marks the boundary between the conditions whose
49229 failure causes control to pass to the next statement, and the conditions whose
49230 failure causes the ACL to return <quote>deny</quote>. This concept has proved to be
49231 confusing to some people, so the use of <option>endpass</option> is no longer recommended as
49232 <quote>best practice</quote>. See the description of <option>accept</option> above for more details.
49233 </para>
49234 </listitem></varlistentry>
49235 <varlistentry>
49236 <term><emphasis role="bold">log_message</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
49237 <listitem>
49238 <para>
49239 <indexterm role="concept">
49240 <primary><option>log_message</option> ACL modifier</primary>
49241 </indexterm>
49242 This modifier sets up a message that is used as part of the log message if the
49243 ACL denies access or a <option>warn</option> statement&#x2019;s conditions are true. For example:
49244 </para>
49245 <literallayout class="monospaced">
49246 require log_message = wrong cipher suite $tls_cipher
49247         encrypted   = DES-CBC3-SHA
49248 </literallayout>
49249 <para>
49250 <option>log_message</option> is also used when recipients are discarded by <option>discard</option>. For
49251 example:
49252 </para>
49253 <literallayout>
49254 <literal>discard </literal>&lt;<emphasis>some conditions</emphasis>&gt;
49255 <literal>        log_message = Discarded $local_part@$domain because...</literal>
49256 </literallayout>
49257 <para>
49258 When access is denied, <option>log_message</option> adds to any underlying error message
49259 that may exist because of a condition failure. For example, while verifying a
49260 recipient address, a <emphasis>:fail:</emphasis> redirection might have already set up a
49261 message.
49262 </para>
49263 <para>
49264 The message may be defined before the conditions to which it applies, because
49265 the string expansion does not happen until Exim decides that access is to be
49266 denied. This means that any variables that are set by the condition are
49267 available for inclusion in the message. For example, the <varname>$dnslist_</varname>&lt;<emphasis>xxx</emphasis>&gt;
49268 variables are set after a DNS black list lookup succeeds. If the expansion of
49269 <option>log_message</option> fails, or if the result is an empty string, the modifier is
49270 ignored.
49271 </para>
49272 <para>
49273 <indexterm role="variable">
49274 <primary><varname>$acl_verify_message</varname></primary>
49275 </indexterm>
49276 If you want to use a <option>warn</option> statement to log the result of an address
49277 verification, you can use <varname>$acl_verify_message</varname> to include the verification
49278 error message.
49279 </para>
49280 <para>
49281 If <option>log_message</option> is used with a <option>warn</option> statement, <quote>Warning:</quote> is added to
49282 the start of the logged message. If the same warning log message is requested
49283 more than once while receiving  a single email message, only one copy is
49284 actually logged. If you want to log multiple copies, use <option>logwrite</option> instead
49285 of <option>log_message</option>. In the absence of <option>log_message</option> and <option>logwrite</option>, nothing
49286 is logged for a successful <option>warn</option> statement.
49287 </para>
49288 <para>
49289 If <option>log_message</option> is not present and there is no underlying error message (for
49290 example, from the failure of address verification), but <option>message</option> is present,
49291 the <option>message</option> text is used for logging rejections. However, if any text for
49292 logging contains newlines, only the first line is logged. In the absence of
49293 both <option>log_message</option> and <option>message</option>, a default built-in message is used for
49294 logging rejections.
49295 </para>
49296 </listitem></varlistentry>
49297 <varlistentry>
49298 <term><emphasis role="bold">log_reject_target</emphasis>&nbsp;=&nbsp;&lt;<emphasis>log name list</emphasis>&gt;</term>
49299 <listitem>
49300 <para>
49301 <indexterm role="concept">
49302 <primary><option>log_reject_target</option> ACL modifier</primary>
49303 </indexterm>
49304 <indexterm role="concept">
49305 <primary>logging in ACL</primary>
49306 <secondary>specifying which log</secondary>
49307 </indexterm>
49308 This modifier makes it possible to specify which logs are used for messages
49309 about ACL rejections. Its argument is a colon-separated list of words that can
49310 be <quote>main</quote>, <quote>reject</quote>, or <quote>panic</quote>. The default is <literal>main:reject</literal>. The list
49311 may be empty, in which case a rejection is not logged at all. For example, this
49312 ACL fragment writes no logging information when access is denied:
49313 </para>
49314 <literallayout>
49315 <literal>deny </literal>&lt;<emphasis>some conditions</emphasis>&gt;
49316 <literal>     log_reject_target =</literal>
49317 </literallayout>
49318 <para>
49319 This modifier can be used in SMTP and non-SMTP ACLs. It applies to both
49320 permanent and temporary rejections. Its effect lasts for the rest of the
49321 current ACL.
49322 </para>
49323 </listitem></varlistentry>
49324 <varlistentry>
49325 <term><emphasis role="bold">logwrite</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
49326 <listitem>
49327 <para>
49328 <indexterm role="concept">
49329 <primary><option>logwrite</option> ACL modifier</primary>
49330 </indexterm>
49331 <indexterm role="concept">
49332 <primary>logging in ACL</primary>
49333 <secondary>immediate</secondary>
49334 </indexterm>
49335 This modifier writes a message to a log file as soon as it is encountered when
49336 processing an ACL. (Compare <option>log_message</option>, which, except in the case of
49337 <option>warn</option> and <option>discard</option>, is used only if the ACL statement denies
49338 access.) The <option>logwrite</option> modifier can be used to log special incidents in
49339 ACLs. For example:
49340 </para>
49341 <literallayout>
49342 <literal>accept </literal>&lt;<emphasis>some special conditions</emphasis>&gt;
49343 <literal>       control  = freeze</literal>
49344 <literal>       logwrite = froze message because ...</literal>
49345 </literallayout>
49346 <para>
49347 By default, the message is written to the main log. However, it may begin
49348 with a colon, followed by a comma-separated list of log names, and then
49349 another colon, to specify exactly which logs are to be written. For
49350 example:
49351 </para>
49352 <literallayout class="monospaced">
49353 logwrite = :main,reject: text for main and reject logs
49354 logwrite = :panic: text for panic log only
49355 </literallayout>
49356 </listitem></varlistentry>
49357 <varlistentry>
49358 <term><emphasis role="bold">message</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
49359 <listitem>
49360 <para>
49361 <indexterm role="concept">
49362 <primary><option>message</option> ACL modifier</primary>
49363 </indexterm>
49364 This modifier sets up a text string that is expanded and used as a response
49365 message when an ACL statement terminates the ACL with an <quote>accept</quote>, <quote>deny</quote>,
49366 or <quote>defer</quote> response. (In the case of the <option>accept</option> and <option>discard</option> verbs,
49367 there is some complication if <option>endpass</option> is involved; see the description of
49368 <option>accept</option> for details.)
49369 </para>
49370 <para>
49371 The expansion of the message happens at the time Exim decides that the ACL is
49372 to end, not at the time it processes <option>message</option>. If the expansion fails, or
49373 generates an empty string, the modifier is ignored. Here is an example where
49374 <option>message</option> must be specified first, because the ACL ends with a rejection if
49375 the <option>hosts</option> condition fails:
49376 </para>
49377 <literallayout class="monospaced">
49378 require  message = Host not recognized
49379          hosts = 10.0.0.0/8
49380 </literallayout>
49381 <para>
49382 (Once a condition has failed, no further conditions or modifiers are
49383 processed.)
49384 </para>
49385 <para>
49386 <indexterm role="concept">
49387 <primary>SMTP</primary>
49388 <secondary>error codes</secondary>
49389 </indexterm>
49390 <indexterm role="option">
49391 <primary><option>smtp_banner</option></primary>
49392 </indexterm>
49393 For ACLs that are triggered by SMTP commands, the message is returned as part
49394 of the SMTP response. The use of <option>message</option> with <option>accept</option> (or <option>discard</option>)
49395 is meaningful only for SMTP, as no message is returned when a non-SMTP message
49396 is accepted. In the case of the connect ACL, accepting with a message modifier
49397 overrides the value of <option>smtp_banner</option>. For the EHLO/HELO ACL, a customized
49398 accept message may not contain more than one line (otherwise it will be
49399 truncated at the first newline and a panic logged), and it cannot affect the
49400 EHLO options.
49401 </para>
49402 <para>
49403 When SMTP is involved, the message may begin with an overriding response code,
49404 consisting of three digits optionally followed by an <quote>extended response code</quote>
49405 of the form <emphasis>n.n.n</emphasis>, each code being followed by a space. For example:
49406 </para>
49407 <literallayout class="monospaced">
49408 deny  message = 599 1.2.3 Host not welcome
49409       hosts = 192.168.34.0/24
49410 </literallayout>
49411 <para>
49412 The first digit of the supplied response code must be the same as would be sent
49413 by default. A panic occurs if it is not. Exim uses a 550 code when it denies
49414 access, but for the predata ACL, note that the default success code is 354, not
49415 2<emphasis>xx</emphasis>.
49416 </para>
49417 <para>
49418 Notwithstanding the previous paragraph, for the QUIT ACL, unlike the others,
49419 the message modifier cannot override the 221 response code.
49420 </para>
49421 <para>
49422 The text in a <option>message</option> modifier is literal; any quotes are taken as
49423 literals, but because the string is expanded, backslash escapes are processed
49424 anyway. If the message contains newlines, this gives rise to a multi-line SMTP
49425 response.
49426 </para>
49427 <para>
49428 <indexterm role="variable">
49429 <primary><varname>$acl_verify_message</varname></primary>
49430 </indexterm>
49431 If <option>message</option> is used on a statement that verifies an address, the message
49432 specified overrides any message that is generated by the verification process.
49433 However, the original message is available in the variable
49434 <varname>$acl_verify_message</varname>, so you can incorporate it into your message if you
49435 wish. In particular, if you want the text from <option>:fail:</option> items in <command>redirect</command>
49436 routers to be passed back as part of the SMTP response, you should either not
49437 use a <option>message</option> modifier, or make use of <varname>$acl_verify_message</varname>.
49438 </para>
49439 <para>
49440 For compatibility with previous releases of Exim, a <option>message</option> modifier that
49441 is used with a <option>warn</option> verb behaves in a similar way to the <option>add_header</option>
49442 modifier, but this usage is now deprecated. However, <option>message</option> acts only when
49443 all the conditions are true, wherever it appears in an ACL command, whereas
49444 <option>add_header</option> acts as soon as it is encountered. If <option>message</option> is used with
49445 <option>warn</option> in an ACL that is not concerned with receiving a message, it has no
49446 effect.
49447 </para>
49448 </listitem></varlistentry>
49449 <varlistentry>
49450 <term><emphasis role="bold">set</emphasis>&nbsp;&lt;<emphasis>acl_name</emphasis>&gt;&nbsp;=&nbsp;&lt;<emphasis>value</emphasis>&gt;</term>
49451 <listitem>
49452 <para>
49453 <indexterm role="concept">
49454 <primary><option>set</option> ACL modifier</primary>
49455 </indexterm>
49456 This modifier puts a value into one of the ACL variables (see section
49457 <xref linkend="SECTaclvariables"/>).
49458 </para>
49459 </listitem></varlistentry>
49460 </variablelist>
49461 </section>
49462 <section id="SECTcontrols">
49463 <title>Use of the control modifier</title>
49464 <para>
49465 <indexterm role="concept">
49466 <primary><option>control</option> ACL modifier</primary>
49467 </indexterm>
49468 The <option>control</option> modifier supports the following settings:
49469 </para>
49470 <variablelist>
49471 <varlistentry>
49472 <term><emphasis role="bold">control&nbsp;=&nbsp;allow_auth_unadvertised</emphasis></term>
49473 <listitem>
49474 <para>
49475 This modifier allows a client host to use the SMTP AUTH command even when it
49476 has not been advertised in response to EHLO. Furthermore, because there are
49477 apparently some really broken clients that do this, Exim will accept AUTH after
49478 HELO (rather than EHLO) when this control is set. It should be used only if you
49479 really need it, and you should limit its use to those broken clients that do
49480 not work without it. For example:
49481 </para>
49482 <literallayout class="monospaced">
49483 warn hosts   = 192.168.34.25
49484      control = allow_auth_unadvertised
49485 </literallayout>
49486 <para>
49487 Normally, when an Exim server receives an AUTH command, it checks the name of
49488 the authentication mechanism that is given in the command to ensure that it
49489 matches an advertised mechanism. When this control is set, the check that a
49490 mechanism has been advertised is bypassed. Any configured mechanism can be used
49491 by the client. This control is permitted only in the connection and HELO ACLs.
49492 </para>
49493 </listitem></varlistentry>
49494 <varlistentry>
49495 <term><emphasis role="bold">control&nbsp;=&nbsp;caseful_local_part</emphasis></term>
49496 <term><emphasis role="bold">control&nbsp;=&nbsp;caselower_local_part</emphasis></term>
49497 <listitem>
49498 <para>
49499 <indexterm role="concept">
49500 <primary>access control lists (ACLs)</primary>
49501 <secondary>case of local part in</secondary>
49502 </indexterm>
49503 <indexterm role="concept">
49504 <primary>case of local parts</primary>
49505 </indexterm>
49506 <indexterm role="variable">
49507 <primary><varname>$local_part</varname></primary>
49508 </indexterm>
49509 These two controls are permitted only in the ACL specified by <option>acl_smtp_rcpt</option>
49510 (that is, during RCPT processing). By default, the contents of <varname>$local_part</varname>
49511 are lower cased before ACL processing. If <quote>caseful_local_part</quote> is specified,
49512 any uppercase letters in the original local part are restored in <varname>$local_part</varname>
49513 for the rest of the ACL, or until a control that sets <quote>caselower_local_part</quote>
49514 is encountered.
49515 </para>
49516 <para>
49517 These controls affect only the current recipient. Moreover, they apply only to
49518 local part handling that takes place directly in the ACL (for example, as a key
49519 in lookups). If a test to verify the recipient is obeyed, the case-related
49520 handling of the local part during the verification is controlled by the router
49521 configuration (see the <option>caseful_local_part</option> generic router option).
49522 </para>
49523 <para>
49524 This facility could be used, for example, to add a spam score to local parts
49525 containing upper case letters. For example, using <varname>$acl_m4</varname> to accumulate the
49526 spam score:
49527 </para>
49528 <literallayout class="monospaced">
49529 warn  control = caseful_local_part
49530       set acl_m4 = ${eval:\
49531                      $acl_m4 + \
49532                      ${if match{$local_part}{[A-Z]}{1}{0}}\
49533                     }
49534       control = caselower_local_part
49535 </literallayout>
49536 <para>
49537 Notice that we put back the lower cased version afterwards, assuming that
49538 is what is wanted for subsequent tests.
49539 </para>
49540 </listitem></varlistentry>
49541 <varlistentry revisionflag="changed">
49542 <term><emphasis role="bold">control&nbsp;=&nbsp;debug/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
49543 <listitem>
49544 <para revisionflag="changed">
49545 <indexterm role="concept">
49546 <primary>access control lists (ACLs)</primary>
49547 <secondary>enabling debug logging</secondary>
49548 </indexterm>
49549 <indexterm role="concept">
49550 <primary>debugging</primary>
49551 <secondary>enabling from an ACL</secondary>
49552 </indexterm>
49553 This control turns on debug logging, almost as though Exim had been invoked
49554 with <literal>-d</literal>, with the output going to a new logfile, by default called
49555 <emphasis>debuglog</emphasis>.  The filename can be adjusted with the <emphasis>tag</emphasis> option, which
49556 may access any variables already defined.  The logging may be adjusted with
49557 the <emphasis>opts</emphasis> option, which takes the same values as the <literal>-d</literal> command-line
49558 option.  Some examples (which depend on variables that don&#x2019;t exist in all
49559 contexts):
49560 </para>
49561 <literallayout class="monospaced" revisionflag="changed">
49562       control = debug
49563       control = debug/tag=.$sender_host_address
49564       control = debug/opts=+expand+acl
49565       control = debug/tag=.$message_exim_id/opts=+expand
49566 </literallayout>
49567 </listitem></varlistentry>
49568 <varlistentry>
49569 <term><emphasis role="bold">control&nbsp;=&nbsp;enforce_sync</emphasis></term>
49570 <term><emphasis role="bold">control&nbsp;=&nbsp;no_enforce_sync</emphasis></term>
49571 <listitem>
49572 <para>
49573 <indexterm role="concept">
49574 <primary>SMTP</primary>
49575 <secondary>synchronization checking</secondary>
49576 </indexterm>
49577 <indexterm role="concept">
49578 <primary>synchronization checking in SMTP</primary>
49579 </indexterm>
49580 These controls make it possible to be selective about when SMTP synchronization
49581 is enforced. The global option <option>smtp_enforce_sync</option> specifies the initial
49582 state of the switch (it is true by default). See the description of this option
49583 in chapter <xref linkend="CHAPmainconfig"/> for details of SMTP synchronization checking.
49584 </para>
49585 <para>
49586 The effect of these two controls lasts for the remainder of the SMTP
49587 connection. They can appear in any ACL except the one for the non-SMTP
49588 messages. The most straightforward place to put them is in the ACL defined by
49589 <option>acl_smtp_connect</option>, which is run at the start of an incoming SMTP connection,
49590 before the first synchronization check. The expected use is to turn off the
49591 synchronization checks for badly-behaved hosts that you nevertheless need to
49592 work with.
49593 </para>
49594 </listitem></varlistentry>
49595 <varlistentry>
49596 <term><emphasis role="bold">control&nbsp;=&nbsp;fakedefer/</emphasis>&lt;<emphasis>message</emphasis>&gt;</term>
49597 <listitem>
49598 <para>
49599 <indexterm role="concept">
49600 <primary>fake defer</primary>
49601 </indexterm>
49602 <indexterm role="concept">
49603 <primary>defer, fake</primary>
49604 </indexterm>
49605 This control works in exactly the same way as <option>fakereject</option> (described below)
49606 except that it causes an SMTP 450 response after the message data instead of a
49607 550 response. You must take care when using <option>fakedefer</option> because it causes the
49608 messages to be duplicated when the sender retries. Therefore, you should not
49609 use <option>fakedefer</option> if the message is to be delivered normally.
49610 </para>
49611 </listitem></varlistentry>
49612 <varlistentry>
49613 <term><emphasis role="bold">control&nbsp;=&nbsp;fakereject/</emphasis>&lt;<emphasis>message</emphasis>&gt;</term>
49614 <listitem>
49615 <para>
49616 <indexterm role="concept">
49617 <primary>fake rejection</primary>
49618 </indexterm>
49619 <indexterm role="concept">
49620 <primary>rejection, fake</primary>
49621 </indexterm>
49622 This control is permitted only for the MAIL, RCPT, and DATA ACLs, in other
49623 words, only when an SMTP message is being received. If Exim accepts the
49624 message, instead the final 250 response, a 550 rejection message is sent.
49625 However, Exim proceeds to deliver the message as normal. The control applies
49626 only to the current message, not to any subsequent ones that may be received in
49627 the same SMTP connection.
49628 </para>
49629 <para>
49630 The text for the 550 response is taken from the <option>control</option> modifier. If no
49631 message is supplied, the following is used:
49632 </para>
49633 <literallayout class="monospaced">
49634 550-Your message has been rejected but is being
49635 550-kept for evaluation.
49636 550-If it was a legitimate message, it may still be
49637 550 delivered to the target recipient(s).
49638 </literallayout>
49639 <para>
49640 This facility should be used with extreme caution.
49641 </para>
49642 </listitem></varlistentry>
49643 <varlistentry>
49644 <term><emphasis role="bold">control&nbsp;=&nbsp;freeze</emphasis></term>
49645 <listitem>
49646 <para>
49647 <indexterm role="concept">
49648 <primary>frozen messages</primary>
49649 <secondary>forcing in ACL</secondary>
49650 </indexterm>
49651 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
49652 other words, only when a message is being received. If the message is accepted,
49653 it is placed on Exim&#x2019;s queue and frozen. The control applies only to the
49654 current message, not to any subsequent ones that may be received in the same
49655 SMTP connection.
49656 </para>
49657 <para>
49658 This modifier can optionally be followed by <literal>/no_tell</literal>. If the global option
49659 <option>freeze_tell</option> is set, it is ignored for the current message (that is, nobody
49660 is told about the freezing), provided all the <emphasis role="bold">control=freeze</emphasis> modifiers that
49661 are obeyed for the current message have the <literal>/no_tell</literal> option.
49662 </para>
49663 </listitem></varlistentry>
49664 <varlistentry>
49665 <term><emphasis role="bold">control&nbsp;=&nbsp;no_delay_flush</emphasis></term>
49666 <listitem>
49667 <para>
49668 <indexterm role="concept">
49669 <primary>SMTP</primary>
49670 <secondary>output flushing, disabling for delay</secondary>
49671 </indexterm>
49672 Exim normally flushes SMTP output before implementing a delay in an ACL, to
49673 avoid unexpected timeouts in clients when the SMTP PIPELINING extension is in
49674 use. This control, as long as it is encountered before the <option>delay</option> modifier,
49675 disables such output flushing.
49676 </para>
49677 </listitem></varlistentry>
49678 <varlistentry>
49679 <term><emphasis role="bold">control&nbsp;=&nbsp;no_callout_flush</emphasis></term>
49680 <listitem>
49681 <para>
49682 <indexterm role="concept">
49683 <primary>SMTP</primary>
49684 <secondary>output flushing, disabling for callout</secondary>
49685 </indexterm>
49686 Exim normally flushes SMTP output before performing a callout in an ACL, to
49687 avoid unexpected timeouts in clients when the SMTP PIPELINING extension is in
49688 use. This control, as long as it is encountered before the <option>verify</option> condition
49689 that causes the callout, disables such output flushing.
49690 </para>
49691 </listitem></varlistentry>
49692 <varlistentry>
49693 <term><emphasis role="bold">control&nbsp;=&nbsp;no_mbox_unspool</emphasis></term>
49694 <listitem>
49695 <para>
49696 This control is available when Exim is compiled with the content scanning
49697 extension. Content scanning may require a copy of the current message, or parts
49698 of it, to be written in <quote>mbox format</quote> to a spool file, for passing to a virus
49699 or spam scanner. Normally, such copies are deleted when they are no longer
49700 needed. If this control is set, the copies are not deleted. The control applies
49701 only to the current message, not to any subsequent ones that may be received in
49702 the same SMTP connection. It is provided for debugging purposes and is unlikely
49703 to be useful in production.
49704 </para>
49705 </listitem></varlistentry>
49706 <varlistentry>
49707 <term><emphasis role="bold">control&nbsp;=&nbsp;no_multiline_responses</emphasis></term>
49708 <listitem>
49709 <para>
49710 <indexterm role="concept">
49711 <primary>multiline responses, suppressing</primary>
49712 </indexterm>
49713 This control is permitted for any ACL except the one for non-SMTP messages.
49714 It seems that there are broken clients in use that cannot handle multiline
49715 SMTP responses, despite the fact that RFC 821 defined them over 20 years ago.
49716 </para>
49717 <para>
49718 If this control is set, multiline SMTP responses from ACL rejections are
49719 suppressed. One way of doing this would have been to put out these responses as
49720 one long line. However, RFC 2821 specifies a maximum of 512 bytes per response
49721 (<quote>use multiline responses for more</quote> it says &ndash; ha!), and some of the
49722 responses might get close to that. So this facility, which is after all only a
49723 sop to broken clients, is implemented by doing two very easy things:
49724 </para>
49725 <itemizedlist>
49726 <listitem>
49727 <para>
49728 Extra information that is normally output as part of a rejection caused by
49729 sender verification failure is omitted. Only the final line (typically <quote>sender
49730 verification failed</quote>) is sent.
49731 </para>
49732 </listitem>
49733 <listitem>
49734 <para>
49735 If a <option>message</option> modifier supplies a multiline response, only the first
49736 line is output.
49737 </para>
49738 </listitem>
49739 </itemizedlist>
49740 <para>
49741 The setting of the switch can, of course, be made conditional on the
49742 calling host. Its effect lasts until the end of the SMTP connection.
49743 </para>
49744 </listitem></varlistentry>
49745 <varlistentry>
49746 <term><emphasis role="bold">control&nbsp;=&nbsp;no_pipelining</emphasis></term>
49747 <listitem>
49748 <para>
49749 <indexterm role="concept">
49750 <primary>PIPELINING</primary>
49751 <secondary>suppressing advertising</secondary>
49752 </indexterm>
49753 This control turns off the advertising of the PIPELINING extension to SMTP in
49754 the current session. To be useful, it must be obeyed before Exim sends its
49755 response to an EHLO command. Therefore, it should normally appear in an ACL
49756 controlled by <option>acl_smtp_connect</option> or <option>acl_smtp_helo</option>. See also
49757 <option>pipelining_advertise_hosts</option>.
49758 </para>
49759 </listitem></varlistentry>
49760 <varlistentry>
49761 <term><emphasis role="bold">control&nbsp;=&nbsp;queue_only</emphasis></term>
49762 <listitem>
49763 <para>
49764 <indexterm role="option">
49765 <primary><option>queue_only</option></primary>
49766 </indexterm>
49767 <indexterm role="concept">
49768 <primary>queueing incoming messages</primary>
49769 </indexterm>
49770 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
49771 other words, only when a message is being received. If the message is accepted,
49772 it is placed on Exim&#x2019;s queue and left there for delivery by a subsequent queue
49773 runner. No immediate delivery process is started. In other words, it has the
49774 effect as the <option>queue_only</option> global option. However, the control applies only
49775 to the current message, not to any subsequent ones that may be received in the
49776 same SMTP connection.
49777 </para>
49778 </listitem></varlistentry>
49779 <varlistentry>
49780 <term><emphasis role="bold">control&nbsp;=&nbsp;submission/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
49781 <listitem>
49782 <para>
49783 <indexterm role="concept">
49784 <primary>message</primary>
49785 <secondary>submission</secondary>
49786 </indexterm>
49787 <indexterm role="concept">
49788 <primary>submission mode</primary>
49789 </indexterm>
49790 This control is permitted only for the MAIL, RCPT, and start of data ACLs (the
49791 latter is the one defined by <option>acl_smtp_predata</option>). Setting it tells Exim that
49792 the current message is a submission from a local MUA. In this case, Exim
49793 operates in <quote>submission mode</quote>, and applies certain fixups to the message if
49794 necessary. For example, it adds a <emphasis>Date:</emphasis> header line if one is not present.
49795 This control is not permitted in the <option>acl_smtp_data</option> ACL, because that is too
49796 late (the message has already been created).
49797 </para>
49798 <para>
49799 Chapter <xref linkend="CHAPmsgproc"/> describes the processing that Exim applies to
49800 messages. Section <xref linkend="SECTsubmodnon"/> covers the processing that happens in
49801 submission mode; the available options for this control are described there.
49802 The control applies only to the current message, not to any subsequent ones
49803 that may be received in the same SMTP connection.
49804 </para>
49805 </listitem></varlistentry>
49806 <varlistentry>
49807 <term><emphasis role="bold">control&nbsp;=&nbsp;suppress_local_fixups</emphasis></term>
49808 <listitem>
49809 <para>
49810 <indexterm role="concept">
49811 <primary>submission fixups, suppressing</primary>
49812 </indexterm>
49813 This control applies to locally submitted (non TCP/IP) messages, and is the
49814 complement of <literal>control = submission</literal>. It disables the fixups that are
49815 normally applied to locally-submitted messages. Specifically:
49816 </para>
49817 <itemizedlist>
49818 <listitem>
49819 <para>
49820 Any <emphasis>Sender:</emphasis> header line is left alone (in this respect, it is a
49821 dynamic version of <option>local_sender_retain</option>).
49822 </para>
49823 </listitem>
49824 <listitem>
49825 <para>
49826 No <emphasis>Message-ID:</emphasis>, <emphasis>From:</emphasis>, or <emphasis>Date:</emphasis> header lines are added.
49827 </para>
49828 </listitem>
49829 <listitem>
49830 <para>
49831 There is no check that <emphasis>From:</emphasis> corresponds to the actual sender.
49832 </para>
49833 </listitem>
49834 </itemizedlist>
49835 <para>
49836 This control may be useful when a remotely-originated message is accepted,
49837 passed to some scanning program, and then re-submitted for delivery. It can be
49838 used only in the <option>acl_smtp_mail</option>, <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>,
49839 and <option>acl_not_smtp_start</option> ACLs, because it has to be set before the message&#x2019;s
49840 data is read.
49841 </para>
49842 <para>
49843 <emphasis role="bold">Note:</emphasis> This control applies only to the current message, not to any others
49844 that are being submitted at the same time using <option>-bs</option> or <option>-bS</option>.
49845 </para>
49846 </listitem></varlistentry>
49847 </variablelist>
49848 </section>
49849 <section id="SECTsummesfix">
49850 <title>Summary of message fixup control</title>
49851 <para>
49852 All four possibilities for message fixups can be specified:
49853 </para>
49854 <itemizedlist>
49855 <listitem>
49856 <para>
49857 Locally submitted, fixups applied: the default.
49858 </para>
49859 </listitem>
49860 <listitem>
49861 <para>
49862 Locally submitted, no fixups applied: use
49863 <literal>control = suppress_local_fixups</literal>.
49864 </para>
49865 </listitem>
49866 <listitem>
49867 <para>
49868 Remotely submitted, no fixups applied: the default.
49869 </para>
49870 </listitem>
49871 <listitem>
49872 <para>
49873 Remotely submitted, fixups applied: use <literal>control = submission</literal>.
49874 </para>
49875 </listitem>
49876 </itemizedlist>
49877 </section>
49878 <section id="SECTaddheadacl">
49879 <title>Adding header lines in ACLs</title>
49880 <para>
49881 <indexterm role="concept">
49882 <primary>header lines</primary>
49883 <secondary>adding in an ACL</secondary>
49884 </indexterm>
49885 <indexterm role="concept">
49886 <primary>header lines</primary>
49887 <secondary>position of added lines</secondary>
49888 </indexterm>
49889 <indexterm role="concept">
49890 <primary><option>message</option> ACL modifier</primary>
49891 </indexterm>
49892 The <option>add_header</option> modifier can be used to add one or more extra header lines
49893 to an incoming message, as in this example:
49894 </para>
49895 <literallayout class="monospaced">
49896 warn dnslists = sbl.spamhaus.org : \
49897                 dialup.mail-abuse.org
49898      add_header = X-blacklisted-at: $dnslist_domain
49899 </literallayout>
49900 <para>
49901 The <option>add_header</option> modifier is permitted in the MAIL, RCPT, PREDATA, DATA,
49902 MIME, and non-SMTP ACLs (in other words, those that are concerned with
49903 receiving a message). The message must ultimately be accepted for
49904 <option>add_header</option> to have any significant effect. You can use <option>add_header</option> with
49905 any ACL verb, including <option>deny</option> (though this is potentially useful only in a
49906 RCPT ACL).
49907 </para>
49908 <para>
49909 If the data for the <option>add_header</option> modifier contains one or more newlines that
49910 are not followed by a space or a tab, it is assumed to contain multiple header
49911 lines. Each one is checked for valid syntax; <literal>X-ACL-Warn:</literal> is added to the
49912 front of any line that is not a valid header line.
49913 </para>
49914 <para>
49915 Added header lines are accumulated during the MAIL, RCPT, and predata ACLs.
49916 They are added to the message before processing the DATA and MIME ACLs.
49917 However, if an identical header line is requested more than once, only one copy
49918 is actually added to the message. Further header lines may be accumulated
49919 during the DATA and MIME ACLs, after which they are added to the message, again
49920 with duplicates suppressed. Thus, it is possible to add two identical header
49921 lines to an SMTP message, but only if one is added before DATA and one after.
49922 In the case of non-SMTP messages, new headers are accumulated during the
49923 non-SMTP ACLs, and are added to the message after all the ACLs have run. If a
49924 message is rejected after DATA or by the non-SMTP ACL, all added header lines
49925 are included in the entry that is written to the reject log.
49926 </para>
49927 <para>
49928 <indexterm role="concept">
49929 <primary>header lines</primary>
49930 <secondary>added; visibility of</secondary>
49931 </indexterm>
49932 Header lines are not visible in string expansions until they are added to the
49933 message. It follows that header lines defined in the MAIL, RCPT, and predata
49934 ACLs are not visible until the DATA ACL and MIME ACLs are run. Similarly,
49935 header lines that are added by the DATA or MIME ACLs are not visible in those
49936 ACLs. Because of this restriction, you cannot use header lines as a way of
49937 passing data between (for example) the MAIL and RCPT ACLs. If you want to do
49938 this, you can use ACL variables, as described in section
49939 <xref linkend="SECTaclvariables"/>.
49940 </para>
49941 <para>
49942 The <option>add_header</option> modifier acts immediately it is encountered during the
49943 processing of an ACL. Notice the difference between these two cases:
49944 </para>
49945 <literallayout>
49946 <literal>accept add_header = ADDED: some text</literal>
49947 <literal>       </literal>&lt;<emphasis>some condition</emphasis>&gt;
49948
49949 <literal>accept </literal>&lt;<emphasis>some condition</emphasis>&gt;
49950 <literal>       add_header = ADDED: some text</literal>
49951 </literallayout>
49952 <para>
49953 In the first case, the header line is always added, whether or not the
49954 condition is true. In the second case, the header line is added only if the
49955 condition is true. Multiple occurrences of <option>add_header</option> may occur in the same
49956 ACL statement. All those that are encountered before a condition fails are
49957 honoured.
49958 </para>
49959 <para>
49960 <indexterm role="concept">
49961 <primary><option>warn</option> ACL verb</primary>
49962 </indexterm>
49963 For compatibility with previous versions of Exim, a <option>message</option> modifier for a
49964 <option>warn</option> verb acts in the same way as <option>add_header</option>, except that it takes
49965 effect only if all the conditions are true, even if it appears before some of
49966 them. Furthermore, only the last occurrence of <option>message</option> is honoured. This
49967 usage of <option>message</option> is now deprecated. If both <option>add_header</option> and <option>message</option>
49968 are present on a <option>warn</option> verb, both are processed according to their
49969 specifications.
49970 </para>
49971 <para>
49972 By default, new header lines are added to a message at the end of the existing
49973 header lines. However, you can specify that any particular header line should
49974 be added right at the start (before all the <emphasis>Received:</emphasis> lines), immediately
49975 after the first block of <emphasis>Received:</emphasis> lines, or immediately before any line
49976 that is not a <emphasis>Received:</emphasis> or <emphasis>Resent-something:</emphasis> header.
49977 </para>
49978 <para>
49979 This is done by specifying <quote>:at_start:</quote>, <quote>:after_received:</quote>, or
49980 <quote>:at_start_rfc:</quote> (or, for completeness, <quote>:at_end:</quote>) before the text of the
49981 header line, respectively. (Header text cannot start with a colon, as there has
49982 to be a header name first.) For example:
49983 </para>
49984 <literallayout class="monospaced">
49985 warn add_header = \
49986        :after_received:X-My-Header: something or other...
49987 </literallayout>
49988 <para>
49989 If more than one header line is supplied in a single <option>add_header</option> modifier,
49990 each one is treated independently and can therefore be placed differently. If
49991 you add more than one line at the start, or after the Received: block, they end
49992 up in reverse order.
49993 </para>
49994 <para>
49995 <emphasis role="bold">Warning</emphasis>: This facility currently applies only to header lines that are
49996 added in an ACL. It does NOT work for header lines that are added in a
49997 system filter or in a router or transport.
49998 </para>
49999 </section>
50000 <section id="SECTaclconditions">
50001 <title>ACL conditions</title>
50002 <para>
50003 <indexterm role="concept">
50004 <primary>access control lists (ACLs)</primary>
50005 <secondary>conditions; list of</secondary>
50006 </indexterm>
50007 Some of conditions listed in this section are available only when Exim is
50008 compiled with the content-scanning extension. They are included here briefly
50009 for completeness. More detailed descriptions can be found in the discussion on
50010 content scanning in chapter <xref linkend="CHAPexiscan"/>.
50011 </para>
50012 <para>
50013 Not all conditions are relevant in all circumstances. For example, testing
50014 senders and recipients does not make sense in an ACL that is being run as the
50015 result of the arrival of an ETRN command, and checks on message headers can be
50016 done only in the ACLs specified by <option>acl_smtp_data</option> and <option>acl_not_smtp</option>. You
50017 can use the same condition (with different parameters) more than once in the
50018 same ACL statement. This provides a way of specifying an <quote>and</quote> conjunction.
50019 The conditions are as follows:
50020 </para>
50021 <variablelist>
50022 <varlistentry>
50023 <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>
50024 <listitem>
50025 <para>
50026 <indexterm role="concept">
50027 <primary>access control lists (ACLs)</primary>
50028 <secondary>nested</secondary>
50029 </indexterm>
50030 <indexterm role="concept">
50031 <primary>access control lists (ACLs)</primary>
50032 <secondary>indirect</secondary>
50033 </indexterm>
50034 <indexterm role="concept">
50035 <primary><option>acl</option> ACL condition</primary>
50036 </indexterm>
50037 The possible values of the argument are the same as for the
50038 <option>acl_smtp_</option><emphasis>xxx</emphasis> options. The named or inline ACL is run. If it returns
50039 <quote>accept</quote> the condition is true; if it returns <quote>deny</quote> the condition is
50040 false. If it returns <quote>defer</quote>, the current ACL returns <quote>defer</quote> unless the
50041 condition is on a <option>warn</option> verb. In that case, a <quote>defer</quote> return makes the
50042 condition false. This means that further processing of the <option>warn</option> verb
50043 ceases, but processing of the ACL continues.
50044 </para>
50045 <para>
50046 If the nested <option>acl</option> returns <quote>drop</quote> and the outer condition denies access,
50047 the connection is dropped. If it returns <quote>discard</quote>, the verb must be
50048 <option>accept</option> or <option>discard</option>, and the action is taken immediately &ndash; no further
50049 conditions are tested.
50050 </para>
50051 <para>
50052 ACLs may be nested up to 20 deep; the limit exists purely to catch runaway
50053 loops. This condition allows you to use different ACLs in different
50054 circumstances. For example, different ACLs can be used to handle RCPT commands
50055 for different local users or different local domains.
50056 </para>
50057 </listitem></varlistentry>
50058 <varlistentry>
50059 <term><emphasis role="bold">authenticated&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string&nbsp;list</emphasis>&gt;</term>
50060 <listitem>
50061 <para>
50062 <indexterm role="concept">
50063 <primary><option>authenticated</option> ACL condition</primary>
50064 </indexterm>
50065 <indexterm role="concept">
50066 <primary>authentication</primary>
50067 <secondary>ACL checking</secondary>
50068 </indexterm>
50069 <indexterm role="concept">
50070 <primary>access control lists (ACLs)</primary>
50071 <secondary>testing for authentication</secondary>
50072 </indexterm>
50073 If the SMTP connection is not authenticated, the condition is false. Otherwise,
50074 the name of the authenticator is tested against the list. To test for
50075 authentication by any authenticator, you can set
50076 </para>
50077 <literallayout class="monospaced">
50078 authenticated = *
50079 </literallayout>
50080 </listitem></varlistentry>
50081 <varlistentry>
50082 <term><emphasis role="bold">condition&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string</emphasis>&gt;</term>
50083 <listitem>
50084 <para>
50085 <indexterm role="concept">
50086 <primary><option>condition</option> ACL condition</primary>
50087 </indexterm>
50088 <indexterm role="concept">
50089 <primary>customizing</primary>
50090 <secondary>ACL condition</secondary>
50091 </indexterm>
50092 <indexterm role="concept">
50093 <primary>access control lists (ACLs)</primary>
50094 <secondary>customized test</secondary>
50095 </indexterm>
50096 <indexterm role="concept">
50097 <primary>access control lists (ACLs)</primary>
50098 <secondary>testing, customized</secondary>
50099 </indexterm>
50100 This feature allows you to make up custom conditions. If the result of
50101 expanding the string is an empty string, the number zero, or one of the strings
50102 <quote>no</quote> or <quote>false</quote>, the condition is false. If the result is any non-zero
50103 number, or one of the strings <quote>yes</quote> or <quote>true</quote>, the condition is true. For
50104 any other value, some error is assumed to have occurred, and the ACL returns
50105 <quote>defer</quote>. However, if the expansion is forced to fail, the condition is
50106 ignored. The effect is to treat it as true, whether it is positive or
50107 negative.
50108 </para>
50109 </listitem></varlistentry>
50110 <varlistentry>
50111 <term><emphasis role="bold">decode&nbsp;=&nbsp;</emphasis>&lt;<emphasis>location</emphasis>&gt;</term>
50112 <listitem>
50113 <para>
50114 <indexterm role="concept">
50115 <primary><option>decode</option> ACL condition</primary>
50116 </indexterm>
50117 This condition is available only when Exim is compiled with the
50118 content-scanning extension, and it is allowed only in the ACL defined by
50119 <option>acl_smtp_mime</option>. It causes the current MIME part to be decoded into a file.
50120 If all goes well, the condition is true. It is false only if there are
50121 problems such as a syntax error or a memory shortage. For more details, see
50122 chapter <xref linkend="CHAPexiscan"/>.
50123 </para>
50124 </listitem></varlistentry>
50125 <varlistentry>
50126 <term><emphasis role="bold">demime&nbsp;=&nbsp;</emphasis>&lt;<emphasis>extension&nbsp;list</emphasis>&gt;</term>
50127 <listitem>
50128 <para>
50129 <indexterm role="concept">
50130 <primary><option>demime</option> ACL condition</primary>
50131 </indexterm>
50132 This condition is available only when Exim is compiled with the
50133 content-scanning extension. Its use is described in section
50134 <xref linkend="SECTdemimecond"/>.
50135 </para>
50136 </listitem></varlistentry>
50137 <varlistentry>
50138 <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>
50139 <listitem>
50140 <para>
50141 <indexterm role="concept">
50142 <primary><option>dnslists</option> ACL condition</primary>
50143 </indexterm>
50144 <indexterm role="concept">
50145 <primary>DNS list</primary>
50146 <secondary>in ACL</secondary>
50147 </indexterm>
50148 <indexterm role="concept">
50149 <primary>black list (DNS)</primary>
50150 </indexterm>
50151 <indexterm role="concept">
50152 <primary>access control lists (ACLs)</primary>
50153 <secondary>testing a DNS list</secondary>
50154 </indexterm>
50155 This condition checks for entries in DNS black lists. These are also known as
50156 <quote>RBL lists</quote>, after the original Realtime Blackhole List, but note that the
50157 use of the lists at <emphasis>mail-abuse.org</emphasis> now carries a charge. There are too many
50158 different variants of this condition to describe briefly here. See sections
50159 <xref linkend="SECTmorednslists"/>&ndash;<xref linkend="SECTmorednslistslast"/> for details.
50160 </para>
50161 </listitem></varlistentry>
50162 <varlistentry>
50163 <term><emphasis role="bold">domains&nbsp;=&nbsp;</emphasis>&lt;<emphasis>domain&nbsp;list</emphasis>&gt;</term>
50164 <listitem>
50165 <para>
50166 <indexterm role="concept">
50167 <primary><option>domains</option> ACL condition</primary>
50168 </indexterm>
50169 <indexterm role="concept">
50170 <primary>domain</primary>
50171 <secondary>ACL checking</secondary>
50172 </indexterm>
50173 <indexterm role="concept">
50174 <primary>access control lists (ACLs)</primary>
50175 <secondary>testing a recipient domain</secondary>
50176 </indexterm>
50177 <indexterm role="variable">
50178 <primary><varname>$domain_data</varname></primary>
50179 </indexterm>
50180 This condition is relevant only after a RCPT command. It checks that the domain
50181 of the recipient address is in the domain list. If percent-hack processing is
50182 enabled, it is done before this test is done. If the check succeeds with a
50183 lookup, the result of the lookup is placed in <varname>$domain_data</varname> until the next
50184 <option>domains</option> test.
50185 </para>
50186 <para>
50187 <emphasis role="bold">Note carefully</emphasis> (because many people seem to fall foul of this): you cannot
50188 use <option>domains</option> in a DATA ACL.
50189 </para>
50190 </listitem></varlistentry>
50191 <varlistentry>
50192 <term><emphasis role="bold">encrypted&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string&nbsp;list</emphasis>&gt;</term>
50193 <listitem>
50194 <para>
50195 <indexterm role="concept">
50196 <primary><option>encrypted</option> ACL condition</primary>
50197 </indexterm>
50198 <indexterm role="concept">
50199 <primary>encryption</primary>
50200 <secondary>checking in an ACL</secondary>
50201 </indexterm>
50202 <indexterm role="concept">
50203 <primary>access control lists (ACLs)</primary>
50204 <secondary>testing for encryption</secondary>
50205 </indexterm>
50206 If the SMTP connection is not encrypted, the condition is false. Otherwise, the
50207 name of the cipher suite in use is tested against the list. To test for
50208 encryption without testing for any specific cipher suite(s), set
50209 </para>
50210 <literallayout class="monospaced">
50211 encrypted = *
50212 </literallayout>
50213 </listitem></varlistentry>
50214 <varlistentry>
50215 <term><emphasis role="bold">hosts&nbsp;=&nbsp;</emphasis>&lt;<emphasis>&nbsp;host&nbsp;list</emphasis>&gt;</term>
50216 <listitem>
50217 <para>
50218 <indexterm role="concept">
50219 <primary><option>hosts</option> ACL condition</primary>
50220 </indexterm>
50221 <indexterm role="concept">
50222 <primary>host</primary>
50223 <secondary>ACL checking</secondary>
50224 </indexterm>
50225 <indexterm role="concept">
50226 <primary>access control lists (ACLs)</primary>
50227 <secondary>testing the client host</secondary>
50228 </indexterm>
50229 This condition tests that the calling host matches the host list. If you have
50230 name lookups or wildcarded host names and IP addresses in the same host list,
50231 you should normally put the IP addresses first. For example, you could have:
50232 </para>
50233 <literallayout class="monospaced">
50234 accept hosts = 10.9.8.7 : dbm;/etc/friendly/hosts
50235 </literallayout>
50236 <para>
50237 The lookup in this example uses the host name for its key. This is implied by
50238 the lookup type <quote>dbm</quote>. (For a host address lookup you would use <quote>net-dbm</quote>
50239 and it wouldn&#x2019;t matter which way round you had these two items.)
50240 </para>
50241 <para>
50242 The reason for the problem with host names lies in the left-to-right way that
50243 Exim processes lists. It can test IP addresses without doing any DNS lookups,
50244 but when it reaches an item that requires a host name, it fails if it cannot
50245 find a host name to compare with the pattern. If the above list is given in the
50246 opposite order, the <option>accept</option> statement fails for a host whose name cannot be
50247 found, even if its IP address is 10.9.8.7.
50248 </para>
50249 <para>
50250 If you really do want to do the name check first, and still recognize the IP
50251 address even if the name lookup fails, you can rewrite the ACL like this:
50252 </para>
50253 <literallayout class="monospaced">
50254 accept hosts = dbm;/etc/friendly/hosts
50255 accept hosts = 10.9.8.7
50256 </literallayout>
50257 <para>
50258 The default action on failing to find the host name is to assume that the host
50259 is not in the list, so the first <option>accept</option> statement fails. The second
50260 statement can then check the IP address.
50261 </para>
50262 <para>
50263 <indexterm role="variable">
50264 <primary><varname>$host_data</varname></primary>
50265 </indexterm>
50266 If a <option>hosts</option> condition is satisfied by means of a lookup, the result
50267 of the lookup is made available in the <varname>$host_data</varname> variable. This
50268 allows you, for example, to set up a statement like this:
50269 </para>
50270 <literallayout class="monospaced">
50271 deny  hosts = net-lsearch;/some/file
50272 message = $host_data
50273 </literallayout>
50274 <para>
50275 which gives a custom error message for each denied host.
50276 </para>
50277 </listitem></varlistentry>
50278 <varlistentry>
50279 <term><emphasis role="bold">local_parts&nbsp;=&nbsp;</emphasis>&lt;<emphasis>local&nbsp;part&nbsp;list</emphasis>&gt;</term>
50280 <listitem>
50281 <para>
50282 <indexterm role="concept">
50283 <primary><option>local_parts</option> ACL condition</primary>
50284 </indexterm>
50285 <indexterm role="concept">
50286 <primary>local part</primary>
50287 <secondary>ACL checking</secondary>
50288 </indexterm>
50289 <indexterm role="concept">
50290 <primary>access control lists (ACLs)</primary>
50291 <secondary>testing a local part</secondary>
50292 </indexterm>
50293 <indexterm role="variable">
50294 <primary><varname>$local_part_data</varname></primary>
50295 </indexterm>
50296 This condition is relevant only after a RCPT command. It checks that the local
50297 part of the recipient address is in the list. If percent-hack processing is
50298 enabled, it is done before this test. If the check succeeds with a lookup, the
50299 result of the lookup is placed in <varname>$local_part_data</varname>, which remains set until
50300 the next <option>local_parts</option> test.
50301 </para>
50302 </listitem></varlistentry>
50303 <varlistentry>
50304 <term><emphasis role="bold">malware&nbsp;=&nbsp;</emphasis>&lt;<emphasis>option</emphasis>&gt;</term>
50305 <listitem>
50306 <para>
50307 <indexterm role="concept">
50308 <primary><option>malware</option> ACL condition</primary>
50309 </indexterm>
50310 <indexterm role="concept">
50311 <primary>access control lists (ACLs)</primary>
50312 <secondary>virus scanning</secondary>
50313 </indexterm>
50314 <indexterm role="concept">
50315 <primary>access control lists (ACLs)</primary>
50316 <secondary>scanning for viruses</secondary>
50317 </indexterm>
50318 This condition is available only when Exim is compiled with the
50319 content-scanning extension. It causes the incoming message to be scanned for
50320 viruses. For details, see chapter <xref linkend="CHAPexiscan"/>.
50321 </para>
50322 </listitem></varlistentry>
50323 <varlistentry>
50324 <term><emphasis role="bold">mime_regex&nbsp;=&nbsp;</emphasis>&lt;<emphasis>list&nbsp;of&nbsp;regular&nbsp;expressions</emphasis>&gt;</term>
50325 <listitem>
50326 <para>
50327 <indexterm role="concept">
50328 <primary><option>mime_regex</option> ACL condition</primary>
50329 </indexterm>
50330 <indexterm role="concept">
50331 <primary>access control lists (ACLs)</primary>
50332 <secondary>testing by regex matching</secondary>
50333 </indexterm>
50334 This condition is available only when Exim is compiled with the
50335 content-scanning extension, and it is allowed only in the ACL defined by
50336 <option>acl_smtp_mime</option>. It causes the current MIME part to be scanned for a match
50337 with any of the regular expressions. For details, see chapter
50338 <xref linkend="CHAPexiscan"/>.
50339 </para>
50340 </listitem></varlistentry>
50341 <varlistentry>
50342 <term><emphasis role="bold">ratelimit&nbsp;=&nbsp;</emphasis>&lt;<emphasis>parameters</emphasis>&gt;</term>
50343 <listitem>
50344 <para>
50345 <indexterm role="concept">
50346 <primary>rate limiting</primary>
50347 </indexterm>
50348 This condition can be used to limit the rate at which a user or host submits
50349 messages. Details are given in section <xref linkend="SECTratelimiting"/>.
50350 </para>
50351 </listitem></varlistentry>
50352 <varlistentry>
50353 <term><emphasis role="bold">recipients&nbsp;=&nbsp;</emphasis>&lt;<emphasis>address&nbsp;list</emphasis>&gt;</term>
50354 <listitem>
50355 <para>
50356 <indexterm role="concept">
50357 <primary><option>recipients</option> ACL condition</primary>
50358 </indexterm>
50359 <indexterm role="concept">
50360 <primary>recipient</primary>
50361 <secondary>ACL checking</secondary>
50362 </indexterm>
50363 <indexterm role="concept">
50364 <primary>access control lists (ACLs)</primary>
50365 <secondary>testing a recipient</secondary>
50366 </indexterm>
50367 This condition is relevant only after a RCPT command. It checks the entire
50368 recipient address against a list of recipients.
50369 </para>
50370 </listitem></varlistentry>
50371 <varlistentry>
50372 <term><emphasis role="bold">regex&nbsp;=&nbsp;</emphasis>&lt;<emphasis>list&nbsp;of&nbsp;regular&nbsp;expressions</emphasis>&gt;</term>
50373 <listitem>
50374 <para>
50375 <indexterm role="concept">
50376 <primary><option>regex</option> ACL condition</primary>
50377 </indexterm>
50378 <indexterm role="concept">
50379 <primary>access control lists (ACLs)</primary>
50380 <secondary>testing by regex matching</secondary>
50381 </indexterm>
50382 This condition is available only when Exim is compiled with the
50383 content-scanning extension, and is available only in the DATA, MIME, and
50384 non-SMTP ACLs. It causes the incoming message to be scanned for a match with
50385 any of the regular expressions. For details, see chapter <xref linkend="CHAPexiscan"/>.
50386 </para>
50387 </listitem></varlistentry>
50388 <varlistentry>
50389 <term><emphasis role="bold">sender_domains&nbsp;=&nbsp;</emphasis>&lt;<emphasis>domain&nbsp;list</emphasis>&gt;</term>
50390 <listitem>
50391 <para>
50392 <indexterm role="concept">
50393 <primary><option>sender_domains</option> ACL condition</primary>
50394 </indexterm>
50395 <indexterm role="concept">
50396 <primary>sender</primary>
50397 <secondary>ACL checking</secondary>
50398 </indexterm>
50399 <indexterm role="concept">
50400 <primary>access control lists (ACLs)</primary>
50401 <secondary>testing a sender domain</secondary>
50402 </indexterm>
50403 <indexterm role="variable">
50404 <primary><varname>$domain</varname></primary>
50405 </indexterm>
50406 <indexterm role="variable">
50407 <primary><varname>$sender_address_domain</varname></primary>
50408 </indexterm>
50409 This condition tests the domain of the sender of the message against the given
50410 domain list. <emphasis role="bold">Note</emphasis>: The domain of the sender address is in
50411 <varname>$sender_address_domain</varname>. It is <emphasis>not</emphasis> put in <varname>$domain</varname> during the testing
50412 of this condition. This is an exception to the general rule for testing domain
50413 lists. It is done this way so that, if this condition is used in an ACL for a
50414 RCPT command, the recipient&#x2019;s domain (which is in <varname>$domain</varname>) can be used to
50415 influence the sender checking.
50416 </para>
50417 <para>
50418 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
50419 relaying, because sender addresses are easily, and commonly, forged.
50420 </para>
50421 </listitem></varlistentry>
50422 <varlistentry>
50423 <term><emphasis role="bold">senders&nbsp;=&nbsp;</emphasis>&lt;<emphasis>address&nbsp;list</emphasis>&gt;</term>
50424 <listitem>
50425 <para>
50426 <indexterm role="concept">
50427 <primary><option>senders</option> ACL condition</primary>
50428 </indexterm>
50429 <indexterm role="concept">
50430 <primary>sender</primary>
50431 <secondary>ACL checking</secondary>
50432 </indexterm>
50433 <indexterm role="concept">
50434 <primary>access control lists (ACLs)</primary>
50435 <secondary>testing a sender</secondary>
50436 </indexterm>
50437 This condition tests the sender of the message against the given list. To test
50438 for a bounce message, which has an empty sender, set
50439 </para>
50440 <literallayout class="monospaced">
50441 senders = :
50442 </literallayout>
50443 <para>
50444 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
50445 relaying, because sender addresses are easily, and commonly, forged.
50446 </para>
50447 </listitem></varlistentry>
50448 <varlistentry>
50449 <term><emphasis role="bold">spam&nbsp;=&nbsp;</emphasis>&lt;<emphasis>username</emphasis>&gt;</term>
50450 <listitem>
50451 <para>
50452 <indexterm role="concept">
50453 <primary><option>spam</option> ACL condition</primary>
50454 </indexterm>
50455 <indexterm role="concept">
50456 <primary>access control lists (ACLs)</primary>
50457 <secondary>scanning for spam</secondary>
50458 </indexterm>
50459 This condition is available only when Exim is compiled with the
50460 content-scanning extension. It causes the incoming message to be scanned by
50461 SpamAssassin. For details, see chapter <xref linkend="CHAPexiscan"/>.
50462 </para>
50463 </listitem></varlistentry>
50464 <varlistentry>
50465 <term><emphasis role="bold">verify&nbsp;=&nbsp;certificate</emphasis></term>
50466 <listitem>
50467 <para>
50468 <indexterm role="concept">
50469 <primary><option>verify</option> ACL condition</primary>
50470 </indexterm>
50471 <indexterm role="concept">
50472 <primary>TLS</primary>
50473 <secondary>client certificate verification</secondary>
50474 </indexterm>
50475 <indexterm role="concept">
50476 <primary>certificate</primary>
50477 <secondary>verification of client</secondary>
50478 </indexterm>
50479 <indexterm role="concept">
50480 <primary>access control lists (ACLs)</primary>
50481 <secondary>certificate verification</secondary>
50482 </indexterm>
50483 <indexterm role="concept">
50484 <primary>access control lists (ACLs)</primary>
50485 <secondary>testing a TLS certificate</secondary>
50486 </indexterm>
50487 This condition is true in an SMTP session if the session is encrypted, and a
50488 certificate was received from the client, and the certificate was verified. The
50489 server requests a certificate only if the client matches <option>tls_verify_hosts</option>
50490 or <option>tls_try_verify_hosts</option> (see chapter <xref linkend="CHAPTLS"/>).
50491 </para>
50492 </listitem></varlistentry>
50493 <varlistentry>
50494 <term><emphasis role="bold">verify&nbsp;=&nbsp;csa</emphasis></term>
50495 <listitem>
50496 <para>
50497 <indexterm role="concept">
50498 <primary>CSA verification</primary>
50499 </indexterm>
50500 This condition checks whether the sending host (the client) is authorized to
50501 send email. Details of how this works are given in section
50502 <xref linkend="SECTverifyCSA"/>.
50503 </para>
50504 </listitem></varlistentry>
50505 <varlistentry>
50506 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_sender/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
50507 <listitem>
50508 <para>
50509 <indexterm role="concept">
50510 <primary><option>verify</option> ACL condition</primary>
50511 </indexterm>
50512 <indexterm role="concept">
50513 <primary>access control lists (ACLs)</primary>
50514 <secondary>verifying sender in the header</secondary>
50515 </indexterm>
50516 <indexterm role="concept">
50517 <primary>header lines</primary>
50518 <secondary>verifying the sender in</secondary>
50519 </indexterm>
50520 <indexterm role="concept">
50521 <primary>sender</primary>
50522 <secondary>verifying in header</secondary>
50523 </indexterm>
50524 <indexterm role="concept">
50525 <primary>verifying</primary>
50526 <secondary>sender in header</secondary>
50527 </indexterm>
50528 This condition is relevant only in an ACL that is run after a message has been
50529 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
50530 <option>acl_not_smtp</option>. It checks that there is a verifiable address in at least one
50531 of the <emphasis>Sender:</emphasis>, <emphasis>Reply-To:</emphasis>, or <emphasis>From:</emphasis> header lines. Such an address
50532 is loosely thought of as a <quote>sender</quote> address (hence the name of the test).
50533 However, an address that appears in one of these headers need not be an address
50534 that accepts bounce messages; only sender addresses in envelopes are required
50535 to accept bounces. Therefore, if you use the callout option on this check, you
50536 might want to arrange for a non-empty address in the MAIL command.
50537 </para>
50538 <para>
50539 Details of address verification and the options are given later, starting at
50540 section <xref linkend="SECTaddressverification"/> (callouts are described in section
50541 <xref linkend="SECTcallver"/>). You can combine this condition with the <option>senders</option>
50542 condition to restrict it to bounce messages only:
50543 </para>
50544 <literallayout class="monospaced">
50545 deny    senders = :
50546         message = A valid sender header is required for bounces
50547        !verify  = header_sender
50548 </literallayout>
50549 </listitem></varlistentry>
50550 <varlistentry>
50551 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_syntax</emphasis></term>
50552 <listitem>
50553 <para>
50554 <indexterm role="concept">
50555 <primary><option>verify</option> ACL condition</primary>
50556 </indexterm>
50557 <indexterm role="concept">
50558 <primary>access control lists (ACLs)</primary>
50559 <secondary>verifying header syntax</secondary>
50560 </indexterm>
50561 <indexterm role="concept">
50562 <primary>header lines</primary>
50563 <secondary>verifying syntax</secondary>
50564 </indexterm>
50565 <indexterm role="concept">
50566 <primary>verifying</primary>
50567 <secondary>header syntax</secondary>
50568 </indexterm>
50569 This condition is relevant only in an ACL that is run after a message has been
50570 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
50571 <option>acl_not_smtp</option>. It checks the syntax of all header lines that can contain
50572 lists of addresses (<emphasis>Sender:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>,
50573 and <emphasis>Bcc:</emphasis>). Unqualified addresses (local parts without domains) are
50574 permitted only in locally generated messages and from hosts that match
50575 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
50576 appropriate.
50577 </para>
50578 <para>
50579 Note that this condition is a syntax check only. However, a common spamming
50580 ploy used to be to send syntactically invalid headers such as
50581 </para>
50582 <literallayout class="monospaced">
50583 To: @
50584 </literallayout>
50585 <para>
50586 and this condition can be used to reject such messages, though they are not as
50587 common as they used to be.
50588 </para>
50589 </listitem></varlistentry>
50590 <varlistentry>
50591 <term><emphasis role="bold">verify&nbsp;=&nbsp;helo</emphasis></term>
50592 <listitem>
50593 <para>
50594 <indexterm role="concept">
50595 <primary><option>verify</option> ACL condition</primary>
50596 </indexterm>
50597 <indexterm role="concept">
50598 <primary>access control lists (ACLs)</primary>
50599 <secondary>verifying HELO/EHLO</secondary>
50600 </indexterm>
50601 <indexterm role="concept">
50602 <primary>HELO</primary>
50603 <secondary>verifying</secondary>
50604 </indexterm>
50605 <indexterm role="concept">
50606 <primary>EHLO</primary>
50607 <secondary>verifying</secondary>
50608 </indexterm>
50609 <indexterm role="concept">
50610 <primary>verifying</primary>
50611 <secondary>EHLO</secondary>
50612 </indexterm>
50613 <indexterm role="concept">
50614 <primary>verifying</primary>
50615 <secondary>HELO</secondary>
50616 </indexterm>
50617 This condition is true if a HELO or EHLO command has been received from the
50618 client host, and its contents have been verified. If there has been no previous
50619 attempt to verify the HELO/EHLO contents, it is carried out when this
50620 condition is encountered. See the description of the <option>helo_verify_hosts</option> and
50621 <option>helo_try_verify_hosts</option> options for details of how to request verification
50622 independently of this condition.
50623 </para>
50624 <para>
50625 For SMTP input that does not come over TCP/IP (the <option>-bs</option> command line
50626 option), this condition is always true.
50627 </para>
50628 </listitem></varlistentry>
50629 <varlistentry>
50630 <term><emphasis role="bold">verify&nbsp;=&nbsp;not_blind</emphasis></term>
50631 <listitem>
50632 <para>
50633 <indexterm role="concept">
50634 <primary>verifying</primary>
50635 <secondary>not blind</secondary>
50636 </indexterm>
50637 <indexterm role="concept">
50638 <primary>bcc recipients, verifying none</primary>
50639 </indexterm>
50640 This condition checks that there are no blind (bcc) recipients in the message.
50641 Every envelope recipient must appear either in a <emphasis>To:</emphasis> header line or in a
50642 <emphasis>Cc:</emphasis> header line for this condition to be true. Local parts are checked
50643 case-sensitively; domains are checked case-insensitively. If <emphasis>Resent-To:</emphasis> or
50644 <emphasis>Resent-Cc:</emphasis> header lines exist, they are also checked. This condition can be
50645 used only in a DATA or non-SMTP ACL.
50646 </para>
50647 <para>
50648 There are, of course, many legitimate messages that make use of blind (bcc)
50649 recipients. This check should not be used on its own for blocking messages.
50650 </para>
50651 </listitem></varlistentry>
50652 <varlistentry>
50653 <term><emphasis role="bold">verify&nbsp;=&nbsp;recipient/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
50654 <listitem>
50655 <para>
50656 <indexterm role="concept">
50657 <primary><option>verify</option> ACL condition</primary>
50658 </indexterm>
50659 <indexterm role="concept">
50660 <primary>access control lists (ACLs)</primary>
50661 <secondary>verifying recipient</secondary>
50662 </indexterm>
50663 <indexterm role="concept">
50664 <primary>recipient</primary>
50665 <secondary>verifying</secondary>
50666 </indexterm>
50667 <indexterm role="concept">
50668 <primary>verifying</primary>
50669 <secondary>recipient</secondary>
50670 </indexterm>
50671 <indexterm role="variable">
50672 <primary><varname>$address_data</varname></primary>
50673 </indexterm>
50674 This condition is relevant only after a RCPT command. It verifies the current
50675 recipient. Details of address verification are given later, starting at section
50676 <xref linkend="SECTaddressverification"/>. After a recipient has been verified, the value
50677 of <varname>$address_data</varname> is the last value that was set while routing the address.
50678 This applies even if the verification fails. When an address that is being
50679 verified is redirected to a single address, verification continues with the new
50680 address, and in that case, the subsequent value of <varname>$address_data</varname> is the
50681 value for the child address.
50682 </para>
50683 </listitem></varlistentry>
50684 <varlistentry>
50685 <term><emphasis role="bold">verify&nbsp;=&nbsp;reverse_host_lookup</emphasis></term>
50686 <listitem>
50687 <para>
50688 <indexterm role="concept">
50689 <primary><option>verify</option> ACL condition</primary>
50690 </indexterm>
50691 <indexterm role="concept">
50692 <primary>access control lists (ACLs)</primary>
50693 <secondary>verifying host reverse lookup</secondary>
50694 </indexterm>
50695 <indexterm role="concept">
50696 <primary>host</primary>
50697 <secondary>verifying reverse lookup</secondary>
50698 </indexterm>
50699 This condition ensures that a verified host name has been looked up from the IP
50700 address of the client host. (This may have happened already if the host name
50701 was needed for checking a host list, or if the host matched <option>host_lookup</option>.)
50702 Verification ensures that the host name obtained from a reverse DNS lookup, or
50703 one of its aliases, does, when it is itself looked up in the DNS, yield the
50704 original IP address.
50705 </para>
50706 <para>
50707 If this condition is used for a locally generated message (that is, when there
50708 is no client host involved), it always succeeds.
50709 </para>
50710 </listitem></varlistentry>
50711 <varlistentry>
50712 <term><emphasis role="bold">verify&nbsp;=&nbsp;sender/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
50713 <listitem>
50714 <para>
50715 <indexterm role="concept">
50716 <primary><option>verify</option> ACL condition</primary>
50717 </indexterm>
50718 <indexterm role="concept">
50719 <primary>access control lists (ACLs)</primary>
50720 <secondary>verifying sender</secondary>
50721 </indexterm>
50722 <indexterm role="concept">
50723 <primary>sender</primary>
50724 <secondary>verifying</secondary>
50725 </indexterm>
50726 <indexterm role="concept">
50727 <primary>verifying</primary>
50728 <secondary>sender</secondary>
50729 </indexterm>
50730 This condition is relevant only after a MAIL or RCPT command, or after a
50731 message has been received (the <option>acl_smtp_data</option> or <option>acl_not_smtp</option> ACLs). If
50732 the message&#x2019;s sender is empty (that is, this is a bounce message), the
50733 condition is true. Otherwise, the sender address is verified.
50734 </para>
50735 <para>
50736 <indexterm role="variable">
50737 <primary><varname>$address_data</varname></primary>
50738 </indexterm>
50739 <indexterm role="variable">
50740 <primary><varname>$sender_address_data</varname></primary>
50741 </indexterm>
50742 If there is data in the <varname>$address_data</varname> variable at the end of routing, its
50743 value is placed in <varname>$sender_address_data</varname> at the end of verification. This
50744 value can be used in subsequent conditions and modifiers in the same ACL
50745 statement. It does not persist after the end of the current statement. If you
50746 want to preserve the value for longer, you can save it in an ACL variable.
50747 </para>
50748 <para>
50749 Details of verification are given later, starting at section
50750 <xref linkend="SECTaddressverification"/>. Exim caches the result of sender verification,
50751 to avoid doing it more than once per message.
50752 </para>
50753 </listitem></varlistentry>
50754 <varlistentry>
50755 <term><emphasis role="bold">verify&nbsp;=&nbsp;sender=</emphasis>&lt;<emphasis>address</emphasis>&gt;<emphasis role="bold">/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
50756 <listitem>
50757 <para>
50758 <indexterm role="concept">
50759 <primary><option>verify</option> ACL condition</primary>
50760 </indexterm>
50761 This is a variation of the previous option, in which a modified address is
50762 verified as a sender.
50763 </para>
50764 </listitem></varlistentry>
50765 </variablelist>
50766 </section>
50767 <section id="SECTmorednslists">
50768 <title>Using DNS lists</title>
50769 <para>
50770 <indexterm role="concept">
50771 <primary>DNS list</primary>
50772 <secondary>in ACL</secondary>
50773 </indexterm>
50774 <indexterm role="concept">
50775 <primary>black list (DNS)</primary>
50776 </indexterm>
50777 <indexterm role="concept">
50778 <primary>access control lists (ACLs)</primary>
50779 <secondary>testing a DNS list</secondary>
50780 </indexterm>
50781 In its simplest form, the <option>dnslists</option> condition tests whether the calling host
50782 is on at least one of a number of DNS lists by looking up the inverted IP
50783 address in one or more DNS domains. (Note that DNS list domains are not mail
50784 domains, so the <literal>+</literal> syntax for named lists doesn&#x2019;t work - it is used for
50785 special options instead.) For example, if the calling host&#x2019;s IP
50786 address is 192.168.62.43, and the ACL statement is
50787 </para>
50788 <literallayout class="monospaced">
50789 deny dnslists = blackholes.mail-abuse.org : \
50790                 dialups.mail-abuse.org
50791 </literallayout>
50792 <para>
50793 the following records are looked up:
50794 </para>
50795 <literallayout class="monospaced">
50796 43.62.168.192.blackholes.mail-abuse.org
50797 43.62.168.192.dialups.mail-abuse.org
50798 </literallayout>
50799 <para>
50800 As soon as Exim finds an existing DNS record, processing of the list stops.
50801 Thus, multiple entries on the list provide an <quote>or</quote> conjunction. If you want
50802 to test that a host is on more than one list (an <quote>and</quote> conjunction), you can
50803 use two separate conditions:
50804 </para>
50805 <literallayout class="monospaced">
50806 deny dnslists = blackholes.mail-abuse.org
50807      dnslists = dialups.mail-abuse.org
50808 </literallayout>
50809 <para>
50810 If a DNS lookup times out or otherwise fails to give a decisive answer, Exim
50811 behaves as if the host does not match the list item, that is, as if the DNS
50812 record does not exist. If there are further items in the DNS list, they are
50813 processed.
50814 </para>
50815 <para>
50816 This is usually the required action when <option>dnslists</option> is used with <option>deny</option>
50817 (which is the most common usage), because it prevents a DNS failure from
50818 blocking mail. However, you can change this behaviour by putting one of the
50819 following special items in the list:
50820 </para>
50821 <literallayout>
50822 <literal>+include_unknown </literal>   behave as if the item is on the list
50823 <literal>+exclude_unknown </literal>   behave as if the item is not on the list (default)
50824 <literal>+defer_unknown   </literal>   give a temporary error
50825 </literallayout>
50826 <para>
50827 <indexterm role="concept">
50828 <primary><literal>+include_unknown</literal></primary>
50829 </indexterm>
50830 <indexterm role="concept">
50831 <primary><literal>+exclude_unknown</literal></primary>
50832 </indexterm>
50833 <indexterm role="concept">
50834 <primary><literal>+defer_unknown</literal></primary>
50835 </indexterm>
50836 Each of these applies to any subsequent items on the list. For example:
50837 </para>
50838 <literallayout class="monospaced">
50839 deny dnslists = +defer_unknown : foo.bar.example
50840 </literallayout>
50841 <para>
50842 Testing the list of domains stops as soon as a match is found. If you want to
50843 warn for one list and block for another, you can use two different statements:
50844 </para>
50845 <literallayout class="monospaced">
50846 deny  dnslists = blackholes.mail-abuse.org
50847 warn  message  = X-Warn: sending host is on dialups list
50848       dnslists = dialups.mail-abuse.org
50849 </literallayout>
50850 <para>
50851 DNS list lookups are cached by Exim for the duration of the SMTP session,
50852 so a lookup based on the IP address is done at most once for any incoming
50853 connection. Exim does not share information between multiple incoming
50854 connections (but your local name server cache should be active).
50855 </para>
50856 </section>
50857 <section id="SECID201">
50858 <title>Specifying the IP address for a DNS list lookup</title>
50859 <para>
50860 <indexterm role="concept">
50861 <primary>DNS list</primary>
50862 <secondary>keyed by explicit IP address</secondary>
50863 </indexterm>
50864 By default, the IP address that is used in a DNS list lookup is the IP address
50865 of the calling host. However, you can specify another IP address by listing it
50866 after the domain name, introduced by a slash. For example:
50867 </para>
50868 <literallayout class="monospaced">
50869 deny dnslists = black.list.tld/192.168.1.2
50870 </literallayout>
50871 <para>
50872 This feature is not very helpful with explicit IP addresses; it is intended for
50873 use with IP addresses that are looked up, for example, the IP addresses of the
50874 MX hosts or nameservers of an email sender address. For an example, see section
50875 <xref linkend="SECTmulkeyfor"/> below.
50876 </para>
50877 </section>
50878 <section id="SECID202">
50879 <title>DNS lists keyed on domain names</title>
50880 <para>
50881 <indexterm role="concept">
50882 <primary>DNS list</primary>
50883 <secondary>keyed by domain name</secondary>
50884 </indexterm>
50885 There are some lists that are keyed on domain names rather than inverted IP
50886 addresses (see for example the <emphasis>domain based zones</emphasis> link at
50887 <emphasis role="bold"><ulink url="http://www.rfc-ignorant.org/">http://www.rfc-ignorant.org/</ulink></emphasis>). No reversing of components is used
50888 with these lists. You can change the name that is looked up in a DNS list by
50889 listing it after the domain name, introduced by a slash. For example,
50890 </para>
50891 <literallayout class="monospaced">
50892 deny  message  = Sender's domain is listed at $dnslist_domain
50893       dnslists = dsn.rfc-ignorant.org/$sender_address_domain
50894 </literallayout>
50895 <para>
50896 This particular example is useful only in ACLs that are obeyed after the
50897 RCPT or DATA commands, when a sender address is available. If (for
50898 example) the message&#x2019;s sender is <emphasis>user@tld.example</emphasis> the name that is looked
50899 up by this example is
50900 </para>
50901 <literallayout class="monospaced">
50902 tld.example.dsn.rfc-ignorant.org
50903 </literallayout>
50904 <para>
50905 A single <option>dnslists</option> condition can contain entries for both names and IP
50906 addresses. For example:
50907 </para>
50908 <literallayout class="monospaced">
50909 deny dnslists = sbl.spamhaus.org : \
50910                 dsn.rfc-ignorant.org/$sender_address_domain
50911 </literallayout>
50912 <para>
50913 The first item checks the sending host&#x2019;s IP address; the second checks a domain
50914 name. The whole condition is true if either of the DNS lookups succeeds.
50915 </para>
50916 </section>
50917 <section id="SECTmulkeyfor">
50918 <title>Multiple explicit keys for a DNS list</title>
50919 <para>
50920 <indexterm role="concept">
50921 <primary>DNS list</primary>
50922 <secondary>multiple keys for</secondary>
50923 </indexterm>
50924 The syntax described above for looking up explicitly-defined values (either
50925 names or IP addresses) in a DNS blacklist is a simplification. After the domain
50926 name for the DNS list, what follows the slash can in fact be a list of items.
50927 As with all lists in Exim, the default separator is a colon. However, because
50928 this is a sublist within the list of DNS blacklist domains, it is necessary
50929 either to double the separators like this:
50930 </para>
50931 <literallayout class="monospaced">
50932 dnslists = black.list.tld/name.1::name.2
50933 </literallayout>
50934 <para>
50935 or to change the separator character, like this:
50936 </para>
50937 <literallayout class="monospaced">
50938 dnslists = black.list.tld/&lt;;name.1;name.2
50939 </literallayout>
50940 <para>
50941 If an item in the list is an IP address, it is inverted before the DNS
50942 blacklist domain is appended. If it is not an IP address, no inversion
50943 occurs. Consider this condition:
50944 </para>
50945 <literallayout class="monospaced">
50946 dnslists = black.list.tld/&lt;;192.168.1.2;a.domain
50947 </literallayout>
50948 <para>
50949 The DNS lookups that occur are:
50950 </para>
50951 <literallayout class="monospaced">
50952 2.1.168.192.black.list.tld
50953 a.domain.black.list.tld
50954 </literallayout>
50955 <para>
50956 Once a DNS record has been found (that matches a specific IP return
50957 address, if specified &ndash; see section <xref linkend="SECTaddmatcon"/>), no further lookups
50958 are done. If there is a temporary DNS error, the rest of the sublist of domains
50959 or IP addresses is tried. A temporary error for the whole dnslists item occurs
50960 only if no other DNS lookup in this sublist succeeds. In other words, a
50961 successful lookup for any of the items in the sublist overrides a temporary
50962 error for a previous item.
50963 </para>
50964 <para>
50965 The ability to supply a list of items after the slash is in some sense just a
50966 syntactic convenience. These two examples have the same effect:
50967 </para>
50968 <literallayout class="monospaced">
50969 dnslists = black.list.tld/a.domain : black.list.tld/b.domain
50970 dnslists = black.list.tld/a.domain::b.domain
50971 </literallayout>
50972 <para>
50973 However, when the data for the list is obtained from a lookup, the second form
50974 is usually much more convenient. Consider this example:
50975 </para>
50976 <literallayout class="monospaced">
50977 deny message  = The mail servers for the domain \
50978                 $sender_address_domain \
50979                 are listed at $dnslist_domain ($dnslist_value); \
50980                 see $dnslist_text.
50981      dnslists = sbl.spamhaus.org/&lt;|${lookup dnsdb {&gt;|a=&lt;|\
50982                                    ${lookup dnsdb {&gt;|mxh=\
50983                                    $sender_address_domain} }} }
50984 </literallayout>
50985 <para>
50986 Note the use of <literal>&gt;|</literal> in the dnsdb lookup to specify the separator for
50987 multiple DNS records. The inner dnsdb lookup produces a list of MX hosts
50988 and the outer dnsdb lookup finds the IP addresses for these hosts. The result
50989 of expanding the condition might be something like this:
50990 </para>
50991 <literallayout class="monospaced">
50992 dnslists = sbl.spahmaus.org/&lt;|192.168.2.3|192.168.5.6|...
50993 </literallayout>
50994 <para>
50995 Thus, this example checks whether or not the IP addresses of the sender
50996 domain&#x2019;s mail servers are on the Spamhaus black list.
50997 </para>
50998 <para>
50999 The key that was used for a successful DNS list lookup is put into the variable
51000 <varname>$dnslist_matched</varname> (see section <xref linkend="SECID204"/>).
51001 </para>
51002 </section>
51003 <section id="SECID203">
51004 <title>Data returned by DNS lists</title>
51005 <para>
51006 <indexterm role="concept">
51007 <primary>DNS list</primary>
51008 <secondary>data returned from</secondary>
51009 </indexterm>
51010 DNS lists are constructed using address records in the DNS. The original RBL
51011 just used the address 127.0.0.1 on the right hand side of each record, but the
51012 RBL+ list and some other lists use a number of values with different meanings.
51013 The values used on the RBL+ list are:
51014 </para>
51015 <literallayout>
51016 127.1.0.1  RBL
51017 127.1.0.2  DUL
51018 127.1.0.3  DUL and RBL
51019 127.1.0.4  RSS
51020 127.1.0.5  RSS and RBL
51021 127.1.0.6  RSS and DUL
51022 127.1.0.7  RSS and DUL and RBL
51023 </literallayout>
51024 <para>
51025 Section <xref linkend="SECTaddmatcon"/> below describes how you can distinguish between
51026 different values. Some DNS lists may return more than one address record;
51027 see section <xref linkend="SECThanmuldnsrec"/> for details of how they are checked.
51028 </para>
51029 </section>
51030 <section id="SECID204">
51031 <title>Variables set from DNS lists</title>
51032 <para>
51033 <indexterm role="concept">
51034 <primary>expansion</primary>
51035 <secondary>variables, set from DNS list</secondary>
51036 </indexterm>
51037 <indexterm role="concept">
51038 <primary>DNS list</primary>
51039 <secondary>variables set from</secondary>
51040 </indexterm>
51041 <indexterm role="variable">
51042 <primary><varname>$dnslist_domain</varname></primary>
51043 </indexterm>
51044 <indexterm role="variable">
51045 <primary><varname>$dnslist_matched</varname></primary>
51046 </indexterm>
51047 <indexterm role="variable">
51048 <primary><varname>$dnslist_text</varname></primary>
51049 </indexterm>
51050 <indexterm role="variable">
51051 <primary><varname>$dnslist_value</varname></primary>
51052 </indexterm>
51053 When an entry is found in a DNS list, the variable <varname>$dnslist_domain</varname> contains
51054 the name of the overall domain that matched (for example,
51055 <literal>spamhaus.example</literal>), <varname>$dnslist_matched</varname> contains the key within that domain
51056 (for example, <literal>192.168.5.3</literal>), and <varname>$dnslist_value</varname> contains the data from
51057 the DNS record. When the key is an IP address, it is not reversed in
51058 <varname>$dnslist_matched</varname> (though it is, of course, in the actual lookup). In simple
51059 cases, for example:
51060 </para>
51061 <literallayout class="monospaced">
51062 deny dnslists = spamhaus.example
51063 </literallayout>
51064 <para>
51065 the key is also available in another variable (in this case,
51066 <varname>$sender_host_address</varname>). In more complicated cases, however, this is not true.
51067 For example, using a data lookup (as described in section <xref linkend="SECTmulkeyfor"/>)
51068 might generate a dnslists lookup like this:
51069 </para>
51070 <literallayout class="monospaced">
51071 deny dnslists = spamhaus.example/&lt;|192.168.1.2|192.168.6.7|...
51072 </literallayout>
51073 <para>
51074 If this condition succeeds, the value in <varname>$dnslist_matched</varname> might be
51075 <literal>192.168.6.7</literal> (for example).
51076 </para>
51077 <para>
51078 If more than one address record is returned by the DNS lookup, all the IP
51079 addresses are included in <varname>$dnslist_value</varname>, separated by commas and spaces.
51080 The variable <varname>$dnslist_text</varname> contains the contents of any associated TXT
51081 record. For lists such as RBL+ the TXT record for a merged entry is often not
51082 very meaningful. See section <xref linkend="SECTmordetinf"/> for a way of obtaining more
51083 information.
51084 </para>
51085 <para>
51086 You can use the DNS list variables in <option>message</option> or <option>log_message</option> modifiers
51087 &ndash; although these appear before the condition in the ACL, they are not
51088 expanded until after it has failed. For example:
51089 </para>
51090 <literallayout class="monospaced">
51091 deny    hosts = !+local_networks
51092         message = $sender_host_address is listed \
51093                   at $dnslist_domain
51094         dnslists = rbl-plus.mail-abuse.example
51095 </literallayout>
51096 </section>
51097 <section id="SECTaddmatcon">
51098 <title>Additional matching conditions for DNS lists</title>
51099 <para>
51100 <indexterm role="concept">
51101 <primary>DNS list</primary>
51102 <secondary>matching specific returned data</secondary>
51103 </indexterm>
51104 You can add an equals sign and an IP address after a <option>dnslists</option> domain name
51105 in order to restrict its action to DNS records with a matching right hand side.
51106 For example,
51107 </para>
51108 <literallayout class="monospaced">
51109 deny dnslists = rblplus.mail-abuse.org=127.0.0.2
51110 </literallayout>
51111 <para>
51112 rejects only those hosts that yield 127.0.0.2. Without this additional data,
51113 any address record is considered to be a match. For the moment, we assume
51114 that the DNS lookup returns just one record. Section <xref linkend="SECThanmuldnsrec"/>
51115 describes how multiple records are handled.
51116 </para>
51117 <para>
51118 More than one IP address may be given for checking, using a comma as a
51119 separator. These are alternatives &ndash; if any one of them matches, the
51120 <option>dnslists</option> condition is true. For example:
51121 </para>
51122 <literallayout class="monospaced">
51123 deny  dnslists = a.b.c=127.0.0.2,127.0.0.3
51124 </literallayout>
51125 <para>
51126 If you want to specify a constraining address list and also specify names or IP
51127 addresses to be looked up, the constraining address list must be specified
51128 first. For example:
51129 </para>
51130 <literallayout class="monospaced">
51131 deny dnslists = dsn.rfc-ignorant.org\
51132                 =127.0.0.2/$sender_address_domain
51133 </literallayout>
51134 <para>
51135 If the character <literal>&amp;</literal> is used instead of <literal>=</literal>, the comparison for each
51136 listed IP address is done by a bitwise <quote>and</quote> instead of by an equality test.
51137 In other words, the listed addresses are used as bit masks. The comparison is
51138 true if all the bits in the mask are present in the address that is being
51139 tested. For example:
51140 </para>
51141 <literallayout class="monospaced">
51142 dnslists = a.b.c&amp;0.0.0.3
51143 </literallayout>
51144 <para>
51145 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
51146 want to test whether one bit or another bit is present (as opposed to both
51147 being present), you must use multiple values. For example:
51148 </para>
51149 <literallayout class="monospaced">
51150 dnslists = a.b.c&amp;0.0.0.1,0.0.0.2
51151 </literallayout>
51152 <para>
51153 matches if the final component of the address is an odd number or two times
51154 an odd number.
51155 </para>
51156 </section>
51157 <section id="SECID205">
51158 <title>Negated DNS matching conditions</title>
51159 <para>
51160 You can supply a negative list of IP addresses as part of a <option>dnslists</option>
51161 condition. Whereas
51162 </para>
51163 <literallayout class="monospaced">
51164 deny  dnslists = a.b.c=127.0.0.2,127.0.0.3
51165 </literallayout>
51166 <para>
51167 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
51168 IP address yielded by the list is either 127.0.0.2 or 127.0.0.3</quote>,
51169 </para>
51170 <literallayout class="monospaced">
51171 deny  dnslists = a.b.c!=127.0.0.2,127.0.0.3
51172 </literallayout>
51173 <para>
51174 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
51175 IP address yielded by the list is not 127.0.0.2 and not 127.0.0.3</quote>. In other
51176 words, the result of the test is inverted if an exclamation mark appears before
51177 the <literal>=</literal> (or the <literal>&amp;</literal>) sign.
51178 </para>
51179 <para>
51180 <emphasis role="bold">Note</emphasis>: This kind of negation is not the same as negation in a domain,
51181 host, or address list (which is why the syntax is different).
51182 </para>
51183 <para>
51184 If you are using just one list, the negation syntax does not gain you much. The
51185 previous example is precisely equivalent to
51186 </para>
51187 <literallayout class="monospaced">
51188 deny  dnslists = a.b.c
51189      !dnslists = a.b.c=127.0.0.2,127.0.0.3
51190 </literallayout>
51191 <para>
51192 However, if you are using multiple lists, the negation syntax is clearer.
51193 Consider this example:
51194 </para>
51195 <literallayout class="monospaced">
51196 deny  dnslists = sbl.spamhaus.org : \
51197                  list.dsbl.org : \
51198                  dnsbl.njabl.org!=127.0.0.3 : \
51199                  relays.ordb.org
51200 </literallayout>
51201 <para>
51202 Using only positive lists, this would have to be:
51203 </para>
51204 <literallayout class="monospaced">
51205 deny  dnslists = sbl.spamhaus.org : \
51206                  list.dsbl.org
51207 deny  dnslists = dnsbl.njabl.org
51208      !dnslists = dnsbl.njabl.org=127.0.0.3
51209 deny  dnslists = relays.ordb.org
51210 </literallayout>
51211 <para>
51212 which is less clear, and harder to maintain.
51213 </para>
51214 </section>
51215 <section id="SECThanmuldnsrec">
51216 <title>Handling multiple DNS records from a DNS list</title>
51217 <para>
51218 A DNS lookup for a <option>dnslists</option> condition may return more than one DNS record,
51219 thereby providing more than one IP address. When an item in a <option>dnslists</option> list
51220 is followed by <literal>=</literal> or <literal>&amp;</literal> and a list of IP addresses, in order to restrict
51221 the match to specific results from the DNS lookup, there are two ways in which
51222 the checking can be handled. For example, consider the condition:
51223 </para>
51224 <literallayout class="monospaced">
51225 dnslists = a.b.c=127.0.0.1
51226 </literallayout>
51227 <para>
51228 What happens if the DNS lookup for the incoming IP address yields both
51229 127.0.0.1 and 127.0.0.2 by means of two separate DNS records? Is the
51230 condition true because at least one given value was found, or is it false
51231 because at least one of the found values was not listed? And how does this
51232 affect negated conditions? Both possibilities are provided for with the help of
51233 additional separators <literal>==</literal> and <literal>=&amp;</literal>.
51234 </para>
51235 <itemizedlist>
51236 <listitem>
51237 <para>
51238 If <literal>=</literal> or <literal>&amp;</literal> is used, the condition is true if any one of the looked up
51239 IP addresses matches one of the listed addresses. For the example above, the
51240 condition is true because 127.0.0.1 matches.
51241 </para>
51242 </listitem>
51243 <listitem>
51244 <para>
51245 If <literal>==</literal> or <literal>=&amp;</literal> is used, the condition is true only if every one of the
51246 looked up IP addresses matches one of the listed addresses. If the condition is
51247 changed to:
51248 </para>
51249 <literallayout class="monospaced">
51250 dnslists = a.b.c==127.0.0.1
51251 </literallayout>
51252 <para>
51253 and the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
51254 false because 127.0.0.2 is not listed. You would need to have:
51255 </para>
51256 <literallayout class="monospaced">
51257 dnslists = a.b.c==127.0.0.1,127.0.0.2
51258 </literallayout>
51259 <para>
51260 for the condition to be true.
51261 </para>
51262 </listitem>
51263 </itemizedlist>
51264 <para>
51265 When <literal>!</literal> is used to negate IP address matching, it inverts the result, giving
51266 the precise opposite of the behaviour above. Thus:
51267 </para>
51268 <itemizedlist>
51269 <listitem>
51270 <para>
51271 If <literal>!=</literal> or <literal>!&amp;</literal> is used, the condition is true if none of the looked up IP
51272 addresses matches one of the listed addresses. Consider:
51273 </para>
51274 <literallayout class="monospaced">
51275 dnslists = a.b.c!&amp;0.0.0.1
51276 </literallayout>
51277 <para>
51278 If the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
51279 false because 127.0.0.1 matches.
51280 </para>
51281 </listitem>
51282 <listitem>
51283 <para>
51284 If <literal>!==</literal> or <literal>!=&amp;</literal> is used, the condition is true there is at least one
51285 looked up IP address that does not match. Consider:
51286 </para>
51287 <literallayout class="monospaced">
51288 dnslists = a.b.c!=&amp;0.0.0.1
51289 </literallayout>
51290 <para>
51291 If the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
51292 true, because 127.0.0.2 does not match. You would need to have:
51293 </para>
51294 <literallayout class="monospaced">
51295 dnslists = a.b.c!=&amp;0.0.0.1,0.0.0.2
51296 </literallayout>
51297 <para>
51298 for the condition to be false.
51299 </para>
51300 </listitem>
51301 </itemizedlist>
51302 <para>
51303 When the DNS lookup yields only a single IP address, there is no difference
51304 between <literal>=</literal> and <literal>==</literal> and between <literal>&amp;</literal> and <literal>=&amp;</literal>.
51305 </para>
51306 </section>
51307 <section id="SECTmordetinf">
51308 <title>Detailed information from merged DNS lists</title>
51309 <para>
51310 <indexterm role="concept">
51311 <primary>DNS list</primary>
51312 <secondary>information from merged</secondary>
51313 </indexterm>
51314 When the facility for restricting the matching IP values in a DNS list is used,
51315 the text from the TXT record that is set in <varname>$dnslist_text</varname> may not reflect
51316 the true reason for rejection. This happens when lists are merged and the IP
51317 address in the A record is used to distinguish them; unfortunately there is
51318 only one TXT record. One way round this is not to use merged lists, but that
51319 can be inefficient because it requires multiple DNS lookups where one would do
51320 in the vast majority of cases when the host of interest is not on any of the
51321 lists.
51322 </para>
51323 <para>
51324 A less inefficient way of solving this problem is available. If
51325 two domain names, comma-separated, are given, the second is used first to
51326 do an initial check, making use of any IP value restrictions that are set.
51327 If there is a match, the first domain is used, without any IP value
51328 restrictions, to get the TXT record. As a byproduct of this, there is also
51329 a check that the IP being tested is indeed on the first list. The first
51330 domain is the one that is put in <varname>$dnslist_domain</varname>. For example:
51331 </para>
51332 <literallayout class="monospaced">
51333 reject message  = \
51334          rejected because $sender_host_address is blacklisted \
51335          at $dnslist_domain\n$dnslist_text
51336        dnslists = \
51337          sbl.spamhaus.org,sbl-xbl.spamhaus.org=127.0.0.2 : \
51338          dul.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.10
51339 </literallayout>
51340 <para>
51341 For the first blacklist item, this starts by doing a lookup in
51342 <emphasis>sbl-xbl.spamhaus.org</emphasis> and testing for a 127.0.0.2 return. If there is a
51343 match, it then looks in <emphasis>sbl.spamhaus.org</emphasis>, without checking the return
51344 value, and as long as something is found, it looks for the corresponding TXT
51345 record. If there is no match in <emphasis>sbl-xbl.spamhaus.org</emphasis>, nothing more is done.
51346 The second blacklist item is processed similarly.
51347 </para>
51348 <para>
51349 If you are interested in more than one merged list, the same list must be
51350 given several times, but because the results of the DNS lookups are cached,
51351 the DNS calls themselves are not repeated. For example:
51352 </para>
51353 <literallayout class="monospaced">
51354 reject dnslists = \
51355          http.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.2 : \
51356          socks.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.3 : \
51357          misc.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.4 : \
51358          dul.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.10
51359 </literallayout>
51360 <para>
51361 In this case there is one lookup in <emphasis>dnsbl.sorbs.net</emphasis>, and if none of the IP
51362 values matches (or if no record is found), this is the only lookup that is
51363 done. Only if there is a match is one of the more specific lists consulted.
51364 </para>
51365 </section>
51366 <section id="SECTmorednslistslast">
51367 <title>DNS lists and IPv6</title>
51368 <para>
51369 <indexterm role="concept">
51370 <primary>IPv6</primary>
51371 <secondary>DNS black lists</secondary>
51372 </indexterm>
51373 <indexterm role="concept">
51374 <primary>DNS list</primary>
51375 <secondary>IPv6 usage</secondary>
51376 </indexterm>
51377 If Exim is asked to do a dnslist lookup for an IPv6 address, it inverts it
51378 nibble by nibble. For example, if the calling host&#x2019;s IP address is
51379 3ffe:ffff:836f:0a00:000a:0800:200a:c031, Exim might look up
51380 </para>
51381 <literallayout class="monospaced">
51382 1.3.0.c.a.0.0.2.0.0.8.0.a.0.0.0.0.0.a.0.f.6.3.8.
51383   f.f.f.f.e.f.f.3.blackholes.mail-abuse.org
51384 </literallayout>
51385 <para>
51386 (split over two lines here to fit on the page). Unfortunately, some of the DNS
51387 lists contain wildcard records, intended for IPv4, that interact badly with
51388 IPv6. For example, the DNS entry
51389 </para>
51390 <literallayout class="monospaced">
51391 *.3.some.list.example.    A    127.0.0.1
51392 </literallayout>
51393 <para>
51394 is probably intended to put the entire 3.0.0.0/8 IPv4 network on the list.
51395 Unfortunately, it also matches the entire 3::/4 IPv6 network.
51396 </para>
51397 <para>
51398 You can exclude IPv6 addresses from DNS lookups by making use of a suitable
51399 <option>condition</option> condition, as in this example:
51400 </para>
51401 <literallayout class="monospaced">
51402 deny   condition = ${if isip4{$sender_host_address}}
51403        dnslists  = some.list.example
51404 </literallayout>
51405 </section>
51406 <section id="SECTratelimiting">
51407 <title>Rate limiting incoming messages</title>
51408 <para>
51409 <indexterm role="concept">
51410 <primary>rate limiting</primary>
51411 <secondary>client sending</secondary>
51412 </indexterm>
51413 <indexterm role="concept">
51414 <primary>limiting client sending rates</primary>
51415 </indexterm>
51416 <indexterm role="option">
51417 <primary><option>smtp_ratelimit_*</option></primary>
51418 </indexterm>
51419 The <option>ratelimit</option> ACL condition can be used to measure and control the rate at
51420 which clients can send email. This is more powerful than the
51421 <option>smtp_ratelimit_*</option> options, because those options control the rate of
51422 commands in a single SMTP session only, whereas the <option>ratelimit</option> condition
51423 works across all connections (concurrent and sequential) from the same client
51424 host. The syntax of the <option>ratelimit</option> condition is:
51425 </para>
51426 <literallayout>
51427 <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;
51428 </literallayout>
51429 <para>
51430 If the average client sending rate is less than <emphasis>m</emphasis> messages per time
51431 period <emphasis>p</emphasis> then the condition is false; otherwise it is true.
51432 </para>
51433 <para>
51434 As a side-effect, the <option>ratelimit</option> condition sets the expansion variable
51435 <varname>$sender_rate</varname> to the client&#x2019;s computed rate, <varname>$sender_rate_limit</varname> to the
51436 configured value of <emphasis>m</emphasis>, and <varname>$sender_rate_period</varname> to the configured value
51437 of <emphasis>p</emphasis>.
51438 </para>
51439 <para>
51440 The parameter <emphasis>p</emphasis> is the smoothing time constant, in the form of an Exim
51441 time interval, for example, <literal>8h</literal> for eight hours. A larger time constant
51442 means that it takes Exim longer to forget a client&#x2019;s past behaviour. The
51443 parameter <emphasis>m</emphasis> is the maximum number of messages that a client is permitted to
51444 send in each time interval. It also specifies the number of messages permitted
51445 in a fast burst. By increasing both <emphasis>m</emphasis> and <emphasis>p</emphasis> but keeping <emphasis>m/p</emphasis>
51446 constant, you can allow a client to send more messages in a burst without
51447 changing its long-term sending rate limit. Conversely, if <emphasis>m</emphasis> and <emphasis>p</emphasis> are
51448 both small, messages must be sent at an even rate.
51449 </para>
51450 <para>
51451 There is a script in <filename>util/ratelimit.pl</filename> which extracts sending rates from
51452 log files, to assist with choosing appropriate settings for <emphasis>m</emphasis> and <emphasis>p</emphasis>
51453 when deploying the <option>ratelimit</option> ACL condition. The script prints usage
51454 instructions when it is run with no arguments.
51455 </para>
51456 <para>
51457 The key is used to look up the data for calculating the client&#x2019;s average
51458 sending rate. This data is stored in Exim&#x2019;s spool directory, alongside the
51459 retry and other hints databases. The default key is <varname>$sender_host_address</varname>,
51460 which means Exim computes the sending rate of each client host IP address.
51461 By changing the key you can change how Exim identifies clients for the purpose
51462 of ratelimiting. For example, to limit the sending rate of each authenticated
51463 user, independent of the computer they are sending from, set the key to
51464 <varname>$authenticated_id</varname>. You must ensure that the lookup key is meaningful; for
51465 example, <varname>$authenticated_id</varname> is only meaningful if the client has
51466 authenticated (which you can check with the <option>authenticated</option> ACL condition).
51467 </para>
51468 <para>
51469 The lookup key does not have to identify clients: If you want to limit the
51470 rate at which a recipient receives messages, you can use the key
51471 <literal>$local_part@$domain</literal> with the <option>per_rcpt</option> option (see below) in a RCPT
51472 ACL.
51473 </para>
51474 <para>
51475 Internally, Exim appends the smoothing constant <emphasis>p</emphasis> and the options onto the
51476 lookup key because they alter the meaning of the stored data. This is not true
51477 for the limit <emphasis>m</emphasis>, so you can alter the configured maximum rate and Exim will
51478 still remember clients&#x2019; past behaviour, but if you alter the other ratelimit
51479 parameters Exim forgets past behaviour.
51480 </para>
51481 <para>
51482 Each <option>ratelimit</option> condition can have up to three options. One option
51483 specifies what Exim measures the rate of, and the second specifies how Exim
51484 handles excessively fast clients. The third option can be <literal>noupdate</literal>, to
51485 disable updating of the ratelimiting database (see section <xref linkend="rearatdat"/>).
51486 The options are separated by a slash, like the other parameters. They may
51487 appear in any order.
51488 </para>
51489 </section>
51490 <section id="ratoptmea">
51491 <title>Ratelimit options for what is being measured</title>
51492 <para>
51493 The <option>per_conn</option> option limits the client&#x2019;s connection rate.
51494 </para>
51495 <para>
51496 The <option>per_mail</option> option limits the client&#x2019;s rate of sending messages. This is
51497 the default if none of the <option>per_*</option> options is specified.
51498 </para>
51499 <para>
51500 The <option>per_byte</option> option limits the sender&#x2019;s email bandwidth. Note that it is
51501 best to use this option in the DATA ACL; if it is used in an earlier ACL it
51502 relies on the SIZE parameter specified by the client in its MAIL command,
51503 which may be inaccurate or completely missing. You can follow the limit <emphasis>m</emphasis>
51504 in the configuration with K, M, or G to specify limits in kilobytes,
51505 megabytes, or gigabytes, respectively.
51506 </para>
51507 <para>
51508 The <option>per_rcpt</option> option causes Exim to limit the rate at which
51509 recipients are accepted. To be effective, it would need to be used in
51510 either the <option>acl_smtp_rcpt</option> or the <option>acl_not_smtp</option> ACL. In the
51511 <option>acl_smtp_rcpt</option> ACL, the number of recipients is incremented by one.
51512 In the case of a locally submitted message in the <option>acl_not_smtp</option> ACL,
51513 the number of recipients is incremented by the <option>$recipients_count</option>
51514 for the entire message. Note that in either case the rate limiting
51515 engine will see a message with many recipients as a large high-speed
51516 burst.
51517 </para>
51518 <para>
51519 The <option>per_cmd</option> option causes Exim to recompute the rate every time the
51520 condition is processed. This can be used to limit the SMTP command rate.
51521 This command is essentially an alias of <option>per_rcpt</option> to make it clear
51522 that the effect is to limit the rate at which individual commands,
51523 rather than recipients, are accepted.
51524 </para>
51525 </section>
51526 <section id="ratophanfas">
51527 <title>Ratelimit options for handling fast clients</title>
51528 <para>
51529 If a client&#x2019;s average rate is greater than the maximum, the rate limiting
51530 engine can react in two possible ways, depending on the presence of the
51531 <option>strict</option> or <option>leaky</option> options. This is independent of the other
51532 counter-measures (such as rejecting the message) that may be specified by the
51533 rest of the ACL. The default mode is leaky, which avoids a sender&#x2019;s
51534 over-aggressive retry rate preventing it from getting any email through.
51535 </para>
51536 <para>
51537 The <option>strict</option> option means that the client&#x2019;s recorded rate is always
51538 updated. The effect of this is that Exim measures the client&#x2019;s average rate
51539 of attempts to send email, which can be much higher than the maximum it is
51540 actually allowed. If the client is over the limit it may be subjected to
51541 counter-measures by the ACL until it slows down below the maximum rate. If
51542 the client stops attempting to send email for the time specified in the <emphasis>p</emphasis>
51543 parameter then its computed rate will decay exponentially to 37% of its peak
51544 value. You can work out the time (the number of smoothing periods) that a
51545 client is subjected to counter-measures after an over-limit burst with this
51546 formula:
51547 </para>
51548 <literallayout class="monospaced">
51549         ln(peakrate/maxrate)
51550 </literallayout>
51551 <para>
51552 The <option>leaky</option> (default) option means that the client&#x2019;s recorded rate is not
51553 updated if it is above the limit. The effect of this is that Exim measures the
51554 client&#x2019;s average rate of successfully sent email, which cannot be greater than
51555 the maximum allowed. If the client is over the limit it may suffer some
51556 counter-measures (as specified in the ACL), but it will still be able to send
51557 email at the configured maximum rate, whatever the rate of its attempts. This
51558 is generally the better choice if you have clients that retry automatically.
51559 </para>
51560 </section>
51561 <section id="useratlim">
51562 <title>Using rate limiting</title>
51563 <para>
51564 Exim&#x2019;s other ACL facilities are used to define what counter-measures are taken
51565 when the rate limit is exceeded. This might be anything from logging a warning
51566 (for example, while measuring existing sending rates in order to define
51567 policy), through time delays to slow down fast senders, up to rejecting the
51568 message. For example:
51569 </para>
51570 <literallayout class="monospaced">
51571 # Log all senders' rates
51572 warn ratelimit = 0 / 1h / strict
51573      log_message = Sender rate $sender_rate / $sender_rate_period
51574
51575 # Slow down fast senders; note the need to truncate $sender_rate
51576 # at the decimal point.
51577 warn ratelimit = 100 / 1h / per_rcpt / strict
51578      delay     = ${eval: ${sg{$sender_rate}{[.].*}{}} - \
51579                    $sender_rate_limit }s
51580
51581 # Keep authenticated users under control
51582 deny authenticated = *
51583      ratelimit = 100 / 1d / strict / $authenticated_id
51584
51585 # System-wide rate limit
51586 defer message = Sorry, too busy. Try again later.
51587      ratelimit = 10 / 1s / $primary_hostname
51588
51589 # Restrict incoming rate from each host, with a default
51590 # set using a macro and special cases looked up in a table.
51591 defer message = Sender rate exceeds $sender_rate_limit \
51592                messages per $sender_rate_period
51593      ratelimit = ${lookup {$sender_host_address} \
51594                    cdb {DB/ratelimits.cdb} \
51595                    {$value} {RATELIMIT} }
51596 </literallayout>
51597 <para>
51598 <emphasis role="bold">Warning</emphasis>: If you have a busy server with a lot of <option>ratelimit</option> tests,
51599 especially with the <option>per_rcpt</option> option, you may suffer from a performance
51600 bottleneck caused by locking on the ratelimit hints database. Apart from
51601 making your ACLs less complicated, you can reduce the problem by using a
51602 RAM disk for Exim&#x2019;s hints directory (usually <filename>/var/spool/exim/db/</filename>). However
51603 this means that Exim will lose its hints data after a reboot (including retry
51604 hints, the callout cache, and ratelimit data).
51605 </para>
51606 </section>
51607 <section id="rearatdat">
51608 <title>Reading ratelimit data without updating</title>
51609 <para>
51610 <indexterm role="concept">
51611 <primary>rate limitint</primary>
51612 <secondary>reading data without updating</secondary>
51613 </indexterm>
51614 If the <option>noupdate</option> option is present on a <option>ratelimit</option> ACL condition, Exim
51615 computes the rate and checks the limit as normal, but it does not update the
51616 saved data. This means that, in relevant ACLs, it is possible to lookup the
51617 existence of a specified (or auto-generated) ratelimit key without incrementing
51618 the ratelimit counter for that key. In order for this to be useful, another ACL
51619 entry must set the rate for the same key (otherwise it will always be zero).
51620 For example:
51621 </para>
51622 <literallayout class="monospaced">
51623 acl_check_connect:
51624   deny ratelimit = 100 / 5m / strict / per_cmd / noupdate
51625        log_message = RATE: $sender_rate/$sender_rate_period \
51626                      (max $sender_rate_limit)
51627 </literallayout>
51628 <literallayout>
51629 <emphasis>... some other logic and tests...</emphasis>
51630 </literallayout>
51631 <literallayout class="monospaced">
51632 acl_check_mail:
51633   warn ratelimit = 100 / 5m / strict / per_cmd
51634        condition = ${if le{$sender_rate}{$sender_rate_limit}}
51635        logwrite  = RATE UPDATE: $sender_rate/$sender_rate_period \
51636                      (max $sender_rate_limit)
51637 </literallayout>
51638 <para>
51639 In this example, the rate is tested and used to deny access (when it is too
51640 high) in the connect ACL, but the actual computation of the remembered rate
51641 happens later, on a per-command basis, in another ACL.
51642 </para>
51643 </section>
51644 <section id="SECTaddressverification">
51645 <title>Address verification</title>
51646 <para>
51647 <indexterm role="concept">
51648 <primary>verifying address</primary>
51649 <secondary>options for</secondary>
51650 </indexterm>
51651 <indexterm role="concept">
51652 <primary>policy control</primary>
51653 <secondary>address verification</secondary>
51654 </indexterm>
51655 Several of the <option>verify</option> conditions described in section
51656 <xref linkend="SECTaclconditions"/> cause addresses to be verified. Section
51657 <xref linkend="SECTsenaddver"/> discusses the reporting of sender verification failures.
51658 The verification conditions can be followed by options that modify the
51659 verification process. The options are separated from the keyword and from each
51660 other by slashes, and some of them contain parameters. For example:
51661 </para>
51662 <literallayout class="monospaced">
51663 verify = sender/callout
51664 verify = recipient/defer_ok/callout=10s,defer_ok
51665 </literallayout>
51666 <para>
51667 The first stage of address verification, which always happens, is to run the
51668 address through the routers, in <quote>verify mode</quote>. Routers can detect the
51669 difference between verification and routing for delivery, and their actions can
51670 be varied by a number of generic options such as <option>verify</option> and <option>verify_only</option>
51671 (see chapter <xref linkend="CHAProutergeneric"/>). If routing fails, verification fails.
51672 The available options are as follows:
51673 </para>
51674 <itemizedlist>
51675 <listitem>
51676 <para>
51677 If the <option>callout</option> option is specified, successful routing to one or more
51678 remote hosts is followed by a <quote>callout</quote> to those hosts as an additional
51679 check. Callouts and their sub-options are discussed in the next section.
51680 </para>
51681 </listitem>
51682 <listitem>
51683 <para>
51684 If there is a defer error while doing verification routing, the ACL
51685 normally returns <quote>defer</quote>. However, if you include <option>defer_ok</option> in the
51686 options, the condition is forced to be true instead. Note that this is a main
51687 verification option as well as a suboption for callouts.
51688 </para>
51689 </listitem>
51690 <listitem>
51691 <para>
51692 The <option>no_details</option> option is covered in section <xref linkend="SECTsenaddver"/>, which
51693 discusses the reporting of sender address verification failures.
51694 </para>
51695 </listitem>
51696 <listitem>
51697 <para>
51698 The <option>success_on_redirect</option> option causes verification always to succeed
51699 immediately after a successful redirection. By default, if a redirection
51700 generates just one address, that address is also verified. See further
51701 discussion in section <xref linkend="SECTredirwhilveri"/>.
51702 </para>
51703 </listitem>
51704 </itemizedlist>
51705 <para>
51706 <indexterm role="concept">
51707 <primary>verifying address</primary>
51708 <secondary>differentiating failures</secondary>
51709 </indexterm>
51710 <indexterm role="variable">
51711 <primary><varname>$recipient_verify_failure</varname></primary>
51712 </indexterm>
51713 <indexterm role="variable">
51714 <primary><varname>$sender_verify_failure</varname></primary>
51715 </indexterm>
51716 <indexterm role="variable">
51717 <primary><varname>$acl_verify_message</varname></primary>
51718 </indexterm>
51719 After an address verification failure, <varname>$acl_verify_message</varname> contains the
51720 error message that is associated with the failure. It can be preserved by
51721 coding like this:
51722 </para>
51723 <literallayout class="monospaced">
51724 warn  !verify = sender
51725        set acl_m0 = $acl_verify_message
51726 </literallayout>
51727 <para>
51728 If you are writing your own custom rejection message or log message when
51729 denying access, you can use this variable to include information about the
51730 verification failure.
51731 </para>
51732 <para>
51733 In addition, <varname>$sender_verify_failure</varname> or <varname>$recipient_verify_failure</varname> (as
51734 appropriate) contains one of the following words:
51735 </para>
51736 <itemizedlist>
51737 <listitem>
51738 <para>
51739 <option>qualify</option>: The address was unqualified (no domain), and the message
51740 was neither local nor came from an exempted host.
51741 </para>
51742 </listitem>
51743 <listitem>
51744 <para>
51745 <option>route</option>: Routing failed.
51746 </para>
51747 </listitem>
51748 <listitem>
51749 <para>
51750 <option>mail</option>: Routing succeeded, and a callout was attempted; rejection
51751 occurred at or before the MAIL command (that is, on initial
51752 connection, HELO, or MAIL).
51753 </para>
51754 </listitem>
51755 <listitem>
51756 <para>
51757 <option>recipient</option>: The RCPT command in a callout was rejected.
51758 </para>
51759 </listitem>
51760 <listitem>
51761 <para>
51762 <option>postmaster</option>: The postmaster check in a callout was rejected.
51763 </para>
51764 </listitem>
51765 </itemizedlist>
51766 <para>
51767 The main use of these variables is expected to be to distinguish between
51768 rejections of MAIL and rejections of RCPT in callouts.
51769 </para>
51770 </section>
51771 <section id="SECTcallver">
51772 <title>Callout verification</title>
51773 <para>
51774 <indexterm role="concept">
51775 <primary>verifying address</primary>
51776 <secondary>by callout</secondary>
51777 </indexterm>
51778 <indexterm role="concept">
51779 <primary>callout</primary>
51780 <secondary>verification</secondary>
51781 </indexterm>
51782 <indexterm role="concept">
51783 <primary>SMTP</primary>
51784 <secondary>callout verification</secondary>
51785 </indexterm>
51786 For non-local addresses, routing verifies the domain, but is unable to do any
51787 checking of the local part. There are situations where some means of verifying
51788 the local part is desirable. One way this can be done is to make an SMTP
51789 <emphasis>callback</emphasis> to a delivery host for the sender address or a <emphasis>callforward</emphasis> to
51790 a subsequent host for a recipient address, to see if the host accepts the
51791 address. We use the term <emphasis>callout</emphasis> to cover both cases. Note that for a
51792 sender address, the callback is not to the client host that is trying to
51793 deliver the message, but to one of the hosts that accepts incoming mail for the
51794 sender&#x2019;s domain.
51795 </para>
51796 <para>
51797 Exim does not do callouts by default. If you want them to happen, you must
51798 request them by setting appropriate options on the <option>verify</option> condition, as
51799 described below. This facility should be used with care, because it can add a
51800 lot of resource usage to the cost of verifying an address. However, Exim does
51801 cache the results of callouts, which helps to reduce the cost. Details of
51802 caching are in section <xref linkend="SECTcallvercache"/>.
51803 </para>
51804 <para>
51805 Recipient callouts are usually used only between hosts that are controlled by
51806 the same administration. For example, a corporate gateway host could use
51807 callouts to check for valid recipients on an internal mailserver. A successful
51808 callout does not guarantee that a real delivery to the address would succeed;
51809 on the other hand, a failing callout does guarantee that a delivery would fail.
51810 </para>
51811 <para>
51812 If the <option>callout</option> option is present on a condition that verifies an address, a
51813 second stage of verification occurs if the address is successfully routed to
51814 one or more remote hosts. The usual case is routing by a <command>dnslookup</command> or a
51815 <command>manualroute</command> router, where the router specifies the hosts. However, if a
51816 router that does not set up hosts routes to an <command>smtp</command> transport with a
51817 <option>hosts</option> setting, the transport&#x2019;s hosts are used. If an <command>smtp</command> transport has
51818 <option>hosts_override</option> set, its hosts are always used, whether or not the router
51819 supplies a host list.
51820 </para>
51821 <para>
51822 The port that is used is taken from the transport, if it is specified and is a
51823 remote transport. (For routers that do verification only, no transport need be
51824 specified.) Otherwise, the default SMTP port is used. If a remote transport
51825 specifies an outgoing interface, this is used; otherwise the interface is not
51826 specified. Likewise, the text that is used for the HELO command is taken from
51827 the transport&#x2019;s <option>helo_data</option> option; if there is no transport, the value of
51828 <varname>$smtp_active_hostname</varname> is used.
51829 </para>
51830 <para>
51831 For a sender callout check, Exim makes SMTP connections to the remote hosts, to
51832 test whether a bounce message could be delivered to the sender address. The
51833 following SMTP commands are sent:
51834 </para>
51835 <literallayout>
51836 <literal>HELO </literal>&lt;<emphasis>local host name</emphasis>&gt;
51837 <literal>MAIL FROM:&lt;&gt;</literal>
51838 <literal>RCPT TO:</literal>&lt;<emphasis>the address to be tested</emphasis>&gt;
51839 <literal>QUIT</literal>
51840 </literallayout>
51841 <para>
51842 LHLO is used instead of HELO if the transport&#x2019;s <option>protocol</option> option is
51843 set to <quote>lmtp</quote>.
51844 </para>
51845 <para>
51846 A recipient callout check is similar. By default, it also uses an empty address
51847 for the sender. This default is chosen because most hosts do not make use of
51848 the sender address when verifying a recipient. Using the same address means
51849 that a single cache entry can be used for each recipient. Some sites, however,
51850 do make use of the sender address when verifying. These are catered for by the
51851 <option>use_sender</option> and <option>use_postmaster</option> options, described in the next section.
51852 </para>
51853 <para>
51854 If the response to the RCPT command is a 2<emphasis>xx</emphasis> code, the verification
51855 succeeds. If it is 5<emphasis>xx</emphasis>, the verification fails. For any other condition,
51856 Exim tries the next host, if any. If there is a problem with all the remote
51857 hosts, the ACL yields <quote>defer</quote>, unless the <option>defer_ok</option> parameter of the
51858 <option>callout</option> option is given, in which case the condition is forced to succeed.
51859 </para>
51860 <para>
51861 <indexterm role="concept">
51862 <primary>SMTP</primary>
51863 <secondary>output flushing, disabling for callout</secondary>
51864 </indexterm>
51865 A callout may take a little time. For this reason, Exim normally flushes SMTP
51866 output before performing a callout in an ACL, to avoid unexpected timeouts in
51867 clients when the SMTP PIPELINING extension is in use. The flushing can be
51868 disabled by using a <option>control</option> modifier to set <option>no_callout_flush</option>.
51869 </para>
51870 </section>
51871 <section id="CALLaddparcall">
51872 <title>Additional parameters for callouts</title>
51873 <para>
51874 <indexterm role="concept">
51875 <primary>callout</primary>
51876 <secondary>additional parameters for</secondary>
51877 </indexterm>
51878 The <option>callout</option> option can be followed by an equals sign and a number of
51879 optional parameters, separated by commas. For example:
51880 </para>
51881 <literallayout class="monospaced">
51882 verify = recipient/callout=10s,defer_ok
51883 </literallayout>
51884 <para>
51885 The old syntax, which had <option>callout_defer_ok</option> and <option>check_postmaster</option> as
51886 separate verify options, is retained for backwards compatibility, but is now
51887 deprecated. The additional parameters for <option>callout</option> are as follows:
51888 </para>
51889 <variablelist>
51890 <varlistentry>
51891 <term>&lt;<emphasis>a&nbsp;time&nbsp;interval</emphasis>&gt;</term>
51892 <listitem>
51893 <para>
51894 <indexterm role="concept">
51895 <primary>callout</primary>
51896 <secondary>timeout, specifying</secondary>
51897 </indexterm>
51898 This specifies the timeout that applies for the callout attempt to each host.
51899 For example:
51900 </para>
51901 <literallayout class="monospaced">
51902 verify = sender/callout=5s
51903 </literallayout>
51904 <para>
51905 The default is 30 seconds. The timeout is used for each response from the
51906 remote host. It is also used for the initial connection, unless overridden by
51907 the <option>connect</option> parameter.
51908 </para>
51909 </listitem></varlistentry>
51910 <varlistentry>
51911 <term><emphasis role="bold">connect&nbsp;=&nbsp;</emphasis>&lt;<emphasis>time&nbsp;interval</emphasis>&gt;</term>
51912 <listitem>
51913 <para>
51914 <indexterm role="concept">
51915 <primary>callout</primary>
51916 <secondary>connection timeout, specifying</secondary>
51917 </indexterm>
51918 This parameter makes it possible to set a different (usually smaller) timeout
51919 for making the SMTP connection. For example:
51920 </para>
51921 <literallayout class="monospaced">
51922 verify = sender/callout=5s,connect=1s
51923 </literallayout>
51924 <para>
51925 If not specified, this timeout defaults to the general timeout value.
51926 </para>
51927 </listitem></varlistentry>
51928 <varlistentry>
51929 <term><emphasis role="bold">defer_ok</emphasis></term>
51930 <listitem>
51931 <para>
51932 <indexterm role="concept">
51933 <primary>callout</primary>
51934 <secondary>defer, action on</secondary>
51935 </indexterm>
51936 When this parameter is present, failure to contact any host, or any other kind
51937 of temporary error, is treated as success by the ACL. However, the cache is not
51938 updated in this circumstance.
51939 </para>
51940 </listitem></varlistentry>
51941 <varlistentry>
51942 <term><emphasis role="bold">fullpostmaster</emphasis></term>
51943 <listitem>
51944 <para>
51945 <indexterm role="concept">
51946 <primary>callout</primary>
51947 <secondary>full postmaster check</secondary>
51948 </indexterm>
51949 This operates like the <option>postmaster</option> option (see below), but if the check for
51950 <emphasis>postmaster@domain</emphasis> fails, it tries just <emphasis>postmaster</emphasis>, without a domain, in
51951 accordance with the specification in RFC 2821. The RFC states that the
51952 unqualified address <emphasis>postmaster</emphasis> should be accepted.
51953 </para>
51954 </listitem></varlistentry>
51955 <varlistentry>
51956 <term><emphasis role="bold">mailfrom&nbsp;=&nbsp;</emphasis>&lt;<emphasis>email&nbsp;address</emphasis>&gt;</term>
51957 <listitem>
51958 <para>
51959 <indexterm role="concept">
51960 <primary>callout</primary>
51961 <secondary>sender when verifying header</secondary>
51962 </indexterm>
51963 When verifying addresses in header lines using the <option>header_sender</option>
51964 verification option, Exim behaves by default as if the addresses are envelope
51965 sender addresses from a message. Callout verification therefore tests to see
51966 whether a bounce message could be delivered, by using an empty address in the
51967 MAIL command. However, it is arguable that these addresses might never be used
51968 as envelope senders, and could therefore justifiably reject bounce messages
51969 (empty senders). The <option>mailfrom</option> callout parameter allows you to specify what
51970 address to use in the MAIL command. For example:
51971 </para>
51972 <literallayout class="monospaced">
51973 require  verify = header_sender/callout=mailfrom=abcd@x.y.z
51974 </literallayout>
51975 <para>
51976 This parameter is available only for the <option>header_sender</option> verification option.
51977 </para>
51978 </listitem></varlistentry>
51979 <varlistentry>
51980 <term><emphasis role="bold">maxwait&nbsp;=&nbsp;</emphasis>&lt;<emphasis>time&nbsp;interval</emphasis>&gt;</term>
51981 <listitem>
51982 <para>
51983 <indexterm role="concept">
51984 <primary>callout</primary>
51985 <secondary>overall timeout, specifying</secondary>
51986 </indexterm>
51987 This parameter sets an overall timeout for performing a callout verification.
51988 For example:
51989 </para>
51990 <literallayout class="monospaced">
51991 verify = sender/callout=5s,maxwait=30s
51992 </literallayout>
51993 <para>
51994 This timeout defaults to four times the callout timeout for individual SMTP
51995 commands. The overall timeout applies when there is more than one host that can
51996 be tried. The timeout is checked before trying the next host. This prevents
51997 very long delays if there are a large number of hosts and all are timing out
51998 (for example, when network connections are timing out).
51999 </para>
52000 </listitem></varlistentry>
52001 <varlistentry>
52002 <term><emphasis role="bold">no_cache</emphasis></term>
52003 <listitem>
52004 <para>
52005 <indexterm role="concept">
52006 <primary>callout</primary>
52007 <secondary>cache, suppressing</secondary>
52008 </indexterm>
52009 <indexterm role="concept">
52010 <primary>caching callout, suppressing</primary>
52011 </indexterm>
52012 When this parameter is given, the callout cache is neither read nor updated.
52013 </para>
52014 </listitem></varlistentry>
52015 <varlistentry>
52016 <term><emphasis role="bold">postmaster</emphasis></term>
52017 <listitem>
52018 <para>
52019 <indexterm role="concept">
52020 <primary>callout</primary>
52021 <secondary>postmaster; checking</secondary>
52022 </indexterm>
52023 When this parameter is set, a successful callout check is followed by a similar
52024 check for the local part <emphasis>postmaster</emphasis> at the same domain. If this address is
52025 rejected, the callout fails (but see <option>fullpostmaster</option> above). The result of
52026 the postmaster check is recorded in a cache record; if it is a failure, this is
52027 used to fail subsequent callouts for the domain without a connection being
52028 made, until the cache record expires.
52029 </para>
52030 </listitem></varlistentry>
52031 <varlistentry>
52032 <term><emphasis role="bold">postmaster_mailfrom&nbsp;=&nbsp;</emphasis>&lt;<emphasis>email&nbsp;address</emphasis>&gt;</term>
52033 <listitem>
52034 <para>
52035 The postmaster check uses an empty sender in the MAIL command by default.
52036 You can use this parameter to do a postmaster check using a different address.
52037 For example:
52038 </para>
52039 <literallayout class="monospaced">
52040 require  verify = sender/callout=postmaster_mailfrom=abc@x.y.z
52041 </literallayout>
52042 <para>
52043 If both <option>postmaster</option> and <option>postmaster_mailfrom</option> are present, the rightmost
52044 one overrides. The <option>postmaster</option> parameter is equivalent to this example:
52045 </para>
52046 <literallayout class="monospaced">
52047 require  verify = sender/callout=postmaster_mailfrom=
52048 </literallayout>
52049 <para>
52050 <emphasis role="bold">Warning</emphasis>: The caching arrangements for postmaster checking do not take
52051 account of the sender address. It is assumed that either the empty address or
52052 a fixed non-empty address will be used. All that Exim remembers is that the
52053 postmaster check for the domain succeeded or failed.
52054 </para>
52055 </listitem></varlistentry>
52056 <varlistentry>
52057 <term><emphasis role="bold">random</emphasis></term>
52058 <listitem>
52059 <para>
52060 <indexterm role="concept">
52061 <primary>callout</primary>
52062 <secondary><quote>random</quote> check</secondary>
52063 </indexterm>
52064 When this parameter is set, before doing the normal callout check, Exim does a
52065 check for a <quote>random</quote> local part at the same domain. The local part is not
52066 really random &ndash; it is defined by the expansion of the option
52067 <option>callout_random_local_part</option>, which defaults to
52068 </para>
52069 <literallayout class="monospaced">
52070 $primary_host_name-$tod_epoch-testing
52071 </literallayout>
52072 <para>
52073 The idea here is to try to determine whether the remote host accepts all local
52074 parts without checking. If it does, there is no point in doing callouts for
52075 specific local parts. If the <quote>random</quote> check succeeds, the result is saved in
52076 a cache record, and used to force the current and subsequent callout checks to
52077 succeed without a connection being made, until the cache record expires.
52078 </para>
52079 </listitem></varlistentry>
52080 <varlistentry>
52081 <term><emphasis role="bold">use_postmaster</emphasis></term>
52082 <listitem>
52083 <para>
52084 <indexterm role="concept">
52085 <primary>callout</primary>
52086 <secondary>sender for recipient check</secondary>
52087 </indexterm>
52088 This parameter applies to recipient callouts only. For example:
52089 </para>
52090 <literallayout class="monospaced">
52091 deny  !verify = recipient/callout=use_postmaster
52092 </literallayout>
52093 <para>
52094 <indexterm role="variable">
52095 <primary><varname>$qualify_domain</varname></primary>
52096 </indexterm>
52097 It causes a non-empty postmaster address to be used in the MAIL command when
52098 performing the callout for the recipient, and also for a <quote>random</quote> check if
52099 that is configured. The local part of the address is <literal>postmaster</literal> and the
52100 domain is the contents of <varname>$qualify_domain</varname>.
52101 </para>
52102 </listitem></varlistentry>
52103 <varlistentry>
52104 <term><emphasis role="bold">use_sender</emphasis></term>
52105 <listitem>
52106 <para>
52107 This option applies to recipient callouts only. For example:
52108 </para>
52109 <literallayout class="monospaced">
52110 require  verify = recipient/callout=use_sender
52111 </literallayout>
52112 <para>
52113 It causes the message&#x2019;s actual sender address to be used in the MAIL
52114 command when performing the callout, instead of an empty address. There is no
52115 need to use this option unless you know that the called hosts make use of the
52116 sender when checking recipients. If used indiscriminately, it reduces the
52117 usefulness of callout caching.
52118 </para>
52119 </listitem></varlistentry>
52120 </variablelist>
52121 <para>
52122 If you use any of the parameters that set a non-empty sender for the MAIL
52123 command (<option>mailfrom</option>, <option>postmaster_mailfrom</option>, <option>use_postmaster</option>, or
52124 <option>use_sender</option>), you should think about possible loops. Recipient checking is
52125 usually done between two hosts that are under the same management, and the host
52126 that receives the callouts is not normally configured to do callouts itself.
52127 Therefore, it is normally safe to use <option>use_postmaster</option> or <option>use_sender</option> in
52128 these circumstances.
52129 </para>
52130 <para>
52131 However, if you use a non-empty sender address for a callout to an arbitrary
52132 host, there is the likelihood that the remote host will itself initiate a
52133 callout check back to your host. As it is checking what appears to be a message
52134 sender, it is likely to use an empty address in MAIL, thus avoiding a
52135 callout loop. However, to be on the safe side it would be best to set up your
52136 own ACLs so that they do not do sender verification checks when the recipient
52137 is the address you use for header sender or postmaster callout checking.
52138 </para>
52139 <para>
52140 Another issue to think about when using non-empty senders for callouts is
52141 caching. When you set <option>mailfrom</option> or <option>use_sender</option>, the cache record is keyed
52142 by the sender/recipient combination; thus, for any given recipient, many more
52143 actual callouts are performed than when an empty sender or postmaster is used.
52144 </para>
52145 </section>
52146 <section id="SECTcallvercache">
52147 <title>Callout caching</title>
52148 <para>
52149 <indexterm role="concept">
52150 <primary>hints database</primary>
52151 <secondary>callout cache</secondary>
52152 </indexterm>
52153 <indexterm role="concept">
52154 <primary>callout</primary>
52155 <secondary>cache, description of</secondary>
52156 </indexterm>
52157 <indexterm role="concept">
52158 <primary>caching</primary>
52159 <secondary>callout</secondary>
52160 </indexterm>
52161 Exim caches the results of callouts in order to reduce the amount of resources
52162 used, unless you specify the <option>no_cache</option> parameter with the <option>callout</option>
52163 option. A hints database called <quote>callout</quote> is used for the cache. Two
52164 different record types are used: one records the result of a callout check for
52165 a specific address, and the other records information that applies to the
52166 entire domain (for example, that it accepts the local part <emphasis>postmaster</emphasis>).
52167 </para>
52168 <para>
52169 When an original callout fails, a detailed SMTP error message is given about
52170 the failure. However, for subsequent failures use the cache data, this message
52171 is not available.
52172 </para>
52173 <para>
52174 The expiry times for negative and positive address cache records are
52175 independent, and can be set by the global options <option>callout_negative_expire</option>
52176 (default 2h) and <option>callout_positive_expire</option> (default 24h), respectively.
52177 </para>
52178 <para>
52179 If a host gives a negative response to an SMTP connection, or rejects any
52180 commands up to and including
52181 </para>
52182 <literallayout class="monospaced">
52183 MAIL FROM:&lt;&gt;
52184 </literallayout>
52185 <para>
52186 (but not including the MAIL command with a non-empty address),
52187 any callout attempt is bound to fail. Exim remembers such failures in a
52188 domain cache record, which it uses to fail callouts for the domain without
52189 making new connections, until the domain record times out. There are two
52190 separate expiry times for domain cache records:
52191 <option>callout_domain_negative_expire</option> (default 3h) and
52192 <option>callout_domain_positive_expire</option> (default 7d).
52193 </para>
52194 <para>
52195 Domain records expire when the negative expiry time is reached if callouts
52196 cannot be made for the domain, or if the postmaster check failed.
52197 Otherwise, they expire when the positive expiry time is reached. This
52198 ensures that, for example, a host that stops accepting <quote>random</quote> local parts
52199 will eventually be noticed.
52200 </para>
52201 <para>
52202 The callout caching mechanism is based on the domain of the address that is
52203 being tested. If the domain routes to several hosts, it is assumed that their
52204 behaviour will be the same.
52205 </para>
52206 </section>
52207 <section id="SECTsenaddver">
52208 <title>Sender address verification reporting</title>
52209 <para>
52210 <indexterm role="concept">
52211 <primary>verifying</primary>
52212 <secondary>suppressing error details</secondary>
52213 </indexterm>
52214 See section <xref linkend="SECTaddressverification"/> for a general discussion of
52215 verification. When sender verification fails in an ACL, the details of the
52216 failure are given as additional output lines before the 550 response to the
52217 relevant SMTP command (RCPT or DATA). For example, if sender callout is in use,
52218 you might see:
52219 </para>
52220 <literallayout class="monospaced">
52221 MAIL FROM:&lt;xyz@abc.example&gt;
52222 250 OK
52223 RCPT TO:&lt;pqr@def.example&gt;
52224 550-Verification failed for &lt;xyz@abc.example&gt;
52225 550-Called:   192.168.34.43
52226 550-Sent:     RCPT TO:&lt;xyz@abc.example&gt;
52227 550-Response: 550 Unknown local part xyz in &lt;xyz@abc.example&gt;
52228 550 Sender verification failed
52229 </literallayout>
52230 <para>
52231 If more than one RCPT command fails in the same way, the details are given
52232 only for the first of them. However, some administrators do not want to send
52233 out this much information. You can suppress the details by adding
52234 <literal>/no_details</literal> to the ACL statement that requests sender verification. For
52235 example:
52236 </para>
52237 <literallayout class="monospaced">
52238 verify = sender/no_details
52239 </literallayout>
52240 </section>
52241 <section id="SECTredirwhilveri">
52242 <title>Redirection while verifying</title>
52243 <para>
52244 <indexterm role="concept">
52245 <primary>verifying</primary>
52246 <secondary>redirection while</secondary>
52247 </indexterm>
52248 <indexterm role="concept">
52249 <primary>address redirection</primary>
52250 <secondary>while verifying</secondary>
52251 </indexterm>
52252 A dilemma arises when a local address is redirected by aliasing or forwarding
52253 during verification: should the generated addresses themselves be verified,
52254 or should the successful expansion of the original address be enough to verify
52255 it? By default, Exim takes the following pragmatic approach:
52256 </para>
52257 <itemizedlist>
52258 <listitem>
52259 <para>
52260 When an incoming address is redirected to just one child address, verification
52261 continues with the child address, and if that fails to verify, the original
52262 verification also fails.
52263 </para>
52264 </listitem>
52265 <listitem>
52266 <para>
52267 When an incoming address is redirected to more than one child address,
52268 verification does not continue. A success result is returned.
52269 </para>
52270 </listitem>
52271 </itemizedlist>
52272 <para>
52273 This seems the most reasonable behaviour for the common use of aliasing as a
52274 way of redirecting different local parts to the same mailbox. It means, for
52275 example, that a pair of alias entries of the form
52276 </para>
52277 <literallayout class="monospaced">
52278 A.Wol:   aw123
52279 aw123:   :fail: Gone away, no forwarding address
52280 </literallayout>
52281 <para>
52282 work as expected, with both local parts causing verification failure. When a
52283 redirection generates more than one address, the behaviour is more like a
52284 mailing list, where the existence of the alias itself is sufficient for
52285 verification to succeed.
52286 </para>
52287 <para>
52288 It is possible, however, to change the default behaviour so that all successful
52289 redirections count as successful verifications, however many new addresses are
52290 generated. This is specified by the <option>success_on_redirect</option> verification
52291 option. For example:
52292 </para>
52293 <literallayout class="monospaced">
52294 require verify = recipient/success_on_redirect/callout=10s
52295 </literallayout>
52296 <para>
52297 In this example, verification succeeds if a router generates a new address, and
52298 the callout does not occur, because no address was routed to a remote host.
52299 </para>
52300 <para>
52301 When verification is being tested via the <option>-bv</option> option, the treatment of
52302 redirections is as just described, unless the <option>-v</option> or any debugging option is
52303 also specified. In that case, full verification is done for every generated
52304 address and a report is output for each of them.
52305 </para>
52306 </section>
52307 <section id="SECTverifyCSA">
52308 <title>Client SMTP authorization (CSA)</title>
52309 <para>
52310 <indexterm role="concept">
52311 <primary>CSA</primary>
52312 <secondary>verifying</secondary>
52313 </indexterm>
52314 Client SMTP Authorization is a system that allows a site to advertise
52315 which machines are and are not permitted to send email. This is done by placing
52316 special SRV records in the DNS; these are looked up using the client&#x2019;s HELO
52317 domain. At the time of writing, CSA is still an Internet Draft. Client SMTP
52318 Authorization checks in Exim are performed by the ACL condition:
52319 </para>
52320 <literallayout class="monospaced">
52321 verify = csa
52322 </literallayout>
52323 <para>
52324 This fails if the client is not authorized. If there is a DNS problem, or if no
52325 valid CSA SRV record is found, or if the client is authorized, the condition
52326 succeeds. These three cases can be distinguished using the expansion variable
52327 <varname>$csa_status</varname>, which can take one of the values <quote>fail</quote>, <quote>defer</quote>,
52328 <quote>unknown</quote>, or <quote>ok</quote>. The condition does not itself defer because that would
52329 be likely to cause problems for legitimate email.
52330 </para>
52331 <para>
52332 The error messages produced by the CSA code include slightly more
52333 detail. If <varname>$csa_status</varname> is <quote>defer</quote>, this may be because of problems
52334 looking up the CSA SRV record, or problems looking up the CSA target
52335 address record. There are four reasons for <varname>$csa_status</varname> being <quote>fail</quote>:
52336 </para>
52337 <itemizedlist>
52338 <listitem>
52339 <para>
52340 The client&#x2019;s host name is explicitly not authorized.
52341 </para>
52342 </listitem>
52343 <listitem>
52344 <para>
52345 The client&#x2019;s IP address does not match any of the CSA target IP addresses.
52346 </para>
52347 </listitem>
52348 <listitem>
52349 <para>
52350 The client&#x2019;s host name is authorized but it has no valid target IP addresses
52351 (for example, the target&#x2019;s addresses are IPv6 and the client is using IPv4).
52352 </para>
52353 </listitem>
52354 <listitem>
52355 <para>
52356 The client&#x2019;s host name has no CSA SRV record but a parent domain has asserted
52357 that all subdomains must be explicitly authorized.
52358 </para>
52359 </listitem>
52360 </itemizedlist>
52361 <para>
52362 The <option>csa</option> verification condition can take an argument which is the domain to
52363 use for the DNS query. The default is:
52364 </para>
52365 <literallayout class="monospaced">
52366 verify = csa/$sender_helo_name
52367 </literallayout>
52368 <para>
52369 This implementation includes an extension to CSA. If the query domain
52370 is an address literal such as [192.0.2.95], or if it is a bare IP
52371 address, Exim searches for CSA SRV records in the reverse DNS as if
52372 the HELO domain was (for example) <emphasis>95.2.0.192.in-addr.arpa</emphasis>. Therefore it is
52373 meaningful to say:
52374 </para>
52375 <literallayout class="monospaced">
52376 verify = csa/$sender_host_address
52377 </literallayout>
52378 <para>
52379 In fact, this is the check that Exim performs if the client does not say HELO.
52380 This extension can be turned off by setting the main configuration option
52381 <option>dns_csa_use_reverse</option> to be false.
52382 </para>
52383 <para>
52384 If a CSA SRV record is not found for the domain itself, a search
52385 is performed through its parent domains for a record which might be
52386 making assertions about subdomains. The maximum depth of this search is limited
52387 using the main configuration option <option>dns_csa_search_limit</option>, which is 5 by
52388 default. Exim does not look for CSA SRV records in a top level domain, so the
52389 default settings handle HELO domains as long as seven
52390 (<emphasis>hostname.five.four.three.two.one.com</emphasis>). This encompasses the vast majority
52391 of legitimate HELO domains.
52392 </para>
52393 <para>
52394 The <emphasis>dnsdb</emphasis> lookup also has support for CSA. Although <emphasis>dnsdb</emphasis> also supports
52395 direct SRV lookups, this is not sufficient because of the extra parent domain
52396 search behaviour of CSA, and (as with PTR lookups) <emphasis>dnsdb</emphasis> also turns IP
52397 addresses into lookups in the reverse DNS space. The result of a successful
52398 lookup such as:
52399 </para>
52400 <literallayout class="monospaced">
52401 ${lookup dnsdb {csa=$sender_helo_name}}
52402 </literallayout>
52403 <para>
52404 has two space-separated fields: an authorization code and a target host name.
52405 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
52406 authorization required but absent, or <quote>?</quote> for unknown.
52407 </para>
52408 </section>
52409 <section id="SECTverifyPRVS">
52410 <title>Bounce address tag validation</title>
52411 <para>
52412 <indexterm role="concept">
52413 <primary>BATV, verifying</primary>
52414 </indexterm>
52415 Bounce address tag validation (BATV) is a scheme whereby the envelope senders
52416 of outgoing messages have a cryptographic, timestamped <quote>tag</quote> added to them.
52417 Genuine incoming bounce messages should therefore always be addressed to
52418 recipients that have a valid tag. This scheme is a way of detecting unwanted
52419 bounce messages caused by sender address forgeries (often called <quote>collateral
52420 spam</quote>), because the recipients of such messages do not include valid tags.
52421 </para>
52422 <para>
52423 There are two expansion items to help with the implementation of the BATV
52424 <quote>prvs</quote> (private signature) scheme in an Exim configuration. This scheme signs
52425 the original envelope sender address by using a simple key to add a hash of the
52426 address and some time-based randomizing information. The <option>prvs</option> expansion
52427 item creates a signed address, and the <option>prvscheck</option> expansion item checks one.
52428 The syntax of these expansion items is described in section
52429 <xref linkend="SECTexpansionitems"/>.
52430 </para>
52431 <para>
52432 As an example, suppose the secret per-address keys are stored in an MySQL
52433 database. A query to look up the key for an address could be defined as a macro
52434 like this:
52435 </para>
52436 <literallayout class="monospaced">
52437 PRVSCHECK_SQL = ${lookup mysql{SELECT secret FROM batv_prvs \
52438                 WHERE sender='${quote_mysql:$prvscheck_address}'\
52439                 }{$value}}
52440 </literallayout>
52441 <para>
52442 Suppose also that the senders who make use of BATV are defined by an address
52443 list called <option>batv_senders</option>. Then, in the ACL for RCPT commands, you could
52444 use this:
52445 </para>
52446 <literallayout class="monospaced">
52447 # Bounces: drop unsigned addresses for BATV senders
52448 deny message = This address does not send an unsigned reverse path
52449      senders = :
52450      recipients = +batv_senders
52451
52452 # Bounces: In case of prvs-signed address, check signature.
52453 deny message = Invalid reverse path signature.
52454      senders = :
52455      condition  = ${prvscheck {$local_part@$domain}\
52456                   {PRVSCHECK_SQL}{1}}
52457      !condition = $prvscheck_result
52458 </literallayout>
52459 <para>
52460 The first statement rejects recipients for bounce messages that are addressed
52461 to plain BATV sender addresses, because it is known that BATV senders do not
52462 send out messages with plain sender addresses. The second statement rejects
52463 recipients that are prvs-signed, but with invalid signatures (either because
52464 the key is wrong, or the signature has timed out).
52465 </para>
52466 <para>
52467 A non-prvs-signed address is not rejected by the second statement, because the
52468 <option>prvscheck</option> expansion yields an empty string if its first argument is not a
52469 prvs-signed address, thus causing the <option>condition</option> condition to be false. If
52470 the first argument is a syntactically valid prvs-signed address, the yield is
52471 the third string (in this case <quote>1</quote>), whether or not the cryptographic and
52472 timeout checks succeed. The <varname>$prvscheck_result</varname> variable contains the result
52473 of the checks (empty for failure, <quote>1</quote> for success).
52474 </para>
52475 <para>
52476 There is one more issue you must consider when implementing prvs-signing:
52477 you have to ensure that the routers accept prvs-signed addresses and
52478 deliver them correctly. The easiest way to handle this is to use a <command>redirect</command>
52479 router to remove the signature with a configuration along these lines:
52480 </para>
52481 <literallayout class="monospaced">
52482 batv_redirect:
52483   driver = redirect
52484   data = ${prvscheck {$local_part@$domain}{PRVSCHECK_SQL}}
52485 </literallayout>
52486 <para>
52487 This works because, if the third argument of <option>prvscheck</option> is empty, the result
52488 of the expansion of a prvs-signed address is the decoded value of the original
52489 address. This router should probably be the first of your routers that handles
52490 local addresses.
52491 </para>
52492 <para>
52493 To create BATV-signed addresses in the first place, a transport of this form
52494 can be used:
52495 </para>
52496 <literallayout class="monospaced">
52497 external_smtp_batv:
52498   driver = smtp
52499   return_path = ${prvs {$return_path} \
52500                        {${lookup mysql{SELECT \
52501                        secret FROM batv_prvs WHERE \
52502                        sender='${quote_mysql:$sender_address}'} \
52503                        {$value}fail}}}
52504 </literallayout>
52505 <para>
52506 If no key can be found for the existing return path, no signing takes place.
52507 </para>
52508 </section>
52509 <section id="SECTrelaycontrol">
52510 <title>Using an ACL to control relaying</title>
52511 <para>
52512 <indexterm role="concept">
52513 <primary>access control lists (ACLs)</primary>
52514 <secondary>relay control</secondary>
52515 </indexterm>
52516 <indexterm role="concept">
52517 <primary>relaying</primary>
52518 <secondary>control by ACL</secondary>
52519 </indexterm>
52520 <indexterm role="concept">
52521 <primary>policy control</primary>
52522 <secondary>relay control</secondary>
52523 </indexterm>
52524 An MTA is said to <emphasis>relay</emphasis> a message if it receives it from some host and
52525 delivers it directly to another host as a result of a remote address contained
52526 within it. Redirecting a local address via an alias or forward file and then
52527 passing the message on to another host is not relaying,
52528 <indexterm role="concept">
52529 <primary><quote>percent hack</quote></primary>
52530 </indexterm>
52531 but a redirection as a result of the <quote>percent hack</quote> is.
52532 </para>
52533 <para>
52534 Two kinds of relaying exist, which are termed <quote>incoming</quote> and <quote>outgoing</quote>.
52535 A host which is acting as a gateway or an MX backup is concerned with incoming
52536 relaying from arbitrary hosts to a specific set of domains. On the other hand,
52537 a host which is acting as a smart host for a number of clients is concerned
52538 with outgoing relaying from those clients to the Internet at large. Often the
52539 same host is fulfilling both functions,
52540 but in principle these two kinds of relaying are entirely independent. What is
52541 not wanted is the transmission of mail from arbitrary remote hosts through your
52542 system to arbitrary domains.
52543 </para>
52544 <para>
52545 You can implement relay control by means of suitable statements in the ACL that
52546 runs for each RCPT command. For convenience, it is often easiest to use
52547 Exim&#x2019;s named list facility to define the domains and hosts involved. For
52548 example, suppose you want to do the following:
52549 </para>
52550 <itemizedlist>
52551 <listitem>
52552 <para>
52553 Deliver a number of domains to mailboxes on the local host (or process them
52554 locally in some other way). Let&#x2019;s say these are <emphasis>my.dom1.example</emphasis> and
52555 <emphasis>my.dom2.example</emphasis>.
52556 </para>
52557 </listitem>
52558 <listitem>
52559 <para>
52560 Relay mail for a number of other domains for which you are the secondary MX.
52561 These might be <emphasis>friend1.example</emphasis> and <emphasis>friend2.example</emphasis>.
52562 </para>
52563 </listitem>
52564 <listitem>
52565 <para>
52566 Relay mail from the hosts on your local LAN, to whatever domains are involved.
52567 Suppose your LAN is 192.168.45.0/24.
52568 </para>
52569 </listitem>
52570 </itemizedlist>
52571 <para>
52572 In the main part of the configuration, you put the following definitions:
52573 </para>
52574 <literallayout class="monospaced">
52575 domainlist local_domains = my.dom1.example : my.dom2.example
52576 domainlist relay_domains = friend1.example : friend2.example
52577 hostlist   relay_hosts   = 192.168.45.0/24
52578 </literallayout>
52579 <para>
52580 Now you can use these definitions in the ACL that is run for every RCPT
52581 command:
52582 </para>
52583 <literallayout class="monospaced">
52584 acl_check_rcpt:
52585   accept domains = +local_domains : +relay_domains
52586   accept hosts   = +relay_hosts
52587 </literallayout>
52588 <para>
52589 The first statement accepts any RCPT command that contains an address in
52590 the local or relay domains. For any other domain, control passes to the second
52591 statement, which accepts the command only if it comes from one of the relay
52592 hosts. In practice, you will probably want to make your ACL more sophisticated
52593 than this, for example, by including sender and recipient verification. The
52594 default configuration includes a more comprehensive example, which is described
52595 in chapter <xref linkend="CHAPdefconfil"/>.
52596 </para>
52597 </section>
52598 <section id="SECTcheralcon">
52599 <title>Checking a relay configuration</title>
52600 <para>
52601 <indexterm role="concept">
52602 <primary>relaying</primary>
52603 <secondary>checking control of</secondary>
52604 </indexterm>
52605 You can check the relay characteristics of your configuration in the same way
52606 that you can test any ACL behaviour for an incoming SMTP connection, by using
52607 the <option>-bh</option> option to run a fake SMTP session with which you interact.
52608 </para>
52609 <para>
52610 For specifically testing for unwanted relaying, the host
52611 <emphasis>relay-test.mail-abuse.org</emphasis> provides a useful service. If you telnet to this
52612 host from the host on which Exim is running, using the normal telnet port, you
52613 will see a normal telnet connection message and then quite a long delay. Be
52614 patient. The remote host is making an SMTP connection back to your host, and
52615 trying a number of common probes to test for open relay vulnerability. The
52616 results of the tests will eventually appear on your terminal.
52617 <indexterm role="concept" startref="IIDacl" class="endofrange"/>
52618 </para>
52619 </section>
52620 </chapter>
52621
52622 <chapter id="CHAPexiscan">
52623 <title>Content scanning at ACL time</title>
52624 <para>
52625 <indexterm role="concept" id="IIDcosca" class="startofrange">
52626 <primary>content scanning</primary>
52627 <secondary>at ACL time</secondary>
52628 </indexterm>
52629 The extension of Exim to include content scanning at ACL time, formerly known
52630 as <quote>exiscan</quote>, was originally implemented as a patch by Tom Kistner. The code
52631 was integrated into the main source for Exim release 4.50, and Tom continues to
52632 maintain it. Most of the wording of this chapter is taken from Tom&#x2019;s
52633 specification.
52634 </para>
52635 <para>
52636 It is also possible to scan the content of messages at other times. The
52637 <function>local_scan()</function> function (see chapter <xref linkend="CHAPlocalscan"/>) allows for content
52638 scanning after all the ACLs have run. A transport filter can be used to scan
52639 messages at delivery time (see the <option>transport_filter</option> option, described in
52640 chapter <xref linkend="CHAPtransportgeneric"/>).
52641 </para>
52642 <para>
52643 If you want to include the ACL-time content-scanning features when you compile
52644 Exim, you need to arrange for WITH_CONTENT_SCAN to be defined in your
52645 <filename>Local/Makefile</filename>. When you do that, the Exim binary is built with:
52646 </para>
52647 <itemizedlist>
52648 <listitem>
52649 <para>
52650 Two additional ACLs (<option>acl_smtp_mime</option> and <option>acl_not_smtp_mime</option>) that are run
52651 for all MIME parts for SMTP and non-SMTP messages, respectively.
52652 </para>
52653 </listitem>
52654 <listitem>
52655 <para>
52656 Additional ACL conditions and modifiers: <option>decode</option>, <option>malware</option>,
52657 <option>mime_regex</option>, <option>regex</option>, and <option>spam</option>. These can be used in the ACL that is
52658 run at the end of message reception (the <option>acl_smtp_data</option> ACL).
52659 </para>
52660 </listitem>
52661 <listitem>
52662 <para>
52663 An additional control feature (<quote>no_mbox_unspool</quote>) that saves spooled copies
52664 of messages, or parts of messages, for debugging purposes.
52665 </para>
52666 </listitem>
52667 <listitem>
52668 <para>
52669 Additional expansion variables that are set in the new ACL and by the new
52670 conditions.
52671 </para>
52672 </listitem>
52673 <listitem>
52674 <para>
52675 Two new main configuration options: <option>av_scanner</option> and <option>spamd_address</option>.
52676 </para>
52677 </listitem>
52678 </itemizedlist>
52679 <para>
52680 There is another content-scanning configuration option for <filename>Local/Makefile</filename>,
52681 called WITH_OLD_DEMIME. If this is set, the old, deprecated <option>demime</option> ACL
52682 condition is compiled, in addition to all the other content-scanning features.
52683 </para>
52684 <para>
52685 Content-scanning is continually evolving, and new features are still being
52686 added. While such features are still unstable and liable to incompatible
52687 changes, they are made available in Exim by setting options whose names begin
52688 EXPERIMENTAL_ in <filename>Local/Makefile</filename>. Such features are not documented in
52689 this manual. You can find out about them by reading the file called
52690 <filename>doc/experimental.txt</filename>.
52691 </para>
52692 <para>
52693 All the content-scanning facilities work on a MBOX copy of the message that is
52694 temporarily created in a file called:
52695 </para>
52696 <literallayout>
52697 &lt;<emphasis>spool_directory</emphasis>&gt;<literal>/scan/</literal>&lt;<emphasis>message_id</emphasis>&gt;/&lt;<emphasis>message_id</emphasis>&gt;<literal>.eml</literal>
52698 </literallayout>
52699 <para>
52700 The <filename>.eml</filename> extension is a friendly hint to virus scanners that they can
52701 expect an MBOX-like structure inside that file. The file is created when the
52702 first content scanning facility is called. Subsequent calls to content
52703 scanning conditions open the same file again. The directory is recursively
52704 removed when the <option>acl_smtp_data</option> ACL has finished running, unless
52705 </para>
52706 <literallayout class="monospaced">
52707 control = no_mbox_unspool
52708 </literallayout>
52709 <para>
52710 has been encountered. When the MIME ACL decodes files, they are put into the
52711 same directory by default.
52712 </para>
52713 <section id="SECTscanvirus">
52714 <title>Scanning for viruses</title>
52715 <para>
52716 <indexterm role="concept">
52717 <primary>virus scanning</primary>
52718 </indexterm>
52719 <indexterm role="concept">
52720 <primary>content scanning</primary>
52721 <secondary>for viruses</secondary>
52722 </indexterm>
52723 <indexterm role="concept">
52724 <primary>content scanning</primary>
52725 <secondary>the <option>malware</option> condition</secondary>
52726 </indexterm>
52727 The <option>malware</option> ACL condition lets you connect virus scanner software to Exim.
52728 It supports a <quote>generic</quote> interface to scanners called via the shell, and
52729 specialized interfaces for <quote>daemon</quote> type virus scanners, which are resident
52730 in memory and thus are much faster.
52731 </para>
52732 <para revisionflag="changed">
52733 <indexterm role="option">
52734 <primary><option>av_scanner</option></primary>
52735 </indexterm>
52736 You can set the <option>av_scanner</option> option in first part of the Exim configuration
52737 file to specify which scanner to use, together with any additional options that
52738 are needed. The basic syntax is as follows:
52739 </para>
52740 <literallayout revisionflag="changed">
52741 <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>
52742 </literallayout>
52743 <para revisionflag="changed">
52744 If you do not set <option>av_scanner</option>, it defaults to
52745 </para>
52746 <literallayout class="monospaced" revisionflag="changed">
52747 av_scanner = sophie:/var/run/sophie
52748 </literallayout>
52749 <para revisionflag="changed">
52750 If the value of <option>av_scanner</option> starts with a dollar character, it is expanded
52751 before use. The following scanner types are supported in this release:
52752 </para>
52753 <variablelist>
52754 <varlistentry>
52755 <term><option>aveserver</option></term>
52756 <listitem>
52757 <para>
52758 <indexterm role="concept">
52759 <primary>virus scanners</primary>
52760 <secondary>Kaspersky</secondary>
52761 </indexterm>
52762 This is the scanner daemon of Kaspersky Version 5. You can get a trial version
52763 at <emphasis role="bold"><ulink url="http://www.kaspersky.com">http://www.kaspersky.com</ulink></emphasis>. This scanner type takes one option,
52764 which is the path to the daemon&#x2019;s UNIX socket. The default is shown in this
52765 example:
52766 </para>
52767 <literallayout class="monospaced">
52768 av_scanner = aveserver:/var/run/aveserver
52769 </literallayout>
52770 </listitem></varlistentry>
52771 <varlistentry revisionflag="changed">
52772 <term><option>clamd</option></term>
52773 <listitem>
52774 <para revisionflag="changed">
52775 <indexterm role="concept">
52776 <primary>virus scanners</primary>
52777 <secondary>clamd</secondary>
52778 </indexterm>
52779 This daemon-type scanner is GPL and free. You can get it at
52780 <emphasis role="bold"><ulink url="http://www.clamav.net/">http://www.clamav.net/</ulink></emphasis>. Some older versions of clamd do not seem to
52781 unpack MIME containers, so it used to be recommended to unpack MIME attachments
52782 in the MIME ACL. This no longer believed to be necessary. One option is
52783 required: either the path and name of a UNIX socket file, or a hostname or IP
52784 number, and a port, separated by space, as in the second of these examples:
52785 </para>
52786 <literallayout class="monospaced" revisionflag="changed">
52787 av_scanner = clamd:/opt/clamd/socket
52788 av_scanner = clamd:192.0.2.3 1234
52789 av_scanner = clamd:192.0.2.3 1234:local
52790 </literallayout>
52791 <para revisionflag="changed">
52792 If the value of av_scanner points to a UNIX socket file or contains the local
52793 keyword, then the ClamAV interface will pass a filename containing the data
52794 to be scanned, which will should normally result in less I/O happening and be
52795 more efficient.  Normally in the TCP case, the data is streamed to ClamAV as
52796 Exim does not assume that there is a common filesystem with the remote host.
52797 There is an option WITH_OLD_CLAMAV_STREAM in <filename>src/EDITME</filename> available, should
52798 you be running a version of ClamAV prior to 0.95.
52799 If the option is unset, the default is <filename>/tmp/clamd</filename>. Thanks to David Saez for
52800 contributing the code for this scanner.
52801 </para>
52802 </listitem></varlistentry>
52803 <varlistentry>
52804 <term><option>cmdline</option></term>
52805 <listitem>
52806 <para>
52807 <indexterm role="concept">
52808 <primary>virus scanners</primary>
52809 <secondary>command line interface</secondary>
52810 </indexterm>
52811 This is the keyword for the generic command line scanner interface. It can be
52812 used to attach virus scanners that are invoked from the shell. This scanner
52813 type takes 3 mandatory options:
52814 </para>
52815 <orderedlist numeration="arabic">
52816 <listitem>
52817 <para>
52818 The full path and name of the scanner binary, with all command line options,
52819 and a placeholder (<literal>%s</literal>) for the directory to scan.
52820 </para>
52821 </listitem>
52822 <listitem>
52823 <para>
52824 A regular expression to match against the STDOUT and STDERR output of the
52825 virus scanner. If the expression matches, a virus was found. You must make
52826 absolutely sure that this expression matches on <quote>virus found</quote>. This is called
52827 the <quote>trigger</quote> expression.
52828 </para>
52829 </listitem>
52830 <listitem>
52831 <para>
52832 Another regular expression, containing exactly one pair of parentheses, to
52833 match the name of the virus found in the scanners output. This is called the
52834 <quote>name</quote> expression.
52835 </para>
52836 </listitem>
52837 </orderedlist>
52838 <para>
52839 For example, Sophos Sweep reports a virus on a line like this:
52840 </para>
52841 <literallayout class="monospaced">
52842 Virus 'W32/Magistr-B' found in file ./those.bat
52843 </literallayout>
52844 <para>
52845 For the trigger expression, we can match the phrase <quote>found in file</quote>. For the
52846 name expression, we want to extract the W32/Magistr-B string, so we can match
52847 for the single quotes left and right of it. Altogether, this makes the
52848 configuration setting:
52849 </para>
52850 <literallayout class="monospaced">
52851 av_scanner = cmdline:\
52852              /path/to/sweep -ss -all -rec -archive %s:\
52853              found in file:'(.+)'
52854 </literallayout>
52855 </listitem></varlistentry>
52856 <varlistentry>
52857 <term><option>drweb</option></term>
52858 <listitem>
52859 <para>
52860 <indexterm role="concept">
52861 <primary>virus scanners</primary>
52862 <secondary>DrWeb</secondary>
52863 </indexterm>
52864 The DrWeb daemon scanner (<emphasis role="bold"><ulink url="http://www.sald.com/">http://www.sald.com/</ulink></emphasis>) interface takes one
52865 argument, either a full path to a UNIX socket, or an IP address and port
52866 separated by white space, as in these examples:
52867 </para>
52868 <literallayout class="monospaced">
52869 av_scanner = drweb:/var/run/drwebd.sock
52870 av_scanner = drweb:192.168.2.20 31337
52871 </literallayout>
52872 <para>
52873 If you omit the argument, the default path <filename>/usr/local/drweb/run/drwebd.sock</filename>
52874 is used. Thanks to Alex Miller for contributing the code for this scanner.
52875 </para>
52876 </listitem></varlistentry>
52877 <varlistentry>
52878 <term><option>fsecure</option></term>
52879 <listitem>
52880 <para>
52881 <indexterm role="concept">
52882 <primary>virus scanners</primary>
52883 <secondary>F-Secure</secondary>
52884 </indexterm>
52885 The F-Secure daemon scanner (<emphasis role="bold"><ulink url="http://www.f-secure.com">http://www.f-secure.com</ulink></emphasis>) takes one
52886 argument which is the path to a UNIX socket. For example:
52887 </para>
52888 <literallayout class="monospaced">
52889 av_scanner = fsecure:/path/to/.fsav
52890 </literallayout>
52891 <para>
52892 If no argument is given, the default is <filename>/var/run/.fsav</filename>. Thanks to Johan
52893 Thelmen for contributing the code for this scanner.
52894 </para>
52895 </listitem></varlistentry>
52896 <varlistentry>
52897 <term><option>kavdaemon</option></term>
52898 <listitem>
52899 <para>
52900 <indexterm role="concept">
52901 <primary>virus scanners</primary>
52902 <secondary>Kaspersky</secondary>
52903 </indexterm>
52904 This is the scanner daemon of Kaspersky Version 4. This version of the
52905 Kaspersky scanner is outdated. Please upgrade (see <option>aveserver</option> above). This
52906 scanner type takes one option, which is the path to the daemon&#x2019;s UNIX socket.
52907 For example:
52908 </para>
52909 <literallayout class="monospaced">
52910 av_scanner = kavdaemon:/opt/AVP/AvpCtl
52911 </literallayout>
52912 <para>
52913 The default path is <filename>/var/run/AvpCtl</filename>.
52914 </para>
52915 </listitem></varlistentry>
52916 <varlistentry>
52917 <term><option>mksd</option></term>
52918 <listitem>
52919 <para>
52920 <indexterm role="concept">
52921 <primary>virus scanners</primary>
52922 <secondary>mksd</secondary>
52923 </indexterm>
52924 This is a daemon type scanner that is aimed mainly at Polish users, though some
52925 parts of documentation are now available in English. You can get it at
52926 <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
52927 the maximum number of processes used simultaneously to scan the attachments,
52928 provided that the demime facility is employed and also provided that mksd has
52929 been run with at least the same number of child processes. For example:
52930 </para>
52931 <literallayout class="monospaced">
52932 av_scanner = mksd:2
52933 </literallayout>
52934 <para>
52935 You can safely omit this option (the default value is 1).
52936 </para>
52937 </listitem></varlistentry>
52938 <varlistentry>
52939 <term><option>sophie</option></term>
52940 <listitem>
52941 <para>
52942 <indexterm role="concept">
52943 <primary>virus scanners</primary>
52944 <secondary>Sophos and Sophie</secondary>
52945 </indexterm>
52946 Sophie is a daemon that uses Sophos&#x2019; <option>libsavi</option> library to scan for viruses.
52947 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
52948 for this scanner type is the path to the UNIX socket that Sophie uses for
52949 client communication. For example:
52950 </para>
52951 <literallayout class="monospaced">
52952 av_scanner = sophie:/tmp/sophie
52953 </literallayout>
52954 <para>
52955 The default path is <filename>/var/run/sophie</filename>, so if you are using this, you can omit
52956 the option.
52957 </para>
52958 </listitem></varlistentry>
52959 </variablelist>
52960 <para>
52961 When <option>av_scanner</option> is correctly set, you can use the <option>malware</option> condition in
52962 the DATA ACL. <emphasis role="bold">Note</emphasis>: You cannot use the <option>malware</option> condition in the MIME
52963 ACL.
52964 </para>
52965 <para>
52966 The <option>av_scanner</option> option is expanded each time <option>malware</option> is called. This
52967 makes it possible to use different scanners. See further below for an example.
52968 The <option>malware</option> condition caches its results, so when you use it multiple times
52969 for the same message, the actual scanning process is only carried out once.
52970 However, using expandable items in <option>av_scanner</option> disables this caching, in
52971 which case each use of the <option>malware</option> condition causes a new scan of the
52972 message.
52973 </para>
52974 <para>
52975 The <option>malware</option> condition takes a right-hand argument that is expanded before
52976 use. It can then be one of
52977 </para>
52978 <itemizedlist>
52979 <listitem>
52980 <para>
52981 <quote>true</quote>, <quote>*</quote>, or <quote>1</quote>, in which case the message is scanned for viruses.
52982 The condition succeeds if a virus was found, and fail otherwise. This is the
52983 recommended usage.
52984 </para>
52985 </listitem>
52986 <listitem>
52987 <para>
52988 <quote>false</quote> or <quote>0</quote> or an empty string, in which case no scanning is done and
52989 the condition fails immediately.
52990 </para>
52991 </listitem>
52992 <listitem>
52993 <para>
52994 A regular expression, in which case the message is scanned for viruses. The
52995 condition succeeds if a virus is found and its name matches the regular
52996 expression. This allows you to take special actions on certain types of virus.
52997 </para>
52998 </listitem>
52999 </itemizedlist>
53000 <para>
53001 You can append <literal>/defer_ok</literal> to the <option>malware</option> condition to accept messages
53002 even if there is a problem with the virus scanner. Otherwise, such a problem
53003 causes the ACL to defer.
53004 </para>
53005 <para>
53006 <indexterm role="variable">
53007 <primary><varname>$malware_name</varname></primary>
53008 </indexterm>
53009 When a virus is found, the condition sets up an expansion variable called
53010 <varname>$malware_name</varname> that contains the name of the virus. You can use it in a
53011 <option>message</option> modifier that specifies the error returned to the sender, and/or in
53012 logging data.
53013 </para>
53014 <para>
53015 If your virus scanner cannot unpack MIME and TNEF containers itself, you should
53016 use the <option>demime</option> condition (see section <xref linkend="SECTdemimecond"/>) before the
53017 <option>malware</option> condition.
53018 </para>
53019 <para revisionflag="changed">
53020 Beware the interaction of Exim&#x2019;s <option>message_size_limit</option> with any size limits
53021 imposed by your anti-virus scanner.
53022 </para>
53023 <para>
53024 Here is a very simple scanning example:
53025 </para>
53026 <literallayout class="monospaced">
53027 deny message = This message contains malware ($malware_name)
53028      demime = *
53029      malware = *
53030 </literallayout>
53031 <para>
53032 The next example accepts messages when there is a problem with the scanner:
53033 </para>
53034 <literallayout class="monospaced">
53035 deny message = This message contains malware ($malware_name)
53036      demime = *
53037      malware = */defer_ok
53038 </literallayout>
53039 <para>
53040 The next example shows how to use an ACL variable to scan with both sophie and
53041 aveserver. It assumes you have set:
53042 </para>
53043 <literallayout class="monospaced">
53044 av_scanner = $acl_m0
53045 </literallayout>
53046 <para>
53047 in the main Exim configuration.
53048 </para>
53049 <literallayout class="monospaced">
53050 deny message = This message contains malware ($malware_name)
53051      set acl_m0 = sophie
53052      malware = *
53053
53054 deny message = This message contains malware ($malware_name)
53055      set acl_m0 = aveserver
53056      malware = *
53057 </literallayout>
53058 </section>
53059 <section id="SECTscanspamass">
53060 <title>Scanning with SpamAssassin</title>
53061 <para>
53062 <indexterm role="concept">
53063 <primary>content scanning</primary>
53064 <secondary>for spam</secondary>
53065 </indexterm>
53066 <indexterm role="concept">
53067 <primary>spam scanning</primary>
53068 </indexterm>
53069 <indexterm role="concept">
53070 <primary>SpamAssassin</primary>
53071 </indexterm>
53072 The <option>spam</option> ACL condition calls SpamAssassin&#x2019;s <option>spamd</option> daemon to get a spam
53073 score and a report for the message. You can get SpamAssassin at
53074 <emphasis role="bold"><ulink url="http://www.spamassassin.org">http://www.spamassassin.org</ulink></emphasis>, or, if you have a working Perl
53075 installation, you can use CPAN by running:
53076 </para>
53077 <literallayout class="monospaced">
53078 perl -MCPAN -e 'install Mail::SpamAssassin'
53079 </literallayout>
53080 <para>
53081 SpamAssassin has its own set of configuration files. Please review its
53082 documentation to see how you can tweak it. The default installation should work
53083 nicely, however.
53084 </para>
53085 <para>
53086 <indexterm role="option">
53087 <primary><option>spamd_address</option></primary>
53088 </indexterm>
53089 After having installed and configured SpamAssassin, start the <option>spamd</option> daemon.
53090 By default, it listens on 127.0.0.1, TCP port 783. If you use another host or
53091 port for <option>spamd</option>, you must set the <option>spamd_address</option> option in the global
53092 part of the Exim configuration as follows (example):
53093 </para>
53094 <literallayout class="monospaced">
53095 spamd_address = 192.168.99.45 387
53096 </literallayout>
53097 <para>
53098 You do not need to set this option if you use the default. As of version 2.60,
53099 <option>spamd</option> also supports communication over UNIX sockets. If you want to use
53100 these, supply <option>spamd_address</option> with an absolute file name instead of a
53101 address/port pair:
53102 </para>
53103 <literallayout class="monospaced">
53104 spamd_address = /var/run/spamd_socket
53105 </literallayout>
53106 <para>
53107 You can have multiple <option>spamd</option> servers to improve scalability. These can
53108 reside on other hardware reachable over the network. To specify multiple
53109 <option>spamd</option> servers, put multiple address/port pairs in the <option>spamd_address</option>
53110 option, separated with colons:
53111 </para>
53112 <literallayout class="monospaced">
53113 spamd_address = 192.168.2.10 783 : \
53114                 192.168.2.11 783 : \
53115                 192.168.2.12 783
53116 </literallayout>
53117 <para>
53118 Up to 32 <option>spamd</option> servers are supported. The servers are queried in a random
53119 fashion. When a server fails to respond to the connection attempt, all other
53120 servers are tried until one succeeds. If no server responds, the <option>spam</option>
53121 condition defers.
53122 </para>
53123 <para>
53124 <emphasis role="bold">Warning</emphasis>: It is not possible to use the UNIX socket connection method with
53125 multiple <option>spamd</option> servers.
53126 </para>
53127 <para>
53128 The <option>spamd_address</option> variable is expanded before use if it starts with
53129 a dollar sign. In this case, the expansion may return a string that is
53130 used as the list so that multiple spamd servers can be the result of an
53131 expansion.
53132 </para>
53133 </section>
53134 <section id="SECID206">
53135 <title>Calling SpamAssassin from an Exim ACL</title>
53136 <para>
53137 Here is a simple example of the use of the <option>spam</option> condition in a DATA ACL:
53138 </para>
53139 <literallayout class="monospaced">
53140 deny message = This message was classified as SPAM
53141      spam = joe
53142 </literallayout>
53143 <para>
53144 The right-hand side of the <option>spam</option> condition specifies a name. This is
53145 relevant if you have set up multiple SpamAssassin profiles. If you do not want
53146 to scan using a specific profile, but rather use the SpamAssassin system-wide
53147 default profile, you can scan for an unknown name, or simply use <quote>nobody</quote>.
53148 However, you must put something on the right-hand side.
53149 </para>
53150 <para>
53151 The name allows you to use per-domain or per-user antispam profiles in
53152 principle, but this is not straightforward in practice, because a message may
53153 have multiple recipients, not necessarily all in the same domain. Because the
53154 <option>spam</option> condition has to be called from a DATA ACL in order to be able to
53155 read the contents of the message, the variables <varname>$local_part</varname> and <varname>$domain</varname>
53156 are not set.
53157 </para>
53158 <para>
53159 The right-hand side of the <option>spam</option> condition is expanded before being used, so
53160 you can put lookups or conditions there. When the right-hand side evaluates to
53161 <quote>0</quote> or <quote>false</quote>, no scanning is done and the condition fails immediately.
53162 </para>
53163 <para>
53164 Scanning with SpamAssassin uses a lot of resources. If you scan every message,
53165 large ones may cause significant performance degradation. As most spam messages
53166 are quite small, it is recommended that you do not scan the big ones. For
53167 example:
53168 </para>
53169 <literallayout class="monospaced">
53170 deny message = This message was classified as SPAM
53171      condition = ${if &lt; {$message_size}{10K}}
53172      spam = nobody
53173 </literallayout>
53174 <para>
53175 The <option>spam</option> condition returns true if the threshold specified in the user&#x2019;s
53176 SpamAssassin profile has been matched or exceeded. If you want to use the
53177 <option>spam</option> condition for its side effects (see the variables below), you can make
53178 it always return <quote>true</quote> by appending <literal>:true</literal> to the username.
53179 </para>
53180 <para revisionflag="changed">
53181 <indexterm role="concept">
53182 <primary>spam scanning</primary>
53183 <secondary>returned variables</secondary>
53184 </indexterm>
53185 When the <option>spam</option> condition is run, it sets up a number of expansion
53186 variables. These variables are saved with the received message, thus they are
53187 available for use at delivery time.
53188 </para>
53189 <variablelist>
53190 <varlistentry>
53191 <term><varname>$spam_score</varname></term>
53192 <listitem>
53193 <para>
53194 The spam score of the message, for example <quote>3.4</quote> or <quote>30.5</quote>. This is useful
53195 for inclusion in log or reject messages.
53196 </para>
53197 </listitem></varlistentry>
53198 <varlistentry revisionflag="changed">
53199 <term><varname>$spam_score_int</varname></term>
53200 <listitem>
53201 <para revisionflag="changed">
53202 The spam score of the message, multiplied by ten, as an integer value. For
53203 example <quote>34</quote> or <quote>305</quote>. It may appear to disagree with <varname>$spam_score</varname>
53204 because <varname>$spam_score</varname> is rounded and <varname>$spam_score_int</varname> is truncated.
53205 The integer value is useful for numeric comparisons in conditions.
53206 </para>
53207 </listitem></varlistentry>
53208 <varlistentry>
53209 <term><varname>$spam_bar</varname></term>
53210 <listitem>
53211 <para>
53212 A string consisting of a number of <quote>+</quote> or <quote>-</quote> characters, representing the
53213 integer part of the spam score value. A spam score of 4.4 would have a
53214 <varname>$spam_bar</varname> value of <quote>++++</quote>. This is useful for inclusion in warning
53215 headers, since MUAs can match on such strings.
53216 </para>
53217 </listitem></varlistentry>
53218 <varlistentry>
53219 <term><varname>$spam_report</varname></term>
53220 <listitem>
53221 <para>
53222 A multiline text table, containing the full SpamAssassin report for the
53223 message. Useful for inclusion in headers or reject messages.
53224 </para>
53225 </listitem></varlistentry>
53226 </variablelist>
53227 <para>
53228 The <option>spam</option> condition caches its results unless expansion in
53229 spamd_address was used. If you call it again with the same user name, it
53230 does not scan again, but rather returns the same values as before.
53231 </para>
53232 <para>
53233 The <option>spam</option> condition returns DEFER if there is any error while running
53234 the message through SpamAssassin or if the expansion of spamd_address
53235 failed. If you want to treat DEFER as FAIL (to pass on to the next ACL
53236 statement block), append <literal>/defer_ok</literal> to the right-hand side of the
53237 spam condition, like this:
53238 </para>
53239 <literallayout class="monospaced">
53240 deny message = This message was classified as SPAM
53241      spam    = joe/defer_ok
53242 </literallayout>
53243 <para>
53244 This causes messages to be accepted even if there is a problem with <option>spamd</option>.
53245 </para>
53246 <para>
53247 Here is a longer, commented example of the use of the <option>spam</option>
53248 condition:
53249 </para>
53250 <literallayout class="monospaced">
53251 # put headers in all messages (no matter if spam or not)
53252 warn  spam = nobody:true
53253       add_header = X-Spam-Score: $spam_score ($spam_bar)
53254       add_header = X-Spam-Report: $spam_report
53255
53256 # add second subject line with *SPAM* marker when message
53257 # is over threshold
53258 warn  spam = nobody
53259       add_header = Subject: *SPAM* $h_Subject:
53260
53261 # reject spam at high scores (&gt; 12)
53262 deny  message = This message scored $spam_score spam points.
53263       spam = nobody:true
53264       condition = ${if &gt;{$spam_score_int}{120}{1}{0}}
53265 </literallayout>
53266 </section>
53267 <section id="SECTscanmimepart">
53268 <title>Scanning MIME parts</title>
53269 <para>
53270 <indexterm role="concept">
53271 <primary>content scanning</primary>
53272 <secondary>MIME parts</secondary>
53273 </indexterm>
53274 <indexterm role="concept">
53275 <primary>MIME content scanning</primary>
53276 </indexterm>
53277 <indexterm role="option">
53278 <primary><option>acl_smtp_mime</option></primary>
53279 </indexterm>
53280 <indexterm role="option">
53281 <primary><option>acl_not_smtp_mime</option></primary>
53282 </indexterm>
53283 The <option>acl_smtp_mime</option> global option specifies an ACL that is called once for
53284 each MIME part of an SMTP message, including multipart types, in the sequence
53285 of their position in the message. Similarly, the <option>acl_not_smtp_mime</option> option
53286 specifies an ACL that is used for the MIME parts of non-SMTP messages. These
53287 options may both refer to the same ACL if you want the same processing in both
53288 cases.
53289 </para>
53290 <para>
53291 These ACLs are called (possibly many times) just before the <option>acl_smtp_data</option>
53292 ACL in the case of an SMTP message, or just before the <option>acl_not_smtp</option> ACL in
53293 the case of a non-SMTP message. However, a MIME ACL is called only if the
53294 message contains a <emphasis>Content-Type:</emphasis> header line. When a call to a MIME
53295 ACL does not yield <quote>accept</quote>, ACL processing is aborted and the appropriate
53296 result code is sent to the client. In the case of an SMTP message, the
53297 <option>acl_smtp_data</option> ACL is not called when this happens.
53298 </para>
53299 <para>
53300 You cannot use the <option>malware</option> or <option>spam</option> conditions in a MIME ACL; these can
53301 only be used in the DATA or non-SMTP ACLs. However, you can use the <option>regex</option>
53302 condition to match against the raw MIME part. You can also use the
53303 <option>mime_regex</option> condition to match against the decoded MIME part (see section
53304 <xref linkend="SECTscanregex"/>).
53305 </para>
53306 <para>
53307 At the start of a MIME ACL, a number of variables are set from the header
53308 information for the relevant MIME part. These are described below. The contents
53309 of the MIME part are not by default decoded into a disk file except for MIME
53310 parts whose content-type is <quote>message/rfc822</quote>. If you want to decode a MIME
53311 part into a disk file, you can use the <option>decode</option> condition. The general
53312 syntax is:
53313 </para>
53314 <literallayout>
53315 <literal>decode = [/</literal>&lt;<emphasis>path</emphasis>&gt;<literal>/]</literal>&lt;<emphasis>filename</emphasis>&gt;
53316 </literallayout>
53317 <para>
53318 The right hand side is expanded before use. After expansion,
53319 the value can be:
53320 </para>
53321 <orderedlist numeration="arabic">
53322 <listitem>
53323 <para>
53324 <quote>0</quote> or <quote>false</quote>, in which case no decoding is done.
53325 </para>
53326 </listitem>
53327 <listitem>
53328 <para>
53329 The string <quote>default</quote>. In that case, the file is put in the temporary
53330 <quote>default</quote> directory &lt;<emphasis>spool_directory</emphasis>&gt;<filename>/scan/</filename>&lt;<emphasis>message_id</emphasis>&gt;<filename>/</filename> with
53331 a sequential file name consisting of the message id and a sequence number. The
53332 full path and name is available in <varname>$mime_decoded_filename</varname> after decoding.
53333 </para>
53334 </listitem>
53335 <listitem>
53336 <para>
53337 A full path name starting with a slash. If the full name is an existing
53338 directory, it is used as a replacement for the default directory. The filename
53339 is then sequentially assigned. If the path does not exist, it is used as
53340 the full path and file name.
53341 </para>
53342 </listitem>
53343 <listitem>
53344 <para>
53345 If the string does not start with a slash, it is used as the
53346 filename, and the default path is then used.
53347 </para>
53348 </listitem>
53349 </orderedlist>
53350 <para>
53351 The <option>decode</option> condition normally succeeds. It is only false for syntax
53352 errors or unusual circumstances such as memory shortages. You can easily decode
53353 a file with its original, proposed filename using
53354 </para>
53355 <literallayout class="monospaced">
53356 decode = $mime_filename
53357 </literallayout>
53358 <para>
53359 However, you should keep in mind that <varname>$mime_filename</varname> might contain
53360 anything. If you place files outside of the default path, they are not
53361 automatically unlinked.
53362 </para>
53363 <para>
53364 For RFC822 attachments (these are messages attached to messages, with a
53365 content-type of <quote>message/rfc822</quote>), the ACL is called again in the same manner
53366 as for the primary message, only that the <varname>$mime_is_rfc822</varname> expansion
53367 variable is set (see below). Attached messages are always decoded to disk
53368 before being checked, and the files are unlinked once the check is done.
53369 </para>
53370 <para>
53371 The MIME ACL supports the <option>regex</option> and <option>mime_regex</option> conditions. These can be
53372 used to match regular expressions against raw and decoded MIME parts,
53373 respectively. They are described in section <xref linkend="SECTscanregex"/>.
53374 </para>
53375 <para>
53376 <indexterm role="concept">
53377 <primary>MIME content scanning</primary>
53378 <secondary>returned variables</secondary>
53379 </indexterm>
53380 The following list describes all expansion variables that are
53381 available in the MIME ACL:
53382 </para>
53383 <variablelist>
53384 <varlistentry>
53385 <term><varname>$mime_boundary</varname></term>
53386 <listitem>
53387 <para>
53388 If the current part is a multipart (see <varname>$mime_is_multipart</varname>) below, it should
53389 have a boundary string, which is stored in this variable. If the current part
53390 has no boundary parameter in the <emphasis>Content-Type:</emphasis> header, this variable
53391 contains the empty string.
53392 </para>
53393 </listitem></varlistentry>
53394 <varlistentry>
53395 <term><varname>$mime_charset</varname></term>
53396 <listitem>
53397 <para>
53398 This variable contains the character set identifier, if one was found in the
53399 <emphasis>Content-Type:</emphasis> header. Examples for charset identifiers are:
53400 </para>
53401 <literallayout class="monospaced">
53402 us-ascii
53403 gb2312 (Chinese)
53404 iso-8859-1
53405 </literallayout>
53406 <para>
53407 Please note that this value is not normalized, so you should do matches
53408 case-insensitively.
53409 </para>
53410 </listitem></varlistentry>
53411 <varlistentry>
53412 <term><varname>$mime_content_description</varname></term>
53413 <listitem>
53414 <para>
53415 This variable contains the normalized content of the <emphasis>Content-Description:</emphasis>
53416 header. It can contain a human-readable description of the parts content. Some
53417 implementations repeat the filename for attachments here, but they are usually
53418 only used for display purposes.
53419 </para>
53420 </listitem></varlistentry>
53421 <varlistentry>
53422 <term><varname>$mime_content_disposition</varname></term>
53423 <listitem>
53424 <para>
53425 This variable contains the normalized content of the <emphasis>Content-Disposition:</emphasis>
53426 header. You can expect strings like <quote>attachment</quote> or <quote>inline</quote> here.
53427 </para>
53428 </listitem></varlistentry>
53429 <varlistentry>
53430 <term><varname>$mime_content_id</varname></term>
53431 <listitem>
53432 <para>
53433 This variable contains the normalized content of the <emphasis>Content-ID:</emphasis> header.
53434 This is a unique ID that can be used to reference a part from another part.
53435 </para>
53436 </listitem></varlistentry>
53437 <varlistentry>
53438 <term><varname>$mime_content_size</varname></term>
53439 <listitem>
53440 <para>
53441 This variable is set only after the <option>decode</option> modifier (see above) has been
53442 successfully run. It contains the size of the decoded part in kilobytes. The
53443 size is always rounded up to full kilobytes, so only a completely empty part
53444 has a <varname>$mime_content_size</varname> of zero.
53445 </para>
53446 </listitem></varlistentry>
53447 <varlistentry>
53448 <term><varname>$mime_content_transfer_encoding</varname></term>
53449 <listitem>
53450 <para>
53451 This variable contains the normalized content of the
53452 <emphasis>Content-transfer-encoding:</emphasis> header. This is a symbolic name for an encoding
53453 type. Typical values are <quote>base64</quote> and <quote>quoted-printable</quote>.
53454 </para>
53455 </listitem></varlistentry>
53456 <varlistentry>
53457 <term><varname>$mime_content_type</varname></term>
53458 <listitem>
53459 <para>
53460 If the MIME part has a <emphasis>Content-Type:</emphasis> header, this variable contains its
53461 value, lowercased, and without any options (like <quote>name</quote> or <quote>charset</quote>). Here
53462 are some examples of popular MIME types, as they may appear in this variable:
53463 </para>
53464 <literallayout class="monospaced">
53465 text/plain
53466 text/html
53467 application/octet-stream
53468 image/jpeg
53469 audio/midi
53470 </literallayout>
53471 <para>
53472 If the MIME part has no <emphasis>Content-Type:</emphasis> header, this variable contains the
53473 empty string.
53474 </para>
53475 </listitem></varlistentry>
53476 <varlistentry>
53477 <term><varname>$mime_decoded_filename</varname></term>
53478 <listitem>
53479 <para>
53480 This variable is set only after the <option>decode</option> modifier (see above) has been
53481 successfully run. It contains the full path and file name of the file
53482 containing the decoded data.
53483 </para>
53484 </listitem></varlistentry>
53485 </variablelist>
53486 <para>
53487 <indexterm role="concept">
53488 <primary>RFC 2047</primary>
53489 </indexterm>
53490 </para>
53491 <variablelist>
53492 <varlistentry>
53493 <term><varname>$mime_filename</varname></term>
53494 <listitem>
53495 <para>
53496 This is perhaps the most important of the MIME variables. It contains a
53497 proposed filename for an attachment, if one was found in either the
53498 <emphasis>Content-Type:</emphasis> or <emphasis>Content-Disposition:</emphasis> headers. The filename will be
53499 RFC2047 decoded, but no additional sanity checks are done. If no filename was
53500 found, this variable contains the empty string.
53501 </para>
53502 </listitem></varlistentry>
53503 <varlistentry>
53504 <term><varname>$mime_is_coverletter</varname></term>
53505 <listitem>
53506 <para>
53507 This variable attempts to differentiate the <quote>cover letter</quote> of an e-mail from
53508 attached data. It can be used to clamp down on flashy or unnecessarily encoded
53509 content in the cover letter, while not restricting attachments at all.
53510 </para>
53511 <para>
53512 The variable contains 1 (true) for a MIME part believed to be part of the
53513 cover letter, and 0 (false) for an attachment. At present, the algorithm is as
53514 follows:
53515 </para>
53516 <orderedlist numeration="arabic">
53517 <listitem>
53518 <para>
53519 The outermost MIME part of a message is always a cover letter.
53520 </para>
53521 </listitem>
53522 <listitem>
53523 <para>
53524 If a multipart/alternative or multipart/related MIME part is a cover letter,
53525 so are all MIME subparts within that multipart.
53526 </para>
53527 </listitem>
53528 <listitem>
53529 <para>
53530 If any other multipart is a cover letter, the first subpart is a cover letter,
53531 and the rest are attachments.
53532 </para>
53533 </listitem>
53534 <listitem>
53535 <para>
53536 All parts contained within an attachment multipart are attachments.
53537 </para>
53538 </listitem>
53539 </orderedlist>
53540 <para>
53541 As an example, the following will ban <quote>HTML mail</quote> (including that sent with
53542 alternative plain text), while allowing HTML files to be attached. HTML
53543 coverletter mail attached to non-HMTL coverletter mail will also be allowed:
53544 </para>
53545 <literallayout class="monospaced">
53546 deny message = HTML mail is not accepted here
53547 !condition = $mime_is_rfc822
53548 condition = $mime_is_coverletter
53549 condition = ${if eq{$mime_content_type}{text/html}{1}{0}}
53550 </literallayout>
53551 </listitem></varlistentry>
53552 <varlistentry>
53553 <term><varname>$mime_is_multipart</varname></term>
53554 <listitem>
53555 <para>
53556 This variable has the value 1 (true) when the current part has the main type
53557 <quote>multipart</quote>, for example <quote>multipart/alternative</quote> or <quote>multipart/mixed</quote>.
53558 Since multipart entities only serve as containers for other parts, you may not
53559 want to carry out specific actions on them.
53560 </para>
53561 </listitem></varlistentry>
53562 <varlistentry>
53563 <term><varname>$mime_is_rfc822</varname></term>
53564 <listitem>
53565 <para>
53566 This variable has the value 1 (true) if the current part is not a part of the
53567 checked message itself, but part of an attached message. Attached message
53568 decoding is fully recursive.
53569 </para>
53570 </listitem></varlistentry>
53571 <varlistentry>
53572 <term><varname>$mime_part_count</varname></term>
53573 <listitem>
53574 <para>
53575 This variable is a counter that is raised for each processed MIME part. It
53576 starts at zero for the very first part (which is usually a multipart). The
53577 counter is per-message, so it is reset when processing RFC822 attachments (see
53578 <varname>$mime_is_rfc822</varname>). The counter stays set after <option>acl_smtp_mime</option> is
53579 complete, so you can use it in the DATA ACL to determine the number of MIME
53580 parts of a message. For non-MIME messages, this variable contains the value -1.
53581 </para>
53582 </listitem></varlistentry>
53583 </variablelist>
53584 </section>
53585 <section id="SECTscanregex">
53586 <title>Scanning with regular expressions</title>
53587 <para>
53588 <indexterm role="concept">
53589 <primary>content scanning</primary>
53590 <secondary>with regular expressions</secondary>
53591 </indexterm>
53592 <indexterm role="concept">
53593 <primary>regular expressions</primary>
53594 <secondary>content scanning with</secondary>
53595 </indexterm>
53596 You can specify your own custom regular expression matches on the full body of
53597 the message, or on individual MIME parts.
53598 </para>
53599 <para>
53600 The <option>regex</option> condition takes one or more regular expressions as arguments and
53601 matches them against the full message (when called in the DATA ACL) or a raw
53602 MIME part (when called in the MIME ACL). The <option>regex</option> condition matches
53603 linewise, with a maximum line length of 32K characters. That means you cannot
53604 have multiline matches with the <option>regex</option> condition.
53605 </para>
53606 <para>
53607 The <option>mime_regex</option> condition can be called only in the MIME ACL. It matches up
53608 to 32K of decoded content (the whole content at once, not linewise). If the
53609 part has not been decoded with the <option>decode</option> modifier earlier in the ACL, it
53610 is decoded automatically when <option>mime_regex</option> is executed (using default path
53611 and filename values). If the decoded data is larger than  32K, only the first
53612 32K characters are checked.
53613 </para>
53614 <para>
53615 The regular expressions are passed as a colon-separated list. To include a
53616 literal colon, you must double it. Since the whole right-hand side string is
53617 expanded before being used, you must also escape dollar signs and backslashes
53618 with more backslashes, or use the <literal>\N</literal> facility to disable expansion.
53619 Here is a simple example that contains two regular expressions:
53620 </para>
53621 <literallayout class="monospaced">
53622 deny message = contains blacklisted regex ($regex_match_string)
53623      regex = [Mm]ortgage : URGENT BUSINESS PROPOSAL
53624 </literallayout>
53625 <para>
53626 The conditions returns true if any one of the regular expressions matches. The
53627 <varname>$regex_match_string</varname> expansion variable is then set up and contains the
53628 matching regular expression.
53629 </para>
53630 <para>
53631 <emphasis role="bold">Warning</emphasis>: With large messages, these conditions can be fairly
53632 CPU-intensive.
53633 </para>
53634 </section>
53635 <section id="SECTdemimecond">
53636 <title>The demime condition</title>
53637 <para>
53638 <indexterm role="concept">
53639 <primary>content scanning</primary>
53640 <secondary>MIME checking</secondary>
53641 </indexterm>
53642 <indexterm role="concept">
53643 <primary>MIME content scanning</primary>
53644 </indexterm>
53645 The <option>demime</option> ACL condition provides MIME unpacking, sanity checking and file
53646 extension blocking. It is usable only in the DATA and non-SMTP ACLs. The
53647 <option>demime</option> condition uses a simpler interface to MIME decoding than the MIME
53648 ACL functionality, but provides no additional facilities. Please note that this
53649 condition is deprecated and kept only for backward compatibility. You must set
53650 the WITH_OLD_DEMIME option in <filename>Local/Makefile</filename> at build time to be able to
53651 use the <option>demime</option> condition.
53652 </para>
53653 <para>
53654 The <option>demime</option> condition unpacks MIME containers in the message. It detects
53655 errors in MIME containers and can match file extensions found in the message
53656 against a list. Using this facility produces files containing the unpacked MIME
53657 parts of the message in the temporary scan directory. If you do antivirus
53658 scanning, it is recommended that you use the <option>demime</option> condition before the
53659 antivirus (<option>malware</option>) condition.
53660 </para>
53661 <para>
53662 On the right-hand side of the <option>demime</option> condition you can pass a
53663 colon-separated list of file extensions that it should match against. For
53664 example:
53665 </para>
53666 <literallayout class="monospaced">
53667 deny message = Found blacklisted file attachment
53668      demime  = vbs:com:bat:pif:prf:lnk
53669 </literallayout>
53670 <para>
53671 If one of the file extensions is found, the condition is true, otherwise it is
53672 false. If there is a temporary error while demimeing (for example, <quote>disk
53673 full</quote>), the condition defers, and the message is temporarily rejected (unless
53674 the condition is on a <option>warn</option> verb).
53675 </para>
53676 <para>
53677 The right-hand side is expanded before being treated as a list, so you can have
53678 conditions and lookups there. If it expands to an empty string, <quote>false</quote>, or
53679 zero (<quote>0</quote>), no demimeing is done and the condition is false.
53680 </para>
53681 <para>
53682 The <option>demime</option> condition set the following variables:
53683 </para>
53684 <variablelist>
53685 <varlistentry>
53686 <term><varname>$demime_errorlevel</varname></term>
53687 <listitem>
53688 <para>
53689 <indexterm role="variable">
53690 <primary><varname>$demime_errorlevel</varname></primary>
53691 </indexterm>
53692 When an error is detected in a MIME container, this variable contains the
53693 severity of the error, as an integer number. The higher the value, the more
53694 severe the error (the current maximum value is 3). If this variable is unset or
53695 zero, no error occurred.
53696 </para>
53697 </listitem></varlistentry>
53698 <varlistentry>
53699 <term><varname>$demime_reason</varname></term>
53700 <listitem>
53701 <para>
53702 <indexterm role="variable">
53703 <primary><varname>$demime_reason</varname></primary>
53704 </indexterm>
53705 When <varname>$demime_errorlevel</varname> is greater than zero, this variable contains a
53706 human-readable text string describing the MIME error that occurred.
53707 </para>
53708 </listitem></varlistentry>
53709 </variablelist>
53710 <variablelist>
53711 <varlistentry>
53712 <term><varname>$found_extension</varname></term>
53713 <listitem>
53714 <para>
53715 <indexterm role="variable">
53716 <primary><varname>$found_extension</varname></primary>
53717 </indexterm>
53718 When the <option>demime</option> condition is true, this variable contains the file
53719 extension it found.
53720 </para>
53721 </listitem></varlistentry>
53722 </variablelist>
53723 <para>
53724 Both <varname>$demime_errorlevel</varname> and <varname>$demime_reason</varname> are set by the first call of
53725 the <option>demime</option> condition, and are not changed on subsequent calls.
53726 </para>
53727 <para>
53728 If you do not want to check for file extensions, but rather use the <option>demime</option>
53729 condition for unpacking or error checking purposes, pass <quote>*</quote> as the
53730 right-hand side value. Here is a more elaborate example of how to use this
53731 facility:
53732 </para>
53733 <literallayout class="monospaced">
53734 # Reject messages with serious MIME container errors
53735 deny  message = Found MIME error ($demime_reason).
53736       demime = *
53737       condition = ${if &gt;{$demime_errorlevel}{2}{1}{0}}
53738
53739 # Reject known virus spreading file extensions.
53740 # Accepting these is pretty much braindead.
53741 deny  message = contains $found_extension file (blacklisted).
53742       demime  = com:vbs:bat:pif:scr
53743
53744 # Freeze .exe and .doc files. Postmaster can
53745 # examine them and eventually thaw them.
53746 deny  log_message = Another $found_extension file.
53747       demime = exe:doc
53748       control = freeze
53749 </literallayout>
53750 <para>
53751 <indexterm role="concept" startref="IIDcosca" class="endofrange"/>
53752 </para>
53753 </section>
53754 </chapter>
53755
53756 <chapter id="CHAPlocalscan">
53757 <title>Adding a local scan function to Exim</title>
53758 <titleabbrev>Local scan function</titleabbrev>
53759 <para>
53760 <indexterm role="concept" id="IIDlosca" class="startofrange">
53761 <primary><function>local_scan()</function> function</primary>
53762 <secondary>description of</secondary>
53763 </indexterm>
53764 <indexterm role="concept">
53765 <primary>customizing</primary>
53766 <secondary>input scan using C function</secondary>
53767 </indexterm>
53768 <indexterm role="concept">
53769 <primary>policy control</primary>
53770 <secondary>by local scan function</secondary>
53771 </indexterm>
53772 In these days of email worms, viruses, and ever-increasing spam, some sites
53773 want to apply a lot of checking to messages before accepting them.
53774 </para>
53775 <para>
53776 The content scanning extension (chapter <xref linkend="CHAPexiscan"/>) has facilities for
53777 passing messages to external virus and spam scanning software. You can also do
53778 a certain amount in Exim itself through string expansions and the <option>condition</option>
53779 condition in the ACL that runs after the SMTP DATA command or the ACL for
53780 non-SMTP messages (see chapter <xref linkend="CHAPACL"/>), but this has its limitations.
53781 </para>
53782 <para>
53783 To allow for further customization to a site&#x2019;s own requirements, there is the
53784 possibility of linking Exim with a private message scanning function, written
53785 in C. If you want to run code that is written in something other than C, you
53786 can of course use a little C stub to call it.
53787 </para>
53788 <para>
53789 The local scan function is run once for every incoming message, at the point
53790 when Exim is just about to accept the message.
53791 It can therefore be used to control non-SMTP messages from local processes as
53792 well as messages arriving via SMTP.
53793 </para>
53794 <para>
53795 Exim applies a timeout to calls of the local scan function, and there is an
53796 option called <option>local_scan_timeout</option> for setting it. The default is 5 minutes.
53797 Zero means <quote>no timeout</quote>.
53798 Exim also sets up signal handlers for SIGSEGV, SIGILL, SIGFPE, and SIGBUS
53799 before calling the local scan function, so that the most common types of crash
53800 are caught. If the timeout is exceeded or one of those signals is caught, the
53801 incoming message is rejected with a temporary error if it is an SMTP message.
53802 For a non-SMTP message, the message is dropped and Exim ends with a non-zero
53803 code. The incident is logged on the main and reject logs.
53804 </para>
53805 <section id="SECID207">
53806 <title>Building Exim to use a local scan function</title>
53807 <para>
53808 <indexterm role="concept">
53809 <primary><function>local_scan()</function> function</primary>
53810 <secondary>building Exim to use</secondary>
53811 </indexterm>
53812 To make use of the local scan function feature, you must tell Exim where your
53813 function is before building Exim, by setting LOCAL_SCAN_SOURCE in your
53814 <filename>Local/Makefile</filename>. A recommended place to put it is in the <filename>Local</filename>
53815 directory, so you might set
53816 </para>
53817 <literallayout class="monospaced">
53818 LOCAL_SCAN_SOURCE=Local/local_scan.c
53819 </literallayout>
53820 <para>
53821 for example. The function must be called <function>local_scan()</function>. It is called by
53822 Exim after it has received a message, when the success return code is about to
53823 be sent. This is after all the ACLs have been run. The return code from your
53824 function controls whether the message is actually accepted or not. There is a
53825 commented template function (that just accepts the message) in the file
53826 _src/local_scan.c_.
53827 </para>
53828 <para>
53829 If you want to make use of Exim&#x2019;s run time configuration file to set options
53830 for your <function>local_scan()</function> function, you must also set
53831 </para>
53832 <literallayout class="monospaced">
53833 LOCAL_SCAN_HAS_OPTIONS=yes
53834 </literallayout>
53835 <para>
53836 in <filename>Local/Makefile</filename> (see section <xref linkend="SECTconoptloc"/> below).
53837 </para>
53838 </section>
53839 <section id="SECTapiforloc">
53840 <title>API for local_scan()</title>
53841 <para>
53842 <indexterm role="concept">
53843 <primary><function>local_scan()</function> function</primary>
53844 <secondary>API description</secondary>
53845 </indexterm>
53846 You must include this line near the start of your code:
53847 </para>
53848 <literallayout class="monospaced">
53849 #include "local_scan.h"
53850 </literallayout>
53851 <para>
53852 This header file defines a number of variables and other values, and the
53853 prototype for the function itself. Exim is coded to use unsigned char values
53854 almost exclusively, and one of the things this header defines is a shorthand
53855 for <literal>unsigned char</literal> called <literal>uschar</literal>.
53856 It also contains the following macro definitions, to simplify casting character
53857 strings and pointers to character strings:
53858 </para>
53859 <literallayout class="monospaced">
53860 #define CS   (char *)
53861 #define CCS  (const char *)
53862 #define CSS  (char **)
53863 #define US   (unsigned char *)
53864 #define CUS  (const unsigned char *)
53865 #define USS  (unsigned char **)
53866 </literallayout>
53867 <para>
53868 The function prototype for <function>local_scan()</function> is:
53869 </para>
53870 <literallayout class="monospaced">
53871 extern int local_scan(int fd, uschar **return_text);
53872 </literallayout>
53873 <para>
53874 The arguments are as follows:
53875 </para>
53876 <itemizedlist>
53877 <listitem>
53878 <para>
53879 <option>fd</option> is a file descriptor for the file that contains the body of the message
53880 (the -D file). The file is open for reading and writing, but updating it is not
53881 recommended. <emphasis role="bold">Warning</emphasis>: You must <emphasis>not</emphasis> close this file descriptor.
53882 </para>
53883 <para>
53884 The descriptor is positioned at character 19 of the file, which is the first
53885 character of the body itself, because the first 19 characters are the message
53886 id followed by <literal>-D</literal> and a newline. If you rewind the file, you should use the
53887 macro SPOOL_DATA_START_OFFSET to reset to the start of the data, just in
53888 case this changes in some future version.
53889 </para>
53890 </listitem>
53891 <listitem>
53892 <para>
53893 <option>return_text</option> is an address which you can use to return a pointer to a text
53894 string at the end of the function. The value it points to on entry is NULL.
53895 </para>
53896 </listitem>
53897 </itemizedlist>
53898 <para>
53899 The function must return an <option>int</option> value which is one of the following macros:
53900 </para>
53901 <variablelist>
53902 <varlistentry>
53903 <term><literal>LOCAL_SCAN_ACCEPT</literal></term>
53904 <listitem>
53905 <para>
53906 <indexterm role="variable">
53907 <primary><varname>$local_scan_data</varname></primary>
53908 </indexterm>
53909 The message is accepted. If you pass back a string of text, it is saved with
53910 the message, and made available in the variable <varname>$local_scan_data</varname>. No
53911 newlines are permitted (if there are any, they are turned into spaces) and the
53912 maximum length of text is 1000 characters.
53913 </para>
53914 </listitem></varlistentry>
53915 <varlistentry>
53916 <term><literal>LOCAL_SCAN_ACCEPT_FREEZE</literal></term>
53917 <listitem>
53918 <para>
53919 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
53920 queued without immediate delivery, and is frozen.
53921 </para>
53922 </listitem></varlistentry>
53923 <varlistentry>
53924 <term><literal>LOCAL_SCAN_ACCEPT_QUEUE</literal></term>
53925 <listitem>
53926 <para>
53927 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
53928 queued without immediate delivery.
53929 </para>
53930 </listitem></varlistentry>
53931 <varlistentry>
53932 <term><literal>LOCAL_SCAN_REJECT</literal></term>
53933 <listitem>
53934 <para>
53935 The message is rejected; the returned text is used as an error message which is
53936 passed back to the sender and which is also logged. Newlines are permitted &ndash;
53937 they cause a multiline response for SMTP rejections, but are converted to
53938 <literal>\n</literal> in log lines. If no message is given, <quote>Administrative prohibition</quote> is
53939 used.
53940 </para>
53941 </listitem></varlistentry>
53942 <varlistentry>
53943 <term><literal>LOCAL_SCAN_TEMPREJECT</literal></term>
53944 <listitem>
53945 <para>
53946 The message is temporarily rejected; the returned text is used as an error
53947 message as for LOCAL_SCAN_REJECT. If no message is given, <quote>Temporary local
53948 problem</quote> is used.
53949 </para>
53950 </listitem></varlistentry>
53951 <varlistentry>
53952 <term><literal>LOCAL_SCAN_REJECT_NOLOGHDR</literal></term>
53953 <listitem>
53954 <para>
53955 This behaves as LOCAL_SCAN_REJECT, except that the header of the rejected
53956 message is not written to the reject log. It has the effect of unsetting the
53957 <option>rejected_header</option> log selector for just this rejection. If
53958 <option>rejected_header</option> is already unset (see the discussion of the
53959 <option>log_selection</option> option in section <xref linkend="SECTlogselector"/>), this code is the
53960 same as LOCAL_SCAN_REJECT.
53961 </para>
53962 </listitem></varlistentry>
53963 <varlistentry>
53964 <term><literal>LOCAL_SCAN_TEMPREJECT_NOLOGHDR</literal></term>
53965 <listitem>
53966 <para>
53967 This code is a variation of LOCAL_SCAN_TEMPREJECT in the same way that
53968 LOCAL_SCAN_REJECT_NOLOGHDR is a variation of LOCAL_SCAN_REJECT.
53969 </para>
53970 </listitem></varlistentry>
53971 </variablelist>
53972 <para>
53973 If the message is not being received by interactive SMTP, rejections are
53974 reported by writing to <option>stderr</option> or by sending an email, as configured by the
53975 <option>-oe</option> command line options.
53976 </para>
53977 </section>
53978 <section id="SECTconoptloc">
53979 <title>Configuration options for local_scan()</title>
53980 <para>
53981 <indexterm role="concept">
53982 <primary><function>local_scan()</function> function</primary>
53983 <secondary>configuration options</secondary>
53984 </indexterm>
53985 It is possible to have option settings in the main configuration file
53986 that set values in static variables in the <function>local_scan()</function> module. If you
53987 want to do this, you must have the line
53988 </para>
53989 <literallayout class="monospaced">
53990 LOCAL_SCAN_HAS_OPTIONS=yes
53991 </literallayout>
53992 <para>
53993 in your <filename>Local/Makefile</filename> when you build Exim. (This line is in
53994 <filename>OS/Makefile-Default</filename>, commented out). Then, in the <function>local_scan()</function> source
53995 file, you must define static variables to hold the option values, and a table
53996 to define them.
53997 </para>
53998 <para>
53999 The table must be a vector called <option>local_scan_options</option>, of type
54000 <literal>optionlist</literal>. Each entry is a triplet, consisting of a name, an option type,
54001 and a pointer to the variable that holds the value. The entries must appear in
54002 alphabetical order. Following <option>local_scan_options</option> you must also define a
54003 variable called <option>local_scan_options_count</option> that contains the number of
54004 entries in the table. Here is a short example, showing two kinds of option:
54005 </para>
54006 <literallayout class="monospaced">
54007 static int my_integer_option = 42;
54008 static uschar *my_string_option = US"a default string";
54009
54010 optionlist local_scan_options[] = {
54011   { "my_integer", opt_int,       &amp;my_integer_option },
54012   { "my_string",  opt_stringptr, &amp;my_string_option }
54013 };
54014
54015 int local_scan_options_count =
54016   sizeof(local_scan_options)/sizeof(optionlist);
54017 </literallayout>
54018 <para>
54019 The values of the variables can now be changed from Exim&#x2019;s runtime
54020 configuration file by including a local scan section as in this example:
54021 </para>
54022 <literallayout class="monospaced">
54023 begin local_scan
54024 my_integer = 99
54025 my_string = some string of text...
54026 </literallayout>
54027 <para>
54028 The available types of option data are as follows:
54029 </para>
54030 <variablelist>
54031 <varlistentry>
54032 <term><emphasis role="bold">opt_bool</emphasis></term>
54033 <listitem>
54034 <para>
54035 This specifies a boolean (true/false) option. The address should point to a
54036 variable of type <literal>BOOL</literal>, which will be set to TRUE or FALSE, which are macros
54037 that are defined as <quote>1</quote> and <quote>0</quote>, respectively. If you want to detect
54038 whether such a variable has been set at all, you can initialize it to
54039 TRUE_UNSET. (BOOL variables are integers underneath, so can hold more than two
54040 values.)
54041 </para>
54042 </listitem></varlistentry>
54043 <varlistentry>
54044 <term><emphasis role="bold">opt_fixed</emphasis></term>
54045 <listitem>
54046 <para>
54047 This specifies a fixed point number, such as is used for load averages.
54048 The address should point to a variable of type <literal>int</literal>. The value is stored
54049 multiplied by 1000, so, for example, 1.4142 is truncated and stored as 1414.
54050 </para>
54051 </listitem></varlistentry>
54052 <varlistentry>
54053 <term><emphasis role="bold">opt_int</emphasis></term>
54054 <listitem>
54055 <para>
54056 This specifies an integer; the address should point to a variable of type
54057 <literal>int</literal>. The value may be specified in any of the integer formats accepted by
54058 Exim.
54059 </para>
54060 </listitem></varlistentry>
54061 <varlistentry>
54062 <term><emphasis role="bold">opt_mkint</emphasis></term>
54063 <listitem>
54064 <para>
54065 This is the same as <option>opt_int</option>, except that when such a value is output in a
54066 <option>-bP</option> listing, if it is an exact number of kilobytes or megabytes, it is
54067 printed with the suffix K or M.
54068 </para>
54069 </listitem></varlistentry>
54070 <varlistentry>
54071 <term><emphasis role="bold">opt_octint</emphasis></term>
54072 <listitem>
54073 <para>
54074 This also specifies an integer, but the value is always interpreted as an
54075 octal integer, whether or not it starts with the digit zero, and it is
54076 always output in octal.
54077 </para>
54078 </listitem></varlistentry>
54079 <varlistentry>
54080 <term><emphasis role="bold">opt_stringptr</emphasis></term>
54081 <listitem>
54082 <para>
54083 This specifies a string value; the address must be a pointer to a
54084 variable that points to a string (for example, of type <literal>uschar *</literal>).
54085 </para>
54086 </listitem></varlistentry>
54087 <varlistentry>
54088 <term><emphasis role="bold">opt_time</emphasis></term>
54089 <listitem>
54090 <para>
54091 This specifies a time interval value. The address must point to a variable of
54092 type <literal>int</literal>. The value that is placed there is a number of seconds.
54093 </para>
54094 </listitem></varlistentry>
54095 </variablelist>
54096 <para>
54097 If the <option>-bP</option> command line option is followed by <literal>local_scan</literal>, Exim prints
54098 out the values of all the <function>local_scan()</function> options.
54099 </para>
54100 </section>
54101 <section id="SECID208">
54102 <title>Available Exim variables</title>
54103 <para>
54104 <indexterm role="concept">
54105 <primary><function>local_scan()</function> function</primary>
54106 <secondary>available Exim variables</secondary>
54107 </indexterm>
54108 The header <filename>local_scan.h</filename> gives you access to a number of C variables. These
54109 are the only ones that are guaranteed to be maintained from release to release.
54110 Note, however, that you can obtain the value of any Exim expansion variable,
54111 including <varname>$recipients</varname>, by calling <emphasis>expand_string()</emphasis>. The exported
54112 C variables are as follows:
54113 </para>
54114 <variablelist>
54115 <varlistentry>
54116 <term><emphasis role="bold">int&nbsp;body_linecount</emphasis></term>
54117 <listitem>
54118 <para>
54119 This variable contains the number of lines in the message&#x2019;s body.
54120 </para>
54121 </listitem></varlistentry>
54122 <varlistentry>
54123 <term><emphasis role="bold">int&nbsp;body_zerocount</emphasis></term>
54124 <listitem>
54125 <para>
54126 This variable contains the number of binary zero bytes in the message&#x2019;s body.
54127 </para>
54128 </listitem></varlistentry>
54129 <varlistentry>
54130 <term><emphasis role="bold">unsigned&nbsp;int&nbsp;debug_selector</emphasis></term>
54131 <listitem>
54132 <para>
54133 This variable is set to zero when no debugging is taking place. Otherwise, it
54134 is a bitmap of debugging selectors. Two bits are identified for use in
54135 <function>local_scan()</function>; they are defined as macros:
54136 </para>
54137 <itemizedlist>
54138 <listitem>
54139 <para>
54140 The <literal>D_v</literal> bit is set when <option>-v</option> was present on the command line. This is a
54141 testing option that is not privileged &ndash; any caller may set it. All the
54142 other selector bits can be set only by admin users.
54143 </para>
54144 </listitem>
54145 <listitem>
54146 <para>
54147 The <literal>D_local_scan</literal> bit is provided for use by <function>local_scan()</function>; it is set
54148 by the <literal>+local_scan</literal> debug selector. It is not included in the default set
54149 of debugging bits.
54150 </para>
54151 </listitem>
54152 </itemizedlist>
54153 <para>
54154 Thus, to write to the debugging output only when <literal>+local_scan</literal> has been
54155 selected, you should use code like this:
54156 </para>
54157 <literallayout class="monospaced">
54158 if ((debug_selector &amp; D_local_scan) != 0)
54159   debug_printf("xxx", ...);
54160 </literallayout>
54161 </listitem></varlistentry>
54162 <varlistentry>
54163 <term><emphasis role="bold">uschar&nbsp;*expand_string_message</emphasis></term>
54164 <listitem>
54165 <para>
54166 After a failing call to <emphasis>expand_string()</emphasis> (returned value NULL), the
54167 variable <option>expand_string_message</option> contains the error message, zero-terminated.
54168 </para>
54169 </listitem></varlistentry>
54170 <varlistentry>
54171 <term><emphasis role="bold">header_line&nbsp;*header_list</emphasis></term>
54172 <listitem>
54173 <para>
54174 A pointer to a chain of header lines. The <option>header_line</option> structure is
54175 discussed below.
54176 </para>
54177 </listitem></varlistentry>
54178 <varlistentry>
54179 <term><emphasis role="bold">header_line&nbsp;*header_last</emphasis></term>
54180 <listitem>
54181 <para>
54182 A pointer to the last of the header lines.
54183 </para>
54184 </listitem></varlistentry>
54185 <varlistentry>
54186 <term><emphasis role="bold">uschar&nbsp;*headers_charset</emphasis></term>
54187 <listitem>
54188 <para>
54189 The value of the <option>headers_charset</option> configuration option.
54190 </para>
54191 </listitem></varlistentry>
54192 <varlistentry>
54193 <term><emphasis role="bold">BOOL&nbsp;host_checking</emphasis></term>
54194 <listitem>
54195 <para>
54196 This variable is TRUE during a host checking session that is initiated by the
54197 <option>-bh</option> command line option.
54198 </para>
54199 </listitem></varlistentry>
54200 <varlistentry>
54201 <term><emphasis role="bold">uschar&nbsp;*interface_address</emphasis></term>
54202 <listitem>
54203 <para>
54204 The IP address of the interface that received the message, as a string. This
54205 is NULL for locally submitted messages.
54206 </para>
54207 </listitem></varlistentry>
54208 <varlistentry>
54209 <term><emphasis role="bold">int&nbsp;interface_port</emphasis></term>
54210 <listitem>
54211 <para>
54212 The port on which this message was received. When testing with the <option>-bh</option>
54213 command line option, the value of this variable is -1 unless a port has been
54214 specified via the <option>-oMi</option> option.
54215 </para>
54216 </listitem></varlistentry>
54217 <varlistentry>
54218 <term><emphasis role="bold">uschar&nbsp;*message_id</emphasis></term>
54219 <listitem>
54220 <para>
54221 This variable contains Exim&#x2019;s message id for the incoming message (the value of
54222 <varname>$message_exim_id</varname>) as a zero-terminated string.
54223 </para>
54224 </listitem></varlistentry>
54225 <varlistentry>
54226 <term><emphasis role="bold">uschar&nbsp;*received_protocol</emphasis></term>
54227 <listitem>
54228 <para>
54229 The name of the protocol by which the message was received.
54230 </para>
54231 </listitem></varlistentry>
54232 <varlistentry>
54233 <term><emphasis role="bold">int&nbsp;recipients_count</emphasis></term>
54234 <listitem>
54235 <para>
54236 The number of accepted recipients.
54237 </para>
54238 </listitem></varlistentry>
54239 <varlistentry>
54240 <term><emphasis role="bold">recipient_item&nbsp;*recipients_list</emphasis></term>
54241 <listitem>
54242 <para>
54243 <indexterm role="concept">
54244 <primary>recipient</primary>
54245 <secondary>adding in local scan</secondary>
54246 </indexterm>
54247 <indexterm role="concept">
54248 <primary>recipient</primary>
54249 <secondary>removing in local scan</secondary>
54250 </indexterm>
54251 The list of accepted recipients, held in a vector of length
54252 <option>recipients_count</option>. The <option>recipient_item</option> structure is discussed below. You
54253 can add additional recipients by calling <emphasis>receive_add_recipient()</emphasis> (see
54254 below). You can delete recipients by removing them from the vector and
54255 adjusting the value in <option>recipients_count</option>. In particular, by setting
54256 <option>recipients_count</option> to zero you remove all recipients. If you then return the
54257 value <literal>LOCAL_SCAN_ACCEPT</literal>, the message is accepted, but immediately
54258 blackholed. To replace the recipients, you can set <option>recipients_count</option> to zero
54259 and then call <emphasis>receive_add_recipient()</emphasis> as often as needed.
54260 </para>
54261 </listitem></varlistentry>
54262 <varlistentry>
54263 <term><emphasis role="bold">uschar&nbsp;*sender_address</emphasis></term>
54264 <listitem>
54265 <para>
54266 The envelope sender address. For bounce messages this is the empty string.
54267 </para>
54268 </listitem></varlistentry>
54269 <varlistentry>
54270 <term><emphasis role="bold">uschar&nbsp;*sender_host_address</emphasis></term>
54271 <listitem>
54272 <para>
54273 The IP address of the sending host, as a string. This is NULL for
54274 locally-submitted messages.
54275 </para>
54276 </listitem></varlistentry>
54277 <varlistentry>
54278 <term><emphasis role="bold">uschar&nbsp;*sender_host_authenticated</emphasis></term>
54279 <listitem>
54280 <para>
54281 The name of the authentication mechanism that was used, or NULL if the message
54282 was not received over an authenticated SMTP connection.
54283 </para>
54284 </listitem></varlistentry>
54285 <varlistentry>
54286 <term><emphasis role="bold">uschar&nbsp;*sender_host_name</emphasis></term>
54287 <listitem>
54288 <para>
54289 The name of the sending host, if known.
54290 </para>
54291 </listitem></varlistentry>
54292 <varlistentry>
54293 <term><emphasis role="bold">int&nbsp;sender_host_port</emphasis></term>
54294 <listitem>
54295 <para>
54296 The port on the sending host.
54297 </para>
54298 </listitem></varlistentry>
54299 <varlistentry>
54300 <term><emphasis role="bold">BOOL&nbsp;smtp_input</emphasis></term>
54301 <listitem>
54302 <para>
54303 This variable is TRUE for all SMTP input, including BSMTP.
54304 </para>
54305 </listitem></varlistentry>
54306 <varlistentry>
54307 <term><emphasis role="bold">BOOL&nbsp;smtp_batched_input</emphasis></term>
54308 <listitem>
54309 <para>
54310 This variable is TRUE for BSMTP input.
54311 </para>
54312 </listitem></varlistentry>
54313 <varlistentry>
54314 <term><emphasis role="bold">int&nbsp;store_pool</emphasis></term>
54315 <listitem>
54316 <para>
54317 The contents of this variable control which pool of memory is used for new
54318 requests. See section <xref linkend="SECTmemhanloc"/> for details.
54319 </para>
54320 </listitem></varlistentry>
54321 </variablelist>
54322 </section>
54323 <section id="SECID209">
54324 <title>Structure of header lines</title>
54325 <para>
54326 The <option>header_line</option> structure contains the members listed below.
54327 You can add additional header lines by calling the <emphasis>header_add()</emphasis> function
54328 (see below). You can cause header lines to be ignored (deleted) by setting
54329 their type to *.
54330 </para>
54331 <variablelist>
54332 <varlistentry>
54333 <term><emphasis role="bold">struct&nbsp;header_line&nbsp;*next</emphasis></term>
54334 <listitem>
54335 <para>
54336 A pointer to the next header line, or NULL for the last line.
54337 </para>
54338 </listitem></varlistentry>
54339 <varlistentry>
54340 <term><emphasis role="bold">int&nbsp;type</emphasis></term>
54341 <listitem>
54342 <para>
54343 A code identifying certain headers that Exim recognizes. The codes are printing
54344 characters, and are documented in chapter <xref linkend="CHAPspool"/> of this manual.
54345 Notice in particular that any header line whose type is * is not transmitted
54346 with the message. This flagging is used for header lines that have been
54347 rewritten, or are to be removed (for example, <emphasis>Envelope-sender:</emphasis> header
54348 lines.) Effectively, * means <quote>deleted</quote>.
54349 </para>
54350 </listitem></varlistentry>
54351 <varlistentry>
54352 <term><emphasis role="bold">int&nbsp;slen</emphasis></term>
54353 <listitem>
54354 <para>
54355 The number of characters in the header line, including the terminating and any
54356 internal newlines.
54357 </para>
54358 </listitem></varlistentry>
54359 <varlistentry>
54360 <term><emphasis role="bold">uschar&nbsp;*text</emphasis></term>
54361 <listitem>
54362 <para>
54363 A pointer to the text of the header. It always ends with a newline, followed by
54364 a zero byte. Internal newlines are preserved.
54365 </para>
54366 </listitem></varlistentry>
54367 </variablelist>
54368 </section>
54369 <section id="SECID210">
54370 <title>Structure of recipient items</title>
54371 <para>
54372 The <option>recipient_item</option> structure contains these members:
54373 </para>
54374 <variablelist>
54375 <varlistentry>
54376 <term><emphasis role="bold">uschar&nbsp;*address</emphasis></term>
54377 <listitem>
54378 <para>
54379 This is a pointer to the recipient address as it was received.
54380 </para>
54381 </listitem></varlistentry>
54382 <varlistentry>
54383 <term><emphasis role="bold">int&nbsp;pno</emphasis></term>
54384 <listitem>
54385 <para>
54386 This is used in later Exim processing when top level addresses are created by
54387 the <option>one_time</option> option. It is not relevant at the time <function>local_scan()</function> is run
54388 and must always contain -1 at this stage.
54389 </para>
54390 </listitem></varlistentry>
54391 <varlistentry>
54392 <term><emphasis role="bold">uschar&nbsp;*errors_to</emphasis></term>
54393 <listitem>
54394 <para>
54395 If this value is not NULL, bounce messages caused by failing to deliver to the
54396 recipient are sent to the address it contains. In other words, it overrides the
54397 envelope sender for this one recipient. (Compare the <option>errors_to</option> generic
54398 router option.) If a <function>local_scan()</function> function sets an <option>errors_to</option> field to
54399 an unqualified address, Exim qualifies it using the domain from
54400 <option>qualify_recipient</option>. When <function>local_scan()</function> is called, the <option>errors_to</option> field
54401 is NULL for all recipients.
54402 </para>
54403 </listitem></varlistentry>
54404 </variablelist>
54405 </section>
54406 <section id="SECID211">
54407 <title>Available Exim functions</title>
54408 <para>
54409 <indexterm role="concept">
54410 <primary><function>local_scan()</function> function</primary>
54411 <secondary>available Exim functions</secondary>
54412 </indexterm>
54413 The header <filename>local_scan.h</filename> gives you access to a number of Exim functions.
54414 These are the only ones that are guaranteed to be maintained from release to
54415 release:
54416 </para>
54417 <variablelist>
54418 <varlistentry>
54419 <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>
54420 <listitem>
54421 <para>
54422 This function creates a child process that runs the command specified by
54423 <option>argv</option>. The environment for the process is specified by <option>envp</option>, which can
54424 be NULL if no environment variables are to be passed. A new umask is supplied
54425 for the process in <option>newumask</option>.
54426 </para>
54427 <para>
54428 Pipes to the standard input and output of the new process are set up
54429 and returned to the caller via the <option>infdptr</option> and <option>outfdptr</option> arguments. The
54430 standard error is cloned to the standard output. If there are any file
54431 descriptors <quote>in the way</quote> in the new process, they are closed. If the final
54432 argument is TRUE, the new process is made into a process group leader.
54433 </para>
54434 <para>
54435 The function returns the pid of the new process, or -1 if things go wrong.
54436 </para>
54437 </listitem></varlistentry>
54438 <varlistentry>
54439 <term><emphasis role="bold">int&nbsp;child_close(pid_t&nbsp;pid,&nbsp;int&nbsp;timeout)</emphasis></term>
54440 <listitem>
54441 <para>
54442 This function waits for a child process to terminate, or for a timeout (in
54443 seconds) to expire. A timeout value of zero means wait as long as it takes. The
54444 return value is as follows:
54445 </para>
54446 <itemizedlist>
54447 <listitem>
54448 <para>
54449 &gt;= 0
54450 </para>
54451 <para>
54452 The process terminated by a normal exit and the value is the process
54453 ending status.
54454 </para>
54455 </listitem>
54456 <listitem>
54457 <para>
54458 &lt; 0 and &gt; &ndash;256
54459 </para>
54460 <para>
54461 The process was terminated by a signal and the value is the negation of the
54462 signal number.
54463 </para>
54464 </listitem>
54465 <listitem>
54466 <para>
54467 &ndash;256
54468 </para>
54469 <para>
54470 The process timed out.
54471 </para>
54472 </listitem>
54473 <listitem>
54474 <para>
54475 &ndash;257
54476 </para>
54477 <para>
54478 The was some other error in wait(); <option>errno</option> is still set.
54479 </para>
54480 </listitem>
54481 </itemizedlist>
54482 </listitem></varlistentry>
54483 <varlistentry>
54484 <term><emphasis role="bold">pid_t&nbsp;child_open_exim(int&nbsp;*fd)</emphasis></term>
54485 <listitem>
54486 <para>
54487 This function provide you with a means of submitting a new message to
54488 Exim. (Of course, you can also call <filename>/usr/sbin/sendmail</filename> yourself if you
54489 want, but this packages it all up for you.) The function creates a pipe,
54490 forks a subprocess that is running
54491 </para>
54492 <literallayout class="monospaced">
54493 exim -t -oem -oi -f &lt;&gt;
54494 </literallayout>
54495 <para>
54496 and returns to you (via the <literal>int *</literal> argument) a file descriptor for the pipe
54497 that is connected to the standard input. The yield of the function is the PID
54498 of the subprocess. You can then write a message to the file descriptor, with
54499 recipients in <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and/or <emphasis>Bcc:</emphasis> header lines.
54500 </para>
54501 <para>
54502 When you have finished, call <emphasis>child_close()</emphasis> to wait for the process to
54503 finish and to collect its ending status. A timeout value of zero is usually
54504 fine in this circumstance. Unless you have made a mistake with the recipient
54505 addresses, you should get a return code of zero.
54506 </para>
54507 </listitem></varlistentry>
54508 <varlistentry>
54509 <term><emphasis role="bold">pid_t&nbsp;child_open_exim2(int&nbsp;*fd,&nbsp;uschar&nbsp;*sender,&nbsp;uschar&nbsp;*sender_authentication)</emphasis></term>
54510 <listitem>
54511 <para>
54512 This function is a more sophisticated version of <emphasis>child_open()</emphasis>. The command
54513 that it runs is:
54514 </para>
54515 <literallayout>
54516 <literal>exim -t -oem -oi -f </literal><emphasis>sender</emphasis><literal> -oMas </literal><emphasis>sender_authentication</emphasis>
54517 </literallayout>
54518 <para>
54519 The third argument may be NULL, in which case the <option>-oMas</option> option is omitted.
54520 </para>
54521 </listitem></varlistentry>
54522 <varlistentry>
54523 <term><emphasis role="bold">void&nbsp;debug_printf(char&nbsp;*,&nbsp;...)</emphasis></term>
54524 <listitem>
54525 <para>
54526 This is Exim&#x2019;s debugging function, with arguments as for <emphasis>(printf()</emphasis>. The
54527 output is written to the standard error stream. If no debugging is selected,
54528 calls to <emphasis>debug_printf()</emphasis> have no effect. Normally, you should make calls
54529 conditional on the <literal>local_scan</literal> debug selector by coding like this:
54530 </para>
54531 <literallayout class="monospaced">
54532 if ((debug_selector &amp; D_local_scan) != 0)
54533   debug_printf("xxx", ...);
54534 </literallayout>
54535 </listitem></varlistentry>
54536 <varlistentry>
54537 <term><emphasis role="bold">uschar&nbsp;*expand_string(uschar&nbsp;*string)</emphasis></term>
54538 <listitem>
54539 <para>
54540 This is an interface to Exim&#x2019;s string expansion code. The return value is the
54541 expanded string, or NULL if there was an expansion failure.
54542 The C variable <option>expand_string_message</option> contains an error message after an
54543 expansion failure. If expansion does not change the string, the return value is
54544 the pointer to the input string. Otherwise, the return value points to a new
54545 block of memory that was obtained by a call to <emphasis>store_get()</emphasis>. See section
54546 <xref linkend="SECTmemhanloc"/> below for a discussion of memory handling.
54547 </para>
54548 </listitem></varlistentry>
54549 <varlistentry>
54550 <term><emphasis role="bold">void&nbsp;header_add(int&nbsp;type,&nbsp;char&nbsp;*format,&nbsp;...)</emphasis></term>
54551 <listitem>
54552 <para>
54553 This function allows you to an add additional header line at the end of the
54554 existing ones. The first argument is the type, and should normally be a space
54555 character. The second argument is a format string and any number of
54556 substitution arguments as for <function>sprintf()</function>. You may include internal newlines
54557 if you want, and you must ensure that the string ends with a newline.
54558 </para>
54559 </listitem></varlistentry>
54560 <varlistentry>
54561 <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>
54562 <listitem>
54563 <para>
54564 This function adds a new header line at a specified point in the header
54565 chain. The header itself is specified as for <emphasis>header_add()</emphasis>.
54566 </para>
54567 <para>
54568 If <option>name</option> is NULL, the new header is added at the end of the chain if
54569 <option>after</option> is true, or at the start if <option>after</option> is false. If <option>name</option> is not
54570 NULL, the header lines are searched for the first non-deleted header that
54571 matches the name. If one is found, the new header is added before it if
54572 <option>after</option> is false. If <option>after</option> is true, the new header is added after the
54573 found header and any adjacent subsequent ones with the same name (even if
54574 marked <quote>deleted</quote>). If no matching non-deleted header is found, the <option>topnot</option>
54575 option controls where the header is added. If it is true, addition is at the
54576 top; otherwise at the bottom. Thus, to add a header after all the <emphasis>Received:</emphasis>
54577 headers, or at the top if there are no <emphasis>Received:</emphasis> headers, you could use
54578 </para>
54579 <literallayout class="monospaced">
54580 header_add_at_position(TRUE, US"Received", TRUE,
54581   ' ', "X-xxx: ...");
54582 </literallayout>
54583 <para>
54584 Normally, there is always at least one non-deleted <emphasis>Received:</emphasis> header, but
54585 there may not be if <option>received_header_text</option> expands to an empty string.
54586 </para>
54587 </listitem></varlistentry>
54588 <varlistentry>
54589 <term><emphasis role="bold">void&nbsp;header_remove(int&nbsp;occurrence,&nbsp;uschar&nbsp;*name)</emphasis></term>
54590 <listitem>
54591 <para>
54592 This function removes header lines. If <option>occurrence</option> is zero or negative, all
54593 occurrences of the header are removed. If occurrence is greater than zero, that
54594 particular instance of the header is removed. If no header(s) can be found that
54595 match the specification, the function does nothing.
54596 </para>
54597 </listitem></varlistentry>
54598 <varlistentry>
54599 <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>
54600 <listitem>
54601 <para>
54602 This function tests whether the given header has the given name. It is not just
54603 a string comparison, because white space is permitted between the name and the
54604 colon. If the <option>notdel</option> argument is true, a false return is forced for all
54605 <quote>deleted</quote> headers; otherwise they are not treated specially. For example:
54606 </para>
54607 <literallayout class="monospaced">
54608 if (header_testname(h, US"X-Spam", 6, TRUE)) ...
54609 </literallayout>
54610 </listitem></varlistentry>
54611 <varlistentry>
54612 <term><emphasis role="bold">uschar&nbsp;*lss_b64encode(uschar&nbsp;*cleartext,&nbsp;int&nbsp;length)</emphasis></term>
54613 <listitem>
54614 <para>
54615 <indexterm role="concept">
54616 <primary>base64 encoding</primary>
54617 <secondary>functions for <function>local_scan()</function> use</secondary>
54618 </indexterm>
54619 This function base64-encodes a string, which is passed by address and length.
54620 The text may contain bytes of any value, including zero. The result is passed
54621 back in dynamic memory that is obtained by calling <emphasis>store_get()</emphasis>. It is
54622 zero-terminated.
54623 </para>
54624 </listitem></varlistentry>
54625 <varlistentry>
54626 <term><emphasis role="bold">int&nbsp;lss_b64decode(uschar&nbsp;*codetext,&nbsp;uschar&nbsp;**cleartext)</emphasis></term>
54627 <listitem>
54628 <para>
54629 This function decodes a base64-encoded string. Its arguments are a
54630 zero-terminated base64-encoded string and the address of a variable that is set
54631 to point to the result, which is in dynamic memory. The length of the decoded
54632 string is the yield of the function. If the input is invalid base64 data, the
54633 yield is -1. A zero byte is added to the end of the output string to make it
54634 easy to interpret as a C string (assuming it contains no zeros of its own). The
54635 added zero byte is not included in the returned count.
54636 </para>
54637 </listitem></varlistentry>
54638 <varlistentry>
54639 <term><emphasis role="bold">int&nbsp;lss_match_domain(uschar&nbsp;*domain,&nbsp;uschar&nbsp;*list)</emphasis></term>
54640 <listitem>
54641 <para>
54642 This function checks for a match in a domain list. Domains are always
54643 matched caselessly. The return value is one of the following:
54644 </para>
54645 <literallayout>
54646 <literal>OK     </literal> match succeeded
54647 <literal>FAIL   </literal> match failed
54648 <literal>DEFER  </literal> match deferred
54649 </literallayout>
54650 <para>
54651 DEFER is usually caused by some kind of lookup defer, such as the
54652 inability to contact a database.
54653 </para>
54654 </listitem></varlistentry>
54655 <varlistentry>
54656 <term><emphasis role="bold">int&nbsp;lss_match_local_part(uschar&nbsp;*localpart,&nbsp;uschar&nbsp;*list,&nbsp;BOOL&nbsp;caseless)</emphasis></term>
54657 <listitem>
54658 <para>
54659 This function checks for a match in a local part list. The third argument
54660 controls case-sensitivity. The return values are as for
54661 <emphasis>lss_match_domain()</emphasis>.
54662 </para>
54663 </listitem></varlistentry>
54664 <varlistentry>
54665 <term><emphasis role="bold">int&nbsp;lss_match_address(uschar&nbsp;*address,&nbsp;uschar&nbsp;*list,&nbsp;BOOL&nbsp;caseless)</emphasis></term>
54666 <listitem>
54667 <para>
54668 This function checks for a match in an address list. The third argument
54669 controls the case-sensitivity of the local part match. The domain is always
54670 matched caselessly. The return values are as for <emphasis>lss_match_domain()</emphasis>.
54671 </para>
54672 </listitem></varlistentry>
54673 <varlistentry>
54674 <term><emphasis role="bold">int&nbsp;lss_match_host(uschar&nbsp;*host_name,&nbsp;uschar&nbsp;*host_address,&nbsp;uschar&nbsp;*list)</emphasis></term>
54675 <listitem>
54676 <para>
54677 This function checks for a match in a host list. The most common usage is
54678 expected to be
54679 </para>
54680 <literallayout class="monospaced">
54681 lss_match_host(sender_host_name, sender_host_address, ...)
54682 </literallayout>
54683 <para>
54684 <indexterm role="variable">
54685 <primary><varname>$sender_host_address</varname></primary>
54686 </indexterm>
54687 An empty address field matches an empty item in the host list. If the host name
54688 is NULL, the name corresponding to <varname>$sender_host_address</varname> is automatically
54689 looked up if a host name is required to match an item in the list. The return
54690 values are as for <emphasis>lss_match_domain()</emphasis>, but in addition, <emphasis>lss_match_host()</emphasis>
54691 returns ERROR in the case when it had to look up a host name, but the lookup
54692 failed.
54693 </para>
54694 </listitem></varlistentry>
54695 <varlistentry>
54696 <term><emphasis role="bold">void&nbsp;log_write(unsigned&nbsp;int&nbsp;selector,&nbsp;int&nbsp;which,&nbsp;char&nbsp;*format,&nbsp;...)</emphasis></term>
54697 <listitem>
54698 <para>
54699 This function writes to Exim&#x2019;s log files. The first argument should be zero (it
54700 is concerned with <option>log_selector</option>). The second argument can be <literal>LOG_MAIN</literal> or
54701 <literal>LOG_REJECT</literal> or <literal>LOG_PANIC</literal> or the inclusive <quote>or</quote> of any combination of
54702 them. It specifies to which log or logs the message is written. The remaining
54703 arguments are a format and relevant insertion arguments. The string should not
54704 contain any newlines, not even at the end.
54705 </para>
54706 </listitem></varlistentry>
54707 <varlistentry>
54708 <term><emphasis role="bold">void&nbsp;receive_add_recipient(uschar&nbsp;*address,&nbsp;int&nbsp;pno)</emphasis></term>
54709 <listitem>
54710 <para>
54711 This function adds an additional recipient to the message. The first argument
54712 is the recipient address. If it is unqualified (has no domain), it is qualified
54713 with the <option>qualify_recipient</option> domain. The second argument must always be -1.
54714 </para>
54715 <para>
54716 This function does not allow you to specify a private <option>errors_to</option> address (as
54717 described with the structure of <option>recipient_item</option> above), because it pre-dates
54718 the addition of that field to the structure. However, it is easy to add such a
54719 value afterwards. For example:
54720 </para>
54721 <literallayout class="monospaced">
54722  receive_add_recipient(US"monitor@mydom.example", -1);
54723  recipients_list[recipients_count-1].errors_to =
54724    US"postmaster@mydom.example";
54725 </literallayout>
54726 </listitem></varlistentry>
54727 <varlistentry>
54728 <term><emphasis role="bold">BOOL&nbsp;receive_remove_recipient(uschar&nbsp;*recipient)</emphasis></term>
54729 <listitem>
54730 <para>
54731 This is a convenience function to remove a named recipient from the list of
54732 recipients. It returns true if a recipient was removed, and false if no
54733 matching recipient could be found. The argument must be a complete email
54734 address.
54735 </para>
54736 </listitem></varlistentry>
54737 </variablelist>
54738 <para>
54739 <indexterm role="concept">
54740 <primary>RFC 2047</primary>
54741 </indexterm>
54742 </para>
54743 <variablelist>
54744 <varlistentry>
54745 <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>
54746 <listitem>
54747 <para>
54748 This function decodes strings that are encoded according to RFC 2047. Typically
54749 these are the contents of header lines. First, each <quote>encoded word</quote> is decoded
54750 from the Q or B encoding into a byte-string. Then, if provided with the name of
54751 a charset encoding, and if the <function>iconv()</function> function is available, an attempt is
54752 made  to translate the result to the named character set. If this fails, the
54753 binary string is returned with an error message.
54754 </para>
54755 <para>
54756 The first argument is the string to be decoded. If <option>lencheck</option> is TRUE, the
54757 maximum MIME word length is enforced. The third argument is the target
54758 encoding, or NULL if no translation is wanted.
54759 </para>
54760 <para>
54761 <indexterm role="concept">
54762 <primary>binary zero</primary>
54763 <secondary>in RFC 2047 decoding</secondary>
54764 </indexterm>
54765 <indexterm role="concept">
54766 <primary>RFC 2047</primary>
54767 <secondary>binary zero in</secondary>
54768 </indexterm>
54769 If a binary zero is encountered in the decoded string, it is replaced by the
54770 contents of the <option>zeroval</option> argument. For use with Exim headers, the value must
54771 not be 0 because header lines are handled as zero-terminated strings.
54772 </para>
54773 <para>
54774 The function returns the result of processing the string, zero-terminated; if
54775 <option>lenptr</option> is not NULL, the length of the result is set in the variable to
54776 which it points. When <option>zeroval</option> is 0, <option>lenptr</option> should not be NULL.
54777 </para>
54778 <para>
54779 If an error is encountered, the function returns NULL and uses the <option>error</option>
54780 argument to return an error message. The variable pointed to by <option>error</option> is
54781 set to NULL if there is no error; it may be set non-NULL even when the function
54782 returns a non-NULL value if decoding was successful, but there was a problem
54783 with translation.
54784 </para>
54785 </listitem></varlistentry>
54786 <varlistentry>
54787 <term><emphasis role="bold">int&nbsp;smtp_fflush(void)</emphasis></term>
54788 <listitem>
54789 <para>
54790 This function is used in conjunction with <emphasis>smtp_printf()</emphasis>, as described
54791 below.
54792 </para>
54793 </listitem></varlistentry>
54794 <varlistentry>
54795 <term><emphasis role="bold">void&nbsp;smtp_printf(char&nbsp;*,&nbsp;...)</emphasis></term>
54796 <listitem>
54797 <para>
54798 The arguments of this function are like <function>printf()</function>; it writes to the SMTP
54799 output stream. You should use this function only when there is an SMTP output
54800 stream, that is, when the incoming message is being received via interactive
54801 SMTP. This is the case when <option>smtp_input</option> is TRUE and <option>smtp_batched_input</option>
54802 is FALSE. If you want to test for an incoming message from another host (as
54803 opposed to a local process that used the <option>-bs</option> command line option), you can
54804 test the value of <option>sender_host_address</option>, which is non-NULL when a remote host
54805 is involved.
54806 </para>
54807 <para>
54808 If an SMTP TLS connection is established, <emphasis>smtp_printf()</emphasis> uses the TLS
54809 output function, so it can be used for all forms of SMTP connection.
54810 </para>
54811 <para>
54812 Strings that are written by <emphasis>smtp_printf()</emphasis> from within <function>local_scan()</function>
54813 must start with an appropriate response code: 550 if you are going to return
54814 LOCAL_SCAN_REJECT, 451 if you are going to return
54815 LOCAL_SCAN_TEMPREJECT, and 250 otherwise. Because you are writing the
54816 initial lines of a multi-line response, the code must be followed by a hyphen
54817 to indicate that the line is not the final response line. You must also ensure
54818 that the lines you write terminate with CRLF. For example:
54819 </para>
54820 <literallayout class="monospaced">
54821 smtp_printf("550-this is some extra info\r\n");
54822 return LOCAL_SCAN_REJECT;
54823 </literallayout>
54824 <para>
54825 Note that you can also create multi-line responses by including newlines in
54826 the data returned via the <option>return_text</option> argument. The added value of using
54827 <emphasis>smtp_printf()</emphasis> is that, for instance, you could introduce delays between
54828 multiple output lines.
54829 </para>
54830 <para>
54831 The <emphasis>smtp_printf()</emphasis> function does not return any error indication, because it
54832 does not automatically flush pending output, and therefore does not test
54833 the state of the stream. (In the main code of Exim, flushing and error
54834 detection is done when Exim is ready for the next SMTP input command.) If
54835 you want to flush the output and check for an error (for example, the
54836 dropping of a TCP/IP connection), you can call <emphasis>smtp_fflush()</emphasis>, which has no
54837 arguments. It flushes the output stream, and returns a non-zero value if there
54838 is an error.
54839 </para>
54840 </listitem></varlistentry>
54841 <varlistentry>
54842 <term><emphasis role="bold">void&nbsp;*store_get(int)</emphasis></term>
54843 <listitem>
54844 <para>
54845 This function accesses Exim&#x2019;s internal store (memory) manager. It gets a new
54846 chunk of memory whose size is given by the argument. Exim bombs out if it ever
54847 runs out of memory. See the next section for a discussion of memory handling.
54848 </para>
54849 </listitem></varlistentry>
54850 <varlistentry>
54851 <term><emphasis role="bold">void&nbsp;*store_get_perm(int)</emphasis></term>
54852 <listitem>
54853 <para>
54854 This function is like <emphasis>store_get()</emphasis>, but it always gets memory from the
54855 permanent pool. See the next section for a discussion of memory handling.
54856 </para>
54857 </listitem></varlistentry>
54858 <varlistentry>
54859 <term><emphasis role="bold">uschar&nbsp;*string_copy(uschar&nbsp;*string)</emphasis></term>
54860 <listitem>
54861 <para>
54862 See below.
54863 </para>
54864 </listitem></varlistentry>
54865 <varlistentry>
54866 <term><emphasis role="bold">uschar&nbsp;*string_copyn(uschar&nbsp;*string,&nbsp;int&nbsp;length)</emphasis></term>
54867 <listitem>
54868 <para>
54869 See below.
54870 </para>
54871 </listitem></varlistentry>
54872 <varlistentry>
54873 <term><emphasis role="bold">uschar&nbsp;*string_sprintf(char&nbsp;*format,&nbsp;...)</emphasis></term>
54874 <listitem>
54875 <para>
54876 These three functions create strings using Exim&#x2019;s dynamic memory facilities.
54877 The first makes a copy of an entire string. The second copies up to a maximum
54878 number of characters, indicated by the second argument. The third uses a format
54879 and insertion arguments to create a new string. In each case, the result is a
54880 pointer to a new string in the current memory pool. See the next section for
54881 more discussion.
54882 </para>
54883 </listitem></varlistentry>
54884 </variablelist>
54885 </section>
54886 <section id="SECTmemhanloc">
54887 <title>More about Exim&#x2019;s memory handling</title>
54888 <para>
54889 <indexterm role="concept">
54890 <primary><function>local_scan()</function> function</primary>
54891 <secondary>memory handling</secondary>
54892 </indexterm>
54893 No function is provided for freeing memory, because that is never needed.
54894 The dynamic memory that Exim uses when receiving a message is automatically
54895 recycled if another message is received by the same process (this applies only
54896 to incoming SMTP connections &ndash; other input methods can supply only one
54897 message at a time). After receiving the last message, a reception process
54898 terminates.
54899 </para>
54900 <para>
54901 Because it is recycled, the normal dynamic memory cannot be used for holding
54902 data that must be preserved over a number of incoming messages on the same SMTP
54903 connection. However, Exim in fact uses two pools of dynamic memory; the second
54904 one is not recycled, and can be used for this purpose.
54905 </para>
54906 <para>
54907 If you want to allocate memory that remains available for subsequent messages
54908 in the same SMTP connection, you should set
54909 </para>
54910 <literallayout class="monospaced">
54911 store_pool = POOL_PERM
54912 </literallayout>
54913 <para>
54914 before calling the function that does the allocation. There is no need to
54915 restore the value if you do not need to; however, if you do want to revert to
54916 the normal pool, you can either restore the previous value of <option>store_pool</option> or
54917 set it explicitly to POOL_MAIN.
54918 </para>
54919 <para>
54920 The pool setting applies to all functions that get dynamic memory, including
54921 <emphasis>expand_string()</emphasis>, <emphasis>store_get()</emphasis>, and the <emphasis>string_xxx()</emphasis> functions.
54922 There is also a convenience function called <emphasis>store_get_perm()</emphasis> that gets a
54923 block of memory from the permanent pool while preserving the value of
54924 <option>store_pool</option>.
54925 <indexterm role="concept" startref="IIDlosca" class="endofrange"/>
54926 </para>
54927 </section>
54928 </chapter>
54929
54930 <chapter id="CHAPsystemfilter">
54931 <title>System-wide message filtering</title>
54932 <para>
54933 <indexterm role="concept" id="IIDsysfil1" class="startofrange">
54934 <primary>filter</primary>
54935 <secondary>system filter</secondary>
54936 </indexterm>
54937 <indexterm role="concept" id="IIDsysfil2" class="startofrange">
54938 <primary>filtering all mail</primary>
54939 </indexterm>
54940 <indexterm role="concept" id="IIDsysfil3" class="startofrange">
54941 <primary>system filter</primary>
54942 </indexterm>
54943 The previous chapters (on ACLs and the local scan function) describe checks
54944 that can be applied to messages before they are accepted by a host. There is
54945 also a mechanism for checking messages once they have been received, but before
54946 they are delivered. This is called the <emphasis>system filter</emphasis>.
54947 </para>
54948 <para>
54949 The system filter operates in a similar manner to users&#x2019; filter files, but it
54950 is run just once per message (however many recipients the message has).
54951 It should not normally be used as a substitute for routing, because <option>deliver</option>
54952 commands in a system router provide new envelope recipient addresses.
54953 The system filter must be an Exim filter. It cannot be a Sieve filter.
54954 </para>
54955 <para>
54956 The system filter is run at the start of a delivery attempt, before any routing
54957 is done. If a message fails to be completely delivered at the first attempt,
54958 the system filter is run again at the start of every retry.
54959 If you want your filter to do something only once per message, you can make use
54960 of the <option>first_delivery</option> condition in an <option>if</option> command in the filter to
54961 prevent it happening on retries.
54962 </para>
54963 <para>
54964 <indexterm role="variable">
54965 <primary><varname>$domain</varname></primary>
54966 </indexterm>
54967 <indexterm role="variable">
54968 <primary><varname>$local_part</varname></primary>
54969 </indexterm>
54970 <emphasis role="bold">Warning</emphasis>: Because the system filter runs just once, variables that are
54971 specific to individual recipient addresses, such as <varname>$local_part</varname> and
54972 <varname>$domain</varname>, are not set, and the <quote>personal</quote> condition is not meaningful. If
54973 you want to run a centrally-specified filter for each recipient address
54974 independently, you can do so by setting up a suitable <command>redirect</command> router, as
54975 described in section <xref linkend="SECTperaddfil"/> below.
54976 </para>
54977 <section id="SECID212">
54978 <title>Specifying a system filter</title>
54979 <para>
54980 <indexterm role="concept">
54981 <primary>uid (user id)</primary>
54982 <secondary>system filter</secondary>
54983 </indexterm>
54984 <indexterm role="concept">
54985 <primary>gid (group id)</primary>
54986 <secondary>system filter</secondary>
54987 </indexterm>
54988 The name of the file that contains the system filter must be specified by
54989 setting <option>system_filter</option>. If you want the filter to run under a uid and gid
54990 other than root, you must also set <option>system_filter_user</option> and
54991 <option>system_filter_group</option> as appropriate. For example:
54992 </para>
54993 <literallayout class="monospaced">
54994 system_filter = /etc/mail/exim.filter
54995 system_filter_user = exim
54996 </literallayout>
54997 <para>
54998 If a system filter generates any deliveries directly to files or pipes (via the
54999 <option>save</option> or <option>pipe</option> commands), transports to handle these deliveries must be
55000 specified by setting <option>system_filter_file_transport</option> and
55001 <option>system_filter_pipe_transport</option>, respectively. Similarly,
55002 <option>system_filter_reply_transport</option> must be set to handle any messages generated
55003 by the <option>reply</option> command.
55004 </para>
55005 </section>
55006 <section id="SECID213">
55007 <title>Testing a system filter</title>
55008 <para>
55009 You can run simple tests of a system filter in the same way as for a user
55010 filter, but you should use <option>-bF</option> rather than <option>-bf</option>, so that features that
55011 are permitted only in system filters are recognized.
55012 </para>
55013 <para>
55014 If you want to test the combined effect of a system filter and a user filter,
55015 you can use both <option>-bF</option> and <option>-bf</option> on the same command line.
55016 </para>
55017 </section>
55018 <section id="SECID214">
55019 <title>Contents of a system filter</title>
55020 <para>
55021 The language used to specify system filters is the same as for users&#x2019; filter
55022 files. It is described in the separate end-user document <emphasis>Exim&#x2019;s interface to
55023 mail filtering</emphasis>. However, there are some additional features that are
55024 available only in system filters; these are described in subsequent sections.
55025 If they are encountered in a user&#x2019;s filter file or when testing with <option>-bf</option>,
55026 they cause errors.
55027 </para>
55028 <para>
55029 <indexterm role="concept">
55030 <primary>frozen messages</primary>
55031 <secondary>manual thaw; testing in filter</secondary>
55032 </indexterm>
55033 There are two special conditions which, though available in users&#x2019; filter
55034 files, are designed for use in system filters. The condition <option>first_delivery</option>
55035 is true only for the first attempt at delivering a message, and
55036 <option>manually_thawed</option> is true only if the message has been frozen, and
55037 subsequently thawed by an admin user. An explicit forced delivery counts as a
55038 manual thaw, but thawing as a result of the <option>auto_thaw</option> setting does not.
55039 </para>
55040 <para>
55041 <emphasis role="bold">Warning</emphasis>: If a system filter uses the <option>first_delivery</option> condition to
55042 specify an <quote>unseen</quote> (non-significant) delivery, and that delivery does not
55043 succeed, it will not be tried again.
55044 If you want Exim to retry an unseen delivery until it succeeds, you should
55045 arrange to set it up every time the filter runs.
55046 </para>
55047 <para>
55048 When a system filter finishes running, the values of the variables <varname>$n0</varname> &ndash;
55049 <varname>$n9</varname> are copied into <varname>$sn0</varname> &ndash; <varname>$sn9</varname> and are thereby made available to
55050 users&#x2019; filter files. Thus a system filter can, for example, set up <quote>scores</quote>
55051 to which users&#x2019; filter files can refer.
55052 </para>
55053 </section>
55054 <section id="SECID215">
55055 <title>Additional variable for system filters</title>
55056 <para>
55057 <indexterm role="variable">
55058 <primary><varname>$recipients</varname></primary>
55059 </indexterm>
55060 The expansion variable <varname>$recipients</varname>, containing a list of all the recipients
55061 of the message (separated by commas and white space), is available in system
55062 filters. It is not available in users&#x2019; filters for privacy reasons.
55063 </para>
55064 </section>
55065 <section id="SECID216">
55066 <title>Defer, freeze, and fail commands for system filters</title>
55067 <para>
55068 <indexterm role="concept">
55069 <primary>freezing messages</primary>
55070 </indexterm>
55071 <indexterm role="concept">
55072 <primary>message</primary>
55073 <secondary>freezing</secondary>
55074 </indexterm>
55075 <indexterm role="concept">
55076 <primary>message</primary>
55077 <secondary>forced failure</secondary>
55078 </indexterm>
55079 <indexterm role="concept">
55080 <primary><option>fail</option></primary>
55081 <secondary>in system filter</secondary>
55082 </indexterm>
55083 <indexterm role="concept">
55084 <primary><option>freeze</option> in system filter</primary>
55085 </indexterm>
55086 <indexterm role="concept">
55087 <primary><option>defer</option> in system filter</primary>
55088 </indexterm>
55089 There are three extra commands (<option>defer</option>, <option>freeze</option> and <option>fail</option>) which are
55090 always available in system filters, but are not normally enabled in users&#x2019;
55091 filters. (See the <option>allow_defer</option>, <option>allow_freeze</option> and <option>allow_fail</option> options
55092 for the <command>redirect</command> router.) These commands can optionally be followed by the
55093 word <option>text</option> and a string containing an error message, for example:
55094 </para>
55095 <literallayout class="monospaced">
55096 fail text "this message looks like spam to me"
55097 </literallayout>
55098 <para>
55099 The keyword <option>text</option> is optional if the next character is a double quote.
55100 </para>
55101 <para>
55102 The <option>defer</option> command defers delivery of the original recipients of the
55103 message. The <option>fail</option> command causes all the original recipients to be failed,
55104 and a bounce message to be created. The <option>freeze</option> command suspends all
55105 delivery attempts for the original recipients. In all cases, any new deliveries
55106 that are specified by the filter are attempted as normal after the filter has
55107 run.
55108 </para>
55109 <para>
55110 The <option>freeze</option> command is ignored if the message has been manually unfrozen and
55111 not manually frozen since. This means that automatic freezing by a system
55112 filter can be used as a way of checking out suspicious messages. If a message
55113 is found to be all right, manually unfreezing it allows it to be delivered.
55114 </para>
55115 <para>
55116 <indexterm role="concept">
55117 <primary>log</primary>
55118 <secondary><option>fail</option> command log line</secondary>
55119 </indexterm>
55120 <indexterm role="concept">
55121 <primary><option>fail</option></primary>
55122 <secondary>log line; reducing</secondary>
55123 </indexterm>
55124 The text given with a fail command is used as part of the bounce message as
55125 well as being written to the log. If the message is quite long, this can fill
55126 up a lot of log space when such failures are common. To reduce the size of the
55127 log message, Exim interprets the text in a special way if it starts with the
55128 two characters <literal>&lt;&lt;</literal> and contains <literal>&gt;&gt;</literal> later. The text between these two
55129 strings is written to the log, and the rest of the text is used in the bounce
55130 message. For example:
55131 </para>
55132 <literallayout class="monospaced">
55133 fail "&lt;&lt;filter test 1&gt;&gt;Your message is rejected \
55134      because it contains attachments that we are \
55135      not prepared to receive."
55136 </literallayout>
55137 <para>
55138 <indexterm role="concept">
55139 <primary>loop</primary>
55140 <secondary>caused by <option>fail</option></secondary>
55141 </indexterm>
55142 Take great care with the <option>fail</option> command when basing the decision to fail on
55143 the contents of the message, because the bounce message will of course include
55144 the contents of the original message and will therefore trigger the <option>fail</option>
55145 command again (causing a mail loop) unless steps are taken to prevent this.
55146 Testing the <option>error_message</option> condition is one way to prevent this. You could
55147 use, for example
55148 </para>
55149 <literallayout class="monospaced">
55150 if $message_body contains "this is spam" and not error_message
55151 then fail text "spam is not wanted here" endif
55152 </literallayout>
55153 <para>
55154 though of course that might let through unwanted bounce messages. The
55155 alternative is clever checking of the body and/or headers to detect bounces
55156 generated by the filter.
55157 </para>
55158 <para>
55159 The interpretation of a system filter file ceases after a
55160 <option>defer</option>,
55161 <option>freeze</option>, or <option>fail</option> command is obeyed. However, any deliveries that were
55162 set up earlier in the filter file are honoured, so you can use a sequence such
55163 as
55164 </para>
55165 <literallayout class="monospaced">
55166 mail ...
55167 freeze
55168 </literallayout>
55169 <para>
55170 to send a specified message when the system filter is freezing (or deferring or
55171 failing) a message. The normal deliveries for the message do not, of course,
55172 take place.
55173 </para>
55174 </section>
55175 <section id="SECTaddremheasys">
55176 <title>Adding and removing headers in a system filter</title>
55177 <para>
55178 <indexterm role="concept">
55179 <primary>header lines</primary>
55180 <secondary>adding; in system filter</secondary>
55181 </indexterm>
55182 <indexterm role="concept">
55183 <primary>header lines</primary>
55184 <secondary>removing; in system filter</secondary>
55185 </indexterm>
55186 <indexterm role="concept">
55187 <primary>filter</primary>
55188 <secondary>header lines; adding/removing</secondary>
55189 </indexterm>
55190 Two filter commands that are available only in system filters are:
55191 </para>
55192 <literallayout class="monospaced">
55193 headers add &lt;string&gt;
55194 headers remove &lt;string&gt;
55195 </literallayout>
55196 <para>
55197 The argument for the <option>headers add</option> is a string that is expanded and then
55198 added to the end of the message&#x2019;s headers. It is the responsibility of the
55199 filter maintainer to make sure it conforms to RFC 2822 syntax. Leading white
55200 space is ignored, and if the string is otherwise empty, or if the expansion is
55201 forced to fail, the command has no effect.
55202 </para>
55203 <para>
55204 You can use <quote>\n</quote> within the string, followed by white space, to specify
55205 continued header lines. More than one header may be added in one command by
55206 including <quote>\n</quote> within the string without any following white space. For
55207 example:
55208 </para>
55209 <literallayout class="monospaced">
55210 headers add "X-header-1: ....\n  \
55211              continuation of X-header-1 ...\n\
55212              X-header-2: ...."
55213 </literallayout>
55214 <para>
55215 Note that the header line continuation white space after the first newline must
55216 be placed before the backslash that continues the input string, because white
55217 space after input continuations is ignored.
55218 </para>
55219 <para>
55220 The argument for <option>headers remove</option> is a colon-separated list of header names.
55221 This command applies only to those headers that are stored with the message;
55222 those that are added at delivery time (such as <emphasis>Envelope-To:</emphasis> and
55223 <emphasis>Return-Path:</emphasis>) cannot be removed by this means. If there is more than one
55224 header with the same name, they are all removed.
55225 </para>
55226 <para>
55227 The <option>headers</option> command in a system filter makes an immediate change to the set
55228 of header lines that was received with the message (with possible additions
55229 from ACL processing). Subsequent commands in the system filter operate on the
55230 modified set, which also forms the basis for subsequent message delivery.
55231 Unless further modified during routing or transporting, this set of headers is
55232 used for all recipients of the message.
55233 </para>
55234 <para>
55235 During routing and transporting, the variables that refer to the contents of
55236 header lines refer only to those lines that are in this set. Thus, header lines
55237 that are added by a system filter are visible to users&#x2019; filter files and to all
55238 routers and transports. This contrasts with the manipulation of header lines by
55239 routers and transports, which is not immediate, but which instead is saved up
55240 until the message is actually being written (see section
55241 <xref linkend="SECTheadersaddrem"/>).
55242 </para>
55243 <para>
55244 If the message is not delivered at the first attempt, header lines that were
55245 added by the system filter are stored with the message, and so are still
55246 present at the next delivery attempt. Header lines that were removed are still
55247 present, but marked <quote>deleted</quote> so that they are not transported with the
55248 message. For this reason, it is usual to make the <option>headers</option> command
55249 conditional on <option>first_delivery</option> so that the set of header lines is not
55250 modified more than once.
55251 </para>
55252 <para>
55253 Because header modification in a system filter acts immediately, you have to
55254 use an indirect approach if you want to modify the contents of a header line.
55255 For example:
55256 </para>
55257 <literallayout class="monospaced">
55258 headers add "Old-Subject: $h_subject:"
55259 headers remove "Subject"
55260 headers add "Subject: new subject (was: $h_old-subject:)"
55261 headers remove "Old-Subject"
55262 </literallayout>
55263 </section>
55264 <section id="SECID217">
55265 <title>Setting an errors address in a system filter</title>
55266 <para>
55267 <indexterm role="concept">
55268 <primary>envelope sender</primary>
55269 </indexterm>
55270 In a system filter, if a <option>deliver</option> command is followed by
55271 </para>
55272 <literallayout class="monospaced">
55273 errors_to &lt;some address&gt;
55274 </literallayout>
55275 <para>
55276 in order to change the envelope sender (and hence the error reporting) for that
55277 delivery, any address may be specified. (In a user filter, only the current
55278 user&#x2019;s address can be set.) For example, if some mail is being monitored, you
55279 might use
55280 </para>
55281 <literallayout class="monospaced">
55282 unseen deliver monitor@spying.example errors_to root@local.example
55283 </literallayout>
55284 <para>
55285 to take a copy which would not be sent back to the normal error reporting
55286 address if its delivery failed.
55287 </para>
55288 </section>
55289 <section id="SECTperaddfil">
55290 <title>Per-address filtering</title>
55291 <para>
55292 <indexterm role="variable">
55293 <primary><varname>$domain</varname></primary>
55294 </indexterm>
55295 <indexterm role="variable">
55296 <primary><varname>$local_part</varname></primary>
55297 </indexterm>
55298 In contrast to the system filter, which is run just once per message for each
55299 delivery attempt, it is also possible to set up a system-wide filtering
55300 operation that runs once for each recipient address. In this case, variables
55301 such as <varname>$local_part</varname> and <varname>$domain</varname> can be used, and indeed, the choice of
55302 filter file could be made dependent on them. This is an example of a router
55303 which implements such a filter:
55304 </para>
55305 <literallayout class="monospaced">
55306 central_filter:
55307   check_local_user
55308   driver = redirect
55309   domains = +local_domains
55310   file = /central/filters/$local_part
55311   no_verify
55312   allow_filter
55313   allow_freeze
55314 </literallayout>
55315 <para>
55316 The filter is run in a separate process under its own uid. Therefore, either
55317 <option>check_local_user</option> must be set (as above), in which case the filter is run as
55318 the local user, or the <option>user</option> option must be used to specify which user to
55319 use. If both are set, <option>user</option> overrides.
55320 </para>
55321 <para>
55322 Care should be taken to ensure that none of the commands in the filter file
55323 specify a significant delivery if the message is to go on to be delivered to
55324 its intended recipient. The router will not then claim to have dealt with the
55325 address, so it will be passed on to subsequent routers to be delivered in the
55326 normal way.
55327 <indexterm role="concept" startref="IIDsysfil1" class="endofrange"/>
55328 <indexterm role="concept" startref="IIDsysfil2" class="endofrange"/>
55329 <indexterm role="concept" startref="IIDsysfil3" class="endofrange"/>
55330 </para>
55331 </section>
55332 </chapter>
55333
55334 <chapter id="CHAPmsgproc">
55335 <title>Message processing</title>
55336 <para>
55337 <indexterm role="concept" id="IIDmesproc" class="startofrange">
55338 <primary>message</primary>
55339 <secondary>general processing</secondary>
55340 </indexterm>
55341 Exim performs various transformations on the sender and recipient addresses of
55342 all messages that it handles, and also on the messages&#x2019; header lines. Some of
55343 these are optional and configurable, while others always take place. All of
55344 this processing, except rewriting as a result of routing, and the addition or
55345 removal of header lines while delivering, happens when a message is received,
55346 before it is placed on Exim&#x2019;s queue.
55347 </para>
55348 <para>
55349 Some of the automatic processing takes place by default only for
55350 <quote>locally-originated</quote> messages. This adjective is used to describe messages
55351 that are not received over TCP/IP, but instead are passed to an Exim process on
55352 its standard input. This includes the interactive <quote>local SMTP</quote> case that is
55353 set up by the <option>-bs</option> command line option.
55354 </para>
55355 <para>
55356 <emphasis role="bold">Note</emphasis>: Messages received over TCP/IP on the loopback interface (127.0.0.1
55357 or ::1) are not considered to be locally-originated. Exim does not treat the
55358 loopback interface specially in any way.
55359 </para>
55360 <para>
55361 If you want the loopback interface to be treated specially, you must ensure
55362 that there are appropriate entries in your ACLs.
55363 </para>
55364 <section id="SECTsubmodnon">
55365 <title>Submission mode for non-local messages</title>
55366 <para>
55367 <indexterm role="concept">
55368 <primary>message</primary>
55369 <secondary>submission</secondary>
55370 </indexterm>
55371 <indexterm role="concept">
55372 <primary>submission mode</primary>
55373 </indexterm>
55374 Processing that happens automatically for locally-originated messages (unless
55375 <option>suppress_local_fixups</option> is set) can also be requested for messages that are
55376 received over TCP/IP. The term <quote>submission mode</quote> is used to describe this
55377 state. Submission mode is set by the modifier
55378 </para>
55379 <literallayout class="monospaced">
55380 control = submission
55381 </literallayout>
55382 <para>
55383 in a MAIL, RCPT, or pre-data ACL for an incoming message (see sections
55384 <xref linkend="SECTACLmodi"/> and <xref linkend="SECTcontrols"/>). This makes Exim treat the message as
55385 a local submission, and is normally used when the source of the message is
55386 known to be an MUA running on a client host (as opposed to an MTA). For
55387 example, to set submission mode for messages originating on the IPv4 loopback
55388 interface, you could include the following in the MAIL ACL:
55389 </para>
55390 <literallayout class="monospaced">
55391 warn  hosts = 127.0.0.1
55392       control = submission
55393 </literallayout>
55394 <para>
55395 <indexterm role="concept">
55396 <primary><option>sender_retain</option> submission option</primary>
55397 </indexterm>
55398 There are some options that can be used when setting submission mode. A slash
55399 is used to separate options. For example:
55400 </para>
55401 <literallayout class="monospaced">
55402 control = submission/sender_retain
55403 </literallayout>
55404 <para>
55405 Specifying <option>sender_retain</option> has the effect of setting <option>local_sender_retain</option>
55406 true and <option>local_from_check</option> false for the current incoming message. The first
55407 of these allows an existing <emphasis>Sender:</emphasis> header in the message to remain, and
55408 the second suppresses the check to ensure that <emphasis>From:</emphasis> matches the
55409 authenticated sender. With this setting, Exim still fixes up messages by adding
55410 <emphasis>Date:</emphasis> and <emphasis>Message-ID:</emphasis> header lines if they are missing, but makes no
55411 attempt to check sender authenticity in header lines.
55412 </para>
55413 <para>
55414 When <option>sender_retain</option> is not set, a submission mode setting may specify a
55415 domain to be used when generating a <emphasis>From:</emphasis> or <emphasis>Sender:</emphasis> header line. For
55416 example:
55417 </para>
55418 <literallayout class="monospaced">
55419 control = submission/domain=some.domain
55420 </literallayout>
55421 <para>
55422 The domain may be empty. How this value is used is described in sections
55423 <xref linkend="SECTthefrohea"/> and <xref linkend="SECTthesenhea"/>. There is also a <option>name</option> option
55424 that allows you to specify the user&#x2019;s full name for inclusion in a created
55425 <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis> header line. For example:
55426 </para>
55427 <literallayout class="monospaced">
55428 accept authenticated = *
55429        control = submission/domain=wonderland.example/\
55430                             name=${lookup {$authenticated_id} \
55431                                    lsearch {/etc/exim/namelist}}
55432 </literallayout>
55433 <para>
55434 Because the name may contain any characters, including slashes, the <option>name</option>
55435 option must be given last. The remainder of the string is used as the name. For
55436 the example above, if <filename>/etc/exim/namelist</filename> contains:
55437 </para>
55438 <literallayout class="monospaced">
55439 bigegg:  Humpty Dumpty
55440 </literallayout>
55441 <para>
55442 then when the sender has authenticated as <emphasis>bigegg</emphasis>, the generated <emphasis>Sender:</emphasis>
55443 line would be:
55444 </para>
55445 <literallayout class="monospaced">
55446 Sender: Humpty Dumpty &lt;bigegg@wonderland.example&gt;
55447 </literallayout>
55448 <para>
55449 <indexterm role="concept">
55450 <primary>return path</primary>
55451 <secondary>in submission mode</secondary>
55452 </indexterm>
55453 By default, submission mode forces the return path to the same address as is
55454 used to create the <emphasis>Sender:</emphasis> header. However, if <option>sender_retain</option> is
55455 specified, the return path is also left unchanged.
55456 </para>
55457 <para>
55458 <emphasis role="bold">Note</emphasis>: The changes caused by submission mode take effect after the predata
55459 ACL. This means that any sender checks performed before the fix-ups use the
55460 untrusted sender address specified by the user, not the trusted sender address
55461 specified by submission mode. Although this might be slightly unexpected, it
55462 does mean that you can configure ACL checks to spot that a user is trying to
55463 spoof another&#x2019;s address.
55464 </para>
55465 </section>
55466 <section id="SECTlineendings">
55467 <title>Line endings</title>
55468 <para>
55469 <indexterm role="concept">
55470 <primary>line endings</primary>
55471 </indexterm>
55472 <indexterm role="concept">
55473 <primary>carriage return</primary>
55474 </indexterm>
55475 <indexterm role="concept">
55476 <primary>linefeed</primary>
55477 </indexterm>
55478 RFC 2821 specifies that CRLF (two characters: carriage-return, followed by
55479 linefeed) is the line ending for messages transmitted over the Internet using
55480 SMTP over TCP/IP. However, within individual operating systems, different
55481 conventions are used. For example, Unix-like systems use just LF, but others
55482 use CRLF or just CR.
55483 </para>
55484 <para>
55485 Exim was designed for Unix-like systems, and internally, it stores messages
55486 using the system&#x2019;s convention of a single LF as a line terminator. When
55487 receiving a message, all line endings are translated to this standard format.
55488 Originally, it was thought that programs that passed messages directly to an
55489 MTA within an operating system would use that system&#x2019;s convention. Experience
55490 has shown that this is not the case; for example, there are Unix applications
55491 that use CRLF in this circumstance. For this reason, and for compatibility with
55492 other MTAs, the way Exim handles line endings for all messages is now as
55493 follows:
55494 </para>
55495 <itemizedlist>
55496 <listitem>
55497 <para>
55498 LF not preceded by CR is treated as a line ending.
55499 </para>
55500 </listitem>
55501 <listitem>
55502 <para>
55503 CR is treated as a line ending; if it is immediately followed by LF, the LF
55504 is ignored.
55505 </para>
55506 </listitem>
55507 <listitem>
55508 <para>
55509 The sequence <quote>CR, dot, CR</quote> does not terminate an incoming SMTP message,
55510 nor a local message in the state where a line containing only a dot is a
55511 terminator.
55512 </para>
55513 </listitem>
55514 <listitem>
55515 <para>
55516 If a bare CR is encountered within a header line, an extra space is added after
55517 the line terminator so as not to end the header line. The reasoning behind this
55518 is that bare CRs in header lines are most likely either to be mistakes, or
55519 people trying to play silly games.
55520 </para>
55521 </listitem>
55522 <listitem>
55523 <para>
55524 If the first header line received in a message ends with CRLF, a subsequent
55525 bare LF in a header line is treated in the same way as a bare CR in a header
55526 line.
55527 </para>
55528 </listitem>
55529 </itemizedlist>
55530 </section>
55531 <section id="SECID218">
55532 <title>Unqualified addresses</title>
55533 <para>
55534 <indexterm role="concept">
55535 <primary>unqualified addresses</primary>
55536 </indexterm>
55537 <indexterm role="concept">
55538 <primary>address</primary>
55539 <secondary>qualification</secondary>
55540 </indexterm>
55541 By default, Exim expects every envelope address it receives from an external
55542 host to be fully qualified. Unqualified addresses cause negative responses to
55543 SMTP commands. However, because SMTP is used as a means of transporting
55544 messages from MUAs running on personal workstations, there is sometimes a
55545 requirement to accept unqualified addresses from specific hosts or IP networks.
55546 </para>
55547 <para>
55548 Exim has two options that separately control which hosts may send unqualified
55549 sender or recipient addresses in SMTP commands, namely
55550 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>. In both
55551 cases, if an unqualified address is accepted, it is qualified by adding the
55552 value of <option>qualify_domain</option> or <option>qualify_recipient</option>, as appropriate.
55553 </para>
55554 <para>
55555 <indexterm role="option">
55556 <primary><option>qualify_domain</option></primary>
55557 </indexterm>
55558 <indexterm role="option">
55559 <primary><option>qualify_recipient</option></primary>
55560 </indexterm>
55561 Unqualified addresses in header lines are automatically qualified for messages
55562 that are locally originated, unless the <option>-bnq</option> option is given on the command
55563 line. For messages received over SMTP, unqualified addresses in header lines
55564 are qualified only if unqualified addresses are permitted in SMTP commands. In
55565 other words, such qualification is also controlled by
55566 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>,
55567 </para>
55568 </section>
55569 <section id="SECID219">
55570 <title>The UUCP From line</title>
55571 <para>
55572 <indexterm role="concept">
55573 <primary><quote>From</quote> line</primary>
55574 </indexterm>
55575 <indexterm role="concept">
55576 <primary>UUCP</primary>
55577 <secondary><quote>From</quote> line</secondary>
55578 </indexterm>
55579 <indexterm role="concept">
55580 <primary>sender</primary>
55581 <secondary>address</secondary>
55582 </indexterm>
55583 <indexterm role="option">
55584 <primary><option>uucp_from_pattern</option></primary>
55585 </indexterm>
55586 <indexterm role="option">
55587 <primary><option>uucp_from_sender</option></primary>
55588 </indexterm>
55589 <indexterm role="concept">
55590 <primary>envelope sender</primary>
55591 </indexterm>
55592 <indexterm role="concept">
55593 <primary>Sendmail compatibility</primary>
55594 <secondary><quote>From</quote> line</secondary>
55595 </indexterm>
55596 Messages that have come from UUCP (and some other applications) often begin
55597 with a line containing the envelope sender and a timestamp, following the word
55598 <quote>From</quote>. Examples of two common formats are:
55599 </para>
55600 <literallayout class="monospaced">
55601 From a.oakley@berlin.mus Fri Jan  5 12:35 GMT 1996
55602 From f.butler@berlin.mus Fri, 7 Jan 97 14:00:00 GMT
55603 </literallayout>
55604 <para>
55605 This line precedes the RFC 2822 header lines. For compatibility with Sendmail,
55606 Exim recognizes such lines at the start of messages that are submitted to it
55607 via the command line (that is, on the standard input). It does not recognize
55608 such lines in incoming SMTP messages, unless the sending host matches
55609 <option>ignore_fromline_hosts</option> or the <option>-bs</option> option was used for a local message
55610 and <option>ignore_fromline_local</option> is set. The recognition is controlled by a
55611 regular expression that is defined by the <option>uucp_from_pattern</option> option, whose
55612 default value matches the two common cases shown above and puts the address
55613 that follows <quote>From</quote> into <varname>$1</varname>.
55614 </para>
55615 <para>
55616 <indexterm role="concept">
55617 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
55618 <secondary>in <quote>From </quote> line handling</secondary>
55619 </indexterm>
55620 When the caller of Exim for a non-SMTP message that contains a <quote>From</quote> line is
55621 a trusted user, the message&#x2019;s sender address is constructed by expanding the
55622 contents of <option>uucp_sender_address</option>, whose default value is <quote>$1</quote>. This is
55623 then parsed as an RFC 2822 address. If there is no domain, the local part is
55624 qualified with <option>qualify_domain</option> unless it is the empty string. However, if
55625 the command line <option>-f</option> option is used, it overrides the <quote>From</quote> line.
55626 </para>
55627 <para>
55628 If the caller of Exim is not trusted, the <quote>From</quote> line is recognized, but the
55629 sender address is not changed. This is also the case for incoming SMTP messages
55630 that are permitted to contain <quote>From</quote> lines.
55631 </para>
55632 <para>
55633 Only one <quote>From</quote> line is recognized. If there is more than one, the second is
55634 treated as a data line that starts the body of the message, as it is not valid
55635 as a header line. This also happens if a <quote>From</quote> line is present in an
55636 incoming SMTP message from a source that is not permitted to send them.
55637 </para>
55638 </section>
55639 <section id="SECID220">
55640 <title>Resent- header lines</title>
55641 <para>
55642 <indexterm role="concept">
55643 <primary><option>Resent-</option> header lines</primary>
55644 </indexterm>
55645 RFC 2822 makes provision for sets of header lines starting with the string
55646 <literal>Resent-</literal> to be added to a message when it is resent by the original
55647 recipient to somebody else. These headers are <emphasis>Resent-Date:</emphasis>,
55648 <emphasis>Resent-From:</emphasis>, <emphasis>Resent-Sender:</emphasis>, <emphasis>Resent-To:</emphasis>, <emphasis>Resent-Cc:</emphasis>,
55649 <emphasis>Resent-Bcc:</emphasis> and <emphasis>Resent-Message-ID:</emphasis>. The RFC says:
55650 </para>
55651 <blockquote>
55652 <para>
55653 <emphasis>Resent fields are strictly informational. They MUST NOT be used in the normal
55654 processing of replies or other such automatic actions on messages.</emphasis>
55655 </para>
55656 </blockquote>
55657 <para>
55658 This leaves things a bit vague as far as other processing actions such as
55659 address rewriting are concerned. Exim treats <option>Resent-</option> header lines as
55660 follows:
55661 </para>
55662 <itemizedlist>
55663 <listitem>
55664 <para>
55665 A <emphasis>Resent-From:</emphasis> line that just contains the login id of the submitting user
55666 is automatically rewritten in the same way as <emphasis>From:</emphasis> (see below).
55667 </para>
55668 </listitem>
55669 <listitem>
55670 <para>
55671 If there&#x2019;s a rewriting rule for a particular header line, it is also applied to
55672 <option>Resent-</option> header lines of the same type. For example, a rule that rewrites
55673 <emphasis>From:</emphasis> also rewrites <emphasis>Resent-From:</emphasis>.
55674 </para>
55675 </listitem>
55676 <listitem>
55677 <para>
55678 For local messages, if <emphasis>Sender:</emphasis> is removed on input, <emphasis>Resent-Sender:</emphasis> is
55679 also removed.
55680 </para>
55681 </listitem>
55682 <listitem>
55683 <para>
55684 For a locally-submitted message,
55685 if there are any <option>Resent-</option> header lines but no <emphasis>Resent-Date:</emphasis>,
55686 <emphasis>Resent-From:</emphasis>, or <emphasis>Resent-Message-Id:</emphasis>, they are added as necessary. It is
55687 the contents of <emphasis>Resent-Message-Id:</emphasis> (rather than <emphasis>Message-Id:</emphasis>) which are
55688 included in log lines in this case.
55689 </para>
55690 </listitem>
55691 <listitem>
55692 <para>
55693 The logic for adding <emphasis>Sender:</emphasis> is duplicated for <emphasis>Resent-Sender:</emphasis> when any
55694 <option>Resent-</option> header lines are present.
55695 </para>
55696 </listitem>
55697 </itemizedlist>
55698 </section>
55699 <section id="SECID221">
55700 <title>The Auto-Submitted: header line</title>
55701 <para>
55702 Whenever Exim generates an autoreply, a bounce, or a delay warning message, it
55703 includes the header line:
55704 </para>
55705 <literallayout class="monospaced">
55706 Auto-Submitted: auto-replied
55707 </literallayout>
55708 </section>
55709 <section id="SECID222">
55710 <title>The Bcc: header line</title>
55711 <para>
55712 <indexterm role="concept">
55713 <primary><emphasis>Bcc:</emphasis> header line</primary>
55714 </indexterm>
55715 If Exim is called with the <option>-t</option> option, to take recipient addresses from a
55716 message&#x2019;s header, it removes any <emphasis>Bcc:</emphasis> header line that may exist (after
55717 extracting its addresses). If <option>-t</option> is not present on the command line, any
55718 existing <emphasis>Bcc:</emphasis> is not removed.
55719 </para>
55720 </section>
55721 <section id="SECID223">
55722 <title>The Date: header line</title>
55723 <para>
55724 <indexterm role="concept">
55725 <primary><emphasis>Date:</emphasis> header line</primary>
55726 </indexterm>
55727 If a locally-generated or submission-mode message has no <emphasis>Date:</emphasis> header line,
55728 Exim adds one, using the current date and time, unless the
55729 <option>suppress_local_fixups</option> control has been specified.
55730 </para>
55731 </section>
55732 <section id="SECID224">
55733 <title>The Delivery-date: header line</title>
55734 <para>
55735 <indexterm role="concept">
55736 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
55737 </indexterm>
55738 <indexterm role="option">
55739 <primary><option>delivery_date_remove</option></primary>
55740 </indexterm>
55741 <emphasis>Delivery-date:</emphasis> header lines are not part of the standard RFC 2822 header
55742 set. Exim can be configured to add them to the final delivery of messages. (See
55743 the generic <option>delivery_date_add</option> transport option.) They should not be present
55744 in messages in transit. If the <option>delivery_date_remove</option> configuration option is
55745 set (the default), Exim removes <emphasis>Delivery-date:</emphasis> header lines from incoming
55746 messages.
55747 </para>
55748 </section>
55749 <section id="SECID225">
55750 <title>The Envelope-to: header line</title>
55751 <para>
55752 <indexterm role="concept">
55753 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
55754 </indexterm>
55755 <indexterm role="option">
55756 <primary><option>envelope_to_remove</option></primary>
55757 </indexterm>
55758 <emphasis>Envelope-to:</emphasis> header lines are not part of the standard RFC 2822 header set.
55759 Exim can be configured to add them to the final delivery of messages. (See the
55760 generic <option>envelope_to_add</option> transport option.) They should not be present in
55761 messages in transit. If the <option>envelope_to_remove</option> configuration option is set
55762 (the default), Exim removes <emphasis>Envelope-to:</emphasis> header lines from incoming
55763 messages.
55764 </para>
55765 </section>
55766 <section id="SECTthefrohea">
55767 <title>The From: header line</title>
55768 <para>
55769 <indexterm role="concept">
55770 <primary><emphasis>From:</emphasis> header line</primary>
55771 </indexterm>
55772 <indexterm role="concept">
55773 <primary>Sendmail compatibility</primary>
55774 <secondary><quote>From</quote> line</secondary>
55775 </indexterm>
55776 <indexterm role="concept">
55777 <primary>message</primary>
55778 <secondary>submission</secondary>
55779 </indexterm>
55780 <indexterm role="concept">
55781 <primary>submission mode</primary>
55782 </indexterm>
55783 If a submission-mode message does not contain a <emphasis>From:</emphasis> header line, Exim
55784 adds one if either of the following conditions is true:
55785 </para>
55786 <itemizedlist>
55787 <listitem>
55788 <para>
55789 The envelope sender address is not empty (that is, this is not a bounce
55790 message). The added header line copies the envelope sender address.
55791 </para>
55792 </listitem>
55793 <listitem>
55794 <para>
55795 <indexterm role="variable">
55796 <primary><varname>$authenticated_id</varname></primary>
55797 </indexterm>
55798 The SMTP session is authenticated and <varname>$authenticated_id</varname> is not empty.
55799 </para>
55800 <orderedlist numeration="arabic">
55801 <listitem>
55802 <para>
55803 <indexterm role="variable">
55804 <primary><varname>$qualify_domain</varname></primary>
55805 </indexterm>
55806 If no domain is specified by the submission control, the local part is
55807 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
55808 </para>
55809 </listitem>
55810 <listitem>
55811 <para>
55812 If a non-empty domain is specified by the submission control, the local
55813 part is <varname>$authenticated_id</varname>, and the domain is the specified domain.
55814 </para>
55815 </listitem>
55816 <listitem>
55817 <para>
55818 If an empty domain is specified by the submission control,
55819 <varname>$authenticated_id</varname> is assumed to be the complete address.
55820 </para>
55821 </listitem>
55822 </orderedlist>
55823 </listitem>
55824 </itemizedlist>
55825 <para>
55826 A non-empty envelope sender takes precedence.
55827 </para>
55828 <para>
55829 If a locally-generated incoming message does not contain a <emphasis>From:</emphasis> header
55830 line, and the <option>suppress_local_fixups</option> control is not set, Exim adds one
55831 containing the sender&#x2019;s address. The calling user&#x2019;s login name and full name
55832 are used to construct the address, as described in section <xref linkend="SECTconstr"/>.
55833 They are obtained from the password data by calling <function>getpwuid()</function> (but see the
55834 <option>unknown_login</option> configuration option). The address is qualified with
55835 <option>qualify_domain</option>.
55836 </para>
55837 <para>
55838 For compatibility with Sendmail, if an incoming, non-SMTP message has a
55839 <emphasis>From:</emphasis> header line containing just the unqualified login name of the calling
55840 user, this is replaced by an address containing the user&#x2019;s login name and full
55841 name as described in section <xref linkend="SECTconstr"/>.
55842 </para>
55843 </section>
55844 <section id="SECID226">
55845 <title>The Message-ID: header line</title>
55846 <para>
55847 <indexterm role="concept">
55848 <primary><emphasis>Message-ID:</emphasis> header line</primary>
55849 </indexterm>
55850 <indexterm role="concept">
55851 <primary>message</primary>
55852 <secondary>submission</secondary>
55853 </indexterm>
55854 <indexterm role="option">
55855 <primary><option>message_id_header_text</option></primary>
55856 </indexterm>
55857 If a locally-generated or submission-mode incoming message does not contain a
55858 <emphasis>Message-ID:</emphasis> or <emphasis>Resent-Message-ID:</emphasis> header line, and the
55859 <option>suppress_local_fixups</option> control is not set, Exim adds a suitable header line
55860 to the message. If there are any <emphasis>Resent-:</emphasis> headers in the message, it
55861 creates <emphasis>Resent-Message-ID:</emphasis>. The id is constructed from Exim&#x2019;s internal
55862 message id, preceded by the letter E to ensure it starts with a letter, and
55863 followed by @ and the primary host name. Additional information can be included
55864 in this header line by setting the <option>message_id_header_text</option> and/or
55865 <option>message_id_header_domain</option> options.
55866 </para>
55867 </section>
55868 <section id="SECID227">
55869 <title>The Received: header line</title>
55870 <para>
55871 <indexterm role="concept">
55872 <primary><emphasis>Received:</emphasis> header line</primary>
55873 </indexterm>
55874 A <emphasis>Received:</emphasis> header line is added at the start of every message. The
55875 contents are defined by the <option>received_header_text</option> configuration option, and
55876 Exim automatically adds a semicolon and a timestamp to the configured string.
55877 </para>
55878 <para>
55879 The <emphasis>Received:</emphasis> header is generated as soon as the message&#x2019;s header lines
55880 have been received. At this stage, the timestamp in the <emphasis>Received:</emphasis> header
55881 line is the time that the message started to be received. This is the value
55882 that is seen by the DATA ACL and by the <function>local_scan()</function> function.
55883 </para>
55884 <para>
55885 Once a message is accepted, the timestamp in the <emphasis>Received:</emphasis> header line is
55886 changed to the time of acceptance, which is (apart from a small delay while the
55887 -H spool file is written) the earliest time at which delivery could start.
55888 </para>
55889 </section>
55890 <section id="SECID228">
55891 <title>The References: header line</title>
55892 <para>
55893 <indexterm role="concept">
55894 <primary><emphasis>References:</emphasis> header line</primary>
55895 </indexterm>
55896 Messages created by the <command>autoreply</command> transport include a <emphasis>References:</emphasis>
55897 header line. This is constructed according to the rules that are described in
55898 section 3.64 of RFC 2822 (which states that replies should contain such a
55899 header line), and section 3.14 of RFC 3834 (which states that automatic
55900 responses are not different in this respect). However, because some mail
55901 processing software does not cope well with very long header lines, no more
55902 than 12 message IDs are copied from the <emphasis>References:</emphasis> header line in the
55903 incoming message. If there are more than 12, the first one and then the final
55904 11 are copied, before adding the message ID of the incoming message.
55905 </para>
55906 </section>
55907 <section id="SECID229">
55908 <title>The Return-path: header line</title>
55909 <para>
55910 <indexterm role="concept">
55911 <primary><emphasis>Return-path:</emphasis> header line</primary>
55912 </indexterm>
55913 <indexterm role="option">
55914 <primary><option>return_path_remove</option></primary>
55915 </indexterm>
55916 <emphasis>Return-path:</emphasis> header lines are defined as something an MTA may insert when
55917 it does the final delivery of messages. (See the generic <option>return_path_add</option>
55918 transport option.) Therefore, they should not be present in messages in
55919 transit. If the <option>return_path_remove</option> configuration option is set (the
55920 default), Exim removes <emphasis>Return-path:</emphasis> header lines from incoming messages.
55921 </para>
55922 </section>
55923 <section id="SECTthesenhea">
55924 <title>The Sender: header line</title>
55925 <para>
55926 <indexterm role="concept">
55927 <primary><emphasis>Sender:</emphasis> header line</primary>
55928 </indexterm>
55929 <indexterm role="concept">
55930 <primary>message</primary>
55931 <secondary>submission</secondary>
55932 </indexterm>
55933 For a locally-originated message from an untrusted user, Exim may remove an
55934 existing <emphasis>Sender:</emphasis> header line, and it may add a new one. You can modify
55935 these actions by setting the <option>local_sender_retain</option> option true, the
55936 <option>local_from_check</option> option false, or by using the <option>suppress_local_fixups</option>
55937 control setting.
55938 </para>
55939 <para>
55940 When a local message is received from an untrusted user and
55941 <option>local_from_check</option> is true (the default), and the <option>suppress_local_fixups</option>
55942 control has not been set, a check is made to see if the address given in the
55943 <emphasis>From:</emphasis> header line is the correct (local) sender of the message. The address
55944 that is expected has the login name as the local part and the value of
55945 <option>qualify_domain</option> as the domain. Prefixes and suffixes for the local part can
55946 be permitted by setting <option>local_from_prefix</option> and <option>local_from_suffix</option>
55947 appropriately. If <emphasis>From:</emphasis> does not contain the correct sender, a <emphasis>Sender:</emphasis>
55948 line is added to the message.
55949 </para>
55950 <para>
55951 If you set <option>local_from_check</option> false, this checking does not occur. However,
55952 the removal of an existing <emphasis>Sender:</emphasis> line still happens, unless you also set
55953 <option>local_sender_retain</option> to be true. It is not possible to set both of these
55954 options true at the same time.
55955 </para>
55956 <para>
55957 <indexterm role="concept">
55958 <primary>submission mode</primary>
55959 </indexterm>
55960 By default, no processing of <emphasis>Sender:</emphasis> header lines is done for messages
55961 received over TCP/IP or for messages submitted by trusted users. However, when
55962 a message is received over TCP/IP in submission mode, and <option>sender_retain</option> is
55963 not specified on the submission control, the following processing takes place:
55964 </para>
55965 <para>
55966 <indexterm role="variable">
55967 <primary><varname>$authenticated_id</varname></primary>
55968 </indexterm>
55969 First, any existing <emphasis>Sender:</emphasis> lines are removed. Then, if the SMTP session is
55970 authenticated, and <varname>$authenticated_id</varname> is not empty, a sender address is
55971 created as follows:
55972 </para>
55973 <itemizedlist>
55974 <listitem>
55975 <para>
55976 <indexterm role="variable">
55977 <primary><varname>$qualify_domain</varname></primary>
55978 </indexterm>
55979 If no domain is specified by the submission control, the local part is
55980 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
55981 </para>
55982 </listitem>
55983 <listitem>
55984 <para>
55985 If a non-empty domain is specified by the submission control, the local part
55986 is <varname>$authenticated_id</varname>, and the domain is the specified domain.
55987 </para>
55988 </listitem>
55989 <listitem>
55990 <para>
55991 If an empty domain is specified by the submission control,
55992 <varname>$authenticated_id</varname> is assumed to be the complete address.
55993 </para>
55994 </listitem>
55995 </itemizedlist>
55996 <para>
55997 This address is compared with the address in the <emphasis>From:</emphasis> header line. If they
55998 are different, a <emphasis>Sender:</emphasis> header line containing the created address is
55999 added. Prefixes and suffixes for the local part in <emphasis>From:</emphasis> can be permitted
56000 by setting <option>local_from_prefix</option> and <option>local_from_suffix</option> appropriately.
56001 </para>
56002 <para>
56003 <indexterm role="concept">
56004 <primary>return path</primary>
56005 <secondary>created from <emphasis>Sender:</emphasis></secondary>
56006 </indexterm>
56007 <emphasis role="bold">Note</emphasis>: Whenever a <emphasis>Sender:</emphasis> header line is created, the return path for
56008 the message (the envelope sender address) is changed to be the same address,
56009 except in the case of submission mode when <option>sender_retain</option> is specified.
56010 </para>
56011 </section>
56012 <section id="SECTheadersaddrem">
56013 <title>Adding and removing header lines in routers and transports</title>
56014 <para>
56015 <indexterm role="concept">
56016 <primary>header lines</primary>
56017 <secondary>adding; in router or transport</secondary>
56018 </indexterm>
56019 <indexterm role="concept">
56020 <primary>header lines</primary>
56021 <secondary>removing; in router or transport</secondary>
56022 </indexterm>
56023 When a message is delivered, the addition and removal of header lines can be
56024 specified in a system filter, or on any of the routers and transports that
56025 process the message. Section <xref linkend="SECTaddremheasys"/> contains details about
56026 modifying headers in a system filter. Header lines can also be added in an ACL
56027 as a message is received (see section <xref linkend="SECTaddheadacl"/>).
56028 </para>
56029 <para>
56030 In contrast to what happens in a system filter, header modifications that are
56031 specified on routers and transports apply only to the particular recipient
56032 addresses that are being processed by those routers and transports. These
56033 changes do not actually take place until a copy of the message is being
56034 transported. Therefore, they do not affect the basic set of header lines, and
56035 they do not affect the values of the variables that refer to header lines.
56036 </para>
56037 <para>
56038 <emphasis role="bold">Note</emphasis>: In particular, this means that any expansions in the configuration of
56039 the transport cannot refer to the modified header lines, because such
56040 expansions all occur before the message is actually transported.
56041 </para>
56042 <para>
56043 For both routers and transports, the result of expanding a <option>headers_add</option>
56044 option must be in the form of one or more RFC 2822 header lines, separated by
56045 newlines (coded as <quote>\n</quote>). For example:
56046 </para>
56047 <literallayout class="monospaced">
56048 headers_add = X-added-header: added by $primary_hostname\n\
56049               X-added-second: another added header line
56050 </literallayout>
56051 <para>
56052 Exim does not check the syntax of these added header lines.
56053 </para>
56054 <para>
56055 The result of expanding <option>headers_remove</option> must consist of a colon-separated
56056 list of header names. This is confusing, because header names themselves are
56057 often terminated by colons. In this case, the colons are the list separators,
56058 not part of the names. For example:
56059 </para>
56060 <literallayout class="monospaced">
56061 headers_remove = return-receipt-to:acknowledge-to
56062 </literallayout>
56063 <para>
56064 When <option>headers_add</option> or <option>headers_remove</option> is specified on a router, its value
56065 is expanded at routing time, and then associated with all addresses that are
56066 accepted by that router, and also with any new addresses that it generates. If
56067 an address passes through several routers as a result of aliasing or
56068 forwarding, the changes are cumulative.
56069 </para>
56070 <para>
56071 <indexterm role="option">
56072 <primary><option>unseen</option></primary>
56073 </indexterm>
56074 However, this does not apply to multiple routers that result from the use of
56075 the <option>unseen</option> option. Any header modifications that were specified by the
56076 <quote>unseen</quote> router or its predecessors apply only to the <quote>unseen</quote> delivery.
56077 </para>
56078 <para>
56079 Addresses that end up with different <option>headers_add</option> or <option>headers_remove</option>
56080 settings cannot be delivered together in a batch, so a transport is always
56081 dealing with a set of addresses that have the same header-processing
56082 requirements.
56083 </para>
56084 <para>
56085 The transport starts by writing the original set of header lines that arrived
56086 with the message, possibly modified by the system filter. As it writes out
56087 these lines, it consults the list of header names that were attached to the
56088 recipient address(es) by <option>headers_remove</option> options in routers, and it also
56089 consults the transport&#x2019;s own <option>headers_remove</option> option. Header lines whose
56090 names are on either of these lists are not written out. If there are multiple
56091 instances of any listed header, they are all skipped.
56092 </para>
56093 <para>
56094 After the remaining original header lines have been written, new header
56095 lines that were specified by routers&#x2019; <option>headers_add</option> options are written, in
56096 the order in which they were attached to the address. These are followed by any
56097 header lines specified by the transport&#x2019;s <option>headers_add</option> option.
56098 </para>
56099 <para>
56100 This way of handling header line modifications in routers and transports has
56101 the following consequences:
56102 </para>
56103 <itemizedlist>
56104 <listitem>
56105 <para>
56106 The original set of header lines, possibly modified by the system filter,
56107 remains <quote>visible</quote>, in the sense that the <varname>$header_</varname><emphasis>xxx</emphasis> variables refer
56108 to it, at all times.
56109 </para>
56110 </listitem>
56111 <listitem>
56112 <para>
56113 Header lines that are added by a router&#x2019;s
56114 <option>headers_add</option> option are not accessible by means of the <varname>$header_</varname><emphasis>xxx</emphasis>
56115 expansion syntax in subsequent routers or the transport.
56116 </para>
56117 </listitem>
56118 <listitem>
56119 <para>
56120 Conversely, header lines that are specified for removal by <option>headers_remove</option>
56121 in a router remain visible to subsequent routers and the transport.
56122 </para>
56123 </listitem>
56124 <listitem>
56125 <para>
56126 Headers added to an address by <option>headers_add</option> in a router cannot be removed by
56127 a later router or by a transport.
56128 </para>
56129 </listitem>
56130 <listitem>
56131 <para>
56132 An added header can refer to the contents of an original header that is to be
56133 removed, even it has the same name as the added header. For example:
56134 </para>
56135 <literallayout class="monospaced">
56136 headers_remove = subject
56137 headers_add = Subject: new subject (was: $h_subject:)
56138 </literallayout>
56139 </listitem>
56140 </itemizedlist>
56141 <para>
56142 <emphasis role="bold">Warning</emphasis>: The <option>headers_add</option> and <option>headers_remove</option> options cannot be used
56143 for a <command>redirect</command> router that has the <option>one_time</option> option set.
56144 </para>
56145 </section>
56146 <section id="SECTconstr">
56147 <title>Constructed addresses</title>
56148 <para>
56149 <indexterm role="concept">
56150 <primary>address</primary>
56151 <secondary>constructed</secondary>
56152 </indexterm>
56153 <indexterm role="concept">
56154 <primary>constructed address</primary>
56155 </indexterm>
56156 When Exim constructs a sender address for a locally-generated message, it uses
56157 the form
56158 </para>
56159 <literallayout>
56160 &lt;<emphasis>user name</emphasis>&gt;&nbsp;&nbsp;&lt;<emphasis>login</emphasis><literal>@</literal><emphasis>qualify_domain</emphasis>&gt;
56161 </literallayout>
56162 <para>
56163 For example:
56164 </para>
56165 <literallayout class="monospaced">
56166 Zaphod Beeblebrox &lt;zaphod@end.univ.example&gt;
56167 </literallayout>
56168 <para>
56169 The user name is obtained from the <option>-F</option> command line option if set, or
56170 otherwise by looking up the calling user by <function>getpwuid()</function> and extracting the
56171 <quote>gecos</quote> field from the password entry. If the <quote>gecos</quote> field contains an
56172 ampersand character, this is replaced by the login name with the first letter
56173 upper cased, as is conventional in a number of operating systems. See the
56174 <option>gecos_name</option> option for a way to tailor the handling of the <quote>gecos</quote> field.
56175 The <option>unknown_username</option> option can be used to specify user names in cases when
56176 there is no password file entry.
56177 </para>
56178 <para>
56179 <indexterm role="concept">
56180 <primary>RFC 2047</primary>
56181 </indexterm>
56182 In all cases, the user name is made to conform to RFC 2822 by quoting all or
56183 parts of it if necessary. In addition, if it contains any non-printing
56184 characters, it is encoded as described in RFC 2047, which defines a way of
56185 including non-ASCII characters in header lines. The value of the
56186 <option>headers_charset</option> option specifies the name of the encoding that is used (the
56187 characters are assumed to be in this encoding). The setting of
56188 <option>print_topbitchars</option> controls whether characters with the top bit set (that
56189 is, with codes greater than 127) count as printing characters or not.
56190 </para>
56191 </section>
56192 <section id="SECID230">
56193 <title>Case of local parts</title>
56194 <para>
56195 <indexterm role="concept">
56196 <primary>case of local parts</primary>
56197 </indexterm>
56198 <indexterm role="concept">
56199 <primary>local part</primary>
56200 <secondary>case of</secondary>
56201 </indexterm>
56202 RFC 2822 states that the case of letters in the local parts of addresses cannot
56203 be assumed to be non-significant. Exim preserves the case of local parts of
56204 addresses, but by default it uses a lower-cased form when it is routing,
56205 because on most Unix systems, usernames are in lower case and case-insensitive
56206 routing is required. However, any particular router can be made to use the
56207 original case for local parts by setting the <option>caseful_local_part</option> generic
56208 router option.
56209 </para>
56210 <para>
56211 <indexterm role="concept">
56212 <primary>mixed-case login names</primary>
56213 </indexterm>
56214 If you must have mixed-case user names on your system, the best way to proceed,
56215 assuming you want case-independent handling of incoming email, is to set up
56216 your first router to convert incoming local parts in your domains to the
56217 correct case by means of a file lookup. For example:
56218 </para>
56219 <literallayout class="monospaced">
56220 correct_case:
56221   driver = redirect
56222   domains = +local_domains
56223   data = ${lookup{$local_part}cdb\
56224               {/etc/usercased.cdb}{$value}fail}\
56225               @$domain
56226 </literallayout>
56227 <para>
56228 For this router, the local part is forced to lower case by the default action
56229 (<option>caseful_local_part</option> is not set). The lower-cased local part is used to look
56230 up a new local part in the correct case. If you then set <option>caseful_local_part</option>
56231 on any subsequent routers which process your domains, they will operate on
56232 local parts with the correct case in a case-sensitive manner.
56233 </para>
56234 </section>
56235 <section id="SECID231">
56236 <title>Dots in local parts</title>
56237 <para>
56238 <indexterm role="concept">
56239 <primary>dot</primary>
56240 <secondary>in local part</secondary>
56241 </indexterm>
56242 <indexterm role="concept">
56243 <primary>local part</primary>
56244 <secondary>dots in</secondary>
56245 </indexterm>
56246 RFC 2822 forbids empty components in local parts. That is, an unquoted local
56247 part may not begin or end with a dot, nor have two consecutive dots in the
56248 middle. However, it seems that many MTAs do not enforce this, so Exim permits
56249 empty components for compatibility.
56250 </para>
56251 </section>
56252 <section id="SECID232">
56253 <title>Rewriting addresses</title>
56254 <para>
56255 <indexterm role="concept">
56256 <primary>rewriting</primary>
56257 <secondary>addresses</secondary>
56258 </indexterm>
56259 Rewriting of sender and recipient addresses, and addresses in headers, can
56260 happen automatically, or as the result of configuration options, as described
56261 in chapter <xref linkend="CHAPrewrite"/>. The headers that may be affected by this are
56262 <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>.
56263 </para>
56264 <para>
56265 Automatic rewriting includes qualification, as mentioned above. The other case
56266 in which it can happen is when an incomplete non-local domain is given. The
56267 routing process may cause this to be expanded into the full domain name. For
56268 example, a header such as
56269 </para>
56270 <literallayout class="monospaced">
56271 To: hare@teaparty
56272 </literallayout>
56273 <para>
56274 might get rewritten as
56275 </para>
56276 <literallayout class="monospaced">
56277 To: hare@teaparty.wonderland.fict.example
56278 </literallayout>
56279 <para>
56280 Rewriting as a result of routing is the one kind of message processing that
56281 does not happen at input time, as it cannot be done until the address has
56282 been routed.
56283 </para>
56284 <para>
56285 Strictly, one should not do <emphasis>any</emphasis> deliveries of a message until all its
56286 addresses have been routed, in case any of the headers get changed as a
56287 result of routing. However, doing this in practice would hold up many
56288 deliveries for unreasonable amounts of time, just because one address could not
56289 immediately be routed. Exim therefore does not delay other deliveries when
56290 routing of one or more addresses is deferred.
56291 <indexterm role="concept" startref="IIDmesproc" class="endofrange"/>
56292 </para>
56293 </section>
56294 </chapter>
56295
56296 <chapter id="CHAPSMTP">
56297 <title>SMTP processing</title>
56298 <para>
56299 <indexterm role="concept" id="IIDsmtpproc1" class="startofrange">
56300 <primary>SMTP</primary>
56301 <secondary>processing details</secondary>
56302 </indexterm>
56303 <indexterm role="concept" id="IIDsmtpproc2" class="startofrange">
56304 <primary>LMTP</primary>
56305 <secondary>processing details</secondary>
56306 </indexterm>
56307 Exim supports a number of different ways of using the SMTP protocol, and its
56308 LMTP variant, which is an interactive protocol for transferring messages into a
56309 closed mail store application. This chapter contains details of how SMTP is
56310 processed. For incoming mail, the following are available:
56311 </para>
56312 <itemizedlist>
56313 <listitem>
56314 <para>
56315 SMTP over TCP/IP (Exim daemon or <emphasis>inetd</emphasis>);
56316 </para>
56317 </listitem>
56318 <listitem>
56319 <para>
56320 SMTP over the standard input and output (the <option>-bs</option> option);
56321 </para>
56322 </listitem>
56323 <listitem>
56324 <para>
56325 Batched SMTP on the standard input (the <option>-bS</option> option).
56326 </para>
56327 </listitem>
56328 </itemizedlist>
56329 <para>
56330 For mail delivery, the following are available:
56331 </para>
56332 <itemizedlist>
56333 <listitem>
56334 <para>
56335 SMTP over TCP/IP (the <command>smtp</command> transport);
56336 </para>
56337 </listitem>
56338 <listitem>
56339 <para>
56340 LMTP over TCP/IP (the <command>smtp</command> transport with the <option>protocol</option> option set to
56341 <quote>lmtp</quote>);
56342 </para>
56343 </listitem>
56344 <listitem>
56345 <para>
56346 LMTP over a pipe to a process running in the local host (the <command>lmtp</command>
56347 transport);
56348 </para>
56349 </listitem>
56350 <listitem>
56351 <para>
56352 Batched SMTP to a file or pipe (the <command>appendfile</command> and <command>pipe</command> transports with
56353 the <option>use_bsmtp</option> option set).
56354 </para>
56355 </listitem>
56356 </itemizedlist>
56357 <para>
56358 <emphasis>Batched SMTP</emphasis> is the name for a process in which batches of messages are
56359 stored in or read from files (or pipes), in a format in which SMTP commands are
56360 used to contain the envelope information.
56361 </para>
56362 <section id="SECToutSMTPTCP">
56363 <title>Outgoing SMTP and LMTP over TCP/IP</title>
56364 <para>
56365 <indexterm role="concept">
56366 <primary>SMTP</primary>
56367 <secondary>outgoing over TCP/IP</secondary>
56368 </indexterm>
56369 <indexterm role="concept">
56370 <primary>outgoing SMTP over TCP/IP</primary>
56371 </indexterm>
56372 <indexterm role="concept">
56373 <primary>LMTP</primary>
56374 <secondary>over TCP/IP</secondary>
56375 </indexterm>
56376 <indexterm role="concept">
56377 <primary>outgoing LMTP over TCP/IP</primary>
56378 </indexterm>
56379 <indexterm role="concept">
56380 <primary>EHLO</primary>
56381 </indexterm>
56382 <indexterm role="concept">
56383 <primary>HELO</primary>
56384 </indexterm>
56385 <indexterm role="concept">
56386 <primary>SIZE option on MAIL command</primary>
56387 </indexterm>
56388 Outgoing SMTP and LMTP over TCP/IP is implemented by the <command>smtp</command> transport.
56389 The <option>protocol</option> option selects which protocol is to be used, but the actual
56390 processing is the same in both cases.
56391 </para>
56392 <para>
56393 If, in response to its EHLO command, Exim is told that the SIZE
56394 parameter is supported, it adds SIZE=&lt;<emphasis>n</emphasis>&gt; to each subsequent MAIL
56395 command. The value of &lt;<emphasis>n</emphasis>&gt; is the message size plus the value of the
56396 <option>size_addition</option> option (default 1024) to allow for additions to the message
56397 such as per-transport header lines, or changes made in a
56398 <indexterm role="concept">
56399 <primary>transport</primary>
56400 <secondary>filter</secondary>
56401 </indexterm>
56402 <indexterm role="concept">
56403 <primary>filter</primary>
56404 <secondary>transport filter</secondary>
56405 </indexterm>
56406 transport filter. If <option>size_addition</option> is set negative, the use of SIZE is
56407 suppressed.
56408 </para>
56409 <para>
56410 If the remote server advertises support for PIPELINING, Exim uses the
56411 pipelining extension to SMTP (RFC 2197) to reduce the number of TCP/IP packets
56412 required for the transaction.
56413 </para>
56414 <para>
56415 If the remote server advertises support for the STARTTLS command, and Exim
56416 was built to support TLS encryption, it tries to start a TLS session unless the
56417 server matches <option>hosts_avoid_tls</option>. See chapter <xref linkend="CHAPTLS"/> for more details.
56418 </para>
56419 <para>
56420 If the remote server advertises support for the AUTH command, Exim scans
56421 the authenticators configuration for any suitable client settings, as described
56422 in chapter <xref linkend="CHAPSMTPAUTH"/>.
56423 </para>
56424 <para>
56425 <indexterm role="concept">
56426 <primary>carriage return</primary>
56427 </indexterm>
56428 <indexterm role="concept">
56429 <primary>linefeed</primary>
56430 </indexterm>
56431 Responses from the remote host are supposed to be terminated by CR followed by
56432 LF. However, there are known to be hosts that do not send CR characters, so in
56433 order to be able to interwork with such hosts, Exim treats LF on its own as a
56434 line terminator.
56435 </para>
56436 <para>
56437 If a message contains a number of different addresses, all those with the same
56438 characteristics (for example, the same envelope sender) that resolve to the
56439 same set of hosts, in the same order, are sent in a single SMTP transaction,
56440 even if they are for different domains, unless there are more than the setting
56441 of the <option>max_rcpt</option>s option in the <command>smtp</command> transport allows, in which case
56442 they are split into groups containing no more than <option>max_rcpt</option>s addresses
56443 each. If <option>remote_max_parallel</option> is greater than one, such groups may be sent
56444 in parallel sessions. The order of hosts with identical MX values is not
56445 significant when checking whether addresses can be batched in this way.
56446 </para>
56447 <para>
56448 When the <command>smtp</command> transport suffers a temporary failure that is not
56449 message-related, Exim updates its transport-specific database, which contains
56450 records indexed by host name that remember which messages are waiting for each
56451 particular host. It also updates the retry database with new retry times.
56452 </para>
56453 <para>
56454 <indexterm role="concept">
56455 <primary>hints database</primary>
56456 <secondary>retry keys</secondary>
56457 </indexterm>
56458 Exim&#x2019;s retry hints are based on host name plus IP address, so if one address of
56459 a multi-homed host is broken, it will soon be skipped most of the time.
56460 See the next section for more detail about error handling.
56461 </para>
56462 <para>
56463 <indexterm role="concept">
56464 <primary>SMTP</primary>
56465 <secondary>passed connection</secondary>
56466 </indexterm>
56467 <indexterm role="concept">
56468 <primary>SMTP</primary>
56469 <secondary>batching over TCP/IP</secondary>
56470 </indexterm>
56471 When a message is successfully delivered over a TCP/IP SMTP connection, Exim
56472 looks in the hints database for the transport to see if there are any queued
56473 messages waiting for the host to which it is connected. If it finds one, it
56474 creates a new Exim process using the <option>-MC</option> option (which can only be used by
56475 a process running as root or the Exim user) and passes the TCP/IP socket to it
56476 so that it can deliver another message using the same socket. The new process
56477 does only those deliveries that are routed to the connected host, and may in
56478 turn pass the socket on to a third process, and so on.
56479 </para>
56480 <para>
56481 The <option>connection_max_messages</option> option of the <command>smtp</command> transport can be used to
56482 limit the number of messages sent down a single TCP/IP connection.
56483 </para>
56484 <para>
56485 <indexterm role="concept">
56486 <primary>asterisk</primary>
56487 <secondary>after IP address</secondary>
56488 </indexterm>
56489 The second and subsequent messages delivered down an existing connection are
56490 identified in the main log by the addition of an asterisk after the closing
56491 square bracket of the IP address.
56492 </para>
56493 </section>
56494 <section id="SECToutSMTPerr">
56495 <title>Errors in outgoing SMTP</title>
56496 <para>
56497 <indexterm role="concept">
56498 <primary>error</primary>
56499 <secondary>in outgoing SMTP</secondary>
56500 </indexterm>
56501 <indexterm role="concept">
56502 <primary>SMTP</primary>
56503 <secondary>errors in outgoing</secondary>
56504 </indexterm>
56505 <indexterm role="concept">
56506 <primary>host</primary>
56507 <secondary>error</secondary>
56508 </indexterm>
56509 Three different kinds of error are recognized for outgoing SMTP: host errors,
56510 message errors, and recipient errors.
56511 </para>
56512 <variablelist>
56513 <varlistentry>
56514 <term><emphasis role="bold">Host errors</emphasis></term>
56515 <listitem>
56516 <para>
56517 A host error is not associated with a particular message or with a
56518 particular recipient of a message. The host errors are:
56519 </para>
56520 <itemizedlist>
56521 <listitem>
56522 <para>
56523 Connection refused or timed out,
56524 </para>
56525 </listitem>
56526 <listitem>
56527 <para>
56528 Any error response code on connection,
56529 </para>
56530 </listitem>
56531 <listitem>
56532 <para>
56533 Any error response code to EHLO or HELO,
56534 </para>
56535 </listitem>
56536 <listitem>
56537 <para>
56538 Loss of connection at any time, except after <quote>.</quote>,
56539 </para>
56540 </listitem>
56541 <listitem>
56542 <para>
56543 I/O errors at any time,
56544 </para>
56545 </listitem>
56546 <listitem>
56547 <para>
56548 Timeouts during the session, other than in response to MAIL, RCPT or
56549 the <quote>.</quote> at the end of the data.
56550 </para>
56551 </listitem>
56552 </itemizedlist>
56553 <para>
56554 For a host error, a permanent error response on connection, or in response to
56555 EHLO, causes all addresses routed to the host to be failed. Any other host
56556 error causes all addresses to be deferred, and retry data to be created for the
56557 host. It is not tried again, for any message, until its retry time arrives. If
56558 the current set of addresses are not all delivered in this run (to some
56559 alternative host), the message is added to the list of those waiting for this
56560 host, so if it is still undelivered when a subsequent successful delivery is
56561 made to the host, it will be sent down the same SMTP connection.
56562 </para>
56563 </listitem></varlistentry>
56564 <varlistentry>
56565 <term><emphasis role="bold">Message errors</emphasis></term>
56566 <listitem>
56567 <para>
56568 <indexterm role="concept">
56569 <primary>message</primary>
56570 <secondary>error</secondary>
56571 </indexterm>
56572 A message error is associated with a particular message when sent to a
56573 particular host, but not with a particular recipient of the message. The
56574 message errors are:
56575 </para>
56576 <itemizedlist>
56577 <listitem>
56578 <para>
56579 Any error response code to MAIL, DATA, or the <quote>.</quote> that terminates
56580 the data,
56581 </para>
56582 </listitem>
56583 <listitem>
56584 <para>
56585 Timeout after MAIL,
56586 </para>
56587 </listitem>
56588 <listitem>
56589 <para>
56590 Timeout or loss of connection after the <quote>.</quote> that terminates the data. A
56591 timeout after the DATA command itself is treated as a host error, as is loss of
56592 connection at any other time.
56593 </para>
56594 </listitem>
56595 </itemizedlist>
56596 <para>
56597 For a message error, a permanent error response (5<emphasis>xx</emphasis>) causes all addresses
56598 to be failed, and a delivery error report to be returned to the sender. A
56599 temporary error response (4<emphasis>xx</emphasis>), or one of the timeouts, causes all
56600 addresses to be deferred. Retry data is not created for the host, but instead,
56601 a retry record for the combination of host plus message id is created. The
56602 message is not added to the list of those waiting for this host. This ensures
56603 that the failing message will not be sent to this host again until the retry
56604 time arrives. However, other messages that are routed to the host are not
56605 affected, so if it is some property of the message that is causing the error,
56606 it will not stop the delivery of other mail.
56607 </para>
56608 <para>
56609 If the remote host specified support for the SIZE parameter in its response
56610 to EHLO, Exim adds SIZE=<emphasis>nnn</emphasis> to the MAIL command, so an
56611 over-large message will cause a message error because the error arrives as a
56612 response to MAIL.
56613 </para>
56614 </listitem></varlistentry>
56615 <varlistentry>
56616 <term><emphasis role="bold">Recipient errors</emphasis></term>
56617 <listitem>
56618 <para>
56619 <indexterm role="concept">
56620 <primary>recipient</primary>
56621 <secondary>error</secondary>
56622 </indexterm>
56623 A recipient error is associated with a particular recipient of a message. The
56624 recipient errors are:
56625 </para>
56626 <itemizedlist>
56627 <listitem>
56628 <para>
56629 Any error response to RCPT,
56630 </para>
56631 </listitem>
56632 <listitem>
56633 <para>
56634 Timeout after RCPT.
56635 </para>
56636 </listitem>
56637 </itemizedlist>
56638 <para>
56639 For a recipient error, a permanent error response (5<emphasis>xx</emphasis>) causes the
56640 recipient address to be failed, and a bounce message to be returned to the
56641 sender. A temporary error response (4<emphasis>xx</emphasis>) or a timeout causes the failing
56642 address to be deferred, and routing retry data to be created for it. This is
56643 used to delay processing of the address in subsequent queue runs, until its
56644 routing retry time arrives. This applies to all messages, but because it
56645 operates only in queue runs, one attempt will be made to deliver a new message
56646 to the failing address before the delay starts to operate. This ensures that,
56647 if the failure is really related to the message rather than the recipient
56648 (<quote>message too big for this recipient</quote> is a possible example), other messages
56649 have a chance of getting delivered. If a delivery to the address does succeed,
56650 the retry information gets cleared, so all stuck messages get tried again, and
56651 the retry clock is reset.
56652 </para>
56653 <para>
56654 The message is not added to the list of those waiting for this host. Use of the
56655 host for other messages is unaffected, and except in the case of a timeout,
56656 other recipients are processed independently, and may be successfully delivered
56657 in the current SMTP session. After a timeout it is of course impossible to
56658 proceed with the session, so all addresses get deferred. However, those other
56659 than the one that failed do not suffer any subsequent retry delays. Therefore,
56660 if one recipient is causing trouble, the others have a chance of getting
56661 through when a subsequent delivery attempt occurs before the failing
56662 recipient&#x2019;s retry time.
56663 </para>
56664 </listitem></varlistentry>
56665 </variablelist>
56666 <para>
56667 In all cases, if there are other hosts (or IP addresses) available for the
56668 current set of addresses (for example, from multiple MX records), they are
56669 tried in this run for any undelivered addresses, subject of course to their
56670 own retry data. In other words, recipient error retry data does not take effect
56671 until the next delivery attempt.
56672 </para>
56673 <para>
56674 Some hosts have been observed to give temporary error responses to every
56675 MAIL command at certain times (<quote>insufficient space</quote> has been seen). It
56676 would be nice if such circumstances could be recognized, and defer data for the
56677 host itself created, but this is not possible within the current Exim design.
56678 What actually happens is that retry data for every (host, message) combination
56679 is created.
56680 </para>
56681 <para>
56682 The reason that timeouts after MAIL and RCPT are treated specially is that
56683 these can sometimes arise as a result of the remote host&#x2019;s verification
56684 procedures. Exim makes this assumption, and treats them as if a temporary error
56685 response had been received. A timeout after <quote>.</quote> is treated specially because
56686 it is known that some broken implementations fail to recognize the end of the
56687 message if the last character of the last line is a binary zero. Thus, it is
56688 helpful to treat this case as a message error.
56689 </para>
56690 <para>
56691 Timeouts at other times are treated as host errors, assuming a problem with the
56692 host, or the connection to it. If a timeout after MAIL, RCPT,
56693 or <quote>.</quote> is really a connection problem, the assumption is that at the next try
56694 the timeout is likely to occur at some other point in the dialogue, causing it
56695 then to be treated as a host error.
56696 </para>
56697 <para>
56698 There is experimental evidence that some MTAs drop the connection after the
56699 terminating <quote>.</quote> if they do not like the contents of the message for some
56700 reason, in contravention of the RFC, which indicates that a 5<emphasis>xx</emphasis> response
56701 should be given. That is why Exim treats this case as a message rather than a
56702 host error, in order not to delay other messages to the same host.
56703 </para>
56704 </section>
56705 <section id="SECID233">
56706 <title>Incoming SMTP messages over TCP/IP</title>
56707 <para>
56708 <indexterm role="concept">
56709 <primary>SMTP</primary>
56710 <secondary>incoming over TCP/IP</secondary>
56711 </indexterm>
56712 <indexterm role="concept">
56713 <primary>incoming SMTP over TCP/IP</primary>
56714 </indexterm>
56715 <indexterm role="concept">
56716 <primary>inetd</primary>
56717 </indexterm>
56718 <indexterm role="concept">
56719 <primary>daemon</primary>
56720 </indexterm>
56721 Incoming SMTP messages can be accepted in one of two ways: by running a
56722 listening daemon, or by using <emphasis>inetd</emphasis>. In the latter case, the entry in
56723 <filename>/etc/inetd.conf</filename> should be like this:
56724 </para>
56725 <literallayout class="monospaced">
56726 smtp stream tcp nowait exim /opt/exim/bin/exim in.exim -bs
56727 </literallayout>
56728 <para>
56729 Exim distinguishes between this case and the case of a locally running user
56730 agent using the <option>-bs</option> option by checking whether or not the standard input is
56731 a socket. When it is, either the port must be privileged (less than 1024), or
56732 the caller must be root or the Exim user. If any other user passes a socket
56733 with an unprivileged port number, Exim prints a message on the standard error
56734 stream and exits with an error code.
56735 </para>
56736 <para>
56737 By default, Exim does not make a log entry when a remote host connects or
56738 disconnects (either via the daemon or <emphasis>inetd</emphasis>), unless the disconnection is
56739 unexpected. It can be made to write such log entries by setting the
56740 <option>smtp_connection</option> log selector.
56741 </para>
56742 <para>
56743 <indexterm role="concept">
56744 <primary>carriage return</primary>
56745 </indexterm>
56746 <indexterm role="concept">
56747 <primary>linefeed</primary>
56748 </indexterm>
56749 Commands from the remote host are supposed to be terminated by CR followed by
56750 LF. However, there are known to be hosts that do not send CR characters. In
56751 order to be able to interwork with such hosts, Exim treats LF on its own as a
56752 line terminator.
56753 Furthermore, because common code is used for receiving messages from all
56754 sources, a CR on its own is also interpreted as a line terminator. However, the
56755 sequence <quote>CR, dot, CR</quote> does not terminate incoming SMTP data.
56756 </para>
56757 <para>
56758 <indexterm role="concept">
56759 <primary>EHLO</primary>
56760 <secondary>invalid data</secondary>
56761 </indexterm>
56762 <indexterm role="concept">
56763 <primary>HELO</primary>
56764 <secondary>invalid data</secondary>
56765 </indexterm>
56766 One area that sometimes gives rise to problems concerns the EHLO or
56767 HELO commands. Some clients send syntactically invalid versions of these
56768 commands, which Exim rejects by default. (This is nothing to do with verifying
56769 the data that is sent, so <option>helo_verify_hosts</option> is not relevant.) You can tell
56770 Exim not to apply a syntax check by setting <option>helo_accept_junk_hosts</option> to
56771 match the broken hosts that send invalid commands.
56772 </para>
56773 <para>
56774 <indexterm role="concept">
56775 <primary>SIZE option on MAIL command</primary>
56776 </indexterm>
56777 <indexterm role="concept">
56778 <primary>MAIL</primary>
56779 <secondary>SIZE option</secondary>
56780 </indexterm>
56781 The amount of disk space available is checked whenever SIZE is received on
56782 a MAIL command, independently of whether <option>message_size_limit</option> or
56783 <option>check_spool_space</option> is configured, unless <option>smtp_check_spool_space</option> is set
56784 false. A temporary error is given if there is not enough space. If
56785 <option>check_spool_space</option> is set, the check is for that amount of space plus the
56786 value given with SIZE, that is, it checks that the addition of the incoming
56787 message will not reduce the space below the threshold.
56788 </para>
56789 <para>
56790 When a message is successfully received, Exim includes the local message id in
56791 its response to the final <quote>.</quote> that terminates the data. If the remote host
56792 logs this text it can help with tracing what has happened to a message.
56793 </para>
56794 <para>
56795 The Exim daemon can limit the number of simultaneous incoming connections it is
56796 prepared to handle (see the <option>smtp_accept_max</option> option). It can also limit the
56797 number of simultaneous incoming connections from a single remote host (see the
56798 <option>smtp_accept_max_per_host</option> option). Additional connection attempts are
56799 rejected using the SMTP temporary error code 421.
56800 </para>
56801 <para>
56802 The Exim daemon does not rely on the SIGCHLD signal to detect when a
56803 subprocess has finished, as this can get lost at busy times. Instead, it looks
56804 for completed subprocesses every time it wakes up. Provided there are other
56805 things happening (new incoming calls, starts of queue runs), completed
56806 processes will be noticed and tidied away. On very quiet systems you may
56807 sometimes see a <quote>defunct</quote> Exim process hanging about. This is not a problem;
56808 it will be noticed when the daemon next wakes up.
56809 </para>
56810 <para>
56811 When running as a daemon, Exim can reserve some SMTP slots for specific hosts,
56812 and can also be set up to reject SMTP calls from non-reserved hosts at times of
56813 high system load &ndash; for details see the <option>smtp_accept_reserve</option>,
56814 <option>smtp_load_reserve</option>, and <option>smtp_reserve_hosts</option> options. The load check
56815 applies in both the daemon and <emphasis>inetd</emphasis> cases.
56816 </para>
56817 <para>
56818 Exim normally starts a delivery process for each message received, though this
56819 can be varied by means of the <option>-odq</option> command line option and the
56820 <option>queue_only</option>, <option>queue_only_file</option>, and <option>queue_only_load</option> options. The
56821 number of simultaneously running delivery processes started in this way from
56822 SMTP input can be limited by the <option>smtp_accept_queue</option> and
56823 <option>smtp_accept_queue_per_connection</option> options. When either limit is reached,
56824 subsequently received messages are just put on the input queue without starting
56825 a delivery process.
56826 </para>
56827 <para>
56828 The controls that involve counts of incoming SMTP calls (<option>smtp_accept_max</option>,
56829 <option>smtp_accept_queue</option>, <option>smtp_accept_reserve</option>) are not available when Exim is
56830 started up from the <emphasis>inetd</emphasis> daemon, because in that case each connection is
56831 handled by an entirely independent Exim process. Control by load average is,
56832 however, available with <emphasis>inetd</emphasis>.
56833 </para>
56834 <para>
56835 Exim can be configured to verify addresses in incoming SMTP commands as they
56836 are received. See chapter <xref linkend="CHAPACL"/> for details. It can also be configured
56837 to rewrite addresses at this time &ndash; before any syntax checking is done. See
56838 section <xref linkend="SECTrewriteS"/>.
56839 </para>
56840 <para>
56841 Exim can also be configured to limit the rate at which a client host submits
56842 MAIL and RCPT commands in a single SMTP session. See the
56843 <option>smtp_ratelimit_hosts</option> option.
56844 </para>
56845 </section>
56846 <section id="SECID234">
56847 <title>Unrecognized SMTP commands</title>
56848 <para>
56849 <indexterm role="concept">
56850 <primary>SMTP</primary>
56851 <secondary>unrecognized commands</secondary>
56852 </indexterm>
56853 If Exim receives more than <option>smtp_max_unknown_commands</option> unrecognized SMTP
56854 commands during a single SMTP connection, it drops the connection after sending
56855 the error response to the last command. The default value for
56856 <option>smtp_max_unknown_commands</option> is 3. This is a defence against some kinds of
56857 abuse that subvert web servers into making connections to SMTP ports; in these
56858 circumstances, a number of non-SMTP lines are sent first.
56859 </para>
56860 </section>
56861 <section id="SECID235">
56862 <title>Syntax and protocol errors in SMTP commands</title>
56863 <para>
56864 <indexterm role="concept">
56865 <primary>SMTP</primary>
56866 <secondary>syntax errors</secondary>
56867 </indexterm>
56868 <indexterm role="concept">
56869 <primary>SMTP</primary>
56870 <secondary>protocol errors</secondary>
56871 </indexterm>
56872 A syntax error is detected if an SMTP command is recognized, but there is
56873 something syntactically wrong with its data, for example, a malformed email
56874 address in a RCPT command. Protocol errors include invalid command
56875 sequencing such as RCPT before MAIL. If Exim receives more than
56876 <option>smtp_max_synprot_errors</option> such commands during a single SMTP connection, it
56877 drops the connection after sending the error response to the last command. The
56878 default value for <option>smtp_max_synprot_errors</option> is 3. This is a defence against
56879 broken clients that loop sending bad commands (yes, it has been seen).
56880 </para>
56881 </section>
56882 <section id="SECID236">
56883 <title>Use of non-mail SMTP commands</title>
56884 <para>
56885 <indexterm role="concept">
56886 <primary>SMTP</primary>
56887 <secondary>non-mail commands</secondary>
56888 </indexterm>
56889 The <quote>non-mail</quote> SMTP commands are those other than MAIL, RCPT, and
56890 DATA. Exim counts such commands, and drops the connection if there are too
56891 many of them in a single SMTP session. This action catches some
56892 denial-of-service attempts and things like repeated failing AUTHs, or a mad
56893 client looping sending EHLO. The global option <option>smtp_accept_max_nonmail</option>
56894 defines what <quote>too many</quote> means. Its default value is 10.
56895 </para>
56896 <para>
56897 When a new message is expected, one occurrence of RSET is not counted. This
56898 allows a client to send one RSET between messages (this is not necessary,
56899 but some clients do it). Exim also allows one uncounted occurrence of HELO
56900 or EHLO, and one occurrence of STARTTLS between messages. After
56901 starting up a TLS session, another EHLO is expected, and so it too is not
56902 counted.
56903 </para>
56904 <para>
56905 The first occurrence of AUTH in a connection, or immediately following
56906 STARTTLS is also not counted. Otherwise, all commands other than MAIL,
56907 RCPT, DATA, and QUIT are counted.
56908 </para>
56909 <para>
56910 You can control which hosts are subject to the limit set by
56911 <option>smtp_accept_max_nonmail</option> by setting
56912 <option>smtp_accept_max_nonmail_hosts</option>. The default value is <literal>*</literal>, which makes
56913 the limit apply to all hosts. This option means that you can exclude any
56914 specific badly-behaved hosts that you have to live with.
56915 </para>
56916 </section>
56917 <section id="SECID237">
56918 <title>The VRFY and EXPN commands</title>
56919 <para>
56920 When Exim receives a VRFY or EXPN command on a TCP/IP connection, it
56921 runs the ACL specified by <option>acl_smtp_vrfy</option> or <option>acl_smtp_expn</option> (as
56922 appropriate) in order to decide whether the command should be accepted or not.
56923 If no ACL is defined, the command is rejected.
56924 </para>
56925 <para>
56926 <indexterm role="concept">
56927 <primary>VRFY</primary>
56928 <secondary>processing</secondary>
56929 </indexterm>
56930 When VRFY is accepted, it runs exactly the same code as when Exim is
56931 called with the <option>-bv</option> option.
56932 </para>
56933 <para>
56934 <indexterm role="concept">
56935 <primary>EXPN</primary>
56936 <secondary>processing</secondary>
56937 </indexterm>
56938 When EXPN is accepted, a single-level expansion of the address is done.
56939 EXPN is treated as an <quote>address test</quote> (similar to the <option>-bt</option> option) rather
56940 than a verification (the <option>-bv</option> option). If an unqualified local part is given
56941 as the argument to EXPN, it is qualified with <option>qualify_domain</option>. Rejections
56942 of VRFY and EXPN commands are logged on the main and reject logs, and
56943 VRFY verification failures are logged on the main log for consistency with
56944 RCPT failures.
56945 </para>
56946 </section>
56947 <section id="SECTETRN">
56948 <title>The ETRN command</title>
56949 <para>
56950 <indexterm role="concept">
56951 <primary>ETRN</primary>
56952 <secondary>processing</secondary>
56953 </indexterm>
56954 RFC 1985 describes an SMTP command called ETRN that is designed to
56955 overcome the security problems of the TURN command (which has fallen into
56956 disuse). When Exim receives an ETRN command on a TCP/IP connection, it runs
56957 the ACL specified by <option>acl_smtp_etrn</option> in order to decide whether the command
56958 should be accepted or not. If no ACL is defined, the command is rejected.
56959 </para>
56960 <para>
56961 The ETRN command is concerned with <quote>releasing</quote> messages that are awaiting
56962 delivery to certain hosts. As Exim does not organize its message queue by host,
56963 the only form of ETRN that is supported by default is the one where the
56964 text starts with the <quote>#</quote> prefix, in which case the remainder of the text is
56965 specific to the SMTP server. A valid ETRN command causes a run of Exim with
56966 the <option>-R</option> option to happen, with the remainder of the ETRN text as its
56967 argument. For example,
56968 </para>
56969 <literallayout class="monospaced">
56970 ETRN #brigadoon
56971 </literallayout>
56972 <para>
56973 runs the command
56974 </para>
56975 <literallayout class="monospaced">
56976 exim -R brigadoon
56977 </literallayout>
56978 <para>
56979 which causes a delivery attempt on all messages with undelivered addresses
56980 containing the text <quote>brigadoon</quote>. When <option>smtp_etrn_serialize</option> is set (the
56981 default), Exim prevents the simultaneous execution of more than one queue run
56982 for the same argument string as a result of an ETRN command. This stops
56983 a misbehaving client from starting more than one queue runner at once.
56984 </para>
56985 <para>
56986 <indexterm role="concept">
56987 <primary>hints database</primary>
56988 <secondary>ETRN serialization</secondary>
56989 </indexterm>
56990 Exim implements the serialization by means of a hints database in which a
56991 record is written whenever a process is started by ETRN, and deleted when
56992 the process completes. However, Exim does not keep the SMTP session waiting for
56993 the ETRN process to complete. Once ETRN is accepted, the client is sent
56994 a <quote>success</quote> return code. Obviously there is scope for hints records to get
56995 left lying around if there is a system or program crash. To guard against this,
56996 Exim ignores any records that are more than six hours old.
56997 </para>
56998 <para>
56999 <indexterm role="option">
57000 <primary><option>smtp_etrn_command</option></primary>
57001 </indexterm>
57002 For more control over what ETRN does, the <option>smtp_etrn_command</option> option can
57003 used. This specifies a command that is run whenever ETRN is received,
57004 whatever the form of its argument. For
57005 example:
57006 </para>
57007 <literallayout class="monospaced">
57008 smtp_etrn_command = /etc/etrn_command $domain \
57009                     $sender_host_address
57010 </literallayout>
57011 <para>
57012 <indexterm role="variable">
57013 <primary><varname>$domain</varname></primary>
57014 </indexterm>
57015 The string is split up into arguments which are independently expanded. The
57016 expansion variable <varname>$domain</varname> is set to the argument of the ETRN command,
57017 and no syntax checking is done on the contents of this argument. Exim does not
57018 wait for the command to complete, so its status code is not checked. Exim runs
57019 under its own uid and gid when receiving incoming SMTP, so it is not possible
57020 for it to change them before running the command.
57021 </para>
57022 </section>
57023 <section id="SECID238">
57024 <title>Incoming local SMTP</title>
57025 <para>
57026 <indexterm role="concept">
57027 <primary>SMTP</primary>
57028 <secondary>local incoming</secondary>
57029 </indexterm>
57030 Some user agents use SMTP to pass messages to their local MTA using the
57031 standard input and output, as opposed to passing the envelope on the command
57032 line and writing the message to the standard input. This is supported by the
57033 <option>-bs</option> option. This form of SMTP is handled in the same way as incoming
57034 messages over TCP/IP (including the use of ACLs), except that the envelope
57035 sender given in a MAIL command is ignored unless the caller is trusted. In
57036 an ACL you can detect this form of SMTP input by testing for an empty host
57037 identification. It is common to have this as the first line in the ACL that
57038 runs for RCPT commands:
57039 </para>
57040 <literallayout class="monospaced">
57041 accept hosts = :
57042 </literallayout>
57043 <para>
57044 This accepts SMTP messages from local processes without doing any other tests.
57045 </para>
57046 </section>
57047 <section id="SECTbatchSMTP">
57048 <title>Outgoing batched SMTP</title>
57049 <para>
57050 <indexterm role="concept">
57051 <primary>SMTP</primary>
57052 <secondary>batched outgoing</secondary>
57053 </indexterm>
57054 <indexterm role="concept">
57055 <primary>batched SMTP output</primary>
57056 </indexterm>
57057 Both the <command>appendfile</command> and <command>pipe</command> transports can be used for handling
57058 batched SMTP. Each has an option called <option>use_bsmtp</option> which causes messages to
57059 be output in BSMTP format. No SMTP responses are possible for this form of
57060 delivery. All it is doing is using SMTP commands as a way of transmitting the
57061 envelope along with the message.
57062 </para>
57063 <para>
57064 The message is written to the file or pipe preceded by the SMTP commands
57065 MAIL and RCPT, and followed by a line containing a single dot. Lines in
57066 the message that start with a dot have an extra dot added. The SMTP command
57067 HELO is not normally used. If it is required, the <option>message_prefix</option> option
57068 can be used to specify it.
57069 </para>
57070 <para>
57071 Because <command>appendfile</command> and <command>pipe</command> are both local transports, they accept only
57072 one recipient address at a time by default. However, you can arrange for them
57073 to handle several addresses at once by setting the <option>batch_max</option> option. When
57074 this is done for BSMTP, messages may contain multiple RCPT commands. See
57075 chapter <xref linkend="CHAPbatching"/> for more details.
57076 </para>
57077 <para>
57078 <indexterm role="variable">
57079 <primary><varname>$host</varname></primary>
57080 </indexterm>
57081 When one or more addresses are routed to a BSMTP transport by a router that
57082 sets up a host list, the name of the first host on the list is available to the
57083 transport in the variable <varname>$host</varname>. Here is an example of such a transport and
57084 router:
57085 </para>
57086 <literallayout class="monospaced">
57087 begin routers
57088 route_append:
57089   driver = manualroute
57090   transport = smtp_appendfile
57091   route_list = domain.example  batch.host.example
57092
57093 begin transports
57094 smtp_appendfile:
57095   driver = appendfile
57096   directory = /var/bsmtp/$host
57097   batch_max = 1000
57098   use_bsmtp
57099   user = exim
57100 </literallayout>
57101 <para>
57102 This causes messages addressed to <emphasis>domain.example</emphasis> to be written in BSMTP
57103 format to <filename>/var/bsmtp/batch.host.example</filename>, with only a single copy of each
57104 message (unless there are more than 1000 recipients).
57105 </para>
57106 </section>
57107 <section id="SECTincomingbatchedSMTP">
57108 <title>Incoming batched SMTP</title>
57109 <para>
57110 <indexterm role="concept">
57111 <primary>SMTP</primary>
57112 <secondary>batched incoming</secondary>
57113 </indexterm>
57114 <indexterm role="concept">
57115 <primary>batched SMTP input</primary>
57116 </indexterm>
57117 The <option>-bS</option> command line option causes Exim to accept one or more messages by
57118 reading SMTP on the standard input, but to generate no responses. If the caller
57119 is trusted, the senders in the MAIL commands are believed; otherwise the
57120 sender is always the caller of Exim. Unqualified senders and receivers are not
57121 rejected (there seems little point) but instead just get qualified. HELO
57122 and EHLO act as RSET; VRFY, EXPN, ETRN and  HELP, act
57123 as NOOP; QUIT quits.
57124 </para>
57125 <para revisionflag="changed">
57126 Minimal policy checking is done for BSMTP input. Only the non-SMTP
57127 ACL is run in the same way as for non-SMTP local input.
57128 </para>
57129 <para>
57130 If an error is detected while reading a message, including a missing <quote>.</quote> at
57131 the end, Exim gives up immediately. It writes details of the error to the
57132 standard output in a stylized way that the calling program should be able to
57133 make some use of automatically, for example:
57134 </para>
57135 <literallayout class="monospaced">
57136 554 Unexpected end of file
57137 Transaction started in line 10
57138 Error detected in line 14
57139 </literallayout>
57140 <para>
57141 It writes a more verbose version, for human consumption, to the standard error
57142 file, for example:
57143 </para>
57144 <literallayout class="monospaced">
57145 An error was detected while processing a file of BSMTP input.
57146 The error message was:
57147
57148 501 '&gt;' missing at end of address
57149
57150 The SMTP transaction started in line 10.
57151 The error was detected in line 12.
57152 The SMTP command at fault was:
57153
57154 rcpt to:&lt;malformed@in.com.plete
57155
57156 1 previous message was successfully processed.
57157 The rest of the batch was abandoned.
57158 </literallayout>
57159 <para>
57160 The return code from Exim is zero only if there were no errors. It is 1 if some
57161 messages were accepted before an error was detected, and 2 if no messages were
57162 accepted.
57163 <indexterm role="concept" startref="IIDsmtpproc1" class="endofrange"/>
57164 <indexterm role="concept" startref="IIDsmtpproc2" class="endofrange"/>
57165 </para>
57166 </section>
57167 </chapter>
57168
57169 <chapter id="CHAPemsgcust">
57170 <title>Customizing bounce and warning messages</title>
57171 <titleabbrev>Customizing messages</titleabbrev>
57172 <para>
57173 When a message fails to be delivered, or remains on the queue for more than a
57174 configured amount of time, Exim sends a message to the original sender, or
57175 to an alternative configured address. The text of these messages is built into
57176 the code of Exim, but it is possible to change it, either by adding a single
57177 string, or by replacing each of the paragraphs by text supplied in a file.
57178 </para>
57179 <para>
57180 The <emphasis>From:</emphasis> and <emphasis>To:</emphasis> header lines are automatically generated; you can
57181 cause a <emphasis>Reply-To:</emphasis> line to be added by setting the <option>errors_reply_to</option>
57182 option. Exim also adds the line
57183 </para>
57184 <literallayout class="monospaced">
57185 Auto-Submitted: auto-generated
57186 </literallayout>
57187 <para>
57188 to all warning and bounce messages,
57189 </para>
57190 <section id="SECID239">
57191 <title>Customizing bounce messages</title>
57192 <para>
57193 <indexterm role="concept">
57194 <primary>customizing</primary>
57195 <secondary>bounce message</secondary>
57196 </indexterm>
57197 <indexterm role="concept">
57198 <primary>bounce message</primary>
57199 <secondary>customizing</secondary>
57200 </indexterm>
57201 If <option>bounce_message_text</option> is set, its contents are included in the default
57202 message immediately after <quote>This message was created automatically by mail
57203 delivery software.</quote> The string is not expanded. It is not used if
57204 <option>bounce_message_file</option> is set.
57205 </para>
57206 <para>
57207 When <option>bounce_message_file</option> is set, it must point to a template file for
57208 constructing error messages. The file consists of a series of text items,
57209 separated by lines consisting of exactly four asterisks. If the file cannot be
57210 opened, default text is used and a message is written to the main and panic
57211 logs. If any text item in the file is empty, default text is used for that
57212 item.
57213 </para>
57214 <para>
57215 <indexterm role="variable">
57216 <primary><varname>$bounce_recipient</varname></primary>
57217 </indexterm>
57218 <indexterm role="variable">
57219 <primary><varname>$bounce_return_size_limit</varname></primary>
57220 </indexterm>
57221 Each item of text that is read from the file is expanded, and there are two
57222 expansion variables which can be of use here: <varname>$bounce_recipient</varname> is set to
57223 the recipient of an error message while it is being created, and
57224 <varname>$bounce_return_size_limit</varname> contains the value of the <option>return_size_limit</option>
57225 option, rounded to a whole number.
57226 </para>
57227 <para>
57228 The items must appear in the file in the following order:
57229 </para>
57230 <itemizedlist>
57231 <listitem>
57232 <para>
57233 The first item is included in the headers, and should include at least a
57234 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
57235 </para>
57236 </listitem>
57237 <listitem>
57238 <para>
57239 The second item forms the start of the error message. After it, Exim lists the
57240 failing addresses with their error messages.
57241 </para>
57242 </listitem>
57243 <listitem>
57244 <para>
57245 The third item is used to introduce any text from pipe transports that is to be
57246 returned to the sender. It is omitted if there is no such text.
57247 </para>
57248 </listitem>
57249 <listitem>
57250 <para>
57251 The fourth item is used to introduce the copy of the message that is returned
57252 as part of the error report.
57253 </para>
57254 </listitem>
57255 <listitem>
57256 <para>
57257 The fifth item is added after the fourth one if the returned message is
57258 truncated because it is bigger than <option>return_size_limit</option>.
57259 </para>
57260 </listitem>
57261 <listitem>
57262 <para>
57263 The sixth item is added after the copy of the original message.
57264 </para>
57265 </listitem>
57266 </itemizedlist>
57267 <para>
57268 The default state (<option>bounce_message_file</option> unset) is equivalent to the
57269 following file, in which the sixth item is empty. The <emphasis>Subject:</emphasis> and some
57270 other lines have been split in order to fit them on the page:
57271 </para>
57272 <literallayout class="monospaced">
57273 Subject: Mail delivery failed
57274   ${if eq{$sender_address}{$bounce_recipient}
57275   {: returning message to sender}}
57276 ****
57277 This message was created automatically by mail delivery software.
57278
57279 A message ${if eq{$sender_address}{$bounce_recipient}
57280   {that you sent }{sent by
57281
57282 &lt;$sender_address&gt;
57283
57284 }}could not be delivered to all of its recipients.
57285 This is a permanent error. The following address(es) failed:
57286 ****
57287 The following text was generated during the delivery attempt(s):
57288 ****
57289 ------ This is a copy of the message, including all the headers.
57290   ------
57291 ****
57292 ------ The body of the message is $message_size characters long;
57293   only the first
57294 ------ $bounce_return_size_limit or so are included here.
57295 ****
57296 </literallayout>
57297 </section>
57298 <section id="SECTcustwarn">
57299 <title>Customizing warning messages</title>
57300 <para>
57301 <indexterm role="concept">
57302 <primary>customizing</primary>
57303 <secondary>warning message</secondary>
57304 </indexterm>
57305 <indexterm role="concept">
57306 <primary>warning of delay</primary>
57307 <secondary>customizing the message</secondary>
57308 </indexterm>
57309 The option <option>warn_message_file</option> can be pointed at a template file for use when
57310 warnings about message delays are created. In this case there are only three
57311 text sections:
57312 </para>
57313 <itemizedlist>
57314 <listitem>
57315 <para>
57316 The first item is included in the headers, and should include at least a
57317 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
57318 </para>
57319 </listitem>
57320 <listitem>
57321 <para>
57322 The second item forms the start of the warning message. After it, Exim lists
57323 the delayed addresses.
57324 </para>
57325 </listitem>
57326 <listitem>
57327 <para>
57328 The third item then ends the message.
57329 </para>
57330 </listitem>
57331 </itemizedlist>
57332 <para>
57333 The default state is equivalent to the following file, except that some lines
57334 have been split here, in order to fit them on the page:
57335 </para>
57336 <literallayout class="monospaced">
57337 Subject: Warning: message $message_exim_id delayed
57338   $warn_message_delay
57339 ****
57340 This message was created automatically by mail delivery software.
57341
57342 A message ${if eq{$sender_address}{$warn_message_recipients}
57343 {that you sent }{sent by
57344
57345 &lt;$sender_address&gt;
57346
57347 }}has not been delivered to all of its recipients after
57348 more than $warn_message_delay on the queue on $primary_hostname.
57349
57350 The message identifier is:     $message_exim_id
57351 The subject of the message is: $h_subject
57352 The date of the message is:    $h_date
57353
57354 The following address(es) have not yet been delivered:
57355 ****
57356 No action is required on your part. Delivery attempts will
57357 continue for some time, and this warning may be repeated at
57358 intervals if the message remains undelivered. Eventually the
57359 mail delivery software will give up, and when that happens,
57360 the message will be returned to you.
57361 </literallayout>
57362 <para>
57363 <indexterm role="variable">
57364 <primary><varname>$warn_message_delay</varname></primary>
57365 </indexterm>
57366 <indexterm role="variable">
57367 <primary><varname>$warn_message_recipients</varname></primary>
57368 </indexterm>
57369 However, in the default state the subject and date lines are omitted if no
57370 appropriate headers exist. During the expansion of this file,
57371 <varname>$warn_message_delay</varname> is set to the delay time in one of the forms <quote>&lt;<emphasis>n</emphasis>&gt;
57372 minutes</quote> or <quote>&lt;<emphasis>n</emphasis>&gt; hours</quote>, and <varname>$warn_message_recipients</varname> contains a list
57373 of recipients for the warning message. There may be more than one if there are
57374 multiple addresses with different <option>errors_to</option> settings on the routers that
57375 handled them.
57376 </para>
57377 </section>
57378 </chapter>
57379
57380 <chapter id="CHAPcomconreq">
57381 <title>Some common configuration settings</title>
57382 <para>
57383 This chapter discusses some configuration settings that seem to be fairly
57384 common. More examples and discussion can be found in the Exim book.
57385 </para>
57386 <section id="SECID240">
57387 <title>Sending mail to a smart host</title>
57388 <para>
57389 <indexterm role="concept">
57390 <primary>smart host</primary>
57391 <secondary>example router</secondary>
57392 </indexterm>
57393 If you want to send all mail for non-local domains to a <quote>smart host</quote>, you
57394 should replace the default <command>dnslookup</command> router with a router which does the
57395 routing explicitly:
57396 </para>
57397 <literallayout class="monospaced">
57398 send_to_smart_host:
57399   driver = manualroute
57400   route_list = !+local_domains smart.host.name
57401   transport = remote_smtp
57402 </literallayout>
57403 <para>
57404 You can use the smart host&#x2019;s IP address instead of the name if you wish.
57405 If you are using Exim only to submit messages to a smart host, and not for
57406 receiving incoming messages, you can arrange for it to do the submission
57407 synchronously by setting the <option>mua_wrapper</option> option (see chapter
57408 <xref linkend="CHAPnonqueueing"/>).
57409 </para>
57410 </section>
57411 <section id="SECTmailinglists">
57412 <title>Using Exim to handle mailing lists</title>
57413 <para>
57414 <indexterm role="concept">
57415 <primary>mailing lists</primary>
57416 </indexterm>
57417 Exim can be used to run simple mailing lists, but for large and/or complicated
57418 requirements, the use of additional specialized mailing list software such as
57419 Majordomo or Mailman is recommended.
57420 </para>
57421 <para>
57422 The <command>redirect</command> router can be used to handle mailing lists where each list
57423 is maintained in a separate file, which can therefore be managed by an
57424 independent manager. The <option>domains</option> router option can be used to run these
57425 lists in a separate domain from normal mail. For example:
57426 </para>
57427 <literallayout class="monospaced">
57428 lists:
57429   driver = redirect
57430   domains = lists.example
57431   file = /usr/lists/$local_part
57432   forbid_pipe
57433   forbid_file
57434   errors_to = $local_part-request@lists.example
57435   no_more
57436 </literallayout>
57437 <para>
57438 This router is skipped for domains other than <emphasis>lists.example</emphasis>. For addresses
57439 in that domain, it looks for a file that matches the local part. If there is no
57440 such file, the router declines, but because <option>no_more</option> is set, no subsequent
57441 routers are tried, and so the whole delivery fails.
57442 </para>
57443 <para>
57444 The <option>forbid_pipe</option> and <option>forbid_file</option> options prevent a local part from being
57445 expanded into a file name or a pipe delivery, which is usually inappropriate in
57446 a mailing list.
57447 </para>
57448 <para>
57449 <indexterm role="option">
57450 <primary><option>errors_to</option></primary>
57451 </indexterm>
57452 The <option>errors_to</option> option specifies that any delivery errors caused by addresses
57453 taken from a mailing list are to be sent to the given address rather than the
57454 original sender of the message. However, before acting on this, Exim verifies
57455 the error address, and ignores it if verification fails.
57456 </para>
57457 <para>
57458 For example, using the configuration above, mail sent to
57459 <emphasis>dicts@lists.example</emphasis> is passed on to those addresses contained in
57460 <filename>/usr/lists/dicts</filename>, with error reports directed to
57461 <emphasis>dicts-request@lists.example</emphasis>, provided that this address can be verified.
57462 There could be a file called <filename>/usr/lists/dicts-request</filename> containing
57463 the address(es) of this particular list&#x2019;s manager(s), but other approaches,
57464 such as setting up an earlier router (possibly using the <option>local_part_prefix</option>
57465 or <option>local_part_suffix</option> options) to handle addresses of the form
57466 <option>owner-</option><emphasis>xxx</emphasis> or <option>xxx-</option><emphasis>request</emphasis>, are also possible.
57467 </para>
57468 </section>
57469 <section id="SECID241">
57470 <title>Syntax errors in mailing lists</title>
57471 <para>
57472 <indexterm role="concept">
57473 <primary>mailing lists</primary>
57474 <secondary>syntax errors in</secondary>
57475 </indexterm>
57476 If an entry in redirection data contains a syntax error, Exim normally defers
57477 delivery of the original address. That means that a syntax error in a mailing
57478 list holds up all deliveries to the list. This may not be appropriate when a
57479 list is being maintained automatically from data supplied by users, and the
57480 addresses are not rigorously checked.
57481 </para>
57482 <para>
57483 If the <option>skip_syntax_errors</option> option is set, the <command>redirect</command> router just skips
57484 entries that fail to parse, noting the incident in the log. If in addition
57485 <option>syntax_errors_to</option> is set to a verifiable address, a message is sent to it
57486 whenever a broken address is skipped. It is usually appropriate to set
57487 <option>syntax_errors_to</option> to the same address as <option>errors_to</option>.
57488 </para>
57489 </section>
57490 <section id="SECID242">
57491 <title>Re-expansion of mailing lists</title>
57492 <para>
57493 <indexterm role="concept">
57494 <primary>mailing lists</primary>
57495 <secondary>re-expansion of</secondary>
57496 </indexterm>
57497 Exim remembers every individual address to which a message has been delivered,
57498 in order to avoid duplication, but it normally stores only the original
57499 recipient addresses with a message. If all the deliveries to a mailing list
57500 cannot be done at the first attempt, the mailing list is re-expanded when the
57501 delivery is next tried. This means that alterations to the list are taken into
57502 account at each delivery attempt, so addresses that have been added to
57503 the list since the message arrived will therefore receive a copy of the
57504 message, even though it pre-dates their subscription.
57505 </para>
57506 <para>
57507 If this behaviour is felt to be undesirable, the <option>one_time</option> option can be set
57508 on the <command>redirect</command> router. If this is done, any addresses generated by the
57509 router that fail to deliver at the first attempt are added to the message as
57510 <quote>top level</quote> addresses, and the parent address that generated them is marked
57511 <quote>delivered</quote>. Thus, expansion of the mailing list does not happen again at the
57512 subsequent delivery attempts. The disadvantage of this is that if any of the
57513 failing addresses are incorrect, correcting them in the file has no effect on
57514 pre-existing messages.
57515 </para>
57516 <para>
57517 The original top-level address is remembered with each of the generated
57518 addresses, and is output in any log messages. However, any intermediate parent
57519 addresses are not recorded. This makes a difference to the log only if the
57520 <option>all_parents</option> selector is set, but for mailing lists there is normally only
57521 one level of expansion anyway.
57522 </para>
57523 </section>
57524 <section id="SECID243">
57525 <title>Closed mailing lists</title>
57526 <para>
57527 <indexterm role="concept">
57528 <primary>mailing lists</primary>
57529 <secondary>closed</secondary>
57530 </indexterm>
57531 The examples so far have assumed open mailing lists, to which anybody may
57532 send mail. It is also possible to set up closed lists, where mail is accepted
57533 from specified senders only. This is done by making use of the generic
57534 <option>senders</option> option to restrict the router that handles the list.
57535 </para>
57536 <para>
57537 The following example uses the same file as a list of recipients and as a list
57538 of permitted senders. It requires three routers:
57539 </para>
57540 <literallayout class="monospaced">
57541 lists_request:
57542   driver = redirect
57543   domains = lists.example
57544   local_part_suffix = -request
57545   file = /usr/lists/$local_part$local_part_suffix
57546   no_more
57547
57548 lists_post:
57549   driver = redirect
57550   domains = lists.example
57551   senders = ${if exists {/usr/lists/$local_part}\
57552              {lsearch;/usr/lists/$local_part}{*}}
57553   file = /usr/lists/$local_part
57554   forbid_pipe
57555   forbid_file
57556   errors_to = $local_part-request@lists.example
57557   no_more
57558
57559 lists_closed:
57560   driver = redirect
57561   domains = lists.example
57562   allow_fail
57563   data = :fail: $local_part@lists.example is a closed mailing list
57564 </literallayout>
57565 <para>
57566 All three routers have the same <option>domains</option> setting, so for any other domains,
57567 they are all skipped. The first router runs only if the local part ends in
57568 <option>-request</option>. It handles messages to the list manager(s) by means of an open
57569 mailing list.
57570 </para>
57571 <para>
57572 The second router runs only if the <option>senders</option> precondition is satisfied. It
57573 checks for the existence of a list that corresponds to the local part, and then
57574 checks that the sender is on the list by means of a linear search. It is
57575 necessary to check for the existence of the file before trying to search it,
57576 because otherwise Exim thinks there is a configuration error. If the file does
57577 not exist, the expansion of <option>senders</option> is *, which matches all senders. This
57578 means that the router runs, but because there is no list, declines, and
57579 <option>no_more</option> ensures that no further routers are run. The address fails with an
57580 <quote>unrouteable address</quote> error.
57581 </para>
57582 <para>
57583 The third router runs only if the second router is skipped, which happens when
57584 a mailing list exists, but the sender is not on it. This router forcibly fails
57585 the address, giving a suitable error message.
57586 </para>
57587 </section>
57588 <section id="SECTverp">
57589 <title>Variable Envelope Return Paths (VERP)</title>
57590 <para>
57591 <indexterm role="concept">
57592 <primary>VERP</primary>
57593 </indexterm>
57594 <indexterm role="concept">
57595 <primary>Variable Envelope Return Paths</primary>
57596 </indexterm>
57597 <indexterm role="concept">
57598 <primary>envelope sender</primary>
57599 </indexterm>
57600 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;
57601 are a way of helping mailing list administrators discover which subscription
57602 address is the cause of a particular delivery failure. The idea is to encode
57603 the original recipient address in the outgoing envelope sender address, so that
57604 if the message is forwarded by another host and then subsequently bounces, the
57605 original recipient can be extracted from the recipient address of the bounce.
57606 </para>
57607 <para>
57608 <indexterm role="option">
57609 <primary><option>errors_to</option></primary>
57610 </indexterm>
57611 <indexterm role="option">
57612 <primary><option>return_path</option></primary>
57613 </indexterm>
57614 Envelope sender addresses can be modified by Exim using two different
57615 facilities: the <option>errors_to</option> option on a router (as shown in previous mailing
57616 list examples), or the <option>return_path</option> option on a transport. The second of
57617 these is effective only if the message is successfully delivered to another
57618 host; it is not used for errors detected on the local host (see the description
57619 of <option>return_path</option> in chapter <xref linkend="CHAPtransportgeneric"/>). Here is an example
57620 of the use of <option>return_path</option> to implement VERP on an <command>smtp</command> transport:
57621 </para>
57622 <literallayout class="monospaced">
57623 verp_smtp:
57624   driver = smtp
57625   max_rcpt = 1
57626   return_path = \
57627     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
57628       {$1-request+$local_part=$domain@your.dom.example}fail}
57629 </literallayout>
57630 <para>
57631 This has the effect of rewriting the return path (envelope sender) on outgoing
57632 SMTP messages, if the local part of the original return path ends in
57633 <quote>-request</quote>, and the domain is <emphasis>your.dom.example</emphasis>. The rewriting inserts the
57634 local part and domain of the recipient into the return path. Suppose, for
57635 example, that a message whose return path has been set to
57636 <emphasis>somelist-request@your.dom.example</emphasis> is sent to
57637 <emphasis>subscriber@other.dom.example</emphasis>. In the transport, the return path is
57638 rewritten as
57639 </para>
57640 <literallayout class="monospaced">
57641 somelist-request+subscriber=other.dom.example@your.dom.example
57642 </literallayout>
57643 <para>
57644 <indexterm role="variable">
57645 <primary><varname>$local_part</varname></primary>
57646 </indexterm>
57647 For this to work, you must tell Exim to send multiple copies of messages that
57648 have more than one recipient, so that each copy has just one recipient. This is
57649 achieved by setting <option>max_rcpt</option> to 1. Without this, a single copy of a message
57650 might be sent to several different recipients in the same domain, in which case
57651 <varname>$local_part</varname> is not available in the transport, because it is not unique.
57652 </para>
57653 <para>
57654 Unless your host is doing nothing but mailing list deliveries, you should
57655 probably use a separate transport for the VERP deliveries, so as not to use
57656 extra resources in making one-per-recipient copies for other deliveries. This
57657 can easily be done by expanding the <option>transport</option> option in the router:
57658 </para>
57659 <literallayout class="monospaced">
57660 dnslookup:
57661   driver = dnslookup
57662   domains = ! +local_domains
57663   transport = \
57664     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
57665       {verp_smtp}{remote_smtp}}
57666   no_more
57667 </literallayout>
57668 <para>
57669 If you want to change the return path using <option>errors_to</option> in a router instead
57670 of using <option>return_path</option> in the transport, you need to set <option>errors_to</option> on all
57671 routers that handle mailing list addresses. This will ensure that all delivery
57672 errors, including those detected on the local host, are sent to the VERP
57673 address.
57674 </para>
57675 <para>
57676 On a host that does no local deliveries and has no manual routing, only the
57677 <command>dnslookup</command> router needs to be changed. A special transport is not needed for
57678 SMTP deliveries. Every mailing list recipient has its own return path value,
57679 and so Exim must hand them to the transport one at a time. Here is an example
57680 of a <command>dnslookup</command> router that implements VERP:
57681 </para>
57682 <literallayout class="monospaced">
57683 verp_dnslookup:
57684   driver = dnslookup
57685   domains = ! +local_domains
57686   transport = remote_smtp
57687   errors_to = \
57688     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}}
57689      {$1-request+$local_part=$domain@your.dom.example}fail}
57690   no_more
57691 </literallayout>
57692 <para>
57693 Before you start sending out messages with VERPed return paths, you must also
57694 configure Exim to accept the bounce messages that come back to those paths.
57695 Typically this is done by setting a <option>local_part_suffix</option> option for a
57696 router, and using this to route the messages to wherever you want to handle
57697 them.
57698 </para>
57699 <para>
57700 The overhead incurred in using VERP depends very much on the size of the
57701 message, the number of recipient addresses that resolve to the same remote
57702 host, and the speed of the connection over which the message is being sent. If
57703 a lot of addresses resolve to the same host and the connection is slow, sending
57704 a separate copy of the message for each address may take substantially longer
57705 than sending a single copy with many recipients (for which VERP cannot be
57706 used).
57707 </para>
57708 </section>
57709 <section id="SECTvirtualdomains">
57710 <title>Virtual domains</title>
57711 <para>
57712 <indexterm role="concept">
57713 <primary>virtual domains</primary>
57714 </indexterm>
57715 <indexterm role="concept">
57716 <primary>domain</primary>
57717 <secondary>virtual</secondary>
57718 </indexterm>
57719 The phrase <emphasis>virtual domain</emphasis> is unfortunately used with two rather different
57720 meanings:
57721 </para>
57722 <itemizedlist>
57723 <listitem>
57724 <para>
57725 A domain for which there are no real mailboxes; all valid local parts are
57726 aliases for other email addresses. Common examples are organizational
57727 top-level domains and <quote>vanity</quote> domains.
57728 </para>
57729 </listitem>
57730 <listitem>
57731 <para>
57732 One of a number of independent domains that are all handled by the same host,
57733 with mailboxes on that host, but where the mailbox owners do not necessarily
57734 have login accounts on that host.
57735 </para>
57736 </listitem>
57737 </itemizedlist>
57738 <para>
57739 The first usage is probably more common, and does seem more <quote>virtual</quote> than
57740 the second. This kind of domain can be handled in Exim with a straightforward
57741 aliasing router. One approach is to create a separate alias file for each
57742 virtual domain. Exim can test for the existence of the alias file to determine
57743 whether the domain exists. The <command>dsearch</command> lookup type is useful here, leading
57744 to a router of this form:
57745 </para>
57746 <literallayout class="monospaced">
57747 virtual:
57748   driver = redirect
57749   domains = dsearch;/etc/mail/virtual
57750   data = ${lookup{$local_part}lsearch{/etc/mail/virtual/$domain}}
57751   no_more
57752 </literallayout>
57753 <para>
57754 The <option>domains</option> option specifies that the router is to be skipped, unless there
57755 is a file in the <filename>/etc/mail/virtual</filename> directory whose name is the same as the
57756 domain that is being processed. When the router runs, it looks up the local
57757 part in the file to find a new address (or list of addresses). The <option>no_more</option>
57758 setting ensures that if the lookup fails (leading to <option>data</option> being an empty
57759 string), Exim gives up on the address without trying any subsequent routers.
57760 </para>
57761 <para>
57762 This one router can handle all the virtual domains because the alias file names
57763 follow a fixed pattern. Permissions can be arranged so that appropriate people
57764 can edit the different alias files. A successful aliasing operation results in
57765 a new envelope recipient address, which is then routed from scratch.
57766 </para>
57767 <para>
57768 The other kind of <quote>virtual</quote> domain can also be handled in a straightforward
57769 way. One approach is to create a file for each domain containing a list of
57770 valid local parts, and use it in a router like this:
57771 </para>
57772 <literallayout class="monospaced">
57773 my_domains:
57774   driver = accept
57775   domains = dsearch;/etc/mail/domains
57776   local_parts = lsearch;/etc/mail/domains/$domain
57777   transport = my_mailboxes
57778 </literallayout>
57779 <para>
57780 The address is accepted if there is a file for the domain, and the local part
57781 can be found in the file. The <option>domains</option> option is used to check for the
57782 file&#x2019;s existence because <option>domains</option> is tested before the <option>local_parts</option>
57783 option (see section <xref linkend="SECTrouprecon"/>). You cannot use <option>require_files</option>,
57784 because that option is tested after <option>local_parts</option>. The transport is as
57785 follows:
57786 </para>
57787 <literallayout class="monospaced">
57788 my_mailboxes:
57789   driver = appendfile
57790   file = /var/mail/$domain/$local_part
57791   user = mail
57792 </literallayout>
57793 <para>
57794 This uses a directory of mailboxes for each domain. The <option>user</option> setting is
57795 required, to specify which uid is to be used for writing to the mailboxes.
57796 </para>
57797 <para>
57798 The configuration shown here is just one example of how you might support this
57799 requirement. There are many other ways this kind of configuration can be set
57800 up, for example, by using a database instead of separate files to hold all the
57801 information about the domains.
57802 </para>
57803 </section>
57804 <section id="SECTmulbox">
57805 <title>Multiple user mailboxes</title>
57806 <para>
57807 <indexterm role="concept">
57808 <primary>multiple mailboxes</primary>
57809 </indexterm>
57810 <indexterm role="concept">
57811 <primary>mailbox</primary>
57812 <secondary>multiple</secondary>
57813 </indexterm>
57814 <indexterm role="concept">
57815 <primary>local part</primary>
57816 <secondary>prefix</secondary>
57817 </indexterm>
57818 <indexterm role="concept">
57819 <primary>local part</primary>
57820 <secondary>suffix</secondary>
57821 </indexterm>
57822 Heavy email users often want to operate with multiple mailboxes, into which
57823 incoming mail is automatically sorted. A popular way of handling this is to
57824 allow users to use multiple sender addresses, so that replies can easily be
57825 identified. Users are permitted to add prefixes or suffixes to their local
57826 parts for this purpose. The wildcard facility of the generic router options
57827 <option>local_part_prefix</option> and <option>local_part_suffix</option> can be used for this. For
57828 example, consider this router:
57829 </para>
57830 <literallayout class="monospaced">
57831 userforward:
57832   driver = redirect
57833   check_local_user
57834   file = $home/.forward
57835   local_part_suffix = -*
57836   local_part_suffix_optional
57837   allow_filter
57838 </literallayout>
57839 <para>
57840 <indexterm role="variable">
57841 <primary><varname>$local_part_suffix</varname></primary>
57842 </indexterm>
57843 It runs a user&#x2019;s <filename>.forward</filename> file for all local parts of the form
57844 <emphasis>username-*</emphasis>. Within the filter file the user can distinguish different
57845 cases by testing the variable <varname>$local_part_suffix</varname>. For example:
57846 </para>
57847 <literallayout class="monospaced">
57848 if $local_part_suffix contains -special then
57849 save /home/$local_part/Mail/special
57850 endif
57851 </literallayout>
57852 <para>
57853 If the filter file does not exist, or does not deal with such addresses, they
57854 fall through to subsequent routers, and, assuming no subsequent use of the
57855 <option>local_part_suffix</option> option is made, they presumably fail. Thus, users have
57856 control over which suffixes are valid.
57857 </para>
57858 <para>
57859 Alternatively, a suffix can be used to trigger the use of a different
57860 <filename>.forward</filename> file &ndash; which is the way a similar facility is implemented in
57861 another MTA:
57862 </para>
57863 <literallayout class="monospaced">
57864 userforward:
57865   driver = redirect
57866   check_local_user
57867   file = $home/.forward$local_part_suffix
57868   local_part_suffix = -*
57869   local_part_suffix_optional
57870   allow_filter
57871 </literallayout>
57872 <para>
57873 If there is no suffix, <filename>.forward</filename> is used; if the suffix is <emphasis>-special</emphasis>, for
57874 example, <filename>.forward-special</filename> is used. Once again, if the appropriate file
57875 does not exist, or does not deal with the address, it is passed on to
57876 subsequent routers, which could, if required, look for an unqualified
57877 <filename>.forward</filename> file to use as a default.
57878 </para>
57879 </section>
57880 <section id="SECID244">
57881 <title>Simplified vacation processing</title>
57882 <para>
57883 <indexterm role="concept">
57884 <primary>vacation processing</primary>
57885 </indexterm>
57886 The traditional way of running the <emphasis>vacation</emphasis> program is for a user to set up
57887 a pipe command in a <filename>.forward</filename> file
57888 (see section <xref linkend="SECTspecitredli"/> for syntax details).
57889 This is prone to error by inexperienced users. There are two features of Exim
57890 that can be used to make this process simpler for users:
57891 </para>
57892 <itemizedlist>
57893 <listitem>
57894 <para>
57895 A local part prefix such as <quote>vacation-</quote> can be specified on a router which
57896 can cause the message to be delivered directly to the <emphasis>vacation</emphasis> program, or
57897 alternatively can use Exim&#x2019;s <command>autoreply</command> transport. The contents of a user&#x2019;s
57898 <filename>.forward</filename> file are then much simpler. For example:
57899 </para>
57900 <literallayout class="monospaced">
57901 spqr, vacation-spqr
57902 </literallayout>
57903 </listitem>
57904 <listitem>
57905 <para>
57906 The <option>require_files</option> generic router option can be used to trigger a
57907 vacation delivery by checking for the existence of a certain file in the
57908 user&#x2019;s home directory. The <option>unseen</option> generic option should also be used, to
57909 ensure that the original delivery also proceeds. In this case, all the user has
57910 to do is to create a file called, say, <filename>.vacation</filename>, containing a vacation
57911 message.
57912 </para>
57913 </listitem>
57914 </itemizedlist>
57915 <para>
57916 Another advantage of both these methods is that they both work even when the
57917 use of arbitrary pipes by users is locked out.
57918 </para>
57919 </section>
57920 <section id="SECID245">
57921 <title>Taking copies of mail</title>
57922 <para>
57923 <indexterm role="concept">
57924 <primary>message</primary>
57925 <secondary>copying every</secondary>
57926 </indexterm>
57927 Some installations have policies that require archive copies of all messages to
57928 be made. A single copy of each message can easily be taken by an appropriate
57929 command in a system filter, which could, for example, use a different file for
57930 each day&#x2019;s messages.
57931 </para>
57932 <para>
57933 There is also a shadow transport mechanism that can be used to take copies of
57934 messages that are successfully delivered by local transports, one copy per
57935 delivery. This could be used, <emphasis>inter alia</emphasis>, to implement automatic
57936 notification of delivery by sites that insist on doing such things.
57937 </para>
57938 </section>
57939 <section id="SECID246">
57940 <title>Intermittently connected hosts</title>
57941 <para>
57942 <indexterm role="concept">
57943 <primary>intermittently connected hosts</primary>
57944 </indexterm>
57945 It has become quite common (because it is cheaper) for hosts to connect to the
57946 Internet periodically rather than remain connected all the time. The normal
57947 arrangement is that mail for such hosts accumulates on a system that is
57948 permanently connected.
57949 </para>
57950 <para>
57951 Exim was designed for use on permanently connected hosts, and so it is not
57952 particularly well-suited to use in an intermittently connected environment.
57953 Nevertheless there are some features that can be used.
57954 </para>
57955 </section>
57956 <section id="SECID247">
57957 <title>Exim on the upstream server host</title>
57958 <para>
57959 It is tempting to arrange for incoming mail for the intermittently connected
57960 host to remain on Exim&#x2019;s queue until the client connects. However, this
57961 approach does not scale very well. Two different kinds of waiting message are
57962 being mixed up in the same queue &ndash; those that cannot be delivered because of
57963 some temporary problem, and those that are waiting for their destination host
57964 to connect. This makes it hard to manage the queue, as well as wasting
57965 resources, because each queue runner scans the entire queue.
57966 </para>
57967 <para>
57968 A better approach is to separate off those messages that are waiting for an
57969 intermittently connected host. This can be done by delivering these messages
57970 into local files in batch SMTP, <quote>mailstore</quote>, or other envelope-preserving
57971 format, from where they are transmitted by other software when their
57972 destination connects. This makes it easy to collect all the mail for one host
57973 in a single directory, and to apply local timeout rules on a per-message basis
57974 if required.
57975 </para>
57976 <para>
57977 On a very small scale, leaving the mail on Exim&#x2019;s queue can be made to work. If
57978 you are doing this, you should configure Exim with a long retry period for the
57979 intermittent host. For example:
57980 </para>
57981 <literallayout class="monospaced">
57982 cheshire.wonderland.fict.example    *   F,5d,24h
57983 </literallayout>
57984 <para>
57985 This stops a lot of failed delivery attempts from occurring, but Exim remembers
57986 which messages it has queued up for that host. Once the intermittent host comes
57987 online, forcing delivery of one message (either by using the <option>-M</option> or <option>-R</option>
57988 options, or by using the ETRN SMTP command (see section <xref linkend="SECTETRN"/>)
57989 causes all the queued up messages to be delivered, often down a single SMTP
57990 connection. While the host remains connected, any new messages get delivered
57991 immediately.
57992 </para>
57993 <para>
57994 If the connecting hosts do not have fixed IP addresses, that is, if a host is
57995 issued with a different IP address each time it connects, Exim&#x2019;s retry
57996 mechanisms on the holding host get confused, because the IP address is normally
57997 used as part of the key string for holding retry information. This can be
57998 avoided by unsetting <option>retry_include_ip_address</option> on the <command>smtp</command> transport.
57999 Since this has disadvantages for permanently connected hosts, it is best to
58000 arrange a separate transport for the intermittently connected ones.
58001 </para>
58002 </section>
58003 <section id="SECID248">
58004 <title>Exim on the intermittently connected client host</title>
58005 <para>
58006 The value of <option>smtp_accept_queue_per_connection</option> should probably be
58007 increased, or even set to zero (that is, disabled) on the intermittently
58008 connected host, so that all incoming messages down a single connection get
58009 delivered immediately.
58010 </para>
58011 <para>
58012 <indexterm role="concept">
58013 <primary>SMTP</primary>
58014 <secondary>passed connection</secondary>
58015 </indexterm>
58016 <indexterm role="concept">
58017 <primary>SMTP</primary>
58018 <secondary>multiple deliveries</secondary>
58019 </indexterm>
58020 <indexterm role="concept">
58021 <primary>multiple SMTP deliveries</primary>
58022 </indexterm>
58023 Mail waiting to be sent from an intermittently connected host will probably
58024 not have been routed, because without a connection DNS lookups are not
58025 possible. This means that if a normal queue run is done at connection time,
58026 each message is likely to be sent in a separate SMTP session. This can be
58027 avoided by starting the queue run with a command line option beginning with
58028 <option>-qq</option> instead of <option>-q</option>. In this case, the queue is scanned twice. In the
58029 first pass, routing is done but no deliveries take place. The second pass is a
58030 normal queue run; since all the messages have been previously routed, those
58031 destined for the same host are likely to get sent as multiple deliveries in a
58032 single SMTP connection.
58033 </para>
58034 </section>
58035 </chapter>
58036
58037 <chapter id="CHAPnonqueueing">
58038 <title>Using Exim as a non-queueing client</title>
58039 <titleabbrev>Exim as a non-queueing client</titleabbrev>
58040 <para>
58041 <indexterm role="concept">
58042 <primary>client, non-queueing</primary>
58043 </indexterm>
58044 <indexterm role="concept">
58045 <primary>smart host</primary>
58046 <secondary>suppressing queueing</secondary>
58047 </indexterm>
58048 On a personal computer, it is a common requirement for all
58049 email to be sent to a <quote>smart host</quote>. There are plenty of MUAs that can be
58050 configured to operate that way, for all the popular operating systems.
58051 However, there are some MUAs for Unix-like systems that cannot be so
58052 configured: they submit messages using the command line interface of
58053 <filename>/usr/sbin/sendmail</filename>. Furthermore, utility programs such as <emphasis>cron</emphasis> submit
58054 messages this way.
58055 </para>
58056 <para>
58057 If the personal computer runs continuously, there is no problem, because it can
58058 run a conventional MTA that handles delivery to the smart host, and deal with
58059 any delays via its queueing mechanism. However, if the computer does not run
58060 continuously or runs different operating systems at different times, queueing
58061 email is not desirable.
58062 </para>
58063 <para>
58064 There is therefore a requirement for something that can provide the
58065 <filename>/usr/sbin/sendmail</filename> interface but deliver messages to a smart host without
58066 any queueing or retrying facilities. Furthermore, the delivery to the smart
58067 host should be synchronous, so that if it fails, the sending MUA is immediately
58068 informed. In other words, we want something that extends an MUA that submits
58069 to a local MTA via the command line so that it behaves like one that submits
58070 to a remote smart host using TCP/SMTP.
58071 </para>
58072 <para>
58073 There are a number of applications (for example, there is one called <emphasis>ssmtp</emphasis>)
58074 that do this job. However, people have found them to be lacking in various
58075 ways. For instance, you might want to allow aliasing and forwarding to be done
58076 before sending a message to the smart host.
58077 </para>
58078 <para>
58079 Exim already had the necessary infrastructure for doing this job. Just a few
58080 tweaks were needed to make it behave as required, though it is somewhat of an
58081 overkill to use a fully-featured MTA for this purpose.
58082 </para>
58083 <para>
58084 <indexterm role="option">
58085 <primary><option>mua_wrapper</option></primary>
58086 </indexterm>
58087 There is a Boolean global option called <option>mua_wrapper</option>, defaulting false.
58088 Setting <option>mua_wrapper</option> true causes Exim to run in a special mode where it
58089 assumes that it is being used to <quote>wrap</quote> a command-line MUA in the manner
58090 just described. As well as setting <option>mua_wrapper</option>, you also need to provide a
58091 compatible router and transport configuration. Typically there will be just one
58092 router and one transport, sending everything to a smart host.
58093 </para>
58094 <para>
58095 When run in MUA wrapping mode, the behaviour of Exim changes in the
58096 following ways:
58097 </para>
58098 <itemizedlist>
58099 <listitem>
58100 <para>
58101 A daemon cannot be run, nor will Exim accept incoming messages from <emphasis>inetd</emphasis>.
58102 In other words, the only way to submit messages is via the command line.
58103 </para>
58104 </listitem>
58105 <listitem>
58106 <para>
58107 Each message is synchronously delivered as soon as it is received (<option>-odi</option> is
58108 assumed). All queueing options (<option>queue_only</option>, <option>queue_smtp_domains</option>,
58109 <option>control</option> in an ACL, etc.) are quietly ignored. The Exim reception process
58110 does not finish until the delivery attempt is complete. If the delivery is
58111 successful, a zero return code is given.
58112 </para>
58113 </listitem>
58114 <listitem>
58115 <para>
58116 Address redirection is permitted, but the final routing for all addresses must
58117 be to the same remote transport, and to the same list of hosts. Furthermore,
58118 the return address (envelope sender) must be the same for all recipients, as
58119 must any added or deleted header lines. In other words, it must be possible to
58120 deliver the message in a single SMTP transaction, however many recipients there
58121 are.
58122 </para>
58123 </listitem>
58124 <listitem>
58125 <para>
58126 If these conditions are not met, or if routing any address results in a
58127 failure or defer status, or if Exim is unable to deliver all the recipients
58128 successfully to one of the smart hosts, delivery of the entire message fails.
58129 </para>
58130 </listitem>
58131 <listitem>
58132 <para>
58133 Because no queueing is allowed, all failures are treated as permanent; there
58134 is no distinction between 4<emphasis>xx</emphasis> and 5<emphasis>xx</emphasis> SMTP response codes from the
58135 smart host. Furthermore, because only a single yes/no response can be given to
58136 the caller, it is not possible to deliver to some recipients and not others. If
58137 there is an error (temporary or permanent) for any recipient, all are failed.
58138 </para>
58139 </listitem>
58140 <listitem>
58141 <para>
58142 If more than one smart host is listed, Exim will try another host after a
58143 connection failure or a timeout, in the normal way. However, if this kind of
58144 failure happens for all the hosts, the delivery fails.
58145 </para>
58146 </listitem>
58147 <listitem>
58148 <para>
58149 When delivery fails, an error message is written to the standard error stream
58150 (as well as to Exim&#x2019;s log), and Exim exits to the caller with a return code
58151 value 1. The message is expunged from Exim&#x2019;s spool files. No bounce messages
58152 are ever generated.
58153 </para>
58154 </listitem>
58155 <listitem>
58156 <para>
58157 No retry data is maintained, and any retry rules are ignored.
58158 </para>
58159 </listitem>
58160 <listitem>
58161 <para>
58162 A number of Exim options are overridden: <option>deliver_drop_privilege</option> is forced
58163 true, <option>max_rcpt</option> in the <command>smtp</command> transport is forced to <quote>unlimited</quote>,
58164 <option>remote_max_parallel</option> is forced to one, and fallback hosts are ignored.
58165 </para>
58166 </listitem>
58167 </itemizedlist>
58168 <para>
58169 The overall effect is that Exim makes a single synchronous attempt to deliver
58170 the message, failing if there is any kind of problem. Because no local
58171 deliveries are done and no daemon can be run, Exim does not need root
58172 privilege. It should be possible to run it setuid to <emphasis>exim</emphasis> instead of setuid
58173 to <emphasis>root</emphasis>. See section <xref linkend="SECTrunexiwitpri"/> for a general discussion about
58174 the advantages and disadvantages of running without root privilege.
58175 </para>
58176 </chapter>
58177
58178 <chapter id="CHAPlog">
58179 <title>Log files</title>
58180 <para>
58181 <indexterm role="concept" id="IIDloggen" class="startofrange">
58182 <primary>log</primary>
58183 <secondary>general description</secondary>
58184 </indexterm>
58185 <indexterm role="concept">
58186 <primary>log</primary>
58187 <secondary>types of</secondary>
58188 </indexterm>
58189 Exim writes three different logs, referred to as the main log, the reject log,
58190 and the panic log:
58191 </para>
58192 <itemizedlist>
58193 <listitem>
58194 <para>
58195 <indexterm role="concept">
58196 <primary>main log</primary>
58197 </indexterm>
58198 The main log records the arrival of each message and each delivery in a single
58199 line in each case. The format is as compact as possible, in an attempt to keep
58200 down the size of log files. Two-character flag sequences make it easy to pick
58201 out these lines. A number of other events are recorded in the main log. Some of
58202 them are optional, in which case the <option>log_selector</option> option controls whether
58203 they are included or not. A Perl script called <emphasis>eximstats</emphasis>, which does simple
58204 analysis of main log files, is provided in the Exim distribution (see section
58205 <xref linkend="SECTmailstat"/>).
58206 </para>
58207 </listitem>
58208 <listitem>
58209 <para>
58210 <indexterm role="concept">
58211 <primary>reject log</primary>
58212 </indexterm>
58213 The reject log records information from messages that are rejected as a result
58214 of a configuration option (that is, for policy reasons).
58215 The first line of each rejection is a copy of the line that is also written to
58216 the main log. Then, if the message&#x2019;s header has been read at the time the log
58217 is written, its contents are written to this log. Only the original header
58218 lines are available; header lines added by ACLs are not logged. You can use the
58219 reject log to check that your policy controls are working correctly; on a busy
58220 host this may be easier than scanning the main log for rejection messages. You
58221 can suppress the writing of the reject log by setting <option>write_rejectlog</option>
58222 false.
58223 </para>
58224 </listitem>
58225 <listitem>
58226 <para>
58227 <indexterm role="concept">
58228 <primary>panic log</primary>
58229 </indexterm>
58230 <indexterm role="concept">
58231 <primary>system log</primary>
58232 </indexterm>
58233 When certain serious errors occur, Exim writes entries to its panic log. If the
58234 error is sufficiently disastrous, Exim bombs out afterwards. Panic log entries
58235 are usually written to the main log as well, but can get lost amid the mass of
58236 other entries. The panic log should be empty under normal circumstances. It is
58237 therefore a good idea to check it (or to have a <emphasis>cron</emphasis> script check it)
58238 regularly, in order to become aware of any problems. When Exim cannot open its
58239 panic log, it tries as a last resort to write to the system log (syslog). This
58240 is opened with LOG_PID+LOG_CONS and the facility code of LOG_MAIL. The
58241 message itself is written at priority LOG_CRIT.
58242 </para>
58243 </listitem>
58244 </itemizedlist>
58245 <para>
58246 Every log line starts with a timestamp, in the format shown in the following
58247 example. Note that many of the examples shown in this chapter are line-wrapped.
58248 In the log file, this would be all on one line:
58249 </para>
58250 <literallayout class="monospaced">
58251 2001-09-16 16:09:47 SMTP connection from [127.0.0.1] closed
58252   by QUIT
58253 </literallayout>
58254 <para>
58255 By default, the timestamps are in the local timezone. There are two
58256 ways of changing this:
58257 </para>
58258 <itemizedlist>
58259 <listitem>
58260 <para>
58261 You can set the <option>timezone</option> option to a different time zone; in particular, if
58262 you set
58263 </para>
58264 <literallayout class="monospaced">
58265 timezone = UTC
58266 </literallayout>
58267 <para>
58268 the timestamps will be in UTC (aka GMT).
58269 </para>
58270 </listitem>
58271 <listitem>
58272 <para>
58273 If you set <option>log_timezone</option> true, the time zone is added to the timestamp, for
58274 example:
58275 </para>
58276 <literallayout class="monospaced">
58277 2003-04-25 11:17:07 +0100 Start queue run: pid=12762
58278 </literallayout>
58279 </listitem>
58280 </itemizedlist>
58281 <para>
58282 <indexterm role="concept">
58283 <primary>log</primary>
58284 <secondary>process ids in</secondary>
58285 </indexterm>
58286 <indexterm role="concept">
58287 <primary>pid (process id)</primary>
58288 <secondary>in log lines</secondary>
58289 </indexterm>
58290 Exim does not include its process id in log lines by default, but you can
58291 request that it does so by specifying the <literal>pid</literal> log selector (see section
58292 <xref linkend="SECTlogselector"/>). When this is set, the process id is output, in square
58293 brackets, immediately after the time and date.
58294 </para>
58295 <section id="SECTwhelogwri">
58296 <title>Where the logs are written</title>
58297 <para>
58298 <indexterm role="concept">
58299 <primary>log</primary>
58300 <secondary>destination</secondary>
58301 </indexterm>
58302 <indexterm role="concept">
58303 <primary>log</primary>
58304 <secondary>to file</secondary>
58305 </indexterm>
58306 <indexterm role="concept">
58307 <primary>log</primary>
58308 <secondary>to syslog</secondary>
58309 </indexterm>
58310 <indexterm role="concept">
58311 <primary>syslog</primary>
58312 </indexterm>
58313 The logs may be written to local files, or to syslog, or both. However, it
58314 should be noted that many syslog implementations use UDP as a transport, and
58315 are therefore unreliable in the sense that messages are not guaranteed to
58316 arrive at the loghost, nor is the ordering of messages necessarily maintained.
58317 It has also been reported that on large log files (tens of megabytes) you may
58318 need to tweak syslog to prevent it syncing the file with each write &ndash; on
58319 Linux this has been seen to make syslog take 90% plus of CPU time.
58320 </para>
58321 <para>
58322 The destination for Exim&#x2019;s logs is configured by setting LOG_FILE_PATH in
58323 <filename>Local/Makefile</filename> or by setting <option>log_file_path</option> in the run time
58324 configuration. This latter string is expanded, so it can contain, for example,
58325 references to the host name:
58326 </para>
58327 <literallayout class="monospaced">
58328 log_file_path = /var/log/$primary_hostname/exim_%slog
58329 </literallayout>
58330 <para>
58331 It is generally advisable, however, to set the string in <filename>Local/Makefile</filename>
58332 rather than at run time, because then the setting is available right from the
58333 start of Exim&#x2019;s execution. Otherwise, if there&#x2019;s something it wants to log
58334 before it has read the configuration file (for example, an error in the
58335 configuration file) it will not use the path you want, and may not be able to
58336 log at all.
58337 </para>
58338 <para>
58339 The value of LOG_FILE_PATH or <option>log_file_path</option> is a colon-separated
58340 list, currently limited to at most two items. This is one option where the
58341 facility for changing a list separator may not be used. The list must always be
58342 colon-separated. If an item in the list is <quote>syslog</quote> then syslog is used;
58343 otherwise the item must either be an absolute path, containing <literal>%s</literal> at the
58344 point where <quote>main</quote>, <quote>reject</quote>, or <quote>panic</quote> is to be inserted, or be empty,
58345 implying the use of a default path.
58346 </para>
58347 <para>
58348 When Exim encounters an empty item in the list, it searches the list defined by
58349 LOG_FILE_PATH, and uses the first item it finds that is neither empty nor
58350 <quote>syslog</quote>. This means that an empty item in <option>log_file_path</option> can be used to
58351 mean <quote>use the path specified at build time</quote>. It no such item exists, log
58352 files are written in the <filename>log</filename> subdirectory of the spool directory. This is
58353 equivalent to the setting:
58354 </para>
58355 <literallayout class="monospaced">
58356 log_file_path = $spool_directory/log/%slog
58357 </literallayout>
58358 <para>
58359 If you do not specify anything at build time or run time, that is where the
58360 logs are written.
58361 </para>
58362 <para revisionflag="changed">
58363 A log file path may also contain <literal>%D</literal> or <literal>%M</literal> if datestamped log file names
58364 are in use &ndash; see section <xref linkend="SECTdatlogfil"/> below.
58365 </para>
58366 <para>
58367 Here are some examples of possible settings:
58368 </para>
58369 <literallayout>
58370 <literal>LOG_FILE_PATH=syslog                    </literal> syslog only
58371 <literal>LOG_FILE_PATH=:syslog                   </literal> syslog and default path
58372 <literal>LOG_FILE_PATH=syslog : /usr/log/exim_%s </literal> syslog and specified path
58373 <literal>LOG_FILE_PATH=/usr/log/exim_%s          </literal> specified path only
58374 </literallayout>
58375 <para>
58376 If there are more than two paths in the list, the first is used and a panic
58377 error is logged.
58378 </para>
58379 </section>
58380 <section id="SECID285">
58381 <title>Logging to local files that are periodically <quote>cycled</quote></title>
58382 <para>
58383 <indexterm role="concept">
58384 <primary>log</primary>
58385 <secondary>cycling local files</secondary>
58386 </indexterm>
58387 <indexterm role="concept">
58388 <primary>cycling logs</primary>
58389 </indexterm>
58390 <indexterm role="concept">
58391 <primary><emphasis>exicyclog</emphasis></primary>
58392 </indexterm>
58393 <indexterm role="concept">
58394 <primary>log</primary>
58395 <secondary>local files; writing to</secondary>
58396 </indexterm>
58397 Some operating systems provide centralized and standardized methods for cycling
58398 log files. For those that do not, a utility script called <emphasis>exicyclog</emphasis> is
58399 provided (see section <xref linkend="SECTcyclogfil"/>). This renames and compresses the
58400 main and reject logs each time it is called. The maximum number of old logs to
58401 keep can be set. It is suggested this script is run as a daily <emphasis>cron</emphasis> job.
58402 </para>
58403 <para>
58404 An Exim delivery process opens the main log when it first needs to write to it,
58405 and it keeps the file open in case subsequent entries are required &ndash; for
58406 example, if a number of different deliveries are being done for the same
58407 message. However, remote SMTP deliveries can take a long time, and this means
58408 that the file may be kept open long after it is renamed if <emphasis>exicyclog</emphasis> or
58409 something similar is being used to rename log files on a regular basis. To
58410 ensure that a switch of log files is noticed as soon as possible, Exim calls
58411 <function>stat()</function> on the main log&#x2019;s name before reusing an open file, and if the file
58412 does not exist, or its inode has changed, the old file is closed and Exim
58413 tries to open the main log from scratch. Thus, an old log file may remain open
58414 for quite some time, but no Exim processes should write to it once it has been
58415 renamed.
58416 </para>
58417 </section>
58418 <section id="SECTdatlogfil" revisionflag="changed">
58419 <title>Datestamped log files</title>
58420 <para revisionflag="changed">
58421 <indexterm role="concept">
58422 <primary>log</primary>
58423 <secondary>datestamped files</secondary>
58424 </indexterm>
58425 Instead of cycling the main and reject log files by renaming them
58426 periodically, some sites like to use files whose names contain a datestamp,
58427 for example, <filename>mainlog-20031225</filename>. The datestamp is in the form <filename>yyyymmdd</filename> or
58428 <filename>yyyymm</filename>. Exim has support for this way of working. It is enabled by setting
58429 the <option>log_file_path</option> option to a path that includes <literal>%D</literal> or <literal>%M</literal> at the
58430 point where the datestamp is required. For example:
58431 </para>
58432 <literallayout class="monospaced" revisionflag="changed">
58433 log_file_path = /var/spool/exim/log/%slog-%D
58434 log_file_path = /var/log/exim-%s-%D.log
58435 log_file_path = /var/spool/exim/log/%D-%slog
58436 log_file_path = /var/log/exim/%s.%M
58437 </literallayout>
58438 <para revisionflag="changed">
58439 As before, <literal>%s</literal> is replaced by <quote>main</quote> or <quote>reject</quote>; the following are
58440 examples of names generated by the above examples:
58441 </para>
58442 <literallayout class="monospaced" revisionflag="changed">
58443 /var/spool/exim/log/mainlog-20021225
58444 /var/log/exim-reject-20021225.log
58445 /var/spool/exim/log/20021225-mainlog
58446 /var/log/exim/main.200212
58447 </literallayout>
58448 <para revisionflag="changed">
58449 When this form of log file is specified, Exim automatically switches to new
58450 files at midnight. It does not make any attempt to compress old logs; you
58451 will need to write your own script if you require this. You should not
58452 run <emphasis>exicyclog</emphasis> with this form of logging.
58453 </para>
58454 <para revisionflag="changed">
58455 The location of the panic log is also determined by <option>log_file_path</option>, but it
58456 is not datestamped, because rotation of the panic log does not make sense.
58457 When generating the name of the panic log, <literal>%D</literal> or <literal>%M</literal> are removed from
58458 the string. In addition, if it immediately follows a slash, a following
58459 non-alphanumeric character is removed; otherwise a preceding non-alphanumeric
58460 character is removed. Thus, the four examples above would give these panic
58461 log names:
58462 </para>
58463 <literallayout class="monospaced" revisionflag="changed">
58464 /var/spool/exim/log/paniclog
58465 /var/log/exim-panic.log
58466 /var/spool/exim/log/paniclog
58467 /var/log/exim/panic
58468 </literallayout>
58469 </section>
58470 <section id="SECID249">
58471 <title>Logging to syslog</title>
58472 <para>
58473 <indexterm role="concept">
58474 <primary>log</primary>
58475 <secondary>syslog; writing to</secondary>
58476 </indexterm>
58477 The use of syslog does not change what Exim logs or the format of its messages,
58478 except in one respect. If <option>syslog_timestamp</option> is set false, the timestamps on
58479 Exim&#x2019;s log lines are omitted when these lines are sent to syslog. Apart from
58480 that, the same strings are written to syslog as to log files. The syslog
58481 <quote>facility</quote> is set to LOG_MAIL, and the program name to <quote>exim</quote>
58482 by default, but you can change these by setting the <option>syslog_facility</option> and
58483 <option>syslog_processname</option> options, respectively. If Exim was compiled with
58484 SYSLOG_LOG_PID set in <filename>Local/Makefile</filename> (this is the default in
58485 <filename>src/EDITME</filename>), then, on systems that permit it (all except ULTRIX), the
58486 LOG_PID flag is set so that the <function>syslog()</function> call adds the pid as well as
58487 the time and host name to each line.
58488 The three log streams are mapped onto syslog priorities as follows:
58489 </para>
58490 <itemizedlist>
58491 <listitem>
58492 <para>
58493 <emphasis>mainlog</emphasis> is mapped to LOG_INFO
58494 </para>
58495 </listitem>
58496 <listitem>
58497 <para>
58498 <emphasis>rejectlog</emphasis> is mapped to LOG_NOTICE
58499 </para>
58500 </listitem>
58501 <listitem>
58502 <para>
58503 <emphasis>paniclog</emphasis> is mapped to LOG_ALERT
58504 </para>
58505 </listitem>
58506 </itemizedlist>
58507 <para>
58508 Many log lines are written to both <emphasis>mainlog</emphasis> and <emphasis>rejectlog</emphasis>, and some are
58509 written to both <emphasis>mainlog</emphasis> and <emphasis>paniclog</emphasis>, so there will be duplicates if
58510 these are routed by syslog to the same place. You can suppress this duplication
58511 by setting <option>syslog_duplication</option> false.
58512 </para>
58513 <para>
58514 Exim&#x2019;s log lines can sometimes be very long, and some of its <emphasis>rejectlog</emphasis>
58515 entries contain multiple lines when headers are included. To cope with both
58516 these cases, entries written to syslog are split into separate <function>syslog()</function>
58517 calls at each internal newline, and also after a maximum of
58518 870 data characters. (This allows for a total syslog line length of 1024, when
58519 additions such as timestamps are added.) If you are running a syslog
58520 replacement that can handle lines longer than the 1024 characters allowed by
58521 RFC 3164, you should set
58522 </para>
58523 <literallayout class="monospaced">
58524 SYSLOG_LONG_LINES=yes
58525 </literallayout>
58526 <para>
58527 in <filename>Local/Makefile</filename> before building Exim. That stops Exim from splitting long
58528 lines, but it still splits at internal newlines in <emphasis>reject</emphasis> log entries.
58529 </para>
58530 <para>
58531 To make it easy to re-assemble split lines later, each component of a split
58532 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;]
58533 where &lt;<emphasis>n</emphasis>&gt; is the component number and &lt;<emphasis>m</emphasis>&gt; is the total number of
58534 components in the entry. The / delimiter is used when the line was split
58535 because it was too long; if it was split because of an internal newline, the \
58536 delimiter is used. For example, supposing the length limit to be 50 instead of
58537 870, the following would be the result of a typical rejection message to
58538 <emphasis>mainlog</emphasis> (LOG_INFO), each line in addition being preceded by the time, host
58539 name, and pid as added by syslog:
58540 </para>
58541 <literallayout class="monospaced">
58542 [1/5] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected from
58543 [2/5]  [127.0.0.1] (ph10): syntax error in 'From' header
58544 [3/5]  when scanning for sender: missing or malformed lo
58545 [4/5] cal part in "&lt;&gt;" (envelope sender is &lt;ph10@cam.exa
58546 [5/5] mple&gt;)
58547 </literallayout>
58548 <para>
58549 The same error might cause the following lines to be written to <quote>rejectlog</quote>
58550 (LOG_NOTICE):
58551 </para>
58552 <literallayout class="monospaced">
58553 [1/18] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected fro
58554 [2/18] m [127.0.0.1] (ph10): syntax error in 'From' head
58555 [3/18] er when scanning for sender: missing or malformed
58556 [4/18]  local part in "&lt;&gt;" (envelope sender is &lt;ph10@cam
58557 [5\18] .example&gt;)
58558 [6\18] Recipients: ph10@some.domain.cam.example
58559 [7\18] P Received: from [127.0.0.1] (ident=ph10)
58560 [8\18]        by xxxxx.cam.example with smtp (Exim 4.00)
58561 [9\18]        id 16RdAL-0006pc-00
58562 [10/18]        for ph10@cam.example; Mon, 16 Sep 2002 16:
58563 [11\18] 09:43 +0100
58564 [12\18] F From: &lt;&gt;
58565 [13\18]   Subject: this is a test header
58566 [18\18]   X-something: this is another header
58567 [15/18] I Message-Id: &lt;E16RdAL-0006pc-00@xxxxx.cam.examp
58568 [16\18] le&gt;
58569 [17\18] B Bcc:
58570 [18/18]   Date: Mon, 16 Sep 2002 16:09:43 +0100
58571 </literallayout>
58572 <para>
58573 Log lines that are neither too long nor contain newlines are written to syslog
58574 without modification.
58575 </para>
58576 <para>
58577 If only syslog is being used, the Exim monitor is unable to provide a log tail
58578 display, unless syslog is routing <emphasis>mainlog</emphasis> to a file on the local host and
58579 the environment variable EXIMON_LOG_FILE_PATH is set to tell the monitor
58580 where it is.
58581 </para>
58582 </section>
58583 <section id="SECID250">
58584 <title>Log line flags</title>
58585 <para>
58586 One line is written to the main log for each message received, and for each
58587 successful, unsuccessful, and delayed delivery. These lines can readily be
58588 picked out by the distinctive two-character flags that immediately follow the
58589 timestamp. The flags are:
58590 </para>
58591 <literallayout>
58592 <literal>&lt;=</literal>     message arrival
58593 <literal>=&gt;</literal>     normal message delivery
58594 <literal>-&gt;</literal>     additional address in same delivery
58595 <literal>*&gt;</literal>     delivery suppressed by <option>-N</option>
58596 <literal>**</literal>     delivery failed; address bounced
58597 <literal>==</literal>     delivery deferred; temporary problem
58598 </literallayout>
58599 </section>
58600 <section id="SECID251">
58601 <title>Logging message reception</title>
58602 <para>
58603 <indexterm role="concept">
58604 <primary>log</primary>
58605 <secondary>reception line</secondary>
58606 </indexterm>
58607 The format of the single-line entry in the main log that is written for every
58608 message received is shown in the basic example below, which is split over
58609 several lines in order to fit it on the page:
58610 </para>
58611 <literallayout class="monospaced">
58612 2002-10-31 08:57:53 16ZCW1-0005MB-00 &lt;= kryten@dwarf.fict.example
58613   H=mailer.fict.example [192.168.123.123] U=exim
58614   P=smtp S=5678 id=&lt;incoming message id&gt;
58615 </literallayout>
58616 <para>
58617 The address immediately following <quote>&lt;=</quote> is the envelope sender address. A
58618 bounce message is shown with the sender address <quote>&lt;&gt;</quote>, and if it is locally
58619 generated, this is followed by an item of the form
58620 </para>
58621 <literallayout class="monospaced">
58622 R=&lt;message id&gt;
58623 </literallayout>
58624 <para>
58625 which is a reference to the message that caused the bounce to be sent.
58626 </para>
58627 <para>
58628 <indexterm role="concept">
58629 <primary>HELO</primary>
58630 </indexterm>
58631 <indexterm role="concept">
58632 <primary>EHLO</primary>
58633 </indexterm>
58634 For messages from other hosts, the H and U fields identify the remote host and
58635 record the RFC 1413 identity of the user that sent the message, if one was
58636 received. The number given in square brackets is the IP address of the sending
58637 host. If there is a single, unparenthesized  host name in the H field, as
58638 above, it has been verified to correspond to the IP address (see the
58639 <option>host_lookup</option> option). If the name is in parentheses, it was the name quoted
58640 by the remote host in the SMTP HELO or EHLO command, and has not been
58641 verified. If verification yields a different name to that given for HELO or
58642 EHLO, the verified name appears first, followed by the HELO or EHLO
58643 name in parentheses.
58644 </para>
58645 <para>
58646 Misconfigured hosts (and mail forgers) sometimes put an IP address, with or
58647 without brackets, in the HELO or EHLO command, leading to entries in
58648 the log containing text like these examples:
58649 </para>
58650 <literallayout class="monospaced">
58651 H=(10.21.32.43) [192.168.8.34]
58652 H=([10.21.32.43]) [192.168.8.34]
58653 </literallayout>
58654 <para>
58655 This can be confusing. Only the final address in square brackets can be relied
58656 on.
58657 </para>
58658 <para>
58659 For locally generated messages (that is, messages not received over TCP/IP),
58660 the H field is omitted, and the U field contains the login name of the caller
58661 of Exim.
58662 </para>
58663 <para>
58664 <indexterm role="concept">
58665 <primary>authentication</primary>
58666 <secondary>logging</secondary>
58667 </indexterm>
58668 <indexterm role="concept">
58669 <primary>AUTH</primary>
58670 <secondary>logging</secondary>
58671 </indexterm>
58672 For all messages, the P field specifies the protocol used to receive the
58673 message. This is the value that is stored in <varname>$received_protocol</varname>. In the case
58674 of incoming SMTP messages, the value indicates whether or not any SMTP
58675 extensions (ESMTP), encryption, or authentication were used. If the SMTP
58676 session was encrypted, there is an additional X field that records the cipher
58677 suite that was used.
58678 </para>
58679 <para>
58680 The protocol is set to <quote>esmtpsa</quote> or <quote>esmtpa</quote> for messages received from
58681 hosts that have authenticated themselves using the SMTP AUTH command. The first
58682 value is used when the SMTP connection was encrypted (<quote>secure</quote>). In this case
58683 there is an additional item A= followed by the name of the authenticator that
58684 was used. If an authenticated identification was set up by the authenticator&#x2019;s
58685 <option>server_set_id</option> option, this is logged too, separated by a colon from the
58686 authenticator name.
58687 </para>
58688 <para>
58689 <indexterm role="concept">
58690 <primary>size</primary>
58691 <secondary>of message</secondary>
58692 </indexterm>
58693 The id field records the existing message id, if present. The size of the
58694 received message is given by the S field. When the message is delivered,
58695 headers may be removed or added, so that the size of delivered copies of the
58696 message may not correspond with this value (and indeed may be different to each
58697 other).
58698 </para>
58699 <para>
58700 The <option>log_selector</option> option can be used to request the logging of additional
58701 data when a message is received. See section <xref linkend="SECTlogselector"/> below.
58702 </para>
58703 </section>
58704 <section id="SECID252">
58705 <title>Logging deliveries</title>
58706 <para>
58707 <indexterm role="concept">
58708 <primary>log</primary>
58709 <secondary>delivery line</secondary>
58710 </indexterm>
58711 The format of the single-line entry in the main log that is written for every
58712 delivery is shown in one of the examples below, for local and remote
58713 deliveries, respectively. Each example has been split into two lines in order
58714 to fit it on the page:
58715 </para>
58716 <literallayout class="monospaced">
58717 2002-10-31 08:59:13 16ZCW1-0005MB-00 =&gt; marv
58718   &lt;marv@hitch.fict.example&gt; R=localuser T=local_delivery
58719 2002-10-31 09:00:10 16ZCW1-0005MB-00 =&gt;
58720   monk@holistic.fict.example R=dnslookup T=remote_smtp
58721   H=holistic.fict.example [192.168.234.234]
58722 </literallayout>
58723 <para>
58724 For ordinary local deliveries, the original address is given in angle brackets
58725 after the final delivery address, which might be a pipe or a file. If
58726 intermediate address(es) exist between the original and the final address, the
58727 last of these is given in parentheses after the final address. The R and T
58728 fields record the router and transport that were used to process the address.
58729 </para>
58730 <para>
58731 If a shadow transport was run after a successful local delivery, the log line
58732 for the successful delivery has an item added on the end, of the form
58733 </para>
58734 <literallayout>
58735 <literal>ST=&lt;</literal><emphasis>shadow transport name</emphasis><literal>&gt;</literal>
58736 </literallayout>
58737 <para>
58738 If the shadow transport did not succeed, the error message is put in
58739 parentheses afterwards.
58740 </para>
58741 <para>
58742 <indexterm role="concept">
58743 <primary>asterisk</primary>
58744 <secondary>after IP address</secondary>
58745 </indexterm>
58746 When more than one address is included in a single delivery (for example, two
58747 SMTP RCPT commands in one transaction) the second and subsequent addresses are
58748 flagged with <literal>-&gt;</literal> instead of <literal>=&gt;</literal>. When two or more messages are delivered
58749 down a single SMTP connection, an asterisk follows the IP address in the log
58750 lines for the second and subsequent messages.
58751 </para>
58752 <para>
58753 The generation of a reply message by a filter file gets logged as a
58754 <quote>delivery</quote> to the addressee, preceded by <quote>&gt;</quote>.
58755 </para>
58756 <para>
58757 The <option>log_selector</option> option can be used to request the logging of additional
58758 data when a message is delivered. See section <xref linkend="SECTlogselector"/> below.
58759 </para>
58760 </section>
58761 <section id="SECID253">
58762 <title>Discarded deliveries</title>
58763 <para>
58764 <indexterm role="concept">
58765 <primary>discarded messages</primary>
58766 </indexterm>
58767 <indexterm role="concept">
58768 <primary>message</primary>
58769 <secondary>discarded</secondary>
58770 </indexterm>
58771 <indexterm role="concept">
58772 <primary>delivery</primary>
58773 <secondary>discarded; logging</secondary>
58774 </indexterm>
58775 When a message is discarded as a result of the command <quote>seen finish</quote> being
58776 obeyed in a filter file which generates no deliveries, a log entry of the form
58777 </para>
58778 <literallayout class="monospaced">
58779 2002-12-10 00:50:49 16auJc-0001UB-00 =&gt; discarded
58780   &lt;low.club@bridge.example&gt; R=userforward
58781 </literallayout>
58782 <para>
58783 is written, to record why no deliveries are logged. When a message is discarded
58784 because it is aliased to <quote>:blackhole:</quote> the log line is like this:
58785 </para>
58786 <literallayout class="monospaced">
58787 1999-03-02 09:44:33 10HmaX-0005vi-00 =&gt; :blackhole:
58788   &lt;hole@nowhere.example&gt; R=blackhole_router
58789 </literallayout>
58790 </section>
58791 <section id="SECID254">
58792 <title>Deferred deliveries</title>
58793 <para>
58794 When a delivery is deferred, a line of the following form is logged:
58795 </para>
58796 <literallayout class="monospaced">
58797 2002-12-19 16:20:23 16aiQz-0002Q5-00 == marvin@endrest.example
58798   R=dnslookup T=smtp defer (146): Connection refused
58799 </literallayout>
58800 <para>
58801 In the case of remote deliveries, the error is the one that was given for the
58802 last IP address that was tried. Details of individual SMTP failures are also
58803 written to the log, so the above line would be preceded by something like
58804 </para>
58805 <literallayout class="monospaced">
58806 2002-12-19 16:20:23 16aiQz-0002Q5-00 Failed to connect to
58807   mail1.endrest.example [192.168.239.239]: Connection refused
58808 </literallayout>
58809 <para>
58810 When a deferred address is skipped because its retry time has not been reached,
58811 a message is written to the log, but this can be suppressed by setting an
58812 appropriate value in <option>log_selector</option>.
58813 </para>
58814 </section>
58815 <section id="SECID255">
58816 <title>Delivery failures</title>
58817 <para>
58818 <indexterm role="concept">
58819 <primary>delivery</primary>
58820 <secondary>failure; logging</secondary>
58821 </indexterm>
58822 If a delivery fails because an address cannot be routed, a line of the
58823 following form is logged:
58824 </para>
58825 <literallayout class="monospaced">
58826 1995-12-19 16:20:23 0tRiQz-0002Q5-00 ** jim@trek99.example
58827   &lt;jim@trek99.example&gt;: unknown mail domain
58828 </literallayout>
58829 <para>
58830 If a delivery fails at transport time, the router and transport are shown, and
58831 the response from the remote host is included, as in this example:
58832 </para>
58833 <literallayout class="monospaced">
58834 2002-07-11 07:14:17 17SXDU-000189-00 ** ace400@pb.example
58835   R=dnslookup T=remote_smtp: SMTP error from remote mailer
58836   after pipelined RCPT TO:&lt;ace400@pb.example&gt;: host
58837   pbmail3.py.example [192.168.63.111]: 553 5.3.0
58838   &lt;ace400@pb.example&gt;...Addressee unknown
58839 </literallayout>
58840 <para>
58841 The word <quote>pipelined</quote> indicates that the SMTP PIPELINING extension was being
58842 used. See <option>hosts_avoid_esmtp</option> in the <command>smtp</command> transport for a way of
58843 disabling PIPELINING. The log lines for all forms of delivery failure are
58844 flagged with <literal>**</literal>.
58845 </para>
58846 </section>
58847 <section id="SECID256">
58848 <title>Fake deliveries</title>
58849 <para>
58850 <indexterm role="concept">
58851 <primary>delivery</primary>
58852 <secondary>fake; logging</secondary>
58853 </indexterm>
58854 If a delivery does not actually take place because the <option>-N</option> option has been
58855 used to suppress it, a normal delivery line is written to the log, except that
58856 <quote>=&gt;</quote> is replaced by <quote>*&gt;</quote>.
58857 </para>
58858 </section>
58859 <section id="SECID257">
58860 <title>Completion</title>
58861 <para>
58862 A line of the form
58863 </para>
58864 <literallayout class="monospaced">
58865 2002-10-31 09:00:11 16ZCW1-0005MB-00 Completed
58866 </literallayout>
58867 <para>
58868 is written to the main log when a message is about to be removed from the spool
58869 at the end of its processing.
58870 </para>
58871 </section>
58872 <section id="SECID258">
58873 <title>Summary of Fields in Log Lines</title>
58874 <para>
58875 <indexterm role="concept">
58876 <primary>log</primary>
58877 <secondary>summary of fields</secondary>
58878 </indexterm>
58879 A summary of the field identifiers that are used in log lines is shown in
58880 the following table:
58881 </para>
58882 <literallayout>
58883 <literal>A   </literal>        authenticator name (and optional id)
58884 <literal>C   </literal>        SMTP confirmation on delivery
58885 <literal>    </literal>        command list for <quote>no mail in SMTP session</quote>
58886 <literal>CV  </literal>        certificate verification status
58887 <literal>D   </literal>        duration of <quote>no mail in SMTP session</quote>
58888 <literal>DN  </literal>        distinguished name from peer certificate
58889 <literal>DT  </literal>        on <literal>=&gt;</literal> lines: time taken for a delivery
58890 <literal>F   </literal>        sender address (on delivery lines)
58891 <literal>H   </literal>        host name and IP address
58892 <literal>I   </literal>        local interface used
58893 <literal>id  </literal>        message id for incoming message
58894 <literal>P   </literal>        on <literal>&lt;=</literal> lines: protocol used
58895 <literal>    </literal>        on <literal>=&gt;</literal> and <literal>**</literal> lines: return path
58896 <literal>QT  </literal>        on <literal>=&gt;</literal> lines: time spent on queue so far
58897 <literal>    </literal>        on <quote>Completed</quote> lines: time spent on queue
58898 <literal>R   </literal>        on <literal>&lt;=</literal> lines: reference for local bounce
58899 <literal>    </literal>        on <literal>=&gt;</literal>  <literal>**</literal> and <literal>==</literal> lines: router name
58900 <literal>S   </literal>        size of message
58901 <literal>ST  </literal>        shadow transport name
58902 <literal>T   </literal>        on <literal>&lt;=</literal> lines: message subject (topic)
58903 <literal>    </literal>        on <literal>=&gt;</literal> <literal>**</literal> and <literal>==</literal> lines: transport name
58904 <literal>U   </literal>        local user or RFC 1413 identity
58905 <literal>X   </literal>        TLS cipher suite
58906 </literallayout>
58907 </section>
58908 <section id="SECID259">
58909 <title>Other log entries</title>
58910 <para>
58911 Various other types of log entry are written from time to time. Most should be
58912 self-explanatory. Among the more common are:
58913 </para>
58914 <itemizedlist>
58915 <listitem>
58916 <para>
58917 <indexterm role="concept">
58918 <primary>retry</primary>
58919 <secondary>time not reached</secondary>
58920 </indexterm>
58921 <emphasis>retry time not reached</emphasis>&nbsp;&nbsp;An address previously suffered a temporary error
58922 during routing or local delivery, and the time to retry has not yet arrived.
58923 This message is not written to an individual message log file unless it happens
58924 during the first delivery attempt.
58925 </para>
58926 </listitem>
58927 <listitem>
58928 <para>
58929 <emphasis>retry time not reached for any host</emphasis>&nbsp;&nbsp;An address previously suffered
58930 temporary errors during remote delivery, and the retry time has not yet arrived
58931 for any of the hosts to which it is routed.
58932 </para>
58933 </listitem>
58934 <listitem>
58935 <para>
58936 <indexterm role="concept">
58937 <primary>spool directory</primary>
58938 <secondary>file locked</secondary>
58939 </indexterm>
58940 <emphasis>spool file locked</emphasis>&nbsp;&nbsp;An attempt to deliver a message cannot proceed because
58941 some other Exim process is already working on the message. This can be quite
58942 common if queue running processes are started at frequent intervals. The
58943 <emphasis>exiwhat</emphasis> utility script can be used to find out what Exim processes are
58944 doing.
58945 </para>
58946 </listitem>
58947 <listitem>
58948 <para>
58949 <indexterm role="concept">
58950 <primary>error</primary>
58951 <secondary>ignored</secondary>
58952 </indexterm>
58953 <emphasis>error ignored</emphasis>&nbsp;&nbsp;There are several circumstances that give rise to this
58954 message:
58955 </para>
58956 <orderedlist numeration="arabic">
58957 <listitem>
58958 <para>
58959 Exim failed to deliver a bounce message whose age was greater than
58960 <option>ignore_bounce_errors_after</option>. The bounce was discarded.
58961 </para>
58962 </listitem>
58963 <listitem>
58964 <para>
58965 A filter file set up a delivery using the <quote>noerror</quote> option, and the delivery
58966 failed. The delivery was discarded.
58967 </para>
58968 </listitem>
58969 <listitem>
58970 <para>
58971 A delivery set up by a router configured with
58972 </para>
58973 <literallayout class="monospaced">
58974     errors_to = &lt;&gt;
58975 </literallayout>
58976 <para>
58977 failed. The delivery was discarded.
58978 </para>
58979 </listitem>
58980 </orderedlist>
58981 </listitem>
58982 </itemizedlist>
58983 </section>
58984 <section id="SECTlogselector">
58985 <title>Reducing or increasing what is logged</title>
58986 <para>
58987 <indexterm role="concept">
58988 <primary>log</primary>
58989 <secondary>selectors</secondary>
58990 </indexterm>
58991 By setting the <option>log_selector</option> global option, you can disable some of Exim&#x2019;s
58992 default logging, or you can request additional logging. The value of
58993 <option>log_selector</option> is made up of names preceded by plus or minus characters. For
58994 example:
58995 </para>
58996 <literallayout class="monospaced">
58997 log_selector = +arguments -retry_defer
58998 </literallayout>
58999 <para>
59000 The list of optional log items is in the following table, with the default
59001 selection marked by asterisks:
59002 </para>
59003 <literallayout>
59004 <literal>*acl_warn_skipped           </literal>  skipped <option>warn</option> statement in ACL
59005 <literal> address_rewrite            </literal>  address rewriting
59006 <literal> all_parents                </literal>  all parents in =&gt; lines
59007 <literal> arguments                  </literal>  command line arguments
59008 <literal>*connection_reject          </literal>  connection rejections
59009 <literal>*delay_delivery             </literal>  immediate delivery delayed
59010 <literal> deliver_time               </literal>  time taken to perform delivery
59011 <literal> delivery_size              </literal>  add <literal>S=</literal><emphasis>nnn</emphasis> to =&gt; lines
59012 <literal>*dnslist_defer              </literal>  defers of DNS list (aka RBL) lookups
59013 <literal>*etrn                       </literal>  ETRN commands
59014 <literal>*host_lookup_failed         </literal>  as it says
59015 <literal> ident_timeout              </literal>  timeout for ident connection
59016 <literal> incoming_interface         </literal>  incoming interface on &lt;= lines
59017 <literal> incoming_port              </literal>  incoming port on &lt;= lines
59018 <literal>*lost_incoming_connection   </literal>  as it says (includes timeouts)
59019 <literal> outgoing_port              </literal>  add remote port to =&gt; lines
59020 <literal>*queue_run                  </literal>  start and end queue runs
59021 <literal> queue_time                 </literal>  time on queue for one recipient
59022 <literal> queue_time_overall         </literal>  time on queue for whole message
59023 <literal> pid                        </literal>  Exim process id
59024 <literal> received_recipients        </literal>  recipients on &lt;= lines
59025 <literal> received_sender            </literal>  sender on &lt;= lines
59026 <literal>*rejected_header            </literal>  header contents on reject log
59027 <literal>*retry_defer                </literal>  <quote>retry time not reached</quote>
59028 <literal> return_path_on_delivery    </literal>  put return path on =&gt; and ** lines
59029 <literal> sender_on_delivery         </literal>  add sender to =&gt; lines
59030 <literal>*sender_verify_fail         </literal>  sender verification failures
59031 <literal>*size_reject                </literal>  rejection because too big
59032 <literal>*skip_delivery              </literal>  delivery skipped in a queue run
59033 <literal> smtp_confirmation          </literal>  SMTP confirmation on =&gt; lines
59034 <literal> smtp_connection            </literal>  SMTP connections
59035 <literal> smtp_incomplete_transaction</literal>  incomplete SMTP transactions
59036 <literal> smtp_no_mail               </literal>  session with no MAIL commands
59037 <literal> smtp_protocol_error        </literal>  SMTP protocol errors
59038 <literal> smtp_syntax_error          </literal>  SMTP syntax errors
59039 <literal> subject                    </literal>  contents of <emphasis>Subject:</emphasis> on &lt;= lines
59040 <literal> tls_certificate_verified   </literal>  certificate verification status
59041 <literal>*tls_cipher                 </literal>  TLS cipher suite on &lt;= and =&gt; lines
59042 <literal> tls_peerdn                 </literal>  TLS peer DN on &lt;= and =&gt; lines
59043 <literal> unknown_in_list            </literal>  DNS lookup failed in list match
59044
59045 <literal> all                        </literal>  all of the above
59046 </literallayout>
59047 <para>
59048 More details on each of these items follows:
59049 </para>
59050 <itemizedlist>
59051 <listitem>
59052 <para>
59053 <indexterm role="concept">
59054 <primary><option>warn</option> ACL verb</primary>
59055 <secondary>log when skipping</secondary>
59056 </indexterm>
59057 <option>acl_warn_skipped</option>: When an ACL <option>warn</option> statement is skipped because one of
59058 its conditions cannot be evaluated, a log line to this effect is written if
59059 this log selector is set.
59060 </para>
59061 </listitem>
59062 <listitem>
59063 <para>
59064 <indexterm role="concept">
59065 <primary>log</primary>
59066 <secondary>rewriting</secondary>
59067 </indexterm>
59068 <indexterm role="concept">
59069 <primary>rewriting</primary>
59070 <secondary>logging</secondary>
59071 </indexterm>
59072 <option>address_rewrite</option>: This applies both to global rewrites and per-transport
59073 rewrites, but not to rewrites in filters run as an unprivileged user (because
59074 such users cannot access the log).
59075 </para>
59076 </listitem>
59077 <listitem>
59078 <para>
59079 <indexterm role="concept">
59080 <primary>log</primary>
59081 <secondary>full parentage</secondary>
59082 </indexterm>
59083 <option>all_parents</option>: Normally only the original and final addresses are logged on
59084 delivery lines; with this selector, intermediate parents are given in
59085 parentheses between them.
59086 </para>
59087 </listitem>
59088 <listitem>
59089 <para>
59090 <indexterm role="concept">
59091 <primary>log</primary>
59092 <secondary>Exim arguments</secondary>
59093 </indexterm>
59094 <indexterm role="concept">
59095 <primary>Exim arguments, logging</primary>
59096 </indexterm>
59097 <option>arguments</option>: This causes Exim to write the arguments with which it was called
59098 to the main log, preceded by the current working directory. This is a debugging
59099 feature, added to make it easier to find out how certain MUAs call
59100 <filename>/usr/sbin/sendmail</filename>. The logging does not happen if Exim has given up root
59101 privilege because it was called with the <option>-C</option> or <option>-D</option> options. Arguments
59102 that are empty or that contain white space are quoted. Non-printing characters
59103 are shown as escape sequences. This facility cannot log unrecognized arguments,
59104 because the arguments are checked before the configuration file is read. The
59105 only way to log such cases is to interpose a script such as <filename>util/logargs.sh</filename>
59106 between the caller and Exim.
59107 </para>
59108 </listitem>
59109 <listitem>
59110 <para>
59111 <indexterm role="concept">
59112 <primary>log</primary>
59113 <secondary>connection rejections</secondary>
59114 </indexterm>
59115 <option>connection_reject</option>: A log entry is written whenever an incoming SMTP
59116 connection is rejected, for whatever reason.
59117 </para>
59118 </listitem>
59119 <listitem>
59120 <para>
59121 <indexterm role="concept">
59122 <primary>log</primary>
59123 <secondary>delayed delivery</secondary>
59124 </indexterm>
59125 <indexterm role="concept">
59126 <primary>delayed delivery, logging</primary>
59127 </indexterm>
59128 <option>delay_delivery</option>: A log entry is written whenever a delivery process is not
59129 started for an incoming message because the load is too high or too many
59130 messages were received on one connection. Logging does not occur if no delivery
59131 process is started because <option>queue_only</option> is set or <option>-odq</option> was used.
59132 </para>
59133 </listitem>
59134 <listitem>
59135 <para>
59136 <indexterm role="concept">
59137 <primary>log</primary>
59138 <secondary>delivery duration</secondary>
59139 </indexterm>
59140 <option>deliver_time</option>: For each delivery, the amount of real time it has taken to
59141 perform the actual delivery is logged as DT=&lt;<emphasis>time</emphasis>&gt;, for example, <literal>DT=1s</literal>.
59142 </para>
59143 </listitem>
59144 <listitem>
59145 <para>
59146 <indexterm role="concept">
59147 <primary>log</primary>
59148 <secondary>message size on delivery</secondary>
59149 </indexterm>
59150 <indexterm role="concept">
59151 <primary>size</primary>
59152 <secondary>of message</secondary>
59153 </indexterm>
59154 <option>delivery_size</option>: For each delivery, the size of message delivered is added to
59155 the <quote>=&gt;</quote> line, tagged with S=.
59156 </para>
59157 </listitem>
59158 <listitem>
59159 <para>
59160 <indexterm role="concept">
59161 <primary>log</primary>
59162 <secondary>dnslist defer</secondary>
59163 </indexterm>
59164 <indexterm role="concept">
59165 <primary>DNS list</primary>
59166 <secondary>logging defer</secondary>
59167 </indexterm>
59168 <indexterm role="concept">
59169 <primary>black list (DNS)</primary>
59170 </indexterm>
59171 <option>dnslist_defer</option>: A log entry is written if an attempt to look up a host in a
59172 DNS black list suffers a temporary error.
59173 </para>
59174 </listitem>
59175 <listitem>
59176 <para>
59177 <indexterm role="concept">
59178 <primary>log</primary>
59179 <secondary>ETRN commands</secondary>
59180 </indexterm>
59181 <indexterm role="concept">
59182 <primary>ETRN</primary>
59183 <secondary>logging</secondary>
59184 </indexterm>
59185 <option>etrn</option>: Every valid ETRN command that is received is logged, before the ACL
59186 is run to determine whether or not it is actually accepted. An invalid ETRN
59187 command, or one received within a message transaction is not logged by this
59188 selector (see <option>smtp_syntax_error</option> and <option>smtp_protocol_error</option>).
59189 </para>
59190 </listitem>
59191 <listitem>
59192 <para>
59193 <indexterm role="concept">
59194 <primary>log</primary>
59195 <secondary>host lookup failure</secondary>
59196 </indexterm>
59197 <option>host_lookup_failed</option>: When a lookup of a host&#x2019;s IP addresses fails to find
59198 any addresses, or when a lookup of an IP address fails to find a host name, a
59199 log line is written. This logging does not apply to direct DNS lookups when
59200 routing email addresses, but it does apply to <quote>byname</quote> lookups.
59201 </para>
59202 </listitem>
59203 <listitem>
59204 <para>
59205 <indexterm role="concept">
59206 <primary>log</primary>
59207 <secondary>ident timeout</secondary>
59208 </indexterm>
59209 <indexterm role="concept">
59210 <primary>RFC 1413</primary>
59211 <secondary>logging timeout</secondary>
59212 </indexterm>
59213 <option>ident_timeout</option>: A log line is written whenever an attempt to connect to a
59214 client&#x2019;s ident port times out.
59215 </para>
59216 </listitem>
59217 <listitem>
59218 <para>
59219 <indexterm role="concept">
59220 <primary>log</primary>
59221 <secondary>incoming interface</secondary>
59222 </indexterm>
59223 <indexterm role="concept">
59224 <primary>interface</primary>
59225 <secondary>logging</secondary>
59226 </indexterm>
59227 <option>incoming_interface</option>: The interface on which a message was received is added
59228 to the <quote>&lt;=</quote> line as an IP address in square brackets, tagged by I= and
59229 followed by a colon and the port number. The local interface and port are also
59230 added to other SMTP log lines, for example <quote>SMTP connection from</quote>, and to
59231 rejection lines.
59232 </para>
59233 </listitem>
59234 <listitem>
59235 <para>
59236 <indexterm role="concept">
59237 <primary>log</primary>
59238 <secondary>incoming remote port</secondary>
59239 </indexterm>
59240 <indexterm role="concept">
59241 <primary>port</primary>
59242 <secondary>logging remote</secondary>
59243 </indexterm>
59244 <indexterm role="concept">
59245 <primary>TCP/IP</primary>
59246 <secondary>logging incoming remote port</secondary>
59247 </indexterm>
59248 <indexterm role="variable">
59249 <primary><varname>$sender_fullhost</varname></primary>
59250 </indexterm>
59251 <indexterm role="variable">
59252 <primary><varname>$sender_rcvhost</varname></primary>
59253 </indexterm>
59254 <option>incoming_port</option>: The remote port number from which a message was received is
59255 added to log entries and <emphasis>Received:</emphasis> header lines, following the IP address
59256 in square brackets, and separated from it by a colon. This is implemented by
59257 changing the value that is put in the <varname>$sender_fullhost</varname> and
59258 <varname>$sender_rcvhost</varname> variables. Recording the remote port number has become more
59259 important with the widening use of NAT (see RFC 2505).
59260 </para>
59261 </listitem>
59262 <listitem>
59263 <para>
59264 <indexterm role="concept">
59265 <primary>log</primary>
59266 <secondary>dropped connection</secondary>
59267 </indexterm>
59268 <option>lost_incoming_connection</option>: A log line is written when an incoming SMTP
59269 connection is unexpectedly dropped.
59270 </para>
59271 </listitem>
59272 <listitem>
59273 <para>
59274 <indexterm role="concept">
59275 <primary>log</primary>
59276 <secondary>outgoing remote port</secondary>
59277 </indexterm>
59278 <indexterm role="concept">
59279 <primary>port</primary>
59280 <secondary>logging outgoint remote</secondary>
59281 </indexterm>
59282 <indexterm role="concept">
59283 <primary>TCP/IP</primary>
59284 <secondary>logging ougtoing remote port</secondary>
59285 </indexterm>
59286 <option>outgoing_port</option>: The remote port number is added to delivery log lines (those
59287 containing =&gt; tags) following the IP address. This option is not included in
59288 the default setting, because for most ordinary configurations, the remote port
59289 number is always 25 (the SMTP port).
59290 </para>
59291 </listitem>
59292 <listitem>
59293 <para>
59294 <indexterm role="concept">
59295 <primary>log</primary>
59296 <secondary>process ids in</secondary>
59297 </indexterm>
59298 <indexterm role="concept">
59299 <primary>pid (process id)</primary>
59300 <secondary>in log lines</secondary>
59301 </indexterm>
59302 <option>pid</option>: The current process id is added to every log line, in square brackets,
59303 immediately after the time and date.
59304 </para>
59305 </listitem>
59306 <listitem>
59307 <para>
59308 <indexterm role="concept">
59309 <primary>log</primary>
59310 <secondary>queue run</secondary>
59311 </indexterm>
59312 <indexterm role="concept">
59313 <primary>queue runner</primary>
59314 <secondary>logging</secondary>
59315 </indexterm>
59316 <option>queue_run</option>: The start and end of every queue run are logged.
59317 </para>
59318 </listitem>
59319 <listitem>
59320 <para>
59321 <indexterm role="concept">
59322 <primary>log</primary>
59323 <secondary>queue time</secondary>
59324 </indexterm>
59325 <option>queue_time</option>: The amount of time the message has been in the queue on the
59326 local host is logged as QT=&lt;<emphasis>time</emphasis>&gt; on delivery (<literal>=&gt;</literal>) lines, for example,
59327 <literal>QT=3m45s</literal>. The clock starts when Exim starts to receive the message, so it
59328 includes reception time as well as the delivery time for the current address.
59329 This means that it may be longer than the difference between the arrival and
59330 delivery log line times, because the arrival log line is not written until the
59331 message has been successfully received.
59332 </para>
59333 </listitem>
59334 <listitem>
59335 <para>
59336 <option>queue_time_overall</option>: The amount of time the message has been in the queue on
59337 the local host is logged as QT=&lt;<emphasis>time</emphasis>&gt; on <quote>Completed</quote> lines, for
59338 example, <literal>QT=3m45s</literal>. The clock starts when Exim starts to receive the
59339 message, so it includes reception time as well as the total delivery time.
59340 </para>
59341 </listitem>
59342 <listitem>
59343 <para>
59344 <indexterm role="concept">
59345 <primary>log</primary>
59346 <secondary>recipients</secondary>
59347 </indexterm>
59348 <option>received_recipients</option>: The recipients of a message are listed in the main log
59349 as soon as the message is received. The list appears at the end of the log line
59350 that is written when a message is received, preceded by the word <quote>for</quote>. The
59351 addresses are listed after they have been qualified, but before any rewriting
59352 has taken place.
59353 Recipients that were discarded by an ACL for MAIL or RCPT do not appear
59354 in the list.
59355 </para>
59356 </listitem>
59357 <listitem>
59358 <para>
59359 <indexterm role="concept">
59360 <primary>log</primary>
59361 <secondary>sender reception</secondary>
59362 </indexterm>
59363 <option>received_sender</option>: The unrewritten original sender of a message is added to
59364 the end of the log line that records the message&#x2019;s arrival, after the word
59365 <quote>from</quote> (before the recipients if <option>received_recipients</option> is also set).
59366 </para>
59367 </listitem>
59368 <listitem>
59369 <para>
59370 <indexterm role="concept">
59371 <primary>log</primary>
59372 <secondary>header lines for rejection</secondary>
59373 </indexterm>
59374 <option>rejected_header</option>: If a message&#x2019;s header has been received at the time a
59375 rejection is written to the reject log, the complete header is added to the
59376 log. Header logging can be turned off individually for messages that are
59377 rejected by the <function>local_scan()</function> function (see section <xref linkend="SECTapiforloc"/>).
59378 </para>
59379 </listitem>
59380 <listitem>
59381 <para>
59382 <indexterm role="concept">
59383 <primary>log</primary>
59384 <secondary>retry defer</secondary>
59385 </indexterm>
59386 <option>retry_defer</option>: A log line is written if a delivery is deferred because a
59387 retry time has not yet been reached. However, this <quote>retry time not reached</quote>
59388 message is always omitted from individual message logs after the first delivery
59389 attempt.
59390 </para>
59391 </listitem>
59392 <listitem>
59393 <para>
59394 <indexterm role="concept">
59395 <primary>log</primary>
59396 <secondary>return path</secondary>
59397 </indexterm>
59398 <option>return_path_on_delivery</option>: The return path that is being transmitted with
59399 the message is included in delivery and bounce lines, using the tag P=.
59400 This is omitted if no delivery actually happens, for example, if routing fails,
59401 or if delivery is to <filename>/dev/null</filename> or to <literal>:blackhole:</literal>.
59402 </para>
59403 </listitem>
59404 <listitem>
59405 <para>
59406 <indexterm role="concept">
59407 <primary>log</primary>
59408 <secondary>sender on delivery</secondary>
59409 </indexterm>
59410 <option>sender_on_delivery</option>: The message&#x2019;s sender address is added to every delivery
59411 and bounce line, tagged by F= (for <quote>from</quote>).
59412 This is the original sender that was received with the message; it is not
59413 necessarily the same as the outgoing return path.
59414 </para>
59415 </listitem>
59416 <listitem>
59417 <para>
59418 <indexterm role="concept">
59419 <primary>log</primary>
59420 <secondary>sender verify failure</secondary>
59421 </indexterm>
59422 <option>sender_verify_fail</option>: If this selector is unset, the separate log line that
59423 gives details of a sender verification failure is not written. Log lines for
59424 the rejection of SMTP commands contain just <quote>sender verify failed</quote>, so some
59425 detail is lost.
59426 </para>
59427 </listitem>
59428 <listitem>
59429 <para>
59430 <indexterm role="concept">
59431 <primary>log</primary>
59432 <secondary>size rejection</secondary>
59433 </indexterm>
59434 <option>size_reject</option>: A log line is written whenever a message is rejected because
59435 it is too big.
59436 </para>
59437 </listitem>
59438 <listitem>
59439 <para>
59440 <indexterm role="concept">
59441 <primary>log</primary>
59442 <secondary>frozen messages; skipped</secondary>
59443 </indexterm>
59444 <indexterm role="concept">
59445 <primary>frozen messages</primary>
59446 <secondary>logging skipping</secondary>
59447 </indexterm>
59448 <option>skip_delivery</option>: A log line is written whenever a message is skipped during a
59449 queue run because it is frozen or because another process is already delivering
59450 it.
59451 <indexterm role="concept">
59452 <primary><quote>spool file is locked</quote></primary>
59453 </indexterm>
59454 The message that is written is <quote>spool file is locked</quote>.
59455 </para>
59456 </listitem>
59457 <listitem>
59458 <para>
59459 <indexterm role="concept">
59460 <primary>log</primary>
59461 <secondary>smtp confirmation</secondary>
59462 </indexterm>
59463 <indexterm role="concept">
59464 <primary>SMTP</primary>
59465 <secondary>logging confirmation</secondary>
59466 </indexterm>
59467 <option>smtp_confirmation</option>: The response to the final <quote>.</quote> in the SMTP dialogue for
59468 outgoing messages is added to delivery log lines in the form <literal>C=</literal>&lt;<emphasis>text</emphasis>&gt;.
59469 A number of MTAs (including Exim) return an identifying string in this
59470 response.
59471 </para>
59472 </listitem>
59473 <listitem>
59474 <para>
59475 <indexterm role="concept">
59476 <primary>log</primary>
59477 <secondary>SMTP connections</secondary>
59478 </indexterm>
59479 <indexterm role="concept">
59480 <primary>SMTP</primary>
59481 <secondary>logging connections</secondary>
59482 </indexterm>
59483 <option>smtp_connection</option>: A log line is written whenever an SMTP connection is
59484 established or closed, unless the connection is from a host that matches
59485 <option>hosts_connection_nolog</option>. (In contrast, <option>lost_incoming_connection</option> applies
59486 only when the closure is unexpected.) This applies to connections from local
59487 processes that use <option>-bs</option> as well as to TCP/IP connections. If a connection is
59488 dropped in the middle of a message, a log line is always written, whether or
59489 not this selector is set, but otherwise nothing is written at the start and end
59490 of connections unless this selector is enabled.
59491 </para>
59492 <para>
59493 For TCP/IP connections to an Exim daemon, the current number of connections is
59494 included in the log message for each new connection, but note that the count is
59495 reset if the daemon is restarted.
59496 Also, because connections are closed (and the closure is logged) in
59497 subprocesses, the count may not include connections that have been closed but
59498 whose termination the daemon has not yet noticed. Thus, while it is possible to
59499 match up the opening and closing of connections in the log, the value of the
59500 logged counts may not be entirely accurate.
59501 </para>
59502 </listitem>
59503 <listitem>
59504 <para>
59505 <indexterm role="concept">
59506 <primary>log</primary>
59507 <secondary>SMTP transaction; incomplete</secondary>
59508 </indexterm>
59509 <indexterm role="concept">
59510 <primary>SMTP</primary>
59511 <secondary>logging incomplete transactions</secondary>
59512 </indexterm>
59513 <option>smtp_incomplete_transaction</option>: When a mail transaction is aborted by
59514 RSET, QUIT, loss of connection, or otherwise, the incident is logged,
59515 and the message sender plus any accepted recipients are included in the log
59516 line. This can provide evidence of dictionary attacks.
59517 </para>
59518 </listitem>
59519 <listitem>
59520 <para>
59521 <indexterm role="concept">
59522 <primary>log</primary>
59523 <secondary>non-MAIL SMTP sessions</secondary>
59524 </indexterm>
59525 <indexterm role="concept">
59526 <primary>MAIL</primary>
59527 <secondary>logging session without</secondary>
59528 </indexterm>
59529 <option>smtp_no_mail</option>: A line is written to the main log whenever an accepted SMTP
59530 connection terminates without having issued a MAIL command. This includes both
59531 the case when the connection is dropped, and the case when QUIT is used. It
59532 does not include cases where the connection is rejected right at the start (by
59533 an ACL, or because there are too many connections, or whatever). These cases
59534 already have their own log lines.
59535 </para>
59536 <para>
59537 The log line that is written contains the identity of the client in the usual
59538 way, followed by D= and a time, which records the duration of the connection.
59539 If the connection was authenticated, this fact is logged exactly as it is for
59540 an incoming message, with an A= item. If the connection was encrypted, CV=,
59541 DN=, and X= items may appear as they do for an incoming message, controlled by
59542 the same logging options.
59543 </para>
59544 <para>
59545 Finally, if any SMTP commands were issued during the connection, a C= item
59546 is added to the line, listing the commands that were used. For example,
59547 </para>
59548 <literallayout class="monospaced">
59549 C=EHLO,QUIT
59550 </literallayout>
59551 <para>
59552 shows that the client issued QUIT straight after EHLO. If there were fewer
59553 than 20 commands, they are all listed. If there were more than 20 commands,
59554 the last 20 are listed, preceded by <quote>...</quote>. However, with the default
59555 setting of 10 for <option>smtp_accep_max_nonmail</option>, the connection will in any case
59556 have been aborted before 20 non-mail commands are processed.
59557 </para>
59558 </listitem>
59559 <listitem>
59560 <para>
59561 <indexterm role="concept">
59562 <primary>log</primary>
59563 <secondary>SMTP protocol error</secondary>
59564 </indexterm>
59565 <indexterm role="concept">
59566 <primary>SMTP</primary>
59567 <secondary>logging protocol error</secondary>
59568 </indexterm>
59569 <option>smtp_protocol_error</option>: A log line is written for every SMTP protocol error
59570 encountered. Exim does not have perfect detection of all protocol errors
59571 because of transmission delays and the use of pipelining. If PIPELINING has
59572 been advertised to a client, an Exim server assumes that the client will use
59573 it, and therefore it does not count <quote>expected</quote> errors (for example, RCPT
59574 received after rejecting MAIL) as protocol errors.
59575 </para>
59576 </listitem>
59577 <listitem>
59578 <para>
59579 <indexterm role="concept">
59580 <primary>SMTP</primary>
59581 <secondary>logging syntax errors</secondary>
59582 </indexterm>
59583 <indexterm role="concept">
59584 <primary>SMTP</primary>
59585 <secondary>syntax errors; logging</secondary>
59586 </indexterm>
59587 <indexterm role="concept">
59588 <primary>SMTP</primary>
59589 <secondary>unknown command; logging</secondary>
59590 </indexterm>
59591 <indexterm role="concept">
59592 <primary>log</primary>
59593 <secondary>unknown SMTP command</secondary>
59594 </indexterm>
59595 <indexterm role="concept">
59596 <primary>log</primary>
59597 <secondary>SMTP syntax error</secondary>
59598 </indexterm>
59599 <option>smtp_syntax_error</option>: A log line is written for every SMTP syntax error
59600 encountered. An unrecognized command is treated as a syntax error. For an
59601 external connection, the host identity is given; for an internal connection
59602 using <option>-bs</option> the sender identification (normally the calling user) is given.
59603 </para>
59604 </listitem>
59605 <listitem>
59606 <para>
59607 <indexterm role="concept">
59608 <primary>log</primary>
59609 <secondary>subject</secondary>
59610 </indexterm>
59611 <indexterm role="concept">
59612 <primary>subject, logging</primary>
59613 </indexterm>
59614 <option>subject</option>: The subject of the message is added to the arrival log line,
59615 preceded by <quote>T=</quote> (T for <quote>topic</quote>, since S is already used for <quote>size</quote>).
59616 Any MIME <quote>words</quote> in the subject are decoded. The <option>print_topbitchars</option> option
59617 specifies whether characters with values greater than 127 should be logged
59618 unchanged, or whether they should be rendered as escape sequences.
59619 </para>
59620 </listitem>
59621 <listitem>
59622 <para>
59623 <indexterm role="concept">
59624 <primary>log</primary>
59625 <secondary>certificate verification</secondary>
59626 </indexterm>
59627 <option>tls_certificate_verified</option>: An extra item is added to &lt;= and =&gt; log lines
59628 when TLS is in use. The item is <literal>CV=yes</literal> if the peer&#x2019;s certificate was
59629 verified, and <literal>CV=no</literal> if not.
59630 </para>
59631 </listitem>
59632 <listitem>
59633 <para>
59634 <indexterm role="concept">
59635 <primary>log</primary>
59636 <secondary>TLS cipher</secondary>
59637 </indexterm>
59638 <indexterm role="concept">
59639 <primary>TLS</primary>
59640 <secondary>logging cipher</secondary>
59641 </indexterm>
59642 <option>tls_cipher</option>: When a message is sent or received over an encrypted
59643 connection, the cipher suite used is added to the log line, preceded by X=.
59644 </para>
59645 </listitem>
59646 <listitem>
59647 <para>
59648 <indexterm role="concept">
59649 <primary>log</primary>
59650 <secondary>TLS peer DN</secondary>
59651 </indexterm>
59652 <indexterm role="concept">
59653 <primary>TLS</primary>
59654 <secondary>logging peer DN</secondary>
59655 </indexterm>
59656 <option>tls_peerdn</option>: When a message is sent or received over an encrypted
59657 connection, and a certificate is supplied by the remote host, the peer DN is
59658 added to the log line, preceded by DN=.
59659 </para>
59660 </listitem>
59661 <listitem>
59662 <para>
59663 <indexterm role="concept">
59664 <primary>log</primary>
59665 <secondary>DNS failure in list</secondary>
59666 </indexterm>
59667 <option>unknown_in_list</option>: This setting causes a log entry to be written when the
59668 result of a list match is failure because a DNS lookup failed.
59669 </para>
59670 </listitem>
59671 </itemizedlist>
59672 </section>
59673 <section id="SECID260">
59674 <title>Message log</title>
59675 <para>
59676 <indexterm role="concept">
59677 <primary>message</primary>
59678 <secondary>log file for</secondary>
59679 </indexterm>
59680 <indexterm role="concept">
59681 <primary>log</primary>
59682 <secondary>message log; description of</secondary>
59683 </indexterm>
59684 <indexterm role="concept">
59685 <primary><filename>msglog</filename> directory</primary>
59686 </indexterm>
59687 <indexterm role="option">
59688 <primary><option>preserve_message_logs</option></primary>
59689 </indexterm>
59690 In addition to the general log files, Exim writes a log file for each message
59691 that it handles. The names of these per-message logs are the message ids, and
59692 they are kept in the <filename>msglog</filename> sub-directory of the spool directory. Each
59693 message log contains copies of the log lines that apply to the message. This
59694 makes it easier to inspect the status of an individual message without having
59695 to search the main log. A message log is deleted when processing of the message
59696 is complete, unless <option>preserve_message_logs</option> is set, but this should be used
59697 only with great care because they can fill up your disk very quickly.
59698 </para>
59699 <para>
59700 On a heavily loaded system, it may be desirable to disable the use of
59701 per-message logs, in order to reduce disk I/O. This can be done by setting the
59702 <option>message_logs</option> option false.
59703 <indexterm role="concept" startref="IIDloggen" class="endofrange"/>
59704 </para>
59705 </section>
59706 </chapter>
59707
59708 <chapter id="CHAPutils">
59709 <title>Exim utilities</title>
59710 <para>
59711 <indexterm role="concept" id="IIDutils" class="startofrange">
59712 <primary>utilities</primary>
59713 </indexterm>
59714 A number of utility scripts and programs are supplied with Exim and are
59715 described in this chapter. There is also the Exim Monitor, which is covered in
59716 the next chapter. The utilities described here are:
59717 </para>
59718 <informaltable frame="none">
59719 <tgroup cols="3" colsep="0" rowsep="0">
59720 <colspec colwidth="7*" align="left"/>
59721 <colspec colwidth="15*" align="left"/>
59722 <colspec colwidth="40*" align="left"/>
59723 <tbody>
59724 <row>
59725 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTfinoutwha"/></entry>
59726 <entry><emphasis>exiwhat</emphasis></entry>
59727 <entry>list what Exim processes are doing</entry>
59728 </row>
59729 <row>
59730 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTgreptheque"/></entry>
59731 <entry><emphasis>exiqgrep</emphasis></entry>
59732 <entry>grep the queue</entry>
59733 </row>
59734 <row>
59735 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTsumtheque"/></entry>
59736 <entry><emphasis>exiqsumm</emphasis></entry>
59737 <entry>summarize the queue</entry>
59738 </row>
59739 <row>
59740 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTextspeinf"/></entry>
59741 <entry><emphasis>exigrep</emphasis></entry>
59742 <entry>search the main log</entry>
59743 </row>
59744 <row>
59745 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTexipick"/></entry>
59746 <entry><emphasis>exipick</emphasis></entry>
59747 <entry>select messages on various criteria</entry>
59748 </row>
59749 <row>
59750 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTcyclogfil"/></entry>
59751 <entry><emphasis>exicyclog</emphasis></entry>
59752 <entry>cycle (rotate) log files</entry>
59753 </row>
59754 <row>
59755 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTmailstat"/></entry>
59756 <entry><emphasis>eximstats</emphasis></entry>
59757 <entry>extract statistics from the log</entry>
59758 </row>
59759 <row>
59760 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTcheckaccess"/></entry>
59761 <entry><emphasis>exim_checkaccess</emphasis></entry>
59762 <entry>check address acceptance from given IP</entry>
59763 </row>
59764 <row>
59765 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTdbmbuild"/></entry>
59766 <entry><emphasis>exim_dbmbuild</emphasis></entry>
59767 <entry>build a DBM file</entry>
59768 </row>
59769 <row>
59770 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTfinindret"/></entry>
59771 <entry><emphasis>exinext</emphasis></entry>
59772 <entry>extract retry information</entry>
59773 </row>
59774 <row>
59775 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
59776 <entry><emphasis>exim_dumpdb</emphasis></entry>
59777 <entry>dump a hints database</entry>
59778 </row>
59779 <row>
59780 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
59781 <entry><emphasis>exim_tidydb</emphasis></entry>
59782 <entry>clean up a hints database</entry>
59783 </row>
59784 <row>
59785 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
59786 <entry><emphasis>exim_fixdb</emphasis></entry>
59787 <entry>patch a hints database</entry>
59788 </row>
59789 <row>
59790 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTmailboxmaint"/></entry>
59791 <entry><emphasis>exim_lock</emphasis></entry>
59792 <entry>lock a mailbox file</entry>
59793 </row>
59794 </tbody>
59795 </tgroup>
59796 </informaltable>
59797 <para>
59798 Another utility that might be of use to sites with many MTAs is Tom Kistner&#x2019;s
59799 <emphasis>exilog</emphasis>. It provides log visualizations across multiple Exim servers. See
59800 <emphasis role="bold"><ulink url="http://duncanthrax.net/exilog/">http://duncanthrax.net/exilog/</ulink></emphasis> for details.
59801 </para>
59802 <section id="SECTfinoutwha">
59803 <title>Finding out what Exim processes are doing (exiwhat)</title>
59804 <para>
59805 <indexterm role="concept">
59806 <primary><emphasis>exiwhat</emphasis></primary>
59807 </indexterm>
59808 <indexterm role="concept">
59809 <primary>process, querying</primary>
59810 </indexterm>
59811 <indexterm role="concept">
59812 <primary>SIGUSR1</primary>
59813 </indexterm>
59814 On operating systems that can restart a system call after receiving a signal
59815 (most modern OS), an Exim process responds to the SIGUSR1 signal by writing
59816 a line describing what it is doing to the file <filename>exim-process.info</filename> in the
59817 Exim spool directory. The <emphasis>exiwhat</emphasis> script sends the signal to all Exim
59818 processes it can find, having first emptied the file. It then waits for one
59819 second to allow the Exim processes to react before displaying the results. In
59820 order to run <emphasis>exiwhat</emphasis> successfully you have to have sufficient privilege to
59821 send the signal to the Exim processes, so it is normally run as root.
59822 </para>
59823 <para>
59824 <emphasis role="bold">Warning</emphasis>: This is not an efficient process. It is intended for occasional
59825 use by system administrators. It is not sensible, for example, to set up a
59826 script that sends SIGUSR1 signals to Exim processes at short intervals.
59827 </para>
59828 <para>
59829 Unfortunately, the <emphasis>ps</emphasis> command that <emphasis>exiwhat</emphasis> uses to find Exim processes
59830 varies in different operating systems. Not only are different options used,
59831 but the format of the output is different. For this reason, there are some
59832 system configuration options that configure exactly how <emphasis>exiwhat</emphasis> works. If
59833 it doesn&#x2019;t seem to be working for you, check the following compile-time
59834 options:
59835 </para>
59836 <literallayout>
59837 <literal>EXIWHAT_PS_CMD    </literal> the command for running <emphasis>ps</emphasis>
59838 <literal>EXIWHAT_PS_ARG    </literal> the argument for <emphasis>ps</emphasis>
59839 <literal>EXIWHAT_EGREP_ARG </literal> the argument for <emphasis>egrep</emphasis> to select from <emphasis>ps</emphasis> output
59840 <literal>EXIWHAT_KILL_ARG  </literal> the argument for the <emphasis>kill</emphasis> command
59841 </literallayout>
59842 <para>
59843 An example of typical output from <emphasis>exiwhat</emphasis> is
59844 </para>
59845 <literallayout class="monospaced">
59846 164 daemon: -q1h, listening on port 25
59847 10483 running queue: waiting for 0tAycK-0002ij-00 (10492)
59848 10492 delivering 0tAycK-0002ij-00 to mail.ref.example
59849   [10.19.42.42] (editor@ref.example)
59850 10592 handling incoming call from [192.168.243.242]
59851 10628 accepting a local non-SMTP message
59852 </literallayout>
59853 <para>
59854 The first number in the output line is the process number. The third line has
59855 been split here, in order to fit it on the page.
59856 </para>
59857 </section>
59858 <section id="SECTgreptheque">
59859 <title>Selective queue listing (exiqgrep)</title>
59860 <para>
59861 <indexterm role="concept">
59862 <primary><emphasis>exiqgrep</emphasis></primary>
59863 </indexterm>
59864 <indexterm role="concept">
59865 <primary>queue</primary>
59866 <secondary>grepping</secondary>
59867 </indexterm>
59868 This utility is a Perl script contributed by Matt Hubbard. It runs
59869 </para>
59870 <literallayout class="monospaced">
59871 exim -bpu
59872 </literallayout>
59873 <para>
59874 to obtain a queue listing with undelivered recipients only, and then greps the
59875 output to select messages that match given criteria. The following selection
59876 options are available:
59877 </para>
59878 <variablelist>
59879 <varlistentry>
59880 <term><emphasis role="bold">-f</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
59881 <listitem>
59882 <para>
59883 Match the sender address. The field that is tested is enclosed in angle
59884 brackets, so you can test for bounce messages with
59885 </para>
59886 <literallayout class="monospaced">
59887 exiqgrep -f '^&lt;&gt;$'
59888 </literallayout>
59889 </listitem></varlistentry>
59890 <varlistentry>
59891 <term><emphasis role="bold">-r</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
59892 <listitem>
59893 <para>
59894 Match a recipient address. The field that is tested is not enclosed in angle
59895 brackets.
59896 </para>
59897 </listitem></varlistentry>
59898 <varlistentry>
59899 <term><emphasis role="bold">-s</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
59900 <listitem>
59901 <para>
59902 Match against the size field.
59903 </para>
59904 </listitem></varlistentry>
59905 <varlistentry>
59906 <term><emphasis role="bold">-y</emphasis>&nbsp;&lt;<emphasis>seconds</emphasis>&gt;</term>
59907 <listitem>
59908 <para>
59909 Match messages that are younger than the given time.
59910 </para>
59911 </listitem></varlistentry>
59912 <varlistentry>
59913 <term><emphasis role="bold">-o</emphasis>&nbsp;&lt;<emphasis>seconds</emphasis>&gt;</term>
59914 <listitem>
59915 <para>
59916 Match messages that are older than the given time.
59917 </para>
59918 </listitem></varlistentry>
59919 <varlistentry>
59920 <term><emphasis role="bold">-z</emphasis></term>
59921 <listitem>
59922 <para>
59923 Match only frozen messages.
59924 </para>
59925 </listitem></varlistentry>
59926 <varlistentry>
59927 <term><emphasis role="bold">-x</emphasis></term>
59928 <listitem>
59929 <para>
59930 Match only non-frozen messages.
59931 </para>
59932 </listitem></varlistentry>
59933 </variablelist>
59934 <para>
59935 The following options control the format of the output:
59936 </para>
59937 <variablelist>
59938 <varlistentry>
59939 <term><emphasis role="bold">-c</emphasis></term>
59940 <listitem>
59941 <para>
59942 Display only the count of matching messages.
59943 </para>
59944 </listitem></varlistentry>
59945 <varlistentry>
59946 <term><emphasis role="bold">-l</emphasis></term>
59947 <listitem>
59948 <para>
59949 Long format &ndash; display the full message information as output by Exim. This is
59950 the default.
59951 </para>
59952 </listitem></varlistentry>
59953 <varlistentry>
59954 <term><emphasis role="bold">-i</emphasis></term>
59955 <listitem>
59956 <para>
59957 Display message ids only.
59958 </para>
59959 </listitem></varlistentry>
59960 <varlistentry>
59961 <term><emphasis role="bold">-b</emphasis></term>
59962 <listitem>
59963 <para>
59964 Brief format &ndash; one line per message.
59965 </para>
59966 </listitem></varlistentry>
59967 <varlistentry>
59968 <term><emphasis role="bold">-R</emphasis></term>
59969 <listitem>
59970 <para>
59971 Display messages in reverse order.
59972 </para>
59973 </listitem></varlistentry>
59974 </variablelist>
59975 <para>
59976 There is one more option, <option>-h</option>, which outputs a list of options.
59977 </para>
59978 </section>
59979 <section id="SECTsumtheque">
59980 <title>Summarizing the queue (exiqsumm)</title>
59981 <para>
59982 <indexterm role="concept">
59983 <primary><emphasis>exiqsumm</emphasis></primary>
59984 </indexterm>
59985 <indexterm role="concept">
59986 <primary>queue</primary>
59987 <secondary>summary</secondary>
59988 </indexterm>
59989 The <emphasis>exiqsumm</emphasis> utility is a Perl script which reads the output of <literal>exim
59990 -bp</literal> and produces a summary of the messages on the queue. Thus, you use it by
59991 running a command such as
59992 </para>
59993 <literallayout class="monospaced">
59994 exim -bp | exiqsumm
59995 </literallayout>
59996 <para>
59997 The output consists of one line for each domain that has messages waiting for
59998 it, as in the following example:
59999 </para>
60000 <literallayout class="monospaced">
60001 3   2322   74m   66m  msn.com.example
60002 </literallayout>
60003 <para>
60004 Each line lists the number of pending deliveries for a domain, their total
60005 volume, and the length of time that the oldest and the newest messages have
60006 been waiting. Note that the number of pending deliveries is greater than the
60007 number of messages when messages have more than one recipient.
60008 </para>
60009 <para>
60010 A summary line is output at the end. By default the output is sorted on the
60011 domain name, but <emphasis>exiqsumm</emphasis> has the options <option>-a</option> and <option>-c</option>, which cause
60012 the output to be sorted by oldest message and by count of messages,
60013 respectively. There are also three options that split the messages for each
60014 domain into two or more subcounts: <option>-b</option> separates bounce messages, <option>-f</option>
60015 separates frozen messages, and <option>-s</option> separates messages according to their
60016 sender.
60017 </para>
60018 <para>
60019 The output of <emphasis>exim -bp</emphasis> contains the original addresses in the message, so
60020 this also applies to the output from <emphasis>exiqsumm</emphasis>. No domains from addresses
60021 generated by aliasing or forwarding are included (unless the <option>one_time</option>
60022 option of the <command>redirect</command> router has been used to convert them into <quote>top
60023 level</quote> addresses).
60024 </para>
60025 </section>
60026 <section id="SECTextspeinf">
60027 <title>Extracting specific information from the log (exigrep)</title>
60028 <para>
60029 <indexterm role="concept">
60030 <primary><emphasis>exigrep</emphasis></primary>
60031 </indexterm>
60032 <indexterm role="concept">
60033 <primary>log</primary>
60034 <secondary>extracts; grepping for</secondary>
60035 </indexterm>
60036 The <emphasis>exigrep</emphasis> utility is a Perl script that searches one or more main log
60037 files for entries that match a given pattern. When it finds a match, it
60038 extracts all the log entries for the relevant message, not just those that
60039 match the pattern. Thus, <emphasis>exigrep</emphasis> can extract complete log entries for a
60040 given message, or all mail for a given user, or for a given host, for example.
60041 The input files can be in Exim log format or syslog format.
60042 If a matching log line is not associated with a specific message, it is
60043 included in <emphasis>exigrep</emphasis>&#x2019;s output without any additional lines. The usage is:
60044 </para>
60045 <literallayout>
60046 <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>
60047 </literallayout>
60048 <para>
60049 If no log file names are given on the command line, the standard input is read.
60050 </para>
60051 <para>
60052 The <option>-t</option> argument specifies a number of seconds. It adds an additional
60053 condition for message selection. Messages that are complete are shown only if
60054 they spent more than &lt;<emphasis>n</emphasis>&gt; seconds on the queue.
60055 </para>
60056 <para>
60057 By default, <emphasis>exigrep</emphasis> does case-insensitive matching. The <option>-I</option> option
60058 makes it case-sensitive. This may give a performance improvement when searching
60059 large log files. Without <option>-I</option>, the Perl pattern matches use Perl&#x2019;s <literal>/i</literal>
60060 option; with <option>-I</option> they do not. In both cases it is possible to change the
60061 case sensitivity within the pattern by using <literal>(?i)</literal> or <literal>(?-i)</literal>.
60062 </para>
60063 <para>
60064 The <option>-l</option> option means <quote>literal</quote>, that is, treat all characters in the
60065 pattern as standing for themselves. Otherwise the pattern must be a Perl
60066 regular expression.
60067 </para>
60068 <para>
60069 The <option>-v</option> option inverts the matching condition. That is, a line is selected
60070 if it does <emphasis>not</emphasis> match the pattern.
60071 </para>
60072 <para>
60073 If the location of a <emphasis>zcat</emphasis> command is known from the definition of
60074 ZCAT_COMMAND in <filename>Local/Makefile</filename>, <emphasis>exigrep</emphasis> automatically passes any file
60075 whose name ends in COMPRESS_SUFFIX through <emphasis>zcat</emphasis> as it searches it.
60076 </para>
60077 </section>
60078 <section id="SECTexipick">
60079 <title>Selecting messages by various criteria (exipick)</title>
60080 <para>
60081 <indexterm role="concept">
60082 <primary><emphasis>exipick</emphasis></primary>
60083 </indexterm>
60084 John Jetmore&#x2019;s <emphasis>exipick</emphasis> utility is included in the Exim distribution. It
60085 lists messages from the queue according to a variety of criteria. For details
60086 of <emphasis>exipick</emphasis>&#x2019;s facilities, visit the web page at
60087 <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
60088 the <option>--help</option> option.
60089 </para>
60090 </section>
60091 <section id="SECTcyclogfil">
60092 <title>Cycling log files (exicyclog)</title>
60093 <para>
60094 <indexterm role="concept">
60095 <primary>log</primary>
60096 <secondary>cycling local files</secondary>
60097 </indexterm>
60098 <indexterm role="concept">
60099 <primary>cycling logs</primary>
60100 </indexterm>
60101 <indexterm role="concept">
60102 <primary><emphasis>exicyclog</emphasis></primary>
60103 </indexterm>
60104 The <emphasis>exicyclog</emphasis> script can be used to cycle (rotate) <emphasis>mainlog</emphasis> and
60105 <emphasis>rejectlog</emphasis> files. This is not necessary if only syslog is being used, or if
60106 you are using log files with datestamps in their names (see section
60107 <xref linkend="SECTdatlogfil"/>). Some operating systems have their own standard mechanisms
60108 for log cycling, and these can be used instead of <emphasis>exicyclog</emphasis> if preferred.
60109 There are two command line options for <emphasis>exicyclog</emphasis>:
60110 </para>
60111 <itemizedlist>
60112 <listitem>
60113 <para>
60114 <option>-k</option> &lt;<emphasis>count</emphasis>&gt; specifies the number of log files to keep, overriding the
60115 default that is set when Exim is built. The default default is 10.
60116 </para>
60117 </listitem>
60118 <listitem>
60119 <para>
60120 <option>-l</option> &lt;<emphasis>path</emphasis>&gt; specifies the log file path, in the same format as Exim&#x2019;s
60121 <option>log_file_path</option> option (for example, <literal>/var/log/exim_%slog</literal>), again
60122 overriding the script&#x2019;s default, which is to find the setting from Exim&#x2019;s
60123 configuration.
60124 </para>
60125 </listitem>
60126 </itemizedlist>
60127 <para>
60128 Each time <emphasis>exicyclog</emphasis> is run the file names get <quote>shuffled down</quote> by one. If
60129 the main log file name is <filename>mainlog</filename> (the default) then when <emphasis>exicyclog</emphasis> is
60130 run <filename>mainlog</filename> becomes <filename>mainlog.01</filename>, the previous <filename>mainlog.01</filename> becomes
60131 <filename>mainlog.02</filename> and so on, up to the limit that is set in the script or by the
60132 <option>-k</option> option. Log files whose numbers exceed the limit are discarded. Reject
60133 logs are handled similarly.
60134 </para>
60135 <para>
60136 If the limit is greater than 99, the script uses 3-digit numbers such as
60137 <filename>mainlog.001</filename>, <filename>mainlog.002</filename>, etc. If you change from a number less than 99
60138 to one that is greater, or <emphasis>vice versa</emphasis>, you will have to fix the names of
60139 any existing log files.
60140 </para>
60141 <para>
60142 If no <filename>mainlog</filename> file exists, the script does nothing. Files that <quote>drop off</quote>
60143 the end are deleted. All files with numbers greater than 01 are compressed,
60144 using a compression command which is configured by the COMPRESS_COMMAND
60145 setting in <filename>Local/Makefile</filename>. It is usual to run <emphasis>exicyclog</emphasis> daily from a
60146 root <option>crontab</option> entry of the form
60147 </para>
60148 <literallayout class="monospaced">
60149 1 0 * * * su exim -c /usr/exim/bin/exicyclog
60150 </literallayout>
60151 <para>
60152 assuming you have used the name <quote>exim</quote> for the Exim user. You can run
60153 <emphasis>exicyclog</emphasis> as root if you wish, but there is no need.
60154 </para>
60155 </section>
60156 <section id="SECTmailstat">
60157 <title>Mail statistics (eximstats)</title>
60158 <para>
60159 <indexterm role="concept">
60160 <primary>statistics</primary>
60161 </indexterm>
60162 <indexterm role="concept">
60163 <primary><emphasis>eximstats</emphasis></primary>
60164 </indexterm>
60165 A Perl script called <emphasis>eximstats</emphasis> is provided for extracting statistical
60166 information from log files. The output is either plain text, or HTML.
60167 Exim log files are also supported by the <emphasis>Lire</emphasis> system produced by the
60168 LogReport Foundation <emphasis role="bold"><ulink url="http://www.logreport.org">http://www.logreport.org</ulink></emphasis>.
60169 </para>
60170 <para>
60171 The <emphasis>eximstats</emphasis> script has been hacked about quite a bit over time. The
60172 latest version is the result of some extensive revision by Steve Campbell. A
60173 lot of information is given by default, but there are options for suppressing
60174 various parts of it. Following any options, the arguments to the script are a
60175 list of files, which should be main log files. For example:
60176 </para>
60177 <literallayout class="monospaced">
60178 eximstats -nr /var/spool/exim/log/mainlog.01
60179 </literallayout>
60180 <para>
60181 By default, <emphasis>eximstats</emphasis> extracts information about the number and volume of
60182 messages received from or delivered to various hosts. The information is sorted
60183 both by message count and by volume, and the top fifty hosts in each category
60184 are listed on the standard output. Similar information, based on email
60185 addresses or domains instead of hosts can be requested by means of various
60186 options. For messages delivered and received locally, similar statistics are
60187 also produced per user.
60188 </para>
60189 <para>
60190 The output also includes total counts and statistics about delivery errors, and
60191 histograms showing the number of messages received and deliveries made in each
60192 hour of the day. A delivery with more than one address in its envelope (for
60193 example, an SMTP transaction with more than one RCPT command) is counted
60194 as a single delivery by <emphasis>eximstats</emphasis>.
60195 </para>
60196 <para>
60197 Though normally more deliveries than receipts are reported (as messages may
60198 have multiple recipients), it is possible for <emphasis>eximstats</emphasis> to report more
60199 messages received than delivered, even though the queue is empty at the start
60200 and end of the period in question. If an incoming message contains no valid
60201 recipients, no deliveries are recorded for it. A bounce message is handled as
60202 an entirely separate message.
60203 </para>
60204 <para>
60205 <emphasis>eximstats</emphasis> always outputs a grand total summary giving the volume and number
60206 of messages received and deliveries made, and the number of hosts involved in
60207 each case. It also outputs the number of messages that were delayed (that is,
60208 not completely delivered at the first attempt), and the number that had at
60209 least one address that failed.
60210 </para>
60211 <para>
60212 The remainder of the output is in sections that can be independently disabled
60213 or modified by various options. It consists of a summary of deliveries by
60214 transport, histograms of messages received and delivered per time interval
60215 (default per hour), information about the time messages spent on the queue,
60216 a list of relayed messages, lists of the top fifty sending hosts, local
60217 senders, destination hosts, and destination local users by count and by volume,
60218 and a list of delivery errors that occurred.
60219 </para>
60220 <para>
60221 The relay information lists messages that were actually relayed, that is, they
60222 came from a remote host and were directly delivered to some other remote host,
60223 without being processed (for example, for aliasing or forwarding) locally.
60224 </para>
60225 <para>
60226 There are quite a few options for <emphasis>eximstats</emphasis> to control exactly what it
60227 outputs. These are documented in the Perl script itself, and can be extracted
60228 by running the command <command>perldoc</command> on the script. For example:
60229 </para>
60230 <literallayout class="monospaced">
60231 perldoc /usr/exim/bin/eximstats
60232 </literallayout>
60233 </section>
60234 <section id="SECTcheckaccess">
60235 <title>Checking access policy (exim_checkaccess)</title>
60236 <para>
60237 <indexterm role="concept">
60238 <primary><emphasis>exim_checkaccess</emphasis></primary>
60239 </indexterm>
60240 <indexterm role="concept">
60241 <primary>policy control</primary>
60242 <secondary>checking access</secondary>
60243 </indexterm>
60244 <indexterm role="concept">
60245 <primary>checking access</primary>
60246 </indexterm>
60247 The <option>-bh</option> command line argument allows you to run a fake SMTP session with
60248 debugging output, in order to check what Exim is doing when it is applying
60249 policy controls to incoming SMTP mail. However, not everybody is sufficiently
60250 familiar with the SMTP protocol to be able to make full use of <option>-bh</option>, and
60251 sometimes you just want to answer the question <quote>Does this address have
60252 access?</quote> without bothering with any further details.
60253 </para>
60254 <para>
60255 The <emphasis>exim_checkaccess</emphasis> utility is a <quote>packaged</quote> version of <option>-bh</option>. It takes
60256 two arguments, an IP address and an email address:
60257 </para>
60258 <literallayout class="monospaced">
60259 exim_checkaccess 10.9.8.7 A.User@a.domain.example
60260 </literallayout>
60261 <para>
60262 The utility runs a call to Exim with the <option>-bh</option> option, to test whether the
60263 given email address would be accepted in a RCPT command in a TCP/IP
60264 connection from the host with the given IP address. The output of the utility
60265 is either the word <quote>accepted</quote>, or the SMTP error response, for example:
60266 </para>
60267 <literallayout class="monospaced">
60268 Rejected:
60269 550 Relay not permitted
60270 </literallayout>
60271 <para>
60272 When running this test, the utility uses <literal>&lt;&gt;</literal> as the envelope sender address
60273 for the MAIL command, but you can change this by providing additional
60274 options. These are passed directly to the Exim command. For example, to specify
60275 that the test is to be run with the sender address <emphasis>himself@there.example</emphasis>
60276 you can use:
60277 </para>
60278 <literallayout class="monospaced">
60279 exim_checkaccess 10.9.8.7 A.User@a.domain.example \
60280                  -f himself@there.example
60281 </literallayout>
60282 <para>
60283 Note that these additional Exim command line items must be given after the two
60284 mandatory arguments.
60285 </para>
60286 <para>
60287 Because the <option>exim_checkaccess</option> uses <option>-bh</option>, it does not perform callouts
60288 while running its checks. You can run checks that include callouts by using
60289 <option>-bhc</option>, but this is not yet available in a <quote>packaged</quote> form.
60290 </para>
60291 </section>
60292 <section id="SECTdbmbuild">
60293 <title>Making DBM files (exim_dbmbuild)</title>
60294 <para>
60295 <indexterm role="concept">
60296 <primary>DBM</primary>
60297 <secondary>building dbm files</secondary>
60298 </indexterm>
60299 <indexterm role="concept">
60300 <primary>building DBM files</primary>
60301 </indexterm>
60302 <indexterm role="concept">
60303 <primary><emphasis>exim_dbmbuild</emphasis></primary>
60304 </indexterm>
60305 <indexterm role="concept">
60306 <primary>lower casing</primary>
60307 </indexterm>
60308 <indexterm role="concept">
60309 <primary>binary zero</primary>
60310 <secondary>in lookup key</secondary>
60311 </indexterm>
60312 The <emphasis>exim_dbmbuild</emphasis> program reads an input file containing keys and data in
60313 the format used by the <command>lsearch</command> lookup (see section
60314 <xref linkend="SECTsinglekeylookups"/>). It writes a DBM file using the lower-cased alias
60315 names as keys and the remainder of the information as data. The lower-casing
60316 can be prevented by calling the program with the <option>-nolc</option> option.
60317 </para>
60318 <para>
60319 A terminating zero is included as part of the key string. This is expected by
60320 the <command>dbm</command> lookup type. However, if the option <option>-nozero</option> is given,
60321 <emphasis>exim_dbmbuild</emphasis> creates files without terminating zeroes in either the key
60322 strings or the data strings. The <command>dbmnz</command> lookup type can be used with such
60323 files.
60324 </para>
60325 <para>
60326 The program requires two arguments: the name of the input file (which can be a
60327 single hyphen to indicate the standard input), and the name of the output file.
60328 It creates the output under a temporary name, and then renames it if all went
60329 well.
60330 </para>
60331 <para>
60332 <indexterm role="concept">
60333 <primary>USE_DB</primary>
60334 </indexterm>
60335 If the native DB interface is in use (USE_DB is set in a compile-time
60336 configuration file &ndash; this is common in free versions of Unix) the two file
60337 names must be different, because in this mode the Berkeley DB functions create
60338 a single output file using exactly the name given. For example,
60339 </para>
60340 <literallayout class="monospaced">
60341 exim_dbmbuild /etc/aliases /etc/aliases.db
60342 </literallayout>
60343 <para>
60344 reads the system alias file and creates a DBM version of it in
60345 <filename>/etc/aliases.db</filename>.
60346 </para>
60347 <para>
60348 In systems that use the <emphasis>ndbm</emphasis> routines (mostly proprietary versions of
60349 Unix), two files are used, with the suffixes <filename>.dir</filename> and <filename>.pag</filename>. In this
60350 environment, the suffixes are added to the second argument of
60351 <emphasis>exim_dbmbuild</emphasis>, so it can be the same as the first. This is also the case
60352 when the Berkeley functions are used in compatibility mode (though this is not
60353 recommended), because in that case it adds a <filename>.db</filename> suffix to the file name.
60354 </para>
60355 <para>
60356 If a duplicate key is encountered, the program outputs a warning, and when it
60357 finishes, its return code is 1 rather than zero, unless the <option>-noduperr</option>
60358 option is used. By default, only the first of a set of duplicates is used &ndash;
60359 this makes it compatible with <command>lsearch</command> lookups. There is an option
60360 <option>-lastdup</option> which causes it to use the data for the last duplicate instead.
60361 There is also an option <option>-nowarn</option>, which stops it listing duplicate keys to
60362 <option>stderr</option>. For other errors, where it doesn&#x2019;t actually make a new file, the
60363 return code is 2.
60364 </para>
60365 </section>
60366 <section id="SECTfinindret">
60367 <title>Finding individual retry times (exinext)</title>
60368 <para>
60369 <indexterm role="concept">
60370 <primary>retry</primary>
60371 <secondary>times</secondary>
60372 </indexterm>
60373 <indexterm role="concept">
60374 <primary><emphasis>exinext</emphasis></primary>
60375 </indexterm>
60376 A utility called <emphasis>exinext</emphasis> (mostly a Perl script) provides the ability to
60377 fish specific information out of the retry database. Given a mail domain (or a
60378 complete address), it looks up the hosts for that domain, and outputs any retry
60379 information for the hosts or for the domain. At present, the retry information
60380 is obtained by running <emphasis>exim_dumpdb</emphasis> (see below) and post-processing the
60381 output. For example:
60382 </para>
60383 <literallayout class="monospaced">
60384 $ exinext piglet@milne.fict.example
60385 kanga.milne.example:192.168.8.1 error 146: Connection refused
60386   first failed: 21-Feb-1996 14:57:34
60387   last tried:   21-Feb-1996 14:57:34
60388   next try at:  21-Feb-1996 15:02:34
60389 roo.milne.example:192.168.8.3 error 146: Connection refused
60390   first failed: 20-Jan-1996 13:12:08
60391   last tried:   21-Feb-1996 11:42:03
60392   next try at:  21-Feb-1996 19:42:03
60393   past final cutoff time
60394 </literallayout>
60395 <para>
60396 You can also give <emphasis>exinext</emphasis> a local part, without a domain, and it
60397 will give any retry information for that local part in your default domain.
60398 A message id can be used to obtain retry information pertaining to a specific
60399 message. This exists only when an attempt to deliver a message to a remote host
60400 suffers a message-specific error (see section <xref linkend="SECToutSMTPerr"/>).
60401 <emphasis>exinext</emphasis> is not particularly efficient, but then it is not expected to be
60402 run very often.
60403 </para>
60404 <para>
60405 The <emphasis>exinext</emphasis> utility calls Exim to find out information such as the location
60406 of the spool directory. The utility has <option>-C</option> and <option>-D</option> options, which are
60407 passed on to the <emphasis>exim</emphasis> commands. The first specifies an alternate Exim
60408 configuration file, and the second sets macros for use within the configuration
60409 file. These features are mainly to help in testing, but might also be useful in
60410 environments where more than one configuration file is in use.
60411 </para>
60412 </section>
60413 <section id="SECThindatmai">
60414 <title>Hints database maintenance</title>
60415 <para>
60416 <indexterm role="concept">
60417 <primary>hints database</primary>
60418 <secondary>maintenance</secondary>
60419 </indexterm>
60420 <indexterm role="concept">
60421 <primary>maintaining Exim&#x2019;s hints database</primary>
60422 </indexterm>
60423 Three utility programs are provided for maintaining the DBM files that Exim
60424 uses to contain its delivery hint information. Each program requires two
60425 arguments. The first specifies the name of Exim&#x2019;s spool directory, and the
60426 second is the name of the database it is to operate on. These are as follows:
60427 </para>
60428 <itemizedlist>
60429 <listitem>
60430 <para>
60431 <emphasis>retry</emphasis>: the database of retry information
60432 </para>
60433 </listitem>
60434 <listitem>
60435 <para>
60436 <emphasis>wait-</emphasis>&lt;<emphasis>transport name</emphasis>&gt;: databases of information about messages waiting
60437 for remote hosts
60438 </para>
60439 </listitem>
60440 <listitem>
60441 <para>
60442 <emphasis>callout</emphasis>: the callout cache
60443 </para>
60444 </listitem>
60445 <listitem>
60446 <para>
60447 <emphasis>ratelimit</emphasis>: the data for implementing the ratelimit ACL condition
60448 </para>
60449 </listitem>
60450 <listitem>
60451 <para>
60452 <emphasis>misc</emphasis>: other hints data
60453 </para>
60454 </listitem>
60455 </itemizedlist>
60456 <para>
60457 The <emphasis>misc</emphasis> database is used for
60458 </para>
60459 <itemizedlist>
60460 <listitem>
60461 <para>
60462 Serializing ETRN runs (when <option>smtp_etrn_serialize</option> is set)
60463 </para>
60464 </listitem>
60465 <listitem>
60466 <para>
60467 Serializing delivery to a specific host (when <option>serialize_hosts</option> is set in an
60468 <command>smtp</command> transport)
60469 </para>
60470 </listitem>
60471 </itemizedlist>
60472 </section>
60473 <section id="SECID261">
60474 <title>exim_dumpdb</title>
60475 <para>
60476 <indexterm role="concept">
60477 <primary><emphasis>exim_dumpdb</emphasis></primary>
60478 </indexterm>
60479 The entire contents of a database are written to the standard output by the
60480 <emphasis>exim_dumpdb</emphasis> program, which has no options or arguments other than the
60481 spool and database names. For example, to dump the retry database:
60482 </para>
60483 <literallayout class="monospaced">
60484 exim_dumpdb /var/spool/exim retry
60485 </literallayout>
60486 <para>
60487 Two lines of output are produced for each entry:
60488 </para>
60489 <literallayout class="monospaced">
60490 T:mail.ref.example:192.168.242.242 146 77 Connection refused
60491 31-Oct-1995 12:00:12 02-Nov-1995 12:21:39 02-Nov-1995 20:21:39 *
60492 </literallayout>
60493 <para>
60494 The first item on the first line is the key of the record. It starts with one
60495 of the letters R, or T, depending on whether it refers to a routing or
60496 transport retry. For a local delivery, the next part is the local address; for
60497 a remote delivery it is the name of the remote host, followed by its failing IP
60498 address (unless <option>retry_include_ip_address</option> is set false on the <command>smtp</command>
60499 transport). If the remote port is not the standard one (port 25), it is added
60500 to the IP address. Then there follows an error code, an additional error code,
60501 and a textual description of the error.
60502 </para>
60503 <para>
60504 The three times on the second line are the time of first failure, the time of
60505 the last delivery attempt, and the computed time for the next attempt. The line
60506 ends with an asterisk if the cutoff time for the last retry rule has been
60507 exceeded.
60508 </para>
60509 <para>
60510 Each output line from <emphasis>exim_dumpdb</emphasis> for the <emphasis>wait-xxx</emphasis> databases
60511 consists of a host name followed by a list of ids for messages that are or were
60512 waiting to be delivered to that host. If there are a very large number for any
60513 one host, continuation records, with a sequence number added to the host name,
60514 may be seen. The data in these records is often out of date, because a message
60515 may be routed to several alternative hosts, and Exim makes no effort to keep
60516 cross-references.
60517 </para>
60518 </section>
60519 <section id="SECID262">
60520 <title>exim_tidydb</title>
60521 <para>
60522 <indexterm role="concept">
60523 <primary><emphasis>exim_tidydb</emphasis></primary>
60524 </indexterm>
60525 The <emphasis>exim_tidydb</emphasis> utility program is used to tidy up the contents of a hints
60526 database. If run with no options, it removes all records that are more than 30
60527 days old. The age is calculated from the date and time that the record was last
60528 updated. Note that, in the case of the retry database, it is <emphasis>not</emphasis> the time
60529 since the first delivery failure. Information about a host that has been down
60530 for more than 30 days will remain in the database, provided that the record is
60531 updated sufficiently often.
60532 </para>
60533 <para>
60534 The cutoff date can be altered by means of the <option>-t</option> option, which must be
60535 followed by a time. For example, to remove all records older than a week from
60536 the retry database:
60537 </para>
60538 <literallayout class="monospaced">
60539 exim_tidydb -t 7d /var/spool/exim retry
60540 </literallayout>
60541 <para>
60542 Both the <emphasis>wait-xxx</emphasis> and <emphasis>retry</emphasis> databases contain items that involve
60543 message ids. In the former these appear as data in records keyed by host &ndash;
60544 they were messages that were waiting for that host &ndash; and in the latter they
60545 are the keys for retry information for messages that have suffered certain
60546 types of error. When <emphasis>exim_tidydb</emphasis> is run, a check is made to ensure that
60547 message ids in database records are those of messages that are still on the
60548 queue. Message ids for messages that no longer exist are removed from
60549 <emphasis>wait-xxx</emphasis> records, and if this leaves any records empty, they are deleted.
60550 For the <emphasis>retry</emphasis> database, records whose keys are non-existent message ids are
60551 removed. The <emphasis>exim_tidydb</emphasis> utility outputs comments on the standard output
60552 whenever it removes information from the database.
60553 </para>
60554 <para>
60555 Certain records are automatically removed by Exim when they are no longer
60556 needed, but others are not. For example, if all the MX hosts for a domain are
60557 down, a retry record is created for each one. If the primary MX host comes back
60558 first, its record is removed when Exim successfully delivers to it, but the
60559 records for the others remain because Exim has not tried to use those hosts.
60560 </para>
60561 <para>
60562 It is important, therefore, to run <emphasis>exim_tidydb</emphasis> periodically on all the
60563 hints databases. You should do this at a quiet time of day, because it requires
60564 a database to be locked (and therefore inaccessible to Exim) while it does its
60565 work. Removing records from a DBM file does not normally make the file smaller,
60566 but all the common DBM libraries are able to re-use the space that is released.
60567 After an initial phase of increasing in size, the databases normally reach a
60568 point at which they no longer get any bigger, as long as they are regularly
60569 tidied.
60570 </para>
60571 <para>
60572 <emphasis role="bold">Warning</emphasis>: If you never run <emphasis>exim_tidydb</emphasis>, the space used by the hints
60573 databases is likely to keep on increasing.
60574 </para>
60575 </section>
60576 <section id="SECID263">
60577 <title>exim_fixdb</title>
60578 <para>
60579 <indexterm role="concept">
60580 <primary><emphasis>exim_fixdb</emphasis></primary>
60581 </indexterm>
60582 The <emphasis>exim_fixdb</emphasis> program is a utility for interactively modifying databases.
60583 Its main use is for testing Exim, but it might also be occasionally useful for
60584 getting round problems in a live system. It has no options, and its interface
60585 is somewhat crude. On entry, it prompts for input with a right angle-bracket. A
60586 key of a database record can then be entered, and the data for that record is
60587 displayed.
60588 </para>
60589 <para>
60590 If <quote>d</quote> is typed at the next prompt, the entire record is deleted. For all
60591 except the <emphasis>retry</emphasis> database, that is the only operation that can be carried
60592 out. For the <emphasis>retry</emphasis> database, each field is output preceded by a number, and
60593 data for individual fields can be changed by typing the field number followed
60594 by new data, for example:
60595 </para>
60596 <literallayout class="monospaced">
60597 &gt; 4 951102:1000
60598 </literallayout>
60599 <para>
60600 resets the time of the next delivery attempt. Time values are given as a
60601 sequence of digit pairs for year, month, day, hour, and minute. Colons can be
60602 used as optional separators.
60603 </para>
60604 </section>
60605 <section id="SECTmailboxmaint">
60606 <title>Mailbox maintenance (exim_lock)</title>
60607 <para>
60608 <indexterm role="concept">
60609 <primary>mailbox</primary>
60610 <secondary>maintenance</secondary>
60611 </indexterm>
60612 <indexterm role="concept">
60613 <primary><emphasis>exim_lock</emphasis></primary>
60614 </indexterm>
60615 <indexterm role="concept">
60616 <primary>locking mailboxes</primary>
60617 </indexterm>
60618 The <emphasis>exim_lock</emphasis> utility locks a mailbox file using the same algorithm as
60619 Exim. For a discussion of locking issues, see section <xref linkend="SECTopappend"/>.
60620 <emphasis>Exim_lock</emphasis> can be used to prevent any modification of a mailbox by Exim or
60621 a user agent while investigating a problem. The utility requires the name of
60622 the file as its first argument. If the locking is successful, the second
60623 argument is run as a command (using C&#x2019;s <function>system()</function> function); if there is no
60624 second argument, the value of the SHELL environment variable is used; if this
60625 is unset or empty, <filename>/bin/sh</filename> is run. When the command finishes, the mailbox
60626 is unlocked and the utility ends. The following options are available:
60627 </para>
60628 <variablelist>
60629 <varlistentry>
60630 <term><option>-fcntl</option></term>
60631 <listitem>
60632 <para>
60633 Use <function>fcntl()</function> locking on the open mailbox.
60634 </para>
60635 </listitem></varlistentry>
60636 <varlistentry>
60637 <term><option>-flock</option></term>
60638 <listitem>
60639 <para>
60640 Use <function>flock()</function> locking on the open mailbox, provided the operating system
60641 supports it.
60642 </para>
60643 </listitem></varlistentry>
60644 <varlistentry>
60645 <term><option>-interval</option></term>
60646 <listitem>
60647 <para>
60648 This must be followed by a number, which is a number of seconds; it sets the
60649 interval to sleep between retries (default 3).
60650 </para>
60651 </listitem></varlistentry>
60652 <varlistentry>
60653 <term><option>-lockfile</option></term>
60654 <listitem>
60655 <para>
60656 Create a lock file before opening the mailbox.
60657 </para>
60658 </listitem></varlistentry>
60659 <varlistentry>
60660 <term><option>-mbx</option></term>
60661 <listitem>
60662 <para>
60663 Lock the mailbox using MBX rules.
60664 </para>
60665 </listitem></varlistentry>
60666 <varlistentry>
60667 <term><option>-q</option></term>
60668 <listitem>
60669 <para>
60670 Suppress verification output.
60671 </para>
60672 </listitem></varlistentry>
60673 <varlistentry>
60674 <term><option>-retries</option></term>
60675 <listitem>
60676 <para>
60677 This must be followed by a number; it sets the number of times to try to get
60678 the lock (default 10).
60679 </para>
60680 </listitem></varlistentry>
60681 <varlistentry>
60682 <term><option>-restore_time</option></term>
60683 <listitem>
60684 <para>
60685 This option causes <option>exim_lock</option> to restore the modified and read times to the
60686 locked file before exiting. This allows you to access a locked mailbox (for
60687 example, to take a backup copy) without disturbing the times that the user
60688 subsequently sees.
60689 </para>
60690 </listitem></varlistentry>
60691 <varlistentry>
60692 <term><option>-timeout</option></term>
60693 <listitem>
60694 <para>
60695 This must be followed by a number, which is a number of seconds; it sets a
60696 timeout to be used with a blocking <function>fcntl()</function> lock. If it is not set (the
60697 default), a non-blocking call is used.
60698 </para>
60699 </listitem></varlistentry>
60700 <varlistentry>
60701 <term><option>-v</option></term>
60702 <listitem>
60703 <para>
60704 Generate verbose output.
60705 </para>
60706 </listitem></varlistentry>
60707 </variablelist>
60708 <para>
60709 If none of <option>-fcntl</option>, <option>-flock</option>, <option>-lockfile</option> or <option>-mbx</option> are given, the
60710 default is to create a lock file and also to use <function>fcntl()</function> locking on the
60711 mailbox, which is the same as Exim&#x2019;s default. The use of <option>-flock</option> or
60712 <option>-fcntl</option> requires that the file be writeable; the use of <option>-lockfile</option>
60713 requires that the directory containing the file be writeable. Locking by lock
60714 file does not last for ever; Exim assumes that a lock file is expired if it is
60715 more than 30 minutes old.
60716 </para>
60717 <para>
60718 The <option>-mbx</option> option can be used with either or both of <option>-fcntl</option> or
60719 <option>-flock</option>. It assumes <option>-fcntl</option> by default. MBX locking causes a shared lock
60720 to be taken out on the open mailbox, and an exclusive lock on the file
60721 <filename>/tmp/.n.m</filename> where <emphasis>n</emphasis> and <emphasis>m</emphasis> are the device number and inode
60722 number of the mailbox file. When the locking is released, if an exclusive lock
60723 can be obtained for the mailbox, the file in <filename>/tmp</filename> is deleted.
60724 </para>
60725 <para>
60726 The default output contains verification of the locking that takes place. The
60727 <option>-v</option> option causes some additional information to be given. The <option>-q</option> option
60728 suppresses all output except error messages.
60729 </para>
60730 <para>
60731 A command such as
60732 </para>
60733 <literallayout class="monospaced">
60734 exim_lock /var/spool/mail/spqr
60735 </literallayout>
60736 <para>
60737 runs an interactive shell while the file is locked, whereas
60738 </para>
60739 <literallayout>
60740 <literal>exim_lock -q /var/spool/mail/spqr &lt;&lt;End</literal>
60741 &lt;<emphasis>some commands</emphasis>&gt;
60742 <literal>End</literal>
60743 </literallayout>
60744 <para>
60745 runs a specific non-interactive sequence of commands while the file is locked,
60746 suppressing all verification output. A single command can be run by a command
60747 such as
60748 </para>
60749 <literallayout class="monospaced">
60750 exim_lock -q /var/spool/mail/spqr \
60751   "cp /var/spool/mail/spqr /some/where"
60752 </literallayout>
60753 <para>
60754 Note that if a command is supplied, it must be entirely contained within the
60755 second argument &ndash; hence the quotes.
60756 <indexterm role="concept" startref="IIDutils" class="endofrange"/>
60757 </para>
60758 </section>
60759 </chapter>
60760
60761 <chapter id="CHAPeximon">
60762 <title>The Exim monitor</title>
60763 <para>
60764 <indexterm role="concept" id="IIDeximon" class="startofrange">
60765 <primary>Exim monitor</primary>
60766 <secondary>description</secondary>
60767 </indexterm>
60768 <indexterm role="concept">
60769 <primary>X-windows</primary>
60770 </indexterm>
60771 <indexterm role="concept">
60772 <primary><emphasis>eximon</emphasis></primary>
60773 </indexterm>
60774 <indexterm role="concept">
60775 <primary>Local/eximon.conf</primary>
60776 </indexterm>
60777 <indexterm role="concept">
60778 <primary><filename>exim_monitor/EDITME</filename></primary>
60779 </indexterm>
60780 The Exim monitor is an application which displays in an X window information
60781 about the state of Exim&#x2019;s queue and what Exim is doing. An admin user can
60782 perform certain operations on messages from this GUI interface; however all
60783 such facilities are also available from the command line, and indeed, the
60784 monitor itself makes use of the command line to perform any actions requested.
60785 </para>
60786 <section id="SECID264">
60787 <title>Running the monitor</title>
60788 <para>
60789 The monitor is started by running the script called <emphasis>eximon</emphasis>. This is a shell
60790 script that sets up a number of environment variables, and then runs the
60791 binary called <filename>eximon.bin</filename>. The default appearance of the monitor window can
60792 be changed by editing the <filename>Local/eximon.conf</filename> file created by editing
60793 <filename>exim_monitor/EDITME</filename>. Comments in that file describe what the various
60794 parameters are for.
60795 </para>
60796 <para>
60797 The parameters that get built into the <emphasis>eximon</emphasis> script can be overridden for
60798 a particular invocation by setting up environment variables of the same names,
60799 preceded by <literal>EXIMON_</literal>. For example, a shell command such as
60800 </para>
60801 <literallayout class="monospaced">
60802 EXIMON_LOG_DEPTH=400 eximon
60803 </literallayout>
60804 <para>
60805 (in a Bourne-compatible shell) runs <emphasis>eximon</emphasis> with an overriding setting of
60806 the LOG_DEPTH parameter. If EXIMON_LOG_FILE_PATH is set in the environment, it
60807 overrides the Exim log file configuration. This makes it possible to have
60808 <emphasis>eximon</emphasis> tailing log data that is written to syslog, provided that MAIL.INFO
60809 syslog messages are routed to a file on the local host.
60810 </para>
60811 <para>
60812 X resources can be used to change the appearance of the window in the normal
60813 way. For example, a resource setting of the form
60814 </para>
60815 <literallayout class="monospaced">
60816 Eximon*background: gray94
60817 </literallayout>
60818 <para>
60819 changes the colour of the background to light grey rather than white. The
60820 stripcharts are drawn with both the data lines and the reference lines in
60821 black. This means that the reference lines are not visible when on top of the
60822 data. However, their colour can be changed by setting a resource called
60823 <quote>highlight</quote> (an odd name, but that&#x2019;s what the Athena stripchart widget uses).
60824 For example, if your X server is running Unix, you could set up lighter
60825 reference lines in the stripcharts by obeying
60826 </para>
60827 <literallayout class="monospaced">
60828 xrdb -merge &lt;&lt;End
60829 Eximon*highlight: gray
60830 End
60831 </literallayout>
60832 <para>
60833 <indexterm role="concept">
60834 <primary>admin user</primary>
60835 </indexterm>
60836 In order to see the contents of messages on the queue, and to operate on them,
60837 <emphasis>eximon</emphasis> must either be run as root or by an admin user.
60838 </para>
60839 <para>
60840 The monitor&#x2019;s window is divided into three parts. The first contains one or
60841 more stripcharts and two action buttons, the second contains a <quote>tail</quote> of the
60842 main log file, and the third is a display of the queue of messages awaiting
60843 delivery, with two more action buttons. The following sections describe these
60844 different parts of the display.
60845 </para>
60846 </section>
60847 <section id="SECID265">
60848 <title>The stripcharts</title>
60849 <para>
60850 <indexterm role="concept">
60851 <primary>stripchart</primary>
60852 </indexterm>
60853 The first stripchart is always a count of messages on the queue. Its name can
60854 be configured by setting QUEUE_STRIPCHART_NAME in the
60855 <filename>Local/eximon.conf</filename> file. The remaining stripcharts are defined in the
60856 configuration script by regular expression matches on log file entries, making
60857 it possible to display, for example, counts of messages delivered to certain
60858 hosts or using certain transports. The supplied defaults display counts of
60859 received and delivered messages, and of local and SMTP deliveries. The default
60860 period between stripchart updates is one minute; this can be adjusted by a
60861 parameter in the <filename>Local/eximon.conf</filename> file.
60862 </para>
60863 <para>
60864 The stripchart displays rescale themselves automatically as the value they are
60865 displaying changes. There are always 10 horizontal lines in each chart; the
60866 title string indicates the value of each division when it is greater than one.
60867 For example, <quote>x2</quote> means that each division represents a value of 2.
60868 </para>
60869 <para>
60870 It is also possible to have a stripchart which shows the percentage fullness of
60871 a particular disk partition, which is useful when local deliveries are confined
60872 to a single partition.
60873 </para>
60874 <para>
60875 <indexterm role="concept">
60876 <primary><option>statvfs</option> function</primary>
60877 </indexterm>
60878 This relies on the availability of the <function>statvfs()</function> function or equivalent in
60879 the operating system. Most, but not all versions of Unix that support Exim have
60880 this. For this particular stripchart, the top of the chart always represents
60881 100%, and the scale is given as <quote>x10%</quote>. This chart is configured by setting
60882 SIZE_STRIPCHART and (optionally) SIZE_STRIPCHART_NAME in the
60883 <filename>Local/eximon.conf</filename> file.
60884 </para>
60885 </section>
60886 <section id="SECID266">
60887 <title>Main action buttons</title>
60888 <para>
60889 <indexterm role="concept">
60890 <primary>size</primary>
60891 <secondary>of monitor window</secondary>
60892 </indexterm>
60893 <indexterm role="concept">
60894 <primary>Exim monitor</primary>
60895 <secondary>window size</secondary>
60896 </indexterm>
60897 <indexterm role="concept">
60898 <primary>window size</primary>
60899 </indexterm>
60900 Below the stripcharts there is an action button for quitting the monitor. Next
60901 to this is another button marked <quote>Size</quote>. They are placed here so that
60902 shrinking the window to its default minimum size leaves just the queue count
60903 stripchart and these two buttons visible. Pressing the <quote>Size</quote> button causes
60904 the window to expand to its maximum size, unless it is already at the maximum,
60905 in which case it is reduced to its minimum.
60906 </para>
60907 <para>
60908 When expanding to the maximum, if the window cannot be fully seen where it
60909 currently is, it is moved back to where it was the last time it was at full
60910 size. When it is expanding from its minimum size, the old position is
60911 remembered, and next time it is reduced to the minimum it is moved back there.
60912 </para>
60913 <para>
60914 The idea is that you can keep a reduced window just showing one or two
60915 stripcharts at a convenient place on your screen, easily expand it to show
60916 the full window when required, and just as easily put it back to what it was.
60917 The idea is copied from what the <emphasis>twm</emphasis> window manager does for its
60918 <emphasis>f.fullzoom</emphasis> action. The minimum size of the window can be changed by setting
60919 the MIN_HEIGHT and MIN_WIDTH values in <filename>Local/eximon.conf</filename>.
60920 </para>
60921 <para>
60922 Normally, the monitor starts up with the window at its full size, but it can be
60923 built so that it starts up with the window at its smallest size, by setting
60924 START_SMALL=yes in <filename>Local/eximon.conf</filename>.
60925 </para>
60926 </section>
60927 <section id="SECID267">
60928 <title>The log display</title>
60929 <para>
60930 <indexterm role="concept">
60931 <primary>log</primary>
60932 <secondary>tail of; in monitor</secondary>
60933 </indexterm>
60934 The second section of the window is an area in which a display of the tail of
60935 the main log is maintained.
60936 To save space on the screen, the timestamp on each log line is shortened by
60937 removing the date and, if <option>log_timezone</option> is set, the timezone.
60938 The log tail is not available when the only destination for logging data is
60939 syslog, unless the syslog lines are routed to a local file whose name is passed
60940 to <emphasis>eximon</emphasis> via the EXIMON_LOG_FILE_PATH environment variable.
60941 </para>
60942 <para>
60943 The log sub-window has a scroll bar at its lefthand side which can be used to
60944 move back to look at earlier text, and the up and down arrow keys also have a
60945 scrolling effect. The amount of log that is kept depends on the setting of
60946 LOG_BUFFER in <filename>Local/eximon.conf</filename>, which specifies the amount of memory
60947 to use. When this is full, the earlier 50% of data is discarded &ndash; this is
60948 much more efficient than throwing it away line by line. The sub-window also has
60949 a horizontal scroll bar for accessing the ends of long log lines. This is the
60950 only means of horizontal scrolling; the right and left arrow keys are not
60951 available. Text can be cut from this part of the window using the mouse in the
60952 normal way. The size of this subwindow is controlled by parameters in the
60953 configuration file <filename>Local/eximon.conf</filename>.
60954 </para>
60955 <para>
60956 Searches of the text in the log window can be carried out by means of the ^R
60957 and ^S keystrokes, which default to a reverse and a forward search,
60958 respectively. The search covers only the text that is displayed in the window.
60959 It cannot go further back up the log.
60960 </para>
60961 <para>
60962 The point from which the search starts is indicated by a caret marker. This is
60963 normally at the end of the text in the window, but can be positioned explicitly
60964 by pointing and clicking with the left mouse button, and is moved automatically
60965 by a successful search. If new text arrives in the window when it is scrolled
60966 back, the caret remains where it is, but if the window is not scrolled back,
60967 the caret is moved to the end of the new text.
60968 </para>
60969 <para>
60970 Pressing ^R or ^S pops up a window into which the search text can be typed.
60971 There are buttons for selecting forward or reverse searching, for carrying out
60972 the search, and for cancelling. If the <quote>Search</quote> button is pressed, the search
60973 happens and the window remains so that further searches can be done. If the
60974 <quote>Return</quote> key is pressed, a single search is done and the window is closed. If
60975 ^C is typed the search is cancelled.
60976 </para>
60977 <para>
60978 The searching facility is implemented using the facilities of the Athena text
60979 widget. By default this pops up a window containing both <quote>search</quote> and
60980 <quote>replace</quote> options. In order to suppress the unwanted <quote>replace</quote> portion for
60981 eximon, a modified version of the <option>TextPop</option> widget is distributed with Exim.
60982 However, the linkers in BSDI and HP-UX seem unable to handle an externally
60983 provided version of <option>TextPop</option> when the remaining parts of the text widget
60984 come from the standard libraries. The compile-time option EXIMON_TEXTPOP can be
60985 unset to cut out the modified <option>TextPop</option>, making it possible to build Eximon
60986 on these systems, at the expense of having unwanted items in the search popup
60987 window.
60988 </para>
60989 </section>
60990 <section id="SECID268">
60991 <title>The queue display</title>
60992 <para>
60993 <indexterm role="concept">
60994 <primary>queue</primary>
60995 <secondary>display in monitor</secondary>
60996 </indexterm>
60997 The bottom section of the monitor window contains a list of all messages that
60998 are on the queue, which includes those currently being received or delivered,
60999 as well as those awaiting delivery. The size of this subwindow is controlled by
61000 parameters in the configuration file <filename>Local/eximon.conf</filename>, and the frequency
61001 at which it is updated is controlled by another parameter in the same file &ndash;
61002 the default is 5 minutes, since queue scans can be quite expensive. However,
61003 there is an <quote>Update</quote> action button just above the display which can be used
61004 to force an update of the queue display at any time.
61005 </para>
61006 <para>
61007 When a host is down for some time, a lot of pending mail can build up for it,
61008 and this can make it hard to deal with other messages on the queue. To help
61009 with this situation there is a button next to <quote>Update</quote> called <quote>Hide</quote>. If
61010 pressed, a dialogue box called <quote>Hide addresses ending with</quote> is put up. If you
61011 type anything in here and press <quote>Return</quote>, the text is added to a chain of
61012 such texts, and if every undelivered address in a message matches at least one
61013 of the texts, the message is not displayed.
61014 </para>
61015 <para>
61016 If there is an address that does not match any of the texts, all the addresses
61017 are displayed as normal. The matching happens on the ends of addresses so, for
61018 example, <emphasis>cam.ac.uk</emphasis> specifies all addresses in Cambridge, while
61019 <emphasis>xxx@foo.com.example</emphasis> specifies just one specific address. When any hiding
61020 has been set up, a button called <quote>Unhide</quote> is displayed. If pressed, it
61021 cancels all hiding. Also, to ensure that hidden messages do not get forgotten,
61022 a hide request is automatically cancelled after one hour.
61023 </para>
61024 <para>
61025 While the dialogue box is displayed, you can&#x2019;t press any buttons or do anything
61026 else to the monitor window. For this reason, if you want to cut text from the
61027 queue display to use in the dialogue box, you have to do the cutting before
61028 pressing the <quote>Hide</quote> button.
61029 </para>
61030 <para>
61031 The queue display contains, for each unhidden queued message, the length of
61032 time it has been on the queue, the size of the message, the message id, the
61033 message sender, and the first undelivered recipient, all on one line. If it is
61034 a bounce message, the sender is shown as <quote>&lt;&gt;</quote>. If there is more than one
61035 recipient to which the message has not yet been delivered, subsequent ones are
61036 listed on additional lines, up to a maximum configured number, following which
61037 an ellipsis is displayed. Recipients that have already received the message are
61038 not shown.
61039 </para>
61040 <para>
61041 <indexterm role="concept">
61042 <primary>frozen messages</primary>
61043 <secondary>display</secondary>
61044 </indexterm>
61045 If a message is frozen, an asterisk is displayed at the left-hand side.
61046 </para>
61047 <para>
61048 The queue display has a vertical scroll bar, and can also be scrolled by means
61049 of the arrow keys. Text can be cut from it using the mouse in the normal way.
61050 The text searching facilities, as described above for the log window, are also
61051 available, but the caret is always moved to the end of the text when the queue
61052 display is updated.
61053 </para>
61054 </section>
61055 <section id="SECID269">
61056 <title>The queue menu</title>
61057 <para>
61058 <indexterm role="concept">
61059 <primary>queue</primary>
61060 <secondary>menu in monitor</secondary>
61061 </indexterm>
61062 If the <option>shift</option> key is held down and the left button is clicked when the mouse
61063 pointer is over the text for any message, an action menu pops up, and the first
61064 line of the queue display for the message is highlighted. This does not affect
61065 any selected text.
61066 </para>
61067 <para>
61068 If you want to use some other event for popping up the menu, you can set the
61069 MENU_EVENT parameter in <filename>Local/eximon.conf</filename> to change the default, or
61070 set EXIMON_MENU_EVENT in the environment before starting the monitor. The
61071 value set in this parameter is a standard X event description. For example, to
61072 run eximon using <option>ctrl</option> rather than <option>shift</option> you could use
61073 </para>
61074 <literallayout class="monospaced">
61075 EXIMON_MENU_EVENT='Ctrl&lt;Btn1Down&gt;' eximon
61076 </literallayout>
61077 <para>
61078 The title of the menu is the message id, and it contains entries which act as
61079 follows:
61080 </para>
61081 <itemizedlist>
61082 <listitem>
61083 <para>
61084 <emphasis>message log</emphasis>: The contents of the message log for the message are displayed
61085 in a new text window.
61086 </para>
61087 </listitem>
61088 <listitem>
61089 <para>
61090 <emphasis>headers</emphasis>: Information from the spool file that contains the envelope
61091 information and headers is displayed in a new text window. See chapter
61092 <xref linkend="CHAPspool"/> for a description of the format of spool files.
61093 </para>
61094 </listitem>
61095 <listitem>
61096 <para>
61097 <emphasis>body</emphasis>: The contents of the spool file containing the body of the message are
61098 displayed in a new text window. There is a default limit of 20,000 bytes to the
61099 amount of data displayed. This can be changed by setting the BODY_MAX
61100 option at compile time, or the EXIMON_BODY_MAX option at run time.
61101 </para>
61102 </listitem>
61103 <listitem>
61104 <para>
61105 <emphasis>deliver message</emphasis>: A call to Exim is made using the <option>-M</option> option to request
61106 delivery of the message. This causes an automatic thaw if the message is
61107 frozen. The <option>-v</option> option is also set, and the output from Exim is displayed in
61108 a new text window. The delivery is run in a separate process, to avoid holding
61109 up the monitor while the delivery proceeds.
61110 </para>
61111 </listitem>
61112 <listitem>
61113 <para>
61114 <emphasis>freeze message</emphasis>: A call to Exim is made using the <option>-Mf</option> option to request
61115 that the message be frozen.
61116 </para>
61117 </listitem>
61118 <listitem>
61119 <para>
61120 <indexterm role="concept">
61121 <primary>thawing messages</primary>
61122 </indexterm>
61123 <indexterm role="concept">
61124 <primary>unfreezing messages</primary>
61125 </indexterm>
61126 <indexterm role="concept">
61127 <primary>frozen messages</primary>
61128 <secondary>thawing</secondary>
61129 </indexterm>
61130 <emphasis>thaw message</emphasis>: A call to Exim is made using the <option>-Mt</option> option to request
61131 that the message be thawed.
61132 </para>
61133 </listitem>
61134 <listitem>
61135 <para>
61136 <indexterm role="concept">
61137 <primary>delivery</primary>
61138 <secondary>forcing failure</secondary>
61139 </indexterm>
61140 <emphasis>give up on msg</emphasis>: A call to Exim is made using the <option>-Mg</option> option to request
61141 that Exim gives up trying to deliver the message. A bounce message is generated
61142 for any remaining undelivered addresses.
61143 </para>
61144 </listitem>
61145 <listitem>
61146 <para>
61147 <emphasis>remove message</emphasis>: A call to Exim is made using the <option>-Mrm</option> option to request
61148 that the message be deleted from the system without generating a bounce
61149 message.
61150 </para>
61151 </listitem>
61152 <listitem>
61153 <para>
61154 <emphasis>add recipient</emphasis>: A dialog box is displayed into which a recipient address can
61155 be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
61156 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
61157 Otherwise it must be entered as a fully qualified address. Pressing RETURN
61158 causes a call to Exim to be made using the <option>-Mar</option> option to request that an
61159 additional recipient be added to the message, unless the entry box is empty, in
61160 which case no action is taken.
61161 </para>
61162 </listitem>
61163 <listitem>
61164 <para>
61165 <emphasis>mark delivered</emphasis>: A dialog box is displayed into which a recipient address
61166 can be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
61167 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
61168 Otherwise it must be entered as a fully qualified address. Pressing RETURN
61169 causes a call to Exim to be made using the <option>-Mmd</option> option to mark the given
61170 recipient address as already delivered, unless the entry box is empty, in which
61171 case no action is taken.
61172 </para>
61173 </listitem>
61174 <listitem>
61175 <para>
61176 <emphasis>mark all delivered</emphasis>: A call to Exim is made using the <option>-Mmad</option> option to
61177 mark all recipient addresses as already delivered.
61178 </para>
61179 </listitem>
61180 <listitem>
61181 <para>
61182 <emphasis>edit sender</emphasis>: A dialog box is displayed initialized with the current
61183 sender&#x2019;s address. Pressing RETURN causes a call to Exim to be made using the
61184 <option>-Mes</option> option to replace the sender address, unless the entry box is empty,
61185 in which case no action is taken. If you want to set an empty sender (as in
61186 bounce messages), you must specify it as <quote>&lt;&gt;</quote>. Otherwise, if the address is
61187 not qualified and the QUALIFY_DOMAIN parameter is set in <filename>Local/eximon.conf</filename>,
61188 the address is qualified with that domain.
61189 </para>
61190 </listitem>
61191 </itemizedlist>
61192 <para>
61193 When a delivery is forced, a window showing the <option>-v</option> output is displayed. In
61194 other cases when a call to Exim is made, if there is any output from Exim (in
61195 particular, if the command fails) a window containing the command and the
61196 output is displayed. Otherwise, the results of the action are normally apparent
61197 from the log and queue displays. However, if you set ACTION_OUTPUT=yes in
61198 <filename>Local/eximon.conf</filename>, a window showing the Exim command is always opened, even
61199 if no output is generated.
61200 </para>
61201 <para>
61202 The queue display is automatically updated for actions such as freezing and
61203 thawing, unless ACTION_QUEUE_UPDATE=no has been set in
61204 <filename>Local/eximon.conf</filename>. In this case the <quote>Update</quote> button has to be used to
61205 force an update of the display after one of these actions.
61206 </para>
61207 <para>
61208 In any text window that is displayed as result of a menu action, the normal
61209 cut-and-paste facility is available, and searching can be carried out using ^R
61210 and ^S, as described above for the log tail window.
61211 <indexterm role="concept" startref="IIDeximon" class="endofrange"/>
61212 </para>
61213 </section>
61214 </chapter>
61215
61216 <chapter id="CHAPsecurity">
61217 <title>Security considerations</title>
61218 <para>
61219 <indexterm role="concept" id="IIDsecurcon" class="startofrange">
61220 <primary>security</primary>
61221 <secondary>discussion of</secondary>
61222 </indexterm>
61223 This chapter discusses a number of issues concerned with security, some of
61224 which are also covered in other parts of this manual.
61225 </para>
61226 <para>
61227 For reasons that this author does not understand, some people have promoted
61228 Exim as a <quote>particularly secure</quote> mailer. Perhaps it is because of the
61229 existence of this chapter in the documentation. However, the intent of the
61230 chapter is simply to describe the way Exim works in relation to certain
61231 security concerns, not to make any specific claims about the effectiveness of
61232 its security as compared with other MTAs.
61233 </para>
61234 <para>
61235 What follows is a description of the way Exim is supposed to be. Best efforts
61236 have been made to try to ensure that the code agrees with the theory, but an
61237 absence of bugs can never be guaranteed. Any that are reported will get fixed
61238 as soon as possible.
61239 </para>
61240 <section id="SECID286">
61241 <title>Building a more <quote>hardened</quote> Exim</title>
61242 <para>
61243 <indexterm role="concept">
61244 <primary>security</primary>
61245 <secondary>build-time features</secondary>
61246 </indexterm>
61247 There are a number of build-time options that can be set in <filename>Local/Makefile</filename>
61248 to create Exim binaries that are <quote>harder</quote> to attack, in particular by a rogue
61249 Exim administrator who does not have the root password, or by someone who has
61250 penetrated the Exim (but not the root) account. These options are as follows:
61251 </para>
61252 <itemizedlist>
61253 <listitem>
61254 <para>
61255 ALT_CONFIG_PREFIX can be set to a string that is required to match the
61256 start of any file names used with the <option>-C</option> option. When it is set, these file
61257 names are also not allowed to contain the sequence <quote>/../</quote>. (However, if the
61258 value of the <option>-C</option> option is identical to the value of CONFIGURE_FILE in
61259 <filename>Local/Makefile</filename>, Exim ignores <option>-C</option> and proceeds as usual.) There is no
61260 default setting for <option>ALT_CONFIG_PREFIX</option>.
61261 </para>
61262 <para revisionflag="changed">
61263 If the permitted configuration files are confined to a directory to
61264 which only root has access, this guards against someone who has broken
61265 into the Exim account from running a privileged Exim with an arbitrary
61266 configuration file, and using it to break into other accounts.
61267 </para>
61268 </listitem>
61269 <listitem>
61270 <para revisionflag="changed">
61271 If a non-trusted configuration file (i.e. not the default configuration file
61272 or one which is trusted by virtue of being listed in the TRUSTED_CONFIG_LIST
61273 file) is specified with <option>-C</option>, or if macros are given with <option>-D</option> (but see
61274 the next item), then root privilege is retained only if the caller of Exim is
61275 root. This locks out the possibility of testing a configuration using <option>-C</option>
61276 right through message reception and delivery, even if the caller is root. The
61277 reception works, but by that time, Exim is running as the Exim user, so when
61278 it re-execs to regain privilege for the delivery, the use of <option>-C</option> causes
61279 privilege to be lost. However, root can test reception and delivery using two
61280 separate commands.
61281 </para>
61282 </listitem>
61283 <listitem>
61284 <para revisionflag="changed">
61285 The WHITELIST_D_MACROS build option declares some macros to be safe to override
61286 with <option>-D</option> if the real uid is one of root, the Exim run-time user or the
61287 CONFIGURE_OWNER, if defined.  The potential impact of this option is limited by
61288 requiring the run-time value supplied to <option>-D</option> to match a regex that errs on
61289 the restrictive side.  Requiring build-time selection of safe macros is onerous
61290 but this option is intended solely as a transition mechanism to permit
61291 previously-working configurations to continue to work after release 4.73.
61292 </para>
61293 </listitem>
61294 <listitem>
61295 <para revisionflag="changed">
61296 If DISABLE_D_OPTION is defined, the use of the <option>-D</option> command line option
61297 is disabled.
61298 </para>
61299 </listitem>
61300 <listitem>
61301 <para revisionflag="changed">
61302 FIXED_NEVER_USERS can be set to a colon-separated list of users that are
61303 never to be used for any deliveries. This is like the <option>never_users</option> runtime
61304 option, but it cannot be overridden; the runtime option adds additional users
61305 to the list. The default setting is <quote>root</quote>; this prevents a non-root user who
61306 is permitted to modify the runtime file from using Exim as a way to get root.
61307 </para>
61308 </listitem>
61309 </itemizedlist>
61310 </section>
61311 <section id="SECID270">
61312 <title>Root privilege</title>
61313 <para>
61314 <indexterm role="concept">
61315 <primary>setuid</primary>
61316 </indexterm>
61317 <indexterm role="concept">
61318 <primary>root privilege</primary>
61319 </indexterm>
61320 The Exim binary is normally setuid to root, which means that it gains root
61321 privilege (runs as root) when it starts execution. In some special cases (for
61322 example, when the daemon is not in use and there are no local deliveries), it
61323 may be possible to run Exim setuid to some user other than root. This is
61324 discussed in the next section. However, in most installations, root privilege
61325 is required for two things:
61326 </para>
61327 <itemizedlist>
61328 <listitem>
61329 <para>
61330 To set up a socket connected to the standard SMTP port (25) when initialising
61331 the listening daemon. If Exim is run from <emphasis>inetd</emphasis>, this privileged action is
61332 not required.
61333 </para>
61334 </listitem>
61335 <listitem>
61336 <para>
61337 To be able to change uid and gid in order to read users&#x2019; <filename>.forward</filename> files and
61338 perform local deliveries as the receiving user or as specified in the
61339 configuration.
61340 </para>
61341 </listitem>
61342 </itemizedlist>
61343 <para>
61344 It is not necessary to be root to do any of the other things Exim does, such as
61345 receiving messages and delivering them externally over SMTP, and it is
61346 obviously more secure if Exim does not run as root except when necessary.
61347 For this reason, a user and group for Exim to use must be defined in
61348 <filename>Local/Makefile</filename>. These are known as <quote>the Exim user</quote> and <quote>the Exim
61349 group</quote>. Their values can be changed by the run time configuration, though this
61350 is not recommended. Often a user called <emphasis>exim</emphasis> is used, but some sites use
61351 <emphasis>mail</emphasis> or another user name altogether.
61352 </para>
61353 <para>
61354 Exim uses <function>setuid()</function> whenever it gives up root privilege. This is a permanent
61355 abdication; the process cannot regain root afterwards. Prior to release 4.00,
61356 <function>seteuid()</function> was used in some circumstances, but this is no longer the case.
61357 </para>
61358 <para>
61359 After a new Exim process has interpreted its command line options, it changes
61360 uid and gid in the following cases:
61361 </para>
61362 <itemizedlist revisionflag="changed">
61363 <listitem>
61364 <para revisionflag="changed">
61365 <indexterm role="option">
61366 <primary><option>-C</option></primary>
61367 </indexterm>
61368 <indexterm role="option">
61369 <primary><option>-D</option></primary>
61370 </indexterm>
61371 If the <option>-C</option> option is used to specify an alternate configuration file, or if
61372 the <option>-D</option> option is used to define macro values for the configuration, and the
61373 calling process is not running as root, the uid and gid are changed to those of
61374 the calling process.
61375 However, if DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the <option>-D</option>
61376 option may not be used at all.
61377 If WHITELIST_D_MACROS is defined in <filename>Local/Makefile</filename>, then some macro values
61378 can be supplied if the calling process is running as root, the Exim run-time
61379 user or CONFIGURE_OWNER, if defined.
61380 </para>
61381 </listitem>
61382 <listitem>
61383 <para revisionflag="changed">
61384 <indexterm role="option">
61385 <primary><option>-be</option></primary>
61386 </indexterm>
61387 <indexterm role="option">
61388 <primary><option>-bf</option></primary>
61389 </indexterm>
61390 <indexterm role="option">
61391 <primary><option>-bF</option></primary>
61392 </indexterm>
61393 If the expansion test option (<option>-be</option>) or one of the filter testing options
61394 (<option>-bf</option> or <option>-bF</option>) are used, the uid and gid are changed to those of the
61395 calling process.
61396 </para>
61397 </listitem>
61398 <listitem>
61399 <para revisionflag="changed">
61400 If the process is not a daemon process or a queue runner process or a delivery
61401 process or a process for testing address routing (started with <option>-bt</option>), the
61402 uid and gid are changed to the Exim user and group. This means that Exim always
61403 runs under its own uid and gid when receiving messages. This also applies when
61404 testing address verification
61405 <indexterm role="option">
61406 <primary><option>-bv</option></primary>
61407 </indexterm>
61408 <indexterm role="option">
61409 <primary><option>-bh</option></primary>
61410 </indexterm>
61411 (the <option>-bv</option> option) and testing incoming message policy controls (the <option>-bh</option>
61412 option).
61413 </para>
61414 </listitem>
61415 <listitem>
61416 <para revisionflag="changed">
61417 For a daemon, queue runner, delivery, or address testing process, the uid
61418 remains as root at this stage, but the gid is changed to the Exim group.
61419 </para>
61420 </listitem>
61421 </itemizedlist>
61422 <para>
61423 The processes that initially retain root privilege behave as follows:
61424 </para>
61425 <itemizedlist>
61426 <listitem>
61427 <para>
61428 A daemon process changes the gid to the Exim group and the uid to the Exim
61429 user after setting up one or more listening sockets. The <function>initgroups()</function>
61430 function is called, so that if the Exim user is in any additional groups, they
61431 will be used during message reception.
61432 </para>
61433 </listitem>
61434 <listitem>
61435 <para>
61436 A queue runner process retains root privilege throughout its execution. Its
61437 job is to fork a controlled sequence of delivery processes.
61438 </para>
61439 </listitem>
61440 <listitem>
61441 <para>
61442 A delivery process retains root privilege throughout most of its execution,
61443 but any actual deliveries (that is, the transports themselves) are run in
61444 subprocesses which always change to a non-root uid and gid. For local
61445 deliveries this is typically the uid and gid of the owner of the mailbox; for
61446 remote deliveries, the Exim uid and gid are used. Once all the delivery
61447 subprocesses have been run, a delivery process changes to the Exim uid and gid
61448 while doing post-delivery tidying up such as updating the retry database and
61449 generating bounce and warning messages.
61450 </para>
61451 <para>
61452 While the recipient addresses in a message are being routed, the delivery
61453 process runs as root. However, if a user&#x2019;s filter file has to be processed,
61454 this is done in a subprocess that runs under the individual user&#x2019;s uid and
61455 gid. A system filter is run as root unless <option>system_filter_user</option> is set.
61456 </para>
61457 </listitem>
61458 <listitem>
61459 <para>
61460 A process that is testing addresses (the <option>-bt</option> option) runs as root so that
61461 the routing is done in the same environment as a message delivery.
61462 </para>
61463 </listitem>
61464 </itemizedlist>
61465 </section>
61466 <section id="SECTrunexiwitpri">
61467 <title>Running Exim without privilege</title>
61468 <para>
61469 <indexterm role="concept">
61470 <primary>privilege, running without</primary>
61471 </indexterm>
61472 <indexterm role="concept">
61473 <primary>unprivileged running</primary>
61474 </indexterm>
61475 <indexterm role="concept">
61476 <primary>root privilege</primary>
61477 <secondary>running without</secondary>
61478 </indexterm>
61479 Some installations like to run Exim in an unprivileged state for more of its
61480 operation, for added security. Support for this mode of operation is provided
61481 by the global option <option>deliver_drop_privilege</option>. When this is set, the uid and
61482 gid are changed to the Exim user and group at the start of a delivery process
61483 (and also queue runner and address testing processes). This means that address
61484 routing is no longer run as root, and the deliveries themselves cannot change
61485 to any other uid.
61486 </para>
61487 <para>
61488 <indexterm role="concept">
61489 <primary>SIGHUP</primary>
61490 </indexterm>
61491 <indexterm role="concept">
61492 <primary>daemon</primary>
61493 <secondary>restarting</secondary>
61494 </indexterm>
61495 Leaving the binary setuid to root, but setting <option>deliver_drop_privilege</option> means
61496 that the daemon can still be started in the usual way, and it can respond
61497 correctly to SIGHUP because the re-invocation regains root privilege.
61498 </para>
61499 <para>
61500 An alternative approach is to make Exim setuid to the Exim user and also setgid
61501 to the Exim group. If you do this, the daemon must be started from a root
61502 process. (Calling Exim from a root process makes it behave in the way it does
61503 when it is setuid root.) However, the daemon cannot restart itself after a
61504 SIGHUP signal because it cannot regain privilege.
61505 </para>
61506 <para>
61507 It is still useful to set <option>deliver_drop_privilege</option> in this case, because it
61508 stops Exim from trying to re-invoke itself to do a delivery after a message has
61509 been received. Such a re-invocation is a waste of resources because it has no
61510 effect.
61511 </para>
61512 <para>
61513 If restarting the daemon is not an issue (for example, if <option>mua_wrapper</option> is
61514 set, or <emphasis>inetd</emphasis> is being used instead of a daemon), having the binary setuid
61515 to the Exim user seems a clean approach, but there is one complication:
61516 </para>
61517 <para>
61518 In this style of operation, Exim is running with the real uid and gid set to
61519 those of the calling process, and the effective uid/gid set to Exim&#x2019;s values.
61520 Ideally, any association with the calling process&#x2019; uid/gid should be dropped,
61521 that is, the real uid/gid should be reset to the effective values so as to
61522 discard any privileges that the caller may have. While some operating systems
61523 have a function that permits this action for a non-root effective uid, quite a
61524 number of them do not. Because of this lack of standardization, Exim does not
61525 address this problem at this time.
61526 </para>
61527 <para>
61528 For this reason, the recommended approach for <quote>mostly unprivileged</quote> running
61529 is to keep the Exim binary setuid to root, and to set
61530 <option>deliver_drop_privilege</option>. This also has the advantage of allowing a daemon to
61531 be used in the most straightforward way.
61532 </para>
61533 <para>
61534 If you configure Exim not to run delivery processes as root, there are a
61535 number of restrictions on what you can do:
61536 </para>
61537 <itemizedlist>
61538 <listitem>
61539 <para>
61540 You can deliver only as the Exim user/group. You should  explicitly use the
61541 <option>user</option> and <option>group</option> options to override routers or local transports that
61542 normally deliver as the recipient. This makes sure that configurations that
61543 work in this mode function the same way in normal mode. Any implicit or
61544 explicit specification of another user causes an error.
61545 </para>
61546 </listitem>
61547 <listitem>
61548 <para>
61549 Use of <filename>.forward</filename> files is severely restricted, such that it is usually
61550 not worthwhile to include them in the configuration.
61551 </para>
61552 </listitem>
61553 <listitem>
61554 <para>
61555 Users who wish to use <filename>.forward</filename> would have to make their home directory and
61556 the file itself accessible to the Exim user. Pipe and append-to-file entries,
61557 and their equivalents in Exim filters, cannot be used. While they could be
61558 enabled in the Exim user&#x2019;s name, that would be insecure and not very useful.
61559 </para>
61560 </listitem>
61561 <listitem>
61562 <para>
61563 Unless the local user mailboxes are all owned by the Exim user (possible in
61564 some POP3 or IMAP-only environments):
61565 </para>
61566 <orderedlist numeration="arabic">
61567 <listitem>
61568 <para>
61569 They must be owned by the Exim group and be writeable by that group. This
61570 implies you must set <option>mode</option> in the appendfile configuration, as well as the
61571 mode of the mailbox files themselves.
61572 </para>
61573 </listitem>
61574 <listitem>
61575 <para>
61576 You must set <option>no_check_owner</option>, since most or all of the files will not be
61577 owned by the Exim user.
61578 </para>
61579 </listitem>
61580 <listitem>
61581 <para>
61582 You must set <option>file_must_exist</option>, because Exim cannot set the owner correctly
61583 on a newly created mailbox when unprivileged. This also implies that new
61584 mailboxes need to be created manually.
61585 </para>
61586 </listitem>
61587 </orderedlist>
61588 </listitem>
61589 </itemizedlist>
61590 <para>
61591 These restrictions severely restrict what can be done in local deliveries.
61592 However, there are no restrictions on remote deliveries. If you are running a
61593 gateway host that does no local deliveries, setting <option>deliver_drop_privilege</option>
61594 gives more security at essentially no cost.
61595 </para>
61596 <para>
61597 If you are using the <option>mua_wrapper</option> facility (see chapter
61598 <xref linkend="CHAPnonqueueing"/>), <option>deliver_drop_privilege</option> is forced to be true.
61599 </para>
61600 </section>
61601 <section id="SECID271">
61602 <title>Delivering to local files</title>
61603 <para>
61604 Full details of the checks applied by <command>appendfile</command> before it writes to a file
61605 are given in chapter <xref linkend="CHAPappendfile"/>.
61606 </para>
61607 </section>
61608 <section id="SECID272">
61609 <title>IPv4 source routing</title>
61610 <para>
61611 <indexterm role="concept">
61612 <primary>source routing</primary>
61613 <secondary>in IP packets</secondary>
61614 </indexterm>
61615 <indexterm role="concept">
61616 <primary>IP source routing</primary>
61617 </indexterm>
61618 Many operating systems suppress IP source-routed packets in the kernel, but
61619 some cannot be made to do this, so Exim does its own check. It logs incoming
61620 IPv4 source-routed TCP calls, and then drops them. Things are all different in
61621 IPv6. No special checking is currently done.
61622 </para>
61623 </section>
61624 <section id="SECID273">
61625 <title>The VRFY, EXPN, and ETRN commands in SMTP</title>
61626 <para>
61627 Support for these SMTP commands is disabled by default. If required, they can
61628 be enabled by defining suitable ACLs.
61629 </para>
61630 </section>
61631 <section id="SECID274">
61632 <title>Privileged users</title>
61633 <para>
61634 <indexterm role="concept">
61635 <primary>trusted users</primary>
61636 </indexterm>
61637 <indexterm role="concept">
61638 <primary>admin user</primary>
61639 </indexterm>
61640 <indexterm role="concept">
61641 <primary>privileged user</primary>
61642 </indexterm>
61643 <indexterm role="concept">
61644 <primary>user</primary>
61645 <secondary>trusted</secondary>
61646 </indexterm>
61647 <indexterm role="concept">
61648 <primary>user</primary>
61649 <secondary>admin</secondary>
61650 </indexterm>
61651 Exim recognizes two sets of users with special privileges. Trusted users are
61652 able to submit new messages to Exim locally, but supply their own sender
61653 addresses and information about a sending host. For other users submitting
61654 local messages, Exim sets up the sender address from the uid, and doesn&#x2019;t
61655 permit a remote host to be specified.
61656 </para>
61657 <para>
61658 <indexterm role="option">
61659 <primary><option>-f</option></primary>
61660 </indexterm>
61661 However, an untrusted user is permitted to use the <option>-f</option> command line option
61662 in the special form <option>-f &lt;&gt;</option> to indicate that a delivery failure for the
61663 message should not cause an error report. This affects the message&#x2019;s envelope,
61664 but it does not affect the <emphasis>Sender:</emphasis> header. Untrusted users may also be
61665 permitted to use specific forms of address with the <option>-f</option> option by setting
61666 the <option>untrusted_set_sender</option> option.
61667 </para>
61668 <para>
61669 Trusted users are used to run processes that receive mail messages from some
61670 other mail domain and pass them on to Exim for delivery either locally, or over
61671 the Internet. Exim trusts a caller that is running as root, as the Exim user,
61672 as any user listed in the <option>trusted_users</option> configuration option, or under any
61673 group listed in the <option>trusted_groups</option> option.
61674 </para>
61675 <para>
61676 Admin users are permitted to do things to the messages on Exim&#x2019;s queue. They
61677 can freeze or thaw messages, cause them to be returned to their senders, remove
61678 them entirely, or modify them in various ways. In addition, admin users can run
61679 the Exim monitor and see all the information it is capable of providing, which
61680 includes the contents of files on the spool.
61681 </para>
61682 <para>
61683 <indexterm role="option">
61684 <primary><option>-M</option></primary>
61685 </indexterm>
61686 <indexterm role="option">
61687 <primary><option>-q</option></primary>
61688 </indexterm>
61689 By default, the use of the <option>-M</option> and <option>-q</option> options to cause Exim to attempt
61690 delivery of messages on its queue is restricted to admin users. This
61691 restriction can be relaxed by setting the <option>no_prod_requires_admin</option> option.
61692 Similarly, the use of <option>-bp</option> (and its variants) to list the contents of the
61693 queue is also restricted to admin users. This restriction can be relaxed by
61694 setting <option>no_queue_list_requires_admin</option>.
61695 </para>
61696 <para>
61697 Exim recognizes an admin user if the calling process is running as root or as
61698 the Exim user or if any of the groups associated with the calling process is
61699 the Exim group. It is not necessary actually to be running under the Exim
61700 group. However, if admin users who are not root or the Exim user are to access
61701 the contents of files on the spool via the Exim monitor (which runs
61702 unprivileged), Exim must be built to allow group read access to its spool
61703 files.
61704 </para>
61705 </section>
61706 <section id="SECID275">
61707 <title>Spool files</title>
61708 <para>
61709 <indexterm role="concept">
61710 <primary>spool directory</primary>
61711 <secondary>files</secondary>
61712 </indexterm>
61713 Exim&#x2019;s spool directory and everything it contains is owned by the Exim user and
61714 set to the Exim group. The mode for spool files is defined in the
61715 <filename>Local/Makefile</filename> configuration file, and defaults to 0640. This means that
61716 any user who is a member of the Exim group can access these files.
61717 </para>
61718 </section>
61719 <section id="SECID276">
61720 <title>Use of argv[0]</title>
61721 <para>
61722 Exim examines the last component of <option>argv[0]</option>, and if it matches one of a set
61723 of specific strings, Exim assumes certain options. For example, calling Exim
61724 with the last component of <option>argv[0]</option> set to <quote>rsmtp</quote> is exactly equivalent
61725 to calling it with the option <option>-bS</option>. There are no security implications in
61726 this.
61727 </para>
61728 </section>
61729 <section id="SECID277">
61730 <title>Use of %f formatting</title>
61731 <para>
61732 The only use made of <quote>%f</quote> by Exim is in formatting load average values. These
61733 are actually stored in integer variables as 1000 times the load average.
61734 Consequently, their range is limited and so therefore is the length of the
61735 converted output.
61736 </para>
61737 </section>
61738 <section id="SECID278">
61739 <title>Embedded Exim path</title>
61740 <para>
61741 Exim uses its own path name, which is embedded in the code, only when it needs
61742 to re-exec in order to regain root privilege. Therefore, it is not root when it
61743 does so. If some bug allowed the path to get overwritten, it would lead to an
61744 arbitrary program&#x2019;s being run as exim, not as root.
61745 </para>
61746 </section>
61747 <section id="SECTdynmoddir" revisionflag="changed">
61748 <title>Dynamic module directory</title>
61749 <para revisionflag="changed">
61750 Any dynamically loadable modules must be installed into the directory
61751 defined in <literal>LOOKUP_MODULE_DIR</literal> in <filename>Local/Makefile</filename> for Exim to permit
61752 loading it.
61753 </para>
61754 </section>
61755 <section id="SECID279">
61756 <title>Use of sprintf()</title>
61757 <para>
61758 <indexterm role="concept">
61759 <primary><function>sprintf()</function></primary>
61760 </indexterm>
61761 A large number of occurrences of <quote>sprintf</quote> in the code are actually calls to
61762 <emphasis>string_sprintf()</emphasis>, a function that returns the result in malloc&#x2019;d store.
61763 The intermediate formatting is done into a large fixed buffer by a function
61764 that runs through the format string itself, and checks the length of each
61765 conversion before performing it, thus preventing buffer overruns.
61766 </para>
61767 <para>
61768 The remaining uses of <function>sprintf()</function> happen in controlled circumstances where
61769 the output buffer is known to be sufficiently long to contain the converted
61770 string.
61771 </para>
61772 </section>
61773 <section id="SECID280">
61774 <title>Use of debug_printf() and log_write()</title>
61775 <para>
61776 Arbitrary strings are passed to both these functions, but they do their
61777 formatting by calling the function <emphasis>string_vformat()</emphasis>, which runs through
61778 the format string itself, and checks the length of each conversion.
61779 </para>
61780 </section>
61781 <section id="SECID281">
61782 <title>Use of strcat() and strcpy()</title>
61783 <para>
61784 These are used only in cases where the output buffer is known to be large
61785 enough to hold the result.
61786 <indexterm role="concept" startref="IIDsecurcon" class="endofrange"/>
61787 </para>
61788 </section>
61789 </chapter>
61790
61791 <chapter id="CHAPspool">
61792 <title>Format of spool files</title>
61793 <para>
61794 <indexterm role="concept" id="IIDforspo1" class="startofrange">
61795 <primary>format</primary>
61796 <secondary>spool files</secondary>
61797 </indexterm>
61798 <indexterm role="concept" id="IIDforspo2" class="startofrange">
61799 <primary>spool directory</primary>
61800 <secondary>format of files</secondary>
61801 </indexterm>
61802 <indexterm role="concept" id="IIDforspo3" class="startofrange">
61803 <primary>spool files</primary>
61804 <secondary>format of</secondary>
61805 </indexterm>
61806 <indexterm role="concept">
61807 <primary>spool files</primary>
61808 <secondary>editing</secondary>
61809 </indexterm>
61810 A message on Exim&#x2019;s queue consists of two files, whose names are the message id
61811 followed by -D and -H, respectively. The data portion of the message is kept in
61812 the -D file on its own. The message&#x2019;s envelope, status, and headers are all
61813 kept in the -H file, whose format is described in this chapter. Each of these
61814 two files contains the final component of its own name as its first line. This
61815 is insurance against disk crashes where the directory is lost but the files
61816 themselves are recoverable.
61817 </para>
61818 <para>
61819 Some people are tempted into editing -D files in order to modify messages. You
61820 need to be extremely careful if you do this; it is not recommended and you are
61821 on your own if you do it. Here are some of the pitfalls:
61822 </para>
61823 <itemizedlist>
61824 <listitem>
61825 <para>
61826 You must ensure that Exim does not try to deliver the message while you are
61827 fiddling with it. The safest way is to take out a write lock on the -D file,
61828 which is what Exim itself does, using <function>fcntl()</function>. If you update the file in
61829 place, the lock will be retained. If you write a new file and rename it, the
61830 lock will be lost at the instant of rename.
61831 </para>
61832 </listitem>
61833 <listitem>
61834 <para>
61835 <indexterm role="variable">
61836 <primary><varname>$body_linecount</varname></primary>
61837 </indexterm>
61838 If you change the number of lines in the file, the value of
61839 <varname>$body_linecount</varname>, which is stored in the -H file, will be incorrect. At
61840 present, this value is not used by Exim, but there is no guarantee that this
61841 will always be the case.
61842 </para>
61843 </listitem>
61844 <listitem>
61845 <para>
61846 If the message is in MIME format, you must take care not to break it.
61847 </para>
61848 </listitem>
61849 <listitem>
61850 <para>
61851 If the message is cryptographically signed, any change will invalidate the
61852 signature.
61853 </para>
61854 </listitem>
61855 </itemizedlist>
61856 <para>
61857 All in all, modifying -D files is fraught with danger.
61858 </para>
61859 <para>
61860 Files whose names end with -J may also be seen in the <filename>input</filename> directory (or
61861 its subdirectories when <option>split_spool_directory</option> is set). These are journal
61862 files, used to record addresses to which the message has been delivered during
61863 the course of a delivery attempt. If there are still undelivered recipients at
61864 the end, the -H file is updated, and the -J file is deleted. If, however, there
61865 is some kind of crash (for example, a power outage) before this happens, the -J
61866 file remains in existence. When Exim next processes the message, it notices the
61867 -J file and uses it to update the -H file before starting the next delivery
61868 attempt.
61869 </para>
61870 <section id="SECID282">
61871 <title>Format of the -H file</title>
61872 <para>
61873 <indexterm role="concept">
61874 <primary>uid (user id)</primary>
61875 <secondary>in spool file</secondary>
61876 </indexterm>
61877 <indexterm role="concept">
61878 <primary>gid (group id)</primary>
61879 <secondary>in spool file</secondary>
61880 </indexterm>
61881 The second line of the -H file contains the login name for the uid of the
61882 process that called Exim to read the message, followed by the numerical uid and
61883 gid. For a locally generated message, this is normally the user who sent the
61884 message. For a message received over TCP/IP via the daemon, it is
61885 normally the Exim user.
61886 </para>
61887 <para>
61888 The third line of the file contains the address of the message&#x2019;s sender as
61889 transmitted in the envelope, contained in angle brackets. The sender address is
61890 empty for bounce messages. For incoming SMTP mail, the sender address is given
61891 in the MAIL command. For locally generated mail, the sender address is
61892 created by Exim from the login name of the current user and the configured
61893 <option>qualify_domain</option>. However, this can be overridden by the <option>-f</option> option or a
61894 leading <quote>From&nbsp;</quote> line if the caller is trusted, or if the supplied address is
61895 <quote>&lt;&gt;</quote> or an address that matches <option>untrusted_set_senders</option>.
61896 </para>
61897 <para>
61898 The fourth line contains two numbers. The first is the time that the message
61899 was received, in the conventional Unix form &ndash; the number of seconds since the
61900 start of the epoch. The second number is a count of the number of messages
61901 warning of delayed delivery that have been sent to the sender.
61902 </para>
61903 <para>
61904 There follow a number of lines starting with a hyphen. These can appear in any
61905 order, and are omitted when not relevant:
61906 </para>
61907 <variablelist>
61908 <varlistentry>
61909 <term><option>-acl</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
61910 <listitem>
61911 <para>
61912 This item is obsolete, and is not generated from Exim release 4.61 onwards;
61913 <option>-aclc</option> and <option>-aclm</option> are used instead. However, <option>-acl</option> is still
61914 recognized, to provide backward compatibility. In the old format, a line of
61915 this form is present for every ACL variable that is not empty. The number
61916 identifies the variable; the <option>acl_c</option><emphasis role="bold">x</emphasis> variables are numbered 0&ndash;9 and
61917 the <option>acl_m</option><emphasis role="bold">x</emphasis> variables are numbered 10&ndash;19. The length is the length of
61918 the data string for the variable. The string itself starts at the beginning of
61919 the next line, and is followed by a newline character. It may contain internal
61920 newlines.
61921 </para>
61922 </listitem></varlistentry>
61923 <varlistentry>
61924 <term><option>-aclc</option>&nbsp;&lt;<emphasis>rest-of-name</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
61925 <listitem>
61926 <para>
61927 A line of this form is present for every ACL connection variable that is
61928 defined. Note that there is a space between <option>-aclc</option> and the rest of the name.
61929 The length is the length of the data string for the variable. The string itself
61930 starts at the beginning of the next line, and is followed by a newline
61931 character. It may contain internal newlines.
61932 </para>
61933 </listitem></varlistentry>
61934 <varlistentry>
61935 <term><option>-aclm</option>&nbsp;&lt;<emphasis>rest-of-name</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
61936 <listitem>
61937 <para>
61938 A line of this form is present for every ACL message variable that is defined.
61939 Note that there is a space between <option>-aclm</option> and the rest of the name. The
61940 length is the length of the data string for the variable. The string itself
61941 starts at the beginning of the next line, and is followed by a newline
61942 character. It may contain internal newlines.
61943 </para>
61944 </listitem></varlistentry>
61945 <varlistentry>
61946 <term><option>-active_hostname</option>&nbsp;&lt;<emphasis>hostname</emphasis>&gt;</term>
61947 <listitem>
61948 <para>
61949 This is present if, when the message was received over SMTP, the value of
61950 <varname>$smtp_active_hostname</varname> was different to the value of <varname>$primary_hostname</varname>.
61951 </para>
61952 </listitem></varlistentry>
61953 <varlistentry>
61954 <term><option>-allow_unqualified_recipient</option></term>
61955 <listitem>
61956 <para>
61957 This is present if unqualified recipient addresses are permitted in header
61958 lines (to stop such addresses from being qualified if rewriting occurs at
61959 transport time). Local messages that were input using <option>-bnq</option> and remote
61960 messages from hosts that match <option>recipient_unqualified_hosts</option> set this flag.
61961 </para>
61962 </listitem></varlistentry>
61963 <varlistentry>
61964 <term><option>-allow_unqualified_sender</option></term>
61965 <listitem>
61966 <para>
61967 This is present if unqualified sender addresses are permitted in header lines
61968 (to stop such addresses from being qualified if rewriting occurs at transport
61969 time). Local messages that were input using <option>-bnq</option> and remote messages from
61970 hosts that match <option>sender_unqualified_hosts</option> set this flag.
61971 </para>
61972 </listitem></varlistentry>
61973 <varlistentry>
61974 <term><option>-auth_id</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
61975 <listitem>
61976 <para>
61977 The id information for a message received on an authenticated SMTP connection
61978 &ndash; the value of the <varname>$authenticated_id</varname> variable.
61979 </para>
61980 </listitem></varlistentry>
61981 <varlistentry>
61982 <term><option>-auth_sender</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
61983 <listitem>
61984 <para>
61985 The address of an authenticated sender &ndash; the value of the
61986 <varname>$authenticated_sender</varname> variable.
61987 </para>
61988 </listitem></varlistentry>
61989 <varlistentry>
61990 <term><option>-body_linecount</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
61991 <listitem>
61992 <para>
61993 This records the number of lines in the body of the message, and is always
61994 present.
61995 </para>
61996 </listitem></varlistentry>
61997 <varlistentry>
61998 <term><option>-body_zerocount</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
61999 <listitem>
62000 <para>
62001 This records the number of binary zero bytes in the body of the message, and is
62002 present if the number is greater than zero.
62003 </para>
62004 </listitem></varlistentry>
62005 <varlistentry>
62006 <term><option>-deliver_firsttime</option></term>
62007 <listitem>
62008 <para>
62009 This is written when a new message is first added to the spool. When the spool
62010 file is updated after a deferral, it is omitted.
62011 </para>
62012 </listitem></varlistentry>
62013 <varlistentry>
62014 <term><option>-frozen</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
62015 <listitem>
62016 <para>
62017 <indexterm role="concept">
62018 <primary>frozen messages</primary>
62019 <secondary>spool data</secondary>
62020 </indexterm>
62021 The message is frozen, and the freezing happened at &lt;<emphasis>time</emphasis>&gt;.
62022 </para>
62023 </listitem></varlistentry>
62024 <varlistentry>
62025 <term><option>-helo_name</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
62026 <listitem>
62027 <para>
62028 This records the host name as specified by a remote host in a HELO or EHLO
62029 command.
62030 </para>
62031 </listitem></varlistentry>
62032 <varlistentry>
62033 <term><option>-host_address</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;.&lt;<emphasis>port</emphasis>&gt;</term>
62034 <listitem>
62035 <para>
62036 This records the IP address of the host from which the message was received and
62037 the remote port number that was used. It is omitted for locally generated
62038 messages.
62039 </para>
62040 </listitem></varlistentry>
62041 <varlistentry>
62042 <term><option>-host_auth</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
62043 <listitem>
62044 <para>
62045 If the message was received on an authenticated SMTP connection, this records
62046 the name of the authenticator &ndash; the value of the
62047 <varname>$sender_host_authenticated</varname> variable.
62048 </para>
62049 </listitem></varlistentry>
62050 <varlistentry>
62051 <term><option>-host_lookup_failed</option></term>
62052 <listitem>
62053 <para>
62054 This is present if an attempt to look up the sending host&#x2019;s name from its IP
62055 address failed. It corresponds to the <varname>$host_lookup_failed</varname> variable.
62056 </para>
62057 </listitem></varlistentry>
62058 <varlistentry>
62059 <term><option>-host_name</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
62060 <listitem>
62061 <para>
62062 <indexterm role="concept">
62063 <primary>reverse DNS lookup</primary>
62064 </indexterm>
62065 <indexterm role="concept">
62066 <primary>DNS</primary>
62067 <secondary>reverse lookup</secondary>
62068 </indexterm>
62069 This records the name of the remote host from which the message was received,
62070 if the host name was looked up from the IP address when the message was being
62071 received. It is not present if no reverse lookup was done.
62072 </para>
62073 </listitem></varlistentry>
62074 <varlistentry>
62075 <term><option>-ident</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
62076 <listitem>
62077 <para>
62078 For locally submitted messages, this records the login of the originating user,
62079 unless it was a trusted user and the <option>-oMt</option> option was used to specify an
62080 ident value. For messages received over TCP/IP, this records the ident string
62081 supplied by the remote host, if any.
62082 </para>
62083 </listitem></varlistentry>
62084 <varlistentry>
62085 <term><option>-interface_address</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;.&lt;<emphasis>port</emphasis>&gt;</term>
62086 <listitem>
62087 <para>
62088 This records the IP address of the local interface and the port number through
62089 which a message was received from a remote host. It is omitted for locally
62090 generated messages.
62091 </para>
62092 </listitem></varlistentry>
62093 <varlistentry>
62094 <term><option>-local</option></term>
62095 <listitem>
62096 <para>
62097 The message is from a local sender.
62098 </para>
62099 </listitem></varlistentry>
62100 <varlistentry>
62101 <term><option>-localerror</option></term>
62102 <listitem>
62103 <para>
62104 The message is a locally-generated bounce message.
62105 </para>
62106 </listitem></varlistentry>
62107 <varlistentry>
62108 <term><option>-local_scan</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
62109 <listitem>
62110 <para>
62111 This records the data string that was returned by the <function>local_scan()</function> function
62112 when the message was received &ndash; the value of the <varname>$local_scan_data</varname>
62113 variable. It is omitted if no data was returned.
62114 </para>
62115 </listitem></varlistentry>
62116 <varlistentry>
62117 <term><option>-manual_thaw</option></term>
62118 <listitem>
62119 <para>
62120 The message was frozen but has been thawed manually, that is, by an explicit
62121 Exim command rather than via the auto-thaw process.
62122 </para>
62123 </listitem></varlistentry>
62124 <varlistentry>
62125 <term><option>-N</option></term>
62126 <listitem>
62127 <para>
62128 A testing delivery process was started using the <option>-N</option> option to suppress any
62129 actual deliveries, but delivery was deferred. At any further delivery attempts,
62130 <option>-N</option> is assumed.
62131 </para>
62132 </listitem></varlistentry>
62133 <varlistentry>
62134 <term><option>-received_protocol</option></term>
62135 <listitem>
62136 <para>
62137 This records the value of the <varname>$received_protocol</varname> variable, which contains
62138 the name of the protocol by which the message was received.
62139 </para>
62140 </listitem></varlistentry>
62141 <varlistentry>
62142 <term><option>-sender_set_untrusted</option></term>
62143 <listitem>
62144 <para>
62145 The envelope sender of this message was set by an untrusted local caller (used
62146 to ensure that the caller is displayed in queue listings).
62147 </para>
62148 </listitem></varlistentry>
62149 <varlistentry>
62150 <term><option>-spam_score_int</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
62151 <listitem>
62152 <para>
62153 If a message was scanned by SpamAssassin, this is present. It records the value
62154 of <varname>$spam_score_int</varname>.
62155 </para>
62156 </listitem></varlistentry>
62157 <varlistentry>
62158 <term><option>-tls_certificate_verified</option></term>
62159 <listitem>
62160 <para>
62161 A TLS certificate was received from the client that sent this message, and the
62162 certificate was verified by the server.
62163 </para>
62164 </listitem></varlistentry>
62165 <varlistentry>
62166 <term><option>-tls_cipher</option>&nbsp;&lt;<emphasis>cipher name</emphasis>&gt;</term>
62167 <listitem>
62168 <para>
62169 When the message was received over an encrypted connection, this records the
62170 name of the cipher suite that was used.
62171 </para>
62172 </listitem></varlistentry>
62173 <varlistentry>
62174 <term><option>-tls_peerdn</option>&nbsp;&lt;<emphasis>peer DN</emphasis>&gt;</term>
62175 <listitem>
62176 <para>
62177 When the message was received over an encrypted connection, and a certificate
62178 was received from the client, this records the Distinguished Name from that
62179 certificate.
62180 </para>
62181 </listitem></varlistentry>
62182 </variablelist>
62183 <para>
62184 Following the options there is a list of those addresses to which the message
62185 is not to be delivered. This set of addresses is initialized from the command
62186 line when the <option>-t</option> option is used and <option>extract_addresses_remove_arguments</option>
62187 is set; otherwise it starts out empty. Whenever a successful delivery is made,
62188 the address is added to this set. The addresses are kept internally as a
62189 balanced binary tree, and it is a representation of that tree which is written
62190 to the spool file. If an address is expanded via an alias or forward file, the
62191 original address is added to the tree when deliveries to all its child
62192 addresses are complete.
62193 </para>
62194 <para>
62195 If the tree is empty, there is a single line in the spool file containing just
62196 the text <quote>XX</quote>. Otherwise, each line consists of two letters, which are either
62197 Y or N, followed by an address. The address is the value for the node of the
62198 tree, and the letters indicate whether the node has a left branch and/or a
62199 right branch attached to it, respectively. If branches exist, they immediately
62200 follow. Here is an example of a three-node tree:
62201 </para>
62202 <literallayout class="monospaced">
62203 YY darcy@austen.fict.example
62204 NN alice@wonderland.fict.example
62205 NN editor@thesaurus.ref.example
62206 </literallayout>
62207 <para>
62208 After the non-recipients tree, there is a list of the message&#x2019;s recipients.
62209 This is a simple list, preceded by a count. It includes all the original
62210 recipients of the message, including those to whom the message has already been
62211 delivered. In the simplest case, the list contains one address per line. For
62212 example:
62213 </para>
62214 <literallayout class="monospaced">
62215 4
62216 editor@thesaurus.ref.example
62217 darcy@austen.fict.example
62218 rdo@foundation
62219 alice@wonderland.fict.example
62220 </literallayout>
62221 <para>
62222 However, when a child address has been added to the top-level addresses as a
62223 result of the use of the <option>one_time</option> option on a <command>redirect</command> router, each
62224 line is of the following form:
62225 </para>
62226 <literallayout>
62227 &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;
62228 </literallayout>
62229 <para>
62230 The 01 flag bit indicates the presence of the three other fields that follow
62231 the top-level address. Other bits may be used in future to support additional
62232 fields. The &lt;<emphasis>parent number</emphasis>&gt; is the offset in the recipients list of the
62233 original parent of the <quote>one time</quote> address. The first two fields are the
62234 envelope sender that is associated with this address and its length. If the
62235 length is zero, there is no special envelope sender (there are then two space
62236 characters in the line). A non-empty field can arise from a <command>redirect</command> router
62237 that has an <option>errors_to</option> setting.
62238 </para>
62239 <para>
62240 A blank line separates the envelope and status information from the headers
62241 which follow. A header may occupy several lines of the file, and to save effort
62242 when reading it in, each header is preceded by a number and an identifying
62243 character. The number is the number of characters in the header, including any
62244 embedded newlines and the terminating newline. The character is one of the
62245 following:
62246 </para>
62247 <informaltable frame="none">
62248 <tgroup cols="2" colsep="0" rowsep="0">
62249 <colspec colwidth="50pt" align="left"/>
62250 <colspec colwidth="254pt" align="left"/>
62251 <tbody>
62252 <row>
62253 <entry>&lt;<emphasis>blank</emphasis>&gt;</entry>
62254 <entry>header in which Exim has no special interest</entry>
62255 </row>
62256 <row>
62257 <entry><literal>B</literal></entry>
62258 <entry><emphasis>Bcc:</emphasis> header</entry>
62259 </row>
62260 <row>
62261 <entry><literal>C</literal></entry>
62262 <entry><emphasis>Cc:</emphasis> header</entry>
62263 </row>
62264 <row>
62265 <entry><literal>F</literal></entry>
62266 <entry><emphasis>From:</emphasis> header</entry>
62267 </row>
62268 <row>
62269 <entry><literal>I</literal></entry>
62270 <entry><emphasis>Message-id:</emphasis> header</entry>
62271 </row>
62272 <row>
62273 <entry><literal>P</literal></entry>
62274 <entry><emphasis>Received:</emphasis> header &ndash; P for <quote>postmark</quote></entry>
62275 </row>
62276 <row>
62277 <entry><literal>R</literal></entry>
62278 <entry><emphasis>Reply-To:</emphasis> header</entry>
62279 </row>
62280 <row>
62281 <entry><literal>S</literal></entry>
62282 <entry><emphasis>Sender:</emphasis> header</entry>
62283 </row>
62284 <row>
62285 <entry><literal>T</literal></entry>
62286 <entry><emphasis>To:</emphasis> header</entry>
62287 </row>
62288 <row>
62289 <entry><literal>*</literal></entry>
62290 <entry>replaced or deleted header</entry>
62291 </row>
62292 </tbody>
62293 </tgroup>
62294 </informaltable>
62295 <para>
62296 Deleted or replaced (rewritten) headers remain in the spool file for debugging
62297 purposes. They are not transmitted when the message is delivered. Here is a
62298 typical set of headers:
62299 </para>
62300 <literallayout class="monospaced">
62301 111P Received: by hobbit.fict.example with local (Exim 4.00)
62302 id 14y9EI-00026G-00; Fri, 11 May 2001 10:28:59 +0100
62303 049  Message-Id: &lt;E14y9EI-00026G-00@hobbit.fict.example&gt;
62304 038* X-rewrote-sender: bb@hobbit.fict.example
62305 042* From: Bilbo Baggins &lt;bb@hobbit.fict.example&gt;
62306 049F From: Bilbo Baggins &lt;B.Baggins@hobbit.fict.example&gt;
62307 099* To: alice@wonderland.fict.example, rdo@foundation,
62308 darcy@austen.fict.example, editor@thesaurus.ref.example
62309 104T To: alice@wonderland.fict.example, rdo@foundation.example,
62310 darcy@austen.fict.example, editor@thesaurus.ref.example
62311 038  Date: Fri, 11 May 2001 10:28:59 +0100
62312 </literallayout>
62313 <para>
62314 The asterisked headers indicate that the envelope sender, <emphasis>From:</emphasis> header, and
62315 <emphasis>To:</emphasis> header have been rewritten, the last one because routing expanded the
62316 unqualified domain <emphasis>foundation</emphasis>.
62317 <indexterm role="concept" startref="IIDforspo1" class="endofrange"/>
62318 <indexterm role="concept" startref="IIDforspo2" class="endofrange"/>
62319 <indexterm role="concept" startref="IIDforspo3" class="endofrange"/>
62320 </para>
62321 </section>
62322 </chapter>
62323
62324 <chapter id="CHID12">
62325 <title>Support for DKIM (DomainKeys Identified Mail) - RFC4871</title>
62326 <titleabbrev>DKIM Support</titleabbrev>
62327 <para>
62328 <indexterm role="concept">
62329 <primary>DKIM</primary>
62330 </indexterm>
62331 </para>
62332 <para>
62333 Since version 4.70, DKIM support is compiled into Exim by default. It can be
62334 disabled by setting DISABLE_DKIM=yes in Local/Makefile.
62335 </para>
62336 <para revisionflag="changed">
62337 Exim&#x2019;s DKIM implementation allows to
62338 </para>
62339 <orderedlist numeration="arabic" revisionflag="changed">
62340 <listitem>
62341 <para revisionflag="changed">
62342 Sign outgoing messages: This function is implemented in the SMTP transport.
62343 It can co-exist with all other Exim features, including transport filters.
62344 </para>
62345 </listitem>
62346 <listitem>
62347 <para revisionflag="changed">
62348 Verify signatures in incoming messages: This is implemented by an additional
62349 ACL (acl_smtp_dkim), which can be called several times per message, with
62350 different signature contexts.
62351 </para>
62352 </listitem>
62353 </orderedlist>
62354 <para>
62355 In typical Exim style, the verification implementation does not include any
62356 default "policy". Instead it enables you to build your own policy using
62357 Exim&#x2019;s standard controls.
62358 </para>
62359 <para>
62360 Please note that verification of DKIM signatures in incoming mail is turned
62361 on by default for logging purposes. For each signature in incoming email,
62362 exim will log a line displaying the most important signature details, and the
62363 signature status. Here is an example:
62364 </para>
62365 <literallayout class="monospaced">
62366 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]
62367 </literallayout>
62368 <para>
62369 You might want to turn off DKIM verification processing entirely for internal
62370 or relay mail sources. To do that, set the <option>dkim_disable_verify</option> ACL
62371 control modifier. This should typically be done in the RCPT ACL, at points
62372 where you accept mail from relay sources (internal hosts or authenticated
62373 senders).
62374 </para>
62375 <section id="SECID513">
62376 <title>Signing outgoing messages</title>
62377 <para>
62378 <indexterm role="concept">
62379 <primary>DKIM</primary>
62380 <secondary>signing</secondary>
62381 </indexterm>
62382 </para>
62383 <para>
62384 Signing is implemented by setting private options on the SMTP transport.
62385 These options take (expandable) strings as arguments.
62386 </para>
62387 <para revisionflag="changed">
62388 <indexterm role="option">
62389 <primary><option>dkim_domain</option></primary>
62390 </indexterm>
62391 </para>
62392 <informaltable frame="all" revisionflag="changed">
62393 <tgroup cols="4" colsep="0" rowsep="0">
62394 <colspec colwidth="8*" align="left"/>
62395 <colspec colwidth="6*" align="center"/>
62396 <colspec colwidth="6*" align="center"/>
62397 <colspec colwidth="6*" align="right"/>
62398 <tbody>
62399 <row>
62400 <entry><option>dkim_domain</option></entry>
62401 <entry>Use: <emphasis>smtp</emphasis></entry>
62402 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
62403 <entry>Default: <emphasis>unset</emphasis></entry>
62404 </row>
62405 </tbody>
62406 </tgroup>
62407 </informaltable>
62408 <para revisionflag="changed">
62409 MANDATORY:
62410 The domain you want to sign with. The result of this expanded
62411 option is put into the <option>$dkim_domain</option> expansion variable.
62412 </para>
62413 <para revisionflag="changed">
62414 <indexterm role="option">
62415 <primary><option>dkim_selector</option></primary>
62416 </indexterm>
62417 </para>
62418 <informaltable frame="all" revisionflag="changed">
62419 <tgroup cols="4" colsep="0" rowsep="0">
62420 <colspec colwidth="8*" align="left"/>
62421 <colspec colwidth="6*" align="center"/>
62422 <colspec colwidth="6*" align="center"/>
62423 <colspec colwidth="6*" align="right"/>
62424 <tbody>
62425 <row>
62426 <entry><option>dkim_selector</option></entry>
62427 <entry>Use: <emphasis>smtp</emphasis></entry>
62428 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
62429 <entry>Default: <emphasis>unset</emphasis></entry>
62430 </row>
62431 </tbody>
62432 </tgroup>
62433 </informaltable>
62434 <para revisionflag="changed">
62435 MANDATORY:
62436 This sets the key selector string. You can use the <option>$dkim_domain</option> expansion
62437 variable to look up a matching selector. The result is put in the expansion
62438 variable <option>$dkim_selector</option> which should be used in the <option>dkim_private_key</option>
62439 option along with <option>$dkim_domain</option>.
62440 </para>
62441 <para revisionflag="changed">
62442 <indexterm role="option">
62443 <primary><option>dkim_private_key</option></primary>
62444 </indexterm>
62445 </para>
62446 <informaltable frame="all" revisionflag="changed">
62447 <tgroup cols="4" colsep="0" rowsep="0">
62448 <colspec colwidth="8*" align="left"/>
62449 <colspec colwidth="6*" align="center"/>
62450 <colspec colwidth="6*" align="center"/>
62451 <colspec colwidth="6*" align="right"/>
62452 <tbody>
62453 <row>
62454 <entry><option>dkim_private_key</option></entry>
62455 <entry>Use: <emphasis>smtp</emphasis></entry>
62456 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
62457 <entry>Default: <emphasis>unset</emphasis></entry>
62458 </row>
62459 </tbody>
62460 </tgroup>
62461 </informaltable>
62462 <para revisionflag="changed">
62463 MANDATORY:
62464 This sets the private key to use. You can use the <option>$dkim_domain</option> and
62465 <option>$dkim_selector</option> expansion variables to determine the private key to use.
62466 The result can either
62467 </para>
62468 <itemizedlist revisionflag="changed">
62469 <listitem>
62470 <para revisionflag="changed">
62471 be a valid RSA private key in ASCII armor, including line breaks.
62472 </para>
62473 </listitem>
62474 <listitem>
62475 <para revisionflag="changed">
62476 start with a slash, in which case it is treated as a file that contains
62477 the private key.
62478 </para>
62479 </listitem>
62480 <listitem>
62481 <para revisionflag="changed">
62482 be "0", "false" or the empty string, in which case the message will not
62483 be signed. This case will not result in an error, even if <option>dkim_strict</option>
62484 is set.
62485 </para>
62486 </listitem>
62487 </itemizedlist>
62488 <para revisionflag="changed">
62489 <indexterm role="option">
62490 <primary><option>dkim_canon</option></primary>
62491 </indexterm>
62492 </para>
62493 <informaltable frame="all" revisionflag="changed">
62494 <tgroup cols="4" colsep="0" rowsep="0">
62495 <colspec colwidth="8*" align="left"/>
62496 <colspec colwidth="6*" align="center"/>
62497 <colspec colwidth="6*" align="center"/>
62498 <colspec colwidth="6*" align="right"/>
62499 <tbody>
62500 <row>
62501 <entry><option>dkim_canon</option></entry>
62502 <entry>Use: <emphasis>smtp</emphasis></entry>
62503 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
62504 <entry>Default: <emphasis>unset</emphasis></entry>
62505 </row>
62506 </tbody>
62507 </tgroup>
62508 </informaltable>
62509 <para revisionflag="changed">
62510 OPTIONAL:
62511 This option sets the canonicalization method used when signing a message.
62512 The DKIM RFC currently supports two methods: "simple" and "relaxed".
62513 The option defaults to "relaxed" when unset. Note: the current implementation
62514 only supports using the same canonicalization method for both headers and body.
62515 </para>
62516 <para revisionflag="changed">
62517 <indexterm role="option">
62518 <primary><option>dkim_strict</option></primary>
62519 </indexterm>
62520 </para>
62521 <informaltable frame="all" revisionflag="changed">
62522 <tgroup cols="4" colsep="0" rowsep="0">
62523 <colspec colwidth="8*" align="left"/>
62524 <colspec colwidth="6*" align="center"/>
62525 <colspec colwidth="6*" align="center"/>
62526 <colspec colwidth="6*" align="right"/>
62527 <tbody>
62528 <row>
62529 <entry><option>dkim_strict</option></entry>
62530 <entry>Use: <emphasis>smtp</emphasis></entry>
62531 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
62532 <entry>Default: <emphasis>unset</emphasis></entry>
62533 </row>
62534 </tbody>
62535 </tgroup>
62536 </informaltable>
62537 <para revisionflag="changed">
62538 OPTIONAL:
62539 This  option  defines  how  Exim  behaves  when  signing a message that
62540 should be signed fails for some reason.  When the expansion evaluates to
62541 either "1" or "true", Exim will defer. Otherwise Exim will send the message
62542 unsigned. You can use the <option>$dkim_domain</option> and <option>$dkim_selector</option> expansion
62543 variables here.
62544 </para>
62545 <para revisionflag="changed">
62546 <indexterm role="option">
62547 <primary><option>dkim_sign_headers</option></primary>
62548 </indexterm>
62549 </para>
62550 <informaltable frame="all" revisionflag="changed">
62551 <tgroup cols="4" colsep="0" rowsep="0">
62552 <colspec colwidth="8*" align="left"/>
62553 <colspec colwidth="6*" align="center"/>
62554 <colspec colwidth="6*" align="center"/>
62555 <colspec colwidth="6*" align="right"/>
62556 <tbody>
62557 <row>
62558 <entry><option>dkim_sign_headers</option></entry>
62559 <entry>Use: <emphasis>smtp</emphasis></entry>
62560 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
62561 <entry>Default: <emphasis>unset</emphasis></entry>
62562 </row>
62563 </tbody>
62564 </tgroup>
62565 </informaltable>
62566 <para revisionflag="changed">
62567 OPTIONAL:
62568 When set, this option must expand to (or be specified as) a colon-separated
62569 list of header names. Headers with these names will be included in the message
62570 signature. When unspecified, the header names recommended in RFC4871 will be
62571 used.
62572 </para>
62573 </section>
62574 <section id="SECID514">
62575 <title>Verifying DKIM signatures in incoming mail</title>
62576 <para>
62577 <indexterm role="concept">
62578 <primary>DKIM</primary>
62579 <secondary>verification</secondary>
62580 </indexterm>
62581 </para>
62582 <para>
62583 Verification of DKIM signatures in incoming email is implemented via the
62584 <option>acl_smtp_dkim</option> ACL. By default, this ACL is called once for each
62585 syntactically(!) correct signature in the incoming message.
62586 </para>
62587 <para>
62588 To evaluate the signature in the ACL a large number of expansion variables
62589 containing the signature status and its details are set up during the
62590 runtime of the ACL.
62591 </para>
62592 <para>
62593 Calling the ACL only for existing signatures is not sufficient to build
62594 more advanced policies. For that reason, the global option
62595 <option>dkim_verify_signers</option>, and a global expansion variable
62596 <option>$dkim_signers</option> exist.
62597 </para>
62598 <para revisionflag="changed">
62599 The global option <option>dkim_verify_signers</option> can be set to a colon-separated
62600 list of DKIM domains or identities for which the ACL <option>acl_smtp_dkim</option> is
62601 called. It is expanded when the message has been received. At this point,
62602 the expansion variable <option>$dkim_signers</option> already contains a colon-separated
62603 list of signer domains and identities for the message. When
62604 <option>dkim_verify_signers</option> is not specified in the main configuration,
62605 it defaults as:
62606 </para>
62607 <literallayout class="monospaced" revisionflag="changed">
62608 dkim_verify_signers = $dkim_signers
62609 </literallayout>
62610 <para revisionflag="changed">
62611 This leads to the default behaviour of calling <option>acl_smtp_dkim</option> for each
62612 DKIM signature in the message. Current DKIM verifiers may want to explicitly
62613 call the ACL for known domains or identities. This would be achieved as follows:
62614 </para>
62615 <literallayout class="monospaced" revisionflag="changed">
62616 dkim_verify_signers = paypal.com:ebay.com:$dkim_signers
62617 </literallayout>
62618 <para revisionflag="changed">
62619 This would result in <option>acl_smtp_dkim</option> always being called for "paypal.com"
62620 and "ebay.com", plus all domains and identities that have signatures in the message.
62621 You can also be more creative in constructing your policy. For example:
62622 </para>
62623 <literallayout class="monospaced" revisionflag="changed">
62624 dkim_verify_signers = $sender_address_domain:$dkim_signers
62625 </literallayout>
62626 <para>
62627 If a domain or identity is listed several times in the (expanded) value of
62628 <option>dkim_verify_signers</option>, the ACL is only called once for that domain or identity.
62629 </para>
62630 <para>
62631 Inside the <option>acl_smtp_dkim</option>, the following expansion variables are
62632 available (from most to least important):
62633 </para>
62634 <variablelist revisionflag="changed">
62635 <varlistentry revisionflag="changed">
62636 <term><option>$dkim_cur_signer</option></term>
62637 <listitem>
62638 <para revisionflag="changed">
62639 The signer that is being evaluated in this ACL run. This can be a domain or
62640 an identity. This is one of the list items from the expanded main option
62641 <option>dkim_verify_signers</option> (see above).
62642 </para>
62643 </listitem></varlistentry>
62644 <varlistentry revisionflag="changed">
62645 <term><option>$dkim_verify_status</option></term>
62646 <listitem>
62647 <para revisionflag="changed">
62648 A string describing the general status of the signature. One of
62649 </para>
62650 <itemizedlist revisionflag="changed">
62651 <listitem>
62652 <para revisionflag="changed">
62653 <option>none</option>: There is no signature in the message for the current domain or
62654 identity (as reflected by <option>$dkim_cur_signer</option>).
62655 </para>
62656 </listitem>
62657 <listitem>
62658 <para revisionflag="changed">
62659 <option>invalid</option>: The signature could not be verified due to a processing error.
62660 More detail is available in <option>$dkim_verify_reason</option>.
62661 </para>
62662 </listitem>
62663 <listitem>
62664 <para revisionflag="changed">
62665 <option>fail</option>: Verification of the signature failed.  More detail is
62666 available in <option>$dkim_verify_reason</option>.
62667 </para>
62668 </listitem>
62669 <listitem>
62670 <para revisionflag="changed">
62671 <option>pass</option>: The signature passed verification. It is valid.
62672 </para>
62673 </listitem>
62674 </itemizedlist>
62675 </listitem></varlistentry>
62676 <varlistentry revisionflag="changed">
62677 <term><option>$dkim_verify_reason</option></term>
62678 <listitem>
62679 <para revisionflag="changed">
62680 A string giving a litte bit more detail when <option>$dkim_verify_status</option> is either
62681 "fail" or "invalid". One of
62682 </para>
62683 <itemizedlist revisionflag="changed">
62684 <listitem>
62685 <para revisionflag="changed">
62686 <option>pubkey_unavailable</option> (when <option>$dkim_verify_status</option>="invalid"): The public
62687 key for the domain could not be retrieved. This may be a temporary problem.
62688 </para>
62689 </listitem>
62690 <listitem>
62691 <para revisionflag="changed">
62692 <option>pubkey_syntax</option> (when <option>$dkim_verify_status</option>="invalid"): The public key
62693 record for the domain is syntactically invalid.
62694 </para>
62695 </listitem>
62696 <listitem>
62697 <para revisionflag="changed">
62698 <option>bodyhash_mismatch</option> (when <option>$dkim_verify_status</option>="fail"): The calculated
62699 body hash does not match the one specified in the signature header. This
62700 means that the message body was modified in transit.
62701 </para>
62702 </listitem>
62703 <listitem>
62704 <para revisionflag="changed">
62705 <option>signature_incorrect</option> (when <option>$dkim_verify_status</option>="fail"): The signature
62706 could not be verified. This may mean that headers were modified,
62707 re-written or otherwise changed in a way which is incompatible with
62708 DKIM verification. It may of course also mean that the signature is forged.
62709 </para>
62710 </listitem>
62711 </itemizedlist>
62712 </listitem></varlistentry>
62713 <varlistentry revisionflag="changed">
62714 <term><option>$dkim_domain</option></term>
62715 <listitem>
62716 <para revisionflag="changed">
62717 The signing domain. IMPORTANT: This variable is only populated if there is
62718 an actual signature in the message for the current domain or identity (as
62719 reflected by <option>$dkim_cur_signer</option>).
62720 </para>
62721 </listitem></varlistentry>
62722 <varlistentry revisionflag="changed">
62723 <term><option>$dkim_identity</option></term>
62724 <listitem>
62725 <para revisionflag="changed">
62726 The signing identity, if present. IMPORTANT: This variable is only populated
62727 if there is an actual signature in the message for the current domain or
62728 identity (as reflected by <option>$dkim_cur_signer</option>).
62729 </para>
62730 </listitem></varlistentry>
62731 <varlistentry revisionflag="changed">
62732 <term><option>$dkim_selector</option></term>
62733 <listitem>
62734 <para revisionflag="changed">
62735 The key record selector string.
62736 </para>
62737 </listitem></varlistentry>
62738 <varlistentry revisionflag="changed">
62739 <term><option>$dkim_algo</option></term>
62740 <listitem>
62741 <para revisionflag="changed">
62742 The algorithm used. One of &#x2019;rsa-sha1&#x2019; or &#x2019;rsa-sha256&#x2019;.
62743 </para>
62744 </listitem></varlistentry>
62745 <varlistentry revisionflag="changed">
62746 <term><option>$dkim_canon_body</option></term>
62747 <listitem>
62748 <para revisionflag="changed">
62749 The body canonicalization method. One of &#x2019;relaxed&#x2019; or &#x2019;simple&#x2019;.
62750 </para>
62751 </listitem></varlistentry>
62752 <varlistentry revisionflag="changed">
62753 <term><option>dkim_canon_headers</option></term>
62754 <listitem>
62755 <para revisionflag="changed">
62756 The header canonicalization method. One of &#x2019;relaxed&#x2019; or &#x2019;simple&#x2019;.
62757 </para>
62758 </listitem></varlistentry>
62759 <varlistentry revisionflag="changed">
62760 <term><option>$dkim_copiedheaders</option></term>
62761 <listitem>
62762 <para revisionflag="changed">
62763 A transcript of headers and their values which are included in the signature
62764 (copied from the &#x2019;z=&#x2019; tag of the signature).
62765 </para>
62766 </listitem></varlistentry>
62767 <varlistentry revisionflag="changed">
62768 <term><option>$dkim_bodylength</option></term>
62769 <listitem>
62770 <para revisionflag="changed">
62771 The number of signed body bytes. If zero ("0"), the body is unsigned. If no
62772 limit was set by the signer, "9999999999999" is returned. This makes sure
62773 that this variable always expands to an integer value.
62774 </para>
62775 </listitem></varlistentry>
62776 <varlistentry revisionflag="changed">
62777 <term><option>$dkim_created</option></term>
62778 <listitem>
62779 <para revisionflag="changed">
62780 UNIX timestamp reflecting the date and time when the signature was created.
62781 When this was not specified by the signer, "0" is returned.
62782 </para>
62783 </listitem></varlistentry>
62784 <varlistentry revisionflag="changed">
62785 <term><option>$dkim_expires</option></term>
62786 <listitem>
62787 <para revisionflag="changed">
62788 UNIX timestamp reflecting the date and time when the signer wants the
62789 signature to be treated as "expired". When this was not specified by the
62790 signer, "9999999999999" is returned. This makes it possible to do useful
62791 integer size comparisons against this value.
62792 </para>
62793 </listitem></varlistentry>
62794 <varlistentry revisionflag="changed">
62795 <term><option>$dkim_headernames</option></term>
62796 <listitem>
62797 <para revisionflag="changed">
62798 A colon-separated list of names of headers included in the signature.
62799 </para>
62800 </listitem></varlistentry>
62801 <varlistentry revisionflag="changed">
62802 <term><option>$dkim_key_testing</option></term>
62803 <listitem>
62804 <para revisionflag="changed">
62805 "1" if the key record has the "testing" flag set, "0" if not.
62806 </para>
62807 </listitem></varlistentry>
62808 <varlistentry revisionflag="changed">
62809 <term><option>$dkim_key_nosubdomaining</option></term>
62810 <listitem>
62811 <para revisionflag="changed">
62812 "1" if the key record forbids subdomaining, "0" otherwise.
62813 </para>
62814 </listitem></varlistentry>
62815 <varlistentry revisionflag="changed">
62816 <term><option>$dkim_key_srvtype</option></term>
62817 <listitem>
62818 <para revisionflag="changed">
62819 Service type (tag s=) from the key record. Defaults to "*" if not specified
62820 in the key record.
62821 </para>
62822 </listitem></varlistentry>
62823 <varlistentry revisionflag="changed">
62824 <term><option>$dkim_key_granularity</option></term>
62825 <listitem>
62826 <para revisionflag="changed">
62827 Key granularity (tag g=) from the key record. Defaults to "*" if not specified
62828 in the key record.
62829 </para>
62830 </listitem></varlistentry>
62831 <varlistentry revisionflag="changed">
62832 <term><option>$dkim_key_notes</option></term>
62833 <listitem>
62834 <para revisionflag="changed">
62835 Notes from the key record (tag n=).
62836 </para>
62837 </listitem></varlistentry>
62838 </variablelist>
62839 <para>
62840 In addition, two ACL conditions are provided:
62841 </para>
62842 <variablelist revisionflag="changed">
62843 <varlistentry revisionflag="changed">
62844 <term><option>dkim_signers</option></term>
62845 <listitem>
62846 <para revisionflag="changed">
62847 ACL condition that checks a colon-separated list of domains or identities
62848 for a match against the domain or identity that the ACL is currently verifying
62849 (reflected by <option>$dkim_cur_signer</option>). This is typically used to restrict an ACL
62850 verb to a group of domains or identities. For example:
62851 </para>
62852 <literallayout class="monospaced">
62853 # Warn when message apparently from GMail has no signature at all
62854 warn log_message = GMail sender without DKIM signature
62855      sender_domains = gmail.com
62856      dkim_signers = gmail.com
62857      dkim_status = none
62858 </literallayout>
62859 </listitem></varlistentry>
62860 <varlistentry>
62861 <term><option>dkim_status</option></term>
62862 <listitem>
62863 <para>
62864 ACL condition that checks a colon-separated list of possible DKIM verification
62865 results agains the actual result of verification. This is typically used
62866 to restrict an ACL verb to a list of verification outcomes, like:
62867 </para>
62868 <literallayout class="monospaced">
62869 deny message = Message from Paypal with invalid or missing signature
62870      sender_domains = paypal.com:paypal.de
62871      dkim_signers = paypal.com:paypal.de
62872      dkim_status = none:invalid:fail
62873 </literallayout>
62874 <para>
62875 The possible status keywords are: &#x2019;none&#x2019;,&#x2019;invalid&#x2019;,&#x2019;fail&#x2019; and &#x2019;pass&#x2019;. Please
62876 see the documentation of the <option>$dkim_verify_status</option> expansion variable above
62877 for more information of what they mean.
62878 </para>
62879 </listitem></varlistentry>
62880 </variablelist>
62881 </section>
62882 </chapter>
62883
62884 <chapter id="CHID13">
62885 <title>Adding new drivers or lookup types</title>
62886 <titleabbrev>Adding drivers or lookups</titleabbrev>
62887 <para>
62888 <indexterm role="concept">
62889 <primary>adding drivers</primary>
62890 </indexterm>
62891 <indexterm role="concept">
62892 <primary>new drivers, adding</primary>
62893 </indexterm>
62894 <indexterm role="concept">
62895 <primary>drivers</primary>
62896 <secondary>adding new</secondary>
62897 </indexterm>
62898 The following actions have to be taken in order to add a new router, transport,
62899 authenticator, or lookup type to Exim:
62900 </para>
62901 <orderedlist numeration="arabic">
62902 <listitem>
62903 <para>
62904 Choose a name for the driver or lookup type that does not conflict with any
62905 existing name; I will use <quote>newdriver</quote> in what follows.
62906 </para>
62907 </listitem>
62908 <listitem>
62909 <para>
62910 Add to <filename>src/EDITME</filename> the line:
62911 </para>
62912 <literallayout>
62913 &lt;<emphasis>type</emphasis>&gt;<literal>_NEWDRIVER=yes</literal>
62914 </literallayout>
62915 <para>
62916 where &lt;<emphasis>type</emphasis>&gt; is ROUTER, TRANSPORT, AUTH, or LOOKUP. If the
62917 code is not to be included in the binary by default, comment this line out. You
62918 should also add any relevant comments about the driver or lookup type.
62919 </para>
62920 </listitem>
62921 <listitem>
62922 <para>
62923 Add to <filename>src/config.h.defaults</filename> the line:
62924 </para>
62925 <literallayout class="monospaced">
62926 #define &lt;type&gt;_NEWDRIVER
62927 </literallayout>
62928 </listitem>
62929 <listitem>
62930 <para>
62931 Edit <filename>src/drtables.c</filename>, adding conditional code to pull in the private header
62932 and create a table entry as is done for all the other drivers and lookup types.
62933 </para>
62934 </listitem>
62935 <listitem>
62936 <para>
62937 Edit <filename>Makefile</filename> in the appropriate sub-directory (<filename>src/routers</filename>,
62938 <filename>src/transports</filename>, <filename>src/auths</filename>, or <filename>src/lookups</filename>); add a line for the new
62939 driver or lookup type and add it to the definition of OBJ.
62940 </para>
62941 </listitem>
62942 <listitem>
62943 <para>
62944 Create <filename>newdriver.h</filename> and <filename>newdriver.c</filename> in the appropriate sub-directory of
62945 <filename>src</filename>.
62946 </para>
62947 </listitem>
62948 <listitem>
62949 <para>
62950 Edit <filename>scripts/MakeLinks</filename> and add commands to link the <filename>.h</filename> and <filename>.c</filename> files
62951 as for other drivers and lookups.
62952 </para>
62953 </listitem>
62954 </orderedlist>
62955 <para>
62956 Then all you need to do is write the code! A good way to start is to make a
62957 proforma by copying an existing module of the same type, globally changing all
62958 occurrences of the name, and cutting out most of the code. Note that any
62959 options you create must be listed in alphabetical order, because the tables are
62960 searched using a binary chop procedure.
62961 </para>
62962 <para>
62963 There is a <filename>README</filename> file in each of the sub-directories of <filename>src</filename> describing
62964 the interface that is expected.
62965 </para>
62966 <?sdop
62967   format="newpage"
62968   foot_right_recto="&chaptertitle;"
62969   foot_right_verso="&chaptertitle;"
62970 ?>
62971 </chapter>
62972
62973 <index role="option">
62974 <title>Options index</title>
62975 </index>
62976
62977 <index role="variable">
62978 <title>Variables index</title>
62979 </index>
62980
62981 <index role="concept">
62982 <title>Concept index</title>
62983 </index>
62984
62985 </book>