Exim 4.90 release
[exim-website.git] / docbook / 4.77 / 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>06 May 2011</date>
16 <author><firstname>Exim</firstname><surname>Maintainers</surname></author>
17 <authorinitials>EM</authorinitials>
18 <revhistory><revision>
19   <revnumber>4.77</revnumber>
20   <date>10 Oct 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.77 of Exim.
202 Substantive changes from the 4.75 edition are marked in some
203 renditions of the document; this paragraph is so marked if the rendition is
204 capable of showing a change indicator.
205 </para>
206 <para>
207 This document is very much a reference manual; it is not a tutorial. The reader
208 is expected to have some familiarity with the SMTP mail transfer protocol and
209 with general Unix system administration. Although there are some discussions
210 and examples in places, the information is mostly organized in a way that makes
211 it easy to look up, rather than in a natural order for sequential reading.
212 Furthermore, the manual aims to cover every aspect of Exim in detail, including
213 a number of rarely-used, special-purpose features that are unlikely to be of
214 very wide interest.
215 </para>
216 <para>
217 <indexterm role="concept">
218 <primary>books about Exim</primary>
219 </indexterm>
220 An <quote>easier</quote> discussion of Exim which provides more in-depth explanatory,
221 introductory, and tutorial material can be found in a book entitled <emphasis>The Exim
222 SMTP Mail Server</emphasis> (second edition, 2007), published by UIT Cambridge
223 (<emphasis role="bold"><ulink url="http://www.uit.co.uk/exim-book/">http://www.uit.co.uk/exim-book/</ulink></emphasis>).
224 </para>
225 <para>
226 This book also contains a chapter that gives a general introduction to SMTP and
227 Internet mail. Inevitably, however, the book is unlikely to be fully up-to-date
228 with the latest release of Exim. (Note that the earlier book about Exim,
229 published by O&#x2019;Reilly, covers Exim 3, and many things have changed in Exim 4.)
230 </para>
231 <para>
232 <indexterm role="concept">
233 <primary>Debian</primary>
234 <secondary>information sources</secondary>
235 </indexterm>
236 If you are using a Debian distribution of Exim, you will find information about
237 Debian-specific features in the file
238 <filename>/usr/share/doc/exim4-base/README.Debian</filename>.
239 The command <command>man update-exim.conf</command> is another source of Debian-specific
240 information.
241 </para>
242 <para>
243 <indexterm role="concept">
244 <primary><filename>doc/NewStuff</filename></primary>
245 </indexterm>
246 <indexterm role="concept">
247 <primary><filename>doc/ChangeLog</filename></primary>
248 </indexterm>
249 <indexterm role="concept">
250 <primary>change log</primary>
251 </indexterm>
252 As the program develops, there may be features in newer versions that have not
253 yet made it into this document, which is updated only when the most significant
254 digit of the fractional part of the version number changes. Specifications of
255 new features that are not yet in this manual are placed in the file
256 <filename>doc/NewStuff</filename> in the Exim distribution.
257 </para>
258 <para>
259 Some features may be classified as <quote>experimental</quote>. These may change
260 incompatibly while they are developing, or even be withdrawn. For this reason,
261 they are not documented in this manual. Information about experimental features
262 can be found in the file <filename>doc/experimental.txt</filename>.
263 </para>
264 <para>
265 All changes to the program (whether new features, bug fixes, or other kinds of
266 change) are noted briefly in the file called <filename>doc/ChangeLog</filename>.
267 </para>
268 <para>
269 <indexterm role="concept">
270 <primary><filename>doc/spec.txt</filename></primary>
271 </indexterm>
272 This specification itself is available as an ASCII file in <filename>doc/spec.txt</filename> so
273 that it can easily be searched with a text editor. Other files in the <filename>doc</filename>
274 directory are:
275 </para>
276 <informaltable frame="none">
277 <tgroup cols="2" colsep="0" rowsep="0">
278 <colspec colwidth="100pt" align="left"/>
279 <colspec colwidth="254pt" align="left"/>
280 <tbody>
281 <row>
282 <entry><filename>OptionLists.txt</filename></entry>
283 <entry>list of all options in alphabetical order</entry>
284 </row>
285 <row>
286 <entry><filename>dbm.discuss.txt</filename></entry>
287 <entry>discussion about DBM libraries</entry>
288 </row>
289 <row>
290 <entry><filename>exim.8</filename></entry>
291 <entry>a man page of Exim&#x2019;s command line options</entry>
292 </row>
293 <row>
294 <entry><filename>experimental.txt</filename></entry>
295 <entry>documentation of experimental features</entry>
296 </row>
297 <row>
298 <entry><filename>filter.txt</filename></entry>
299 <entry>specification of the filter language</entry>
300 </row>
301 <row>
302 <entry><filename>Exim3.upgrade</filename></entry>
303 <entry>upgrade notes from release 2 to release 3</entry>
304 </row>
305 <row>
306 <entry><filename>Exim4.upgrade</filename></entry>
307 <entry>upgrade notes from release 3 to release 4</entry>
308 </row>
309 </tbody>
310 </tgroup>
311 </informaltable>
312 <para>
313 The main specification and the specification of the filtering language are also
314 available in other formats (HTML, PostScript, PDF, and Texinfo). Section
315 <xref linkend="SECTavail"/> below tells you how to get hold of these.
316 </para>
317 </section>
318 <section id="SECID2">
319 <title>FTP and web sites</title>
320 <para>
321 <indexterm role="concept">
322 <primary>web site</primary>
323 </indexterm>
324 <indexterm role="concept">
325 <primary>FTP site</primary>
326 </indexterm>
327 The primary site for Exim source distributions is currently the University of
328 Cambridge&#x2019;s FTP site, whose contents are described in <emphasis>Where to find the Exim
329 distribution</emphasis> below. In addition, there is a web site and an FTP site at
330 <option>exim.org</option>. These are now also hosted at the University of Cambridge. The
331 <option>exim.org</option> site was previously hosted for a number of years by Energis
332 Squared, formerly Planet Online Ltd, whose support I gratefully acknowledge.
333 </para>
334 <para>
335 <indexterm role="concept">
336 <primary>wiki</primary>
337 </indexterm>
338 <indexterm role="concept">
339 <primary>FAQ</primary>
340 </indexterm>
341 As well as Exim distribution tar files, the Exim web site contains a number of
342 differently formatted versions of the documentation. A recent addition to the
343 online information is the Exim wiki (<emphasis role="bold"><ulink url="http://wiki.exim.org">http://wiki.exim.org</ulink></emphasis>),
344 which contains what used to be a separate FAQ, as well as various other
345 examples, tips, and know-how that have been contributed by Exim users.
346 </para>
347 <para>
348 <indexterm role="concept">
349 <primary>Bugzilla</primary>
350 </indexterm>
351 An Exim Bugzilla exists at <emphasis role="bold"><ulink url="http://bugs.exim.org">http://bugs.exim.org</ulink></emphasis>. You can use
352 this to report bugs, and also to add items to the wish list. Please search
353 first to check that you are not duplicating a previous entry.
354 </para>
355 </section>
356 <section id="SECID3">
357 <title>Mailing lists</title>
358 <para>
359 <indexterm role="concept">
360 <primary>mailing lists</primary>
361 <secondary>for Exim users</secondary>
362 </indexterm>
363 The following Exim mailing lists exist:
364 </para>
365 <informaltable frame="none">
366 <tgroup cols="2" colsep="0" rowsep="0">
367 <colspec colwidth="140pt" align="left"/>
368 <colspec colwidth="254pt" align="left"/>
369 <tbody>
370 <row>
371 <entry><emphasis>exim-announce@exim.org</emphasis></entry>
372 <entry>Moderated, low volume announcements list</entry>
373 </row>
374 <row>
375 <entry><emphasis>exim-users@exim.org</emphasis></entry>
376 <entry>General discussion list</entry>
377 </row>
378 <row>
379 <entry><emphasis>exim-dev@exim.org</emphasis></entry>
380 <entry>Discussion of bugs, enhancements, etc.</entry>
381 </row>
382 <row>
383 <entry><emphasis>exim-cvs@exim.org</emphasis></entry>
384 <entry>Automated commit messages from the VCS</entry>
385 </row>
386 </tbody>
387 </tgroup>
388 </informaltable>
389 <para>
390 You can subscribe to these lists, change your existing subscriptions, and view
391 or search the archives via the mailing lists link on the Exim home page.
392 <indexterm role="concept">
393 <primary>Debian</primary>
394 <secondary>mailing list for</secondary>
395 </indexterm>
396 If you are using a Debian distribution of Exim, you may wish to subscribe to
397 the Debian-specific mailing list <emphasis>pkg-exim4-users@lists.alioth.debian.org</emphasis>
398 via this web page:
399 </para>
400 <literallayout>
401 <emphasis role="bold"><ulink url="http://lists.alioth.debian.org/mailman/listinfo/pkg-exim4-users">http://lists.alioth.debian.org/mailman/listinfo/pkg-exim4-users</ulink></emphasis>
402 </literallayout>
403 <para>
404 Please ask Debian-specific questions on this list and not on the general Exim
405 lists.
406 </para>
407 </section>
408 <section id="SECID4">
409 <title>Exim training</title>
410 <para>
411 <indexterm role="concept">
412 <primary>training courses</primary>
413 </indexterm>
414 Training courses in Cambridge (UK) used to be run annually by the author of
415 Exim, before he retired. At the time of writing, there are no plans to run
416 further Exim courses in Cambridge. However, if that changes, relevant
417 information will be posted at <emphasis role="bold"><ulink url="http://www-tus.csx.cam.ac.uk/courses/exim/">http://www-tus.csx.cam.ac.uk/courses/exim/</ulink></emphasis>.
418 </para>
419 </section>
420 <section id="SECID5">
421 <title>Bug reports</title>
422 <para>
423 <indexterm role="concept">
424 <primary>bug reports</primary>
425 </indexterm>
426 <indexterm role="concept">
427 <primary>reporting bugs</primary>
428 </indexterm>
429 Reports of obvious bugs can be emailed to <emphasis>bugs@exim.org</emphasis> or reported
430 via the Bugzilla (<emphasis role="bold"><ulink url="http://bugs.exim.org">http://bugs.exim.org</ulink></emphasis>). However, if you are unsure
431 whether some behaviour is a bug or not, the best thing to do is to post a
432 message to the <emphasis>exim-dev</emphasis> mailing list and have it discussed.
433 </para>
434 </section>
435 <section id="SECTavail">
436 <title>Where to find the Exim distribution</title>
437 <para>
438 <indexterm role="concept">
439 <primary>FTP site</primary>
440 </indexterm>
441 <indexterm role="concept">
442 <primary>distribution</primary>
443 <secondary>ftp site</secondary>
444 </indexterm>
445 The master ftp site for the Exim distribution is
446 </para>
447 <literallayout>
448 <emphasis role="bold">ftp://ftp.csx.cam.ac.uk/pub/software/email/exim</emphasis>
449 </literallayout>
450 <para>
451 This is mirrored by
452 </para>
453 <literallayout>
454 <emphasis role="bold">ftp://ftp.exim.org/pub/exim</emphasis>
455 </literallayout>
456 <para>
457 The file references that follow are relative to the <filename>exim</filename> directories at
458 these sites. There are now quite a number of independent mirror sites around
459 the world. Those that I know about are listed in the file called <filename>Mirrors</filename>.
460 </para>
461 <para>
462 Within the <filename>exim</filename> directory there are subdirectories called <filename>exim3</filename> (for
463 previous Exim 3 distributions), <filename>exim4</filename> (for the latest Exim 4
464 distributions), and <filename>Testing</filename> for testing versions. In the <filename>exim4</filename>
465 subdirectory, the current release can always be found in files called
466 </para>
467 <literallayout>
468 <filename>exim-n.nn.tar.gz</filename>
469 <filename>exim-n.nn.tar.bz2</filename>
470 </literallayout>
471 <para>
472 where <emphasis>n.nn</emphasis> is the highest such version number in the directory. The two
473 files contain identical data; the only difference is the type of compression.
474 The <filename>.bz2</filename> file is usually a lot smaller than the <filename>.gz</filename> file.
475 </para>
476 <para>
477 <indexterm role="concept">
478 <primary>distribution</primary>
479 <secondary>signing details</secondary>
480 </indexterm>
481 <indexterm role="concept">
482 <primary>distribution</primary>
483 <secondary>public key</secondary>
484 </indexterm>
485 <indexterm role="concept">
486 <primary>public key for signed distribution</primary>
487 </indexterm>
488 The distributions are currently signed with Nigel Metheringham&#x2019;s GPG key. The
489 corresponding public key is available from a number of keyservers, and there is
490 also a copy in the file <filename>nigel-pubkey.asc</filename>. The signatures for the tar bundles are
491 in:
492 </para>
493 <literallayout>
494 <filename>exim-n.nn.tar.gz.asc</filename>
495 <filename>exim-n.nn.tar.bz2.asc</filename>
496 </literallayout>
497 <para>
498 For each released version, the log of changes is made separately available in a
499 separate file in the directory <filename>ChangeLogs</filename> so that it is possible to
500 find out what has changed without having to download the entire distribution.
501 </para>
502 <para>
503 <indexterm role="concept">
504 <primary>documentation</primary>
505 <secondary>available formats</secondary>
506 </indexterm>
507 The main distribution contains ASCII versions of this specification and other
508 documentation; other formats of the documents are available in separate files
509 inside the <filename>exim4</filename> directory of the FTP site:
510 </para>
511 <literallayout>
512 <filename>exim-html-n.nn.tar.gz</filename>
513 <filename>exim-pdf-n.nn.tar.gz</filename>
514 <filename>exim-postscript-n.nn.tar.gz</filename>
515 <filename>exim-texinfo-n.nn.tar.gz</filename>
516 </literallayout>
517 <para>
518 These tar files contain only the <filename>doc</filename> directory, not the complete
519 distribution, and are also available in <filename>.bz2</filename> as well as <filename>.gz</filename> forms.
520 </para>
521 </section>
522 <section id="SECID6">
523 <title>Limitations</title>
524 <itemizedlist>
525 <listitem>
526 <para>
527 <indexterm role="concept">
528 <primary>limitations of Exim</primary>
529 </indexterm>
530 <indexterm role="concept">
531 <primary>bang paths</primary>
532 <secondary>not handled by Exim</secondary>
533 </indexterm>
534 Exim is designed for use as an Internet MTA, and therefore handles addresses in
535 RFC 2822 domain format only. It cannot handle UUCP <quote>bang paths</quote>, though
536 simple two-component bang paths can be converted by a straightforward rewriting
537 configuration. This restriction does not prevent Exim from being interfaced to
538 UUCP as a transport mechanism, provided that domain addresses are used.
539 </para>
540 </listitem>
541 <listitem>
542 <para>
543 <indexterm role="concept">
544 <primary>domainless addresses</primary>
545 </indexterm>
546 <indexterm role="concept">
547 <primary>address</primary>
548 <secondary>without domain</secondary>
549 </indexterm>
550 Exim insists that every address it handles has a domain attached. For incoming
551 local messages, domainless addresses are automatically qualified with a
552 configured domain value. Configuration options specify from which remote
553 systems unqualified addresses are acceptable. These are then qualified on
554 arrival.
555 </para>
556 </listitem>
557 <listitem>
558 <para>
559 <indexterm role="concept">
560 <primary>transport</primary>
561 <secondary>external</secondary>
562 </indexterm>
563 <indexterm role="concept">
564 <primary>external transports</primary>
565 </indexterm>
566 The only external transport mechanisms that are currently implemented are SMTP
567 and LMTP over a TCP/IP network (including support for IPv6). However, a pipe
568 transport is available, and there are facilities for writing messages to files
569 and pipes, optionally in <emphasis>batched SMTP</emphasis> format; these facilities can be used
570 to send messages to other transport mechanisms such as UUCP, provided they can
571 handle domain-style addresses. Batched SMTP input is also catered for.
572 </para>
573 </listitem>
574 <listitem>
575 <para>
576 Exim is not designed for storing mail for dial-in hosts. When the volumes of
577 such mail are large, it is better to get the messages <quote>delivered</quote> into files
578 (that is, off Exim&#x2019;s queue) and subsequently passed on to the dial-in hosts by
579 other means.
580 </para>
581 </listitem>
582 <listitem>
583 <para>
584 Although Exim does have basic facilities for scanning incoming messages, these
585 are not comprehensive enough to do full virus or spam scanning. Such operations
586 are best carried out using additional specialized software packages. If you
587 compile Exim with the content-scanning extension, straightforward interfaces to
588 a number of common scanners are provided.
589 </para>
590 </listitem>
591 </itemizedlist>
592 </section>
593 <section id="SECID7">
594 <title>Run time configuration</title>
595 <para>
596 Exim&#x2019;s run time configuration is held in a single text file that is divided
597 into a number of sections. The entries in this file consist of keywords and
598 values, in the style of Smail 3 configuration files. A default configuration
599 file which is suitable for simple online installations is provided in the
600 distribution, and is described in chapter <xref linkend="CHAPdefconfil"/> below.
601 </para>
602 </section>
603 <section id="SECID8">
604 <title>Calling interface</title>
605 <para>
606 <indexterm role="concept">
607 <primary>Sendmail compatibility</primary>
608 <secondary>command line interface</secondary>
609 </indexterm>
610 Like many MTAs, Exim has adopted the Sendmail command line interface so that it
611 can be a straight replacement for <filename>/usr/lib/sendmail</filename> or
612 <filename>/usr/sbin/sendmail</filename> when sending mail, but you do not need to know anything
613 about Sendmail in order to run Exim. For actions other than sending messages,
614 Sendmail-compatible options also exist, but those that produce output (for
615 example, <option>-bp</option>, which lists the messages on the queue) do so in Exim&#x2019;s own
616 format. There are also some additional options that are compatible with Smail
617 3, and some further options that are new to Exim. Chapter <xref linkend="CHAPcommandline"/>
618 documents all Exim&#x2019;s command line options. This information is automatically
619 made into the man page that forms part of the Exim distribution.
620 </para>
621 <para>
622 Control of messages on the queue can be done via certain privileged command
623 line options. There is also an optional monitor program called <emphasis>eximon</emphasis>,
624 which displays current information in an X window, and which contains a menu
625 interface to Exim&#x2019;s command line administration options.
626 </para>
627 </section>
628 <section id="SECID9">
629 <title>Terminology</title>
630 <para>
631 <indexterm role="concept">
632 <primary>terminology definitions</primary>
633 </indexterm>
634 <indexterm role="concept">
635 <primary>body of message</primary>
636 <secondary>definition of</secondary>
637 </indexterm>
638 The <emphasis>body</emphasis> of a message is the actual data that the sender wants to transmit.
639 It is the last part of a message, and is separated from the <emphasis>header</emphasis> (see
640 below) by a blank line.
641 </para>
642 <para>
643 <indexterm role="concept">
644 <primary>bounce message</primary>
645 <secondary>definition of</secondary>
646 </indexterm>
647 When a message cannot be delivered, it is normally returned to the sender in a
648 delivery failure message or a <quote>non-delivery report</quote> (NDR). The term
649 <emphasis>bounce</emphasis> is commonly used for this action, and the error reports are often
650 called <emphasis>bounce messages</emphasis>. This is a convenient shorthand for <quote>delivery
651 failure error report</quote>. Such messages have an empty sender address in the
652 message&#x2019;s <emphasis>envelope</emphasis> (see below) to ensure that they cannot themselves give
653 rise to further bounce messages.
654 </para>
655 <para>
656 The term <emphasis>default</emphasis> appears frequently in this manual. It is used to qualify a
657 value which is used in the absence of any setting in the configuration. It may
658 also qualify an action which is taken unless a configuration setting specifies
659 otherwise.
660 </para>
661 <para>
662 The term <emphasis>defer</emphasis> is used when the delivery of a message to a specific
663 destination cannot immediately take place for some reason (a remote host may be
664 down, or a user&#x2019;s local mailbox may be full). Such deliveries are <emphasis>deferred</emphasis>
665 until a later time.
666 </para>
667 <para>
668 The word <emphasis>domain</emphasis> is sometimes used to mean all but the first component of a
669 host&#x2019;s name. It is <emphasis>not</emphasis> used in that sense here, where it normally refers to
670 the part of an email address following the @ sign.
671 </para>
672 <para>
673 <indexterm role="concept">
674 <primary>envelope, definition of</primary>
675 </indexterm>
676 <indexterm role="concept">
677 <primary>sender</primary>
678 <secondary>definition of</secondary>
679 </indexterm>
680 A message in transit has an associated <emphasis>envelope</emphasis>, as well as a header and a
681 body. The envelope contains a sender address (to which bounce messages should
682 be delivered), and any number of recipient addresses. References to the
683 sender or the recipients of a message usually mean the addresses in the
684 envelope. An MTA uses these addresses for delivery, and for returning bounce
685 messages, not the addresses that appear in the header lines.
686 </para>
687 <para>
688 <indexterm role="concept">
689 <primary>message</primary>
690 <secondary>header, definition of</secondary>
691 </indexterm>
692 <indexterm role="concept">
693 <primary>header section</primary>
694 <secondary>definition of</secondary>
695 </indexterm>
696 The <emphasis>header</emphasis> of a message is the first part of a message&#x2019;s text, consisting
697 of a number of lines, each of which has a name such as <emphasis>From:</emphasis>, <emphasis>To:</emphasis>,
698 <emphasis>Subject:</emphasis>, etc. Long header lines can be split over several text lines by
699 indenting the continuations. The header is separated from the body by a blank
700 line.
701 </para>
702 <para>
703 <indexterm role="concept">
704 <primary>local part</primary>
705 <secondary>definition of</secondary>
706 </indexterm>
707 <indexterm role="concept">
708 <primary>domain</primary>
709 <secondary>definition of</secondary>
710 </indexterm>
711 The term <emphasis>local part</emphasis>, which is taken from RFC 2822, is used to refer to that
712 part of an email address that precedes the @ sign. The part that follows the
713 @ sign is called the <emphasis>domain</emphasis> or <emphasis>mail domain</emphasis>.
714 </para>
715 <para>
716 <indexterm role="concept">
717 <primary>local delivery</primary>
718 <secondary>definition of</secondary>
719 </indexterm>
720 <indexterm role="concept">
721 <primary>remote delivery, definition of</primary>
722 </indexterm>
723 The terms <emphasis>local delivery</emphasis> and <emphasis>remote delivery</emphasis> are used to distinguish
724 delivery to a file or a pipe on the local host from delivery by SMTP over
725 TCP/IP to another host. As far as Exim is concerned, all hosts other than the
726 host it is running on are <emphasis>remote</emphasis>.
727 </para>
728 <para>
729 <indexterm role="concept">
730 <primary>return path</primary>
731 <secondary>definition of</secondary>
732 </indexterm>
733 <emphasis>Return path</emphasis> is another name that is used for the sender address in a
734 message&#x2019;s envelope.
735 </para>
736 <para>
737 <indexterm role="concept">
738 <primary>queue</primary>
739 <secondary>definition of</secondary>
740 </indexterm>
741 The term <emphasis>queue</emphasis> is used to refer to the set of messages awaiting delivery,
742 because this term is in widespread use in the context of MTAs. However, in
743 Exim&#x2019;s case the reality is more like a pool than a queue, because there is
744 normally no ordering of waiting messages.
745 </para>
746 <para>
747 <indexterm role="concept">
748 <primary>queue runner</primary>
749 <secondary>definition of</secondary>
750 </indexterm>
751 The term <emphasis>queue runner</emphasis> is used to describe a process that scans the queue
752 and attempts to deliver those messages whose retry times have come. This term
753 is used by other MTAs, and also relates to the command <option>runq</option>, but in Exim
754 the waiting messages are normally processed in an unpredictable order.
755 </para>
756 <para>
757 <indexterm role="concept">
758 <primary>spool directory</primary>
759 <secondary>definition of</secondary>
760 </indexterm>
761 The term <emphasis>spool directory</emphasis> is used for a directory in which Exim keeps the
762 messages on its queue &ndash; that is, those that it is in the process of
763 delivering. This should not be confused with the directory in which local
764 mailboxes are stored, which is called a <quote>spool directory</quote> by some people. In
765 the Exim documentation, <quote>spool</quote> is always used in the first sense.
766 </para>
767 </section>
768 </chapter>
769
770 <chapter id="CHID2">
771 <title>Incorporated code</title>
772 <para>
773 <indexterm role="concept">
774 <primary>incorporated code</primary>
775 </indexterm>
776 <indexterm role="concept">
777 <primary>regular expressions</primary>
778 <secondary>library</secondary>
779 </indexterm>
780 <indexterm role="concept">
781 <primary>PCRE</primary>
782 </indexterm>
783 A number of pieces of external code are included in the Exim distribution.
784 </para>
785 <itemizedlist>
786 <listitem>
787 <para>
788 Regular expressions are supported in the main Exim program and in the
789 Exim monitor using the freely-distributable PCRE library, copyright
790 &copy; University of Cambridge. The source to PCRE is no longer shipped with
791 Exim, so you will need to use the version of PCRE shipped with your system,
792 or obtain and install the full version of the library from
793 <emphasis role="bold"><ulink url="ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre">ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre</ulink></emphasis>.
794 </para>
795 </listitem>
796 <listitem>
797 <para>
798 <indexterm role="concept">
799 <primary>cdb</primary>
800 <secondary>acknowledgment</secondary>
801 </indexterm>
802 Support for the cdb (Constant DataBase) lookup method is provided by code
803 contributed by Nigel Metheringham of (at the time he contributed it) Planet
804 Online Ltd. The implementation is completely contained within the code of Exim.
805 It does not link against an external cdb library. The code contains the
806 following statements:
807 </para>
808 <blockquote>
809 <para>
810 Copyright &copy; 1998 Nigel Metheringham, Planet Online Ltd
811 </para>
812 <para>
813 This program is free software; you can redistribute it and/or modify it under
814 the terms of the GNU General Public License as published by the Free Software
815 Foundation; either version 2 of the License, or (at your option) any later
816 version.
817 This code implements Dan Bernstein&#x2019;s Constant DataBase (cdb) spec. Information,
818 the spec and sample code for cdb can be obtained from
819 <emphasis role="bold"><ulink url="http://www.pobox.com/~djb/cdb.html">http://www.pobox.com/~djb/cdb.html</ulink></emphasis>. This implementation borrows
820 some code from Dan Bernstein&#x2019;s implementation (which has no license
821 restrictions applied to it).
822 </para>
823 </blockquote>
824 </listitem>
825 <listitem>
826 <para>
827 <indexterm role="concept">
828 <primary>SPA authentication</primary>
829 </indexterm>
830 <indexterm role="concept">
831 <primary>Samba project</primary>
832 </indexterm>
833 <indexterm role="concept">
834 <primary>Microsoft Secure Password Authentication</primary>
835 </indexterm>
836 Client support for Microsoft&#x2019;s <emphasis>Secure Password Authentication</emphasis> is provided
837 by code contributed by Marc Prud&#x2019;hommeaux. Server support was contributed by
838 Tom Kistner. This includes code taken from the Samba project, which is released
839 under the Gnu GPL.
840 </para>
841 </listitem>
842 <listitem>
843 <para>
844 <indexterm role="concept">
845 <primary>Cyrus</primary>
846 </indexterm>
847 <indexterm role="concept">
848 <primary><emphasis>pwcheck</emphasis> daemon</primary>
849 </indexterm>
850 <indexterm role="concept">
851 <primary><emphasis>pwauthd</emphasis> daemon</primary>
852 </indexterm>
853 Support for calling the Cyrus <emphasis>pwcheck</emphasis> and <emphasis>saslauthd</emphasis> daemons is provided
854 by code taken from the Cyrus-SASL library and adapted by Alexander S.
855 Sabourenkov. The permission notice appears below, in accordance with the
856 conditions expressed therein.
857 </para>
858 <blockquote>
859 <para>
860 Copyright &copy; 2001 Carnegie Mellon University.  All rights reserved.
861 </para>
862 <para>
863 Redistribution and use in source and binary forms, with or without
864 modification, are permitted provided that the following conditions
865 are met:
866 </para>
867 <orderedlist numeration="arabic">
868 <listitem>
869 <para>
870 Redistributions of source code must retain the above copyright
871 notice, this list of conditions and the following disclaimer.
872 </para>
873 </listitem>
874 <listitem>
875 <para>
876 Redistributions in binary form must reproduce the above copyright
877 notice, this list of conditions and the following disclaimer in
878 the documentation and/or other materials provided with the
879 distribution.
880 </para>
881 </listitem>
882 <listitem>
883 <para>
884 The name <quote>Carnegie Mellon University</quote> must not be used to
885 endorse or promote products derived from this software without
886 prior written permission. For permission or any other legal
887 details, please contact
888 </para>
889 <literallayout>
890               Office of Technology Transfer
891               Carnegie Mellon University
892               5000 Forbes Avenue
893               Pittsburgh, PA  15213-3890
894               (412) 268-4387, fax: (412) 268-7395
895               tech-transfer@andrew.cmu.edu
896 </literallayout>
897 </listitem>
898 <listitem>
899 <para>
900 Redistributions of any form whatsoever must retain the following
901 acknowledgment:
902 </para>
903 <para>
904 <quote>This product includes software developed by Computing Services
905 at Carnegie Mellon University (<emphasis role="bold"><ulink url="http://www.cmu.edu/computing/">http://www.cmu.edu/computing/</ulink></emphasis>.</quote>
906 </para>
907 <para>
908 CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
909 THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
910 AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
911 FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
912 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
913 AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
914 OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
915 </para>
916 </listitem>
917 </orderedlist>
918 </blockquote>
919 </listitem>
920 <listitem>
921 <para>
922 <indexterm role="concept">
923 <primary>Exim monitor</primary>
924 <secondary>acknowledgment</secondary>
925 </indexterm>
926 <indexterm role="concept">
927 <primary>X-windows</primary>
928 </indexterm>
929 <indexterm role="concept">
930 <primary>Athena</primary>
931 </indexterm>
932 The Exim Monitor program, which is an X-Window application, includes
933 modified versions of the Athena StripChart and TextPop widgets.
934 This code is copyright by DEC and MIT, and their permission notice appears
935 below, in accordance with the conditions expressed therein.
936 </para>
937 <blockquote>
938 <para>
939 Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
940 and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
941 </para>
942 <para>
943 All Rights Reserved
944 </para>
945 <para>
946 Permission to use, copy, modify, and distribute this software and its
947 documentation for any purpose and without fee is hereby granted,
948 provided that the above copyright notice appear in all copies and that
949 both that copyright notice and this permission notice appear in
950 supporting documentation, and that the names of Digital or MIT not be
951 used in advertising or publicity pertaining to distribution of the
952 software without specific, written prior permission.
953 </para>
954 <para>
955 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
956 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
957 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
958 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
959 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
960 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
961 SOFTWARE.
962 </para>
963 </blockquote>
964 </listitem>
965 <listitem>
966 <para>
967 Many people have contributed code fragments, some large, some small, that were
968 not covered by any specific licence requirements. It is assumed that the
969 contributors are happy to see their code incorporated into Exim under the GPL.
970 </para>
971 </listitem>
972 </itemizedlist>
973 </chapter>
974
975 <chapter id="CHID11">
976 <title>How Exim receives and delivers mail</title>
977 <titleabbrev>Receiving and delivering mail</titleabbrev>
978 <section id="SECID10">
979 <title>Overall philosophy</title>
980 <para>
981 <indexterm role="concept">
982 <primary>design philosophy</primary>
983 </indexterm>
984 Exim is designed to work efficiently on systems that are permanently connected
985 to the Internet and are handling a general mix of mail. In such circumstances,
986 most messages can be delivered immediately. Consequently, Exim does not
987 maintain independent queues of messages for specific domains or hosts, though
988 it does try to send several messages in a single SMTP connection after a host
989 has been down, and it also maintains per-host retry information.
990 </para>
991 </section>
992 <section id="SECID11">
993 <title>Policy control</title>
994 <para>
995 <indexterm role="concept">
996 <primary>policy control</primary>
997 <secondary>overview</secondary>
998 </indexterm>
999 Policy controls are now an important feature of MTAs that are connected to the
1000 Internet. Perhaps their most important job is to stop MTAs being abused as
1001 <quote>open relays</quote> by misguided individuals who send out vast amounts of
1002 unsolicited junk, and want to disguise its source. Exim provides flexible
1003 facilities for specifying policy controls on incoming mail:
1004 </para>
1005 <itemizedlist>
1006 <listitem>
1007 <para>
1008 <indexterm role="concept">
1009 <primary>access control lists (ACLs)</primary>
1010 <secondary>introduction</secondary>
1011 </indexterm>
1012 Exim 4 (unlike previous versions of Exim) implements policy controls on
1013 incoming mail by means of <emphasis>Access Control Lists</emphasis> (ACLs). Each list is a
1014 series of statements that may either grant or deny access. ACLs can be used at
1015 several places in the SMTP dialogue while receiving a message from a remote
1016 host. However, the most common places are after each RCPT command, and at the
1017 very end of the message. The sysadmin can specify conditions for accepting or
1018 rejecting individual recipients or the entire message, respectively, at these
1019 two points (see chapter <xref linkend="CHAPACL"/>). Denial of access results in an SMTP
1020 error code.
1021 </para>
1022 </listitem>
1023 <listitem>
1024 <para>
1025 An ACL is also available for locally generated, non-SMTP messages. In this
1026 case, the only available actions are to accept or deny the entire message.
1027 </para>
1028 </listitem>
1029 <listitem>
1030 <para>
1031 When Exim is compiled with the content-scanning extension, facilities are
1032 provided in the ACL mechanism for passing the message to external virus and/or
1033 spam scanning software. The result of such a scan is passed back to the ACL,
1034 which can then use it to decide what to do with the message.
1035 </para>
1036 </listitem>
1037 <listitem>
1038 <para>
1039 When a message has been received, either from a remote host or from the local
1040 host, but before the final acknowledgment has been sent, a locally supplied C
1041 function called <function>local_scan()</function> can be run to inspect the message and decide
1042 whether to accept it or not (see chapter <xref linkend="CHAPlocalscan"/>). If the message
1043 is accepted, the list of recipients can be modified by the function.
1044 </para>
1045 </listitem>
1046 <listitem>
1047 <para>
1048 Using the <function>local_scan()</function> mechanism is another way of calling external scanner
1049 software. The <option>SA-Exim</option> add-on package works this way. It does not require
1050 Exim to be compiled with the content-scanning extension.
1051 </para>
1052 </listitem>
1053 <listitem>
1054 <para>
1055 After a message has been accepted, a further checking mechanism is available in
1056 the form of the <emphasis>system filter</emphasis> (see chapter <xref linkend="CHAPsystemfilter"/>). This
1057 runs at the start of every delivery process.
1058 </para>
1059 </listitem>
1060 </itemizedlist>
1061 </section>
1062 <section id="SECID12">
1063 <title>User filters</title>
1064 <para>
1065 <indexterm role="concept">
1066 <primary>filter</primary>
1067 <secondary>introduction</secondary>
1068 </indexterm>
1069 <indexterm role="concept">
1070 <primary>Sieve filter</primary>
1071 </indexterm>
1072 In a conventional Exim configuration, users are able to run private filters by
1073 setting up appropriate <filename>.forward</filename> files in their home directories. See
1074 chapter <xref linkend="CHAPredirect"/> (about the <command>redirect</command> router) for the
1075 configuration needed to support this, and the separate document entitled
1076 <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis> for user details. Two different kinds
1077 of filtering are available:
1078 </para>
1079 <itemizedlist>
1080 <listitem>
1081 <para>
1082 Sieve filters are written in the standard filtering language that is defined
1083 by RFC 3028.
1084 </para>
1085 </listitem>
1086 <listitem>
1087 <para>
1088 Exim filters are written in a syntax that is unique to Exim, but which is more
1089 powerful than Sieve, which it pre-dates.
1090 </para>
1091 </listitem>
1092 </itemizedlist>
1093 <para>
1094 User filters are run as part of the routing process, described below.
1095 </para>
1096 </section>
1097 <section id="SECTmessiden">
1098 <title>Message identification</title>
1099 <para>
1100 <indexterm role="concept">
1101 <primary>message ids</primary>
1102 <secondary>details of format</secondary>
1103 </indexterm>
1104 <indexterm role="concept">
1105 <primary>format</primary>
1106 <secondary>of message id</secondary>
1107 </indexterm>
1108 <indexterm role="concept">
1109 <primary>id of message</primary>
1110 </indexterm>
1111 <indexterm role="concept">
1112 <primary>base62</primary>
1113 </indexterm>
1114 <indexterm role="concept">
1115 <primary>base36</primary>
1116 </indexterm>
1117 <indexterm role="concept">
1118 <primary>Darwin</primary>
1119 </indexterm>
1120 <indexterm role="concept">
1121 <primary>Cygwin</primary>
1122 </indexterm>
1123 Every message handled by Exim is given a <emphasis>message id</emphasis> which is sixteen
1124 characters long. It is divided into three parts, separated by hyphens, for
1125 example <literal>16VDhn-0001bo-D3</literal>. Each part is a sequence of letters and digits,
1126 normally encoding numbers in base 62. However, in the Darwin operating
1127 system (Mac OS X) and when Exim is compiled to run under Cygwin, base 36
1128 (avoiding the use of lower case letters) is used instead, because the message
1129 id is used to construct file names, and the names of files in those systems are
1130 not always case-sensitive.
1131 </para>
1132 <para>
1133 <indexterm role="concept">
1134 <primary>pid (process id)</primary>
1135 <secondary>re-use of</secondary>
1136 </indexterm>
1137 The detail of the contents of the message id have changed as Exim has evolved.
1138 Earlier versions relied on the operating system not re-using a process id (pid)
1139 within one second. On modern operating systems, this assumption can no longer
1140 be made, so the algorithm had to be changed. To retain backward compatibility,
1141 the format of the message id was retained, which is why the following rules are
1142 somewhat eccentric:
1143 </para>
1144 <itemizedlist>
1145 <listitem>
1146 <para>
1147 The first six characters of the message id are the time at which the message
1148 started to be received, to a granularity of one second. That is, this field
1149 contains the number of seconds since the start of the epoch (the normal Unix
1150 way of representing the date and time of day).
1151 </para>
1152 </listitem>
1153 <listitem>
1154 <para>
1155 After the first hyphen, the next six characters are the id of the process that
1156 received the message.
1157 </para>
1158 </listitem>
1159 <listitem>
1160 <para>
1161 There are two different possibilities for the final two characters:
1162 </para>
1163 <orderedlist numeration="arabic">
1164 <listitem>
1165 <para>
1166 <indexterm role="option">
1167 <primary><option>localhost_number</option></primary>
1168 </indexterm>
1169 If <option>localhost_number</option> is not set, this value is the fractional part of the
1170 time of reception, normally in units of 1/2000 of a second, but for systems
1171 that must use base 36 instead of base 62 (because of case-insensitive file
1172 systems), the units are 1/1000 of a second.
1173 </para>
1174 </listitem>
1175 <listitem>
1176 <para>
1177 If <option>localhost_number</option> is set, it is multiplied by 200 (100) and added to
1178 the fractional part of the time, which in this case is in units of 1/200
1179 (1/100) of a second.
1180 </para>
1181 </listitem>
1182 </orderedlist>
1183 </listitem>
1184 </itemizedlist>
1185 <para>
1186 After a message has been received, Exim waits for the clock to tick at the
1187 appropriate resolution before proceeding, so that if another message is
1188 received by the same process, or by another process with the same (re-used)
1189 pid, it is guaranteed that the time will be different. In most cases, the clock
1190 will already have ticked while the message was being received.
1191 </para>
1192 </section>
1193 <section id="SECID13">
1194 <title>Receiving mail</title>
1195 <para>
1196 <indexterm role="concept">
1197 <primary>receiving mail</primary>
1198 </indexterm>
1199 <indexterm role="concept">
1200 <primary>message</primary>
1201 <secondary>reception</secondary>
1202 </indexterm>
1203 The only way Exim can receive mail from another host is using SMTP over
1204 TCP/IP, in which case the sender and recipient addresses are transferred using
1205 SMTP commands. However, from a locally running process (such as a user&#x2019;s MUA),
1206 there are several possibilities:
1207 </para>
1208 <itemizedlist>
1209 <listitem>
1210 <para>
1211 If the process runs Exim with the <option>-bm</option> option, the message is read
1212 non-interactively (usually via a pipe), with the recipients taken from the
1213 command line, or from the body of the message if <option>-t</option> is also used.
1214 </para>
1215 </listitem>
1216 <listitem>
1217 <para>
1218 If the process runs Exim with the <option>-bS</option> option, the message is also read
1219 non-interactively, but in this case the recipients are listed at the start of
1220 the message in a series of SMTP RCPT commands, terminated by a DATA
1221 command. This is so-called <quote>batch SMTP</quote> format,
1222 but it isn&#x2019;t really SMTP. The SMTP commands are just another way of passing
1223 envelope addresses in a non-interactive submission.
1224 </para>
1225 </listitem>
1226 <listitem>
1227 <para>
1228 If the process runs Exim with the <option>-bs</option> option, the message is read
1229 interactively, using the SMTP protocol. A two-way pipe is normally used for
1230 passing data between the local process and the Exim process.
1231 This is <quote>real</quote> SMTP and is handled in the same way as SMTP over TCP/IP. For
1232 example, the ACLs for SMTP commands are used for this form of submission.
1233 </para>
1234 </listitem>
1235 <listitem>
1236 <para>
1237 A local process may also make a TCP/IP call to the host&#x2019;s loopback address
1238 (127.0.0.1) or any other of its IP addresses. When receiving messages, Exim
1239 does not treat the loopback address specially. It treats all such connections
1240 in the same way as connections from other hosts.
1241 </para>
1242 </listitem>
1243 </itemizedlist>
1244 <para>
1245 <indexterm role="concept">
1246 <primary>message sender, constructed by Exim</primary>
1247 </indexterm>
1248 <indexterm role="concept">
1249 <primary>sender</primary>
1250 <secondary>constructed by Exim</secondary>
1251 </indexterm>
1252 In the three cases that do not involve TCP/IP, the sender address is
1253 constructed from the login name of the user that called Exim and a default
1254 qualification domain (which can be set by the <option>qualify_domain</option> configuration
1255 option). For local or batch SMTP, a sender address that is passed using the
1256 SMTP MAIL command is ignored. However, the system administrator may allow
1257 certain users (<quote>trusted users</quote>) to specify a different sender address
1258 unconditionally, or all users to specify certain forms of different sender
1259 address. The <option>-f</option> option or the SMTP MAIL command is used to specify these
1260 different addresses. See section <xref linkend="SECTtrustedadmin"/> for details of trusted
1261 users, and the <option>untrusted_set_sender</option> option for a way of allowing untrusted
1262 users to change sender addresses.
1263 </para>
1264 <para>
1265 Messages received by either of the non-interactive mechanisms are subject to
1266 checking by the non-SMTP ACL, if one is defined. Messages received using SMTP
1267 (either over TCP/IP, or interacting with a local process) can be checked by a
1268 number of ACLs that operate at different times during the SMTP session. Either
1269 individual recipients, or the entire message, can be rejected if local policy
1270 requirements are not met. The <function>local_scan()</function> function (see chapter
1271 <xref linkend="CHAPlocalscan"/>) is run for all incoming messages.
1272 </para>
1273 <para>
1274 Exim can be configured not to start a delivery process when a message is
1275 received; this can be unconditional, or depend on the number of incoming SMTP
1276 connections or the system load. In these situations, new messages wait on the
1277 queue until a queue runner process picks them up. However, in standard
1278 configurations under normal conditions, delivery is started as soon as a
1279 message is received.
1280 </para>
1281 </section>
1282 <section id="SECID14">
1283 <title>Handling an incoming message</title>
1284 <para>
1285 <indexterm role="concept">
1286 <primary>spool directory</primary>
1287 <secondary>files that hold a message</secondary>
1288 </indexterm>
1289 <indexterm role="concept">
1290 <primary>file</primary>
1291 <secondary>how a message is held</secondary>
1292 </indexterm>
1293 When Exim accepts a message, it writes two files in its spool directory. The
1294 first contains the envelope information, the current status of the message, and
1295 the header lines, and the second contains the body of the message. The names of
1296 the two spool files consist of the message id, followed by <literal>-H</literal> for the
1297 file containing the envelope and header, and <literal>-D</literal> for the data file.
1298 </para>
1299 <para>
1300 <indexterm role="concept">
1301 <primary>spool directory</primary>
1302 <secondary><filename>input</filename> sub-directory</secondary>
1303 </indexterm>
1304 By default all these message files are held in a single directory called
1305 <filename>input</filename> inside the general Exim spool directory. Some operating systems do
1306 not perform very well if the number of files in a directory gets large; to
1307 improve performance in such cases, the <option>split_spool_directory</option> option can be
1308 used. This causes Exim to split up the input files into 62 sub-directories
1309 whose names are single letters or digits. When this is done, the queue is
1310 processed one sub-directory at a time instead of all at once, which can improve
1311 overall performance even when there are not enough files in each directory to
1312 affect file system performance.
1313 </para>
1314 <para>
1315 The envelope information consists of the address of the message&#x2019;s sender and
1316 the addresses of the recipients. This information is entirely separate from
1317 any addresses contained in the header lines. The status of the message includes
1318 a list of recipients who have already received the message. The format of the
1319 first spool file is described in chapter <xref linkend="CHAPspool"/>.
1320 </para>
1321 <para>
1322 <indexterm role="concept">
1323 <primary>rewriting</primary>
1324 <secondary>addresses</secondary>
1325 </indexterm>
1326 Address rewriting that is specified in the rewrite section of the configuration
1327 (see chapter <xref linkend="CHAPrewrite"/>) is done once and for all on incoming addresses,
1328 both in the header lines and the envelope, at the time the message is accepted.
1329 If during the course of delivery additional addresses are generated (for
1330 example, via aliasing), these new addresses are rewritten as soon as they are
1331 generated. At the time a message is actually delivered (transported) further
1332 rewriting can take place; because this is a transport option, it can be
1333 different for different forms of delivery. It is also possible to specify the
1334 addition or removal of certain header lines at the time the message is
1335 delivered (see chapters <xref linkend="CHAProutergeneric"/> and
1336 <xref linkend="CHAPtransportgeneric"/>).
1337 </para>
1338 </section>
1339 <section id="SECID15">
1340 <title>Life of a message</title>
1341 <para>
1342 <indexterm role="concept">
1343 <primary>message</primary>
1344 <secondary>life of</secondary>
1345 </indexterm>
1346 <indexterm role="concept">
1347 <primary>message</primary>
1348 <secondary>frozen</secondary>
1349 </indexterm>
1350 A message remains in the spool directory until it is completely delivered to
1351 its recipients or to an error address, or until it is deleted by an
1352 administrator or by the user who originally created it. In cases when delivery
1353 cannot proceed &ndash; for example, when a message can neither be delivered to its
1354 recipients nor returned to its sender, the message is marked <quote>frozen</quote> on the
1355 spool, and no more deliveries are attempted.
1356 </para>
1357 <para>
1358 <indexterm role="concept">
1359 <primary>frozen messages</primary>
1360 <secondary>thawing</secondary>
1361 </indexterm>
1362 <indexterm role="concept">
1363 <primary>message</primary>
1364 <secondary>thawing frozen</secondary>
1365 </indexterm>
1366 An administrator can <quote>thaw</quote> such messages when the problem has been
1367 corrected, and can also freeze individual messages by hand if necessary. In
1368 addition, an administrator can force a delivery error, causing a bounce message
1369 to be sent.
1370 </para>
1371 <para>
1372 <indexterm role="option">
1373 <primary><option>timeout_frozen_after</option></primary>
1374 </indexterm>
1375 <indexterm role="option">
1376 <primary><option>ignore_bounce_errors_after</option></primary>
1377 </indexterm>
1378 There are options called <option>ignore_bounce_errors_after</option> and
1379 <option>timeout_frozen_after</option>, which discard frozen messages after a certain time.
1380 The first applies only to frozen bounces, the second to any frozen messages.
1381 </para>
1382 <para>
1383 <indexterm role="concept">
1384 <primary>message</primary>
1385 <secondary>log file for</secondary>
1386 </indexterm>
1387 <indexterm role="concept">
1388 <primary>log</primary>
1389 <secondary>file for each message</secondary>
1390 </indexterm>
1391 While Exim is working on a message, it writes information about each delivery
1392 attempt to its main log file. This includes successful, unsuccessful, and
1393 delayed deliveries for each recipient (see chapter <xref linkend="CHAPlog"/>). The log
1394 lines are also written to a separate <emphasis>message log</emphasis> file for each message.
1395 These logs are solely for the benefit of the administrator, and are normally
1396 deleted along with the spool files when processing of a message is complete.
1397 The use of individual message logs can be disabled by setting
1398 <option>no_message_logs</option>; this might give an improvement in performance on very busy
1399 systems.
1400 </para>
1401 <para>
1402 <indexterm role="concept">
1403 <primary>journal file</primary>
1404 </indexterm>
1405 <indexterm role="concept">
1406 <primary>file</primary>
1407 <secondary>journal</secondary>
1408 </indexterm>
1409 All the information Exim itself needs to set up a delivery is kept in the first
1410 spool file, along with the header lines. When a successful delivery occurs, the
1411 address is immediately written at the end of a journal file, whose name is the
1412 message id followed by <literal>-J</literal>. At the end of a delivery run, if there are some
1413 addresses left to be tried again later, the first spool file (the <literal>-H</literal> file)
1414 is updated to indicate which these are, and the journal file is then deleted.
1415 Updating the spool file is done by writing a new file and renaming it, to
1416 minimize the possibility of data loss.
1417 </para>
1418 <para>
1419 Should the system or the program crash after a successful delivery but before
1420 the spool file has been updated, the journal is left lying around. The next
1421 time Exim attempts to deliver the message, it reads the journal file and
1422 updates the spool file before proceeding. This minimizes the chances of double
1423 deliveries caused by crashes.
1424 </para>
1425 </section>
1426 <section id="SECTprocaddress">
1427 <title>Processing an address for delivery</title>
1428 <para>
1429 <indexterm role="concept">
1430 <primary>drivers</primary>
1431 <secondary>definition of</secondary>
1432 </indexterm>
1433 <indexterm role="concept">
1434 <primary>router</primary>
1435 <secondary>definition of</secondary>
1436 </indexterm>
1437 <indexterm role="concept">
1438 <primary>transport</primary>
1439 <secondary>definition of</secondary>
1440 </indexterm>
1441 The main delivery processing elements of Exim are called <emphasis>routers</emphasis> and
1442 <emphasis>transports</emphasis>, and collectively these are known as <emphasis>drivers</emphasis>. Code for a
1443 number of them is provided in the source distribution, and compile-time options
1444 specify which ones are included in the binary. Run time options specify which
1445 ones are actually used for delivering messages.
1446 </para>
1447 <para>
1448 <indexterm role="concept">
1449 <primary>drivers</primary>
1450 <secondary>instance definition</secondary>
1451 </indexterm>
1452 Each driver that is specified in the run time configuration is an <emphasis>instance</emphasis>
1453 of that particular driver type. Multiple instances are allowed; for example,
1454 you can set up several different <command>smtp</command> transports, each with different
1455 option values that might specify different ports or different timeouts. Each
1456 instance has its own identifying name. In what follows we will normally use the
1457 instance name when discussing one particular instance (that is, one specific
1458 configuration of the driver), and the generic driver name when discussing
1459 the driver&#x2019;s features in general.
1460 </para>
1461 <para>
1462 A <emphasis>router</emphasis> is a driver that operates on an address, either determining how
1463 its delivery should happen, by assigning it to a specific transport, or
1464 converting the address into one or more new addresses (for example, via an
1465 alias file). A router may also explicitly choose to fail an address, causing it
1466 to be bounced.
1467 </para>
1468 <para>
1469 A <emphasis>transport</emphasis> is a driver that transmits a copy of the message from Exim&#x2019;s
1470 spool to some destination. There are two kinds of transport: for a <emphasis>local</emphasis>
1471 transport, the destination is a file or a pipe on the local host, whereas for a
1472 <emphasis>remote</emphasis> transport the destination is some other host. A message is passed
1473 to a specific transport as a result of successful routing. If a message has
1474 several recipients, it may be passed to a number of different transports.
1475 </para>
1476 <para>
1477 <indexterm role="concept">
1478 <primary>preconditions</primary>
1479 <secondary>definition of</secondary>
1480 </indexterm>
1481 An address is processed by passing it to each configured router instance in
1482 turn, subject to certain preconditions, until a router accepts the address or
1483 specifies that it should be bounced. We will describe this process in more
1484 detail shortly. First, as a simple example, we consider how each recipient
1485 address in a message is processed in a small configuration of three routers.
1486 </para>
1487 <para>
1488 To make this a more concrete example, it is described in terms of some actual
1489 routers, but remember, this is only an example. You can configure Exim&#x2019;s
1490 routers in many different ways, and there may be any number of routers in a
1491 configuration.
1492 </para>
1493 <para>
1494 The first router that is specified in a configuration is often one that handles
1495 addresses in domains that are not recognized specially by the local host. These
1496 are typically addresses for arbitrary domains on the Internet. A precondition
1497 is set up which looks for the special domains known to the host (for example,
1498 its own domain name), and the router is run for addresses that do <emphasis>not</emphasis>
1499 match. Typically, this is a router that looks up domains in the DNS in order to
1500 find the hosts to which this address routes. If it succeeds, the address is
1501 assigned to a suitable SMTP transport; if it does not succeed, the router is
1502 configured to fail the address.
1503 </para>
1504 <para>
1505 The second router is reached only when the domain is recognized as one that
1506 <quote>belongs</quote> to the local host. This router does redirection &ndash; also known as
1507 aliasing and forwarding. When it generates one or more new addresses from the
1508 original, each of them is routed independently from the start. Otherwise, the
1509 router may cause an address to fail, or it may simply decline to handle the
1510 address, in which case the address is passed to the next router.
1511 </para>
1512 <para>
1513 The final router in many configurations is one that checks to see if the
1514 address belongs to a local mailbox. The precondition may involve a check to
1515 see if the local part is the name of a login account, or it may look up the
1516 local part in a file or a database. If its preconditions are not met, or if
1517 the router declines, we have reached the end of the routers. When this happens,
1518 the address is bounced.
1519 </para>
1520 </section>
1521 <section id="SECID16">
1522 <title>Processing an address for verification</title>
1523 <para>
1524 <indexterm role="concept">
1525 <primary>router</primary>
1526 <secondary>for verification</secondary>
1527 </indexterm>
1528 <indexterm role="concept">
1529 <primary>verifying address</primary>
1530 <secondary>overview</secondary>
1531 </indexterm>
1532 As well as being used to decide how to deliver to an address, Exim&#x2019;s routers
1533 are also used for <emphasis>address verification</emphasis>. Verification can be requested as
1534 one of the checks to be performed in an ACL for incoming messages, on both
1535 sender and recipient addresses, and it can be tested using the <option>-bv</option> and
1536 <option>-bvs</option> command line options.
1537 </para>
1538 <para>
1539 When an address is being verified, the routers are run in <quote>verify mode</quote>. This
1540 does not affect the way the routers work, but it is a state that can be
1541 detected. By this means, a router can be skipped or made to behave differently
1542 when verifying. A common example is a configuration in which the first router
1543 sends all messages to a message-scanning program, unless they have been
1544 previously scanned. Thus, the first router accepts all addresses without any
1545 checking, making it useless for verifying. Normally, the <option>no_verify</option> option
1546 would be set for such a router, causing it to be skipped in verify mode.
1547 </para>
1548 </section>
1549 <section id="SECTrunindrou">
1550 <title>Running an individual router</title>
1551 <para>
1552 <indexterm role="concept">
1553 <primary>router</primary>
1554 <secondary>running details</secondary>
1555 </indexterm>
1556 <indexterm role="concept">
1557 <primary>preconditions</primary>
1558 <secondary>checking</secondary>
1559 </indexterm>
1560 <indexterm role="concept">
1561 <primary>router</primary>
1562 <secondary>result of running</secondary>
1563 </indexterm>
1564 As explained in the example above, a number of preconditions are checked before
1565 running a router. If any are not met, the router is skipped, and the address is
1566 passed to the next router. When all the preconditions on a router <emphasis>are</emphasis> met,
1567 the router is run. What happens next depends on the outcome, which is one of
1568 the following:
1569 </para>
1570 <itemizedlist>
1571 <listitem>
1572 <para>
1573 <emphasis>accept</emphasis>: The router accepts the address, and either assigns it to a
1574 transport, or generates one or more <quote>child</quote> addresses. Processing the
1575 original address ceases,
1576 <indexterm role="option">
1577 <primary><option>unseen</option></primary>
1578 </indexterm>
1579 unless the <option>unseen</option> option is set on the router. This option
1580 can be used to set up multiple deliveries with different routing (for example,
1581 for keeping archive copies of messages). When <option>unseen</option> is set, the address is
1582 passed to the next router. Normally, however, an <emphasis>accept</emphasis> return marks the
1583 end of routing.
1584 </para>
1585 <para>
1586 Any child addresses generated by the router are processed independently,
1587 starting with the first router by default. It is possible to change this by
1588 setting the <option>redirect_router</option> option to specify which router to start at for
1589 child addresses. Unlike <option>pass_router</option> (see below) the router specified by
1590 <option>redirect_router</option> may be anywhere in the router configuration.
1591 </para>
1592 </listitem>
1593 <listitem>
1594 <para>
1595 <emphasis>pass</emphasis>: The router recognizes the address, but cannot handle it itself. It
1596 requests that the address be passed to another router. By default the address
1597 is passed to the next router, but this can be changed by setting the
1598 <option>pass_router</option> option. However, (unlike <option>redirect_router</option>) the named router
1599 must be below the current router (to avoid loops).
1600 </para>
1601 </listitem>
1602 <listitem>
1603 <para>
1604 <emphasis>decline</emphasis>: The router declines to accept the address because it does not
1605 recognize it at all. By default, the address is passed to the next router, but
1606 this can be prevented by setting the <option>no_more</option> option. When <option>no_more</option> is
1607 set, all the remaining routers are skipped. In effect, <option>no_more</option> converts
1608 <emphasis>decline</emphasis> into <emphasis>fail</emphasis>.
1609 </para>
1610 </listitem>
1611 <listitem>
1612 <para>
1613 <emphasis>fail</emphasis>: The router determines that the address should fail, and queues it for
1614 the generation of a bounce message. There is no further processing of the
1615 original address unless <option>unseen</option> is set on the router.
1616 </para>
1617 </listitem>
1618 <listitem>
1619 <para>
1620 <emphasis>defer</emphasis>: The router cannot handle the address at the present time. (A
1621 database may be offline, or a DNS lookup may have timed out.) No further
1622 processing of the address happens in this delivery attempt. It is tried again
1623 next time the message is considered for delivery.
1624 </para>
1625 </listitem>
1626 <listitem>
1627 <para>
1628 <emphasis>error</emphasis>: There is some error in the router (for example, a syntax error in
1629 its configuration). The action is as for defer.
1630 </para>
1631 </listitem>
1632 </itemizedlist>
1633 <para>
1634 If an address reaches the end of the routers without having been accepted by
1635 any of them, it is bounced as unrouteable. The default error message in this
1636 situation is <quote>unrouteable address</quote>, but you can set your own message by
1637 making use of the <option>cannot_route_message</option> option. This can be set for any
1638 router; the value from the last router that <quote>saw</quote> the address is used.
1639 </para>
1640 <para>
1641 Sometimes while routing you want to fail a delivery when some conditions are
1642 met but others are not, instead of passing the address on for further routing.
1643 You can do this by having a second router that explicitly fails the delivery
1644 when the relevant conditions are met. The <command>redirect</command> router has a <quote>fail</quote>
1645 facility for this purpose.
1646 </para>
1647 </section>
1648 <section id="SECID17">
1649 <title>Duplicate addresses</title>
1650 <para>
1651 <indexterm role="concept">
1652 <primary>case of local parts</primary>
1653 </indexterm>
1654 <indexterm role="concept">
1655 <primary>address duplicate, discarding</primary>
1656 </indexterm>
1657 <indexterm role="concept">
1658 <primary>duplicate addresses</primary>
1659 </indexterm>
1660 Once routing is complete, Exim scans the addresses that are assigned to local
1661 and remote transports, and discards any duplicates that it finds. During this
1662 check, local parts are treated as case-sensitive. This happens only when
1663 actually delivering a message; when testing routers with <option>-bt</option>, all the
1664 routed addresses are shown.
1665 </para>
1666 </section>
1667 <section id="SECTrouprecon">
1668 <title>Router preconditions</title>
1669 <para>
1670 <indexterm role="concept">
1671 <primary>router</primary>
1672 <secondary>preconditions, order of processing</secondary>
1673 </indexterm>
1674 <indexterm role="concept">
1675 <primary>preconditions</primary>
1676 <secondary>order of processing</secondary>
1677 </indexterm>
1678 The preconditions that are tested for each router are listed below, in the
1679 order in which they are tested. The individual configuration options are
1680 described in more detail in chapter <xref linkend="CHAProutergeneric"/>.
1681 </para>
1682 <itemizedlist>
1683 <listitem>
1684 <para>
1685 The <option>local_part_prefix</option> and <option>local_part_suffix</option> options can specify that
1686 the local parts handled by the router may or must have certain prefixes and/or
1687 suffixes. If a mandatory affix (prefix or suffix) is not present, the router is
1688 skipped. These conditions are tested first. When an affix is present, it is
1689 removed from the local part before further processing, including the evaluation
1690 of any other conditions.
1691 </para>
1692 </listitem>
1693 <listitem>
1694 <para>
1695 Routers can be designated for use only when not verifying an address, that is,
1696 only when routing it for delivery (or testing its delivery routing). If the
1697 <option>verify</option> option is set false, the router is skipped when Exim is verifying an
1698 address.
1699 Setting the <option>verify</option> option actually sets two options, <option>verify_sender</option> and
1700 <option>verify_recipient</option>, which independently control the use of the router for
1701 sender and recipient verification. You can set these options directly if
1702 you want a router to be used for only one type of verification.
1703 </para>
1704 </listitem>
1705 <listitem>
1706 <para>
1707 If the <option>address_test</option> option is set false, the router is skipped when Exim is
1708 run with the <option>-bt</option> option to test an address routing. This can be helpful
1709 when the first router sends all new messages to a scanner of some sort; it
1710 makes it possible to use <option>-bt</option> to test subsequent delivery routing without
1711 having to simulate the effect of the scanner.
1712 </para>
1713 </listitem>
1714 <listitem>
1715 <para>
1716 Routers can be designated for use only when verifying an address, as
1717 opposed to routing it for delivery. The <option>verify_only</option> option controls this.
1718 </para>
1719 </listitem>
1720 <listitem>
1721 <para>
1722 Individual routers can be explicitly skipped when running the routers to
1723 check an address given in the SMTP EXPN command (see the <option>expn</option> option).
1724 </para>
1725 </listitem>
1726 <listitem>
1727 <para>
1728 If the <option>domains</option> option is set, the domain of the address must be in the set
1729 of domains that it defines.
1730 </para>
1731 </listitem>
1732 <listitem>
1733 <para>
1734 <indexterm role="variable">
1735 <primary><varname>$local_part_prefix</varname></primary>
1736 </indexterm>
1737 <indexterm role="variable">
1738 <primary><varname>$local_part</varname></primary>
1739 </indexterm>
1740 <indexterm role="variable">
1741 <primary><varname>$local_part_suffix</varname></primary>
1742 </indexterm>
1743 If the <option>local_parts</option> option is set, the local part of the address must be in
1744 the set of local parts that it defines. If <option>local_part_prefix</option> or
1745 <option>local_part_suffix</option> is in use, the prefix or suffix is removed from the local
1746 part before this check. If you want to do precondition tests on local parts
1747 that include affixes, you can do so by using a <option>condition</option> option (see below)
1748 that uses the variables <varname>$local_part</varname>, <varname>$local_part_prefix</varname>, and
1749 <varname>$local_part_suffix</varname> as necessary.
1750 </para>
1751 </listitem>
1752 <listitem>
1753 <para>
1754 <indexterm role="variable">
1755 <primary><varname>$local_user_uid</varname></primary>
1756 </indexterm>
1757 <indexterm role="variable">
1758 <primary><varname>$local_user_gid</varname></primary>
1759 </indexterm>
1760 <indexterm role="variable">
1761 <primary><varname>$home</varname></primary>
1762 </indexterm>
1763 If the <option>check_local_user</option> option is set, the local part must be the name of
1764 an account on the local host. If this check succeeds, the uid and gid of the
1765 local user are placed in <varname>$local_user_uid</varname> and <varname>$local_user_gid</varname> and the
1766 user&#x2019;s home directory is placed in <varname>$home</varname>; these values can be used in the
1767 remaining preconditions.
1768 </para>
1769 </listitem>
1770 <listitem>
1771 <para>
1772 If the <option>router_home_directory</option> option is set, it is expanded at this point,
1773 because it overrides the value of <varname>$home</varname>. If this expansion were left till
1774 later, the value of <varname>$home</varname> as set by <option>check_local_user</option> would be used in
1775 subsequent tests. Having two different values of <varname>$home</varname> in the same router
1776 could lead to confusion.
1777 </para>
1778 </listitem>
1779 <listitem>
1780 <para>
1781 If the <option>senders</option> option is set, the envelope sender address must be in the
1782 set of addresses that it defines.
1783 </para>
1784 </listitem>
1785 <listitem>
1786 <para>
1787 If the <option>require_files</option> option is set, the existence or non-existence of
1788 specified files is tested.
1789 </para>
1790 </listitem>
1791 <listitem>
1792 <para>
1793 <indexterm role="concept">
1794 <primary>customizing</primary>
1795 <secondary>precondition</secondary>
1796 </indexterm>
1797 If the <option>condition</option> option is set, it is evaluated and tested. This option
1798 uses an expanded string to allow you to set up your own custom preconditions.
1799 Expanded strings are described in chapter <xref linkend="CHAPexpand"/>.
1800 </para>
1801 </listitem>
1802 </itemizedlist>
1803 <para>
1804 Note that <option>require_files</option> comes near the end of the list, so you cannot use
1805 it to check for the existence of a file in which to lookup up a domain, local
1806 part, or sender. However, as these options are all expanded, you can use the
1807 <option>exists</option> expansion condition to make such tests within each condition. The
1808 <option>require_files</option> option is intended for checking files that the router may be
1809 going to use internally, or which are needed by a specific transport (for
1810 example, <filename>.procmailrc</filename>).
1811 </para>
1812 </section>
1813 <section id="SECID18">
1814 <title>Delivery in detail</title>
1815 <para>
1816 <indexterm role="concept">
1817 <primary>delivery</primary>
1818 <secondary>in detail</secondary>
1819 </indexterm>
1820 When a message is to be delivered, the sequence of events is as follows:
1821 </para>
1822 <itemizedlist>
1823 <listitem>
1824 <para>
1825 If a system-wide filter file is specified, the message is passed to it. The
1826 filter may add recipients to the message, replace the recipients, discard the
1827 message, cause a new message to be generated, or cause the message delivery to
1828 fail. The format of the system filter file is the same as for Exim user filter
1829 files, described in the separate document entitled <emphasis>Exim&#x2019;s interfaces to mail
1830 filtering</emphasis>.
1831 <indexterm role="concept">
1832 <primary>Sieve filter</primary>
1833 <secondary>not available for system filter</secondary>
1834 </indexterm>
1835 (<emphasis role="bold">Note</emphasis>: Sieve cannot be used for system filter files.)
1836 </para>
1837 <para>
1838 Some additional features are available in system filters &ndash; see chapter
1839 <xref linkend="CHAPsystemfilter"/> for details. Note that a message is passed to the system
1840 filter only once per delivery attempt, however many recipients it has. However,
1841 if there are several delivery attempts because one or more addresses could not
1842 be immediately delivered, the system filter is run each time. The filter
1843 condition <option>first_delivery</option> can be used to detect the first run of the system
1844 filter.
1845 </para>
1846 </listitem>
1847 <listitem>
1848 <para>
1849 Each recipient address is offered to each configured router in turn, subject to
1850 its preconditions, until one is able to handle it. If no router can handle the
1851 address, that is, if they all decline, the address is failed. Because routers
1852 can be targeted at particular domains, several locally handled domains can be
1853 processed entirely independently of each other.
1854 </para>
1855 </listitem>
1856 <listitem>
1857 <para>
1858 <indexterm role="concept">
1859 <primary>routing</primary>
1860 <secondary>loops in</secondary>
1861 </indexterm>
1862 <indexterm role="concept">
1863 <primary>loop</primary>
1864 <secondary>while routing</secondary>
1865 </indexterm>
1866 A router that accepts an address may assign it to a local or a remote
1867 transport. However, the transport is not run at this time. Instead, the address
1868 is placed on a list for the particular transport, which will be run later.
1869 Alternatively, the router may generate one or more new addresses (typically
1870 from alias, forward, or filter files). New addresses are fed back into this
1871 process from the top, but in order to avoid loops, a router ignores any address
1872 which has an identically-named ancestor that was processed by itself.
1873 </para>
1874 </listitem>
1875 <listitem>
1876 <para>
1877 When all the routing has been done, addresses that have been successfully
1878 handled are passed to their assigned transports. When local transports are
1879 doing real local deliveries, they handle only one address at a time, but if a
1880 local transport is being used as a pseudo-remote transport (for example, to
1881 collect batched SMTP messages for transmission by some other means) multiple
1882 addresses can be handled. Remote transports can always handle more than one
1883 address at a time, but can be configured not to do so, or to restrict multiple
1884 addresses to the same domain.
1885 </para>
1886 </listitem>
1887 <listitem>
1888 <para>
1889 Each local delivery to a file or a pipe runs in a separate process under a
1890 non-privileged uid, and these deliveries are run one at a time. Remote
1891 deliveries also run in separate processes, normally under a uid that is private
1892 to Exim (<quote>the Exim user</quote>), but in this case, several remote deliveries can be
1893 run in parallel. The maximum number of simultaneous remote deliveries for any
1894 one message is set by the <option>remote_max_parallel</option> option.
1895 The order in which deliveries are done is not defined, except that all local
1896 deliveries happen before any remote deliveries.
1897 </para>
1898 </listitem>
1899 <listitem>
1900 <para>
1901 <indexterm role="concept">
1902 <primary>queue runner</primary>
1903 </indexterm>
1904 When it encounters a local delivery during a queue run, Exim checks its retry
1905 database to see if there has been a previous temporary delivery failure for the
1906 address before running the local transport. If there was a previous failure,
1907 Exim does not attempt a new delivery until the retry time for the address is
1908 reached. However, this happens only for delivery attempts that are part of a
1909 queue run. Local deliveries are always attempted when delivery immediately
1910 follows message reception, even if retry times are set for them. This makes for
1911 better behaviour if one particular message is causing problems (for example,
1912 causing quota overflow, or provoking an error in a filter file).
1913 </para>
1914 </listitem>
1915 <listitem>
1916 <para>
1917 <indexterm role="concept">
1918 <primary>delivery</primary>
1919 <secondary>retry in remote transports</secondary>
1920 </indexterm>
1921 Remote transports do their own retry handling, since an address may be
1922 deliverable to one of a number of hosts, each of which may have a different
1923 retry time. If there have been previous temporary failures and no host has
1924 reached its retry time, no delivery is attempted, whether in a queue run or
1925 not. See chapter <xref linkend="CHAPretry"/> for details of retry strategies.
1926 </para>
1927 </listitem>
1928 <listitem>
1929 <para>
1930 If there were any permanent errors, a bounce message is returned to an
1931 appropriate address (the sender in the common case), with details of the error
1932 for each failing address. Exim can be configured to send copies of bounce
1933 messages to other addresses.
1934 </para>
1935 </listitem>
1936 <listitem>
1937 <para>
1938 <indexterm role="concept">
1939 <primary>delivery</primary>
1940 <secondary>deferral</secondary>
1941 </indexterm>
1942 If one or more addresses suffered a temporary failure, the message is left on
1943 the queue, to be tried again later. Delivery of these addresses is said to be
1944 <emphasis>deferred</emphasis>.
1945 </para>
1946 </listitem>
1947 <listitem>
1948 <para>
1949 When all the recipient addresses have either been delivered or bounced,
1950 handling of the message is complete. The spool files and message log are
1951 deleted, though the message log can optionally be preserved if required.
1952 </para>
1953 </listitem>
1954 </itemizedlist>
1955 </section>
1956 <section id="SECID19">
1957 <title>Retry mechanism</title>
1958 <para>
1959 <indexterm role="concept">
1960 <primary>delivery</primary>
1961 <secondary>retry mechanism</secondary>
1962 </indexterm>
1963 <indexterm role="concept">
1964 <primary>retry</primary>
1965 <secondary>description of mechanism</secondary>
1966 </indexterm>
1967 <indexterm role="concept">
1968 <primary>queue runner</primary>
1969 </indexterm>
1970 Exim&#x2019;s mechanism for retrying messages that fail to get delivered at the first
1971 attempt is the queue runner process. You must either run an Exim daemon that
1972 uses the <option>-q</option> option with a time interval to start queue runners at regular
1973 intervals, or use some other means (such as <emphasis>cron</emphasis>) to start them. If you do
1974 not arrange for queue runners to be run, messages that fail temporarily at the
1975 first attempt will remain on your queue for ever. A queue runner process works
1976 its way through the queue, one message at a time, trying each delivery that has
1977 passed its retry time.
1978 You can run several queue runners at once.
1979 </para>
1980 <para>
1981 Exim uses a set of configured rules to determine when next to retry the failing
1982 address (see chapter <xref linkend="CHAPretry"/>). These rules also specify when Exim
1983 should give up trying to deliver to the address, at which point it generates a
1984 bounce message. If no retry rules are set for a particular host, address, and
1985 error combination, no retries are attempted, and temporary errors are treated
1986 as permanent.
1987 </para>
1988 </section>
1989 <section id="SECID20">
1990 <title>Temporary delivery failure</title>
1991 <para>
1992 <indexterm role="concept">
1993 <primary>delivery</primary>
1994 <secondary>temporary failure</secondary>
1995 </indexterm>
1996 There are many reasons why a message may not be immediately deliverable to a
1997 particular address. Failure to connect to a remote machine (because it, or the
1998 connection to it, is down) is one of the most common. Temporary failures may be
1999 detected during routing as well as during the transport stage of delivery.
2000 Local deliveries may be delayed if NFS files are unavailable, or if a mailbox
2001 is on a file system where the user is over quota. Exim can be configured to
2002 impose its own quotas on local mailboxes; where system quotas are set they will
2003 also apply.
2004 </para>
2005 <para>
2006 If a host is unreachable for a period of time, a number of messages may be
2007 waiting for it by the time it recovers, and sending them in a single SMTP
2008 connection is clearly beneficial. Whenever a delivery to a remote host is
2009 deferred,
2010 <indexterm role="concept">
2011 <primary>hints database</primary>
2012 </indexterm>
2013 Exim makes a note in its hints database, and whenever a successful
2014 SMTP delivery has happened, it looks to see if any other messages are waiting
2015 for the same host. If any are found, they are sent over the same SMTP
2016 connection, subject to a configuration limit as to the maximum number in any
2017 one connection.
2018 </para>
2019 </section>
2020 <section id="SECID21">
2021 <title>Permanent delivery failure</title>
2022 <para>
2023 <indexterm role="concept">
2024 <primary>delivery</primary>
2025 <secondary>permanent failure</secondary>
2026 </indexterm>
2027 <indexterm role="concept">
2028 <primary>bounce message</primary>
2029 <secondary>when generated</secondary>
2030 </indexterm>
2031 When a message cannot be delivered to some or all of its intended recipients, a
2032 bounce message is generated. Temporary delivery failures turn into permanent
2033 errors when their timeout expires. All the addresses that fail in a given
2034 delivery attempt are listed in a single message. If the original message has
2035 many recipients, it is possible for some addresses to fail in one delivery
2036 attempt and others to fail subsequently, giving rise to more than one bounce
2037 message. The wording of bounce messages can be customized by the administrator.
2038 See chapter <xref linkend="CHAPemsgcust"/> for details.
2039 </para>
2040 <para>
2041 <indexterm role="concept">
2042 <primary><emphasis>X-Failed-Recipients:</emphasis> header line</primary>
2043 </indexterm>
2044 Bounce messages contain an <emphasis>X-Failed-Recipients:</emphasis> header line that lists the
2045 failed addresses, for the benefit of programs that try to analyse such messages
2046 automatically.
2047 </para>
2048 <para>
2049 <indexterm role="concept">
2050 <primary>bounce message</primary>
2051 <secondary>recipient of</secondary>
2052 </indexterm>
2053 A bounce message is normally sent to the sender of the original message, as
2054 obtained from the message&#x2019;s envelope. For incoming SMTP messages, this is the
2055 address given in the MAIL command. However, when an address is expanded via a
2056 forward or alias file, an alternative address can be specified for delivery
2057 failures of the generated addresses. For a mailing list expansion (see section
2058 <xref linkend="SECTmailinglists"/>) it is common to direct bounce messages to the manager
2059 of the list.
2060 </para>
2061 </section>
2062 <section id="SECID22">
2063 <title>Failures to deliver bounce messages</title>
2064 <para>
2065 <indexterm role="concept">
2066 <primary>bounce message</primary>
2067 <secondary>failure to deliver</secondary>
2068 </indexterm>
2069 If a bounce message (either locally generated or received from a remote host)
2070 itself suffers a permanent delivery failure, the message is left on the queue,
2071 but it is frozen, awaiting the attention of an administrator. There are options
2072 that can be used to make Exim discard such failed messages, or to keep them
2073 for only a short time (see <option>timeout_frozen_after</option> and
2074 <option>ignore_bounce_errors_after</option>).
2075 </para>
2076 </section>
2077 </chapter>
2078
2079 <chapter id="CHID3">
2080 <title>Building and installing Exim</title>
2081 <para>
2082 <indexterm role="concept" id="IIDbuex" class="startofrange">
2083 <primary>building Exim</primary>
2084 </indexterm>
2085 </para>
2086 <section id="SECID23">
2087 <title>Unpacking</title>
2088 <para>
2089 Exim is distributed as a gzipped or bzipped tar file which, when unpacked,
2090 creates a directory with the name of the current release (for example,
2091 <filename>exim-4.77</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">
2558 <title>Use of tcpwrappers</title>
2559 <para>
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">
2583 USE_TCP_WRAPPERS=yes
2584 CFLAGS=-O -I/usr/local/include
2585 EXTRALIBS_EXIM=-L/usr/local/lib -lwrap
2586 </literallayout>
2587 <para>
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">
2592 exim : LOCAL  192.168.1.  .friendly.domain.example
2593 </literallayout>
2594 <para>
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">
2629 <title>Dynamically loaded lookup module support</title>
2630 <para>
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>
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>
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">
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.77-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>
3595 <term><option>--version</option></term>
3596 <listitem>
3597 <para>
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>
4592 <term><option>-bmalware</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
4593 <listitem>
4594 <para>
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>
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>
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>
4697 <term><option>-bV</option></term>
4698 <listitem>
4699 <para>
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>
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>
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>
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>
5618 <term><option>-Mvc</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5619 <listitem>
5620 <para>
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>
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>
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>
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">
7032 <title>Using a different configuration file</title>
7033 <para>
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>
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>
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>
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 = '${quote_mysql:$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>
14558 <term><emphasis role="bold">${reverse_ip:</emphasis>&lt;<emphasis>ipaddr</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14559 <listitem>
14560 <para>
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">
14571 ${reverse_ip:192.0.2.4} and ${reverse_ip:2001:0db8:c42:9:1:abcd:192.0.2.3}
14572 </literallayout>
14573 <para>
14574 returns
14575 </para>
14576 <literallayout class="monospaced">
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>
14892 <term><emphasis role="bold">bool&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14893 <listitem>
14894 <para>
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>
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">
14914 ${if bool{$acl_m_privileged_sender} ...
14915 </literallayout>
14916 </listitem></varlistentry>
14917 <varlistentry>
14918 <term><emphasis role="bold">bool_lax&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14919 <listitem>
14920 <para>
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>
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 revisionflag="changed">
15277 <term><emphasis role="bold">inlist&nbsp;{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15278 <term><emphasis role="bold">inlisti&nbsp;{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15279 <listitem>
15280 <para revisionflag="changed">
15281 <indexterm role="concept">
15282 <primary>string</primary>
15283 <secondary>comparison</secondary>
15284 </indexterm>
15285 <indexterm role="concept">
15286 <primary>list</primary>
15287 <secondary>iterative conditions</secondary>
15288 </indexterm>
15289 Both strings are expanded; the second string is treated as a list of simple
15290 strings; if the first string is a member of the second, then the condition
15291 is true.
15292 </para>
15293 <para revisionflag="changed">
15294 These are simpler to use versions of the more powerful <emphasis role="bold">forany</emphasis> condition.
15295 Examples, and the <emphasis role="bold">forany</emphasis> equivalents:
15296 </para>
15297 <literallayout class="monospaced" revisionflag="changed">
15298 ${if inlist{needle}{foo:needle:bar}}
15299   ${if forany{foo:needle:bar}{eq{$item}{needle}}}
15300 ${if inlisti{Needle}{fOo:NeeDLE:bAr}}
15301   ${if forany{fOo:NeeDLE:bAr}{eqi{$item}{Needle}}}
15302 </literallayout>
15303 </listitem></varlistentry>
15304 <varlistentry>
15305 <term><emphasis role="bold">isip&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15306 <term><emphasis role="bold">isip4&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15307 <term><emphasis role="bold">isip6&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15308 <listitem>
15309 <para>
15310 <indexterm role="concept">
15311 <primary>IP address</primary>
15312 <secondary>testing string format</secondary>
15313 </indexterm>
15314 <indexterm role="concept">
15315 <primary>string</primary>
15316 <secondary>testing for IP address</secondary>
15317 </indexterm>
15318 <indexterm role="concept">
15319 <primary><option>isip</option> expansion condition</primary>
15320 </indexterm>
15321 <indexterm role="concept">
15322 <primary><option>isip4</option> expansion condition</primary>
15323 </indexterm>
15324 <indexterm role="concept">
15325 <primary><option>isip6</option> expansion condition</primary>
15326 </indexterm>
15327 The substring is first expanded, and then tested to see if it has the form of
15328 an IP address. Both IPv4 and IPv6 addresses are valid for <option>isip</option>, whereas
15329 <option>isip4</option> and <option>isip6</option> test specifically for IPv4 or IPv6 addresses.
15330 </para>
15331 <para>
15332 For an IPv4 address, the test is for four dot-separated components, each of
15333 which consists of from one to three digits. For an IPv6 address, up to eight
15334 colon-separated components are permitted, each containing from one to four
15335 hexadecimal digits. There may be fewer than eight components if an empty
15336 component (adjacent colons) is present. Only one empty component is permitted.
15337 </para>
15338 <para>
15339 <emphasis role="bold">Note</emphasis>: The checks are just on the form of the address; actual numerical
15340 values are not considered. Thus, for example, 999.999.999.999 passes the IPv4
15341 check. The main use of these tests is to distinguish between IP addresses and
15342 host names, or between IPv4 and IPv6 addresses. For example, you could use
15343 </para>
15344 <literallayout class="monospaced">
15345 ${if isip4{$sender_host_address}...
15346 </literallayout>
15347 <para>
15348 to test which IP version an incoming SMTP connection is using.
15349 </para>
15350 </listitem></varlistentry>
15351 <varlistentry>
15352 <term><emphasis role="bold">ldapauth&nbsp;{</emphasis>&lt;<emphasis>ldap&nbsp;query</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15353 <listitem>
15354 <para>
15355 <indexterm role="concept">
15356 <primary>LDAP</primary>
15357 <secondary>use for authentication</secondary>
15358 </indexterm>
15359 <indexterm role="concept">
15360 <primary>expansion</primary>
15361 <secondary>LDAP authentication test</secondary>
15362 </indexterm>
15363 <indexterm role="concept">
15364 <primary><option>ldapauth</option> expansion condition</primary>
15365 </indexterm>
15366 This condition supports user authentication using LDAP. See section
15367 <xref linkend="SECTldap"/> for details of how to use LDAP in lookups and the syntax of
15368 queries. For this use, the query must contain a user name and password. The
15369 query itself is not used, and can be empty. The condition is true if the
15370 password is not empty, and the user name and password are accepted by the LDAP
15371 server. An empty password is rejected without calling LDAP because LDAP binds
15372 with an empty password are considered anonymous regardless of the username, and
15373 will succeed in most configurations. See chapter <xref linkend="CHAPSMTPAUTH"/> for details
15374 of SMTP authentication, and chapter <xref linkend="CHAPplaintext"/> for an example of how
15375 this can be used.
15376 </para>
15377 </listitem></varlistentry>
15378 <varlistentry>
15379 <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>
15380 <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>
15381 <listitem>
15382 <para>
15383 <indexterm role="concept">
15384 <primary>string</primary>
15385 <secondary>comparison</secondary>
15386 </indexterm>
15387 <indexterm role="concept">
15388 <primary>expansion</primary>
15389 <secondary>string comparison</secondary>
15390 </indexterm>
15391 <indexterm role="concept">
15392 <primary><option>le</option> expansion condition</primary>
15393 </indexterm>
15394 <indexterm role="concept">
15395 <primary><option>lei</option> expansion condition</primary>
15396 </indexterm>
15397 The two substrings are first expanded. The condition is true if the first
15398 string is lexically less than or equal to the second string. For <option>le</option> the
15399 comparison includes the case of letters, whereas for <option>lei</option> the comparison is
15400 case-independent.
15401 </para>
15402 </listitem></varlistentry>
15403 <varlistentry>
15404 <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>
15405 <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>
15406 <listitem>
15407 <para>
15408 <indexterm role="concept">
15409 <primary>string</primary>
15410 <secondary>comparison</secondary>
15411 </indexterm>
15412 <indexterm role="concept">
15413 <primary>expansion</primary>
15414 <secondary>string comparison</secondary>
15415 </indexterm>
15416 <indexterm role="concept">
15417 <primary><option>lt</option> expansion condition</primary>
15418 </indexterm>
15419 <indexterm role="concept">
15420 <primary><option>lti</option> expansion condition</primary>
15421 </indexterm>
15422 The two substrings are first expanded. The condition is true if the first
15423 string is lexically less than the second string. For <option>lt</option> the comparison
15424 includes the case of letters, whereas for <option>lti</option> the comparison is
15425 case-independent.
15426 </para>
15427 </listitem></varlistentry>
15428 <varlistentry>
15429 <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>
15430 <listitem>
15431 <para>
15432 <indexterm role="concept">
15433 <primary>expansion</primary>
15434 <secondary>regular expression comparison</secondary>
15435 </indexterm>
15436 <indexterm role="concept">
15437 <primary>regular expressions</primary>
15438 <secondary>match in expanded string</secondary>
15439 </indexterm>
15440 <indexterm role="concept">
15441 <primary><option>match</option> expansion condition</primary>
15442 </indexterm>
15443 The two substrings are first expanded. The second is then treated as a regular
15444 expression and applied to the first. Because of the pre-expansion, if the
15445 regular expression contains dollar, or backslash characters, they must be
15446 escaped. Care must also be taken if the regular expression contains braces
15447 (curly brackets). A closing brace must be escaped so that it is not taken as a
15448 premature termination of &lt;<emphasis>string2</emphasis>&gt;. The easiest approach is to use the
15449 <literal>\N</literal> feature to disable expansion of the regular expression.
15450 For example,
15451 </para>
15452 <literallayout class="monospaced">
15453 ${if match {$local_part}{\N^\d{3}\N} ...
15454 </literallayout>
15455 <para>
15456 If the whole expansion string is in double quotes, further escaping of
15457 backslashes is also required.
15458 </para>
15459 <para>
15460 The condition is true if the regular expression match succeeds.
15461 The regular expression is not required to begin with a circumflex
15462 metacharacter, but if there is no circumflex, the expression is not anchored,
15463 and it may match anywhere in the subject, not just at the start. If you want
15464 the pattern to match at the end of the subject, you must include the <literal>$</literal>
15465 metacharacter at an appropriate point.
15466 </para>
15467 <para>
15468 <indexterm role="concept">
15469 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
15470 <secondary>in <option>if</option> expansion</secondary>
15471 </indexterm>
15472 At the start of an <option>if</option> expansion the values of the numeric variable
15473 substitutions <varname>$1</varname> etc. are remembered. Obeying a <option>match</option> condition that
15474 succeeds causes them to be reset to the substrings of that condition and they
15475 will have these values during the expansion of the success string. At the end
15476 of the <option>if</option> expansion, the previous values are restored. After testing a
15477 combination of conditions using <option>or</option>, the subsequent values of the numeric
15478 variables are those of the condition that succeeded.
15479 </para>
15480 </listitem></varlistentry>
15481 <varlistentry>
15482 <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>
15483 <listitem>
15484 <para>
15485 <indexterm role="concept">
15486 <primary><option>match_address</option> expansion condition</primary>
15487 </indexterm>
15488 See <emphasis role="bold">match_local_part</emphasis>.
15489 </para>
15490 </listitem></varlistentry>
15491 <varlistentry>
15492 <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>
15493 <listitem>
15494 <para>
15495 <indexterm role="concept">
15496 <primary><option>match_domain</option> expansion condition</primary>
15497 </indexterm>
15498 See <emphasis role="bold">match_local_part</emphasis>.
15499 </para>
15500 </listitem></varlistentry>
15501 <varlistentry>
15502 <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>
15503 <listitem>
15504 <para>
15505 <indexterm role="concept">
15506 <primary><option>match_ip</option> expansion condition</primary>
15507 </indexterm>
15508 This condition matches an IP address to a list of IP address patterns. It must
15509 be followed by two argument strings. The first (after expansion) must be an IP
15510 address or an empty string. The second (after expansion) is a restricted host
15511 list that can match only an IP address, not a host name. For example:
15512 </para>
15513 <literallayout class="monospaced">
15514 ${if match_ip{$sender_host_address}{1.2.3.4:5.6.7.8}{...}{...}}
15515 </literallayout>
15516 <para>
15517 The specific types of host list item that are permitted in the list are:
15518 </para>
15519 <itemizedlist>
15520 <listitem>
15521 <para>
15522 An IP address, optionally with a CIDR mask.
15523 </para>
15524 </listitem>
15525 <listitem>
15526 <para>
15527 A single asterisk, which matches any IP address.
15528 </para>
15529 </listitem>
15530 <listitem>
15531 <para>
15532 An empty item, which matches only if the IP address is empty. This could be
15533 useful for testing for a locally submitted message or one from specific hosts
15534 in a single test such as
15535 </para>
15536 <literallayout class="monospaced">
15537   ${if match_ip{$sender_host_address}{:4.3.2.1:...}{...}{...}}
15538 </literallayout>
15539 <para>
15540 where the first item in the list is the empty string.
15541 </para>
15542 </listitem>
15543 <listitem>
15544 <para>
15545 The item @[] matches any of the local host&#x2019;s interface addresses.
15546 </para>
15547 </listitem>
15548 <listitem>
15549 <para>
15550 Single-key lookups are assumed to be like <quote>net-</quote> style lookups in host lists,
15551 even if <literal>net-</literal> is not specified. There is never any attempt to turn the IP
15552 address into a host name. The most common type of linear search for
15553 <emphasis role="bold">match_ip</emphasis> is likely to be <emphasis role="bold">iplsearch</emphasis>, in which the file can contain CIDR
15554 masks. For example:
15555 </para>
15556 <literallayout class="monospaced">
15557   ${if match_ip{$sender_host_address}{iplsearch;/some/file}...
15558 </literallayout>
15559 <para>
15560 It is of course possible to use other kinds of lookup, and in such a case, you
15561 do need to specify the <literal>net-</literal> prefix if you want to specify a specific
15562 address mask, for example:
15563 </para>
15564 <literallayout class="monospaced">
15565   ${if match_ip{$sender_host_address}{net24-dbm;/some/file}...
15566 </literallayout>
15567 <para>
15568 However, unless you are combining a <option>match_ip</option> condition with others, it is
15569 just as easy to use the fact that a lookup is itself a condition, and write:
15570 </para>
15571 <literallayout class="monospaced">
15572   ${lookup{${mask:$sender_host_address/24}}dbm{/a/file}...
15573 </literallayout>
15574 </listitem>
15575 </itemizedlist>
15576 <para>
15577 Consult section <xref linkend="SECThoslispatip"/> for further details of these patterns.
15578 </para>
15579 </listitem></varlistentry>
15580 <varlistentry>
15581 <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>
15582 <listitem>
15583 <para>
15584 <indexterm role="concept">
15585 <primary>domain list</primary>
15586 <secondary>in expansion condition</secondary>
15587 </indexterm>
15588 <indexterm role="concept">
15589 <primary>address list</primary>
15590 <secondary>in expansion condition</secondary>
15591 </indexterm>
15592 <indexterm role="concept">
15593 <primary>local part</primary>
15594 <secondary>list, in expansion condition</secondary>
15595 </indexterm>
15596 <indexterm role="concept">
15597 <primary><option>match_local_part</option> expansion condition</primary>
15598 </indexterm>
15599 This condition, together with <option>match_address</option> and <option>match_domain</option>, make it
15600 possible to test domain, address, and local part lists within expansions. Each
15601 condition requires two arguments: an item and a list to match. A trivial
15602 example is:
15603 </para>
15604 <literallayout class="monospaced">
15605 ${if match_domain{a.b.c}{x.y.z:a.b.c:p.q.r}{yes}{no}}
15606 </literallayout>
15607 <para>
15608 In each case, the second argument may contain any of the allowable items for a
15609 list of the appropriate type. Also, because the second argument (after
15610 expansion) is a standard form of list, it is possible to refer to a named list.
15611 Thus, you can use conditions like this:
15612 </para>
15613 <literallayout class="monospaced">
15614 ${if match_domain{$domain}{+local_domains}{...
15615 </literallayout>
15616 <para>
15617 <indexterm role="concept">
15618 <primary><literal>+caseful</literal></primary>
15619 </indexterm>
15620 For address lists, the matching starts off caselessly, but the <literal>+caseful</literal>
15621 item can be used, as in all address lists, to cause subsequent items to
15622 have their local parts matched casefully. Domains are always matched
15623 caselessly.
15624 </para>
15625 <para revisionflag="changed">
15626 Note that &lt;<emphasis>string2</emphasis>&gt; is not itself subject to string expansion, unless
15627 Exim was built with the EXPAND_LISTMATCH_RHS option.
15628 </para>
15629 <para>
15630 <emphasis role="bold">Note</emphasis>: Host lists are <emphasis>not</emphasis> supported in this way. This is because
15631 hosts have two identities: a name and an IP address, and it is not clear
15632 how to specify cleanly how such a test would work. However, IP addresses can be
15633 matched using <option>match_ip</option>.
15634 </para>
15635 </listitem></varlistentry>
15636 <varlistentry>
15637 <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>
15638 <listitem>
15639 <para>
15640 <indexterm role="concept">
15641 <primary>PAM authentication</primary>
15642 </indexterm>
15643 <indexterm role="concept">
15644 <primary>AUTH</primary>
15645 <secondary>with PAM</secondary>
15646 </indexterm>
15647 <indexterm role="concept">
15648 <primary>Solaris</primary>
15649 <secondary>PAM support</secondary>
15650 </indexterm>
15651 <indexterm role="concept">
15652 <primary>expansion</primary>
15653 <secondary>PAM authentication test</secondary>
15654 </indexterm>
15655 <indexterm role="concept">
15656 <primary><option>pam</option> expansion condition</primary>
15657 </indexterm>
15658 <emphasis>Pluggable Authentication Modules</emphasis>
15659 (<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
15660 available in the latest releases of Solaris and in some GNU/Linux
15661 distributions. The Exim support, which is intended for use in conjunction with
15662 the SMTP AUTH command, is available only if Exim is compiled with
15663 </para>
15664 <literallayout class="monospaced">
15665 SUPPORT_PAM=yes
15666 </literallayout>
15667 <para>
15668 in <filename>Local/Makefile</filename>. You probably need to add <option>-lpam</option> to EXTRALIBS, and
15669 in some releases of GNU/Linux <option>-ldl</option> is also needed.
15670 </para>
15671 <para>
15672 The argument string is first expanded, and the result must be a
15673 colon-separated list of strings. Leading and trailing white space is ignored.
15674 The PAM module is initialized with the service name <quote>exim</quote> and the user name
15675 taken from the first item in the colon-separated data string (&lt;<emphasis>string1</emphasis>&gt;).
15676 The remaining items in the data string are passed over in response to requests
15677 from the authentication function. In the simple case there will only be one
15678 request, for a password, so the data consists of just two strings.
15679 </para>
15680 <para>
15681 There can be problems if any of the strings are permitted to contain colon
15682 characters. In the usual way, these have to be doubled to avoid being taken as
15683 separators. If the data is being inserted from a variable, the <option>sg</option> expansion
15684 item can be used to double any existing colons. For example, the configuration
15685 of a LOGIN authenticator might contain this setting:
15686 </para>
15687 <literallayout class="monospaced">
15688 server_condition = ${if pam{$auth1:${sg{$auth2}{:}{::}}}}
15689 </literallayout>
15690 <para>
15691 For a PLAIN authenticator you could use:
15692 </para>
15693 <literallayout class="monospaced">
15694 server_condition = ${if pam{$auth2:${sg{$auth3}{:}{::}}}}
15695 </literallayout>
15696 <para>
15697 In some operating systems, PAM authentication can be done only from a process
15698 running as root. Since Exim is running as the Exim user when receiving
15699 messages, this means that PAM cannot be used directly in those systems.
15700 A patched version of the <emphasis>pam_unix</emphasis> module that comes with the
15701 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>.
15702 The patched module allows one special uid/gid combination, in addition to root,
15703 to authenticate. If you build the patched module to allow the Exim user and
15704 group, PAM can then be used from an Exim authenticator.
15705 </para>
15706 </listitem></varlistentry>
15707 <varlistentry>
15708 <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>
15709 <listitem>
15710 <para>
15711 <indexterm role="concept">
15712 <primary><emphasis>pwcheck</emphasis> daemon</primary>
15713 </indexterm>
15714 <indexterm role="concept">
15715 <primary>Cyrus</primary>
15716 </indexterm>
15717 <indexterm role="concept">
15718 <primary>expansion</primary>
15719 <secondary><emphasis>pwcheck</emphasis> authentication test</secondary>
15720 </indexterm>
15721 <indexterm role="concept">
15722 <primary><option>pwcheck</option> expansion condition</primary>
15723 </indexterm>
15724 This condition supports user authentication using the Cyrus <emphasis>pwcheck</emphasis> daemon.
15725 This is one way of making it possible for passwords to be checked by a process
15726 that is not running as root. <emphasis role="bold">Note</emphasis>: The use of <emphasis>pwcheck</emphasis> is now
15727 deprecated. Its replacement is <emphasis>saslauthd</emphasis> (see below).
15728 </para>
15729 <para>
15730 The pwcheck support is not included in Exim by default. You need to specify
15731 the location of the pwcheck daemon&#x2019;s socket in <filename>Local/Makefile</filename> before
15732 building Exim. For example:
15733 </para>
15734 <literallayout class="monospaced">
15735 CYRUS_PWCHECK_SOCKET=/var/pwcheck/pwcheck
15736 </literallayout>
15737 <para>
15738 You do not need to install the full Cyrus software suite in order to use
15739 the pwcheck daemon. You can compile and install just the daemon alone
15740 from the Cyrus SASL library. Ensure that <emphasis>exim</emphasis> is the only user that has
15741 access to the <filename>/var/pwcheck</filename> directory.
15742 </para>
15743 <para>
15744 The <option>pwcheck</option> condition takes one argument, which must be the user name and
15745 password, separated by a colon. For example, in a LOGIN authenticator
15746 configuration, you might have this:
15747 </para>
15748 <literallayout class="monospaced">
15749 server_condition = ${if pwcheck{$auth1:$auth2}}
15750 </literallayout>
15751 <para>
15752 Again, for a PLAIN authenticator configuration, this would be:
15753 </para>
15754 <literallayout class="monospaced">
15755 server_condition = ${if pwcheck{$auth2:$auth3}}
15756 </literallayout>
15757 </listitem></varlistentry>
15758 <varlistentry>
15759 <term><emphasis role="bold">queue_running</emphasis></term>
15760 <listitem>
15761 <para>
15762 <indexterm role="concept">
15763 <primary>queue runner</primary>
15764 <secondary>detecting when delivering from</secondary>
15765 </indexterm>
15766 <indexterm role="concept">
15767 <primary>expansion</primary>
15768 <secondary>queue runner test</secondary>
15769 </indexterm>
15770 <indexterm role="concept">
15771 <primary><option>queue_running</option> expansion condition</primary>
15772 </indexterm>
15773 This condition, which has no data, is true during delivery attempts that are
15774 initiated by queue runner processes, and false otherwise.
15775 </para>
15776 </listitem></varlistentry>
15777 <varlistentry>
15778 <term><emphasis role="bold">radius&nbsp;{</emphasis>&lt;<emphasis>authentication&nbsp;string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15779 <listitem>
15780 <para>
15781 <indexterm role="concept">
15782 <primary>Radius</primary>
15783 </indexterm>
15784 <indexterm role="concept">
15785 <primary>expansion</primary>
15786 <secondary>Radius authentication</secondary>
15787 </indexterm>
15788 <indexterm role="concept">
15789 <primary><option>radius</option> expansion condition</primary>
15790 </indexterm>
15791 Radius authentication (RFC 2865) is supported in a similar way to PAM. You must
15792 set RADIUS_CONFIG_FILE in <filename>Local/Makefile</filename> to specify the location of
15793 the Radius client configuration file in order to build Exim with Radius
15794 support.
15795 </para>
15796 <para>
15797 With just that one setting, Exim expects to be linked with the <option>radiusclient</option>
15798 library, using the original API. If you are using release 0.4.0 or later of
15799 this library, you need to set
15800 </para>
15801 <literallayout class="monospaced">
15802 RADIUS_LIB_TYPE=RADIUSCLIENTNEW
15803 </literallayout>
15804 <para>
15805 in <filename>Local/Makefile</filename> when building Exim. You can also link Exim with the
15806 <option>libradius</option> library that comes with FreeBSD. To do this, set
15807 </para>
15808 <literallayout class="monospaced">
15809 RADIUS_LIB_TYPE=RADLIB
15810 </literallayout>
15811 <para>
15812 in <filename>Local/Makefile</filename>, in addition to setting RADIUS_CONFIGURE_FILE.
15813 You may also have to supply a suitable setting in EXTRALIBS so that the
15814 Radius library can be found when Exim is linked.
15815 </para>
15816 <para>
15817 The string specified by RADIUS_CONFIG_FILE is expanded and passed to the
15818 Radius client library, which calls the Radius server. The condition is true if
15819 the authentication is successful. For example:
15820 </para>
15821 <literallayout class="monospaced">
15822 server_condition = ${if radius{&lt;arguments&gt;}}
15823 </literallayout>
15824 </listitem></varlistentry>
15825 <varlistentry>
15826 <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>
15827 <listitem>
15828 <para>
15829 <indexterm role="concept">
15830 <primary><emphasis>saslauthd</emphasis> daemon</primary>
15831 </indexterm>
15832 <indexterm role="concept">
15833 <primary>Cyrus</primary>
15834 </indexterm>
15835 <indexterm role="concept">
15836 <primary>expansion</primary>
15837 <secondary><emphasis>saslauthd</emphasis> authentication test</secondary>
15838 </indexterm>
15839 <indexterm role="concept">
15840 <primary><option>saslauthd</option> expansion condition</primary>
15841 </indexterm>
15842 This condition supports user authentication using the Cyrus <emphasis>saslauthd</emphasis>
15843 daemon. This replaces the older <emphasis>pwcheck</emphasis> daemon, which is now deprecated.
15844 Using this daemon is one way of making it possible for passwords to be checked
15845 by a process that is not running as root.
15846 </para>
15847 <para>
15848 The saslauthd support is not included in Exim by default. You need to specify
15849 the location of the saslauthd daemon&#x2019;s socket in <filename>Local/Makefile</filename> before
15850 building Exim. For example:
15851 </para>
15852 <literallayout class="monospaced">
15853 CYRUS_SASLAUTHD_SOCKET=/var/state/saslauthd/mux
15854 </literallayout>
15855 <para>
15856 You do not need to install the full Cyrus software suite in order to use
15857 the saslauthd daemon. You can compile and install just the daemon alone
15858 from the Cyrus SASL library.
15859 </para>
15860 <para>
15861 Up to four arguments can be supplied to the <option>saslauthd</option> condition, but only
15862 two are mandatory. For example:
15863 </para>
15864 <literallayout class="monospaced">
15865 server_condition = ${if saslauthd{{$auth1}{$auth2}}}
15866 </literallayout>
15867 <para>
15868 The service and the realm are optional (which is why the arguments are enclosed
15869 in their own set of braces). For details of the meaning of the service and
15870 realm, and how to run the daemon, consult the Cyrus documentation.
15871 </para>
15872 </listitem></varlistentry>
15873 </variablelist>
15874 </section>
15875 <section id="SECID84">
15876 <title>Combining expansion conditions</title>
15877 <para>
15878 <indexterm role="concept">
15879 <primary>expansion</primary>
15880 <secondary>combining conditions</secondary>
15881 </indexterm>
15882 Several conditions can be tested at once by combining them using the <option>and</option>
15883 and <option>or</option> combination conditions. Note that <option>and</option> and <option>or</option> are complete
15884 conditions on their own, and precede their lists of sub-conditions. Each
15885 sub-condition must be enclosed in braces within the overall braces that contain
15886 the list. No repetition of <option>if</option> is used.
15887 </para>
15888 <variablelist>
15889 <varlistentry>
15890 <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>
15891 <listitem>
15892 <para>
15893 <indexterm role="concept">
15894 <primary><quote>or</quote> expansion condition</primary>
15895 </indexterm>
15896 <indexterm role="concept">
15897 <primary>expansion</primary>
15898 <secondary><quote>or</quote> of conditions</secondary>
15899 </indexterm>
15900 The sub-conditions are evaluated from left to right. The condition is true if
15901 any one of the sub-conditions is true.
15902 For example,
15903 </para>
15904 <literallayout class="monospaced">
15905 ${if or {{eq{$local_part}{spqr}}{eq{$domain}{testing.com}}}...
15906 </literallayout>
15907 <para>
15908 When a true sub-condition is found, the following ones are parsed but not
15909 evaluated. If there are several <quote>match</quote> sub-conditions the values of the
15910 numeric variables afterwards are taken from the first one that succeeds.
15911 </para>
15912 </listitem></varlistentry>
15913 <varlistentry>
15914 <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>
15915 <listitem>
15916 <para>
15917 <indexterm role="concept">
15918 <primary><quote>and</quote> expansion condition</primary>
15919 </indexterm>
15920 <indexterm role="concept">
15921 <primary>expansion</primary>
15922 <secondary><quote>and</quote> of conditions</secondary>
15923 </indexterm>
15924 The sub-conditions are evaluated from left to right. The condition is true if
15925 all of the sub-conditions are true. If there are several <quote>match</quote>
15926 sub-conditions, the values of the numeric variables afterwards are taken from
15927 the last one. When a false sub-condition is found, the following ones are
15928 parsed but not evaluated.
15929 </para>
15930 </listitem></varlistentry>
15931 </variablelist>
15932 <para>
15933 <indexterm role="concept" startref="IIDexpcond" class="endofrange"/>
15934 </para>
15935 </section>
15936 <section id="SECTexpvar">
15937 <title>Expansion variables</title>
15938 <para>
15939 <indexterm role="concept">
15940 <primary>expansion</primary>
15941 <secondary>variables, list of</secondary>
15942 </indexterm>
15943 This section contains an alphabetical list of all the expansion variables. Some
15944 of them are available only when Exim is compiled with specific options such as
15945 support for TLS or the content scanning extension.
15946 </para>
15947 <variablelist>
15948 <varlistentry>
15949 <term><varname>$0</varname>, <varname>$1</varname>, etc</term>
15950 <listitem>
15951 <para>
15952 <indexterm role="concept">
15953 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
15954 </indexterm>
15955 When a <option>match</option> expansion condition succeeds, these variables contain the
15956 captured substrings identified by the regular expression during subsequent
15957 processing of the success string of the containing <option>if</option> expansion item.
15958 However, they do not retain their values afterwards; in fact, their previous
15959 values are restored at the end of processing an <option>if</option> item. The numerical
15960 variables may also be set externally by some other matching process which
15961 precedes the expansion of the string. For example, the commands available in
15962 Exim filter files include an <option>if</option> command with its own regular expression
15963 matching condition.
15964 </para>
15965 </listitem></varlistentry>
15966 <varlistentry>
15967 <term><varname>$acl_c...</varname></term>
15968 <listitem>
15969 <para>
15970 Values can be placed in these variables by the <option>set</option> modifier in an ACL. They
15971 can be given any name that starts with <varname>$acl_c</varname> and is at least six characters
15972 long, but the sixth character must be either a digit or an underscore. For
15973 example: <varname>$acl_c5</varname>, <varname>$acl_c_mycount</varname>. The values of the <varname>$acl_c...</varname>
15974 variables persist throughout the lifetime of an SMTP connection. They can be
15975 used to pass information between ACLs and between different invocations of the
15976 same ACL. When a message is received, the values of these variables are saved
15977 with the message, and can be accessed by filters, routers, and transports
15978 during subsequent delivery.
15979 </para>
15980 </listitem></varlistentry>
15981 <varlistentry>
15982 <term><varname>$acl_m...</varname></term>
15983 <listitem>
15984 <para>
15985 These variables are like the <varname>$acl_c...</varname> variables, except that their values
15986 are reset after a message has been received. Thus, if several messages are
15987 received in one SMTP connection, <varname>$acl_m...</varname> values are not passed on from one
15988 message to the next, as <varname>$acl_c...</varname> values are. The <varname>$acl_m...</varname> variables are
15989 also reset by MAIL, RSET, EHLO, HELO, and after starting a TLS session. When a
15990 message is received, the values of these variables are saved with the message,
15991 and can be accessed by filters, routers, and transports during subsequent
15992 delivery.
15993 </para>
15994 </listitem></varlistentry>
15995 <varlistentry>
15996 <term><varname>$acl_verify_message</varname></term>
15997 <listitem>
15998 <para>
15999 <indexterm role="variable">
16000 <primary><varname>$acl_verify_message</varname></primary>
16001 </indexterm>
16002 After an address verification has failed, this variable contains the failure
16003 message. It retains its value for use in subsequent modifiers. The message can
16004 be preserved by coding like this:
16005 </para>
16006 <literallayout class="monospaced">
16007 warn !verify = sender
16008      set acl_m0 = $acl_verify_message
16009 </literallayout>
16010 <para>
16011 You can use <varname>$acl_verify_message</varname> during the expansion of the <option>message</option> or
16012 <option>log_message</option> modifiers, to include information about the verification
16013 failure.
16014 </para>
16015 </listitem></varlistentry>
16016 <varlistentry>
16017 <term><varname>$address_data</varname></term>
16018 <listitem>
16019 <para>
16020 <indexterm role="variable">
16021 <primary><varname>$address_data</varname></primary>
16022 </indexterm>
16023 This variable is set by means of the <option>address_data</option> option in routers. The
16024 value then remains with the address while it is processed by subsequent routers
16025 and eventually a transport. If the transport is handling multiple addresses,
16026 the value from the first address is used. See chapter <xref linkend="CHAProutergeneric"/>
16027 for more details. <emphasis role="bold">Note</emphasis>: The contents of <varname>$address_data</varname> are visible in
16028 user filter files.
16029 </para>
16030 <para>
16031 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify
16032 a recipient address, the final value is still in the variable for subsequent
16033 conditions and modifiers of the ACL statement. If routing the address caused it
16034 to be redirected to just one address, the child address is also routed as part
16035 of the verification, and in this case the final value of <varname>$address_data</varname> is
16036 from the child&#x2019;s routing.
16037 </para>
16038 <para>
16039 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
16040 sender address, the final value is also preserved, but this time in
16041 <varname>$sender_address_data</varname>, to distinguish it from data from a recipient
16042 address.
16043 </para>
16044 <para>
16045 In both cases (recipient and sender verification), the value does not persist
16046 after the end of the current ACL statement. If you want to preserve
16047 these values for longer, you can save them in ACL variables.
16048 </para>
16049 </listitem></varlistentry>
16050 <varlistentry>
16051 <term><varname>$address_file</varname></term>
16052 <listitem>
16053 <para>
16054 <indexterm role="variable">
16055 <primary><varname>$address_file</varname></primary>
16056 </indexterm>
16057 When, as a result of aliasing, forwarding, or filtering, a message is directed
16058 to a specific file, this variable holds the name of the file when the transport
16059 is running. At other times, the variable is empty. For example, using the
16060 default configuration, if user <option>r2d2</option> has a <filename>.forward</filename> file containing
16061 </para>
16062 <literallayout class="monospaced">
16063 /home/r2d2/savemail
16064 </literallayout>
16065 <para>
16066 then when the <command>address_file</command> transport is running, <varname>$address_file</varname>
16067 contains the text string <literal>/home/r2d2/savemail</literal>.
16068 <indexterm role="concept">
16069 <primary>Sieve filter</primary>
16070 <secondary>value of <varname>$address_file</varname></secondary>
16071 </indexterm>
16072 For Sieve filters, the value may be <quote>inbox</quote> or a relative folder name. It is
16073 then up to the transport configuration to generate an appropriate absolute path
16074 to the relevant file.
16075 </para>
16076 </listitem></varlistentry>
16077 <varlistentry>
16078 <term><varname>$address_pipe</varname></term>
16079 <listitem>
16080 <para>
16081 <indexterm role="variable">
16082 <primary><varname>$address_pipe</varname></primary>
16083 </indexterm>
16084 When, as a result of aliasing or forwarding, a message is directed to a pipe,
16085 this variable holds the pipe command when the transport is running.
16086 </para>
16087 </listitem></varlistentry>
16088 <varlistentry>
16089 <term><varname>$auth1</varname> &ndash; <varname>$auth3</varname></term>
16090 <listitem>
16091 <para>
16092 <indexterm role="variable">
16093 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
16094 </indexterm>
16095 These variables are used in SMTP authenticators (see chapters
16096 <xref linkend="CHAPplaintext"/>&ndash;<xref linkend="CHAPspa"/>). Elsewhere, they are empty.
16097 </para>
16098 </listitem></varlistentry>
16099 <varlistentry>
16100 <term><varname>$authenticated_id</varname></term>
16101 <listitem>
16102 <para>
16103 <indexterm role="concept">
16104 <primary>authentication</primary>
16105 <secondary>id</secondary>
16106 </indexterm>
16107 <indexterm role="variable">
16108 <primary><varname>$authenticated_id</varname></primary>
16109 </indexterm>
16110 When a server successfully authenticates a client it may be configured to
16111 preserve some of the authentication information in the variable
16112 <varname>$authenticated_id</varname> (see chapter <xref linkend="CHAPSMTPAUTH"/>). For example, a
16113 user/password authenticator configuration might preserve the user name for use
16114 in the routers. Note that this is not the same information that is saved in
16115 <varname>$sender_host_authenticated</varname>.
16116 When a message is submitted locally (that is, not over a TCP connection)
16117 the value of <varname>$authenticated_id</varname> is normally the login name of the calling
16118 process. However, a trusted user can override this by means of the <option>-oMai</option>
16119 command line option.
16120 </para>
16121 </listitem></varlistentry>
16122 <varlistentry>
16123 <term><varname>$authenticated_sender</varname></term>
16124 <listitem>
16125 <para>
16126 <indexterm role="concept">
16127 <primary>sender</primary>
16128 <secondary>authenticated</secondary>
16129 </indexterm>
16130 <indexterm role="concept">
16131 <primary>authentication</primary>
16132 <secondary>sender</secondary>
16133 </indexterm>
16134 <indexterm role="concept">
16135 <primary>AUTH</primary>
16136 <secondary>on MAIL command</secondary>
16137 </indexterm>
16138 <indexterm role="variable">
16139 <primary><varname>$authenticated_sender</varname></primary>
16140 </indexterm>
16141 When acting as a server, Exim takes note of the AUTH= parameter on an incoming
16142 SMTP MAIL command if it believes the sender is sufficiently trusted, as
16143 described in section <xref linkend="SECTauthparamail"/>. Unless the data is the string
16144 <quote>&lt;&gt;</quote>, it is set as the authenticated sender of the message, and the value is
16145 available during delivery in the <varname>$authenticated_sender</varname> variable. If the
16146 sender is not trusted, Exim accepts the syntax of AUTH=, but ignores the data.
16147 </para>
16148 <para>
16149 <indexterm role="variable">
16150 <primary><varname>$qualify_domain</varname></primary>
16151 </indexterm>
16152 When a message is submitted locally (that is, not over a TCP connection), the
16153 value of <varname>$authenticated_sender</varname> is an address constructed from the login
16154 name of the calling process and <varname>$qualify_domain</varname>, except that a trusted user
16155 can override this by means of the <option>-oMas</option> command line option.
16156 </para>
16157 </listitem></varlistentry>
16158 <varlistentry>
16159 <term><varname>$authentication_failed</varname></term>
16160 <listitem>
16161 <para>
16162 <indexterm role="concept">
16163 <primary>authentication</primary>
16164 <secondary>failure</secondary>
16165 </indexterm>
16166 <indexterm role="variable">
16167 <primary><varname>$authentication_failed</varname></primary>
16168 </indexterm>
16169 This variable is set to <quote>1</quote> in an Exim server if a client issues an AUTH
16170 command that does not succeed. Otherwise it is set to <quote>0</quote>. This makes it
16171 possible to distinguish between <quote>did not try to authenticate</quote>
16172 (<varname>$sender_host_authenticated</varname> is empty and <varname>$authentication_failed</varname> is set to
16173 <quote>0</quote>) and <quote>tried to authenticate but failed</quote> (<varname>$sender_host_authenticated</varname>
16174 is empty and <varname>$authentication_failed</varname> is set to <quote>1</quote>). Failure includes any
16175 negative response to an AUTH command, including (for example) an attempt to use
16176 an undefined mechanism.
16177 </para>
16178 </listitem></varlistentry>
16179 <varlistentry revisionflag="changed">
16180 <term><varname>$av_failed</varname></term>
16181 <listitem>
16182 <para revisionflag="changed">
16183 <indexterm role="concept">
16184 <primary>content scanning</primary>
16185 <secondary>AV scanner failure</secondary>
16186 </indexterm>
16187 This variable is available when Exim is compiled with the content-scanning
16188 extension. It is set to <quote>0</quote> by default, but will be set to <quote>1</quote> if any
16189 problem occurs with the virus scanner (specified by <option>av_scanner</option>) during
16190 the ACL malware condition.
16191 </para>
16192 </listitem></varlistentry>
16193 <varlistentry>
16194 <term><varname>$body_linecount</varname></term>
16195 <listitem>
16196 <para>
16197 <indexterm role="concept">
16198 <primary>message body</primary>
16199 <secondary>line count</secondary>
16200 </indexterm>
16201 <indexterm role="concept">
16202 <primary>body of message</primary>
16203 <secondary>line count</secondary>
16204 </indexterm>
16205 <indexterm role="variable">
16206 <primary><varname>$body_linecount</varname></primary>
16207 </indexterm>
16208 When a message is being received or delivered, this variable contains the
16209 number of lines in the message&#x2019;s body. See also <varname>$message_linecount</varname>.
16210 </para>
16211 </listitem></varlistentry>
16212 <varlistentry>
16213 <term><varname>$body_zerocount</varname></term>
16214 <listitem>
16215 <para>
16216 <indexterm role="concept">
16217 <primary>message body</primary>
16218 <secondary>binary zero count</secondary>
16219 </indexterm>
16220 <indexterm role="concept">
16221 <primary>body of message</primary>
16222 <secondary>binary zero count</secondary>
16223 </indexterm>
16224 <indexterm role="concept">
16225 <primary>binary zero</primary>
16226 <secondary>in message body</secondary>
16227 </indexterm>
16228 <indexterm role="variable">
16229 <primary><varname>$body_zerocount</varname></primary>
16230 </indexterm>
16231 When a message is being received or delivered, this variable contains the
16232 number of binary zero bytes in the message&#x2019;s body.
16233 </para>
16234 </listitem></varlistentry>
16235 <varlistentry>
16236 <term><varname>$bounce_recipient</varname></term>
16237 <listitem>
16238 <para>
16239 <indexterm role="variable">
16240 <primary><varname>$bounce_recipient</varname></primary>
16241 </indexterm>
16242 This is set to the recipient address of a bounce message while Exim is creating
16243 it. It is useful if a customized bounce message text file is in use (see
16244 chapter <xref linkend="CHAPemsgcust"/>).
16245 </para>
16246 </listitem></varlistentry>
16247 <varlistentry>
16248 <term><varname>$bounce_return_size_limit</varname></term>
16249 <listitem>
16250 <para>
16251 <indexterm role="variable">
16252 <primary><varname>$bounce_return_size_limit</varname></primary>
16253 </indexterm>
16254 This contains the value set in the <option>bounce_return_size_limit</option> option, rounded
16255 up to a multiple of 1000. It is useful when a customized error message text
16256 file is in use (see chapter <xref linkend="CHAPemsgcust"/>).
16257 </para>
16258 </listitem></varlistentry>
16259 <varlistentry>
16260 <term><varname>$caller_gid</varname></term>
16261 <listitem>
16262 <para>
16263 <indexterm role="concept">
16264 <primary>gid (group id)</primary>
16265 <secondary>caller</secondary>
16266 </indexterm>
16267 <indexterm role="variable">
16268 <primary><varname>$caller_gid</varname></primary>
16269 </indexterm>
16270 The real group id under which the process that called Exim was running. This is
16271 not the same as the group id of the originator of a message (see
16272 <varname>$originator_gid</varname>). If Exim re-execs itself, this variable in the new
16273 incarnation normally contains the Exim gid.
16274 </para>
16275 </listitem></varlistentry>
16276 <varlistentry>
16277 <term><varname>$caller_uid</varname></term>
16278 <listitem>
16279 <para>
16280 <indexterm role="concept">
16281 <primary>uid (user id)</primary>
16282 <secondary>caller</secondary>
16283 </indexterm>
16284 <indexterm role="variable">
16285 <primary><varname>$caller_uid</varname></primary>
16286 </indexterm>
16287 The real user id under which the process that called Exim was running. This is
16288 not the same as the user id of the originator of a message (see
16289 <varname>$originator_uid</varname>). If Exim re-execs itself, this variable in the new
16290 incarnation normally contains the Exim uid.
16291 </para>
16292 </listitem></varlistentry>
16293 <varlistentry>
16294 <term><varname>$compile_date</varname></term>
16295 <listitem>
16296 <para>
16297 <indexterm role="variable">
16298 <primary><varname>$compile_date</varname></primary>
16299 </indexterm>
16300 The date on which the Exim binary was compiled.
16301 </para>
16302 </listitem></varlistentry>
16303 <varlistentry>
16304 <term><varname>$compile_number</varname></term>
16305 <listitem>
16306 <para>
16307 <indexterm role="variable">
16308 <primary><varname>$compile_number</varname></primary>
16309 </indexterm>
16310 The building process for Exim keeps a count of the number
16311 of times it has been compiled. This serves to distinguish different
16312 compilations of the same version of the program.
16313 </para>
16314 </listitem></varlistentry>
16315 <varlistentry>
16316 <term><varname>$demime_errorlevel</varname></term>
16317 <listitem>
16318 <para>
16319 <indexterm role="variable">
16320 <primary><varname>$demime_errorlevel</varname></primary>
16321 </indexterm>
16322 This variable is available when Exim is compiled with
16323 the content-scanning extension and the obsolete <option>demime</option> condition. For
16324 details, see section <xref linkend="SECTdemimecond"/>.
16325 </para>
16326 </listitem></varlistentry>
16327 <varlistentry>
16328 <term><varname>$demime_reason</varname></term>
16329 <listitem>
16330 <para>
16331 <indexterm role="variable">
16332 <primary><varname>$demime_reason</varname></primary>
16333 </indexterm>
16334 This variable is available when Exim is compiled with the
16335 content-scanning extension and the obsolete <option>demime</option> condition. For details,
16336 see section <xref linkend="SECTdemimecond"/>.
16337 </para>
16338 </listitem></varlistentry>
16339 <varlistentry>
16340 <term><varname>$dnslist_domain</varname></term>
16341 <term><varname>$dnslist_matched</varname></term>
16342 <term><varname>$dnslist_text</varname></term>
16343 <term><varname>$dnslist_value</varname></term>
16344 <listitem>
16345 <para>
16346 <indexterm role="variable">
16347 <primary><varname>$dnslist_domain</varname></primary>
16348 </indexterm>
16349 <indexterm role="variable">
16350 <primary><varname>$dnslist_matched</varname></primary>
16351 </indexterm>
16352 <indexterm role="variable">
16353 <primary><varname>$dnslist_text</varname></primary>
16354 </indexterm>
16355 <indexterm role="variable">
16356 <primary><varname>$dnslist_value</varname></primary>
16357 </indexterm>
16358 <indexterm role="concept">
16359 <primary>black list (DNS)</primary>
16360 </indexterm>
16361 When a DNS (black) list lookup succeeds, these variables are set to contain
16362 the following data from the lookup: the list&#x2019;s domain name, the key that was
16363 looked up, the contents of any associated TXT record, and the value from the
16364 main A record. See section <xref linkend="SECID204"/> for more details.
16365 </para>
16366 </listitem></varlistentry>
16367 <varlistentry>
16368 <term><varname>$domain</varname></term>
16369 <listitem>
16370 <para>
16371 <indexterm role="variable">
16372 <primary><varname>$domain</varname></primary>
16373 </indexterm>
16374 When an address is being routed, or delivered on its own, this variable
16375 contains the domain. Uppercase letters in the domain are converted into lower
16376 case for <varname>$domain</varname>.
16377 </para>
16378 <para>
16379 Global address rewriting happens when a message is received, so the value of
16380 <varname>$domain</varname> during routing and delivery is the value after rewriting. <varname>$domain</varname>
16381 is set during user filtering, but not during system filtering, because a
16382 message may have many recipients and the system filter is called just once.
16383 </para>
16384 <para>
16385 When more than one address is being delivered at once (for example, several
16386 RCPT commands in one SMTP delivery), <varname>$domain</varname> is set only if they all
16387 have the same domain. Transports can be restricted to handling only one domain
16388 at a time if the value of <varname>$domain</varname> is required at transport time &ndash; this is
16389 the default for local transports. For further details of the environment in
16390 which local transports are run, see chapter <xref linkend="CHAPenvironment"/>.
16391 </para>
16392 <para>
16393 <indexterm role="option">
16394 <primary><option>delay_warning_condition</option></primary>
16395 </indexterm>
16396 At the end of a delivery, if all deferred addresses have the same domain, it is
16397 set in <varname>$domain</varname> during the expansion of <option>delay_warning_condition</option>.
16398 </para>
16399 <para>
16400 The <varname>$domain</varname> variable is also used in some other circumstances:
16401 </para>
16402 <itemizedlist>
16403 <listitem>
16404 <para>
16405 When an ACL is running for a RCPT command, <varname>$domain</varname> contains the domain of
16406 the recipient address. The domain of the <emphasis>sender</emphasis> address is in
16407 <varname>$sender_address_domain</varname> at both MAIL time and at RCPT time. <varname>$domain</varname> is not
16408 normally set during the running of the MAIL ACL. However, if the sender address
16409 is verified with a callout during the MAIL ACL, the sender domain is placed in
16410 <varname>$domain</varname> during the expansions of <option>hosts</option>, <option>interface</option>, and <option>port</option> in
16411 the <command>smtp</command> transport.
16412 </para>
16413 </listitem>
16414 <listitem>
16415 <para>
16416 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
16417 <varname>$domain</varname> contains the domain portion of the address that is being rewritten;
16418 it can be used in the expansion of the replacement address, for example, to
16419 rewrite domains by file lookup.
16420 </para>
16421 </listitem>
16422 <listitem>
16423 <para>
16424 With one important exception, whenever a domain list is being scanned,
16425 <varname>$domain</varname> contains the subject domain. <emphasis role="bold">Exception</emphasis>: When a domain list in
16426 a <option>sender_domains</option> condition in an ACL is being processed, the subject domain
16427 is in <varname>$sender_address_domain</varname> and not in <varname>$domain</varname>. It works this way so
16428 that, in a RCPT ACL, the sender domain list can be dependent on the
16429 recipient domain (which is what is in <varname>$domain</varname> at this time).
16430 </para>
16431 </listitem>
16432 <listitem>
16433 <para>
16434 <indexterm role="concept">
16435 <primary>ETRN</primary>
16436 <secondary>value of <varname>$domain</varname></secondary>
16437 </indexterm>
16438 <indexterm role="option">
16439 <primary><option>smtp_etrn_command</option></primary>
16440 </indexterm>
16441 When the <option>smtp_etrn_command</option> option is being expanded, <varname>$domain</varname> contains
16442 the complete argument of the ETRN command (see section <xref linkend="SECTETRN"/>).
16443 </para>
16444 </listitem>
16445 </itemizedlist>
16446 </listitem></varlistentry>
16447 <varlistentry>
16448 <term><varname>$domain_data</varname></term>
16449 <listitem>
16450 <para>
16451 <indexterm role="variable">
16452 <primary><varname>$domain_data</varname></primary>
16453 </indexterm>
16454 When the <option>domains</option> option on a router matches a domain by
16455 means of a lookup, the data read by the lookup is available during the running
16456 of the router as <varname>$domain_data</varname>. In addition, if the driver routes the
16457 address to a transport, the value is available in that transport. If the
16458 transport is handling multiple addresses, the value from the first address is
16459 used.
16460 </para>
16461 <para>
16462 <varname>$domain_data</varname> is also set when the <option>domains</option> condition in an ACL matches a
16463 domain by means of a lookup. The data read by the lookup is available during
16464 the rest of the ACL statement. In all other situations, this variable expands
16465 to nothing.
16466 </para>
16467 </listitem></varlistentry>
16468 <varlistentry>
16469 <term><varname>$exim_gid</varname></term>
16470 <listitem>
16471 <para>
16472 <indexterm role="variable">
16473 <primary><varname>$exim_gid</varname></primary>
16474 </indexterm>
16475 This variable contains the numerical value of the Exim group id.
16476 </para>
16477 </listitem></varlistentry>
16478 <varlistentry>
16479 <term><varname>$exim_path</varname></term>
16480 <listitem>
16481 <para>
16482 <indexterm role="variable">
16483 <primary><varname>$exim_path</varname></primary>
16484 </indexterm>
16485 This variable contains the path to the Exim binary.
16486 </para>
16487 </listitem></varlistentry>
16488 <varlistentry>
16489 <term><varname>$exim_uid</varname></term>
16490 <listitem>
16491 <para>
16492 <indexterm role="variable">
16493 <primary><varname>$exim_uid</varname></primary>
16494 </indexterm>
16495 This variable contains the numerical value of the Exim user id.
16496 </para>
16497 </listitem></varlistentry>
16498 <varlistentry>
16499 <term><varname>$found_extension</varname></term>
16500 <listitem>
16501 <para>
16502 <indexterm role="variable">
16503 <primary><varname>$found_extension</varname></primary>
16504 </indexterm>
16505 This variable is available when Exim is compiled with the
16506 content-scanning extension and the obsolete <option>demime</option> condition. For details,
16507 see section <xref linkend="SECTdemimecond"/>.
16508 </para>
16509 </listitem></varlistentry>
16510 <varlistentry>
16511 <term><varname>$header_</varname>&lt;<emphasis>name</emphasis>&gt;</term>
16512 <listitem>
16513 <para>
16514 This is not strictly an expansion variable. It is expansion syntax for
16515 inserting the message header line with the given name. Note that the name must
16516 be terminated by colon or white space, because it may contain a wide variety of
16517 characters. Note also that braces must <emphasis>not</emphasis> be used.
16518 </para>
16519 </listitem></varlistentry>
16520 <varlistentry>
16521 <term><varname>$home</varname></term>
16522 <listitem>
16523 <para>
16524 <indexterm role="variable">
16525 <primary><varname>$home</varname></primary>
16526 </indexterm>
16527 When the <option>check_local_user</option> option is set for a router, the user&#x2019;s home
16528 directory is placed in <varname>$home</varname> when the check succeeds. In particular, this
16529 means it is set during the running of users&#x2019; filter files. A router may also
16530 explicitly set a home directory for use by a transport; this can be overridden
16531 by a setting on the transport itself.
16532 </para>
16533 <para>
16534 When running a filter test via the <option>-bf</option> option, <varname>$home</varname> is set to the value
16535 of the environment variable HOME.
16536 </para>
16537 </listitem></varlistentry>
16538 <varlistentry>
16539 <term><varname>$host</varname></term>
16540 <listitem>
16541 <para>
16542 <indexterm role="variable">
16543 <primary><varname>$host</varname></primary>
16544 </indexterm>
16545 If a router assigns an address to a transport (any transport), and passes a
16546 list of hosts with the address, the value of <varname>$host</varname> when the transport starts
16547 to run is the name of the first host on the list. Note that this applies both
16548 to local and remote transports.
16549 </para>
16550 <para>
16551 <indexterm role="concept">
16552 <primary>transport</primary>
16553 <secondary>filter</secondary>
16554 </indexterm>
16555 <indexterm role="concept">
16556 <primary>filter</primary>
16557 <secondary>transport filter</secondary>
16558 </indexterm>
16559 For the <command>smtp</command> transport, if there is more than one host, the value of
16560 <varname>$host</varname> changes as the transport works its way through the list. In
16561 particular, when the <command>smtp</command> transport is expanding its options for encryption
16562 using TLS, or for specifying a transport filter (see chapter
16563 <xref linkend="CHAPtransportgeneric"/>), <varname>$host</varname> contains the name of the host to which it
16564 is connected.
16565 </para>
16566 <para>
16567 When used in the client part of an authenticator configuration (see chapter
16568 <xref linkend="CHAPSMTPAUTH"/>), <varname>$host</varname> contains the name of the server to which the
16569 client is connected.
16570 </para>
16571 </listitem></varlistentry>
16572 <varlistentry>
16573 <term><varname>$host_address</varname></term>
16574 <listitem>
16575 <para>
16576 <indexterm role="variable">
16577 <primary><varname>$host_address</varname></primary>
16578 </indexterm>
16579 This variable is set to the remote host&#x2019;s IP address whenever <varname>$host</varname> is set
16580 for a remote connection. It is also set to the IP address that is being checked
16581 when the <option>ignore_target_hosts</option> option is being processed.
16582 </para>
16583 </listitem></varlistentry>
16584 <varlistentry>
16585 <term><varname>$host_data</varname></term>
16586 <listitem>
16587 <para>
16588 <indexterm role="variable">
16589 <primary><varname>$host_data</varname></primary>
16590 </indexterm>
16591 If a <option>hosts</option> condition in an ACL is satisfied by means of a lookup, the
16592 result of the lookup is made available in the <varname>$host_data</varname> variable. This
16593 allows you, for example, to do things like this:
16594 </para>
16595 <literallayout class="monospaced">
16596 deny  hosts = net-lsearch;/some/file
16597 message = $host_data
16598 </literallayout>
16599 </listitem></varlistentry>
16600 <varlistentry>
16601 <term><varname>$host_lookup_deferred</varname></term>
16602 <listitem>
16603 <para>
16604 <indexterm role="concept">
16605 <primary>host name</primary>
16606 <secondary>lookup, failure of</secondary>
16607 </indexterm>
16608 <indexterm role="variable">
16609 <primary><varname>$host_lookup_deferred</varname></primary>
16610 </indexterm>
16611 This variable normally contains <quote>0</quote>, as does <varname>$host_lookup_failed</varname>. When a
16612 message comes from a remote host and there is an attempt to look up the host&#x2019;s
16613 name from its IP address, and the attempt is not successful, one of these
16614 variables is set to <quote>1</quote>.
16615 </para>
16616 <itemizedlist>
16617 <listitem>
16618 <para>
16619 If the lookup receives a definite negative response (for example, a DNS lookup
16620 succeeded, but no records were found), <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
16621 </para>
16622 </listitem>
16623 <listitem>
16624 <para>
16625 If there is any kind of problem during the lookup, such that Exim cannot
16626 tell whether or not the host name is defined (for example, a timeout for a DNS
16627 lookup), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>.
16628 </para>
16629 </listitem>
16630 </itemizedlist>
16631 <para>
16632 Looking up a host&#x2019;s name from its IP address consists of more than just a
16633 single reverse lookup. Exim checks that a forward lookup of at least one of the
16634 names it receives from a reverse lookup yields the original IP address. If this
16635 is not the case, Exim does not accept the looked up name(s), and
16636 <varname>$host_lookup_failed</varname> is set to <quote>1</quote>. Thus, being able to find a name from an
16637 IP address (for example, the existence of a PTR record in the DNS) is not
16638 sufficient on its own for the success of a host name lookup. If the reverse
16639 lookup succeeds, but there is a lookup problem such as a timeout when checking
16640 the result, the name is not accepted, and <varname>$host_lookup_deferred</varname> is set to
16641 <quote>1</quote>. See also <varname>$sender_host_name</varname>.
16642 </para>
16643 </listitem></varlistentry>
16644 <varlistentry>
16645 <term><varname>$host_lookup_failed</varname></term>
16646 <listitem>
16647 <para>
16648 <indexterm role="variable">
16649 <primary><varname>$host_lookup_failed</varname></primary>
16650 </indexterm>
16651 See <varname>$host_lookup_deferred</varname>.
16652 </para>
16653 </listitem></varlistentry>
16654 <varlistentry>
16655 <term><varname>$inode</varname></term>
16656 <listitem>
16657 <para>
16658 <indexterm role="variable">
16659 <primary><varname>$inode</varname></primary>
16660 </indexterm>
16661 The only time this variable is set is while expanding the <option>directory_file</option>
16662 option in the <command>appendfile</command> transport. The variable contains the inode number
16663 of the temporary file which is about to be renamed. It can be used to construct
16664 a unique name for the file.
16665 </para>
16666 </listitem></varlistentry>
16667 <varlistentry>
16668 <term><varname>$interface_address</varname></term>
16669 <listitem>
16670 <para>
16671 <indexterm role="variable">
16672 <primary><varname>$interface_address</varname></primary>
16673 </indexterm>
16674 This is an obsolete name for <varname>$received_ip_address</varname>.
16675 </para>
16676 </listitem></varlistentry>
16677 <varlistentry>
16678 <term><varname>$interface_port</varname></term>
16679 <listitem>
16680 <para>
16681 <indexterm role="variable">
16682 <primary><varname>$interface_port</varname></primary>
16683 </indexterm>
16684 This is an obsolete name for <varname>$received_port</varname>.
16685 </para>
16686 </listitem></varlistentry>
16687 <varlistentry>
16688 <term><varname>$item</varname></term>
16689 <listitem>
16690 <para>
16691 <indexterm role="variable">
16692 <primary><varname>$item</varname></primary>
16693 </indexterm>
16694 This variable is used during the expansion of <emphasis role="bold">forall</emphasis> and <emphasis role="bold">forany</emphasis>
16695 conditions (see section <xref linkend="SECTexpcond"/>), and <emphasis role="bold">filter</emphasis>, <emphasis role="bold">map</emphasis>, and
16696 <emphasis role="bold">reduce</emphasis> items (see section <xref linkend="SECTexpcond"/>). In other circumstances, it is
16697 empty.
16698 </para>
16699 </listitem></varlistentry>
16700 <varlistentry>
16701 <term><varname>$ldap_dn</varname></term>
16702 <listitem>
16703 <para>
16704 <indexterm role="variable">
16705 <primary><varname>$ldap_dn</varname></primary>
16706 </indexterm>
16707 This variable, which is available only when Exim is compiled with LDAP support,
16708 contains the DN from the last entry in the most recently successful LDAP
16709 lookup.
16710 </para>
16711 </listitem></varlistentry>
16712 <varlistentry>
16713 <term><varname>$load_average</varname></term>
16714 <listitem>
16715 <para>
16716 <indexterm role="variable">
16717 <primary><varname>$load_average</varname></primary>
16718 </indexterm>
16719 This variable contains the system load average, multiplied by 1000 so that it
16720 is an integer. For example, if the load average is 0.21, the value of the
16721 variable is 210. The value is recomputed every time the variable is referenced.
16722 </para>
16723 </listitem></varlistentry>
16724 <varlistentry>
16725 <term><varname>$local_part</varname></term>
16726 <listitem>
16727 <para>
16728 <indexterm role="variable">
16729 <primary><varname>$local_part</varname></primary>
16730 </indexterm>
16731 When an address is being routed, or delivered on its own, this
16732 variable contains the local part. When a number of addresses are being
16733 delivered together (for example, multiple RCPT commands in an SMTP
16734 session), <varname>$local_part</varname> is not set.
16735 </para>
16736 <para>
16737 Global address rewriting happens when a message is received, so the value of
16738 <varname>$local_part</varname> during routing and delivery is the value after rewriting.
16739 <varname>$local_part</varname> is set during user filtering, but not during system filtering,
16740 because a message may have many recipients and the system filter is called just
16741 once.
16742 </para>
16743 <para>
16744 <indexterm role="variable">
16745 <primary><varname>$local_part_prefix</varname></primary>
16746 </indexterm>
16747 <indexterm role="variable">
16748 <primary><varname>$local_part_suffix</varname></primary>
16749 </indexterm>
16750 If a local part prefix or suffix has been recognized, it is not included in the
16751 value of <varname>$local_part</varname> during routing and subsequent delivery. The values of
16752 any prefix or suffix are in <varname>$local_part_prefix</varname> and
16753 <varname>$local_part_suffix</varname>, respectively.
16754 </para>
16755 <para>
16756 When a message is being delivered to a file, pipe, or autoreply transport as a
16757 result of aliasing or forwarding, <varname>$local_part</varname> is set to the local part of
16758 the parent address, not to the file name or command (see <varname>$address_file</varname> and
16759 <varname>$address_pipe</varname>).
16760 </para>
16761 <para>
16762 When an ACL is running for a RCPT command, <varname>$local_part</varname> contains the
16763 local part of the recipient address.
16764 </para>
16765 <para>
16766 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
16767 <varname>$local_part</varname> contains the local part of the address that is being rewritten;
16768 it can be used in the expansion of the replacement address, for example.
16769 </para>
16770 <para>
16771 In all cases, all quoting is removed from the local part. For example, for both
16772 the addresses
16773 </para>
16774 <literallayout class="monospaced">
16775 "abc:xyz"@test.example
16776 abc\:xyz@test.example
16777 </literallayout>
16778 <para>
16779 the value of <varname>$local_part</varname> is
16780 </para>
16781 <literallayout class="monospaced">
16782 abc:xyz
16783 </literallayout>
16784 <para>
16785 If you use <varname>$local_part</varname> to create another address, you should always wrap it
16786 inside a quoting operator. For example, in a <command>redirect</command> router you could
16787 have:
16788 </para>
16789 <literallayout class="monospaced">
16790 data = ${quote_local_part:$local_part}@new.domain.example
16791 </literallayout>
16792 <para>
16793 <emphasis role="bold">Note</emphasis>: The value of <varname>$local_part</varname> is normally lower cased. If you want
16794 to process local parts in a case-dependent manner in a router, you can set the
16795 <option>caseful_local_part</option> option (see chapter <xref linkend="CHAProutergeneric"/>).
16796 </para>
16797 </listitem></varlistentry>
16798 <varlistentry>
16799 <term><varname>$local_part_data</varname></term>
16800 <listitem>
16801 <para>
16802 <indexterm role="variable">
16803 <primary><varname>$local_part_data</varname></primary>
16804 </indexterm>
16805 When the <option>local_parts</option> option on a router matches a local part by means of a
16806 lookup, the data read by the lookup is available during the running of the
16807 router as <varname>$local_part_data</varname>. In addition, if the driver routes the address
16808 to a transport, the value is available in that transport. If the transport is
16809 handling multiple addresses, the value from the first address is used.
16810 </para>
16811 <para>
16812 <varname>$local_part_data</varname> is also set when the <option>local_parts</option> condition in an ACL
16813 matches a local part by means of a lookup. The data read by the lookup is
16814 available during the rest of the ACL statement. In all other situations, this
16815 variable expands to nothing.
16816 </para>
16817 </listitem></varlistentry>
16818 <varlistentry>
16819 <term><varname>$local_part_prefix</varname></term>
16820 <listitem>
16821 <para>
16822 <indexterm role="variable">
16823 <primary><varname>$local_part_prefix</varname></primary>
16824 </indexterm>
16825 When an address is being routed or delivered, and a
16826 specific prefix for the local part was recognized, it is available in this
16827 variable, having been removed from <varname>$local_part</varname>.
16828 </para>
16829 </listitem></varlistentry>
16830 <varlistentry>
16831 <term><varname>$local_part_suffix</varname></term>
16832 <listitem>
16833 <para>
16834 <indexterm role="variable">
16835 <primary><varname>$local_part_suffix</varname></primary>
16836 </indexterm>
16837 When an address is being routed or delivered, and a
16838 specific suffix for the local part was recognized, it is available in this
16839 variable, having been removed from <varname>$local_part</varname>.
16840 </para>
16841 </listitem></varlistentry>
16842 <varlistentry>
16843 <term><varname>$local_scan_data</varname></term>
16844 <listitem>
16845 <para>
16846 <indexterm role="variable">
16847 <primary><varname>$local_scan_data</varname></primary>
16848 </indexterm>
16849 This variable contains the text returned by the <function>local_scan()</function> function when
16850 a message is received. See chapter <xref linkend="CHAPlocalscan"/> for more details.
16851 </para>
16852 </listitem></varlistentry>
16853 <varlistentry>
16854 <term><varname>$local_user_gid</varname></term>
16855 <listitem>
16856 <para>
16857 <indexterm role="variable">
16858 <primary><varname>$local_user_gid</varname></primary>
16859 </indexterm>
16860 See <varname>$local_user_uid</varname>.
16861 </para>
16862 </listitem></varlistentry>
16863 <varlistentry>
16864 <term><varname>$local_user_uid</varname></term>
16865 <listitem>
16866 <para>
16867 <indexterm role="variable">
16868 <primary><varname>$local_user_uid</varname></primary>
16869 </indexterm>
16870 This variable and <varname>$local_user_gid</varname> are set to the uid and gid after the
16871 <option>check_local_user</option> router precondition succeeds. This means that their values
16872 are available for the remaining preconditions (<option>senders</option>, <option>require_files</option>,
16873 and <option>condition</option>), for the <option>address_data</option> expansion, and for any
16874 router-specific expansions. At all other times, the values in these variables
16875 are <literal>(uid_t)(-1)</literal> and <literal>(gid_t)(-1)</literal>, respectively.
16876 </para>
16877 </listitem></varlistentry>
16878 <varlistentry>
16879 <term><varname>$localhost_number</varname></term>
16880 <listitem>
16881 <para>
16882 <indexterm role="variable">
16883 <primary><varname>$localhost_number</varname></primary>
16884 </indexterm>
16885 This contains the expanded value of the
16886 <option>localhost_number</option> option. The expansion happens after the main options have
16887 been read.
16888 </para>
16889 </listitem></varlistentry>
16890 <varlistentry>
16891 <term><varname>$log_inodes</varname></term>
16892 <listitem>
16893 <para>
16894 <indexterm role="variable">
16895 <primary><varname>$log_inodes</varname></primary>
16896 </indexterm>
16897 The number of free inodes in the disk partition where Exim&#x2019;s
16898 log files are being written. The value is recalculated whenever the variable is
16899 referenced. If the relevant file system does not have the concept of inodes,
16900 the value of is -1. See also the <option>check_log_inodes</option> option.
16901 </para>
16902 </listitem></varlistentry>
16903 <varlistentry>
16904 <term><varname>$log_space</varname></term>
16905 <listitem>
16906 <para>
16907 <indexterm role="variable">
16908 <primary><varname>$log_space</varname></primary>
16909 </indexterm>
16910 The amount of free space (as a number of kilobytes) in the disk
16911 partition where Exim&#x2019;s log files are being written. The value is recalculated
16912 whenever the variable is referenced. If the operating system does not have the
16913 ability to find the amount of free space (only true for experimental systems),
16914 the space value is -1. See also the <option>check_log_space</option> option.
16915 </para>
16916 </listitem></varlistentry>
16917 <varlistentry>
16918 <term><varname>$mailstore_basename</varname></term>
16919 <listitem>
16920 <para>
16921 <indexterm role="variable">
16922 <primary><varname>$mailstore_basename</varname></primary>
16923 </indexterm>
16924 This variable is set only when doing deliveries in <quote>mailstore</quote> format in the
16925 <command>appendfile</command> transport. During the expansion of the <option>mailstore_prefix</option>,
16926 <option>mailstore_suffix</option>, <option>message_prefix</option>, and <option>message_suffix</option> options, it
16927 contains the basename of the files that are being written, that is, the name
16928 without the <quote>.tmp</quote>, <quote>.env</quote>, or <quote>.msg</quote> suffix. At all other times, this
16929 variable is empty.
16930 </para>
16931 </listitem></varlistentry>
16932 <varlistentry>
16933 <term><varname>$malware_name</varname></term>
16934 <listitem>
16935 <para>
16936 <indexterm role="variable">
16937 <primary><varname>$malware_name</varname></primary>
16938 </indexterm>
16939 This variable is available when Exim is compiled with the
16940 content-scanning extension. It is set to the name of the virus that was found
16941 when the ACL <option>malware</option> condition is true (see section <xref linkend="SECTscanvirus"/>).
16942 </para>
16943 </listitem></varlistentry>
16944 <varlistentry>
16945 <term><varname>$max_received_linelength</varname></term>
16946 <listitem>
16947 <para>
16948 <indexterm role="variable">
16949 <primary><varname>$max_received_linelength</varname></primary>
16950 </indexterm>
16951 <indexterm role="concept">
16952 <primary>maximum</primary>
16953 <secondary>line length</secondary>
16954 </indexterm>
16955 <indexterm role="concept">
16956 <primary>line length</primary>
16957 <secondary>maximum</secondary>
16958 </indexterm>
16959 This variable contains the number of bytes in the longest line that was
16960 received as part of the message, not counting the line termination
16961 character(s).
16962 </para>
16963 </listitem></varlistentry>
16964 <varlistentry>
16965 <term><varname>$message_age</varname></term>
16966 <listitem>
16967 <para>
16968 <indexterm role="concept">
16969 <primary>message</primary>
16970 <secondary>age of</secondary>
16971 </indexterm>
16972 <indexterm role="variable">
16973 <primary><varname>$message_age</varname></primary>
16974 </indexterm>
16975 This variable is set at the start of a delivery attempt to contain the number
16976 of seconds since the message was received. It does not change during a single
16977 delivery attempt.
16978 </para>
16979 </listitem></varlistentry>
16980 <varlistentry>
16981 <term><varname>$message_body</varname></term>
16982 <listitem>
16983 <para>
16984 <indexterm role="concept">
16985 <primary>body of message</primary>
16986 <secondary>expansion variable</secondary>
16987 </indexterm>
16988 <indexterm role="concept">
16989 <primary>message body</primary>
16990 <secondary>in expansion</secondary>
16991 </indexterm>
16992 <indexterm role="concept">
16993 <primary>binary zero</primary>
16994 <secondary>in message body</secondary>
16995 </indexterm>
16996 <indexterm role="variable">
16997 <primary><varname>$message_body</varname></primary>
16998 </indexterm>
16999 <indexterm role="option">
17000 <primary><option>message_body_visible</option></primary>
17001 </indexterm>
17002 This variable contains the initial portion of a message&#x2019;s body while it is
17003 being delivered, and is intended mainly for use in filter files. The maximum
17004 number of characters of the body that are put into the variable is set by the
17005 <option>message_body_visible</option> configuration option; the default is 500.
17006 </para>
17007 <para>
17008 <indexterm role="option">
17009 <primary><option>message_body_newlines</option></primary>
17010 </indexterm>
17011 By default, newlines are converted into spaces in <varname>$message_body</varname>, to make it
17012 easier to search for phrases that might be split over a line break. However,
17013 this can be disabled by setting <option>message_body_newlines</option> to be true. Binary
17014 zeros are always converted into spaces.
17015 </para>
17016 </listitem></varlistentry>
17017 <varlistentry>
17018 <term><varname>$message_body_end</varname></term>
17019 <listitem>
17020 <para>
17021 <indexterm role="concept">
17022 <primary>body of message</primary>
17023 <secondary>expansion variable</secondary>
17024 </indexterm>
17025 <indexterm role="concept">
17026 <primary>message body</primary>
17027 <secondary>in expansion</secondary>
17028 </indexterm>
17029 <indexterm role="variable">
17030 <primary><varname>$message_body_end</varname></primary>
17031 </indexterm>
17032 This variable contains the final portion of a message&#x2019;s
17033 body while it is being delivered. The format and maximum size are as for
17034 <varname>$message_body</varname>.
17035 </para>
17036 </listitem></varlistentry>
17037 <varlistentry>
17038 <term><varname>$message_body_size</varname></term>
17039 <listitem>
17040 <para>
17041 <indexterm role="concept">
17042 <primary>body of message</primary>
17043 <secondary>size</secondary>
17044 </indexterm>
17045 <indexterm role="concept">
17046 <primary>message body</primary>
17047 <secondary>size</secondary>
17048 </indexterm>
17049 <indexterm role="variable">
17050 <primary><varname>$message_body_size</varname></primary>
17051 </indexterm>
17052 When a message is being delivered, this variable contains the size of the body
17053 in bytes. The count starts from the character after the blank line that
17054 separates the body from the header. Newlines are included in the count. See
17055 also <varname>$message_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
17056 </para>
17057 </listitem></varlistentry>
17058 <varlistentry>
17059 <term><varname>$message_exim_id</varname></term>
17060 <listitem>
17061 <para>
17062 <indexterm role="variable">
17063 <primary><varname>$message_exim_id</varname></primary>
17064 </indexterm>
17065 When a message is being received or delivered, this variable contains the
17066 unique message id that is generated and used by Exim to identify the message.
17067 An id is not created for a message until after its header has been successfully
17068 received. <emphasis role="bold">Note</emphasis>: This is <emphasis>not</emphasis> the contents of the <emphasis>Message-ID:</emphasis> header
17069 line; it is the local id that Exim assigns to the message, for example:
17070 <literal>1BXTIK-0001yO-VA</literal>.
17071 </para>
17072 </listitem></varlistentry>
17073 <varlistentry>
17074 <term><varname>$message_headers</varname></term>
17075 <listitem>
17076 <para>
17077 <indexterm role="variable">
17078 <primary><varname>$message_headers</varname></primary>
17079 </indexterm>
17080 This variable contains a concatenation of all the header lines when a message
17081 is being processed, except for lines added by routers or transports. The header
17082 lines are separated by newline characters. Their contents are decoded in the
17083 same way as a header line that is inserted by <option>bheader</option>.
17084 </para>
17085 </listitem></varlistentry>
17086 <varlistentry>
17087 <term><varname>$message_headers_raw</varname></term>
17088 <listitem>
17089 <para>
17090 <indexterm role="variable">
17091 <primary><varname>$message_headers_raw</varname></primary>
17092 </indexterm>
17093 This variable is like <varname>$message_headers</varname> except that no processing of the
17094 contents of header lines is done.
17095 </para>
17096 </listitem></varlistentry>
17097 <varlistentry>
17098 <term><varname>$message_id</varname></term>
17099 <listitem>
17100 <para>
17101 This is an old name for <varname>$message_exim_id</varname>, which is now deprecated.
17102 </para>
17103 </listitem></varlistentry>
17104 <varlistentry>
17105 <term><varname>$message_linecount</varname></term>
17106 <listitem>
17107 <para>
17108 <indexterm role="variable">
17109 <primary><varname>$message_linecount</varname></primary>
17110 </indexterm>
17111 This variable contains the total number of lines in the header and body of the
17112 message. Compare <varname>$body_linecount</varname>, which is the count for the body only.
17113 During the DATA and content-scanning ACLs, <varname>$message_linecount</varname> contains the
17114 number of lines received. Before delivery happens (that is, before filters,
17115 routers, and transports run) the count is increased to include the
17116 <emphasis>Received:</emphasis> header line that Exim standardly adds, and also any other header
17117 lines that are added by ACLs. The blank line that separates the message header
17118 from the body is not counted.
17119 </para>
17120 <para>
17121 As with the special case of <varname>$message_size</varname>, during the expansion of the
17122 appendfile transport&#x2019;s maildir_tag option in maildir format, the value of
17123 <varname>$message_linecount</varname> is the precise size of the number of newlines in the
17124 file that has been written (minus one for the blank line between the
17125 header and the body).
17126 </para>
17127 <para>
17128 Here is an example of the use of this variable in a DATA ACL:
17129 </para>
17130 <literallayout class="monospaced">
17131 deny message   = Too many lines in message header
17132      condition = \
17133       ${if &lt;{250}{${eval:$message_linecount - $body_linecount}}}
17134 </literallayout>
17135 <para>
17136 In the MAIL and RCPT ACLs, the value is zero because at that stage the
17137 message has not yet been received.
17138 </para>
17139 </listitem></varlistentry>
17140 <varlistentry>
17141 <term><varname>$message_size</varname></term>
17142 <listitem>
17143 <para>
17144 <indexterm role="concept">
17145 <primary>size</primary>
17146 <secondary>of message</secondary>
17147 </indexterm>
17148 <indexterm role="concept">
17149 <primary>message</primary>
17150 <secondary>size</secondary>
17151 </indexterm>
17152 <indexterm role="variable">
17153 <primary><varname>$message_size</varname></primary>
17154 </indexterm>
17155 When a message is being processed, this variable contains its size in bytes. In
17156 most cases, the size includes those headers that were received with the
17157 message, but not those (such as <emphasis>Envelope-to:</emphasis>) that are added to individual
17158 deliveries as they are written. However, there is one special case: during the
17159 expansion of the <option>maildir_tag</option> option in the <command>appendfile</command> transport while
17160 doing a delivery in maildir format, the value of <varname>$message_size</varname> is the
17161 precise size of the file that has been written. See also
17162 <varname>$message_body_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
17163 </para>
17164 <para>
17165 <indexterm role="concept">
17166 <primary>RCPT</primary>
17167 <secondary>value of <varname>$message_size</varname></secondary>
17168 </indexterm>
17169 While running a per message ACL (mail/rcpt/predata), <varname>$message_size</varname>
17170 contains the size supplied on the MAIL command, or -1 if no size was given. The
17171 value may not, of course, be truthful.
17172 </para>
17173 </listitem></varlistentry>
17174 <varlistentry>
17175 <term><varname>$mime_</varname><emphasis>xxx</emphasis></term>
17176 <listitem>
17177 <para>
17178 A number of variables whose names start with <varname>$mime</varname> are
17179 available when Exim is compiled with the content-scanning extension. For
17180 details, see section <xref linkend="SECTscanmimepart"/>.
17181 </para>
17182 </listitem></varlistentry>
17183 <varlistentry>
17184 <term><varname>$n0</varname> &ndash; <varname>$n9</varname></term>
17185 <listitem>
17186 <para>
17187 These variables are counters that can be incremented by means
17188 of the <option>add</option> command in filter files.
17189 </para>
17190 </listitem></varlistentry>
17191 <varlistentry>
17192 <term><varname>$original_domain</varname></term>
17193 <listitem>
17194 <para>
17195 <indexterm role="variable">
17196 <primary><varname>$domain</varname></primary>
17197 </indexterm>
17198 <indexterm role="variable">
17199 <primary><varname>$original_domain</varname></primary>
17200 </indexterm>
17201 When a top-level address is being processed for delivery, this contains the
17202 same value as <varname>$domain</varname>. However, if a <quote>child</quote> address (for example,
17203 generated by an alias, forward, or filter file) is being processed, this
17204 variable contains the domain of the original address (lower cased). This
17205 differs from <varname>$parent_domain</varname> only when there is more than one level of
17206 aliasing or forwarding. When more than one address is being delivered in a
17207 single transport run, <varname>$original_domain</varname> is not set.
17208 </para>
17209 <para>
17210 If a new address is created by means of a <option>deliver</option> command in a system
17211 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
17212 part <emphasis>system-filter</emphasis> and the default qualify domain.
17213 </para>
17214 </listitem></varlistentry>
17215 <varlistentry>
17216 <term><varname>$original_local_part</varname></term>
17217 <listitem>
17218 <para>
17219 <indexterm role="variable">
17220 <primary><varname>$local_part</varname></primary>
17221 </indexterm>
17222 <indexterm role="variable">
17223 <primary><varname>$original_local_part</varname></primary>
17224 </indexterm>
17225 When a top-level address is being processed for delivery, this contains the
17226 same value as <varname>$local_part</varname>, unless a prefix or suffix was removed from the
17227 local part, because <varname>$original_local_part</varname> always contains the full local
17228 part. When a <quote>child</quote> address (for example, generated by an alias, forward, or
17229 filter file) is being processed, this variable contains the full local part of
17230 the original address.
17231 </para>
17232 <para>
17233 If the router that did the redirection processed the local part
17234 case-insensitively, the value in <varname>$original_local_part</varname> is in lower case.
17235 This variable differs from <varname>$parent_local_part</varname> only when there is more than
17236 one level of aliasing or forwarding. When more than one address is being
17237 delivered in a single transport run, <varname>$original_local_part</varname> is not set.
17238 </para>
17239 <para>
17240 If a new address is created by means of a <option>deliver</option> command in a system
17241 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
17242 part <emphasis>system-filter</emphasis> and the default qualify domain.
17243 </para>
17244 </listitem></varlistentry>
17245 <varlistentry>
17246 <term><varname>$originator_gid</varname></term>
17247 <listitem>
17248 <para>
17249 <indexterm role="concept">
17250 <primary>gid (group id)</primary>
17251 <secondary>of originating user</secondary>
17252 </indexterm>
17253 <indexterm role="concept">
17254 <primary>sender</primary>
17255 <secondary>gid</secondary>
17256 </indexterm>
17257 <indexterm role="variable">
17258 <primary><varname>$caller_gid</varname></primary>
17259 </indexterm>
17260 <indexterm role="variable">
17261 <primary><varname>$originator_gid</varname></primary>
17262 </indexterm>
17263 This variable contains the value of <varname>$caller_gid</varname> that was set when the
17264 message was received. For messages received via the command line, this is the
17265 gid of the sending user. For messages received by SMTP over TCP/IP, this is
17266 normally the gid of the Exim user.
17267 </para>
17268 </listitem></varlistentry>
17269 <varlistentry>
17270 <term><varname>$originator_uid</varname></term>
17271 <listitem>
17272 <para>
17273 <indexterm role="concept">
17274 <primary>uid (user id)</primary>
17275 <secondary>of originating user</secondary>
17276 </indexterm>
17277 <indexterm role="concept">
17278 <primary>sender</primary>
17279 <secondary>uid</secondary>
17280 </indexterm>
17281 <indexterm role="variable">
17282 <primary><varname>$caller_uid</varname></primary>
17283 </indexterm>
17284 <indexterm role="variable">
17285 <primary><varname>$originaltor_uid</varname></primary>
17286 </indexterm>
17287 The value of <varname>$caller_uid</varname> that was set when the message was received. For
17288 messages received via the command line, this is the uid of the sending user.
17289 For messages received by SMTP over TCP/IP, this is normally the uid of the Exim
17290 user.
17291 </para>
17292 </listitem></varlistentry>
17293 <varlistentry>
17294 <term><varname>$parent_domain</varname></term>
17295 <listitem>
17296 <para>
17297 <indexterm role="variable">
17298 <primary><varname>$parent_domain</varname></primary>
17299 </indexterm>
17300 This variable is similar to <varname>$original_domain</varname> (see
17301 above), except that it refers to the immediately preceding parent address.
17302 </para>
17303 </listitem></varlistentry>
17304 <varlistentry>
17305 <term><varname>$parent_local_part</varname></term>
17306 <listitem>
17307 <para>
17308 <indexterm role="variable">
17309 <primary><varname>$parent_local_part</varname></primary>
17310 </indexterm>
17311 This variable is similar to <varname>$original_local_part</varname>
17312 (see above), except that it refers to the immediately preceding parent address.
17313 </para>
17314 </listitem></varlistentry>
17315 <varlistentry>
17316 <term><varname>$pid</varname></term>
17317 <listitem>
17318 <para>
17319 <indexterm role="concept">
17320 <primary>pid (process id)</primary>
17321 <secondary>of current process</secondary>
17322 </indexterm>
17323 <indexterm role="variable">
17324 <primary><varname>$pid</varname></primary>
17325 </indexterm>
17326 This variable contains the current process id.
17327 </para>
17328 </listitem></varlistentry>
17329 <varlistentry>
17330 <term><varname>$pipe_addresses</varname></term>
17331 <listitem>
17332 <para>
17333 <indexterm role="concept">
17334 <primary>filter</primary>
17335 <secondary>transport filter</secondary>
17336 </indexterm>
17337 <indexterm role="concept">
17338 <primary>transport</primary>
17339 <secondary>filter</secondary>
17340 </indexterm>
17341 <indexterm role="variable">
17342 <primary><varname>$pipe_addresses</varname></primary>
17343 </indexterm>
17344 This is not an expansion variable, but is mentioned here because the string
17345 <literal>$pipe_addresses</literal> is handled specially in the command specification for the
17346 <command>pipe</command> transport (chapter <xref linkend="CHAPpipetransport"/>) and in transport filters
17347 (described under <option>transport_filter</option> in chapter <xref linkend="CHAPtransportgeneric"/>).
17348 It cannot be used in general expansion strings, and provokes an <quote>unknown
17349 variable</quote> error if encountered.
17350 </para>
17351 </listitem></varlistentry>
17352 <varlistentry>
17353 <term><varname>$primary_hostname</varname></term>
17354 <listitem>
17355 <para>
17356 <indexterm role="variable">
17357 <primary><varname>$primary_hostname</varname></primary>
17358 </indexterm>
17359 This variable contains the value set by <option>primary_hostname</option> in the
17360 configuration file, or read by the <function>uname()</function> function. If <function>uname()</function> returns
17361 a single-component name, Exim calls <function>gethostbyname()</function> (or
17362 <function>getipnodebyname()</function> where available) in an attempt to acquire a fully
17363 qualified host name. See also <varname>$smtp_active_hostname</varname>.
17364 </para>
17365 </listitem></varlistentry>
17366 <varlistentry>
17367 <term><varname>$prvscheck_address</varname></term>
17368 <listitem>
17369 <para>
17370 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
17371 which is described in sections <xref linkend="SECTexpansionitems"/> and
17372 <xref linkend="SECTverifyPRVS"/>.
17373 </para>
17374 </listitem></varlistentry>
17375 <varlistentry>
17376 <term><varname>$prvscheck_keynum</varname></term>
17377 <listitem>
17378 <para>
17379 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
17380 which is described in sections <xref linkend="SECTexpansionitems"/> and
17381 <xref linkend="SECTverifyPRVS"/>.
17382 </para>
17383 </listitem></varlistentry>
17384 <varlistentry>
17385 <term><varname>$prvscheck_result</varname></term>
17386 <listitem>
17387 <para>
17388 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
17389 which is described in sections <xref linkend="SECTexpansionitems"/> and
17390 <xref linkend="SECTverifyPRVS"/>.
17391 </para>
17392 </listitem></varlistentry>
17393 <varlistentry>
17394 <term><varname>$qualify_domain</varname></term>
17395 <listitem>
17396 <para>
17397 <indexterm role="variable">
17398 <primary><varname>$qualify_domain</varname></primary>
17399 </indexterm>
17400 The value set for the <option>qualify_domain</option> option in the configuration file.
17401 </para>
17402 </listitem></varlistentry>
17403 <varlistentry>
17404 <term><varname>$qualify_recipient</varname></term>
17405 <listitem>
17406 <para>
17407 <indexterm role="variable">
17408 <primary><varname>$qualify_recipient</varname></primary>
17409 </indexterm>
17410 The value set for the <option>qualify_recipient</option> option in the configuration file,
17411 or if not set, the value of <varname>$qualify_domain</varname>.
17412 </para>
17413 </listitem></varlistentry>
17414 <varlistentry>
17415 <term><varname>$rcpt_count</varname></term>
17416 <listitem>
17417 <para>
17418 <indexterm role="variable">
17419 <primary><varname>$rcpt_count</varname></primary>
17420 </indexterm>
17421 When a message is being received by SMTP, this variable contains the number of
17422 RCPT commands received for the current message. If this variable is used in a
17423 RCPT ACL, its value includes the current command.
17424 </para>
17425 </listitem></varlistentry>
17426 <varlistentry>
17427 <term><varname>$rcpt_defer_count</varname></term>
17428 <listitem>
17429 <para>
17430 <indexterm role="variable">
17431 <primary><varname>$rcpt_defer_count</varname></primary>
17432 </indexterm>
17433 <indexterm role="concept">
17434 <primary>4<emphasis>xx</emphasis> responses</primary>
17435 <secondary>count of</secondary>
17436 </indexterm>
17437 When a message is being received by SMTP, this variable contains the number of
17438 RCPT commands in the current message that have previously been rejected with a
17439 temporary (4<emphasis>xx</emphasis>) response.
17440 </para>
17441 </listitem></varlistentry>
17442 <varlistentry>
17443 <term><varname>$rcpt_fail_count</varname></term>
17444 <listitem>
17445 <para>
17446 <indexterm role="variable">
17447 <primary><varname>$rcpt_fail_count</varname></primary>
17448 </indexterm>
17449 When a message is being received by SMTP, this variable contains the number of
17450 RCPT commands in the current message that have previously been rejected with a
17451 permanent (5<emphasis>xx</emphasis>) response.
17452 </para>
17453 </listitem></varlistentry>
17454 <varlistentry>
17455 <term><varname>$received_count</varname></term>
17456 <listitem>
17457 <para>
17458 <indexterm role="variable">
17459 <primary><varname>$received_count</varname></primary>
17460 </indexterm>
17461 This variable contains the number of <emphasis>Received:</emphasis> header lines in the message,
17462 including the one added by Exim (so its value is always greater than zero). It
17463 is available in the DATA ACL, the non-SMTP ACL, and while routing and
17464 delivering.
17465 </para>
17466 </listitem></varlistentry>
17467 <varlistentry>
17468 <term><varname>$received_for</varname></term>
17469 <listitem>
17470 <para>
17471 <indexterm role="variable">
17472 <primary><varname>$received_for</varname></primary>
17473 </indexterm>
17474 If there is only a single recipient address in an incoming message, this
17475 variable contains that address when the <emphasis>Received:</emphasis> header line is being
17476 built. The value is copied after recipient rewriting has happened, but before
17477 the <function>local_scan()</function> function is run.
17478 </para>
17479 </listitem></varlistentry>
17480 <varlistentry>
17481 <term><varname>$received_ip_address</varname></term>
17482 <listitem>
17483 <para>
17484 <indexterm role="variable">
17485 <primary><varname>$received_ip_address</varname></primary>
17486 </indexterm>
17487 As soon as an Exim server starts processing an incoming TCP/IP connection, this
17488 variable is set to the address of the local IP interface, and <varname>$received_port</varname>
17489 is set to the local port number. (The remote IP address and port are in
17490 <varname>$sender_host_address</varname> and <varname>$sender_host_port</varname>.) When testing with <option>-bh</option>,
17491 the port value is -1 unless it has been set using the <option>-oMi</option> command line
17492 option.
17493 </para>
17494 <para>
17495 As well as being useful in ACLs (including the <quote>connect</quote> ACL), these variable
17496 could be used, for example, to make the file name for a TLS certificate depend
17497 on which interface and/or port is being used for the incoming connection. The
17498 values of <varname>$received_ip_address</varname> and <varname>$received_port</varname> are saved with any
17499 messages that are received, thus making these variables available at delivery
17500 time.
17501 </para>
17502 <para>
17503 <emphasis role="bold">Note:</emphasis> There are no equivalent variables for outgoing connections, because
17504 the values are unknown (unless they are explicitly set by options of the
17505 <command>smtp</command> transport).
17506 </para>
17507 </listitem></varlistentry>
17508 <varlistentry>
17509 <term><varname>$received_port</varname></term>
17510 <listitem>
17511 <para>
17512 <indexterm role="variable">
17513 <primary><varname>$received_port</varname></primary>
17514 </indexterm>
17515 See <varname>$received_ip_address</varname>.
17516 </para>
17517 </listitem></varlistentry>
17518 <varlistentry>
17519 <term><varname>$received_protocol</varname></term>
17520 <listitem>
17521 <para>
17522 <indexterm role="variable">
17523 <primary><varname>$received_protocol</varname></primary>
17524 </indexterm>
17525 When a message is being processed, this variable contains the name of the
17526 protocol by which it was received. Most of the names used by Exim are defined
17527 by RFCs 821, 2821, and 3848. They start with <quote>smtp</quote> (the client used HELO) or
17528 <quote>esmtp</quote> (the client used EHLO). This can be followed by <quote>s</quote> for secure
17529 (encrypted) and/or <quote>a</quote> for authenticated. Thus, for example, if the protocol
17530 is set to <quote>esmtpsa</quote>, the message was received over an encrypted SMTP
17531 connection and the client was successfully authenticated.
17532 </para>
17533 <para>
17534 Exim uses the protocol name <quote>smtps</quote> for the case when encryption is
17535 automatically set up on connection without the use of STARTTLS (see
17536 <option>tls_on_connect_ports</option>), and the client uses HELO to initiate the
17537 encrypted SMTP session. The name <quote>smtps</quote> is also used for the rare situation
17538 where the client initially uses EHLO, sets up an encrypted connection using
17539 STARTTLS, and then uses HELO afterwards.
17540 </para>
17541 <para>
17542 The <option>-oMr</option> option provides a way of specifying a custom protocol name for
17543 messages that are injected locally by trusted callers. This is commonly used to
17544 identify messages that are being re-injected after some kind of scanning.
17545 </para>
17546 </listitem></varlistentry>
17547 <varlistentry>
17548 <term><varname>$received_time</varname></term>
17549 <listitem>
17550 <para>
17551 <indexterm role="variable">
17552 <primary><varname>$received_time</varname></primary>
17553 </indexterm>
17554 This variable contains the date and time when the current message was received,
17555 as a number of seconds since the start of the Unix epoch.
17556 </para>
17557 </listitem></varlistentry>
17558 <varlistentry>
17559 <term><varname>$recipient_data</varname></term>
17560 <listitem>
17561 <para>
17562 <indexterm role="variable">
17563 <primary><varname>$recipient_data</varname></primary>
17564 </indexterm>
17565 This variable is set after an indexing lookup success in an ACL <option>recipients</option>
17566 condition. It contains the data from the lookup, and the value remains set
17567 until the next <option>recipients</option> test. Thus, you can do things like this:
17568 </para>
17569 <literallayout>
17570 <literal>require recipients  = cdb*@;/some/file</literal>
17571 <literal>deny    </literal><emphasis>some further test involving</emphasis> <literal>$recipient_data</literal>
17572 </literallayout>
17573 <para>
17574 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
17575 method in the address list, using the semicolon syntax as in the example above.
17576 The variable is not set for a lookup that is used as part of the string
17577 expansion that all such lists undergo before being interpreted.
17578 </para>
17579 </listitem></varlistentry>
17580 <varlistentry>
17581 <term><varname>$recipient_verify_failure</varname></term>
17582 <listitem>
17583 <para>
17584 <indexterm role="variable">
17585 <primary><varname>$recipient_verify_failure</varname></primary>
17586 </indexterm>
17587 In an ACL, when a recipient verification fails, this variable contains
17588 information about the failure. It is set to one of the following words:
17589 </para>
17590 <itemizedlist>
17591 <listitem>
17592 <para>
17593 <quote>qualify</quote>: The address was unqualified (no domain), and the message
17594 was neither local nor came from an exempted host.
17595 </para>
17596 </listitem>
17597 <listitem>
17598 <para>
17599 <quote>route</quote>: Routing failed.
17600 </para>
17601 </listitem>
17602 <listitem>
17603 <para>
17604 <quote>mail</quote>: Routing succeeded, and a callout was attempted; rejection occurred at
17605 or before the MAIL command (that is, on initial connection, HELO, or
17606 MAIL).
17607 </para>
17608 </listitem>
17609 <listitem>
17610 <para>
17611 <quote>recipient</quote>: The RCPT command in a callout was rejected.
17612 </para>
17613 </listitem>
17614 <listitem>
17615 <para>
17616 <quote>postmaster</quote>: The postmaster check in a callout was rejected.
17617 </para>
17618 </listitem>
17619 </itemizedlist>
17620 <para>
17621 The main use of this variable is expected to be to distinguish between
17622 rejections of MAIL and rejections of RCPT.
17623 </para>
17624 </listitem></varlistentry>
17625 <varlistentry>
17626 <term><varname>$recipients</varname></term>
17627 <listitem>
17628 <para>
17629 <indexterm role="variable">
17630 <primary><varname>$recipients</varname></primary>
17631 </indexterm>
17632 This variable contains a list of envelope recipients for a message. A comma and
17633 a space separate the addresses in the replacement text. However, the variable
17634 is not generally available, to prevent exposure of Bcc recipients in
17635 unprivileged users&#x2019; filter files. You can use <varname>$recipients</varname> only in these
17636 cases:
17637 </para>
17638 <orderedlist numeration="arabic">
17639 <listitem>
17640 <para>
17641 In a system filter file.
17642 </para>
17643 </listitem>
17644 <listitem>
17645 <para>
17646 In the ACLs associated with the DATA command and with non-SMTP messages, that
17647 is, the ACLs defined by <option>acl_smtp_predata</option>, <option>acl_smtp_data</option>,
17648 <option>acl_smtp_mime</option>, <option>acl_not_smtp_start</option>, <option>acl_not_smtp</option>, and
17649 <option>acl_not_smtp_mime</option>.
17650 </para>
17651 </listitem>
17652 <listitem>
17653 <para>
17654 From within a <function>local_scan()</function> function.
17655 </para>
17656 </listitem>
17657 </orderedlist>
17658 </listitem></varlistentry>
17659 <varlistentry>
17660 <term><varname>$recipients_count</varname></term>
17661 <listitem>
17662 <para>
17663 <indexterm role="variable">
17664 <primary><varname>$recipients_count</varname></primary>
17665 </indexterm>
17666 When a message is being processed, this variable contains the number of
17667 envelope recipients that came with the message. Duplicates are not excluded
17668 from the count. While a message is being received over SMTP, the number
17669 increases for each accepted recipient. It can be referenced in an ACL.
17670 </para>
17671 </listitem></varlistentry>
17672 <varlistentry>
17673 <term><varname>$regex_match_string</varname></term>
17674 <listitem>
17675 <para>
17676 <indexterm role="variable">
17677 <primary><varname>$regex_match_string</varname></primary>
17678 </indexterm>
17679 This variable is set to contain the matching regular expression after a
17680 <option>regex</option> ACL condition has matched (see section <xref linkend="SECTscanregex"/>).
17681 </para>
17682 </listitem></varlistentry>
17683 <varlistentry>
17684 <term><varname>$reply_address</varname></term>
17685 <listitem>
17686 <para>
17687 <indexterm role="variable">
17688 <primary><varname>$reply_address</varname></primary>
17689 </indexterm>
17690 When a message is being processed, this variable contains the contents of the
17691 <emphasis>Reply-To:</emphasis> header line if one exists and it is not empty, or otherwise the
17692 contents of the <emphasis>From:</emphasis> header line. Apart from the removal of leading
17693 white space, the value is not processed in any way. In particular, no RFC 2047
17694 decoding or character code translation takes place.
17695 </para>
17696 </listitem></varlistentry>
17697 <varlistentry>
17698 <term><varname>$return_path</varname></term>
17699 <listitem>
17700 <para>
17701 <indexterm role="variable">
17702 <primary><varname>$return_path</varname></primary>
17703 </indexterm>
17704 When a message is being delivered, this variable contains the return path &ndash;
17705 the sender field that will be sent as part of the envelope. It is not enclosed
17706 in &lt;&gt; characters. At the start of routing an address, <varname>$return_path</varname> has the
17707 same value as <varname>$sender_address</varname>, but if, for example, an incoming message to a
17708 mailing list has been expanded by a router which specifies a different address
17709 for bounce messages, <varname>$return_path</varname> subsequently contains the new bounce
17710 address, whereas <varname>$sender_address</varname> always contains the original sender address
17711 that was received with the message. In other words, <varname>$sender_address</varname> contains
17712 the incoming envelope sender, and <varname>$return_path</varname> contains the outgoing
17713 envelope sender.
17714 </para>
17715 </listitem></varlistentry>
17716 <varlistentry>
17717 <term><varname>$return_size_limit</varname></term>
17718 <listitem>
17719 <para>
17720 <indexterm role="variable">
17721 <primary><varname>$return_size_limit</varname></primary>
17722 </indexterm>
17723 This is an obsolete name for <varname>$bounce_return_size_limit</varname>.
17724 </para>
17725 </listitem></varlistentry>
17726 <varlistentry>
17727 <term><varname>$runrc</varname></term>
17728 <listitem>
17729 <para>
17730 <indexterm role="concept">
17731 <primary>return code</primary>
17732 <secondary>from <option>run</option> expansion</secondary>
17733 </indexterm>
17734 <indexterm role="variable">
17735 <primary><varname>$runrc</varname></primary>
17736 </indexterm>
17737 This variable contains the return code from a command that is run by the
17738 <option>${run...}</option> expansion item. <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot
17739 assume the order in which option values are expanded, except for those
17740 preconditions whose order of testing is documented. Therefore, you cannot
17741 reliably expect to set <varname>$runrc</varname> by the expansion of one option, and use it in
17742 another.
17743 </para>
17744 </listitem></varlistentry>
17745 <varlistentry>
17746 <term><varname>$self_hostname</varname></term>
17747 <listitem>
17748 <para>
17749 <indexterm role="option">
17750 <primary><option>self</option></primary>
17751 <secondary>value of host name</secondary>
17752 </indexterm>
17753 <indexterm role="variable">
17754 <primary><varname>$self_hostname</varname></primary>
17755 </indexterm>
17756 When an address is routed to a supposedly remote host that turns out to be the
17757 local host, what happens is controlled by the <option>self</option> generic router option.
17758 One of its values causes the address to be passed to another router. When this
17759 happens, <varname>$self_hostname</varname> is set to the name of the local host that the
17760 original router encountered. In other circumstances its contents are null.
17761 </para>
17762 </listitem></varlistentry>
17763 <varlistentry>
17764 <term><varname>$sender_address</varname></term>
17765 <listitem>
17766 <para>
17767 <indexterm role="variable">
17768 <primary><varname>$sender_address</varname></primary>
17769 </indexterm>
17770 When a message is being processed, this variable contains the sender&#x2019;s address
17771 that was received in the message&#x2019;s envelope. The case of letters in the address
17772 is retained, in both the local part and the domain. For bounce messages, the
17773 value of this variable is the empty string. See also <varname>$return_path</varname>.
17774 </para>
17775 </listitem></varlistentry>
17776 <varlistentry>
17777 <term><varname>$sender_address_data</varname></term>
17778 <listitem>
17779 <para>
17780 <indexterm role="variable">
17781 <primary><varname>$address_data</varname></primary>
17782 </indexterm>
17783 <indexterm role="variable">
17784 <primary><varname>$sender_address_data</varname></primary>
17785 </indexterm>
17786 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
17787 sender address, the final value is preserved in <varname>$sender_address_data</varname>, to
17788 distinguish it from data from a recipient address. The value does not persist
17789 after the end of the current ACL statement. If you want to preserve it for
17790 longer, you can save it in an ACL variable.
17791 </para>
17792 </listitem></varlistentry>
17793 <varlistentry>
17794 <term><varname>$sender_address_domain</varname></term>
17795 <listitem>
17796 <para>
17797 <indexterm role="variable">
17798 <primary><varname>$sender_address_domain</varname></primary>
17799 </indexterm>
17800 The domain portion of <varname>$sender_address</varname>.
17801 </para>
17802 </listitem></varlistentry>
17803 <varlistentry>
17804 <term><varname>$sender_address_local_part</varname></term>
17805 <listitem>
17806 <para>
17807 <indexterm role="variable">
17808 <primary><varname>$sender_address_local_part</varname></primary>
17809 </indexterm>
17810 The local part portion of <varname>$sender_address</varname>.
17811 </para>
17812 </listitem></varlistentry>
17813 <varlistentry>
17814 <term><varname>$sender_data</varname></term>
17815 <listitem>
17816 <para>
17817 <indexterm role="variable">
17818 <primary><varname>$sender_data</varname></primary>
17819 </indexterm>
17820 This variable is set after a lookup success in an ACL <option>senders</option> condition or
17821 in a router <option>senders</option> option. It contains the data from the lookup, and the
17822 value remains set until the next <option>senders</option> test. Thus, you can do things like
17823 this:
17824 </para>
17825 <literallayout>
17826 <literal>require senders      = cdb*@;/some/file</literal>
17827 <literal>deny    </literal><emphasis>some further test involving</emphasis> <literal>$sender_data</literal>
17828 </literallayout>
17829 <para>
17830 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
17831 method in the address list, using the semicolon syntax as in the example above.
17832 The variable is not set for a lookup that is used as part of the string
17833 expansion that all such lists undergo before being interpreted.
17834 </para>
17835 </listitem></varlistentry>
17836 <varlistentry>
17837 <term><varname>$sender_fullhost</varname></term>
17838 <listitem>
17839 <para>
17840 <indexterm role="variable">
17841 <primary><varname>$sender_fullhost</varname></primary>
17842 </indexterm>
17843 When a message is received from a remote host, this variable contains the host
17844 name and IP address in a single string. It ends with the IP address in square
17845 brackets, followed by a colon and a port number if the logging of ports is
17846 enabled. The format of the rest of the string depends on whether the host
17847 issued a HELO or EHLO SMTP command, and whether the host name was verified by
17848 looking up its IP address. (Looking up the IP address can be forced by the
17849 <option>host_lookup</option> option, independent of verification.) A plain host name at the
17850 start of the string is a verified host name; if this is not present,
17851 verification either failed or was not requested. A host name in parentheses is
17852 the argument of a HELO or EHLO command. This is omitted if it is identical to
17853 the verified host name or to the host&#x2019;s IP address in square brackets.
17854 </para>
17855 </listitem></varlistentry>
17856 <varlistentry>
17857 <term><varname>$sender_helo_name</varname></term>
17858 <listitem>
17859 <para>
17860 <indexterm role="variable">
17861 <primary><varname>$sender_helo_name</varname></primary>
17862 </indexterm>
17863 When a message is received from a remote host that has issued a HELO or EHLO
17864 command, the argument of that command is placed in this variable. It is also
17865 set if HELO or EHLO is used when a message is received using SMTP locally via
17866 the <option>-bs</option> or <option>-bS</option> options.
17867 </para>
17868 </listitem></varlistentry>
17869 <varlistentry>
17870 <term><varname>$sender_host_address</varname></term>
17871 <listitem>
17872 <para>
17873 <indexterm role="variable">
17874 <primary><varname>$sender_host_address</varname></primary>
17875 </indexterm>
17876 When a message is received from a remote host, this variable contains that
17877 host&#x2019;s IP address. For locally submitted messages, it is empty.
17878 </para>
17879 </listitem></varlistentry>
17880 <varlistentry>
17881 <term><varname>$sender_host_authenticated</varname></term>
17882 <listitem>
17883 <para>
17884 <indexterm role="variable">
17885 <primary><varname>$sender_host_authenticated</varname></primary>
17886 </indexterm>
17887 This variable contains the name (not the public name) of the authenticator
17888 driver that successfully authenticated the client from which the message was
17889 received. It is empty if there was no successful authentication. See also
17890 <varname>$authenticated_id</varname>.
17891 </para>
17892 </listitem></varlistentry>
17893 <varlistentry>
17894 <term><varname>$sender_host_name</varname></term>
17895 <listitem>
17896 <para>
17897 <indexterm role="variable">
17898 <primary><varname>$sender_host_name</varname></primary>
17899 </indexterm>
17900 When a message is received from a remote host, this variable contains the
17901 host&#x2019;s name as obtained by looking up its IP address. For messages received by
17902 other means, this variable is empty.
17903 </para>
17904 <para>
17905 <indexterm role="variable">
17906 <primary><varname>$host_lookup_failed</varname></primary>
17907 </indexterm>
17908 If the host name has not previously been looked up, a reference to
17909 <varname>$sender_host_name</varname> triggers a lookup (for messages from remote hosts).
17910 A looked up name is accepted only if it leads back to the original IP address
17911 via a forward lookup. If either the reverse or the forward lookup fails to find
17912 any data, or if the forward lookup does not yield the original IP address,
17913 <varname>$sender_host_name</varname> remains empty, and <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
17914 </para>
17915 <para>
17916 <indexterm role="variable">
17917 <primary><varname>$host_lookup_deferred</varname></primary>
17918 </indexterm>
17919 However, if either of the lookups cannot be completed (for example, there is a
17920 DNS timeout), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>, and
17921 <varname>$host_lookup_failed</varname> remains set to <quote>0</quote>.
17922 </para>
17923 <para>
17924 Once <varname>$host_lookup_failed</varname> is set to <quote>1</quote>, Exim does not try to look up the
17925 host name again if there is a subsequent reference to <varname>$sender_host_name</varname>
17926 in the same Exim process, but it does try again if <varname>$host_lookup_deferred</varname>
17927 is set to <quote>1</quote>.
17928 </para>
17929 <para>
17930 Exim does not automatically look up every calling host&#x2019;s name. If you want
17931 maximum efficiency, you should arrange your configuration so that it avoids
17932 these lookups altogether. The lookup happens only if one or more of the
17933 following are true:
17934 </para>
17935 <itemizedlist>
17936 <listitem>
17937 <para>
17938 A string containing <varname>$sender_host_name</varname> is expanded.
17939 </para>
17940 </listitem>
17941 <listitem>
17942 <para>
17943 The calling host matches the list in <option>host_lookup</option>. In the default
17944 configuration, this option is set to *, so it must be changed if lookups are
17945 to be avoided. (In the code, the default for <option>host_lookup</option> is unset.)
17946 </para>
17947 </listitem>
17948 <listitem>
17949 <para>
17950 Exim needs the host name in order to test an item in a host list. The items
17951 that require this are described in sections <xref linkend="SECThoslispatnam"/> and
17952 <xref linkend="SECThoslispatnamsk"/>.
17953 </para>
17954 </listitem>
17955 <listitem>
17956 <para>
17957 The calling host matches <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>.
17958 In this case, the host name is required to compare with the name quoted in any
17959 EHLO or HELO commands that the client issues.
17960 </para>
17961 </listitem>
17962 <listitem>
17963 <para>
17964 The remote host issues a EHLO or HELO command that quotes one of the
17965 domains in <option>helo_lookup_domains</option>. The default value of this option is
17966 </para>
17967 <literallayout class="monospaced">
17968   helo_lookup_domains = @ : @[]
17969 </literallayout>
17970 <para>
17971 which causes a lookup if a remote host (incorrectly) gives the server&#x2019;s name or
17972 IP address in an EHLO or HELO command.
17973 </para>
17974 </listitem>
17975 </itemizedlist>
17976 </listitem></varlistentry>
17977 <varlistentry>
17978 <term><varname>$sender_host_port</varname></term>
17979 <listitem>
17980 <para>
17981 <indexterm role="variable">
17982 <primary><varname>$sender_host_port</varname></primary>
17983 </indexterm>
17984 When a message is received from a remote host, this variable contains the port
17985 number that was used on the remote host.
17986 </para>
17987 </listitem></varlistentry>
17988 <varlistentry>
17989 <term><varname>$sender_ident</varname></term>
17990 <listitem>
17991 <para>
17992 <indexterm role="variable">
17993 <primary><varname>$sender_ident</varname></primary>
17994 </indexterm>
17995 When a message is received from a remote host, this variable contains the
17996 identification received in response to an RFC 1413 request. When a message has
17997 been received locally, this variable contains the login name of the user that
17998 called Exim.
17999 </para>
18000 </listitem></varlistentry>
18001 <varlistentry>
18002 <term><varname>$sender_rate_</varname><emphasis>xxx</emphasis></term>
18003 <listitem>
18004 <para>
18005 A number of variables whose names begin <varname>$sender_rate_</varname> are set as part of the
18006 <option>ratelimit</option> ACL condition. Details are given in section
18007 <xref linkend="SECTratelimiting"/>.
18008 </para>
18009 </listitem></varlistentry>
18010 <varlistentry>
18011 <term><varname>$sender_rcvhost</varname></term>
18012 <listitem>
18013 <para>
18014 <indexterm role="concept">
18015 <primary>DNS</primary>
18016 <secondary>reverse lookup</secondary>
18017 </indexterm>
18018 <indexterm role="concept">
18019 <primary>reverse DNS lookup</primary>
18020 </indexterm>
18021 <indexterm role="variable">
18022 <primary><varname>$sender_rcvhost</varname></primary>
18023 </indexterm>
18024 This is provided specifically for use in <emphasis>Received:</emphasis> headers. It starts with
18025 either the verified host name (as obtained from a reverse DNS lookup) or, if
18026 there is no verified host name, the IP address in square brackets. After that
18027 there may be text in parentheses. When the first item is a verified host name,
18028 the first thing in the parentheses is the IP address in square brackets,
18029 followed by a colon and a port number if port logging is enabled. When the
18030 first item is an IP address, the port is recorded as <quote>port=<emphasis>xxxx</emphasis></quote> inside
18031 the parentheses.
18032 </para>
18033 <para>
18034 There may also be items of the form <quote>helo=<emphasis>xxxx</emphasis></quote> if HELO or EHLO
18035 was used and its argument was not identical to the real host name or IP
18036 address, and <quote>ident=<emphasis>xxxx</emphasis></quote> if an RFC 1413 ident string is available. If
18037 all three items are present in the parentheses, a newline and tab are inserted
18038 into the string, to improve the formatting of the <emphasis>Received:</emphasis> header.
18039 </para>
18040 </listitem></varlistentry>
18041 <varlistentry>
18042 <term><varname>$sender_verify_failure</varname></term>
18043 <listitem>
18044 <para>
18045 <indexterm role="variable">
18046 <primary><varname>$sender_verify_failure</varname></primary>
18047 </indexterm>
18048 In an ACL, when a sender verification fails, this variable contains information
18049 about the failure. The details are the same as for
18050 <varname>$recipient_verify_failure</varname>.
18051 </para>
18052 </listitem></varlistentry>
18053 <varlistentry>
18054 <term><varname>$sending_ip_address</varname></term>
18055 <listitem>
18056 <para>
18057 <indexterm role="variable">
18058 <primary><varname>$sending_ip_address</varname></primary>
18059 </indexterm>
18060 This variable is set whenever an outgoing SMTP connection to another host has
18061 been set up. It contains the IP address of the local interface that is being
18062 used. This is useful if a host that has more than one IP address wants to take
18063 on different personalities depending on which one is being used. For incoming
18064 connections, see <varname>$received_ip_address</varname>.
18065 </para>
18066 </listitem></varlistentry>
18067 <varlistentry>
18068 <term><varname>$sending_port</varname></term>
18069 <listitem>
18070 <para>
18071 <indexterm role="variable">
18072 <primary><varname>$sending_port</varname></primary>
18073 </indexterm>
18074 This variable is set whenever an outgoing SMTP connection to another host has
18075 been set up. It contains the local port that is being used. For incoming
18076 connections, see <varname>$received_port</varname>.
18077 </para>
18078 </listitem></varlistentry>
18079 <varlistentry>
18080 <term><varname>$smtp_active_hostname</varname></term>
18081 <listitem>
18082 <para>
18083 <indexterm role="variable">
18084 <primary><varname>$smtp_active_hostname</varname></primary>
18085 </indexterm>
18086 During an incoming SMTP session, this variable contains the value of the active
18087 host name, as specified by the <option>smtp_active_hostname</option> option. The value of
18088 <varname>$smtp_active_hostname</varname> is saved with any message that is received, so its
18089 value can be consulted during routing and delivery.
18090 </para>
18091 </listitem></varlistentry>
18092 <varlistentry>
18093 <term><varname>$smtp_command</varname></term>
18094 <listitem>
18095 <para>
18096 <indexterm role="variable">
18097 <primary><varname>$smtp_command</varname></primary>
18098 </indexterm>
18099 During the processing of an incoming SMTP command, this variable contains the
18100 entire command. This makes it possible to distinguish between HELO and EHLO in
18101 the HELO ACL, and also to distinguish between commands such as these:
18102 </para>
18103 <literallayout class="monospaced">
18104 MAIL FROM:&lt;&gt;
18105 MAIL FROM: &lt;&gt;
18106 </literallayout>
18107 <para>
18108 For a MAIL command, extra parameters such as SIZE can be inspected. For a RCPT
18109 command, the address in <varname>$smtp_command</varname> is the original address before any
18110 rewriting, whereas the values in <varname>$local_part</varname> and <varname>$domain</varname> are taken from
18111 the address after SMTP-time rewriting.
18112 </para>
18113 </listitem></varlistentry>
18114 <varlistentry>
18115 <term><varname>$smtp_command_argument</varname></term>
18116 <listitem>
18117 <para>
18118 <indexterm role="concept">
18119 <primary>SMTP</primary>
18120 <secondary>command, argument for</secondary>
18121 </indexterm>
18122 <indexterm role="variable">
18123 <primary><varname>$smtp_command_argument</varname></primary>
18124 </indexterm>
18125 While an ACL is running to check an SMTP command, this variable contains the
18126 argument, that is, the text that follows the command name, with leading white
18127 space removed. Following the introduction of <varname>$smtp_command</varname>, this variable is
18128 somewhat redundant, but is retained for backwards compatibility.
18129 </para>
18130 </listitem></varlistentry>
18131 <varlistentry>
18132 <term><varname>$smtp_count_at_connection_start</varname></term>
18133 <listitem>
18134 <para>
18135 <indexterm role="variable">
18136 <primary><varname>$smtp_count_at_connection_start</varname></primary>
18137 </indexterm>
18138 This variable is set greater than zero only in processes spawned by the Exim
18139 daemon for handling incoming SMTP connections. The name is deliberately long,
18140 in order to emphasize what the contents are. When the daemon accepts a new
18141 connection, it increments this variable. A copy of the variable is passed to
18142 the child process that handles the connection, but its value is fixed, and
18143 never changes. It is only an approximation of how many incoming connections
18144 there actually are, because many other connections may come and go while a
18145 single connection is being processed. When a child process terminates, the
18146 daemon decrements its copy of the variable.
18147 </para>
18148 </listitem></varlistentry>
18149 <varlistentry>
18150 <term><varname>$sn0</varname> &ndash; <varname>$sn9</varname></term>
18151 <listitem>
18152 <para>
18153 These variables are copies of the values of the <varname>$n0</varname> &ndash; <varname>$n9</varname> accumulators
18154 that were current at the end of the system filter file. This allows a system
18155 filter file to set values that can be tested in users&#x2019; filter files. For
18156 example, a system filter could set a value indicating how likely it is that a
18157 message is junk mail.
18158 </para>
18159 </listitem></varlistentry>
18160 <varlistentry>
18161 <term><varname>$spam_</varname><emphasis>xxx</emphasis></term>
18162 <listitem>
18163 <para>
18164 A number of variables whose names start with <varname>$spam</varname> are available when Exim
18165 is compiled with the content-scanning extension. For details, see section
18166 <xref linkend="SECTscanspamass"/>.
18167 </para>
18168 </listitem></varlistentry>
18169 <varlistentry>
18170 <term><varname>$spool_directory</varname></term>
18171 <listitem>
18172 <para>
18173 <indexterm role="variable">
18174 <primary><varname>$spool_directory</varname></primary>
18175 </indexterm>
18176 The name of Exim&#x2019;s spool directory.
18177 </para>
18178 </listitem></varlistentry>
18179 <varlistentry>
18180 <term><varname>$spool_inodes</varname></term>
18181 <listitem>
18182 <para>
18183 <indexterm role="variable">
18184 <primary><varname>$spool_inodes</varname></primary>
18185 </indexterm>
18186 The number of free inodes in the disk partition where Exim&#x2019;s spool files are
18187 being written. The value is recalculated whenever the variable is referenced.
18188 If the relevant file system does not have the concept of inodes, the value of
18189 is -1. See also the <option>check_spool_inodes</option> option.
18190 </para>
18191 </listitem></varlistentry>
18192 <varlistentry>
18193 <term><varname>$spool_space</varname></term>
18194 <listitem>
18195 <para>
18196 <indexterm role="variable">
18197 <primary><varname>$spool_space</varname></primary>
18198 </indexterm>
18199 The amount of free space (as a number of kilobytes) in the disk partition where
18200 Exim&#x2019;s spool files are being written. The value is recalculated whenever the
18201 variable is referenced. If the operating system does not have the ability to
18202 find the amount of free space (only true for experimental systems), the space
18203 value is -1. For example, to check in an ACL that there is at least 50
18204 megabytes free on the spool, you could write:
18205 </para>
18206 <literallayout class="monospaced">
18207 condition = ${if &gt; {$spool_space}{50000}}
18208 </literallayout>
18209 <para>
18210 See also the <option>check_spool_space</option> option.
18211 </para>
18212 </listitem></varlistentry>
18213 <varlistentry>
18214 <term><varname>$thisaddress</varname></term>
18215 <listitem>
18216 <para>
18217 <indexterm role="variable">
18218 <primary><varname>$thisaddress</varname></primary>
18219 </indexterm>
18220 This variable is set only during the processing of the <option>foranyaddress</option>
18221 command in a filter file. Its use is explained in the description of that
18222 command, which can be found in the separate document entitled <emphasis>Exim&#x2019;s
18223 interfaces to mail filtering</emphasis>.
18224 </para>
18225 </listitem></varlistentry>
18226 <varlistentry>
18227 <term><varname>$tls_certificate_verified</varname></term>
18228 <listitem>
18229 <para>
18230 <indexterm role="variable">
18231 <primary><varname>$tls_certificate_verified</varname></primary>
18232 </indexterm>
18233 This variable is set to <quote>1</quote> if a TLS certificate was verified when the
18234 message was received, and <quote>0</quote> otherwise.
18235 </para>
18236 </listitem></varlistentry>
18237 <varlistentry>
18238 <term><varname>$tls_cipher</varname></term>
18239 <listitem>
18240 <para>
18241 <indexterm role="variable">
18242 <primary><varname>$tls_cipher</varname></primary>
18243 </indexterm>
18244 When a message is received from a remote host over an encrypted SMTP
18245 connection, this variable is set to the cipher suite that was negotiated, for
18246 example DES-CBC3-SHA. In other circumstances, in particular, for message
18247 received over unencrypted connections, the variable is empty. Testing
18248 <varname>$tls_cipher</varname> for emptiness is one way of distinguishing between encrypted and
18249 non-encrypted connections during ACL processing.
18250 </para>
18251 <para>
18252 The <varname>$tls_cipher</varname> variable retains its value during message delivery, except
18253 when an outward SMTP delivery takes place via the <command>smtp</command> transport. In this
18254 case, <varname>$tls_cipher</varname> is cleared before any outgoing SMTP connection is made,
18255 and then set to the outgoing cipher suite if one is negotiated. See chapter
18256 <xref linkend="CHAPTLS"/> for details of TLS support and chapter <xref linkend="CHAPsmtptrans"/> for
18257 details of the <command>smtp</command> transport.
18258 </para>
18259 </listitem></varlistentry>
18260 <varlistentry>
18261 <term><varname>$tls_peerdn</varname></term>
18262 <listitem>
18263 <para>
18264 <indexterm role="variable">
18265 <primary><varname>$tls_peerdn</varname></primary>
18266 </indexterm>
18267 When a message is received from a remote host over an encrypted SMTP
18268 connection, and Exim is configured to request a certificate from the client,
18269 the value of the Distinguished Name of the certificate is made available in the
18270 <varname>$tls_peerdn</varname> during subsequent processing. Like <varname>$tls_cipher</varname>, the
18271 value is retained during message delivery, except during outbound SMTP
18272 deliveries.
18273 </para>
18274 </listitem></varlistentry>
18275 <varlistentry>
18276 <term><varname>$tod_bsdinbox</varname></term>
18277 <listitem>
18278 <para>
18279 <indexterm role="variable">
18280 <primary><varname>$tod_bsdinbox</varname></primary>
18281 </indexterm>
18282 The time of day and the date, in the format required for BSD-style mailbox
18283 files, for example: Thu Oct 17 17:14:09 1995.
18284 </para>
18285 </listitem></varlistentry>
18286 <varlistentry>
18287 <term><varname>$tod_epoch</varname></term>
18288 <listitem>
18289 <para>
18290 <indexterm role="variable">
18291 <primary><varname>$tod_epoch</varname></primary>
18292 </indexterm>
18293 The time and date as a number of seconds since the start of the Unix epoch.
18294 </para>
18295 </listitem></varlistentry>
18296 <varlistentry>
18297 <term><varname>$tod_full</varname></term>
18298 <listitem>
18299 <para>
18300 <indexterm role="variable">
18301 <primary><varname>$tod_full</varname></primary>
18302 </indexterm>
18303 A full version of the time and date, for example: Wed, 16 Oct 1995 09:51:40
18304 +0100. The timezone is always given as a numerical offset from UTC, with
18305 positive values used for timezones that are ahead (east) of UTC, and negative
18306 values for those that are behind (west).
18307 </para>
18308 </listitem></varlistentry>
18309 <varlistentry>
18310 <term><varname>$tod_log</varname></term>
18311 <listitem>
18312 <para>
18313 <indexterm role="variable">
18314 <primary><varname>$tod_log</varname></primary>
18315 </indexterm>
18316 The time and date in the format used for writing Exim&#x2019;s log files, for example:
18317 1995-10-12 15:32:29, but without a timezone.
18318 </para>
18319 </listitem></varlistentry>
18320 <varlistentry>
18321 <term><varname>$tod_logfile</varname></term>
18322 <listitem>
18323 <para>
18324 <indexterm role="variable">
18325 <primary><varname>$tod_logfile</varname></primary>
18326 </indexterm>
18327 This variable contains the date in the format yyyymmdd. This is the format that
18328 is used for datestamping log files when <option>log_file_path</option> contains the <literal>%D</literal>
18329 flag.
18330 </para>
18331 </listitem></varlistentry>
18332 <varlistentry>
18333 <term><varname>$tod_zone</varname></term>
18334 <listitem>
18335 <para>
18336 <indexterm role="variable">
18337 <primary><varname>$tod_zone</varname></primary>
18338 </indexterm>
18339 This variable contains the numerical value of the local timezone, for example:
18340 -0500.
18341 </para>
18342 </listitem></varlistentry>
18343 <varlistentry>
18344 <term><varname>$tod_zulu</varname></term>
18345 <listitem>
18346 <para>
18347 <indexterm role="variable">
18348 <primary><varname>$tod_zulu</varname></primary>
18349 </indexterm>
18350 This variable contains the UTC date and time in <quote>Zulu</quote> format, as specified
18351 by ISO 8601, for example: 20030221154023Z.
18352 </para>
18353 </listitem></varlistentry>
18354 <varlistentry>
18355 <term><varname>$value</varname></term>
18356 <listitem>
18357 <para>
18358 <indexterm role="variable">
18359 <primary><varname>$value</varname></primary>
18360 </indexterm>
18361 This variable contains the result of an expansion lookup, extraction operation,
18362 or external command, as described above. It is also used during a
18363 <emphasis role="bold">reduce</emphasis> expansion.
18364 </para>
18365 </listitem></varlistentry>
18366 <varlistentry>
18367 <term><varname>$version_number</varname></term>
18368 <listitem>
18369 <para>
18370 <indexterm role="variable">
18371 <primary><varname>$version_number</varname></primary>
18372 </indexterm>
18373 The version number of Exim.
18374 </para>
18375 </listitem></varlistentry>
18376 <varlistentry>
18377 <term><varname>$warn_message_delay</varname></term>
18378 <listitem>
18379 <para>
18380 <indexterm role="variable">
18381 <primary><varname>$warn_message_delay</varname></primary>
18382 </indexterm>
18383 This variable is set only during the creation of a message warning about a
18384 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
18385 </para>
18386 </listitem></varlistentry>
18387 <varlistentry>
18388 <term><varname>$warn_message_recipients</varname></term>
18389 <listitem>
18390 <para>
18391 <indexterm role="variable">
18392 <primary><varname>$warn_message_recipients</varname></primary>
18393 </indexterm>
18394 This variable is set only during the creation of a message warning about a
18395 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
18396 </para>
18397 </listitem></varlistentry>
18398 </variablelist>
18399 <para>
18400 <indexterm role="concept" startref="IIDstrexp" class="endofrange"/>
18401 </para>
18402 </section>
18403 </chapter>
18404
18405 <chapter id="CHAPperl">
18406 <title>Embedded Perl</title>
18407 <para>
18408 <indexterm role="concept" id="IIDperl" class="startofrange">
18409 <primary>Perl</primary>
18410 <secondary>calling from Exim</secondary>
18411 </indexterm>
18412 Exim can be built to include an embedded Perl interpreter. When this is done,
18413 Perl subroutines can be called as part of the string expansion process. To make
18414 use of the Perl support, you need version 5.004 or later of Perl installed on
18415 your system. To include the embedded interpreter in the Exim binary, include
18416 the line
18417 </para>
18418 <literallayout class="monospaced">
18419 EXIM_PERL = perl.o
18420 </literallayout>
18421 <para>
18422 in your <filename>Local/Makefile</filename> and then build Exim in the normal way.
18423 </para>
18424 <section id="SECID85">
18425 <title>Setting up so Perl can be used</title>
18426 <para>
18427 <indexterm role="option">
18428 <primary><option>perl_startup</option></primary>
18429 </indexterm>
18430 Access to Perl subroutines is via a global configuration option called
18431 <option>perl_startup</option> and an expansion string operator <option>${perl ...}</option>. If there is
18432 no <option>perl_startup</option> option in the Exim configuration file then no Perl
18433 interpreter is started and there is almost no overhead for Exim (since none of
18434 the Perl library will be paged in unless used). If there is a <option>perl_startup</option>
18435 option then the associated value is taken to be Perl code which is executed in
18436 a newly created Perl interpreter.
18437 </para>
18438 <para>
18439 The value of <option>perl_startup</option> is not expanded in the Exim sense, so you do not
18440 need backslashes before any characters to escape special meanings. The option
18441 should usually be something like
18442 </para>
18443 <literallayout class="monospaced">
18444 perl_startup = do '/etc/exim.pl'
18445 </literallayout>
18446 <para>
18447 where <filename>/etc/exim.pl</filename> is Perl code which defines any subroutines you want to
18448 use from Exim. Exim can be configured either to start up a Perl interpreter as
18449 soon as it is entered, or to wait until the first time it is needed. Starting
18450 the interpreter at the beginning ensures that it is done while Exim still has
18451 its setuid privilege, but can impose an unnecessary overhead if Perl is not in
18452 fact used in a particular run. Also, note that this does not mean that Exim is
18453 necessarily running as root when Perl is called at a later time. By default,
18454 the interpreter is started only when it is needed, but this can be changed in
18455 two ways:
18456 </para>
18457 <itemizedlist>
18458 <listitem>
18459 <para>
18460 <indexterm role="option">
18461 <primary><option>perl_at_start</option></primary>
18462 </indexterm>
18463 Setting <option>perl_at_start</option> (a boolean option) in the configuration requests
18464 a startup when Exim is entered.
18465 </para>
18466 </listitem>
18467 <listitem>
18468 <para>
18469 The command line option <option>-ps</option> also requests a startup when Exim is entered,
18470 overriding the setting of <option>perl_at_start</option>.
18471 </para>
18472 </listitem>
18473 </itemizedlist>
18474 <para>
18475 There is also a command line option <option>-pd</option> (for delay) which suppresses the
18476 initial startup, even if <option>perl_at_start</option> is set.
18477 </para>
18478 </section>
18479 <section id="SECID86">
18480 <title>Calling Perl subroutines</title>
18481 <para>
18482 When the configuration file includes a <option>perl_startup</option> option you can make use
18483 of the string expansion item to call the Perl subroutines that are defined
18484 by the <option>perl_startup</option> code. The operator is used in any of the following
18485 forms:
18486 </para>
18487 <literallayout class="monospaced">
18488 ${perl{foo}}
18489 ${perl{foo}{argument}}
18490 ${perl{foo}{argument1}{argument2} ... }
18491 </literallayout>
18492 <para>
18493 which calls the subroutine <option>foo</option> with the given arguments. A maximum of eight
18494 arguments may be passed. Passing more than this results in an expansion failure
18495 with an error message of the form
18496 </para>
18497 <literallayout class="monospaced">
18498 Too many arguments passed to Perl subroutine "foo" (max is 8)
18499 </literallayout>
18500 <para>
18501 The return value of the Perl subroutine is evaluated in a scalar context before
18502 it is passed back to Exim to be inserted into the expanded string. If the
18503 return value is <emphasis>undef</emphasis>, the expansion is forced to fail in the same way as
18504 an explicit <quote>fail</quote> on an <option>if</option> or <option>lookup</option> item. If the subroutine aborts
18505 by obeying Perl&#x2019;s <option>die</option> function, the expansion fails with the error message
18506 that was passed to <option>die</option>.
18507 </para>
18508 </section>
18509 <section id="SECID87">
18510 <title>Calling Exim functions from Perl</title>
18511 <para>
18512 Within any Perl code called from Exim, the function <emphasis>Exim::expand_string()</emphasis>
18513 is available to call back into Exim&#x2019;s string expansion function. For example,
18514 the Perl code
18515 </para>
18516 <literallayout class="monospaced">
18517 my $lp = Exim::expand_string('$local_part');
18518 </literallayout>
18519 <para>
18520 makes the current Exim <varname>$local_part</varname> available in the Perl variable <varname>$lp</varname>.
18521 Note those are single quotes and not double quotes to protect against
18522 <varname>$local_part</varname> being interpolated as a Perl variable.
18523 </para>
18524 <para>
18525 If the string expansion is forced to fail by a <quote>fail</quote> item, the result of
18526 <emphasis>Exim::expand_string()</emphasis> is <option>undef</option>. If there is a syntax error in the
18527 expansion string, the Perl call from the original expansion string fails with
18528 an appropriate error message, in the same way as if <option>die</option> were used.
18529 </para>
18530 <para>
18531 <indexterm role="concept">
18532 <primary>debugging</primary>
18533 <secondary>from embedded Perl</secondary>
18534 </indexterm>
18535 <indexterm role="concept">
18536 <primary>log</primary>
18537 <secondary>writing from embedded Perl</secondary>
18538 </indexterm>
18539 Two other Exim functions are available for use from within Perl code.
18540 <emphasis>Exim::debug_write()</emphasis> writes a string to the standard error stream if Exim&#x2019;s
18541 debugging is enabled. If you want a newline at the end, you must supply it.
18542 <emphasis>Exim::log_write()</emphasis> writes a string to Exim&#x2019;s main log, adding a leading
18543 timestamp. In this case, you should not supply a terminating newline.
18544 </para>
18545 </section>
18546 <section id="SECID88">
18547 <title>Use of standard output and error by Perl</title>
18548 <para>
18549 <indexterm role="concept">
18550 <primary>Perl</primary>
18551 <secondary>standard output and error</secondary>
18552 </indexterm>
18553 You should not write to the standard error or output streams from within your
18554 Perl code, as it is not defined how these are set up. In versions of Exim
18555 before 4.50, it is possible for the standard output or error to refer to the
18556 SMTP connection during message reception via the daemon. Writing to this stream
18557 is certain to cause chaos. From Exim 4.50 onwards, the standard output and
18558 error streams are connected to <filename>/dev/null</filename> in the daemon. The chaos is
18559 avoided, but the output is lost.
18560 </para>
18561 <para>
18562 <indexterm role="concept">
18563 <primary>Perl</primary>
18564 <secondary>use of <option>warn</option></secondary>
18565 </indexterm>
18566 The Perl <option>warn</option> statement writes to the standard error stream by default.
18567 Calls to <option>warn</option> may be embedded in Perl modules that you use, but over which
18568 you have no control. When Exim starts up the Perl interpreter, it arranges for
18569 output from the <option>warn</option> statement to be written to the Exim main log. You can
18570 change this by including appropriate Perl magic somewhere in your Perl code.
18571 For example, to discard <option>warn</option> output completely, you need this:
18572 </para>
18573 <literallayout class="monospaced">
18574 $SIG{__WARN__} = sub { };
18575 </literallayout>
18576 <para>
18577 Whenever a <option>warn</option> is obeyed, the anonymous subroutine is called. In this
18578 example, the code for the subroutine is empty, so it does nothing, but you can
18579 include any Perl code that you like. The text of the <option>warn</option> message is passed
18580 as the first subroutine argument.
18581 <indexterm role="concept" startref="IIDperl" class="endofrange"/>
18582 </para>
18583 </section>
18584 </chapter>
18585
18586 <chapter id="CHAPinterfaces">
18587 <title>Starting the daemon and the use of network interfaces</title>
18588 <titleabbrev>Starting the daemon</titleabbrev>
18589 <para>
18590 <indexterm role="concept">
18591 <primary>daemon</primary>
18592 <secondary>starting</secondary>
18593 </indexterm>
18594 <indexterm role="concept">
18595 <primary>interface</primary>
18596 <secondary>listening</secondary>
18597 </indexterm>
18598 <indexterm role="concept">
18599 <primary>network interface</primary>
18600 </indexterm>
18601 <indexterm role="concept">
18602 <primary>interface</primary>
18603 <secondary>network</secondary>
18604 </indexterm>
18605 <indexterm role="concept">
18606 <primary>IP address</primary>
18607 <secondary>for listening</secondary>
18608 </indexterm>
18609 <indexterm role="concept">
18610 <primary>daemon</primary>
18611 <secondary>listening IP addresses</secondary>
18612 </indexterm>
18613 <indexterm role="concept">
18614 <primary>TCP/IP</primary>
18615 <secondary>setting listening interfaces</secondary>
18616 </indexterm>
18617 <indexterm role="concept">
18618 <primary>TCP/IP</primary>
18619 <secondary>setting listening ports</secondary>
18620 </indexterm>
18621 A host that is connected to a TCP/IP network may have one or more physical
18622 hardware network interfaces. Each of these interfaces may be configured as one
18623 or more <quote>logical</quote> interfaces, which are the entities that a program actually
18624 works with. Each of these logical interfaces is associated with an IP address.
18625 In addition, TCP/IP software supports <quote>loopback</quote> interfaces (127.0.0.1 in
18626 IPv4 and ::1 in IPv6), which do not use any physical hardware. Exim requires
18627 knowledge about the host&#x2019;s interfaces for use in three different circumstances:
18628 </para>
18629 <orderedlist numeration="arabic">
18630 <listitem>
18631 <para>
18632 When a listening daemon is started, Exim needs to know which interfaces
18633 and ports to listen on.
18634 </para>
18635 </listitem>
18636 <listitem>
18637 <para>
18638 When Exim is routing an address, it needs to know which IP addresses
18639 are associated with local interfaces. This is required for the correct
18640 processing of MX lists by removing the local host and others with the
18641 same or higher priority values. Also, Exim needs to detect cases
18642 when an address is routed to an IP address that in fact belongs to the
18643 local host. Unless the <option>self</option> router option or the <option>allow_localhost</option>
18644 option of the smtp transport is set (as appropriate), this is treated
18645 as an error situation.
18646 </para>
18647 </listitem>
18648 <listitem>
18649 <para>
18650 When Exim connects to a remote host, it may need to know which interface to use
18651 for the outgoing connection.
18652 </para>
18653 </listitem>
18654 </orderedlist>
18655 <para>
18656 Exim&#x2019;s default behaviour is likely to be appropriate in the vast majority
18657 of cases. If your host has only one interface, and you want all its IP
18658 addresses to be treated in the same way, and you are using only the
18659 standard SMTP port, you should not need to take any special action. The
18660 rest of this chapter does not apply to you.
18661 </para>
18662 <para>
18663 In a more complicated situation you may want to listen only on certain
18664 interfaces, or on different ports, and for this reason there are a number of
18665 options that can be used to influence Exim&#x2019;s behaviour. The rest of this
18666 chapter describes how they operate.
18667 </para>
18668 <para>
18669 When a message is received over TCP/IP, the interface and port that were
18670 actually used are set in <varname>$received_ip_address</varname> and <varname>$received_port</varname>.
18671 </para>
18672 <section id="SECID89">
18673 <title>Starting a listening daemon</title>
18674 <para>
18675 When a listening daemon is started (by means of the <option>-bd</option> command line
18676 option), the interfaces and ports on which it listens are controlled by the
18677 following options:
18678 </para>
18679 <itemizedlist>
18680 <listitem>
18681 <para>
18682 <option>daemon_smtp_ports</option> contains a list of default ports. (For backward
18683 compatibility, this option can also be specified in the singular.)
18684 </para>
18685 </listitem>
18686 <listitem>
18687 <para>
18688 <option>local_interfaces</option> contains list of interface IP addresses on which to
18689 listen. Each item may optionally also specify a port.
18690 </para>
18691 </listitem>
18692 </itemizedlist>
18693 <para>
18694 The default list separator in both cases is a colon, but this can be changed as
18695 described in section <xref linkend="SECTlistconstruct"/>. When IPv6 addresses are involved,
18696 it is usually best to change the separator to avoid having to double all the
18697 colons. For example:
18698 </para>
18699 <literallayout class="monospaced">
18700 local_interfaces = &lt;; 127.0.0.1 ; \
18701                       192.168.23.65 ; \
18702                       ::1 ; \
18703                       3ffe:ffff:836f::fe86:a061
18704 </literallayout>
18705 <para>
18706 There are two different formats for specifying a port along with an IP address
18707 in <option>local_interfaces</option>:
18708 </para>
18709 <orderedlist numeration="arabic">
18710 <listitem>
18711 <para>
18712 The port is added onto the address with a dot separator. For example, to listen
18713 on port 1234 on two different IP addresses:
18714 </para>
18715 <literallayout class="monospaced">
18716 local_interfaces = &lt;; 192.168.23.65.1234 ; \
18717                       3ffe:ffff:836f::fe86:a061.1234
18718 </literallayout>
18719 </listitem>
18720 <listitem>
18721 <para>
18722 The IP address is enclosed in square brackets, and the port is added
18723 with a colon separator, for example:
18724 </para>
18725 <literallayout class="monospaced">
18726 local_interfaces = &lt;; [192.168.23.65]:1234 ; \
18727                       [3ffe:ffff:836f::fe86:a061]:1234
18728 </literallayout>
18729 </listitem>
18730 </orderedlist>
18731 <para>
18732 When a port is not specified, the value of <option>daemon_smtp_ports</option> is used. The
18733 default setting contains just one port:
18734 </para>
18735 <literallayout class="monospaced">
18736 daemon_smtp_ports = smtp
18737 </literallayout>
18738 <para>
18739 If more than one port is listed, each interface that does not have its own port
18740 specified listens on all of them. Ports that are listed in
18741 <option>daemon_smtp_ports</option> can be identified either by name (defined in
18742 <filename>/etc/services</filename>) or by number. However, when ports are given with individual
18743 IP addresses in <option>local_interfaces</option>, only numbers (not names) can be used.
18744 </para>
18745 </section>
18746 <section id="SECID90">
18747 <title>Special IP listening addresses</title>
18748 <para>
18749 The addresses 0.0.0.0 and ::0 are treated specially. They are interpreted
18750 as <quote>all IPv4 interfaces</quote> and <quote>all IPv6 interfaces</quote>, respectively. In each
18751 case, Exim tells the TCP/IP stack to <quote>listen on all IPv<emphasis>x</emphasis> interfaces</quote>
18752 instead of setting up separate listening sockets for each interface. The
18753 default value of <option>local_interfaces</option> is
18754 </para>
18755 <literallayout class="monospaced">
18756 local_interfaces = 0.0.0.0
18757 </literallayout>
18758 <para>
18759 when Exim is built without IPv6 support; otherwise it is:
18760 </para>
18761 <literallayout class="monospaced">
18762 local_interfaces = &lt;; ::0 ; 0.0.0.0
18763 </literallayout>
18764 <para>
18765 Thus, by default, Exim listens on all available interfaces, on the SMTP port.
18766 </para>
18767 </section>
18768 <section id="SECID91">
18769 <title>Overriding local_interfaces and daemon_smtp_ports</title>
18770 <para>
18771 The <option>-oX</option> command line option can be used to override the values of
18772 <option>daemon_smtp_ports</option> and/or <option>local_interfaces</option> for a particular daemon
18773 instance. Another way of doing this would be to use macros and the <option>-D</option>
18774 option. However, <option>-oX</option> can be used by any admin user, whereas modification of
18775 the runtime configuration by <option>-D</option> is allowed only when the caller is root or
18776 exim.
18777 </para>
18778 <para>
18779 The value of <option>-oX</option> is a list of items. The default colon separator can be
18780 changed in the usual way if required. If there are any items that do not
18781 contain dots or colons (that is, are not IP addresses), the value of
18782 <option>daemon_smtp_ports</option> is replaced by the list of those items. If there are any
18783 items that do contain dots or colons, the value of <option>local_interfaces</option> is
18784 replaced by those items. Thus, for example,
18785 </para>
18786 <literallayout class="monospaced">
18787 -oX 1225
18788 </literallayout>
18789 <para>
18790 overrides <option>daemon_smtp_ports</option>, but leaves <option>local_interfaces</option> unchanged,
18791 whereas
18792 </para>
18793 <literallayout class="monospaced">
18794 -oX 192.168.34.5.1125
18795 </literallayout>
18796 <para>
18797 overrides <option>local_interfaces</option>, leaving <option>daemon_smtp_ports</option> unchanged.
18798 (However, since <option>local_interfaces</option> now contains no items without ports, the
18799 value of <option>daemon_smtp_ports</option> is no longer relevant in this example.)
18800 </para>
18801 </section>
18802 <section id="SECTsupobssmt">
18803 <title>Support for the obsolete SSMTP (or SMTPS) protocol</title>
18804 <para>
18805 <indexterm role="concept">
18806 <primary>ssmtp protocol</primary>
18807 </indexterm>
18808 <indexterm role="concept">
18809 <primary>smtps protocol</primary>
18810 </indexterm>
18811 <indexterm role="concept">
18812 <primary>SMTP</primary>
18813 <secondary>ssmtp protocol</secondary>
18814 </indexterm>
18815 <indexterm role="concept">
18816 <primary>SMTP</primary>
18817 <secondary>smtps protocol</secondary>
18818 </indexterm>
18819 Exim supports the obsolete SSMTP protocol (also known as SMTPS) that was used
18820 before the STARTTLS command was standardized for SMTP. Some legacy clients
18821 still use this protocol. If the <option>tls_on_connect_ports</option> option is set to a
18822 list of port numbers, connections to those ports must use SSMTP. The most
18823 common use of this option is expected to be
18824 </para>
18825 <literallayout class="monospaced">
18826 tls_on_connect_ports = 465
18827 </literallayout>
18828 <para>
18829 because 465 is the usual port number used by the legacy clients. There is also
18830 a command line option <option>-tls-on-connect</option>, which forces all ports to behave in
18831 this way when a daemon is started.
18832 </para>
18833 <para>
18834 <emphasis role="bold">Warning</emphasis>: Setting <option>tls_on_connect_ports</option> does not of itself cause the
18835 daemon to listen on those ports. You must still specify them in
18836 <option>daemon_smtp_ports</option>, <option>local_interfaces</option>, or the <option>-oX</option> option. (This is
18837 because <option>tls_on_connect_ports</option> applies to <option>inetd</option> connections as well as to
18838 connections via the daemon.)
18839 </para>
18840 </section>
18841 <section id="SECID92">
18842 <title>IPv6 address scopes</title>
18843 <para>
18844 <indexterm role="concept">
18845 <primary>IPv6</primary>
18846 <secondary>address scopes</secondary>
18847 </indexterm>
18848 IPv6 addresses have <quote>scopes</quote>, and a host with multiple hardware interfaces
18849 can, in principle, have the same link-local IPv6 address on different
18850 interfaces. Thus, additional information is needed, over and above the IP
18851 address, to distinguish individual interfaces. A convention of using a
18852 percent sign followed by something (often the interface name) has been
18853 adopted in some cases, leading to addresses like this:
18854 </para>
18855 <literallayout class="monospaced">
18856 fe80::202:b3ff:fe03:45c1%eth0
18857 </literallayout>
18858 <para>
18859 To accommodate this usage, a percent sign followed by an arbitrary string is
18860 allowed at the end of an IPv6 address. By default, Exim calls <function>getaddrinfo()</function>
18861 to convert a textual IPv6 address for actual use. This function recognizes the
18862 percent convention in operating systems that support it, and it processes the
18863 address appropriately. Unfortunately, some older libraries have problems with
18864 <function>getaddrinfo()</function>. If
18865 </para>
18866 <literallayout class="monospaced">
18867 IPV6_USE_INET_PTON=yes
18868 </literallayout>
18869 <para>
18870 is set in <filename>Local/Makefile</filename> (or an OS-dependent Makefile) when Exim is built,
18871 Exim uses <emphasis>inet_pton()</emphasis> to convert a textual IPv6 address for actual use,
18872 instead of <function>getaddrinfo()</function>. (Before version 4.14, it always used this
18873 function.) Of course, this means that the additional functionality of
18874 <function>getaddrinfo()</function> &ndash; recognizing scoped addresses &ndash; is lost.
18875 </para>
18876 </section>
18877 <section id="SECID93">
18878 <title>Disabling IPv6</title>
18879 <para>
18880 <indexterm role="concept">
18881 <primary>IPv6</primary>
18882 <secondary>disabling</secondary>
18883 </indexterm>
18884 Sometimes it happens that an Exim binary that was compiled with IPv6 support is
18885 run on a host whose kernel does not support IPv6. The binary will fall back to
18886 using IPv4, but it may waste resources looking up AAAA records, and trying to
18887 connect to IPv6 addresses, causing delays to mail delivery. If you set the
18888 <indexterm role="option">
18889 <primary><option>disable_ipv6</option></primary>
18890 </indexterm>
18891 <option>disable_ipv6</option> option true, even if the Exim binary has IPv6 support, no IPv6
18892 activities take place. AAAA records are never looked up, and any IPv6 addresses
18893 that are listed in <option>local_interfaces</option>, data for the <command>manualroute</command> router,
18894 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
18895 to handle IPv6 literal addresses.
18896 </para>
18897 <para>
18898 On the other hand, when IPv6 is in use, there may be times when you want to
18899 disable it for certain hosts or domains. You can use the <option>dns_ipv4_lookup</option>
18900 option to globally suppress the lookup of AAAA records for specified domains,
18901 and you can use the <option>ignore_target_hosts</option> generic router option to ignore
18902 IPv6 addresses in an individual router.
18903 </para>
18904 </section>
18905 <section id="SECID94">
18906 <title>Examples of starting a listening daemon</title>
18907 <para>
18908 The default case in an IPv6 environment is
18909 </para>
18910 <literallayout class="monospaced">
18911 daemon_smtp_ports = smtp
18912 local_interfaces = &lt;; ::0 ; 0.0.0.0
18913 </literallayout>
18914 <para>
18915 This specifies listening on the smtp port on all IPv6 and IPv4 interfaces.
18916 Either one or two sockets may be used, depending on the characteristics of
18917 the TCP/IP stack. (This is complicated and messy; for more information,
18918 read the comments in the <filename>daemon.c</filename> source file.)
18919 </para>
18920 <para>
18921 To specify listening on ports 25 and 26 on all interfaces:
18922 </para>
18923 <literallayout class="monospaced">
18924 daemon_smtp_ports = 25 : 26
18925 </literallayout>
18926 <para>
18927 (leaving <option>local_interfaces</option> at the default setting) or, more explicitly:
18928 </para>
18929 <literallayout class="monospaced">
18930 local_interfaces = &lt;; ::0.25     ; ::0.26 \
18931                       0.0.0.0.25 ; 0.0.0.0.26
18932 </literallayout>
18933 <para>
18934 To listen on the default port on all IPv4 interfaces, and on port 26 on the
18935 IPv4 loopback address only:
18936 </para>
18937 <literallayout class="monospaced">
18938 local_interfaces = 0.0.0.0 : 127.0.0.1.26
18939 </literallayout>
18940 <para>
18941 To specify listening on the default port on specific interfaces only:
18942 </para>
18943 <literallayout class="monospaced">
18944 local_interfaces = 192.168.34.67 : 192.168.34.67
18945 </literallayout>
18946 <para>
18947 <emphasis role="bold">Warning</emphasis>: Such a setting excludes listening on the loopback interfaces.
18948 </para>
18949 </section>
18950 <section id="SECTreclocipadd">
18951 <title>Recognizing the local host</title>
18952 <para>
18953 The <option>local_interfaces</option> option is also used when Exim needs to determine
18954 whether or not an IP address refers to the local host. That is, the IP
18955 addresses of all the interfaces on which a daemon is listening are always
18956 treated as local.
18957 </para>
18958 <para>
18959 For this usage, port numbers in <option>local_interfaces</option> are ignored. If either of
18960 the items 0.0.0.0 or ::0 are encountered, Exim gets a complete list of
18961 available interfaces from the operating system, and extracts the relevant
18962 (that is, IPv4 or IPv6) addresses to use for checking.
18963 </para>
18964 <para>
18965 Some systems set up large numbers of virtual interfaces in order to provide
18966 many virtual web servers. In this situation, you may want to listen for
18967 email on only a few of the available interfaces, but nevertheless treat all
18968 interfaces as local when routing. You can do this by setting
18969 <option>extra_local_interfaces</option> to a list of IP addresses, possibly including the
18970 <quote>all</quote> wildcard values. These addresses are recognized as local, but are not
18971 used for listening. Consider this example:
18972 </para>
18973 <literallayout class="monospaced">
18974 local_interfaces = &lt;; 127.0.0.1 ; ::1 ; \
18975                       192.168.53.235 ; \
18976                       3ffe:2101:12:1:a00:20ff:fe86:a061
18977
18978 extra_local_interfaces = &lt;; ::0 ; 0.0.0.0
18979 </literallayout>
18980 <para>
18981 The daemon listens on the loopback interfaces and just one IPv4 and one IPv6
18982 address, but all available interface addresses are treated as local when
18983 Exim is routing.
18984 </para>
18985 <para>
18986 In some environments the local host name may be in an MX list, but with an IP
18987 address that is not assigned to any local interface. In other cases it may be
18988 desirable to treat other host names as if they referred to the local host. Both
18989 these cases can be handled by setting the <option>hosts_treat_as_local</option> option.
18990 This contains host names rather than IP addresses. When a host is referenced
18991 during routing, either via an MX record or directly, it is treated as the local
18992 host if its name matches <option>hosts_treat_as_local</option>, or if any of its IP
18993 addresses match <option>local_interfaces</option> or <option>extra_local_interfaces</option>.
18994 </para>
18995 </section>
18996 <section id="SECID95">
18997 <title>Delivering to a remote host</title>
18998 <para>
18999 Delivery to a remote host is handled by the smtp transport. By default, it
19000 allows the system&#x2019;s TCP/IP functions to choose which interface to use (if
19001 there is more than one) when connecting to a remote host. However, the
19002 <option>interface</option> option can be set to specify which interface is used. See the
19003 description of the smtp transport in chapter <xref linkend="CHAPsmtptrans"/> for more
19004 details.
19005 </para>
19006 </section>
19007 </chapter>
19008
19009 <chapter id="CHAPmainconfig">
19010 <title>Main configuration</title>
19011 <para>
19012 <indexterm role="concept" id="IIDconfima" class="startofrange">
19013 <primary>configuration file</primary>
19014 <secondary>main section</secondary>
19015 </indexterm>
19016 <indexterm role="concept" id="IIDmaiconf" class="startofrange">
19017 <primary>main configuration</primary>
19018 </indexterm>
19019 The first part of the run time configuration file contains three types of item:
19020 </para>
19021 <itemizedlist>
19022 <listitem>
19023 <para>
19024 Macro definitions: These lines start with an upper case letter. See section
19025 <xref linkend="SECTmacrodefs"/> for details of macro processing.
19026 </para>
19027 </listitem>
19028 <listitem>
19029 <para>
19030 Named list definitions: These lines start with one of the words <quote>domainlist</quote>,
19031 <quote>hostlist</quote>, <quote>addresslist</quote>, or <quote>localpartlist</quote>. Their use is described in
19032 section <xref linkend="SECTnamedlists"/>.
19033 </para>
19034 </listitem>
19035 <listitem>
19036 <para>
19037 Main configuration settings: Each setting occupies one line of the file
19038 (with possible continuations). If any setting is preceded by the word
19039 <quote>hide</quote>, the <option>-bP</option> command line option displays its value to admin users
19040 only. See section <xref linkend="SECTcos"/> for a description of the syntax of these option
19041 settings.
19042 </para>
19043 </listitem>
19044 </itemizedlist>
19045 <para>
19046 This chapter specifies all the main configuration options, along with their
19047 types and default values. For ease of finding a particular option, they appear
19048 in alphabetical order in section <xref linkend="SECTalomo"/> below. However, because there
19049 are now so many options, they are first listed briefly in functional groups, as
19050 an aid to finding the name of the option you are looking for. Some options are
19051 listed in more than one group.
19052 </para>
19053 <section id="SECID96">
19054 <title>Miscellaneous</title>
19055 <informaltable frame="none">
19056 <tgroup cols="2" colsep="0" rowsep="0">
19057 <colspec colwidth="196pt" align="left"/>
19058 <colspec colwidth="254pt" align="left"/>
19059 <tbody>
19060 <row>
19061 <entry><option>bi_command</option></entry>
19062 <entry>to run for <option>-bi</option> command line option</entry>
19063 </row>
19064 <row>
19065 <entry><option>disable_ipv6</option></entry>
19066 <entry>do no IPv6 processing</entry>
19067 </row>
19068 <row>
19069 <entry><option>keep_malformed</option></entry>
19070 <entry>for broken files &ndash; should not happen</entry>
19071 </row>
19072 <row>
19073 <entry><option>localhost_number</option></entry>
19074 <entry>for unique message ids in clusters</entry>
19075 </row>
19076 <row>
19077 <entry><option>message_body_newlines</option></entry>
19078 <entry>retain newlines in <varname>$message_body</varname></entry>
19079 </row>
19080 <row>
19081 <entry><option>message_body_visible</option></entry>
19082 <entry>how much to show in <varname>$message_body</varname></entry>
19083 </row>
19084 <row>
19085 <entry><option>mua_wrapper</option></entry>
19086 <entry>run in <quote>MUA wrapper</quote> mode</entry>
19087 </row>
19088 <row>
19089 <entry><option>print_topbitchars</option></entry>
19090 <entry>top-bit characters are printing</entry>
19091 </row>
19092 <row>
19093 <entry><option>timezone</option></entry>
19094 <entry>force time zone</entry>
19095 </row>
19096 </tbody>
19097 </tgroup>
19098 </informaltable>
19099 </section>
19100 <section id="SECID97">
19101 <title>Exim parameters</title>
19102 <informaltable frame="none">
19103 <tgroup cols="2" colsep="0" rowsep="0">
19104 <colspec colwidth="196pt" align="left"/>
19105 <colspec colwidth="254pt" align="left"/>
19106 <tbody>
19107 <row>
19108 <entry><option>exim_group</option></entry>
19109 <entry>override compiled-in value</entry>
19110 </row>
19111 <row>
19112 <entry><option>exim_path</option></entry>
19113 <entry>override compiled-in value</entry>
19114 </row>
19115 <row>
19116 <entry><option>exim_user</option></entry>
19117 <entry>override compiled-in value</entry>
19118 </row>
19119 <row>
19120 <entry><option>primary_hostname</option></entry>
19121 <entry>default from <function>uname()</function></entry>
19122 </row>
19123 <row>
19124 <entry><option>split_spool_directory</option></entry>
19125 <entry>use multiple directories</entry>
19126 </row>
19127 <row>
19128 <entry><option>spool_directory</option></entry>
19129 <entry>override compiled-in value</entry>
19130 </row>
19131 </tbody>
19132 </tgroup>
19133 </informaltable>
19134 </section>
19135 <section id="SECID98">
19136 <title>Privilege controls</title>
19137 <informaltable frame="none">
19138 <tgroup cols="2" colsep="0" rowsep="0">
19139 <colspec colwidth="196pt" align="left"/>
19140 <colspec colwidth="254pt" align="left"/>
19141 <tbody>
19142 <row>
19143 <entry><option>admin_groups</option></entry>
19144 <entry>groups that are Exim admin users</entry>
19145 </row>
19146 <row>
19147 <entry><option>deliver_drop_privilege</option></entry>
19148 <entry>drop root for delivery processes</entry>
19149 </row>
19150 <row>
19151 <entry><option>local_from_check</option></entry>
19152 <entry>insert <emphasis>Sender:</emphasis> if necessary</entry>
19153 </row>
19154 <row>
19155 <entry><option>local_from_prefix</option></entry>
19156 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
19157 </row>
19158 <row>
19159 <entry><option>local_from_suffix</option></entry>
19160 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
19161 </row>
19162 <row>
19163 <entry><option>local_sender_retain</option></entry>
19164 <entry>keep <emphasis>Sender:</emphasis> from untrusted user</entry>
19165 </row>
19166 <row>
19167 <entry><option>never_users</option></entry>
19168 <entry>do not run deliveries as these</entry>
19169 </row>
19170 <row>
19171 <entry><option>prod_requires_admin</option></entry>
19172 <entry>forced delivery requires admin user</entry>
19173 </row>
19174 <row>
19175 <entry><option>queue_list_requires_admin</option></entry>
19176 <entry>queue listing requires admin user</entry>
19177 </row>
19178 <row>
19179 <entry><option>trusted_groups</option></entry>
19180 <entry>groups that are trusted</entry>
19181 </row>
19182 <row>
19183 <entry><option>trusted_users</option></entry>
19184 <entry>users that are trusted</entry>
19185 </row>
19186 </tbody>
19187 </tgroup>
19188 </informaltable>
19189 </section>
19190 <section id="SECID99">
19191 <title>Logging</title>
19192 <informaltable frame="none">
19193 <tgroup cols="2" colsep="0" rowsep="0">
19194 <colspec colwidth="196pt" align="left"/>
19195 <colspec colwidth="254pt" align="left"/>
19196 <tbody>
19197 <row>
19198 <entry><option>hosts_connection_nolog</option></entry>
19199 <entry>exemption from connect logging</entry>
19200 </row>
19201 <row>
19202 <entry><option>log_file_path</option></entry>
19203 <entry>override compiled-in value</entry>
19204 </row>
19205 <row>
19206 <entry><option>log_selector</option></entry>
19207 <entry>set/unset optional logging</entry>
19208 </row>
19209 <row>
19210 <entry><option>log_timezone</option></entry>
19211 <entry>add timezone to log lines</entry>
19212 </row>
19213 <row>
19214 <entry><option>message_logs</option></entry>
19215 <entry>create per-message logs</entry>
19216 </row>
19217 <row>
19218 <entry><option>preserve_message_logs</option></entry>
19219 <entry>after message completion</entry>
19220 </row>
19221 <row>
19222 <entry><option>process_log_path</option></entry>
19223 <entry>for SIGUSR1 and <emphasis>exiwhat</emphasis></entry>
19224 </row>
19225 <row>
19226 <entry><option>syslog_duplication</option></entry>
19227 <entry>controls duplicate log lines on syslog</entry>
19228 </row>
19229 <row>
19230 <entry><option>syslog_facility</option></entry>
19231 <entry>set syslog <quote>facility</quote> field</entry>
19232 </row>
19233 <row>
19234 <entry><option>syslog_processname</option></entry>
19235 <entry>set syslog <quote>ident</quote> field</entry>
19236 </row>
19237 <row>
19238 <entry><option>syslog_timestamp</option></entry>
19239 <entry>timestamp syslog lines</entry>
19240 </row>
19241 <row>
19242 <entry><option>write_rejectlog</option></entry>
19243 <entry>control use of message log</entry>
19244 </row>
19245 </tbody>
19246 </tgroup>
19247 </informaltable>
19248 </section>
19249 <section id="SECID100">
19250 <title>Frozen messages</title>
19251 <informaltable frame="none">
19252 <tgroup cols="2" colsep="0" rowsep="0">
19253 <colspec colwidth="196pt" align="left"/>
19254 <colspec colwidth="254pt" align="left"/>
19255 <tbody>
19256 <row>
19257 <entry><option>auto_thaw</option></entry>
19258 <entry>sets time for retrying frozen messages</entry>
19259 </row>
19260 <row>
19261 <entry><option>freeze_tell</option></entry>
19262 <entry>send message when freezing</entry>
19263 </row>
19264 <row>
19265 <entry><option>move_frozen_messages</option></entry>
19266 <entry>to another directory</entry>
19267 </row>
19268 <row>
19269 <entry><option>timeout_frozen_after</option></entry>
19270 <entry>keep frozen messages only so long</entry>
19271 </row>
19272 </tbody>
19273 </tgroup>
19274 </informaltable>
19275 </section>
19276 <section id="SECID101">
19277 <title>Data lookups</title>
19278 <informaltable frame="none">
19279 <tgroup cols="2" colsep="0" rowsep="0">
19280 <colspec colwidth="196pt" align="left"/>
19281 <colspec colwidth="254pt" align="left"/>
19282 <tbody>
19283 <row>
19284 <entry><option>ibase_servers</option></entry>
19285 <entry>InterBase servers</entry>
19286 </row>
19287 <row>
19288 <entry><option>ldap_ca_cert_dir</option></entry>
19289 <entry>dir of CA certs to verify LDAP server&#x2019;s</entry>
19290 </row>
19291 <row>
19292 <entry><option>ldap_ca_cert_file</option></entry>
19293 <entry>file of CA certs to verify LDAP server&#x2019;s</entry>
19294 </row>
19295 <row>
19296 <entry><option>ldap_cert_file</option></entry>
19297 <entry>client cert file for LDAP</entry>
19298 </row>
19299 <row>
19300 <entry><option>ldap_cert_key</option></entry>
19301 <entry>client key file for LDAP</entry>
19302 </row>
19303 <row>
19304 <entry><option>ldap_cipher_suite</option></entry>
19305 <entry>TLS negotiation preference control</entry>
19306 </row>
19307 <row>
19308 <entry><option>ldap_default_servers</option></entry>
19309 <entry>used if no server in query</entry>
19310 </row>
19311 <row>
19312 <entry><option>ldap_require_cert</option></entry>
19313 <entry>action to take without LDAP server cert</entry>
19314 </row>
19315 <row>
19316 <entry><option>ldap_start_tls</option></entry>
19317 <entry>require TLS within LDAP</entry>
19318 </row>
19319 <row>
19320 <entry><option>ldap_version</option></entry>
19321 <entry>set protocol version</entry>
19322 </row>
19323 <row>
19324 <entry><option>lookup_open_max</option></entry>
19325 <entry>lookup files held open</entry>
19326 </row>
19327 <row>
19328 <entry><option>mysql_servers</option></entry>
19329 <entry>default MySQL servers</entry>
19330 </row>
19331 <row>
19332 <entry><option>oracle_servers</option></entry>
19333 <entry>Oracle servers</entry>
19334 </row>
19335 <row>
19336 <entry><option>pgsql_servers</option></entry>
19337 <entry>default PostgreSQL servers</entry>
19338 </row>
19339 <row>
19340 <entry><option>sqlite_lock_timeout</option></entry>
19341 <entry>as it says</entry>
19342 </row>
19343 </tbody>
19344 </tgroup>
19345 </informaltable>
19346 </section>
19347 <section id="SECID102">
19348 <title>Message ids</title>
19349 <informaltable frame="none">
19350 <tgroup cols="2" colsep="0" rowsep="0">
19351 <colspec colwidth="196pt" align="left"/>
19352 <colspec colwidth="254pt" align="left"/>
19353 <tbody>
19354 <row>
19355 <entry><option>message_id_header_domain</option></entry>
19356 <entry>used to build <emphasis>Message-ID:</emphasis> header</entry>
19357 </row>
19358 <row>
19359 <entry><option>message_id_header_text</option></entry>
19360 <entry>ditto</entry>
19361 </row>
19362 </tbody>
19363 </tgroup>
19364 </informaltable>
19365 </section>
19366 <section id="SECID103">
19367 <title>Embedded Perl Startup</title>
19368 <informaltable frame="none">
19369 <tgroup cols="2" colsep="0" rowsep="0">
19370 <colspec colwidth="196pt" align="left"/>
19371 <colspec colwidth="254pt" align="left"/>
19372 <tbody>
19373 <row>
19374 <entry><option>perl_at_start</option></entry>
19375 <entry>always start the interpreter</entry>
19376 </row>
19377 <row>
19378 <entry><option>perl_startup</option></entry>
19379 <entry>code to obey when starting Perl</entry>
19380 </row>
19381 </tbody>
19382 </tgroup>
19383 </informaltable>
19384 </section>
19385 <section id="SECID104">
19386 <title>Daemon</title>
19387 <informaltable frame="none">
19388 <tgroup cols="2" colsep="0" rowsep="0">
19389 <colspec colwidth="196pt" align="left"/>
19390 <colspec colwidth="254pt" align="left"/>
19391 <tbody>
19392 <row>
19393 <entry><option>daemon_smtp_ports</option></entry>
19394 <entry>default ports</entry>
19395 </row>
19396 <row>
19397 <entry><option>daemon_startup_retries</option></entry>
19398 <entry>number of times to retry</entry>
19399 </row>
19400 <row>
19401 <entry><option>daemon_startup_sleep</option></entry>
19402 <entry>time to sleep between tries</entry>
19403 </row>
19404 <row>
19405 <entry><option>extra_local_interfaces</option></entry>
19406 <entry>not necessarily listened on</entry>
19407 </row>
19408 <row>
19409 <entry><option>local_interfaces</option></entry>
19410 <entry>on which to listen, with optional ports</entry>
19411 </row>
19412 <row>
19413 <entry><option>pid_file_path</option></entry>
19414 <entry>override compiled-in value</entry>
19415 </row>
19416 <row>
19417 <entry><option>queue_run_max</option></entry>
19418 <entry>maximum simultaneous queue runners</entry>
19419 </row>
19420 </tbody>
19421 </tgroup>
19422 </informaltable>
19423 </section>
19424 <section id="SECID105">
19425 <title>Resource control</title>
19426 <informaltable frame="none">
19427 <tgroup cols="2" colsep="0" rowsep="0">
19428 <colspec colwidth="196pt" align="left"/>
19429 <colspec colwidth="254pt" align="left"/>
19430 <tbody>
19431 <row>
19432 <entry><option>check_log_inodes</option></entry>
19433 <entry>before accepting a message</entry>
19434 </row>
19435 <row>
19436 <entry><option>check_log_space</option></entry>
19437 <entry>before accepting a message</entry>
19438 </row>
19439 <row>
19440 <entry><option>check_spool_inodes</option></entry>
19441 <entry>before accepting a message</entry>
19442 </row>
19443 <row>
19444 <entry><option>check_spool_space</option></entry>
19445 <entry>before accepting a message</entry>
19446 </row>
19447 <row>
19448 <entry><option>deliver_queue_load_max</option></entry>
19449 <entry>no queue deliveries if load high</entry>
19450 </row>
19451 <row>
19452 <entry><option>queue_only_load</option></entry>
19453 <entry>queue incoming if load high</entry>
19454 </row>
19455 <row>
19456 <entry><option>queue_only_load_latch</option></entry>
19457 <entry>don&#x2019;t re-evaluate load for each message</entry>
19458 </row>
19459 <row>
19460 <entry><option>queue_run_max</option></entry>
19461 <entry>maximum simultaneous queue runners</entry>
19462 </row>
19463 <row>
19464 <entry><option>remote_max_parallel</option></entry>
19465 <entry>parallel SMTP delivery per message</entry>
19466 </row>
19467 <row>
19468 <entry><option>smtp_accept_max</option></entry>
19469 <entry>simultaneous incoming connections</entry>
19470 </row>
19471 <row>
19472 <entry><option>smtp_accept_max_nonmail</option></entry>
19473 <entry>non-mail commands</entry>
19474 </row>
19475 <row>
19476 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
19477 <entry>hosts to which the limit applies</entry>
19478 </row>
19479 <row>
19480 <entry><option>smtp_accept_max_per_connection</option></entry>
19481 <entry>messages per connection</entry>
19482 </row>
19483 <row>
19484 <entry><option>smtp_accept_max_per_host</option></entry>
19485 <entry>connections from one host</entry>
19486 </row>
19487 <row>
19488 <entry><option>smtp_accept_queue</option></entry>
19489 <entry>queue mail if more connections</entry>
19490 </row>
19491 <row>
19492 <entry><option>smtp_accept_queue_per_connection</option></entry>
19493 <entry>queue if more messages per connection</entry>
19494 </row>
19495 <row>
19496 <entry><option>smtp_accept_reserve</option></entry>
19497 <entry>only reserve hosts if more connections</entry>
19498 </row>
19499 <row>
19500 <entry><option>smtp_check_spool_space</option></entry>
19501 <entry>from SIZE on MAIL command</entry>
19502 </row>
19503 <row>
19504 <entry><option>smtp_connect_backlog</option></entry>
19505 <entry>passed to TCP/IP stack</entry>
19506 </row>
19507 <row>
19508 <entry><option>smtp_load_reserve</option></entry>
19509 <entry>SMTP from reserved hosts if load high</entry>
19510 </row>
19511 <row>
19512 <entry><option>smtp_reserve_hosts</option></entry>
19513 <entry>these are the reserve hosts</entry>
19514 </row>
19515 </tbody>
19516 </tgroup>
19517 </informaltable>
19518 </section>
19519 <section id="SECID106">
19520 <title>Policy controls</title>
19521 <informaltable frame="none">
19522 <tgroup cols="2" colsep="0" rowsep="0">
19523 <colspec colwidth="196pt" align="left"/>
19524 <colspec colwidth="254pt" align="left"/>
19525 <tbody>
19526 <row>
19527 <entry><option>acl_not_smtp</option></entry>
19528 <entry>ACL for non-SMTP messages</entry>
19529 </row>
19530 <row>
19531 <entry><option>acl_not_smtp_mime</option></entry>
19532 <entry>ACL for non-SMTP MIME parts</entry>
19533 </row>
19534 <row>
19535 <entry><option>acl_not_smtp_start</option></entry>
19536 <entry>ACL for start of non-SMTP message</entry>
19537 </row>
19538 <row>
19539 <entry><option>acl_smtp_auth</option></entry>
19540 <entry>ACL for AUTH</entry>
19541 </row>
19542 <row>
19543 <entry><option>acl_smtp_connect</option></entry>
19544 <entry>ACL for connection</entry>
19545 </row>
19546 <row>
19547 <entry><option>acl_smtp_data</option></entry>
19548 <entry>ACL for DATA</entry>
19549 </row>
19550 <row>
19551 <entry><option>acl_smtp_dkim</option></entry>
19552 <entry>ACL for DKIM verification</entry>
19553 </row>
19554 <row>
19555 <entry><option>acl_smtp_etrn</option></entry>
19556 <entry>ACL for ETRN</entry>
19557 </row>
19558 <row>
19559 <entry><option>acl_smtp_expn</option></entry>
19560 <entry>ACL for EXPN</entry>
19561 </row>
19562 <row>
19563 <entry><option>acl_smtp_helo</option></entry>
19564 <entry>ACL for EHLO or HELO</entry>
19565 </row>
19566 <row>
19567 <entry><option>acl_smtp_mail</option></entry>
19568 <entry>ACL for MAIL</entry>
19569 </row>
19570 <row>
19571 <entry><option>acl_smtp_mailauth</option></entry>
19572 <entry>ACL for AUTH on MAIL command</entry>
19573 </row>
19574 <row>
19575 <entry><option>acl_smtp_mime</option></entry>
19576 <entry>ACL for MIME parts</entry>
19577 </row>
19578 <row>
19579 <entry><option>acl_smtp_predata</option></entry>
19580 <entry>ACL for start of data</entry>
19581 </row>
19582 <row>
19583 <entry><option>acl_smtp_quit</option></entry>
19584 <entry>ACL for QUIT</entry>
19585 </row>
19586 <row>
19587 <entry><option>acl_smtp_rcpt</option></entry>
19588 <entry>ACL for RCPT</entry>
19589 </row>
19590 <row>
19591 <entry><option>acl_smtp_starttls</option></entry>
19592 <entry>ACL for STARTTLS</entry>
19593 </row>
19594 <row>
19595 <entry><option>acl_smtp_vrfy</option></entry>
19596 <entry>ACL for VRFY</entry>
19597 </row>
19598 <row>
19599 <entry><option>av_scanner</option></entry>
19600 <entry>specify virus scanner</entry>
19601 </row>
19602 <row>
19603 <entry><option>check_rfc2047_length</option></entry>
19604 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
19605 </row>
19606 <row>
19607 <entry><option>dns_csa_search_limit</option></entry>
19608 <entry>control CSA parent search depth</entry>
19609 </row>
19610 <row>
19611 <entry><option>dns_csa_use_reverse</option></entry>
19612 <entry>en/disable CSA IP reverse search</entry>
19613 </row>
19614 <row>
19615 <entry><option>header_maxsize</option></entry>
19616 <entry>total size of message header</entry>
19617 </row>
19618 <row>
19619 <entry><option>header_line_maxsize</option></entry>
19620 <entry>individual header line limit</entry>
19621 </row>
19622 <row>
19623 <entry><option>helo_accept_junk_hosts</option></entry>
19624 <entry>allow syntactic junk from these hosts</entry>
19625 </row>
19626 <row>
19627 <entry><option>helo_allow_chars</option></entry>
19628 <entry>allow illegal chars in HELO names</entry>
19629 </row>
19630 <row>
19631 <entry><option>helo_lookup_domains</option></entry>
19632 <entry>lookup hostname for these HELO names</entry>
19633 </row>
19634 <row>
19635 <entry><option>helo_try_verify_hosts</option></entry>
19636 <entry>HELO soft-checked for these hosts</entry>
19637 </row>
19638 <row>
19639 <entry><option>helo_verify_hosts</option></entry>
19640 <entry>HELO hard-checked for these hosts</entry>
19641 </row>
19642 <row>
19643 <entry><option>host_lookup</option></entry>
19644 <entry>host name looked up for these hosts</entry>
19645 </row>
19646 <row>
19647 <entry><option>host_lookup_order</option></entry>
19648 <entry>order of DNS and local name lookups</entry>
19649 </row>
19650 <row>
19651 <entry><option>host_reject_connection</option></entry>
19652 <entry>reject connection from these hosts</entry>
19653 </row>
19654 <row>
19655 <entry><option>hosts_treat_as_local</option></entry>
19656 <entry>useful in some cluster configurations</entry>
19657 </row>
19658 <row>
19659 <entry><option>local_scan_timeout</option></entry>
19660 <entry>timeout for <function>local_scan()</function></entry>
19661 </row>
19662 <row>
19663 <entry><option>message_size_limit</option></entry>
19664 <entry>for all messages</entry>
19665 </row>
19666 <row>
19667 <entry><option>percent_hack_domains</option></entry>
19668 <entry>recognize %-hack for these domains</entry>
19669 </row>
19670 <row>
19671 <entry><option>spamd_address</option></entry>
19672 <entry>set interface to SpamAssassin</entry>
19673 </row>
19674 <row>
19675 <entry><option>strict_acl_vars</option></entry>
19676 <entry>object to unset ACL variables</entry>
19677 </row>
19678 </tbody>
19679 </tgroup>
19680 </informaltable>
19681 </section>
19682 <section id="SECID107">
19683 <title>Callout cache</title>
19684 <informaltable frame="none">
19685 <tgroup cols="2" colsep="0" rowsep="0">
19686 <colspec colwidth="196pt" align="left"/>
19687 <colspec colwidth="254pt" align="left"/>
19688 <tbody>
19689 <row>
19690 <entry><option>callout_domain_negative_expire</option></entry>
19691 <entry>timeout for negative domain cache item</entry>
19692 </row>
19693 <row>
19694 <entry><option>callout_domain_positive_expire</option></entry>
19695 <entry>timeout for positive domain cache item</entry>
19696 </row>
19697 <row>
19698 <entry><option>callout_negative_expire</option></entry>
19699 <entry>timeout for negative address cache item</entry>
19700 </row>
19701 <row>
19702 <entry><option>callout_positive_expire</option></entry>
19703 <entry>timeout for positive address cache item</entry>
19704 </row>
19705 <row>
19706 <entry><option>callout_random_local_part</option></entry>
19707 <entry>string to use for <quote>random</quote> testing</entry>
19708 </row>
19709 </tbody>
19710 </tgroup>
19711 </informaltable>
19712 </section>
19713 <section id="SECID108">
19714 <title>TLS</title>
19715 <informaltable frame="none">
19716 <tgroup cols="2" colsep="0" rowsep="0">
19717 <colspec colwidth="196pt" align="left"/>
19718 <colspec colwidth="254pt" align="left"/>
19719 <tbody>
19720 <row>
19721 <entry><option>gnutls_require_kx</option></entry>
19722 <entry>control GnuTLS key exchanges</entry>
19723 </row>
19724 <row>
19725 <entry><option>gnutls_require_mac</option></entry>
19726 <entry>control GnuTLS MAC algorithms</entry>
19727 </row>
19728 <row>
19729 <entry><option>gnutls_require_protocols</option></entry>
19730 <entry>control GnuTLS protocols</entry>
19731 </row>
19732 <row>
19733 <entry><option>gnutls_compat_mode</option></entry>
19734 <entry>use GnuTLS compatibility mode</entry>
19735 </row>
19736 <row>
19737 <entry><option>openssl_options</option></entry>
19738 <entry>adjust OpenSSL compatibility options</entry>
19739 </row>
19740 <row>
19741 <entry><option>tls_advertise_hosts</option></entry>
19742 <entry>advertise TLS to these hosts</entry>
19743 </row>
19744 <row>
19745 <entry><option>tls_certificate</option></entry>
19746 <entry>location of server certificate</entry>
19747 </row>
19748 <row>
19749 <entry><option>tls_crl</option></entry>
19750 <entry>certificate revocation list</entry>
19751 </row>
19752 <row>
19753 <entry><option>tls_dhparam</option></entry>
19754 <entry>DH parameters for server</entry>
19755 </row>
19756 <row>
19757 <entry><option>tls_on_connect_ports</option></entry>
19758 <entry>specify SSMTP (SMTPS) ports</entry>
19759 </row>
19760 <row>
19761 <entry><option>tls_privatekey</option></entry>
19762 <entry>location of server private key</entry>
19763 </row>
19764 <row>
19765 <entry><option>tls_remember_esmtp</option></entry>
19766 <entry>don&#x2019;t reset after starting TLS</entry>
19767 </row>
19768 <row>
19769 <entry><option>tls_require_ciphers</option></entry>
19770 <entry>specify acceptable ciphers</entry>
19771 </row>
19772 <row>
19773 <entry><option>tls_try_verify_hosts</option></entry>
19774 <entry>try to verify client certificate</entry>
19775 </row>
19776 <row>
19777 <entry><option>tls_verify_certificates</option></entry>
19778 <entry>expected client certificates</entry>
19779 </row>
19780 <row>
19781 <entry><option>tls_verify_hosts</option></entry>
19782 <entry>insist on client certificate verify</entry>
19783 </row>
19784 </tbody>
19785 </tgroup>
19786 </informaltable>
19787 </section>
19788 <section id="SECID109">
19789 <title>Local user handling</title>
19790 <informaltable frame="none">
19791 <tgroup cols="2" colsep="0" rowsep="0">
19792 <colspec colwidth="196pt" align="left"/>
19793 <colspec colwidth="254pt" align="left"/>
19794 <tbody>
19795 <row>
19796 <entry><option>finduser_retries</option></entry>
19797 <entry>useful in NIS environments</entry>
19798 </row>
19799 <row>
19800 <entry><option>gecos_name</option></entry>
19801 <entry>used when creating <emphasis>Sender:</emphasis></entry>
19802 </row>
19803 <row>
19804 <entry><option>gecos_pattern</option></entry>
19805 <entry>ditto</entry>
19806 </row>
19807 <row>
19808 <entry><option>max_username_length</option></entry>
19809 <entry>for systems that truncate</entry>
19810 </row>
19811 <row>
19812 <entry><option>unknown_login</option></entry>
19813 <entry>used when no login name found</entry>
19814 </row>
19815 <row>
19816 <entry><option>unknown_username</option></entry>
19817 <entry>ditto</entry>
19818 </row>
19819 <row>
19820 <entry><option>uucp_from_pattern</option></entry>
19821 <entry>for recognizing <quote>From </quote> lines</entry>
19822 </row>
19823 <row>
19824 <entry><option>uucp_from_sender</option></entry>
19825 <entry>ditto</entry>
19826 </row>
19827 </tbody>
19828 </tgroup>
19829 </informaltable>
19830 </section>
19831 <section id="SECID110">
19832 <title>All incoming messages (SMTP and non-SMTP)</title>
19833 <informaltable frame="none">
19834 <tgroup cols="2" colsep="0" rowsep="0">
19835 <colspec colwidth="196pt" align="left"/>
19836 <colspec colwidth="254pt" align="left"/>
19837 <tbody>
19838 <row>
19839 <entry><option>header_maxsize</option></entry>
19840 <entry>total size of message header</entry>
19841 </row>
19842 <row>
19843 <entry><option>header_line_maxsize</option></entry>
19844 <entry>individual header line limit</entry>
19845 </row>
19846 <row>
19847 <entry><option>message_size_limit</option></entry>
19848 <entry>applies to all messages</entry>
19849 </row>
19850 <row>
19851 <entry><option>percent_hack_domains</option></entry>
19852 <entry>recognize %-hack for these domains</entry>
19853 </row>
19854 <row>
19855 <entry><option>received_header_text</option></entry>
19856 <entry>expanded to make <emphasis>Received:</emphasis></entry>
19857 </row>
19858 <row>
19859 <entry><option>received_headers_max</option></entry>
19860 <entry>for mail loop detection</entry>
19861 </row>
19862 <row>
19863 <entry><option>recipients_max</option></entry>
19864 <entry>limit per message</entry>
19865 </row>
19866 <row>
19867 <entry><option>recipients_max_reject</option></entry>
19868 <entry>permanently reject excess recipients</entry>
19869 </row>
19870 </tbody>
19871 </tgroup>
19872 </informaltable>
19873 </section>
19874 <section id="SECID111">
19875 <title>Non-SMTP incoming messages</title>
19876 <informaltable frame="none">
19877 <tgroup cols="2" colsep="0" rowsep="0">
19878 <colspec colwidth="196pt" align="left"/>
19879 <colspec colwidth="254pt" align="left"/>
19880 <tbody>
19881 <row>
19882 <entry><option>receive_timeout</option></entry>
19883 <entry>for non-SMTP messages</entry>
19884 </row>
19885 </tbody>
19886 </tgroup>
19887 </informaltable>
19888 </section>
19889 <section id="SECID112">
19890 <title>Incoming SMTP messages</title>
19891 <para>
19892 See also the <emphasis>Policy controls</emphasis> section above.
19893 </para>
19894 <informaltable frame="none">
19895 <tgroup cols="2" colsep="0" rowsep="0">
19896 <colspec colwidth="196pt" align="left"/>
19897 <colspec colwidth="254pt" align="left"/>
19898 <tbody>
19899 <row>
19900 <entry><option>host_lookup</option></entry>
19901 <entry>host name looked up for these hosts</entry>
19902 </row>
19903 <row>
19904 <entry><option>host_lookup_order</option></entry>
19905 <entry>order of DNS and local name lookups</entry>
19906 </row>
19907 <row>
19908 <entry><option>recipient_unqualified_hosts</option></entry>
19909 <entry>may send unqualified recipients</entry>
19910 </row>
19911 <row>
19912 <entry><option>rfc1413_hosts</option></entry>
19913 <entry>make ident calls to these hosts</entry>
19914 </row>
19915 <row>
19916 <entry><option>rfc1413_query_timeout</option></entry>
19917 <entry>zero disables ident calls</entry>
19918 </row>
19919 <row>
19920 <entry><option>sender_unqualified_hosts</option></entry>
19921 <entry>may send unqualified senders</entry>
19922 </row>
19923 <row>
19924 <entry><option>smtp_accept_keepalive</option></entry>
19925 <entry>some TCP/IP magic</entry>
19926 </row>
19927 <row>
19928 <entry><option>smtp_accept_max</option></entry>
19929 <entry>simultaneous incoming connections</entry>
19930 </row>
19931 <row>
19932 <entry><option>smtp_accept_max_nonmail</option></entry>
19933 <entry>non-mail commands</entry>
19934 </row>
19935 <row>
19936 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
19937 <entry>hosts to which the limit applies</entry>
19938 </row>
19939 <row>
19940 <entry><option>smtp_accept_max_per_connection</option></entry>
19941 <entry>messages per connection</entry>
19942 </row>
19943 <row>
19944 <entry><option>smtp_accept_max_per_host</option></entry>
19945 <entry>connections from one host</entry>
19946 </row>
19947 <row>
19948 <entry><option>smtp_accept_queue</option></entry>
19949 <entry>queue mail if more connections</entry>
19950 </row>
19951 <row>
19952 <entry><option>smtp_accept_queue_per_connection</option></entry>
19953 <entry>queue if more messages per connection</entry>
19954 </row>
19955 <row>
19956 <entry><option>smtp_accept_reserve</option></entry>
19957 <entry>only reserve hosts if more connections</entry>
19958 </row>
19959 <row>
19960 <entry><option>smtp_active_hostname</option></entry>
19961 <entry>host name to use in messages</entry>
19962 </row>
19963 <row>
19964 <entry><option>smtp_banner</option></entry>
19965 <entry>text for welcome banner</entry>
19966 </row>
19967 <row>
19968 <entry><option>smtp_check_spool_space</option></entry>
19969 <entry>from SIZE on MAIL command</entry>
19970 </row>
19971 <row>
19972 <entry><option>smtp_connect_backlog</option></entry>
19973 <entry>passed to TCP/IP stack</entry>
19974 </row>
19975 <row>
19976 <entry><option>smtp_enforce_sync</option></entry>
19977 <entry>of SMTP command/responses</entry>
19978 </row>
19979 <row>
19980 <entry><option>smtp_etrn_command</option></entry>
19981 <entry>what to run for ETRN</entry>
19982 </row>
19983 <row>
19984 <entry><option>smtp_etrn_serialize</option></entry>
19985 <entry>only one at once</entry>
19986 </row>
19987 <row>
19988 <entry><option>smtp_load_reserve</option></entry>
19989 <entry>only reserve hosts if this load</entry>
19990 </row>
19991 <row>
19992 <entry><option>smtp_max_unknown_commands</option></entry>
19993 <entry>before dropping connection</entry>
19994 </row>
19995 <row>
19996 <entry><option>smtp_ratelimit_hosts</option></entry>
19997 <entry>apply ratelimiting to these hosts</entry>
19998 </row>
19999 <row>
20000 <entry><option>smtp_ratelimit_mail</option></entry>
20001 <entry>ratelimit for MAIL commands</entry>
20002 </row>
20003 <row>
20004 <entry><option>smtp_ratelimit_rcpt</option></entry>
20005 <entry>ratelimit for RCPT commands</entry>
20006 </row>
20007 <row>
20008 <entry><option>smtp_receive_timeout</option></entry>
20009 <entry>per command or data line</entry>
20010 </row>
20011 <row>
20012 <entry><option>smtp_reserve_hosts</option></entry>
20013 <entry>these are the reserve hosts</entry>
20014 </row>
20015 <row>
20016 <entry><option>smtp_return_error_details</option></entry>
20017 <entry>give detail on rejections</entry>
20018 </row>
20019 </tbody>
20020 </tgroup>
20021 </informaltable>
20022 </section>
20023 <section id="SECID113">
20024 <title>SMTP extensions</title>
20025 <informaltable frame="none">
20026 <tgroup cols="2" colsep="0" rowsep="0">
20027 <colspec colwidth="196pt" align="left"/>
20028 <colspec colwidth="254pt" align="left"/>
20029 <tbody>
20030 <row>
20031 <entry><option>accept_8bitmime</option></entry>
20032 <entry>advertise 8BITMIME</entry>
20033 </row>
20034 <row>
20035 <entry><option>auth_advertise_hosts</option></entry>
20036 <entry>advertise AUTH to these hosts</entry>
20037 </row>
20038 <row>
20039 <entry><option>ignore_fromline_hosts</option></entry>
20040 <entry>allow <quote>From </quote> from these hosts</entry>
20041 </row>
20042 <row>
20043 <entry><option>ignore_fromline_local</option></entry>
20044 <entry>allow <quote>From </quote> from local SMTP</entry>
20045 </row>
20046 <row>
20047 <entry><option>pipelining_advertise_hosts</option></entry>
20048 <entry>advertise pipelining to these hosts</entry>
20049 </row>
20050 <row>
20051 <entry><option>tls_advertise_hosts</option></entry>
20052 <entry>advertise TLS to these hosts</entry>
20053 </row>
20054 </tbody>
20055 </tgroup>
20056 </informaltable>
20057 </section>
20058 <section id="SECID114">
20059 <title>Processing messages</title>
20060 <informaltable frame="none">
20061 <tgroup cols="2" colsep="0" rowsep="0">
20062 <colspec colwidth="196pt" align="left"/>
20063 <colspec colwidth="254pt" align="left"/>
20064 <tbody>
20065 <row>
20066 <entry><option>allow_domain_literals</option></entry>
20067 <entry>recognize domain literal syntax</entry>
20068 </row>
20069 <row>
20070 <entry><option>allow_mx_to_ip</option></entry>
20071 <entry>allow MX to point to IP address</entry>
20072 </row>
20073 <row>
20074 <entry><option>allow_utf8_domains</option></entry>
20075 <entry>in addresses</entry>
20076 </row>
20077 <row>
20078 <entry><option>check_rfc2047_length</option></entry>
20079 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
20080 </row>
20081 <row>
20082 <entry><option>delivery_date_remove</option></entry>
20083 <entry>from incoming messages</entry>
20084 </row>
20085 <row>
20086 <entry><option>envelope_to_remove</option></entry>
20087 <entry>from incoming messages</entry>
20088 </row>
20089 <row>
20090 <entry><option>extract_addresses_remove_arguments</option></entry>
20091 <entry>affects <option>-t</option> processing</entry>
20092 </row>
20093 <row>
20094 <entry><option>headers_charset</option></entry>
20095 <entry>default for translations</entry>
20096 </row>
20097 <row>
20098 <entry><option>qualify_domain</option></entry>
20099 <entry>default for senders</entry>
20100 </row>
20101 <row>
20102 <entry><option>qualify_recipient</option></entry>
20103 <entry>default for recipients</entry>
20104 </row>
20105 <row>
20106 <entry><option>return_path_remove</option></entry>
20107 <entry>from incoming messages</entry>
20108 </row>
20109 <row>
20110 <entry><option>strip_excess_angle_brackets</option></entry>
20111 <entry>in addresses</entry>
20112 </row>
20113 <row>
20114 <entry><option>strip_trailing_dot</option></entry>
20115 <entry>at end of addresses</entry>
20116 </row>
20117 <row>
20118 <entry><option>untrusted_set_sender</option></entry>
20119 <entry>untrusted can set envelope sender</entry>
20120 </row>
20121 </tbody>
20122 </tgroup>
20123 </informaltable>
20124 </section>
20125 <section id="SECID115">
20126 <title>System filter</title>
20127 <informaltable frame="none">
20128 <tgroup cols="2" colsep="0" rowsep="0">
20129 <colspec colwidth="196pt" align="left"/>
20130 <colspec colwidth="254pt" align="left"/>
20131 <tbody>
20132 <row>
20133 <entry><option>system_filter</option></entry>
20134 <entry>locate system filter</entry>
20135 </row>
20136 <row>
20137 <entry><option>system_filter_directory_transport</option></entry>
20138 <entry>transport for delivery to a directory</entry>
20139 </row>
20140 <row>
20141 <entry><option>system_filter_file_transport</option></entry>
20142 <entry>transport for delivery to a file</entry>
20143 </row>
20144 <row>
20145 <entry><option>system_filter_group</option></entry>
20146 <entry>group for filter running</entry>
20147 </row>
20148 <row>
20149 <entry><option>system_filter_pipe_transport</option></entry>
20150 <entry>transport for delivery to a pipe</entry>
20151 </row>
20152 <row>
20153 <entry><option>system_filter_reply_transport</option></entry>
20154 <entry>transport for autoreply delivery</entry>
20155 </row>
20156 <row>
20157 <entry><option>system_filter_user</option></entry>
20158 <entry>user for filter running</entry>
20159 </row>
20160 </tbody>
20161 </tgroup>
20162 </informaltable>
20163 </section>
20164 <section id="SECID116">
20165 <title>Routing and delivery</title>
20166 <informaltable frame="none">
20167 <tgroup cols="2" colsep="0" rowsep="0">
20168 <colspec colwidth="196pt" align="left"/>
20169 <colspec colwidth="254pt" align="left"/>
20170 <tbody>
20171 <row>
20172 <entry><option>disable_ipv6</option></entry>
20173 <entry>do no IPv6 processing</entry>
20174 </row>
20175 <row>
20176 <entry><option>dns_again_means_nonexist</option></entry>
20177 <entry>for broken domains</entry>
20178 </row>
20179 <row>
20180 <entry><option>dns_check_names_pattern</option></entry>
20181 <entry>pre-DNS syntax check</entry>
20182 </row>
20183 <row>
20184 <entry><option>dns_ipv4_lookup</option></entry>
20185 <entry>only v4 lookup for these domains</entry>
20186 </row>
20187 <row>
20188 <entry><option>dns_retrans</option></entry>
20189 <entry>parameter for resolver</entry>
20190 </row>
20191 <row>
20192 <entry><option>dns_retry</option></entry>
20193 <entry>parameter for resolver</entry>
20194 </row>
20195 <row>
20196 <entry><option>dns_use_edns0</option></entry>
20197 <entry>parameter for resolver</entry>
20198 </row>
20199 <row>
20200 <entry><option>hold_domains</option></entry>
20201 <entry>hold delivery for these domains</entry>
20202 </row>
20203 <row>
20204 <entry><option>local_interfaces</option></entry>
20205 <entry>for routing checks</entry>
20206 </row>
20207 <row>
20208 <entry><option>queue_domains</option></entry>
20209 <entry>no immediate delivery for these</entry>
20210 </row>
20211 <row>
20212 <entry><option>queue_only</option></entry>
20213 <entry>no immediate delivery at all</entry>
20214 </row>
20215 <row>
20216 <entry><option>queue_only_file</option></entry>
20217 <entry>no immediate delivery if file exists</entry>
20218 </row>
20219 <row>
20220 <entry><option>queue_only_load</option></entry>
20221 <entry>no immediate delivery if load is high</entry>
20222 </row>
20223 <row>
20224 <entry><option>queue_only_load_latch</option></entry>
20225 <entry>don&#x2019;t re-evaluate load for each message</entry>
20226 </row>
20227 <row>
20228 <entry><option>queue_only_override</option></entry>
20229 <entry>allow command line to override</entry>
20230 </row>
20231 <row>
20232 <entry><option>queue_run_in_order</option></entry>
20233 <entry>order of arrival</entry>
20234 </row>
20235 <row>
20236 <entry><option>queue_run_max</option></entry>
20237 <entry>of simultaneous queue runners</entry>
20238 </row>
20239 <row>
20240 <entry><option>queue_smtp_domains</option></entry>
20241 <entry>no immediate SMTP delivery for these</entry>
20242 </row>
20243 <row>
20244 <entry><option>remote_max_parallel</option></entry>
20245 <entry>parallel SMTP delivery per message</entry>
20246 </row>
20247 <row>
20248 <entry><option>remote_sort_domains</option></entry>
20249 <entry>order of remote deliveries</entry>
20250 </row>
20251 <row>
20252 <entry><option>retry_data_expire</option></entry>
20253 <entry>timeout for retry data</entry>
20254 </row>
20255 <row>
20256 <entry><option>retry_interval_max</option></entry>
20257 <entry>safety net for retry rules</entry>
20258 </row>
20259 </tbody>
20260 </tgroup>
20261 </informaltable>
20262 </section>
20263 <section id="SECID117">
20264 <title>Bounce and warning messages</title>
20265 <informaltable frame="none">
20266 <tgroup cols="2" colsep="0" rowsep="0">
20267 <colspec colwidth="196pt" align="left"/>
20268 <colspec colwidth="254pt" align="left"/>
20269 <tbody>
20270 <row>
20271 <entry><option>bounce_message_file</option></entry>
20272 <entry>content of bounce</entry>
20273 </row>
20274 <row>
20275 <entry><option>bounce_message_text</option></entry>
20276 <entry>content of bounce</entry>
20277 </row>
20278 <row>
20279 <entry><option>bounce_return_body</option></entry>
20280 <entry>include body if returning message</entry>
20281 </row>
20282 <row>
20283 <entry><option>bounce_return_message</option></entry>
20284 <entry>include original message in bounce</entry>
20285 </row>
20286 <row>
20287 <entry><option>bounce_return_size_limit</option></entry>
20288 <entry>limit on returned message</entry>
20289 </row>
20290 <row>
20291 <entry><option>bounce_sender_authentication</option></entry>
20292 <entry>send authenticated sender with bounce</entry>
20293 </row>
20294 <row>
20295 <entry><option>dsn_from</option></entry>
20296 <entry>set <emphasis>From:</emphasis> contents in bounces</entry>
20297 </row>
20298 <row>
20299 <entry><option>errors_copy</option></entry>
20300 <entry>copy bounce messages</entry>
20301 </row>
20302 <row>
20303 <entry><option>errors_reply_to</option></entry>
20304 <entry><emphasis>Reply-to:</emphasis> in bounces</entry>
20305 </row>
20306 <row>
20307 <entry><option>delay_warning</option></entry>
20308 <entry>time schedule</entry>
20309 </row>
20310 <row>
20311 <entry><option>delay_warning_condition</option></entry>
20312 <entry>condition for warning messages</entry>
20313 </row>
20314 <row>
20315 <entry><option>ignore_bounce_errors_after</option></entry>
20316 <entry>discard undeliverable bounces</entry>
20317 </row>
20318 <row>
20319 <entry><option>smtp_return_error_details</option></entry>
20320 <entry>give detail on rejections</entry>
20321 </row>
20322 <row>
20323 <entry><option>warn_message_file</option></entry>
20324 <entry>content of warning message</entry>
20325 </row>
20326 </tbody>
20327 </tgroup>
20328 </informaltable>
20329 </section>
20330 <section id="SECTalomo">
20331 <title>Alphabetical list of main options</title>
20332 <para>
20333 Those options that undergo string expansion before use are marked with
20334 &dagger;.
20335 </para>
20336 <para>
20337 <indexterm role="option">
20338 <primary><option>accept_8bitmime</option></primary>
20339 </indexterm>
20340 </para>
20341 <informaltable frame="all">
20342 <tgroup cols="4" colsep="0" rowsep="0">
20343 <colspec colwidth="8*" align="left"/>
20344 <colspec colwidth="6*" align="center"/>
20345 <colspec colwidth="6*" align="center"/>
20346 <colspec colwidth="6*" align="right"/>
20347 <tbody>
20348 <row>
20349 <entry><option>accept_8bitmime</option></entry>
20350 <entry>Use: <emphasis>main</emphasis></entry>
20351 <entry>Type: <emphasis>boolean</emphasis></entry>
20352 <entry>Default: <emphasis>false</emphasis></entry>
20353 </row>
20354 </tbody>
20355 </tgroup>
20356 </informaltable>
20357 <para>
20358 <indexterm role="concept">
20359 <primary>8BITMIME</primary>
20360 </indexterm>
20361 <indexterm role="concept">
20362 <primary>8-bit characters</primary>
20363 </indexterm>
20364 This option causes Exim to send 8BITMIME in its response to an SMTP
20365 EHLO command, and to accept the BODY= parameter on MAIL commands.
20366 However, though Exim is 8-bit clean, it is not a protocol converter, and it
20367 takes no steps to do anything special with messages received by this route.
20368 Consequently, this option is turned off by default.
20369 </para>
20370 <para>
20371 <indexterm role="option">
20372 <primary><option>acl_not_smtp</option></primary>
20373 </indexterm>
20374 </para>
20375 <informaltable frame="all">
20376 <tgroup cols="4" colsep="0" rowsep="0">
20377 <colspec colwidth="8*" align="left"/>
20378 <colspec colwidth="6*" align="center"/>
20379 <colspec colwidth="6*" align="center"/>
20380 <colspec colwidth="6*" align="right"/>
20381 <tbody>
20382 <row>
20383 <entry><option>acl_not_smtp</option></entry>
20384 <entry>Use: <emphasis>main</emphasis></entry>
20385 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20386 <entry>Default: <emphasis>unset</emphasis></entry>
20387 </row>
20388 </tbody>
20389 </tgroup>
20390 </informaltable>
20391 <para>
20392 <indexterm role="concept">
20393 <primary>access control lists (ACLs)</primary>
20394 <secondary>for non-SMTP messages</secondary>
20395 </indexterm>
20396 <indexterm role="concept">
20397 <primary>non-SMTP messages</primary>
20398 <secondary>ACLs for</secondary>
20399 </indexterm>
20400 This option defines the ACL that is run when a non-SMTP message has been
20401 read and is on the point of being accepted. See chapter <xref linkend="CHAPACL"/> for
20402 further details.
20403 </para>
20404 <para>
20405 <indexterm role="option">
20406 <primary><option>acl_not_smtp_mime</option></primary>
20407 </indexterm>
20408 </para>
20409 <informaltable frame="all">
20410 <tgroup cols="4" colsep="0" rowsep="0">
20411 <colspec colwidth="8*" align="left"/>
20412 <colspec colwidth="6*" align="center"/>
20413 <colspec colwidth="6*" align="center"/>
20414 <colspec colwidth="6*" align="right"/>
20415 <tbody>
20416 <row>
20417 <entry><option>acl_not_smtp_mime</option></entry>
20418 <entry>Use: <emphasis>main</emphasis></entry>
20419 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20420 <entry>Default: <emphasis>unset</emphasis></entry>
20421 </row>
20422 </tbody>
20423 </tgroup>
20424 </informaltable>
20425 <para>
20426 This option defines the ACL that is run for individual MIME parts of non-SMTP
20427 messages. It operates in exactly the same way as <option>acl_smtp_mime</option> operates for
20428 SMTP messages.
20429 </para>
20430 <para>
20431 <indexterm role="option">
20432 <primary><option>acl_not_smtp_start</option></primary>
20433 </indexterm>
20434 </para>
20435 <informaltable frame="all">
20436 <tgroup cols="4" colsep="0" rowsep="0">
20437 <colspec colwidth="8*" align="left"/>
20438 <colspec colwidth="6*" align="center"/>
20439 <colspec colwidth="6*" align="center"/>
20440 <colspec colwidth="6*" align="right"/>
20441 <tbody>
20442 <row>
20443 <entry><option>acl_not_smtp_start</option></entry>
20444 <entry>Use: <emphasis>main</emphasis></entry>
20445 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20446 <entry>Default: <emphasis>unset</emphasis></entry>
20447 </row>
20448 </tbody>
20449 </tgroup>
20450 </informaltable>
20451 <para>
20452 <indexterm role="concept">
20453 <primary>access control lists (ACLs)</primary>
20454 <secondary>at start of non-SMTP message</secondary>
20455 </indexterm>
20456 <indexterm role="concept">
20457 <primary>non-SMTP messages</primary>
20458 <secondary>ACLs for</secondary>
20459 </indexterm>
20460 This option defines the ACL that is run before Exim starts reading a
20461 non-SMTP message. See chapter <xref linkend="CHAPACL"/> for further details.
20462 </para>
20463 <para>
20464 <indexterm role="option">
20465 <primary><option>acl_smtp_auth</option></primary>
20466 </indexterm>
20467 </para>
20468 <informaltable frame="all">
20469 <tgroup cols="4" colsep="0" rowsep="0">
20470 <colspec colwidth="8*" align="left"/>
20471 <colspec colwidth="6*" align="center"/>
20472 <colspec colwidth="6*" align="center"/>
20473 <colspec colwidth="6*" align="right"/>
20474 <tbody>
20475 <row>
20476 <entry><option>acl_smtp_auth</option></entry>
20477 <entry>Use: <emphasis>main</emphasis></entry>
20478 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20479 <entry>Default: <emphasis>unset</emphasis></entry>
20480 </row>
20481 </tbody>
20482 </tgroup>
20483 </informaltable>
20484 <para>
20485 <indexterm role="concept">
20486 <primary>access control lists (ACLs)</primary>
20487 <secondary>setting up for SMTP commands</secondary>
20488 </indexterm>
20489 <indexterm role="concept">
20490 <primary>AUTH</primary>
20491 <secondary>ACL for</secondary>
20492 </indexterm>
20493 This option defines the ACL that is run when an SMTP AUTH command is
20494 received. See chapter <xref linkend="CHAPACL"/> for further details.
20495 </para>
20496 <para>
20497 <indexterm role="option">
20498 <primary><option>acl_smtp_connect</option></primary>
20499 </indexterm>
20500 </para>
20501 <informaltable frame="all">
20502 <tgroup cols="4" colsep="0" rowsep="0">
20503 <colspec colwidth="8*" align="left"/>
20504 <colspec colwidth="6*" align="center"/>
20505 <colspec colwidth="6*" align="center"/>
20506 <colspec colwidth="6*" align="right"/>
20507 <tbody>
20508 <row>
20509 <entry><option>acl_smtp_connect</option></entry>
20510 <entry>Use: <emphasis>main</emphasis></entry>
20511 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20512 <entry>Default: <emphasis>unset</emphasis></entry>
20513 </row>
20514 </tbody>
20515 </tgroup>
20516 </informaltable>
20517 <para>
20518 <indexterm role="concept">
20519 <primary>access control lists (ACLs)</primary>
20520 <secondary>on SMTP connection</secondary>
20521 </indexterm>
20522 This option defines the ACL that is run when an SMTP connection is received.
20523 See chapter <xref linkend="CHAPACL"/> for further details.
20524 </para>
20525 <para>
20526 <indexterm role="option">
20527 <primary><option>acl_smtp_data</option></primary>
20528 </indexterm>
20529 </para>
20530 <informaltable frame="all">
20531 <tgroup cols="4" colsep="0" rowsep="0">
20532 <colspec colwidth="8*" align="left"/>
20533 <colspec colwidth="6*" align="center"/>
20534 <colspec colwidth="6*" align="center"/>
20535 <colspec colwidth="6*" align="right"/>
20536 <tbody>
20537 <row>
20538 <entry><option>acl_smtp_data</option></entry>
20539 <entry>Use: <emphasis>main</emphasis></entry>
20540 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20541 <entry>Default: <emphasis>unset</emphasis></entry>
20542 </row>
20543 </tbody>
20544 </tgroup>
20545 </informaltable>
20546 <para>
20547 <indexterm role="concept">
20548 <primary>DATA</primary>
20549 <secondary>ACL for</secondary>
20550 </indexterm>
20551 This option defines the ACL that is run after an SMTP DATA command has been
20552 processed and the message itself has been received, but before the final
20553 acknowledgment is sent. See chapter <xref linkend="CHAPACL"/> for further details.
20554 </para>
20555 <para>
20556 <indexterm role="option">
20557 <primary><option>acl_smtp_etrn</option></primary>
20558 </indexterm>
20559 </para>
20560 <informaltable frame="all">
20561 <tgroup cols="4" colsep="0" rowsep="0">
20562 <colspec colwidth="8*" align="left"/>
20563 <colspec colwidth="6*" align="center"/>
20564 <colspec colwidth="6*" align="center"/>
20565 <colspec colwidth="6*" align="right"/>
20566 <tbody>
20567 <row>
20568 <entry><option>acl_smtp_etrn</option></entry>
20569 <entry>Use: <emphasis>main</emphasis></entry>
20570 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20571 <entry>Default: <emphasis>unset</emphasis></entry>
20572 </row>
20573 </tbody>
20574 </tgroup>
20575 </informaltable>
20576 <para>
20577 <indexterm role="concept">
20578 <primary>ETRN</primary>
20579 <secondary>ACL for</secondary>
20580 </indexterm>
20581 This option defines the ACL that is run when an SMTP ETRN command is
20582 received. See chapter <xref linkend="CHAPACL"/> for further details.
20583 </para>
20584 <para>
20585 <indexterm role="option">
20586 <primary><option>acl_smtp_expn</option></primary>
20587 </indexterm>
20588 </para>
20589 <informaltable frame="all">
20590 <tgroup cols="4" colsep="0" rowsep="0">
20591 <colspec colwidth="8*" align="left"/>
20592 <colspec colwidth="6*" align="center"/>
20593 <colspec colwidth="6*" align="center"/>
20594 <colspec colwidth="6*" align="right"/>
20595 <tbody>
20596 <row>
20597 <entry><option>acl_smtp_expn</option></entry>
20598 <entry>Use: <emphasis>main</emphasis></entry>
20599 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20600 <entry>Default: <emphasis>unset</emphasis></entry>
20601 </row>
20602 </tbody>
20603 </tgroup>
20604 </informaltable>
20605 <para>
20606 <indexterm role="concept">
20607 <primary>EXPN</primary>
20608 <secondary>ACL for</secondary>
20609 </indexterm>
20610 This option defines the ACL that is run when an SMTP EXPN command is
20611 received. See chapter <xref linkend="CHAPACL"/> for further details.
20612 </para>
20613 <para>
20614 <indexterm role="option">
20615 <primary><option>acl_smtp_helo</option></primary>
20616 </indexterm>
20617 </para>
20618 <informaltable frame="all">
20619 <tgroup cols="4" colsep="0" rowsep="0">
20620 <colspec colwidth="8*" align="left"/>
20621 <colspec colwidth="6*" align="center"/>
20622 <colspec colwidth="6*" align="center"/>
20623 <colspec colwidth="6*" align="right"/>
20624 <tbody>
20625 <row>
20626 <entry><option>acl_smtp_helo</option></entry>
20627 <entry>Use: <emphasis>main</emphasis></entry>
20628 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20629 <entry>Default: <emphasis>unset</emphasis></entry>
20630 </row>
20631 </tbody>
20632 </tgroup>
20633 </informaltable>
20634 <para>
20635 <indexterm role="concept">
20636 <primary>EHLO</primary>
20637 <secondary>ACL for</secondary>
20638 </indexterm>
20639 <indexterm role="concept">
20640 <primary>HELO</primary>
20641 <secondary>ACL for</secondary>
20642 </indexterm>
20643 This option defines the ACL that is run when an SMTP EHLO or HELO
20644 command is received. See chapter <xref linkend="CHAPACL"/> for further details.
20645 </para>
20646 <para>
20647 <indexterm role="option">
20648 <primary><option>acl_smtp_mail</option></primary>
20649 </indexterm>
20650 </para>
20651 <informaltable frame="all">
20652 <tgroup cols="4" colsep="0" rowsep="0">
20653 <colspec colwidth="8*" align="left"/>
20654 <colspec colwidth="6*" align="center"/>
20655 <colspec colwidth="6*" align="center"/>
20656 <colspec colwidth="6*" align="right"/>
20657 <tbody>
20658 <row>
20659 <entry><option>acl_smtp_mail</option></entry>
20660 <entry>Use: <emphasis>main</emphasis></entry>
20661 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20662 <entry>Default: <emphasis>unset</emphasis></entry>
20663 </row>
20664 </tbody>
20665 </tgroup>
20666 </informaltable>
20667 <para>
20668 <indexterm role="concept">
20669 <primary>MAIL</primary>
20670 <secondary>ACL for</secondary>
20671 </indexterm>
20672 This option defines the ACL that is run when an SMTP MAIL command is
20673 received. See chapter <xref linkend="CHAPACL"/> for further details.
20674 </para>
20675 <para>
20676 <indexterm role="option">
20677 <primary><option>acl_smtp_mailauth</option></primary>
20678 </indexterm>
20679 </para>
20680 <informaltable frame="all">
20681 <tgroup cols="4" colsep="0" rowsep="0">
20682 <colspec colwidth="8*" align="left"/>
20683 <colspec colwidth="6*" align="center"/>
20684 <colspec colwidth="6*" align="center"/>
20685 <colspec colwidth="6*" align="right"/>
20686 <tbody>
20687 <row>
20688 <entry><option>acl_smtp_mailauth</option></entry>
20689 <entry>Use: <emphasis>main</emphasis></entry>
20690 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20691 <entry>Default: <emphasis>unset</emphasis></entry>
20692 </row>
20693 </tbody>
20694 </tgroup>
20695 </informaltable>
20696 <para>
20697 <indexterm role="concept">
20698 <primary>AUTH</primary>
20699 <secondary>on MAIL command</secondary>
20700 </indexterm>
20701 This option defines the ACL that is run when there is an AUTH parameter on
20702 a MAIL command. See chapter <xref linkend="CHAPACL"/> for details of ACLs, and chapter
20703 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
20704 </para>
20705 <para>
20706 <indexterm role="option">
20707 <primary><option>acl_smtp_mime</option></primary>
20708 </indexterm>
20709 </para>
20710 <informaltable frame="all">
20711 <tgroup cols="4" colsep="0" rowsep="0">
20712 <colspec colwidth="8*" align="left"/>
20713 <colspec colwidth="6*" align="center"/>
20714 <colspec colwidth="6*" align="center"/>
20715 <colspec colwidth="6*" align="right"/>
20716 <tbody>
20717 <row>
20718 <entry><option>acl_smtp_mime</option></entry>
20719 <entry>Use: <emphasis>main</emphasis></entry>
20720 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20721 <entry>Default: <emphasis>unset</emphasis></entry>
20722 </row>
20723 </tbody>
20724 </tgroup>
20725 </informaltable>
20726 <para>
20727 <indexterm role="concept">
20728 <primary>MIME content scanning</primary>
20729 <secondary>ACL for</secondary>
20730 </indexterm>
20731 This option is available when Exim is built with the content-scanning
20732 extension. It defines the ACL that is run for each MIME part in a message. See
20733 section <xref linkend="SECTscanmimepart"/> for details.
20734 </para>
20735 <para>
20736 <indexterm role="option">
20737 <primary><option>acl_smtp_predata</option></primary>
20738 </indexterm>
20739 </para>
20740 <informaltable frame="all">
20741 <tgroup cols="4" colsep="0" rowsep="0">
20742 <colspec colwidth="8*" align="left"/>
20743 <colspec colwidth="6*" align="center"/>
20744 <colspec colwidth="6*" align="center"/>
20745 <colspec colwidth="6*" align="right"/>
20746 <tbody>
20747 <row>
20748 <entry><option>acl_smtp_predata</option></entry>
20749 <entry>Use: <emphasis>main</emphasis></entry>
20750 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20751 <entry>Default: <emphasis>unset</emphasis></entry>
20752 </row>
20753 </tbody>
20754 </tgroup>
20755 </informaltable>
20756 <para>
20757 This option defines the ACL that is run when an SMTP DATA command is
20758 received, before the message itself is received. See chapter <xref linkend="CHAPACL"/> for
20759 further details.
20760 </para>
20761 <para>
20762 <indexterm role="option">
20763 <primary><option>acl_smtp_quit</option></primary>
20764 </indexterm>
20765 </para>
20766 <informaltable frame="all">
20767 <tgroup cols="4" colsep="0" rowsep="0">
20768 <colspec colwidth="8*" align="left"/>
20769 <colspec colwidth="6*" align="center"/>
20770 <colspec colwidth="6*" align="center"/>
20771 <colspec colwidth="6*" align="right"/>
20772 <tbody>
20773 <row>
20774 <entry><option>acl_smtp_quit</option></entry>
20775 <entry>Use: <emphasis>main</emphasis></entry>
20776 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20777 <entry>Default: <emphasis>unset</emphasis></entry>
20778 </row>
20779 </tbody>
20780 </tgroup>
20781 </informaltable>
20782 <para>
20783 <indexterm role="concept">
20784 <primary>QUIT, ACL for</primary>
20785 </indexterm>
20786 This option defines the ACL that is run when an SMTP QUIT command is
20787 received. See chapter <xref linkend="CHAPACL"/> for further details.
20788 </para>
20789 <para>
20790 <indexterm role="option">
20791 <primary><option>acl_smtp_rcpt</option></primary>
20792 </indexterm>
20793 </para>
20794 <informaltable frame="all">
20795 <tgroup cols="4" colsep="0" rowsep="0">
20796 <colspec colwidth="8*" align="left"/>
20797 <colspec colwidth="6*" align="center"/>
20798 <colspec colwidth="6*" align="center"/>
20799 <colspec colwidth="6*" align="right"/>
20800 <tbody>
20801 <row>
20802 <entry><option>acl_smtp_rcpt</option></entry>
20803 <entry>Use: <emphasis>main</emphasis></entry>
20804 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20805 <entry>Default: <emphasis>unset</emphasis></entry>
20806 </row>
20807 </tbody>
20808 </tgroup>
20809 </informaltable>
20810 <para>
20811 <indexterm role="concept">
20812 <primary>RCPT</primary>
20813 <secondary>ACL for</secondary>
20814 </indexterm>
20815 This option defines the ACL that is run when an SMTP RCPT command is
20816 received. See chapter <xref linkend="CHAPACL"/> for further details.
20817 </para>
20818 <para>
20819 <indexterm role="option">
20820 <primary><option>acl_smtp_starttls</option></primary>
20821 </indexterm>
20822 </para>
20823 <informaltable frame="all">
20824 <tgroup cols="4" colsep="0" rowsep="0">
20825 <colspec colwidth="8*" align="left"/>
20826 <colspec colwidth="6*" align="center"/>
20827 <colspec colwidth="6*" align="center"/>
20828 <colspec colwidth="6*" align="right"/>
20829 <tbody>
20830 <row>
20831 <entry><option>acl_smtp_starttls</option></entry>
20832 <entry>Use: <emphasis>main</emphasis></entry>
20833 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20834 <entry>Default: <emphasis>unset</emphasis></entry>
20835 </row>
20836 </tbody>
20837 </tgroup>
20838 </informaltable>
20839 <para>
20840 <indexterm role="concept">
20841 <primary>STARTTLS, ACL for</primary>
20842 </indexterm>
20843 This option defines the ACL that is run when an SMTP STARTTLS command is
20844 received. See chapter <xref linkend="CHAPACL"/> for further details.
20845 </para>
20846 <para>
20847 <indexterm role="option">
20848 <primary><option>acl_smtp_vrfy</option></primary>
20849 </indexterm>
20850 </para>
20851 <informaltable frame="all">
20852 <tgroup cols="4" colsep="0" rowsep="0">
20853 <colspec colwidth="8*" align="left"/>
20854 <colspec colwidth="6*" align="center"/>
20855 <colspec colwidth="6*" align="center"/>
20856 <colspec colwidth="6*" align="right"/>
20857 <tbody>
20858 <row>
20859 <entry><option>acl_smtp_vrfy</option></entry>
20860 <entry>Use: <emphasis>main</emphasis></entry>
20861 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20862 <entry>Default: <emphasis>unset</emphasis></entry>
20863 </row>
20864 </tbody>
20865 </tgroup>
20866 </informaltable>
20867 <para>
20868 <indexterm role="concept">
20869 <primary>VRFY</primary>
20870 <secondary>ACL for</secondary>
20871 </indexterm>
20872 This option defines the ACL that is run when an SMTP VRFY command is
20873 received. See chapter <xref linkend="CHAPACL"/> for further details.
20874 </para>
20875 <para>
20876 <indexterm role="option">
20877 <primary><option>admin_groups</option></primary>
20878 </indexterm>
20879 </para>
20880 <informaltable frame="all">
20881 <tgroup cols="4" colsep="0" rowsep="0">
20882 <colspec colwidth="8*" align="left"/>
20883 <colspec colwidth="6*" align="center"/>
20884 <colspec colwidth="6*" align="center"/>
20885 <colspec colwidth="6*" align="right"/>
20886 <tbody>
20887 <row>
20888 <entry><option>admin_groups</option></entry>
20889 <entry>Use: <emphasis>main</emphasis></entry>
20890 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
20891 <entry>Default: <emphasis>unset</emphasis></entry>
20892 </row>
20893 </tbody>
20894 </tgroup>
20895 </informaltable>
20896 <para>
20897 <indexterm role="concept">
20898 <primary>admin user</primary>
20899 </indexterm>
20900 This option is expanded just once, at the start of Exim&#x2019;s processing. If the
20901 current group or any of the supplementary groups of an Exim caller is in this
20902 colon-separated list, the caller has admin privileges. If all your system
20903 programmers are in a specific group, for example, you can give them all Exim
20904 admin privileges by putting that group in <option>admin_groups</option>. However, this does
20905 not permit them to read Exim&#x2019;s spool files (whose group owner is the Exim gid).
20906 To permit this, you have to add individuals to the Exim group.
20907 </para>
20908 <para>
20909 <indexterm role="option">
20910 <primary><option>allow_domain_literals</option></primary>
20911 </indexterm>
20912 </para>
20913 <informaltable frame="all">
20914 <tgroup cols="4" colsep="0" rowsep="0">
20915 <colspec colwidth="8*" align="left"/>
20916 <colspec colwidth="6*" align="center"/>
20917 <colspec colwidth="6*" align="center"/>
20918 <colspec colwidth="6*" align="right"/>
20919 <tbody>
20920 <row>
20921 <entry><option>allow_domain_literals</option></entry>
20922 <entry>Use: <emphasis>main</emphasis></entry>
20923 <entry>Type: <emphasis>boolean</emphasis></entry>
20924 <entry>Default: <emphasis>false</emphasis></entry>
20925 </row>
20926 </tbody>
20927 </tgroup>
20928 </informaltable>
20929 <para>
20930 <indexterm role="concept">
20931 <primary>domain literal</primary>
20932 </indexterm>
20933 If this option is set, the RFC 2822 domain literal format is permitted in
20934 email addresses. The option is not set by default, because the domain literal
20935 format is not normally required these days, and few people know about it. It
20936 has, however, been exploited by mail abusers.
20937 </para>
20938 <para>
20939 Unfortunately, it seems that some DNS black list maintainers are using this
20940 format to report black listing to postmasters. If you want to accept messages
20941 addressed to your hosts by IP address, you need to set
20942 <option>allow_domain_literals</option> true, and also to add <literal>@[]</literal> to the list of local
20943 domains (defined in the named domain list <option>local_domains</option> in the default
20944 configuration). This <quote>magic string</quote> matches the domain literal form of all
20945 the local host&#x2019;s IP addresses.
20946 </para>
20947 <para>
20948 <indexterm role="option">
20949 <primary><option>allow_mx_to_ip</option></primary>
20950 </indexterm>
20951 </para>
20952 <informaltable frame="all">
20953 <tgroup cols="4" colsep="0" rowsep="0">
20954 <colspec colwidth="8*" align="left"/>
20955 <colspec colwidth="6*" align="center"/>
20956 <colspec colwidth="6*" align="center"/>
20957 <colspec colwidth="6*" align="right"/>
20958 <tbody>
20959 <row>
20960 <entry><option>allow_mx_to_ip</option></entry>
20961 <entry>Use: <emphasis>main</emphasis></entry>
20962 <entry>Type: <emphasis>boolean</emphasis></entry>
20963 <entry>Default: <emphasis>false</emphasis></entry>
20964 </row>
20965 </tbody>
20966 </tgroup>
20967 </informaltable>
20968 <para>
20969 <indexterm role="concept">
20970 <primary>MX record</primary>
20971 <secondary>pointing to IP address</secondary>
20972 </indexterm>
20973 It appears that more and more DNS zone administrators are breaking the rules
20974 and putting domain names that look like IP addresses on the right hand side of
20975 MX records. Exim follows the rules and rejects this, giving an error message
20976 that explains the mis-configuration. However, some other MTAs support this
20977 practice, so to avoid <quote>Why can&#x2019;t Exim do this?</quote> complaints,
20978 <option>allow_mx_to_ip</option> exists, in order to enable this heinous activity. It is not
20979 recommended, except when you have no other choice.
20980 </para>
20981 <para>
20982 <indexterm role="option">
20983 <primary><option>allow_utf8_domains</option></primary>
20984 </indexterm>
20985 </para>
20986 <informaltable frame="all">
20987 <tgroup cols="4" colsep="0" rowsep="0">
20988 <colspec colwidth="8*" align="left"/>
20989 <colspec colwidth="6*" align="center"/>
20990 <colspec colwidth="6*" align="center"/>
20991 <colspec colwidth="6*" align="right"/>
20992 <tbody>
20993 <row>
20994 <entry><option>allow_utf8_domains</option></entry>
20995 <entry>Use: <emphasis>main</emphasis></entry>
20996 <entry>Type: <emphasis>boolean</emphasis></entry>
20997 <entry>Default: <emphasis>false</emphasis></entry>
20998 </row>
20999 </tbody>
21000 </tgroup>
21001 </informaltable>
21002 <para>
21003 <indexterm role="concept">
21004 <primary>domain</primary>
21005 <secondary>UTF-8 characters in</secondary>
21006 </indexterm>
21007 <indexterm role="concept">
21008 <primary>UTF-8</primary>
21009 <secondary>in domain name</secondary>
21010 </indexterm>
21011 Lots of discussion is going on about internationalized domain names. One
21012 camp is strongly in favour of just using UTF-8 characters, and it seems
21013 that at least two other MTAs permit this. This option allows Exim users to
21014 experiment if they wish.
21015 </para>
21016 <para>
21017 If it is set true, Exim&#x2019;s domain parsing function allows valid
21018 UTF-8 multicharacters to appear in domain name components, in addition to
21019 letters, digits, and hyphens. However, just setting this option is not
21020 enough; if you want to look up these domain names in the DNS, you must also
21021 adjust the value of <option>dns_check_names_pattern</option> to match the extended form. A
21022 suitable setting is:
21023 </para>
21024 <literallayout class="monospaced">
21025 dns_check_names_pattern = (?i)^(?&gt;(?(1)\.|())[a-z0-9\xc0-\xff]\
21026   (?&gt;[-a-z0-9\x80-\xff]*[a-z0-9\x80-\xbf])?)+$
21027 </literallayout>
21028 <para>
21029 Alternatively, you can just disable this feature by setting
21030 </para>
21031 <literallayout class="monospaced">
21032 dns_check_names_pattern =
21033 </literallayout>
21034 <para>
21035 That is, set the option to an empty string so that no check is done.
21036 </para>
21037 <para>
21038 <indexterm role="option">
21039 <primary><option>auth_advertise_hosts</option></primary>
21040 </indexterm>
21041 </para>
21042 <informaltable frame="all">
21043 <tgroup cols="4" colsep="0" rowsep="0">
21044 <colspec colwidth="8*" align="left"/>
21045 <colspec colwidth="6*" align="center"/>
21046 <colspec colwidth="6*" align="center"/>
21047 <colspec colwidth="6*" align="right"/>
21048 <tbody>
21049 <row>
21050 <entry><option>auth_advertise_hosts</option></entry>
21051 <entry>Use: <emphasis>main</emphasis></entry>
21052 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
21053 <entry>Default: <emphasis>*</emphasis></entry>
21054 </row>
21055 </tbody>
21056 </tgroup>
21057 </informaltable>
21058 <para>
21059 <indexterm role="concept">
21060 <primary>authentication</primary>
21061 <secondary>advertising</secondary>
21062 </indexterm>
21063 <indexterm role="concept">
21064 <primary>AUTH</primary>
21065 <secondary>advertising</secondary>
21066 </indexterm>
21067 If any server authentication mechanisms are configured, Exim advertises them in
21068 response to an EHLO command only if the calling host matches this list.
21069 Otherwise, Exim does not advertise AUTH.
21070 Exim does not accept AUTH commands from clients to which it has not
21071 advertised the availability of AUTH. The advertising of individual
21072 authentication mechanisms can be controlled by the use of the
21073 <option>server_advertise_condition</option> generic authenticator option on the individual
21074 authenticators. See chapter <xref linkend="CHAPSMTPAUTH"/> for further details.
21075 </para>
21076 <para>
21077 Certain mail clients (for example, Netscape) require the user to provide a name
21078 and password for authentication if AUTH is advertised, even though it may
21079 not be needed (the host may accept messages from hosts on its local LAN without
21080 authentication, for example). The <option>auth_advertise_hosts</option> option can be used
21081 to make these clients more friendly by excluding them from the set of hosts to
21082 which Exim advertises AUTH.
21083 </para>
21084 <para>
21085 <indexterm role="concept">
21086 <primary>AUTH</primary>
21087 <secondary>advertising when encrypted</secondary>
21088 </indexterm>
21089 If you want to advertise the availability of AUTH only when the connection
21090 is encrypted using TLS, you can make use of the fact that the value of this
21091 option is expanded, with a setting like this:
21092 </para>
21093 <literallayout class="monospaced">
21094 auth_advertise_hosts = ${if eq{$tls_cipher}{}{}{*}}
21095 </literallayout>
21096 <para>
21097 <indexterm role="variable">
21098 <primary><varname>$tls_cipher</varname></primary>
21099 </indexterm>
21100 If <varname>$tls_cipher</varname> is empty, the session is not encrypted, and the result of
21101 the expansion is empty, thus matching no hosts. Otherwise, the result of the
21102 expansion is *, which matches all hosts.
21103 </para>
21104 <para>
21105 <indexterm role="option">
21106 <primary><option>auto_thaw</option></primary>
21107 </indexterm>
21108 </para>
21109 <informaltable frame="all">
21110 <tgroup cols="4" colsep="0" rowsep="0">
21111 <colspec colwidth="8*" align="left"/>
21112 <colspec colwidth="6*" align="center"/>
21113 <colspec colwidth="6*" align="center"/>
21114 <colspec colwidth="6*" align="right"/>
21115 <tbody>
21116 <row>
21117 <entry><option>auto_thaw</option></entry>
21118 <entry>Use: <emphasis>main</emphasis></entry>
21119 <entry>Type: <emphasis>time</emphasis></entry>
21120 <entry>Default: <emphasis>0s</emphasis></entry>
21121 </row>
21122 </tbody>
21123 </tgroup>
21124 </informaltable>
21125 <para>
21126 <indexterm role="concept">
21127 <primary>thawing messages</primary>
21128 </indexterm>
21129 <indexterm role="concept">
21130 <primary>unfreezing messages</primary>
21131 </indexterm>
21132 If this option is set to a time greater than zero, a queue runner will try a
21133 new delivery attempt on any frozen message, other than a bounce message, if
21134 this much time has passed since it was frozen. This may result in the message
21135 being re-frozen if nothing has changed since the last attempt. It is a way of
21136 saying <quote>keep on trying, even though there are big problems</quote>.
21137 </para>
21138 <para>
21139 <emphasis role="bold">Note</emphasis>: This is an old option, which predates <option>timeout_frozen_after</option> and
21140 <option>ignore_bounce_errors_after</option>. It is retained for compatibility, but it is not
21141 thought to be very useful any more, and its use should probably be avoided.
21142 </para>
21143 <para>
21144 <indexterm role="option">
21145 <primary><option>av_scanner</option></primary>
21146 </indexterm>
21147 </para>
21148 <informaltable frame="all">
21149 <tgroup cols="4" colsep="0" rowsep="0">
21150 <colspec colwidth="8*" align="left"/>
21151 <colspec colwidth="6*" align="center"/>
21152 <colspec colwidth="6*" align="center"/>
21153 <colspec colwidth="6*" align="right"/>
21154 <tbody>
21155 <row>
21156 <entry><option>av_scanner</option></entry>
21157 <entry>Use: <emphasis>main</emphasis></entry>
21158 <entry>Type: <emphasis>string</emphasis></entry>
21159 <entry>Default: <emphasis>see below</emphasis></entry>
21160 </row>
21161 </tbody>
21162 </tgroup>
21163 </informaltable>
21164 <para>
21165 This option is available if Exim is built with the content-scanning extension.
21166 It specifies which anti-virus scanner to use. The default value is:
21167 </para>
21168 <literallayout class="monospaced">
21169 sophie:/var/run/sophie
21170 </literallayout>
21171 <para>
21172 If the value of <option>av_scanner</option> starts with a dollar character, it is expanded
21173 before use. See section <xref linkend="SECTscanvirus"/> for further details.
21174 </para>
21175 <para>
21176 <indexterm role="option">
21177 <primary><option>bi_command</option></primary>
21178 </indexterm>
21179 </para>
21180 <informaltable frame="all">
21181 <tgroup cols="4" colsep="0" rowsep="0">
21182 <colspec colwidth="8*" align="left"/>
21183 <colspec colwidth="6*" align="center"/>
21184 <colspec colwidth="6*" align="center"/>
21185 <colspec colwidth="6*" align="right"/>
21186 <tbody>
21187 <row>
21188 <entry><option>bi_command</option></entry>
21189 <entry>Use: <emphasis>main</emphasis></entry>
21190 <entry>Type: <emphasis>string</emphasis></entry>
21191 <entry>Default: <emphasis>unset</emphasis></entry>
21192 </row>
21193 </tbody>
21194 </tgroup>
21195 </informaltable>
21196 <para>
21197 <indexterm role="option">
21198 <primary><option>-bi</option></primary>
21199 </indexterm>
21200 This option supplies the name of a command that is run when Exim is called with
21201 the <option>-bi</option> option (see chapter <xref linkend="CHAPcommandline"/>). The string value is
21202 just the command name, it is not a complete command line. If an argument is
21203 required, it must come from the <option>-oA</option> command line option.
21204 </para>
21205 <para>
21206 <indexterm role="option">
21207 <primary><option>bounce_message_file</option></primary>
21208 </indexterm>
21209 </para>
21210 <informaltable frame="all">
21211 <tgroup cols="4" colsep="0" rowsep="0">
21212 <colspec colwidth="8*" align="left"/>
21213 <colspec colwidth="6*" align="center"/>
21214 <colspec colwidth="6*" align="center"/>
21215 <colspec colwidth="6*" align="right"/>
21216 <tbody>
21217 <row>
21218 <entry><option>bounce_message_file</option></entry>
21219 <entry>Use: <emphasis>main</emphasis></entry>
21220 <entry>Type: <emphasis>string</emphasis></entry>
21221 <entry>Default: <emphasis>unset</emphasis></entry>
21222 </row>
21223 </tbody>
21224 </tgroup>
21225 </informaltable>
21226 <para>
21227 <indexterm role="concept">
21228 <primary>bounce message</primary>
21229 <secondary>customizing</secondary>
21230 </indexterm>
21231 <indexterm role="concept">
21232 <primary>customizing</primary>
21233 <secondary>bounce message</secondary>
21234 </indexterm>
21235 This option defines a template file containing paragraphs of text to be used
21236 for constructing bounce messages.  Details of the file&#x2019;s contents are given in
21237 chapter <xref linkend="CHAPemsgcust"/>. See also <option>warn_message_file</option>.
21238 </para>
21239 <para>
21240 <indexterm role="option">
21241 <primary><option>bounce_message_text</option></primary>
21242 </indexterm>
21243 </para>
21244 <informaltable frame="all">
21245 <tgroup cols="4" colsep="0" rowsep="0">
21246 <colspec colwidth="8*" align="left"/>
21247 <colspec colwidth="6*" align="center"/>
21248 <colspec colwidth="6*" align="center"/>
21249 <colspec colwidth="6*" align="right"/>
21250 <tbody>
21251 <row>
21252 <entry><option>bounce_message_text</option></entry>
21253 <entry>Use: <emphasis>main</emphasis></entry>
21254 <entry>Type: <emphasis>string</emphasis></entry>
21255 <entry>Default: <emphasis>unset</emphasis></entry>
21256 </row>
21257 </tbody>
21258 </tgroup>
21259 </informaltable>
21260 <para>
21261 When this option is set, its contents are included in the default bounce
21262 message immediately after <quote>This message was created automatically by mail
21263 delivery software.</quote> It is not used if <option>bounce_message_file</option> is set.
21264 </para>
21265 <para>
21266 <indexterm role="option">
21267 <primary><option>bounce_return_body</option></primary>
21268 </indexterm>
21269 </para>
21270 <informaltable frame="all">
21271 <tgroup cols="4" colsep="0" rowsep="0">
21272 <colspec colwidth="8*" align="left"/>
21273 <colspec colwidth="6*" align="center"/>
21274 <colspec colwidth="6*" align="center"/>
21275 <colspec colwidth="6*" align="right"/>
21276 <tbody>
21277 <row>
21278 <entry><option>bounce_return_body</option></entry>
21279 <entry>Use: <emphasis>main</emphasis></entry>
21280 <entry>Type: <emphasis>boolean</emphasis></entry>
21281 <entry>Default: <emphasis>true</emphasis></entry>
21282 </row>
21283 </tbody>
21284 </tgroup>
21285 </informaltable>
21286 <para>
21287 <indexterm role="concept">
21288 <primary>bounce message</primary>
21289 <secondary>including body</secondary>
21290 </indexterm>
21291 This option controls whether the body of an incoming message is included in a
21292 bounce message when <option>bounce_return_message</option> is true. The default setting
21293 causes the entire message, both header and body, to be returned (subject to the
21294 value of <option>bounce_return_size_limit</option>). If this option is false, only the
21295 message header is included. In the case of a non-SMTP message containing an
21296 error that is detected during reception, only those header lines preceding the
21297 point at which the error was detected are returned.
21298 <indexterm role="concept">
21299 <primary>bounce message</primary>
21300 <secondary>including original</secondary>
21301 </indexterm>
21302 </para>
21303 <para>
21304 <indexterm role="option">
21305 <primary><option>bounce_return_message</option></primary>
21306 </indexterm>
21307 </para>
21308 <informaltable frame="all">
21309 <tgroup cols="4" colsep="0" rowsep="0">
21310 <colspec colwidth="8*" align="left"/>
21311 <colspec colwidth="6*" align="center"/>
21312 <colspec colwidth="6*" align="center"/>
21313 <colspec colwidth="6*" align="right"/>
21314 <tbody>
21315 <row>
21316 <entry><option>bounce_return_message</option></entry>
21317 <entry>Use: <emphasis>main</emphasis></entry>
21318 <entry>Type: <emphasis>boolean</emphasis></entry>
21319 <entry>Default: <emphasis>true</emphasis></entry>
21320 </row>
21321 </tbody>
21322 </tgroup>
21323 </informaltable>
21324 <para>
21325 If this option is set false, none of the original message is included in
21326 bounce messages generated by Exim. See also <option>bounce_return_size_limit</option> and
21327 <option>bounce_return_body</option>.
21328 </para>
21329 <para>
21330 <indexterm role="option">
21331 <primary><option>bounce_return_size_limit</option></primary>
21332 </indexterm>
21333 </para>
21334 <informaltable frame="all">
21335 <tgroup cols="4" colsep="0" rowsep="0">
21336 <colspec colwidth="8*" align="left"/>
21337 <colspec colwidth="6*" align="center"/>
21338 <colspec colwidth="6*" align="center"/>
21339 <colspec colwidth="6*" align="right"/>
21340 <tbody>
21341 <row>
21342 <entry><option>bounce_return_size_limit</option></entry>
21343 <entry>Use: <emphasis>main</emphasis></entry>
21344 <entry>Type: <emphasis>integer</emphasis></entry>
21345 <entry>Default: <emphasis>100K</emphasis></entry>
21346 </row>
21347 </tbody>
21348 </tgroup>
21349 </informaltable>
21350 <para>
21351 <indexterm role="concept">
21352 <primary>size</primary>
21353 <secondary>of bounce, limit</secondary>
21354 </indexterm>
21355 <indexterm role="concept">
21356 <primary>bounce message</primary>
21357 <secondary>size limit</secondary>
21358 </indexterm>
21359 <indexterm role="concept">
21360 <primary>limit</primary>
21361 <secondary>bounce message size</secondary>
21362 </indexterm>
21363 This option sets a limit in bytes on the size of messages that are returned to
21364 senders as part of bounce messages when <option>bounce_return_message</option> is true. The
21365 limit should be less than the value of the global <option>message_size_limit</option> and of
21366 any <option>message_size_limit</option> settings on transports, to allow for the bounce text
21367 that Exim generates. If this option is set to zero there is no limit.
21368 </para>
21369 <para>
21370 When the body of any message that is to be included in a bounce message is
21371 greater than the limit, it is truncated, and a comment pointing this out is
21372 added at the top. The actual cutoff may be greater than the value given, owing
21373 to the use of buffering for transferring the message in chunks (typically 8K in
21374 size). The idea is to save bandwidth on those undeliverable 15-megabyte
21375 messages.
21376 </para>
21377 <para>
21378 <indexterm role="option">
21379 <primary><option>bounce_sender_authentication</option></primary>
21380 </indexterm>
21381 </para>
21382 <informaltable frame="all">
21383 <tgroup cols="4" colsep="0" rowsep="0">
21384 <colspec colwidth="8*" align="left"/>
21385 <colspec colwidth="6*" align="center"/>
21386 <colspec colwidth="6*" align="center"/>
21387 <colspec colwidth="6*" align="right"/>
21388 <tbody>
21389 <row>
21390 <entry><option>bounce_sender_authentication</option></entry>
21391 <entry>Use: <emphasis>main</emphasis></entry>
21392 <entry>Type: <emphasis>string</emphasis></entry>
21393 <entry>Default: <emphasis>unset</emphasis></entry>
21394 </row>
21395 </tbody>
21396 </tgroup>
21397 </informaltable>
21398 <para>
21399 <indexterm role="concept">
21400 <primary>bounce message</primary>
21401 <secondary>sender authentication</secondary>
21402 </indexterm>
21403 <indexterm role="concept">
21404 <primary>authentication</primary>
21405 <secondary>bounce message</secondary>
21406 </indexterm>
21407 <indexterm role="concept">
21408 <primary>AUTH</primary>
21409 <secondary>on bounce message</secondary>
21410 </indexterm>
21411 This option provides an authenticated sender address that is sent with any
21412 bounce messages generated by Exim that are sent over an authenticated SMTP
21413 connection. A typical setting might be:
21414 </para>
21415 <literallayout class="monospaced">
21416 bounce_sender_authentication = mailer-daemon@my.domain.example
21417 </literallayout>
21418 <para>
21419 which would cause bounce messages to be sent using the SMTP command:
21420 </para>
21421 <literallayout class="monospaced">
21422 MAIL FROM:&lt;&gt; AUTH=mailer-daemon@my.domain.example
21423 </literallayout>
21424 <para>
21425 The value of <option>bounce_sender_authentication</option> must always be a complete email
21426 address.
21427 </para>
21428 <para>
21429 <indexterm role="option">
21430 <primary><option>callout_domain_negative_expire</option></primary>
21431 </indexterm>
21432 </para>
21433 <informaltable frame="all">
21434 <tgroup cols="4" colsep="0" rowsep="0">
21435 <colspec colwidth="8*" align="left"/>
21436 <colspec colwidth="6*" align="center"/>
21437 <colspec colwidth="6*" align="center"/>
21438 <colspec colwidth="6*" align="right"/>
21439 <tbody>
21440 <row>
21441 <entry><option>callout_domain_negative_expire</option></entry>
21442 <entry>Use: <emphasis>main</emphasis></entry>
21443 <entry>Type: <emphasis>time</emphasis></entry>
21444 <entry>Default: <emphasis>3h</emphasis></entry>
21445 </row>
21446 </tbody>
21447 </tgroup>
21448 </informaltable>
21449 <para>
21450 <indexterm role="concept">
21451 <primary>caching</primary>
21452 <secondary>callout timeouts</secondary>
21453 </indexterm>
21454 <indexterm role="concept">
21455 <primary>callout</primary>
21456 <secondary>caching timeouts</secondary>
21457 </indexterm>
21458 This option specifies the expiry time for negative callout cache data for a
21459 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
21460 section <xref linkend="SECTcallvercache"/> for details of the caching.
21461 </para>
21462 <para>
21463 <indexterm role="option">
21464 <primary><option>callout_domain_positive_expire</option></primary>
21465 </indexterm>
21466 </para>
21467 <informaltable frame="all">
21468 <tgroup cols="4" colsep="0" rowsep="0">
21469 <colspec colwidth="8*" align="left"/>
21470 <colspec colwidth="6*" align="center"/>
21471 <colspec colwidth="6*" align="center"/>
21472 <colspec colwidth="6*" align="right"/>
21473 <tbody>
21474 <row>
21475 <entry><option>callout_domain_positive_expire</option></entry>
21476 <entry>Use: <emphasis>main</emphasis></entry>
21477 <entry>Type: <emphasis>time</emphasis></entry>
21478 <entry>Default: <emphasis>7d</emphasis></entry>
21479 </row>
21480 </tbody>
21481 </tgroup>
21482 </informaltable>
21483 <para>
21484 This option specifies the expiry time for positive callout cache data for a
21485 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
21486 section <xref linkend="SECTcallvercache"/> for details of the caching.
21487 </para>
21488 <para>
21489 <indexterm role="option">
21490 <primary><option>callout_negative_expire</option></primary>
21491 </indexterm>
21492 </para>
21493 <informaltable frame="all">
21494 <tgroup cols="4" colsep="0" rowsep="0">
21495 <colspec colwidth="8*" align="left"/>
21496 <colspec colwidth="6*" align="center"/>
21497 <colspec colwidth="6*" align="center"/>
21498 <colspec colwidth="6*" align="right"/>
21499 <tbody>
21500 <row>
21501 <entry><option>callout_negative_expire</option></entry>
21502 <entry>Use: <emphasis>main</emphasis></entry>
21503 <entry>Type: <emphasis>time</emphasis></entry>
21504 <entry>Default: <emphasis>2h</emphasis></entry>
21505 </row>
21506 </tbody>
21507 </tgroup>
21508 </informaltable>
21509 <para>
21510 This option specifies the expiry time for negative callout cache data for an
21511 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
21512 section <xref linkend="SECTcallvercache"/> for details of the caching.
21513 </para>
21514 <para>
21515 <indexterm role="option">
21516 <primary><option>callout_positive_expire</option></primary>
21517 </indexterm>
21518 </para>
21519 <informaltable frame="all">
21520 <tgroup cols="4" colsep="0" rowsep="0">
21521 <colspec colwidth="8*" align="left"/>
21522 <colspec colwidth="6*" align="center"/>
21523 <colspec colwidth="6*" align="center"/>
21524 <colspec colwidth="6*" align="right"/>
21525 <tbody>
21526 <row>
21527 <entry><option>callout_positive_expire</option></entry>
21528 <entry>Use: <emphasis>main</emphasis></entry>
21529 <entry>Type: <emphasis>time</emphasis></entry>
21530 <entry>Default: <emphasis>24h</emphasis></entry>
21531 </row>
21532 </tbody>
21533 </tgroup>
21534 </informaltable>
21535 <para>
21536 This option specifies the expiry time for positive callout cache data for an
21537 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
21538 section <xref linkend="SECTcallvercache"/> for details of the caching.
21539 </para>
21540 <para>
21541 <indexterm role="option">
21542 <primary><option>callout_random_local_part</option></primary>
21543 </indexterm>
21544 </para>
21545 <informaltable frame="all">
21546 <tgroup cols="4" colsep="0" rowsep="0">
21547 <colspec colwidth="8*" align="left"/>
21548 <colspec colwidth="6*" align="center"/>
21549 <colspec colwidth="6*" align="center"/>
21550 <colspec colwidth="6*" align="right"/>
21551 <tbody>
21552 <row>
21553 <entry><option>callout_random_local_part</option></entry>
21554 <entry>Use: <emphasis>main</emphasis></entry>
21555 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21556 <entry>Default: <emphasis>see below</emphasis></entry>
21557 </row>
21558 </tbody>
21559 </tgroup>
21560 </informaltable>
21561 <para>
21562 This option defines the <quote>random</quote> local part that can be used as part of
21563 callout verification. The default value is
21564 </para>
21565 <literallayout class="monospaced">
21566 $primary_host_name-$tod_epoch-testing
21567 </literallayout>
21568 <para>
21569 See section <xref linkend="CALLaddparcall"/> for details of how this value is used.
21570 </para>
21571 <para>
21572 <indexterm role="option">
21573 <primary><option>check_log_inodes</option></primary>
21574 </indexterm>
21575 </para>
21576 <informaltable frame="all">
21577 <tgroup cols="4" colsep="0" rowsep="0">
21578 <colspec colwidth="8*" align="left"/>
21579 <colspec colwidth="6*" align="center"/>
21580 <colspec colwidth="6*" align="center"/>
21581 <colspec colwidth="6*" align="right"/>
21582 <tbody>
21583 <row>
21584 <entry><option>check_log_inodes</option></entry>
21585 <entry>Use: <emphasis>main</emphasis></entry>
21586 <entry>Type: <emphasis>integer</emphasis></entry>
21587 <entry>Default: <emphasis>0</emphasis></entry>
21588 </row>
21589 </tbody>
21590 </tgroup>
21591 </informaltable>
21592 <para>
21593 See <option>check_spool_space</option> below.
21594 </para>
21595 <para>
21596 <indexterm role="option">
21597 <primary><option>check_log_space</option></primary>
21598 </indexterm>
21599 </para>
21600 <informaltable frame="all">
21601 <tgroup cols="4" colsep="0" rowsep="0">
21602 <colspec colwidth="8*" align="left"/>
21603 <colspec colwidth="6*" align="center"/>
21604 <colspec colwidth="6*" align="center"/>
21605 <colspec colwidth="6*" align="right"/>
21606 <tbody>
21607 <row>
21608 <entry><option>check_log_space</option></entry>
21609 <entry>Use: <emphasis>main</emphasis></entry>
21610 <entry>Type: <emphasis>integer</emphasis></entry>
21611 <entry>Default: <emphasis>0</emphasis></entry>
21612 </row>
21613 </tbody>
21614 </tgroup>
21615 </informaltable>
21616 <para>
21617 See <option>check_spool_space</option> below.
21618 </para>
21619 <para>
21620 <indexterm role="option">
21621 <primary><option>check_rfc2047_length</option></primary>
21622 </indexterm>
21623 <indexterm role="concept">
21624 <primary>RFC 2047</primary>
21625 <secondary>disabling length check</secondary>
21626 </indexterm>
21627 <indexterm role="option">
21628 <primary><option>check_rfc2047_length</option></primary>
21629 </indexterm>
21630 </para>
21631 <informaltable frame="all">
21632 <tgroup cols="4" colsep="0" rowsep="0">
21633 <colspec colwidth="8*" align="left"/>
21634 <colspec colwidth="6*" align="center"/>
21635 <colspec colwidth="6*" align="center"/>
21636 <colspec colwidth="6*" align="right"/>
21637 <tbody>
21638 <row>
21639 <entry><option>check_rfc2047_length</option></entry>
21640 <entry>Use: <emphasis>main</emphasis></entry>
21641 <entry>Type: <emphasis>boolean</emphasis></entry>
21642 <entry>Default: <emphasis>true</emphasis></entry>
21643 </row>
21644 </tbody>
21645 </tgroup>
21646 </informaltable>
21647 <para>
21648 RFC 2047 defines a way of encoding non-ASCII characters in headers using a
21649 system of <quote>encoded words</quote>. The RFC specifies a maximum length for an encoded
21650 word; strings to be encoded that exceed this length are supposed to use
21651 multiple encoded words. By default, Exim does not recognize encoded words that
21652 exceed the maximum length. However, it seems that some software, in violation
21653 of the RFC, generates overlong encoded words. If <option>check_rfc2047_length</option> is
21654 set false, Exim recognizes encoded words of any length.
21655 </para>
21656 <para>
21657 <indexterm role="option">
21658 <primary><option>check_spool_inodes</option></primary>
21659 </indexterm>
21660 </para>
21661 <informaltable frame="all">
21662 <tgroup cols="4" colsep="0" rowsep="0">
21663 <colspec colwidth="8*" align="left"/>
21664 <colspec colwidth="6*" align="center"/>
21665 <colspec colwidth="6*" align="center"/>
21666 <colspec colwidth="6*" align="right"/>
21667 <tbody>
21668 <row>
21669 <entry><option>check_spool_inodes</option></entry>
21670 <entry>Use: <emphasis>main</emphasis></entry>
21671 <entry>Type: <emphasis>integer</emphasis></entry>
21672 <entry>Default: <emphasis>0</emphasis></entry>
21673 </row>
21674 </tbody>
21675 </tgroup>
21676 </informaltable>
21677 <para>
21678 See <option>check_spool_space</option> below.
21679 </para>
21680 <para>
21681 <indexterm role="option">
21682 <primary><option>check_spool_space</option></primary>
21683 </indexterm>
21684 </para>
21685 <informaltable frame="all">
21686 <tgroup cols="4" colsep="0" rowsep="0">
21687 <colspec colwidth="8*" align="left"/>
21688 <colspec colwidth="6*" align="center"/>
21689 <colspec colwidth="6*" align="center"/>
21690 <colspec colwidth="6*" align="right"/>
21691 <tbody>
21692 <row>
21693 <entry><option>check_spool_space</option></entry>
21694 <entry>Use: <emphasis>main</emphasis></entry>
21695 <entry>Type: <emphasis>integer</emphasis></entry>
21696 <entry>Default: <emphasis>0</emphasis></entry>
21697 </row>
21698 </tbody>
21699 </tgroup>
21700 </informaltable>
21701 <para>
21702 <indexterm role="concept">
21703 <primary>checking disk space</primary>
21704 </indexterm>
21705 <indexterm role="concept">
21706 <primary>disk space, checking</primary>
21707 </indexterm>
21708 <indexterm role="concept">
21709 <primary>spool directory</primary>
21710 <secondary>checking space</secondary>
21711 </indexterm>
21712 The four <option>check_...</option> options allow for checking of disk resources before a
21713 message is accepted.
21714 </para>
21715 <para>
21716 <indexterm role="variable">
21717 <primary><varname>$log_inodes</varname></primary>
21718 </indexterm>
21719 <indexterm role="variable">
21720 <primary><varname>$log_space</varname></primary>
21721 </indexterm>
21722 <indexterm role="variable">
21723 <primary><varname>$spool_inodes</varname></primary>
21724 </indexterm>
21725 <indexterm role="variable">
21726 <primary><varname>$spool_space</varname></primary>
21727 </indexterm>
21728 When any of these options are set, they apply to all incoming messages. If you
21729 want to apply different checks to different kinds of message, you can do so by
21730 testing the variables <varname>$log_inodes</varname>, <varname>$log_space</varname>, <varname>$spool_inodes</varname>, and
21731 <varname>$spool_space</varname> in an ACL with appropriate additional conditions.
21732 </para>
21733 <para>
21734 <option>check_spool_space</option> and <option>check_spool_inodes</option> check the spool partition if
21735 either value is greater than zero, for example:
21736 </para>
21737 <literallayout class="monospaced">
21738 check_spool_space = 10M
21739 check_spool_inodes = 100
21740 </literallayout>
21741 <para>
21742 The spool partition is the one that contains the directory defined by
21743 SPOOL_DIRECTORY in <filename>Local/Makefile</filename>. It is used for holding messages in
21744 transit.
21745 </para>
21746 <para>
21747 <option>check_log_space</option> and <option>check_log_inodes</option>  check the partition in which log
21748 files are written if either is greater than zero. These should be set only if
21749 <option>log_file_path</option> and <option>spool_directory</option> refer to different partitions.
21750 </para>
21751 <para>
21752 If there is less space or fewer inodes than requested, Exim refuses to accept
21753 incoming mail. In the case of SMTP input this is done by giving a 452 temporary
21754 error response to the MAIL command. If ESMTP is in use and there was a
21755 SIZE parameter on the MAIL command, its value is added to the
21756 <option>check_spool_space</option> value, and the check is performed even if
21757 <option>check_spool_space</option> is zero, unless <option>no_smtp_check_spool_space</option> is set.
21758 </para>
21759 <para>
21760 The values for <option>check_spool_space</option> and <option>check_log_space</option> are held as a
21761 number of kilobytes. If a non-multiple of 1024 is specified, it is rounded up.
21762 </para>
21763 <para>
21764 For non-SMTP input and for batched SMTP input, the test is done at start-up; on
21765 failure a message is written to stderr and Exim exits with a non-zero code, as
21766 it obviously cannot send an error message of any kind.
21767 </para>
21768 <para>
21769 <indexterm role="option">
21770 <primary><option>daemon_smtp_ports</option></primary>
21771 </indexterm>
21772 </para>
21773 <informaltable frame="all">
21774 <tgroup cols="4" colsep="0" rowsep="0">
21775 <colspec colwidth="8*" align="left"/>
21776 <colspec colwidth="6*" align="center"/>
21777 <colspec colwidth="6*" align="center"/>
21778 <colspec colwidth="6*" align="right"/>
21779 <tbody>
21780 <row>
21781 <entry><option>daemon_smtp_ports</option></entry>
21782 <entry>Use: <emphasis>main</emphasis></entry>
21783 <entry>Type: <emphasis>string</emphasis></entry>
21784 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
21785 </row>
21786 </tbody>
21787 </tgroup>
21788 </informaltable>
21789 <para>
21790 <indexterm role="concept">
21791 <primary>port</primary>
21792 <secondary>for daemon</secondary>
21793 </indexterm>
21794 <indexterm role="concept">
21795 <primary>TCP/IP</primary>
21796 <secondary>setting listening ports</secondary>
21797 </indexterm>
21798 This option specifies one or more default SMTP ports on which the Exim daemon
21799 listens. See chapter <xref linkend="CHAPinterfaces"/> for details of how it is used. For
21800 backward compatibility, <option>daemon_smtp_port</option> (singular) is a synonym.
21801 </para>
21802 <para>
21803 <indexterm role="option">
21804 <primary><option>daemon_startup_retries</option></primary>
21805 </indexterm>
21806 </para>
21807 <informaltable frame="all">
21808 <tgroup cols="4" colsep="0" rowsep="0">
21809 <colspec colwidth="8*" align="left"/>
21810 <colspec colwidth="6*" align="center"/>
21811 <colspec colwidth="6*" align="center"/>
21812 <colspec colwidth="6*" align="right"/>
21813 <tbody>
21814 <row>
21815 <entry><option>daemon_startup_retries</option></entry>
21816 <entry>Use: <emphasis>main</emphasis></entry>
21817 <entry>Type: <emphasis>integer</emphasis></entry>
21818 <entry>Default: <emphasis>9</emphasis></entry>
21819 </row>
21820 </tbody>
21821 </tgroup>
21822 </informaltable>
21823 <para>
21824 <indexterm role="concept">
21825 <primary>daemon startup, retrying</primary>
21826 </indexterm>
21827 This option, along with <option>daemon_startup_sleep</option>, controls the retrying done by
21828 the daemon at startup when it cannot immediately bind a listening socket
21829 (typically because the socket is already in use): <option>daemon_startup_retries</option>
21830 defines the number of retries after the first failure, and
21831 <option>daemon_startup_sleep</option> defines the length of time to wait between retries.
21832 </para>
21833 <para>
21834 <indexterm role="option">
21835 <primary><option>daemon_startup_sleep</option></primary>
21836 </indexterm>
21837 </para>
21838 <informaltable frame="all">
21839 <tgroup cols="4" colsep="0" rowsep="0">
21840 <colspec colwidth="8*" align="left"/>
21841 <colspec colwidth="6*" align="center"/>
21842 <colspec colwidth="6*" align="center"/>
21843 <colspec colwidth="6*" align="right"/>
21844 <tbody>
21845 <row>
21846 <entry><option>daemon_startup_sleep</option></entry>
21847 <entry>Use: <emphasis>main</emphasis></entry>
21848 <entry>Type: <emphasis>time</emphasis></entry>
21849 <entry>Default: <emphasis>30s</emphasis></entry>
21850 </row>
21851 </tbody>
21852 </tgroup>
21853 </informaltable>
21854 <para>
21855 See <option>daemon_startup_retries</option>.
21856 </para>
21857 <para>
21858 <indexterm role="option">
21859 <primary><option>delay_warning</option></primary>
21860 </indexterm>
21861 </para>
21862 <informaltable frame="all">
21863 <tgroup cols="4" colsep="0" rowsep="0">
21864 <colspec colwidth="8*" align="left"/>
21865 <colspec colwidth="6*" align="center"/>
21866 <colspec colwidth="6*" align="center"/>
21867 <colspec colwidth="6*" align="right"/>
21868 <tbody>
21869 <row>
21870 <entry><option>delay_warning</option></entry>
21871 <entry>Use: <emphasis>main</emphasis></entry>
21872 <entry>Type: <emphasis>time list</emphasis></entry>
21873 <entry>Default: <emphasis>24h</emphasis></entry>
21874 </row>
21875 </tbody>
21876 </tgroup>
21877 </informaltable>
21878 <para>
21879 <indexterm role="concept">
21880 <primary>warning of delay</primary>
21881 </indexterm>
21882 <indexterm role="concept">
21883 <primary>delay warning, specifying</primary>
21884 </indexterm>
21885 When a message is delayed, Exim sends a warning message to the sender at
21886 intervals specified by this option. The data is a colon-separated list of times
21887 after which to send warning messages. If the value of the option is an empty
21888 string or a zero time, no warnings are sent. Up to 10 times may be given. If a
21889 message has been on the queue for longer than the last time, the last interval
21890 between the times is used to compute subsequent warning times. For example,
21891 with
21892 </para>
21893 <literallayout class="monospaced">
21894 delay_warning = 4h:8h:24h
21895 </literallayout>
21896 <para>
21897 the first message is sent after 4 hours, the second after 8 hours, and
21898 the third one after 24 hours. After that, messages are sent every 16 hours,
21899 because that is the interval between the last two times on the list. If you set
21900 just one time, it specifies the repeat interval. For example, with:
21901 </para>
21902 <literallayout class="monospaced">
21903 delay_warning = 6h
21904 </literallayout>
21905 <para>
21906 messages are repeated every six hours. To stop warnings after a given time, set
21907 a very large time at the end of the list. For example:
21908 </para>
21909 <literallayout class="monospaced">
21910 delay_warning = 2h:12h:99d
21911 </literallayout>
21912 <para>
21913 <indexterm role="option">
21914 <primary><option>delay_warning_condition</option></primary>
21915 </indexterm>
21916 </para>
21917 <informaltable frame="all">
21918 <tgroup cols="4" colsep="0" rowsep="0">
21919 <colspec colwidth="8*" align="left"/>
21920 <colspec colwidth="6*" align="center"/>
21921 <colspec colwidth="6*" align="center"/>
21922 <colspec colwidth="6*" align="right"/>
21923 <tbody>
21924 <row>
21925 <entry><option>delay_warning_condition</option></entry>
21926 <entry>Use: <emphasis>main</emphasis></entry>
21927 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21928 <entry>Default: <emphasis>see below</emphasis></entry>
21929 </row>
21930 </tbody>
21931 </tgroup>
21932 </informaltable>
21933 <para>
21934 <indexterm role="variable">
21935 <primary><varname>$domain</varname></primary>
21936 </indexterm>
21937 The string is expanded at the time a warning message might be sent. If all the
21938 deferred addresses have the same domain, it is set in <varname>$domain</varname> during the
21939 expansion. Otherwise <varname>$domain</varname> is empty. If the result of the expansion is a
21940 forced failure, an empty string, or a string matching any of <quote>0</quote>, <quote>no</quote> or
21941 <quote>false</quote> (the comparison being done caselessly) then the warning message is
21942 not sent. The default is:
21943 </para>
21944 <literallayout class="monospaced">
21945 delay_warning_condition = ${if or {\
21946   { !eq{$h_list-id:$h_list-post:$h_list-subscribe:}{} }\
21947   { match{$h_precedence:}{(?i)bulk|list|junk} }\
21948   { match{$h_auto-submitted:}{(?i)auto-generated|auto-replied} }\
21949   } {no}{yes}}
21950 </literallayout>
21951 <para>
21952 This suppresses the sending of warnings for messages that contain <emphasis>List-ID:</emphasis>,
21953 <emphasis>List-Post:</emphasis>, or <emphasis>List-Subscribe:</emphasis> headers, or have <quote>bulk</quote>, <quote>list</quote> or
21954 <quote>junk</quote> in a <emphasis>Precedence:</emphasis> header, or have <quote>auto-generated</quote> or
21955 <quote>auto-replied</quote> in an <emphasis>Auto-Submitted:</emphasis> header.
21956 </para>
21957 <para>
21958 <indexterm role="option">
21959 <primary><option>deliver_drop_privilege</option></primary>
21960 </indexterm>
21961 </para>
21962 <informaltable frame="all">
21963 <tgroup cols="4" colsep="0" rowsep="0">
21964 <colspec colwidth="8*" align="left"/>
21965 <colspec colwidth="6*" align="center"/>
21966 <colspec colwidth="6*" align="center"/>
21967 <colspec colwidth="6*" align="right"/>
21968 <tbody>
21969 <row>
21970 <entry><option>deliver_drop_privilege</option></entry>
21971 <entry>Use: <emphasis>main</emphasis></entry>
21972 <entry>Type: <emphasis>boolean</emphasis></entry>
21973 <entry>Default: <emphasis>false</emphasis></entry>
21974 </row>
21975 </tbody>
21976 </tgroup>
21977 </informaltable>
21978 <para>
21979 <indexterm role="concept">
21980 <primary>unprivileged delivery</primary>
21981 </indexterm>
21982 <indexterm role="concept">
21983 <primary>delivery</primary>
21984 <secondary>unprivileged</secondary>
21985 </indexterm>
21986 If this option is set true, Exim drops its root privilege at the start of a
21987 delivery process, and runs as the Exim user throughout. This severely restricts
21988 the kinds of local delivery that are possible, but is viable in certain types
21989 of configuration. There is a discussion about the use of root privilege in
21990 chapter <xref linkend="CHAPsecurity"/>.
21991 </para>
21992 <para>
21993 <indexterm role="option">
21994 <primary><option>deliver_queue_load_max</option></primary>
21995 </indexterm>
21996 </para>
21997 <informaltable frame="all">
21998 <tgroup cols="4" colsep="0" rowsep="0">
21999 <colspec colwidth="8*" align="left"/>
22000 <colspec colwidth="6*" align="center"/>
22001 <colspec colwidth="6*" align="center"/>
22002 <colspec colwidth="6*" align="right"/>
22003 <tbody>
22004 <row>
22005 <entry><option>deliver_queue_load_max</option></entry>
22006 <entry>Use: <emphasis>main</emphasis></entry>
22007 <entry>Type: <emphasis>fixed-point</emphasis></entry>
22008 <entry>Default: <emphasis>unset</emphasis></entry>
22009 </row>
22010 </tbody>
22011 </tgroup>
22012 </informaltable>
22013 <para>
22014 <indexterm role="concept">
22015 <primary>load average</primary>
22016 </indexterm>
22017 <indexterm role="concept">
22018 <primary>queue runner</primary>
22019 <secondary>abandoning</secondary>
22020 </indexterm>
22021 When this option is set, a queue run is abandoned if the system load average
22022 becomes greater than the value of the option. The option has no effect on
22023 ancient operating systems on which Exim cannot determine the load average.
22024 See also <option>queue_only_load</option> and <option>smtp_load_reserve</option>.
22025 </para>
22026 <para>
22027 <indexterm role="option">
22028 <primary><option>delivery_date_remove</option></primary>
22029 </indexterm>
22030 </para>
22031 <informaltable frame="all">
22032 <tgroup cols="4" colsep="0" rowsep="0">
22033 <colspec colwidth="8*" align="left"/>
22034 <colspec colwidth="6*" align="center"/>
22035 <colspec colwidth="6*" align="center"/>
22036 <colspec colwidth="6*" align="right"/>
22037 <tbody>
22038 <row>
22039 <entry><option>delivery_date_remove</option></entry>
22040 <entry>Use: <emphasis>main</emphasis></entry>
22041 <entry>Type: <emphasis>boolean</emphasis></entry>
22042 <entry>Default: <emphasis>true</emphasis></entry>
22043 </row>
22044 </tbody>
22045 </tgroup>
22046 </informaltable>
22047 <para>
22048 <indexterm role="concept">
22049 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
22050 </indexterm>
22051 Exim&#x2019;s transports have an option for adding a <emphasis>Delivery-date:</emphasis> header to a
22052 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
22053 handled. <emphasis>Delivery-date:</emphasis> records the actual time of delivery. Such headers
22054 should not be present in incoming messages, and this option causes them to be
22055 removed at the time the message is received, to avoid any problems that might
22056 occur when a delivered message is subsequently sent on to some other recipient.
22057 </para>
22058 <para>
22059 <indexterm role="option">
22060 <primary><option>disable_fsync</option></primary>
22061 </indexterm>
22062 </para>
22063 <informaltable frame="all">
22064 <tgroup cols="4" colsep="0" rowsep="0">
22065 <colspec colwidth="8*" align="left"/>
22066 <colspec colwidth="6*" align="center"/>
22067 <colspec colwidth="6*" align="center"/>
22068 <colspec colwidth="6*" align="right"/>
22069 <tbody>
22070 <row>
22071 <entry><option>disable_fsync</option></entry>
22072 <entry>Use: <emphasis>main</emphasis></entry>
22073 <entry>Type: <emphasis>boolean</emphasis></entry>
22074 <entry>Default: <emphasis>false</emphasis></entry>
22075 </row>
22076 </tbody>
22077 </tgroup>
22078 </informaltable>
22079 <para>
22080 <indexterm role="concept">
22081 <primary><function>fsync()</function>, disabling</primary>
22082 </indexterm>
22083 This option is available only if Exim was built with the compile-time option
22084 ENABLE_DISABLE_FSYNC. When this is not set, a reference to <option>disable_fsync</option> in
22085 a runtime configuration generates an <quote>unknown option</quote> error. You should not
22086 build Exim with ENABLE_DISABLE_FSYNC or set <option>disable_fsync</option> unless you
22087 really, really, really understand what you are doing. <emphasis>No pre-compiled
22088 distributions of Exim should ever make this option available.</emphasis>
22089 </para>
22090 <para>
22091 When <option>disable_fsync</option> is set true, Exim no longer calls <function>fsync()</function> to force
22092 updated files&#x2019; data to be written to disc before continuing. Unexpected events
22093 such as crashes and power outages may cause data to be lost or scrambled.
22094 Here be Dragons. <emphasis role="bold">Beware.</emphasis>
22095 </para>
22096 <para>
22097 <indexterm role="option">
22098 <primary><option>disable_ipv6</option></primary>
22099 </indexterm>
22100 </para>
22101 <informaltable frame="all">
22102 <tgroup cols="4" colsep="0" rowsep="0">
22103 <colspec colwidth="8*" align="left"/>
22104 <colspec colwidth="6*" align="center"/>
22105 <colspec colwidth="6*" align="center"/>
22106 <colspec colwidth="6*" align="right"/>
22107 <tbody>
22108 <row>
22109 <entry><option>disable_ipv6</option></entry>
22110 <entry>Use: <emphasis>main</emphasis></entry>
22111 <entry>Type: <emphasis>boolean</emphasis></entry>
22112 <entry>Default: <emphasis>false</emphasis></entry>
22113 </row>
22114 </tbody>
22115 </tgroup>
22116 </informaltable>
22117 <para>
22118 <indexterm role="concept">
22119 <primary>IPv6</primary>
22120 <secondary>disabling</secondary>
22121 </indexterm>
22122 If this option is set true, even if the Exim binary has IPv6 support, no IPv6
22123 activities take place. AAAA records are never looked up, and any IPv6 addresses
22124 that are listed in <option>local_interfaces</option>, data for the <option>manualroute</option> router,
22125 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
22126 to handle IPv6 literal addresses.
22127 </para>
22128 <para>
22129 <indexterm role="option">
22130 <primary><option>dns_again_means_nonexist</option></primary>
22131 </indexterm>
22132 </para>
22133 <informaltable frame="all">
22134 <tgroup cols="4" colsep="0" rowsep="0">
22135 <colspec colwidth="8*" align="left"/>
22136 <colspec colwidth="6*" align="center"/>
22137 <colspec colwidth="6*" align="center"/>
22138 <colspec colwidth="6*" align="right"/>
22139 <tbody>
22140 <row>
22141 <entry><option>dns_again_means_nonexist</option></entry>
22142 <entry>Use: <emphasis>main</emphasis></entry>
22143 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
22144 <entry>Default: <emphasis>unset</emphasis></entry>
22145 </row>
22146 </tbody>
22147 </tgroup>
22148 </informaltable>
22149 <para>
22150 <indexterm role="concept">
22151 <primary>DNS</primary>
22152 <secondary><quote>try again</quote> response; overriding</secondary>
22153 </indexterm>
22154 DNS lookups give a <quote>try again</quote> response for the DNS errors
22155 <quote>non-authoritative host not found</quote> and <quote>SERVERFAIL</quote>. This can cause Exim to
22156 keep trying to deliver a message, or to give repeated temporary errors to
22157 incoming mail. Sometimes the effect is caused by a badly set up name server and
22158 may persist for a long time. If a domain which exhibits this problem matches
22159 anything in <option>dns_again_means_nonexist</option>, it is treated as if it did not exist.
22160 This option should be used with care. You can make it apply to reverse lookups
22161 by a setting such as this:
22162 </para>
22163 <literallayout class="monospaced">
22164 dns_again_means_nonexist = *.in-addr.arpa
22165 </literallayout>
22166 <para>
22167 This option applies to all DNS lookups that Exim does. It also applies when the
22168 <function>gethostbyname()</function> or <function>getipnodebyname()</function> functions give temporary errors,
22169 since these are most likely to be caused by DNS lookup problems. The
22170 <command>dnslookup</command> router has some options of its own for controlling what happens
22171 when lookups for MX or SRV records give temporary errors. These more specific
22172 options are applied after this global option.
22173 </para>
22174 <para>
22175 <indexterm role="option">
22176 <primary><option>dns_check_names_pattern</option></primary>
22177 </indexterm>
22178 </para>
22179 <informaltable frame="all">
22180 <tgroup cols="4" colsep="0" rowsep="0">
22181 <colspec colwidth="8*" align="left"/>
22182 <colspec colwidth="6*" align="center"/>
22183 <colspec colwidth="6*" align="center"/>
22184 <colspec colwidth="6*" align="right"/>
22185 <tbody>
22186 <row>
22187 <entry><option>dns_check_names_pattern</option></entry>
22188 <entry>Use: <emphasis>main</emphasis></entry>
22189 <entry>Type: <emphasis>string</emphasis></entry>
22190 <entry>Default: <emphasis>see below</emphasis></entry>
22191 </row>
22192 </tbody>
22193 </tgroup>
22194 </informaltable>
22195 <para>
22196 <indexterm role="concept">
22197 <primary>DNS</primary>
22198 <secondary>pre-check of name syntax</secondary>
22199 </indexterm>
22200 When this option is set to a non-empty string, it causes Exim to check domain
22201 names for characters that are not allowed in host names before handing them to
22202 the DNS resolver, because some resolvers give temporary errors for names that
22203 contain unusual characters. If a domain name contains any unwanted characters,
22204 a <quote>not found</quote> result is forced, and the resolver is not called. The check is
22205 done by matching the domain name against a regular expression, which is the
22206 value of this option. The default pattern is
22207 </para>
22208 <literallayout class="monospaced">
22209 dns_check_names_pattern = \
22210   (?i)^(?&gt;(?(1)\.|())[^\W_](?&gt;[a-z0-9/-]*[^\W_])?)+$
22211 </literallayout>
22212 <para>
22213 which permits only letters, digits, slashes, and hyphens in components, but
22214 they must start and end with a letter or digit. Slashes are not, in fact,
22215 permitted in host names, but they are found in certain NS records (which can be
22216 accessed in Exim by using a <option>dnsdb</option> lookup). If you set
22217 <option>allow_utf8_domains</option>, you must modify this pattern, or set the option to an
22218 empty string.
22219 </para>
22220 <para>
22221 <indexterm role="option">
22222 <primary><option>dns_csa_search_limit</option></primary>
22223 </indexterm>
22224 </para>
22225 <informaltable frame="all">
22226 <tgroup cols="4" colsep="0" rowsep="0">
22227 <colspec colwidth="8*" align="left"/>
22228 <colspec colwidth="6*" align="center"/>
22229 <colspec colwidth="6*" align="center"/>
22230 <colspec colwidth="6*" align="right"/>
22231 <tbody>
22232 <row>
22233 <entry><option>dns_csa_search_limit</option></entry>
22234 <entry>Use: <emphasis>main</emphasis></entry>
22235 <entry>Type: <emphasis>integer</emphasis></entry>
22236 <entry>Default: <emphasis>5</emphasis></entry>
22237 </row>
22238 </tbody>
22239 </tgroup>
22240 </informaltable>
22241 <para>
22242 This option controls the depth of parental searching for CSA SRV records in the
22243 DNS, as described in more detail in section <xref linkend="SECTverifyCSA"/>.
22244 </para>
22245 <para>
22246 <indexterm role="option">
22247 <primary><option>dns_csa_use_reverse</option></primary>
22248 </indexterm>
22249 </para>
22250 <informaltable frame="all">
22251 <tgroup cols="4" colsep="0" rowsep="0">
22252 <colspec colwidth="8*" align="left"/>
22253 <colspec colwidth="6*" align="center"/>
22254 <colspec colwidth="6*" align="center"/>
22255 <colspec colwidth="6*" align="right"/>
22256 <tbody>
22257 <row>
22258 <entry><option>dns_csa_use_reverse</option></entry>
22259 <entry>Use: <emphasis>main</emphasis></entry>
22260 <entry>Type: <emphasis>boolean</emphasis></entry>
22261 <entry>Default: <emphasis>true</emphasis></entry>
22262 </row>
22263 </tbody>
22264 </tgroup>
22265 </informaltable>
22266 <para>
22267 This option controls whether or not an IP address, given as a CSA domain, is
22268 reversed and looked up in the reverse DNS, as described in more detail in
22269 section <xref linkend="SECTverifyCSA"/>.
22270 </para>
22271 <para>
22272 <indexterm role="option">
22273 <primary><option>dns_ipv4_lookup</option></primary>
22274 </indexterm>
22275 </para>
22276 <informaltable frame="all">
22277 <tgroup cols="4" colsep="0" rowsep="0">
22278 <colspec colwidth="8*" align="left"/>
22279 <colspec colwidth="6*" align="center"/>
22280 <colspec colwidth="6*" align="center"/>
22281 <colspec colwidth="6*" align="right"/>
22282 <tbody>
22283 <row>
22284 <entry><option>dns_ipv4_lookup</option></entry>
22285 <entry>Use: <emphasis>main</emphasis></entry>
22286 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
22287 <entry>Default: <emphasis>unset</emphasis></entry>
22288 </row>
22289 </tbody>
22290 </tgroup>
22291 </informaltable>
22292 <para>
22293 <indexterm role="concept">
22294 <primary>IPv6</primary>
22295 <secondary>DNS lookup for AAAA records</secondary>
22296 </indexterm>
22297 <indexterm role="concept">
22298 <primary>DNS</primary>
22299 <secondary>IPv6 lookup for AAAA records</secondary>
22300 </indexterm>
22301 When Exim is compiled with IPv6 support and <option>disable_ipv6</option> is not set, it
22302 looks for IPv6 address records (AAAA records) as well as IPv4 address records
22303 (A records) when trying to find IP addresses for hosts, unless the host&#x2019;s
22304 domain matches this list.
22305 </para>
22306 <para>
22307 This is a fudge to help with name servers that give big delays or otherwise do
22308 not work for the AAAA record type. In due course, when the world&#x2019;s name
22309 servers have all been upgraded, there should be no need for this option.
22310 </para>
22311 <para>
22312 <indexterm role="option">
22313 <primary><option>dns_retrans</option></primary>
22314 </indexterm>
22315 </para>
22316 <informaltable frame="all">
22317 <tgroup cols="4" colsep="0" rowsep="0">
22318 <colspec colwidth="8*" align="left"/>
22319 <colspec colwidth="6*" align="center"/>
22320 <colspec colwidth="6*" align="center"/>
22321 <colspec colwidth="6*" align="right"/>
22322 <tbody>
22323 <row>
22324 <entry><option>dns_retrans</option></entry>
22325 <entry>Use: <emphasis>main</emphasis></entry>
22326 <entry>Type: <emphasis>time</emphasis></entry>
22327 <entry>Default: <emphasis>0s</emphasis></entry>
22328 </row>
22329 </tbody>
22330 </tgroup>
22331 </informaltable>
22332 <para>
22333 <indexterm role="concept">
22334 <primary>DNS</primary>
22335 <secondary>resolver options</secondary>
22336 </indexterm>
22337 The options <option>dns_retrans</option> and <option>dns_retry</option> can be used to set the
22338 retransmission and retry parameters for DNS lookups. Values of zero (the
22339 defaults) leave the system default settings unchanged. The first value is the
22340 time between retries, and the second is the number of retries. It isn&#x2019;t
22341 totally clear exactly how these settings affect the total time a DNS lookup may
22342 take. I haven&#x2019;t found any documentation about timeouts on DNS lookups; these
22343 parameter values are available in the external resolver interface structure,
22344 but nowhere does it seem to describe how they are used or what you might want
22345 to set in them.
22346 </para>
22347 <para>
22348 <indexterm role="option">
22349 <primary><option>dns_retry</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>dns_retry</option></entry>
22361 <entry>Use: <emphasis>main</emphasis></entry>
22362 <entry>Type: <emphasis>integer</emphasis></entry>
22363 <entry>Default: <emphasis>0</emphasis></entry>
22364 </row>
22365 </tbody>
22366 </tgroup>
22367 </informaltable>
22368 <para>
22369 See <option>dns_retrans</option> above.
22370 </para>
22371 <para revisionflag="changed">
22372 <indexterm role="option">
22373 <primary><option>dns_use_edns0</option></primary>
22374 </indexterm>
22375 </para>
22376 <informaltable frame="all" revisionflag="changed">
22377 <tgroup cols="4" colsep="0" rowsep="0">
22378 <colspec colwidth="8*" align="left"/>
22379 <colspec colwidth="6*" align="center"/>
22380 <colspec colwidth="6*" align="center"/>
22381 <colspec colwidth="6*" align="right"/>
22382 <tbody>
22383 <row>
22384 <entry><option>dns_use_edns0</option></entry>
22385 <entry>Use: <emphasis>main</emphasis></entry>
22386 <entry>Type: <emphasis>integer</emphasis></entry>
22387 <entry>Default: <emphasis>-1</emphasis></entry>
22388 </row>
22389 </tbody>
22390 </tgroup>
22391 </informaltable>
22392 <para revisionflag="changed">
22393 <indexterm role="concept">
22394 <primary>DNS</primary>
22395 <secondary>resolver options</secondary>
22396 </indexterm>
22397 <indexterm role="concept">
22398 <primary>DNS</primary>
22399 <secondary>EDNS0</secondary>
22400 </indexterm>
22401 If this option is set to a non-negative number then Exim will initialise the
22402 DNS resolver library to either use or not use EDNS0 extensions, overriding
22403 the system default. A value of 0 coerces EDNS0 off, a value of 1 coerces EDNS0
22404 on.
22405 </para>
22406 <para revisionflag="changed">
22407 If the resolver library does not support EDNS0 then this option has no effect.
22408 </para>
22409 <para>
22410 <indexterm role="option">
22411 <primary><option>drop_cr</option></primary>
22412 </indexterm>
22413 </para>
22414 <informaltable frame="all">
22415 <tgroup cols="4" colsep="0" rowsep="0">
22416 <colspec colwidth="8*" align="left"/>
22417 <colspec colwidth="6*" align="center"/>
22418 <colspec colwidth="6*" align="center"/>
22419 <colspec colwidth="6*" align="right"/>
22420 <tbody>
22421 <row>
22422 <entry><option>drop_cr</option></entry>
22423 <entry>Use: <emphasis>main</emphasis></entry>
22424 <entry>Type: <emphasis>boolean</emphasis></entry>
22425 <entry>Default: <emphasis>false</emphasis></entry>
22426 </row>
22427 </tbody>
22428 </tgroup>
22429 </informaltable>
22430 <para>
22431 This is an obsolete option that is now a no-op. It used to affect the way Exim
22432 handled CR and LF characters in incoming messages. What happens now is
22433 described in section <xref linkend="SECTlineendings"/>.
22434 </para>
22435 <para>
22436 <indexterm role="option">
22437 <primary><option>dsn_from</option></primary>
22438 </indexterm>
22439 </para>
22440 <informaltable frame="all">
22441 <tgroup cols="4" colsep="0" rowsep="0">
22442 <colspec colwidth="8*" align="left"/>
22443 <colspec colwidth="6*" align="center"/>
22444 <colspec colwidth="6*" align="center"/>
22445 <colspec colwidth="6*" align="right"/>
22446 <tbody>
22447 <row>
22448 <entry><option>dsn_from</option></entry>
22449 <entry>Use: <emphasis>main</emphasis></entry>
22450 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22451 <entry>Default: <emphasis>see below</emphasis></entry>
22452 </row>
22453 </tbody>
22454 </tgroup>
22455 </informaltable>
22456 <para>
22457 <indexterm role="concept">
22458 <primary><emphasis>From:</emphasis> header line</primary>
22459 <secondary>in bounces</secondary>
22460 </indexterm>
22461 <indexterm role="concept">
22462 <primary>bounce messages</primary>
22463 <secondary><emphasis>From:</emphasis> line, specifying</secondary>
22464 </indexterm>
22465 This option can be used to vary the contents of <emphasis>From:</emphasis> header lines in
22466 bounces and other automatically generated messages (<quote>Delivery Status
22467 Notifications</quote> &ndash; hence the name of the option). The default setting is:
22468 </para>
22469 <literallayout class="monospaced">
22470 dsn_from = Mail Delivery System &lt;Mailer-Daemon@$qualify_domain&gt;
22471 </literallayout>
22472 <para>
22473 The value is expanded every time it is needed. If the expansion fails, a
22474 panic is logged, and the default value is used.
22475 </para>
22476 <para>
22477 <indexterm role="option">
22478 <primary><option>envelope_to_remove</option></primary>
22479 </indexterm>
22480 </para>
22481 <informaltable frame="all">
22482 <tgroup cols="4" colsep="0" rowsep="0">
22483 <colspec colwidth="8*" align="left"/>
22484 <colspec colwidth="6*" align="center"/>
22485 <colspec colwidth="6*" align="center"/>
22486 <colspec colwidth="6*" align="right"/>
22487 <tbody>
22488 <row>
22489 <entry><option>envelope_to_remove</option></entry>
22490 <entry>Use: <emphasis>main</emphasis></entry>
22491 <entry>Type: <emphasis>boolean</emphasis></entry>
22492 <entry>Default: <emphasis>true</emphasis></entry>
22493 </row>
22494 </tbody>
22495 </tgroup>
22496 </informaltable>
22497 <para>
22498 <indexterm role="concept">
22499 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
22500 </indexterm>
22501 Exim&#x2019;s transports have an option for adding an <emphasis>Envelope-to:</emphasis> header to a
22502 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
22503 handled. <emphasis>Envelope-to:</emphasis> records the original recipient address from the
22504 messages&#x2019;s envelope that caused the delivery to happen. Such headers should not
22505 be present in incoming messages, and this option causes them to be removed at
22506 the time the message is received, to avoid any problems that might occur when a
22507 delivered message is subsequently sent on to some other recipient.
22508 </para>
22509 <para>
22510 <indexterm role="option">
22511 <primary><option>errors_copy</option></primary>
22512 </indexterm>
22513 </para>
22514 <informaltable frame="all">
22515 <tgroup cols="4" colsep="0" rowsep="0">
22516 <colspec colwidth="8*" align="left"/>
22517 <colspec colwidth="6*" align="center"/>
22518 <colspec colwidth="6*" align="center"/>
22519 <colspec colwidth="6*" align="right"/>
22520 <tbody>
22521 <row>
22522 <entry><option>errors_copy</option></entry>
22523 <entry>Use: <emphasis>main</emphasis></entry>
22524 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
22525 <entry>Default: <emphasis>unset</emphasis></entry>
22526 </row>
22527 </tbody>
22528 </tgroup>
22529 </informaltable>
22530 <para>
22531 <indexterm role="concept">
22532 <primary>bounce message</primary>
22533 <secondary>copy to other address</secondary>
22534 </indexterm>
22535 <indexterm role="concept">
22536 <primary>copy of bounce message</primary>
22537 </indexterm>
22538 Setting this option causes Exim to send bcc copies of bounce messages that it
22539 generates to other addresses. <emphasis role="bold">Note</emphasis>: This does not apply to bounce messages
22540 coming from elsewhere. The value of the option is a colon-separated list of
22541 items. Each item consists of a pattern, terminated by white space, followed by
22542 a comma-separated list of email addresses. If a pattern contains spaces, it
22543 must be enclosed in double quotes.
22544 </para>
22545 <para>
22546 Each pattern is processed in the same way as a single item in an address list
22547 (see section <xref linkend="SECTaddresslist"/>). When a pattern matches the recipient of
22548 the bounce message, the message is copied to the addresses on the list. The
22549 items are scanned in order, and once a matching one is found, no further items
22550 are examined. For example:
22551 </para>
22552 <literallayout class="monospaced">
22553 errors_copy = spqr@mydomain   postmaster@mydomain.example :\
22554               rqps@mydomain   hostmaster@mydomain.example,\
22555                               postmaster@mydomain.example
22556 </literallayout>
22557 <para>
22558 <indexterm role="variable">
22559 <primary><varname>$domain</varname></primary>
22560 </indexterm>
22561 <indexterm role="variable">
22562 <primary><varname>$local_part</varname></primary>
22563 </indexterm>
22564 The address list is expanded before use. The expansion variables <varname>$local_part</varname>
22565 and <varname>$domain</varname> are set from the original recipient of the error message, and if
22566 there was any wildcard matching in the pattern, the expansion
22567 <indexterm role="concept">
22568 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
22569 <secondary>in <option>errors_copy</option></secondary>
22570 </indexterm>
22571 variables <varname>$0</varname>, <varname>$1</varname>, etc. are set in the normal way.
22572 </para>
22573 <para>
22574 <indexterm role="option">
22575 <primary><option>errors_reply_to</option></primary>
22576 </indexterm>
22577 </para>
22578 <informaltable frame="all">
22579 <tgroup cols="4" colsep="0" rowsep="0">
22580 <colspec colwidth="8*" align="left"/>
22581 <colspec colwidth="6*" align="center"/>
22582 <colspec colwidth="6*" align="center"/>
22583 <colspec colwidth="6*" align="right"/>
22584 <tbody>
22585 <row>
22586 <entry><option>errors_reply_to</option></entry>
22587 <entry>Use: <emphasis>main</emphasis></entry>
22588 <entry>Type: <emphasis>string</emphasis></entry>
22589 <entry>Default: <emphasis>unset</emphasis></entry>
22590 </row>
22591 </tbody>
22592 </tgroup>
22593 </informaltable>
22594 <para>
22595 <indexterm role="concept">
22596 <primary>bounce message</primary>
22597 <secondary><emphasis>Reply-to:</emphasis> in</secondary>
22598 </indexterm>
22599 By default, Exim&#x2019;s bounce and delivery warning messages contain the header line
22600 </para>
22601 <literallayout>
22602 <literal>From: Mail Delivery System &lt;Mailer-Daemon@</literal><emphasis>qualify-domain</emphasis><literal>&gt;</literal>
22603 </literallayout>
22604 <para>
22605 <indexterm role="option">
22606 <primary><option>quota_warn_message</option></primary>
22607 </indexterm>
22608 where <emphasis>qualify-domain</emphasis> is the value of the <option>qualify_domain</option> option.
22609 A warning message that is generated by the <option>quota_warn_message</option> option in an
22610 <command>appendfile</command> transport may contain its own <emphasis>From:</emphasis> header line that
22611 overrides the default.
22612 </para>
22613 <para>
22614 Experience shows that people reply to bounce messages. If the
22615 <option>errors_reply_to</option> option is set, a <emphasis>Reply-To:</emphasis> header is added to bounce
22616 and warning messages. For example:
22617 </para>
22618 <literallayout class="monospaced">
22619 errors_reply_to = postmaster@my.domain.example
22620 </literallayout>
22621 <para>
22622 The value of the option is not expanded. It must specify a valid RFC 2822
22623 address. However, if a warning message that is generated by the
22624 <option>quota_warn_message</option> option in an <command>appendfile</command> transport contain its
22625 own <emphasis>Reply-To:</emphasis> header line, the value of the <option>errors_reply_to</option> option is
22626 not used.
22627 </para>
22628 <para>
22629 <indexterm role="option">
22630 <primary><option>exim_group</option></primary>
22631 </indexterm>
22632 </para>
22633 <informaltable frame="all">
22634 <tgroup cols="4" colsep="0" rowsep="0">
22635 <colspec colwidth="8*" align="left"/>
22636 <colspec colwidth="6*" align="center"/>
22637 <colspec colwidth="6*" align="center"/>
22638 <colspec colwidth="6*" align="right"/>
22639 <tbody>
22640 <row>
22641 <entry><option>exim_group</option></entry>
22642 <entry>Use: <emphasis>main</emphasis></entry>
22643 <entry>Type: <emphasis>string</emphasis></entry>
22644 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
22645 </row>
22646 </tbody>
22647 </tgroup>
22648 </informaltable>
22649 <para>
22650 <indexterm role="concept">
22651 <primary>gid (group id)</primary>
22652 <secondary>Exim&#x2019;s own</secondary>
22653 </indexterm>
22654 <indexterm role="concept">
22655 <primary>Exim group</primary>
22656 </indexterm>
22657 This option changes the gid under which Exim runs when it gives up root
22658 privilege. The default value is compiled into the binary. The value of this
22659 option is used only when <option>exim_user</option> is also set. Unless it consists entirely
22660 of digits, the string is looked up using <function>getgrnam()</function>, and failure causes a
22661 configuration error. See chapter <xref linkend="CHAPsecurity"/> for a discussion of
22662 security issues.
22663 </para>
22664 <para>
22665 <indexterm role="option">
22666 <primary><option>exim_path</option></primary>
22667 </indexterm>
22668 </para>
22669 <informaltable frame="all">
22670 <tgroup cols="4" colsep="0" rowsep="0">
22671 <colspec colwidth="8*" align="left"/>
22672 <colspec colwidth="6*" align="center"/>
22673 <colspec colwidth="6*" align="center"/>
22674 <colspec colwidth="6*" align="right"/>
22675 <tbody>
22676 <row>
22677 <entry><option>exim_path</option></entry>
22678 <entry>Use: <emphasis>main</emphasis></entry>
22679 <entry>Type: <emphasis>string</emphasis></entry>
22680 <entry>Default: <emphasis>see below</emphasis></entry>
22681 </row>
22682 </tbody>
22683 </tgroup>
22684 </informaltable>
22685 <para>
22686 <indexterm role="concept">
22687 <primary>Exim binary, path name</primary>
22688 </indexterm>
22689 This option specifies the path name of the Exim binary, which is used when Exim
22690 needs to re-exec itself. The default is set up to point to the file <emphasis>exim</emphasis> in
22691 the directory configured at compile time by the BIN_DIRECTORY setting. It
22692 is necessary to change <option>exim_path</option> if, exceptionally, Exim is run from some
22693 other place.
22694 <emphasis role="bold">Warning</emphasis>: Do not use a macro to define the value of this option, because
22695 you will break those Exim utilities that scan the configuration file to find
22696 where the binary is. (They then use the <option>-bP</option> option to extract option
22697 settings such as the value of <option>spool_directory</option>.)
22698 </para>
22699 <para>
22700 <indexterm role="option">
22701 <primary><option>exim_user</option></primary>
22702 </indexterm>
22703 </para>
22704 <informaltable frame="all">
22705 <tgroup cols="4" colsep="0" rowsep="0">
22706 <colspec colwidth="8*" align="left"/>
22707 <colspec colwidth="6*" align="center"/>
22708 <colspec colwidth="6*" align="center"/>
22709 <colspec colwidth="6*" align="right"/>
22710 <tbody>
22711 <row>
22712 <entry><option>exim_user</option></entry>
22713 <entry>Use: <emphasis>main</emphasis></entry>
22714 <entry>Type: <emphasis>string</emphasis></entry>
22715 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
22716 </row>
22717 </tbody>
22718 </tgroup>
22719 </informaltable>
22720 <para>
22721 <indexterm role="concept">
22722 <primary>uid (user id)</primary>
22723 <secondary>Exim&#x2019;s own</secondary>
22724 </indexterm>
22725 <indexterm role="concept">
22726 <primary>Exim user</primary>
22727 </indexterm>
22728 This option changes the uid under which Exim runs when it gives up root
22729 privilege. The default value is compiled into the binary. Ownership of the run
22730 time configuration file and the use of the <option>-C</option> and <option>-D</option> command line
22731 options is checked against the values in the binary, not what is set here.
22732 </para>
22733 <para>
22734 Unless it consists entirely of digits, the string is looked up using
22735 <function>getpwnam()</function>, and failure causes a configuration error. If <option>exim_group</option> is
22736 not also supplied, the gid is taken from the result of <function>getpwnam()</function> if it is
22737 used. See chapter <xref linkend="CHAPsecurity"/> for a discussion of security issues.
22738 </para>
22739 <para>
22740 <indexterm role="option">
22741 <primary><option>extra_local_interfaces</option></primary>
22742 </indexterm>
22743 </para>
22744 <informaltable frame="all">
22745 <tgroup cols="4" colsep="0" rowsep="0">
22746 <colspec colwidth="8*" align="left"/>
22747 <colspec colwidth="6*" align="center"/>
22748 <colspec colwidth="6*" align="center"/>
22749 <colspec colwidth="6*" align="right"/>
22750 <tbody>
22751 <row>
22752 <entry><option>extra_local_interfaces</option></entry>
22753 <entry>Use: <emphasis>main</emphasis></entry>
22754 <entry>Type: <emphasis>string list</emphasis></entry>
22755 <entry>Default: <emphasis>unset</emphasis></entry>
22756 </row>
22757 </tbody>
22758 </tgroup>
22759 </informaltable>
22760 <para>
22761 This option defines network interfaces that are to be considered local when
22762 routing, but which are not used for listening by the daemon. See section
22763 <xref linkend="SECTreclocipadd"/> for details.
22764 </para>
22765 <para>
22766 <indexterm role="option">
22767 <primary><option>extract_addresses_remove_arguments</option></primary>
22768 </indexterm>
22769 </para>
22770 <informaltable frame="all">
22771 <tgroup cols="4" colsep="0" rowsep="0">
22772 <colspec colwidth="8*" align="left"/>
22773 <colspec colwidth="6*" align="center"/>
22774 <colspec colwidth="6*" align="center"/>
22775 <colspec colwidth="6*" align="right"/>
22776 <tbody>
22777 <row>
22778 <entry><option>extract_addresses_remove_ &nbsp;&nbsp;arguments</option></entry>
22779 <entry>Use: <emphasis>main</emphasis></entry>
22780 <entry>Type: <emphasis>boolean</emphasis></entry>
22781 <entry>Default: <emphasis>true</emphasis></entry>
22782 </row>
22783 </tbody>
22784 </tgroup>
22785 </informaltable>
22786 <para>
22787 <indexterm role="option">
22788 <primary><option>-t</option></primary>
22789 </indexterm>
22790 <indexterm role="concept">
22791 <primary>command line</primary>
22792 <secondary>addresses with <option>-t</option></secondary>
22793 </indexterm>
22794 <indexterm role="concept">
22795 <primary>Sendmail compatibility</primary>
22796 <secondary><option>-t</option> option</secondary>
22797 </indexterm>
22798 According to some Sendmail documentation (Sun, IRIX, HP-UX), if any addresses
22799 are present on the command line when the <option>-t</option> option is used to build an
22800 envelope from a message&#x2019;s <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis> and <emphasis>Bcc:</emphasis> headers, the command
22801 line addresses are removed from the recipients list. This is also how Smail
22802 behaves. However, other Sendmail documentation (the O&#x2019;Reilly book) states that
22803 command line addresses are added to those obtained from the header lines. When
22804 <option>extract_addresses_remove_arguments</option> is true (the default), Exim subtracts
22805 argument headers. If it is set false, Exim adds rather than removes argument
22806 addresses.
22807 </para>
22808 <para>
22809 <indexterm role="option">
22810 <primary><option>finduser_retries</option></primary>
22811 </indexterm>
22812 </para>
22813 <informaltable frame="all">
22814 <tgroup cols="4" colsep="0" rowsep="0">
22815 <colspec colwidth="8*" align="left"/>
22816 <colspec colwidth="6*" align="center"/>
22817 <colspec colwidth="6*" align="center"/>
22818 <colspec colwidth="6*" align="right"/>
22819 <tbody>
22820 <row>
22821 <entry><option>finduser_retries</option></entry>
22822 <entry>Use: <emphasis>main</emphasis></entry>
22823 <entry>Type: <emphasis>integer</emphasis></entry>
22824 <entry>Default: <emphasis>0</emphasis></entry>
22825 </row>
22826 </tbody>
22827 </tgroup>
22828 </informaltable>
22829 <para>
22830 <indexterm role="concept">
22831 <primary>NIS, retrying user lookups</primary>
22832 </indexterm>
22833 On systems running NIS or other schemes in which user and group information is
22834 distributed from a remote system, there can be times when <function>getpwnam()</function> and
22835 related functions fail, even when given valid data, because things time out.
22836 Unfortunately these failures cannot be distinguished from genuine <quote>not found</quote>
22837 errors. If <option>finduser_retries</option> is set greater than zero, Exim will try that
22838 many extra times to find a user or a group, waiting for one second between
22839 retries.
22840 </para>
22841 <para>
22842 <indexterm role="concept">
22843 <primary><filename>/etc/passwd</filename></primary>
22844 <secondary>multiple reading of</secondary>
22845 </indexterm>
22846 You should not set this option greater than zero if your user information is in
22847 a traditional <filename>/etc/passwd</filename> file, because it will cause Exim needlessly to
22848 search the file multiple times for non-existent users, and also cause delay.
22849 </para>
22850 <para>
22851 <indexterm role="option">
22852 <primary><option>freeze_tell</option></primary>
22853 </indexterm>
22854 </para>
22855 <informaltable frame="all">
22856 <tgroup cols="4" colsep="0" rowsep="0">
22857 <colspec colwidth="8*" align="left"/>
22858 <colspec colwidth="6*" align="center"/>
22859 <colspec colwidth="6*" align="center"/>
22860 <colspec colwidth="6*" align="right"/>
22861 <tbody>
22862 <row>
22863 <entry><option>freeze_tell</option></entry>
22864 <entry>Use: <emphasis>main</emphasis></entry>
22865 <entry>Type: <emphasis>string list, comma separated</emphasis></entry>
22866 <entry>Default: <emphasis>unset</emphasis></entry>
22867 </row>
22868 </tbody>
22869 </tgroup>
22870 </informaltable>
22871 <para>
22872 <indexterm role="concept">
22873 <primary>freezing messages</primary>
22874 <secondary>sending a message when freezing</secondary>
22875 </indexterm>
22876 On encountering certain errors, or when configured to do so in a system filter,
22877 ACL, or special router, Exim freezes a message. This means that no further
22878 delivery attempts take place until an administrator thaws the message, or the
22879 <option>auto_thaw</option>, <option>ignore_bounce_errors_after</option>, or <option>timeout_frozen_after</option>
22880 feature cause it to be processed. If <option>freeze_tell</option> is set, Exim generates a
22881 warning message whenever it freezes something, unless the message it is
22882 freezing is a locally-generated bounce message. (Without this exception there
22883 is the possibility of looping.) The warning message is sent to the addresses
22884 supplied as the comma-separated value of this option. If several of the
22885 message&#x2019;s addresses cause freezing, only a single message is sent. If the
22886 freezing was automatic, the reason(s) for freezing can be found in the message
22887 log. If you configure freezing in a filter or ACL, you must arrange for any
22888 logging that you require.
22889 </para>
22890 <para>
22891 <indexterm role="option">
22892 <primary><option>gecos_name</option></primary>
22893 </indexterm>
22894 </para>
22895 <informaltable frame="all">
22896 <tgroup cols="4" colsep="0" rowsep="0">
22897 <colspec colwidth="8*" align="left"/>
22898 <colspec colwidth="6*" align="center"/>
22899 <colspec colwidth="6*" align="center"/>
22900 <colspec colwidth="6*" align="right"/>
22901 <tbody>
22902 <row>
22903 <entry><option>gecos_name</option></entry>
22904 <entry>Use: <emphasis>main</emphasis></entry>
22905 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22906 <entry>Default: <emphasis>unset</emphasis></entry>
22907 </row>
22908 </tbody>
22909 </tgroup>
22910 </informaltable>
22911 <para>
22912 <indexterm role="concept">
22913 <primary>HP-UX</primary>
22914 </indexterm>
22915 <indexterm role="concept">
22916 <primary><quote>gecos</quote> field, parsing</primary>
22917 </indexterm>
22918 Some operating systems, notably HP-UX, use the <quote>gecos</quote> field in the system
22919 password file to hold other information in addition to users&#x2019; real names. Exim
22920 looks up this field for use when it is creating <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis>
22921 headers. If either <option>gecos_pattern</option> or <option>gecos_name</option> are unset, the contents
22922 of the field are used unchanged, except that, if an ampersand is encountered,
22923 it is replaced by the user&#x2019;s login name with the first character forced to
22924 upper case, since this is a convention that is observed on many systems.
22925 </para>
22926 <para>
22927 When these options are set, <option>gecos_pattern</option> is treated as a regular
22928 expression that is to be applied to the field (again with &amp; replaced by the
22929 login name), and if it matches, <option>gecos_name</option> is expanded and used as the
22930 user&#x2019;s name.
22931 </para>
22932 <para>
22933 <indexterm role="concept">
22934 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
22935 <secondary>in <option>gecos_name</option></secondary>
22936 </indexterm>
22937 Numeric variables such as <varname>$1</varname>, <varname>$2</varname>, etc. can be used in the expansion to
22938 pick up sub-fields that were matched by the pattern. In HP-UX, where the user&#x2019;s
22939 name terminates at the first comma, the following can be used:
22940 </para>
22941 <literallayout class="monospaced">
22942 gecos_pattern = ([^,]*)
22943 gecos_name = $1
22944 </literallayout>
22945 <para>
22946 <indexterm role="option">
22947 <primary><option>gecos_pattern</option></primary>
22948 </indexterm>
22949 </para>
22950 <informaltable frame="all">
22951 <tgroup cols="4" colsep="0" rowsep="0">
22952 <colspec colwidth="8*" align="left"/>
22953 <colspec colwidth="6*" align="center"/>
22954 <colspec colwidth="6*" align="center"/>
22955 <colspec colwidth="6*" align="right"/>
22956 <tbody>
22957 <row>
22958 <entry><option>gecos_pattern</option></entry>
22959 <entry>Use: <emphasis>main</emphasis></entry>
22960 <entry>Type: <emphasis>string</emphasis></entry>
22961 <entry>Default: <emphasis>unset</emphasis></entry>
22962 </row>
22963 </tbody>
22964 </tgroup>
22965 </informaltable>
22966 <para>
22967 See <option>gecos_name</option> above.
22968 </para>
22969 <para>
22970 <indexterm role="option">
22971 <primary><option>gnutls_require_kx</option></primary>
22972 </indexterm>
22973 </para>
22974 <informaltable frame="all">
22975 <tgroup cols="4" colsep="0" rowsep="0">
22976 <colspec colwidth="8*" align="left"/>
22977 <colspec colwidth="6*" align="center"/>
22978 <colspec colwidth="6*" align="center"/>
22979 <colspec colwidth="6*" align="right"/>
22980 <tbody>
22981 <row>
22982 <entry><option>gnutls_require_kx</option></entry>
22983 <entry>Use: <emphasis>main</emphasis></entry>
22984 <entry>Type: <emphasis>string</emphasis></entry>
22985 <entry>Default: <emphasis>unset</emphasis></entry>
22986 </row>
22987 </tbody>
22988 </tgroup>
22989 </informaltable>
22990 <para>
22991 This option controls the key exchange mechanisms when GnuTLS is used in an Exim
22992 server. For details, see section <xref linkend="SECTreqciphgnu"/>.
22993 </para>
22994 <para>
22995 <indexterm role="option">
22996 <primary><option>gnutls_require_mac</option></primary>
22997 </indexterm>
22998 </para>
22999 <informaltable frame="all">
23000 <tgroup cols="4" colsep="0" rowsep="0">
23001 <colspec colwidth="8*" align="left"/>
23002 <colspec colwidth="6*" align="center"/>
23003 <colspec colwidth="6*" align="center"/>
23004 <colspec colwidth="6*" align="right"/>
23005 <tbody>
23006 <row>
23007 <entry><option>gnutls_require_mac</option></entry>
23008 <entry>Use: <emphasis>main</emphasis></entry>
23009 <entry>Type: <emphasis>string</emphasis></entry>
23010 <entry>Default: <emphasis>unset</emphasis></entry>
23011 </row>
23012 </tbody>
23013 </tgroup>
23014 </informaltable>
23015 <para>
23016 This option controls the MAC algorithms when GnuTLS is used in an Exim
23017 server. For details, see section <xref linkend="SECTreqciphgnu"/>.
23018 </para>
23019 <para>
23020 <indexterm role="option">
23021 <primary><option>gnutls_require_protocols</option></primary>
23022 </indexterm>
23023 </para>
23024 <informaltable frame="all">
23025 <tgroup cols="4" colsep="0" rowsep="0">
23026 <colspec colwidth="8*" align="left"/>
23027 <colspec colwidth="6*" align="center"/>
23028 <colspec colwidth="6*" align="center"/>
23029 <colspec colwidth="6*" align="right"/>
23030 <tbody>
23031 <row>
23032 <entry><option>gnutls_require_protocols</option></entry>
23033 <entry>Use: <emphasis>main</emphasis></entry>
23034 <entry>Type: <emphasis>string</emphasis></entry>
23035 <entry>Default: <emphasis>unset</emphasis></entry>
23036 </row>
23037 </tbody>
23038 </tgroup>
23039 </informaltable>
23040 <para>
23041 This option controls the protocols when GnuTLS is used in an Exim
23042 server. For details, see section <xref linkend="SECTreqciphgnu"/>.
23043 </para>
23044 <para>
23045 <indexterm role="option">
23046 <primary><option>gnutls_compat_mode</option></primary>
23047 </indexterm>
23048 </para>
23049 <informaltable frame="all">
23050 <tgroup cols="4" colsep="0" rowsep="0">
23051 <colspec colwidth="8*" align="left"/>
23052 <colspec colwidth="6*" align="center"/>
23053 <colspec colwidth="6*" align="center"/>
23054 <colspec colwidth="6*" align="right"/>
23055 <tbody>
23056 <row>
23057 <entry><option>gnutls_compat_mode</option></entry>
23058 <entry>Use: <emphasis>main</emphasis></entry>
23059 <entry>Type: <emphasis>boolean</emphasis></entry>
23060 <entry>Default: <emphasis>unset</emphasis></entry>
23061 </row>
23062 </tbody>
23063 </tgroup>
23064 </informaltable>
23065 <para>
23066 This option controls whether GnuTLS is used in compatibility mode in an Exim
23067 server. This reduces security slightly, but improves interworking with older
23068 implementations of TLS.
23069 </para>
23070 <para>
23071 <indexterm role="option">
23072 <primary><option>headers_charset</option></primary>
23073 </indexterm>
23074 </para>
23075 <informaltable frame="all">
23076 <tgroup cols="4" colsep="0" rowsep="0">
23077 <colspec colwidth="8*" align="left"/>
23078 <colspec colwidth="6*" align="center"/>
23079 <colspec colwidth="6*" align="center"/>
23080 <colspec colwidth="6*" align="right"/>
23081 <tbody>
23082 <row>
23083 <entry><option>headers_charset</option></entry>
23084 <entry>Use: <emphasis>main</emphasis></entry>
23085 <entry>Type: <emphasis>string</emphasis></entry>
23086 <entry>Default: <emphasis>see below</emphasis></entry>
23087 </row>
23088 </tbody>
23089 </tgroup>
23090 </informaltable>
23091 <para>
23092 This option sets a default character set for translating from encoded MIME
23093 <quote>words</quote> in header lines, when referenced by an <varname>$h_xxx</varname> expansion item. The
23094 default is the value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The
23095 ultimate default is ISO-8859-1. For more details see the description of header
23096 insertions in section <xref linkend="SECTexpansionitems"/>.
23097 </para>
23098 <para>
23099 <indexterm role="option">
23100 <primary><option>header_maxsize</option></primary>
23101 </indexterm>
23102 </para>
23103 <informaltable frame="all">
23104 <tgroup cols="4" colsep="0" rowsep="0">
23105 <colspec colwidth="8*" align="left"/>
23106 <colspec colwidth="6*" align="center"/>
23107 <colspec colwidth="6*" align="center"/>
23108 <colspec colwidth="6*" align="right"/>
23109 <tbody>
23110 <row>
23111 <entry><option>header_maxsize</option></entry>
23112 <entry>Use: <emphasis>main</emphasis></entry>
23113 <entry>Type: <emphasis>integer</emphasis></entry>
23114 <entry>Default: <emphasis>see below</emphasis></entry>
23115 </row>
23116 </tbody>
23117 </tgroup>
23118 </informaltable>
23119 <para>
23120 <indexterm role="concept">
23121 <primary>header section</primary>
23122 <secondary>maximum size of</secondary>
23123 </indexterm>
23124 <indexterm role="concept">
23125 <primary>limit</primary>
23126 <secondary>size of message header section</secondary>
23127 </indexterm>
23128 This option controls the overall maximum size of a message&#x2019;s header
23129 section. The default is the value of HEADER_MAXSIZE in
23130 <filename>Local/Makefile</filename>; the default for that is 1M. Messages with larger header
23131 sections are rejected.
23132 </para>
23133 <para>
23134 <indexterm role="option">
23135 <primary><option>header_line_maxsize</option></primary>
23136 </indexterm>
23137 </para>
23138 <informaltable frame="all">
23139 <tgroup cols="4" colsep="0" rowsep="0">
23140 <colspec colwidth="8*" align="left"/>
23141 <colspec colwidth="6*" align="center"/>
23142 <colspec colwidth="6*" align="center"/>
23143 <colspec colwidth="6*" align="right"/>
23144 <tbody>
23145 <row>
23146 <entry><option>header_line_maxsize</option></entry>
23147 <entry>Use: <emphasis>main</emphasis></entry>
23148 <entry>Type: <emphasis>integer</emphasis></entry>
23149 <entry>Default: <emphasis>0</emphasis></entry>
23150 </row>
23151 </tbody>
23152 </tgroup>
23153 </informaltable>
23154 <para>
23155 <indexterm role="concept">
23156 <primary>header lines</primary>
23157 <secondary>maximum size of</secondary>
23158 </indexterm>
23159 <indexterm role="concept">
23160 <primary>limit</primary>
23161 <secondary>size of one header line</secondary>
23162 </indexterm>
23163 This option limits the length of any individual header line in a message, after
23164 all the continuations have been joined together. Messages with individual
23165 header lines that are longer than the limit are rejected. The default value of
23166 zero means <quote>no limit</quote>.
23167 </para>
23168 <para>
23169 <indexterm role="option">
23170 <primary><option>helo_accept_junk_hosts</option></primary>
23171 </indexterm>
23172 </para>
23173 <informaltable frame="all">
23174 <tgroup cols="4" colsep="0" rowsep="0">
23175 <colspec colwidth="8*" align="left"/>
23176 <colspec colwidth="6*" align="center"/>
23177 <colspec colwidth="6*" align="center"/>
23178 <colspec colwidth="6*" align="right"/>
23179 <tbody>
23180 <row>
23181 <entry><option>helo_accept_junk_hosts</option></entry>
23182 <entry>Use: <emphasis>main</emphasis></entry>
23183 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
23184 <entry>Default: <emphasis>unset</emphasis></entry>
23185 </row>
23186 </tbody>
23187 </tgroup>
23188 </informaltable>
23189 <para>
23190 <indexterm role="concept">
23191 <primary>HELO</primary>
23192 <secondary>accepting junk data</secondary>
23193 </indexterm>
23194 <indexterm role="concept">
23195 <primary>EHLO</primary>
23196 <secondary>accepting junk data</secondary>
23197 </indexterm>
23198 Exim checks the syntax of HELO and EHLO commands for incoming SMTP
23199 mail, and gives an error response for invalid data. Unfortunately, there are
23200 some SMTP clients that send syntactic junk. They can be accommodated by setting
23201 this option. Note that this is a syntax check only. See <option>helo_verify_hosts</option>
23202 if you want to do semantic checking.
23203 See also <option>helo_allow_chars</option> for a way of extending the permitted character
23204 set.
23205 </para>
23206 <para>
23207 <indexterm role="option">
23208 <primary><option>helo_allow_chars</option></primary>
23209 </indexterm>
23210 </para>
23211 <informaltable frame="all">
23212 <tgroup cols="4" colsep="0" rowsep="0">
23213 <colspec colwidth="8*" align="left"/>
23214 <colspec colwidth="6*" align="center"/>
23215 <colspec colwidth="6*" align="center"/>
23216 <colspec colwidth="6*" align="right"/>
23217 <tbody>
23218 <row>
23219 <entry><option>helo_allow_chars</option></entry>
23220 <entry>Use: <emphasis>main</emphasis></entry>
23221 <entry>Type: <emphasis>string</emphasis></entry>
23222 <entry>Default: <emphasis>unset</emphasis></entry>
23223 </row>
23224 </tbody>
23225 </tgroup>
23226 </informaltable>
23227 <para>
23228 <indexterm role="concept">
23229 <primary>HELO</primary>
23230 <secondary>underscores in</secondary>
23231 </indexterm>
23232 <indexterm role="concept">
23233 <primary>EHLO</primary>
23234 <secondary>underscores in</secondary>
23235 </indexterm>
23236 <indexterm role="concept">
23237 <primary>underscore in EHLO/HELO</primary>
23238 </indexterm>
23239 This option can be set to a string of rogue characters that are permitted in
23240 all EHLO and HELO names in addition to the standard letters, digits,
23241 hyphens, and dots. If you really must allow underscores, you can set
23242 </para>
23243 <literallayout class="monospaced">
23244 helo_allow_chars = _
23245 </literallayout>
23246 <para>
23247 Note that the value is one string, not a list.
23248 </para>
23249 <para>
23250 <indexterm role="option">
23251 <primary><option>helo_lookup_domains</option></primary>
23252 </indexterm>
23253 </para>
23254 <informaltable frame="all">
23255 <tgroup cols="4" colsep="0" rowsep="0">
23256 <colspec colwidth="8*" align="left"/>
23257 <colspec colwidth="6*" align="center"/>
23258 <colspec colwidth="6*" align="center"/>
23259 <colspec colwidth="6*" align="right"/>
23260 <tbody>
23261 <row>
23262 <entry><option>helo_lookup_domains</option></entry>
23263 <entry>Use: <emphasis>main</emphasis></entry>
23264 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
23265 <entry>Default: <emphasis><literal>@:@[]</literal></emphasis></entry>
23266 </row>
23267 </tbody>
23268 </tgroup>
23269 </informaltable>
23270 <para>
23271 <indexterm role="concept">
23272 <primary>HELO</primary>
23273 <secondary>forcing reverse lookup</secondary>
23274 </indexterm>
23275 <indexterm role="concept">
23276 <primary>EHLO</primary>
23277 <secondary>forcing reverse lookup</secondary>
23278 </indexterm>
23279 If the domain given by a client in a HELO or EHLO command matches this
23280 list, a reverse lookup is done in order to establish the host&#x2019;s true name. The
23281 default forces a lookup if the client host gives the server&#x2019;s name or any of
23282 its IP addresses (in brackets), something that broken clients have been seen to
23283 do.
23284 </para>
23285 <para>
23286 <indexterm role="option">
23287 <primary><option>helo_try_verify_hosts</option></primary>
23288 </indexterm>
23289 </para>
23290 <informaltable frame="all">
23291 <tgroup cols="4" colsep="0" rowsep="0">
23292 <colspec colwidth="8*" align="left"/>
23293 <colspec colwidth="6*" align="center"/>
23294 <colspec colwidth="6*" align="center"/>
23295 <colspec colwidth="6*" align="right"/>
23296 <tbody>
23297 <row>
23298 <entry><option>helo_try_verify_hosts</option></entry>
23299 <entry>Use: <emphasis>main</emphasis></entry>
23300 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
23301 <entry>Default: <emphasis>unset</emphasis></entry>
23302 </row>
23303 </tbody>
23304 </tgroup>
23305 </informaltable>
23306 <para>
23307 <indexterm role="concept">
23308 <primary>HELO verifying</primary>
23309 <secondary>optional</secondary>
23310 </indexterm>
23311 <indexterm role="concept">
23312 <primary>EHLO</primary>
23313 <secondary>verifying, optional</secondary>
23314 </indexterm>
23315 By default, Exim just checks the syntax of HELO and EHLO commands (see
23316 <option>helo_accept_junk_hosts</option> and <option>helo_allow_chars</option>). However, some sites like
23317 to do more extensive checking of the data supplied by these commands. The ACL
23318 condition <literal>verify = helo</literal> is provided to make this possible.
23319 Formerly, it was necessary also to set this option (<option>helo_try_verify_hosts</option>)
23320 to force the check to occur. From release 4.53 onwards, this is no longer
23321 necessary. If the check has not been done before <literal>verify = helo</literal> is
23322 encountered, it is done at that time. Consequently, this option is obsolete.
23323 Its specification is retained here for backwards compatibility.
23324 </para>
23325 <para>
23326 When an EHLO or HELO command is received, if the calling host matches
23327 <option>helo_try_verify_hosts</option>, Exim checks that the host name given in the HELO or
23328 EHLO command either:
23329 </para>
23330 <itemizedlist>
23331 <listitem>
23332 <para>
23333 is an IP literal matching the calling address of the host, or
23334 </para>
23335 </listitem>
23336 <listitem>
23337 <para>
23338 <indexterm role="concept">
23339 <primary>DNS</primary>
23340 <secondary>reverse lookup</secondary>
23341 </indexterm>
23342 <indexterm role="concept">
23343 <primary>reverse DNS lookup</primary>
23344 </indexterm>
23345 matches the host name that Exim obtains by doing a reverse lookup of the
23346 calling host address, or
23347 </para>
23348 </listitem>
23349 <listitem>
23350 <para>
23351 when looked up using <function>gethostbyname()</function> (or <function>getipnodebyname()</function> when
23352 available) yields the calling host address.
23353 </para>
23354 </listitem>
23355 </itemizedlist>
23356 <para>
23357 However, the EHLO or HELO command is not rejected if any of the checks
23358 fail. Processing continues, but the result of the check is remembered, and can
23359 be detected later in an ACL by the <literal>verify = helo</literal> condition.
23360 </para>
23361 <para>
23362 <indexterm role="option">
23363 <primary><option>helo_verify_hosts</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>helo_verify_hosts</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>HELO verifying</primary>
23385 <secondary>mandatory</secondary>
23386 </indexterm>
23387 <indexterm role="concept">
23388 <primary>EHLO</primary>
23389 <secondary>verifying, mandatory</secondary>
23390 </indexterm>
23391 Like <option>helo_try_verify_hosts</option>, this option is obsolete, and retained only for
23392 backwards compatibility. For hosts that match this option, Exim checks the host
23393 name given in the HELO or EHLO in the same way as for
23394 <option>helo_try_verify_hosts</option>. If the check fails, the HELO or EHLO command is
23395 rejected with a 550 error, and entries are written to the main and reject logs.
23396 If a MAIL command is received before EHLO or HELO, it is rejected with a 503
23397 error.
23398 </para>
23399 <para>
23400 <indexterm role="option">
23401 <primary><option>hold_domains</option></primary>
23402 </indexterm>
23403 </para>
23404 <informaltable frame="all">
23405 <tgroup cols="4" colsep="0" rowsep="0">
23406 <colspec colwidth="8*" align="left"/>
23407 <colspec colwidth="6*" align="center"/>
23408 <colspec colwidth="6*" align="center"/>
23409 <colspec colwidth="6*" align="right"/>
23410 <tbody>
23411 <row>
23412 <entry><option>hold_domains</option></entry>
23413 <entry>Use: <emphasis>main</emphasis></entry>
23414 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
23415 <entry>Default: <emphasis>unset</emphasis></entry>
23416 </row>
23417 </tbody>
23418 </tgroup>
23419 </informaltable>
23420 <para>
23421 <indexterm role="concept">
23422 <primary>domain</primary>
23423 <secondary>delaying delivery</secondary>
23424 </indexterm>
23425 <indexterm role="concept">
23426 <primary>delivery</primary>
23427 <secondary>delaying certain domains</secondary>
23428 </indexterm>
23429 This option allows mail for particular domains to be held on the queue
23430 manually. The option is overridden if a message delivery is forced with the
23431 <option>-M</option>, <option>-qf</option>, <option>-Rf</option> or <option>-Sf</option> options, and also while testing or
23432 verifying addresses using <option>-bt</option> or <option>-bv</option>. Otherwise, if a domain matches an
23433 item in <option>hold_domains</option>, no routing or delivery for that address is done, and
23434 it is deferred every time the message is looked at.
23435 </para>
23436 <para>
23437 This option is intended as a temporary operational measure for delaying the
23438 delivery of mail while some problem is being sorted out, or some new
23439 configuration tested. If you just want to delay the processing of some
23440 domains until a queue run occurs, you should use <option>queue_domains</option> or
23441 <option>queue_smtp_domains</option>, not <option>hold_domains</option>.
23442 </para>
23443 <para>
23444 A setting of <option>hold_domains</option> does not override Exim&#x2019;s code for removing
23445 messages from the queue if they have been there longer than the longest retry
23446 time in any retry rule. If you want to hold messages for longer than the normal
23447 retry times, insert a dummy retry rule with a long retry time.
23448 </para>
23449 <para>
23450 <indexterm role="option">
23451 <primary><option>host_lookup</option></primary>
23452 </indexterm>
23453 </para>
23454 <informaltable frame="all">
23455 <tgroup cols="4" colsep="0" rowsep="0">
23456 <colspec colwidth="8*" align="left"/>
23457 <colspec colwidth="6*" align="center"/>
23458 <colspec colwidth="6*" align="center"/>
23459 <colspec colwidth="6*" align="right"/>
23460 <tbody>
23461 <row>
23462 <entry><option>host_lookup</option></entry>
23463 <entry>Use: <emphasis>main</emphasis></entry>
23464 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
23465 <entry>Default: <emphasis>unset</emphasis></entry>
23466 </row>
23467 </tbody>
23468 </tgroup>
23469 </informaltable>
23470 <para>
23471 <indexterm role="concept">
23472 <primary>host name</primary>
23473 <secondary>lookup, forcing</secondary>
23474 </indexterm>
23475 Exim does not look up the name of a calling host from its IP address unless it
23476 is required to compare against some host list, or the host matches
23477 <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>, or the host matches this
23478 option (which normally contains IP addresses rather than host names). The
23479 default configuration file contains
23480 </para>
23481 <literallayout class="monospaced">
23482 host_lookup = *
23483 </literallayout>
23484 <para>
23485 which causes a lookup to happen for all hosts. If the expense of these lookups
23486 is felt to be too great, the setting can be changed or removed.
23487 </para>
23488 <para>
23489 After a successful reverse lookup, Exim does a forward lookup on the name it
23490 has obtained, to verify that it yields the IP address that it started with. If
23491 this check fails, Exim behaves as if the name lookup failed.
23492 </para>
23493 <para>
23494 <indexterm role="variable">
23495 <primary><varname>$host_lookup_failed</varname></primary>
23496 </indexterm>
23497 <indexterm role="variable">
23498 <primary><varname>$sender_host_name</varname></primary>
23499 </indexterm>
23500 After any kind of failure, the host name (in <varname>$sender_host_name</varname>) remains
23501 unset, and <varname>$host_lookup_failed</varname> is set to the string <quote>1</quote>. See also
23502 <option>dns_again_means_nonexist</option>, <option>helo_lookup_domains</option>, and
23503 <literal>verify = reverse_host_lookup</literal> in ACLs.
23504 </para>
23505 <para>
23506 <indexterm role="option">
23507 <primary><option>host_lookup_order</option></primary>
23508 </indexterm>
23509 </para>
23510 <informaltable frame="all">
23511 <tgroup cols="4" colsep="0" rowsep="0">
23512 <colspec colwidth="8*" align="left"/>
23513 <colspec colwidth="6*" align="center"/>
23514 <colspec colwidth="6*" align="center"/>
23515 <colspec colwidth="6*" align="right"/>
23516 <tbody>
23517 <row>
23518 <entry><option>host_lookup_order</option></entry>
23519 <entry>Use: <emphasis>main</emphasis></entry>
23520 <entry>Type: <emphasis>string list</emphasis></entry>
23521 <entry>Default: <emphasis><literal>bydns:byaddr</literal></emphasis></entry>
23522 </row>
23523 </tbody>
23524 </tgroup>
23525 </informaltable>
23526 <para>
23527 This option specifies the order of different lookup methods when Exim is trying
23528 to find a host name from an IP address. The default is to do a DNS lookup
23529 first, and then to try a local lookup (using <function>gethostbyaddr()</function> or equivalent)
23530 if that fails. You can change the order of these lookups, or omit one entirely,
23531 if you want.
23532 </para>
23533 <para>
23534 <emphasis role="bold">Warning</emphasis>: The <quote>byaddr</quote> method does not always yield aliases when there are
23535 multiple PTR records in the DNS and the IP address is not listed in
23536 <filename>/etc/hosts</filename>. Different operating systems give different results in this
23537 case. That is why the default tries a DNS lookup first.
23538 </para>
23539 <para>
23540 <indexterm role="option">
23541 <primary><option>host_reject_connection</option></primary>
23542 </indexterm>
23543 </para>
23544 <informaltable frame="all">
23545 <tgroup cols="4" colsep="0" rowsep="0">
23546 <colspec colwidth="8*" align="left"/>
23547 <colspec colwidth="6*" align="center"/>
23548 <colspec colwidth="6*" align="center"/>
23549 <colspec colwidth="6*" align="right"/>
23550 <tbody>
23551 <row>
23552 <entry><option>host_reject_connection</option></entry>
23553 <entry>Use: <emphasis>main</emphasis></entry>
23554 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
23555 <entry>Default: <emphasis>unset</emphasis></entry>
23556 </row>
23557 </tbody>
23558 </tgroup>
23559 </informaltable>
23560 <para>
23561 <indexterm role="concept">
23562 <primary>host</primary>
23563 <secondary>rejecting connections from</secondary>
23564 </indexterm>
23565 If this option is set, incoming SMTP calls from the hosts listed are rejected
23566 as soon as the connection is made.
23567 This option is obsolete, and retained only for backward compatibility, because
23568 nowadays the ACL specified by <option>acl_smtp_connect</option> can also reject incoming
23569 connections immediately.
23570 </para>
23571 <para>
23572 The ability to give an immediate rejection (either by this option or using an
23573 ACL) is provided for use in unusual cases. Many hosts will just try again,
23574 sometimes without much delay. Normally, it is better to use an ACL to reject
23575 incoming messages at a later stage, such as after RCPT commands. See
23576 chapter <xref linkend="CHAPACL"/>.
23577 </para>
23578 <para>
23579 <indexterm role="option">
23580 <primary><option>hosts_connection_nolog</option></primary>
23581 </indexterm>
23582 </para>
23583 <informaltable frame="all">
23584 <tgroup cols="4" colsep="0" rowsep="0">
23585 <colspec colwidth="8*" align="left"/>
23586 <colspec colwidth="6*" align="center"/>
23587 <colspec colwidth="6*" align="center"/>
23588 <colspec colwidth="6*" align="right"/>
23589 <tbody>
23590 <row>
23591 <entry><option>hosts_connection_nolog</option></entry>
23592 <entry>Use: <emphasis>main</emphasis></entry>
23593 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
23594 <entry>Default: <emphasis>unset</emphasis></entry>
23595 </row>
23596 </tbody>
23597 </tgroup>
23598 </informaltable>
23599 <para>
23600 <indexterm role="concept">
23601 <primary>host</primary>
23602 <secondary>not logging connections from</secondary>
23603 </indexterm>
23604 This option defines a list of hosts for which connection logging does not
23605 happen, even though the <option>smtp_connection</option> log selector is set. For example,
23606 you might want not to log SMTP connections from local processes, or from
23607 127.0.0.1, or from your local LAN. This option is consulted in the main loop of
23608 the daemon; you should therefore strive to restrict its value to a short inline
23609 list of IP addresses and networks. To disable logging SMTP connections from
23610 local processes, you must create a host list with an empty item. For example:
23611 </para>
23612 <literallayout class="monospaced">
23613 hosts_connection_nolog = :
23614 </literallayout>
23615 <para>
23616 If the <option>smtp_connection</option> log selector is not set, this option has no effect.
23617 </para>
23618 <para>
23619 <indexterm role="option">
23620 <primary><option>hosts_treat_as_local</option></primary>
23621 </indexterm>
23622 </para>
23623 <informaltable frame="all">
23624 <tgroup cols="4" colsep="0" rowsep="0">
23625 <colspec colwidth="8*" align="left"/>
23626 <colspec colwidth="6*" align="center"/>
23627 <colspec colwidth="6*" align="center"/>
23628 <colspec colwidth="6*" align="right"/>
23629 <tbody>
23630 <row>
23631 <entry><option>hosts_treat_as_local</option></entry>
23632 <entry>Use: <emphasis>main</emphasis></entry>
23633 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
23634 <entry>Default: <emphasis>unset</emphasis></entry>
23635 </row>
23636 </tbody>
23637 </tgroup>
23638 </informaltable>
23639 <para>
23640 <indexterm role="concept">
23641 <primary>local host</primary>
23642 <secondary>domains treated as</secondary>
23643 </indexterm>
23644 <indexterm role="concept">
23645 <primary>host</primary>
23646 <secondary>treated as local</secondary>
23647 </indexterm>
23648 If this option is set, any host names that match the domain list are treated as
23649 if they were the local host when Exim is scanning host lists obtained from MX
23650 records
23651 or other sources. Note that the value of this option is a domain list, not a
23652 host list, because it is always used to check host names, not IP addresses.
23653 </para>
23654 <para>
23655 This option also applies when Exim is matching the special items
23656 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal> in a domain list (see
23657 section <xref linkend="SECTdomainlist"/>), and when checking the <option>hosts</option> option in the
23658 <command>smtp</command> transport for the local host (see the <option>allow_localhost</option> option in
23659 that transport). See also <option>local_interfaces</option>, <option>extra_local_interfaces</option>, and
23660 chapter <xref linkend="CHAPinterfaces"/>, which contains a discussion about local network
23661 interfaces and recognizing the local host.
23662 </para>
23663 <para>
23664 <indexterm role="option">
23665 <primary><option>ibase_servers</option></primary>
23666 </indexterm>
23667 </para>
23668 <informaltable frame="all">
23669 <tgroup cols="4" colsep="0" rowsep="0">
23670 <colspec colwidth="8*" align="left"/>
23671 <colspec colwidth="6*" align="center"/>
23672 <colspec colwidth="6*" align="center"/>
23673 <colspec colwidth="6*" align="right"/>
23674 <tbody>
23675 <row>
23676 <entry><option>ibase_servers</option></entry>
23677 <entry>Use: <emphasis>main</emphasis></entry>
23678 <entry>Type: <emphasis>string list</emphasis></entry>
23679 <entry>Default: <emphasis>unset</emphasis></entry>
23680 </row>
23681 </tbody>
23682 </tgroup>
23683 </informaltable>
23684 <para>
23685 <indexterm role="concept">
23686 <primary>InterBase</primary>
23687 <secondary>server list</secondary>
23688 </indexterm>
23689 This option provides a list of InterBase servers and associated connection data,
23690 to be used in conjunction with <command>ibase</command> lookups (see section <xref linkend="SECID72"/>).
23691 The option is available only if Exim has been built with InterBase support.
23692 </para>
23693 <para>
23694 <indexterm role="option">
23695 <primary><option>ignore_bounce_errors_after</option></primary>
23696 </indexterm>
23697 </para>
23698 <informaltable frame="all">
23699 <tgroup cols="4" colsep="0" rowsep="0">
23700 <colspec colwidth="8*" align="left"/>
23701 <colspec colwidth="6*" align="center"/>
23702 <colspec colwidth="6*" align="center"/>
23703 <colspec colwidth="6*" align="right"/>
23704 <tbody>
23705 <row>
23706 <entry><option>ignore_bounce_errors_after</option></entry>
23707 <entry>Use: <emphasis>main</emphasis></entry>
23708 <entry>Type: <emphasis>time</emphasis></entry>
23709 <entry>Default: <emphasis>10w</emphasis></entry>
23710 </row>
23711 </tbody>
23712 </tgroup>
23713 </informaltable>
23714 <para>
23715 <indexterm role="concept">
23716 <primary>bounce message</primary>
23717 <secondary>discarding</secondary>
23718 </indexterm>
23719 <indexterm role="concept">
23720 <primary>discarding bounce message</primary>
23721 </indexterm>
23722 This option affects the processing of bounce messages that cannot be delivered,
23723 that is, those that suffer a permanent delivery failure. (Bounce messages that
23724 suffer temporary delivery failures are of course retried in the usual way.)
23725 </para>
23726 <para>
23727 After a permanent delivery failure, bounce messages are frozen,
23728 because there is no sender to whom they can be returned. When a frozen bounce
23729 message has been on the queue for more than the given time, it is unfrozen at
23730 the next queue run, and a further delivery is attempted. If delivery fails
23731 again, the bounce message is discarded. This makes it possible to keep failed
23732 bounce messages around for a shorter time than the normal maximum retry time
23733 for frozen messages. For example,
23734 </para>
23735 <literallayout class="monospaced">
23736 ignore_bounce_errors_after = 12h
23737 </literallayout>
23738 <para>
23739 retries failed bounce message deliveries after 12 hours, discarding any further
23740 failures. If the value of this option is set to a zero time period, bounce
23741 failures are discarded immediately. Setting a very long time (as in the default
23742 value) has the effect of disabling this option. For ways of automatically
23743 dealing with other kinds of frozen message, see <option>auto_thaw</option> and
23744 <option>timeout_frozen_after</option>.
23745 </para>
23746 <para>
23747 <indexterm role="option">
23748 <primary><option>ignore_fromline_hosts</option></primary>
23749 </indexterm>
23750 </para>
23751 <informaltable frame="all">
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>ignore_fromline_hosts</option></entry>
23760 <entry>Use: <emphasis>main</emphasis></entry>
23761 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
23762 <entry>Default: <emphasis>unset</emphasis></entry>
23763 </row>
23764 </tbody>
23765 </tgroup>
23766 </informaltable>
23767 <para>
23768 <indexterm role="concept">
23769 <primary><quote>From</quote> line</primary>
23770 </indexterm>
23771 <indexterm role="concept">
23772 <primary>UUCP</primary>
23773 <secondary><quote>From</quote> line</secondary>
23774 </indexterm>
23775 Some broken SMTP clients insist on sending a UUCP-like <quote>From&nbsp;</quote> line before
23776 the headers of a message. By default this is treated as the start of the
23777 message&#x2019;s body, which means that any following headers are not recognized as
23778 such. Exim can be made to ignore it by setting <option>ignore_fromline_hosts</option> to
23779 match those hosts that insist on sending it. If the sender is actually a local
23780 process rather than a remote host, and is using <option>-bs</option> to inject the messages,
23781 <option>ignore_fromline_local</option> must be set to achieve this effect.
23782 </para>
23783 <para>
23784 <indexterm role="option">
23785 <primary><option>ignore_fromline_local</option></primary>
23786 </indexterm>
23787 </para>
23788 <informaltable frame="all">
23789 <tgroup cols="4" colsep="0" rowsep="0">
23790 <colspec colwidth="8*" align="left"/>
23791 <colspec colwidth="6*" align="center"/>
23792 <colspec colwidth="6*" align="center"/>
23793 <colspec colwidth="6*" align="right"/>
23794 <tbody>
23795 <row>
23796 <entry><option>ignore_fromline_local</option></entry>
23797 <entry>Use: <emphasis>main</emphasis></entry>
23798 <entry>Type: <emphasis>boolean</emphasis></entry>
23799 <entry>Default: <emphasis>false</emphasis></entry>
23800 </row>
23801 </tbody>
23802 </tgroup>
23803 </informaltable>
23804 <para>
23805 See <option>ignore_fromline_hosts</option> above.
23806 </para>
23807 <para>
23808 <indexterm role="option">
23809 <primary><option>keep_malformed</option></primary>
23810 </indexterm>
23811 </para>
23812 <informaltable frame="all">
23813 <tgroup cols="4" colsep="0" rowsep="0">
23814 <colspec colwidth="8*" align="left"/>
23815 <colspec colwidth="6*" align="center"/>
23816 <colspec colwidth="6*" align="center"/>
23817 <colspec colwidth="6*" align="right"/>
23818 <tbody>
23819 <row>
23820 <entry><option>keep_malformed</option></entry>
23821 <entry>Use: <emphasis>main</emphasis></entry>
23822 <entry>Type: <emphasis>time</emphasis></entry>
23823 <entry>Default: <emphasis>4d</emphasis></entry>
23824 </row>
23825 </tbody>
23826 </tgroup>
23827 </informaltable>
23828 <para>
23829 This option specifies the length of time to keep messages whose spool files
23830 have been corrupted in some way. This should, of course, never happen. At the
23831 next attempt to deliver such a message, it gets removed. The incident is
23832 logged.
23833 </para>
23834 <para>
23835 <indexterm role="option">
23836 <primary><option>ldap_ca_cert_dir</option></primary>
23837 </indexterm>
23838 </para>
23839 <informaltable frame="all">
23840 <tgroup cols="4" colsep="0" rowsep="0">
23841 <colspec colwidth="8*" align="left"/>
23842 <colspec colwidth="6*" align="center"/>
23843 <colspec colwidth="6*" align="center"/>
23844 <colspec colwidth="6*" align="right"/>
23845 <tbody>
23846 <row>
23847 <entry><option>ldap_ca_cert_dir</option></entry>
23848 <entry>Use: <emphasis>main</emphasis></entry>
23849 <entry>Type: <emphasis>string</emphasis></entry>
23850 <entry>Default: <emphasis>unset</emphasis></entry>
23851 </row>
23852 </tbody>
23853 </tgroup>
23854 </informaltable>
23855 <para>
23856 <indexterm role="concept">
23857 <primary>LDAP</primary>
23858 <secondary>,</secondary>
23859 </indexterm>
23860 This option indicates which directory contains CA certificates for verifying
23861 a TLS certificate presented by an LDAP server.
23862 While Exim does not provide a default value, your SSL library may.
23863 Analogous to <option>tls_verify_certificates</option> but as a client-side option for LDAP
23864 and constrained to be a directory.
23865 </para>
23866 <para>
23867 <indexterm role="option">
23868 <primary><option>ldap_ca_cert_file</option></primary>
23869 </indexterm>
23870 </para>
23871 <informaltable frame="all">
23872 <tgroup cols="4" colsep="0" rowsep="0">
23873 <colspec colwidth="8*" align="left"/>
23874 <colspec colwidth="6*" align="center"/>
23875 <colspec colwidth="6*" align="center"/>
23876 <colspec colwidth="6*" align="right"/>
23877 <tbody>
23878 <row>
23879 <entry><option>ldap_ca_cert_file</option></entry>
23880 <entry>Use: <emphasis>main</emphasis></entry>
23881 <entry>Type: <emphasis>string</emphasis></entry>
23882 <entry>Default: <emphasis>unset</emphasis></entry>
23883 </row>
23884 </tbody>
23885 </tgroup>
23886 </informaltable>
23887 <para>
23888 <indexterm role="concept">
23889 <primary>LDAP</primary>
23890 <secondary>,</secondary>
23891 </indexterm>
23892 This option indicates which file contains CA certificates for verifying
23893 a TLS certificate presented by an LDAP server.
23894 While Exim does not provide a default value, your SSL library may.
23895 Analogous to <option>tls_verify_certificates</option> but as a client-side option for LDAP
23896 and constrained to be a file.
23897 </para>
23898 <para>
23899 <indexterm role="option">
23900 <primary><option>ldap_cert_file</option></primary>
23901 </indexterm>
23902 </para>
23903 <informaltable frame="all">
23904 <tgroup cols="4" colsep="0" rowsep="0">
23905 <colspec colwidth="8*" align="left"/>
23906 <colspec colwidth="6*" align="center"/>
23907 <colspec colwidth="6*" align="center"/>
23908 <colspec colwidth="6*" align="right"/>
23909 <tbody>
23910 <row>
23911 <entry><option>ldap_cert_file</option></entry>
23912 <entry>Use: <emphasis>main</emphasis></entry>
23913 <entry>Type: <emphasis>string</emphasis></entry>
23914 <entry>Default: <emphasis>unset</emphasis></entry>
23915 </row>
23916 </tbody>
23917 </tgroup>
23918 </informaltable>
23919 <para>
23920 <indexterm role="concept">
23921 <primary>LDAP</primary>
23922 <secondary>TLS client certificate file</secondary>
23923 </indexterm>
23924 This option indicates which file contains an TLS client certificate which
23925 Exim should present to the LDAP server during TLS negotiation.
23926 Should be used together with <option>ldap_cert_key</option>.
23927 </para>
23928 <para>
23929 <indexterm role="option">
23930 <primary><option>ldap_cert_key</option></primary>
23931 </indexterm>
23932 </para>
23933 <informaltable frame="all">
23934 <tgroup cols="4" colsep="0" rowsep="0">
23935 <colspec colwidth="8*" align="left"/>
23936 <colspec colwidth="6*" align="center"/>
23937 <colspec colwidth="6*" align="center"/>
23938 <colspec colwidth="6*" align="right"/>
23939 <tbody>
23940 <row>
23941 <entry><option>ldap_cert_key</option></entry>
23942 <entry>Use: <emphasis>main</emphasis></entry>
23943 <entry>Type: <emphasis>string</emphasis></entry>
23944 <entry>Default: <emphasis>unset</emphasis></entry>
23945 </row>
23946 </tbody>
23947 </tgroup>
23948 </informaltable>
23949 <para>
23950 <indexterm role="concept">
23951 <primary>LDAP</primary>
23952 <secondary>TLS client key file</secondary>
23953 </indexterm>
23954 This option indicates which file contains the secret/private key to use
23955 to prove identity to the LDAP server during TLS negotiation.
23956 Should be used together with <option>ldap_cert_file</option>, which contains the
23957 identity to be proven.
23958 </para>
23959 <para>
23960 <indexterm role="option">
23961 <primary><option>ldap_cipher_suite</option></primary>
23962 </indexterm>
23963 </para>
23964 <informaltable frame="all">
23965 <tgroup cols="4" colsep="0" rowsep="0">
23966 <colspec colwidth="8*" align="left"/>
23967 <colspec colwidth="6*" align="center"/>
23968 <colspec colwidth="6*" align="center"/>
23969 <colspec colwidth="6*" align="right"/>
23970 <tbody>
23971 <row>
23972 <entry><option>ldap_cipher_suite</option></entry>
23973 <entry>Use: <emphasis>main</emphasis></entry>
23974 <entry>Type: <emphasis>string</emphasis></entry>
23975 <entry>Default: <emphasis>unset</emphasis></entry>
23976 </row>
23977 </tbody>
23978 </tgroup>
23979 </informaltable>
23980 <para>
23981 <indexterm role="concept">
23982 <primary>LDAP</primary>
23983 <secondary>TLS cipher suite</secondary>
23984 </indexterm>
23985 This controls the TLS cipher-suite negotiation during TLS negotiation with
23986 the LDAP server.  See <xref linkend="SECTreqciphssl"/> for more details of the format of
23987 cipher-suite options with OpenSSL (as used by LDAP client libraries).
23988 </para>
23989 <para>
23990 <indexterm role="option">
23991 <primary><option>ldap_default_servers</option></primary>
23992 </indexterm>
23993 </para>
23994 <informaltable frame="all">
23995 <tgroup cols="4" colsep="0" rowsep="0">
23996 <colspec colwidth="8*" align="left"/>
23997 <colspec colwidth="6*" align="center"/>
23998 <colspec colwidth="6*" align="center"/>
23999 <colspec colwidth="6*" align="right"/>
24000 <tbody>
24001 <row>
24002 <entry><option>ldap_default_servers</option></entry>
24003 <entry>Use: <emphasis>main</emphasis></entry>
24004 <entry>Type: <emphasis>string list</emphasis></entry>
24005 <entry>Default: <emphasis>unset</emphasis></entry>
24006 </row>
24007 </tbody>
24008 </tgroup>
24009 </informaltable>
24010 <para>
24011 <indexterm role="concept">
24012 <primary>LDAP</primary>
24013 <secondary>default servers</secondary>
24014 </indexterm>
24015 This option provides a list of LDAP servers which are tried in turn when an
24016 LDAP query does not contain a server. See section <xref linkend="SECTforldaque"/> for
24017 details of LDAP queries. This option is available only when Exim has been built
24018 with LDAP support.
24019 </para>
24020 <para>
24021 <indexterm role="option">
24022 <primary><option>ldap_require_cert</option></primary>
24023 </indexterm>
24024 </para>
24025 <informaltable frame="all">
24026 <tgroup cols="4" colsep="0" rowsep="0">
24027 <colspec colwidth="8*" align="left"/>
24028 <colspec colwidth="6*" align="center"/>
24029 <colspec colwidth="6*" align="center"/>
24030 <colspec colwidth="6*" align="right"/>
24031 <tbody>
24032 <row>
24033 <entry><option>ldap_require_cert</option></entry>
24034 <entry>Use: <emphasis>main</emphasis></entry>
24035 <entry>Type: <emphasis>string</emphasis></entry>
24036 <entry>Default: <emphasis>unset.</emphasis></entry>
24037 </row>
24038 </tbody>
24039 </tgroup>
24040 </informaltable>
24041 <para>
24042 <indexterm role="concept">
24043 <primary>LDAP</primary>
24044 <secondary>policy for LDAP server TLS cert presentation</secondary>
24045 </indexterm>
24046 This should be one of the values "hard", "demand", "allow", "try" or "never".
24047 A value other than one of these is interpreted as "never".
24048 See the entry "TLS_REQCERT" in your system man page for ldap.conf(5).
24049 Although Exim does not set a default, the LDAP library probably defaults
24050 to hard/demand.
24051 </para>
24052 <para>
24053 <indexterm role="option">
24054 <primary><option>ldap_start_tls</option></primary>
24055 </indexterm>
24056 </para>
24057 <informaltable frame="all">
24058 <tgroup cols="4" colsep="0" rowsep="0">
24059 <colspec colwidth="8*" align="left"/>
24060 <colspec colwidth="6*" align="center"/>
24061 <colspec colwidth="6*" align="center"/>
24062 <colspec colwidth="6*" align="right"/>
24063 <tbody>
24064 <row>
24065 <entry><option>ldap_start_tls</option></entry>
24066 <entry>Use: <emphasis>main</emphasis></entry>
24067 <entry>Type: <emphasis>boolean</emphasis></entry>
24068 <entry>Default: <emphasis>false</emphasis></entry>
24069 </row>
24070 </tbody>
24071 </tgroup>
24072 </informaltable>
24073 <para>
24074 <indexterm role="concept">
24075 <primary>LDAP</primary>
24076 <secondary>whether or not to negotiate TLS</secondary>
24077 </indexterm>
24078 If set, Exim will attempt to negotiate TLS with the LDAP server when
24079 connecting on a regular LDAP port.  This is the LDAP equivalent of SMTP&#x2019;s
24080 "STARTTLS".  This is distinct from using "ldaps", which is the LDAP form
24081 of SSL-on-connect.
24082 In the event of failure to negotiate TLS, the action taken is controlled
24083 by <option>ldap_require_cert</option>.
24084 </para>
24085 <para>
24086 <indexterm role="option">
24087 <primary><option>ldap_version</option></primary>
24088 </indexterm>
24089 </para>
24090 <informaltable frame="all">
24091 <tgroup cols="4" colsep="0" rowsep="0">
24092 <colspec colwidth="8*" align="left"/>
24093 <colspec colwidth="6*" align="center"/>
24094 <colspec colwidth="6*" align="center"/>
24095 <colspec colwidth="6*" align="right"/>
24096 <tbody>
24097 <row>
24098 <entry><option>ldap_version</option></entry>
24099 <entry>Use: <emphasis>main</emphasis></entry>
24100 <entry>Type: <emphasis>integer</emphasis></entry>
24101 <entry>Default: <emphasis>unset</emphasis></entry>
24102 </row>
24103 </tbody>
24104 </tgroup>
24105 </informaltable>
24106 <para>
24107 <indexterm role="concept">
24108 <primary>LDAP</primary>
24109 <secondary>protocol version, forcing</secondary>
24110 </indexterm>
24111 This option can be used to force Exim to set a specific protocol version for
24112 LDAP. If it option is unset, it is shown by the <option>-bP</option> command line option as
24113 -1. When this is the case, the default is 3 if LDAP_VERSION3 is defined in
24114 the LDAP headers; otherwise it is 2. This option is available only when Exim
24115 has been built with LDAP support.
24116 </para>
24117 <para>
24118 <indexterm role="option">
24119 <primary><option>local_from_check</option></primary>
24120 </indexterm>
24121 </para>
24122 <informaltable frame="all">
24123 <tgroup cols="4" colsep="0" rowsep="0">
24124 <colspec colwidth="8*" align="left"/>
24125 <colspec colwidth="6*" align="center"/>
24126 <colspec colwidth="6*" align="center"/>
24127 <colspec colwidth="6*" align="right"/>
24128 <tbody>
24129 <row>
24130 <entry><option>local_from_check</option></entry>
24131 <entry>Use: <emphasis>main</emphasis></entry>
24132 <entry>Type: <emphasis>boolean</emphasis></entry>
24133 <entry>Default: <emphasis>true</emphasis></entry>
24134 </row>
24135 </tbody>
24136 </tgroup>
24137 </informaltable>
24138 <para>
24139 <indexterm role="concept">
24140 <primary><emphasis>Sender:</emphasis> header line</primary>
24141 <secondary>disabling addition of</secondary>
24142 </indexterm>
24143 <indexterm role="concept">
24144 <primary><emphasis>From:</emphasis> header line</primary>
24145 <secondary>disabling checking of</secondary>
24146 </indexterm>
24147 When a message is submitted locally (that is, not over a TCP/IP connection) by
24148 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line, and
24149 checks that the <emphasis>From:</emphasis> header line matches the login of the calling user and
24150 the domain specified by <option>qualify_domain</option>.
24151 </para>
24152 <para>
24153 <emphasis role="bold">Note</emphasis>: An unqualified address (no domain) in the <emphasis>From:</emphasis> header in a
24154 locally submitted message is automatically qualified by Exim, unless the
24155 <option>-bnq</option> command line option is used.
24156 </para>
24157 <para>
24158 You can use <option>local_from_prefix</option> and <option>local_from_suffix</option> to permit affixes
24159 on the local part. If the <emphasis>From:</emphasis> header line does not match, Exim adds a
24160 <emphasis>Sender:</emphasis> header with an address constructed from the calling user&#x2019;s login
24161 and the default qualify domain.
24162 </para>
24163 <para>
24164 If <option>local_from_check</option> is set false, the <emphasis>From:</emphasis> header check is disabled,
24165 and no <emphasis>Sender:</emphasis> header is ever added. If, in addition, you want to retain
24166 <emphasis>Sender:</emphasis> header lines supplied by untrusted users, you must also set
24167 <option>local_sender_retain</option> to be true.
24168 </para>
24169 <para>
24170 <indexterm role="concept">
24171 <primary>envelope sender</primary>
24172 </indexterm>
24173 These options affect only the header lines in the message. The envelope sender
24174 is still forced to be the login id at the qualify domain unless
24175 <option>untrusted_set_sender</option> permits the user to supply an envelope sender.
24176 </para>
24177 <para>
24178 For messages received over TCP/IP, an ACL can specify <quote>submission mode</quote> to
24179 request similar header line checking. See section <xref linkend="SECTthesenhea"/>, which
24180 has more details about <emphasis>Sender:</emphasis> processing.
24181 </para>
24182 <para>
24183 <indexterm role="option">
24184 <primary><option>local_from_prefix</option></primary>
24185 </indexterm>
24186 </para>
24187 <informaltable frame="all">
24188 <tgroup cols="4" colsep="0" rowsep="0">
24189 <colspec colwidth="8*" align="left"/>
24190 <colspec colwidth="6*" align="center"/>
24191 <colspec colwidth="6*" align="center"/>
24192 <colspec colwidth="6*" align="right"/>
24193 <tbody>
24194 <row>
24195 <entry><option>local_from_prefix</option></entry>
24196 <entry>Use: <emphasis>main</emphasis></entry>
24197 <entry>Type: <emphasis>string</emphasis></entry>
24198 <entry>Default: <emphasis>unset</emphasis></entry>
24199 </row>
24200 </tbody>
24201 </tgroup>
24202 </informaltable>
24203 <para>
24204 When Exim checks the <emphasis>From:</emphasis> header line of locally submitted messages for
24205 matching the login id (see <option>local_from_check</option> above), it can be configured to
24206 ignore certain prefixes and suffixes in the local part of the address. This is
24207 done by setting <option>local_from_prefix</option> and/or <option>local_from_suffix</option> to
24208 appropriate lists, in the same form as the <option>local_part_prefix</option> and
24209 <option>local_part_suffix</option> router options (see chapter <xref linkend="CHAProutergeneric"/>). For
24210 example, if
24211 </para>
24212 <literallayout class="monospaced">
24213 local_from_prefix = *-
24214 </literallayout>
24215 <para>
24216 is set, a <emphasis>From:</emphasis> line containing
24217 </para>
24218 <literallayout class="monospaced">
24219 From: anything-user@your.domain.example
24220 </literallayout>
24221 <para>
24222 will not cause a <emphasis>Sender:</emphasis> header to be added if <emphasis>user@your.domain.example</emphasis>
24223 matches the actual sender address that is constructed from the login name and
24224 qualify domain.
24225 </para>
24226 <para>
24227 <indexterm role="option">
24228 <primary><option>local_from_suffix</option></primary>
24229 </indexterm>
24230 </para>
24231 <informaltable frame="all">
24232 <tgroup cols="4" colsep="0" rowsep="0">
24233 <colspec colwidth="8*" align="left"/>
24234 <colspec colwidth="6*" align="center"/>
24235 <colspec colwidth="6*" align="center"/>
24236 <colspec colwidth="6*" align="right"/>
24237 <tbody>
24238 <row>
24239 <entry><option>local_from_suffix</option></entry>
24240 <entry>Use: <emphasis>main</emphasis></entry>
24241 <entry>Type: <emphasis>string</emphasis></entry>
24242 <entry>Default: <emphasis>unset</emphasis></entry>
24243 </row>
24244 </tbody>
24245 </tgroup>
24246 </informaltable>
24247 <para>
24248 See <option>local_from_prefix</option> above.
24249 </para>
24250 <para>
24251 <indexterm role="option">
24252 <primary><option>local_interfaces</option></primary>
24253 </indexterm>
24254 </para>
24255 <informaltable frame="all">
24256 <tgroup cols="4" colsep="0" rowsep="0">
24257 <colspec colwidth="8*" align="left"/>
24258 <colspec colwidth="6*" align="center"/>
24259 <colspec colwidth="6*" align="center"/>
24260 <colspec colwidth="6*" align="right"/>
24261 <tbody>
24262 <row>
24263 <entry><option>local_interfaces</option></entry>
24264 <entry>Use: <emphasis>main</emphasis></entry>
24265 <entry>Type: <emphasis>string list</emphasis></entry>
24266 <entry>Default: <emphasis>see below</emphasis></entry>
24267 </row>
24268 </tbody>
24269 </tgroup>
24270 </informaltable>
24271 <para>
24272 This option controls which network interfaces are used by the daemon for
24273 listening; they are also used to identify the local host when routing. Chapter
24274 <xref linkend="CHAPinterfaces"/> contains a full description of this option and the related
24275 options <option>daemon_smtp_ports</option>, <option>extra_local_interfaces</option>,
24276 <option>hosts_treat_as_local</option>, and <option>tls_on_connect_ports</option>. The default value for
24277 <option>local_interfaces</option> is
24278 </para>
24279 <literallayout class="monospaced">
24280 local_interfaces = 0.0.0.0
24281 </literallayout>
24282 <para>
24283 when Exim is built without IPv6 support; otherwise it is
24284 </para>
24285 <literallayout class="monospaced">
24286 local_interfaces = &lt;; ::0 ; 0.0.0.0
24287 </literallayout>
24288 <para>
24289 <indexterm role="option">
24290 <primary><option>local_scan_timeout</option></primary>
24291 </indexterm>
24292 </para>
24293 <informaltable frame="all">
24294 <tgroup cols="4" colsep="0" rowsep="0">
24295 <colspec colwidth="8*" align="left"/>
24296 <colspec colwidth="6*" align="center"/>
24297 <colspec colwidth="6*" align="center"/>
24298 <colspec colwidth="6*" align="right"/>
24299 <tbody>
24300 <row>
24301 <entry><option>local_scan_timeout</option></entry>
24302 <entry>Use: <emphasis>main</emphasis></entry>
24303 <entry>Type: <emphasis>time</emphasis></entry>
24304 <entry>Default: <emphasis>5m</emphasis></entry>
24305 </row>
24306 </tbody>
24307 </tgroup>
24308 </informaltable>
24309 <para>
24310 <indexterm role="concept">
24311 <primary>timeout</primary>
24312 <secondary>for <function>local_scan()</function> function</secondary>
24313 </indexterm>
24314 <indexterm role="concept">
24315 <primary><function>local_scan()</function> function</primary>
24316 <secondary>timeout</secondary>
24317 </indexterm>
24318 This timeout applies to the <function>local_scan()</function> function (see chapter
24319 <xref linkend="CHAPlocalscan"/>). Zero means <quote>no timeout</quote>. If the timeout is exceeded,
24320 the incoming message is rejected with a temporary error if it is an SMTP
24321 message. For a non-SMTP message, the message is dropped and Exim ends with a
24322 non-zero code. The incident is logged on the main and reject logs.
24323 </para>
24324 <para>
24325 <indexterm role="option">
24326 <primary><option>local_sender_retain</option></primary>
24327 </indexterm>
24328 </para>
24329 <informaltable frame="all">
24330 <tgroup cols="4" colsep="0" rowsep="0">
24331 <colspec colwidth="8*" align="left"/>
24332 <colspec colwidth="6*" align="center"/>
24333 <colspec colwidth="6*" align="center"/>
24334 <colspec colwidth="6*" align="right"/>
24335 <tbody>
24336 <row>
24337 <entry><option>local_sender_retain</option></entry>
24338 <entry>Use: <emphasis>main</emphasis></entry>
24339 <entry>Type: <emphasis>boolean</emphasis></entry>
24340 <entry>Default: <emphasis>false</emphasis></entry>
24341 </row>
24342 </tbody>
24343 </tgroup>
24344 </informaltable>
24345 <para>
24346 <indexterm role="concept">
24347 <primary><emphasis>Sender:</emphasis> header line</primary>
24348 <secondary>retaining from local submission</secondary>
24349 </indexterm>
24350 When a message is submitted locally (that is, not over a TCP/IP connection) by
24351 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line. If you
24352 do not want this to happen, you must set <option>local_sender_retain</option>, and you must
24353 also set <option>local_from_check</option> to be false (Exim will complain if you do not).
24354 See also the ACL modifier <literal>control = suppress_local_fixups</literal>. Section
24355 <xref linkend="SECTthesenhea"/> has more details about <emphasis>Sender:</emphasis> processing.
24356 </para>
24357 <para>
24358 <indexterm role="option">
24359 <primary><option>localhost_number</option></primary>
24360 </indexterm>
24361 </para>
24362 <informaltable frame="all">
24363 <tgroup cols="4" colsep="0" rowsep="0">
24364 <colspec colwidth="8*" align="left"/>
24365 <colspec colwidth="6*" align="center"/>
24366 <colspec colwidth="6*" align="center"/>
24367 <colspec colwidth="6*" align="right"/>
24368 <tbody>
24369 <row>
24370 <entry><option>localhost_number</option></entry>
24371 <entry>Use: <emphasis>main</emphasis></entry>
24372 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24373 <entry>Default: <emphasis>unset</emphasis></entry>
24374 </row>
24375 </tbody>
24376 </tgroup>
24377 </informaltable>
24378 <para>
24379 <indexterm role="concept">
24380 <primary>host</primary>
24381 <secondary>locally unique number for</secondary>
24382 </indexterm>
24383 <indexterm role="concept">
24384 <primary>message ids</primary>
24385 <secondary>with multiple hosts</secondary>
24386 </indexterm>
24387 <indexterm role="variable">
24388 <primary><varname>$localhost_number</varname></primary>
24389 </indexterm>
24390 Exim&#x2019;s message ids are normally unique only within the local host. If
24391 uniqueness among a set of hosts is required, each host must set a different
24392 value for the <option>localhost_number</option> option. The string is expanded immediately
24393 after reading the configuration file (so that a number can be computed from the
24394 host name, for example) and the result of the expansion must be a number in the
24395 range 0&ndash;16 (or 0&ndash;10 on operating systems with case-insensitive file
24396 systems). This is available in subsequent string expansions via the variable
24397 <varname>$localhost_number</varname>. When <option>localhost_number is set</option>, the final two
24398 characters of the message id, instead of just being a fractional part of the
24399 time, are computed from the time and the local host number as described in
24400 section <xref linkend="SECTmessiden"/>.
24401 </para>
24402 <para>
24403 <indexterm role="option">
24404 <primary><option>log_file_path</option></primary>
24405 </indexterm>
24406 </para>
24407 <informaltable frame="all">
24408 <tgroup cols="4" colsep="0" rowsep="0">
24409 <colspec colwidth="8*" align="left"/>
24410 <colspec colwidth="6*" align="center"/>
24411 <colspec colwidth="6*" align="center"/>
24412 <colspec colwidth="6*" align="right"/>
24413 <tbody>
24414 <row>
24415 <entry><option>log_file_path</option></entry>
24416 <entry>Use: <emphasis>main</emphasis></entry>
24417 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
24418 <entry>Default: <emphasis>set at compile time</emphasis></entry>
24419 </row>
24420 </tbody>
24421 </tgroup>
24422 </informaltable>
24423 <para>
24424 <indexterm role="concept">
24425 <primary>log</primary>
24426 <secondary>file path for</secondary>
24427 </indexterm>
24428 This option sets the path which is used to determine the names of Exim&#x2019;s log
24429 files, or indicates that logging is to be to syslog, or both. It is expanded
24430 when Exim is entered, so it can, for example, contain a reference to the host
24431 name. If no specific path is set for the log files at compile or run time, they
24432 are written in a sub-directory called <filename>log</filename> in Exim&#x2019;s spool directory.
24433 Chapter <xref linkend="CHAPlog"/> contains further details about Exim&#x2019;s logging, and
24434 section <xref linkend="SECTwhelogwri"/> describes how the contents of <option>log_file_path</option> are
24435 used. If this string is fixed at your installation (contains no expansion
24436 variables) it is recommended that you do not set this option in the
24437 configuration file, but instead supply the path using LOG_FILE_PATH in
24438 <filename>Local/Makefile</filename> so that it is available to Exim for logging errors detected
24439 early on &ndash; in particular, failure to read the configuration file.
24440 </para>
24441 <para>
24442 <indexterm role="option">
24443 <primary><option>log_selector</option></primary>
24444 </indexterm>
24445 </para>
24446 <informaltable frame="all">
24447 <tgroup cols="4" colsep="0" rowsep="0">
24448 <colspec colwidth="8*" align="left"/>
24449 <colspec colwidth="6*" align="center"/>
24450 <colspec colwidth="6*" align="center"/>
24451 <colspec colwidth="6*" align="right"/>
24452 <tbody>
24453 <row>
24454 <entry><option>log_selector</option></entry>
24455 <entry>Use: <emphasis>main</emphasis></entry>
24456 <entry>Type: <emphasis>string</emphasis></entry>
24457 <entry>Default: <emphasis>unset</emphasis></entry>
24458 </row>
24459 </tbody>
24460 </tgroup>
24461 </informaltable>
24462 <para>
24463 <indexterm role="concept">
24464 <primary>log</primary>
24465 <secondary>selectors</secondary>
24466 </indexterm>
24467 This option can be used to reduce or increase the number of things that Exim
24468 writes to its log files. Its argument is made up of names preceded by plus or
24469 minus characters. For example:
24470 </para>
24471 <literallayout class="monospaced">
24472 log_selector = +arguments -retry_defer
24473 </literallayout>
24474 <para>
24475 A list of possible names and what they control is given in the chapter on
24476 logging, in section <xref linkend="SECTlogselector"/>.
24477 </para>
24478 <para>
24479 <indexterm role="option">
24480 <primary><option>log_timezone</option></primary>
24481 </indexterm>
24482 </para>
24483 <informaltable frame="all">
24484 <tgroup cols="4" colsep="0" rowsep="0">
24485 <colspec colwidth="8*" align="left"/>
24486 <colspec colwidth="6*" align="center"/>
24487 <colspec colwidth="6*" align="center"/>
24488 <colspec colwidth="6*" align="right"/>
24489 <tbody>
24490 <row>
24491 <entry><option>log_timezone</option></entry>
24492 <entry>Use: <emphasis>main</emphasis></entry>
24493 <entry>Type: <emphasis>boolean</emphasis></entry>
24494 <entry>Default: <emphasis>false</emphasis></entry>
24495 </row>
24496 </tbody>
24497 </tgroup>
24498 </informaltable>
24499 <para>
24500 <indexterm role="concept">
24501 <primary>log</primary>
24502 <secondary>timezone for entries</secondary>
24503 </indexterm>
24504 <indexterm role="variable">
24505 <primary><varname>$tod_log</varname></primary>
24506 </indexterm>
24507 <indexterm role="variable">
24508 <primary><varname>$tod_zone</varname></primary>
24509 </indexterm>
24510 By default, the timestamps on log lines are in local time without the
24511 timezone. This means that if your timezone changes twice a year, the timestamps
24512 in log lines are ambiguous for an hour when the clocks go back. One way of
24513 avoiding this problem is to set the timezone to UTC. An alternative is to set
24514 <option>log_timezone</option> true. This turns on the addition of the timezone offset to
24515 timestamps in log lines. Turning on this option can add quite a lot to the size
24516 of log files because each line is extended by 6 characters. Note that the
24517 <varname>$tod_log</varname> variable contains the log timestamp without the zone, but there is
24518 another variable called <varname>$tod_zone</varname> that contains just the timezone offset.
24519 </para>
24520 <para>
24521 <indexterm role="option">
24522 <primary><option>lookup_open_max</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>lookup_open_max</option></entry>
24534 <entry>Use: <emphasis>main</emphasis></entry>
24535 <entry>Type: <emphasis>integer</emphasis></entry>
24536 <entry>Default: <emphasis>25</emphasis></entry>
24537 </row>
24538 </tbody>
24539 </tgroup>
24540 </informaltable>
24541 <para>
24542 <indexterm role="concept">
24543 <primary>too many open files</primary>
24544 </indexterm>
24545 <indexterm role="concept">
24546 <primary>open files, too many</primary>
24547 </indexterm>
24548 <indexterm role="concept">
24549 <primary>file</primary>
24550 <secondary>too many open</secondary>
24551 </indexterm>
24552 <indexterm role="concept">
24553 <primary>lookup</primary>
24554 <secondary>maximum open files</secondary>
24555 </indexterm>
24556 <indexterm role="concept">
24557 <primary>limit</primary>
24558 <secondary>open files for lookups</secondary>
24559 </indexterm>
24560 This option limits the number of simultaneously open files for single-key
24561 lookups that use regular files (that is, <command>lsearch</command>, <command>dbm</command>, and <command>cdb</command>).
24562 Exim normally keeps these files open during routing, because often the same
24563 file is required several times. If the limit is reached, Exim closes the least
24564 recently used file. Note that if you are using the <emphasis>ndbm</emphasis> library, it
24565 actually opens two files for each logical DBM database, though it still counts
24566 as one for the purposes of <option>lookup_open_max</option>. If you are getting <quote>too many
24567 open files</quote> errors with NDBM, you need to reduce the value of
24568 <option>lookup_open_max</option>.
24569 </para>
24570 <para>
24571 <indexterm role="option">
24572 <primary><option>max_username_length</option></primary>
24573 </indexterm>
24574 </para>
24575 <informaltable frame="all">
24576 <tgroup cols="4" colsep="0" rowsep="0">
24577 <colspec colwidth="8*" align="left"/>
24578 <colspec colwidth="6*" align="center"/>
24579 <colspec colwidth="6*" align="center"/>
24580 <colspec colwidth="6*" align="right"/>
24581 <tbody>
24582 <row>
24583 <entry><option>max_username_length</option></entry>
24584 <entry>Use: <emphasis>main</emphasis></entry>
24585 <entry>Type: <emphasis>integer</emphasis></entry>
24586 <entry>Default: <emphasis>0</emphasis></entry>
24587 </row>
24588 </tbody>
24589 </tgroup>
24590 </informaltable>
24591 <para>
24592 <indexterm role="concept">
24593 <primary>length of login name</primary>
24594 </indexterm>
24595 <indexterm role="concept">
24596 <primary>user name</primary>
24597 <secondary>maximum length</secondary>
24598 </indexterm>
24599 <indexterm role="concept">
24600 <primary>limit</primary>
24601 <secondary>user name length</secondary>
24602 </indexterm>
24603 Some operating systems are broken in that they truncate long arguments to
24604 <function>getpwnam()</function> to eight characters, instead of returning <quote>no such user</quote>. If
24605 this option is set greater than zero, any attempt to call <function>getpwnam()</function> with
24606 an argument that is longer behaves as if <function>getpwnam()</function> failed.
24607 </para>
24608 <para>
24609 <indexterm role="option">
24610 <primary><option>message_body_newlines</option></primary>
24611 </indexterm>
24612 </para>
24613 <informaltable frame="all">
24614 <tgroup cols="4" colsep="0" rowsep="0">
24615 <colspec colwidth="8*" align="left"/>
24616 <colspec colwidth="6*" align="center"/>
24617 <colspec colwidth="6*" align="center"/>
24618 <colspec colwidth="6*" align="right"/>
24619 <tbody>
24620 <row>
24621 <entry><option>message_body_newlines</option></entry>
24622 <entry>Use: <emphasis>main</emphasis></entry>
24623 <entry>Type: <emphasis>bool</emphasis></entry>
24624 <entry>Default: <emphasis>false</emphasis></entry>
24625 </row>
24626 </tbody>
24627 </tgroup>
24628 </informaltable>
24629 <para>
24630 <indexterm role="concept">
24631 <primary>message body</primary>
24632 <secondary>newlines in variables</secondary>
24633 </indexterm>
24634 <indexterm role="concept">
24635 <primary>newline</primary>
24636 <secondary>in message body variables</secondary>
24637 </indexterm>
24638 <indexterm role="variable">
24639 <primary><varname>$message_body</varname></primary>
24640 </indexterm>
24641 <indexterm role="variable">
24642 <primary><varname>$message_body_end</varname></primary>
24643 </indexterm>
24644 By default, newlines in the message body are replaced by spaces when setting
24645 the <varname>$message_body</varname> and <varname>$message_body_end</varname> expansion variables. If this
24646 option is set true, this no longer happens.
24647 </para>
24648 <para>
24649 <indexterm role="option">
24650 <primary><option>message_body_visible</option></primary>
24651 </indexterm>
24652 </para>
24653 <informaltable frame="all">
24654 <tgroup cols="4" colsep="0" rowsep="0">
24655 <colspec colwidth="8*" align="left"/>
24656 <colspec colwidth="6*" align="center"/>
24657 <colspec colwidth="6*" align="center"/>
24658 <colspec colwidth="6*" align="right"/>
24659 <tbody>
24660 <row>
24661 <entry><option>message_body_visible</option></entry>
24662 <entry>Use: <emphasis>main</emphasis></entry>
24663 <entry>Type: <emphasis>integer</emphasis></entry>
24664 <entry>Default: <emphasis>500</emphasis></entry>
24665 </row>
24666 </tbody>
24667 </tgroup>
24668 </informaltable>
24669 <para>
24670 <indexterm role="concept">
24671 <primary>body of message</primary>
24672 <secondary>visible size</secondary>
24673 </indexterm>
24674 <indexterm role="concept">
24675 <primary>message body</primary>
24676 <secondary>visible size</secondary>
24677 </indexterm>
24678 <indexterm role="variable">
24679 <primary><varname>$message_body</varname></primary>
24680 </indexterm>
24681 <indexterm role="variable">
24682 <primary><varname>$message_body_end</varname></primary>
24683 </indexterm>
24684 This option specifies how much of a message&#x2019;s body is to be included in the
24685 <varname>$message_body</varname> and <varname>$message_body_end</varname> expansion variables.
24686 </para>
24687 <para>
24688 <indexterm role="option">
24689 <primary><option>message_id_header_domain</option></primary>
24690 </indexterm>
24691 </para>
24692 <informaltable frame="all">
24693 <tgroup cols="4" colsep="0" rowsep="0">
24694 <colspec colwidth="8*" align="left"/>
24695 <colspec colwidth="6*" align="center"/>
24696 <colspec colwidth="6*" align="center"/>
24697 <colspec colwidth="6*" align="right"/>
24698 <tbody>
24699 <row>
24700 <entry><option>message_id_header_domain</option></entry>
24701 <entry>Use: <emphasis>main</emphasis></entry>
24702 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24703 <entry>Default: <emphasis>unset</emphasis></entry>
24704 </row>
24705 </tbody>
24706 </tgroup>
24707 </informaltable>
24708 <para>
24709 <indexterm role="concept">
24710 <primary><emphasis>Message-ID:</emphasis> header line</primary>
24711 </indexterm>
24712 If this option is set, the string is expanded and used as the right hand side
24713 (domain) of the <emphasis>Message-ID:</emphasis> header that Exim creates if a
24714 locally-originated incoming message does not have one. <quote>Locally-originated</quote>
24715 means <quote>not received over TCP/IP.</quote>
24716 Otherwise, the primary host name is used.
24717 Only letters, digits, dot and hyphen are accepted; any other characters are
24718 replaced by hyphens. If the expansion is forced to fail, or if the result is an
24719 empty string, the option is ignored.
24720 </para>
24721 <para>
24722 <indexterm role="option">
24723 <primary><option>message_id_header_text</option></primary>
24724 </indexterm>
24725 </para>
24726 <informaltable frame="all">
24727 <tgroup cols="4" colsep="0" rowsep="0">
24728 <colspec colwidth="8*" align="left"/>
24729 <colspec colwidth="6*" align="center"/>
24730 <colspec colwidth="6*" align="center"/>
24731 <colspec colwidth="6*" align="right"/>
24732 <tbody>
24733 <row>
24734 <entry><option>message_id_header_text</option></entry>
24735 <entry>Use: <emphasis>main</emphasis></entry>
24736 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24737 <entry>Default: <emphasis>unset</emphasis></entry>
24738 </row>
24739 </tbody>
24740 </tgroup>
24741 </informaltable>
24742 <para>
24743 If this variable is set, the string is expanded and used to augment the text of
24744 the <emphasis>Message-id:</emphasis> header that Exim creates if a locally-originated incoming
24745 message does not have one. The text of this header is required by RFC 2822 to
24746 take the form of an address. By default, Exim uses its internal message id as
24747 the local part, and the primary host name as the domain. If this option is set,
24748 it is expanded, and provided the expansion is not forced to fail, and does not
24749 yield an empty string, the result is inserted into the header immediately
24750 before the @, separated from the internal message id by a dot. Any characters
24751 that are illegal in an address are automatically converted into hyphens. This
24752 means that variables such as <varname>$tod_log</varname> can be used, because the spaces and
24753 colons will become hyphens.
24754 </para>
24755 <para>
24756 <indexterm role="option">
24757 <primary><option>message_logs</option></primary>
24758 </indexterm>
24759 </para>
24760 <informaltable frame="all">
24761 <tgroup cols="4" colsep="0" rowsep="0">
24762 <colspec colwidth="8*" align="left"/>
24763 <colspec colwidth="6*" align="center"/>
24764 <colspec colwidth="6*" align="center"/>
24765 <colspec colwidth="6*" align="right"/>
24766 <tbody>
24767 <row>
24768 <entry><option>message_logs</option></entry>
24769 <entry>Use: <emphasis>main</emphasis></entry>
24770 <entry>Type: <emphasis>boolean</emphasis></entry>
24771 <entry>Default: <emphasis>true</emphasis></entry>
24772 </row>
24773 </tbody>
24774 </tgroup>
24775 </informaltable>
24776 <para>
24777 <indexterm role="concept">
24778 <primary>message logs</primary>
24779 <secondary>disabling</secondary>
24780 </indexterm>
24781 <indexterm role="concept">
24782 <primary>log</primary>
24783 <secondary>message log; disabling</secondary>
24784 </indexterm>
24785 If this option is turned off, per-message log files are not created in the
24786 <filename>msglog</filename> spool sub-directory. This reduces the amount of disk I/O required by
24787 Exim, by reducing the number of files involved in handling a message from a
24788 minimum of four (header spool file, body spool file, delivery journal, and
24789 per-message log) to three. The other major I/O activity is Exim&#x2019;s main log,
24790 which is not affected by this option.
24791 </para>
24792 <para>
24793 <indexterm role="option">
24794 <primary><option>message_size_limit</option></primary>
24795 </indexterm>
24796 </para>
24797 <informaltable frame="all">
24798 <tgroup cols="4" colsep="0" rowsep="0">
24799 <colspec colwidth="8*" align="left"/>
24800 <colspec colwidth="6*" align="center"/>
24801 <colspec colwidth="6*" align="center"/>
24802 <colspec colwidth="6*" align="right"/>
24803 <tbody>
24804 <row>
24805 <entry><option>message_size_limit</option></entry>
24806 <entry>Use: <emphasis>main</emphasis></entry>
24807 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24808 <entry>Default: <emphasis>50M</emphasis></entry>
24809 </row>
24810 </tbody>
24811 </tgroup>
24812 </informaltable>
24813 <para>
24814 <indexterm role="concept">
24815 <primary>message</primary>
24816 <secondary>size limit</secondary>
24817 </indexterm>
24818 <indexterm role="concept">
24819 <primary>limit</primary>
24820 <secondary>message size</secondary>
24821 </indexterm>
24822 <indexterm role="concept">
24823 <primary>size</primary>
24824 <secondary>of message, limit</secondary>
24825 </indexterm>
24826 This option limits the maximum size of message that Exim will process. The
24827 value is expanded for each incoming connection so, for example, it can be made
24828 to depend on the IP address of the remote host for messages arriving via
24829 TCP/IP. After expansion, the value must be a sequence of decimal digits,
24830 optionally followed by K or M.
24831 </para>
24832 <para>
24833 <emphasis role="bold">Note</emphasis>: This limit cannot be made to depend on a message&#x2019;s sender or any
24834 other properties of an individual message, because it has to be advertised in
24835 the server&#x2019;s response to EHLO. String expansion failure causes a temporary
24836 error. A value of zero means no limit, but its use is not recommended. See also
24837 <option>bounce_return_size_limit</option>.
24838 </para>
24839 <para>
24840 Incoming SMTP messages are failed with a 552 error if the limit is
24841 exceeded; locally-generated messages either get a stderr message or a delivery
24842 failure message to the sender, depending on the <option>-oe</option> setting. Rejection of
24843 an oversized message is logged in both the main and the reject logs. See also
24844 the generic transport option <option>message_size_limit</option>, which limits the size of
24845 message that an individual transport can process.
24846 </para>
24847 <para>
24848 If you use a virus-scanner and set this option to to a value larger than the
24849 maximum size that your virus-scanner is configured to support, you may get
24850 failures triggered by large mails.  The right size to configure for the
24851 virus-scanner depends upon what data is passed and the options in use but it&#x2019;s
24852 probably safest to just set it to a little larger than this value.  Eg, with a
24853 default Exim message size of 50M and a default ClamAV StreamMaxLength of 10M,
24854 some problems may result.
24855 </para>
24856 <para>
24857 A value of 0 will disable size limit checking; Exim will still advertise the
24858 SIZE extension in an EHLO response, but without a limit, so as to permit
24859 SMTP clients to still indicate the message size along with the MAIL verb.
24860 </para>
24861 <para>
24862 <indexterm role="option">
24863 <primary><option>move_frozen_messages</option></primary>
24864 </indexterm>
24865 </para>
24866 <informaltable frame="all">
24867 <tgroup cols="4" colsep="0" rowsep="0">
24868 <colspec colwidth="8*" align="left"/>
24869 <colspec colwidth="6*" align="center"/>
24870 <colspec colwidth="6*" align="center"/>
24871 <colspec colwidth="6*" align="right"/>
24872 <tbody>
24873 <row>
24874 <entry><option>move_frozen_messages</option></entry>
24875 <entry>Use: <emphasis>main</emphasis></entry>
24876 <entry>Type: <emphasis>boolean</emphasis></entry>
24877 <entry>Default: <emphasis>false</emphasis></entry>
24878 </row>
24879 </tbody>
24880 </tgroup>
24881 </informaltable>
24882 <para>
24883 <indexterm role="concept">
24884 <primary>frozen messages</primary>
24885 <secondary>moving</secondary>
24886 </indexterm>
24887 This option, which is available only if Exim has been built with the setting
24888 </para>
24889 <literallayout class="monospaced">
24890 SUPPORT_MOVE_FROZEN_MESSAGES=yes
24891 </literallayout>
24892 <para>
24893 in <filename>Local/Makefile</filename>, causes frozen messages and their message logs to be
24894 moved from the <filename>input</filename> and <filename>msglog</filename> directories on the spool to <filename>Finput</filename>
24895 and <filename>Fmsglog</filename>, respectively. There is currently no support in Exim or the
24896 standard utilities for handling such moved messages, and they do not show up in
24897 lists generated by <option>-bp</option> or by the Exim monitor.
24898 </para>
24899 <para>
24900 <indexterm role="option">
24901 <primary><option>mua_wrapper</option></primary>
24902 </indexterm>
24903 </para>
24904 <informaltable frame="all">
24905 <tgroup cols="4" colsep="0" rowsep="0">
24906 <colspec colwidth="8*" align="left"/>
24907 <colspec colwidth="6*" align="center"/>
24908 <colspec colwidth="6*" align="center"/>
24909 <colspec colwidth="6*" align="right"/>
24910 <tbody>
24911 <row>
24912 <entry><option>mua_wrapper</option></entry>
24913 <entry>Use: <emphasis>main</emphasis></entry>
24914 <entry>Type: <emphasis>boolean</emphasis></entry>
24915 <entry>Default: <emphasis>false</emphasis></entry>
24916 </row>
24917 </tbody>
24918 </tgroup>
24919 </informaltable>
24920 <para>
24921 Setting this option true causes Exim to run in a very restrictive mode in which
24922 it passes messages synchronously to a smart host. Chapter <xref linkend="CHAPnonqueueing"/>
24923 contains a full description of this facility.
24924 </para>
24925 <para>
24926 <indexterm role="option">
24927 <primary><option>mysql_servers</option></primary>
24928 </indexterm>
24929 </para>
24930 <informaltable frame="all">
24931 <tgroup cols="4" colsep="0" rowsep="0">
24932 <colspec colwidth="8*" align="left"/>
24933 <colspec colwidth="6*" align="center"/>
24934 <colspec colwidth="6*" align="center"/>
24935 <colspec colwidth="6*" align="right"/>
24936 <tbody>
24937 <row>
24938 <entry><option>mysql_servers</option></entry>
24939 <entry>Use: <emphasis>main</emphasis></entry>
24940 <entry>Type: <emphasis>string list</emphasis></entry>
24941 <entry>Default: <emphasis>unset</emphasis></entry>
24942 </row>
24943 </tbody>
24944 </tgroup>
24945 </informaltable>
24946 <para>
24947 <indexterm role="concept">
24948 <primary>MySQL</primary>
24949 <secondary>server list</secondary>
24950 </indexterm>
24951 This option provides a list of MySQL servers and associated connection data, to
24952 be used in conjunction with <command>mysql</command> lookups (see section <xref linkend="SECID72"/>). The
24953 option is available only if Exim has been built with MySQL support.
24954 </para>
24955 <para>
24956 <indexterm role="option">
24957 <primary><option>never_users</option></primary>
24958 </indexterm>
24959 </para>
24960 <informaltable frame="all">
24961 <tgroup cols="4" colsep="0" rowsep="0">
24962 <colspec colwidth="8*" align="left"/>
24963 <colspec colwidth="6*" align="center"/>
24964 <colspec colwidth="6*" align="center"/>
24965 <colspec colwidth="6*" align="right"/>
24966 <tbody>
24967 <row>
24968 <entry><option>never_users</option></entry>
24969 <entry>Use: <emphasis>main</emphasis></entry>
24970 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
24971 <entry>Default: <emphasis>unset</emphasis></entry>
24972 </row>
24973 </tbody>
24974 </tgroup>
24975 </informaltable>
24976 <para>
24977 This option is expanded just once, at the start of Exim&#x2019;s processing. Local
24978 message deliveries are normally run in processes that are setuid to the
24979 recipient, and remote deliveries are normally run under Exim&#x2019;s own uid and gid.
24980 It is usually desirable to prevent any deliveries from running as root, as a
24981 safety precaution.
24982 </para>
24983 <para>
24984 When Exim is built, an option called FIXED_NEVER_USERS can be set to a
24985 list of users that must not be used for local deliveries. This list is fixed in
24986 the binary and cannot be overridden by the configuration file. By default, it
24987 contains just the single user name <quote>root</quote>. The <option>never_users</option> runtime option
24988 can be used to add more users to the fixed list.
24989 </para>
24990 <para>
24991 If a message is to be delivered as one of the users on the fixed list or the
24992 <option>never_users</option> list, an error occurs, and delivery is deferred. A common
24993 example is
24994 </para>
24995 <literallayout class="monospaced">
24996 never_users = root:daemon:bin
24997 </literallayout>
24998 <para>
24999 Including root is redundant if it is also on the fixed list, but it does no
25000 harm. This option overrides the <option>pipe_as_creator</option> option of the <command>pipe</command>
25001 transport driver.
25002 </para>
25003 <para>
25004 <indexterm role="option">
25005 <primary><option>openssl_options</option></primary>
25006 </indexterm>
25007 </para>
25008 <informaltable frame="all">
25009 <tgroup cols="4" colsep="0" rowsep="0">
25010 <colspec colwidth="8*" align="left"/>
25011 <colspec colwidth="6*" align="center"/>
25012 <colspec colwidth="6*" align="center"/>
25013 <colspec colwidth="6*" align="right"/>
25014 <tbody>
25015 <row>
25016 <entry><option>openssl_options</option></entry>
25017 <entry>Use: <emphasis>main</emphasis></entry>
25018 <entry>Type: <emphasis>string list</emphasis></entry>
25019 <entry>Default: <emphasis>+dont_insert_empty_fragments</emphasis></entry>
25020 </row>
25021 </tbody>
25022 </tgroup>
25023 </informaltable>
25024 <para>
25025 <indexterm role="concept">
25026 <primary>OpenSSL </primary>
25027 <secondary>compatibility</secondary>
25028 </indexterm>
25029 This option allows an administrator to adjust the SSL options applied
25030 by OpenSSL to connections.  It is given as a space-separated list of items,
25031 each one to be +added or -subtracted from the current value.  The default
25032 value is one option which happens to have been set historically.  You can
25033 remove all options with:
25034 </para>
25035 <literallayout class="monospaced">
25036 openssl_options = -all
25037 </literallayout>
25038 <para>
25039 This option is only available if Exim is built against OpenSSL.  The values
25040 available for this option vary according to the age of your OpenSSL install.
25041 The <quote>all</quote> value controls a subset of flags which are available, typically
25042 the bug workaround options.  The <emphasis>SSL_CTX_set_options</emphasis> man page will
25043 list the values known on your system and Exim should support all the
25044 <quote>bug workaround</quote> options and many of the <quote>modifying</quote> options.  The Exim
25045 names lose the leading <quote>SSL_OP_</quote> and are lower-cased.
25046 </para>
25047 <para>
25048 Note that adjusting the options can have severe impact upon the security of
25049 SSL as used by Exim.  It is possible to disable safety checks and shoot
25050 yourself in the foot in various unpleasant ways.  This option should not be
25051 adjusted lightly.  An unrecognised item will be detected at by invoking Exim
25052 with the <option>-bV</option> flag.
25053 </para>
25054 <para>
25055 An example:
25056 </para>
25057 <literallayout class="monospaced">
25058 openssl_options = -all +microsoft_big_sslv3_buffer
25059 </literallayout>
25060 <para>
25061 <indexterm role="option">
25062 <primary><option>oracle_servers</option></primary>
25063 </indexterm>
25064 </para>
25065 <informaltable frame="all">
25066 <tgroup cols="4" colsep="0" rowsep="0">
25067 <colspec colwidth="8*" align="left"/>
25068 <colspec colwidth="6*" align="center"/>
25069 <colspec colwidth="6*" align="center"/>
25070 <colspec colwidth="6*" align="right"/>
25071 <tbody>
25072 <row>
25073 <entry><option>oracle_servers</option></entry>
25074 <entry>Use: <emphasis>main</emphasis></entry>
25075 <entry>Type: <emphasis>string list</emphasis></entry>
25076 <entry>Default: <emphasis>unset</emphasis></entry>
25077 </row>
25078 </tbody>
25079 </tgroup>
25080 </informaltable>
25081 <para>
25082 <indexterm role="concept">
25083 <primary>Oracle</primary>
25084 <secondary>server list</secondary>
25085 </indexterm>
25086 This option provides a list of Oracle servers and associated connection data,
25087 to be used in conjunction with <command>oracle</command> lookups (see section <xref linkend="SECID72"/>).
25088 The option is available only if Exim has been built with Oracle support.
25089 </para>
25090 <para>
25091 <indexterm role="option">
25092 <primary><option>percent_hack_domains</option></primary>
25093 </indexterm>
25094 </para>
25095 <informaltable frame="all">
25096 <tgroup cols="4" colsep="0" rowsep="0">
25097 <colspec colwidth="8*" align="left"/>
25098 <colspec colwidth="6*" align="center"/>
25099 <colspec colwidth="6*" align="center"/>
25100 <colspec colwidth="6*" align="right"/>
25101 <tbody>
25102 <row>
25103 <entry><option>percent_hack_domains</option></entry>
25104 <entry>Use: <emphasis>main</emphasis></entry>
25105 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
25106 <entry>Default: <emphasis>unset</emphasis></entry>
25107 </row>
25108 </tbody>
25109 </tgroup>
25110 </informaltable>
25111 <para>
25112 <indexterm role="concept">
25113 <primary><quote>percent hack</quote></primary>
25114 </indexterm>
25115 <indexterm role="concept">
25116 <primary>source routing</primary>
25117 <secondary>in email address</secondary>
25118 </indexterm>
25119 <indexterm role="concept">
25120 <primary>address</primary>
25121 <secondary>source-routed</secondary>
25122 </indexterm>
25123 The <quote>percent hack</quote> is the convention whereby a local part containing a
25124 percent sign is re-interpreted as a new email address, with the percent
25125 replaced by @. This is sometimes called <quote>source routing</quote>, though that term is
25126 also applied to RFC 2822 addresses that begin with an @ character. If this
25127 option is set, Exim implements the percent facility for those domains listed,
25128 but no others. This happens before an incoming SMTP address is tested against
25129 an ACL.
25130 </para>
25131 <para>
25132 <emphasis role="bold">Warning</emphasis>: The <quote>percent hack</quote> has often been abused by people who are
25133 trying to get round relaying restrictions. For this reason, it is best avoided
25134 if at all possible. Unfortunately, a number of less security-conscious MTAs
25135 implement it unconditionally. If you are running Exim on a gateway host, and
25136 routing mail through to internal MTAs without processing the local parts, it is
25137 a good idea to reject recipient addresses with percent characters in their
25138 local parts. Exim&#x2019;s default configuration does this.
25139 </para>
25140 <para>
25141 <indexterm role="option">
25142 <primary><option>perl_at_start</option></primary>
25143 </indexterm>
25144 </para>
25145 <informaltable frame="all">
25146 <tgroup cols="4" colsep="0" rowsep="0">
25147 <colspec colwidth="8*" align="left"/>
25148 <colspec colwidth="6*" align="center"/>
25149 <colspec colwidth="6*" align="center"/>
25150 <colspec colwidth="6*" align="right"/>
25151 <tbody>
25152 <row>
25153 <entry><option>perl_at_start</option></entry>
25154 <entry>Use: <emphasis>main</emphasis></entry>
25155 <entry>Type: <emphasis>boolean</emphasis></entry>
25156 <entry>Default: <emphasis>false</emphasis></entry>
25157 </row>
25158 </tbody>
25159 </tgroup>
25160 </informaltable>
25161 <para>
25162 This option is available only when Exim is built with an embedded Perl
25163 interpreter. See chapter <xref linkend="CHAPperl"/> for details of its use.
25164 </para>
25165 <para>
25166 <indexterm role="option">
25167 <primary><option>perl_startup</option></primary>
25168 </indexterm>
25169 </para>
25170 <informaltable frame="all">
25171 <tgroup cols="4" colsep="0" rowsep="0">
25172 <colspec colwidth="8*" align="left"/>
25173 <colspec colwidth="6*" align="center"/>
25174 <colspec colwidth="6*" align="center"/>
25175 <colspec colwidth="6*" align="right"/>
25176 <tbody>
25177 <row>
25178 <entry><option>perl_startup</option></entry>
25179 <entry>Use: <emphasis>main</emphasis></entry>
25180 <entry>Type: <emphasis>string</emphasis></entry>
25181 <entry>Default: <emphasis>unset</emphasis></entry>
25182 </row>
25183 </tbody>
25184 </tgroup>
25185 </informaltable>
25186 <para>
25187 This option is available only when Exim is built with an embedded Perl
25188 interpreter. See chapter <xref linkend="CHAPperl"/> for details of its use.
25189 </para>
25190 <para>
25191 <indexterm role="option">
25192 <primary><option>pgsql_servers</option></primary>
25193 </indexterm>
25194 </para>
25195 <informaltable frame="all">
25196 <tgroup cols="4" colsep="0" rowsep="0">
25197 <colspec colwidth="8*" align="left"/>
25198 <colspec colwidth="6*" align="center"/>
25199 <colspec colwidth="6*" align="center"/>
25200 <colspec colwidth="6*" align="right"/>
25201 <tbody>
25202 <row>
25203 <entry><option>pgsql_servers</option></entry>
25204 <entry>Use: <emphasis>main</emphasis></entry>
25205 <entry>Type: <emphasis>string list</emphasis></entry>
25206 <entry>Default: <emphasis>unset</emphasis></entry>
25207 </row>
25208 </tbody>
25209 </tgroup>
25210 </informaltable>
25211 <para>
25212 <indexterm role="concept">
25213 <primary>PostgreSQL lookup type</primary>
25214 <secondary>server list</secondary>
25215 </indexterm>
25216 This option provides a list of PostgreSQL servers and associated connection
25217 data, to be used in conjunction with <command>pgsql</command> lookups (see section
25218 <xref linkend="SECID72"/>). The option is available only if Exim has been built with
25219 PostgreSQL support.
25220 </para>
25221 <para>
25222 <indexterm role="option">
25223 <primary><option>pid_file_path</option></primary>
25224 </indexterm>
25225 </para>
25226 <informaltable frame="all">
25227 <tgroup cols="4" colsep="0" rowsep="0">
25228 <colspec colwidth="8*" align="left"/>
25229 <colspec colwidth="6*" align="center"/>
25230 <colspec colwidth="6*" align="center"/>
25231 <colspec colwidth="6*" align="right"/>
25232 <tbody>
25233 <row>
25234 <entry><option>pid_file_path</option></entry>
25235 <entry>Use: <emphasis>main</emphasis></entry>
25236 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25237 <entry>Default: <emphasis>set at compile time</emphasis></entry>
25238 </row>
25239 </tbody>
25240 </tgroup>
25241 </informaltable>
25242 <para>
25243 <indexterm role="concept">
25244 <primary>daemon</primary>
25245 <secondary>pid file path</secondary>
25246 </indexterm>
25247 <indexterm role="concept">
25248 <primary>pid file, path for</primary>
25249 </indexterm>
25250 This option sets the name of the file to which the Exim daemon writes its
25251 process id. The string is expanded, so it can contain, for example, references
25252 to the host name:
25253 </para>
25254 <literallayout class="monospaced">
25255 pid_file_path = /var/log/$primary_hostname/exim.pid
25256 </literallayout>
25257 <para>
25258 If no path is set, the pid is written to the file <filename>exim-daemon.pid</filename> in Exim&#x2019;s
25259 spool directory.
25260 The value set by the option can be overridden by the <option>-oP</option> command line
25261 option. A pid file is not written if a <quote>non-standard</quote> daemon is run by means
25262 of the <option>-oX</option> option, unless a path is explicitly supplied by <option>-oP</option>.
25263 </para>
25264 <para>
25265 <indexterm role="option">
25266 <primary><option>pipelining_advertise_hosts</option></primary>
25267 </indexterm>
25268 </para>
25269 <informaltable frame="all">
25270 <tgroup cols="4" colsep="0" rowsep="0">
25271 <colspec colwidth="8*" align="left"/>
25272 <colspec colwidth="6*" align="center"/>
25273 <colspec colwidth="6*" align="center"/>
25274 <colspec colwidth="6*" align="right"/>
25275 <tbody>
25276 <row>
25277 <entry><option>pipelining_advertise_hosts</option></entry>
25278 <entry>Use: <emphasis>main</emphasis></entry>
25279 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
25280 <entry>Default: <emphasis>*</emphasis></entry>
25281 </row>
25282 </tbody>
25283 </tgroup>
25284 </informaltable>
25285 <para>
25286 <indexterm role="concept">
25287 <primary>PIPELINING</primary>
25288 <secondary>suppressing advertising</secondary>
25289 </indexterm>
25290 This option can be used to suppress the advertisement of the SMTP
25291 PIPELINING extension to specific hosts. See also the <emphasis role="bold">no_pipelining</emphasis>
25292 control in section <xref linkend="SECTcontrols"/>. When PIPELINING is not advertised and
25293 <option>smtp_enforce_sync</option> is true, an Exim server enforces strict synchronization
25294 for each SMTP command and response. When PIPELINING is advertised, Exim assumes
25295 that clients will use it; <quote>out of order</quote> commands that are <quote>expected</quote> do
25296 not count as protocol errors (see <option>smtp_max_synprot_errors</option>).
25297 </para>
25298 <para>
25299 <indexterm role="option">
25300 <primary><option>preserve_message_logs</option></primary>
25301 </indexterm>
25302 </para>
25303 <informaltable frame="all">
25304 <tgroup cols="4" colsep="0" rowsep="0">
25305 <colspec colwidth="8*" align="left"/>
25306 <colspec colwidth="6*" align="center"/>
25307 <colspec colwidth="6*" align="center"/>
25308 <colspec colwidth="6*" align="right"/>
25309 <tbody>
25310 <row>
25311 <entry><option>preserve_message_logs</option></entry>
25312 <entry>Use: <emphasis>main</emphasis></entry>
25313 <entry>Type: <emphasis>boolean</emphasis></entry>
25314 <entry>Default: <emphasis>false</emphasis></entry>
25315 </row>
25316 </tbody>
25317 </tgroup>
25318 </informaltable>
25319 <para>
25320 <indexterm role="concept">
25321 <primary>message logs</primary>
25322 <secondary>preserving</secondary>
25323 </indexterm>
25324 If this option is set, message log files are not deleted when messages are
25325 completed. Instead, they are moved to a sub-directory of the spool directory
25326 called <filename>msglog.OLD</filename>, where they remain available for statistical or debugging
25327 purposes. This is a dangerous option to set on systems with any appreciable
25328 volume of mail. Use with care!
25329 </para>
25330 <para>
25331 <indexterm role="option">
25332 <primary><option>primary_hostname</option></primary>
25333 </indexterm>
25334 </para>
25335 <informaltable frame="all">
25336 <tgroup cols="4" colsep="0" rowsep="0">
25337 <colspec colwidth="8*" align="left"/>
25338 <colspec colwidth="6*" align="center"/>
25339 <colspec colwidth="6*" align="center"/>
25340 <colspec colwidth="6*" align="right"/>
25341 <tbody>
25342 <row>
25343 <entry><option>primary_hostname</option></entry>
25344 <entry>Use: <emphasis>main</emphasis></entry>
25345 <entry>Type: <emphasis>string</emphasis></entry>
25346 <entry>Default: <emphasis>see below</emphasis></entry>
25347 </row>
25348 </tbody>
25349 </tgroup>
25350 </informaltable>
25351 <para>
25352 <indexterm role="concept">
25353 <primary>name</primary>
25354 <secondary>of local host</secondary>
25355 </indexterm>
25356 <indexterm role="concept">
25357 <primary>host</primary>
25358 <secondary>name of local</secondary>
25359 </indexterm>
25360 <indexterm role="concept">
25361 <primary>local host</primary>
25362 <secondary>name of</secondary>
25363 </indexterm>
25364 <indexterm role="variable">
25365 <primary><varname>$primary_hostname</varname></primary>
25366 </indexterm>
25367 This specifies the name of the current host. It is used in the default EHLO or
25368 HELO command for outgoing SMTP messages (changeable via the <option>helo_data</option>
25369 option in the <command>smtp</command> transport), and as the default for <option>qualify_domain</option>.
25370 The value is also used by default in some SMTP response messages from an Exim
25371 server. This can be changed dynamically by setting <option>smtp_active_hostname</option>.
25372 </para>
25373 <para>
25374 If <option>primary_hostname</option> is not set, Exim calls <function>uname()</function> to find the host
25375 name. If this fails, Exim panics and dies. If the name returned by <function>uname()</function>
25376 contains only one component, Exim passes it to <function>gethostbyname()</function> (or
25377 <function>getipnodebyname()</function> when available) in order to obtain the fully qualified
25378 version. The variable <varname>$primary_hostname</varname> contains the host name, whether set
25379 explicitly by this option, or defaulted.
25380 </para>
25381 <para>
25382 <indexterm role="option">
25383 <primary><option>print_topbitchars</option></primary>
25384 </indexterm>
25385 </para>
25386 <informaltable frame="all">
25387 <tgroup cols="4" colsep="0" rowsep="0">
25388 <colspec colwidth="8*" align="left"/>
25389 <colspec colwidth="6*" align="center"/>
25390 <colspec colwidth="6*" align="center"/>
25391 <colspec colwidth="6*" align="right"/>
25392 <tbody>
25393 <row>
25394 <entry><option>print_topbitchars</option></entry>
25395 <entry>Use: <emphasis>main</emphasis></entry>
25396 <entry>Type: <emphasis>boolean</emphasis></entry>
25397 <entry>Default: <emphasis>false</emphasis></entry>
25398 </row>
25399 </tbody>
25400 </tgroup>
25401 </informaltable>
25402 <para>
25403 <indexterm role="concept">
25404 <primary>printing characters</primary>
25405 </indexterm>
25406 <indexterm role="concept">
25407 <primary>8-bit characters</primary>
25408 </indexterm>
25409 By default, Exim considers only those characters whose codes lie in the range
25410 32&ndash;126 to be printing characters. In a number of circumstances (for example,
25411 when writing log entries) non-printing characters are converted into escape
25412 sequences, primarily to avoid messing up the layout. If <option>print_topbitchars</option>
25413 is set, code values of 128 and above are also considered to be printing
25414 characters.
25415 </para>
25416 <para>
25417 This option also affects the header syntax checks performed by the
25418 <command>autoreply</command> transport, and whether Exim uses RFC 2047 encoding of
25419 the user&#x2019;s full name when constructing From: and Sender: addresses (as
25420 described in section <xref linkend="SECTconstr"/>). Setting this option can cause
25421 Exim to generate eight bit message headers that do not conform to the
25422 standards.
25423 </para>
25424 <para>
25425 <indexterm role="option">
25426 <primary><option>process_log_path</option></primary>
25427 </indexterm>
25428 </para>
25429 <informaltable frame="all">
25430 <tgroup cols="4" colsep="0" rowsep="0">
25431 <colspec colwidth="8*" align="left"/>
25432 <colspec colwidth="6*" align="center"/>
25433 <colspec colwidth="6*" align="center"/>
25434 <colspec colwidth="6*" align="right"/>
25435 <tbody>
25436 <row>
25437 <entry><option>process_log_path</option></entry>
25438 <entry>Use: <emphasis>main</emphasis></entry>
25439 <entry>Type: <emphasis>string</emphasis></entry>
25440 <entry>Default: <emphasis>unset</emphasis></entry>
25441 </row>
25442 </tbody>
25443 </tgroup>
25444 </informaltable>
25445 <para>
25446 <indexterm role="concept">
25447 <primary>process log path</primary>
25448 </indexterm>
25449 <indexterm role="concept">
25450 <primary>log</primary>
25451 <secondary>process log</secondary>
25452 </indexterm>
25453 <indexterm role="concept">
25454 <primary><emphasis>exiwhat</emphasis></primary>
25455 </indexterm>
25456 This option sets the name of the file to which an Exim process writes its
25457 <quote>process log</quote> when sent a USR1 signal. This is used by the <emphasis>exiwhat</emphasis>
25458 utility script. If this option is unset, the file called <filename>exim-process.info</filename>
25459 in Exim&#x2019;s spool directory is used. The ability to specify the name explicitly
25460 can be useful in environments where two different Exims are running, using
25461 different spool directories.
25462 </para>
25463 <para>
25464 <indexterm role="option">
25465 <primary><option>prod_requires_admin</option></primary>
25466 </indexterm>
25467 </para>
25468 <informaltable frame="all">
25469 <tgroup cols="4" colsep="0" rowsep="0">
25470 <colspec colwidth="8*" align="left"/>
25471 <colspec colwidth="6*" align="center"/>
25472 <colspec colwidth="6*" align="center"/>
25473 <colspec colwidth="6*" align="right"/>
25474 <tbody>
25475 <row>
25476 <entry><option>prod_requires_admin</option></entry>
25477 <entry>Use: <emphasis>main</emphasis></entry>
25478 <entry>Type: <emphasis>boolean</emphasis></entry>
25479 <entry>Default: <emphasis>true</emphasis></entry>
25480 </row>
25481 </tbody>
25482 </tgroup>
25483 </informaltable>
25484 <para>
25485 <indexterm role="option">
25486 <primary><option>-M</option></primary>
25487 </indexterm>
25488 <indexterm role="option">
25489 <primary><option>-R</option></primary>
25490 </indexterm>
25491 <indexterm role="option">
25492 <primary><option>-q</option></primary>
25493 </indexterm>
25494 The <option>-M</option>, <option>-R</option>, and <option>-q</option> command-line options require the caller to be an
25495 admin user unless <option>prod_requires_admin</option> is set false. See also
25496 <option>queue_list_requires_admin</option>.
25497 </para>
25498 <para>
25499 <indexterm role="option">
25500 <primary><option>qualify_domain</option></primary>
25501 </indexterm>
25502 </para>
25503 <informaltable frame="all">
25504 <tgroup cols="4" colsep="0" rowsep="0">
25505 <colspec colwidth="8*" align="left"/>
25506 <colspec colwidth="6*" align="center"/>
25507 <colspec colwidth="6*" align="center"/>
25508 <colspec colwidth="6*" align="right"/>
25509 <tbody>
25510 <row>
25511 <entry><option>qualify_domain</option></entry>
25512 <entry>Use: <emphasis>main</emphasis></entry>
25513 <entry>Type: <emphasis>string</emphasis></entry>
25514 <entry>Default: <emphasis>see below</emphasis></entry>
25515 </row>
25516 </tbody>
25517 </tgroup>
25518 </informaltable>
25519 <para>
25520 <indexterm role="concept">
25521 <primary>domain</primary>
25522 <secondary>for qualifying addresses</secondary>
25523 </indexterm>
25524 <indexterm role="concept">
25525 <primary>address</primary>
25526 <secondary>qualification</secondary>
25527 </indexterm>
25528 This option specifies the domain name that is added to any envelope sender
25529 addresses that do not have a domain qualification. It also applies to
25530 recipient addresses if <option>qualify_recipient</option> is not set. Unqualified addresses
25531 are accepted by default only for locally-generated messages. Qualification is
25532 also applied to addresses in header lines such as <emphasis>From:</emphasis> and <emphasis>To:</emphasis> for
25533 locally-generated messages, unless the <option>-bnq</option> command line option is used.
25534 </para>
25535 <para>
25536 Messages from external sources must always contain fully qualified addresses,
25537 unless the sending host matches <option>sender_unqualified_hosts</option> or
25538 <option>recipient_unqualified_hosts</option> (as appropriate), in which case incoming
25539 addresses are qualified with <option>qualify_domain</option> or <option>qualify_recipient</option> as
25540 necessary. Internally, Exim always works with fully qualified envelope
25541 addresses. If <option>qualify_domain</option> is not set, it defaults to the
25542 <option>primary_hostname</option> value.
25543 </para>
25544 <para>
25545 <indexterm role="option">
25546 <primary><option>qualify_recipient</option></primary>
25547 </indexterm>
25548 </para>
25549 <informaltable frame="all">
25550 <tgroup cols="4" colsep="0" rowsep="0">
25551 <colspec colwidth="8*" align="left"/>
25552 <colspec colwidth="6*" align="center"/>
25553 <colspec colwidth="6*" align="center"/>
25554 <colspec colwidth="6*" align="right"/>
25555 <tbody>
25556 <row>
25557 <entry><option>qualify_recipient</option></entry>
25558 <entry>Use: <emphasis>main</emphasis></entry>
25559 <entry>Type: <emphasis>string</emphasis></entry>
25560 <entry>Default: <emphasis>see below</emphasis></entry>
25561 </row>
25562 </tbody>
25563 </tgroup>
25564 </informaltable>
25565 <para>
25566 This option allows you to specify a different domain for qualifying recipient
25567 addresses to the one that is used for senders. See <option>qualify_domain</option> above.
25568 </para>
25569 <para>
25570 <indexterm role="option">
25571 <primary><option>queue_domains</option></primary>
25572 </indexterm>
25573 </para>
25574 <informaltable frame="all">
25575 <tgroup cols="4" colsep="0" rowsep="0">
25576 <colspec colwidth="8*" align="left"/>
25577 <colspec colwidth="6*" align="center"/>
25578 <colspec colwidth="6*" align="center"/>
25579 <colspec colwidth="6*" align="right"/>
25580 <tbody>
25581 <row>
25582 <entry><option>queue_domains</option></entry>
25583 <entry>Use: <emphasis>main</emphasis></entry>
25584 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
25585 <entry>Default: <emphasis>unset</emphasis></entry>
25586 </row>
25587 </tbody>
25588 </tgroup>
25589 </informaltable>
25590 <para>
25591 <indexterm role="concept">
25592 <primary>domain</primary>
25593 <secondary>specifying non-immediate delivery</secondary>
25594 </indexterm>
25595 <indexterm role="concept">
25596 <primary>queueing incoming messages</primary>
25597 </indexterm>
25598 <indexterm role="concept">
25599 <primary>message</primary>
25600 <secondary>queueing certain domains</secondary>
25601 </indexterm>
25602 This option lists domains for which immediate delivery is not required.
25603 A delivery process is started whenever a message is received, but only those
25604 domains that do not match are processed. All other deliveries wait until the
25605 next queue run. See also <option>hold_domains</option> and <option>queue_smtp_domains</option>.
25606 </para>
25607 <para>
25608 <indexterm role="option">
25609 <primary><option>queue_list_requires_admin</option></primary>
25610 </indexterm>
25611 </para>
25612 <informaltable frame="all">
25613 <tgroup cols="4" colsep="0" rowsep="0">
25614 <colspec colwidth="8*" align="left"/>
25615 <colspec colwidth="6*" align="center"/>
25616 <colspec colwidth="6*" align="center"/>
25617 <colspec colwidth="6*" align="right"/>
25618 <tbody>
25619 <row>
25620 <entry><option>queue_list_requires_admin</option></entry>
25621 <entry>Use: <emphasis>main</emphasis></entry>
25622 <entry>Type: <emphasis>boolean</emphasis></entry>
25623 <entry>Default: <emphasis>true</emphasis></entry>
25624 </row>
25625 </tbody>
25626 </tgroup>
25627 </informaltable>
25628 <para>
25629 <indexterm role="option">
25630 <primary><option>-bp</option></primary>
25631 </indexterm>
25632 The <option>-bp</option> command-line option, which lists the messages that are on the
25633 queue, requires the caller to be an admin user unless
25634 <option>queue_list_requires_admin</option> is set false. See also <option>prod_requires_admin</option>.
25635 </para>
25636 <para>
25637 <indexterm role="option">
25638 <primary><option>queue_only</option></primary>
25639 </indexterm>
25640 </para>
25641 <informaltable frame="all">
25642 <tgroup cols="4" colsep="0" rowsep="0">
25643 <colspec colwidth="8*" align="left"/>
25644 <colspec colwidth="6*" align="center"/>
25645 <colspec colwidth="6*" align="center"/>
25646 <colspec colwidth="6*" align="right"/>
25647 <tbody>
25648 <row>
25649 <entry><option>queue_only</option></entry>
25650 <entry>Use: <emphasis>main</emphasis></entry>
25651 <entry>Type: <emphasis>boolean</emphasis></entry>
25652 <entry>Default: <emphasis>false</emphasis></entry>
25653 </row>
25654 </tbody>
25655 </tgroup>
25656 </informaltable>
25657 <para>
25658 <indexterm role="concept">
25659 <primary>queueing incoming messages</primary>
25660 </indexterm>
25661 <indexterm role="concept">
25662 <primary>message</primary>
25663 <secondary>queueing unconditionally</secondary>
25664 </indexterm>
25665 If <option>queue_only</option> is set, a delivery process is not automatically started
25666 whenever a message is received. Instead, the message waits on the queue for the
25667 next queue run. Even if <option>queue_only</option> is false, incoming messages may not get
25668 delivered immediately when certain conditions (such as heavy load) occur.
25669 </para>
25670 <para>
25671 The <option>-odq</option> command line has the same effect as <option>queue_only</option>. The <option>-odb</option>
25672 and <option>-odi</option> command line options override <option>queue_only</option> unless
25673 <option>queue_only_override</option> is set false. See also <option>queue_only_file</option>,
25674 <option>queue_only_load</option>, and <option>smtp_accept_queue</option>.
25675 </para>
25676 <para>
25677 <indexterm role="option">
25678 <primary><option>queue_only_file</option></primary>
25679 </indexterm>
25680 </para>
25681 <informaltable frame="all">
25682 <tgroup cols="4" colsep="0" rowsep="0">
25683 <colspec colwidth="8*" align="left"/>
25684 <colspec colwidth="6*" align="center"/>
25685 <colspec colwidth="6*" align="center"/>
25686 <colspec colwidth="6*" align="right"/>
25687 <tbody>
25688 <row>
25689 <entry><option>queue_only_file</option></entry>
25690 <entry>Use: <emphasis>main</emphasis></entry>
25691 <entry>Type: <emphasis>string</emphasis></entry>
25692 <entry>Default: <emphasis>unset</emphasis></entry>
25693 </row>
25694 </tbody>
25695 </tgroup>
25696 </informaltable>
25697 <para>
25698 <indexterm role="concept">
25699 <primary>queueing incoming messages</primary>
25700 </indexterm>
25701 <indexterm role="concept">
25702 <primary>message</primary>
25703 <secondary>queueing by file existence</secondary>
25704 </indexterm>
25705 This option can be set to a colon-separated list of absolute path names, each
25706 one optionally preceded by <quote>smtp</quote>. When Exim is receiving a message,
25707 it tests for the existence of each listed path using a call to <function>stat()</function>. For
25708 each path that exists, the corresponding queueing option is set.
25709 For paths with no prefix, <option>queue_only</option> is set; for paths prefixed by
25710 <quote>smtp</quote>, <option>queue_smtp_domains</option> is set to match all domains. So, for example,
25711 </para>
25712 <literallayout class="monospaced">
25713 queue_only_file = smtp/some/file
25714 </literallayout>
25715 <para>
25716 causes Exim to behave as if <option>queue_smtp_domains</option> were set to <quote>*</quote> whenever
25717 <filename>/some/file</filename> exists.
25718 </para>
25719 <para>
25720 <indexterm role="option">
25721 <primary><option>queue_only_load</option></primary>
25722 </indexterm>
25723 </para>
25724 <informaltable frame="all">
25725 <tgroup cols="4" colsep="0" rowsep="0">
25726 <colspec colwidth="8*" align="left"/>
25727 <colspec colwidth="6*" align="center"/>
25728 <colspec colwidth="6*" align="center"/>
25729 <colspec colwidth="6*" align="right"/>
25730 <tbody>
25731 <row>
25732 <entry><option>queue_only_load</option></entry>
25733 <entry>Use: <emphasis>main</emphasis></entry>
25734 <entry>Type: <emphasis>fixed-point</emphasis></entry>
25735 <entry>Default: <emphasis>unset</emphasis></entry>
25736 </row>
25737 </tbody>
25738 </tgroup>
25739 </informaltable>
25740 <para>
25741 <indexterm role="concept">
25742 <primary>load average</primary>
25743 </indexterm>
25744 <indexterm role="concept">
25745 <primary>queueing incoming messages</primary>
25746 </indexterm>
25747 <indexterm role="concept">
25748 <primary>message</primary>
25749 <secondary>queueing by load</secondary>
25750 </indexterm>
25751 If the system load average is higher than this value, incoming messages from
25752 all sources are queued, and no automatic deliveries are started. If this
25753 happens during local or remote SMTP input, all subsequent messages received on
25754 the same SMTP connection are queued by default, whatever happens to the load in
25755 the meantime, but this can be changed by setting <option>queue_only_load_latch</option>
25756 false.
25757 </para>
25758 <para>
25759 Deliveries will subsequently be performed by queue runner processes. This
25760 option has no effect on ancient operating systems on which Exim cannot
25761 determine the load average. See also <option>deliver_queue_load_max</option> and
25762 <option>smtp_load_reserve</option>.
25763 </para>
25764 <para>
25765 <indexterm role="option">
25766 <primary><option>queue_only_load_latch</option></primary>
25767 </indexterm>
25768 </para>
25769 <informaltable frame="all">
25770 <tgroup cols="4" colsep="0" rowsep="0">
25771 <colspec colwidth="8*" align="left"/>
25772 <colspec colwidth="6*" align="center"/>
25773 <colspec colwidth="6*" align="center"/>
25774 <colspec colwidth="6*" align="right"/>
25775 <tbody>
25776 <row>
25777 <entry><option>queue_only_load_latch</option></entry>
25778 <entry>Use: <emphasis>main</emphasis></entry>
25779 <entry>Type: <emphasis>boolean</emphasis></entry>
25780 <entry>Default: <emphasis>true</emphasis></entry>
25781 </row>
25782 </tbody>
25783 </tgroup>
25784 </informaltable>
25785 <para>
25786 <indexterm role="concept">
25787 <primary>load average</primary>
25788 <secondary>re-evaluating per message</secondary>
25789 </indexterm>
25790 When this option is true (the default), once one message has been queued
25791 because the load average is higher than the value set by <option>queue_only_load</option>,
25792 all subsequent messages received on the same SMTP connection are also queued.
25793 This is a deliberate choice; even though the load average may fall below the
25794 threshold, it doesn&#x2019;t seem right to deliver later messages on the same
25795 connection when not delivering earlier ones. However, there are special
25796 circumstances such as very long-lived connections from scanning appliances
25797 where this is not the best strategy. In such cases, <option>queue_only_load_latch</option>
25798 should be set false. This causes the value of the load average to be
25799 re-evaluated for each message.
25800 </para>
25801 <para>
25802 <indexterm role="option">
25803 <primary><option>queue_only_override</option></primary>
25804 </indexterm>
25805 </para>
25806 <informaltable frame="all">
25807 <tgroup cols="4" colsep="0" rowsep="0">
25808 <colspec colwidth="8*" align="left"/>
25809 <colspec colwidth="6*" align="center"/>
25810 <colspec colwidth="6*" align="center"/>
25811 <colspec colwidth="6*" align="right"/>
25812 <tbody>
25813 <row>
25814 <entry><option>queue_only_override</option></entry>
25815 <entry>Use: <emphasis>main</emphasis></entry>
25816 <entry>Type: <emphasis>boolean</emphasis></entry>
25817 <entry>Default: <emphasis>true</emphasis></entry>
25818 </row>
25819 </tbody>
25820 </tgroup>
25821 </informaltable>
25822 <para>
25823 <indexterm role="concept">
25824 <primary>queueing incoming messages</primary>
25825 </indexterm>
25826 When this option is true, the <option>-od</option><emphasis>x</emphasis> command line options override the
25827 setting of <option>queue_only</option> or <option>queue_only_file</option> in the configuration file. If
25828 <option>queue_only_override</option> is set false, the <option>-od</option><emphasis>x</emphasis> options cannot be used
25829 to override; they are accepted, but ignored.
25830 </para>
25831 <para>
25832 <indexterm role="option">
25833 <primary><option>queue_run_in_order</option></primary>
25834 </indexterm>
25835 </para>
25836 <informaltable frame="all">
25837 <tgroup cols="4" colsep="0" rowsep="0">
25838 <colspec colwidth="8*" align="left"/>
25839 <colspec colwidth="6*" align="center"/>
25840 <colspec colwidth="6*" align="center"/>
25841 <colspec colwidth="6*" align="right"/>
25842 <tbody>
25843 <row>
25844 <entry><option>queue_run_in_order</option></entry>
25845 <entry>Use: <emphasis>main</emphasis></entry>
25846 <entry>Type: <emphasis>boolean</emphasis></entry>
25847 <entry>Default: <emphasis>false</emphasis></entry>
25848 </row>
25849 </tbody>
25850 </tgroup>
25851 </informaltable>
25852 <para>
25853 <indexterm role="concept">
25854 <primary>queue runner</primary>
25855 <secondary>processing messages in order</secondary>
25856 </indexterm>
25857 If this option is set, queue runs happen in order of message arrival instead of
25858 in an arbitrary order. For this to happen, a complete list of the entire queue
25859 must be set up before the deliveries start. When the queue is all held in a
25860 single directory (the default), a single list is created for both the ordered
25861 and the non-ordered cases. However, if <option>split_spool_directory</option> is set, a
25862 single list is not created when <option>queue_run_in_order</option> is false. In this case,
25863 the sub-directories are processed one at a time (in a random order), and this
25864 avoids setting up one huge list for the whole queue. Thus, setting
25865 <option>queue_run_in_order</option> with <option>split_spool_directory</option> may degrade performance
25866 when the queue is large, because of the extra work in setting up the single,
25867 large list. In most situations, <option>queue_run_in_order</option> should not be set.
25868 </para>
25869 <para>
25870 <indexterm role="option">
25871 <primary><option>queue_run_max</option></primary>
25872 </indexterm>
25873 </para>
25874 <informaltable frame="all">
25875 <tgroup cols="4" colsep="0" rowsep="0">
25876 <colspec colwidth="8*" align="left"/>
25877 <colspec colwidth="6*" align="center"/>
25878 <colspec colwidth="6*" align="center"/>
25879 <colspec colwidth="6*" align="right"/>
25880 <tbody>
25881 <row>
25882 <entry><option>queue_run_max</option></entry>
25883 <entry>Use: <emphasis>main</emphasis></entry>
25884 <entry>Type: <emphasis>integer</emphasis></entry>
25885 <entry>Default: <emphasis>5</emphasis></entry>
25886 </row>
25887 </tbody>
25888 </tgroup>
25889 </informaltable>
25890 <para>
25891 <indexterm role="concept">
25892 <primary>queue runner</primary>
25893 <secondary>maximum number of</secondary>
25894 </indexterm>
25895 This controls the maximum number of queue runner processes that an Exim daemon
25896 can run simultaneously. This does not mean that it starts them all at once,
25897 but rather that if the maximum number are still running when the time comes to
25898 start another one, it refrains from starting another one. This can happen with
25899 very large queues and/or very sluggish deliveries. This option does not,
25900 however, interlock with other processes, so additional queue runners can be
25901 started by other means, or by killing and restarting the daemon.
25902 </para>
25903 <para>
25904 Setting this option to zero does not suppress queue runs; rather, it disables
25905 the limit, allowing any number of simultaneous queue runner processes to be
25906 run. If you do not want queue runs to occur, omit the <option>-q</option><emphasis>xx</emphasis> setting on
25907 the daemon&#x2019;s command line.
25908 </para>
25909 <para>
25910 <indexterm role="option">
25911 <primary><option>queue_smtp_domains</option></primary>
25912 </indexterm>
25913 </para>
25914 <informaltable frame="all">
25915 <tgroup cols="4" colsep="0" rowsep="0">
25916 <colspec colwidth="8*" align="left"/>
25917 <colspec colwidth="6*" align="center"/>
25918 <colspec colwidth="6*" align="center"/>
25919 <colspec colwidth="6*" align="right"/>
25920 <tbody>
25921 <row>
25922 <entry><option>queue_smtp_domains</option></entry>
25923 <entry>Use: <emphasis>main</emphasis></entry>
25924 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
25925 <entry>Default: <emphasis>unset</emphasis></entry>
25926 </row>
25927 </tbody>
25928 </tgroup>
25929 </informaltable>
25930 <para>
25931 <indexterm role="concept">
25932 <primary>queueing incoming messages</primary>
25933 </indexterm>
25934 <indexterm role="concept">
25935 <primary>message</primary>
25936 <secondary>queueing remote deliveries</secondary>
25937 </indexterm>
25938 When this option is set, a delivery process is started whenever a message is
25939 received, routing is performed, and local deliveries take place.
25940 However, if any SMTP deliveries are required for domains that match
25941 <option>queue_smtp_domains</option>, they are not immediately delivered, but instead the
25942 message waits on the queue for the next queue run. Since routing of the message
25943 has taken place, Exim knows to which remote hosts it must be delivered, and so
25944 when the queue run happens, multiple messages for the same host are delivered
25945 over a single SMTP connection. The <option>-odqs</option> command line option causes all
25946 SMTP deliveries to be queued in this way, and is equivalent to setting
25947 <option>queue_smtp_domains</option> to <quote>*</quote>. See also <option>hold_domains</option> and
25948 <option>queue_domains</option>.
25949 </para>
25950 <para>
25951 <indexterm role="option">
25952 <primary><option>receive_timeout</option></primary>
25953 </indexterm>
25954 </para>
25955 <informaltable frame="all">
25956 <tgroup cols="4" colsep="0" rowsep="0">
25957 <colspec colwidth="8*" align="left"/>
25958 <colspec colwidth="6*" align="center"/>
25959 <colspec colwidth="6*" align="center"/>
25960 <colspec colwidth="6*" align="right"/>
25961 <tbody>
25962 <row>
25963 <entry><option>receive_timeout</option></entry>
25964 <entry>Use: <emphasis>main</emphasis></entry>
25965 <entry>Type: <emphasis>time</emphasis></entry>
25966 <entry>Default: <emphasis>0s</emphasis></entry>
25967 </row>
25968 </tbody>
25969 </tgroup>
25970 </informaltable>
25971 <para>
25972 <indexterm role="concept">
25973 <primary>timeout</primary>
25974 <secondary>for non-SMTP input</secondary>
25975 </indexterm>
25976 This option sets the timeout for accepting a non-SMTP message, that is, the
25977 maximum time that Exim waits when reading a message on the standard input. If
25978 the value is zero, it will wait for ever. This setting is overridden by the
25979 <option>-or</option> command line option. The timeout for incoming SMTP messages is
25980 controlled by <option>smtp_receive_timeout</option>.
25981 </para>
25982 <para>
25983 <indexterm role="option">
25984 <primary><option>received_header_text</option></primary>
25985 </indexterm>
25986 </para>
25987 <informaltable frame="all">
25988 <tgroup cols="4" colsep="0" rowsep="0">
25989 <colspec colwidth="8*" align="left"/>
25990 <colspec colwidth="6*" align="center"/>
25991 <colspec colwidth="6*" align="center"/>
25992 <colspec colwidth="6*" align="right"/>
25993 <tbody>
25994 <row>
25995 <entry><option>received_header_text</option></entry>
25996 <entry>Use: <emphasis>main</emphasis></entry>
25997 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25998 <entry>Default: <emphasis>see below</emphasis></entry>
25999 </row>
26000 </tbody>
26001 </tgroup>
26002 </informaltable>
26003 <para>
26004 <indexterm role="concept">
26005 <primary>customizing</primary>
26006 <secondary><emphasis>Received:</emphasis> header</secondary>
26007 </indexterm>
26008 <indexterm role="concept">
26009 <primary><emphasis>Received:</emphasis> header line</primary>
26010 <secondary>customizing</secondary>
26011 </indexterm>
26012 This string defines the contents of the <emphasis>Received:</emphasis> message header that is
26013 added to each message, except for the timestamp, which is automatically added
26014 on at the end (preceded by a semicolon). The string is expanded each time it is
26015 used. If the expansion yields an empty string, no <emphasis>Received:</emphasis> header line is
26016 added to the message. Otherwise, the string should start with the text
26017 <quote>Received:</quote> and conform to the RFC 2822 specification for <emphasis>Received:</emphasis>
26018 header lines. The default setting is:
26019 </para>
26020 <literallayout class="monospaced">
26021 received_header_text = Received: \
26022   ${if def:sender_rcvhost {from $sender_rcvhost\n\t}\
26023   {${if def:sender_ident \
26024   {from ${quote_local_part:$sender_ident} }}\
26025   ${if def:sender_helo_name {(helo=$sender_helo_name)\n\t}}}}\
26026   by $primary_hostname \
26027   ${if def:received_protocol {with $received_protocol}} \
26028   ${if def:tls_cipher {($tls_cipher)\n\t}}\
26029   (Exim $version_number)\n\t\
26030   ${if def:sender_address \
26031   {(envelope-from &lt;$sender_address&gt;)\n\t}}\
26032   id $message_exim_id\
26033   ${if def:received_for {\n\tfor $received_for}}
26034 </literallayout>
26035 <para>
26036 The reference to the TLS cipher is omitted when Exim is built without TLS
26037 support. The use of conditional expansions ensures that this works for both
26038 locally generated messages and messages received from remote hosts, giving
26039 header lines such as the following:
26040 </para>
26041 <literallayout class="monospaced">
26042 Received: from scrooge.carol.example ([192.168.12.25] ident=root)
26043 by marley.carol.example with esmtp (Exim 4.00)
26044 (envelope-from &lt;bob@carol.example&gt;)
26045 id 16IOWa-00019l-00
26046 for chas@dickens.example; Tue, 25 Dec 2001 14:43:44 +0000
26047 Received: by scrooge.carol.example with local (Exim 4.00)
26048 id 16IOWW-000083-00; Tue, 25 Dec 2001 14:43:41 +0000
26049 </literallayout>
26050 <para>
26051 Until the body of the message has been received, the timestamp is the time when
26052 the message started to be received. Once the body has arrived, and all policy
26053 checks have taken place, the timestamp is updated to the time at which the
26054 message was accepted.
26055 </para>
26056 <para>
26057 <indexterm role="option">
26058 <primary><option>received_headers_max</option></primary>
26059 </indexterm>
26060 </para>
26061 <informaltable frame="all">
26062 <tgroup cols="4" colsep="0" rowsep="0">
26063 <colspec colwidth="8*" align="left"/>
26064 <colspec colwidth="6*" align="center"/>
26065 <colspec colwidth="6*" align="center"/>
26066 <colspec colwidth="6*" align="right"/>
26067 <tbody>
26068 <row>
26069 <entry><option>received_headers_max</option></entry>
26070 <entry>Use: <emphasis>main</emphasis></entry>
26071 <entry>Type: <emphasis>integer</emphasis></entry>
26072 <entry>Default: <emphasis>30</emphasis></entry>
26073 </row>
26074 </tbody>
26075 </tgroup>
26076 </informaltable>
26077 <para>
26078 <indexterm role="concept">
26079 <primary>loop</primary>
26080 <secondary>prevention</secondary>
26081 </indexterm>
26082 <indexterm role="concept">
26083 <primary>mail loop prevention</primary>
26084 </indexterm>
26085 <indexterm role="concept">
26086 <primary><emphasis>Received:</emphasis> header line</primary>
26087 <secondary>counting</secondary>
26088 </indexterm>
26089 When a message is to be delivered, the number of <emphasis>Received:</emphasis> headers is
26090 counted, and if it is greater than this parameter, a mail loop is assumed to
26091 have occurred, the delivery is abandoned, and an error message is generated.
26092 This applies to both local and remote deliveries.
26093 </para>
26094 <para>
26095 <indexterm role="option">
26096 <primary><option>recipient_unqualified_hosts</option></primary>
26097 </indexterm>
26098 </para>
26099 <informaltable frame="all">
26100 <tgroup cols="4" colsep="0" rowsep="0">
26101 <colspec colwidth="8*" align="left"/>
26102 <colspec colwidth="6*" align="center"/>
26103 <colspec colwidth="6*" align="center"/>
26104 <colspec colwidth="6*" align="right"/>
26105 <tbody>
26106 <row>
26107 <entry><option>recipient_unqualified_hosts</option></entry>
26108 <entry>Use: <emphasis>main</emphasis></entry>
26109 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26110 <entry>Default: <emphasis>unset</emphasis></entry>
26111 </row>
26112 </tbody>
26113 </tgroup>
26114 </informaltable>
26115 <para>
26116 <indexterm role="concept">
26117 <primary>unqualified addresses</primary>
26118 </indexterm>
26119 <indexterm role="concept">
26120 <primary>host</primary>
26121 <secondary>unqualified addresses from</secondary>
26122 </indexterm>
26123 This option lists those hosts from which Exim is prepared to accept unqualified
26124 recipient addresses in message envelopes. The addresses are made fully
26125 qualified by the addition of the <option>qualify_recipient</option> value. This option also
26126 affects message header lines. Exim does not reject unqualified recipient
26127 addresses in headers, but it qualifies them only if the message came from a
26128 host that matches <option>recipient_unqualified_hosts</option>,
26129 or if the message was submitted locally (not using TCP/IP), and the <option>-bnq</option>
26130 option was not set.
26131 </para>
26132 <para>
26133 <indexterm role="option">
26134 <primary><option>recipients_max</option></primary>
26135 </indexterm>
26136 </para>
26137 <informaltable frame="all">
26138 <tgroup cols="4" colsep="0" rowsep="0">
26139 <colspec colwidth="8*" align="left"/>
26140 <colspec colwidth="6*" align="center"/>
26141 <colspec colwidth="6*" align="center"/>
26142 <colspec colwidth="6*" align="right"/>
26143 <tbody>
26144 <row>
26145 <entry><option>recipients_max</option></entry>
26146 <entry>Use: <emphasis>main</emphasis></entry>
26147 <entry>Type: <emphasis>integer</emphasis></entry>
26148 <entry>Default: <emphasis>0</emphasis></entry>
26149 </row>
26150 </tbody>
26151 </tgroup>
26152 </informaltable>
26153 <para>
26154 <indexterm role="concept">
26155 <primary>limit</primary>
26156 <secondary>number of recipients</secondary>
26157 </indexterm>
26158 <indexterm role="concept">
26159 <primary>recipient</primary>
26160 <secondary>maximum number</secondary>
26161 </indexterm>
26162 If this option is set greater than zero, it specifies the maximum number of
26163 original recipients for any message. Additional recipients that are generated
26164 by aliasing or forwarding do not count. SMTP messages get a 452 response for
26165 all recipients over the limit; earlier recipients are delivered as normal.
26166 Non-SMTP messages with too many recipients are failed, and no deliveries are
26167 done.
26168 </para>
26169 <para>
26170 <indexterm role="concept">
26171 <primary>RCPT</primary>
26172 <secondary>maximum number of incoming</secondary>
26173 </indexterm>
26174 <emphasis role="bold">Note</emphasis>: The RFCs specify that an SMTP server should accept at least 100
26175 RCPT commands in a single message.
26176 </para>
26177 <para>
26178 <indexterm role="option">
26179 <primary><option>recipients_max_reject</option></primary>
26180 </indexterm>
26181 </para>
26182 <informaltable frame="all">
26183 <tgroup cols="4" colsep="0" rowsep="0">
26184 <colspec colwidth="8*" align="left"/>
26185 <colspec colwidth="6*" align="center"/>
26186 <colspec colwidth="6*" align="center"/>
26187 <colspec colwidth="6*" align="right"/>
26188 <tbody>
26189 <row>
26190 <entry><option>recipients_max_reject</option></entry>
26191 <entry>Use: <emphasis>main</emphasis></entry>
26192 <entry>Type: <emphasis>boolean</emphasis></entry>
26193 <entry>Default: <emphasis>false</emphasis></entry>
26194 </row>
26195 </tbody>
26196 </tgroup>
26197 </informaltable>
26198 <para>
26199 If this option is set true, Exim rejects SMTP messages containing too many
26200 recipients by giving 552 errors to the surplus RCPT commands, and a 554
26201 error to the eventual DATA command. Otherwise (the default) it gives a 452
26202 error to the surplus RCPT commands and accepts the message on behalf of the
26203 initial set of recipients. The remote server should then re-send the message
26204 for the remaining recipients at a later time.
26205 </para>
26206 <para>
26207 <indexterm role="option">
26208 <primary><option>remote_max_parallel</option></primary>
26209 </indexterm>
26210 </para>
26211 <informaltable frame="all">
26212 <tgroup cols="4" colsep="0" rowsep="0">
26213 <colspec colwidth="8*" align="left"/>
26214 <colspec colwidth="6*" align="center"/>
26215 <colspec colwidth="6*" align="center"/>
26216 <colspec colwidth="6*" align="right"/>
26217 <tbody>
26218 <row>
26219 <entry><option>remote_max_parallel</option></entry>
26220 <entry>Use: <emphasis>main</emphasis></entry>
26221 <entry>Type: <emphasis>integer</emphasis></entry>
26222 <entry>Default: <emphasis>2</emphasis></entry>
26223 </row>
26224 </tbody>
26225 </tgroup>
26226 </informaltable>
26227 <para>
26228 <indexterm role="concept">
26229 <primary>delivery</primary>
26230 <secondary>parallelism for remote</secondary>
26231 </indexterm>
26232 This option controls parallel delivery of one message to a number of remote
26233 hosts. If the value is less than 2, parallel delivery is disabled, and Exim
26234 does all the remote deliveries for a message one by one. Otherwise, if a single
26235 message has to be delivered to more than one remote host, or if several copies
26236 have to be sent to the same remote host, up to <option>remote_max_parallel</option>
26237 deliveries are done simultaneously. If more than <option>remote_max_parallel</option>
26238 deliveries are required, the maximum number of processes are started, and as
26239 each one finishes, another is begun. The order of starting processes is the
26240 same as if sequential delivery were being done, and can be controlled by the
26241 <option>remote_sort_domains</option> option. If parallel delivery takes place while running
26242 with debugging turned on, the debugging output from each delivery process is
26243 tagged with its process id.
26244 </para>
26245 <para>
26246 This option controls only the maximum number of parallel deliveries for one
26247 message in one Exim delivery process. Because Exim has no central queue
26248 manager, there is no way of controlling the total number of simultaneous
26249 deliveries if the configuration allows a delivery attempt as soon as a message
26250 is received.
26251 </para>
26252 <para>
26253 <indexterm role="concept">
26254 <primary>number of deliveries</primary>
26255 </indexterm>
26256 <indexterm role="concept">
26257 <primary>delivery</primary>
26258 <secondary>maximum number of</secondary>
26259 </indexterm>
26260 If you want to control the total number of deliveries on the system, you
26261 need to set the <option>queue_only</option> option. This ensures that all incoming messages
26262 are added to the queue without starting a delivery process. Then set up an Exim
26263 daemon to start queue runner processes at appropriate intervals (probably
26264 fairly often, for example, every minute), and limit the total number of queue
26265 runners by setting the <option>queue_run_max</option> parameter. Because each queue runner
26266 delivers only one message at a time, the maximum number of deliveries that can
26267 then take place at once is <option>queue_run_max</option> multiplied by
26268 <option>remote_max_parallel</option>.
26269 </para>
26270 <para>
26271 If it is purely remote deliveries you want to control, use
26272 <option>queue_smtp_domains</option> instead of <option>queue_only</option>. This has the added benefit of
26273 doing the SMTP routing before queueing, so that several messages for the same
26274 host will eventually get delivered down the same connection.
26275 </para>
26276 <para>
26277 <indexterm role="option">
26278 <primary><option>remote_sort_domains</option></primary>
26279 </indexterm>
26280 </para>
26281 <informaltable frame="all">
26282 <tgroup cols="4" colsep="0" rowsep="0">
26283 <colspec colwidth="8*" align="left"/>
26284 <colspec colwidth="6*" align="center"/>
26285 <colspec colwidth="6*" align="center"/>
26286 <colspec colwidth="6*" align="right"/>
26287 <tbody>
26288 <row>
26289 <entry><option>remote_sort_domains</option></entry>
26290 <entry>Use: <emphasis>main</emphasis></entry>
26291 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
26292 <entry>Default: <emphasis>unset</emphasis></entry>
26293 </row>
26294 </tbody>
26295 </tgroup>
26296 </informaltable>
26297 <para>
26298 <indexterm role="concept">
26299 <primary>sorting remote deliveries</primary>
26300 </indexterm>
26301 <indexterm role="concept">
26302 <primary>delivery</primary>
26303 <secondary>sorting remote</secondary>
26304 </indexterm>
26305 When there are a number of remote deliveries for a message, they are sorted by
26306 domain into the order given by this list. For example,
26307 </para>
26308 <literallayout class="monospaced">
26309 remote_sort_domains = *.cam.ac.uk:*.uk
26310 </literallayout>
26311 <para>
26312 would attempt to deliver to all addresses in the <emphasis>cam.ac.uk</emphasis> domain first,
26313 then to those in the <option>uk</option> domain, then to any others.
26314 </para>
26315 <para>
26316 <indexterm role="option">
26317 <primary><option>retry_data_expire</option></primary>
26318 </indexterm>
26319 </para>
26320 <informaltable frame="all">
26321 <tgroup cols="4" colsep="0" rowsep="0">
26322 <colspec colwidth="8*" align="left"/>
26323 <colspec colwidth="6*" align="center"/>
26324 <colspec colwidth="6*" align="center"/>
26325 <colspec colwidth="6*" align="right"/>
26326 <tbody>
26327 <row>
26328 <entry><option>retry_data_expire</option></entry>
26329 <entry>Use: <emphasis>main</emphasis></entry>
26330 <entry>Type: <emphasis>time</emphasis></entry>
26331 <entry>Default: <emphasis>7d</emphasis></entry>
26332 </row>
26333 </tbody>
26334 </tgroup>
26335 </informaltable>
26336 <para>
26337 <indexterm role="concept">
26338 <primary>hints database</primary>
26339 <secondary>data expiry</secondary>
26340 </indexterm>
26341 This option sets a <quote>use before</quote> time on retry information in Exim&#x2019;s hints
26342 database. Any older retry data is ignored. This means that, for example, once a
26343 host has not been tried for 7 days, Exim behaves as if it has no knowledge of
26344 past failures.
26345 </para>
26346 <para>
26347 <indexterm role="option">
26348 <primary><option>retry_interval_max</option></primary>
26349 </indexterm>
26350 </para>
26351 <informaltable frame="all">
26352 <tgroup cols="4" colsep="0" rowsep="0">
26353 <colspec colwidth="8*" align="left"/>
26354 <colspec colwidth="6*" align="center"/>
26355 <colspec colwidth="6*" align="center"/>
26356 <colspec colwidth="6*" align="right"/>
26357 <tbody>
26358 <row>
26359 <entry><option>retry_interval_max</option></entry>
26360 <entry>Use: <emphasis>main</emphasis></entry>
26361 <entry>Type: <emphasis>time</emphasis></entry>
26362 <entry>Default: <emphasis>24h</emphasis></entry>
26363 </row>
26364 </tbody>
26365 </tgroup>
26366 </informaltable>
26367 <para>
26368 <indexterm role="concept">
26369 <primary>retry</primary>
26370 <secondary>limit on interval</secondary>
26371 </indexterm>
26372 <indexterm role="concept">
26373 <primary>limit</primary>
26374 <secondary>on retry interval</secondary>
26375 </indexterm>
26376 Chapter <xref linkend="CHAPretry"/> describes Exim&#x2019;s mechanisms for controlling the
26377 intervals between delivery attempts for messages that cannot be delivered
26378 straight away. This option sets an overall limit to the length of time between
26379 retries. It cannot be set greater than 24 hours; any attempt to do so forces
26380 the default value.
26381 </para>
26382 <para>
26383 <indexterm role="option">
26384 <primary><option>return_path_remove</option></primary>
26385 </indexterm>
26386 </para>
26387 <informaltable frame="all">
26388 <tgroup cols="4" colsep="0" rowsep="0">
26389 <colspec colwidth="8*" align="left"/>
26390 <colspec colwidth="6*" align="center"/>
26391 <colspec colwidth="6*" align="center"/>
26392 <colspec colwidth="6*" align="right"/>
26393 <tbody>
26394 <row>
26395 <entry><option>return_path_remove</option></entry>
26396 <entry>Use: <emphasis>main</emphasis></entry>
26397 <entry>Type: <emphasis>boolean</emphasis></entry>
26398 <entry>Default: <emphasis>true</emphasis></entry>
26399 </row>
26400 </tbody>
26401 </tgroup>
26402 </informaltable>
26403 <para>
26404 <indexterm role="concept">
26405 <primary><emphasis>Return-path:</emphasis> header line</primary>
26406 <secondary>removing</secondary>
26407 </indexterm>
26408 RFC 2821, section 4.4, states that an SMTP server must insert a
26409 <emphasis>Return-path:</emphasis> header line into a message when it makes a <quote>final delivery</quote>.
26410 The <emphasis>Return-path:</emphasis> header preserves the sender address as received in the
26411 MAIL command. This description implies that this header should not be present
26412 in an incoming message. If <option>return_path_remove</option> is true, any existing
26413 <emphasis>Return-path:</emphasis> headers are removed from messages at the time they are
26414 received. Exim&#x2019;s transports have options for adding <emphasis>Return-path:</emphasis> headers at
26415 the time of delivery. They are normally used only for final local deliveries.
26416 </para>
26417 <para>
26418 <indexterm role="option">
26419 <primary><option>return_size_limit</option></primary>
26420 </indexterm>
26421 </para>
26422 <informaltable frame="all">
26423 <tgroup cols="4" colsep="0" rowsep="0">
26424 <colspec colwidth="8*" align="left"/>
26425 <colspec colwidth="6*" align="center"/>
26426 <colspec colwidth="6*" align="center"/>
26427 <colspec colwidth="6*" align="right"/>
26428 <tbody>
26429 <row>
26430 <entry><option>return_size_limit</option></entry>
26431 <entry>Use: <emphasis>main</emphasis></entry>
26432 <entry>Type: <emphasis>integer</emphasis></entry>
26433 <entry>Default: <emphasis>100K</emphasis></entry>
26434 </row>
26435 </tbody>
26436 </tgroup>
26437 </informaltable>
26438 <para>
26439 This option is an obsolete synonym for <option>bounce_return_size_limit</option>.
26440 </para>
26441 <para>
26442 <indexterm role="option">
26443 <primary><option>rfc1413_hosts</option></primary>
26444 </indexterm>
26445 </para>
26446 <informaltable frame="all">
26447 <tgroup cols="4" colsep="0" rowsep="0">
26448 <colspec colwidth="8*" align="left"/>
26449 <colspec colwidth="6*" align="center"/>
26450 <colspec colwidth="6*" align="center"/>
26451 <colspec colwidth="6*" align="right"/>
26452 <tbody>
26453 <row>
26454 <entry><option>rfc1413_hosts</option></entry>
26455 <entry>Use: <emphasis>main</emphasis></entry>
26456 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26457 <entry>Default: <emphasis>*</emphasis></entry>
26458 </row>
26459 </tbody>
26460 </tgroup>
26461 </informaltable>
26462 <para>
26463 <indexterm role="concept">
26464 <primary>RFC 1413</primary>
26465 </indexterm>
26466 <indexterm role="concept">
26467 <primary>host</primary>
26468 <secondary>for RFC 1413 calls</secondary>
26469 </indexterm>
26470 RFC 1413 identification calls are made to any client host which matches an item
26471 in the list.
26472 </para>
26473 <para>
26474 <indexterm role="option">
26475 <primary><option>rfc1413_query_timeout</option></primary>
26476 </indexterm>
26477 </para>
26478 <informaltable frame="all">
26479 <tgroup cols="4" colsep="0" rowsep="0">
26480 <colspec colwidth="8*" align="left"/>
26481 <colspec colwidth="6*" align="center"/>
26482 <colspec colwidth="6*" align="center"/>
26483 <colspec colwidth="6*" align="right"/>
26484 <tbody>
26485 <row>
26486 <entry><option>rfc1413_query_timeout</option></entry>
26487 <entry>Use: <emphasis>main</emphasis></entry>
26488 <entry>Type: <emphasis>time</emphasis></entry>
26489 <entry>Default: <emphasis>5s</emphasis></entry>
26490 </row>
26491 </tbody>
26492 </tgroup>
26493 </informaltable>
26494 <para>
26495 <indexterm role="concept">
26496 <primary>RFC 1413</primary>
26497 <secondary>query timeout</secondary>
26498 </indexterm>
26499 <indexterm role="concept">
26500 <primary>timeout</primary>
26501 <secondary>for RFC 1413 call</secondary>
26502 </indexterm>
26503 This sets the timeout on RFC 1413 identification calls. If it is set to zero,
26504 no RFC 1413 calls are ever made.
26505 </para>
26506 <para>
26507 <indexterm role="option">
26508 <primary><option>sender_unqualified_hosts</option></primary>
26509 </indexterm>
26510 </para>
26511 <informaltable frame="all">
26512 <tgroup cols="4" colsep="0" rowsep="0">
26513 <colspec colwidth="8*" align="left"/>
26514 <colspec colwidth="6*" align="center"/>
26515 <colspec colwidth="6*" align="center"/>
26516 <colspec colwidth="6*" align="right"/>
26517 <tbody>
26518 <row>
26519 <entry><option>sender_unqualified_hosts</option></entry>
26520 <entry>Use: <emphasis>main</emphasis></entry>
26521 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26522 <entry>Default: <emphasis>unset</emphasis></entry>
26523 </row>
26524 </tbody>
26525 </tgroup>
26526 </informaltable>
26527 <para>
26528 <indexterm role="concept">
26529 <primary>unqualified addresses</primary>
26530 </indexterm>
26531 <indexterm role="concept">
26532 <primary>host</primary>
26533 <secondary>unqualified addresses from</secondary>
26534 </indexterm>
26535 This option lists those hosts from which Exim is prepared to accept unqualified
26536 sender addresses. The addresses are made fully qualified by the addition of
26537 <option>qualify_domain</option>. This option also affects message header lines. Exim does
26538 not reject unqualified addresses in headers that contain sender addresses, but
26539 it qualifies them only if the message came from a host that matches
26540 <option>sender_unqualified_hosts</option>, or if the message was submitted locally (not
26541 using TCP/IP), and the <option>-bnq</option> option was not set.
26542 </para>
26543 <para>
26544 <indexterm role="option">
26545 <primary><option>smtp_accept_keepalive</option></primary>
26546 </indexterm>
26547 </para>
26548 <informaltable frame="all">
26549 <tgroup cols="4" colsep="0" rowsep="0">
26550 <colspec colwidth="8*" align="left"/>
26551 <colspec colwidth="6*" align="center"/>
26552 <colspec colwidth="6*" align="center"/>
26553 <colspec colwidth="6*" align="right"/>
26554 <tbody>
26555 <row>
26556 <entry><option>smtp_accept_keepalive</option></entry>
26557 <entry>Use: <emphasis>main</emphasis></entry>
26558 <entry>Type: <emphasis>boolean</emphasis></entry>
26559 <entry>Default: <emphasis>true</emphasis></entry>
26560 </row>
26561 </tbody>
26562 </tgroup>
26563 </informaltable>
26564 <para>
26565 <indexterm role="concept">
26566 <primary>keepalive</primary>
26567 <secondary>on incoming connection</secondary>
26568 </indexterm>
26569 This option controls the setting of the SO_KEEPALIVE option on incoming
26570 TCP/IP socket connections. When set, it causes the kernel to probe idle
26571 connections periodically, by sending packets with <quote>old</quote> sequence numbers. The
26572 other end of the connection should send an acknowledgment if the connection is
26573 still okay or a reset if the connection has been aborted. The reason for doing
26574 this is that it has the beneficial effect of freeing up certain types of
26575 connection that can get stuck when the remote host is disconnected without
26576 tidying up the TCP/IP call properly. The keepalive mechanism takes several
26577 hours to detect unreachable hosts.
26578 </para>
26579 <para>
26580 <indexterm role="option">
26581 <primary><option>smtp_accept_max</option></primary>
26582 </indexterm>
26583 </para>
26584 <informaltable frame="all">
26585 <tgroup cols="4" colsep="0" rowsep="0">
26586 <colspec colwidth="8*" align="left"/>
26587 <colspec colwidth="6*" align="center"/>
26588 <colspec colwidth="6*" align="center"/>
26589 <colspec colwidth="6*" align="right"/>
26590 <tbody>
26591 <row>
26592 <entry><option>smtp_accept_max</option></entry>
26593 <entry>Use: <emphasis>main</emphasis></entry>
26594 <entry>Type: <emphasis>integer</emphasis></entry>
26595 <entry>Default: <emphasis>20</emphasis></entry>
26596 </row>
26597 </tbody>
26598 </tgroup>
26599 </informaltable>
26600 <para>
26601 <indexterm role="concept">
26602 <primary>limit</primary>
26603 <secondary>incoming SMTP connections</secondary>
26604 </indexterm>
26605 <indexterm role="concept">
26606 <primary>SMTP</primary>
26607 <secondary>incoming connection count</secondary>
26608 </indexterm>
26609 <indexterm role="concept">
26610 <primary>inetd</primary>
26611 </indexterm>
26612 This option specifies the maximum number of simultaneous incoming SMTP calls
26613 that Exim will accept. It applies only to the listening daemon; there is no
26614 control (in Exim) when incoming SMTP is being handled by <emphasis>inetd</emphasis>. If the
26615 value is set to zero, no limit is applied. However, it is required to be
26616 non-zero if either <option>smtp_accept_max_per_host</option> or <option>smtp_accept_queue</option> is
26617 set. See also <option>smtp_accept_reserve</option> and <option>smtp_load_reserve</option>.
26618 </para>
26619 <para>
26620 A new SMTP connection is immediately rejected if the <option>smtp_accept_max</option> limit
26621 has been reached. If not, Exim first checks <option>smtp_accept_max_per_host</option>. If
26622 that limit has not been reached for the client host, <option>smtp_accept_reserve</option>
26623 and <option>smtp_load_reserve</option> are then checked before accepting the connection.
26624 </para>
26625 <para>
26626 <indexterm role="option">
26627 <primary><option>smtp_accept_max_nonmail</option></primary>
26628 </indexterm>
26629 </para>
26630 <informaltable frame="all">
26631 <tgroup cols="4" colsep="0" rowsep="0">
26632 <colspec colwidth="8*" align="left"/>
26633 <colspec colwidth="6*" align="center"/>
26634 <colspec colwidth="6*" align="center"/>
26635 <colspec colwidth="6*" align="right"/>
26636 <tbody>
26637 <row>
26638 <entry><option>smtp_accept_max_nonmail</option></entry>
26639 <entry>Use: <emphasis>main</emphasis></entry>
26640 <entry>Type: <emphasis>integer</emphasis></entry>
26641 <entry>Default: <emphasis>10</emphasis></entry>
26642 </row>
26643 </tbody>
26644 </tgroup>
26645 </informaltable>
26646 <para>
26647 <indexterm role="concept">
26648 <primary>limit</primary>
26649 <secondary>non-mail SMTP commands</secondary>
26650 </indexterm>
26651 <indexterm role="concept">
26652 <primary>SMTP</primary>
26653 <secondary>limiting non-mail commands</secondary>
26654 </indexterm>
26655 Exim counts the number of <quote>non-mail</quote> commands in an SMTP session, and drops
26656 the connection if there are too many. This option defines <quote>too many</quote>. The
26657 check catches some denial-of-service attacks, repeated failing AUTHs, or a mad
26658 client looping sending EHLO, for example. The check is applied only if the
26659 client host matches <option>smtp_accept_max_nonmail_hosts</option>.
26660 </para>
26661 <para>
26662 When a new message is expected, one occurrence of RSET is not counted. This
26663 allows a client to send one RSET between messages (this is not necessary,
26664 but some clients do it). Exim also allows one uncounted occurrence of HELO
26665 or EHLO, and one occurrence of STARTTLS between messages. After
26666 starting up a TLS session, another EHLO is expected, and so it too is not
26667 counted. The first occurrence of AUTH in a connection, or immediately
26668 following STARTTLS is not counted. Otherwise, all commands other than
26669 MAIL, RCPT, DATA, and QUIT are counted.
26670 </para>
26671 <para>
26672 <indexterm role="option">
26673 <primary><option>smtp_accept_max_nonmail_hosts</option></primary>
26674 </indexterm>
26675 </para>
26676 <informaltable frame="all">
26677 <tgroup cols="4" colsep="0" rowsep="0">
26678 <colspec colwidth="8*" align="left"/>
26679 <colspec colwidth="6*" align="center"/>
26680 <colspec colwidth="6*" align="center"/>
26681 <colspec colwidth="6*" align="right"/>
26682 <tbody>
26683 <row>
26684 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
26685 <entry>Use: <emphasis>main</emphasis></entry>
26686 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26687 <entry>Default: <emphasis>*</emphasis></entry>
26688 </row>
26689 </tbody>
26690 </tgroup>
26691 </informaltable>
26692 <para>
26693 You can control which hosts are subject to the <option>smtp_accept_max_nonmail</option>
26694 check by setting this option. The default value makes it apply to all hosts. By
26695 changing the value, you can exclude any badly-behaved hosts that you have to
26696 live with.
26697 </para>
26698 <para>
26699 <indexterm role="option">
26700 <primary><option>smtp_accept_max_per_connection</option></primary>
26701 </indexterm>
26702 </para>
26703 <informaltable frame="all">
26704 <tgroup cols="4" colsep="0" rowsep="0">
26705 <colspec colwidth="8*" align="left"/>
26706 <colspec colwidth="6*" align="center"/>
26707 <colspec colwidth="6*" align="center"/>
26708 <colspec colwidth="6*" align="right"/>
26709 <tbody>
26710 <row>
26711 <entry><option>smtp_accept_max_per_ &nbsp;&nbsp;connection</option></entry>
26712 <entry>Use: <emphasis>main</emphasis></entry>
26713 <entry>Type: <emphasis>integer</emphasis></entry>
26714 <entry>Default: <emphasis>1000</emphasis></entry>
26715 </row>
26716 </tbody>
26717 </tgroup>
26718 </informaltable>
26719 <para>
26720 <indexterm role="concept">
26721 <primary>SMTP</primary>
26722 <secondary>limiting incoming message count</secondary>
26723 </indexterm>
26724 <indexterm role="concept">
26725 <primary>limit</primary>
26726 <secondary>messages per SMTP connection</secondary>
26727 </indexterm>
26728 The value of this option limits the number of MAIL commands that Exim is
26729 prepared to accept over a single SMTP connection, whether or not each command
26730 results in the transfer of a message. After the limit is reached, a 421
26731 response is given to subsequent MAIL commands. This limit is a safety
26732 precaution against a client that goes mad (incidents of this type have been
26733 seen).
26734 </para>
26735 <para>
26736 <indexterm role="option">
26737 <primary><option>smtp_accept_max_per_host</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_max_per_host</option></entry>
26749 <entry>Use: <emphasis>main</emphasis></entry>
26750 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26751 <entry>Default: <emphasis>unset</emphasis></entry>
26752 </row>
26753 </tbody>
26754 </tgroup>
26755 </informaltable>
26756 <para>
26757 <indexterm role="concept">
26758 <primary>limit</primary>
26759 <secondary>SMTP connections from one host</secondary>
26760 </indexterm>
26761 <indexterm role="concept">
26762 <primary>host</primary>
26763 <secondary>limiting SMTP connections from</secondary>
26764 </indexterm>
26765 This option restricts the number of simultaneous IP connections from a single
26766 host (strictly, from a single IP address) to the Exim daemon. The option is
26767 expanded, to enable different limits to be applied to different hosts by
26768 reference to <varname>$sender_host_address</varname>. Once the limit is reached, additional
26769 connection attempts from the same host are rejected with error code 421. This
26770 is entirely independent of <option>smtp_accept_reserve</option>. The option&#x2019;s default value
26771 of zero imposes no limit. If this option is set greater than zero, it is
26772 required that <option>smtp_accept_max</option> be non-zero.
26773 </para>
26774 <para>
26775 <emphasis role="bold">Warning</emphasis>: When setting this option you should not use any expansion
26776 constructions that take an appreciable amount of time. The expansion and test
26777 happen in the main daemon loop, in order to reject additional connections
26778 without forking additional processes (otherwise a denial-of-service attack
26779 could cause a vast number or processes to be created). While the daemon is
26780 doing this processing, it cannot accept any other incoming connections.
26781 </para>
26782 <para>
26783 <indexterm role="option">
26784 <primary><option>smtp_accept_queue</option></primary>
26785 </indexterm>
26786 </para>
26787 <informaltable frame="all">
26788 <tgroup cols="4" colsep="0" rowsep="0">
26789 <colspec colwidth="8*" align="left"/>
26790 <colspec colwidth="6*" align="center"/>
26791 <colspec colwidth="6*" align="center"/>
26792 <colspec colwidth="6*" align="right"/>
26793 <tbody>
26794 <row>
26795 <entry><option>smtp_accept_queue</option></entry>
26796 <entry>Use: <emphasis>main</emphasis></entry>
26797 <entry>Type: <emphasis>integer</emphasis></entry>
26798 <entry>Default: <emphasis>0</emphasis></entry>
26799 </row>
26800 </tbody>
26801 </tgroup>
26802 </informaltable>
26803 <para>
26804 <indexterm role="concept">
26805 <primary>SMTP</primary>
26806 <secondary>incoming connection count</secondary>
26807 </indexterm>
26808 <indexterm role="concept">
26809 <primary>queueing incoming messages</primary>
26810 </indexterm>
26811 <indexterm role="concept">
26812 <primary>message</primary>
26813 <secondary>queueing by SMTP connection count</secondary>
26814 </indexterm>
26815 If the number of simultaneous incoming SMTP connections being handled via the
26816 listening daemon exceeds this value, messages received by SMTP are just placed
26817 on the queue; no delivery processes are started automatically. The count is
26818 fixed at the start of an SMTP connection. It cannot be updated in the
26819 subprocess that receives messages, and so the queueing or not queueing applies
26820 to all messages received in the same connection.
26821 </para>
26822 <para>
26823 A value of zero implies no limit, and clearly any non-zero value is useful only
26824 if it is less than the <option>smtp_accept_max</option> value (unless that is zero). See
26825 also <option>queue_only</option>, <option>queue_only_load</option>, <option>queue_smtp_domains</option>, and the
26826 various <option>-od</option><emphasis>x</emphasis> command line options.
26827 </para>
26828 <para>
26829 <indexterm role="option">
26830 <primary><option>smtp_accept_queue_per_connection</option></primary>
26831 </indexterm>
26832 </para>
26833 <informaltable frame="all">
26834 <tgroup cols="4" colsep="0" rowsep="0">
26835 <colspec colwidth="8*" align="left"/>
26836 <colspec colwidth="6*" align="center"/>
26837 <colspec colwidth="6*" align="center"/>
26838 <colspec colwidth="6*" align="right"/>
26839 <tbody>
26840 <row>
26841 <entry><option>smtp_accept_queue_per_ &nbsp;&nbsp;connection</option></entry>
26842 <entry>Use: <emphasis>main</emphasis></entry>
26843 <entry>Type: <emphasis>integer</emphasis></entry>
26844 <entry>Default: <emphasis>10</emphasis></entry>
26845 </row>
26846 </tbody>
26847 </tgroup>
26848 </informaltable>
26849 <para>
26850 <indexterm role="concept">
26851 <primary>queueing incoming messages</primary>
26852 </indexterm>
26853 <indexterm role="concept">
26854 <primary>message</primary>
26855 <secondary>queueing by message count</secondary>
26856 </indexterm>
26857 This option limits the number of delivery processes that Exim starts
26858 automatically when receiving messages via SMTP, whether via the daemon or by
26859 the use of <option>-bs</option> or <option>-bS</option>. If the value of the option is greater than zero,
26860 and the number of messages received in a single SMTP session exceeds this
26861 number, subsequent messages are placed on the queue, but no delivery processes
26862 are started. This helps to limit the number of Exim processes when a server
26863 restarts after downtime and there is a lot of mail waiting for it on other
26864 systems. On large systems, the default should probably be increased, and on
26865 dial-in client systems it should probably be set to zero (that is, disabled).
26866 </para>
26867 <para>
26868 <indexterm role="option">
26869 <primary><option>smtp_accept_reserve</option></primary>
26870 </indexterm>
26871 </para>
26872 <informaltable frame="all">
26873 <tgroup cols="4" colsep="0" rowsep="0">
26874 <colspec colwidth="8*" align="left"/>
26875 <colspec colwidth="6*" align="center"/>
26876 <colspec colwidth="6*" align="center"/>
26877 <colspec colwidth="6*" align="right"/>
26878 <tbody>
26879 <row>
26880 <entry><option>smtp_accept_reserve</option></entry>
26881 <entry>Use: <emphasis>main</emphasis></entry>
26882 <entry>Type: <emphasis>integer</emphasis></entry>
26883 <entry>Default: <emphasis>0</emphasis></entry>
26884 </row>
26885 </tbody>
26886 </tgroup>
26887 </informaltable>
26888 <para>
26889 <indexterm role="concept">
26890 <primary>SMTP</primary>
26891 <secondary>incoming call count</secondary>
26892 </indexterm>
26893 <indexterm role="concept">
26894 <primary>host</primary>
26895 <secondary>reserved</secondary>
26896 </indexterm>
26897 When <option>smtp_accept_max</option> is set greater than zero, this option specifies a
26898 number of SMTP connections that are reserved for connections from the hosts
26899 that are specified in <option>smtp_reserve_hosts</option>. The value set in
26900 <option>smtp_accept_max</option> includes this reserve pool. The specified hosts are not
26901 restricted to this number of connections; the option specifies a minimum number
26902 of connection slots for them, not a maximum. It is a guarantee that this group
26903 of hosts can always get at least <option>smtp_accept_reserve</option> connections. However,
26904 the limit specified by <option>smtp_accept_max_per_host</option> is still applied to each
26905 individual host.
26906 </para>
26907 <para>
26908 For example, if <option>smtp_accept_max</option> is set to 50 and <option>smtp_accept_reserve</option> is
26909 set to 5, once there are 45 active connections (from any hosts), new
26910 connections are accepted only from hosts listed in <option>smtp_reserve_hosts</option>,
26911 provided the other criteria for acceptance are met.
26912 </para>
26913 <para>
26914 <indexterm role="option">
26915 <primary><option>smtp_active_hostname</option></primary>
26916 </indexterm>
26917 </para>
26918 <informaltable frame="all">
26919 <tgroup cols="4" colsep="0" rowsep="0">
26920 <colspec colwidth="8*" align="left"/>
26921 <colspec colwidth="6*" align="center"/>
26922 <colspec colwidth="6*" align="center"/>
26923 <colspec colwidth="6*" align="right"/>
26924 <tbody>
26925 <row>
26926 <entry><option>smtp_active_hostname</option></entry>
26927 <entry>Use: <emphasis>main</emphasis></entry>
26928 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26929 <entry>Default: <emphasis>unset</emphasis></entry>
26930 </row>
26931 </tbody>
26932 </tgroup>
26933 </informaltable>
26934 <para>
26935 <indexterm role="concept">
26936 <primary>host</primary>
26937 <secondary>name in SMTP responses</secondary>
26938 </indexterm>
26939 <indexterm role="concept">
26940 <primary>SMTP</primary>
26941 <secondary>host name in responses</secondary>
26942 </indexterm>
26943 <indexterm role="variable">
26944 <primary><varname>$primary_hostname</varname></primary>
26945 </indexterm>
26946 This option is provided for multi-homed servers that want to masquerade as
26947 several different hosts. At the start of an incoming SMTP connection, its value
26948 is expanded and used instead of the value of <varname>$primary_hostname</varname> in SMTP
26949 responses. For example, it is used as domain name in the response to an
26950 incoming HELO or EHLO command.
26951 </para>
26952 <para>
26953 <indexterm role="variable">
26954 <primary><varname>$smtp_active_hostname</varname></primary>
26955 </indexterm>
26956 The active hostname is placed in the <varname>$smtp_active_hostname</varname> variable, which
26957 is saved with any messages that are received. It is therefore available for use
26958 in routers and transports when the message is later delivered.
26959 </para>
26960 <para>
26961 If this option is unset, or if its expansion is forced to fail, or if the
26962 expansion results in an empty string, the value of <varname>$primary_hostname</varname> is
26963 used. Other expansion failures cause a message to be written to the main and
26964 panic logs, and the SMTP command receives a temporary error. Typically, the
26965 value of <option>smtp_active_hostname</option> depends on the incoming interface address.
26966 For example:
26967 </para>
26968 <literallayout class="monospaced">
26969 smtp_active_hostname = ${if eq{$received_ip_address}{10.0.0.1}\
26970   {cox.mydomain}{box.mydomain}}
26971 </literallayout>
26972 <para>
26973 Although <varname>$smtp_active_hostname</varname> is primarily concerned with incoming
26974 messages, it is also used as the default for HELO commands in callout
26975 verification if there is no remote transport from which to obtain a
26976 <option>helo_data</option> value.
26977 </para>
26978 <para>
26979 <indexterm role="option">
26980 <primary><option>smtp_banner</option></primary>
26981 </indexterm>
26982 </para>
26983 <informaltable frame="all">
26984 <tgroup cols="4" colsep="0" rowsep="0">
26985 <colspec colwidth="8*" align="left"/>
26986 <colspec colwidth="6*" align="center"/>
26987 <colspec colwidth="6*" align="center"/>
26988 <colspec colwidth="6*" align="right"/>
26989 <tbody>
26990 <row>
26991 <entry><option>smtp_banner</option></entry>
26992 <entry>Use: <emphasis>main</emphasis></entry>
26993 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26994 <entry>Default: <emphasis>see below</emphasis></entry>
26995 </row>
26996 </tbody>
26997 </tgroup>
26998 </informaltable>
26999 <para>
27000 <indexterm role="concept">
27001 <primary>SMTP</primary>
27002 <secondary>welcome banner</secondary>
27003 </indexterm>
27004 <indexterm role="concept">
27005 <primary>banner for SMTP</primary>
27006 </indexterm>
27007 <indexterm role="concept">
27008 <primary>welcome banner for SMTP</primary>
27009 </indexterm>
27010 <indexterm role="concept">
27011 <primary>customizing</primary>
27012 <secondary>SMTP banner</secondary>
27013 </indexterm>
27014 This string, which is expanded every time it is used, is output as the initial
27015 positive response to an SMTP connection. The default setting is:
27016 </para>
27017 <literallayout class="monospaced">
27018 smtp_banner = $smtp_active_hostname ESMTP Exim \
27019   $version_number $tod_full
27020 </literallayout>
27021 <para>
27022 Failure to expand the string causes a panic error. If you want to create a
27023 multiline response to the initial SMTP connection, use <quote>\n</quote> in the string at
27024 appropriate points, but not at the end. Note that the 220 code is not included
27025 in this string. Exim adds it automatically (several times in the case of a
27026 multiline response).
27027 </para>
27028 <para>
27029 <indexterm role="option">
27030 <primary><option>smtp_check_spool_space</option></primary>
27031 </indexterm>
27032 </para>
27033 <informaltable frame="all">
27034 <tgroup cols="4" colsep="0" rowsep="0">
27035 <colspec colwidth="8*" align="left"/>
27036 <colspec colwidth="6*" align="center"/>
27037 <colspec colwidth="6*" align="center"/>
27038 <colspec colwidth="6*" align="right"/>
27039 <tbody>
27040 <row>
27041 <entry><option>smtp_check_spool_space</option></entry>
27042 <entry>Use: <emphasis>main</emphasis></entry>
27043 <entry>Type: <emphasis>boolean</emphasis></entry>
27044 <entry>Default: <emphasis>true</emphasis></entry>
27045 </row>
27046 </tbody>
27047 </tgroup>
27048 </informaltable>
27049 <para>
27050 <indexterm role="concept">
27051 <primary>checking disk space</primary>
27052 </indexterm>
27053 <indexterm role="concept">
27054 <primary>disk space, checking</primary>
27055 </indexterm>
27056 <indexterm role="concept">
27057 <primary>spool directory</primary>
27058 <secondary>checking space</secondary>
27059 </indexterm>
27060 When this option is set, if an incoming SMTP session encounters the SIZE
27061 option on a MAIL command, it checks that there is enough space in the
27062 spool directory&#x2019;s partition to accept a message of that size, while still
27063 leaving free the amount specified by <option>check_spool_space</option> (even if that value
27064 is zero). If there isn&#x2019;t enough space, a temporary error code is returned.
27065 </para>
27066 <para>
27067 <indexterm role="option">
27068 <primary><option>smtp_connect_backlog</option></primary>
27069 </indexterm>
27070 </para>
27071 <informaltable frame="all">
27072 <tgroup cols="4" colsep="0" rowsep="0">
27073 <colspec colwidth="8*" align="left"/>
27074 <colspec colwidth="6*" align="center"/>
27075 <colspec colwidth="6*" align="center"/>
27076 <colspec colwidth="6*" align="right"/>
27077 <tbody>
27078 <row>
27079 <entry><option>smtp_connect_backlog</option></entry>
27080 <entry>Use: <emphasis>main</emphasis></entry>
27081 <entry>Type: <emphasis>integer</emphasis></entry>
27082 <entry>Default: <emphasis>20</emphasis></entry>
27083 </row>
27084 </tbody>
27085 </tgroup>
27086 </informaltable>
27087 <para>
27088 <indexterm role="concept">
27089 <primary>connection backlog</primary>
27090 </indexterm>
27091 <indexterm role="concept">
27092 <primary>SMTP</primary>
27093 <secondary>connection backlog</secondary>
27094 </indexterm>
27095 <indexterm role="concept">
27096 <primary>backlog of connections</primary>
27097 </indexterm>
27098 This option specifies a maximum number of waiting SMTP connections. Exim passes
27099 this value to the TCP/IP system when it sets up its listener. Once this number
27100 of connections are waiting for the daemon&#x2019;s attention, subsequent connection
27101 attempts are refused at the TCP/IP level. At least, that is what the manuals
27102 say; in some circumstances such connection attempts have been observed to time
27103 out instead. For large systems it is probably a good idea to increase the
27104 value (to 50, say). It also gives some protection against denial-of-service
27105 attacks by SYN flooding.
27106 </para>
27107 <para>
27108 <indexterm role="option">
27109 <primary><option>smtp_enforce_sync</option></primary>
27110 </indexterm>
27111 </para>
27112 <informaltable frame="all">
27113 <tgroup cols="4" colsep="0" rowsep="0">
27114 <colspec colwidth="8*" align="left"/>
27115 <colspec colwidth="6*" align="center"/>
27116 <colspec colwidth="6*" align="center"/>
27117 <colspec colwidth="6*" align="right"/>
27118 <tbody>
27119 <row>
27120 <entry><option>smtp_enforce_sync</option></entry>
27121 <entry>Use: <emphasis>main</emphasis></entry>
27122 <entry>Type: <emphasis>boolean</emphasis></entry>
27123 <entry>Default: <emphasis>true</emphasis></entry>
27124 </row>
27125 </tbody>
27126 </tgroup>
27127 </informaltable>
27128 <para>
27129 <indexterm role="concept">
27130 <primary>SMTP</primary>
27131 <secondary>synchronization checking</secondary>
27132 </indexterm>
27133 <indexterm role="concept">
27134 <primary>synchronization checking in SMTP</primary>
27135 </indexterm>
27136 The SMTP protocol specification requires the client to wait for a response from
27137 the server at certain points in the dialogue. Without PIPELINING these
27138 synchronization points are after every command; with PIPELINING they are
27139 fewer, but they still exist.
27140 </para>
27141 <para>
27142 Some spamming sites send out a complete set of SMTP commands without waiting
27143 for any response. Exim protects against this by rejecting a message if the
27144 client has sent further input when it should not have. The error response <quote>554
27145 SMTP synchronization error</quote> is sent, and the connection is dropped. Testing
27146 for this error cannot be perfect because of transmission delays (unexpected
27147 input may be on its way but not yet received when Exim checks). However, it
27148 does detect many instances.
27149 </para>
27150 <para>
27151 The check can be globally disabled by setting <option>smtp_enforce_sync</option> false.
27152 If you want to disable the check selectively (for example, only for certain
27153 hosts), you can do so by an appropriate use of a <option>control</option> modifier in an ACL
27154 (see section <xref linkend="SECTcontrols"/>). See also <option>pipelining_advertise_hosts</option>.
27155 </para>
27156 <para>
27157 <indexterm role="option">
27158 <primary><option>smtp_etrn_command</option></primary>
27159 </indexterm>
27160 </para>
27161 <informaltable frame="all">
27162 <tgroup cols="4" colsep="0" rowsep="0">
27163 <colspec colwidth="8*" align="left"/>
27164 <colspec colwidth="6*" align="center"/>
27165 <colspec colwidth="6*" align="center"/>
27166 <colspec colwidth="6*" align="right"/>
27167 <tbody>
27168 <row>
27169 <entry><option>smtp_etrn_command</option></entry>
27170 <entry>Use: <emphasis>main</emphasis></entry>
27171 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27172 <entry>Default: <emphasis>unset</emphasis></entry>
27173 </row>
27174 </tbody>
27175 </tgroup>
27176 </informaltable>
27177 <para>
27178 <indexterm role="concept">
27179 <primary>ETRN</primary>
27180 <secondary>command to be run</secondary>
27181 </indexterm>
27182 <indexterm role="variable">
27183 <primary><varname>$domain</varname></primary>
27184 </indexterm>
27185 If this option is set, the given command is run whenever an SMTP ETRN
27186 command is received from a host that is permitted to issue such commands (see
27187 chapter <xref linkend="CHAPACL"/>). The string is split up into separate arguments which
27188 are independently expanded. The expansion variable <varname>$domain</varname> is set to the
27189 argument of the ETRN command, and no syntax checking is done on it. For
27190 example:
27191 </para>
27192 <literallayout class="monospaced">
27193 smtp_etrn_command = /etc/etrn_command $domain \
27194                     $sender_host_address
27195 </literallayout>
27196 <para>
27197 A new process is created to run the command, but Exim does not wait for it to
27198 complete. Consequently, its status cannot be checked. If the command cannot be
27199 run, a line is written to the panic log, but the ETRN caller still receives
27200 a 250 success response. Exim is normally running under its own uid when
27201 receiving SMTP, so it is not possible for it to change the uid before running
27202 the command.
27203 </para>
27204 <para>
27205 <indexterm role="option">
27206 <primary><option>smtp_etrn_serialize</option></primary>
27207 </indexterm>
27208 </para>
27209 <informaltable frame="all">
27210 <tgroup cols="4" colsep="0" rowsep="0">
27211 <colspec colwidth="8*" align="left"/>
27212 <colspec colwidth="6*" align="center"/>
27213 <colspec colwidth="6*" align="center"/>
27214 <colspec colwidth="6*" align="right"/>
27215 <tbody>
27216 <row>
27217 <entry><option>smtp_etrn_serialize</option></entry>
27218 <entry>Use: <emphasis>main</emphasis></entry>
27219 <entry>Type: <emphasis>boolean</emphasis></entry>
27220 <entry>Default: <emphasis>true</emphasis></entry>
27221 </row>
27222 </tbody>
27223 </tgroup>
27224 </informaltable>
27225 <para>
27226 <indexterm role="concept">
27227 <primary>ETRN</primary>
27228 <secondary>serializing</secondary>
27229 </indexterm>
27230 When this option is set, it prevents the simultaneous execution of more than
27231 one identical command as a result of ETRN in an SMTP connection. See
27232 section <xref linkend="SECTETRN"/> for details.
27233 </para>
27234 <para>
27235 <indexterm role="option">
27236 <primary><option>smtp_load_reserve</option></primary>
27237 </indexterm>
27238 </para>
27239 <informaltable frame="all">
27240 <tgroup cols="4" colsep="0" rowsep="0">
27241 <colspec colwidth="8*" align="left"/>
27242 <colspec colwidth="6*" align="center"/>
27243 <colspec colwidth="6*" align="center"/>
27244 <colspec colwidth="6*" align="right"/>
27245 <tbody>
27246 <row>
27247 <entry><option>smtp_load_reserve</option></entry>
27248 <entry>Use: <emphasis>main</emphasis></entry>
27249 <entry>Type: <emphasis>fixed-point</emphasis></entry>
27250 <entry>Default: <emphasis>unset</emphasis></entry>
27251 </row>
27252 </tbody>
27253 </tgroup>
27254 </informaltable>
27255 <para>
27256 <indexterm role="concept">
27257 <primary>load average</primary>
27258 </indexterm>
27259 If the system load average ever gets higher than this, incoming SMTP calls are
27260 accepted only from those hosts that match an entry in <option>smtp_reserve_hosts</option>.
27261 If <option>smtp_reserve_hosts</option> is not set, no incoming SMTP calls are accepted when
27262 the load is over the limit. The option has no effect on ancient operating
27263 systems on which Exim cannot determine the load average. See also
27264 <option>deliver_queue_load_max</option> and <option>queue_only_load</option>.
27265 </para>
27266 <para>
27267 <indexterm role="option">
27268 <primary><option>smtp_max_synprot_errors</option></primary>
27269 </indexterm>
27270 </para>
27271 <informaltable frame="all">
27272 <tgroup cols="4" colsep="0" rowsep="0">
27273 <colspec colwidth="8*" align="left"/>
27274 <colspec colwidth="6*" align="center"/>
27275 <colspec colwidth="6*" align="center"/>
27276 <colspec colwidth="6*" align="right"/>
27277 <tbody>
27278 <row>
27279 <entry><option>smtp_max_synprot_errors</option></entry>
27280 <entry>Use: <emphasis>main</emphasis></entry>
27281 <entry>Type: <emphasis>integer</emphasis></entry>
27282 <entry>Default: <emphasis>3</emphasis></entry>
27283 </row>
27284 </tbody>
27285 </tgroup>
27286 </informaltable>
27287 <para>
27288 <indexterm role="concept">
27289 <primary>SMTP</primary>
27290 <secondary>limiting syntax and protocol errors</secondary>
27291 </indexterm>
27292 <indexterm role="concept">
27293 <primary>limit</primary>
27294 <secondary>SMTP syntax and protocol errors</secondary>
27295 </indexterm>
27296 Exim rejects SMTP commands that contain syntax or protocol errors. In
27297 particular, a syntactically invalid email address, as in this command:
27298 </para>
27299 <literallayout class="monospaced">
27300 RCPT TO:&lt;abc xyz@a.b.c&gt;
27301 </literallayout>
27302 <para>
27303 causes immediate rejection of the command, before any other tests are done.
27304 (The ACL cannot be run if there is no valid address to set up for it.) An
27305 example of a protocol error is receiving RCPT before MAIL. If there are
27306 too many syntax or protocol errors in one SMTP session, the connection is
27307 dropped. The limit is set by this option.
27308 </para>
27309 <para>
27310 <indexterm role="concept">
27311 <primary>PIPELINING</primary>
27312 <secondary>expected errors</secondary>
27313 </indexterm>
27314 When the PIPELINING extension to SMTP is in use, some protocol errors are
27315 <quote>expected</quote>, for instance, a RCPT command after a rejected MAIL command.
27316 Exim assumes that PIPELINING will be used if it advertises it (see
27317 <option>pipelining_advertise_hosts</option>), and in this situation, <quote>expected</quote> errors do
27318 not count towards the limit.
27319 </para>
27320 <para>
27321 <indexterm role="option">
27322 <primary><option>smtp_max_unknown_commands</option></primary>
27323 </indexterm>
27324 </para>
27325 <informaltable frame="all">
27326 <tgroup cols="4" colsep="0" rowsep="0">
27327 <colspec colwidth="8*" align="left"/>
27328 <colspec colwidth="6*" align="center"/>
27329 <colspec colwidth="6*" align="center"/>
27330 <colspec colwidth="6*" align="right"/>
27331 <tbody>
27332 <row>
27333 <entry><option>smtp_max_unknown_commands</option></entry>
27334 <entry>Use: <emphasis>main</emphasis></entry>
27335 <entry>Type: <emphasis>integer</emphasis></entry>
27336 <entry>Default: <emphasis>3</emphasis></entry>
27337 </row>
27338 </tbody>
27339 </tgroup>
27340 </informaltable>
27341 <para>
27342 <indexterm role="concept">
27343 <primary>SMTP</primary>
27344 <secondary>limiting unknown commands</secondary>
27345 </indexterm>
27346 <indexterm role="concept">
27347 <primary>limit</primary>
27348 <secondary>unknown SMTP commands</secondary>
27349 </indexterm>
27350 If there are too many unrecognized commands in an incoming SMTP session, an
27351 Exim server drops the connection. This is a defence against some kinds of abuse
27352 that subvert web
27353 clients
27354 into making connections to SMTP ports; in these circumstances, a number of
27355 non-SMTP command lines are sent first.
27356 </para>
27357 <para>
27358 <indexterm role="option">
27359 <primary><option>smtp_ratelimit_hosts</option></primary>
27360 </indexterm>
27361 </para>
27362 <informaltable frame="all">
27363 <tgroup cols="4" colsep="0" rowsep="0">
27364 <colspec colwidth="8*" align="left"/>
27365 <colspec colwidth="6*" align="center"/>
27366 <colspec colwidth="6*" align="center"/>
27367 <colspec colwidth="6*" align="right"/>
27368 <tbody>
27369 <row>
27370 <entry><option>smtp_ratelimit_hosts</option></entry>
27371 <entry>Use: <emphasis>main</emphasis></entry>
27372 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
27373 <entry>Default: <emphasis>unset</emphasis></entry>
27374 </row>
27375 </tbody>
27376 </tgroup>
27377 </informaltable>
27378 <para>
27379 <indexterm role="concept">
27380 <primary>SMTP</primary>
27381 <secondary>rate limiting</secondary>
27382 </indexterm>
27383 <indexterm role="concept">
27384 <primary>limit</primary>
27385 <secondary>rate of message arrival</secondary>
27386 </indexterm>
27387 <indexterm role="concept">
27388 <primary>RCPT</primary>
27389 <secondary>rate limiting</secondary>
27390 </indexterm>
27391 Some sites find it helpful to be able to limit the rate at which certain hosts
27392 can send them messages, and the rate at which an individual message can specify
27393 recipients.
27394 </para>
27395 <para>
27396 Exim has two rate-limiting facilities. This section describes the older
27397 facility, which can limit rates within a single connection. The newer
27398 <option>ratelimit</option> ACL condition can limit rates across all connections. See section
27399 <xref linkend="SECTratelimiting"/> for details of the newer facility.
27400 </para>
27401 <para>
27402 When a host matches <option>smtp_ratelimit_hosts</option>, the values of
27403 <option>smtp_ratelimit_mail</option> and <option>smtp_ratelimit_rcpt</option> are used to control the
27404 rate of acceptance of MAIL and RCPT commands in a single SMTP session,
27405 respectively. Each option, if set, must contain a set of four comma-separated
27406 values:
27407 </para>
27408 <itemizedlist>
27409 <listitem>
27410 <para>
27411 A threshold, before which there is no rate limiting.
27412 </para>
27413 </listitem>
27414 <listitem>
27415 <para>
27416 An initial time delay. Unlike other times in Exim, numbers with decimal
27417 fractional parts are allowed here.
27418 </para>
27419 </listitem>
27420 <listitem>
27421 <para>
27422 A factor by which to increase the delay each time.
27423 </para>
27424 </listitem>
27425 <listitem>
27426 <para>
27427 A maximum value for the delay. This should normally be less than 5 minutes,
27428 because after that time, the client is liable to timeout the SMTP command.
27429 </para>
27430 </listitem>
27431 </itemizedlist>
27432 <para>
27433 For example, these settings have been used successfully at the site which
27434 first suggested this feature, for controlling mail from their customers:
27435 </para>
27436 <literallayout class="monospaced">
27437 smtp_ratelimit_mail = 2,0.5s,1.05,4m
27438 smtp_ratelimit_rcpt = 4,0.25s,1.015,4m
27439 </literallayout>
27440 <para>
27441 The first setting specifies delays that are applied to MAIL commands after
27442 two have been received over a single connection. The initial delay is 0.5
27443 seconds, increasing by a factor of 1.05 each time. The second setting applies
27444 delays to RCPT commands when more than four occur in a single message.
27445 </para>
27446 <para>
27447 <indexterm role="option">
27448 <primary><option>smtp_ratelimit_mail</option></primary>
27449 </indexterm>
27450 </para>
27451 <informaltable frame="all">
27452 <tgroup cols="4" colsep="0" rowsep="0">
27453 <colspec colwidth="8*" align="left"/>
27454 <colspec colwidth="6*" align="center"/>
27455 <colspec colwidth="6*" align="center"/>
27456 <colspec colwidth="6*" align="right"/>
27457 <tbody>
27458 <row>
27459 <entry><option>smtp_ratelimit_mail</option></entry>
27460 <entry>Use: <emphasis>main</emphasis></entry>
27461 <entry>Type: <emphasis>string</emphasis></entry>
27462 <entry>Default: <emphasis>unset</emphasis></entry>
27463 </row>
27464 </tbody>
27465 </tgroup>
27466 </informaltable>
27467 <para>
27468 See <option>smtp_ratelimit_hosts</option> above.
27469 </para>
27470 <para>
27471 <indexterm role="option">
27472 <primary><option>smtp_ratelimit_rcpt</option></primary>
27473 </indexterm>
27474 </para>
27475 <informaltable frame="all">
27476 <tgroup cols="4" colsep="0" rowsep="0">
27477 <colspec colwidth="8*" align="left"/>
27478 <colspec colwidth="6*" align="center"/>
27479 <colspec colwidth="6*" align="center"/>
27480 <colspec colwidth="6*" align="right"/>
27481 <tbody>
27482 <row>
27483 <entry><option>smtp_ratelimit_rcpt</option></entry>
27484 <entry>Use: <emphasis>main</emphasis></entry>
27485 <entry>Type: <emphasis>string</emphasis></entry>
27486 <entry>Default: <emphasis>unset</emphasis></entry>
27487 </row>
27488 </tbody>
27489 </tgroup>
27490 </informaltable>
27491 <para>
27492 See <option>smtp_ratelimit_hosts</option> above.
27493 </para>
27494 <para>
27495 <indexterm role="option">
27496 <primary><option>smtp_receive_timeout</option></primary>
27497 </indexterm>
27498 </para>
27499 <informaltable frame="all">
27500 <tgroup cols="4" colsep="0" rowsep="0">
27501 <colspec colwidth="8*" align="left"/>
27502 <colspec colwidth="6*" align="center"/>
27503 <colspec colwidth="6*" align="center"/>
27504 <colspec colwidth="6*" align="right"/>
27505 <tbody>
27506 <row>
27507 <entry><option>smtp_receive_timeout</option></entry>
27508 <entry>Use: <emphasis>main</emphasis></entry>
27509 <entry>Type: <emphasis>time</emphasis></entry>
27510 <entry>Default: <emphasis>5m</emphasis></entry>
27511 </row>
27512 </tbody>
27513 </tgroup>
27514 </informaltable>
27515 <para>
27516 <indexterm role="concept">
27517 <primary>timeout</primary>
27518 <secondary>for SMTP input</secondary>
27519 </indexterm>
27520 <indexterm role="concept">
27521 <primary>SMTP</primary>
27522 <secondary>input timeout</secondary>
27523 </indexterm>
27524 This sets a timeout value for SMTP reception. It applies to all forms of SMTP
27525 input, including batch SMTP. If a line of input (either an SMTP command or a
27526 data line) is not received within this time, the SMTP connection is dropped and
27527 the message is abandoned.
27528 A line is written to the log containing one of the following messages:
27529 </para>
27530 <literallayout class="monospaced">
27531 SMTP command timeout on connection from...
27532 SMTP data timeout on connection from...
27533 </literallayout>
27534 <para>
27535 The former means that Exim was expecting to read an SMTP command; the latter
27536 means that it was in the DATA phase, reading the contents of a message.
27537 </para>
27538 <para>
27539 <indexterm role="option">
27540 <primary><option>-os</option></primary>
27541 </indexterm>
27542 The value set by this option can be overridden by the
27543 <option>-os</option> command-line option. A setting of zero time disables the timeout, but
27544 this should never be used for SMTP over TCP/IP. (It can be useful in some cases
27545 of local input using <option>-bs</option> or <option>-bS</option>.) For non-SMTP input, the reception
27546 timeout is controlled by <option>receive_timeout</option> and <option>-or</option>.
27547 </para>
27548 <para>
27549 <indexterm role="option">
27550 <primary><option>smtp_reserve_hosts</option></primary>
27551 </indexterm>
27552 </para>
27553 <informaltable frame="all">
27554 <tgroup cols="4" colsep="0" rowsep="0">
27555 <colspec colwidth="8*" align="left"/>
27556 <colspec colwidth="6*" align="center"/>
27557 <colspec colwidth="6*" align="center"/>
27558 <colspec colwidth="6*" align="right"/>
27559 <tbody>
27560 <row>
27561 <entry><option>smtp_reserve_hosts</option></entry>
27562 <entry>Use: <emphasis>main</emphasis></entry>
27563 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
27564 <entry>Default: <emphasis>unset</emphasis></entry>
27565 </row>
27566 </tbody>
27567 </tgroup>
27568 </informaltable>
27569 <para>
27570 This option defines hosts for which SMTP connections are reserved; see
27571 <option>smtp_accept_reserve</option> and <option>smtp_load_reserve</option> above.
27572 </para>
27573 <para>
27574 <indexterm role="option">
27575 <primary><option>smtp_return_error_details</option></primary>
27576 </indexterm>
27577 </para>
27578 <informaltable frame="all">
27579 <tgroup cols="4" colsep="0" rowsep="0">
27580 <colspec colwidth="8*" align="left"/>
27581 <colspec colwidth="6*" align="center"/>
27582 <colspec colwidth="6*" align="center"/>
27583 <colspec colwidth="6*" align="right"/>
27584 <tbody>
27585 <row>
27586 <entry><option>smtp_return_error_details</option></entry>
27587 <entry>Use: <emphasis>main</emphasis></entry>
27588 <entry>Type: <emphasis>boolean</emphasis></entry>
27589 <entry>Default: <emphasis>false</emphasis></entry>
27590 </row>
27591 </tbody>
27592 </tgroup>
27593 </informaltable>
27594 <para>
27595 <indexterm role="concept">
27596 <primary>SMTP</primary>
27597 <secondary>details policy failures</secondary>
27598 </indexterm>
27599 <indexterm role="concept">
27600 <primary>policy control</primary>
27601 <secondary>rejection, returning details</secondary>
27602 </indexterm>
27603 In the default state, Exim uses bland messages such as
27604 <quote>Administrative prohibition</quote> when it rejects SMTP commands for policy
27605 reasons. Many sysadmins like this because it gives away little information
27606 to spammers. However, some other sysadmins who are applying strict checking
27607 policies want to give out much fuller information about failures. Setting
27608 <option>smtp_return_error_details</option> true causes Exim to be more forthcoming. For
27609 example, instead of <quote>Administrative prohibition</quote>, it might give:
27610 </para>
27611 <literallayout class="monospaced">
27612 550-Rejected after DATA: '&gt;' missing at end of address:
27613 550 failing address in "From" header is: &lt;user@dom.ain
27614 </literallayout>
27615 <para>
27616 <indexterm role="option">
27617 <primary><option>spamd_address</option></primary>
27618 </indexterm>
27619 </para>
27620 <informaltable frame="all">
27621 <tgroup cols="4" colsep="0" rowsep="0">
27622 <colspec colwidth="8*" align="left"/>
27623 <colspec colwidth="6*" align="center"/>
27624 <colspec colwidth="6*" align="center"/>
27625 <colspec colwidth="6*" align="right"/>
27626 <tbody>
27627 <row>
27628 <entry><option>spamd_address</option></entry>
27629 <entry>Use: <emphasis>main</emphasis></entry>
27630 <entry>Type: <emphasis>string</emphasis></entry>
27631 <entry>Default: <emphasis>see below</emphasis></entry>
27632 </row>
27633 </tbody>
27634 </tgroup>
27635 </informaltable>
27636 <para>
27637 This option is available when Exim is compiled with the content-scanning
27638 extension. It specifies how Exim connects to SpamAssassin&#x2019;s <option>spamd</option> daemon.
27639 The default value is
27640 </para>
27641 <literallayout class="monospaced">
27642 127.0.0.1 783
27643 </literallayout>
27644 <para>
27645 See section <xref linkend="SECTscanspamass"/> for more details.
27646 </para>
27647 <para>
27648 <indexterm role="option">
27649 <primary><option>split_spool_directory</option></primary>
27650 </indexterm>
27651 </para>
27652 <informaltable frame="all">
27653 <tgroup cols="4" colsep="0" rowsep="0">
27654 <colspec colwidth="8*" align="left"/>
27655 <colspec colwidth="6*" align="center"/>
27656 <colspec colwidth="6*" align="center"/>
27657 <colspec colwidth="6*" align="right"/>
27658 <tbody>
27659 <row>
27660 <entry><option>split_spool_directory</option></entry>
27661 <entry>Use: <emphasis>main</emphasis></entry>
27662 <entry>Type: <emphasis>boolean</emphasis></entry>
27663 <entry>Default: <emphasis>false</emphasis></entry>
27664 </row>
27665 </tbody>
27666 </tgroup>
27667 </informaltable>
27668 <para>
27669 <indexterm role="concept">
27670 <primary>multiple spool directories</primary>
27671 </indexterm>
27672 <indexterm role="concept">
27673 <primary>spool directory</primary>
27674 <secondary>split</secondary>
27675 </indexterm>
27676 <indexterm role="concept">
27677 <primary>directories, multiple</primary>
27678 </indexterm>
27679 If this option is set, it causes Exim to split its input directory into 62
27680 subdirectories, each with a single alphanumeric character as its name. The
27681 sixth character of the message id is used to allocate messages to
27682 subdirectories; this is the least significant base-62 digit of the time of
27683 arrival of the message.
27684 </para>
27685 <para>
27686 Splitting up the spool in this way may provide better performance on systems
27687 where there are long mail queues, by reducing the number of files in any one
27688 directory. The msglog directory is also split up in a similar way to the input
27689 directory; however, if <option>preserve_message_logs</option> is set, all old msglog files
27690 are still placed in the single directory <filename>msglog.OLD</filename>.
27691 </para>
27692 <para>
27693 It is not necessary to take any special action for existing messages when
27694 changing <option>split_spool_directory</option>. Exim notices messages that are in the
27695 <quote>wrong</quote> place, and continues to process them. If the option is turned off
27696 after a period of being on, the subdirectories will eventually empty and be
27697 automatically deleted.
27698 </para>
27699 <para>
27700 When <option>split_spool_directory</option> is set, the behaviour of queue runner processes
27701 changes. Instead of creating a list of all messages in the queue, and then
27702 trying to deliver each one in turn, it constructs a list of those in one
27703 sub-directory and tries to deliver them, before moving on to the next
27704 sub-directory. The sub-directories are processed in a random order. This
27705 spreads out the scanning of the input directories, and uses less memory. It is
27706 particularly beneficial when there are lots of messages on the queue. However,
27707 if <option>queue_run_in_order</option> is set, none of this new processing happens. The
27708 entire queue has to be scanned and sorted before any deliveries can start.
27709 </para>
27710 <para>
27711 <indexterm role="option">
27712 <primary><option>spool_directory</option></primary>
27713 </indexterm>
27714 </para>
27715 <informaltable frame="all">
27716 <tgroup cols="4" colsep="0" rowsep="0">
27717 <colspec colwidth="8*" align="left"/>
27718 <colspec colwidth="6*" align="center"/>
27719 <colspec colwidth="6*" align="center"/>
27720 <colspec colwidth="6*" align="right"/>
27721 <tbody>
27722 <row>
27723 <entry><option>spool_directory</option></entry>
27724 <entry>Use: <emphasis>main</emphasis></entry>
27725 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27726 <entry>Default: <emphasis>set at compile time</emphasis></entry>
27727 </row>
27728 </tbody>
27729 </tgroup>
27730 </informaltable>
27731 <para>
27732 <indexterm role="concept">
27733 <primary>spool directory</primary>
27734 <secondary>path to</secondary>
27735 </indexterm>
27736 This defines the directory in which Exim keeps its spool, that is, the messages
27737 it is waiting to deliver. The default value is taken from the compile-time
27738 configuration setting, if there is one. If not, this option must be set. The
27739 string is expanded, so it can contain, for example, a reference to
27740 <varname>$primary_hostname</varname>.
27741 </para>
27742 <para>
27743 If the spool directory name is fixed on your installation, it is recommended
27744 that you set it at build time rather than from this option, particularly if the
27745 log files are being written to the spool directory (see <option>log_file_path</option>).
27746 Otherwise log files cannot be used for errors that are detected early on, such
27747 as failures in the configuration file.
27748 </para>
27749 <para>
27750 By using this option to override the compiled-in path, it is possible to run
27751 tests of Exim without using the standard spool.
27752 </para>
27753 <para>
27754 <indexterm role="option">
27755 <primary><option>sqlite_lock_timeout</option></primary>
27756 </indexterm>
27757 </para>
27758 <informaltable frame="all">
27759 <tgroup cols="4" colsep="0" rowsep="0">
27760 <colspec colwidth="8*" align="left"/>
27761 <colspec colwidth="6*" align="center"/>
27762 <colspec colwidth="6*" align="center"/>
27763 <colspec colwidth="6*" align="right"/>
27764 <tbody>
27765 <row>
27766 <entry><option>sqlite_lock_timeout</option></entry>
27767 <entry>Use: <emphasis>main</emphasis></entry>
27768 <entry>Type: <emphasis>time</emphasis></entry>
27769 <entry>Default: <emphasis>5s</emphasis></entry>
27770 </row>
27771 </tbody>
27772 </tgroup>
27773 </informaltable>
27774 <para>
27775 <indexterm role="concept">
27776 <primary>sqlite lookup type</primary>
27777 <secondary>lock timeout</secondary>
27778 </indexterm>
27779 This option controls the timeout that the <command>sqlite</command> lookup uses when trying to
27780 access an SQLite database. See section <xref linkend="SECTsqlite"/> for more details.
27781 </para>
27782 <para>
27783 <indexterm role="option">
27784 <primary><option>strict_acl_vars</option></primary>
27785 </indexterm>
27786 </para>
27787 <informaltable frame="all">
27788 <tgroup cols="4" colsep="0" rowsep="0">
27789 <colspec colwidth="8*" align="left"/>
27790 <colspec colwidth="6*" align="center"/>
27791 <colspec colwidth="6*" align="center"/>
27792 <colspec colwidth="6*" align="right"/>
27793 <tbody>
27794 <row>
27795 <entry><option>strict_acl_vars</option></entry>
27796 <entry>Use: <emphasis>main</emphasis></entry>
27797 <entry>Type: <emphasis>boolean</emphasis></entry>
27798 <entry>Default: <emphasis>false</emphasis></entry>
27799 </row>
27800 </tbody>
27801 </tgroup>
27802 </informaltable>
27803 <para>
27804 <indexterm role="concept">
27805 <primary>access control lists (ACLs)</primary>
27806 <secondary>variables, handling unset</secondary>
27807 </indexterm>
27808 This option controls what happens if a syntactically valid but undefined ACL
27809 variable is referenced. If it is false (the default), an empty string
27810 is substituted; if it is true, an error is generated. See section
27811 <xref linkend="SECTaclvariables"/> for details of ACL variables.
27812 </para>
27813 <para>
27814 <indexterm role="option">
27815 <primary><option>strip_excess_angle_brackets</option></primary>
27816 </indexterm>
27817 </para>
27818 <informaltable frame="all">
27819 <tgroup cols="4" colsep="0" rowsep="0">
27820 <colspec colwidth="8*" align="left"/>
27821 <colspec colwidth="6*" align="center"/>
27822 <colspec colwidth="6*" align="center"/>
27823 <colspec colwidth="6*" align="right"/>
27824 <tbody>
27825 <row>
27826 <entry><option>strip_excess_angle_brackets</option></entry>
27827 <entry>Use: <emphasis>main</emphasis></entry>
27828 <entry>Type: <emphasis>boolean</emphasis></entry>
27829 <entry>Default: <emphasis>false</emphasis></entry>
27830 </row>
27831 </tbody>
27832 </tgroup>
27833 </informaltable>
27834 <para>
27835 <indexterm role="concept">
27836 <primary>angle brackets, excess</primary>
27837 </indexterm>
27838 If this option is set, redundant pairs of angle brackets round <quote>route-addr</quote>
27839 items in addresses are stripped. For example, <emphasis>&lt;&lt;xxx@a.b.c.d&gt;&gt;</emphasis> is
27840 treated as <emphasis>&lt;xxx@a.b.c.d&gt;</emphasis>. If this is in the envelope and the message is
27841 passed on to another MTA, the excess angle brackets are not passed on. If this
27842 option is not set, multiple pairs of angle brackets cause a syntax error.
27843 </para>
27844 <para>
27845 <indexterm role="option">
27846 <primary><option>strip_trailing_dot</option></primary>
27847 </indexterm>
27848 </para>
27849 <informaltable frame="all">
27850 <tgroup cols="4" colsep="0" rowsep="0">
27851 <colspec colwidth="8*" align="left"/>
27852 <colspec colwidth="6*" align="center"/>
27853 <colspec colwidth="6*" align="center"/>
27854 <colspec colwidth="6*" align="right"/>
27855 <tbody>
27856 <row>
27857 <entry><option>strip_trailing_dot</option></entry>
27858 <entry>Use: <emphasis>main</emphasis></entry>
27859 <entry>Type: <emphasis>boolean</emphasis></entry>
27860 <entry>Default: <emphasis>false</emphasis></entry>
27861 </row>
27862 </tbody>
27863 </tgroup>
27864 </informaltable>
27865 <para>
27866 <indexterm role="concept">
27867 <primary>trailing dot on domain</primary>
27868 </indexterm>
27869 <indexterm role="concept">
27870 <primary>dot</primary>
27871 <secondary>trailing on domain</secondary>
27872 </indexterm>
27873 If this option is set, a trailing dot at the end of a domain in an address is
27874 ignored. If this is in the envelope and the message is passed on to another
27875 MTA, the dot is not passed on. If this option is not set, a dot at the end of a
27876 domain causes a syntax error.
27877 However, addresses in header lines are checked only when an ACL requests header
27878 syntax checking.
27879 </para>
27880 <para>
27881 <indexterm role="option">
27882 <primary><option>syslog_duplication</option></primary>
27883 </indexterm>
27884 </para>
27885 <informaltable frame="all">
27886 <tgroup cols="4" colsep="0" rowsep="0">
27887 <colspec colwidth="8*" align="left"/>
27888 <colspec colwidth="6*" align="center"/>
27889 <colspec colwidth="6*" align="center"/>
27890 <colspec colwidth="6*" align="right"/>
27891 <tbody>
27892 <row>
27893 <entry><option>syslog_duplication</option></entry>
27894 <entry>Use: <emphasis>main</emphasis></entry>
27895 <entry>Type: <emphasis>boolean</emphasis></entry>
27896 <entry>Default: <emphasis>true</emphasis></entry>
27897 </row>
27898 </tbody>
27899 </tgroup>
27900 </informaltable>
27901 <para>
27902 <indexterm role="concept">
27903 <primary>syslog</primary>
27904 <secondary>duplicate log lines; suppressing</secondary>
27905 </indexterm>
27906 When Exim is logging to syslog, it writes the log lines for its three
27907 separate logs at different syslog priorities so that they can in principle
27908 be separated on the logging hosts. Some installations do not require this
27909 separation, and in those cases, the duplication of certain log lines is a
27910 nuisance. If <option>syslog_duplication</option> is set false, only one copy of any
27911 particular log line is written to syslog. For lines that normally go to
27912 both the main log and the reject log, the reject log version (possibly
27913 containing message header lines) is written, at LOG_NOTICE priority.
27914 Lines that normally go to both the main and the panic log are written at
27915 the LOG_ALERT priority.
27916 </para>
27917 <para>
27918 <indexterm role="option">
27919 <primary><option>syslog_facility</option></primary>
27920 </indexterm>
27921 </para>
27922 <informaltable frame="all">
27923 <tgroup cols="4" colsep="0" rowsep="0">
27924 <colspec colwidth="8*" align="left"/>
27925 <colspec colwidth="6*" align="center"/>
27926 <colspec colwidth="6*" align="center"/>
27927 <colspec colwidth="6*" align="right"/>
27928 <tbody>
27929 <row>
27930 <entry><option>syslog_facility</option></entry>
27931 <entry>Use: <emphasis>main</emphasis></entry>
27932 <entry>Type: <emphasis>string</emphasis></entry>
27933 <entry>Default: <emphasis>unset</emphasis></entry>
27934 </row>
27935 </tbody>
27936 </tgroup>
27937 </informaltable>
27938 <para>
27939 <indexterm role="concept">
27940 <primary>syslog</primary>
27941 <secondary>facility; setting</secondary>
27942 </indexterm>
27943 This option sets the syslog <quote>facility</quote> name, used when Exim is logging to
27944 syslog. The value must be one of the strings <quote>mail</quote>, <quote>user</quote>, <quote>news</quote>,
27945 <quote>uucp</quote>, <quote>daemon</quote>, or <quote>local<emphasis>x</emphasis></quote> where <emphasis>x</emphasis> is a digit between 0 and 7.
27946 If this option is unset, <quote>mail</quote> is used. See chapter <xref linkend="CHAPlog"/> for
27947 details of Exim&#x2019;s logging.
27948 </para>
27949 <para>
27950 <indexterm role="option">
27951 <primary><option>syslog_processname</option></primary>
27952 </indexterm>
27953 </para>
27954 <informaltable frame="all">
27955 <tgroup cols="4" colsep="0" rowsep="0">
27956 <colspec colwidth="8*" align="left"/>
27957 <colspec colwidth="6*" align="center"/>
27958 <colspec colwidth="6*" align="center"/>
27959 <colspec colwidth="6*" align="right"/>
27960 <tbody>
27961 <row>
27962 <entry><option>syslog_processname</option></entry>
27963 <entry>Use: <emphasis>main</emphasis></entry>
27964 <entry>Type: <emphasis>string</emphasis></entry>
27965 <entry>Default: <emphasis><literal>exim</literal></emphasis></entry>
27966 </row>
27967 </tbody>
27968 </tgroup>
27969 </informaltable>
27970 <para>
27971 <indexterm role="concept">
27972 <primary>syslog</primary>
27973 <secondary>process name; setting</secondary>
27974 </indexterm>
27975 This option sets the syslog <quote>ident</quote> name, used when Exim is logging to
27976 syslog. The value must be no longer than 32 characters. See chapter
27977 <xref linkend="CHAPlog"/> for details of Exim&#x2019;s logging.
27978 </para>
27979 <para>
27980 <indexterm role="option">
27981 <primary><option>syslog_timestamp</option></primary>
27982 </indexterm>
27983 </para>
27984 <informaltable frame="all">
27985 <tgroup cols="4" colsep="0" rowsep="0">
27986 <colspec colwidth="8*" align="left"/>
27987 <colspec colwidth="6*" align="center"/>
27988 <colspec colwidth="6*" align="center"/>
27989 <colspec colwidth="6*" align="right"/>
27990 <tbody>
27991 <row>
27992 <entry><option>syslog_timestamp</option></entry>
27993 <entry>Use: <emphasis>main</emphasis></entry>
27994 <entry>Type: <emphasis>boolean</emphasis></entry>
27995 <entry>Default: <emphasis>true</emphasis></entry>
27996 </row>
27997 </tbody>
27998 </tgroup>
27999 </informaltable>
28000 <para>
28001 <indexterm role="concept">
28002 <primary>syslog</primary>
28003 <secondary>timestamps</secondary>
28004 </indexterm>
28005 If <option>syslog_timestamp</option> is set false, the timestamps on Exim&#x2019;s log lines are
28006 omitted when these lines are sent to syslog. See chapter <xref linkend="CHAPlog"/> for
28007 details of Exim&#x2019;s logging.
28008 </para>
28009 <para>
28010 <indexterm role="option">
28011 <primary><option>system_filter</option></primary>
28012 </indexterm>
28013 </para>
28014 <informaltable frame="all">
28015 <tgroup cols="4" colsep="0" rowsep="0">
28016 <colspec colwidth="8*" align="left"/>
28017 <colspec colwidth="6*" align="center"/>
28018 <colspec colwidth="6*" align="center"/>
28019 <colspec colwidth="6*" align="right"/>
28020 <tbody>
28021 <row>
28022 <entry><option>system_filter</option></entry>
28023 <entry>Use: <emphasis>main</emphasis></entry>
28024 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28025 <entry>Default: <emphasis>unset</emphasis></entry>
28026 </row>
28027 </tbody>
28028 </tgroup>
28029 </informaltable>
28030 <para>
28031 <indexterm role="concept">
28032 <primary>filter</primary>
28033 <secondary>system filter</secondary>
28034 </indexterm>
28035 <indexterm role="concept">
28036 <primary>system filter</primary>
28037 <secondary>specifying</secondary>
28038 </indexterm>
28039 <indexterm role="concept">
28040 <primary>Sieve filter</primary>
28041 <secondary>not available for system filter</secondary>
28042 </indexterm>
28043 This option specifies an Exim filter file that is applied to all messages at
28044 the start of each delivery attempt, before any routing is done. System filters
28045 must be Exim filters; they cannot be Sieve filters. If the system filter
28046 generates any deliveries to files or pipes, or any new mail messages, the
28047 appropriate <option>system_filter_..._transport</option> option(s) must be set, to define
28048 which transports are to be used. Details of this facility are given in chapter
28049 <xref linkend="CHAPsystemfilter"/>.
28050 </para>
28051 <para>
28052 <indexterm role="option">
28053 <primary><option>system_filter_directory_transport</option></primary>
28054 </indexterm>
28055 </para>
28056 <informaltable frame="all">
28057 <tgroup cols="4" colsep="0" rowsep="0">
28058 <colspec colwidth="8*" align="left"/>
28059 <colspec colwidth="6*" align="center"/>
28060 <colspec colwidth="6*" align="center"/>
28061 <colspec colwidth="6*" align="right"/>
28062 <tbody>
28063 <row>
28064 <entry><option>system_filter_directory_transport</option></entry>
28065 <entry>Use: <emphasis>main</emphasis></entry>
28066 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28067 <entry>Default: <emphasis>unset</emphasis></entry>
28068 </row>
28069 </tbody>
28070 </tgroup>
28071 </informaltable>
28072 <para>
28073 <indexterm role="variable">
28074 <primary><varname>$address_file</varname></primary>
28075 </indexterm>
28076 This sets the name of the transport driver that is to be used when the
28077 <option>save</option> command in a system message filter specifies a path ending in <quote>/</quote>,
28078 implying delivery of each message into a separate file in some directory.
28079 During the delivery, the variable <varname>$address_file</varname> contains the path name.
28080 </para>
28081 <para>
28082 <indexterm role="option">
28083 <primary><option>system_filter_file_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_file_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>file</primary>
28105 <secondary>transport for system filter</secondary>
28106 </indexterm>
28107 This sets the name of the transport driver that is to be used when the <option>save</option>
28108 command in a system message filter specifies a path not ending in <quote>/</quote>. During
28109 the delivery, the variable <varname>$address_file</varname> contains the path name.
28110 </para>
28111 <para>
28112 <indexterm role="option">
28113 <primary><option>system_filter_group</option></primary>
28114 </indexterm>
28115 </para>
28116 <informaltable frame="all">
28117 <tgroup cols="4" colsep="0" rowsep="0">
28118 <colspec colwidth="8*" align="left"/>
28119 <colspec colwidth="6*" align="center"/>
28120 <colspec colwidth="6*" align="center"/>
28121 <colspec colwidth="6*" align="right"/>
28122 <tbody>
28123 <row>
28124 <entry><option>system_filter_group</option></entry>
28125 <entry>Use: <emphasis>main</emphasis></entry>
28126 <entry>Type: <emphasis>string</emphasis></entry>
28127 <entry>Default: <emphasis>unset</emphasis></entry>
28128 </row>
28129 </tbody>
28130 </tgroup>
28131 </informaltable>
28132 <para>
28133 <indexterm role="concept">
28134 <primary>gid (group id)</primary>
28135 <secondary>system filter</secondary>
28136 </indexterm>
28137 This option is used only when <option>system_filter_user</option> is also set. It sets the
28138 gid under which the system filter is run, overriding any gid that is associated
28139 with the user. The value may be numerical or symbolic.
28140 </para>
28141 <para>
28142 <indexterm role="option">
28143 <primary><option>system_filter_pipe_transport</option></primary>
28144 </indexterm>
28145 </para>
28146 <informaltable frame="all">
28147 <tgroup cols="4" colsep="0" rowsep="0">
28148 <colspec colwidth="8*" align="left"/>
28149 <colspec colwidth="6*" align="center"/>
28150 <colspec colwidth="6*" align="center"/>
28151 <colspec colwidth="6*" align="right"/>
28152 <tbody>
28153 <row>
28154 <entry><option>system_filter_pipe_transport</option></entry>
28155 <entry>Use: <emphasis>main</emphasis></entry>
28156 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28157 <entry>Default: <emphasis>unset</emphasis></entry>
28158 </row>
28159 </tbody>
28160 </tgroup>
28161 </informaltable>
28162 <para>
28163 <indexterm role="concept">
28164 <primary><command>pipe</command> transport</primary>
28165 <secondary>for system filter</secondary>
28166 </indexterm>
28167 <indexterm role="variable">
28168 <primary><varname>$address_pipe</varname></primary>
28169 </indexterm>
28170 This specifies the transport driver that is to be used when a <option>pipe</option> command
28171 is used in a system filter. During the delivery, the variable <varname>$address_pipe</varname>
28172 contains the pipe command.
28173 </para>
28174 <para>
28175 <indexterm role="option">
28176 <primary><option>system_filter_reply_transport</option></primary>
28177 </indexterm>
28178 </para>
28179 <informaltable frame="all">
28180 <tgroup cols="4" colsep="0" rowsep="0">
28181 <colspec colwidth="8*" align="left"/>
28182 <colspec colwidth="6*" align="center"/>
28183 <colspec colwidth="6*" align="center"/>
28184 <colspec colwidth="6*" align="right"/>
28185 <tbody>
28186 <row>
28187 <entry><option>system_filter_reply_transport</option></entry>
28188 <entry>Use: <emphasis>main</emphasis></entry>
28189 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28190 <entry>Default: <emphasis>unset</emphasis></entry>
28191 </row>
28192 </tbody>
28193 </tgroup>
28194 </informaltable>
28195 <para>
28196 <indexterm role="concept">
28197 <primary><command>autoreply</command> transport</primary>
28198 <secondary>for system filter</secondary>
28199 </indexterm>
28200 This specifies the transport driver that is to be used when a <option>mail</option> command
28201 is used in a system filter.
28202 </para>
28203 <para>
28204 <indexterm role="option">
28205 <primary><option>system_filter_user</option></primary>
28206 </indexterm>
28207 </para>
28208 <informaltable frame="all">
28209 <tgroup cols="4" colsep="0" rowsep="0">
28210 <colspec colwidth="8*" align="left"/>
28211 <colspec colwidth="6*" align="center"/>
28212 <colspec colwidth="6*" align="center"/>
28213 <colspec colwidth="6*" align="right"/>
28214 <tbody>
28215 <row>
28216 <entry><option>system_filter_user</option></entry>
28217 <entry>Use: <emphasis>main</emphasis></entry>
28218 <entry>Type: <emphasis>string</emphasis></entry>
28219 <entry>Default: <emphasis>unset</emphasis></entry>
28220 </row>
28221 </tbody>
28222 </tgroup>
28223 </informaltable>
28224 <para>
28225 <indexterm role="concept">
28226 <primary>uid (user id)</primary>
28227 <secondary>system filter</secondary>
28228 </indexterm>
28229 If this option is set to root, the system filter is run in the main Exim
28230 delivery process, as root.  Otherwise, the system filter runs in a separate
28231 process, as the given user, defaulting to the Exim run-time user.
28232 Unless the string consists entirely of digits, it
28233 is looked up in the password data. Failure to find the named user causes a
28234 configuration error. The gid is either taken from the password data, or
28235 specified by <option>system_filter_group</option>. When the uid is specified numerically,
28236 <option>system_filter_group</option> is required to be set.
28237 </para>
28238 <para>
28239 If the system filter generates any pipe, file, or reply deliveries, the uid
28240 under which the filter is run is used when transporting them, unless a
28241 transport option overrides.
28242 </para>
28243 <para>
28244 <indexterm role="option">
28245 <primary><option>tcp_nodelay</option></primary>
28246 </indexterm>
28247 </para>
28248 <informaltable frame="all">
28249 <tgroup cols="4" colsep="0" rowsep="0">
28250 <colspec colwidth="8*" align="left"/>
28251 <colspec colwidth="6*" align="center"/>
28252 <colspec colwidth="6*" align="center"/>
28253 <colspec colwidth="6*" align="right"/>
28254 <tbody>
28255 <row>
28256 <entry><option>tcp_nodelay</option></entry>
28257 <entry>Use: <emphasis>main</emphasis></entry>
28258 <entry>Type: <emphasis>boolean</emphasis></entry>
28259 <entry>Default: <emphasis>true</emphasis></entry>
28260 </row>
28261 </tbody>
28262 </tgroup>
28263 </informaltable>
28264 <para>
28265 <indexterm role="concept">
28266 <primary>daemon</primary>
28267 <secondary>TCP_NODELAY on sockets</secondary>
28268 </indexterm>
28269 <indexterm role="concept">
28270 <primary>Nagle algorithm</primary>
28271 </indexterm>
28272 <indexterm role="concept">
28273 <primary>TCP_NODELAY on listening sockets</primary>
28274 </indexterm>
28275 If this option is set false, it stops the Exim daemon setting the
28276 TCP_NODELAY option on its listening sockets. Setting TCP_NODELAY
28277 turns off the <quote>Nagle algorithm</quote>, which is a way of improving network
28278 performance in interactive (character-by-character) situations. Turning it off
28279 should improve Exim&#x2019;s performance a bit, so that is what happens by default.
28280 However, it appears that some broken clients cannot cope, and time out. Hence
28281 this option. It affects only those sockets that are set up for listening by the
28282 daemon. Sockets created by the smtp transport for delivering mail always set
28283 TCP_NODELAY.
28284 </para>
28285 <para>
28286 <indexterm role="option">
28287 <primary><option>timeout_frozen_after</option></primary>
28288 </indexterm>
28289 </para>
28290 <informaltable frame="all">
28291 <tgroup cols="4" colsep="0" rowsep="0">
28292 <colspec colwidth="8*" align="left"/>
28293 <colspec colwidth="6*" align="center"/>
28294 <colspec colwidth="6*" align="center"/>
28295 <colspec colwidth="6*" align="right"/>
28296 <tbody>
28297 <row>
28298 <entry><option>timeout_frozen_after</option></entry>
28299 <entry>Use: <emphasis>main</emphasis></entry>
28300 <entry>Type: <emphasis>time</emphasis></entry>
28301 <entry>Default: <emphasis>0s</emphasis></entry>
28302 </row>
28303 </tbody>
28304 </tgroup>
28305 </informaltable>
28306 <para>
28307 <indexterm role="concept">
28308 <primary>frozen messages</primary>
28309 <secondary>timing out</secondary>
28310 </indexterm>
28311 <indexterm role="concept">
28312 <primary>timeout</primary>
28313 <secondary>frozen messages</secondary>
28314 </indexterm>
28315 If <option>timeout_frozen_after</option> is set to a time greater than zero, a frozen
28316 message of any kind that has been on the queue for longer than the given time
28317 is automatically cancelled at the next queue run. If the frozen message is a
28318 bounce message, it is just discarded; otherwise, a bounce is sent to the
28319 sender, in a similar manner to cancellation by the <option>-Mg</option> command line option.
28320 If you want to timeout frozen bounce messages earlier than other kinds of
28321 frozen message, see <option>ignore_bounce_errors_after</option>.
28322 </para>
28323 <para>
28324 <emphasis role="bold">Note:</emphasis> the default value of zero means no timeouts; with this setting,
28325 frozen messages remain on the queue forever (except for any frozen bounce
28326 messages that are released by <option>ignore_bounce_errors_after</option>).
28327 </para>
28328 <para>
28329 <indexterm role="option">
28330 <primary><option>timezone</option></primary>
28331 </indexterm>
28332 </para>
28333 <informaltable frame="all">
28334 <tgroup cols="4" colsep="0" rowsep="0">
28335 <colspec colwidth="8*" align="left"/>
28336 <colspec colwidth="6*" align="center"/>
28337 <colspec colwidth="6*" align="center"/>
28338 <colspec colwidth="6*" align="right"/>
28339 <tbody>
28340 <row>
28341 <entry><option>timezone</option></entry>
28342 <entry>Use: <emphasis>main</emphasis></entry>
28343 <entry>Type: <emphasis>string</emphasis></entry>
28344 <entry>Default: <emphasis>unset</emphasis></entry>
28345 </row>
28346 </tbody>
28347 </tgroup>
28348 </informaltable>
28349 <para>
28350 <indexterm role="concept">
28351 <primary>timezone, setting</primary>
28352 </indexterm>
28353 The value of <option>timezone</option> is used to set the environment variable TZ while
28354 running Exim (if it is different on entry). This ensures that all timestamps
28355 created by Exim are in the required timezone. If you want all your timestamps
28356 to be in UTC (aka GMT) you should set
28357 </para>
28358 <literallayout class="monospaced">
28359 timezone = UTC
28360 </literallayout>
28361 <para>
28362 The default value is taken from TIMEZONE_DEFAULT in <filename>Local/Makefile</filename>,
28363 or, if that is not set, from the value of the TZ environment variable when Exim
28364 is built. If <option>timezone</option> is set to the empty string, either at build or run
28365 time, any existing TZ variable is removed from the environment when Exim
28366 runs. This is appropriate behaviour for obtaining wall-clock time on some, but
28367 unfortunately not all, operating systems.
28368 </para>
28369 <para>
28370 <indexterm role="option">
28371 <primary><option>tls_advertise_hosts</option></primary>
28372 </indexterm>
28373 </para>
28374 <informaltable frame="all">
28375 <tgroup cols="4" colsep="0" rowsep="0">
28376 <colspec colwidth="8*" align="left"/>
28377 <colspec colwidth="6*" align="center"/>
28378 <colspec colwidth="6*" align="center"/>
28379 <colspec colwidth="6*" align="right"/>
28380 <tbody>
28381 <row>
28382 <entry><option>tls_advertise_hosts</option></entry>
28383 <entry>Use: <emphasis>main</emphasis></entry>
28384 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28385 <entry>Default: <emphasis>unset</emphasis></entry>
28386 </row>
28387 </tbody>
28388 </tgroup>
28389 </informaltable>
28390 <para>
28391 <indexterm role="concept">
28392 <primary>TLS</primary>
28393 <secondary>advertising</secondary>
28394 </indexterm>
28395 <indexterm role="concept">
28396 <primary>encryption</primary>
28397 <secondary>on SMTP connection</secondary>
28398 </indexterm>
28399 <indexterm role="concept">
28400 <primary>SMTP</primary>
28401 <secondary>encrypted connection</secondary>
28402 </indexterm>
28403 When Exim is built with support for TLS encrypted connections, the availability
28404 of the STARTTLS command to set up an encrypted session is advertised in
28405 response to EHLO only to those client hosts that match this option. See
28406 chapter <xref linkend="CHAPTLS"/> for details of Exim&#x2019;s support for TLS.
28407 </para>
28408 <para>
28409 <indexterm role="option">
28410 <primary><option>tls_certificate</option></primary>
28411 </indexterm>
28412 </para>
28413 <informaltable frame="all">
28414 <tgroup cols="4" colsep="0" rowsep="0">
28415 <colspec colwidth="8*" align="left"/>
28416 <colspec colwidth="6*" align="center"/>
28417 <colspec colwidth="6*" align="center"/>
28418 <colspec colwidth="6*" align="right"/>
28419 <tbody>
28420 <row>
28421 <entry><option>tls_certificate</option></entry>
28422 <entry>Use: <emphasis>main</emphasis></entry>
28423 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28424 <entry>Default: <emphasis>unset</emphasis></entry>
28425 </row>
28426 </tbody>
28427 </tgroup>
28428 </informaltable>
28429 <para>
28430 <indexterm role="concept">
28431 <primary>TLS</primary>
28432 <secondary>server certificate; location of</secondary>
28433 </indexterm>
28434 <indexterm role="concept">
28435 <primary>certificate</primary>
28436 <secondary>server, location of</secondary>
28437 </indexterm>
28438 The value of this option is expanded, and must then be the absolute path to a
28439 file which contains the server&#x2019;s certificates. The server&#x2019;s private key is also
28440 assumed to be in this file if <option>tls_privatekey</option> is unset. See chapter
28441 <xref linkend="CHAPTLS"/> for further details.
28442 </para>
28443 <para>
28444 <emphasis role="bold">Note</emphasis>: The certificates defined by this option are used only when Exim is
28445 receiving incoming messages as a server. If you want to supply certificates for
28446 use when sending messages as a client, you must set the <option>tls_certificate</option>
28447 option in the relevant <command>smtp</command> transport.
28448 </para>
28449 <para>
28450 <indexterm role="option">
28451 <primary><option>tls_crl</option></primary>
28452 </indexterm>
28453 </para>
28454 <informaltable frame="all">
28455 <tgroup cols="4" colsep="0" rowsep="0">
28456 <colspec colwidth="8*" align="left"/>
28457 <colspec colwidth="6*" align="center"/>
28458 <colspec colwidth="6*" align="center"/>
28459 <colspec colwidth="6*" align="right"/>
28460 <tbody>
28461 <row>
28462 <entry><option>tls_crl</option></entry>
28463 <entry>Use: <emphasis>main</emphasis></entry>
28464 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28465 <entry>Default: <emphasis>unset</emphasis></entry>
28466 </row>
28467 </tbody>
28468 </tgroup>
28469 </informaltable>
28470 <para>
28471 <indexterm role="concept">
28472 <primary>TLS</primary>
28473 <secondary>server certificate revocation list</secondary>
28474 </indexterm>
28475 <indexterm role="concept">
28476 <primary>certificate</primary>
28477 <secondary>revocation list for server</secondary>
28478 </indexterm>
28479 This option specifies a certificate revocation list. The expanded value must
28480 be the name of a file that contains a CRL in PEM format.
28481 </para>
28482 <para>
28483 <indexterm role="option">
28484 <primary><option>tls_dhparam</option></primary>
28485 </indexterm>
28486 </para>
28487 <informaltable frame="all">
28488 <tgroup cols="4" colsep="0" rowsep="0">
28489 <colspec colwidth="8*" align="left"/>
28490 <colspec colwidth="6*" align="center"/>
28491 <colspec colwidth="6*" align="center"/>
28492 <colspec colwidth="6*" align="right"/>
28493 <tbody>
28494 <row>
28495 <entry><option>tls_dhparam</option></entry>
28496 <entry>Use: <emphasis>main</emphasis></entry>
28497 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28498 <entry>Default: <emphasis>unset</emphasis></entry>
28499 </row>
28500 </tbody>
28501 </tgroup>
28502 </informaltable>
28503 <para>
28504 <indexterm role="concept">
28505 <primary>TLS</primary>
28506 <secondary>D-H parameters for server</secondary>
28507 </indexterm>
28508 The value of this option is expanded, and must then be the absolute path to
28509 a file which contains the server&#x2019;s DH parameter values.
28510 This is used only for OpenSSL. When Exim is linked with GnuTLS, this option is
28511 ignored. See section <xref linkend="SECTopenvsgnu"/> for further details.
28512 </para>
28513 <para>
28514 <indexterm role="option">
28515 <primary><option>tls_on_connect_ports</option></primary>
28516 </indexterm>
28517 </para>
28518 <informaltable frame="all">
28519 <tgroup cols="4" colsep="0" rowsep="0">
28520 <colspec colwidth="8*" align="left"/>
28521 <colspec colwidth="6*" align="center"/>
28522 <colspec colwidth="6*" align="center"/>
28523 <colspec colwidth="6*" align="right"/>
28524 <tbody>
28525 <row>
28526 <entry><option>tls_on_connect_ports</option></entry>
28527 <entry>Use: <emphasis>main</emphasis></entry>
28528 <entry>Type: <emphasis>string list</emphasis></entry>
28529 <entry>Default: <emphasis>unset</emphasis></entry>
28530 </row>
28531 </tbody>
28532 </tgroup>
28533 </informaltable>
28534 <para>
28535 This option specifies a list of incoming SSMTP (aka SMTPS) ports that should
28536 operate the obsolete SSMTP (SMTPS) protocol, where a TLS session is immediately
28537 set up without waiting for the client to issue a STARTTLS command. For
28538 further details, see section <xref linkend="SECTsupobssmt"/>.
28539 </para>
28540 <para>
28541 <indexterm role="option">
28542 <primary><option>tls_privatekey</option></primary>
28543 </indexterm>
28544 </para>
28545 <informaltable frame="all">
28546 <tgroup cols="4" colsep="0" rowsep="0">
28547 <colspec colwidth="8*" align="left"/>
28548 <colspec colwidth="6*" align="center"/>
28549 <colspec colwidth="6*" align="center"/>
28550 <colspec colwidth="6*" align="right"/>
28551 <tbody>
28552 <row>
28553 <entry><option>tls_privatekey</option></entry>
28554 <entry>Use: <emphasis>main</emphasis></entry>
28555 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28556 <entry>Default: <emphasis>unset</emphasis></entry>
28557 </row>
28558 </tbody>
28559 </tgroup>
28560 </informaltable>
28561 <para>
28562 <indexterm role="concept">
28563 <primary>TLS</primary>
28564 <secondary>server private key; location of</secondary>
28565 </indexterm>
28566 The value of this option is expanded, and must then be the absolute path to a
28567 file which contains the server&#x2019;s private key. If this option is unset, or if
28568 the expansion is forced to fail, or the result is an empty string, the private
28569 key is assumed to be in the same file as the server&#x2019;s certificates. See chapter
28570 <xref linkend="CHAPTLS"/> for further details.
28571 </para>
28572 <para>
28573 <indexterm role="option">
28574 <primary><option>tls_remember_esmtp</option></primary>
28575 </indexterm>
28576 </para>
28577 <informaltable frame="all">
28578 <tgroup cols="4" colsep="0" rowsep="0">
28579 <colspec colwidth="8*" align="left"/>
28580 <colspec colwidth="6*" align="center"/>
28581 <colspec colwidth="6*" align="center"/>
28582 <colspec colwidth="6*" align="right"/>
28583 <tbody>
28584 <row>
28585 <entry><option>tls_remember_esmtp</option></entry>
28586 <entry>Use: <emphasis>main</emphasis></entry>
28587 <entry>Type: <emphasis>boolean</emphasis></entry>
28588 <entry>Default: <emphasis>false</emphasis></entry>
28589 </row>
28590 </tbody>
28591 </tgroup>
28592 </informaltable>
28593 <para>
28594 <indexterm role="concept">
28595 <primary>TLS</primary>
28596 <secondary>esmtp state; remembering</secondary>
28597 </indexterm>
28598 <indexterm role="concept">
28599 <primary>TLS</primary>
28600 <secondary>broken clients</secondary>
28601 </indexterm>
28602 If this option is set true, Exim violates the RFCs by remembering that it is in
28603 <quote>esmtp</quote> state after successfully negotiating a TLS session. This provides
28604 support for broken clients that fail to send a new EHLO after starting a
28605 TLS session.
28606 </para>
28607 <para>
28608 <indexterm role="option">
28609 <primary><option>tls_require_ciphers</option></primary>
28610 </indexterm>
28611 </para>
28612 <informaltable frame="all">
28613 <tgroup cols="4" colsep="0" rowsep="0">
28614 <colspec colwidth="8*" align="left"/>
28615 <colspec colwidth="6*" align="center"/>
28616 <colspec colwidth="6*" align="center"/>
28617 <colspec colwidth="6*" align="right"/>
28618 <tbody>
28619 <row>
28620 <entry><option>tls_require_ciphers</option></entry>
28621 <entry>Use: <emphasis>main</emphasis></entry>
28622 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28623 <entry>Default: <emphasis>unset</emphasis></entry>
28624 </row>
28625 </tbody>
28626 </tgroup>
28627 </informaltable>
28628 <para>
28629 <indexterm role="concept">
28630 <primary>TLS</primary>
28631 <secondary>requiring specific ciphers</secondary>
28632 </indexterm>
28633 <indexterm role="concept">
28634 <primary>cipher</primary>
28635 <secondary>requiring specific</secondary>
28636 </indexterm>
28637 This option controls which ciphers can be used for incoming TLS connections.
28638 The <command>smtp</command> transport has an option of the same name for controlling outgoing
28639 connections. This option is expanded for each connection, so can be varied for
28640 different clients if required. The value of this option must be a list of
28641 permitted cipher suites. The OpenSSL and GnuTLS libraries handle cipher control
28642 in somewhat different ways. If GnuTLS is being used, the client controls the
28643 preference order of the available ciphers. Details are given in sections
28644 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
28645 </para>
28646 <para>
28647 <indexterm role="option">
28648 <primary><option>tls_try_verify_hosts</option></primary>
28649 </indexterm>
28650 </para>
28651 <informaltable frame="all">
28652 <tgroup cols="4" colsep="0" rowsep="0">
28653 <colspec colwidth="8*" align="left"/>
28654 <colspec colwidth="6*" align="center"/>
28655 <colspec colwidth="6*" align="center"/>
28656 <colspec colwidth="6*" align="right"/>
28657 <tbody>
28658 <row>
28659 <entry><option>tls_try_verify_hosts</option></entry>
28660 <entry>Use: <emphasis>main</emphasis></entry>
28661 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28662 <entry>Default: <emphasis>unset</emphasis></entry>
28663 </row>
28664 </tbody>
28665 </tgroup>
28666 </informaltable>
28667 <para>
28668 <indexterm role="concept">
28669 <primary>TLS</primary>
28670 <secondary>client certificate verification</secondary>
28671 </indexterm>
28672 <indexterm role="concept">
28673 <primary>certificate</primary>
28674 <secondary>verification of client</secondary>
28675 </indexterm>
28676 See <option>tls_verify_hosts</option> below.
28677 </para>
28678 <para>
28679 <indexterm role="option">
28680 <primary><option>tls_verify_certificates</option></primary>
28681 </indexterm>
28682 </para>
28683 <informaltable frame="all">
28684 <tgroup cols="4" colsep="0" rowsep="0">
28685 <colspec colwidth="8*" align="left"/>
28686 <colspec colwidth="6*" align="center"/>
28687 <colspec colwidth="6*" align="center"/>
28688 <colspec colwidth="6*" align="right"/>
28689 <tbody>
28690 <row>
28691 <entry><option>tls_verify_certificates</option></entry>
28692 <entry>Use: <emphasis>main</emphasis></entry>
28693 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28694 <entry>Default: <emphasis>unset</emphasis></entry>
28695 </row>
28696 </tbody>
28697 </tgroup>
28698 </informaltable>
28699 <para>
28700 <indexterm role="concept">
28701 <primary>TLS</primary>
28702 <secondary>client certificate verification</secondary>
28703 </indexterm>
28704 <indexterm role="concept">
28705 <primary>certificate</primary>
28706 <secondary>verification of client</secondary>
28707 </indexterm>
28708 The value of this option is expanded, and must then be the absolute path to
28709 a file containing permitted certificates for clients that
28710 match <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option>. Alternatively, if you
28711 are using OpenSSL, you can set <option>tls_verify_certificates</option> to the name of a
28712 directory containing certificate files. This does not work with GnuTLS; the
28713 option must be set to the name of a single file if you are using GnuTLS.
28714 </para>
28715 <para>
28716 These certificates should be for the certificate authorities trusted, rather
28717 than the public cert of individual clients.  With both OpenSSL and GnuTLS, if
28718 the value is a file then the certificates are sent by Exim as a server to
28719 connecting clients, defining the list of accepted certificate authorities.
28720 Thus the values defined should be considered public data.  To avoid this,
28721 use OpenSSL with a directory.
28722 </para>
28723 <para>
28724 <indexterm role="option">
28725 <primary><option>tls_verify_hosts</option></primary>
28726 </indexterm>
28727 </para>
28728 <informaltable frame="all">
28729 <tgroup cols="4" colsep="0" rowsep="0">
28730 <colspec colwidth="8*" align="left"/>
28731 <colspec colwidth="6*" align="center"/>
28732 <colspec colwidth="6*" align="center"/>
28733 <colspec colwidth="6*" align="right"/>
28734 <tbody>
28735 <row>
28736 <entry><option>tls_verify_hosts</option></entry>
28737 <entry>Use: <emphasis>main</emphasis></entry>
28738 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28739 <entry>Default: <emphasis>unset</emphasis></entry>
28740 </row>
28741 </tbody>
28742 </tgroup>
28743 </informaltable>
28744 <para>
28745 <indexterm role="concept">
28746 <primary>TLS</primary>
28747 <secondary>client certificate verification</secondary>
28748 </indexterm>
28749 <indexterm role="concept">
28750 <primary>certificate</primary>
28751 <secondary>verification of client</secondary>
28752 </indexterm>
28753 This option, along with <option>tls_try_verify_hosts</option>, controls the checking of
28754 certificates from clients. The expected certificates are defined by
28755 <option>tls_verify_certificates</option>, which must be set. A configuration error occurs if
28756 either <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> is set and
28757 <option>tls_verify_certificates</option> is not set.
28758 </para>
28759 <para>
28760 Any client that matches <option>tls_verify_hosts</option> is constrained by
28761 <option>tls_verify_certificates</option>. When the client initiates a TLS session, it must
28762 present one of the listed certificates. If it does not, the connection is
28763 aborted. <emphasis role="bold">Warning</emphasis>: Including a host in <option>tls_verify_hosts</option> does not require
28764 the host to use TLS. It can still send SMTP commands through unencrypted
28765 connections. Forcing a client to use TLS has to be done separately using an
28766 ACL to reject inappropriate commands when the connection is not encrypted.
28767 </para>
28768 <para>
28769 A weaker form of checking is provided by <option>tls_try_verify_hosts</option>. If a client
28770 matches this option (but not <option>tls_verify_hosts</option>), Exim requests a
28771 certificate and checks it against <option>tls_verify_certificates</option>, but does not
28772 abort the connection if there is no certificate or if it does not match. This
28773 state can be detected in an ACL, which makes it possible to implement policies
28774 such as <quote>accept for relay only if a verified certificate has been received,
28775 but accept for local delivery if encrypted, even without a verified
28776 certificate</quote>.
28777 </para>
28778 <para>
28779 Client hosts that match neither of these lists are not asked to present
28780 certificates.
28781 </para>
28782 <para>
28783 <indexterm role="option">
28784 <primary><option>trusted_groups</option></primary>
28785 </indexterm>
28786 </para>
28787 <informaltable frame="all">
28788 <tgroup cols="4" colsep="0" rowsep="0">
28789 <colspec colwidth="8*" align="left"/>
28790 <colspec colwidth="6*" align="center"/>
28791 <colspec colwidth="6*" align="center"/>
28792 <colspec colwidth="6*" align="right"/>
28793 <tbody>
28794 <row>
28795 <entry><option>trusted_groups</option></entry>
28796 <entry>Use: <emphasis>main</emphasis></entry>
28797 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
28798 <entry>Default: <emphasis>unset</emphasis></entry>
28799 </row>
28800 </tbody>
28801 </tgroup>
28802 </informaltable>
28803 <para>
28804 <indexterm role="concept">
28805 <primary>trusted groups</primary>
28806 </indexterm>
28807 <indexterm role="concept">
28808 <primary>groups</primary>
28809 <secondary>trusted</secondary>
28810 </indexterm>
28811 This option is expanded just once, at the start of Exim&#x2019;s processing. If this
28812 option is set, any process that is running in one of the listed groups, or
28813 which has one of them as a supplementary group, is trusted. The groups can be
28814 specified numerically or by name. See section <xref linkend="SECTtrustedadmin"/> for
28815 details of what trusted callers are permitted to do. If neither
28816 <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the Exim user
28817 are trusted.
28818 </para>
28819 <para>
28820 <indexterm role="option">
28821 <primary><option>trusted_users</option></primary>
28822 </indexterm>
28823 </para>
28824 <informaltable frame="all">
28825 <tgroup cols="4" colsep="0" rowsep="0">
28826 <colspec colwidth="8*" align="left"/>
28827 <colspec colwidth="6*" align="center"/>
28828 <colspec colwidth="6*" align="center"/>
28829 <colspec colwidth="6*" align="right"/>
28830 <tbody>
28831 <row>
28832 <entry><option>trusted_users</option></entry>
28833 <entry>Use: <emphasis>main</emphasis></entry>
28834 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
28835 <entry>Default: <emphasis>unset</emphasis></entry>
28836 </row>
28837 </tbody>
28838 </tgroup>
28839 </informaltable>
28840 <para>
28841 <indexterm role="concept">
28842 <primary>trusted users</primary>
28843 </indexterm>
28844 <indexterm role="concept">
28845 <primary>user</primary>
28846 <secondary>trusted</secondary>
28847 </indexterm>
28848 This option is expanded just once, at the start of Exim&#x2019;s processing. If this
28849 option is set, any process that is running as one of the listed users is
28850 trusted. The users can be specified numerically or by name. See section
28851 <xref linkend="SECTtrustedadmin"/> for details of what trusted callers are permitted to do.
28852 If neither <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the
28853 Exim user are trusted.
28854 </para>
28855 <para>
28856 <indexterm role="option">
28857 <primary><option>unknown_login</option></primary>
28858 </indexterm>
28859 </para>
28860 <informaltable frame="all">
28861 <tgroup cols="4" colsep="0" rowsep="0">
28862 <colspec colwidth="8*" align="left"/>
28863 <colspec colwidth="6*" align="center"/>
28864 <colspec colwidth="6*" align="center"/>
28865 <colspec colwidth="6*" align="right"/>
28866 <tbody>
28867 <row>
28868 <entry><option>unknown_login</option></entry>
28869 <entry>Use: <emphasis>main</emphasis></entry>
28870 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28871 <entry>Default: <emphasis>unset</emphasis></entry>
28872 </row>
28873 </tbody>
28874 </tgroup>
28875 </informaltable>
28876 <para>
28877 <indexterm role="concept">
28878 <primary>uid (user id)</primary>
28879 <secondary>unknown caller</secondary>
28880 </indexterm>
28881 <indexterm role="variable">
28882 <primary><varname>$caller_uid</varname></primary>
28883 </indexterm>
28884 This is a specialized feature for use in unusual configurations. By default, if
28885 the uid of the caller of Exim cannot be looked up using <function>getpwuid()</function>, Exim
28886 gives up. The <option>unknown_login</option> option can be used to set a login name to be
28887 used in this circumstance. It is expanded, so values like <option>user$caller_uid</option>
28888 can be set. When <option>unknown_login</option> is used, the value of <option>unknown_username</option>
28889 is used for the user&#x2019;s real name (gecos field), unless this has been set by the
28890 <option>-F</option> option.
28891 </para>
28892 <para>
28893 <indexterm role="option">
28894 <primary><option>unknown_username</option></primary>
28895 </indexterm>
28896 </para>
28897 <informaltable frame="all">
28898 <tgroup cols="4" colsep="0" rowsep="0">
28899 <colspec colwidth="8*" align="left"/>
28900 <colspec colwidth="6*" align="center"/>
28901 <colspec colwidth="6*" align="center"/>
28902 <colspec colwidth="6*" align="right"/>
28903 <tbody>
28904 <row>
28905 <entry><option>unknown_username</option></entry>
28906 <entry>Use: <emphasis>main</emphasis></entry>
28907 <entry>Type: <emphasis>string</emphasis></entry>
28908 <entry>Default: <emphasis>unset</emphasis></entry>
28909 </row>
28910 </tbody>
28911 </tgroup>
28912 </informaltable>
28913 <para>
28914 See <option>unknown_login</option>.
28915 </para>
28916 <para>
28917 <indexterm role="option">
28918 <primary><option>untrusted_set_sender</option></primary>
28919 </indexterm>
28920 </para>
28921 <informaltable frame="all">
28922 <tgroup cols="4" colsep="0" rowsep="0">
28923 <colspec colwidth="8*" align="left"/>
28924 <colspec colwidth="6*" align="center"/>
28925 <colspec colwidth="6*" align="center"/>
28926 <colspec colwidth="6*" align="right"/>
28927 <tbody>
28928 <row>
28929 <entry><option>untrusted_set_sender</option></entry>
28930 <entry>Use: <emphasis>main</emphasis></entry>
28931 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
28932 <entry>Default: <emphasis>unset</emphasis></entry>
28933 </row>
28934 </tbody>
28935 </tgroup>
28936 </informaltable>
28937 <para>
28938 <indexterm role="concept">
28939 <primary>trusted users</primary>
28940 </indexterm>
28941 <indexterm role="concept">
28942 <primary>sender</primary>
28943 <secondary>setting by untrusted user</secondary>
28944 </indexterm>
28945 <indexterm role="concept">
28946 <primary>untrusted user setting sender</primary>
28947 </indexterm>
28948 <indexterm role="concept">
28949 <primary>user</primary>
28950 <secondary>untrusted setting sender</secondary>
28951 </indexterm>
28952 <indexterm role="concept">
28953 <primary>envelope sender</primary>
28954 </indexterm>
28955 When an untrusted user submits a message to Exim using the standard input, Exim
28956 normally creates an envelope sender address from the user&#x2019;s login and the
28957 default qualification domain. Data from the <option>-f</option> option (for setting envelope
28958 senders on non-SMTP messages) or the SMTP MAIL command (if <option>-bs</option> or <option>-bS</option>
28959 is used) is ignored.
28960 </para>
28961 <para>
28962 However, untrusted users are permitted to set an empty envelope sender address,
28963 to declare that a message should never generate any bounces. For example:
28964 </para>
28965 <literallayout class="monospaced">
28966 exim -f '&lt;&gt;' user@domain.example
28967 </literallayout>
28968 <para>
28969 <indexterm role="variable">
28970 <primary><varname>$sender_ident</varname></primary>
28971 </indexterm>
28972 The <option>untrusted_set_sender</option> option allows you to permit untrusted users to set
28973 other envelope sender addresses in a controlled way. When it is set, untrusted
28974 users are allowed to set envelope sender addresses that match any of the
28975 patterns in the list. Like all address lists, the string is expanded. The
28976 identity of the user is in <varname>$sender_ident</varname>, so you can, for example, restrict
28977 users to setting senders that start with their login ids
28978 followed by a hyphen
28979 by a setting like this:
28980 </para>
28981 <literallayout class="monospaced">
28982 untrusted_set_sender = ^$sender_ident-
28983 </literallayout>
28984 <para>
28985 If you want to allow untrusted users to set envelope sender addresses without
28986 restriction, you can use
28987 </para>
28988 <literallayout class="monospaced">
28989 untrusted_set_sender = *
28990 </literallayout>
28991 <para>
28992 The <option>untrusted_set_sender</option> option applies to all forms of local input, but
28993 only to the setting of the envelope sender. It does not permit untrusted users
28994 to use the other options which trusted user can use to override message
28995 parameters. Furthermore, it does not stop Exim from removing an existing
28996 <emphasis>Sender:</emphasis> header in the message, or from adding a <emphasis>Sender:</emphasis> header if
28997 necessary. See <option>local_sender_retain</option> and <option>local_from_check</option> for ways of
28998 overriding these actions. The handling of the <emphasis>Sender:</emphasis> header is also
28999 described in section <xref linkend="SECTthesenhea"/>.
29000 </para>
29001 <para>
29002 The log line for a message&#x2019;s arrival shows the envelope sender following
29003 <quote>&lt;=</quote>. For local messages, the user&#x2019;s login always follows, after <quote>U=</quote>. In
29004 <option>-bp</option> displays, and in the Exim monitor, if an untrusted user sets an
29005 envelope sender address, the user&#x2019;s login is shown in parentheses after the
29006 sender address.
29007 </para>
29008 <para>
29009 <indexterm role="option">
29010 <primary><option>uucp_from_pattern</option></primary>
29011 </indexterm>
29012 </para>
29013 <informaltable frame="all">
29014 <tgroup cols="4" colsep="0" rowsep="0">
29015 <colspec colwidth="8*" align="left"/>
29016 <colspec colwidth="6*" align="center"/>
29017 <colspec colwidth="6*" align="center"/>
29018 <colspec colwidth="6*" align="right"/>
29019 <tbody>
29020 <row>
29021 <entry><option>uucp_from_pattern</option></entry>
29022 <entry>Use: <emphasis>main</emphasis></entry>
29023 <entry>Type: <emphasis>string</emphasis></entry>
29024 <entry>Default: <emphasis>see below</emphasis></entry>
29025 </row>
29026 </tbody>
29027 </tgroup>
29028 </informaltable>
29029 <para>
29030 <indexterm role="concept">
29031 <primary><quote>From</quote> line</primary>
29032 </indexterm>
29033 <indexterm role="concept">
29034 <primary>UUCP</primary>
29035 <secondary><quote>From</quote> line</secondary>
29036 </indexterm>
29037 Some applications that pass messages to an MTA via a command line interface use
29038 an initial line starting with <quote>From&nbsp;</quote> to pass the envelope sender. In
29039 particular, this is used by UUCP software. Exim recognizes such a line by means
29040 of a regular expression that is set in <option>uucp_from_pattern</option>. When the pattern
29041 matches, the sender address is constructed by expanding the contents of
29042 <option>uucp_from_sender</option>, provided that the caller of Exim is a trusted user. The
29043 default pattern recognizes lines in the following two forms:
29044 </para>
29045 <literallayout class="monospaced">
29046 From ph10 Fri Jan  5 12:35 GMT 1996
29047 From ph10 Fri, 7 Jan 97 14:00:00 GMT
29048 </literallayout>
29049 <para>
29050 The pattern can be seen by running
29051 </para>
29052 <literallayout class="monospaced">
29053 exim -bP uucp_from_pattern
29054 </literallayout>
29055 <para>
29056 It checks only up to the hours and minutes, and allows for a 2-digit or 4-digit
29057 year in the second case. The first word after <quote>From&nbsp;</quote> is matched in the
29058 regular expression by a parenthesized subpattern. The default value for
29059 <option>uucp_from_sender</option> is <quote>$1</quote>, which therefore just uses this first word
29060 (<quote>ph10</quote> in the example above) as the message&#x2019;s sender. See also
29061 <option>ignore_fromline_hosts</option>.
29062 </para>
29063 <para>
29064 <indexterm role="option">
29065 <primary><option>uucp_from_sender</option></primary>
29066 </indexterm>
29067 </para>
29068 <informaltable frame="all">
29069 <tgroup cols="4" colsep="0" rowsep="0">
29070 <colspec colwidth="8*" align="left"/>
29071 <colspec colwidth="6*" align="center"/>
29072 <colspec colwidth="6*" align="center"/>
29073 <colspec colwidth="6*" align="right"/>
29074 <tbody>
29075 <row>
29076 <entry><option>uucp_from_sender</option></entry>
29077 <entry>Use: <emphasis>main</emphasis></entry>
29078 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29079 <entry>Default: <emphasis><literal>$1</literal></emphasis></entry>
29080 </row>
29081 </tbody>
29082 </tgroup>
29083 </informaltable>
29084 <para>
29085 See <option>uucp_from_pattern</option> above.
29086 </para>
29087 <para>
29088 <indexterm role="option">
29089 <primary><option>warn_message_file</option></primary>
29090 </indexterm>
29091 </para>
29092 <informaltable frame="all">
29093 <tgroup cols="4" colsep="0" rowsep="0">
29094 <colspec colwidth="8*" align="left"/>
29095 <colspec colwidth="6*" align="center"/>
29096 <colspec colwidth="6*" align="center"/>
29097 <colspec colwidth="6*" align="right"/>
29098 <tbody>
29099 <row>
29100 <entry><option>warn_message_file</option></entry>
29101 <entry>Use: <emphasis>main</emphasis></entry>
29102 <entry>Type: <emphasis>string</emphasis></entry>
29103 <entry>Default: <emphasis>unset</emphasis></entry>
29104 </row>
29105 </tbody>
29106 </tgroup>
29107 </informaltable>
29108 <para>
29109 <indexterm role="concept">
29110 <primary>warning of delay</primary>
29111 <secondary>customizing the message</secondary>
29112 </indexterm>
29113 <indexterm role="concept">
29114 <primary>customizing</primary>
29115 <secondary>warning message</secondary>
29116 </indexterm>
29117 This option defines a template file containing paragraphs of text to be used
29118 for constructing the warning message which is sent by Exim when a message has
29119 been on the queue for a specified amount of time, as specified by
29120 <option>delay_warning</option>. Details of the file&#x2019;s contents are given in chapter
29121 <xref linkend="CHAPemsgcust"/>. See also <option>bounce_message_file</option>.
29122 </para>
29123 <para>
29124 <indexterm role="option">
29125 <primary><option>write_rejectlog</option></primary>
29126 </indexterm>
29127 </para>
29128 <informaltable frame="all">
29129 <tgroup cols="4" colsep="0" rowsep="0">
29130 <colspec colwidth="8*" align="left"/>
29131 <colspec colwidth="6*" align="center"/>
29132 <colspec colwidth="6*" align="center"/>
29133 <colspec colwidth="6*" align="right"/>
29134 <tbody>
29135 <row>
29136 <entry><option>write_rejectlog</option></entry>
29137 <entry>Use: <emphasis>main</emphasis></entry>
29138 <entry>Type: <emphasis>boolean</emphasis></entry>
29139 <entry>Default: <emphasis>true</emphasis></entry>
29140 </row>
29141 </tbody>
29142 </tgroup>
29143 </informaltable>
29144 <para>
29145 <indexterm role="concept">
29146 <primary>reject log</primary>
29147 <secondary>disabling</secondary>
29148 </indexterm>
29149 If this option is set false, Exim no longer writes anything to the reject log.
29150 See chapter <xref linkend="CHAPlog"/> for details of what Exim writes to its logs.
29151 <indexterm role="concept" startref="IIDconfima" class="endofrange"/>
29152 <indexterm role="concept" startref="IIDmaiconf" class="endofrange"/>
29153 </para>
29154 </section>
29155 </chapter>
29156
29157 <chapter id="CHAProutergeneric">
29158 <title>Generic options for routers</title>
29159 <para>
29160 <indexterm role="concept" id="IIDgenoprou1" class="startofrange">
29161 <primary>options</primary>
29162 <secondary>generic; for routers</secondary>
29163 </indexterm>
29164 <indexterm role="concept" id="IIDgenoprou2" class="startofrange">
29165 <primary>generic options</primary>
29166 <secondary>router</secondary>
29167 </indexterm>
29168 This chapter describes the generic options that apply to all routers.
29169 Those that are preconditions are marked with &Dagger; in the <quote>use</quote> field.
29170 </para>
29171 <para>
29172 For a general description of how a router operates, see sections
29173 <xref linkend="SECTrunindrou"/> and <xref linkend="SECTrouprecon"/>. The latter specifies the order in
29174 which the preconditions are tested. The order of expansion of the options that
29175 provide data for a transport is: <option>errors_to</option>, <option>headers_add</option>,
29176 <option>headers_remove</option>, <option>transport</option>.
29177 </para>
29178 <para>
29179 <indexterm role="option">
29180 <primary><option>address_data</option></primary>
29181 </indexterm>
29182 </para>
29183 <informaltable frame="all">
29184 <tgroup cols="4" colsep="0" rowsep="0">
29185 <colspec colwidth="8*" align="left"/>
29186 <colspec colwidth="6*" align="center"/>
29187 <colspec colwidth="6*" align="center"/>
29188 <colspec colwidth="6*" align="right"/>
29189 <tbody>
29190 <row>
29191 <entry><option>address_data</option></entry>
29192 <entry>Use: <emphasis>routers</emphasis></entry>
29193 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29194 <entry>Default: <emphasis>unset</emphasis></entry>
29195 </row>
29196 </tbody>
29197 </tgroup>
29198 </informaltable>
29199 <para>
29200 <indexterm role="concept">
29201 <primary>router</primary>
29202 <secondary>data attached to address</secondary>
29203 </indexterm>
29204 The string is expanded just before the router is run, that is, after all the
29205 precondition tests have succeeded. If the expansion is forced to fail, the
29206 router declines, the value of <option>address_data</option> remains unchanged, and the
29207 <option>more</option> option controls what happens next. Other expansion failures cause
29208 delivery of the address to be deferred.
29209 </para>
29210 <para>
29211 <indexterm role="variable">
29212 <primary><varname>$address_data</varname></primary>
29213 </indexterm>
29214 When the expansion succeeds, the value is retained with the address, and can be
29215 accessed using the variable <varname>$address_data</varname> in the current router, subsequent
29216 routers, and the eventual transport.
29217 </para>
29218 <para>
29219 <emphasis role="bold">Warning</emphasis>: If the current or any subsequent router is a <command>redirect</command> router
29220 that runs a user&#x2019;s filter file, the contents of <varname>$address_data</varname> are accessible
29221 in the filter. This is not normally a problem, because such data is usually
29222 either not confidential or it <quote>belongs</quote> to the current user, but if you do
29223 put confidential data into <varname>$address_data</varname> you need to remember this point.
29224 </para>
29225 <para>
29226 Even if the router declines or passes, the value of <varname>$address_data</varname> remains
29227 with the address, though it can be changed by another <option>address_data</option> setting
29228 on a subsequent router. If a router generates child addresses, the value of
29229 <varname>$address_data</varname> propagates to them. This also applies to the special kind of
29230 <quote>child</quote> that is generated by a router with the <option>unseen</option> option.
29231 </para>
29232 <para>
29233 The idea of <option>address_data</option> is that you can use it to look up a lot of data
29234 for the address once, and then pick out parts of the data later. For example,
29235 you could use a single LDAP lookup to return a string of the form
29236 </para>
29237 <literallayout class="monospaced">
29238 uid=1234 gid=5678 mailbox=/mail/xyz forward=/home/xyz/.forward
29239 </literallayout>
29240 <para>
29241 In the transport you could pick out the mailbox by a setting such as
29242 </para>
29243 <literallayout class="monospaced">
29244 file = ${extract{mailbox}{$address_data}}
29245 </literallayout>
29246 <para>
29247 This makes the configuration file less messy, and also reduces the number of
29248 lookups (though Exim does cache lookups).
29249 </para>
29250 <para>
29251 <indexterm role="variable">
29252 <primary><varname>$sender_address_data</varname></primary>
29253 </indexterm>
29254 <indexterm role="variable">
29255 <primary><varname>$address_data</varname></primary>
29256 </indexterm>
29257 The <option>address_data</option> facility is also useful as a means of passing information
29258 from one router to another, and from a router to a transport. In addition, if
29259 <varname>$address_data</varname> is set by a router when verifying a recipient address from an
29260 ACL, it remains available for use in the rest of the ACL statement. After
29261 verifying a sender, the value is transferred to <varname>$sender_address_data</varname>.
29262 </para>
29263 <para>
29264 <indexterm role="option">
29265 <primary><option>address_test</option></primary>
29266 </indexterm>
29267 </para>
29268 <informaltable frame="all">
29269 <tgroup cols="4" colsep="0" rowsep="0">
29270 <colspec colwidth="8*" align="left"/>
29271 <colspec colwidth="6*" align="center"/>
29272 <colspec colwidth="6*" align="center"/>
29273 <colspec colwidth="6*" align="right"/>
29274 <tbody>
29275 <row>
29276 <entry><option>address_test</option></entry>
29277 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
29278 <entry>Type: <emphasis>boolean</emphasis></entry>
29279 <entry>Default: <emphasis>true</emphasis></entry>
29280 </row>
29281 </tbody>
29282 </tgroup>
29283 </informaltable>
29284 <para>
29285 <indexterm role="option">
29286 <primary><option>-bt</option></primary>
29287 </indexterm>
29288 <indexterm role="concept">
29289 <primary>router</primary>
29290 <secondary>skipping when address testing</secondary>
29291 </indexterm>
29292 If this option is set false, the router is skipped when routing is being tested
29293 by means of the <option>-bt</option> command line option. This can be a convenience when
29294 your first router sends messages to an external scanner, because it saves you
29295 having to set the <quote>already scanned</quote> indicator when testing real address
29296 routing.
29297 </para>
29298 <para>
29299 <indexterm role="option">
29300 <primary><option>cannot_route_message</option></primary>
29301 </indexterm>
29302 </para>
29303 <informaltable frame="all">
29304 <tgroup cols="4" colsep="0" rowsep="0">
29305 <colspec colwidth="8*" align="left"/>
29306 <colspec colwidth="6*" align="center"/>
29307 <colspec colwidth="6*" align="center"/>
29308 <colspec colwidth="6*" align="right"/>
29309 <tbody>
29310 <row>
29311 <entry><option>cannot_route_message</option></entry>
29312 <entry>Use: <emphasis>routers</emphasis></entry>
29313 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29314 <entry>Default: <emphasis>unset</emphasis></entry>
29315 </row>
29316 </tbody>
29317 </tgroup>
29318 </informaltable>
29319 <para>
29320 <indexterm role="concept">
29321 <primary>router</primary>
29322 <secondary>customizing <quote>cannot route</quote> message</secondary>
29323 </indexterm>
29324 <indexterm role="concept">
29325 <primary>customizing</primary>
29326 <secondary><quote>cannot route</quote> message</secondary>
29327 </indexterm>
29328 This option specifies a text message that is used when an address cannot be
29329 routed because Exim has run out of routers. The default message is
29330 <quote>Unrouteable address</quote>. This option is useful only on routers that have
29331 <option>more</option> set false, or on the very last router in a configuration, because the
29332 value that is used is taken from the last router that is considered. This
29333 includes a router that is skipped because its preconditions are not met, as
29334 well as a router that declines. For example, using the default configuration,
29335 you could put:
29336 </para>
29337 <literallayout class="monospaced">
29338 cannot_route_message = Remote domain not found in DNS
29339 </literallayout>
29340 <para>
29341 on the first router, which is a <command>dnslookup</command> router with <option>more</option> set false,
29342 and
29343 </para>
29344 <literallayout class="monospaced">
29345 cannot_route_message = Unknown local user
29346 </literallayout>
29347 <para>
29348 on the final router that checks for local users. If string expansion fails for
29349 this option, the default message is used. Unless the expansion failure was
29350 explicitly forced, a message about the failure is written to the main and panic
29351 logs, in addition to the normal message about the routing failure.
29352 </para>
29353 <para>
29354 <indexterm role="option">
29355 <primary><option>caseful_local_part</option></primary>
29356 </indexterm>
29357 </para>
29358 <informaltable frame="all">
29359 <tgroup cols="4" colsep="0" rowsep="0">
29360 <colspec colwidth="8*" align="left"/>
29361 <colspec colwidth="6*" align="center"/>
29362 <colspec colwidth="6*" align="center"/>
29363 <colspec colwidth="6*" align="right"/>
29364 <tbody>
29365 <row>
29366 <entry><option>caseful_local_part</option></entry>
29367 <entry>Use: <emphasis>routers</emphasis></entry>
29368 <entry>Type: <emphasis>boolean</emphasis></entry>
29369 <entry>Default: <emphasis>false</emphasis></entry>
29370 </row>
29371 </tbody>
29372 </tgroup>
29373 </informaltable>
29374 <para>
29375 <indexterm role="concept">
29376 <primary>case of local parts</primary>
29377 </indexterm>
29378 <indexterm role="concept">
29379 <primary>router</primary>
29380 <secondary>case of local parts</secondary>
29381 </indexterm>
29382 By default, routers handle the local parts of addresses in a case-insensitive
29383 manner, though the actual case is preserved for transmission with the message.
29384 If you want the case of letters to be significant in a router, you must set
29385 this option true. For individual router options that contain address or local
29386 part lists (for example, <option>local_parts</option>), case-sensitive matching can be
29387 turned on by <quote>+caseful</quote> as a list item. See section <xref linkend="SECTcasletadd"/> for
29388 more details.
29389 </para>
29390 <para>
29391 <indexterm role="variable">
29392 <primary><varname>$local_part</varname></primary>
29393 </indexterm>
29394 <indexterm role="variable">
29395 <primary><varname>$original_local_part</varname></primary>
29396 </indexterm>
29397 <indexterm role="variable">
29398 <primary><varname>$parent_local_part</varname></primary>
29399 </indexterm>
29400 The value of the <varname>$local_part</varname> variable is forced to lower case while a
29401 router is running unless <option>caseful_local_part</option> is set. When a router assigns
29402 an address to a transport, the value of <varname>$local_part</varname> when the transport runs
29403 is the same as it was in the router. Similarly, when a router generates child
29404 addresses by aliasing or forwarding, the values of <varname>$original_local_part</varname>
29405 and <varname>$parent_local_part</varname> are those that were used by the redirecting router.
29406 </para>
29407 <para>
29408 This option applies to the processing of an address by a router. When a
29409 recipient address is being processed in an ACL, there is a separate <option>control</option>
29410 modifier that can be used to specify case-sensitive processing within the ACL
29411 (see section <xref linkend="SECTcontrols"/>).
29412 </para>
29413 <para>
29414 <indexterm role="option">
29415 <primary><option>check_local_user</option></primary>
29416 </indexterm>
29417 </para>
29418 <informaltable frame="all">
29419 <tgroup cols="4" colsep="0" rowsep="0">
29420 <colspec colwidth="8*" align="left"/>
29421 <colspec colwidth="6*" align="center"/>
29422 <colspec colwidth="6*" align="center"/>
29423 <colspec colwidth="6*" align="right"/>
29424 <tbody>
29425 <row>
29426 <entry><option>check_local_user</option></entry>
29427 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
29428 <entry>Type: <emphasis>boolean</emphasis></entry>
29429 <entry>Default: <emphasis>false</emphasis></entry>
29430 </row>
29431 </tbody>
29432 </tgroup>
29433 </informaltable>
29434 <para>
29435 <indexterm role="concept">
29436 <primary>local user, checking in router</primary>
29437 </indexterm>
29438 <indexterm role="concept">
29439 <primary>router</primary>
29440 <secondary>checking for local user</secondary>
29441 </indexterm>
29442 <indexterm role="concept">
29443 <primary><filename>/etc/passwd</filename></primary>
29444 </indexterm>
29445 <indexterm role="variable">
29446 <primary><varname>$home</varname></primary>
29447 </indexterm>
29448 When this option is true, Exim checks that the local part of the recipient
29449 address (with affixes removed if relevant) is the name of an account on the
29450 local system. The check is done by calling the <function>getpwnam()</function> function rather
29451 than trying to read <filename>/etc/passwd</filename> directly. This means that other methods of
29452 holding password data (such as NIS) are supported. If the local part is a local
29453 user, <varname>$home</varname> is set from the password data, and can be tested in other
29454 preconditions that are evaluated after this one (the order of evaluation is
29455 given in section <xref linkend="SECTrouprecon"/>). However, the value of <varname>$home</varname> can be
29456 overridden by <option>router_home_directory</option>. If the local part is not a local user,
29457 the router is skipped.
29458 </para>
29459 <para>
29460 If you want to check that the local part is either the name of a local user
29461 or matches something else, you cannot combine <option>check_local_user</option> with a
29462 setting of <option>local_parts</option>, because that specifies the logical <emphasis>and</emphasis> of the
29463 two conditions. However, you can use a <command>passwd</command> lookup in a <option>local_parts</option>
29464 setting to achieve this. For example:
29465 </para>
29466 <literallayout class="monospaced">
29467 local_parts = passwd;$local_part : lsearch;/etc/other/users
29468 </literallayout>
29469 <para>
29470 Note, however, that the side effects of <option>check_local_user</option> (such as setting
29471 up a home directory) do not occur when a <command>passwd</command> lookup is used in a
29472 <option>local_parts</option> (or any other) precondition.
29473 </para>
29474 <para>
29475 <indexterm role="option">
29476 <primary><option>condition</option></primary>
29477 </indexterm>
29478 </para>
29479 <informaltable frame="all">
29480 <tgroup cols="4" colsep="0" rowsep="0">
29481 <colspec colwidth="8*" align="left"/>
29482 <colspec colwidth="6*" align="center"/>
29483 <colspec colwidth="6*" align="center"/>
29484 <colspec colwidth="6*" align="right"/>
29485 <tbody>
29486 <row>
29487 <entry><option>condition</option></entry>
29488 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
29489 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29490 <entry>Default: <emphasis>unset</emphasis></entry>
29491 </row>
29492 </tbody>
29493 </tgroup>
29494 </informaltable>
29495 <para>
29496 <indexterm role="concept">
29497 <primary>router</primary>
29498 <secondary>customized precondition</secondary>
29499 </indexterm>
29500 This option specifies a general precondition test that has to succeed for the
29501 router to be called. The <option>condition</option> option is the last precondition to be
29502 evaluated (see section <xref linkend="SECTrouprecon"/>). The string is expanded, and if the
29503 result is a forced failure, or an empty string, or one of the strings <quote>0</quote> or
29504 <quote>no</quote> or <quote>false</quote> (checked without regard to the case of the letters), the
29505 router is skipped, and the address is offered to the next one.
29506 </para>
29507 <para>
29508 If the result is any other value, the router is run (as this is the last
29509 precondition to be evaluated, all the other preconditions must be true).
29510 </para>
29511 <para>
29512 This option is unique in that multiple <option>condition</option> options may be present.
29513 All <option>condition</option> options must succeed.
29514 </para>
29515 <para>
29516 The <option>condition</option> option provides a means of applying custom conditions to the
29517 running of routers. Note that in the case of a simple conditional expansion,
29518 the default expansion values are exactly what is wanted. For example:
29519 </para>
29520 <literallayout class="monospaced">
29521 condition = ${if &gt;{$message_age}{600}}
29522 </literallayout>
29523 <para>
29524 Because of the default behaviour of the string expansion, this is equivalent to
29525 </para>
29526 <literallayout class="monospaced">
29527 condition = ${if &gt;{$message_age}{600}{true}{}}
29528 </literallayout>
29529 <para>
29530 A multiple condition example, which succeeds:
29531 </para>
29532 <literallayout class="monospaced">
29533 condition = ${if &gt;{$message_age}{600}}
29534 condition = ${if !eq{${lc:$local_part}}{postmaster}}
29535 condition = foobar
29536 </literallayout>
29537 <para>
29538 If the expansion fails (other than forced failure) delivery is deferred. Some
29539 of the other precondition options are common special cases that could in fact
29540 be specified using <option>condition</option>.
29541 </para>
29542 <para>
29543 <indexterm role="option">
29544 <primary><option>debug_print</option></primary>
29545 </indexterm>
29546 </para>
29547 <informaltable frame="all">
29548 <tgroup cols="4" colsep="0" rowsep="0">
29549 <colspec colwidth="8*" align="left"/>
29550 <colspec colwidth="6*" align="center"/>
29551 <colspec colwidth="6*" align="center"/>
29552 <colspec colwidth="6*" align="right"/>
29553 <tbody>
29554 <row>
29555 <entry><option>debug_print</option></entry>
29556 <entry>Use: <emphasis>routers</emphasis></entry>
29557 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29558 <entry>Default: <emphasis>unset</emphasis></entry>
29559 </row>
29560 </tbody>
29561 </tgroup>
29562 </informaltable>
29563 <para>
29564 <indexterm role="concept">
29565 <primary>testing</primary>
29566 <secondary>variables in drivers</secondary>
29567 </indexterm>
29568 If this option is set and debugging is enabled (see the <option>-d</option> command line
29569 option), the string is expanded and included in the debugging output.
29570 If expansion of the string fails, the error message is written to the debugging
29571 output, and Exim carries on processing.
29572 This option is provided to help with checking out the values of variables and
29573 so on when debugging router configurations. For example, if a <option>condition</option>
29574 option appears not to be working, <option>debug_print</option> can be used to output the
29575 variables it references. The output happens after checks for <option>domains</option>,
29576 <option>local_parts</option>, and <option>check_local_user</option> but before any other preconditions
29577 are tested. A newline is added to the text if it does not end with one.
29578 </para>
29579 <para>
29580 <indexterm role="option">
29581 <primary><option>disable_logging</option></primary>
29582 </indexterm>
29583 </para>
29584 <informaltable frame="all">
29585 <tgroup cols="4" colsep="0" rowsep="0">
29586 <colspec colwidth="8*" align="left"/>
29587 <colspec colwidth="6*" align="center"/>
29588 <colspec colwidth="6*" align="center"/>
29589 <colspec colwidth="6*" align="right"/>
29590 <tbody>
29591 <row>
29592 <entry><option>disable_logging</option></entry>
29593 <entry>Use: <emphasis>routers</emphasis></entry>
29594 <entry>Type: <emphasis>boolean</emphasis></entry>
29595 <entry>Default: <emphasis>false</emphasis></entry>
29596 </row>
29597 </tbody>
29598 </tgroup>
29599 </informaltable>
29600 <para>
29601 If this option is set true, nothing is logged for any routing errors
29602 or for any deliveries caused by this router. You should not set this option
29603 unless you really, really know what you are doing. See also the generic
29604 transport option of the same name.
29605 </para>
29606 <para>
29607 <indexterm role="option">
29608 <primary><option>domains</option></primary>
29609 </indexterm>
29610 </para>
29611 <informaltable frame="all">
29612 <tgroup cols="4" colsep="0" rowsep="0">
29613 <colspec colwidth="8*" align="left"/>
29614 <colspec colwidth="6*" align="center"/>
29615 <colspec colwidth="6*" align="center"/>
29616 <colspec colwidth="6*" align="right"/>
29617 <tbody>
29618 <row>
29619 <entry><option>domains</option></entry>
29620 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
29621 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
29622 <entry>Default: <emphasis>unset</emphasis></entry>
29623 </row>
29624 </tbody>
29625 </tgroup>
29626 </informaltable>
29627 <para>
29628 <indexterm role="concept">
29629 <primary>router</primary>
29630 <secondary>restricting to specific domains</secondary>
29631 </indexterm>
29632 <indexterm role="variable">
29633 <primary><varname>$domain_data</varname></primary>
29634 </indexterm>
29635 If this option is set, the router is skipped unless the current domain matches
29636 the list. If the match is achieved by means of a file lookup, the data that the
29637 lookup returned for the domain is placed in <varname>$domain_data</varname> for use in string
29638 expansions of the driver&#x2019;s private options. See section <xref linkend="SECTrouprecon"/> for
29639 a list of the order in which preconditions are evaluated.
29640 </para>
29641 <para>
29642 <indexterm role="option">
29643 <primary><option>driver</option></primary>
29644 </indexterm>
29645 </para>
29646 <informaltable frame="all">
29647 <tgroup cols="4" colsep="0" rowsep="0">
29648 <colspec colwidth="8*" align="left"/>
29649 <colspec colwidth="6*" align="center"/>
29650 <colspec colwidth="6*" align="center"/>
29651 <colspec colwidth="6*" align="right"/>
29652 <tbody>
29653 <row>
29654 <entry><option>driver</option></entry>
29655 <entry>Use: <emphasis>routers</emphasis></entry>
29656 <entry>Type: <emphasis>string</emphasis></entry>
29657 <entry>Default: <emphasis>unset</emphasis></entry>
29658 </row>
29659 </tbody>
29660 </tgroup>
29661 </informaltable>
29662 <para>
29663 This option must always be set. It specifies which of the available routers is
29664 to be used.
29665 </para>
29666 <para>
29667 <indexterm role="option">
29668 <primary><option>errors_to</option></primary>
29669 </indexterm>
29670 </para>
29671 <informaltable frame="all">
29672 <tgroup cols="4" colsep="0" rowsep="0">
29673 <colspec colwidth="8*" align="left"/>
29674 <colspec colwidth="6*" align="center"/>
29675 <colspec colwidth="6*" align="center"/>
29676 <colspec colwidth="6*" align="right"/>
29677 <tbody>
29678 <row>
29679 <entry><option>errors_to</option></entry>
29680 <entry>Use: <emphasis>routers</emphasis></entry>
29681 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29682 <entry>Default: <emphasis>unset</emphasis></entry>
29683 </row>
29684 </tbody>
29685 </tgroup>
29686 </informaltable>
29687 <para>
29688 <indexterm role="concept">
29689 <primary>envelope sender</primary>
29690 </indexterm>
29691 <indexterm role="concept">
29692 <primary>router</primary>
29693 <secondary>changing address for errors</secondary>
29694 </indexterm>
29695 If a router successfully handles an address, it may assign the address to a
29696 transport for delivery or it may generate child addresses. In both cases, if
29697 there is a delivery problem during later processing, the resulting bounce
29698 message is sent to the address that results from expanding this string,
29699 provided that the address verifies successfully. The <option>errors_to</option> option is
29700 expanded before <option>headers_add</option>, <option>headers_remove</option>, and <option>transport</option>.
29701 </para>
29702 <para>
29703 The <option>errors_to</option> setting associated with an address can be overridden if it
29704 subsequently passes through other routers that have their own <option>errors_to</option>
29705 settings, or if the message is delivered by a transport with a <option>return_path</option>
29706 setting.
29707 </para>
29708 <para>
29709 If <option>errors_to</option> is unset, or the expansion is forced to fail, or the result of
29710 the expansion fails to verify, the errors address associated with the incoming
29711 address is used. At top level, this is the envelope sender. A non-forced
29712 expansion failure causes delivery to be deferred.
29713 </para>
29714 <para>
29715 If an address for which <option>errors_to</option> has been set ends up being delivered over
29716 SMTP, the envelope sender for that delivery is the <option>errors_to</option> value, so that
29717 any bounces that are generated by other MTAs on the delivery route are also
29718 sent there. You can set <option>errors_to</option> to the empty string by either of these
29719 settings:
29720 </para>
29721 <literallayout class="monospaced">
29722 errors_to =
29723 errors_to = ""
29724 </literallayout>
29725 <para>
29726 An expansion item that yields an empty string has the same effect. If you do
29727 this, a locally detected delivery error for addresses processed by this router
29728 no longer gives rise to a bounce message; the error is discarded. If the
29729 address is delivered to a remote host, the return path is set to <literal>&lt;&gt;</literal>, unless
29730 overridden by the <option>return_path</option> option on the transport.
29731 </para>
29732 <para>
29733 <indexterm role="variable">
29734 <primary><varname>$address_data</varname></primary>
29735 </indexterm>
29736 If for some reason you want to discard local errors, but use a non-empty
29737 MAIL command for remote delivery, you can preserve the original return
29738 path in <varname>$address_data</varname> in the router, and reinstate it in the transport by
29739 setting <option>return_path</option>.
29740 </para>
29741 <para>
29742 The most common use of <option>errors_to</option> is to direct mailing list bounces to the
29743 manager of the list, as described in section <xref linkend="SECTmailinglists"/>, or to
29744 implement VERP (Variable Envelope Return Paths) (see section <xref linkend="SECTverp"/>).
29745 </para>
29746 <para>
29747 <indexterm role="option">
29748 <primary><option>expn</option></primary>
29749 </indexterm>
29750 </para>
29751 <informaltable frame="all">
29752 <tgroup cols="4" colsep="0" rowsep="0">
29753 <colspec colwidth="8*" align="left"/>
29754 <colspec colwidth="6*" align="center"/>
29755 <colspec colwidth="6*" align="center"/>
29756 <colspec colwidth="6*" align="right"/>
29757 <tbody>
29758 <row>
29759 <entry><option>expn</option></entry>
29760 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
29761 <entry>Type: <emphasis>boolean</emphasis></entry>
29762 <entry>Default: <emphasis>true</emphasis></entry>
29763 </row>
29764 </tbody>
29765 </tgroup>
29766 </informaltable>
29767 <para>
29768 <indexterm role="concept">
29769 <primary>address</primary>
29770 <secondary>testing</secondary>
29771 </indexterm>
29772 <indexterm role="concept">
29773 <primary>testing</primary>
29774 <secondary>addresses</secondary>
29775 </indexterm>
29776 <indexterm role="concept">
29777 <primary>EXPN</primary>
29778 <secondary>router skipping</secondary>
29779 </indexterm>
29780 <indexterm role="concept">
29781 <primary>router</primary>
29782 <secondary>skipping for EXPN</secondary>
29783 </indexterm>
29784 If this option is turned off, the router is skipped when testing an address
29785 as a result of processing an SMTP EXPN command. You might, for example,
29786 want to turn it off on a router for users&#x2019; <filename>.forward</filename> files, while leaving it
29787 on for the system alias file.
29788 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
29789 are evaluated.
29790 </para>
29791 <para>
29792 The use of the SMTP EXPN command is controlled by an ACL (see chapter
29793 <xref linkend="CHAPACL"/>). When Exim is running an EXPN command, it is similar to testing
29794 an address with <option>-bt</option>. Compare VRFY, whose counterpart is <option>-bv</option>.
29795 </para>
29796 <para>
29797 <indexterm role="option">
29798 <primary><option>fail_verify</option></primary>
29799 </indexterm>
29800 </para>
29801 <informaltable frame="all">
29802 <tgroup cols="4" colsep="0" rowsep="0">
29803 <colspec colwidth="8*" align="left"/>
29804 <colspec colwidth="6*" align="center"/>
29805 <colspec colwidth="6*" align="center"/>
29806 <colspec colwidth="6*" align="right"/>
29807 <tbody>
29808 <row>
29809 <entry><option>fail_verify</option></entry>
29810 <entry>Use: <emphasis>routers</emphasis></entry>
29811 <entry>Type: <emphasis>boolean</emphasis></entry>
29812 <entry>Default: <emphasis>false</emphasis></entry>
29813 </row>
29814 </tbody>
29815 </tgroup>
29816 </informaltable>
29817 <para>
29818 <indexterm role="concept">
29819 <primary>router</primary>
29820 <secondary>forcing verification failure</secondary>
29821 </indexterm>
29822 Setting this option has the effect of setting both <option>fail_verify_sender</option> and
29823 <option>fail_verify_recipient</option> to the same value.
29824 </para>
29825 <para>
29826 <indexterm role="option">
29827 <primary><option>fail_verify_recipient</option></primary>
29828 </indexterm>
29829 </para>
29830 <informaltable frame="all">
29831 <tgroup cols="4" colsep="0" rowsep="0">
29832 <colspec colwidth="8*" align="left"/>
29833 <colspec colwidth="6*" align="center"/>
29834 <colspec colwidth="6*" align="center"/>
29835 <colspec colwidth="6*" align="right"/>
29836 <tbody>
29837 <row>
29838 <entry><option>fail_verify_recipient</option></entry>
29839 <entry>Use: <emphasis>routers</emphasis></entry>
29840 <entry>Type: <emphasis>boolean</emphasis></entry>
29841 <entry>Default: <emphasis>false</emphasis></entry>
29842 </row>
29843 </tbody>
29844 </tgroup>
29845 </informaltable>
29846 <para>
29847 If this option is true and an address is accepted by this router when
29848 verifying a recipient, verification fails.
29849 </para>
29850 <para>
29851 <indexterm role="option">
29852 <primary><option>fail_verify_sender</option></primary>
29853 </indexterm>
29854 </para>
29855 <informaltable frame="all">
29856 <tgroup cols="4" colsep="0" rowsep="0">
29857 <colspec colwidth="8*" align="left"/>
29858 <colspec colwidth="6*" align="center"/>
29859 <colspec colwidth="6*" align="center"/>
29860 <colspec colwidth="6*" align="right"/>
29861 <tbody>
29862 <row>
29863 <entry><option>fail_verify_sender</option></entry>
29864 <entry>Use: <emphasis>routers</emphasis></entry>
29865 <entry>Type: <emphasis>boolean</emphasis></entry>
29866 <entry>Default: <emphasis>false</emphasis></entry>
29867 </row>
29868 </tbody>
29869 </tgroup>
29870 </informaltable>
29871 <para>
29872 If this option is true and an address is accepted by this router when
29873 verifying a sender, verification fails.
29874 </para>
29875 <para>
29876 <indexterm role="option">
29877 <primary><option>fallback_hosts</option></primary>
29878 </indexterm>
29879 </para>
29880 <informaltable frame="all">
29881 <tgroup cols="4" colsep="0" rowsep="0">
29882 <colspec colwidth="8*" align="left"/>
29883 <colspec colwidth="6*" align="center"/>
29884 <colspec colwidth="6*" align="center"/>
29885 <colspec colwidth="6*" align="right"/>
29886 <tbody>
29887 <row>
29888 <entry><option>fallback_hosts</option></entry>
29889 <entry>Use: <emphasis>routers</emphasis></entry>
29890 <entry>Type: <emphasis>string list</emphasis></entry>
29891 <entry>Default: <emphasis>unset</emphasis></entry>
29892 </row>
29893 </tbody>
29894 </tgroup>
29895 </informaltable>
29896 <para>
29897 <indexterm role="concept">
29898 <primary>router</primary>
29899 <secondary>fallback hosts</secondary>
29900 </indexterm>
29901 <indexterm role="concept">
29902 <primary>fallback</primary>
29903 <secondary>hosts specified on router</secondary>
29904 </indexterm>
29905 String expansion is not applied to this option. The argument must be a
29906 colon-separated list of host names or IP addresses. The list separator can be
29907 changed (see section <xref linkend="SECTlistconstruct"/>), and a port can be specified with
29908 each name or address. In fact, the format of each item is exactly the same as
29909 defined for the list of hosts in a <command>manualroute</command> router (see section
29910 <xref linkend="SECTformatonehostitem"/>).
29911 </para>
29912 <para>
29913 If a router queues an address for a remote transport, this host list is
29914 associated with the address, and used instead of the transport&#x2019;s fallback host
29915 list. If <option>hosts_randomize</option> is set on the transport, the order of the list is
29916 randomized for each use. See the <option>fallback_hosts</option> option of the <command>smtp</command>
29917 transport for further details.
29918 </para>
29919 <para>
29920 <indexterm role="option">
29921 <primary><option>group</option></primary>
29922 </indexterm>
29923 </para>
29924 <informaltable frame="all">
29925 <tgroup cols="4" colsep="0" rowsep="0">
29926 <colspec colwidth="8*" align="left"/>
29927 <colspec colwidth="6*" align="center"/>
29928 <colspec colwidth="6*" align="center"/>
29929 <colspec colwidth="6*" align="right"/>
29930 <tbody>
29931 <row>
29932 <entry><option>group</option></entry>
29933 <entry>Use: <emphasis>routers</emphasis></entry>
29934 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29935 <entry>Default: <emphasis>see below</emphasis></entry>
29936 </row>
29937 </tbody>
29938 </tgroup>
29939 </informaltable>
29940 <para>
29941 <indexterm role="concept">
29942 <primary>gid (group id)</primary>
29943 <secondary>local delivery</secondary>
29944 </indexterm>
29945 <indexterm role="concept">
29946 <primary>local transports</primary>
29947 <secondary>uid and gid</secondary>
29948 </indexterm>
29949 <indexterm role="concept">
29950 <primary>transport</primary>
29951 <secondary>local</secondary>
29952 </indexterm>
29953 <indexterm role="concept">
29954 <primary>router</primary>
29955 <secondary>setting group</secondary>
29956 </indexterm>
29957 When a router queues an address for a transport, and the transport does not
29958 specify a group, the group given here is used when running the delivery
29959 process.
29960 The group may be specified numerically or by name. If expansion fails, the
29961 error is logged and delivery is deferred.
29962 The default is unset, unless <option>check_local_user</option> is set, when the default
29963 is taken from the password information. See also <option>initgroups</option> and <option>user</option>
29964 and the discussion in chapter <xref linkend="CHAPenvironment"/>.
29965 </para>
29966 <para>
29967 <indexterm role="option">
29968 <primary><option>headers_add</option></primary>
29969 </indexterm>
29970 </para>
29971 <informaltable frame="all">
29972 <tgroup cols="4" colsep="0" rowsep="0">
29973 <colspec colwidth="8*" align="left"/>
29974 <colspec colwidth="6*" align="center"/>
29975 <colspec colwidth="6*" align="center"/>
29976 <colspec colwidth="6*" align="right"/>
29977 <tbody>
29978 <row>
29979 <entry><option>headers_add</option></entry>
29980 <entry>Use: <emphasis>routers</emphasis></entry>
29981 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29982 <entry>Default: <emphasis>unset</emphasis></entry>
29983 </row>
29984 </tbody>
29985 </tgroup>
29986 </informaltable>
29987 <para>
29988 <indexterm role="concept">
29989 <primary>header lines</primary>
29990 <secondary>adding</secondary>
29991 </indexterm>
29992 <indexterm role="concept">
29993 <primary>router</primary>
29994 <secondary>adding header lines</secondary>
29995 </indexterm>
29996 This option specifies a string of text that is expanded at routing time, and
29997 associated with any addresses that are accepted by the router. However, this
29998 option has no effect when an address is just being verified. The way in which
29999 the text is used to add header lines at transport time is described in section
30000 <xref linkend="SECTheadersaddrem"/>. New header lines are not actually added until the
30001 message is in the process of being transported. This means that references to
30002 header lines in string expansions in the transport&#x2019;s configuration do not
30003 <quote>see</quote> the added header lines.
30004 </para>
30005 <para>
30006 The <option>headers_add</option> option is expanded after <option>errors_to</option>, but before
30007 <option>headers_remove</option> and <option>transport</option>. If the expanded string is empty, or if
30008 the expansion is forced to fail, the option has no effect. Other expansion
30009 failures are treated as configuration errors.
30010 </para>
30011 <para>
30012 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_add</option> option cannot be used for a <command>redirect</command>
30013 router that has the <option>one_time</option> option set.
30014 </para>
30015 <para>
30016 <indexterm role="concept">
30017 <primary>duplicate addresses</primary>
30018 </indexterm>
30019 <indexterm role="option">
30020 <primary><option>unseen</option></primary>
30021 </indexterm>
30022 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
30023 additions are deleted when the address is passed on to subsequent routers.
30024 For a <option>redirect</option> router, if a generated address is the same as the incoming
30025 address, this can lead to duplicate addresses with different header
30026 modifications. Exim does not do duplicate deliveries (except, in certain
30027 circumstances, to pipes -- see section <xref linkend="SECTdupaddr"/>), but it is undefined
30028 which of the duplicates is discarded, so this ambiguous situation should be
30029 avoided. The <option>repeat_use</option> option of the <option>redirect</option> router may be of help.
30030 </para>
30031 <para>
30032 <indexterm role="option">
30033 <primary><option>headers_remove</option></primary>
30034 </indexterm>
30035 </para>
30036 <informaltable frame="all">
30037 <tgroup cols="4" colsep="0" rowsep="0">
30038 <colspec colwidth="8*" align="left"/>
30039 <colspec colwidth="6*" align="center"/>
30040 <colspec colwidth="6*" align="center"/>
30041 <colspec colwidth="6*" align="right"/>
30042 <tbody>
30043 <row>
30044 <entry><option>headers_remove</option></entry>
30045 <entry>Use: <emphasis>routers</emphasis></entry>
30046 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30047 <entry>Default: <emphasis>unset</emphasis></entry>
30048 </row>
30049 </tbody>
30050 </tgroup>
30051 </informaltable>
30052 <para>
30053 <indexterm role="concept">
30054 <primary>header lines</primary>
30055 <secondary>removing</secondary>
30056 </indexterm>
30057 <indexterm role="concept">
30058 <primary>router</primary>
30059 <secondary>removing header lines</secondary>
30060 </indexterm>
30061 This option specifies a string of text that is expanded at routing time, and
30062 associated with any addresses that are accepted by the router. However, this
30063 option has no effect when an address is just being verified. The way in which
30064 the text is used to remove header lines at transport time is described in
30065 section <xref linkend="SECTheadersaddrem"/>. Header lines are not actually removed until
30066 the message is in the process of being transported. This means that references
30067 to header lines in string expansions in the transport&#x2019;s configuration still
30068 <quote>see</quote> the original header lines.
30069 </para>
30070 <para>
30071 The <option>headers_remove</option> option is expanded after <option>errors_to</option> and
30072 <option>headers_add</option>, but before <option>transport</option>. If the expansion is forced to fail,
30073 the option has no effect. Other expansion failures are treated as configuration
30074 errors.
30075 </para>
30076 <para>
30077 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_remove</option> option cannot be used for a <command>redirect</command>
30078 router that has the <option>one_time</option> option set.
30079 </para>
30080 <para>
30081 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
30082 removal requests are deleted when the address is passed on to subsequent
30083 routers, and this can lead to problems with duplicates -- see the similar
30084 warning for <option>headers_add</option> above.
30085 </para>
30086 <para>
30087 <indexterm role="option">
30088 <primary><option>ignore_target_hosts</option></primary>
30089 </indexterm>
30090 </para>
30091 <informaltable frame="all">
30092 <tgroup cols="4" colsep="0" rowsep="0">
30093 <colspec colwidth="8*" align="left"/>
30094 <colspec colwidth="6*" align="center"/>
30095 <colspec colwidth="6*" align="center"/>
30096 <colspec colwidth="6*" align="right"/>
30097 <tbody>
30098 <row>
30099 <entry><option>ignore_target_hosts</option></entry>
30100 <entry>Use: <emphasis>routers</emphasis></entry>
30101 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
30102 <entry>Default: <emphasis>unset</emphasis></entry>
30103 </row>
30104 </tbody>
30105 </tgroup>
30106 </informaltable>
30107 <para>
30108 <indexterm role="concept">
30109 <primary>IP address</primary>
30110 <secondary>discarding</secondary>
30111 </indexterm>
30112 <indexterm role="concept">
30113 <primary>router</primary>
30114 <secondary>discarding IP addresses</secondary>
30115 </indexterm>
30116 Although this option is a host list, it should normally contain IP address
30117 entries rather than names. If any host that is looked up by the router has an
30118 IP address that matches an item in this list, Exim behaves as if that IP
30119 address did not exist. This option allows you to cope with rogue DNS entries
30120 like
30121 </para>
30122 <literallayout class="monospaced">
30123 remote.domain.example.  A  127.0.0.1
30124 </literallayout>
30125 <para>
30126 by setting
30127 </para>
30128 <literallayout class="monospaced">
30129 ignore_target_hosts = 127.0.0.1
30130 </literallayout>
30131 <para>
30132 on the relevant router. If all the hosts found by a <command>dnslookup</command> router are
30133 discarded in this way, the router declines. In a conventional configuration, an
30134 attempt to mail to such a domain would normally provoke the <quote>unrouteable
30135 domain</quote> error, and an attempt to verify an address in the domain would fail.
30136 Similarly, if <option>ignore_target_hosts</option> is set on an <command>ipliteral</command> router, the
30137 router declines if presented with one of the listed addresses.
30138 </para>
30139 <para>
30140 You can use this option to disable the use of IPv4 or IPv6 for mail delivery by
30141 means of the first or the second of the following settings, respectively:
30142 </para>
30143 <literallayout class="monospaced">
30144 ignore_target_hosts = 0.0.0.0/0
30145 ignore_target_hosts = &lt;; 0::0/0
30146 </literallayout>
30147 <para>
30148 The pattern in the first line matches all IPv4 addresses, whereas the pattern
30149 in the second line matches all IPv6 addresses.
30150 </para>
30151 <para>
30152 This option may also be useful for ignoring link-local and site-local IPv6
30153 addresses. Because, like all host lists, the value of <option>ignore_target_hosts</option>
30154 is expanded before use as a list, it is possible to make it dependent on the
30155 domain that is being routed.
30156 </para>
30157 <para>
30158 <indexterm role="variable">
30159 <primary><varname>$host_address</varname></primary>
30160 </indexterm>
30161 During its expansion, <varname>$host_address</varname> is set to the IP address that is being
30162 checked.
30163 </para>
30164 <para>
30165 <indexterm role="option">
30166 <primary><option>initgroups</option></primary>
30167 </indexterm>
30168 </para>
30169 <informaltable frame="all">
30170 <tgroup cols="4" colsep="0" rowsep="0">
30171 <colspec colwidth="8*" align="left"/>
30172 <colspec colwidth="6*" align="center"/>
30173 <colspec colwidth="6*" align="center"/>
30174 <colspec colwidth="6*" align="right"/>
30175 <tbody>
30176 <row>
30177 <entry><option>initgroups</option></entry>
30178 <entry>Use: <emphasis>routers</emphasis></entry>
30179 <entry>Type: <emphasis>boolean</emphasis></entry>
30180 <entry>Default: <emphasis>false</emphasis></entry>
30181 </row>
30182 </tbody>
30183 </tgroup>
30184 </informaltable>
30185 <para>
30186 <indexterm role="concept">
30187 <primary>additional groups</primary>
30188 </indexterm>
30189 <indexterm role="concept">
30190 <primary>groups</primary>
30191 <secondary>additional</secondary>
30192 </indexterm>
30193 <indexterm role="concept">
30194 <primary>local transports</primary>
30195 <secondary>uid and gid</secondary>
30196 </indexterm>
30197 <indexterm role="concept">
30198 <primary>transport</primary>
30199 <secondary>local</secondary>
30200 </indexterm>
30201 If the router queues an address for a transport, and this option is true, and
30202 the uid supplied by the router is not overridden by the transport, the
30203 <function>initgroups()</function> function is called when running the transport to ensure that
30204 any additional groups associated with the uid are set up. See also <option>group</option>
30205 and <option>user</option> and the discussion in chapter <xref linkend="CHAPenvironment"/>.
30206 </para>
30207 <para>
30208 <indexterm role="option">
30209 <primary><option>local_part_prefix</option></primary>
30210 </indexterm>
30211 </para>
30212 <informaltable frame="all">
30213 <tgroup cols="4" colsep="0" rowsep="0">
30214 <colspec colwidth="8*" align="left"/>
30215 <colspec colwidth="6*" align="center"/>
30216 <colspec colwidth="6*" align="center"/>
30217 <colspec colwidth="6*" align="right"/>
30218 <tbody>
30219 <row>
30220 <entry><option>local_part_prefix</option></entry>
30221 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
30222 <entry>Type: <emphasis>string list</emphasis></entry>
30223 <entry>Default: <emphasis>unset</emphasis></entry>
30224 </row>
30225 </tbody>
30226 </tgroup>
30227 </informaltable>
30228 <para>
30229 <indexterm role="concept">
30230 <primary>router</primary>
30231 <secondary>prefix for local part</secondary>
30232 </indexterm>
30233 <indexterm role="concept">
30234 <primary>prefix</primary>
30235 <secondary>for local part, used in router</secondary>
30236 </indexterm>
30237 If this option is set, the router is skipped unless the local part starts with
30238 one of the given strings, or <option>local_part_prefix_optional</option> is true. See
30239 section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions are
30240 evaluated.
30241 </para>
30242 <para>
30243 The list is scanned from left to right, and the first prefix that matches is
30244 used. A limited form of wildcard is available; if the prefix begins with an
30245 asterisk, it matches the longest possible sequence of arbitrary characters at
30246 the start of the local part. An asterisk should therefore always be followed by
30247 some character that does not occur in normal local parts.
30248 <indexterm role="concept">
30249 <primary>multiple mailboxes</primary>
30250 </indexterm>
30251 <indexterm role="concept">
30252 <primary>mailbox</primary>
30253 <secondary>multiple</secondary>
30254 </indexterm>
30255 Wildcarding can be used to set up multiple user mailboxes, as described in
30256 section <xref linkend="SECTmulbox"/>.
30257 </para>
30258 <para>
30259 <indexterm role="variable">
30260 <primary><varname>$local_part</varname></primary>
30261 </indexterm>
30262 <indexterm role="variable">
30263 <primary><varname>$local_part_prefix</varname></primary>
30264 </indexterm>
30265 During the testing of the <option>local_parts</option> option, and while the router is
30266 running, the prefix is removed from the local part, and is available in the
30267 expansion variable <varname>$local_part_prefix</varname>. When a message is being delivered, if
30268 the router accepts the address, this remains true during subsequent delivery by
30269 a transport. In particular, the local part that is transmitted in the RCPT
30270 command for LMTP, SMTP, and BSMTP deliveries has the prefix removed by default.
30271 This behaviour can be overridden by setting <option>rcpt_include_affixes</option> true on
30272 the relevant transport.
30273 </para>
30274 <para>
30275 When an address is being verified, <option>local_part_prefix</option> affects only the
30276 behaviour of the router. If the callout feature of verification is in use, this
30277 means that the full address, including the prefix, will be used during the
30278 callout.
30279 </para>
30280 <para>
30281 The prefix facility is commonly used to handle local parts of the form
30282 <option>owner-something</option>. Another common use is to support local parts of the form
30283 <option>real-username</option> to bypass a user&#x2019;s <filename>.forward</filename> file &ndash; helpful when trying
30284 to tell a user their forwarding is broken &ndash; by placing a router like this one
30285 immediately before the router that handles <filename>.forward</filename> files:
30286 </para>
30287 <literallayout class="monospaced">
30288 real_localuser:
30289   driver = accept
30290   local_part_prefix = real-
30291   check_local_user
30292   transport = local_delivery
30293 </literallayout>
30294 <para>
30295 For security, it would probably be a good idea to restrict the use of this
30296 router to locally-generated messages, using a condition such as this:
30297 </para>
30298 <literallayout class="monospaced">
30299   condition = ${if match {$sender_host_address}\
30300                          {\N^(|127\.0\.0\.1)$\N}}
30301 </literallayout>
30302 <para>
30303 If both <option>local_part_prefix</option> and <option>local_part_suffix</option> are set for a router,
30304 both conditions must be met if not optional. Care must be taken if wildcards
30305 are used in both a prefix and a suffix on the same router. Different
30306 separator characters must be used to avoid ambiguity.
30307 </para>
30308 <para>
30309 <indexterm role="option">
30310 <primary><option>local_part_prefix_optional</option></primary>
30311 </indexterm>
30312 </para>
30313 <informaltable frame="all">
30314 <tgroup cols="4" colsep="0" rowsep="0">
30315 <colspec colwidth="8*" align="left"/>
30316 <colspec colwidth="6*" align="center"/>
30317 <colspec colwidth="6*" align="center"/>
30318 <colspec colwidth="6*" align="right"/>
30319 <tbody>
30320 <row>
30321 <entry><option>local_part_prefix_optional</option></entry>
30322 <entry>Use: <emphasis>routers</emphasis></entry>
30323 <entry>Type: <emphasis>boolean</emphasis></entry>
30324 <entry>Default: <emphasis>false</emphasis></entry>
30325 </row>
30326 </tbody>
30327 </tgroup>
30328 </informaltable>
30329 <para>
30330 See <option>local_part_prefix</option> above.
30331 </para>
30332 <para>
30333 <indexterm role="option">
30334 <primary><option>local_part_suffix</option></primary>
30335 </indexterm>
30336 </para>
30337 <informaltable frame="all">
30338 <tgroup cols="4" colsep="0" rowsep="0">
30339 <colspec colwidth="8*" align="left"/>
30340 <colspec colwidth="6*" align="center"/>
30341 <colspec colwidth="6*" align="center"/>
30342 <colspec colwidth="6*" align="right"/>
30343 <tbody>
30344 <row>
30345 <entry><option>local_part_suffix</option></entry>
30346 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
30347 <entry>Type: <emphasis>string list</emphasis></entry>
30348 <entry>Default: <emphasis>unset</emphasis></entry>
30349 </row>
30350 </tbody>
30351 </tgroup>
30352 </informaltable>
30353 <para>
30354 <indexterm role="concept">
30355 <primary>router</primary>
30356 <secondary>suffix for local part</secondary>
30357 </indexterm>
30358 <indexterm role="concept">
30359 <primary>suffix for local part</primary>
30360 <secondary>used in router</secondary>
30361 </indexterm>
30362 This option operates in the same way as <option>local_part_prefix</option>, except that the
30363 local part must end (rather than start) with the given string, the
30364 <option>local_part_suffix_optional</option> option determines whether the suffix is
30365 mandatory, and the wildcard * character, if present, must be the last
30366 character of the suffix. This option facility is commonly used to handle local
30367 parts of the form <option>something-request</option> and multiple user mailboxes of the form
30368 <option>username-foo</option>.
30369 </para>
30370 <para>
30371 <indexterm role="option">
30372 <primary><option>local_part_suffix_optional</option></primary>
30373 </indexterm>
30374 </para>
30375 <informaltable frame="all">
30376 <tgroup cols="4" colsep="0" rowsep="0">
30377 <colspec colwidth="8*" align="left"/>
30378 <colspec colwidth="6*" align="center"/>
30379 <colspec colwidth="6*" align="center"/>
30380 <colspec colwidth="6*" align="right"/>
30381 <tbody>
30382 <row>
30383 <entry><option>local_part_suffix_optional</option></entry>
30384 <entry>Use: <emphasis>routers</emphasis></entry>
30385 <entry>Type: <emphasis>boolean</emphasis></entry>
30386 <entry>Default: <emphasis>false</emphasis></entry>
30387 </row>
30388 </tbody>
30389 </tgroup>
30390 </informaltable>
30391 <para>
30392 See <option>local_part_suffix</option> above.
30393 </para>
30394 <para>
30395 <indexterm role="option">
30396 <primary><option>local_parts</option></primary>
30397 </indexterm>
30398 </para>
30399 <informaltable frame="all">
30400 <tgroup cols="4" colsep="0" rowsep="0">
30401 <colspec colwidth="8*" align="left"/>
30402 <colspec colwidth="6*" align="center"/>
30403 <colspec colwidth="6*" align="center"/>
30404 <colspec colwidth="6*" align="right"/>
30405 <tbody>
30406 <row>
30407 <entry><option>local_parts</option></entry>
30408 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
30409 <entry>Type: <emphasis>local part list</emphasis>&dagger;<emphasis></emphasis></entry>
30410 <entry>Default: <emphasis>unset</emphasis></entry>
30411 </row>
30412 </tbody>
30413 </tgroup>
30414 </informaltable>
30415 <para>
30416 <indexterm role="concept">
30417 <primary>router</primary>
30418 <secondary>restricting to specific local parts</secondary>
30419 </indexterm>
30420 <indexterm role="concept">
30421 <primary>local part</primary>
30422 <secondary>checking in router</secondary>
30423 </indexterm>
30424 The router is run only if the local part of the address matches the list.
30425 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
30426 are evaluated, and
30427 section <xref linkend="SECTlocparlis"/> for a discussion of local part lists. Because the
30428 string is expanded, it is possible to make it depend on the domain, for
30429 example:
30430 </para>
30431 <literallayout class="monospaced">
30432 local_parts = dbm;/usr/local/specials/$domain
30433 </literallayout>
30434 <para>
30435 <indexterm role="variable">
30436 <primary><varname>$local_part_data</varname></primary>
30437 </indexterm>
30438 If the match is achieved by a lookup, the data that the lookup returned
30439 for the local part is placed in the variable <varname>$local_part_data</varname> for use in
30440 expansions of the router&#x2019;s private options. You might use this option, for
30441 example, if you have a large number of local virtual domains, and you want to
30442 send all postmaster mail to the same place without having to set up an alias in
30443 each virtual domain:
30444 </para>
30445 <literallayout class="monospaced">
30446 postmaster:
30447   driver = redirect
30448   local_parts = postmaster
30449   data = postmaster@real.domain.example
30450 </literallayout>
30451 <para>
30452 <indexterm role="option">
30453 <primary><option>log_as_local</option></primary>
30454 </indexterm>
30455 </para>
30456 <informaltable frame="all">
30457 <tgroup cols="4" colsep="0" rowsep="0">
30458 <colspec colwidth="8*" align="left"/>
30459 <colspec colwidth="6*" align="center"/>
30460 <colspec colwidth="6*" align="center"/>
30461 <colspec colwidth="6*" align="right"/>
30462 <tbody>
30463 <row>
30464 <entry><option>log_as_local</option></entry>
30465 <entry>Use: <emphasis>routers</emphasis></entry>
30466 <entry>Type: <emphasis>boolean</emphasis></entry>
30467 <entry>Default: <emphasis>see below</emphasis></entry>
30468 </row>
30469 </tbody>
30470 </tgroup>
30471 </informaltable>
30472 <para>
30473 <indexterm role="concept">
30474 <primary>log</primary>
30475 <secondary>delivery line</secondary>
30476 </indexterm>
30477 <indexterm role="concept">
30478 <primary>delivery</primary>
30479 <secondary>log line format</secondary>
30480 </indexterm>
30481 Exim has two logging styles for delivery, the idea being to make local
30482 deliveries stand out more visibly from remote ones. In the <quote>local</quote> style, the
30483 recipient address is given just as the local part, without a domain. The use of
30484 this style is controlled by this option. It defaults to true for the <command>accept</command>
30485 router, and false for all the others. This option applies only when a
30486 router assigns an address to a transport. It has no effect on routers that
30487 redirect addresses.
30488 </para>
30489 <para>
30490 <indexterm role="option">
30491 <primary><option>more</option></primary>
30492 </indexterm>
30493 </para>
30494 <informaltable frame="all">
30495 <tgroup cols="4" colsep="0" rowsep="0">
30496 <colspec colwidth="8*" align="left"/>
30497 <colspec colwidth="6*" align="center"/>
30498 <colspec colwidth="6*" align="center"/>
30499 <colspec colwidth="6*" align="right"/>
30500 <tbody>
30501 <row>
30502 <entry><option>more</option></entry>
30503 <entry>Use: <emphasis>routers</emphasis></entry>
30504 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
30505 <entry>Default: <emphasis>true</emphasis></entry>
30506 </row>
30507 </tbody>
30508 </tgroup>
30509 </informaltable>
30510 <para>
30511 The result of string expansion for this option must be a valid boolean value,
30512 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
30513 result causes an error, and delivery is deferred. If the expansion is forced to
30514 fail, the default value for the option (true) is used. Other failures cause
30515 delivery to be deferred.
30516 </para>
30517 <para>
30518 If this option is set false, and the router declines to handle the address, no
30519 further routers are tried, routing fails, and the address is bounced.
30520 <indexterm role="option">
30521 <primary><option>self</option></primary>
30522 </indexterm>
30523 However, if the router explicitly passes an address to the following router by
30524 means of the setting
30525 </para>
30526 <literallayout class="monospaced">
30527 self = pass
30528 </literallayout>
30529 <para>
30530 or otherwise, the setting of <option>more</option> is ignored. Also, the setting of <option>more</option>
30531 does not affect the behaviour if one of the precondition tests fails. In that
30532 case, the address is always passed to the next router.
30533 </para>
30534 <para>
30535 Note that <option>address_data</option> is not considered to be a precondition. If its
30536 expansion is forced to fail, the router declines, and the value of <option>more</option>
30537 controls what happens next.
30538 </para>
30539 <para>
30540 <indexterm role="option">
30541 <primary><option>pass_on_timeout</option></primary>
30542 </indexterm>
30543 </para>
30544 <informaltable frame="all">
30545 <tgroup cols="4" colsep="0" rowsep="0">
30546 <colspec colwidth="8*" align="left"/>
30547 <colspec colwidth="6*" align="center"/>
30548 <colspec colwidth="6*" align="center"/>
30549 <colspec colwidth="6*" align="right"/>
30550 <tbody>
30551 <row>
30552 <entry><option>pass_on_timeout</option></entry>
30553 <entry>Use: <emphasis>routers</emphasis></entry>
30554 <entry>Type: <emphasis>boolean</emphasis></entry>
30555 <entry>Default: <emphasis>false</emphasis></entry>
30556 </row>
30557 </tbody>
30558 </tgroup>
30559 </informaltable>
30560 <para>
30561 <indexterm role="concept">
30562 <primary>timeout</primary>
30563 <secondary>of router</secondary>
30564 </indexterm>
30565 <indexterm role="concept">
30566 <primary>router</primary>
30567 <secondary>timeout</secondary>
30568 </indexterm>
30569 If a router times out during a host lookup, it normally causes deferral of the
30570 address. If <option>pass_on_timeout</option> is set, the address is passed on to the next
30571 router, overriding <option>no_more</option>. This may be helpful for systems that are
30572 intermittently connected to the Internet, or those that want to pass to a smart
30573 host any messages that cannot immediately be delivered.
30574 </para>
30575 <para>
30576 There are occasional other temporary errors that can occur while doing DNS
30577 lookups. They are treated in the same way as a timeout, and this option
30578 applies to all of them.
30579 </para>
30580 <para>
30581 <indexterm role="option">
30582 <primary><option>pass_router</option></primary>
30583 </indexterm>
30584 </para>
30585 <informaltable frame="all">
30586 <tgroup cols="4" colsep="0" rowsep="0">
30587 <colspec colwidth="8*" align="left"/>
30588 <colspec colwidth="6*" align="center"/>
30589 <colspec colwidth="6*" align="center"/>
30590 <colspec colwidth="6*" align="right"/>
30591 <tbody>
30592 <row>
30593 <entry><option>pass_router</option></entry>
30594 <entry>Use: <emphasis>routers</emphasis></entry>
30595 <entry>Type: <emphasis>string</emphasis></entry>
30596 <entry>Default: <emphasis>unset</emphasis></entry>
30597 </row>
30598 </tbody>
30599 </tgroup>
30600 </informaltable>
30601 <para>
30602 <indexterm role="concept">
30603 <primary>router</primary>
30604 <secondary>go to after <quote>pass</quote></secondary>
30605 </indexterm>
30606 Routers that recognize the generic <option>self</option> option (<command>dnslookup</command>,
30607 <command>ipliteral</command>, and <command>manualroute</command>) are able to return <quote>pass</quote>, forcing
30608 routing to continue, and overriding a false setting of <option>more</option>. When one of
30609 these routers returns <quote>pass</quote>, the address is normally handed on to the next
30610 router in sequence. This can be changed by setting <option>pass_router</option> to the name
30611 of another router. However (unlike <option>redirect_router</option>) the named router must
30612 be below the current router, to avoid loops. Note that this option applies only
30613 to the special case of <quote>pass</quote>. It does not apply when a router returns
30614 <quote>decline</quote> because it cannot handle an address.
30615 </para>
30616 <para>
30617 <indexterm role="option">
30618 <primary><option>redirect_router</option></primary>
30619 </indexterm>
30620 </para>
30621 <informaltable frame="all">
30622 <tgroup cols="4" colsep="0" rowsep="0">
30623 <colspec colwidth="8*" align="left"/>
30624 <colspec colwidth="6*" align="center"/>
30625 <colspec colwidth="6*" align="center"/>
30626 <colspec colwidth="6*" align="right"/>
30627 <tbody>
30628 <row>
30629 <entry><option>redirect_router</option></entry>
30630 <entry>Use: <emphasis>routers</emphasis></entry>
30631 <entry>Type: <emphasis>string</emphasis></entry>
30632 <entry>Default: <emphasis>unset</emphasis></entry>
30633 </row>
30634 </tbody>
30635 </tgroup>
30636 </informaltable>
30637 <para>
30638 <indexterm role="concept">
30639 <primary>router</primary>
30640 <secondary>start at after redirection</secondary>
30641 </indexterm>
30642 Sometimes an administrator knows that it is pointless to reprocess addresses
30643 generated from alias or forward files with the same router again. For
30644 example, if an alias file translates real names into login ids there is no
30645 point searching the alias file a second time, especially if it is a large file.
30646 </para>
30647 <para>
30648 The <option>redirect_router</option> option can be set to the name of any router instance.
30649 It causes the routing of any generated addresses to start at the named router
30650 instead of at the first router. This option has no effect if the router in
30651 which it is set does not generate new addresses.
30652 </para>
30653 <para>
30654 <indexterm role="option">
30655 <primary><option>require_files</option></primary>
30656 </indexterm>
30657 </para>
30658 <informaltable frame="all">
30659 <tgroup cols="4" colsep="0" rowsep="0">
30660 <colspec colwidth="8*" align="left"/>
30661 <colspec colwidth="6*" align="center"/>
30662 <colspec colwidth="6*" align="center"/>
30663 <colspec colwidth="6*" align="right"/>
30664 <tbody>
30665 <row>
30666 <entry><option>require_files</option></entry>
30667 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
30668 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
30669 <entry>Default: <emphasis>unset</emphasis></entry>
30670 </row>
30671 </tbody>
30672 </tgroup>
30673 </informaltable>
30674 <para>
30675 <indexterm role="concept">
30676 <primary>file</primary>
30677 <secondary>requiring for router</secondary>
30678 </indexterm>
30679 <indexterm role="concept">
30680 <primary>router</primary>
30681 <secondary>requiring file existence</secondary>
30682 </indexterm>
30683 This option provides a general mechanism for predicating the running of a
30684 router on the existence or non-existence of certain files or directories.
30685 Before running a router, as one of its precondition tests, Exim works its way
30686 through the <option>require_files</option> list, expanding each item separately.
30687 </para>
30688 <para>
30689 Because the list is split before expansion, any colons in expansion items must
30690 be doubled, or the facility for using a different list separator must be used.
30691 If any expansion is forced to fail, the item is ignored. Other expansion
30692 failures cause routing of the address to be deferred.
30693 </para>
30694 <para>
30695 If any expanded string is empty, it is ignored. Otherwise, except as described
30696 below, each string must be a fully qualified file path, optionally preceded by
30697 <quote>!</quote>. The paths are passed to the <function>stat()</function> function to test for the
30698 existence of the files or directories. The router is skipped if any paths not
30699 preceded by <quote>!</quote> do not exist, or if any paths preceded by <quote>!</quote> do exist.
30700 </para>
30701 <para>
30702 <indexterm role="concept">
30703 <primary>NFS</primary>
30704 </indexterm>
30705 If <function>stat()</function> cannot determine whether a file exists or not, delivery of
30706 the message is deferred. This can happen when NFS-mounted filesystems are
30707 unavailable.
30708 </para>
30709 <para>
30710 This option is checked after the <option>domains</option>, <option>local_parts</option>, and <option>senders</option>
30711 options, so you cannot use it to check for the existence of a file in which to
30712 look up a domain, local part, or sender. (See section <xref linkend="SECTrouprecon"/> for a
30713 full list of the order in which preconditions are evaluated.) However, as
30714 these options are all expanded, you can use the <option>exists</option> expansion condition
30715 to make such tests. The <option>require_files</option> option is intended for checking files
30716 that the router may be going to use internally, or which are needed by a
30717 transport (for example <filename>.procmailrc</filename>).
30718 </para>
30719 <para>
30720 During delivery, the <function>stat()</function> function is run as root, but there is a
30721 facility for some checking of the accessibility of a file by another user.
30722 This is not a proper permissions check, but just a <quote>rough</quote> check that
30723 operates as follows:
30724 </para>
30725 <para>
30726 If an item in a <option>require_files</option> list does not contain any forward slash
30727 characters, it is taken to be the user (and optional group, separated by a
30728 comma) to be checked for subsequent files in the list. If no group is specified
30729 but the user is specified symbolically, the gid associated with the uid is
30730 used. For example:
30731 </para>
30732 <literallayout class="monospaced">
30733 require_files = mail:/some/file
30734 require_files = $local_part:$home/.procmailrc
30735 </literallayout>
30736 <para>
30737 If a user or group name in a <option>require_files</option> list does not exist, the
30738 <option>require_files</option> condition fails.
30739 </para>
30740 <para>
30741 Exim performs the check by scanning along the components of the file path, and
30742 checking the access for the given uid and gid. It checks for <quote>x</quote> access on
30743 directories, and <quote>r</quote> access on the final file. Note that this means that file
30744 access control lists, if the operating system has them, are ignored.
30745 </para>
30746 <para>
30747 <emphasis role="bold">Warning 1</emphasis>: When the router is being run to verify addresses for an
30748 incoming SMTP message, Exim is not running as root, but under its own uid. This
30749 may affect the result of a <option>require_files</option> check. In particular, <function>stat()</function>
30750 may yield the error EACCES (<quote>Permission denied</quote>). This means that the Exim
30751 user is not permitted to read one of the directories on the file&#x2019;s path.
30752 </para>
30753 <para>
30754 <emphasis role="bold">Warning 2</emphasis>: Even when Exim is running as root while delivering a message,
30755 <function>stat()</function> can yield EACCES for a file in an NFS directory that is mounted
30756 without root access. In this case, if a check for access by a particular user
30757 is requested, Exim creates a subprocess that runs as that user, and tries the
30758 check again in that process.
30759 </para>
30760 <para>
30761 The default action for handling an unresolved EACCES is to consider it to
30762 be caused by a configuration error, and routing is deferred because the
30763 existence or non-existence of the file cannot be determined. However, in some
30764 circumstances it may be desirable to treat this condition as if the file did
30765 not exist. If the file name (or the exclamation mark that precedes the file
30766 name for non-existence) is preceded by a plus sign, the EACCES error is treated
30767 as if the file did not exist. For example:
30768 </para>
30769 <literallayout class="monospaced">
30770 require_files = +/some/file
30771 </literallayout>
30772 <para>
30773 If the router is not an essential part of verification (for example, it
30774 handles users&#x2019; <filename>.forward</filename> files), another solution is to set the <option>verify</option>
30775 option false so that the router is skipped when verifying.
30776 </para>
30777 <para>
30778 <indexterm role="option">
30779 <primary><option>retry_use_local_part</option></primary>
30780 </indexterm>
30781 </para>
30782 <informaltable frame="all">
30783 <tgroup cols="4" colsep="0" rowsep="0">
30784 <colspec colwidth="8*" align="left"/>
30785 <colspec colwidth="6*" align="center"/>
30786 <colspec colwidth="6*" align="center"/>
30787 <colspec colwidth="6*" align="right"/>
30788 <tbody>
30789 <row>
30790 <entry><option>retry_use_local_part</option></entry>
30791 <entry>Use: <emphasis>routers</emphasis></entry>
30792 <entry>Type: <emphasis>boolean</emphasis></entry>
30793 <entry>Default: <emphasis>see below</emphasis></entry>
30794 </row>
30795 </tbody>
30796 </tgroup>
30797 </informaltable>
30798 <para>
30799 <indexterm role="concept">
30800 <primary>hints database</primary>
30801 <secondary>retry keys</secondary>
30802 </indexterm>
30803 <indexterm role="concept">
30804 <primary>local part</primary>
30805 <secondary>in retry keys</secondary>
30806 </indexterm>
30807 When a delivery suffers a temporary routing failure, a retry record is created
30808 in Exim&#x2019;s hints database. For addresses whose routing depends only on the
30809 domain, the key for the retry record should not involve the local part, but for
30810 other addresses, both the domain and the local part should be included.
30811 Usually, remote routing is of the former kind, and local routing is of the
30812 latter kind.
30813 </para>
30814 <para>
30815 This option controls whether the local part is used to form the key for retry
30816 hints for addresses that suffer temporary errors while being handled by this
30817 router. The default value is true for any router that has <option>check_local_user</option>
30818 set, and false otherwise. Note that this option does not apply to hints keys
30819 for transport delays; they are controlled by a generic transport option of the
30820 same name.
30821 </para>
30822 <para>
30823 The setting of <option>retry_use_local_part</option> applies only to the router on which it
30824 appears. If the router generates child addresses, they are routed
30825 independently; this setting does not become attached to them.
30826 </para>
30827 <para>
30828 <indexterm role="option">
30829 <primary><option>router_home_directory</option></primary>
30830 </indexterm>
30831 </para>
30832 <informaltable frame="all">
30833 <tgroup cols="4" colsep="0" rowsep="0">
30834 <colspec colwidth="8*" align="left"/>
30835 <colspec colwidth="6*" align="center"/>
30836 <colspec colwidth="6*" align="center"/>
30837 <colspec colwidth="6*" align="right"/>
30838 <tbody>
30839 <row>
30840 <entry><option>router_home_directory</option></entry>
30841 <entry>Use: <emphasis>routers</emphasis></entry>
30842 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30843 <entry>Default: <emphasis>unset</emphasis></entry>
30844 </row>
30845 </tbody>
30846 </tgroup>
30847 </informaltable>
30848 <para>
30849 <indexterm role="concept">
30850 <primary>router</primary>
30851 <secondary>home directory for</secondary>
30852 </indexterm>
30853 <indexterm role="concept">
30854 <primary>home directory</primary>
30855 <secondary>for router</secondary>
30856 </indexterm>
30857 <indexterm role="variable">
30858 <primary><varname>$home</varname></primary>
30859 </indexterm>
30860 This option sets a home directory for use while the router is running. (Compare
30861 <option>transport_home_directory</option>, which sets a home directory for later
30862 transporting.) In particular, if used on a <command>redirect</command> router, this option
30863 sets a value for <varname>$home</varname> while a filter is running. The value is expanded;
30864 forced expansion failure causes the option to be ignored &ndash; other failures
30865 cause the router to defer.
30866 </para>
30867 <para>
30868 Expansion of <option>router_home_directory</option> happens immediately after the
30869 <option>check_local_user</option> test (if configured), before any further expansions take
30870 place.
30871 (See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
30872 are evaluated.)
30873 While the router is running, <option>router_home_directory</option> overrides the value of
30874 <varname>$home</varname> that came from <option>check_local_user</option>.
30875 </para>
30876 <para>
30877 When a router accepts an address and assigns it to a local transport (including
30878 the cases when a <command>redirect</command> router generates a pipe, file, or autoreply
30879 delivery), the home directory setting for the transport is taken from the first
30880 of these values that is set:
30881 </para>
30882 <itemizedlist>
30883 <listitem>
30884 <para>
30885 The <option>home_directory</option> option on the transport;
30886 </para>
30887 </listitem>
30888 <listitem>
30889 <para>
30890 The <option>transport_home_directory</option> option on the router;
30891 </para>
30892 </listitem>
30893 <listitem>
30894 <para>
30895 The password data if <option>check_local_user</option> is set on the router;
30896 </para>
30897 </listitem>
30898 <listitem>
30899 <para>
30900 The <option>router_home_directory</option> option on the router.
30901 </para>
30902 </listitem>
30903 </itemizedlist>
30904 <para>
30905 In other words, <option>router_home_directory</option> overrides the password data for the
30906 router, but not for the transport.
30907 </para>
30908 <para>
30909 <indexterm role="option">
30910 <primary><option>self</option></primary>
30911 </indexterm>
30912 </para>
30913 <informaltable frame="all">
30914 <tgroup cols="4" colsep="0" rowsep="0">
30915 <colspec colwidth="8*" align="left"/>
30916 <colspec colwidth="6*" align="center"/>
30917 <colspec colwidth="6*" align="center"/>
30918 <colspec colwidth="6*" align="right"/>
30919 <tbody>
30920 <row>
30921 <entry><option>self</option></entry>
30922 <entry>Use: <emphasis>routers</emphasis></entry>
30923 <entry>Type: <emphasis>string</emphasis></entry>
30924 <entry>Default: <emphasis>freeze</emphasis></entry>
30925 </row>
30926 </tbody>
30927 </tgroup>
30928 </informaltable>
30929 <para>
30930 <indexterm role="concept">
30931 <primary>MX record</primary>
30932 <secondary>pointing to local host</secondary>
30933 </indexterm>
30934 <indexterm role="concept">
30935 <primary>local host</primary>
30936 <secondary>MX pointing to</secondary>
30937 </indexterm>
30938 This option applies to those routers that use a recipient address to find a
30939 list of remote hosts. Currently, these are the <command>dnslookup</command>, <command>ipliteral</command>,
30940 and <command>manualroute</command> routers.
30941 Certain configurations of the <command>queryprogram</command> router can also specify a list
30942 of remote hosts.
30943 Usually such routers are configured to send the message to a remote host via an
30944 <command>smtp</command> transport. The <option>self</option> option specifies what happens when the first
30945 host on the list turns out to be the local host.
30946 The way in which Exim checks for the local host is described in section
30947 <xref linkend="SECTreclocipadd"/>.
30948 </para>
30949 <para>
30950 Normally this situation indicates either an error in Exim&#x2019;s configuration (for
30951 example, the router should be configured not to process this domain), or an
30952 error in the DNS (for example, the MX should not point to this host). For this
30953 reason, the default action is to log the incident, defer the address, and
30954 freeze the message. The following alternatives are provided for use in special
30955 cases:
30956 </para>
30957 <variablelist>
30958 <varlistentry>
30959 <term><option>defer</option></term>
30960 <listitem>
30961 <para>
30962 Delivery of the message is tried again later, but the message is not frozen.
30963 </para>
30964 </listitem></varlistentry>
30965 <varlistentry>
30966 <term><option>reroute</option>: &lt;<emphasis>domain</emphasis>&gt;</term>
30967 <listitem>
30968 <para>
30969 The domain is changed to the given domain, and the address is passed back to
30970 be reprocessed by the routers. No rewriting of headers takes place. This
30971 behaviour is essentially a redirection.
30972 </para>
30973 </listitem></varlistentry>
30974 <varlistentry>
30975 <term><option>reroute: rewrite:</option> &lt;<emphasis>domain</emphasis>&gt;</term>
30976 <listitem>
30977 <para>
30978 The domain is changed to the given domain, and the address is passed back to be
30979 reprocessed by the routers. Any headers that contain the original domain are
30980 rewritten.
30981 </para>
30982 </listitem></varlistentry>
30983 <varlistentry>
30984 <term><option>pass</option></term>
30985 <listitem>
30986 <para>
30987 <indexterm role="option">
30988 <primary><option>more</option></primary>
30989 </indexterm>
30990 <indexterm role="variable">
30991 <primary><varname>$self_hostname</varname></primary>
30992 </indexterm>
30993 The router passes the address to the next router, or to the router named in the
30994 <option>pass_router</option> option if it is set. This overrides <option>no_more</option>. During
30995 subsequent routing and delivery, the variable <varname>$self_hostname</varname> contains the
30996 name of the local host that the router encountered. This can be used to
30997 distinguish between different cases for hosts with multiple names. The
30998 combination
30999 </para>
31000 <literallayout class="monospaced">
31001 self = pass
31002 no_more
31003 </literallayout>
31004 <para>
31005 ensures that only those addresses that routed to the local host are passed on.
31006 Without <option>no_more</option>, addresses that were declined for other reasons would also
31007 be passed to the next router.
31008 </para>
31009 </listitem></varlistentry>
31010 <varlistentry>
31011 <term><option>fail</option></term>
31012 <listitem>
31013 <para>
31014 Delivery fails and an error report is generated.
31015 </para>
31016 </listitem></varlistentry>
31017 <varlistentry>
31018 <term><option>send</option></term>
31019 <listitem>
31020 <para>
31021 <indexterm role="concept">
31022 <primary>local host</primary>
31023 <secondary>sending to</secondary>
31024 </indexterm>
31025 The anomaly is ignored and the address is queued for the transport. This
31026 setting should be used with extreme caution. For an <command>smtp</command> transport, it
31027 makes sense only in cases where the program that is listening on the SMTP port
31028 is not this version of Exim. That is, it must be some other MTA, or Exim with a
31029 different configuration file that handles the domain in another way.
31030 </para>
31031 </listitem></varlistentry>
31032 </variablelist>
31033 <para>
31034 <indexterm role="option">
31035 <primary><option>senders</option></primary>
31036 </indexterm>
31037 </para>
31038 <informaltable frame="all">
31039 <tgroup cols="4" colsep="0" rowsep="0">
31040 <colspec colwidth="8*" align="left"/>
31041 <colspec colwidth="6*" align="center"/>
31042 <colspec colwidth="6*" align="center"/>
31043 <colspec colwidth="6*" align="right"/>
31044 <tbody>
31045 <row>
31046 <entry><option>senders</option></entry>
31047 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
31048 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
31049 <entry>Default: <emphasis>unset</emphasis></entry>
31050 </row>
31051 </tbody>
31052 </tgroup>
31053 </informaltable>
31054 <para>
31055 <indexterm role="concept">
31056 <primary>router</primary>
31057 <secondary>checking senders</secondary>
31058 </indexterm>
31059 If this option is set, the router is skipped unless the message&#x2019;s sender
31060 address matches something on the list.
31061 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
31062 are evaluated.
31063 </para>
31064 <para>
31065 There are issues concerning verification when the running of routers is
31066 dependent on the sender. When Exim is verifying the address in an <option>errors_to</option>
31067 setting, it sets the sender to the null string. When using the <option>-bt</option> option
31068 to check a configuration file, it is necessary also to use the <option>-f</option> option to
31069 set an appropriate sender. For incoming mail, the sender is unset when
31070 verifying the sender, but is available when verifying any recipients. If the
31071 SMTP VRFY command is enabled, it must be used after MAIL if the sender address
31072 matters.
31073 </para>
31074 <para>
31075 <indexterm role="option">
31076 <primary><option>translate_ip_address</option></primary>
31077 </indexterm>
31078 </para>
31079 <informaltable frame="all">
31080 <tgroup cols="4" colsep="0" rowsep="0">
31081 <colspec colwidth="8*" align="left"/>
31082 <colspec colwidth="6*" align="center"/>
31083 <colspec colwidth="6*" align="center"/>
31084 <colspec colwidth="6*" align="right"/>
31085 <tbody>
31086 <row>
31087 <entry><option>translate_ip_address</option></entry>
31088 <entry>Use: <emphasis>routers</emphasis></entry>
31089 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31090 <entry>Default: <emphasis>unset</emphasis></entry>
31091 </row>
31092 </tbody>
31093 </tgroup>
31094 </informaltable>
31095 <para>
31096 <indexterm role="concept">
31097 <primary>IP address</primary>
31098 <secondary>translating</secondary>
31099 </indexterm>
31100 <indexterm role="concept">
31101 <primary>packet radio</primary>
31102 </indexterm>
31103 <indexterm role="concept">
31104 <primary>router</primary>
31105 <secondary>IP address translation</secondary>
31106 </indexterm>
31107 There exist some rare networking situations (for example, packet radio) where
31108 it is helpful to be able to translate IP addresses generated by normal routing
31109 mechanisms into other IP addresses, thus performing a kind of manual IP
31110 routing. This should be done only if the normal IP routing of the TCP/IP stack
31111 is inadequate or broken. Because this is an extremely uncommon requirement, the
31112 code to support this option is not included in the Exim binary unless
31113 SUPPORT_TRANSLATE_IP_ADDRESS=yes is set in <filename>Local/Makefile</filename>.
31114 </para>
31115 <para>
31116 <indexterm role="variable">
31117 <primary><varname>$host_address</varname></primary>
31118 </indexterm>
31119 The <option>translate_ip_address</option> string is expanded for every IP address generated
31120 by the router, with the generated address set in <varname>$host_address</varname>. If the
31121 expansion is forced to fail, no action is taken.
31122 For any other expansion error, delivery of the message is deferred.
31123 If the result of the expansion is an IP address, that replaces the original
31124 address; otherwise the result is assumed to be a host name &ndash; this is looked
31125 up using <function>gethostbyname()</function> (or <function>getipnodebyname()</function> when available) to
31126 produce one or more replacement IP addresses. For example, to subvert all IP
31127 addresses in some specific networks, this could be added to a router:
31128 </para>
31129 <literallayout class="monospaced">
31130 translate_ip_address = \
31131   ${lookup{${mask:$host_address/26}}lsearch{/some/file}\
31132     {$value}fail}}
31133 </literallayout>
31134 <para>
31135 The file would contain lines like
31136 </para>
31137 <literallayout class="monospaced">
31138 10.2.3.128/26    some.host
31139 10.8.4.34/26     10.44.8.15
31140 </literallayout>
31141 <para>
31142 You should not make use of this facility unless you really understand what you
31143 are doing.
31144 </para>
31145 <para>
31146 <indexterm role="option">
31147 <primary><option>transport</option></primary>
31148 </indexterm>
31149 </para>
31150 <informaltable frame="all">
31151 <tgroup cols="4" colsep="0" rowsep="0">
31152 <colspec colwidth="8*" align="left"/>
31153 <colspec colwidth="6*" align="center"/>
31154 <colspec colwidth="6*" align="center"/>
31155 <colspec colwidth="6*" align="right"/>
31156 <tbody>
31157 <row>
31158 <entry><option>transport</option></entry>
31159 <entry>Use: <emphasis>routers</emphasis></entry>
31160 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31161 <entry>Default: <emphasis>unset</emphasis></entry>
31162 </row>
31163 </tbody>
31164 </tgroup>
31165 </informaltable>
31166 <para>
31167 This option specifies the transport to be used when a router accepts an address
31168 and sets it up for delivery. A transport is never needed if a router is used
31169 only for verification. The value of the option is expanded at routing time,
31170 after the expansion of <option>errors_to</option>, <option>headers_add</option>, and <option>headers_remove</option>,
31171 and result must be the name of one of the configured transports. If it is not,
31172 delivery is deferred.
31173 </para>
31174 <para>
31175 The <option>transport</option> option is not used by the <command>redirect</command> router, but it does
31176 have some private options that set up transports for pipe and file deliveries
31177 (see chapter <xref linkend="CHAPredirect"/>).
31178 </para>
31179 <para>
31180 <indexterm role="option">
31181 <primary><option>transport_current_directory</option></primary>
31182 </indexterm>
31183 </para>
31184 <informaltable frame="all">
31185 <tgroup cols="4" colsep="0" rowsep="0">
31186 <colspec colwidth="8*" align="left"/>
31187 <colspec colwidth="6*" align="center"/>
31188 <colspec colwidth="6*" align="center"/>
31189 <colspec colwidth="6*" align="right"/>
31190 <tbody>
31191 <row>
31192 <entry><option>transport_current_directory</option></entry>
31193 <entry>Use: <emphasis>routers</emphasis></entry>
31194 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31195 <entry>Default: <emphasis>unset</emphasis></entry>
31196 </row>
31197 </tbody>
31198 </tgroup>
31199 </informaltable>
31200 <para>
31201 <indexterm role="concept">
31202 <primary>current directory for local transport</primary>
31203 </indexterm>
31204 This option associates a current directory with any address that is routed
31205 to a local transport. This can happen either because a transport is
31206 explicitly configured for the router, or because it generates a delivery to a
31207 file or a pipe. During the delivery process (that is, at transport time), this
31208 option string is expanded and is set as the current directory, unless
31209 overridden by a setting on the transport.
31210 If the expansion fails for any reason, including forced failure, an error is
31211 logged, and delivery is deferred.
31212 See chapter <xref linkend="CHAPenvironment"/> for details of the local delivery
31213 environment.
31214 </para>
31215 <para>
31216 <indexterm role="option">
31217 <primary><option>transport_home_directory</option></primary>
31218 </indexterm>
31219 </para>
31220 <informaltable frame="all">
31221 <tgroup cols="4" colsep="0" rowsep="0">
31222 <colspec colwidth="8*" align="left"/>
31223 <colspec colwidth="6*" align="center"/>
31224 <colspec colwidth="6*" align="center"/>
31225 <colspec colwidth="6*" align="right"/>
31226 <tbody>
31227 <row>
31228 <entry><option>transport_home_directory</option></entry>
31229 <entry>Use: <emphasis>routers</emphasis></entry>
31230 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31231 <entry>Default: <emphasis>see below</emphasis></entry>
31232 </row>
31233 </tbody>
31234 </tgroup>
31235 </informaltable>
31236 <para>
31237 <indexterm role="concept">
31238 <primary>home directory</primary>
31239 <secondary>for local transport</secondary>
31240 </indexterm>
31241 This option associates a home directory with any address that is routed to a
31242 local transport. This can happen either because a transport is explicitly
31243 configured for the router, or because it generates a delivery to a file or a
31244 pipe. During the delivery process (that is, at transport time), the option
31245 string is expanded and is set as the home directory, unless overridden by a
31246 setting of <option>home_directory</option> on the transport.
31247 If the expansion fails for any reason, including forced failure, an error is
31248 logged, and delivery is deferred.
31249 </para>
31250 <para>
31251 If the transport does not specify a home directory, and
31252 <option>transport_home_directory</option> is not set for the router, the home directory for
31253 the transport is taken from the password data if <option>check_local_user</option> is set for
31254 the router. Otherwise it is taken from <option>router_home_directory</option> if that option
31255 is set; if not, no home directory is set for the transport.
31256 </para>
31257 <para>
31258 See chapter <xref linkend="CHAPenvironment"/> for further details of the local delivery
31259 environment.
31260 </para>
31261 <para>
31262 <indexterm role="option">
31263 <primary><option>unseen</option></primary>
31264 </indexterm>
31265 </para>
31266 <informaltable frame="all">
31267 <tgroup cols="4" colsep="0" rowsep="0">
31268 <colspec colwidth="8*" align="left"/>
31269 <colspec colwidth="6*" align="center"/>
31270 <colspec colwidth="6*" align="center"/>
31271 <colspec colwidth="6*" align="right"/>
31272 <tbody>
31273 <row>
31274 <entry><option>unseen</option></entry>
31275 <entry>Use: <emphasis>routers</emphasis></entry>
31276 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
31277 <entry>Default: <emphasis>false</emphasis></entry>
31278 </row>
31279 </tbody>
31280 </tgroup>
31281 </informaltable>
31282 <para>
31283 <indexterm role="concept">
31284 <primary>router</primary>
31285 <secondary>carrying on after success</secondary>
31286 </indexterm>
31287 The result of string expansion for this option must be a valid boolean value,
31288 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
31289 result causes an error, and delivery is deferred. If the expansion is forced to
31290 fail, the default value for the option (false) is used. Other failures cause
31291 delivery to be deferred.
31292 </para>
31293 <para>
31294 When this option is set true, routing does not cease if the router accepts the
31295 address. Instead, a copy of the incoming address is passed to the next router,
31296 overriding a false setting of <option>more</option>. There is little point in setting
31297 <option>more</option> false if <option>unseen</option> is always true, but it may be useful in cases when
31298 the value of <option>unseen</option> contains expansion items (and therefore, presumably, is
31299 sometimes true and sometimes false).
31300 </para>
31301 <para>
31302 <indexterm role="concept">
31303 <primary>copy of message (<option>unseen</option> option)</primary>
31304 </indexterm>
31305 Setting the <option>unseen</option> option has a similar effect to the <option>unseen</option> command
31306 qualifier in filter files. It can be used to cause copies of messages to be
31307 delivered to some other destination, while also carrying out a normal delivery.
31308 In effect, the current address is made into a <quote>parent</quote> that has two children
31309 &ndash; one that is delivered as specified by this router, and a clone that goes on
31310 to be routed further. For this reason, <option>unseen</option> may not be combined with the
31311 <option>one_time</option> option in a <command>redirect</command> router.
31312 </para>
31313 <para>
31314 <emphasis role="bold">Warning</emphasis>: Header lines added to the address (or specified for removal) by
31315 this router or by previous routers affect the <quote>unseen</quote> copy of the message
31316 only. The clone that continues to be processed by further routers starts with
31317 no added headers and none specified for removal. For a <option>redirect</option> router, if
31318 a generated address is the same as the incoming address, this can lead to
31319 duplicate addresses with different header modifications. Exim does not do
31320 duplicate deliveries (except, in certain circumstances, to pipes -- see section
31321 <xref linkend="SECTdupaddr"/>), but it is undefined which of the duplicates is discarded,
31322 so this ambiguous situation should be avoided. The <option>repeat_use</option> option of the
31323 <option>redirect</option> router may be of help.
31324 </para>
31325 <para>
31326 Unlike the handling of header modifications, any data that was set by the
31327 <option>address_data</option> option in the current or previous routers <emphasis>is</emphasis> passed on to
31328 subsequent routers.
31329 </para>
31330 <para>
31331 <indexterm role="option">
31332 <primary><option>user</option></primary>
31333 </indexterm>
31334 </para>
31335 <informaltable frame="all">
31336 <tgroup cols="4" colsep="0" rowsep="0">
31337 <colspec colwidth="8*" align="left"/>
31338 <colspec colwidth="6*" align="center"/>
31339 <colspec colwidth="6*" align="center"/>
31340 <colspec colwidth="6*" align="right"/>
31341 <tbody>
31342 <row>
31343 <entry><option>user</option></entry>
31344 <entry>Use: <emphasis>routers</emphasis></entry>
31345 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31346 <entry>Default: <emphasis>see below</emphasis></entry>
31347 </row>
31348 </tbody>
31349 </tgroup>
31350 </informaltable>
31351 <para>
31352 <indexterm role="concept">
31353 <primary>uid (user id)</primary>
31354 <secondary>local delivery</secondary>
31355 </indexterm>
31356 <indexterm role="concept">
31357 <primary>local transports</primary>
31358 <secondary>uid and gid</secondary>
31359 </indexterm>
31360 <indexterm role="concept">
31361 <primary>transport</primary>
31362 <secondary>local</secondary>
31363 </indexterm>
31364 <indexterm role="concept">
31365 <primary>router</primary>
31366 <secondary>user for filter processing</secondary>
31367 </indexterm>
31368 <indexterm role="concept">
31369 <primary>filter</primary>
31370 <secondary>user for processing</secondary>
31371 </indexterm>
31372 When a router queues an address for a transport, and the transport does not
31373 specify a user, the user given here is used when running the delivery process.
31374 The user may be specified numerically or by name. If expansion fails, the
31375 error is logged and delivery is deferred.
31376 This user is also used by the <command>redirect</command> router when running a filter file.
31377 The default is unset, except when <option>check_local_user</option> is set. In this case,
31378 the default is taken from the password information. If the user is specified as
31379 a name, and <option>group</option> is not set, the group associated with the user is used.
31380 See also <option>initgroups</option> and <option>group</option> and the discussion in chapter
31381 <xref linkend="CHAPenvironment"/>.
31382 </para>
31383 <para>
31384 <indexterm role="option">
31385 <primary><option>verify</option></primary>
31386 </indexterm>
31387 </para>
31388 <informaltable frame="all">
31389 <tgroup cols="4" colsep="0" rowsep="0">
31390 <colspec colwidth="8*" align="left"/>
31391 <colspec colwidth="6*" align="center"/>
31392 <colspec colwidth="6*" align="center"/>
31393 <colspec colwidth="6*" align="right"/>
31394 <tbody>
31395 <row>
31396 <entry><option>verify</option></entry>
31397 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
31398 <entry>Type: <emphasis>boolean</emphasis></entry>
31399 <entry>Default: <emphasis>true</emphasis></entry>
31400 </row>
31401 </tbody>
31402 </tgroup>
31403 </informaltable>
31404 <para>
31405 Setting this option has the effect of setting <option>verify_sender</option> and
31406 <option>verify_recipient</option> to the same value.
31407 </para>
31408 <para>
31409 <indexterm role="option">
31410 <primary><option>verify_only</option></primary>
31411 </indexterm>
31412 </para>
31413 <informaltable frame="all">
31414 <tgroup cols="4" colsep="0" rowsep="0">
31415 <colspec colwidth="8*" align="left"/>
31416 <colspec colwidth="6*" align="center"/>
31417 <colspec colwidth="6*" align="center"/>
31418 <colspec colwidth="6*" align="right"/>
31419 <tbody>
31420 <row>
31421 <entry><option>verify_only</option></entry>
31422 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
31423 <entry>Type: <emphasis>boolean</emphasis></entry>
31424 <entry>Default: <emphasis>false</emphasis></entry>
31425 </row>
31426 </tbody>
31427 </tgroup>
31428 </informaltable>
31429 <para>
31430 <indexterm role="concept">
31431 <primary>EXPN</primary>
31432 <secondary>with <option>verify_only</option></secondary>
31433 </indexterm>
31434 <indexterm role="option">
31435 <primary><option>-bv</option></primary>
31436 </indexterm>
31437 <indexterm role="concept">
31438 <primary>router</primary>
31439 <secondary>used only when verifying</secondary>
31440 </indexterm>
31441 If this option is set, the router is used only when verifying an address or
31442 testing with the <option>-bv</option> option, not when actually doing a delivery, testing
31443 with the <option>-bt</option> option, or running the SMTP EXPN command. It can be further
31444 restricted to verifying only senders or recipients by means of
31445 <option>verify_sender</option> and <option>verify_recipient</option>.
31446 </para>
31447 <para>
31448 <emphasis role="bold">Warning</emphasis>: When the router is being run to verify addresses for an incoming
31449 SMTP message, Exim is not running as root, but under its own uid. If the router
31450 accesses any files, you need to make sure that they are accessible to the Exim
31451 user or group.
31452 </para>
31453 <para>
31454 <indexterm role="option">
31455 <primary><option>verify_recipient</option></primary>
31456 </indexterm>
31457 </para>
31458 <informaltable frame="all">
31459 <tgroup cols="4" colsep="0" rowsep="0">
31460 <colspec colwidth="8*" align="left"/>
31461 <colspec colwidth="6*" align="center"/>
31462 <colspec colwidth="6*" align="center"/>
31463 <colspec colwidth="6*" align="right"/>
31464 <tbody>
31465 <row>
31466 <entry><option>verify_recipient</option></entry>
31467 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
31468 <entry>Type: <emphasis>boolean</emphasis></entry>
31469 <entry>Default: <emphasis>true</emphasis></entry>
31470 </row>
31471 </tbody>
31472 </tgroup>
31473 </informaltable>
31474 <para>
31475 If this option is false, the router is skipped when verifying recipient
31476 addresses
31477 or testing recipient verification using <option>-bv</option>.
31478 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
31479 are evaluated.
31480 </para>
31481 <para>
31482 <indexterm role="option">
31483 <primary><option>verify_sender</option></primary>
31484 </indexterm>
31485 </para>
31486 <informaltable frame="all">
31487 <tgroup cols="4" colsep="0" rowsep="0">
31488 <colspec colwidth="8*" align="left"/>
31489 <colspec colwidth="6*" align="center"/>
31490 <colspec colwidth="6*" align="center"/>
31491 <colspec colwidth="6*" align="right"/>
31492 <tbody>
31493 <row>
31494 <entry><option>verify_sender</option></entry>
31495 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
31496 <entry>Type: <emphasis>boolean</emphasis></entry>
31497 <entry>Default: <emphasis>true</emphasis></entry>
31498 </row>
31499 </tbody>
31500 </tgroup>
31501 </informaltable>
31502 <para>
31503 If this option is false, the router is skipped when verifying sender addresses
31504 or testing sender verification using <option>-bvs</option>.
31505 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
31506 are evaluated.
31507 <indexterm role="concept" startref="IIDgenoprou1" class="endofrange"/>
31508 <indexterm role="concept" startref="IIDgenoprou2" class="endofrange"/>
31509 </para>
31510 </chapter>
31511
31512 <chapter id="CHID4">
31513 <title>The accept router</title>
31514 <para>
31515 <indexterm role="concept">
31516 <primary><command>accept</command> router</primary>
31517 </indexterm>
31518 <indexterm role="concept">
31519 <primary>routers</primary>
31520 <secondary><command>accept</command></secondary>
31521 </indexterm>
31522 The <command>accept</command> router has no private options of its own. Unless it is being
31523 used purely for verification (see <option>verify_only</option>) a transport is required to
31524 be defined by the generic <option>transport</option> option. If the preconditions that are
31525 specified by generic options are met, the router accepts the address and queues
31526 it for the given transport. The most common use of this router is for setting
31527 up deliveries to local mailboxes. For example:
31528 </para>
31529 <literallayout class="monospaced">
31530 localusers:
31531   driver = accept
31532   domains = mydomain.example
31533   check_local_user
31534   transport = local_delivery
31535 </literallayout>
31536 <para>
31537 The <option>domains</option> condition in this example checks the domain of the address, and
31538 <option>check_local_user</option> checks that the local part is the login of a local user.
31539 When both preconditions are met, the <command>accept</command> router runs, and queues the
31540 address for the <command>local_delivery</command> transport.
31541 </para>
31542 </chapter>
31543
31544 <chapter id="CHAPdnslookup">
31545 <title>The dnslookup router</title>
31546 <para>
31547 <indexterm role="concept" id="IIDdnsrou1" class="startofrange">
31548 <primary><command>dnslookup</command> router</primary>
31549 </indexterm>
31550 <indexterm role="concept" id="IIDdnsrou2" class="startofrange">
31551 <primary>routers</primary>
31552 <secondary><command>dnslookup</command></secondary>
31553 </indexterm>
31554 The <command>dnslookup</command> router looks up the hosts that handle mail for the
31555 recipient&#x2019;s domain in the DNS. A transport must always be set for this router,
31556 unless <option>verify_only</option> is set.
31557 </para>
31558 <para>
31559 If SRV support is configured (see <option>check_srv</option> below), Exim first searches for
31560 SRV records. If none are found, or if SRV support is not configured,
31561 MX records are looked up. If no MX records exist, address records are sought.
31562 However, <option>mx_domains</option> can be set to disable the direct use of address
31563 records.
31564 </para>
31565 <para>
31566 MX records of equal priority are sorted by Exim into a random order. Exim then
31567 looks for address records for the host names obtained from MX or SRV records.
31568 When a host has more than one IP address, they are sorted into a random order,
31569 except that IPv6 addresses are always sorted before IPv4 addresses. If all the
31570 IP addresses found are discarded by a setting of the <option>ignore_target_hosts</option>
31571 generic option, the router declines.
31572 </para>
31573 <para>
31574 Unless they have the highest priority (lowest MX value), MX records that point
31575 to the local host, or to any host name that matches <option>hosts_treat_as_local</option>,
31576 are discarded, together with any other MX records of equal or lower priority.
31577 </para>
31578 <para>
31579 <indexterm role="concept">
31580 <primary>MX record</primary>
31581 <secondary>pointing to local host</secondary>
31582 </indexterm>
31583 <indexterm role="concept">
31584 <primary>local host</primary>
31585 <secondary>MX pointing to</secondary>
31586 </indexterm>
31587 <indexterm role="option">
31588 <primary><option>self</option></primary>
31589 <secondary>in <command>dnslookup</command> router</secondary>
31590 </indexterm>
31591 If the host pointed to by the highest priority MX record, or looked up as an
31592 address record, is the local host, or matches <option>hosts_treat_as_local</option>, what
31593 happens is controlled by the generic <option>self</option> option.
31594 </para>
31595 <section id="SECTprowitdnsloo">
31596 <title>Problems with DNS lookups</title>
31597 <para>
31598 There have been problems with DNS servers when SRV records are looked up.
31599 Some mis-behaving servers return a DNS error or timeout when a non-existent
31600 SRV record is sought. Similar problems have in the past been reported for
31601 MX records. The global <option>dns_again_means_nonexist</option> option can help with this
31602 problem, but it is heavy-handed because it is a global option.
31603 </para>
31604 <para>
31605 For this reason, there are two options, <option>srv_fail_domains</option> and
31606 <option>mx_fail_domains</option>, that control what happens when a DNS lookup in a
31607 <command>dnslookup</command> router results in a DNS failure or a <quote>try again</quote> response. If
31608 an attempt to look up an SRV or MX record causes one of these results, and the
31609 domain matches the relevant list, Exim behaves as if the DNS had responded <quote>no
31610 such record</quote>. In the case of an SRV lookup, this means that the router
31611 proceeds to look for MX records; in the case of an MX lookup, it proceeds to
31612 look for A or AAAA records, unless the domain matches <option>mx_domains</option>, in which
31613 case routing fails.
31614 </para>
31615 </section>
31616 <section id="SECID118">
31617 <title>Private options for dnslookup</title>
31618 <para>
31619 <indexterm role="concept">
31620 <primary>options</primary>
31621 <secondary><command>dnslookup</command> router</secondary>
31622 </indexterm>
31623 The private options for the <command>dnslookup</command> router are as follows:
31624 </para>
31625 <para>
31626 <indexterm role="option">
31627 <primary><option>check_secondary_mx</option></primary>
31628 </indexterm>
31629 </para>
31630 <informaltable frame="all">
31631 <tgroup cols="4" colsep="0" rowsep="0">
31632 <colspec colwidth="8*" align="left"/>
31633 <colspec colwidth="6*" align="center"/>
31634 <colspec colwidth="6*" align="center"/>
31635 <colspec colwidth="6*" align="right"/>
31636 <tbody>
31637 <row>
31638 <entry><option>check_secondary_mx</option></entry>
31639 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31640 <entry>Type: <emphasis>boolean</emphasis></entry>
31641 <entry>Default: <emphasis>false</emphasis></entry>
31642 </row>
31643 </tbody>
31644 </tgroup>
31645 </informaltable>
31646 <para>
31647 <indexterm role="concept">
31648 <primary>MX record</primary>
31649 <secondary>checking for secondary</secondary>
31650 </indexterm>
31651 If this option is set, the router declines unless the local host is found in
31652 (and removed from) the list of hosts obtained by MX lookup. This can be used to
31653 process domains for which the local host is a secondary mail exchanger
31654 differently to other domains. The way in which Exim decides whether a host is
31655 the local host is described in section <xref linkend="SECTreclocipadd"/>.
31656 </para>
31657 <para>
31658 <indexterm role="option">
31659 <primary><option>check_srv</option></primary>
31660 </indexterm>
31661 </para>
31662 <informaltable frame="all">
31663 <tgroup cols="4" colsep="0" rowsep="0">
31664 <colspec colwidth="8*" align="left"/>
31665 <colspec colwidth="6*" align="center"/>
31666 <colspec colwidth="6*" align="center"/>
31667 <colspec colwidth="6*" align="right"/>
31668 <tbody>
31669 <row>
31670 <entry><option>check_srv</option></entry>
31671 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31672 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31673 <entry>Default: <emphasis>unset</emphasis></entry>
31674 </row>
31675 </tbody>
31676 </tgroup>
31677 </informaltable>
31678 <para>
31679 <indexterm role="concept">
31680 <primary>SRV record</primary>
31681 <secondary>enabling use of</secondary>
31682 </indexterm>
31683 The <command>dnslookup</command> router supports the use of SRV records (see RFC 2782) in
31684 addition to MX and address records. The support is disabled by default. To
31685 enable SRV support, set the <option>check_srv</option> option to the name of the service
31686 required. For example,
31687 </para>
31688 <literallayout class="monospaced">
31689 check_srv = smtp
31690 </literallayout>
31691 <para>
31692 looks for SRV records that refer to the normal smtp service. The option is
31693 expanded, so the service name can vary from message to message or address
31694 to address. This might be helpful if SRV records are being used for a
31695 submission service. If the expansion is forced to fail, the <option>check_srv</option>
31696 option is ignored, and the router proceeds to look for MX records in the
31697 normal way.
31698 </para>
31699 <para>
31700 When the expansion succeeds, the router searches first for SRV records for
31701 the given service (it assumes TCP protocol). A single SRV record with a
31702 host name that consists of just a single dot indicates <quote>no such service for
31703 this domain</quote>; if this is encountered, the router declines. If other kinds of
31704 SRV record are found, they are used to construct a host list for delivery
31705 according to the rules of RFC 2782. MX records are not sought in this case.
31706 </para>
31707 <para>
31708 When no SRV records are found, MX records (and address records) are sought in
31709 the traditional way. In other words, SRV records take precedence over MX
31710 records, just as MX records take precedence over address records. Note that
31711 this behaviour is not sanctioned by RFC 2782, though a previous draft RFC
31712 defined it. It is apparently believed that MX records are sufficient for email
31713 and that SRV records should not be used for this purpose. However, SRV records
31714 have an additional <quote>weight</quote> feature which some people might find useful when
31715 trying to split an SMTP load between hosts of different power.
31716 </para>
31717 <para>
31718 See section <xref linkend="SECTprowitdnsloo"/> above for a discussion of Exim&#x2019;s behaviour
31719 when there is a DNS lookup error.
31720 </para>
31721 <para>
31722 <indexterm role="option">
31723 <primary><option>mx_domains</option></primary>
31724 </indexterm>
31725 </para>
31726 <informaltable frame="all">
31727 <tgroup cols="4" colsep="0" rowsep="0">
31728 <colspec colwidth="8*" align="left"/>
31729 <colspec colwidth="6*" align="center"/>
31730 <colspec colwidth="6*" align="center"/>
31731 <colspec colwidth="6*" align="right"/>
31732 <tbody>
31733 <row>
31734 <entry><option>mx_domains</option></entry>
31735 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31736 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
31737 <entry>Default: <emphasis>unset</emphasis></entry>
31738 </row>
31739 </tbody>
31740 </tgroup>
31741 </informaltable>
31742 <para>
31743 <indexterm role="concept">
31744 <primary>MX record</primary>
31745 <secondary>required to exist</secondary>
31746 </indexterm>
31747 <indexterm role="concept">
31748 <primary>SRV record</primary>
31749 <secondary>required to exist</secondary>
31750 </indexterm>
31751 A domain that matches <option>mx_domains</option> is required to have either an MX or an SRV
31752 record in order to be recognized. (The name of this option could be improved.)
31753 For example, if all the mail hosts in <emphasis>fict.example</emphasis> are known to have MX
31754 records, except for those in <emphasis>discworld.fict.example</emphasis>, you could use this
31755 setting:
31756 </para>
31757 <literallayout class="monospaced">
31758 mx_domains = ! *.discworld.fict.example : *.fict.example
31759 </literallayout>
31760 <para>
31761 This specifies that messages addressed to a domain that matches the list but
31762 has no MX record should be bounced immediately instead of being routed using
31763 the address record.
31764 </para>
31765 <para>
31766 <indexterm role="option">
31767 <primary><option>mx_fail_domains</option></primary>
31768 </indexterm>
31769 </para>
31770 <informaltable frame="all">
31771 <tgroup cols="4" colsep="0" rowsep="0">
31772 <colspec colwidth="8*" align="left"/>
31773 <colspec colwidth="6*" align="center"/>
31774 <colspec colwidth="6*" align="center"/>
31775 <colspec colwidth="6*" align="right"/>
31776 <tbody>
31777 <row>
31778 <entry><option>mx_fail_domains</option></entry>
31779 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31780 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
31781 <entry>Default: <emphasis>unset</emphasis></entry>
31782 </row>
31783 </tbody>
31784 </tgroup>
31785 </informaltable>
31786 <para>
31787 If the DNS lookup for MX records for one of the domains in this list causes a
31788 DNS lookup error, Exim behaves as if no MX records were found. See section
31789 <xref linkend="SECTprowitdnsloo"/> for more discussion.
31790 </para>
31791 <para>
31792 <indexterm role="option">
31793 <primary><option>qualify_single</option></primary>
31794 </indexterm>
31795 </para>
31796 <informaltable frame="all">
31797 <tgroup cols="4" colsep="0" rowsep="0">
31798 <colspec colwidth="8*" align="left"/>
31799 <colspec colwidth="6*" align="center"/>
31800 <colspec colwidth="6*" align="center"/>
31801 <colspec colwidth="6*" align="right"/>
31802 <tbody>
31803 <row>
31804 <entry><option>qualify_single</option></entry>
31805 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31806 <entry>Type: <emphasis>boolean</emphasis></entry>
31807 <entry>Default: <emphasis>true</emphasis></entry>
31808 </row>
31809 </tbody>
31810 </tgroup>
31811 </informaltable>
31812 <para>
31813 <indexterm role="concept">
31814 <primary>DNS</primary>
31815 <secondary>resolver options</secondary>
31816 </indexterm>
31817 <indexterm role="concept">
31818 <primary>DNS</primary>
31819 <secondary>qualifying single-component names</secondary>
31820 </indexterm>
31821 When this option is true, the resolver option RES_DEFNAMES is set for DNS
31822 lookups. Typically, but not standardly, this causes the resolver to qualify
31823 single-component names with the default domain. For example, on a machine
31824 called <emphasis>dictionary.ref.example</emphasis>, the domain <emphasis>thesaurus</emphasis> would be changed to
31825 <emphasis>thesaurus.ref.example</emphasis> inside the resolver. For details of what your
31826 resolver actually does, consult your man pages for <emphasis>resolver</emphasis> and
31827 <emphasis>resolv.conf</emphasis>.
31828 </para>
31829 <para>
31830 <indexterm role="option">
31831 <primary><option>rewrite_headers</option></primary>
31832 </indexterm>
31833 </para>
31834 <informaltable frame="all">
31835 <tgroup cols="4" colsep="0" rowsep="0">
31836 <colspec colwidth="8*" align="left"/>
31837 <colspec colwidth="6*" align="center"/>
31838 <colspec colwidth="6*" align="center"/>
31839 <colspec colwidth="6*" align="right"/>
31840 <tbody>
31841 <row>
31842 <entry><option>rewrite_headers</option></entry>
31843 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31844 <entry>Type: <emphasis>boolean</emphasis></entry>
31845 <entry>Default: <emphasis>true</emphasis></entry>
31846 </row>
31847 </tbody>
31848 </tgroup>
31849 </informaltable>
31850 <para>
31851 <indexterm role="concept">
31852 <primary>rewriting</primary>
31853 <secondary>header lines</secondary>
31854 </indexterm>
31855 <indexterm role="concept">
31856 <primary>header lines</primary>
31857 <secondary>rewriting</secondary>
31858 </indexterm>
31859 If the domain name in the address that is being processed is not fully
31860 qualified, it may be expanded to its full form by a DNS lookup. For example, if
31861 an address is specified as <emphasis>dormouse@teaparty</emphasis>, the domain might be
31862 expanded to <emphasis>teaparty.wonderland.fict.example</emphasis>. Domain expansion can also
31863 occur as a result of setting the <option>widen_domains</option> option. If
31864 <option>rewrite_headers</option> is true, all occurrences of the abbreviated domain name in
31865 any <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-to:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>
31866 header lines of the message are rewritten with the full domain name.
31867 </para>
31868 <para>
31869 This option should be turned off only when it is known that no message is
31870 ever going to be sent outside an environment where the abbreviation makes
31871 sense.
31872 </para>
31873 <para>
31874 When an MX record is looked up in the DNS and matches a wildcard record, name
31875 servers normally return a record containing the name that has been looked up,
31876 making it impossible to detect whether a wildcard was present or not. However,
31877 some name servers have recently been seen to return the wildcard entry. If the
31878 name returned by a DNS lookup begins with an asterisk, it is not used for
31879 header rewriting.
31880 </para>
31881 <para>
31882 <indexterm role="option">
31883 <primary><option>same_domain_copy_routing</option></primary>
31884 </indexterm>
31885 </para>
31886 <informaltable frame="all">
31887 <tgroup cols="4" colsep="0" rowsep="0">
31888 <colspec colwidth="8*" align="left"/>
31889 <colspec colwidth="6*" align="center"/>
31890 <colspec colwidth="6*" align="center"/>
31891 <colspec colwidth="6*" align="right"/>
31892 <tbody>
31893 <row>
31894 <entry><option>same_domain_copy_routing</option></entry>
31895 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31896 <entry>Type: <emphasis>boolean</emphasis></entry>
31897 <entry>Default: <emphasis>false</emphasis></entry>
31898 </row>
31899 </tbody>
31900 </tgroup>
31901 </informaltable>
31902 <para>
31903 <indexterm role="concept">
31904 <primary>address</primary>
31905 <secondary>copying routing</secondary>
31906 </indexterm>
31907 Addresses with the same domain are normally routed by the <command>dnslookup</command> router
31908 to the same list of hosts. However, this cannot be presumed, because the router
31909 options and preconditions may refer to the local part of the address. By
31910 default, therefore, Exim routes each address in a message independently. DNS
31911 servers run caches, so repeated DNS lookups are not normally expensive, and in
31912 any case, personal messages rarely have more than a few recipients.
31913 </para>
31914 <para>
31915 If you are running mailing lists with large numbers of subscribers at the same
31916 domain, and you are using a <command>dnslookup</command> router which is independent of the
31917 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
31918 lookups for identical domains in one message. In this case, when <command>dnslookup</command>
31919 routes an address to a remote transport, any other unrouted addresses in the
31920 message that have the same domain are automatically given the same routing
31921 without processing them independently,
31922 provided the following conditions are met:
31923 </para>
31924 <itemizedlist>
31925 <listitem>
31926 <para>
31927 No router that processed the address specified <option>headers_add</option> or
31928 <option>headers_remove</option>.
31929 </para>
31930 </listitem>
31931 <listitem>
31932 <para>
31933 The router did not change the address in any way, for example, by <quote>widening</quote>
31934 the domain.
31935 </para>
31936 </listitem>
31937 </itemizedlist>
31938 <para>
31939 <indexterm role="option">
31940 <primary><option>search_parents</option></primary>
31941 </indexterm>
31942 </para>
31943 <informaltable frame="all">
31944 <tgroup cols="4" colsep="0" rowsep="0">
31945 <colspec colwidth="8*" align="left"/>
31946 <colspec colwidth="6*" align="center"/>
31947 <colspec colwidth="6*" align="center"/>
31948 <colspec colwidth="6*" align="right"/>
31949 <tbody>
31950 <row>
31951 <entry><option>search_parents</option></entry>
31952 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31953 <entry>Type: <emphasis>boolean</emphasis></entry>
31954 <entry>Default: <emphasis>false</emphasis></entry>
31955 </row>
31956 </tbody>
31957 </tgroup>
31958 </informaltable>
31959 <para>
31960 <indexterm role="concept">
31961 <primary>DNS</primary>
31962 <secondary>resolver options</secondary>
31963 </indexterm>
31964 When this option is true, the resolver option RES_DNSRCH is set for DNS
31965 lookups. This is different from the <option>qualify_single</option> option in that it
31966 applies to domains containing dots. Typically, but not standardly, it causes
31967 the resolver to search for the name in the current domain and in parent
31968 domains. For example, on a machine in the <emphasis>fict.example</emphasis> domain, if looking
31969 up <emphasis>teaparty.wonderland</emphasis> failed, the resolver would try
31970 <emphasis>teaparty.wonderland.fict.example</emphasis>. For details of what your resolver
31971 actually does, consult your man pages for <emphasis>resolver</emphasis> and <emphasis>resolv.conf</emphasis>.
31972 </para>
31973 <para>
31974 Setting this option true can cause problems in domains that have a wildcard MX
31975 record, because any domain that does not have its own MX record matches the
31976 local wildcard.
31977 </para>
31978 <para>
31979 <indexterm role="option">
31980 <primary><option>srv_fail_domains</option></primary>
31981 </indexterm>
31982 </para>
31983 <informaltable frame="all">
31984 <tgroup cols="4" colsep="0" rowsep="0">
31985 <colspec colwidth="8*" align="left"/>
31986 <colspec colwidth="6*" align="center"/>
31987 <colspec colwidth="6*" align="center"/>
31988 <colspec colwidth="6*" align="right"/>
31989 <tbody>
31990 <row>
31991 <entry><option>srv_fail_domains</option></entry>
31992 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31993 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
31994 <entry>Default: <emphasis>unset</emphasis></entry>
31995 </row>
31996 </tbody>
31997 </tgroup>
31998 </informaltable>
31999 <para>
32000 If the DNS lookup for SRV records for one of the domains in this list causes a
32001 DNS lookup error, Exim behaves as if no SRV records were found. See section
32002 <xref linkend="SECTprowitdnsloo"/> for more discussion.
32003 </para>
32004 <para>
32005 <indexterm role="option">
32006 <primary><option>widen_domains</option></primary>
32007 </indexterm>
32008 </para>
32009 <informaltable frame="all">
32010 <tgroup cols="4" colsep="0" rowsep="0">
32011 <colspec colwidth="8*" align="left"/>
32012 <colspec colwidth="6*" align="center"/>
32013 <colspec colwidth="6*" align="center"/>
32014 <colspec colwidth="6*" align="right"/>
32015 <tbody>
32016 <row>
32017 <entry><option>widen_domains</option></entry>
32018 <entry>Use: <emphasis>dnslookup</emphasis></entry>
32019 <entry>Type: <emphasis>string list</emphasis></entry>
32020 <entry>Default: <emphasis>unset</emphasis></entry>
32021 </row>
32022 </tbody>
32023 </tgroup>
32024 </informaltable>
32025 <para>
32026 <indexterm role="concept">
32027 <primary>domain</primary>
32028 <secondary>partial; widening</secondary>
32029 </indexterm>
32030 If a DNS lookup fails and this option is set, each of its strings in turn is
32031 added onto the end of the domain, and the lookup is tried again. For example,
32032 if
32033 </para>
32034 <literallayout class="monospaced">
32035 widen_domains = fict.example:ref.example
32036 </literallayout>
32037 <para>
32038 is set and a lookup of <emphasis>klingon.dictionary</emphasis> fails,
32039 <emphasis>klingon.dictionary.fict.example</emphasis> is looked up, and if this fails,
32040 <emphasis>klingon.dictionary.ref.example</emphasis> is tried. Note that the <option>qualify_single</option>
32041 and <option>search_parents</option> options can cause some widening to be undertaken inside
32042 the DNS resolver. <option>widen_domains</option> is not applied to sender addresses
32043 when verifying, unless <option>rewrite_headers</option> is false (not the default).
32044 </para>
32045 </section>
32046 <section id="SECID119">
32047 <title>Effect of qualify_single and search_parents</title>
32048 <para>
32049 When a domain from an envelope recipient is changed by the resolver as a result
32050 of the <option>qualify_single</option> or <option>search_parents</option> options, Exim rewrites the
32051 corresponding address in the message&#x2019;s header lines unless <option>rewrite_headers</option>
32052 is set false. Exim then re-routes the address, using the full domain.
32053 </para>
32054 <para>
32055 These two options affect only the DNS lookup that takes place inside the router
32056 for the domain of the address that is being routed. They do not affect lookups
32057 such as that implied by
32058 </para>
32059 <literallayout class="monospaced">
32060 domains = @mx_any
32061 </literallayout>
32062 <para>
32063 that may happen while processing a router precondition before the router is
32064 entered. No widening ever takes place for these lookups.
32065 <indexterm role="concept" startref="IIDdnsrou1" class="endofrange"/>
32066 <indexterm role="concept" startref="IIDdnsrou2" class="endofrange"/>
32067 </para>
32068 </section>
32069 </chapter>
32070
32071 <chapter id="CHID5">
32072 <title>The ipliteral router</title>
32073 <para>
32074 <indexterm role="concept">
32075 <primary><command>ipliteral</command> router</primary>
32076 </indexterm>
32077 <indexterm role="concept">
32078 <primary>domain literal</primary>
32079 <secondary>routing</secondary>
32080 </indexterm>
32081 <indexterm role="concept">
32082 <primary>routers</primary>
32083 <secondary><command>ipliteral</command></secondary>
32084 </indexterm>
32085 This router has no private options. Unless it is being used purely for
32086 verification (see <option>verify_only</option>) a transport is required to be defined by the
32087 generic <option>transport</option> option. The router accepts the address if its domain part
32088 takes the form of an RFC 2822 domain literal. For example, the <command>ipliteral</command>
32089 router handles the address
32090 </para>
32091 <literallayout class="monospaced">
32092 root@[192.168.1.1]
32093 </literallayout>
32094 <para>
32095 by setting up delivery to the host with that IP address. IPv4 domain literals
32096 consist of an IPv4 address enclosed in square brackets. IPv6 domain literals
32097 are similar, but the address is preceded by <literal>ipv6:</literal>. For example:
32098 </para>
32099 <literallayout class="monospaced">
32100 postmaster@[ipv6:fe80::a00:20ff:fe86:a061.5678]
32101 </literallayout>
32102 <para>
32103 Exim allows <literal>ipv4:</literal> before IPv4 addresses, for consistency, and on the
32104 grounds that sooner or later somebody will try it.
32105 </para>
32106 <para>
32107 <indexterm role="option">
32108 <primary><option>self</option></primary>
32109 <secondary>in <command>ipliteral</command> router</secondary>
32110 </indexterm>
32111 If the IP address matches something in <option>ignore_target_hosts</option>, the router
32112 declines. If an IP literal turns out to refer to the local host, the generic
32113 <option>self</option> option determines what happens.
32114 </para>
32115 <para>
32116 The RFCs require support for domain literals; however, their use is
32117 controversial in today&#x2019;s Internet. If you want to use this router, you must
32118 also set the main configuration option <option>allow_domain_literals</option>. Otherwise,
32119 Exim will not recognize the domain literal syntax in addresses.
32120 </para>
32121 </chapter>
32122
32123 <chapter id="CHID6">
32124 <title>The iplookup router</title>
32125 <para>
32126 <indexterm role="concept">
32127 <primary><command>iplookup</command> router</primary>
32128 </indexterm>
32129 <indexterm role="concept">
32130 <primary>routers</primary>
32131 <secondary><command>iplookup</command></secondary>
32132 </indexterm>
32133 The <command>iplookup</command> router was written to fulfil a specific requirement in
32134 Cambridge University (which in fact no longer exists). For this reason, it is
32135 not included in the binary of Exim by default. If you want to include it, you
32136 must set
32137 </para>
32138 <literallayout class="monospaced">
32139 ROUTER_IPLOOKUP=yes
32140 </literallayout>
32141 <para>
32142 in your <filename>Local/Makefile</filename> configuration file.
32143 </para>
32144 <para>
32145 The <command>iplookup</command> router routes an address by sending it over a TCP or UDP
32146 connection to one or more specific hosts. The host can then return the same or
32147 a different address &ndash; in effect rewriting the recipient address in the
32148 message&#x2019;s envelope. The new address is then passed on to subsequent routers. If
32149 this process fails, the address can be passed on to other routers, or delivery
32150 can be deferred. Since <command>iplookup</command> is just a rewriting router, a transport
32151 must not be specified for it.
32152 </para>
32153 <para>
32154 <indexterm role="concept">
32155 <primary>options</primary>
32156 <secondary><command>iplookup</command> router</secondary>
32157 </indexterm>
32158 <indexterm role="option">
32159 <primary><option>hosts</option></primary>
32160 </indexterm>
32161 </para>
32162 <informaltable frame="all">
32163 <tgroup cols="4" colsep="0" rowsep="0">
32164 <colspec colwidth="8*" align="left"/>
32165 <colspec colwidth="6*" align="center"/>
32166 <colspec colwidth="6*" align="center"/>
32167 <colspec colwidth="6*" align="right"/>
32168 <tbody>
32169 <row>
32170 <entry><option>hosts</option></entry>
32171 <entry>Use: <emphasis>iplookup</emphasis></entry>
32172 <entry>Type: <emphasis>string</emphasis></entry>
32173 <entry>Default: <emphasis>unset</emphasis></entry>
32174 </row>
32175 </tbody>
32176 </tgroup>
32177 </informaltable>
32178 <para>
32179 This option must be supplied. Its value is a colon-separated list of host
32180 names. The hosts are looked up using <function>gethostbyname()</function>
32181 (or <function>getipnodebyname()</function> when available)
32182 and are tried in order until one responds to the query. If none respond, what
32183 happens is controlled by <option>optional</option>.
32184 </para>
32185 <para>
32186 <indexterm role="option">
32187 <primary><option>optional</option></primary>
32188 </indexterm>
32189 </para>
32190 <informaltable frame="all">
32191 <tgroup cols="4" colsep="0" rowsep="0">
32192 <colspec colwidth="8*" align="left"/>
32193 <colspec colwidth="6*" align="center"/>
32194 <colspec colwidth="6*" align="center"/>
32195 <colspec colwidth="6*" align="right"/>
32196 <tbody>
32197 <row>
32198 <entry><option>optional</option></entry>
32199 <entry>Use: <emphasis>iplookup</emphasis></entry>
32200 <entry>Type: <emphasis>boolean</emphasis></entry>
32201 <entry>Default: <emphasis>false</emphasis></entry>
32202 </row>
32203 </tbody>
32204 </tgroup>
32205 </informaltable>
32206 <para>
32207 If <option>optional</option> is true, if no response is obtained from any host, the address
32208 is passed to the next router, overriding <option>no_more</option>. If <option>optional</option> is false,
32209 delivery to the address is deferred.
32210 </para>
32211 <para>
32212 <indexterm role="option">
32213 <primary><option>port</option></primary>
32214 </indexterm>
32215 </para>
32216 <informaltable frame="all">
32217 <tgroup cols="4" colsep="0" rowsep="0">
32218 <colspec colwidth="8*" align="left"/>
32219 <colspec colwidth="6*" align="center"/>
32220 <colspec colwidth="6*" align="center"/>
32221 <colspec colwidth="6*" align="right"/>
32222 <tbody>
32223 <row>
32224 <entry><option>port</option></entry>
32225 <entry>Use: <emphasis>iplookup</emphasis></entry>
32226 <entry>Type: <emphasis>integer</emphasis></entry>
32227 <entry>Default: <emphasis>0</emphasis></entry>
32228 </row>
32229 </tbody>
32230 </tgroup>
32231 </informaltable>
32232 <para>
32233 <indexterm role="concept">
32234 <primary>port</primary>
32235 <secondary><command>iplookup</command> router</secondary>
32236 </indexterm>
32237 This option must be supplied. It specifies the port number for the TCP or UDP
32238 call.
32239 </para>
32240 <para>
32241 <indexterm role="option">
32242 <primary><option>protocol</option></primary>
32243 </indexterm>
32244 </para>
32245 <informaltable frame="all">
32246 <tgroup cols="4" colsep="0" rowsep="0">
32247 <colspec colwidth="8*" align="left"/>
32248 <colspec colwidth="6*" align="center"/>
32249 <colspec colwidth="6*" align="center"/>
32250 <colspec colwidth="6*" align="right"/>
32251 <tbody>
32252 <row>
32253 <entry><option>protocol</option></entry>
32254 <entry>Use: <emphasis>iplookup</emphasis></entry>
32255 <entry>Type: <emphasis>string</emphasis></entry>
32256 <entry>Default: <emphasis>udp</emphasis></entry>
32257 </row>
32258 </tbody>
32259 </tgroup>
32260 </informaltable>
32261 <para>
32262 This option can be set to <quote>udp</quote> or <quote>tcp</quote> to specify which of the two
32263 protocols is to be used.
32264 </para>
32265 <para>
32266 <indexterm role="option">
32267 <primary><option>query</option></primary>
32268 </indexterm>
32269 </para>
32270 <informaltable frame="all">
32271 <tgroup cols="4" colsep="0" rowsep="0">
32272 <colspec colwidth="8*" align="left"/>
32273 <colspec colwidth="6*" align="center"/>
32274 <colspec colwidth="6*" align="center"/>
32275 <colspec colwidth="6*" align="right"/>
32276 <tbody>
32277 <row>
32278 <entry><option>query</option></entry>
32279 <entry>Use: <emphasis>iplookup</emphasis></entry>
32280 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32281 <entry>Default: <emphasis>see below</emphasis></entry>
32282 </row>
32283 </tbody>
32284 </tgroup>
32285 </informaltable>
32286 <para>
32287 This defines the content of the query that is sent to the remote hosts. The
32288 default value is:
32289 </para>
32290 <literallayout class="monospaced">
32291 $local_part@$domain $local_part@$domain
32292 </literallayout>
32293 <para>
32294 The repetition serves as a way of checking that a response is to the correct
32295 query in the default case (see <option>response_pattern</option> below).
32296 </para>
32297 <para>
32298 <indexterm role="option">
32299 <primary><option>reroute</option></primary>
32300 </indexterm>
32301 </para>
32302 <informaltable frame="all">
32303 <tgroup cols="4" colsep="0" rowsep="0">
32304 <colspec colwidth="8*" align="left"/>
32305 <colspec colwidth="6*" align="center"/>
32306 <colspec colwidth="6*" align="center"/>
32307 <colspec colwidth="6*" align="right"/>
32308 <tbody>
32309 <row>
32310 <entry><option>reroute</option></entry>
32311 <entry>Use: <emphasis>iplookup</emphasis></entry>
32312 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32313 <entry>Default: <emphasis>unset</emphasis></entry>
32314 </row>
32315 </tbody>
32316 </tgroup>
32317 </informaltable>
32318 <para>
32319 If this option is not set, the rerouted address is precisely the byte string
32320 returned by the remote host, up to the first white space, if any. If set, the
32321 string is expanded to form the rerouted address. It can include parts matched
32322 in the response by <option>response_pattern</option> by means of numeric variables such as
32323 <varname>$1</varname>, <varname>$2</varname>, etc. The variable <varname>$0</varname> refers to the entire input string,
32324 whether or not a pattern is in use. In all cases, the rerouted address must end
32325 up in the form <emphasis>local_part@domain</emphasis>.
32326 </para>
32327 <para>
32328 <indexterm role="option">
32329 <primary><option>response_pattern</option></primary>
32330 </indexterm>
32331 </para>
32332 <informaltable frame="all">
32333 <tgroup cols="4" colsep="0" rowsep="0">
32334 <colspec colwidth="8*" align="left"/>
32335 <colspec colwidth="6*" align="center"/>
32336 <colspec colwidth="6*" align="center"/>
32337 <colspec colwidth="6*" align="right"/>
32338 <tbody>
32339 <row>
32340 <entry><option>response_pattern</option></entry>
32341 <entry>Use: <emphasis>iplookup</emphasis></entry>
32342 <entry>Type: <emphasis>string</emphasis></entry>
32343 <entry>Default: <emphasis>unset</emphasis></entry>
32344 </row>
32345 </tbody>
32346 </tgroup>
32347 </informaltable>
32348 <para>
32349 This option can be set to a regular expression that is applied to the string
32350 returned from the remote host. If the pattern does not match the response, the
32351 router declines. If <option>response_pattern</option> is not set, no checking of the
32352 response is done, unless the query was defaulted, in which case there is a
32353 check that the text returned after the first white space is the original
32354 address. This checks that the answer that has been received is in response to
32355 the correct question. For example, if the response is just a new domain, the
32356 following could be used:
32357 </para>
32358 <literallayout class="monospaced">
32359 response_pattern = ^([^@]+)$
32360 reroute = $local_part@$1
32361 </literallayout>
32362 <para>
32363 <indexterm role="option">
32364 <primary><option>timeout</option></primary>
32365 </indexterm>
32366 </para>
32367 <informaltable frame="all">
32368 <tgroup cols="4" colsep="0" rowsep="0">
32369 <colspec colwidth="8*" align="left"/>
32370 <colspec colwidth="6*" align="center"/>
32371 <colspec colwidth="6*" align="center"/>
32372 <colspec colwidth="6*" align="right"/>
32373 <tbody>
32374 <row>
32375 <entry><option>timeout</option></entry>
32376 <entry>Use: <emphasis>iplookup</emphasis></entry>
32377 <entry>Type: <emphasis>time</emphasis></entry>
32378 <entry>Default: <emphasis>5s</emphasis></entry>
32379 </row>
32380 </tbody>
32381 </tgroup>
32382 </informaltable>
32383 <para>
32384 This specifies the amount of time to wait for a response from the remote
32385 machine. The same timeout is used for the <function>connect()</function> function for a TCP
32386 call. It does not apply to UDP.
32387 </para>
32388 </chapter>
32389
32390 <chapter id="CHID7">
32391 <title>The manualroute router</title>
32392 <para>
32393 <indexterm role="concept" id="IIDmanrou1" class="startofrange">
32394 <primary><command>manualroute</command> router</primary>
32395 </indexterm>
32396 <indexterm role="concept" id="IIDmanrou2" class="startofrange">
32397 <primary>routers</primary>
32398 <secondary><command>manualroute</command></secondary>
32399 </indexterm>
32400 <indexterm role="concept">
32401 <primary>domain</primary>
32402 <secondary>manually routing</secondary>
32403 </indexterm>
32404 The <command>manualroute</command> router is so-called because it provides a way of manually
32405 routing an address according to its domain. It is mainly used when you want to
32406 route addresses to remote hosts according to your own rules, bypassing the
32407 normal DNS routing that looks up MX records. However, <command>manualroute</command> can also
32408 route to local transports, a facility that may be useful if you want to save
32409 messages for dial-in hosts in local files.
32410 </para>
32411 <para>
32412 The <command>manualroute</command> router compares a list of domain patterns with the domain
32413 it is trying to route. If there is no match, the router declines. Each pattern
32414 has associated with it a list of hosts and some other optional data, which may
32415 include a transport. The combination of a pattern and its data is called a
32416 <quote>routing rule</quote>. For patterns that do not have an associated transport, the
32417 generic <option>transport</option> option must specify a transport, unless the router is
32418 being used purely for verification (see <option>verify_only</option>).
32419 </para>
32420 <para>
32421 <indexterm role="variable">
32422 <primary><varname>$host</varname></primary>
32423 </indexterm>
32424 In the case of verification, matching the domain pattern is sufficient for the
32425 router to accept the address. When actually routing an address for delivery,
32426 an address that matches a domain pattern is queued for the associated
32427 transport. If the transport is not a local one, a host list must be associated
32428 with the pattern; IP addresses are looked up for the hosts, and these are
32429 passed to the transport along with the mail address. For local transports, a
32430 host list is optional. If it is present, it is passed in <varname>$host</varname> as a single
32431 text string.
32432 </para>
32433 <para>
32434 The list of routing rules can be provided as an inline string in
32435 <option>route_list</option>, or the data can be obtained by looking up the domain in a file
32436 or database by setting <option>route_data</option>. Only one of these settings may appear in
32437 any one instance of <command>manualroute</command>. The format of routing rules is described
32438 below, following the list of private options.
32439 </para>
32440 <section id="SECTprioptman">
32441 <title>Private options for manualroute</title>
32442 <para>
32443 <indexterm role="concept">
32444 <primary>options</primary>
32445 <secondary><command>manualroute</command> router</secondary>
32446 </indexterm>
32447 The private options for the <command>manualroute</command> router are as follows:
32448 </para>
32449 <para>
32450 <indexterm role="option">
32451 <primary><option>host_all_ignored</option></primary>
32452 </indexterm>
32453 </para>
32454 <informaltable frame="all">
32455 <tgroup cols="4" colsep="0" rowsep="0">
32456 <colspec colwidth="8*" align="left"/>
32457 <colspec colwidth="6*" align="center"/>
32458 <colspec colwidth="6*" align="center"/>
32459 <colspec colwidth="6*" align="right"/>
32460 <tbody>
32461 <row>
32462 <entry><option>host_all_ignored</option></entry>
32463 <entry>Use: <emphasis>manualroute</emphasis></entry>
32464 <entry>Type: <emphasis>string</emphasis></entry>
32465 <entry>Default: <emphasis>defer</emphasis></entry>
32466 </row>
32467 </tbody>
32468 </tgroup>
32469 </informaltable>
32470 <para>
32471 See <option>host_find_failed</option>.
32472 </para>
32473 <para>
32474 <indexterm role="option">
32475 <primary><option>host_find_failed</option></primary>
32476 </indexterm>
32477 </para>
32478 <informaltable frame="all">
32479 <tgroup cols="4" colsep="0" rowsep="0">
32480 <colspec colwidth="8*" align="left"/>
32481 <colspec colwidth="6*" align="center"/>
32482 <colspec colwidth="6*" align="center"/>
32483 <colspec colwidth="6*" align="right"/>
32484 <tbody>
32485 <row>
32486 <entry><option>host_find_failed</option></entry>
32487 <entry>Use: <emphasis>manualroute</emphasis></entry>
32488 <entry>Type: <emphasis>string</emphasis></entry>
32489 <entry>Default: <emphasis>freeze</emphasis></entry>
32490 </row>
32491 </tbody>
32492 </tgroup>
32493 </informaltable>
32494 <para>
32495 This option controls what happens when <command>manualroute</command> tries to find an IP
32496 address for a host, and the host does not exist. The option can be set to one
32497 of the following values:
32498 </para>
32499 <literallayout class="monospaced">
32500 decline
32501 defer
32502 fail
32503 freeze
32504 ignore
32505 pass
32506 </literallayout>
32507 <para>
32508 The default (<quote>freeze</quote>) assumes that this state is a serious configuration
32509 error. The difference between <quote>pass</quote> and <quote>decline</quote> is that the former
32510 forces the address to be passed to the next router (or the router defined by
32511 <option>pass_router</option>),
32512 <indexterm role="option">
32513 <primary><option>more</option></primary>
32514 </indexterm>
32515 overriding <option>no_more</option>, whereas the latter passes the address to the next
32516 router only if <option>more</option> is true.
32517 </para>
32518 <para>
32519 The value <quote>ignore</quote> causes Exim to completely ignore a host whose IP address
32520 cannot be found. If all the hosts in the list are ignored, the behaviour is
32521 controlled by the <option>host_all_ignored</option> option. This takes the same values
32522 as <option>host_find_failed</option>, except that it cannot be set to <quote>ignore</quote>.
32523 </para>
32524 <para>
32525 The <option>host_find_failed</option> option applies only to a definite <quote>does not exist</quote>
32526 state; if a host lookup gets a temporary error, delivery is deferred unless the
32527 generic <option>pass_on_timeout</option> option is set.
32528 </para>
32529 <para>
32530 <indexterm role="option">
32531 <primary><option>hosts_randomize</option></primary>
32532 </indexterm>
32533 </para>
32534 <informaltable frame="all">
32535 <tgroup cols="4" colsep="0" rowsep="0">
32536 <colspec colwidth="8*" align="left"/>
32537 <colspec colwidth="6*" align="center"/>
32538 <colspec colwidth="6*" align="center"/>
32539 <colspec colwidth="6*" align="right"/>
32540 <tbody>
32541 <row>
32542 <entry><option>hosts_randomize</option></entry>
32543 <entry>Use: <emphasis>manualroute</emphasis></entry>
32544 <entry>Type: <emphasis>boolean</emphasis></entry>
32545 <entry>Default: <emphasis>false</emphasis></entry>
32546 </row>
32547 </tbody>
32548 </tgroup>
32549 </informaltable>
32550 <para>
32551 <indexterm role="concept">
32552 <primary>randomized host list</primary>
32553 </indexterm>
32554 <indexterm role="concept">
32555 <primary>host</primary>
32556 <secondary>list of; randomized</secondary>
32557 </indexterm>
32558 If this option is set, the order of the items in a host list in a routing rule
32559 is randomized each time the list is used, unless an option in the routing rule
32560 overrides (see below). Randomizing the order of a host list can be used to do
32561 crude load sharing. However, if more than one mail address is routed by the
32562 same router to the same host list, the host lists are considered to be the same
32563 (even though they may be randomized into different orders) for the purpose of
32564 deciding whether to batch the deliveries into a single SMTP transaction.
32565 </para>
32566 <para>
32567 When <option>hosts_randomize</option> is true, a host list may be split
32568 into groups whose order is separately randomized. This makes it possible to
32569 set up MX-like behaviour. The boundaries between groups are indicated by an
32570 item that is just <literal>+</literal> in the host list. For example:
32571 </para>
32572 <literallayout class="monospaced">
32573 route_list = * host1:host2:host3:+:host4:host5
32574 </literallayout>
32575 <para>
32576 The order of the first three hosts and the order of the last two hosts is
32577 randomized for each use, but the first three always end up before the last two.
32578 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored. If a
32579 randomized host list is passed to an <command>smtp</command> transport that also has
32580 <option>hosts_randomize set</option>, the list is not re-randomized.
32581 </para>
32582 <para>
32583 <indexterm role="option">
32584 <primary><option>route_data</option></primary>
32585 </indexterm>
32586 </para>
32587 <informaltable frame="all">
32588 <tgroup cols="4" colsep="0" rowsep="0">
32589 <colspec colwidth="8*" align="left"/>
32590 <colspec colwidth="6*" align="center"/>
32591 <colspec colwidth="6*" align="center"/>
32592 <colspec colwidth="6*" align="right"/>
32593 <tbody>
32594 <row>
32595 <entry><option>route_data</option></entry>
32596 <entry>Use: <emphasis>manualroute</emphasis></entry>
32597 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32598 <entry>Default: <emphasis>unset</emphasis></entry>
32599 </row>
32600 </tbody>
32601 </tgroup>
32602 </informaltable>
32603 <para>
32604 If this option is set, it must expand to yield the data part of a routing rule.
32605 Typically, the expansion string includes a lookup based on the domain. For
32606 example:
32607 </para>
32608 <literallayout class="monospaced">
32609 route_data = ${lookup{$domain}dbm{/etc/routes}}
32610 </literallayout>
32611 <para>
32612 If the expansion is forced to fail, or the result is an empty string, the
32613 router declines. Other kinds of expansion failure cause delivery to be
32614 deferred.
32615 </para>
32616 <para>
32617 <indexterm role="option">
32618 <primary><option>route_list</option></primary>
32619 </indexterm>
32620 </para>
32621 <informaltable frame="all">
32622 <tgroup cols="4" colsep="0" rowsep="0">
32623 <colspec colwidth="8*" align="left"/>
32624 <colspec colwidth="6*" align="center"/>
32625 <colspec colwidth="6*" align="center"/>
32626 <colspec colwidth="6*" align="right"/>
32627 <tbody>
32628 <row>
32629 <entry><option>route_list</option></entry>
32630 <entry>Use: <emphasis>manualroute</emphasis></entry>
32631 <entry>Type: <emphasis>string list</emphasis></entry>
32632 <entry>Default: <emphasis>unset</emphasis></entry>
32633 </row>
32634 </tbody>
32635 </tgroup>
32636 </informaltable>
32637 <para>
32638 This string is a list of routing rules, in the form defined below. Note that,
32639 unlike most string lists, the items are separated by semicolons. This is so
32640 that they may contain colon-separated host lists.
32641 </para>
32642 <para>
32643 <indexterm role="option">
32644 <primary><option>same_domain_copy_routing</option></primary>
32645 </indexterm>
32646 </para>
32647 <informaltable frame="all">
32648 <tgroup cols="4" colsep="0" rowsep="0">
32649 <colspec colwidth="8*" align="left"/>
32650 <colspec colwidth="6*" align="center"/>
32651 <colspec colwidth="6*" align="center"/>
32652 <colspec colwidth="6*" align="right"/>
32653 <tbody>
32654 <row>
32655 <entry><option>same_domain_copy_routing</option></entry>
32656 <entry>Use: <emphasis>manualroute</emphasis></entry>
32657 <entry>Type: <emphasis>boolean</emphasis></entry>
32658 <entry>Default: <emphasis>false</emphasis></entry>
32659 </row>
32660 </tbody>
32661 </tgroup>
32662 </informaltable>
32663 <para>
32664 <indexterm role="concept">
32665 <primary>address</primary>
32666 <secondary>copying routing</secondary>
32667 </indexterm>
32668 Addresses with the same domain are normally routed by the <command>manualroute</command>
32669 router to the same list of hosts. However, this cannot be presumed, because the
32670 router options and preconditions may refer to the local part of the address. By
32671 default, therefore, Exim routes each address in a message independently. DNS
32672 servers run caches, so repeated DNS lookups are not normally expensive, and in
32673 any case, personal messages rarely have more than a few recipients.
32674 </para>
32675 <para>
32676 If you are running mailing lists with large numbers of subscribers at the same
32677 domain, and you are using a <command>manualroute</command> router which is independent of the
32678 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
32679 lookups for identical domains in one message. In this case, when
32680 <command>manualroute</command> routes an address to a remote transport, any other unrouted
32681 addresses in the message that have the same domain are automatically given the
32682 same routing without processing them independently. However, this is only done
32683 if <option>headers_add</option> and <option>headers_remove</option> are unset.
32684 </para>
32685 </section>
32686 <section id="SECID120">
32687 <title>Routing rules in route_list</title>
32688 <para>
32689 The value of <option>route_list</option> is a string consisting of a sequence of routing
32690 rules, separated by semicolons. If a semicolon is needed in a rule, it can be
32691 entered as two semicolons. Alternatively, the list separator can be changed as
32692 described (for colon-separated lists) in section <xref linkend="SECTlistconstruct"/>.
32693 Empty rules are ignored. The format of each rule is
32694 </para>
32695 <literallayout>
32696 &lt;<emphasis>domain pattern</emphasis>&gt;  &lt;<emphasis>list of hosts</emphasis>&gt;  &lt;<emphasis>options</emphasis>&gt;
32697 </literallayout>
32698 <para>
32699 The following example contains two rules, each with a simple domain pattern and
32700 no options:
32701 </para>
32702 <literallayout class="monospaced">
32703 route_list = \
32704   dict.ref.example  mail-1.ref.example:mail-2.ref.example ; \
32705   thes.ref.example  mail-3.ref.example:mail-4.ref.example
32706 </literallayout>
32707 <para>
32708 The three parts of a rule are separated by white space. The pattern and the
32709 list of hosts can be enclosed in quotes if necessary, and if they are, the
32710 usual quoting rules apply. Each rule in a <option>route_list</option> must start with a
32711 single domain pattern, which is the only mandatory item in the rule. The
32712 pattern is in the same format as one item in a domain list (see section
32713 <xref linkend="SECTdomainlist"/>),
32714 except that it may not be the name of an interpolated file.
32715 That is, it may be wildcarded, or a regular expression, or a file or database
32716 lookup (with semicolons doubled, because of the use of semicolon as a separator
32717 in a <option>route_list</option>).
32718 </para>
32719 <para>
32720 The rules in <option>route_list</option> are searched in order until one of the patterns
32721 matches the domain that is being routed. The list of hosts and then options are
32722 then used as described below. If there is no match, the router declines. When
32723 <option>route_list</option> is set, <option>route_data</option> must not be set.
32724 </para>
32725 </section>
32726 <section id="SECID121">
32727 <title>Routing rules in route_data</title>
32728 <para>
32729 The use of <option>route_list</option> is convenient when there are only a small number of
32730 routing rules. For larger numbers, it is easier to use a file or database to
32731 hold the routing information, and use the <option>route_data</option> option instead.
32732 The value of <option>route_data</option> is a list of hosts, followed by (optional) options.
32733 Most commonly, <option>route_data</option> is set as a string that contains an
32734 expansion lookup. For example, suppose we place two routing rules in a file
32735 like this:
32736 </para>
32737 <literallayout class="monospaced">
32738 dict.ref.example:  mail-1.ref.example:mail-2.ref.example
32739 thes.ref.example:  mail-3.ref.example:mail-4.ref.example
32740 </literallayout>
32741 <para>
32742 This data can be accessed by setting
32743 </para>
32744 <literallayout class="monospaced">
32745 route_data = ${lookup{$domain}lsearch{/the/file/name}}
32746 </literallayout>
32747 <para>
32748 Failure of the lookup results in an empty string, causing the router to
32749 decline. However, you do not have to use a lookup in <option>route_data</option>. The only
32750 requirement is that the result of expanding the string is a list of hosts,
32751 possibly followed by options, separated by white space. The list of hosts must
32752 be enclosed in quotes if it contains white space.
32753 </para>
32754 </section>
32755 <section id="SECID122">
32756 <title>Format of the list of hosts</title>
32757 <para>
32758 A list of hosts, whether obtained via <option>route_data</option> or <option>route_list</option>, is
32759 always separately expanded before use. If the expansion fails, the router
32760 declines. The result of the expansion must be a colon-separated list of names
32761 and/or IP addresses, optionally also including ports. The format of each item
32762 in the list is described in the next section. The list separator can be changed
32763 as described in section <xref linkend="SECTlistconstruct"/>.
32764 </para>
32765 <para>
32766 If the list of hosts was obtained from a <option>route_list</option> item, the following
32767 variables are set during its expansion:
32768 </para>
32769 <itemizedlist>
32770 <listitem>
32771 <para>
32772 <indexterm role="concept">
32773 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname>  etc)</primary>
32774 <secondary>in <command>manualroute</command> router</secondary>
32775 </indexterm>
32776 If the domain was matched against a regular expression, the numeric variables
32777 <varname>$1</varname>, <varname>$2</varname>, etc. may be set. For example:
32778 </para>
32779 <literallayout class="monospaced">
32780 route_list = ^domain(\d+)   host-$1.text.example
32781 </literallayout>
32782 </listitem>
32783 <listitem>
32784 <para>
32785 <varname>$0</varname> is always set to the entire domain.
32786 </para>
32787 </listitem>
32788 <listitem>
32789 <para>
32790 <varname>$1</varname> is also set when partial matching is done in a file lookup.
32791 </para>
32792 </listitem>
32793 <listitem>
32794 <para>
32795 <indexterm role="variable">
32796 <primary><varname>$value</varname></primary>
32797 </indexterm>
32798 If the pattern that matched the domain was a lookup item, the data that was
32799 looked up is available in the expansion variable <varname>$value</varname>. For example:
32800 </para>
32801 <literallayout class="monospaced">
32802 route_list = lsearch;;/some/file.routes  $value
32803 </literallayout>
32804 </listitem>
32805 </itemizedlist>
32806 <para>
32807 Note the doubling of the semicolon in the pattern that is necessary because
32808 semicolon is the default route list separator.
32809 </para>
32810 </section>
32811 <section id="SECTformatonehostitem">
32812 <title>Format of one host item</title>
32813 <para>
32814 Each item in the list of hosts is either a host name or an IP address,
32815 optionally with an attached port number. When no port is given, an IP address
32816 is not enclosed in brackets. When a port is specified, it overrides the port
32817 specification on the transport. The port is separated from the name or address
32818 by a colon. This leads to some complications:
32819 </para>
32820 <itemizedlist>
32821 <listitem>
32822 <para>
32823 Because colon is the default separator for the list of hosts, either
32824 the colon that specifies a port must be doubled, or the list separator must
32825 be changed. The following two examples have the same effect:
32826 </para>
32827 <literallayout class="monospaced">
32828 route_list = * "host1.tld::1225 : host2.tld::1226"
32829 route_list = * "&lt;+ host1.tld:1225 + host2.tld:1226"
32830 </literallayout>
32831 </listitem>
32832 <listitem>
32833 <para>
32834 When IPv6 addresses are involved, it gets worse, because they contain
32835 colons of their own. To make this case easier, it is permitted to
32836 enclose an IP address (either v4 or v6) in square brackets if a port
32837 number follows. For example:
32838 </para>
32839 <literallayout class="monospaced">
32840 route_list = * "&lt;/ [10.1.1.1]:1225 / [::1]:1226"
32841 </literallayout>
32842 </listitem>
32843 </itemizedlist>
32844 </section>
32845 <section id="SECThostshowused">
32846 <title>How the list of hosts is used</title>
32847 <para>
32848 When an address is routed to an <command>smtp</command> transport by <command>manualroute</command>, each of
32849 the hosts is tried, in the order specified, when carrying out the SMTP
32850 delivery. However, the order can be changed by setting the <option>hosts_randomize</option>
32851 option, either on the router (see section <xref linkend="SECTprioptman"/> above), or on the
32852 transport.
32853 </para>
32854 <para>
32855 Hosts may be listed by name or by IP address. An unadorned name in the list of
32856 hosts is interpreted as a host name. A name that is followed by <literal>/MX</literal> is
32857 interpreted as an indirection to a sublist of hosts obtained by looking up MX
32858 records in the DNS. For example:
32859 </para>
32860 <literallayout class="monospaced">
32861 route_list = *  x.y.z:p.q.r/MX:e.f.g
32862 </literallayout>
32863 <para>
32864 If this feature is used with a port specifier, the port must come last. For
32865 example:
32866 </para>
32867 <literallayout class="monospaced">
32868 route_list = *  dom1.tld/mx::1225
32869 </literallayout>
32870 <para>
32871 If the <option>hosts_randomize</option> option is set, the order of the items in the list is
32872 randomized before any lookups are done. Exim then scans the list; for any name
32873 that is not followed by <literal>/MX</literal> it looks up an IP address. If this turns out to
32874 be an interface on the local host and the item is not the first in the list,
32875 Exim discards it and any subsequent items. If it is the first item, what
32876 happens is controlled by the
32877 <indexterm role="option">
32878 <primary><option>self</option></primary>
32879 <secondary>in <command>manualroute</command> router</secondary>
32880 </indexterm>
32881 <option>self</option> option of the router.
32882 </para>
32883 <para>
32884 A name on the list that is followed by <literal>/MX</literal> is replaced with the list of
32885 hosts obtained by looking up MX records for the name. This is always a DNS
32886 lookup; the <option>bydns</option> and <option>byname</option> options (see section <xref linkend="SECThowoptused"/>
32887 below) are not relevant here. The order of these hosts is determined by the
32888 preference values in the MX records, according to the usual rules. Because
32889 randomizing happens before the MX lookup, it does not affect the order that is
32890 defined by MX preferences.
32891 </para>
32892 <para>
32893 If the local host is present in the sublist obtained from MX records, but is
32894 not the most preferred host in that list, it and any equally or less
32895 preferred hosts are removed before the sublist is inserted into the main list.
32896 </para>
32897 <para>
32898 If the local host is the most preferred host in the MX list, what happens
32899 depends on where in the original list of hosts the <literal>/MX</literal> item appears. If it
32900 is not the first item (that is, there are previous hosts in the main list),
32901 Exim discards this name and any subsequent items in the main list.
32902 </para>
32903 <para>
32904 If the MX item is first in the list of hosts, and the local host is the
32905 most preferred host, what happens is controlled by the <option>self</option> option of the
32906 router.
32907 </para>
32908 <para>
32909 DNS failures when lookup up the MX records are treated in the same way as DNS
32910 failures when looking up IP addresses: <option>pass_on_timeout</option> and
32911 <option>host_find_failed</option> are used when relevant.
32912 </para>
32913 <para>
32914 The generic <option>ignore_target_hosts</option> option applies to all hosts in the list,
32915 whether obtained from an MX lookup or not.
32916 </para>
32917 </section>
32918 <section id="SECThowoptused">
32919 <title>How the options are used</title>
32920 <para>
32921 The options are a sequence of words; in practice no more than three are ever
32922 present. One of the words can be the name of a transport; this overrides the
32923 <option>transport</option> option on the router for this particular routing rule only. The
32924 other words (if present) control randomization of the list of hosts on a
32925 per-rule basis, and how the IP addresses of the hosts are to be found when
32926 routing to a remote transport. These options are as follows:
32927 </para>
32928 <itemizedlist>
32929 <listitem>
32930 <para>
32931 <option>randomize</option>: randomize the order of the hosts in this list, overriding the
32932 setting of <option>hosts_randomize</option> for this routing rule only.
32933 </para>
32934 </listitem>
32935 <listitem>
32936 <para>
32937 <option>no_randomize</option>: do not randomize the order of the hosts in this list,
32938 overriding the setting of <option>hosts_randomize</option> for this routing rule only.
32939 </para>
32940 </listitem>
32941 <listitem>
32942 <para>
32943 <option>byname</option>: use <function>getipnodebyname()</function> (<function>gethostbyname()</function> on older systems) to
32944 find IP addresses. This function may ultimately cause a DNS lookup, but it may
32945 also look in <filename>/etc/hosts</filename> or other sources of information.
32946 </para>
32947 </listitem>
32948 <listitem>
32949 <para>
32950 <option>bydns</option>: look up address records for the hosts directly in the DNS; fail if
32951 no address records are found. If there is a temporary DNS error (such as a
32952 timeout), delivery is deferred.
32953 </para>
32954 </listitem>
32955 </itemizedlist>
32956 <para>
32957 For example:
32958 </para>
32959 <literallayout class="monospaced">
32960 route_list = domain1  host1:host2:host3  randomize bydns;\
32961              domain2  host4:host5
32962 </literallayout>
32963 <para>
32964 If neither <option>byname</option> nor <option>bydns</option> is given, Exim behaves as follows: First, a
32965 DNS lookup is done. If this yields anything other than HOST_NOT_FOUND, that
32966 result is used. Otherwise, Exim goes on to try a call to <function>getipnodebyname()</function>
32967 or <function>gethostbyname()</function>, and the result of the lookup is the result of that
32968 call.
32969 </para>
32970 <para>
32971 <emphasis role="bold">Warning</emphasis>: It has been discovered that on some systems, if a DNS lookup
32972 called via <function>getipnodebyname()</function> times out, HOST_NOT_FOUND is returned
32973 instead of TRY_AGAIN. That is why the default action is to try a DNS
32974 lookup first. Only if that gives a definite <quote>no such host</quote> is the local
32975 function called.
32976 </para>
32977 <para>
32978 If no IP address for a host can be found, what happens is controlled by the
32979 <option>host_find_failed</option> option.
32980 </para>
32981 <para>
32982 <indexterm role="variable">
32983 <primary><varname>$host</varname></primary>
32984 </indexterm>
32985 When an address is routed to a local transport, IP addresses are not looked up.
32986 The host list is passed to the transport in the <varname>$host</varname> variable.
32987 </para>
32988 </section>
32989 <section id="SECID123">
32990 <title>Manualroute examples</title>
32991 <para>
32992 In some of the examples that follow, the presence of the <option>remote_smtp</option>
32993 transport, as defined in the default configuration file, is assumed:
32994 </para>
32995 <itemizedlist>
32996 <listitem>
32997 <para>
32998 <indexterm role="concept">
32999 <primary>smart host</primary>
33000 <secondary>example router</secondary>
33001 </indexterm>
33002 The <command>manualroute</command> router can be used to forward all external mail to a
33003 <emphasis>smart host</emphasis>. If you have set up, in the main part of the configuration, a
33004 named domain list that contains your local domains, for example:
33005 </para>
33006 <literallayout class="monospaced">
33007 domainlist local_domains = my.domain.example
33008 </literallayout>
33009 <para>
33010 You can arrange for all other domains to be routed to a smart host by making
33011 your first router something like this:
33012 </para>
33013 <literallayout class="monospaced">
33014 smart_route:
33015   driver = manualroute
33016   domains = !+local_domains
33017   transport = remote_smtp
33018   route_list = * smarthost.ref.example
33019 </literallayout>
33020 <para>
33021 This causes all non-local addresses to be sent to the single host
33022 <emphasis>smarthost.ref.example</emphasis>. If a colon-separated list of smart hosts is given,
33023 they are tried in order
33024 (but you can use <option>hosts_randomize</option> to vary the order each time).
33025 Another way of configuring the same thing is this:
33026 </para>
33027 <literallayout class="monospaced">
33028 smart_route:
33029   driver = manualroute
33030   transport = remote_smtp
33031   route_list = !+local_domains  smarthost.ref.example
33032 </literallayout>
33033 <para>
33034 There is no difference in behaviour between these two routers as they stand.
33035 However, they behave differently if <option>no_more</option> is added to them. In the first
33036 example, the router is skipped if the domain does not match the <option>domains</option>
33037 precondition; the following router is always tried. If the router runs, it
33038 always matches the domain and so can never decline. Therefore, <option>no_more</option>
33039 would have no effect. In the second case, the router is never skipped; it
33040 always runs. However, if it doesn&#x2019;t match the domain, it declines. In this case
33041 <option>no_more</option> would prevent subsequent routers from running.
33042 </para>
33043 </listitem>
33044 <listitem>
33045 <para>
33046 <indexterm role="concept">
33047 <primary>mail hub example</primary>
33048 </indexterm>
33049 A <emphasis>mail hub</emphasis> is a host which receives mail for a number of domains via MX
33050 records in the DNS and delivers it via its own private routing mechanism. Often
33051 the final destinations are behind a firewall, with the mail hub being the one
33052 machine that can connect to machines both inside and outside the firewall. The
33053 <command>manualroute</command> router is usually used on a mail hub to route incoming messages
33054 to the correct hosts. For a small number of domains, the routing can be inline,
33055 using the <option>route_list</option> option, but for a larger number a file or database
33056 lookup is easier to manage.
33057 </para>
33058 <para>
33059 If the domain names are in fact the names of the machines to which the mail is
33060 to be sent by the mail hub, the configuration can be quite simple. For
33061 example:
33062 </para>
33063 <literallayout class="monospaced">
33064 hub_route:
33065   driver = manualroute
33066   transport = remote_smtp
33067   route_list = *.rhodes.tvs.example  $domain
33068 </literallayout>
33069 <para>
33070 This configuration routes domains that match <literal>*.rhodes.tvs.example</literal> to hosts
33071 whose names are the same as the mail domains. A similar approach can be taken
33072 if the host name can be obtained from the domain name by a string manipulation
33073 that the expansion facilities can handle. Otherwise, a lookup based on the
33074 domain can be used to find the host:
33075 </para>
33076 <literallayout class="monospaced">
33077 through_firewall:
33078   driver = manualroute
33079   transport = remote_smtp
33080   route_data = ${lookup {$domain} cdb {/internal/host/routes}}
33081 </literallayout>
33082 <para>
33083 The result of the lookup must be the name or IP address of the host (or
33084 hosts) to which the address is to be routed. If the lookup fails, the route
33085 data is empty, causing the router to decline. The address then passes to the
33086 next router.
33087 </para>
33088 </listitem>
33089 <listitem>
33090 <para>
33091 <indexterm role="concept">
33092 <primary>batched SMTP output example</primary>
33093 </indexterm>
33094 <indexterm role="concept">
33095 <primary>SMTP</primary>
33096 <secondary>batched outgoing; example</secondary>
33097 </indexterm>
33098 You can use <command>manualroute</command> to deliver messages to pipes or files in batched
33099 SMTP format for onward transportation by some other means. This is one way of
33100 storing mail for a dial-up host when it is not connected. The route list entry
33101 can be as simple as a single domain name in a configuration like this:
33102 </para>
33103 <literallayout class="monospaced">
33104 save_in_file:
33105   driver = manualroute
33106   transport = batchsmtp_appendfile
33107   route_list = saved.domain.example
33108 </literallayout>
33109 <para>
33110 though often a pattern is used to pick up more than one domain. If there are
33111 several domains or groups of domains with different transport requirements,
33112 different transports can be listed in the routing information:
33113 </para>
33114 <literallayout class="monospaced">
33115 save_in_file:
33116   driver = manualroute
33117   route_list = \
33118     *.saved.domain1.example  $domain  batch_appendfile; \
33119     *.saved.domain2.example  \
33120       ${lookup{$domain}dbm{/domain2/hosts}{$value}fail} \
33121       batch_pipe
33122 </literallayout>
33123 <para>
33124 <indexterm role="variable">
33125 <primary><varname>$domain</varname></primary>
33126 </indexterm>
33127 <indexterm role="variable">
33128 <primary><varname>$host</varname></primary>
33129 </indexterm>
33130 The first of these just passes the domain in the <varname>$host</varname> variable, which
33131 doesn&#x2019;t achieve much (since it is also in <varname>$domain</varname>), but the second does a
33132 file lookup to find a value to pass, causing the router to decline to handle
33133 the address if the lookup fails.
33134 </para>
33135 </listitem>
33136 <listitem>
33137 <para>
33138 <indexterm role="concept">
33139 <primary>UUCP</primary>
33140 <secondary>example of router for</secondary>
33141 </indexterm>
33142 Routing mail directly to UUCP software is a specific case of the use of
33143 <command>manualroute</command> in a gateway to another mail environment. This is an example of
33144 one way it can be done:
33145 </para>
33146 <literallayout class="monospaced">
33147 # Transport
33148 uucp:
33149   driver = pipe
33150   user = nobody
33151   command = /usr/local/bin/uux -r - \
33152     ${substr_-5:$host}!rmail ${local_part}
33153   return_fail_output = true
33154
33155 # Router
33156 uucphost:
33157   transport = uucp
33158   driver = manualroute
33159   route_data = \
33160     ${lookup{$domain}lsearch{/usr/local/exim/uucphosts}}
33161 </literallayout>
33162 <para>
33163 The file <filename>/usr/local/exim/uucphosts</filename> contains entries like
33164 </para>
33165 <literallayout class="monospaced">
33166 darksite.ethereal.example:           darksite.UUCP
33167 </literallayout>
33168 <para>
33169 It can be set up more simply without adding and removing <quote>.UUCP</quote> but this way
33170 makes clear the distinction between the domain name
33171 <emphasis>darksite.ethereal.example</emphasis> and the UUCP host name <emphasis>darksite</emphasis>.
33172 </para>
33173 </listitem>
33174 </itemizedlist>
33175 <para>
33176 <indexterm role="concept" startref="IIDmanrou1" class="endofrange"/>
33177 <indexterm role="concept" startref="IIDmanrou2" class="endofrange"/>
33178 </para>
33179 </section>
33180 </chapter>
33181
33182 <chapter id="CHAPdriverlast">
33183 <title>The queryprogram router</title>
33184 <para>
33185 <indexterm role="concept" id="IIDquerou1" class="startofrange">
33186 <primary><command>queryprogram</command> router</primary>
33187 </indexterm>
33188 <indexterm role="concept" id="IIDquerou2" class="startofrange">
33189 <primary>routers</primary>
33190 <secondary><command>queryprogram</command></secondary>
33191 </indexterm>
33192 <indexterm role="concept">
33193 <primary>routing</primary>
33194 <secondary>by external program</secondary>
33195 </indexterm>
33196 The <command>queryprogram</command> router routes an address by running an external command
33197 and acting on its output. This is an expensive way to route, and is intended
33198 mainly for use in lightly-loaded systems, or for performing experiments.
33199 However, if it is possible to use the precondition options (<option>domains</option>,
33200 <option>local_parts</option>, etc) to skip this router for most addresses, it could sensibly
33201 be used in special cases, even on a busy host. There are the following private
33202 options:
33203 <indexterm role="concept">
33204 <primary>options</primary>
33205 <secondary><command>queryprogram</command> router</secondary>
33206 </indexterm>
33207 </para>
33208 <para>
33209 <indexterm role="option">
33210 <primary><option>command</option></primary>
33211 </indexterm>
33212 </para>
33213 <informaltable frame="all">
33214 <tgroup cols="4" colsep="0" rowsep="0">
33215 <colspec colwidth="8*" align="left"/>
33216 <colspec colwidth="6*" align="center"/>
33217 <colspec colwidth="6*" align="center"/>
33218 <colspec colwidth="6*" align="right"/>
33219 <tbody>
33220 <row>
33221 <entry><option>command</option></entry>
33222 <entry>Use: <emphasis>queryprogram</emphasis></entry>
33223 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33224 <entry>Default: <emphasis>unset</emphasis></entry>
33225 </row>
33226 </tbody>
33227 </tgroup>
33228 </informaltable>
33229 <para>
33230 This option must be set. It specifies the command that is to be run. The
33231 command is split up into a command name and arguments, and then each is
33232 expanded separately (exactly as for a <command>pipe</command> transport, described in chapter
33233 <xref linkend="CHAPpipetransport"/>).
33234 </para>
33235 <para>
33236 <indexterm role="option">
33237 <primary><option>command_group</option></primary>
33238 </indexterm>
33239 </para>
33240 <informaltable frame="all">
33241 <tgroup cols="4" colsep="0" rowsep="0">
33242 <colspec colwidth="8*" align="left"/>
33243 <colspec colwidth="6*" align="center"/>
33244 <colspec colwidth="6*" align="center"/>
33245 <colspec colwidth="6*" align="right"/>
33246 <tbody>
33247 <row>
33248 <entry><option>command_group</option></entry>
33249 <entry>Use: <emphasis>queryprogram</emphasis></entry>
33250 <entry>Type: <emphasis>string</emphasis></entry>
33251 <entry>Default: <emphasis>unset</emphasis></entry>
33252 </row>
33253 </tbody>
33254 </tgroup>
33255 </informaltable>
33256 <para>
33257 <indexterm role="concept">
33258 <primary>gid (group id)</primary>
33259 <secondary>in <command>queryprogram</command> router</secondary>
33260 </indexterm>
33261 This option specifies a gid to be set when running the command while routing an
33262 address for deliver. It must be set if <option>command_user</option> specifies a numerical
33263 uid. If it begins with a digit, it is interpreted as the numerical value of the
33264 gid. Otherwise it is looked up using <function>getgrnam()</function>.
33265 </para>
33266 <para>
33267 <indexterm role="option">
33268 <primary><option>command_user</option></primary>
33269 </indexterm>
33270 </para>
33271 <informaltable frame="all">
33272 <tgroup cols="4" colsep="0" rowsep="0">
33273 <colspec colwidth="8*" align="left"/>
33274 <colspec colwidth="6*" align="center"/>
33275 <colspec colwidth="6*" align="center"/>
33276 <colspec colwidth="6*" align="right"/>
33277 <tbody>
33278 <row>
33279 <entry><option>command_user</option></entry>
33280 <entry>Use: <emphasis>queryprogram</emphasis></entry>
33281 <entry>Type: <emphasis>string</emphasis></entry>
33282 <entry>Default: <emphasis>unset</emphasis></entry>
33283 </row>
33284 </tbody>
33285 </tgroup>
33286 </informaltable>
33287 <para>
33288 <indexterm role="concept">
33289 <primary>uid (user id)</primary>
33290 <secondary>for <command>queryprogram</command></secondary>
33291 </indexterm>
33292 This option must be set. It specifies the uid which is set when running the
33293 command while routing an address for delivery. If the value begins with a digit,
33294 it is interpreted as the numerical value of the uid. Otherwise, it is looked up
33295 using <function>getpwnam()</function> to obtain a value for the uid and, if <option>command_group</option> is
33296 not set, a value for the gid also.
33297 </para>
33298 <para>
33299 <emphasis role="bold">Warning:</emphasis> Changing uid and gid is possible only when Exim is running as
33300 root, which it does during a normal delivery in a conventional configuration.
33301 However, when an address is being verified during message reception, Exim is
33302 usually running as the Exim user, not as root. If the <command>queryprogram</command> router
33303 is called from a non-root process, Exim cannot change uid or gid before running
33304 the command. In this circumstance the command runs under the current uid and
33305 gid.
33306 </para>
33307 <para>
33308 <indexterm role="option">
33309 <primary><option>current_directory</option></primary>
33310 </indexterm>
33311 </para>
33312 <informaltable frame="all">
33313 <tgroup cols="4" colsep="0" rowsep="0">
33314 <colspec colwidth="8*" align="left"/>
33315 <colspec colwidth="6*" align="center"/>
33316 <colspec colwidth="6*" align="center"/>
33317 <colspec colwidth="6*" align="right"/>
33318 <tbody>
33319 <row>
33320 <entry><option>current_directory</option></entry>
33321 <entry>Use: <emphasis>queryprogram</emphasis></entry>
33322 <entry>Type: <emphasis>string</emphasis></entry>
33323 <entry>Default: <emphasis>/</emphasis></entry>
33324 </row>
33325 </tbody>
33326 </tgroup>
33327 </informaltable>
33328 <para>
33329 This option specifies an absolute path which is made the current directory
33330 before running the command.
33331 </para>
33332 <para>
33333 <indexterm role="option">
33334 <primary><option>timeout</option></primary>
33335 </indexterm>
33336 </para>
33337 <informaltable frame="all">
33338 <tgroup cols="4" colsep="0" rowsep="0">
33339 <colspec colwidth="8*" align="left"/>
33340 <colspec colwidth="6*" align="center"/>
33341 <colspec colwidth="6*" align="center"/>
33342 <colspec colwidth="6*" align="right"/>
33343 <tbody>
33344 <row>
33345 <entry><option>timeout</option></entry>
33346 <entry>Use: <emphasis>queryprogram</emphasis></entry>
33347 <entry>Type: <emphasis>time</emphasis></entry>
33348 <entry>Default: <emphasis>1h</emphasis></entry>
33349 </row>
33350 </tbody>
33351 </tgroup>
33352 </informaltable>
33353 <para>
33354 If the command does not complete within the timeout period, its process group
33355 is killed and the message is frozen. A value of zero time specifies no
33356 timeout.
33357 </para>
33358 <para>
33359 The standard output of the command is connected to a pipe, which is read when
33360 the command terminates. It should consist of a single line of output,
33361 containing up to five fields, separated by white space. The maximum length of
33362 the line is 1023 characters. Longer lines are silently truncated. The first
33363 field is one of the following words (case-insensitive):
33364 </para>
33365 <itemizedlist>
33366 <listitem>
33367 <para>
33368 <emphasis>Accept</emphasis>: routing succeeded; the remaining fields specify what to do (see
33369 below).
33370 </para>
33371 </listitem>
33372 <listitem>
33373 <para>
33374 <emphasis>Decline</emphasis>: the router declines; pass the address to the next router, unless
33375 <option>no_more</option> is set.
33376 </para>
33377 </listitem>
33378 <listitem>
33379 <para>
33380 <emphasis>Fail</emphasis>: routing failed; do not pass the address to any more routers. Any
33381 subsequent text on the line is an error message. If the router is run as part
33382 of address verification during an incoming SMTP message, the message is
33383 included in the SMTP response.
33384 </para>
33385 </listitem>
33386 <listitem>
33387 <para>
33388 <emphasis>Defer</emphasis>: routing could not be completed at this time; try again later. Any
33389 subsequent text on the line is an error message which is logged. It is not
33390 included in any SMTP response.
33391 </para>
33392 </listitem>
33393 <listitem>
33394 <para>
33395 <emphasis>Freeze</emphasis>: the same as <emphasis>defer</emphasis>, except that the message is frozen.
33396 </para>
33397 </listitem>
33398 <listitem>
33399 <para>
33400 <emphasis>Pass</emphasis>: pass the address to the next router (or the router specified by
33401 <option>pass_router</option>), overriding <option>no_more</option>.
33402 </para>
33403 </listitem>
33404 <listitem>
33405 <para>
33406 <emphasis>Redirect</emphasis>: the message is redirected. The remainder of the line is a list of
33407 new addresses, which are routed independently, starting with the first router,
33408 or the router specified by <option>redirect_router</option>, if set.
33409 </para>
33410 </listitem>
33411 </itemizedlist>
33412 <para>
33413 When the first word is <emphasis>accept</emphasis>, the remainder of the line consists of a
33414 number of keyed data values, as follows (split into two lines here, to fit on
33415 the page):
33416 </para>
33417 <literallayout class="monospaced">
33418 ACCEPT TRANSPORT=&lt;transport&gt; HOSTS=&lt;list of hosts&gt;
33419 LOOKUP=byname|bydns DATA=&lt;text&gt;
33420 </literallayout>
33421 <para>
33422 The data items can be given in any order, and all are optional. If no transport
33423 is included, the transport specified by the generic <option>transport</option> option is
33424 used. The list of hosts and the lookup type are needed only if the transport is
33425 an <command>smtp</command> transport that does not itself supply a list of hosts.
33426 </para>
33427 <para>
33428 The format of the list of hosts is the same as for the <command>manualroute</command> router.
33429 As well as host names and IP addresses with optional port numbers, as described
33430 in section <xref linkend="SECTformatonehostitem"/>, it may contain names followed by
33431 <literal>/MX</literal> to specify sublists of hosts that are obtained by looking up MX records
33432 (see section <xref linkend="SECThostshowused"/>).
33433 </para>
33434 <para>
33435 If the lookup type is not specified, Exim behaves as follows when trying to
33436 find an IP address for each host: First, a DNS lookup is done. If this yields
33437 anything other than HOST_NOT_FOUND, that result is used. Otherwise, Exim
33438 goes on to try a call to <function>getipnodebyname()</function> or <function>gethostbyname()</function>, and the
33439 result of the lookup is the result of that call.
33440 </para>
33441 <para>
33442 <indexterm role="variable">
33443 <primary><varname>$address_data</varname></primary>
33444 </indexterm>
33445 If the DATA field is set, its value is placed in the <varname>$address_data</varname>
33446 variable. For example, this return line
33447 </para>
33448 <literallayout class="monospaced">
33449 accept hosts=x1.y.example:x2.y.example data="rule1"
33450 </literallayout>
33451 <para>
33452 routes the address to the default transport, passing a list of two hosts. When
33453 the transport runs, the string <quote>rule1</quote> is in <varname>$address_data</varname>.
33454 <indexterm role="concept" startref="IIDquerou1" class="endofrange"/>
33455 <indexterm role="concept" startref="IIDquerou2" class="endofrange"/>
33456 </para>
33457 </chapter>
33458
33459 <chapter id="CHAPredirect">
33460 <title>The redirect router</title>
33461 <para>
33462 <indexterm role="concept" id="IIDredrou1" class="startofrange">
33463 <primary><command>redirect</command> router</primary>
33464 </indexterm>
33465 <indexterm role="concept" id="IIDredrou2" class="startofrange">
33466 <primary>routers</primary>
33467 <secondary><command>redirect</command></secondary>
33468 </indexterm>
33469 <indexterm role="concept">
33470 <primary>alias file</primary>
33471 <secondary>in a <command>redirect</command> router</secondary>
33472 </indexterm>
33473 <indexterm role="concept">
33474 <primary>address redirection</primary>
33475 <secondary><command>redirect</command> router</secondary>
33476 </indexterm>
33477 The <command>redirect</command> router handles several kinds of address redirection. Its most
33478 common uses are for resolving local part aliases from a central alias file
33479 (usually called <filename>/etc/aliases</filename>) and for handling users&#x2019; personal <filename>.forward</filename>
33480 files, but it has many other potential uses. The incoming address can be
33481 redirected in several different ways:
33482 </para>
33483 <itemizedlist>
33484 <listitem>
33485 <para>
33486 It can be replaced by one or more new addresses which are themselves routed
33487 independently.
33488 </para>
33489 </listitem>
33490 <listitem>
33491 <para>
33492 It can be routed to be delivered to a given file or directory.
33493 </para>
33494 </listitem>
33495 <listitem>
33496 <para>
33497 It can be routed to be delivered to a specified pipe command.
33498 </para>
33499 </listitem>
33500 <listitem>
33501 <para>
33502 It can cause an automatic reply to be generated.
33503 </para>
33504 </listitem>
33505 <listitem>
33506 <para>
33507 It can be forced to fail, optionally with a custom error message.
33508 </para>
33509 </listitem>
33510 <listitem>
33511 <para>
33512 It can be temporarily deferred, optionally with a custom message.
33513 </para>
33514 </listitem>
33515 <listitem>
33516 <para>
33517 It can be discarded.
33518 </para>
33519 </listitem>
33520 </itemizedlist>
33521 <para>
33522 The generic <option>transport</option> option must not be set for <command>redirect</command> routers.
33523 However, there are some private options which define transports for delivery to
33524 files and pipes, and for generating autoreplies. See the <option>file_transport</option>,
33525 <option>pipe_transport</option> and <option>reply_transport</option> descriptions below.
33526 </para>
33527 <section id="SECID124">
33528 <title>Redirection data</title>
33529 <para>
33530 The router operates by interpreting a text string which it obtains either by
33531 expanding the contents of the <option>data</option> option, or by reading the entire
33532 contents of a file whose name is given in the <option>file</option> option. These two
33533 options are mutually exclusive. The first is commonly used for handling system
33534 aliases, in a configuration like this:
33535 </para>
33536 <literallayout class="monospaced">
33537 system_aliases:
33538   driver = redirect
33539   data = ${lookup{$local_part}lsearch{/etc/aliases}}
33540 </literallayout>
33541 <para>
33542 If the lookup fails, the expanded string in this example is empty. When the
33543 expansion of <option>data</option> results in an empty string, the router declines. A forced
33544 expansion failure also causes the router to decline; other expansion failures
33545 cause delivery to be deferred.
33546 </para>
33547 <para>
33548 A configuration using <option>file</option> is commonly used for handling users&#x2019;
33549 <filename>.forward</filename> files, like this:
33550 </para>
33551 <literallayout class="monospaced">
33552 userforward:
33553   driver = redirect
33554   check_local_user
33555   file = $home/.forward
33556   no_verify
33557 </literallayout>
33558 <para>
33559 If the file does not exist, or causes no action to be taken (for example, it is
33560 empty or consists only of comments), the router declines. <emphasis role="bold">Warning</emphasis>: This
33561 is not the case when the file contains syntactically valid items that happen to
33562 yield empty addresses, for example, items containing only RFC 2822 address
33563 comments.
33564 </para>
33565 </section>
33566 <section id="SECID125">
33567 <title>Forward files and address verification</title>
33568 <para>
33569 <indexterm role="concept">
33570 <primary>address redirection</primary>
33571 <secondary>while verifying</secondary>
33572 </indexterm>
33573 It is usual to set <option>no_verify</option> on <command>redirect</command> routers which handle users&#x2019;
33574 <filename>.forward</filename> files, as in the example above. There are two reasons for this:
33575 </para>
33576 <itemizedlist>
33577 <listitem>
33578 <para>
33579 When Exim is receiving an incoming SMTP message from a remote host, it is
33580 running under the Exim uid, not as root. Exim is unable to change uid to read
33581 the file as the user, and it may not be able to read it as the Exim user. So in
33582 practice the router may not be able to operate.
33583 </para>
33584 </listitem>
33585 <listitem>
33586 <para>
33587 However, even when the router can operate, the existence of a <filename>.forward</filename> file
33588 is unimportant when verifying an address. What should be checked is whether the
33589 local part is a valid user name or not. Cutting out the redirection processing
33590 saves some resources.
33591 </para>
33592 </listitem>
33593 </itemizedlist>
33594 </section>
33595 <section id="SECID126">
33596 <title>Interpreting redirection data</title>
33597 <para>
33598 <indexterm role="concept">
33599 <primary>Sieve filter</primary>
33600 <secondary>specifying in redirection data</secondary>
33601 </indexterm>
33602 <indexterm role="concept">
33603 <primary>filter</primary>
33604 <secondary>specifying in redirection data</secondary>
33605 </indexterm>
33606 The contents of the data string, whether obtained from <option>data</option> or <option>file</option>,
33607 can be interpreted in two different ways:
33608 </para>
33609 <itemizedlist>
33610 <listitem>
33611 <para>
33612 If the <option>allow_filter</option> option is set true, and the data begins with the text
33613 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote>, it is interpreted as a list of
33614 <emphasis>filtering</emphasis> instructions in the form of an Exim or Sieve filter file,
33615 respectively. Details of the syntax and semantics of filter files are described
33616 in a separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>; this
33617 document is intended for use by end users.
33618 </para>
33619 </listitem>
33620 <listitem>
33621 <para>
33622 Otherwise, the data must be a comma-separated list of redirection items, as
33623 described in the next section.
33624 </para>
33625 </listitem>
33626 </itemizedlist>
33627 <para>
33628 When a message is redirected to a file (a <quote>mail folder</quote>), the file name given
33629 in a non-filter redirection list must always be an absolute path. A filter may
33630 generate a relative path &ndash; how this is handled depends on the transport&#x2019;s
33631 configuration. See section <xref linkend="SECTfildiropt"/> for a discussion of this issue
33632 for the <command>appendfile</command> transport.
33633 </para>
33634 </section>
33635 <section id="SECTitenonfilred">
33636 <title>Items in a non-filter redirection list</title>
33637 <para>
33638 <indexterm role="concept">
33639 <primary>address redirection</primary>
33640 <secondary>non-filter list items</secondary>
33641 </indexterm>
33642 When the redirection data is not an Exim or Sieve filter, for example, if it
33643 comes from a conventional alias or forward file, it consists of a list of
33644 addresses, file names, pipe commands, or certain special items (see section
33645 <xref linkend="SECTspecitredli"/> below). The special items can be individually enabled or
33646 disabled by means of options whose names begin with <option>allow_</option> or <option>forbid_</option>,
33647 depending on their default values. The items in the list are separated by
33648 commas or newlines.
33649 If a comma is required in an item, the entire item must be enclosed in double
33650 quotes.
33651 </para>
33652 <para>
33653 Lines starting with a # character are comments, and are ignored, and # may
33654 also appear following a comma, in which case everything between the # and the
33655 next newline character is ignored.
33656 </para>
33657 <para>
33658 If an item is entirely enclosed in double quotes, these are removed. Otherwise
33659 double quotes are retained because some forms of mail address require their use
33660 (but never to enclose the entire address). In the following description,
33661 <quote>item</quote> refers to what remains after any surrounding double quotes have been
33662 removed.
33663 </para>
33664 <para>
33665 <indexterm role="variable">
33666 <primary><varname>$local_part</varname></primary>
33667 </indexterm>
33668 <emphasis role="bold">Warning</emphasis>: If you use an Exim expansion to construct a redirection address,
33669 and the expansion contains a reference to <varname>$local_part</varname>, you should make use
33670 of the <option>quote_local_part</option> expansion operator, in case the local part contains
33671 special characters. For example, to redirect all mail for the domain
33672 <emphasis>obsolete.example</emphasis>, retaining the existing local part, you could use this
33673 setting:
33674 </para>
33675 <literallayout class="monospaced">
33676 data = ${quote_local_part:$local_part}@newdomain.example
33677 </literallayout>
33678 </section>
33679 <section id="SECTredlocmai">
33680 <title>Redirecting to a local mailbox</title>
33681 <para>
33682 <indexterm role="concept">
33683 <primary>routing</primary>
33684 <secondary>loops in</secondary>
33685 </indexterm>
33686 <indexterm role="concept">
33687 <primary>loop</primary>
33688 <secondary>while routing, avoidance of</secondary>
33689 </indexterm>
33690 <indexterm role="concept">
33691 <primary>address redirection</primary>
33692 <secondary>to local mailbox</secondary>
33693 </indexterm>
33694 A redirection item may safely be the same as the address currently under
33695 consideration. This does not cause a routing loop, because a router is
33696 automatically skipped if any ancestor of the address that is being processed
33697 is the same as the current address and was processed by the current router.
33698 Such an address is therefore passed to the following routers, so it is handled
33699 as if there were no redirection. When making this loop-avoidance test, the
33700 complete local part, including any prefix or suffix, is used.
33701 </para>
33702 <para>
33703 <indexterm role="concept">
33704 <primary>address redirection</primary>
33705 <secondary>local part without domain</secondary>
33706 </indexterm>
33707 Specifying the same local part without a domain is a common usage in personal
33708 filter files when the user wants to have messages delivered to the local
33709 mailbox and also forwarded elsewhere. For example, the user whose login is
33710 <emphasis>cleo</emphasis> might have a <filename>.forward</filename> file containing this:
33711 </para>
33712 <literallayout class="monospaced">
33713 cleo, cleopatra@egypt.example
33714 </literallayout>
33715 <para>
33716 <indexterm role="concept">
33717 <primary>backslash in alias file</primary>
33718 </indexterm>
33719 <indexterm role="concept">
33720 <primary>alias file</primary>
33721 <secondary>backslash in</secondary>
33722 </indexterm>
33723 For compatibility with other MTAs, such unqualified local parts may be
33724 preceded by <quote>\</quote>, but this is not a requirement for loop prevention. However,
33725 it does make a difference if more than one domain is being handled
33726 synonymously.
33727 </para>
33728 <para>
33729 If an item begins with <quote>\</quote> and the rest of the item parses as a valid RFC
33730 2822 address that does not include a domain, the item is qualified using the
33731 domain of the incoming address. In the absence of a leading <quote>\</quote>, unqualified
33732 addresses are qualified using the value in <option>qualify_recipient</option>, but you can
33733 force the incoming domain to be used by setting <option>qualify_preserve_domain</option>.
33734 </para>
33735 <para>
33736 Care must be taken if there are alias names for local users.
33737 Consider an MTA handling a single local domain where the system alias file
33738 contains:
33739 </para>
33740 <literallayout class="monospaced">
33741 Sam.Reman: spqr
33742 </literallayout>
33743 <para>
33744 Now suppose that Sam (whose login id is <emphasis>spqr</emphasis>) wants to save copies of
33745 messages in the local mailbox, and also forward copies elsewhere. He creates
33746 this forward file:
33747 </para>
33748 <literallayout class="monospaced">
33749 Sam.Reman, spqr@reme.elsewhere.example
33750 </literallayout>
33751 <para>
33752 With these settings, an incoming message addressed to <emphasis>Sam.Reman</emphasis> fails. The
33753 <command>redirect</command> router for system aliases does not process <emphasis>Sam.Reman</emphasis> the
33754 second time round, because it has previously routed it,
33755 and the following routers presumably cannot handle the alias. The forward file
33756 should really contain
33757 </para>
33758 <literallayout class="monospaced">
33759 spqr, spqr@reme.elsewhere.example
33760 </literallayout>
33761 <para>
33762 but because this is such a common error, the <option>check_ancestor</option> option (see
33763 below) exists to provide a way to get round it. This is normally set on a
33764 <command>redirect</command> router that is handling users&#x2019; <filename>.forward</filename> files.
33765 </para>
33766 </section>
33767 <section id="SECTspecitredli">
33768 <title>Special items in redirection lists</title>
33769 <para>
33770 In addition to addresses, the following types of item may appear in redirection
33771 lists (that is, in non-filter redirection data):
33772 </para>
33773 <itemizedlist>
33774 <listitem>
33775 <para>
33776 <indexterm role="concept">
33777 <primary>pipe</primary>
33778 <secondary>in redirection list</secondary>
33779 </indexterm>
33780 <indexterm role="concept">
33781 <primary>address redirection</primary>
33782 <secondary>to pipe</secondary>
33783 </indexterm>
33784 An item is treated as a pipe command if it begins with <quote>|</quote> and does not parse
33785 as a valid RFC 2822 address that includes a domain. A transport for running the
33786 command must be specified by the <option>pipe_transport</option> option.
33787 Normally, either the router or the transport specifies a user and a group under
33788 which to run the delivery. The default is to use the Exim user and group.
33789 </para>
33790 <para>
33791 Single or double quotes can be used for enclosing the individual arguments of
33792 the pipe command; no interpretation of escapes is done for single quotes. If
33793 the command contains a comma character, it is necessary to put the whole item
33794 in double quotes, for example:
33795 </para>
33796 <literallayout class="monospaced">
33797 "|/some/command ready,steady,go"
33798 </literallayout>
33799 <para>
33800 since items in redirection lists are terminated by commas. Do not, however,
33801 quote just the command. An item such as
33802 </para>
33803 <literallayout class="monospaced">
33804 |"/some/command ready,steady,go"
33805 </literallayout>
33806 <para>
33807 is interpreted as a pipe with a rather strange command name, and no arguments.
33808 </para>
33809 </listitem>
33810 <listitem>
33811 <para>
33812 <indexterm role="concept">
33813 <primary>file</primary>
33814 <secondary>in redirection list</secondary>
33815 </indexterm>
33816 <indexterm role="concept">
33817 <primary>address redirection</primary>
33818 <secondary>to file</secondary>
33819 </indexterm>
33820 An item is interpreted as a path name if it begins with <quote>/</quote> and does not
33821 parse as a valid RFC 2822 address that includes a domain. For example,
33822 </para>
33823 <literallayout class="monospaced">
33824 /home/world/minbari
33825 </literallayout>
33826 <para>
33827 is treated as a file name, but
33828 </para>
33829 <literallayout class="monospaced">
33830 /s=molari/o=babylon/@x400gate.way
33831 </literallayout>
33832 <para>
33833 is treated as an address. For a file name, a transport must be specified using
33834 the <option>file_transport</option> option. However, if the generated path name ends with a
33835 forward slash character, it is interpreted as a directory name rather than a
33836 file name, and <option>directory_transport</option> is used instead.
33837 </para>
33838 <para>
33839 Normally, either the router or the transport specifies a user and a group under
33840 which to run the delivery. The default is to use the Exim user and group.
33841 </para>
33842 <para>
33843 <indexterm role="concept">
33844 <primary><filename>/dev/null</filename></primary>
33845 </indexterm>
33846 However, if a redirection item is the path <filename>/dev/null</filename>, delivery to it is
33847 bypassed at a high level, and the log entry shows <quote>**bypassed**</quote>
33848 instead of a transport name. In this case the user and group are not used.
33849 </para>
33850 </listitem>
33851 <listitem>
33852 <para>
33853 <indexterm role="concept">
33854 <primary>included address list</primary>
33855 </indexterm>
33856 <indexterm role="concept">
33857 <primary>address redirection</primary>
33858 <secondary>included external list</secondary>
33859 </indexterm>
33860 If an item is of the form
33861 </para>
33862 <literallayout class="monospaced">
33863 :include:&lt;path name&gt;
33864 </literallayout>
33865 <para>
33866 a list of further items is taken from the given file and included at that
33867 point. <emphasis role="bold">Note</emphasis>: Such a file can not be a filter file; it is just an
33868 out-of-line addition to the list. The items in the included list are separated
33869 by commas or newlines and are not subject to expansion. If this is the first
33870 item in an alias list in an <command>lsearch</command> file, a colon must be used to terminate
33871 the alias name. This example is incorrect:
33872 </para>
33873 <literallayout class="monospaced">
33874 list1    :include:/opt/lists/list1
33875 </literallayout>
33876 <para>
33877 It must be given as
33878 </para>
33879 <literallayout class="monospaced">
33880 list1:   :include:/opt/lists/list1
33881 </literallayout>
33882 </listitem>
33883 <listitem>
33884 <para>
33885 <indexterm role="concept">
33886 <primary>address redirection</primary>
33887 <secondary>to black hole</secondary>
33888 </indexterm>
33889 Sometimes you want to throw away mail to a particular local part. Making the
33890 <option>data</option> option expand to an empty string does not work, because that causes
33891 the router to decline. Instead, the alias item
33892 <indexterm role="concept">
33893 <primary>black hole</primary>
33894 </indexterm>
33895 <indexterm role="concept">
33896 <primary>abandoning mail</primary>
33897 </indexterm>
33898 <emphasis>:blackhole:</emphasis> can be used. It does what its name implies. No delivery is
33899 done, and no error message is generated. This has the same effect as specifing
33900 <filename>/dev/null</filename> as a destination, but it can be independently disabled.
33901 </para>
33902 <para>
33903 <emphasis role="bold">Warning</emphasis>: If <emphasis>:blackhole:</emphasis> appears anywhere in a redirection list, no
33904 delivery is done for the original local part, even if other redirection items
33905 are present. If you are generating a multi-item list (for example, by reading a
33906 database) and need the ability to provide a no-op item, you must use
33907 <filename>/dev/null</filename>.
33908 </para>
33909 </listitem>
33910 <listitem>
33911 <para>
33912 <indexterm role="concept">
33913 <primary>delivery</primary>
33914 <secondary>forcing failure</secondary>
33915 </indexterm>
33916 <indexterm role="concept">
33917 <primary>delivery</primary>
33918 <secondary>forcing deferral</secondary>
33919 </indexterm>
33920 <indexterm role="concept">
33921 <primary>failing delivery</primary>
33922 <secondary>forcing</secondary>
33923 </indexterm>
33924 <indexterm role="concept">
33925 <primary>deferred delivery, forcing</primary>
33926 </indexterm>
33927 <indexterm role="concept">
33928 <primary>customizing</primary>
33929 <secondary>failure message</secondary>
33930 </indexterm>
33931 An attempt to deliver a particular address can be deferred or forced to fail by
33932 redirection items of the form
33933 </para>
33934 <literallayout class="monospaced">
33935 :defer:
33936 :fail:
33937 </literallayout>
33938 <para>
33939 respectively. When a redirection list contains such an item, it applies
33940 to the entire redirection; any other items in the list are ignored. Any
33941 text following <emphasis>:fail:</emphasis> or <emphasis>:defer:</emphasis> is placed in the error text
33942 associated with the failure. For example, an alias file might contain:
33943 </para>
33944 <literallayout class="monospaced">
33945 X.Employee:  :fail: Gone away, no forwarding address
33946 </literallayout>
33947 <para>
33948 In the case of an address that is being verified from an ACL or as the subject
33949 of a
33950 <indexterm role="concept">
33951 <primary>VRFY</primary>
33952 <secondary>error text, display of</secondary>
33953 </indexterm>
33954 VRFY command, the text is included in the SMTP error response by
33955 default.
33956 <indexterm role="concept">
33957 <primary>EXPN</primary>
33958 <secondary>error text, display of</secondary>
33959 </indexterm>
33960 The text is not included in the response to an EXPN command. In non-SMTP cases
33961 the text is included in the error message that Exim generates.
33962 </para>
33963 <para>
33964 <indexterm role="concept">
33965 <primary>SMTP</primary>
33966 <secondary>error codes</secondary>
33967 </indexterm>
33968 By default, Exim sends a 451 SMTP code for a <emphasis>:defer:</emphasis>, and 550 for
33969 <emphasis>:fail:</emphasis>. However, if the message starts with three digits followed by a
33970 space, optionally followed by an extended code of the form <emphasis>n.n.n</emphasis>, also
33971 followed by a space, and the very first digit is the same as the default error
33972 code, the code from the message is used instead. If the very first digit is
33973 incorrect, a panic error is logged, and the default code is used. You can
33974 suppress the use of the supplied code in a redirect router by setting the
33975 <option>forbid_smtp_code</option> option true. In this case, any SMTP code is quietly
33976 ignored.
33977 </para>
33978 <para>
33979 <indexterm role="variable">
33980 <primary><varname>$acl_verify_message</varname></primary>
33981 </indexterm>
33982 In an ACL, an explicitly provided message overrides the default, but the
33983 default message is available in the variable <varname>$acl_verify_message</varname> and can
33984 therefore be included in a custom message if this is desired.
33985 </para>
33986 <para>
33987 Normally the error text is the rest of the redirection list &ndash; a comma does
33988 not terminate it &ndash; but a newline does act as a terminator. Newlines are not
33989 normally present in alias expansions. In <command>lsearch</command> lookups they are removed
33990 as part of the continuation process, but they may exist in other kinds of
33991 lookup and in <emphasis>:include:</emphasis> files.
33992 </para>
33993 <para>
33994 During routing for message delivery (as opposed to verification), a redirection
33995 containing <emphasis>:fail:</emphasis> causes an immediate failure of the incoming address,
33996 whereas <emphasis>:defer:</emphasis> causes the message to remain on the queue so that a
33997 subsequent delivery attempt can happen at a later time. If an address is
33998 deferred for too long, it will ultimately fail, because the normal retry
33999 rules still apply.
34000 </para>
34001 </listitem>
34002 <listitem>
34003 <para>
34004 <indexterm role="concept">
34005 <primary>alias file</primary>
34006 <secondary>exception to default</secondary>
34007 </indexterm>
34008 Sometimes it is useful to use a single-key search type with a default (see
34009 chapter <xref linkend="CHAPfdlookup"/>) to look up aliases. However, there may be a need
34010 for exceptions to the default. These can be handled by aliasing them to
34011 <emphasis>:unknown:</emphasis>. This differs from <emphasis>:fail:</emphasis> in that it causes the <command>redirect</command>
34012 router to decline, whereas <emphasis>:fail:</emphasis> forces routing to fail. A lookup which
34013 results in an empty redirection list has the same effect.
34014 </para>
34015 </listitem>
34016 </itemizedlist>
34017 </section>
34018 <section id="SECTdupaddr">
34019 <title>Duplicate addresses</title>
34020 <para>
34021 <indexterm role="concept">
34022 <primary>duplicate addresses</primary>
34023 </indexterm>
34024 <indexterm role="concept">
34025 <primary>address duplicate, discarding</primary>
34026 </indexterm>
34027 <indexterm role="concept">
34028 <primary>pipe</primary>
34029 <secondary>duplicated</secondary>
34030 </indexterm>
34031 Exim removes duplicate addresses from the list to which it is delivering, so as
34032 to deliver just one copy to each address. This does not apply to deliveries
34033 routed to pipes by different immediate parent addresses, but an indirect
34034 aliasing scheme of the type
34035 </para>
34036 <literallayout class="monospaced">
34037 pipe:       |/some/command $local_part
34038 localpart1: pipe
34039 localpart2: pipe
34040 </literallayout>
34041 <para>
34042 does not work with a message that is addressed to both local parts, because
34043 when the second is aliased to the intermediate local part <quote>pipe</quote> it gets
34044 discarded as being the same as a previously handled address. However, a scheme
34045 such as
34046 </para>
34047 <literallayout class="monospaced">
34048 localpart1: |/some/command $local_part
34049 localpart2: |/some/command $local_part
34050 </literallayout>
34051 <para>
34052 does result in two different pipe deliveries, because the immediate parents of
34053 the pipes are distinct.
34054 </para>
34055 </section>
34056 <section id="SECID128">
34057 <title>Repeated redirection expansion</title>
34058 <para>
34059 <indexterm role="concept">
34060 <primary>repeated redirection expansion</primary>
34061 </indexterm>
34062 <indexterm role="concept">
34063 <primary>address redirection</primary>
34064 <secondary>repeated for each delivery attempt</secondary>
34065 </indexterm>
34066 When a message cannot be delivered to all of its recipients immediately,
34067 leading to two or more delivery attempts, redirection expansion is carried out
34068 afresh each time for those addresses whose children were not all previously
34069 delivered. If redirection is being used as a mailing list, this can lead to new
34070 members of the list receiving copies of old messages. The <option>one_time</option> option
34071 can be used to avoid this.
34072 </para>
34073 </section>
34074 <section id="SECID129">
34075 <title>Errors in redirection lists</title>
34076 <para>
34077 <indexterm role="concept">
34078 <primary>address redirection</primary>
34079 <secondary>errors</secondary>
34080 </indexterm>
34081 If <option>skip_syntax_errors</option> is set, a malformed address that causes a parsing
34082 error is skipped, and an entry is written to the main log. This may be useful
34083 for mailing lists that are automatically managed. Otherwise, if an error is
34084 detected while generating the list of new addresses, the original address is
34085 deferred. See also <option>syntax_errors_to</option>.
34086 </para>
34087 </section>
34088 <section id="SECID130">
34089 <title>Private options for the redirect router</title>
34090 <para>
34091 <indexterm role="concept">
34092 <primary>options</primary>
34093 <secondary><command>redirect</command> router</secondary>
34094 </indexterm>
34095 The private options for the <command>redirect</command> router are as follows:
34096 </para>
34097 <para>
34098 <indexterm role="option">
34099 <primary><option>allow_defer</option></primary>
34100 </indexterm>
34101 </para>
34102 <informaltable frame="all">
34103 <tgroup cols="4" colsep="0" rowsep="0">
34104 <colspec colwidth="8*" align="left"/>
34105 <colspec colwidth="6*" align="center"/>
34106 <colspec colwidth="6*" align="center"/>
34107 <colspec colwidth="6*" align="right"/>
34108 <tbody>
34109 <row>
34110 <entry><option>allow_defer</option></entry>
34111 <entry>Use: <emphasis>redirect</emphasis></entry>
34112 <entry>Type: <emphasis>boolean</emphasis></entry>
34113 <entry>Default: <emphasis>false</emphasis></entry>
34114 </row>
34115 </tbody>
34116 </tgroup>
34117 </informaltable>
34118 <para>
34119 Setting this option allows the use of <emphasis>:defer:</emphasis> in non-filter redirection
34120 data, or the <option>defer</option> command in an Exim filter file.
34121 </para>
34122 <para>
34123 <indexterm role="option">
34124 <primary><option>allow_fail</option></primary>
34125 </indexterm>
34126 </para>
34127 <informaltable frame="all">
34128 <tgroup cols="4" colsep="0" rowsep="0">
34129 <colspec colwidth="8*" align="left"/>
34130 <colspec colwidth="6*" align="center"/>
34131 <colspec colwidth="6*" align="center"/>
34132 <colspec colwidth="6*" align="right"/>
34133 <tbody>
34134 <row>
34135 <entry><option>allow_fail</option></entry>
34136 <entry>Use: <emphasis>redirect</emphasis></entry>
34137 <entry>Type: <emphasis>boolean</emphasis></entry>
34138 <entry>Default: <emphasis>false</emphasis></entry>
34139 </row>
34140 </tbody>
34141 </tgroup>
34142 </informaltable>
34143 <para>
34144 <indexterm role="concept">
34145 <primary>failing delivery</primary>
34146 <secondary>from filter</secondary>
34147 </indexterm>
34148 If this option is true, the <emphasis>:fail:</emphasis> item can be used in a redirection list,
34149 and the <option>fail</option> command may be used in an Exim filter file.
34150 </para>
34151 <para>
34152 <indexterm role="option">
34153 <primary><option>allow_filter</option></primary>
34154 </indexterm>
34155 </para>
34156 <informaltable frame="all">
34157 <tgroup cols="4" colsep="0" rowsep="0">
34158 <colspec colwidth="8*" align="left"/>
34159 <colspec colwidth="6*" align="center"/>
34160 <colspec colwidth="6*" align="center"/>
34161 <colspec colwidth="6*" align="right"/>
34162 <tbody>
34163 <row>
34164 <entry><option>allow_filter</option></entry>
34165 <entry>Use: <emphasis>redirect</emphasis></entry>
34166 <entry>Type: <emphasis>boolean</emphasis></entry>
34167 <entry>Default: <emphasis>false</emphasis></entry>
34168 </row>
34169 </tbody>
34170 </tgroup>
34171 </informaltable>
34172 <para>
34173 <indexterm role="concept">
34174 <primary>filter</primary>
34175 <secondary>enabling use of</secondary>
34176 </indexterm>
34177 <indexterm role="concept">
34178 <primary>Sieve filter</primary>
34179 <secondary>enabling use of</secondary>
34180 </indexterm>
34181 Setting this option allows Exim to interpret redirection data that starts with
34182 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote> as a set of filtering instructions. There
34183 are some features of Exim filter files that some administrators may wish to
34184 lock out; see the <option>forbid_filter_</option><emphasis>xxx</emphasis> options below.
34185 </para>
34186 <para>
34187 It is also possible to lock out Exim filters or Sieve filters while allowing
34188 the other type; see <option>forbid_exim_filter</option> and <option>forbid_sieve_filter</option>.
34189 </para>
34190 <para>
34191 The filter is run using the uid and gid set by the generic <option>user</option> and
34192 <option>group</option> options. These take their defaults from the password data if
34193 <option>check_local_user</option> is set, so in the normal case of users&#x2019; personal filter
34194 files, the filter is run as the relevant user. When <option>allow_filter</option> is set
34195 true, Exim insists that either <option>check_local_user</option> or <option>user</option> is set.
34196 </para>
34197 <para>
34198 <indexterm role="option">
34199 <primary><option>allow_freeze</option></primary>
34200 </indexterm>
34201 </para>
34202 <informaltable frame="all">
34203 <tgroup cols="4" colsep="0" rowsep="0">
34204 <colspec colwidth="8*" align="left"/>
34205 <colspec colwidth="6*" align="center"/>
34206 <colspec colwidth="6*" align="center"/>
34207 <colspec colwidth="6*" align="right"/>
34208 <tbody>
34209 <row>
34210 <entry><option>allow_freeze</option></entry>
34211 <entry>Use: <emphasis>redirect</emphasis></entry>
34212 <entry>Type: <emphasis>boolean</emphasis></entry>
34213 <entry>Default: <emphasis>false</emphasis></entry>
34214 </row>
34215 </tbody>
34216 </tgroup>
34217 </informaltable>
34218 <para>
34219 <indexterm role="concept">
34220 <primary>freezing messages</primary>
34221 <secondary>allowing in filter</secondary>
34222 </indexterm>
34223 Setting this option allows the use of the <option>freeze</option> command in an Exim filter.
34224 This command is more normally encountered in system filters, and is disabled by
34225 default for redirection filters because it isn&#x2019;t something you usually want to
34226 let ordinary users do.
34227 </para>
34228 <para>
34229 <indexterm role="option">
34230 <primary><option>check_ancestor</option></primary>
34231 </indexterm>
34232 </para>
34233 <informaltable frame="all">
34234 <tgroup cols="4" colsep="0" rowsep="0">
34235 <colspec colwidth="8*" align="left"/>
34236 <colspec colwidth="6*" align="center"/>
34237 <colspec colwidth="6*" align="center"/>
34238 <colspec colwidth="6*" align="right"/>
34239 <tbody>
34240 <row>
34241 <entry><option>check_ancestor</option></entry>
34242 <entry>Use: <emphasis>redirect</emphasis></entry>
34243 <entry>Type: <emphasis>boolean</emphasis></entry>
34244 <entry>Default: <emphasis>false</emphasis></entry>
34245 </row>
34246 </tbody>
34247 </tgroup>
34248 </informaltable>
34249 <para>
34250 This option is concerned with handling generated addresses that are the same
34251 as some address in the list of redirection ancestors of the current address.
34252 Although it is turned off by default in the code, it is set in the default
34253 configuration file for handling users&#x2019; <filename>.forward</filename> files. It is recommended
34254 for this use of the <command>redirect</command> router.
34255 </para>
34256 <para>
34257 When <option>check_ancestor</option> is set, if a generated address (including the domain)
34258 is the same as any ancestor of the current address, it is replaced by a copy of
34259 the current address. This helps in the case where local part A is aliased to B,
34260 and B has a <filename>.forward</filename> file pointing back to A. For example, within a single
34261 domain, the local part <quote>Joe.Bloggs</quote> is aliased to <quote>jb</quote> and
34262 <filename>&nbsp;jb/.forward</filename> contains:
34263 </para>
34264 <literallayout class="monospaced">
34265 \Joe.Bloggs, &lt;other item(s)&gt;
34266 </literallayout>
34267 <para>
34268 Without the <option>check_ancestor</option> setting, either local part (<quote>jb</quote> or
34269 <quote>joe.bloggs</quote>) gets processed once by each router and so ends up as it was
34270 originally. If <quote>jb</quote> is the real mailbox name, mail to <quote>jb</quote> gets delivered
34271 (having been turned into <quote>joe.bloggs</quote> by the <filename>.forward</filename> file and back to
34272 <quote>jb</quote> by the alias), but mail to <quote>joe.bloggs</quote> fails. Setting
34273 <option>check_ancestor</option> on the <command>redirect</command> router that handles the <filename>.forward</filename>
34274 file prevents it from turning <quote>jb</quote> back into <quote>joe.bloggs</quote> when that was the
34275 original address. See also the <option>repeat_use</option> option below.
34276 </para>
34277 <para>
34278 <indexterm role="option">
34279 <primary><option>check_group</option></primary>
34280 </indexterm>
34281 </para>
34282 <informaltable frame="all">
34283 <tgroup cols="4" colsep="0" rowsep="0">
34284 <colspec colwidth="8*" align="left"/>
34285 <colspec colwidth="6*" align="center"/>
34286 <colspec colwidth="6*" align="center"/>
34287 <colspec colwidth="6*" align="right"/>
34288 <tbody>
34289 <row>
34290 <entry><option>check_group</option></entry>
34291 <entry>Use: <emphasis>redirect</emphasis></entry>
34292 <entry>Type: <emphasis>boolean</emphasis></entry>
34293 <entry>Default: <emphasis>see below</emphasis></entry>
34294 </row>
34295 </tbody>
34296 </tgroup>
34297 </informaltable>
34298 <para>
34299 When the <option>file</option> option is used, the group owner of the file is checked only
34300 when this option is set. The permitted groups are those listed in the
34301 <option>owngroups</option> option, together with the user&#x2019;s default group if
34302 <option>check_local_user</option> is set. If the file has the wrong group, routing is
34303 deferred. The default setting for this option is true if <option>check_local_user</option>
34304 is set and the <option>modemask</option> option permits the group write bit, or if the
34305 <option>owngroups</option> option is set. Otherwise it is false, and no group check occurs.
34306 </para>
34307 <para>
34308 <indexterm role="option">
34309 <primary><option>check_owner</option></primary>
34310 </indexterm>
34311 </para>
34312 <informaltable frame="all">
34313 <tgroup cols="4" colsep="0" rowsep="0">
34314 <colspec colwidth="8*" align="left"/>
34315 <colspec colwidth="6*" align="center"/>
34316 <colspec colwidth="6*" align="center"/>
34317 <colspec colwidth="6*" align="right"/>
34318 <tbody>
34319 <row>
34320 <entry><option>check_owner</option></entry>
34321 <entry>Use: <emphasis>redirect</emphasis></entry>
34322 <entry>Type: <emphasis>boolean</emphasis></entry>
34323 <entry>Default: <emphasis>see below</emphasis></entry>
34324 </row>
34325 </tbody>
34326 </tgroup>
34327 </informaltable>
34328 <para>
34329 When the <option>file</option> option is used, the owner of the file is checked only when
34330 this option is set. If <option>check_local_user</option> is set, the local user is
34331 permitted; otherwise the owner must be one of those listed in the <option>owners</option>
34332 option. The default value for this option is true if <option>check_local_user</option> or
34333 <option>owners</option> is set. Otherwise the default is false, and no owner check occurs.
34334 </para>
34335 <para>
34336 <indexterm role="option">
34337 <primary><option>data</option></primary>
34338 </indexterm>
34339 </para>
34340 <informaltable frame="all">
34341 <tgroup cols="4" colsep="0" rowsep="0">
34342 <colspec colwidth="8*" align="left"/>
34343 <colspec colwidth="6*" align="center"/>
34344 <colspec colwidth="6*" align="center"/>
34345 <colspec colwidth="6*" align="right"/>
34346 <tbody>
34347 <row>
34348 <entry><option>data</option></entry>
34349 <entry>Use: <emphasis>redirect</emphasis></entry>
34350 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34351 <entry>Default: <emphasis>unset</emphasis></entry>
34352 </row>
34353 </tbody>
34354 </tgroup>
34355 </informaltable>
34356 <para>
34357 This option is mutually exclusive with <option>file</option>. One or other of them must be
34358 set, but not both. The contents of <option>data</option> are expanded, and then used as the
34359 list of forwarding items, or as a set of filtering instructions. If the
34360 expansion is forced to fail, or the result is an empty string or a string that
34361 has no effect (consists entirely of comments), the router declines.
34362 </para>
34363 <para>
34364 When filtering instructions are used, the string must begin with <quote>#Exim
34365 filter</quote>, and all comments in the string, including this initial one, must be
34366 terminated with newline characters. For example:
34367 </para>
34368 <literallayout class="monospaced">
34369 data = #Exim filter\n\
34370        if $h_to: contains Exim then save $home/mail/exim endif
34371 </literallayout>
34372 <para>
34373 If you are reading the data from a database where newlines cannot be included,
34374 you can use the <varname>${sg}</varname> expansion item to turn the escape string of your
34375 choice into a newline.
34376 </para>
34377 <para>
34378 <indexterm role="option">
34379 <primary><option>directory_transport</option></primary>
34380 </indexterm>
34381 </para>
34382 <informaltable frame="all">
34383 <tgroup cols="4" colsep="0" rowsep="0">
34384 <colspec colwidth="8*" align="left"/>
34385 <colspec colwidth="6*" align="center"/>
34386 <colspec colwidth="6*" align="center"/>
34387 <colspec colwidth="6*" align="right"/>
34388 <tbody>
34389 <row>
34390 <entry><option>directory_transport</option></entry>
34391 <entry>Use: <emphasis>redirect</emphasis></entry>
34392 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34393 <entry>Default: <emphasis>unset</emphasis></entry>
34394 </row>
34395 </tbody>
34396 </tgroup>
34397 </informaltable>
34398 <para>
34399 A <command>redirect</command> router sets up a direct delivery to a directory when a path name
34400 ending with a slash is specified as a new <quote>address</quote>. The transport used is
34401 specified by this option, which, after expansion, must be the name of a
34402 configured transport. This should normally be an <command>appendfile</command> transport.
34403 </para>
34404 <para>
34405 <indexterm role="option">
34406 <primary><option>file</option></primary>
34407 </indexterm>
34408 </para>
34409 <informaltable frame="all">
34410 <tgroup cols="4" colsep="0" rowsep="0">
34411 <colspec colwidth="8*" align="left"/>
34412 <colspec colwidth="6*" align="center"/>
34413 <colspec colwidth="6*" align="center"/>
34414 <colspec colwidth="6*" align="right"/>
34415 <tbody>
34416 <row>
34417 <entry><option>file</option></entry>
34418 <entry>Use: <emphasis>redirect</emphasis></entry>
34419 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34420 <entry>Default: <emphasis>unset</emphasis></entry>
34421 </row>
34422 </tbody>
34423 </tgroup>
34424 </informaltable>
34425 <para>
34426 This option specifies the name of a file that contains the redirection data. It
34427 is mutually exclusive with the <option>data</option> option. The string is expanded before
34428 use; if the expansion is forced to fail, the router declines. Other expansion
34429 failures cause delivery to be deferred. The result of a successful expansion
34430 must be an absolute path. The entire file is read and used as the redirection
34431 data. If the data is an empty string or a string that has no effect (consists
34432 entirely of comments), the router declines.
34433 </para>
34434 <para>
34435 <indexterm role="concept">
34436 <primary>NFS</primary>
34437 <secondary>checking for file existence</secondary>
34438 </indexterm>
34439 If the attempt to open the file fails with a <quote>does not exist</quote> error, Exim
34440 runs a check on the containing directory,
34441 unless <option>ignore_enotdir</option> is true (see below).
34442 If the directory does not appear to exist, delivery is deferred. This can
34443 happen when users&#x2019; <filename>.forward</filename> files are in NFS-mounted directories, and there
34444 is a mount problem. If the containing directory does exist, but the file does
34445 not, the router declines.
34446 </para>
34447 <para>
34448 <indexterm role="option">
34449 <primary><option>file_transport</option></primary>
34450 </indexterm>
34451 </para>
34452 <informaltable frame="all">
34453 <tgroup cols="4" colsep="0" rowsep="0">
34454 <colspec colwidth="8*" align="left"/>
34455 <colspec colwidth="6*" align="center"/>
34456 <colspec colwidth="6*" align="center"/>
34457 <colspec colwidth="6*" align="right"/>
34458 <tbody>
34459 <row>
34460 <entry><option>file_transport</option></entry>
34461 <entry>Use: <emphasis>redirect</emphasis></entry>
34462 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34463 <entry>Default: <emphasis>unset</emphasis></entry>
34464 </row>
34465 </tbody>
34466 </tgroup>
34467 </informaltable>
34468 <para>
34469 <indexterm role="variable">
34470 <primary><varname>$address_file</varname></primary>
34471 </indexterm>
34472 A <command>redirect</command> router sets up a direct delivery to a file when a path name not
34473 ending in a slash is specified as a new <quote>address</quote>. The transport used is
34474 specified by this option, which, after expansion, must be the name of a
34475 configured transport. This should normally be an <command>appendfile</command> transport. When
34476 it is running, the file name is in <varname>$address_file</varname>.
34477 </para>
34478 <para>
34479 <indexterm role="option">
34480 <primary><option>filter_prepend_home</option></primary>
34481 </indexterm>
34482 </para>
34483 <informaltable frame="all">
34484 <tgroup cols="4" colsep="0" rowsep="0">
34485 <colspec colwidth="8*" align="left"/>
34486 <colspec colwidth="6*" align="center"/>
34487 <colspec colwidth="6*" align="center"/>
34488 <colspec colwidth="6*" align="right"/>
34489 <tbody>
34490 <row>
34491 <entry><option>filter_prepend_home</option></entry>
34492 <entry>Use: <emphasis>redirect</emphasis></entry>
34493 <entry>Type: <emphasis>boolean</emphasis></entry>
34494 <entry>Default: <emphasis>true</emphasis></entry>
34495 </row>
34496 </tbody>
34497 </tgroup>
34498 </informaltable>
34499 <para>
34500 When this option is true, if a <command>save</command> command in an Exim filter specifies a
34501 relative path, and <varname>$home</varname> is defined, it is automatically prepended to the
34502 relative path. If this option is set false, this action does not happen. The
34503 relative path is then passed to the transport unmodified.
34504 </para>
34505 <para>
34506 <indexterm role="option">
34507 <primary><option>forbid_blackhole</option></primary>
34508 </indexterm>
34509 </para>
34510 <informaltable frame="all">
34511 <tgroup cols="4" colsep="0" rowsep="0">
34512 <colspec colwidth="8*" align="left"/>
34513 <colspec colwidth="6*" align="center"/>
34514 <colspec colwidth="6*" align="center"/>
34515 <colspec colwidth="6*" align="right"/>
34516 <tbody>
34517 <row>
34518 <entry><option>forbid_blackhole</option></entry>
34519 <entry>Use: <emphasis>redirect</emphasis></entry>
34520 <entry>Type: <emphasis>boolean</emphasis></entry>
34521 <entry>Default: <emphasis>false</emphasis></entry>
34522 </row>
34523 </tbody>
34524 </tgroup>
34525 </informaltable>
34526 <para>
34527 If this option is true, the <emphasis>:blackhole:</emphasis> item may not appear in a
34528 redirection list.
34529 </para>
34530 <para>
34531 <indexterm role="option">
34532 <primary><option>forbid_exim_filter</option></primary>
34533 </indexterm>
34534 </para>
34535 <informaltable frame="all">
34536 <tgroup cols="4" colsep="0" rowsep="0">
34537 <colspec colwidth="8*" align="left"/>
34538 <colspec colwidth="6*" align="center"/>
34539 <colspec colwidth="6*" align="center"/>
34540 <colspec colwidth="6*" align="right"/>
34541 <tbody>
34542 <row>
34543 <entry><option>forbid_exim_filter</option></entry>
34544 <entry>Use: <emphasis>redirect</emphasis></entry>
34545 <entry>Type: <emphasis>boolean</emphasis></entry>
34546 <entry>Default: <emphasis>false</emphasis></entry>
34547 </row>
34548 </tbody>
34549 </tgroup>
34550 </informaltable>
34551 <para>
34552 If this option is set true, only Sieve filters are permitted when
34553 <option>allow_filter</option> is true.
34554 </para>
34555 <para>
34556 <indexterm role="option">
34557 <primary><option>forbid_file</option></primary>
34558 </indexterm>
34559 </para>
34560 <informaltable frame="all">
34561 <tgroup cols="4" colsep="0" rowsep="0">
34562 <colspec colwidth="8*" align="left"/>
34563 <colspec colwidth="6*" align="center"/>
34564 <colspec colwidth="6*" align="center"/>
34565 <colspec colwidth="6*" align="right"/>
34566 <tbody>
34567 <row>
34568 <entry><option>forbid_file</option></entry>
34569 <entry>Use: <emphasis>redirect</emphasis></entry>
34570 <entry>Type: <emphasis>boolean</emphasis></entry>
34571 <entry>Default: <emphasis>false</emphasis></entry>
34572 </row>
34573 </tbody>
34574 </tgroup>
34575 </informaltable>
34576 <para>
34577 <indexterm role="concept">
34578 <primary>delivery</primary>
34579 <secondary>to file; forbidding</secondary>
34580 </indexterm>
34581 <indexterm role="concept">
34582 <primary>Sieve filter</primary>
34583 <secondary>forbidding delivery to a file</secondary>
34584 </indexterm>
34585 <indexterm role="concept">
34586 <primary>Sieve filter</primary>
34587 <secondary><quote>keep</quote> facility; disabling</secondary>
34588 </indexterm>
34589 If this option is true, this router may not generate a new address that
34590 specifies delivery to a local file or directory, either from a filter or from a
34591 conventional forward file. This option is forced to be true if <option>one_time</option> is
34592 set. It applies to Sieve filters as well as to Exim filters, but if true, it
34593 locks out the Sieve&#x2019;s <quote>keep</quote> facility.
34594 </para>
34595 <para>
34596 <indexterm role="option">
34597 <primary><option>forbid_filter_dlfunc</option></primary>
34598 </indexterm>
34599 </para>
34600 <informaltable frame="all">
34601 <tgroup cols="4" colsep="0" rowsep="0">
34602 <colspec colwidth="8*" align="left"/>
34603 <colspec colwidth="6*" align="center"/>
34604 <colspec colwidth="6*" align="center"/>
34605 <colspec colwidth="6*" align="right"/>
34606 <tbody>
34607 <row>
34608 <entry><option>forbid_filter_dlfunc</option></entry>
34609 <entry>Use: <emphasis>redirect</emphasis></entry>
34610 <entry>Type: <emphasis>boolean</emphasis></entry>
34611 <entry>Default: <emphasis>false</emphasis></entry>
34612 </row>
34613 </tbody>
34614 </tgroup>
34615 </informaltable>
34616 <para>
34617 <indexterm role="concept">
34618 <primary>filter</primary>
34619 <secondary>locking out certain features</secondary>
34620 </indexterm>
34621 If this option is true, string expansions in Exim filters are not allowed to
34622 make use of the <option>dlfunc</option> expansion facility to run dynamically loaded
34623 functions.
34624 </para>
34625 <para>
34626 <indexterm role="option">
34627 <primary><option>forbid_filter_existstest</option></primary>
34628 </indexterm>
34629 </para>
34630 <informaltable frame="all">
34631 <tgroup cols="4" colsep="0" rowsep="0">
34632 <colspec colwidth="8*" align="left"/>
34633 <colspec colwidth="6*" align="center"/>
34634 <colspec colwidth="6*" align="center"/>
34635 <colspec colwidth="6*" align="right"/>
34636 <tbody>
34637 <row>
34638 <entry><option>forbid_filter_existstest</option></entry>
34639 <entry>Use: <emphasis>redirect</emphasis></entry>
34640 <entry>Type: <emphasis>boolean</emphasis></entry>
34641 <entry>Default: <emphasis>false</emphasis></entry>
34642 </row>
34643 </tbody>
34644 </tgroup>
34645 </informaltable>
34646 <para>
34647 <indexterm role="concept">
34648 <primary>expansion</primary>
34649 <secondary>statting a file</secondary>
34650 </indexterm>
34651 If this option is true, string expansions in Exim filters are not allowed to
34652 make use of the <option>exists</option> condition or the <option>stat</option> expansion item.
34653 </para>
34654 <para>
34655 <indexterm role="option">
34656 <primary><option>forbid_filter_logwrite</option></primary>
34657 </indexterm>
34658 </para>
34659 <informaltable frame="all">
34660 <tgroup cols="4" colsep="0" rowsep="0">
34661 <colspec colwidth="8*" align="left"/>
34662 <colspec colwidth="6*" align="center"/>
34663 <colspec colwidth="6*" align="center"/>
34664 <colspec colwidth="6*" align="right"/>
34665 <tbody>
34666 <row>
34667 <entry><option>forbid_filter_logwrite</option></entry>
34668 <entry>Use: <emphasis>redirect</emphasis></entry>
34669 <entry>Type: <emphasis>boolean</emphasis></entry>
34670 <entry>Default: <emphasis>false</emphasis></entry>
34671 </row>
34672 </tbody>
34673 </tgroup>
34674 </informaltable>
34675 <para>
34676 If this option is true, use of the logging facility in Exim filters is not
34677 permitted. Logging is in any case available only if the filter is being run
34678 under some unprivileged uid (which is normally the case for ordinary users&#x2019;
34679 <filename>.forward</filename> files).
34680 </para>
34681 <para>
34682 <indexterm role="option">
34683 <primary><option>forbid_filter_lookup</option></primary>
34684 </indexterm>
34685 </para>
34686 <informaltable frame="all">
34687 <tgroup cols="4" colsep="0" rowsep="0">
34688 <colspec colwidth="8*" align="left"/>
34689 <colspec colwidth="6*" align="center"/>
34690 <colspec colwidth="6*" align="center"/>
34691 <colspec colwidth="6*" align="right"/>
34692 <tbody>
34693 <row>
34694 <entry><option>forbid_filter_lookup</option></entry>
34695 <entry>Use: <emphasis>redirect</emphasis></entry>
34696 <entry>Type: <emphasis>boolean</emphasis></entry>
34697 <entry>Default: <emphasis>false</emphasis></entry>
34698 </row>
34699 </tbody>
34700 </tgroup>
34701 </informaltable>
34702 <para>
34703 If this option is true, string expansions in Exim filter files are not allowed
34704 to make use of <option>lookup</option> items.
34705 </para>
34706 <para>
34707 <indexterm role="option">
34708 <primary><option>forbid_filter_perl</option></primary>
34709 </indexterm>
34710 </para>
34711 <informaltable frame="all">
34712 <tgroup cols="4" colsep="0" rowsep="0">
34713 <colspec colwidth="8*" align="left"/>
34714 <colspec colwidth="6*" align="center"/>
34715 <colspec colwidth="6*" align="center"/>
34716 <colspec colwidth="6*" align="right"/>
34717 <tbody>
34718 <row>
34719 <entry><option>forbid_filter_perl</option></entry>
34720 <entry>Use: <emphasis>redirect</emphasis></entry>
34721 <entry>Type: <emphasis>boolean</emphasis></entry>
34722 <entry>Default: <emphasis>false</emphasis></entry>
34723 </row>
34724 </tbody>
34725 </tgroup>
34726 </informaltable>
34727 <para>
34728 This option has an effect only if Exim is built with embedded Perl support. If
34729 it is true, string expansions in Exim filter files are not allowed to make use
34730 of the embedded Perl support.
34731 </para>
34732 <para>
34733 <indexterm role="option">
34734 <primary><option>forbid_filter_readfile</option></primary>
34735 </indexterm>
34736 </para>
34737 <informaltable frame="all">
34738 <tgroup cols="4" colsep="0" rowsep="0">
34739 <colspec colwidth="8*" align="left"/>
34740 <colspec colwidth="6*" align="center"/>
34741 <colspec colwidth="6*" align="center"/>
34742 <colspec colwidth="6*" align="right"/>
34743 <tbody>
34744 <row>
34745 <entry><option>forbid_filter_readfile</option></entry>
34746 <entry>Use: <emphasis>redirect</emphasis></entry>
34747 <entry>Type: <emphasis>boolean</emphasis></entry>
34748 <entry>Default: <emphasis>false</emphasis></entry>
34749 </row>
34750 </tbody>
34751 </tgroup>
34752 </informaltable>
34753 <para>
34754 If this option is true, string expansions in Exim filter files are not allowed
34755 to make use of <option>readfile</option> items.
34756 </para>
34757 <para>
34758 <indexterm role="option">
34759 <primary><option>forbid_filter_readsocket</option></primary>
34760 </indexterm>
34761 </para>
34762 <informaltable frame="all">
34763 <tgroup cols="4" colsep="0" rowsep="0">
34764 <colspec colwidth="8*" align="left"/>
34765 <colspec colwidth="6*" align="center"/>
34766 <colspec colwidth="6*" align="center"/>
34767 <colspec colwidth="6*" align="right"/>
34768 <tbody>
34769 <row>
34770 <entry><option>forbid_filter_readsocket</option></entry>
34771 <entry>Use: <emphasis>redirect</emphasis></entry>
34772 <entry>Type: <emphasis>boolean</emphasis></entry>
34773 <entry>Default: <emphasis>false</emphasis></entry>
34774 </row>
34775 </tbody>
34776 </tgroup>
34777 </informaltable>
34778 <para>
34779 If this option is true, string expansions in Exim filter files are not allowed
34780 to make use of <option>readsocket</option> items.
34781 </para>
34782 <para>
34783 <indexterm role="option">
34784 <primary><option>forbid_filter_reply</option></primary>
34785 </indexterm>
34786 </para>
34787 <informaltable frame="all">
34788 <tgroup cols="4" colsep="0" rowsep="0">
34789 <colspec colwidth="8*" align="left"/>
34790 <colspec colwidth="6*" align="center"/>
34791 <colspec colwidth="6*" align="center"/>
34792 <colspec colwidth="6*" align="right"/>
34793 <tbody>
34794 <row>
34795 <entry><option>forbid_filter_reply</option></entry>
34796 <entry>Use: <emphasis>redirect</emphasis></entry>
34797 <entry>Type: <emphasis>boolean</emphasis></entry>
34798 <entry>Default: <emphasis>false</emphasis></entry>
34799 </row>
34800 </tbody>
34801 </tgroup>
34802 </informaltable>
34803 <para>
34804 If this option is true, this router may not generate an automatic reply
34805 message. Automatic replies can be generated only from Exim or Sieve filter
34806 files, not from traditional forward files. This option is forced to be true if
34807 <option>one_time</option> is set.
34808 </para>
34809 <para>
34810 <indexterm role="option">
34811 <primary><option>forbid_filter_run</option></primary>
34812 </indexterm>
34813 </para>
34814 <informaltable frame="all">
34815 <tgroup cols="4" colsep="0" rowsep="0">
34816 <colspec colwidth="8*" align="left"/>
34817 <colspec colwidth="6*" align="center"/>
34818 <colspec colwidth="6*" align="center"/>
34819 <colspec colwidth="6*" align="right"/>
34820 <tbody>
34821 <row>
34822 <entry><option>forbid_filter_run</option></entry>
34823 <entry>Use: <emphasis>redirect</emphasis></entry>
34824 <entry>Type: <emphasis>boolean</emphasis></entry>
34825 <entry>Default: <emphasis>false</emphasis></entry>
34826 </row>
34827 </tbody>
34828 </tgroup>
34829 </informaltable>
34830 <para>
34831 If this option is true, string expansions in Exim filter files are not allowed
34832 to make use of <option>run</option> items.
34833 </para>
34834 <para>
34835 <indexterm role="option">
34836 <primary><option>forbid_include</option></primary>
34837 </indexterm>
34838 </para>
34839 <informaltable frame="all">
34840 <tgroup cols="4" colsep="0" rowsep="0">
34841 <colspec colwidth="8*" align="left"/>
34842 <colspec colwidth="6*" align="center"/>
34843 <colspec colwidth="6*" align="center"/>
34844 <colspec colwidth="6*" align="right"/>
34845 <tbody>
34846 <row>
34847 <entry><option>forbid_include</option></entry>
34848 <entry>Use: <emphasis>redirect</emphasis></entry>
34849 <entry>Type: <emphasis>boolean</emphasis></entry>
34850 <entry>Default: <emphasis>false</emphasis></entry>
34851 </row>
34852 </tbody>
34853 </tgroup>
34854 </informaltable>
34855 <para>
34856 If this option is true, items of the form
34857 </para>
34858 <literallayout class="monospaced">
34859 :include:&lt;path name&gt;
34860 </literallayout>
34861 <para>
34862 are not permitted in non-filter redirection lists.
34863 </para>
34864 <para>
34865 <indexterm role="option">
34866 <primary><option>forbid_pipe</option></primary>
34867 </indexterm>
34868 </para>
34869 <informaltable frame="all">
34870 <tgroup cols="4" colsep="0" rowsep="0">
34871 <colspec colwidth="8*" align="left"/>
34872 <colspec colwidth="6*" align="center"/>
34873 <colspec colwidth="6*" align="center"/>
34874 <colspec colwidth="6*" align="right"/>
34875 <tbody>
34876 <row>
34877 <entry><option>forbid_pipe</option></entry>
34878 <entry>Use: <emphasis>redirect</emphasis></entry>
34879 <entry>Type: <emphasis>boolean</emphasis></entry>
34880 <entry>Default: <emphasis>false</emphasis></entry>
34881 </row>
34882 </tbody>
34883 </tgroup>
34884 </informaltable>
34885 <para>
34886 <indexterm role="concept">
34887 <primary>delivery</primary>
34888 <secondary>to pipe; forbidding</secondary>
34889 </indexterm>
34890 If this option is true, this router may not generate a new address which
34891 specifies delivery to a pipe, either from an Exim filter or from a conventional
34892 forward file. This option is forced to be true if <option>one_time</option> is set.
34893 </para>
34894 <para>
34895 <indexterm role="option">
34896 <primary><option>forbid_sieve_filter</option></primary>
34897 </indexterm>
34898 </para>
34899 <informaltable frame="all">
34900 <tgroup cols="4" colsep="0" rowsep="0">
34901 <colspec colwidth="8*" align="left"/>
34902 <colspec colwidth="6*" align="center"/>
34903 <colspec colwidth="6*" align="center"/>
34904 <colspec colwidth="6*" align="right"/>
34905 <tbody>
34906 <row>
34907 <entry><option>forbid_sieve_filter</option></entry>
34908 <entry>Use: <emphasis>redirect</emphasis></entry>
34909 <entry>Type: <emphasis>boolean</emphasis></entry>
34910 <entry>Default: <emphasis>false</emphasis></entry>
34911 </row>
34912 </tbody>
34913 </tgroup>
34914 </informaltable>
34915 <para>
34916 If this option is set true, only Exim filters are permitted when
34917 <option>allow_filter</option> is true.
34918 </para>
34919 <para>
34920 <indexterm role="concept">
34921 <primary>SMTP</primary>
34922 <secondary>error codes</secondary>
34923 </indexterm>
34924 <indexterm role="option">
34925 <primary><option>forbid_smtp_code</option></primary>
34926 </indexterm>
34927 </para>
34928 <informaltable frame="all">
34929 <tgroup cols="4" colsep="0" rowsep="0">
34930 <colspec colwidth="8*" align="left"/>
34931 <colspec colwidth="6*" align="center"/>
34932 <colspec colwidth="6*" align="center"/>
34933 <colspec colwidth="6*" align="right"/>
34934 <tbody>
34935 <row>
34936 <entry><option>forbid_smtp_code</option></entry>
34937 <entry>Use: <emphasis>redirect</emphasis></entry>
34938 <entry>Type: <emphasis>boolean</emphasis></entry>
34939 <entry>Default: <emphasis>false</emphasis></entry>
34940 </row>
34941 </tbody>
34942 </tgroup>
34943 </informaltable>
34944 <para>
34945 If this option is set true, any SMTP error codes that are present at the start
34946 of messages specified for <literal>:defer:</literal> or <literal>:fail:</literal> are quietly ignored, and
34947 the default codes (451 and 550, respectively) are always used.
34948 </para>
34949 <para>
34950 <indexterm role="option">
34951 <primary><option>hide_child_in_errmsg</option></primary>
34952 </indexterm>
34953 </para>
34954 <informaltable frame="all">
34955 <tgroup cols="4" colsep="0" rowsep="0">
34956 <colspec colwidth="8*" align="left"/>
34957 <colspec colwidth="6*" align="center"/>
34958 <colspec colwidth="6*" align="center"/>
34959 <colspec colwidth="6*" align="right"/>
34960 <tbody>
34961 <row>
34962 <entry><option>hide_child_in_errmsg</option></entry>
34963 <entry>Use: <emphasis>redirect</emphasis></entry>
34964 <entry>Type: <emphasis>boolean</emphasis></entry>
34965 <entry>Default: <emphasis>false</emphasis></entry>
34966 </row>
34967 </tbody>
34968 </tgroup>
34969 </informaltable>
34970 <para>
34971 <indexterm role="concept">
34972 <primary>bounce message</primary>
34973 <secondary>redirection details; suppressing</secondary>
34974 </indexterm>
34975 If this option is true, it prevents Exim from quoting a child address if it
34976 generates a bounce or delay message for it. Instead it says <quote>an address
34977 generated from &lt;<emphasis>the top level address</emphasis>&gt;</quote>. Of course, this applies only to
34978 bounces generated locally. If a message is forwarded to another host, <emphasis>its</emphasis>
34979 bounce may well quote the generated address.
34980 </para>
34981 <para>
34982 <indexterm role="option">
34983 <primary><option>ignore_eacces</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>ignore_eacces</option></entry>
34995 <entry>Use: <emphasis>redirect</emphasis></entry>
34996 <entry>Type: <emphasis>boolean</emphasis></entry>
34997 <entry>Default: <emphasis>false</emphasis></entry>
34998 </row>
34999 </tbody>
35000 </tgroup>
35001 </informaltable>
35002 <para>
35003 <indexterm role="concept">
35004 <primary>EACCES</primary>
35005 </indexterm>
35006 If this option is set and an attempt to open a redirection file yields the
35007 EACCES error (permission denied), the <command>redirect</command> router behaves as if the
35008 file did not exist.
35009 </para>
35010 <para>
35011 <indexterm role="option">
35012 <primary><option>ignore_enotdir</option></primary>
35013 </indexterm>
35014 </para>
35015 <informaltable frame="all">
35016 <tgroup cols="4" colsep="0" rowsep="0">
35017 <colspec colwidth="8*" align="left"/>
35018 <colspec colwidth="6*" align="center"/>
35019 <colspec colwidth="6*" align="center"/>
35020 <colspec colwidth="6*" align="right"/>
35021 <tbody>
35022 <row>
35023 <entry><option>ignore_enotdir</option></entry>
35024 <entry>Use: <emphasis>redirect</emphasis></entry>
35025 <entry>Type: <emphasis>boolean</emphasis></entry>
35026 <entry>Default: <emphasis>false</emphasis></entry>
35027 </row>
35028 </tbody>
35029 </tgroup>
35030 </informaltable>
35031 <para>
35032 <indexterm role="concept">
35033 <primary>ENOTDIR</primary>
35034 </indexterm>
35035 If this option is set and an attempt to open a redirection file yields the
35036 ENOTDIR error (something on the path is not a directory), the <command>redirect</command>
35037 router behaves as if the file did not exist.
35038 </para>
35039 <para>
35040 Setting <option>ignore_enotdir</option> has another effect as well: When a <command>redirect</command>
35041 router that has the <option>file</option> option set discovers that the file does not exist
35042 (the ENOENT error), it tries to <function>stat()</function> the parent directory, as a check
35043 against unmounted NFS directories. If the parent can not be statted, delivery
35044 is deferred. However, it seems wrong to do this check when <option>ignore_enotdir</option>
35045 is set, because that option tells Exim to ignore <quote>something on the path is not
35046 a directory</quote> (the ENOTDIR error). This is a confusing area, because it seems
35047 that some operating systems give ENOENT where others give ENOTDIR.
35048 </para>
35049 <para>
35050 <indexterm role="option">
35051 <primary><option>include_directory</option></primary>
35052 </indexterm>
35053 </para>
35054 <informaltable frame="all">
35055 <tgroup cols="4" colsep="0" rowsep="0">
35056 <colspec colwidth="8*" align="left"/>
35057 <colspec colwidth="6*" align="center"/>
35058 <colspec colwidth="6*" align="center"/>
35059 <colspec colwidth="6*" align="right"/>
35060 <tbody>
35061 <row>
35062 <entry><option>include_directory</option></entry>
35063 <entry>Use: <emphasis>redirect</emphasis></entry>
35064 <entry>Type: <emphasis>string</emphasis></entry>
35065 <entry>Default: <emphasis>unset</emphasis></entry>
35066 </row>
35067 </tbody>
35068 </tgroup>
35069 </informaltable>
35070 <para>
35071 If this option is set, the path names of any <emphasis>:include:</emphasis> items in a
35072 redirection list must start with this directory.
35073 </para>
35074 <para>
35075 <indexterm role="option">
35076 <primary><option>modemask</option></primary>
35077 </indexterm>
35078 </para>
35079 <informaltable frame="all">
35080 <tgroup cols="4" colsep="0" rowsep="0">
35081 <colspec colwidth="8*" align="left"/>
35082 <colspec colwidth="6*" align="center"/>
35083 <colspec colwidth="6*" align="center"/>
35084 <colspec colwidth="6*" align="right"/>
35085 <tbody>
35086 <row>
35087 <entry><option>modemask</option></entry>
35088 <entry>Use: <emphasis>redirect</emphasis></entry>
35089 <entry>Type: <emphasis>octal integer</emphasis></entry>
35090 <entry>Default: <emphasis>022</emphasis></entry>
35091 </row>
35092 </tbody>
35093 </tgroup>
35094 </informaltable>
35095 <para>
35096 This specifies mode bits which must not be set for a file specified by the
35097 <option>file</option> option. If any of the forbidden bits are set, delivery is deferred.
35098 </para>
35099 <para>
35100 <indexterm role="option">
35101 <primary><option>one_time</option></primary>
35102 </indexterm>
35103 </para>
35104 <informaltable frame="all">
35105 <tgroup cols="4" colsep="0" rowsep="0">
35106 <colspec colwidth="8*" align="left"/>
35107 <colspec colwidth="6*" align="center"/>
35108 <colspec colwidth="6*" align="center"/>
35109 <colspec colwidth="6*" align="right"/>
35110 <tbody>
35111 <row>
35112 <entry><option>one_time</option></entry>
35113 <entry>Use: <emphasis>redirect</emphasis></entry>
35114 <entry>Type: <emphasis>boolean</emphasis></entry>
35115 <entry>Default: <emphasis>false</emphasis></entry>
35116 </row>
35117 </tbody>
35118 </tgroup>
35119 </informaltable>
35120 <para>
35121 <indexterm role="concept">
35122 <primary>one-time aliasing/forwarding expansion</primary>
35123 </indexterm>
35124 <indexterm role="concept">
35125 <primary>alias file</primary>
35126 <secondary>one-time expansion</secondary>
35127 </indexterm>
35128 <indexterm role="concept">
35129 <primary>forward file</primary>
35130 <secondary>one-time expansion</secondary>
35131 </indexterm>
35132 <indexterm role="concept">
35133 <primary>mailing lists</primary>
35134 <secondary>one-time expansion</secondary>
35135 </indexterm>
35136 <indexterm role="concept">
35137 <primary>address redirection</primary>
35138 <secondary>one-time expansion</secondary>
35139 </indexterm>
35140 Sometimes the fact that Exim re-evaluates aliases and reprocesses redirection
35141 files each time it tries to deliver a message causes a problem when one or more
35142 of the generated addresses fails be delivered at the first attempt. The problem
35143 is not one of duplicate delivery &ndash; Exim is clever enough to handle that &ndash;
35144 but of what happens when the redirection list changes during the time that the
35145 message is on Exim&#x2019;s queue. This is particularly true in the case of mailing
35146 lists, where new subscribers might receive copies of messages that were posted
35147 before they subscribed.
35148 </para>
35149 <para>
35150 If <option>one_time</option> is set and any addresses generated by the router fail to
35151 deliver at the first attempt, the failing addresses are added to the message as
35152 <quote>top level</quote> addresses, and the parent address that generated them is marked
35153 <quote>delivered</quote>. Thus, redirection does not happen again at the next delivery
35154 attempt.
35155 </para>
35156 <para>
35157 <emphasis role="bold">Warning 1</emphasis>: Any header line addition or removal that is specified by this
35158 router would be lost if delivery did not succeed at the first attempt. For this
35159 reason, the <option>headers_add</option> and <option>headers_remove</option> generic options are not
35160 permitted when <option>one_time</option> is set.
35161 </para>
35162 <para>
35163 <emphasis role="bold">Warning 2</emphasis>: To ensure that the router generates only addresses (as opposed
35164 to pipe or file deliveries or auto-replies) <option>forbid_file</option>, <option>forbid_pipe</option>,
35165 and <option>forbid_filter_reply</option> are forced to be true when <option>one_time</option> is set.
35166 </para>
35167 <para>
35168 <emphasis role="bold">Warning 3</emphasis>: The <option>unseen</option> generic router option may not be set with
35169 <option>one_time</option>.
35170 </para>
35171 <para>
35172 The original top-level address is remembered with each of the generated
35173 addresses, and is output in any log messages. However, any intermediate parent
35174 addresses are not recorded. This makes a difference to the log only if
35175 <option>all_parents</option> log selector is set. It is expected that <option>one_time</option> will
35176 typically be used for mailing lists, where there is normally just one level of
35177 expansion.
35178 </para>
35179 <para>
35180 <indexterm role="option">
35181 <primary><option>owners</option></primary>
35182 </indexterm>
35183 </para>
35184 <informaltable frame="all">
35185 <tgroup cols="4" colsep="0" rowsep="0">
35186 <colspec colwidth="8*" align="left"/>
35187 <colspec colwidth="6*" align="center"/>
35188 <colspec colwidth="6*" align="center"/>
35189 <colspec colwidth="6*" align="right"/>
35190 <tbody>
35191 <row>
35192 <entry><option>owners</option></entry>
35193 <entry>Use: <emphasis>redirect</emphasis></entry>
35194 <entry>Type: <emphasis>string list</emphasis></entry>
35195 <entry>Default: <emphasis>unset</emphasis></entry>
35196 </row>
35197 </tbody>
35198 </tgroup>
35199 </informaltable>
35200 <para>
35201 <indexterm role="concept">
35202 <primary>ownership</primary>
35203 <secondary>alias file</secondary>
35204 </indexterm>
35205 <indexterm role="concept">
35206 <primary>ownership</primary>
35207 <secondary>forward file</secondary>
35208 </indexterm>
35209 <indexterm role="concept">
35210 <primary>alias file</primary>
35211 <secondary>ownership</secondary>
35212 </indexterm>
35213 <indexterm role="concept">
35214 <primary>forward file</primary>
35215 <secondary>ownership</secondary>
35216 </indexterm>
35217 This specifies a list of permitted owners for the file specified by <option>file</option>.
35218 This list is in addition to the local user when <option>check_local_user</option> is set.
35219 See <option>check_owner</option> above.
35220 </para>
35221 <para>
35222 <indexterm role="option">
35223 <primary><option>owngroups</option></primary>
35224 </indexterm>
35225 </para>
35226 <informaltable frame="all">
35227 <tgroup cols="4" colsep="0" rowsep="0">
35228 <colspec colwidth="8*" align="left"/>
35229 <colspec colwidth="6*" align="center"/>
35230 <colspec colwidth="6*" align="center"/>
35231 <colspec colwidth="6*" align="right"/>
35232 <tbody>
35233 <row>
35234 <entry><option>owngroups</option></entry>
35235 <entry>Use: <emphasis>redirect</emphasis></entry>
35236 <entry>Type: <emphasis>string list</emphasis></entry>
35237 <entry>Default: <emphasis>unset</emphasis></entry>
35238 </row>
35239 </tbody>
35240 </tgroup>
35241 </informaltable>
35242 <para>
35243 This specifies a list of permitted groups for the file specified by <option>file</option>.
35244 The list is in addition to the local user&#x2019;s primary group when
35245 <option>check_local_user</option> is set. See <option>check_group</option> above.
35246 </para>
35247 <para>
35248 <indexterm role="option">
35249 <primary><option>pipe_transport</option></primary>
35250 </indexterm>
35251 </para>
35252 <informaltable frame="all">
35253 <tgroup cols="4" colsep="0" rowsep="0">
35254 <colspec colwidth="8*" align="left"/>
35255 <colspec colwidth="6*" align="center"/>
35256 <colspec colwidth="6*" align="center"/>
35257 <colspec colwidth="6*" align="right"/>
35258 <tbody>
35259 <row>
35260 <entry><option>pipe_transport</option></entry>
35261 <entry>Use: <emphasis>redirect</emphasis></entry>
35262 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35263 <entry>Default: <emphasis>unset</emphasis></entry>
35264 </row>
35265 </tbody>
35266 </tgroup>
35267 </informaltable>
35268 <para>
35269 <indexterm role="variable">
35270 <primary><varname>$address_pipe</varname></primary>
35271 </indexterm>
35272 A <command>redirect</command> router sets up a direct delivery to a pipe when a string
35273 starting with a vertical bar character is specified as a new <quote>address</quote>. The
35274 transport used is specified by this option, which, after expansion, must be the
35275 name of a configured transport. This should normally be a <command>pipe</command> transport.
35276 When the transport is run, the pipe command is in <varname>$address_pipe</varname>.
35277 </para>
35278 <para>
35279 <indexterm role="option">
35280 <primary><option>qualify_domain</option></primary>
35281 </indexterm>
35282 </para>
35283 <informaltable frame="all">
35284 <tgroup cols="4" colsep="0" rowsep="0">
35285 <colspec colwidth="8*" align="left"/>
35286 <colspec colwidth="6*" align="center"/>
35287 <colspec colwidth="6*" align="center"/>
35288 <colspec colwidth="6*" align="right"/>
35289 <tbody>
35290 <row>
35291 <entry><option>qualify_domain</option></entry>
35292 <entry>Use: <emphasis>redirect</emphasis></entry>
35293 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35294 <entry>Default: <emphasis>unset</emphasis></entry>
35295 </row>
35296 </tbody>
35297 </tgroup>
35298 </informaltable>
35299 <para>
35300 <indexterm role="variable">
35301 <primary><varname>$qualify_recipient</varname></primary>
35302 </indexterm>
35303 If this option is set, and an unqualified address (one without a domain) is
35304 generated, and that address would normally be qualified by the global setting
35305 in <option>qualify_recipient</option>, it is instead qualified with the domain specified by
35306 expanding this string. If the expansion fails, the router declines. If you want
35307 to revert to the default, you can have the expansion generate
35308 <varname>$qualify_recipient</varname>.
35309 </para>
35310 <para>
35311 This option applies to all unqualified addresses generated by Exim filters,
35312 but for traditional <filename>.forward</filename> files, it applies only to addresses that are
35313 not preceded by a backslash. Sieve filters cannot generate unqualified
35314 addresses.
35315 </para>
35316 <para>
35317 <indexterm role="option">
35318 <primary><option>qualify_preserve_domain</option></primary>
35319 </indexterm>
35320 </para>
35321 <informaltable frame="all">
35322 <tgroup cols="4" colsep="0" rowsep="0">
35323 <colspec colwidth="8*" align="left"/>
35324 <colspec colwidth="6*" align="center"/>
35325 <colspec colwidth="6*" align="center"/>
35326 <colspec colwidth="6*" align="right"/>
35327 <tbody>
35328 <row>
35329 <entry><option>qualify_preserve_domain</option></entry>
35330 <entry>Use: <emphasis>redirect</emphasis></entry>
35331 <entry>Type: <emphasis>boolean</emphasis></entry>
35332 <entry>Default: <emphasis>false</emphasis></entry>
35333 </row>
35334 </tbody>
35335 </tgroup>
35336 </informaltable>
35337 <para>
35338 <indexterm role="concept">
35339 <primary>domain</primary>
35340 <secondary>in redirection; preserving</secondary>
35341 </indexterm>
35342 <indexterm role="concept">
35343 <primary>preserving domain in redirection</primary>
35344 </indexterm>
35345 <indexterm role="concept">
35346 <primary>address redirection</primary>
35347 <secondary>domain; preserving</secondary>
35348 </indexterm>
35349 If this option is set, the router&#x2019;s local <option>qualify_domain</option> option must not be
35350 set (a configuration error occurs if it is). If an unqualified address (one
35351 without a domain) is generated, it is qualified with the domain of the parent
35352 address (the immediately preceding ancestor) instead of the global
35353 <option>qualify_recipient</option> value. In the case of a traditional <filename>.forward</filename> file,
35354 this applies whether or not the address is preceded by a backslash.
35355 </para>
35356 <para>
35357 <indexterm role="option">
35358 <primary><option>repeat_use</option></primary>
35359 </indexterm>
35360 </para>
35361 <informaltable frame="all">
35362 <tgroup cols="4" colsep="0" rowsep="0">
35363 <colspec colwidth="8*" align="left"/>
35364 <colspec colwidth="6*" align="center"/>
35365 <colspec colwidth="6*" align="center"/>
35366 <colspec colwidth="6*" align="right"/>
35367 <tbody>
35368 <row>
35369 <entry><option>repeat_use</option></entry>
35370 <entry>Use: <emphasis>redirect</emphasis></entry>
35371 <entry>Type: <emphasis>boolean</emphasis></entry>
35372 <entry>Default: <emphasis>true</emphasis></entry>
35373 </row>
35374 </tbody>
35375 </tgroup>
35376 </informaltable>
35377 <para>
35378 If this option is set false, the router is skipped for a child address that has
35379 any ancestor that was routed by this router. This test happens before any of
35380 the other preconditions are tested. Exim&#x2019;s default anti-looping rules skip
35381 only when the ancestor is the same as the current address. See also
35382 <option>check_ancestor</option> above and the generic <option>redirect_router</option> option.
35383 </para>
35384 <para>
35385 <indexterm role="option">
35386 <primary><option>reply_transport</option></primary>
35387 </indexterm>
35388 </para>
35389 <informaltable frame="all">
35390 <tgroup cols="4" colsep="0" rowsep="0">
35391 <colspec colwidth="8*" align="left"/>
35392 <colspec colwidth="6*" align="center"/>
35393 <colspec colwidth="6*" align="center"/>
35394 <colspec colwidth="6*" align="right"/>
35395 <tbody>
35396 <row>
35397 <entry><option>reply_transport</option></entry>
35398 <entry>Use: <emphasis>redirect</emphasis></entry>
35399 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35400 <entry>Default: <emphasis>unset</emphasis></entry>
35401 </row>
35402 </tbody>
35403 </tgroup>
35404 </informaltable>
35405 <para>
35406 A <command>redirect</command> router sets up an automatic reply when a <option>mail</option> or
35407 <option>vacation</option> command is used in a filter file. The transport used is specified
35408 by this option, which, after expansion, must be the name of a configured
35409 transport. This should normally be an <command>autoreply</command> transport. Other transports
35410 are unlikely to do anything sensible or useful.
35411 </para>
35412 <para>
35413 <indexterm role="option">
35414 <primary><option>rewrite</option></primary>
35415 </indexterm>
35416 </para>
35417 <informaltable frame="all">
35418 <tgroup cols="4" colsep="0" rowsep="0">
35419 <colspec colwidth="8*" align="left"/>
35420 <colspec colwidth="6*" align="center"/>
35421 <colspec colwidth="6*" align="center"/>
35422 <colspec colwidth="6*" align="right"/>
35423 <tbody>
35424 <row>
35425 <entry><option>rewrite</option></entry>
35426 <entry>Use: <emphasis>redirect</emphasis></entry>
35427 <entry>Type: <emphasis>boolean</emphasis></entry>
35428 <entry>Default: <emphasis>true</emphasis></entry>
35429 </row>
35430 </tbody>
35431 </tgroup>
35432 </informaltable>
35433 <para>
35434 <indexterm role="concept">
35435 <primary>address redirection</primary>
35436 <secondary>disabling rewriting</secondary>
35437 </indexterm>
35438 If this option is set false, addresses generated by the router are not
35439 subject to address rewriting. Otherwise, they are treated like new addresses
35440 and are rewritten according to the global rewriting rules.
35441 </para>
35442 <para>
35443 <indexterm role="option">
35444 <primary><option>sieve_subaddress</option></primary>
35445 </indexterm>
35446 </para>
35447 <informaltable frame="all">
35448 <tgroup cols="4" colsep="0" rowsep="0">
35449 <colspec colwidth="8*" align="left"/>
35450 <colspec colwidth="6*" align="center"/>
35451 <colspec colwidth="6*" align="center"/>
35452 <colspec colwidth="6*" align="right"/>
35453 <tbody>
35454 <row>
35455 <entry><option>sieve_subaddress</option></entry>
35456 <entry>Use: <emphasis>redirect</emphasis></entry>
35457 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35458 <entry>Default: <emphasis>unset</emphasis></entry>
35459 </row>
35460 </tbody>
35461 </tgroup>
35462 </informaltable>
35463 <para>
35464 The value of this option is passed to a Sieve filter to specify the
35465 :subaddress part of an address.
35466 </para>
35467 <para>
35468 <indexterm role="option">
35469 <primary><option>sieve_useraddress</option></primary>
35470 </indexterm>
35471 </para>
35472 <informaltable frame="all">
35473 <tgroup cols="4" colsep="0" rowsep="0">
35474 <colspec colwidth="8*" align="left"/>
35475 <colspec colwidth="6*" align="center"/>
35476 <colspec colwidth="6*" align="center"/>
35477 <colspec colwidth="6*" align="right"/>
35478 <tbody>
35479 <row>
35480 <entry><option>sieve_useraddress</option></entry>
35481 <entry>Use: <emphasis>redirect</emphasis></entry>
35482 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35483 <entry>Default: <emphasis>unset</emphasis></entry>
35484 </row>
35485 </tbody>
35486 </tgroup>
35487 </informaltable>
35488 <para>
35489 The value of this option is passed to a Sieve filter to specify the :user part
35490 of an address. However, if it is unset, the entire original local part
35491 (including any prefix or suffix) is used for :user.
35492 </para>
35493 <para>
35494 <indexterm role="option">
35495 <primary><option>sieve_vacation_directory</option></primary>
35496 </indexterm>
35497 </para>
35498 <informaltable frame="all">
35499 <tgroup cols="4" colsep="0" rowsep="0">
35500 <colspec colwidth="8*" align="left"/>
35501 <colspec colwidth="6*" align="center"/>
35502 <colspec colwidth="6*" align="center"/>
35503 <colspec colwidth="6*" align="right"/>
35504 <tbody>
35505 <row>
35506 <entry><option>sieve_vacation_directory</option></entry>
35507 <entry>Use: <emphasis>redirect</emphasis></entry>
35508 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35509 <entry>Default: <emphasis>unset</emphasis></entry>
35510 </row>
35511 </tbody>
35512 </tgroup>
35513 </informaltable>
35514 <para>
35515 <indexterm role="concept">
35516 <primary>Sieve filter</primary>
35517 <secondary>vacation directory</secondary>
35518 </indexterm>
35519 To enable the <quote>vacation</quote> extension for Sieve filters, you must set
35520 <option>sieve_vacation_directory</option> to the directory where vacation databases are held
35521 (do not put anything else in that directory), and ensure that the
35522 <option>reply_transport</option> option refers to an <command>autoreply</command> transport. Each user
35523 needs their own directory; Exim will create it if necessary.
35524 </para>
35525 <para>
35526 <indexterm role="option">
35527 <primary><option>skip_syntax_errors</option></primary>
35528 </indexterm>
35529 </para>
35530 <informaltable frame="all">
35531 <tgroup cols="4" colsep="0" rowsep="0">
35532 <colspec colwidth="8*" align="left"/>
35533 <colspec colwidth="6*" align="center"/>
35534 <colspec colwidth="6*" align="center"/>
35535 <colspec colwidth="6*" align="right"/>
35536 <tbody>
35537 <row>
35538 <entry><option>skip_syntax_errors</option></entry>
35539 <entry>Use: <emphasis>redirect</emphasis></entry>
35540 <entry>Type: <emphasis>boolean</emphasis></entry>
35541 <entry>Default: <emphasis>false</emphasis></entry>
35542 </row>
35543 </tbody>
35544 </tgroup>
35545 </informaltable>
35546 <para>
35547 <indexterm role="concept">
35548 <primary>forward file</primary>
35549 <secondary>broken</secondary>
35550 </indexterm>
35551 <indexterm role="concept">
35552 <primary>address redirection</primary>
35553 <secondary>broken files</secondary>
35554 </indexterm>
35555 <indexterm role="concept">
35556 <primary>alias file</primary>
35557 <secondary>broken</secondary>
35558 </indexterm>
35559 <indexterm role="concept">
35560 <primary>broken alias or forward files</primary>
35561 </indexterm>
35562 <indexterm role="concept">
35563 <primary>ignoring faulty addresses</primary>
35564 </indexterm>
35565 <indexterm role="concept">
35566 <primary>skipping faulty addresses</primary>
35567 </indexterm>
35568 <indexterm role="concept">
35569 <primary>error</primary>
35570 <secondary>skipping bad syntax</secondary>
35571 </indexterm>
35572 If <option>skip_syntax_errors</option> is set, syntactically malformed addresses in
35573 non-filter redirection data are skipped, and each failing address is logged. If
35574 <option>syntax_errors_to</option> is set, a message is sent to the address it defines,
35575 giving details of the failures. If <option>syntax_errors_text</option> is set, its contents
35576 are expanded and placed at the head of the error message generated by
35577 <option>syntax_errors_to</option>. Usually it is appropriate to set <option>syntax_errors_to</option> to
35578 be the same address as the generic <option>errors_to</option> option. The
35579 <option>skip_syntax_errors</option> option is often used when handling mailing lists.
35580 </para>
35581 <para>
35582 If all the addresses in a redirection list are skipped because of syntax
35583 errors, the router declines to handle the original address, and it is passed to
35584 the following routers.
35585 </para>
35586 <para>
35587 If <option>skip_syntax_errors</option> is set when an Exim filter is interpreted, any syntax
35588 error in the filter causes filtering to be abandoned without any action being
35589 taken. The incident is logged, and the router declines to handle the address,
35590 so it is passed to the following routers.
35591 </para>
35592 <para>
35593 <indexterm role="concept">
35594 <primary>Sieve filter</primary>
35595 <secondary>syntax errors in</secondary>
35596 </indexterm>
35597 Syntax errors in a Sieve filter file cause the <quote>keep</quote> action to occur. This
35598 action is specified by RFC 3028. The values of <option>skip_syntax_errors</option>,
35599 <option>syntax_errors_to</option>, and <option>syntax_errors_text</option> are not used.
35600 </para>
35601 <para>
35602 <option>skip_syntax_errors</option> can be used to specify that errors in users&#x2019; forward
35603 lists or filter files should not prevent delivery. The <option>syntax_errors_to</option>
35604 option, used with an address that does not get redirected, can be used to
35605 notify users of these errors, by means of a router like this:
35606 </para>
35607 <literallayout class="monospaced">
35608 userforward:
35609   driver = redirect
35610   allow_filter
35611   check_local_user
35612   file = $home/.forward
35613   file_transport = address_file
35614   pipe_transport = address_pipe
35615   reply_transport = address_reply
35616   no_verify
35617   skip_syntax_errors
35618   syntax_errors_to = real-$local_part@$domain
35619   syntax_errors_text = \
35620    This is an automatically generated message. An error has\n\
35621    been found in your .forward file. Details of the error are\n\
35622    reported below. While this error persists, you will receive\n\
35623    a copy of this message for every message that is addressed\n\
35624    to you. If your .forward file is a filter file, or if it is\n\
35625    a non-filter file containing no valid forwarding addresses,\n\
35626    a copy of each incoming message will be put in your normal\n\
35627    mailbox. If a non-filter file contains at least one valid\n\
35628    forwarding address, forwarding to the valid addresses will\n\
35629    happen, and those will be the only deliveries that occur.
35630 </literallayout>
35631 <para>
35632 You also need a router to ensure that local addresses that are prefixed by
35633 <literal>real-</literal> are recognized, but not forwarded or filtered. For example, you could
35634 put this immediately before the <command>userforward</command> router:
35635 </para>
35636 <literallayout class="monospaced">
35637 real_localuser:
35638   driver = accept
35639   check_local_user
35640   local_part_prefix = real-
35641   transport = local_delivery
35642 </literallayout>
35643 <para>
35644 For security, it would probably be a good idea to restrict the use of this
35645 router to locally-generated messages, using a condition such as this:
35646 </para>
35647 <literallayout class="monospaced">
35648   condition = ${if match {$sender_host_address}\
35649                          {\N^(|127\.0\.0\.1)$\N}}
35650 </literallayout>
35651 <para>
35652 <indexterm role="option">
35653 <primary><option>syntax_errors_text</option></primary>
35654 </indexterm>
35655 </para>
35656 <informaltable frame="all">
35657 <tgroup cols="4" colsep="0" rowsep="0">
35658 <colspec colwidth="8*" align="left"/>
35659 <colspec colwidth="6*" align="center"/>
35660 <colspec colwidth="6*" align="center"/>
35661 <colspec colwidth="6*" align="right"/>
35662 <tbody>
35663 <row>
35664 <entry><option>syntax_errors_text</option></entry>
35665 <entry>Use: <emphasis>redirect</emphasis></entry>
35666 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35667 <entry>Default: <emphasis>unset</emphasis></entry>
35668 </row>
35669 </tbody>
35670 </tgroup>
35671 </informaltable>
35672 <para>
35673 See <option>skip_syntax_errors</option> above.
35674 </para>
35675 <para>
35676 <indexterm role="option">
35677 <primary><option>syntax_errors_to</option></primary>
35678 </indexterm>
35679 </para>
35680 <informaltable frame="all">
35681 <tgroup cols="4" colsep="0" rowsep="0">
35682 <colspec colwidth="8*" align="left"/>
35683 <colspec colwidth="6*" align="center"/>
35684 <colspec colwidth="6*" align="center"/>
35685 <colspec colwidth="6*" align="right"/>
35686 <tbody>
35687 <row>
35688 <entry><option>syntax_errors_to</option></entry>
35689 <entry>Use: <emphasis>redirect</emphasis></entry>
35690 <entry>Type: <emphasis>string</emphasis></entry>
35691 <entry>Default: <emphasis>unset</emphasis></entry>
35692 </row>
35693 </tbody>
35694 </tgroup>
35695 </informaltable>
35696 <para>
35697 See <option>skip_syntax_errors</option> above.
35698 <indexterm role="concept" startref="IIDredrou1" class="endofrange"/>
35699 <indexterm role="concept" startref="IIDredrou2" class="endofrange"/>
35700 </para>
35701 </section>
35702 </chapter>
35703
35704 <chapter id="CHAPenvironment">
35705 <title>Environment for running local transports</title>
35706 <titleabbrev>Environment for local transports</titleabbrev>
35707 <para>
35708 <indexterm role="concept" id="IIDenvlotra1" class="startofrange">
35709 <primary>local transports</primary>
35710 <secondary>environment for</secondary>
35711 </indexterm>
35712 <indexterm role="concept" id="IIDenvlotra2" class="startofrange">
35713 <primary>environment for local transports</primary>
35714 </indexterm>
35715 <indexterm role="concept" id="IIDenvlotra3" class="startofrange">
35716 <primary>transport</primary>
35717 <secondary>local; environment for</secondary>
35718 </indexterm>
35719 Local transports handle deliveries to files and pipes. (The <command>autoreply</command>
35720 transport can be thought of as similar to a pipe.) Exim always runs transports
35721 in subprocesses, under specified uids and gids. Typical deliveries to local
35722 mailboxes run under the uid and gid of the local user.
35723 </para>
35724 <para>
35725 Exim also sets a specific current directory while running the transport; for
35726 some transports a home directory setting is also relevant. The <command>pipe</command>
35727 transport is the only one that sets up environment variables; see section
35728 <xref linkend="SECTpipeenv"/> for details.
35729 </para>
35730 <para>
35731 The values used for the uid, gid, and the directories may come from several
35732 different places. In many cases, the router that handles the address associates
35733 settings with that address as a result of its <option>check_local_user</option>, <option>group</option>,
35734 or <option>user</option> options. However, values may also be given in the transport&#x2019;s own
35735 configuration, and these override anything that comes from the router.
35736 </para>
35737 <section id="SECID131">
35738 <title>Concurrent deliveries</title>
35739 <para>
35740 <indexterm role="concept">
35741 <primary>concurrent deliveries</primary>
35742 </indexterm>
35743 <indexterm role="concept">
35744 <primary>simultaneous deliveries</primary>
35745 </indexterm>
35746 If two different messages for the same local recipient arrive more or less
35747 simultaneously, the two delivery processes are likely to run concurrently. When
35748 the <command>appendfile</command> transport is used to write to a file, Exim applies locking
35749 rules to stop concurrent processes from writing to the same file at the same
35750 time.
35751 </para>
35752 <para>
35753 However, when you use a <command>pipe</command> transport, it is up to you to arrange any
35754 locking that is needed. Here is a silly example:
35755 </para>
35756 <literallayout class="monospaced">
35757 my_transport:
35758   driver = pipe
35759   command = /bin/sh -c 'cat &gt;&gt;/some/file'
35760 </literallayout>
35761 <para>
35762 This is supposed to write the message at the end of the file. However, if two
35763 messages arrive at the same time, the file will be scrambled. You can use the
35764 <option>exim_lock</option> utility program (see section <xref linkend="SECTmailboxmaint"/>) to lock a
35765 file using the same algorithm that Exim itself uses.
35766 </para>
35767 </section>
35768 <section id="SECTenvuidgid">
35769 <title>Uids and gids</title>
35770 <para>
35771 <indexterm role="concept">
35772 <primary>local transports</primary>
35773 <secondary>uid and gid</secondary>
35774 </indexterm>
35775 <indexterm role="concept">
35776 <primary>transport</primary>
35777 <secondary>local; uid and gid</secondary>
35778 </indexterm>
35779 All transports have the options <option>group</option> and <option>user</option>. If <option>group</option> is set, it
35780 overrides any group that the router set in the address, even if <option>user</option> is not
35781 set for the transport. This makes it possible, for example, to run local mail
35782 delivery under the uid of the recipient (set by the router), but in a special
35783 group (set by the transport). For example:
35784 </para>
35785 <literallayout class="monospaced">
35786 # Routers ...
35787 # User/group are set by check_local_user in this router
35788 local_users:
35789   driver = accept
35790   check_local_user
35791   transport = group_delivery
35792
35793 # Transports ...
35794 # This transport overrides the group
35795 group_delivery:
35796   driver = appendfile
35797   file = /var/spool/mail/$local_part
35798   group = mail
35799 </literallayout>
35800 <para>
35801 If <option>user</option> is set for a transport, its value overrides what is set in the
35802 address by the router. If <option>user</option> is non-numeric and <option>group</option> is not set, the
35803 gid associated with the user is used. If <option>user</option> is numeric, <option>group</option> must be
35804 set.
35805 </para>
35806 <para>
35807 <indexterm role="option">
35808 <primary><option>initgroups</option></primary>
35809 </indexterm>
35810 When the uid is taken from the transport&#x2019;s configuration, the <function>initgroups()</function>
35811 function is called for the groups associated with that uid if the
35812 <option>initgroups</option> option is set for the transport. When the uid is not specified
35813 by the transport, but is associated with the address by a router, the option
35814 for calling <function>initgroups()</function> is taken from the router configuration.
35815 </para>
35816 <para>
35817 <indexterm role="concept">
35818 <primary><command>pipe</command> transport</primary>
35819 <secondary>uid for</secondary>
35820 </indexterm>
35821 The <command>pipe</command> transport contains the special option <option>pipe_as_creator</option>. If this
35822 is set and <option>user</option> is not set, the uid of the process that called Exim to
35823 receive the message is used, and if <option>group</option> is not set, the corresponding
35824 original gid is also used.
35825 </para>
35826 <para>
35827 This is the detailed preference order for obtaining a gid; the first of the
35828 following that is set is used:
35829 </para>
35830 <itemizedlist>
35831 <listitem>
35832 <para>
35833 A <option>group</option> setting of the transport;
35834 </para>
35835 </listitem>
35836 <listitem>
35837 <para>
35838 A <option>group</option> setting of the router;
35839 </para>
35840 </listitem>
35841 <listitem>
35842 <para>
35843 A gid associated with a user setting of the router, either as a result of
35844 <option>check_local_user</option> or an explicit non-numeric <option>user</option> setting;
35845 </para>
35846 </listitem>
35847 <listitem>
35848 <para>
35849 The group associated with a non-numeric <option>user</option> setting of the transport;
35850 </para>
35851 </listitem>
35852 <listitem>
35853 <para>
35854 In a <command>pipe</command> transport, the creator&#x2019;s gid if <option>deliver_as_creator</option> is set and
35855 the uid is the creator&#x2019;s uid;
35856 </para>
35857 </listitem>
35858 <listitem>
35859 <para>
35860 The Exim gid if the Exim uid is being used as a default.
35861 </para>
35862 </listitem>
35863 </itemizedlist>
35864 <para>
35865 If, for example, the user is specified numerically on the router and there are
35866 no group settings, no gid is available. In this situation, an error occurs.
35867 This is different for the uid, for which there always is an ultimate default.
35868 The first of the following that is set is used:
35869 </para>
35870 <itemizedlist>
35871 <listitem>
35872 <para>
35873 A <option>user</option> setting of the transport;
35874 </para>
35875 </listitem>
35876 <listitem>
35877 <para>
35878 In a <command>pipe</command> transport, the creator&#x2019;s uid if <option>deliver_as_creator</option> is set;
35879 </para>
35880 </listitem>
35881 <listitem>
35882 <para>
35883 A <option>user</option> setting of the router;
35884 </para>
35885 </listitem>
35886 <listitem>
35887 <para>
35888 A <option>check_local_user</option> setting of the router;
35889 </para>
35890 </listitem>
35891 <listitem>
35892 <para>
35893 The Exim uid.
35894 </para>
35895 </listitem>
35896 </itemizedlist>
35897 <para>
35898 Of course, an error will still occur if the uid that is chosen is on the
35899 <option>never_users</option> list.
35900 </para>
35901 </section>
35902 <section id="SECID132">
35903 <title>Current and home directories</title>
35904 <para>
35905 <indexterm role="concept">
35906 <primary>current directory for local transport</primary>
35907 </indexterm>
35908 <indexterm role="concept">
35909 <primary>home directory</primary>
35910 <secondary>for local transport</secondary>
35911 </indexterm>
35912 <indexterm role="concept">
35913 <primary>transport</primary>
35914 <secondary>local; home directory for</secondary>
35915 </indexterm>
35916 <indexterm role="concept">
35917 <primary>transport</primary>
35918 <secondary>local; current directory for</secondary>
35919 </indexterm>
35920 Routers may set current and home directories for local transports by means of
35921 the <option>transport_current_directory</option> and <option>transport_home_directory</option> options.
35922 However, if the transport&#x2019;s <option>current_directory</option> or <option>home_directory</option> options
35923 are set, they override the router&#x2019;s values. In detail, the home directory
35924 for a local transport is taken from the first of these values that is set:
35925 </para>
35926 <itemizedlist>
35927 <listitem>
35928 <para>
35929 The <option>home_directory</option> option on the transport;
35930 </para>
35931 </listitem>
35932 <listitem>
35933 <para>
35934 The <option>transport_home_directory</option> option on the router;
35935 </para>
35936 </listitem>
35937 <listitem>
35938 <para>
35939 The password data if <option>check_local_user</option> is set on the router;
35940 </para>
35941 </listitem>
35942 <listitem>
35943 <para>
35944 The <option>router_home_directory</option> option on the router.
35945 </para>
35946 </listitem>
35947 </itemizedlist>
35948 <para>
35949 The current directory is taken from the first of these values that is set:
35950 </para>
35951 <itemizedlist>
35952 <listitem>
35953 <para>
35954 The <option>current_directory</option> option on the transport;
35955 </para>
35956 </listitem>
35957 <listitem>
35958 <para>
35959 The <option>transport_current_directory</option> option on the router.
35960 </para>
35961 </listitem>
35962 </itemizedlist>
35963 <para>
35964 If neither the router nor the transport sets a current directory, Exim uses the
35965 value of the home directory, if it is set. Otherwise it sets the current
35966 directory to <filename>/</filename> before running a local transport.
35967 </para>
35968 </section>
35969 <section id="SECID133">
35970 <title>Expansion variables derived from the address</title>
35971 <para>
35972 <indexterm role="variable">
35973 <primary><varname>$domain</varname></primary>
35974 </indexterm>
35975 <indexterm role="variable">
35976 <primary><varname>$local_part</varname></primary>
35977 </indexterm>
35978 <indexterm role="variable">
35979 <primary><varname>$original_domain</varname></primary>
35980 </indexterm>
35981 Normally a local delivery is handling a single address, and in that case the
35982 variables such as <varname>$domain</varname> and <varname>$local_part</varname> are set during local
35983 deliveries. However, in some circumstances more than one address may be handled
35984 at once (for example, while writing batch SMTP for onward transmission by some
35985 other means). In this case, the variables associated with the local part are
35986 never set, <varname>$domain</varname> is set only if all the addresses have the same domain,
35987 and <varname>$original_domain</varname> is never set.
35988 <indexterm role="concept" startref="IIDenvlotra1" class="endofrange"/>
35989 <indexterm role="concept" startref="IIDenvlotra2" class="endofrange"/>
35990 <indexterm role="concept" startref="IIDenvlotra3" class="endofrange"/>
35991 </para>
35992 </section>
35993 </chapter>
35994
35995 <chapter id="CHAPtransportgeneric">
35996 <title>Generic options for transports</title>
35997 <para>
35998 <indexterm role="concept" id="IIDgenoptra1" class="startofrange">
35999 <primary>generic options</primary>
36000 <secondary>transport</secondary>
36001 </indexterm>
36002 <indexterm role="concept" id="IIDgenoptra2" class="startofrange">
36003 <primary>options</primary>
36004 <secondary>generic; for transports</secondary>
36005 </indexterm>
36006 <indexterm role="concept" id="IIDgenoptra3" class="startofrange">
36007 <primary>transport</primary>
36008 <secondary>generic options for</secondary>
36009 </indexterm>
36010 The following generic options apply to all transports:
36011 </para>
36012 <para>
36013 <indexterm role="option">
36014 <primary><option>body_only</option></primary>
36015 </indexterm>
36016 </para>
36017 <informaltable frame="all">
36018 <tgroup cols="4" colsep="0" rowsep="0">
36019 <colspec colwidth="8*" align="left"/>
36020 <colspec colwidth="6*" align="center"/>
36021 <colspec colwidth="6*" align="center"/>
36022 <colspec colwidth="6*" align="right"/>
36023 <tbody>
36024 <row>
36025 <entry><option>body_only</option></entry>
36026 <entry>Use: <emphasis>transports</emphasis></entry>
36027 <entry>Type: <emphasis>boolean</emphasis></entry>
36028 <entry>Default: <emphasis>false</emphasis></entry>
36029 </row>
36030 </tbody>
36031 </tgroup>
36032 </informaltable>
36033 <para>
36034 <indexterm role="concept">
36035 <primary>transport</primary>
36036 <secondary>body only</secondary>
36037 </indexterm>
36038 <indexterm role="concept">
36039 <primary>message</primary>
36040 <secondary>transporting body only</secondary>
36041 </indexterm>
36042 <indexterm role="concept">
36043 <primary>body of message</primary>
36044 <secondary>transporting</secondary>
36045 </indexterm>
36046 If this option is set, the message&#x2019;s headers are not transported. It is
36047 mutually exclusive with <option>headers_only</option>. If it is used with the <command>appendfile</command>
36048 or <command>pipe</command> transports, the settings of <option>message_prefix</option> and
36049 <option>message_suffix</option> should be checked, because this option does not
36050 automatically suppress them.
36051 </para>
36052 <para>
36053 <indexterm role="option">
36054 <primary><option>current_directory</option></primary>
36055 </indexterm>
36056 </para>
36057 <informaltable frame="all">
36058 <tgroup cols="4" colsep="0" rowsep="0">
36059 <colspec colwidth="8*" align="left"/>
36060 <colspec colwidth="6*" align="center"/>
36061 <colspec colwidth="6*" align="center"/>
36062 <colspec colwidth="6*" align="right"/>
36063 <tbody>
36064 <row>
36065 <entry><option>current_directory</option></entry>
36066 <entry>Use: <emphasis>transports</emphasis></entry>
36067 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36068 <entry>Default: <emphasis>unset</emphasis></entry>
36069 </row>
36070 </tbody>
36071 </tgroup>
36072 </informaltable>
36073 <para>
36074 <indexterm role="concept">
36075 <primary>transport</primary>
36076 <secondary>current directory for</secondary>
36077 </indexterm>
36078 This specifies the current directory that is to be set while running the
36079 transport, overriding any value that may have been set by the router.
36080 If the expansion fails for any reason, including forced failure, an error is
36081 logged, and delivery is deferred.
36082 </para>
36083 <para>
36084 <indexterm role="option">
36085 <primary><option>disable_logging</option></primary>
36086 </indexterm>
36087 </para>
36088 <informaltable frame="all">
36089 <tgroup cols="4" colsep="0" rowsep="0">
36090 <colspec colwidth="8*" align="left"/>
36091 <colspec colwidth="6*" align="center"/>
36092 <colspec colwidth="6*" align="center"/>
36093 <colspec colwidth="6*" align="right"/>
36094 <tbody>
36095 <row>
36096 <entry><option>disable_logging</option></entry>
36097 <entry>Use: <emphasis>transports</emphasis></entry>
36098 <entry>Type: <emphasis>boolean</emphasis></entry>
36099 <entry>Default: <emphasis>false</emphasis></entry>
36100 </row>
36101 </tbody>
36102 </tgroup>
36103 </informaltable>
36104 <para>
36105 If this option is set true, nothing is logged for any
36106 deliveries by the transport or for any
36107 transport errors. You should not set this option unless you really, really know
36108 what you are doing.
36109 </para>
36110 <para>
36111 <indexterm role="option">
36112 <primary><option>debug_print</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>debug_print</option></entry>
36124 <entry>Use: <emphasis>transports</emphasis></entry>
36125 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36126 <entry>Default: <emphasis>unset</emphasis></entry>
36127 </row>
36128 </tbody>
36129 </tgroup>
36130 </informaltable>
36131 <para>
36132 <indexterm role="concept">
36133 <primary>testing</primary>
36134 <secondary>variables in drivers</secondary>
36135 </indexterm>
36136 If this option is set and debugging is enabled (see the <option>-d</option> command line
36137 option), the string is expanded and included in the debugging output when the
36138 transport is run.
36139 If expansion of the string fails, the error message is written to the debugging
36140 output, and Exim carries on processing.
36141 This facility is provided to help with checking out the values of variables and
36142 so on when debugging driver configurations. For example, if a <option>headers_add</option>
36143 option is not working properly, <option>debug_print</option> could be used to output the
36144 variables it references. A newline is added to the text if it does not end with
36145 one.
36146 </para>
36147 <para>
36148 <indexterm role="option">
36149 <primary><option>delivery_date_add</option></primary>
36150 </indexterm>
36151 </para>
36152 <informaltable frame="all">
36153 <tgroup cols="4" colsep="0" rowsep="0">
36154 <colspec colwidth="8*" align="left"/>
36155 <colspec colwidth="6*" align="center"/>
36156 <colspec colwidth="6*" align="center"/>
36157 <colspec colwidth="6*" align="right"/>
36158 <tbody>
36159 <row>
36160 <entry><option>delivery_date_add</option></entry>
36161 <entry>Use: <emphasis>transports</emphasis></entry>
36162 <entry>Type: <emphasis>boolean</emphasis></entry>
36163 <entry>Default: <emphasis>false</emphasis></entry>
36164 </row>
36165 </tbody>
36166 </tgroup>
36167 </informaltable>
36168 <para>
36169 <indexterm role="concept">
36170 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
36171 </indexterm>
36172 If this option is true, a <emphasis>Delivery-date:</emphasis> header is added to the message.
36173 This gives the actual time the delivery was made. As this is not a standard
36174 header, Exim has a configuration option (<option>delivery_date_remove</option>) which
36175 requests its removal from incoming messages, so that delivered messages can
36176 safely be resent to other recipients.
36177 </para>
36178 <para>
36179 <indexterm role="option">
36180 <primary><option>driver</option></primary>
36181 </indexterm>
36182 </para>
36183 <informaltable frame="all">
36184 <tgroup cols="4" colsep="0" rowsep="0">
36185 <colspec colwidth="8*" align="left"/>
36186 <colspec colwidth="6*" align="center"/>
36187 <colspec colwidth="6*" align="center"/>
36188 <colspec colwidth="6*" align="right"/>
36189 <tbody>
36190 <row>
36191 <entry><option>driver</option></entry>
36192 <entry>Use: <emphasis>transports</emphasis></entry>
36193 <entry>Type: <emphasis>string</emphasis></entry>
36194 <entry>Default: <emphasis>unset</emphasis></entry>
36195 </row>
36196 </tbody>
36197 </tgroup>
36198 </informaltable>
36199 <para>
36200 This specifies which of the available transport drivers is to be used.
36201 There is no default, and this option must be set for every transport.
36202 </para>
36203 <para>
36204 <indexterm role="option">
36205 <primary><option>envelope_to_add</option></primary>
36206 </indexterm>
36207 </para>
36208 <informaltable frame="all">
36209 <tgroup cols="4" colsep="0" rowsep="0">
36210 <colspec colwidth="8*" align="left"/>
36211 <colspec colwidth="6*" align="center"/>
36212 <colspec colwidth="6*" align="center"/>
36213 <colspec colwidth="6*" align="right"/>
36214 <tbody>
36215 <row>
36216 <entry><option>envelope_to_add</option></entry>
36217 <entry>Use: <emphasis>transports</emphasis></entry>
36218 <entry>Type: <emphasis>boolean</emphasis></entry>
36219 <entry>Default: <emphasis>false</emphasis></entry>
36220 </row>
36221 </tbody>
36222 </tgroup>
36223 </informaltable>
36224 <para>
36225 <indexterm role="concept">
36226 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
36227 </indexterm>
36228 If this option is true, an <emphasis>Envelope-to:</emphasis> header is added to the message.
36229 This gives the original address(es) in the incoming envelope that caused this
36230 delivery to happen. More than one address may be present if the transport is
36231 configured to handle several addresses at once, or if more than one original
36232 address was redirected to the same final address. As this is not a standard
36233 header, Exim has a configuration option (<option>envelope_to_remove</option>) which requests
36234 its removal from incoming messages, so that delivered messages can safely be
36235 resent to other recipients.
36236 </para>
36237 <para>
36238 <indexterm role="option">
36239 <primary><option>group</option></primary>
36240 </indexterm>
36241 </para>
36242 <informaltable frame="all">
36243 <tgroup cols="4" colsep="0" rowsep="0">
36244 <colspec colwidth="8*" align="left"/>
36245 <colspec colwidth="6*" align="center"/>
36246 <colspec colwidth="6*" align="center"/>
36247 <colspec colwidth="6*" align="right"/>
36248 <tbody>
36249 <row>
36250 <entry><option>group</option></entry>
36251 <entry>Use: <emphasis>transports</emphasis></entry>
36252 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36253 <entry>Default: <emphasis>Exim group</emphasis></entry>
36254 </row>
36255 </tbody>
36256 </tgroup>
36257 </informaltable>
36258 <para>
36259 <indexterm role="concept">
36260 <primary>transport</primary>
36261 <secondary>group; specifying</secondary>
36262 </indexterm>
36263 This option specifies a gid for running the transport process, overriding any
36264 value that the router supplies, and also overriding any value associated with
36265 <option>user</option> (see below).
36266 </para>
36267 <para>
36268 <indexterm role="option">
36269 <primary><option>headers_add</option></primary>
36270 </indexterm>
36271 </para>
36272 <informaltable frame="all">
36273 <tgroup cols="4" colsep="0" rowsep="0">
36274 <colspec colwidth="8*" align="left"/>
36275 <colspec colwidth="6*" align="center"/>
36276 <colspec colwidth="6*" align="center"/>
36277 <colspec colwidth="6*" align="right"/>
36278 <tbody>
36279 <row>
36280 <entry><option>headers_add</option></entry>
36281 <entry>Use: <emphasis>transports</emphasis></entry>
36282 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36283 <entry>Default: <emphasis>unset</emphasis></entry>
36284 </row>
36285 </tbody>
36286 </tgroup>
36287 </informaltable>
36288 <para>
36289 <indexterm role="concept">
36290 <primary>header lines</primary>
36291 <secondary>adding in transport</secondary>
36292 </indexterm>
36293 <indexterm role="concept">
36294 <primary>transport</primary>
36295 <secondary>header lines; adding</secondary>
36296 </indexterm>
36297 This option specifies a string of text that is expanded and added to the header
36298 portion of a message as it is transported, as described in section
36299 <xref linkend="SECTheadersaddrem"/>. Additional header lines can also be specified by
36300 routers. If the result of the expansion is an empty string, or if the expansion
36301 is forced to fail, no action is taken. Other expansion failures are treated as
36302 errors and cause the delivery to be deferred.
36303 </para>
36304 <para>
36305 <indexterm role="option">
36306 <primary><option>headers_only</option></primary>
36307 </indexterm>
36308 </para>
36309 <informaltable frame="all">
36310 <tgroup cols="4" colsep="0" rowsep="0">
36311 <colspec colwidth="8*" align="left"/>
36312 <colspec colwidth="6*" align="center"/>
36313 <colspec colwidth="6*" align="center"/>
36314 <colspec colwidth="6*" align="right"/>
36315 <tbody>
36316 <row>
36317 <entry><option>headers_only</option></entry>
36318 <entry>Use: <emphasis>transports</emphasis></entry>
36319 <entry>Type: <emphasis>boolean</emphasis></entry>
36320 <entry>Default: <emphasis>false</emphasis></entry>
36321 </row>
36322 </tbody>
36323 </tgroup>
36324 </informaltable>
36325 <para>
36326 <indexterm role="concept">
36327 <primary>transport</primary>
36328 <secondary>header lines only</secondary>
36329 </indexterm>
36330 <indexterm role="concept">
36331 <primary>message</primary>
36332 <secondary>transporting headers only</secondary>
36333 </indexterm>
36334 <indexterm role="concept">
36335 <primary>header lines</primary>
36336 <secondary>transporting</secondary>
36337 </indexterm>
36338 If this option is set, the message&#x2019;s body is not transported. It is mutually
36339 exclusive with <option>body_only</option>. If it is used with the <command>appendfile</command> or <command>pipe</command>
36340 transports, the settings of <option>message_prefix</option> and <option>message_suffix</option> should be
36341 checked, since this option does not automatically suppress them.
36342 </para>
36343 <para>
36344 <indexterm role="option">
36345 <primary><option>headers_remove</option></primary>
36346 </indexterm>
36347 </para>
36348 <informaltable frame="all">
36349 <tgroup cols="4" colsep="0" rowsep="0">
36350 <colspec colwidth="8*" align="left"/>
36351 <colspec colwidth="6*" align="center"/>
36352 <colspec colwidth="6*" align="center"/>
36353 <colspec colwidth="6*" align="right"/>
36354 <tbody>
36355 <row>
36356 <entry><option>headers_remove</option></entry>
36357 <entry>Use: <emphasis>transports</emphasis></entry>
36358 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36359 <entry>Default: <emphasis>unset</emphasis></entry>
36360 </row>
36361 </tbody>
36362 </tgroup>
36363 </informaltable>
36364 <para>
36365 <indexterm role="concept">
36366 <primary>header lines</primary>
36367 <secondary>removing</secondary>
36368 </indexterm>
36369 <indexterm role="concept">
36370 <primary>transport</primary>
36371 <secondary>header lines; removing</secondary>
36372 </indexterm>
36373 This option specifies a string that is expanded into a list of header names;
36374 these headers are omitted from the message as it is transported, as described
36375 in section <xref linkend="SECTheadersaddrem"/>. Header removal can also be specified by
36376 routers. If the result of the expansion is an empty string, or if the expansion
36377 is forced to fail, no action is taken. Other expansion failures are treated as
36378 errors and cause the delivery to be deferred.
36379 </para>
36380 <para>
36381 <indexterm role="option">
36382 <primary><option>headers_rewrite</option></primary>
36383 </indexterm>
36384 </para>
36385 <informaltable frame="all">
36386 <tgroup cols="4" colsep="0" rowsep="0">
36387 <colspec colwidth="8*" align="left"/>
36388 <colspec colwidth="6*" align="center"/>
36389 <colspec colwidth="6*" align="center"/>
36390 <colspec colwidth="6*" align="right"/>
36391 <tbody>
36392 <row>
36393 <entry><option>headers_rewrite</option></entry>
36394 <entry>Use: <emphasis>transports</emphasis></entry>
36395 <entry>Type: <emphasis>string</emphasis></entry>
36396 <entry>Default: <emphasis>unset</emphasis></entry>
36397 </row>
36398 </tbody>
36399 </tgroup>
36400 </informaltable>
36401 <para>
36402 <indexterm role="concept">
36403 <primary>transport</primary>
36404 <secondary>header lines; rewriting</secondary>
36405 </indexterm>
36406 <indexterm role="concept">
36407 <primary>rewriting</primary>
36408 <secondary>at transport time</secondary>
36409 </indexterm>
36410 This option allows addresses in header lines to be rewritten at transport time,
36411 that is, as the message is being copied to its destination. The contents of the
36412 option are a colon-separated list of rewriting rules. Each rule is in exactly
36413 the same form as one of the general rewriting rules that are applied when a
36414 message is received. These are described in chapter <xref linkend="CHAPrewrite"/>. For
36415 example,
36416 </para>
36417 <literallayout class="monospaced">
36418 headers_rewrite = a@b c@d f : \
36419                   x@y w@z
36420 </literallayout>
36421 <para>
36422 changes <emphasis>a@b</emphasis> into <emphasis>c@d</emphasis> in <emphasis>From:</emphasis> header lines, and <emphasis>x@y</emphasis> into
36423 <emphasis>w@z</emphasis> in all address-bearing header lines. The rules are applied to the
36424 header lines just before they are written out at transport time, so they affect
36425 only those copies of the message that pass through the transport. However, only
36426 the message&#x2019;s original header lines, and any that were added by a system
36427 filter, are rewritten. If a router or transport adds header lines, they are not
36428 affected by this option. These rewriting rules are <emphasis>not</emphasis> applied to the
36429 envelope. You can change the return path using <option>return_path</option>, but you cannot
36430 change envelope recipients at this time.
36431 </para>
36432 <para>
36433 <indexterm role="option">
36434 <primary><option>home_directory</option></primary>
36435 </indexterm>
36436 </para>
36437 <informaltable frame="all">
36438 <tgroup cols="4" colsep="0" rowsep="0">
36439 <colspec colwidth="8*" align="left"/>
36440 <colspec colwidth="6*" align="center"/>
36441 <colspec colwidth="6*" align="center"/>
36442 <colspec colwidth="6*" align="right"/>
36443 <tbody>
36444 <row>
36445 <entry><option>home_directory</option></entry>
36446 <entry>Use: <emphasis>transports</emphasis></entry>
36447 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36448 <entry>Default: <emphasis>unset</emphasis></entry>
36449 </row>
36450 </tbody>
36451 </tgroup>
36452 </informaltable>
36453 <para>
36454 <indexterm role="concept">
36455 <primary>transport</primary>
36456 <secondary>home directory for</secondary>
36457 </indexterm>
36458 <indexterm role="variable">
36459 <primary><varname>$home</varname></primary>
36460 </indexterm>
36461 This option specifies a home directory setting for a local transport,
36462 overriding any value that may be set by the router. The home directory is
36463 placed in <varname>$home</varname> while expanding the transport&#x2019;s private options. It is also
36464 used as the current directory if no current directory is set by the
36465 <option>current_directory</option> option on the transport or the
36466 <option>transport_current_directory</option> option on the router. If the expansion fails
36467 for any reason, including forced failure, an error is logged, and delivery is
36468 deferred.
36469 </para>
36470 <para>
36471 <indexterm role="option">
36472 <primary><option>initgroups</option></primary>
36473 </indexterm>
36474 </para>
36475 <informaltable frame="all">
36476 <tgroup cols="4" colsep="0" rowsep="0">
36477 <colspec colwidth="8*" align="left"/>
36478 <colspec colwidth="6*" align="center"/>
36479 <colspec colwidth="6*" align="center"/>
36480 <colspec colwidth="6*" align="right"/>
36481 <tbody>
36482 <row>
36483 <entry><option>initgroups</option></entry>
36484 <entry>Use: <emphasis>transports</emphasis></entry>
36485 <entry>Type: <emphasis>boolean</emphasis></entry>
36486 <entry>Default: <emphasis>false</emphasis></entry>
36487 </row>
36488 </tbody>
36489 </tgroup>
36490 </informaltable>
36491 <para>
36492 <indexterm role="concept">
36493 <primary>additional groups</primary>
36494 </indexterm>
36495 <indexterm role="concept">
36496 <primary>groups</primary>
36497 <secondary>additional</secondary>
36498 </indexterm>
36499 <indexterm role="concept">
36500 <primary>transport</primary>
36501 <secondary>group; additional</secondary>
36502 </indexterm>
36503 If this option is true and the uid for the delivery process is provided by the
36504 transport, the <function>initgroups()</function> function is called when running the transport
36505 to ensure that any additional groups associated with the uid are set up.
36506 </para>
36507 <para>
36508 <indexterm role="option">
36509 <primary><option>message_size_limit</option></primary>
36510 </indexterm>
36511 </para>
36512 <informaltable frame="all">
36513 <tgroup cols="4" colsep="0" rowsep="0">
36514 <colspec colwidth="8*" align="left"/>
36515 <colspec colwidth="6*" align="center"/>
36516 <colspec colwidth="6*" align="center"/>
36517 <colspec colwidth="6*" align="right"/>
36518 <tbody>
36519 <row>
36520 <entry><option>message_size_limit</option></entry>
36521 <entry>Use: <emphasis>transports</emphasis></entry>
36522 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36523 <entry>Default: <emphasis>0</emphasis></entry>
36524 </row>
36525 </tbody>
36526 </tgroup>
36527 </informaltable>
36528 <para>
36529 <indexterm role="concept">
36530 <primary>limit</primary>
36531 <secondary>message size per transport</secondary>
36532 </indexterm>
36533 <indexterm role="concept">
36534 <primary>size</primary>
36535 <secondary>of message, limit</secondary>
36536 </indexterm>
36537 <indexterm role="concept">
36538 <primary>transport</primary>
36539 <secondary>message size; limiting</secondary>
36540 </indexterm>
36541 This option controls the size of messages passed through the transport. It is
36542 expanded before use; the result of the expansion must be a sequence of decimal
36543 digits, optionally followed by K or M. If the expansion fails for any reason,
36544 including forced failure, or if the result is not of the required form,
36545 delivery is deferred. If the value is greater than zero and the size of a
36546 message exceeds this limit, the address is failed. If there is any chance that
36547 the resulting bounce message could be routed to the same transport, you should
36548 ensure that <option>return_size_limit</option> is less than the transport&#x2019;s
36549 <option>message_size_limit</option>, as otherwise the bounce message will fail to get
36550 delivered.
36551 </para>
36552 <para>
36553 <indexterm role="option">
36554 <primary><option>rcpt_include_affixes</option></primary>
36555 </indexterm>
36556 </para>
36557 <informaltable frame="all">
36558 <tgroup cols="4" colsep="0" rowsep="0">
36559 <colspec colwidth="8*" align="left"/>
36560 <colspec colwidth="6*" align="center"/>
36561 <colspec colwidth="6*" align="center"/>
36562 <colspec colwidth="6*" align="right"/>
36563 <tbody>
36564 <row>
36565 <entry><option>rcpt_include_affixes</option></entry>
36566 <entry>Use: <emphasis>transports</emphasis></entry>
36567 <entry>Type: <emphasis>boolean</emphasis></entry>
36568 <entry>Default: <emphasis>false</emphasis></entry>
36569 </row>
36570 </tbody>
36571 </tgroup>
36572 </informaltable>
36573 <para>
36574 <indexterm role="concept">
36575 <primary>prefix</primary>
36576 <secondary>for local part, including in envelope</secondary>
36577 </indexterm>
36578 <indexterm role="concept">
36579 <primary>suffix for local part</primary>
36580 <secondary>including in envelope</secondary>
36581 </indexterm>
36582 <indexterm role="concept">
36583 <primary>local part</primary>
36584 <secondary>prefix</secondary>
36585 </indexterm>
36586 <indexterm role="concept">
36587 <primary>local part</primary>
36588 <secondary>suffix</secondary>
36589 </indexterm>
36590 When this option is false (the default), and an address that has had any
36591 affixes (prefixes or suffixes) removed from the local part is delivered by any
36592 form of SMTP or LMTP, the affixes are not included. For example, if a router
36593 that contains
36594 </para>
36595 <literallayout class="monospaced">
36596 local_part_prefix = *-
36597 </literallayout>
36598 <para>
36599 routes the address <emphasis>abc-xyz@some.domain</emphasis> to an SMTP transport, the envelope
36600 is delivered with
36601 </para>
36602 <literallayout class="monospaced">
36603 RCPT TO:&lt;xyz@some.domain&gt;
36604 </literallayout>
36605 <para>
36606 This is also the case when an ACL-time callout is being used to verify a
36607 recipient address. However, if <option>rcpt_include_affixes</option> is set true, the
36608 whole local part is included in the RCPT command. This option applies to BSMTP
36609 deliveries by the <command>appendfile</command> and <command>pipe</command> transports as well as to the
36610 <command>lmtp</command> and <command>smtp</command> transports.
36611 </para>
36612 <para>
36613 <indexterm role="option">
36614 <primary><option>retry_use_local_part</option></primary>
36615 </indexterm>
36616 </para>
36617 <informaltable frame="all">
36618 <tgroup cols="4" colsep="0" rowsep="0">
36619 <colspec colwidth="8*" align="left"/>
36620 <colspec colwidth="6*" align="center"/>
36621 <colspec colwidth="6*" align="center"/>
36622 <colspec colwidth="6*" align="right"/>
36623 <tbody>
36624 <row>
36625 <entry><option>retry_use_local_part</option></entry>
36626 <entry>Use: <emphasis>transports</emphasis></entry>
36627 <entry>Type: <emphasis>boolean</emphasis></entry>
36628 <entry>Default: <emphasis>see below</emphasis></entry>
36629 </row>
36630 </tbody>
36631 </tgroup>
36632 </informaltable>
36633 <para>
36634 <indexterm role="concept">
36635 <primary>hints database</primary>
36636 <secondary>retry keys</secondary>
36637 </indexterm>
36638 When a delivery suffers a temporary failure, a retry record is created
36639 in Exim&#x2019;s hints database. For remote deliveries, the key for the retry record
36640 is based on the name and/or IP address of the failing remote host. For local
36641 deliveries, the key is normally the entire address, including both the local
36642 part and the domain. This is suitable for most common cases of local delivery
36643 temporary failure &ndash; for example, exceeding a mailbox quota should delay only
36644 deliveries to that mailbox, not to the whole domain.
36645 </para>
36646 <para>
36647 However, in some special cases you may want to treat a temporary local delivery
36648 as a failure associated with the domain, and not with a particular local part.
36649 (For example, if you are storing all mail for some domain in files.) You can do
36650 this by setting <option>retry_use_local_part</option> false.
36651 </para>
36652 <para>
36653 For all the local transports, its default value is true. For remote transports,
36654 the default value is false for tidiness, but changing the value has no effect
36655 on a remote transport in the current implementation.
36656 </para>
36657 <para>
36658 <indexterm role="option">
36659 <primary><option>return_path</option></primary>
36660 </indexterm>
36661 </para>
36662 <informaltable frame="all">
36663 <tgroup cols="4" colsep="0" rowsep="0">
36664 <colspec colwidth="8*" align="left"/>
36665 <colspec colwidth="6*" align="center"/>
36666 <colspec colwidth="6*" align="center"/>
36667 <colspec colwidth="6*" align="right"/>
36668 <tbody>
36669 <row>
36670 <entry><option>return_path</option></entry>
36671 <entry>Use: <emphasis>transports</emphasis></entry>
36672 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36673 <entry>Default: <emphasis>unset</emphasis></entry>
36674 </row>
36675 </tbody>
36676 </tgroup>
36677 </informaltable>
36678 <para>
36679 <indexterm role="concept">
36680 <primary>envelope sender</primary>
36681 </indexterm>
36682 <indexterm role="concept">
36683 <primary>transport</primary>
36684 <secondary>return path; changing</secondary>
36685 </indexterm>
36686 <indexterm role="concept">
36687 <primary>return path</primary>
36688 <secondary>changing in transport</secondary>
36689 </indexterm>
36690 If this option is set, the string is expanded at transport time and replaces
36691 the existing return path (envelope sender) value in the copy of the message
36692 that is being delivered. An empty return path is permitted. This feature is
36693 designed for remote deliveries, where the value of this option is used in the
36694 SMTP MAIL command. If you set <option>return_path</option> for a local transport, the
36695 only effect is to change the address that is placed in the <emphasis>Return-path:</emphasis>
36696 header line, if one is added to the message (see the next option).
36697 </para>
36698 <para>
36699 <emphasis role="bold">Note:</emphasis> A changed return path is not logged unless you add
36700 <option>return_path_on_delivery</option> to the log selector.
36701 </para>
36702 <para>
36703 <indexterm role="variable">
36704 <primary><varname>$return_path</varname></primary>
36705 </indexterm>
36706 The expansion can refer to the existing value via <varname>$return_path</varname>. This is
36707 either the message&#x2019;s envelope sender, or an address set by the
36708 <option>errors_to</option> option on a router. If the expansion is forced to fail, no
36709 replacement occurs; if it fails for another reason, delivery is deferred. This
36710 option can be used to support VERP (Variable Envelope Return Paths) &ndash; see
36711 section <xref linkend="SECTverp"/>.
36712 </para>
36713 <para>
36714 <emphasis role="bold">Note</emphasis>: If a delivery error is detected locally, including the case when a
36715 remote server rejects a message at SMTP time, the bounce message is not sent to
36716 the value of this option. It is sent to the previously set errors address.
36717 This defaults to the incoming sender address, but can be changed by setting
36718 <option>errors_to</option> in a router.
36719 </para>
36720 <para>
36721 <indexterm role="option">
36722 <primary><option>return_path_add</option></primary>
36723 </indexterm>
36724 </para>
36725 <informaltable frame="all">
36726 <tgroup cols="4" colsep="0" rowsep="0">
36727 <colspec colwidth="8*" align="left"/>
36728 <colspec colwidth="6*" align="center"/>
36729 <colspec colwidth="6*" align="center"/>
36730 <colspec colwidth="6*" align="right"/>
36731 <tbody>
36732 <row>
36733 <entry><option>return_path_add</option></entry>
36734 <entry>Use: <emphasis>transports</emphasis></entry>
36735 <entry>Type: <emphasis>boolean</emphasis></entry>
36736 <entry>Default: <emphasis>false</emphasis></entry>
36737 </row>
36738 </tbody>
36739 </tgroup>
36740 </informaltable>
36741 <para>
36742 <indexterm role="concept">
36743 <primary><emphasis>Return-path:</emphasis> header line</primary>
36744 </indexterm>
36745 If this option is true, a <emphasis>Return-path:</emphasis> header is added to the message.
36746 Although the return path is normally available in the prefix line of BSD
36747 mailboxes, this is commonly not displayed by MUAs, and so the user does not
36748 have easy access to it.
36749 </para>
36750 <para>
36751 RFC 2821 states that the <emphasis>Return-path:</emphasis> header is added to a message <quote>when
36752 the delivery SMTP server makes the final delivery</quote>. This implies that this
36753 header should not be present in incoming messages. Exim has a configuration
36754 option, <option>return_path_remove</option>, which requests removal of this header from
36755 incoming messages, so that delivered messages can safely be resent to other
36756 recipients.
36757 </para>
36758 <para>
36759 <indexterm role="option">
36760 <primary><option>shadow_condition</option></primary>
36761 </indexterm>
36762 </para>
36763 <informaltable frame="all">
36764 <tgroup cols="4" colsep="0" rowsep="0">
36765 <colspec colwidth="8*" align="left"/>
36766 <colspec colwidth="6*" align="center"/>
36767 <colspec colwidth="6*" align="center"/>
36768 <colspec colwidth="6*" align="right"/>
36769 <tbody>
36770 <row>
36771 <entry><option>shadow_condition</option></entry>
36772 <entry>Use: <emphasis>transports</emphasis></entry>
36773 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36774 <entry>Default: <emphasis>unset</emphasis></entry>
36775 </row>
36776 </tbody>
36777 </tgroup>
36778 </informaltable>
36779 <para>
36780 See <option>shadow_transport</option> below.
36781 </para>
36782 <para>
36783 <indexterm role="option">
36784 <primary><option>shadow_transport</option></primary>
36785 </indexterm>
36786 </para>
36787 <informaltable frame="all">
36788 <tgroup cols="4" colsep="0" rowsep="0">
36789 <colspec colwidth="8*" align="left"/>
36790 <colspec colwidth="6*" align="center"/>
36791 <colspec colwidth="6*" align="center"/>
36792 <colspec colwidth="6*" align="right"/>
36793 <tbody>
36794 <row>
36795 <entry><option>shadow_transport</option></entry>
36796 <entry>Use: <emphasis>transports</emphasis></entry>
36797 <entry>Type: <emphasis>string</emphasis></entry>
36798 <entry>Default: <emphasis>unset</emphasis></entry>
36799 </row>
36800 </tbody>
36801 </tgroup>
36802 </informaltable>
36803 <para>
36804 <indexterm role="concept">
36805 <primary>shadow transport</primary>
36806 </indexterm>
36807 <indexterm role="concept">
36808 <primary>transport</primary>
36809 <secondary>shadow</secondary>
36810 </indexterm>
36811 A local transport may set the <option>shadow_transport</option> option to the name of
36812 another local transport. Shadow remote transports are not supported.
36813 </para>
36814 <para>
36815 Whenever a delivery to the main transport succeeds, and either
36816 <option>shadow_condition</option> is unset, or its expansion does not result in the empty
36817 string or one of the strings <quote>0</quote> or <quote>no</quote> or <quote>false</quote>, the message is also
36818 passed to the shadow transport, with the same delivery address or addresses. If
36819 expansion fails, no action is taken except that non-forced expansion failures
36820 cause a log line to be written.
36821 </para>
36822 <para>
36823 The result of the shadow transport is discarded and does not affect the
36824 subsequent processing of the message. Only a single level of shadowing is
36825 provided; the <option>shadow_transport</option> option is ignored on any transport when it
36826 is running as a shadow. Options concerned with output from pipes are also
36827 ignored. The log line for the successful delivery has an item added on the end,
36828 of the form
36829 </para>
36830 <literallayout class="monospaced">
36831 ST=&lt;shadow transport name&gt;
36832 </literallayout>
36833 <para>
36834 If the shadow transport did not succeed, the error message is put in
36835 parentheses afterwards. Shadow transports can be used for a number of different
36836 purposes, including keeping more detailed log information than Exim normally
36837 provides, and implementing automatic acknowledgment policies based on message
36838 headers that some sites insist on.
36839 </para>
36840 <para>
36841 <indexterm role="option">
36842 <primary><option>transport_filter</option></primary>
36843 </indexterm>
36844 </para>
36845 <informaltable frame="all">
36846 <tgroup cols="4" colsep="0" rowsep="0">
36847 <colspec colwidth="8*" align="left"/>
36848 <colspec colwidth="6*" align="center"/>
36849 <colspec colwidth="6*" align="center"/>
36850 <colspec colwidth="6*" align="right"/>
36851 <tbody>
36852 <row>
36853 <entry><option>transport_filter</option></entry>
36854 <entry>Use: <emphasis>transports</emphasis></entry>
36855 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36856 <entry>Default: <emphasis>unset</emphasis></entry>
36857 </row>
36858 </tbody>
36859 </tgroup>
36860 </informaltable>
36861 <para>
36862 <indexterm role="concept">
36863 <primary>transport</primary>
36864 <secondary>filter</secondary>
36865 </indexterm>
36866 <indexterm role="concept">
36867 <primary>filter</primary>
36868 <secondary>transport filter</secondary>
36869 </indexterm>
36870 This option sets up a filtering (in the Unix shell sense) process for messages
36871 at transport time. It should not be confused with mail filtering as set up by
36872 individual users or via a system filter.
36873 </para>
36874 <para>
36875 When the message is about to be written out, the command specified by
36876 <option>transport_filter</option> is started up in a separate, parallel process, and
36877 the entire message, including the header lines, is passed to it on its standard
36878 input (this in fact is done from a third process, to avoid deadlock). The
36879 command must be specified as an absolute path.
36880 </para>
36881 <para>
36882 The lines of the message that are written to the transport filter are
36883 terminated by newline (<quote>\n</quote>). The message is passed to the filter before any
36884 SMTP-specific processing, such as turning <quote>\n</quote> into <quote>\r\n</quote> and escaping
36885 lines beginning with a dot, and also before any processing implied by the
36886 settings of <option>check_string</option> and <option>escape_string</option> in the <command>appendfile</command> or
36887 <command>pipe</command> transports.
36888 </para>
36889 <para>
36890 The standard error for the filter process is set to the same destination as its
36891 standard output; this is read and written to the message&#x2019;s ultimate
36892 destination. The process that writes the message to the filter, the
36893 filter itself, and the original process that reads the result and delivers it
36894 are all run in parallel, like a shell pipeline.
36895 </para>
36896 <para>
36897 The filter can perform any transformations it likes, but of course should take
36898 care not to break RFC 2822 syntax. Exim does not check the result, except to
36899 test for a final newline when SMTP is in use. All messages transmitted over
36900 SMTP must end with a newline, so Exim supplies one if it is missing.
36901 </para>
36902 <para>
36903 <indexterm role="concept">
36904 <primary>content scanning</primary>
36905 <secondary>per user</secondary>
36906 </indexterm>
36907 A transport filter can be used to provide content-scanning on a per-user basis
36908 at delivery time if the only required effect of the scan is to modify the
36909 message. For example, a content scan could insert a new header line containing
36910 a spam score. This could be interpreted by a filter in the user&#x2019;s MUA. It is
36911 not possible to discard a message at this stage.
36912 </para>
36913 <para>
36914 <indexterm role="concept">
36915 <primary>SMTP</primary>
36916 <secondary>SIZE</secondary>
36917 </indexterm>
36918 A problem might arise if the filter increases the size of a message that is
36919 being sent down an SMTP connection. If the receiving SMTP server has indicated
36920 support for the SIZE parameter, Exim will have sent the size of the message
36921 at the start of the SMTP session. If what is actually sent is substantially
36922 more, the server might reject the message. This can be worked round by setting
36923 the <option>size_addition</option> option on the <command>smtp</command> transport, either to allow for
36924 additions to the message, or to disable the use of SIZE altogether.
36925 </para>
36926 <para>
36927 <indexterm role="variable">
36928 <primary><varname>$pipe_addresses</varname></primary>
36929 </indexterm>
36930 The value of the <option>transport_filter</option> option is the command string for starting
36931 the filter, which is run directly from Exim, not under a shell. The string is
36932 parsed by Exim in the same way as a command string for the <command>pipe</command> transport:
36933 Exim breaks it up into arguments and then expands each argument separately (see
36934 section <xref linkend="SECThowcommandrun"/>). Any kind of expansion failure causes delivery
36935 to be deferred. The special argument <varname>$pipe_addresses</varname> is replaced by a number
36936 of arguments, one for each address that applies to this delivery. (This isn&#x2019;t
36937 an ideal name for this feature here, but as it was already implemented for the
36938 <command>pipe</command> transport, it seemed sensible not to change it.)
36939 </para>
36940 <para>
36941 <indexterm role="variable">
36942 <primary><varname>$host</varname></primary>
36943 </indexterm>
36944 <indexterm role="variable">
36945 <primary><varname>$host_address</varname></primary>
36946 </indexterm>
36947 The expansion variables <varname>$host</varname> and <varname>$host_address</varname> are available when the
36948 transport is a remote one. They contain the name and IP address of the host to
36949 which the message is being sent. For example:
36950 </para>
36951 <literallayout class="monospaced">
36952 transport_filter = /some/directory/transport-filter.pl \
36953   $host $host_address $sender_address $pipe_addresses
36954 </literallayout>
36955 <para>
36956 Two problems arise if you want to use more complicated expansion items to
36957 generate transport filter commands, both of which due to the fact that the
36958 command is split up <emphasis>before</emphasis> expansion.
36959 </para>
36960 <itemizedlist>
36961 <listitem>
36962 <para>
36963 If an expansion item contains white space, you must quote it, so that it is all
36964 part of the same command item. If the entire option setting is one such
36965 expansion item, you have to take care what kind of quoting you use. For
36966 example:
36967 </para>
36968 <literallayout class="monospaced">
36969 transport_filter = '/bin/cmd${if eq{$host}{a.b.c}{1}{2}}'
36970 </literallayout>
36971 <para>
36972 This runs the command <command>/bin/cmd1</command> if the host name is <emphasis>a.b.c</emphasis>, and
36973 <command>/bin/cmd2</command> otherwise. If double quotes had been used, they would have been
36974 stripped by Exim when it read the option&#x2019;s value. When the value is used, if
36975 the single quotes were missing, the line would be split into two items,
36976 <literal>/bin/cmd${if</literal> and <literal>eq{$host}{a.b.c}{1}{2}</literal>, and an error would occur when
36977 Exim tried to expand the first one.
36978 </para>
36979 </listitem>
36980 <listitem>
36981 <para>
36982 Except for the special case of <varname>$pipe_addresses</varname> that is mentioned above, an
36983 expansion cannot generate multiple arguments, or a command name followed by
36984 arguments. Consider this example:
36985 </para>
36986 <literallayout class="monospaced">
36987 transport_filter = ${lookup{$host}lsearch{/a/file}\
36988                     {$value}{/bin/cat}}
36989 </literallayout>
36990 <para>
36991 The result of the lookup is interpreted as the name of the command, even
36992 if it contains white space. The simplest way round this is to use a shell:
36993 </para>
36994 <literallayout class="monospaced">
36995 transport_filter = /bin/sh -c ${lookup{$host}lsearch{/a/file}\
36996                                {$value}{/bin/cat}}
36997 </literallayout>
36998 </listitem>
36999 </itemizedlist>
37000 <para>
37001 The filter process is run under the same uid and gid as the normal delivery.
37002 For remote deliveries this is the Exim uid/gid by default. The command should
37003 normally yield a zero return code. Transport filters are not supposed to fail.
37004 A non-zero code is taken to mean that the transport filter encountered some
37005 serious problem. Delivery of the message is deferred; the message remains on
37006 the queue and is tried again later. It is not possible to cause a message to be
37007 bounced from a transport filter.
37008 </para>
37009 <para>
37010 If a transport filter is set on an autoreply transport, the original message is
37011 passed through the filter as it is being copied into the newly generated
37012 message, which happens if the <option>return_message</option> option is set.
37013 </para>
37014 <para>
37015 <indexterm role="option">
37016 <primary><option>transport_filter_timeout</option></primary>
37017 </indexterm>
37018 </para>
37019 <informaltable frame="all">
37020 <tgroup cols="4" colsep="0" rowsep="0">
37021 <colspec colwidth="8*" align="left"/>
37022 <colspec colwidth="6*" align="center"/>
37023 <colspec colwidth="6*" align="center"/>
37024 <colspec colwidth="6*" align="right"/>
37025 <tbody>
37026 <row>
37027 <entry><option>transport_filter_timeout</option></entry>
37028 <entry>Use: <emphasis>transports</emphasis></entry>
37029 <entry>Type: <emphasis>time</emphasis></entry>
37030 <entry>Default: <emphasis>5m</emphasis></entry>
37031 </row>
37032 </tbody>
37033 </tgroup>
37034 </informaltable>
37035 <para>
37036 <indexterm role="concept">
37037 <primary>transport</primary>
37038 <secondary>filter, timeout</secondary>
37039 </indexterm>
37040 When Exim is reading the output of a transport filter, it a applies a timeout
37041 that can be set by this option. Exceeding the timeout is normally treated as a
37042 temporary delivery failure. However, if a transport filter is used with a
37043 <command>pipe</command> transport, a timeout in the transport filter is treated in the same
37044 way as a timeout in the pipe command itself. By default, a timeout is a hard
37045 error, but if the <command>pipe</command> transport&#x2019;s <option>timeout_defer</option> option is set true, it
37046 becomes a temporary error.
37047 </para>
37048 <para>
37049 <indexterm role="option">
37050 <primary><option>user</option></primary>
37051 </indexterm>
37052 </para>
37053 <informaltable frame="all">
37054 <tgroup cols="4" colsep="0" rowsep="0">
37055 <colspec colwidth="8*" align="left"/>
37056 <colspec colwidth="6*" align="center"/>
37057 <colspec colwidth="6*" align="center"/>
37058 <colspec colwidth="6*" align="right"/>
37059 <tbody>
37060 <row>
37061 <entry><option>user</option></entry>
37062 <entry>Use: <emphasis>transports</emphasis></entry>
37063 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37064 <entry>Default: <emphasis>Exim user</emphasis></entry>
37065 </row>
37066 </tbody>
37067 </tgroup>
37068 </informaltable>
37069 <para>
37070 <indexterm role="concept">
37071 <primary>uid (user id)</primary>
37072 <secondary>local delivery</secondary>
37073 </indexterm>
37074 <indexterm role="concept">
37075 <primary>transport</primary>
37076 <secondary>user, specifying</secondary>
37077 </indexterm>
37078 This option specifies the user under whose uid the delivery process is to be
37079 run, overriding any uid that may have been set by the router. If the user is
37080 given as a name, the uid is looked up from the password data, and the
37081 associated group is taken as the value of the gid to be used if the <option>group</option>
37082 option is not set.
37083 </para>
37084 <para>
37085 For deliveries that use local transports, a user and group are normally
37086 specified explicitly or implicitly (for example, as a result of
37087 <option>check_local_user</option>) by the router or transport.
37088 </para>
37089 <para>
37090 <indexterm role="concept">
37091 <primary>hints database</primary>
37092 <secondary>access by remote transport</secondary>
37093 </indexterm>
37094 For remote transports, you should leave this option unset unless you really are
37095 sure you know what you are doing. When a remote transport is running, it needs
37096 to be able to access Exim&#x2019;s hints databases, because each host may have its own
37097 retry data.
37098 <indexterm role="concept" startref="IIDgenoptra1" class="endofrange"/>
37099 <indexterm role="concept" startref="IIDgenoptra2" class="endofrange"/>
37100 <indexterm role="concept" startref="IIDgenoptra3" class="endofrange"/>
37101 </para>
37102 </chapter>
37103
37104 <chapter id="CHAPbatching">
37105 <title>Address batching in local transports</title>
37106 <titleabbrev>Address batching</titleabbrev>
37107 <para>
37108 <indexterm role="concept">
37109 <primary>transport</primary>
37110 <secondary>local; address batching in</secondary>
37111 </indexterm>
37112 The only remote transport (<command>smtp</command>) is normally configured to handle more than
37113 one address at a time, so that when several addresses are routed to the same
37114 remote host, just one copy of the message is sent. Local transports, however,
37115 normally handle one address at a time. That is, a separate instance of the
37116 transport is run for each address that is routed to the transport. A separate
37117 copy of the message is delivered each time.
37118 </para>
37119 <para>
37120 <indexterm role="concept">
37121 <primary>batched local delivery</primary>
37122 </indexterm>
37123 <indexterm role="option">
37124 <primary><option>batch_max</option></primary>
37125 </indexterm>
37126 <indexterm role="option">
37127 <primary><option>batch_id</option></primary>
37128 </indexterm>
37129 In special cases, it may be desirable to handle several addresses at once in a
37130 local transport, for example:
37131 </para>
37132 <itemizedlist>
37133 <listitem>
37134 <para>
37135 In an <command>appendfile</command> transport, when storing messages in files for later
37136 delivery by some other means, a single copy of the message with multiple
37137 recipients saves space.
37138 </para>
37139 </listitem>
37140 <listitem>
37141 <para>
37142 In an <command>lmtp</command> transport, when delivering over <quote>local SMTP</quote> to some process,
37143 a single copy saves time, and is the normal way LMTP is expected to work.
37144 </para>
37145 </listitem>
37146 <listitem>
37147 <para>
37148 In a <command>pipe</command> transport, when passing the message
37149 to a scanner program or
37150 to some other delivery mechanism such as UUCP, multiple recipients may be
37151 acceptable.
37152 </para>
37153 </listitem>
37154 </itemizedlist>
37155 <para>
37156 These three local transports all have the same options for controlling multiple
37157 (<quote>batched</quote>) deliveries, namely <option>batch_max</option> and <option>batch_id</option>. To save
37158 repeating the information for each transport, these options are described here.
37159 </para>
37160 <para>
37161 The <option>batch_max</option> option specifies the maximum number of addresses that can be
37162 delivered together in a single run of the transport. Its default value is one
37163 (no batching). When more than one address is routed to a transport that has a
37164 <option>batch_max</option> value greater than one, the addresses are delivered in a batch
37165 (that is, in a single run of the transport with multiple recipients), subject
37166 to certain conditions:
37167 </para>
37168 <itemizedlist>
37169 <listitem>
37170 <para>
37171 <indexterm role="variable">
37172 <primary><varname>$local_part</varname></primary>
37173 </indexterm>
37174 If any of the transport&#x2019;s options contain a reference to <varname>$local_part</varname>, no
37175 batching is possible.
37176 </para>
37177 </listitem>
37178 <listitem>
37179 <para>
37180 <indexterm role="variable">
37181 <primary><varname>$domain</varname></primary>
37182 </indexterm>
37183 If any of the transport&#x2019;s options contain a reference to <varname>$domain</varname>, only
37184 addresses with the same domain are batched.
37185 </para>
37186 </listitem>
37187 <listitem>
37188 <para>
37189 <indexterm role="concept">
37190 <primary>customizing</primary>
37191 <secondary>batching condition</secondary>
37192 </indexterm>
37193 If <option>batch_id</option> is set, it is expanded for each address, and only those
37194 addresses with the same expanded value are batched. This allows you to specify
37195 customized batching conditions. Failure of the expansion for any reason,
37196 including forced failure, disables batching, but it does not stop the delivery
37197 from taking place.
37198 </para>
37199 </listitem>
37200 <listitem>
37201 <para>
37202 Batched addresses must also have the same errors address (where to send
37203 delivery errors), the same header additions and removals, the same user and
37204 group for the transport, and if a host list is present, the first host must
37205 be the same.
37206 </para>
37207 </listitem>
37208 </itemizedlist>
37209 <para>
37210 In the case of the <command>appendfile</command> and <command>pipe</command> transports, batching applies
37211 both when the file or pipe command is specified in the transport, and when it
37212 is specified by a <command>redirect</command> router, but all the batched addresses must of
37213 course be routed to the same file or pipe command. These two transports have an
37214 option called <option>use_bsmtp</option>, which causes them to deliver the message in
37215 <quote>batched SMTP</quote> format, with the envelope represented as SMTP commands. The
37216 <option>check_string</option> and <option>escape_string</option> options are forced to the values
37217 </para>
37218 <literallayout class="monospaced">
37219 check_string = "."
37220 escape_string = ".."
37221 </literallayout>
37222 <para>
37223 when batched SMTP is in use. A full description of the batch SMTP mechanism is
37224 given in section <xref linkend="SECTbatchSMTP"/>. The <command>lmtp</command> transport does not have a
37225 <option>use_bsmtp</option> option, because it always delivers using the SMTP protocol.
37226 </para>
37227 <para>
37228 <indexterm role="concept">
37229 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
37230 </indexterm>
37231 If the generic <option>envelope_to_add</option> option is set for a batching transport, the
37232 <emphasis>Envelope-to:</emphasis> header that is added to the message contains all the addresses
37233 that are being processed together. If you are using a batching <command>appendfile</command>
37234 transport without <option>use_bsmtp</option>, the only way to preserve the recipient
37235 addresses is to set the <option>envelope_to_add</option> option.
37236 </para>
37237 <para>
37238 <indexterm role="concept">
37239 <primary><command>pipe</command> transport</primary>
37240 <secondary>with multiple addresses</secondary>
37241 </indexterm>
37242 <indexterm role="variable">
37243 <primary><varname>$pipe_addresses</varname></primary>
37244 </indexterm>
37245 If you are using a <command>pipe</command> transport without BSMTP, and setting the
37246 transport&#x2019;s <option>command</option> option, you can include <varname>$pipe_addresses</varname> as part of
37247 the command. This is not a true variable; it is a bit of magic that causes each
37248 of the recipient addresses to be inserted into the command as a separate
37249 argument. This provides a way of accessing all the addresses that are being
37250 delivered in the batch. <emphasis role="bold">Note:</emphasis> This is not possible for pipe commands that
37251 are specified by a <command>redirect</command> router.
37252 </para>
37253 </chapter>
37254
37255 <chapter id="CHAPappendfile">
37256 <title>The appendfile transport</title>
37257 <para>
37258 <indexterm role="concept" id="IIDapptra1" class="startofrange">
37259 <primary><command>appendfile</command> transport</primary>
37260 </indexterm>
37261 <indexterm role="concept" id="IIDapptra2" class="startofrange">
37262 <primary>transports</primary>
37263 <secondary><command>appendfile</command></secondary>
37264 </indexterm>
37265 <indexterm role="concept">
37266 <primary>directory creation</primary>
37267 </indexterm>
37268 <indexterm role="concept">
37269 <primary>creating directories</primary>
37270 </indexterm>
37271 The <command>appendfile</command> transport delivers a message by appending it to an existing
37272 file, or by creating an entirely new file in a specified directory. Single
37273 files to which messages are appended can be in the traditional Unix mailbox
37274 format, or optionally in the MBX format supported by the Pine MUA and
37275 University of Washington IMAP daemon, <emphasis>inter alia</emphasis>. When each message is
37276 being delivered as a separate file, <quote>maildir</quote> format can optionally be used
37277 to give added protection against failures that happen part-way through the
37278 delivery. A third form of separate-file delivery known as <quote>mailstore</quote> is also
37279 supported. For all file formats, Exim attempts to create as many levels of
37280 directory as necessary, provided that <option>create_directory</option> is set.
37281 </para>
37282 <para>
37283 The code for the optional formats is not included in the Exim binary by
37284 default. It is necessary to set SUPPORT_MBX, SUPPORT_MAILDIR and/or
37285 SUPPORT_MAILSTORE in <filename>Local/Makefile</filename> to have the appropriate code
37286 included.
37287 </para>
37288 <para>
37289 <indexterm role="concept">
37290 <primary>quota</primary>
37291 <secondary>system</secondary>
37292 </indexterm>
37293 Exim recognizes system quota errors, and generates an appropriate message. Exim
37294 also supports its own quota control within the transport, for use when the
37295 system facility is unavailable or cannot be used for some reason.
37296 </para>
37297 <para>
37298 If there is an error while appending to a file (for example, quota exceeded or
37299 partition filled), Exim attempts to reset the file&#x2019;s length and last
37300 modification time back to what they were before. If there is an error while
37301 creating an entirely new file, the new file is removed.
37302 </para>
37303 <para>
37304 Before appending to a file, a number of security checks are made, and the
37305 file is locked. A detailed description is given below, after the list of
37306 private options.
37307 </para>
37308 <para>
37309 The <command>appendfile</command> transport is most commonly used for local deliveries to
37310 users&#x2019; mailboxes. However, it can also be used as a pseudo-remote transport for
37311 putting messages into files for remote delivery by some means other than Exim.
37312 <quote>Batch SMTP</quote> format is often used in this case (see the <option>use_bsmtp</option>
37313 option).
37314 </para>
37315 <section id="SECTfildiropt">
37316 <title>The file and directory options</title>
37317 <para>
37318 The <option>file</option> option specifies a single file, to which the message is appended;
37319 the <option>directory</option> option specifies a directory, in which a new file containing
37320 the message is created. Only one of these two options can be set, and for
37321 normal deliveries to mailboxes, one of them <emphasis>must</emphasis> be set.
37322 </para>
37323 <para>
37324 <indexterm role="variable">
37325 <primary><varname>$address_file</varname></primary>
37326 </indexterm>
37327 <indexterm role="variable">
37328 <primary><varname>$local_part</varname></primary>
37329 </indexterm>
37330 However, <command>appendfile</command> is also used for delivering messages to files or
37331 directories whose names (or parts of names) are obtained from alias,
37332 forwarding, or filtering operations (for example, a <option>save</option> command in a
37333 user&#x2019;s Exim filter). When such a transport is running, <varname>$local_part</varname> contains
37334 the local part that was aliased or forwarded, and <varname>$address_file</varname> contains the
37335 name (or partial name) of the file or directory generated by the redirection
37336 operation. There are two cases:
37337 </para>
37338 <itemizedlist>
37339 <listitem>
37340 <para>
37341 If neither <option>file</option> nor <option>directory</option> is set, the redirection operation
37342 must specify an absolute path (one that begins with <literal>/</literal>). This is the most
37343 common case when users with local accounts use filtering to sort mail into
37344 different folders. See for example, the <command>address_file</command> transport in the
37345 default configuration. If the path ends with a slash, it is assumed to be the
37346 name of a directory. A delivery to a directory can also be forced by setting
37347 <option>maildir_format</option> or <option>mailstore_format</option>.
37348 </para>
37349 </listitem>
37350 <listitem>
37351 <para>
37352 If <option>file</option> or <option>directory</option> is set for a delivery from a redirection, it is
37353 used to determine the file or directory name for the delivery. Normally, the
37354 contents of <varname>$address_file</varname> are used in some way in the string expansion.
37355 </para>
37356 </listitem>
37357 </itemizedlist>
37358 <para>
37359 <indexterm role="concept">
37360 <primary>Sieve filter</primary>
37361 <secondary>configuring <command>appendfile</command></secondary>
37362 </indexterm>
37363 <indexterm role="concept">
37364 <primary>Sieve filter</primary>
37365 <secondary>relative mailbox path handling</secondary>
37366 </indexterm>
37367 As an example of the second case, consider an environment where users do not
37368 have home directories. They may be permitted to use Exim filter commands of the
37369 form:
37370 </para>
37371 <literallayout class="monospaced">
37372 save folder23
37373 </literallayout>
37374 <para>
37375 or Sieve filter commands of the form:
37376 </para>
37377 <literallayout class="monospaced">
37378 require "fileinto";
37379 fileinto "folder23";
37380 </literallayout>
37381 <para>
37382 In this situation, the expansion of <option>file</option> or <option>directory</option> in the transport
37383 must transform the relative path into an appropriate absolute file name. In the
37384 case of Sieve filters, the name <emphasis>inbox</emphasis> must be handled. It is the name that
37385 is used as a result of a <quote>keep</quote> action in the filter. This example shows one
37386 way of handling this requirement:
37387 </para>
37388 <literallayout class="monospaced">
37389 file = ${if eq{$address_file}{inbox} \
37390             {/var/mail/$local_part} \
37391             {${if eq{${substr_0_1:$address_file}}{/} \
37392                   {$address_file} \
37393                   {$home/mail/$address_file} \
37394             }} \
37395        }
37396 </literallayout>
37397 <para>
37398 With this setting of <option>file</option>, <emphasis>inbox</emphasis> refers to the standard mailbox
37399 location, absolute paths are used without change, and other folders are in the
37400 <filename>mail</filename> directory within the home directory.
37401 </para>
37402 <para>
37403 <emphasis role="bold">Note 1</emphasis>: While processing an Exim filter, a relative path such as
37404 <filename>folder23</filename> is turned into an absolute path if a home directory is known to
37405 the router. In particular, this is the case if <option>check_local_user</option> is set. If
37406 you want to prevent this happening at routing time, you can set
37407 <option>router_home_directory</option> empty. This forces the router to pass the relative
37408 path to the transport.
37409 </para>
37410 <para>
37411 <emphasis role="bold">Note 2</emphasis>: An absolute path in <varname>$address_file</varname> is not treated specially;
37412 the <option>file</option> or <option>directory</option> option is still used if it is set.
37413 </para>
37414 </section>
37415 <section id="SECID134">
37416 <title>Private options for appendfile</title>
37417 <para>
37418 <indexterm role="concept">
37419 <primary>options</primary>
37420 <secondary><command>appendfile</command> transport</secondary>
37421 </indexterm>
37422 </para>
37423 <para>
37424 <indexterm role="option">
37425 <primary><option>allow_fifo</option></primary>
37426 </indexterm>
37427 </para>
37428 <informaltable frame="all">
37429 <tgroup cols="4" colsep="0" rowsep="0">
37430 <colspec colwidth="8*" align="left"/>
37431 <colspec colwidth="6*" align="center"/>
37432 <colspec colwidth="6*" align="center"/>
37433 <colspec colwidth="6*" align="right"/>
37434 <tbody>
37435 <row>
37436 <entry><option>allow_fifo</option></entry>
37437 <entry>Use: <emphasis>appendfile</emphasis></entry>
37438 <entry>Type: <emphasis>boolean</emphasis></entry>
37439 <entry>Default: <emphasis>false</emphasis></entry>
37440 </row>
37441 </tbody>
37442 </tgroup>
37443 </informaltable>
37444 <para>
37445 <indexterm role="concept">
37446 <primary>fifo (named pipe)</primary>
37447 </indexterm>
37448 <indexterm role="concept">
37449 <primary>named pipe (fifo)</primary>
37450 </indexterm>
37451 <indexterm role="concept">
37452 <primary>pipe</primary>
37453 <secondary>named (fifo)</secondary>
37454 </indexterm>
37455 Setting this option permits delivery to named pipes (FIFOs) as well as to
37456 regular files. If no process is reading the named pipe at delivery time, the
37457 delivery is deferred.
37458 </para>
37459 <para>
37460 <indexterm role="option">
37461 <primary><option>allow_symlink</option></primary>
37462 </indexterm>
37463 </para>
37464 <informaltable frame="all">
37465 <tgroup cols="4" colsep="0" rowsep="0">
37466 <colspec colwidth="8*" align="left"/>
37467 <colspec colwidth="6*" align="center"/>
37468 <colspec colwidth="6*" align="center"/>
37469 <colspec colwidth="6*" align="right"/>
37470 <tbody>
37471 <row>
37472 <entry><option>allow_symlink</option></entry>
37473 <entry>Use: <emphasis>appendfile</emphasis></entry>
37474 <entry>Type: <emphasis>boolean</emphasis></entry>
37475 <entry>Default: <emphasis>false</emphasis></entry>
37476 </row>
37477 </tbody>
37478 </tgroup>
37479 </informaltable>
37480 <para>
37481 <indexterm role="concept">
37482 <primary>symbolic link</primary>
37483 <secondary>to mailbox</secondary>
37484 </indexterm>
37485 <indexterm role="concept">
37486 <primary>mailbox</primary>
37487 <secondary>symbolic link</secondary>
37488 </indexterm>
37489 By default, <command>appendfile</command> will not deliver if the path name for the file is
37490 that of a symbolic link. Setting this option relaxes that constraint, but there
37491 are security issues involved in the use of symbolic links. Be sure you know
37492 what you are doing if you set this. Details of exactly what this option affects
37493 are included in the discussion which follows this list of options.
37494 </para>
37495 <para>
37496 <indexterm role="option">
37497 <primary><option>batch_id</option></primary>
37498 </indexterm>
37499 </para>
37500 <informaltable frame="all">
37501 <tgroup cols="4" colsep="0" rowsep="0">
37502 <colspec colwidth="8*" align="left"/>
37503 <colspec colwidth="6*" align="center"/>
37504 <colspec colwidth="6*" align="center"/>
37505 <colspec colwidth="6*" align="right"/>
37506 <tbody>
37507 <row>
37508 <entry><option>batch_id</option></entry>
37509 <entry>Use: <emphasis>appendfile</emphasis></entry>
37510 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37511 <entry>Default: <emphasis>unset</emphasis></entry>
37512 </row>
37513 </tbody>
37514 </tgroup>
37515 </informaltable>
37516 <para>
37517 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
37518 However, batching is automatically disabled for <command>appendfile</command> deliveries that
37519 happen as a result of forwarding or aliasing or other redirection directly to a
37520 file.
37521 </para>
37522 <para>
37523 <indexterm role="option">
37524 <primary><option>batch_max</option></primary>
37525 </indexterm>
37526 </para>
37527 <informaltable frame="all">
37528 <tgroup cols="4" colsep="0" rowsep="0">
37529 <colspec colwidth="8*" align="left"/>
37530 <colspec colwidth="6*" align="center"/>
37531 <colspec colwidth="6*" align="center"/>
37532 <colspec colwidth="6*" align="right"/>
37533 <tbody>
37534 <row>
37535 <entry><option>batch_max</option></entry>
37536 <entry>Use: <emphasis>appendfile</emphasis></entry>
37537 <entry>Type: <emphasis>integer</emphasis></entry>
37538 <entry>Default: <emphasis>1</emphasis></entry>
37539 </row>
37540 </tbody>
37541 </tgroup>
37542 </informaltable>
37543 <para>
37544 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
37545 </para>
37546 <para>
37547 <indexterm role="option">
37548 <primary><option>check_group</option></primary>
37549 </indexterm>
37550 </para>
37551 <informaltable frame="all">
37552 <tgroup cols="4" colsep="0" rowsep="0">
37553 <colspec colwidth="8*" align="left"/>
37554 <colspec colwidth="6*" align="center"/>
37555 <colspec colwidth="6*" align="center"/>
37556 <colspec colwidth="6*" align="right"/>
37557 <tbody>
37558 <row>
37559 <entry><option>check_group</option></entry>
37560 <entry>Use: <emphasis>appendfile</emphasis></entry>
37561 <entry>Type: <emphasis>boolean</emphasis></entry>
37562 <entry>Default: <emphasis>false</emphasis></entry>
37563 </row>
37564 </tbody>
37565 </tgroup>
37566 </informaltable>
37567 <para>
37568 When this option is set, the group owner of the file defined by the <option>file</option>
37569 option is checked to see that it is the same as the group under which the
37570 delivery process is running. The default setting is false because the default
37571 file mode is 0600, which means that the group is irrelevant.
37572 </para>
37573 <para>
37574 <indexterm role="option">
37575 <primary><option>check_owner</option></primary>
37576 </indexterm>
37577 </para>
37578 <informaltable frame="all">
37579 <tgroup cols="4" colsep="0" rowsep="0">
37580 <colspec colwidth="8*" align="left"/>
37581 <colspec colwidth="6*" align="center"/>
37582 <colspec colwidth="6*" align="center"/>
37583 <colspec colwidth="6*" align="right"/>
37584 <tbody>
37585 <row>
37586 <entry><option>check_owner</option></entry>
37587 <entry>Use: <emphasis>appendfile</emphasis></entry>
37588 <entry>Type: <emphasis>boolean</emphasis></entry>
37589 <entry>Default: <emphasis>true</emphasis></entry>
37590 </row>
37591 </tbody>
37592 </tgroup>
37593 </informaltable>
37594 <para>
37595 When this option is set, the owner of the file defined by the <option>file</option> option
37596 is checked to ensure that it is the same as the user under which the delivery
37597 process is running.
37598 </para>
37599 <para>
37600 <indexterm role="option">
37601 <primary><option>check_string</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>check_string</option></entry>
37613 <entry>Use: <emphasis>appendfile</emphasis></entry>
37614 <entry>Type: <emphasis>string</emphasis></entry>
37615 <entry>Default: <emphasis>see below</emphasis></entry>
37616 </row>
37617 </tbody>
37618 </tgroup>
37619 </informaltable>
37620 <para>
37621 <indexterm role="concept">
37622 <primary><quote>From</quote> line</primary>
37623 </indexterm>
37624 As <command>appendfile</command> writes the message, the start of each line is tested for
37625 matching <option>check_string</option>, and if it does, the initial matching characters are
37626 replaced by the contents of <option>escape_string</option>. The value of <option>check_string</option> is
37627 a literal string, not a regular expression, and the case of any letters it
37628 contains is significant.
37629 </para>
37630 <para>
37631 If <option>use_bsmtp</option> is set the values of <option>check_string</option> and <option>escape_string</option>
37632 are forced to <quote>.</quote> and <quote>..</quote> respectively, and any settings in the
37633 configuration are ignored. Otherwise, they default to <quote>From&nbsp;</quote> and
37634 <quote>&gt;From&nbsp;</quote> when the <option>file</option> option is set, and unset when any of the
37635 <option>directory</option>, <option>maildir</option>, or <option>mailstore</option> options are set.
37636 </para>
37637 <para>
37638 The default settings, along with <option>message_prefix</option> and <option>message_suffix</option>, are
37639 suitable for traditional <quote>BSD</quote> mailboxes, where a line beginning with
37640 <quote>From&nbsp;</quote> indicates the start of a new message. All four options need changing
37641 if another format is used. For example, to deliver to mailboxes in MMDF format:
37642 <indexterm role="concept">
37643 <primary>MMDF format mailbox</primary>
37644 </indexterm>
37645 <indexterm role="concept">
37646 <primary>mailbox</primary>
37647 <secondary>MMDF format</secondary>
37648 </indexterm>
37649 </para>
37650 <literallayout class="monospaced">
37651 check_string = "\1\1\1\1\n"
37652 escape_string = "\1\1\1\1 \n"
37653 message_prefix = "\1\1\1\1\n"
37654 message_suffix = "\1\1\1\1\n"
37655 </literallayout>
37656 <para>
37657 <indexterm role="option">
37658 <primary><option>create_directory</option></primary>
37659 </indexterm>
37660 </para>
37661 <informaltable frame="all">
37662 <tgroup cols="4" colsep="0" rowsep="0">
37663 <colspec colwidth="8*" align="left"/>
37664 <colspec colwidth="6*" align="center"/>
37665 <colspec colwidth="6*" align="center"/>
37666 <colspec colwidth="6*" align="right"/>
37667 <tbody>
37668 <row>
37669 <entry><option>create_directory</option></entry>
37670 <entry>Use: <emphasis>appendfile</emphasis></entry>
37671 <entry>Type: <emphasis>boolean</emphasis></entry>
37672 <entry>Default: <emphasis>true</emphasis></entry>
37673 </row>
37674 </tbody>
37675 </tgroup>
37676 </informaltable>
37677 <para>
37678 <indexterm role="concept">
37679 <primary>directory creation</primary>
37680 </indexterm>
37681 When this option is true, Exim attempts to create any missing superior
37682 directories for the file that it is about to write. A created directory&#x2019;s mode
37683 is given by the <option>directory_mode</option> option.
37684 </para>
37685 <para>
37686 The group ownership of a newly created directory is highly dependent on the
37687 operating system (and possibly the file system) that is being used. For
37688 example, in Solaris, if the parent directory has the setgid bit set, its group
37689 is propagated to the child; if not, the currently set group is used. However,
37690 in FreeBSD, the parent&#x2019;s group is always used.
37691 </para>
37692 <para>
37693 <indexterm role="option">
37694 <primary><option>create_file</option></primary>
37695 </indexterm>
37696 </para>
37697 <informaltable frame="all">
37698 <tgroup cols="4" colsep="0" rowsep="0">
37699 <colspec colwidth="8*" align="left"/>
37700 <colspec colwidth="6*" align="center"/>
37701 <colspec colwidth="6*" align="center"/>
37702 <colspec colwidth="6*" align="right"/>
37703 <tbody>
37704 <row>
37705 <entry><option>create_file</option></entry>
37706 <entry>Use: <emphasis>appendfile</emphasis></entry>
37707 <entry>Type: <emphasis>string</emphasis></entry>
37708 <entry>Default: <emphasis>anywhere</emphasis></entry>
37709 </row>
37710 </tbody>
37711 </tgroup>
37712 </informaltable>
37713 <para>
37714 This option constrains the location of files and directories that are created
37715 by this transport. It applies to files defined by the <option>file</option> option and
37716 directories defined by the <option>directory</option> option. In the case of maildir
37717 delivery, it applies to the top level directory, not the maildir directories
37718 beneath.
37719 </para>
37720 <para>
37721 The option must be set to one of the words <quote>anywhere</quote>, <quote>inhome</quote>, or
37722 <quote>belowhome</quote>. In the second and third cases, a home directory must have been
37723 set for the transport. This option is not useful when an explicit file name is
37724 given for normal mailbox deliveries. It is intended for the case when file
37725 names are generated from users&#x2019; <filename>.forward</filename> files. These are usually handled
37726 by an <command>appendfile</command> transport called <option>address_file</option>. See also
37727 <option>file_must_exist</option>.
37728 </para>
37729 <para>
37730 <indexterm role="option">
37731 <primary><option>directory</option></primary>
37732 </indexterm>
37733 </para>
37734 <informaltable frame="all">
37735 <tgroup cols="4" colsep="0" rowsep="0">
37736 <colspec colwidth="8*" align="left"/>
37737 <colspec colwidth="6*" align="center"/>
37738 <colspec colwidth="6*" align="center"/>
37739 <colspec colwidth="6*" align="right"/>
37740 <tbody>
37741 <row>
37742 <entry><option>directory</option></entry>
37743 <entry>Use: <emphasis>appendfile</emphasis></entry>
37744 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37745 <entry>Default: <emphasis>unset</emphasis></entry>
37746 </row>
37747 </tbody>
37748 </tgroup>
37749 </informaltable>
37750 <para>
37751 This option is mutually exclusive with the <option>file</option> option, but one of <option>file</option>
37752 or <option>directory</option> must be set, unless the delivery is the direct result of a
37753 redirection (see section <xref linkend="SECTfildiropt"/>).
37754 </para>
37755 <para>
37756 When <option>directory</option> is set, the string is expanded, and the message is delivered
37757 into a new file or files in or below the given directory, instead of being
37758 appended to a single mailbox file. A number of different formats are provided
37759 (see <option>maildir_format</option> and <option>mailstore_format</option>), and see section
37760 <xref linkend="SECTopdir"/> for further details of this form of delivery.
37761 </para>
37762 <para>
37763 <indexterm role="option">
37764 <primary><option>directory_file</option></primary>
37765 </indexterm>
37766 </para>
37767 <informaltable frame="all">
37768 <tgroup cols="4" colsep="0" rowsep="0">
37769 <colspec colwidth="8*" align="left"/>
37770 <colspec colwidth="6*" align="center"/>
37771 <colspec colwidth="6*" align="center"/>
37772 <colspec colwidth="6*" align="right"/>
37773 <tbody>
37774 <row>
37775 <entry><option>directory_file</option></entry>
37776 <entry>Use: <emphasis>appendfile</emphasis></entry>
37777 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37778 <entry>Default: <emphasis>see below</emphasis></entry>
37779 </row>
37780 </tbody>
37781 </tgroup>
37782 </informaltable>
37783 <para>
37784 <indexterm role="concept">
37785 <primary>base62</primary>
37786 </indexterm>
37787 <indexterm role="variable">
37788 <primary><varname>$inode</varname></primary>
37789 </indexterm>
37790 When <option>directory</option> is set, but neither <option>maildir_format</option> nor
37791 <option>mailstore_format</option> is set, <command>appendfile</command> delivers each message into a file
37792 whose name is obtained by expanding this string. The default value is:
37793 </para>
37794 <literallayout class="monospaced">
37795 q${base62:$tod_epoch}-$inode
37796 </literallayout>
37797 <para>
37798 This generates a unique name from the current time, in base 62 form, and the
37799 inode of the file. The variable <varname>$inode</varname> is available only when expanding this
37800 option.
37801 </para>
37802 <para>
37803 <indexterm role="option">
37804 <primary><option>directory_mode</option></primary>
37805 </indexterm>
37806 </para>
37807 <informaltable frame="all">
37808 <tgroup cols="4" colsep="0" rowsep="0">
37809 <colspec colwidth="8*" align="left"/>
37810 <colspec colwidth="6*" align="center"/>
37811 <colspec colwidth="6*" align="center"/>
37812 <colspec colwidth="6*" align="right"/>
37813 <tbody>
37814 <row>
37815 <entry><option>directory_mode</option></entry>
37816 <entry>Use: <emphasis>appendfile</emphasis></entry>
37817 <entry>Type: <emphasis>octal integer</emphasis></entry>
37818 <entry>Default: <emphasis>0700</emphasis></entry>
37819 </row>
37820 </tbody>
37821 </tgroup>
37822 </informaltable>
37823 <para>
37824 If <command>appendfile</command> creates any directories as a result of the
37825 <option>create_directory</option> option, their mode is specified by this option.
37826 </para>
37827 <para>
37828 <indexterm role="option">
37829 <primary><option>escape_string</option></primary>
37830 </indexterm>
37831 </para>
37832 <informaltable frame="all">
37833 <tgroup cols="4" colsep="0" rowsep="0">
37834 <colspec colwidth="8*" align="left"/>
37835 <colspec colwidth="6*" align="center"/>
37836 <colspec colwidth="6*" align="center"/>
37837 <colspec colwidth="6*" align="right"/>
37838 <tbody>
37839 <row>
37840 <entry><option>escape_string</option></entry>
37841 <entry>Use: <emphasis>appendfile</emphasis></entry>
37842 <entry>Type: <emphasis>string</emphasis></entry>
37843 <entry>Default: <emphasis>see description</emphasis></entry>
37844 </row>
37845 </tbody>
37846 </tgroup>
37847 </informaltable>
37848 <para>
37849 See <option>check_string</option> above.
37850 </para>
37851 <para>
37852 <indexterm role="option">
37853 <primary><option>file</option></primary>
37854 </indexterm>
37855 </para>
37856 <informaltable frame="all">
37857 <tgroup cols="4" colsep="0" rowsep="0">
37858 <colspec colwidth="8*" align="left"/>
37859 <colspec colwidth="6*" align="center"/>
37860 <colspec colwidth="6*" align="center"/>
37861 <colspec colwidth="6*" align="right"/>
37862 <tbody>
37863 <row>
37864 <entry><option>file</option></entry>
37865 <entry>Use: <emphasis>appendfile</emphasis></entry>
37866 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37867 <entry>Default: <emphasis>unset</emphasis></entry>
37868 </row>
37869 </tbody>
37870 </tgroup>
37871 </informaltable>
37872 <para>
37873 This option is mutually exclusive with the <option>directory</option> option, but one of
37874 <option>file</option> or <option>directory</option> must be set, unless the delivery is the direct result
37875 of a redirection (see section <xref linkend="SECTfildiropt"/>). The <option>file</option> option
37876 specifies a single file, to which the message is appended. One or more of
37877 <option>use_fcntl_lock</option>, <option>use_flock_lock</option>, or <option>use_lockfile</option> must be set with
37878 <option>file</option>.
37879 </para>
37880 <para>
37881 <indexterm role="concept">
37882 <primary>NFS</primary>
37883 <secondary>lock file</secondary>
37884 </indexterm>
37885 <indexterm role="concept">
37886 <primary>locking files</primary>
37887 </indexterm>
37888 <indexterm role="concept">
37889 <primary>lock files</primary>
37890 </indexterm>
37891 If you are using more than one host to deliver over NFS into the same
37892 mailboxes, you should always use lock files.
37893 </para>
37894 <para>
37895 The string value is expanded for each delivery, and must yield an absolute
37896 path. The most common settings of this option are variations on one of these
37897 examples:
37898 </para>
37899 <literallayout class="monospaced">
37900 file = /var/spool/mail/$local_part
37901 file = /home/$local_part/inbox
37902 file = $home/inbox
37903 </literallayout>
37904 <para>
37905 <indexterm role="concept">
37906 <primary><quote>sticky</quote> bit</primary>
37907 </indexterm>
37908 In the first example, all deliveries are done into the same directory. If Exim
37909 is configured to use lock files (see <option>use_lockfile</option> below) it must be able to
37910 create a file in the directory, so the <quote>sticky</quote> bit must be turned on for
37911 deliveries to be possible, or alternatively the <option>group</option> option can be used to
37912 run the delivery under a group id which has write access to the directory.
37913 </para>
37914 <para>
37915 <indexterm role="option">
37916 <primary><option>file_format</option></primary>
37917 </indexterm>
37918 </para>
37919 <informaltable frame="all">
37920 <tgroup cols="4" colsep="0" rowsep="0">
37921 <colspec colwidth="8*" align="left"/>
37922 <colspec colwidth="6*" align="center"/>
37923 <colspec colwidth="6*" align="center"/>
37924 <colspec colwidth="6*" align="right"/>
37925 <tbody>
37926 <row>
37927 <entry><option>file_format</option></entry>
37928 <entry>Use: <emphasis>appendfile</emphasis></entry>
37929 <entry>Type: <emphasis>string</emphasis></entry>
37930 <entry>Default: <emphasis>unset</emphasis></entry>
37931 </row>
37932 </tbody>
37933 </tgroup>
37934 </informaltable>
37935 <para>
37936 <indexterm role="concept">
37937 <primary>file</primary>
37938 <secondary>mailbox; checking existing format</secondary>
37939 </indexterm>
37940 This option requests the transport to check the format of an existing file
37941 before adding to it. The check consists of matching a specific string at the
37942 start of the file. The value of the option consists of an even number of
37943 colon-separated strings. The first of each pair is the test string, and the
37944 second is the name of a transport. If the transport associated with a matched
37945 string is not the current transport, control is passed over to the other
37946 transport. For example, suppose the standard <command>local_delivery</command> transport has
37947 this added to it:
37948 </para>
37949 <literallayout class="monospaced">
37950 file_format = "From       : local_delivery :\
37951                \1\1\1\1\n : local_mmdf_delivery"
37952 </literallayout>
37953 <para>
37954 Mailboxes that begin with <quote>From</quote> are still handled by this transport, but if
37955 a mailbox begins with four binary ones followed by a newline, control is passed
37956 to a transport called <option>local_mmdf_delivery</option>, which presumably is configured
37957 to do the delivery in MMDF format. If a mailbox does not exist or is empty, it
37958 is assumed to match the current transport. If the start of a mailbox doesn&#x2019;t
37959 match any string, or if the transport named for a given string is not defined,
37960 delivery is deferred.
37961 </para>
37962 <para>
37963 <indexterm role="option">
37964 <primary><option>file_must_exist</option></primary>
37965 </indexterm>
37966 </para>
37967 <informaltable frame="all">
37968 <tgroup cols="4" colsep="0" rowsep="0">
37969 <colspec colwidth="8*" align="left"/>
37970 <colspec colwidth="6*" align="center"/>
37971 <colspec colwidth="6*" align="center"/>
37972 <colspec colwidth="6*" align="right"/>
37973 <tbody>
37974 <row>
37975 <entry><option>file_must_exist</option></entry>
37976 <entry>Use: <emphasis>appendfile</emphasis></entry>
37977 <entry>Type: <emphasis>boolean</emphasis></entry>
37978 <entry>Default: <emphasis>false</emphasis></entry>
37979 </row>
37980 </tbody>
37981 </tgroup>
37982 </informaltable>
37983 <para>
37984 If this option is true, the file specified by the <option>file</option> option must exist.
37985 A temporary error occurs if it does not, causing delivery to be deferred.
37986 If this option is false, the file is created if it does not exist.
37987 </para>
37988 <para>
37989 <indexterm role="option">
37990 <primary><option>lock_fcntl_timeout</option></primary>
37991 </indexterm>
37992 </para>
37993 <informaltable frame="all">
37994 <tgroup cols="4" colsep="0" rowsep="0">
37995 <colspec colwidth="8*" align="left"/>
37996 <colspec colwidth="6*" align="center"/>
37997 <colspec colwidth="6*" align="center"/>
37998 <colspec colwidth="6*" align="right"/>
37999 <tbody>
38000 <row>
38001 <entry><option>lock_fcntl_timeout</option></entry>
38002 <entry>Use: <emphasis>appendfile</emphasis></entry>
38003 <entry>Type: <emphasis>time</emphasis></entry>
38004 <entry>Default: <emphasis>0s</emphasis></entry>
38005 </row>
38006 </tbody>
38007 </tgroup>
38008 </informaltable>
38009 <para>
38010 <indexterm role="concept">
38011 <primary>timeout</primary>
38012 <secondary>mailbox locking</secondary>
38013 </indexterm>
38014 <indexterm role="concept">
38015 <primary>mailbox</primary>
38016 <secondary>locking, blocking and non-blocking</secondary>
38017 </indexterm>
38018 <indexterm role="concept">
38019 <primary>locking files</primary>
38020 </indexterm>
38021 By default, the <command>appendfile</command> transport uses non-blocking calls to <function>fcntl()</function>
38022 when locking an open mailbox file. If the call fails, the delivery process
38023 sleeps for <option>lock_interval</option> and tries again, up to <option>lock_retries</option> times.
38024 Non-blocking calls are used so that the file is not kept open during the wait
38025 for the lock; the reason for this is to make it as safe as possible for
38026 deliveries over NFS in the case when processes might be accessing an NFS
38027 mailbox without using a lock file. This should not be done, but
38028 misunderstandings and hence misconfigurations are not unknown.
38029 </para>
38030 <para>
38031 On a busy system, however, the performance of a non-blocking lock approach is
38032 not as good as using a blocking lock with a timeout. In this case, the waiting
38033 is done inside the system call, and Exim&#x2019;s delivery process acquires the lock
38034 and can proceed as soon as the previous lock holder releases it.
38035 </para>
38036 <para>
38037 If <option>lock_fcntl_timeout</option> is set to a non-zero time, blocking locks, with that
38038 timeout, are used. There may still be some retrying: the maximum number of
38039 retries is
38040 </para>
38041 <literallayout class="monospaced">
38042 (lock_retries * lock_interval) / lock_fcntl_timeout
38043 </literallayout>
38044 <para>
38045 rounded up to the next whole number. In other words, the total time during
38046 which <command>appendfile</command> is trying to get a lock is roughly the same, unless
38047 <option>lock_fcntl_timeout</option> is set very large.
38048 </para>
38049 <para>
38050 You should consider setting this option if you are getting a lot of delayed
38051 local deliveries because of errors of the form
38052 </para>
38053 <literallayout class="monospaced">
38054 failed to lock mailbox /some/file (fcntl)
38055 </literallayout>
38056 <para>
38057 <indexterm role="option">
38058 <primary><option>lock_flock_timeout</option></primary>
38059 </indexterm>
38060 </para>
38061 <informaltable frame="all">
38062 <tgroup cols="4" colsep="0" rowsep="0">
38063 <colspec colwidth="8*" align="left"/>
38064 <colspec colwidth="6*" align="center"/>
38065 <colspec colwidth="6*" align="center"/>
38066 <colspec colwidth="6*" align="right"/>
38067 <tbody>
38068 <row>
38069 <entry><option>lock_flock_timeout</option></entry>
38070 <entry>Use: <emphasis>appendfile</emphasis></entry>
38071 <entry>Type: <emphasis>time</emphasis></entry>
38072 <entry>Default: <emphasis>0s</emphasis></entry>
38073 </row>
38074 </tbody>
38075 </tgroup>
38076 </informaltable>
38077 <para>
38078 This timeout applies to file locking when using <function>flock()</function> (see
38079 <option>use_flock</option>); the timeout operates in a similar manner to
38080 <option>lock_fcntl_timeout</option>.
38081 </para>
38082 <para>
38083 <indexterm role="option">
38084 <primary><option>lock_interval</option></primary>
38085 </indexterm>
38086 </para>
38087 <informaltable frame="all">
38088 <tgroup cols="4" colsep="0" rowsep="0">
38089 <colspec colwidth="8*" align="left"/>
38090 <colspec colwidth="6*" align="center"/>
38091 <colspec colwidth="6*" align="center"/>
38092 <colspec colwidth="6*" align="right"/>
38093 <tbody>
38094 <row>
38095 <entry><option>lock_interval</option></entry>
38096 <entry>Use: <emphasis>appendfile</emphasis></entry>
38097 <entry>Type: <emphasis>time</emphasis></entry>
38098 <entry>Default: <emphasis>3s</emphasis></entry>
38099 </row>
38100 </tbody>
38101 </tgroup>
38102 </informaltable>
38103 <para>
38104 This specifies the time to wait between attempts to lock the file. See below
38105 for details of locking.
38106 </para>
38107 <para>
38108 <indexterm role="option">
38109 <primary><option>lock_retries</option></primary>
38110 </indexterm>
38111 </para>
38112 <informaltable frame="all">
38113 <tgroup cols="4" colsep="0" rowsep="0">
38114 <colspec colwidth="8*" align="left"/>
38115 <colspec colwidth="6*" align="center"/>
38116 <colspec colwidth="6*" align="center"/>
38117 <colspec colwidth="6*" align="right"/>
38118 <tbody>
38119 <row>
38120 <entry><option>lock_retries</option></entry>
38121 <entry>Use: <emphasis>appendfile</emphasis></entry>
38122 <entry>Type: <emphasis>integer</emphasis></entry>
38123 <entry>Default: <emphasis>10</emphasis></entry>
38124 </row>
38125 </tbody>
38126 </tgroup>
38127 </informaltable>
38128 <para>
38129 This specifies the maximum number of attempts to lock the file. A value of zero
38130 is treated as 1. See below for details of locking.
38131 </para>
38132 <para>
38133 <indexterm role="option">
38134 <primary><option>lockfile_mode</option></primary>
38135 </indexterm>
38136 </para>
38137 <informaltable frame="all">
38138 <tgroup cols="4" colsep="0" rowsep="0">
38139 <colspec colwidth="8*" align="left"/>
38140 <colspec colwidth="6*" align="center"/>
38141 <colspec colwidth="6*" align="center"/>
38142 <colspec colwidth="6*" align="right"/>
38143 <tbody>
38144 <row>
38145 <entry><option>lockfile_mode</option></entry>
38146 <entry>Use: <emphasis>appendfile</emphasis></entry>
38147 <entry>Type: <emphasis>octal integer</emphasis></entry>
38148 <entry>Default: <emphasis>0600</emphasis></entry>
38149 </row>
38150 </tbody>
38151 </tgroup>
38152 </informaltable>
38153 <para>
38154 This specifies the mode of the created lock file, when a lock file is being
38155 used (see <option>use_lockfile</option> and <option>use_mbx_lock</option>).
38156 </para>
38157 <para>
38158 <indexterm role="option">
38159 <primary><option>lockfile_timeout</option></primary>
38160 </indexterm>
38161 </para>
38162 <informaltable frame="all">
38163 <tgroup cols="4" colsep="0" rowsep="0">
38164 <colspec colwidth="8*" align="left"/>
38165 <colspec colwidth="6*" align="center"/>
38166 <colspec colwidth="6*" align="center"/>
38167 <colspec colwidth="6*" align="right"/>
38168 <tbody>
38169 <row>
38170 <entry><option>lockfile_timeout</option></entry>
38171 <entry>Use: <emphasis>appendfile</emphasis></entry>
38172 <entry>Type: <emphasis>time</emphasis></entry>
38173 <entry>Default: <emphasis>30m</emphasis></entry>
38174 </row>
38175 </tbody>
38176 </tgroup>
38177 </informaltable>
38178 <para>
38179 <indexterm role="concept">
38180 <primary>timeout</primary>
38181 <secondary>mailbox locking</secondary>
38182 </indexterm>
38183 When a lock file is being used (see <option>use_lockfile</option>), if a lock file already
38184 exists and is older than this value, it is assumed to have been left behind by
38185 accident, and Exim attempts to remove it.
38186 </para>
38187 <para>
38188 <indexterm role="option">
38189 <primary><option>mailbox_filecount</option></primary>
38190 </indexterm>
38191 </para>
38192 <informaltable frame="all">
38193 <tgroup cols="4" colsep="0" rowsep="0">
38194 <colspec colwidth="8*" align="left"/>
38195 <colspec colwidth="6*" align="center"/>
38196 <colspec colwidth="6*" align="center"/>
38197 <colspec colwidth="6*" align="right"/>
38198 <tbody>
38199 <row>
38200 <entry><option>mailbox_filecount</option></entry>
38201 <entry>Use: <emphasis>appendfile</emphasis></entry>
38202 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38203 <entry>Default: <emphasis>unset</emphasis></entry>
38204 </row>
38205 </tbody>
38206 </tgroup>
38207 </informaltable>
38208 <para>
38209 <indexterm role="concept">
38210 <primary>mailbox</primary>
38211 <secondary>specifying size of</secondary>
38212 </indexterm>
38213 <indexterm role="concept">
38214 <primary>size</primary>
38215 <secondary>of mailbox</secondary>
38216 </indexterm>
38217 If this option is set, it is expanded, and the result is taken as the current
38218 number of files in the mailbox. It must be a decimal number, optionally
38219 followed by K or M. This provides a way of obtaining this information from an
38220 external source that maintains the data.
38221 </para>
38222 <para>
38223 <indexterm role="option">
38224 <primary><option>mailbox_size</option></primary>
38225 </indexterm>
38226 </para>
38227 <informaltable frame="all">
38228 <tgroup cols="4" colsep="0" rowsep="0">
38229 <colspec colwidth="8*" align="left"/>
38230 <colspec colwidth="6*" align="center"/>
38231 <colspec colwidth="6*" align="center"/>
38232 <colspec colwidth="6*" align="right"/>
38233 <tbody>
38234 <row>
38235 <entry><option>mailbox_size</option></entry>
38236 <entry>Use: <emphasis>appendfile</emphasis></entry>
38237 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38238 <entry>Default: <emphasis>unset</emphasis></entry>
38239 </row>
38240 </tbody>
38241 </tgroup>
38242 </informaltable>
38243 <para>
38244 <indexterm role="concept">
38245 <primary>mailbox</primary>
38246 <secondary>specifying size of</secondary>
38247 </indexterm>
38248 <indexterm role="concept">
38249 <primary>size</primary>
38250 <secondary>of mailbox</secondary>
38251 </indexterm>
38252 If this option is set, it is expanded, and the result is taken as the current
38253 size the mailbox. It must be a decimal number, optionally followed by K or M.
38254 This provides a way of obtaining this information from an external source that
38255 maintains the data. This is likely to be helpful for maildir deliveries where
38256 it is computationally expensive to compute the size of a mailbox.
38257 </para>
38258 <para>
38259 <indexterm role="option">
38260 <primary><option>maildir_format</option></primary>
38261 </indexterm>
38262 </para>
38263 <informaltable frame="all">
38264 <tgroup cols="4" colsep="0" rowsep="0">
38265 <colspec colwidth="8*" align="left"/>
38266 <colspec colwidth="6*" align="center"/>
38267 <colspec colwidth="6*" align="center"/>
38268 <colspec colwidth="6*" align="right"/>
38269 <tbody>
38270 <row>
38271 <entry><option>maildir_format</option></entry>
38272 <entry>Use: <emphasis>appendfile</emphasis></entry>
38273 <entry>Type: <emphasis>boolean</emphasis></entry>
38274 <entry>Default: <emphasis>false</emphasis></entry>
38275 </row>
38276 </tbody>
38277 </tgroup>
38278 </informaltable>
38279 <para>
38280 <indexterm role="concept">
38281 <primary>maildir format</primary>
38282 <secondary>specifying</secondary>
38283 </indexterm>
38284 If this option is set with the <option>directory</option> option, the delivery is into a new
38285 file, in the <quote>maildir</quote> format that is used by other mail software. When the
38286 transport is activated directly from a <command>redirect</command> router (for example, the
38287 <command>address_file</command> transport in the default configuration), setting
38288 <option>maildir_format</option> causes the path received from the router to be treated as a
38289 directory, whether or not it ends with <literal>/</literal>. This option is available only if
38290 SUPPORT_MAILDIR is present in <filename>Local/Makefile</filename>. See section
38291 <xref linkend="SECTmaildirdelivery"/> below for further details.
38292 </para>
38293 <para>
38294 <indexterm role="option">
38295 <primary><option>maildir_quota_directory_regex</option></primary>
38296 </indexterm>
38297 </para>
38298 <informaltable frame="all">
38299 <tgroup cols="4" colsep="0" rowsep="0">
38300 <colspec colwidth="8*" align="left"/>
38301 <colspec colwidth="6*" align="center"/>
38302 <colspec colwidth="6*" align="center"/>
38303 <colspec colwidth="6*" align="right"/>
38304 <tbody>
38305 <row>
38306 <entry><option>maildir_quota_directory_regex</option></entry>
38307 <entry>Use: <emphasis>appendfile</emphasis></entry>
38308 <entry>Type: <emphasis>string</emphasis></entry>
38309 <entry>Default: <emphasis>See below</emphasis></entry>
38310 </row>
38311 </tbody>
38312 </tgroup>
38313 </informaltable>
38314 <para>
38315 <indexterm role="concept">
38316 <primary>maildir format</primary>
38317 <secondary>quota; directories included in</secondary>
38318 </indexterm>
38319 <indexterm role="concept">
38320 <primary>quota</primary>
38321 <secondary>maildir; directories included in</secondary>
38322 </indexterm>
38323 This option is relevant only when <option>maildir_use_size_file</option> is set. It defines
38324 a regular expression for specifying directories, relative to the quota
38325 directory (see <option>quota_directory</option>), that should be included in the quota
38326 calculation. The default value is:
38327 </para>
38328 <literallayout class="monospaced">
38329 maildir_quota_directory_regex = ^(?:cur|new|\..*)$
38330 </literallayout>
38331 <para>
38332 This includes the <filename>cur</filename> and <filename>new</filename> directories, and any maildir++ folders
38333 (directories whose names begin with a dot). If you want to exclude the
38334 <filename>Trash</filename>
38335 folder from the count (as some sites do), you need to change this setting to
38336 </para>
38337 <literallayout class="monospaced">
38338 maildir_quota_directory_regex = ^(?:cur|new|\.(?!Trash).*)$
38339 </literallayout>
38340 <para>
38341 This uses a negative lookahead in the regular expression to exclude the
38342 directory whose name is <filename>.Trash</filename>. When a directory is excluded from quota
38343 calculations, quota processing is bypassed for any messages that are delivered
38344 directly into that directory.
38345 </para>
38346 <para>
38347 <indexterm role="option">
38348 <primary><option>maildir_retries</option></primary>
38349 </indexterm>
38350 </para>
38351 <informaltable frame="all">
38352 <tgroup cols="4" colsep="0" rowsep="0">
38353 <colspec colwidth="8*" align="left"/>
38354 <colspec colwidth="6*" align="center"/>
38355 <colspec colwidth="6*" align="center"/>
38356 <colspec colwidth="6*" align="right"/>
38357 <tbody>
38358 <row>
38359 <entry><option>maildir_retries</option></entry>
38360 <entry>Use: <emphasis>appendfile</emphasis></entry>
38361 <entry>Type: <emphasis>integer</emphasis></entry>
38362 <entry>Default: <emphasis>10</emphasis></entry>
38363 </row>
38364 </tbody>
38365 </tgroup>
38366 </informaltable>
38367 <para>
38368 This option specifies the number of times to retry when writing a file in
38369 <quote>maildir</quote> format. See section <xref linkend="SECTmaildirdelivery"/> below.
38370 </para>
38371 <para>
38372 <indexterm role="option">
38373 <primary><option>maildir_tag</option></primary>
38374 </indexterm>
38375 </para>
38376 <informaltable frame="all">
38377 <tgroup cols="4" colsep="0" rowsep="0">
38378 <colspec colwidth="8*" align="left"/>
38379 <colspec colwidth="6*" align="center"/>
38380 <colspec colwidth="6*" align="center"/>
38381 <colspec colwidth="6*" align="right"/>
38382 <tbody>
38383 <row>
38384 <entry><option>maildir_tag</option></entry>
38385 <entry>Use: <emphasis>appendfile</emphasis></entry>
38386 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38387 <entry>Default: <emphasis>unset</emphasis></entry>
38388 </row>
38389 </tbody>
38390 </tgroup>
38391 </informaltable>
38392 <para>
38393 This option applies only to deliveries in maildir format, and is described in
38394 section <xref linkend="SECTmaildirdelivery"/> below.
38395 </para>
38396 <para revisionflag="changed">
38397 <indexterm role="option">
38398 <primary><option>maildir_use_size_file</option></primary>
38399 </indexterm>
38400 </para>
38401 <informaltable frame="all" revisionflag="changed">
38402 <tgroup cols="4" colsep="0" rowsep="0">
38403 <colspec colwidth="8*" align="left"/>
38404 <colspec colwidth="6*" align="center"/>
38405 <colspec colwidth="6*" align="center"/>
38406 <colspec colwidth="6*" align="right"/>
38407 <tbody>
38408 <row>
38409 <entry><option>maildir_use_size_file</option></entry>
38410 <entry>Use: <emphasis>appendfile</emphasis>&dagger;<emphasis></emphasis></entry>
38411 <entry>Type: <emphasis>boolean</emphasis></entry>
38412 <entry>Default: <emphasis>false</emphasis></entry>
38413 </row>
38414 </tbody>
38415 </tgroup>
38416 </informaltable>
38417 <para revisionflag="changed">
38418 <indexterm role="concept">
38419 <primary>maildir format</primary>
38420 <secondary><filename>maildirsize</filename> file</secondary>
38421 </indexterm>
38422 The result of string expansion for this option must be a valid boolean value.
38423 If it is true, it enables support for <filename>maildirsize</filename> files. Exim
38424 creates a <filename>maildirsize</filename> file in a maildir if one does not exist, taking the
38425 quota from the <option>quota</option> option of the transport. If <option>quota</option> is unset, the
38426 value is zero. See <option>maildir_quota_directory_regex</option> above and section
38427 <xref linkend="SECTmaildirdelivery"/> below for further details.
38428 </para>
38429 <para>
38430 <indexterm role="option">
38431 <primary><option>maildirfolder_create_regex</option></primary>
38432 </indexterm>
38433 </para>
38434 <informaltable frame="all">
38435 <tgroup cols="4" colsep="0" rowsep="0">
38436 <colspec colwidth="8*" align="left"/>
38437 <colspec colwidth="6*" align="center"/>
38438 <colspec colwidth="6*" align="center"/>
38439 <colspec colwidth="6*" align="right"/>
38440 <tbody>
38441 <row>
38442 <entry><option>maildirfolder_create_regex</option></entry>
38443 <entry>Use: <emphasis>appendfile</emphasis></entry>
38444 <entry>Type: <emphasis>string</emphasis></entry>
38445 <entry>Default: <emphasis>unset</emphasis></entry>
38446 </row>
38447 </tbody>
38448 </tgroup>
38449 </informaltable>
38450 <para>
38451 <indexterm role="concept">
38452 <primary>maildir format</primary>
38453 <secondary><filename>maildirfolder</filename> file</secondary>
38454 </indexterm>
38455 <indexterm role="concept">
38456 <primary><filename>maildirfolder</filename>, creating</primary>
38457 </indexterm>
38458 The value of this option is a regular expression. If it is unset, it has no
38459 effect. Otherwise, before a maildir delivery takes place, the pattern is
38460 matched against the name of the maildir directory, that is, the directory
38461 containing the <filename>new</filename> and <filename>tmp</filename> subdirectories that will be used for the
38462 delivery. If there is a match, Exim checks for the existence of a file called
38463 <filename>maildirfolder</filename> in the directory, and creates it if it does not exist.
38464 See section <xref linkend="SECTmaildirdelivery"/> for more details.
38465 </para>
38466 <para>
38467 <indexterm role="option">
38468 <primary><option>mailstore_format</option></primary>
38469 </indexterm>
38470 </para>
38471 <informaltable frame="all">
38472 <tgroup cols="4" colsep="0" rowsep="0">
38473 <colspec colwidth="8*" align="left"/>
38474 <colspec colwidth="6*" align="center"/>
38475 <colspec colwidth="6*" align="center"/>
38476 <colspec colwidth="6*" align="right"/>
38477 <tbody>
38478 <row>
38479 <entry><option>mailstore_format</option></entry>
38480 <entry>Use: <emphasis>appendfile</emphasis></entry>
38481 <entry>Type: <emphasis>boolean</emphasis></entry>
38482 <entry>Default: <emphasis>false</emphasis></entry>
38483 </row>
38484 </tbody>
38485 </tgroup>
38486 </informaltable>
38487 <para>
38488 <indexterm role="concept">
38489 <primary>mailstore format</primary>
38490 <secondary>specifying</secondary>
38491 </indexterm>
38492 If this option is set with the <option>directory</option> option, the delivery is into two
38493 new files in  <quote>mailstore</quote> format. The option is available only if
38494 SUPPORT_MAILSTORE is present in <filename>Local/Makefile</filename>. See section <xref linkend="SECTopdir"/>
38495 below for further details.
38496 </para>
38497 <para>
38498 <indexterm role="option">
38499 <primary><option>mailstore_prefix</option></primary>
38500 </indexterm>
38501 </para>
38502 <informaltable frame="all">
38503 <tgroup cols="4" colsep="0" rowsep="0">
38504 <colspec colwidth="8*" align="left"/>
38505 <colspec colwidth="6*" align="center"/>
38506 <colspec colwidth="6*" align="center"/>
38507 <colspec colwidth="6*" align="right"/>
38508 <tbody>
38509 <row>
38510 <entry><option>mailstore_prefix</option></entry>
38511 <entry>Use: <emphasis>appendfile</emphasis></entry>
38512 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38513 <entry>Default: <emphasis>unset</emphasis></entry>
38514 </row>
38515 </tbody>
38516 </tgroup>
38517 </informaltable>
38518 <para>
38519 This option applies only to deliveries in mailstore format, and is described in
38520 section <xref linkend="SECTopdir"/> below.
38521 </para>
38522 <para>
38523 <indexterm role="option">
38524 <primary><option>mailstore_suffix</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>mailstore_suffix</option></entry>
38536 <entry>Use: <emphasis>appendfile</emphasis></entry>
38537 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38538 <entry>Default: <emphasis>unset</emphasis></entry>
38539 </row>
38540 </tbody>
38541 </tgroup>
38542 </informaltable>
38543 <para>
38544 This option applies only to deliveries in mailstore format, and is described in
38545 section <xref linkend="SECTopdir"/> below.
38546 </para>
38547 <para>
38548 <indexterm role="option">
38549 <primary><option>mbx_format</option></primary>
38550 </indexterm>
38551 </para>
38552 <informaltable frame="all">
38553 <tgroup cols="4" colsep="0" rowsep="0">
38554 <colspec colwidth="8*" align="left"/>
38555 <colspec colwidth="6*" align="center"/>
38556 <colspec colwidth="6*" align="center"/>
38557 <colspec colwidth="6*" align="right"/>
38558 <tbody>
38559 <row>
38560 <entry><option>mbx_format</option></entry>
38561 <entry>Use: <emphasis>appendfile</emphasis></entry>
38562 <entry>Type: <emphasis>boolean</emphasis></entry>
38563 <entry>Default: <emphasis>false</emphasis></entry>
38564 </row>
38565 </tbody>
38566 </tgroup>
38567 </informaltable>
38568 <para>
38569 <indexterm role="concept">
38570 <primary>locking files</primary>
38571 </indexterm>
38572 <indexterm role="concept">
38573 <primary>file</primary>
38574 <secondary>locking</secondary>
38575 </indexterm>
38576 <indexterm role="concept">
38577 <primary>file</primary>
38578 <secondary>MBX format</secondary>
38579 </indexterm>
38580 <indexterm role="concept">
38581 <primary>MBX format, specifying</primary>
38582 </indexterm>
38583 This option is available only if Exim has been compiled with SUPPORT_MBX
38584 set in <filename>Local/Makefile</filename>. If <option>mbx_format</option> is set with the <option>file</option> option,
38585 the message is appended to the mailbox file in MBX format instead of
38586 traditional Unix format. This format is supported by Pine4 and its associated
38587 IMAP and POP daemons, by means of the <emphasis>c-client</emphasis> library that they all use.
38588 </para>
38589 <para>
38590 <emphasis role="bold">Note</emphasis>: The <option>message_prefix</option> and <option>message_suffix</option> options are not
38591 automatically changed by the use of <option>mbx_format</option>. They should normally be set
38592 empty when using MBX format, so this option almost always appears in this
38593 combination:
38594 </para>
38595 <literallayout class="monospaced">
38596 mbx_format = true
38597 message_prefix =
38598 message_suffix =
38599 </literallayout>
38600 <para>
38601 If none of the locking options are mentioned in the configuration,
38602 <option>use_mbx_lock</option> is assumed and the other locking options default to false. It
38603 is possible to specify the other kinds of locking with <option>mbx_format</option>, but
38604 <option>use_fcntl_lock</option> and <option>use_mbx_lock</option> are mutually exclusive. MBX locking
38605 interworks with <emphasis>c-client</emphasis>, providing for shared access to the mailbox. It
38606 should not be used if any program that does not use this form of locking is
38607 going to access the mailbox, nor should it be used if the mailbox file is NFS
38608 mounted, because it works only when the mailbox is accessed from a single host.
38609 </para>
38610 <para>
38611 If you set <option>use_fcntl_lock</option> with an MBX-format mailbox, you cannot use
38612 the standard version of <emphasis>c-client</emphasis>, because as long as it has a mailbox open
38613 (this means for the whole of a Pine or IMAP session), Exim will not be able to
38614 append messages to it.
38615 </para>
38616 <para>
38617 <indexterm role="option">
38618 <primary><option>message_prefix</option></primary>
38619 </indexterm>
38620 </para>
38621 <informaltable frame="all">
38622 <tgroup cols="4" colsep="0" rowsep="0">
38623 <colspec colwidth="8*" align="left"/>
38624 <colspec colwidth="6*" align="center"/>
38625 <colspec colwidth="6*" align="center"/>
38626 <colspec colwidth="6*" align="right"/>
38627 <tbody>
38628 <row>
38629 <entry><option>message_prefix</option></entry>
38630 <entry>Use: <emphasis>appendfile</emphasis></entry>
38631 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38632 <entry>Default: <emphasis>see below</emphasis></entry>
38633 </row>
38634 </tbody>
38635 </tgroup>
38636 </informaltable>
38637 <para>
38638 <indexterm role="concept">
38639 <primary><quote>From</quote> line</primary>
38640 </indexterm>
38641 The string specified here is expanded and output at the start of every message.
38642 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
38643 in which case it is:
38644 </para>
38645 <literallayout class="monospaced">
38646 message_prefix = "From ${if def:return_path{$return_path}\
38647   {MAILER-DAEMON}} $tod_bsdinbox\n"
38648 </literallayout>
38649 <para>
38650 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
38651 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_prefix</option>.
38652 </para>
38653 <para>
38654 <indexterm role="option">
38655 <primary><option>message_suffix</option></primary>
38656 </indexterm>
38657 </para>
38658 <informaltable frame="all">
38659 <tgroup cols="4" colsep="0" rowsep="0">
38660 <colspec colwidth="8*" align="left"/>
38661 <colspec colwidth="6*" align="center"/>
38662 <colspec colwidth="6*" align="center"/>
38663 <colspec colwidth="6*" align="right"/>
38664 <tbody>
38665 <row>
38666 <entry><option>message_suffix</option></entry>
38667 <entry>Use: <emphasis>appendfile</emphasis></entry>
38668 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38669 <entry>Default: <emphasis>see below</emphasis></entry>
38670 </row>
38671 </tbody>
38672 </tgroup>
38673 </informaltable>
38674 <para>
38675 The string specified here is expanded and output at the end of every message.
38676 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
38677 in which case it is a single newline character. The suffix can be suppressed by
38678 setting
38679 </para>
38680 <literallayout class="monospaced">
38681 message_suffix =
38682 </literallayout>
38683 <para>
38684 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
38685 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_suffix</option>.
38686 </para>
38687 <para>
38688 <indexterm role="option">
38689 <primary><option>mode</option></primary>
38690 </indexterm>
38691 </para>
38692 <informaltable frame="all">
38693 <tgroup cols="4" colsep="0" rowsep="0">
38694 <colspec colwidth="8*" align="left"/>
38695 <colspec colwidth="6*" align="center"/>
38696 <colspec colwidth="6*" align="center"/>
38697 <colspec colwidth="6*" align="right"/>
38698 <tbody>
38699 <row>
38700 <entry><option>mode</option></entry>
38701 <entry>Use: <emphasis>appendfile</emphasis></entry>
38702 <entry>Type: <emphasis>octal integer</emphasis></entry>
38703 <entry>Default: <emphasis>0600</emphasis></entry>
38704 </row>
38705 </tbody>
38706 </tgroup>
38707 </informaltable>
38708 <para>
38709 If the output file is created, it is given this mode. If it already exists and
38710 has wider permissions, they are reduced to this mode. If it has narrower
38711 permissions, an error occurs unless <option>mode_fail_narrower</option> is false. However,
38712 if the delivery is the result of a <option>save</option> command in a filter file specifying
38713 a particular mode, the mode of the output file is always forced to take that
38714 value, and this option is ignored.
38715 </para>
38716 <para>
38717 <indexterm role="option">
38718 <primary><option>mode_fail_narrower</option></primary>
38719 </indexterm>
38720 </para>
38721 <informaltable frame="all">
38722 <tgroup cols="4" colsep="0" rowsep="0">
38723 <colspec colwidth="8*" align="left"/>
38724 <colspec colwidth="6*" align="center"/>
38725 <colspec colwidth="6*" align="center"/>
38726 <colspec colwidth="6*" align="right"/>
38727 <tbody>
38728 <row>
38729 <entry><option>mode_fail_narrower</option></entry>
38730 <entry>Use: <emphasis>appendfile</emphasis></entry>
38731 <entry>Type: <emphasis>boolean</emphasis></entry>
38732 <entry>Default: <emphasis>true</emphasis></entry>
38733 </row>
38734 </tbody>
38735 </tgroup>
38736 </informaltable>
38737 <para>
38738 This option applies in the case when an existing mailbox file has a narrower
38739 mode than that specified by the <option>mode</option> option. If <option>mode_fail_narrower</option> is
38740 true, the delivery is deferred (<quote>mailbox has the wrong mode</quote>); otherwise Exim
38741 continues with the delivery attempt, using the existing mode of the file.
38742 </para>
38743 <para>
38744 <indexterm role="option">
38745 <primary><option>notify_comsat</option></primary>
38746 </indexterm>
38747 </para>
38748 <informaltable frame="all">
38749 <tgroup cols="4" colsep="0" rowsep="0">
38750 <colspec colwidth="8*" align="left"/>
38751 <colspec colwidth="6*" align="center"/>
38752 <colspec colwidth="6*" align="center"/>
38753 <colspec colwidth="6*" align="right"/>
38754 <tbody>
38755 <row>
38756 <entry><option>notify_comsat</option></entry>
38757 <entry>Use: <emphasis>appendfile</emphasis></entry>
38758 <entry>Type: <emphasis>boolean</emphasis></entry>
38759 <entry>Default: <emphasis>false</emphasis></entry>
38760 </row>
38761 </tbody>
38762 </tgroup>
38763 </informaltable>
38764 <para>
38765 If this option is true, the <emphasis>comsat</emphasis> daemon is notified after every
38766 successful delivery to a user mailbox. This is the daemon that notifies logged
38767 on users about incoming mail.
38768 </para>
38769 <para>
38770 <indexterm role="option">
38771 <primary><option>quota</option></primary>
38772 </indexterm>
38773 </para>
38774 <informaltable frame="all">
38775 <tgroup cols="4" colsep="0" rowsep="0">
38776 <colspec colwidth="8*" align="left"/>
38777 <colspec colwidth="6*" align="center"/>
38778 <colspec colwidth="6*" align="center"/>
38779 <colspec colwidth="6*" align="right"/>
38780 <tbody>
38781 <row>
38782 <entry><option>quota</option></entry>
38783 <entry>Use: <emphasis>appendfile</emphasis></entry>
38784 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38785 <entry>Default: <emphasis>unset</emphasis></entry>
38786 </row>
38787 </tbody>
38788 </tgroup>
38789 </informaltable>
38790 <para>
38791 <indexterm role="concept">
38792 <primary>quota</primary>
38793 <secondary>imposed by Exim</secondary>
38794 </indexterm>
38795 This option imposes a limit on the size of the file to which Exim is appending,
38796 or to the total space used in the directory tree when the <option>directory</option> option
38797 is set. In the latter case, computation of the space used is expensive, because
38798 all the files in the directory (and any sub-directories) have to be
38799 individually inspected and their sizes summed. (See <option>quota_size_regex</option> and
38800 <option>maildir_use_size_file</option> for ways to avoid this in environments where users
38801 have no shell access to their mailboxes).
38802 </para>
38803 <para>
38804 As there is no interlock against two simultaneous deliveries into a
38805 multi-file mailbox, it is possible for the quota to be overrun in this case.
38806 For single-file mailboxes, of course, an interlock is a necessity.
38807 </para>
38808 <para>
38809 A file&#x2019;s size is taken as its <emphasis>used</emphasis> value. Because of blocking effects, this
38810 may be a lot less than the actual amount of disk space allocated to the file.
38811 If the sizes of a number of files are being added up, the rounding effect can
38812 become quite noticeable, especially on systems that have large block sizes.
38813 Nevertheless, it seems best to stick to the <emphasis>used</emphasis> figure, because this is
38814 the obvious value which users understand most easily.
38815 </para>
38816 <para>
38817 The value of the option is expanded, and must then be a numerical value
38818 (decimal point allowed), optionally followed by one of the letters K, M, or G,
38819 for kilobytes, megabytes, or gigabytes. If Exim is running on a system with
38820 large file support (Linux and FreeBSD have this), mailboxes larger than 2G can
38821 be handled.
38822 </para>
38823 <para>
38824 <emphasis role="bold">Note</emphasis>: A value of zero is interpreted as <quote>no quota</quote>.
38825 </para>
38826 <para>
38827 The expansion happens while Exim is running as root, before it changes uid for
38828 the delivery. This means that files that are inaccessible to the end user can
38829 be used to hold quota values that are looked up in the expansion. When delivery
38830 fails because this quota is exceeded, the handling of the error is as for
38831 system quota failures.
38832 </para>
38833 <para>
38834 By default, Exim&#x2019;s quota checking mimics system quotas, and restricts the
38835 mailbox to the specified maximum size, though the value is not accurate to the
38836 last byte, owing to separator lines and additional headers that may get added
38837 during message delivery. When a mailbox is nearly full, large messages may get
38838 refused even though small ones are accepted, because the size of the current
38839 message is added to the quota when the check is made. This behaviour can be
38840 changed by setting <option>quota_is_inclusive</option> false. When this is done, the check
38841 for exceeding the quota does not include the current message. Thus, deliveries
38842 continue until the quota has been exceeded; thereafter, no further messages are
38843 delivered. See also <option>quota_warn_threshold</option>.
38844 </para>
38845 <para>
38846 <indexterm role="option">
38847 <primary><option>quota_directory</option></primary>
38848 </indexterm>
38849 </para>
38850 <informaltable frame="all">
38851 <tgroup cols="4" colsep="0" rowsep="0">
38852 <colspec colwidth="8*" align="left"/>
38853 <colspec colwidth="6*" align="center"/>
38854 <colspec colwidth="6*" align="center"/>
38855 <colspec colwidth="6*" align="right"/>
38856 <tbody>
38857 <row>
38858 <entry><option>quota_directory</option></entry>
38859 <entry>Use: <emphasis>appendfile</emphasis></entry>
38860 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38861 <entry>Default: <emphasis>unset</emphasis></entry>
38862 </row>
38863 </tbody>
38864 </tgroup>
38865 </informaltable>
38866 <para>
38867 This option defines the directory to check for quota purposes when delivering
38868 into individual files. The default is the delivery directory, or, if a file
38869 called <filename>maildirfolder</filename> exists in a maildir directory, the parent of the
38870 delivery directory.
38871 </para>
38872 <para>
38873 <indexterm role="option">
38874 <primary><option>quota_filecount</option></primary>
38875 </indexterm>
38876 </para>
38877 <informaltable frame="all">
38878 <tgroup cols="4" colsep="0" rowsep="0">
38879 <colspec colwidth="8*" align="left"/>
38880 <colspec colwidth="6*" align="center"/>
38881 <colspec colwidth="6*" align="center"/>
38882 <colspec colwidth="6*" align="right"/>
38883 <tbody>
38884 <row>
38885 <entry><option>quota_filecount</option></entry>
38886 <entry>Use: <emphasis>appendfile</emphasis></entry>
38887 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38888 <entry>Default: <emphasis>0</emphasis></entry>
38889 </row>
38890 </tbody>
38891 </tgroup>
38892 </informaltable>
38893 <para>
38894 This option applies when the <option>directory</option> option is set. It limits the total
38895 number of files in the directory (compare the inode limit in system quotas). It
38896 can only be used if <option>quota</option> is also set. The value is expanded; an expansion
38897 failure causes delivery to be deferred. A value of zero is interpreted as
38898 <quote>no quota</quote>.
38899 </para>
38900 <para>
38901 <indexterm role="option">
38902 <primary><option>quota_is_inclusive</option></primary>
38903 </indexterm>
38904 </para>
38905 <informaltable frame="all">
38906 <tgroup cols="4" colsep="0" rowsep="0">
38907 <colspec colwidth="8*" align="left"/>
38908 <colspec colwidth="6*" align="center"/>
38909 <colspec colwidth="6*" align="center"/>
38910 <colspec colwidth="6*" align="right"/>
38911 <tbody>
38912 <row>
38913 <entry><option>quota_is_inclusive</option></entry>
38914 <entry>Use: <emphasis>appendfile</emphasis></entry>
38915 <entry>Type: <emphasis>boolean</emphasis></entry>
38916 <entry>Default: <emphasis>true</emphasis></entry>
38917 </row>
38918 </tbody>
38919 </tgroup>
38920 </informaltable>
38921 <para>
38922 See <option>quota</option> above.
38923 </para>
38924 <para>
38925 <indexterm role="option">
38926 <primary><option>quota_size_regex</option></primary>
38927 </indexterm>
38928 </para>
38929 <informaltable frame="all">
38930 <tgroup cols="4" colsep="0" rowsep="0">
38931 <colspec colwidth="8*" align="left"/>
38932 <colspec colwidth="6*" align="center"/>
38933 <colspec colwidth="6*" align="center"/>
38934 <colspec colwidth="6*" align="right"/>
38935 <tbody>
38936 <row>
38937 <entry><option>quota_size_regex</option></entry>
38938 <entry>Use: <emphasis>appendfile</emphasis></entry>
38939 <entry>Type: <emphasis>string</emphasis></entry>
38940 <entry>Default: <emphasis>unset</emphasis></entry>
38941 </row>
38942 </tbody>
38943 </tgroup>
38944 </informaltable>
38945 <para>
38946 This option applies when one of the delivery modes that writes a separate file
38947 for each message is being used. When Exim wants to find the size of one of
38948 these files in order to test the quota, it first checks <option>quota_size_regex</option>.
38949 If this is set to a regular expression that matches the file name, and it
38950 captures one string, that string is interpreted as a representation of the
38951 file&#x2019;s size. The value of <option>quota_size_regex</option> is not expanded.
38952 </para>
38953 <para>
38954 This feature is useful only when users have no shell access to their mailboxes
38955 &ndash; otherwise they could defeat the quota simply by renaming the files. This
38956 facility can be used with maildir deliveries, by setting <option>maildir_tag</option> to add
38957 the file length to the file name. For example:
38958 </para>
38959 <literallayout class="monospaced">
38960 maildir_tag = ,S=$message_size
38961 quota_size_regex = ,S=(\d+)
38962 </literallayout>
38963 <para>
38964 An alternative to <varname>$message_size</varname> is <varname>$message_linecount</varname>, which contains the
38965 number of lines in the message.
38966 </para>
38967 <para>
38968 The regular expression should not assume that the length is at the end of the
38969 file name (even though <option>maildir_tag</option> puts it there) because maildir MUAs
38970 sometimes add other information onto the ends of message file names.
38971 </para>
38972 <para>
38973 Section <xref linkend="SECID136"/> contains further information.
38974 </para>
38975 <para>
38976 <indexterm role="option">
38977 <primary><option>quota_warn_message</option></primary>
38978 </indexterm>
38979 </para>
38980 <informaltable frame="all">
38981 <tgroup cols="4" colsep="0" rowsep="0">
38982 <colspec colwidth="8*" align="left"/>
38983 <colspec colwidth="6*" align="center"/>
38984 <colspec colwidth="6*" align="center"/>
38985 <colspec colwidth="6*" align="right"/>
38986 <tbody>
38987 <row>
38988 <entry><option>quota_warn_message</option></entry>
38989 <entry>Use: <emphasis>appendfile</emphasis></entry>
38990 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38991 <entry>Default: <emphasis>see below</emphasis></entry>
38992 </row>
38993 </tbody>
38994 </tgroup>
38995 </informaltable>
38996 <para>
38997 See below for the use of this option. If it is not set when
38998 <option>quota_warn_threshold</option> is set, it defaults to
38999 </para>
39000 <literallayout class="monospaced">
39001 quota_warn_message = "\
39002   To: $local_part@$domain\n\
39003   Subject: Your mailbox\n\n\
39004   This message is automatically created \
39005   by mail delivery software.\n\n\
39006   The size of your mailbox has exceeded \
39007   a warning threshold that is\n\
39008   set by the system administrator.\n"
39009 </literallayout>
39010 <para>
39011 <indexterm role="option">
39012 <primary><option>quota_warn_threshold</option></primary>
39013 </indexterm>
39014 </para>
39015 <informaltable frame="all">
39016 <tgroup cols="4" colsep="0" rowsep="0">
39017 <colspec colwidth="8*" align="left"/>
39018 <colspec colwidth="6*" align="center"/>
39019 <colspec colwidth="6*" align="center"/>
39020 <colspec colwidth="6*" align="right"/>
39021 <tbody>
39022 <row>
39023 <entry><option>quota_warn_threshold</option></entry>
39024 <entry>Use: <emphasis>appendfile</emphasis></entry>
39025 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39026 <entry>Default: <emphasis>0</emphasis></entry>
39027 </row>
39028 </tbody>
39029 </tgroup>
39030 </informaltable>
39031 <para>
39032 <indexterm role="concept">
39033 <primary>quota</primary>
39034 <secondary>warning threshold</secondary>
39035 </indexterm>
39036 <indexterm role="concept">
39037 <primary>mailbox</primary>
39038 <secondary>size warning</secondary>
39039 </indexterm>
39040 <indexterm role="concept">
39041 <primary>size</primary>
39042 <secondary>of mailbox</secondary>
39043 </indexterm>
39044 This option is expanded in the same way as <option>quota</option> (see above). If the
39045 resulting value is greater than zero, and delivery of the message causes the
39046 size of the file or total space in the directory tree to cross the given
39047 threshold, a warning message is sent. If <option>quota</option> is also set, the threshold
39048 may be specified as a percentage of it by following the value with a percent
39049 sign. For example:
39050 </para>
39051 <literallayout class="monospaced">
39052 quota = 10M
39053 quota_warn_threshold = 75%
39054 </literallayout>
39055 <para>
39056 If <option>quota</option> is not set, a setting of <option>quota_warn_threshold</option> that ends with a
39057 percent sign is ignored.
39058 </para>
39059 <para>
39060 The warning message itself is specified by the <option>quota_warn_message</option> option,
39061 and it must start with a <emphasis>To:</emphasis> header line containing the recipient(s) of the
39062 warning message. These do not necessarily have to include the recipient(s) of
39063 the original message. A <emphasis>Subject:</emphasis> line should also normally be supplied. You
39064 can include any other header lines that you want. If you do not include a
39065 <emphasis>From:</emphasis> line, the default is:
39066 </para>
39067 <literallayout class="monospaced">
39068 From: Mail Delivery System &lt;mailer-daemon@$qualify_domain_sender&gt;
39069 </literallayout>
39070 <para>
39071 <indexterm role="option">
39072 <primary><option>errors_reply_to</option></primary>
39073 </indexterm>
39074 If you supply a <emphasis>Reply-To:</emphasis> line, it overrides the global <option>errors_reply_to</option>
39075 option.
39076 </para>
39077 <para>
39078 The <option>quota</option> option does not have to be set in order to use this option; they
39079 are independent of one another except when the threshold is specified as a
39080 percentage.
39081 </para>
39082 <para>
39083 <indexterm role="option">
39084 <primary><option>use_bsmtp</option></primary>
39085 </indexterm>
39086 </para>
39087 <informaltable frame="all">
39088 <tgroup cols="4" colsep="0" rowsep="0">
39089 <colspec colwidth="8*" align="left"/>
39090 <colspec colwidth="6*" align="center"/>
39091 <colspec colwidth="6*" align="center"/>
39092 <colspec colwidth="6*" align="right"/>
39093 <tbody>
39094 <row>
39095 <entry><option>use_bsmtp</option></entry>
39096 <entry>Use: <emphasis>appendfile</emphasis></entry>
39097 <entry>Type: <emphasis>boolean</emphasis></entry>
39098 <entry>Default: <emphasis>false</emphasis></entry>
39099 </row>
39100 </tbody>
39101 </tgroup>
39102 </informaltable>
39103 <para>
39104 <indexterm role="concept">
39105 <primary>envelope sender</primary>
39106 </indexterm>
39107 If this option is set true, <command>appendfile</command> writes messages in <quote>batch SMTP</quote>
39108 format, with the envelope sender and recipient(s) included as SMTP commands. If
39109 you want to include a leading HELO command with such messages, you can do
39110 so by setting the <option>message_prefix</option> option. See section <xref linkend="SECTbatchSMTP"/>
39111 for details of batch SMTP.
39112 </para>
39113 <para>
39114 <indexterm role="option">
39115 <primary><option>use_crlf</option></primary>
39116 </indexterm>
39117 </para>
39118 <informaltable frame="all">
39119 <tgroup cols="4" colsep="0" rowsep="0">
39120 <colspec colwidth="8*" align="left"/>
39121 <colspec colwidth="6*" align="center"/>
39122 <colspec colwidth="6*" align="center"/>
39123 <colspec colwidth="6*" align="right"/>
39124 <tbody>
39125 <row>
39126 <entry><option>use_crlf</option></entry>
39127 <entry>Use: <emphasis>appendfile</emphasis></entry>
39128 <entry>Type: <emphasis>boolean</emphasis></entry>
39129 <entry>Default: <emphasis>false</emphasis></entry>
39130 </row>
39131 </tbody>
39132 </tgroup>
39133 </informaltable>
39134 <para>
39135 <indexterm role="concept">
39136 <primary>carriage return</primary>
39137 </indexterm>
39138 <indexterm role="concept">
39139 <primary>linefeed</primary>
39140 </indexterm>
39141 This option causes lines to be terminated with the two-character CRLF sequence
39142 (carriage return, linefeed) instead of just a linefeed character. In the case
39143 of batched SMTP, the byte sequence written to the file is then an exact image
39144 of what would be sent down a real SMTP connection.
39145 </para>
39146 <para>
39147 <emphasis role="bold">Note:</emphasis> The contents of the <option>message_prefix</option> and <option>message_suffix</option> options
39148 (which are used to supply the traditional <quote>From&nbsp;</quote> and blank line separators
39149 in Berkeley-style mailboxes) are written verbatim, so must contain their own
39150 carriage return characters if these are needed. In cases where these options
39151 have non-empty defaults, the values end with a single linefeed, so they must be
39152 changed to end with <literal>\r\n</literal> if <option>use_crlf</option> is set.
39153 </para>
39154 <para>
39155 <indexterm role="option">
39156 <primary><option>use_fcntl_lock</option></primary>
39157 </indexterm>
39158 </para>
39159 <informaltable frame="all">
39160 <tgroup cols="4" colsep="0" rowsep="0">
39161 <colspec colwidth="8*" align="left"/>
39162 <colspec colwidth="6*" align="center"/>
39163 <colspec colwidth="6*" align="center"/>
39164 <colspec colwidth="6*" align="right"/>
39165 <tbody>
39166 <row>
39167 <entry><option>use_fcntl_lock</option></entry>
39168 <entry>Use: <emphasis>appendfile</emphasis></entry>
39169 <entry>Type: <emphasis>boolean</emphasis></entry>
39170 <entry>Default: <emphasis>see below</emphasis></entry>
39171 </row>
39172 </tbody>
39173 </tgroup>
39174 </informaltable>
39175 <para>
39176 This option controls the use of the <function>fcntl()</function> function to lock a file for
39177 exclusive use when a message is being appended. It is set by default unless
39178 <option>use_flock_lock</option> is set. Otherwise, it should be turned off only if you know
39179 that all your MUAs use lock file locking. When both <option>use_fcntl_lock</option> and
39180 <option>use_flock_lock</option> are unset, <option>use_lockfile</option> must be set.
39181 </para>
39182 <para>
39183 <indexterm role="option">
39184 <primary><option>use_flock_lock</option></primary>
39185 </indexterm>
39186 </para>
39187 <informaltable frame="all">
39188 <tgroup cols="4" colsep="0" rowsep="0">
39189 <colspec colwidth="8*" align="left"/>
39190 <colspec colwidth="6*" align="center"/>
39191 <colspec colwidth="6*" align="center"/>
39192 <colspec colwidth="6*" align="right"/>
39193 <tbody>
39194 <row>
39195 <entry><option>use_flock_lock</option></entry>
39196 <entry>Use: <emphasis>appendfile</emphasis></entry>
39197 <entry>Type: <emphasis>boolean</emphasis></entry>
39198 <entry>Default: <emphasis>false</emphasis></entry>
39199 </row>
39200 </tbody>
39201 </tgroup>
39202 </informaltable>
39203 <para>
39204 This option is provided to support the use of <function>flock()</function> for file locking, for
39205 the few situations where it is needed. Most modern operating systems support
39206 <function>fcntl()</function> and <function>lockf()</function> locking, and these two functions interwork with
39207 each other. Exim uses <function>fcntl()</function> locking by default.
39208 </para>
39209 <para>
39210 This option is required only if you are using an operating system where
39211 <function>flock()</function> is used by programs that access mailboxes (typically MUAs), and
39212 where <function>flock()</function> does not correctly interwork with <function>fcntl()</function>. You can use
39213 both <function>fcntl()</function> and <function>flock()</function> locking simultaneously if you want.
39214 </para>
39215 <para>
39216 <indexterm role="concept">
39217 <primary>Solaris</primary>
39218 <secondary><function>flock()</function> support</secondary>
39219 </indexterm>
39220 Not all operating systems provide <function>flock()</function>. Some versions of Solaris do not
39221 have it (and some, I think, provide a not quite right version built on top of
39222 <function>lockf()</function>). If the OS does not have <function>flock()</function>, Exim will be built without
39223 the ability to use it, and any attempt to do so will cause a configuration
39224 error.
39225 </para>
39226 <para>
39227 <emphasis role="bold">Warning</emphasis>: <function>flock()</function> locks do not work on NFS files (unless <function>flock()</function>
39228 is just being mapped onto <function>fcntl()</function> by the OS).
39229 </para>
39230 <para>
39231 <indexterm role="option">
39232 <primary><option>use_lockfile</option></primary>
39233 </indexterm>
39234 </para>
39235 <informaltable frame="all">
39236 <tgroup cols="4" colsep="0" rowsep="0">
39237 <colspec colwidth="8*" align="left"/>
39238 <colspec colwidth="6*" align="center"/>
39239 <colspec colwidth="6*" align="center"/>
39240 <colspec colwidth="6*" align="right"/>
39241 <tbody>
39242 <row>
39243 <entry><option>use_lockfile</option></entry>
39244 <entry>Use: <emphasis>appendfile</emphasis></entry>
39245 <entry>Type: <emphasis>boolean</emphasis></entry>
39246 <entry>Default: <emphasis>see below</emphasis></entry>
39247 </row>
39248 </tbody>
39249 </tgroup>
39250 </informaltable>
39251 <para>
39252 If this option is turned off, Exim does not attempt to create a lock file when
39253 appending to a mailbox file. In this situation, the only locking is by
39254 <function>fcntl()</function>. You should only turn <option>use_lockfile</option> off if you are absolutely
39255 sure that every MUA that is ever going to look at your users&#x2019; mailboxes uses
39256 <function>fcntl()</function> rather than a lock file, and even then only when you are not
39257 delivering over NFS from more than one host.
39258 </para>
39259 <para>
39260 <indexterm role="concept">
39261 <primary>NFS</primary>
39262 <secondary>lock file</secondary>
39263 </indexterm>
39264 In order to append to an NFS file safely from more than one host, it is
39265 necessary to take out a lock <emphasis>before</emphasis> opening the file, and the lock file
39266 achieves this. Otherwise, even with <function>fcntl()</function> locking, there is a risk of
39267 file corruption.
39268 </para>
39269 <para>
39270 The <option>use_lockfile</option> option is set by default unless <option>use_mbx_lock</option> is set.
39271 It is not possible to turn both <option>use_lockfile</option> and <option>use_fcntl_lock</option> off,
39272 except when <option>mbx_format</option> is set.
39273 </para>
39274 <para>
39275 <indexterm role="option">
39276 <primary><option>use_mbx_lock</option></primary>
39277 </indexterm>
39278 </para>
39279 <informaltable frame="all">
39280 <tgroup cols="4" colsep="0" rowsep="0">
39281 <colspec colwidth="8*" align="left"/>
39282 <colspec colwidth="6*" align="center"/>
39283 <colspec colwidth="6*" align="center"/>
39284 <colspec colwidth="6*" align="right"/>
39285 <tbody>
39286 <row>
39287 <entry><option>use_mbx_lock</option></entry>
39288 <entry>Use: <emphasis>appendfile</emphasis></entry>
39289 <entry>Type: <emphasis>boolean</emphasis></entry>
39290 <entry>Default: <emphasis>see below</emphasis></entry>
39291 </row>
39292 </tbody>
39293 </tgroup>
39294 </informaltable>
39295 <para>
39296 This option is available only if Exim has been compiled with SUPPORT_MBX
39297 set in <filename>Local/Makefile</filename>. Setting the option specifies that special MBX
39298 locking rules be used. It is set by default if <option>mbx_format</option> is set and none
39299 of the locking options are mentioned in the configuration. The locking rules
39300 are the same as are used by the <emphasis>c-client</emphasis> library that underlies Pine and
39301 the IMAP4 and POP daemons that come with it (see the discussion below). The
39302 rules allow for shared access to the mailbox. However, this kind of locking
39303 does not work when the mailbox is NFS mounted.
39304 </para>
39305 <para>
39306 You can set <option>use_mbx_lock</option> with either (or both) of <option>use_fcntl_lock</option> and
39307 <option>use_flock_lock</option> to control what kind of locking is used in implementing the
39308 MBX locking rules. The default is to use <function>fcntl()</function> if <option>use_mbx_lock</option> is set
39309 without <option>use_fcntl_lock</option> or <option>use_flock_lock</option>.
39310 </para>
39311 </section>
39312 <section id="SECTopappend">
39313 <title>Operational details for appending</title>
39314 <para>
39315 <indexterm role="concept">
39316 <primary>appending to a file</primary>
39317 </indexterm>
39318 <indexterm role="concept">
39319 <primary>file</primary>
39320 <secondary>appending</secondary>
39321 </indexterm>
39322 Before appending to a file, the following preparations are made:
39323 </para>
39324 <itemizedlist>
39325 <listitem>
39326 <para>
39327 If the name of the file is <filename>/dev/null</filename>, no action is taken, and a success
39328 return is given.
39329 </para>
39330 </listitem>
39331 <listitem>
39332 <para>
39333 <indexterm role="concept">
39334 <primary>directory creation</primary>
39335 </indexterm>
39336 If any directories on the file&#x2019;s path are missing, Exim creates them if the
39337 <option>create_directory</option> option is set. A created directory&#x2019;s mode is given by the
39338 <option>directory_mode</option> option.
39339 </para>
39340 </listitem>
39341 <listitem>
39342 <para>
39343 If <option>file_format</option> is set, the format of an existing file is checked. If this
39344 indicates that a different transport should be used, control is passed to that
39345 transport.
39346 </para>
39347 </listitem>
39348 <listitem>
39349 <para>
39350 <indexterm role="concept">
39351 <primary>file</primary>
39352 <secondary>locking</secondary>
39353 </indexterm>
39354 <indexterm role="concept">
39355 <primary>locking files</primary>
39356 </indexterm>
39357 <indexterm role="concept">
39358 <primary>NFS</primary>
39359 <secondary>lock file</secondary>
39360 </indexterm>
39361 If <option>use_lockfile</option> is set, a lock file is built in a way that will work
39362 reliably over NFS, as follows:
39363 </para>
39364 <orderedlist numeration="arabic">
39365 <listitem>
39366 <para>
39367 Create a <quote>hitching post</quote> file whose name is that of the lock file with the
39368 current time, primary host name, and process id added, by opening for writing
39369 as a new file. If this fails with an access error, delivery is deferred.
39370 </para>
39371 </listitem>
39372 <listitem>
39373 <para>
39374 Close the hitching post file, and hard link it to the lock file name.
39375 </para>
39376 </listitem>
39377 <listitem>
39378 <para>
39379 If the call to <function>link()</function> succeeds, creation of the lock file has succeeded.
39380 Unlink the hitching post name.
39381 </para>
39382 </listitem>
39383 <listitem>
39384 <para>
39385 Otherwise, use <function>stat()</function> to get information about the hitching post file, and
39386 then unlink hitching post name. If the number of links is exactly two, creation
39387 of the lock file succeeded but something (for example, an NFS server crash and
39388 restart) caused this fact not to be communicated to the <function>link()</function> call.
39389 </para>
39390 </listitem>
39391 <listitem>
39392 <para>
39393 If creation of the lock file failed, wait for <option>lock_interval</option> and try again,
39394 up to <option>lock_retries</option> times. However, since any program that writes to a
39395 mailbox should complete its task very quickly, it is reasonable to time out old
39396 lock files that are normally the result of user agent and system crashes. If an
39397 existing lock file is older than <option>lockfile_timeout</option> Exim attempts to unlink
39398 it before trying again.
39399 </para>
39400 </listitem>
39401 </orderedlist>
39402 </listitem>
39403 <listitem>
39404 <para>
39405 A call is made to <function>lstat()</function> to discover whether the main file exists, and if
39406 so, what its characteristics are. If <function>lstat()</function> fails for any reason other
39407 than non-existence, delivery is deferred.
39408 </para>
39409 </listitem>
39410 <listitem>
39411 <para>
39412 <indexterm role="concept">
39413 <primary>symbolic link</primary>
39414 <secondary>to mailbox</secondary>
39415 </indexterm>
39416 <indexterm role="concept">
39417 <primary>mailbox</primary>
39418 <secondary>symbolic link</secondary>
39419 </indexterm>
39420 If the file does exist and is a symbolic link, delivery is deferred, unless the
39421 <option>allow_symlink</option> option is set, in which case the ownership of the link is
39422 checked, and then <function>stat()</function> is called to find out about the real file, which
39423 is then subjected to the checks below. The check on the top-level link
39424 ownership prevents one user creating a link for another&#x2019;s mailbox in a sticky
39425 directory, though allowing symbolic links in this case is definitely not a good
39426 idea. If there is a chain of symbolic links, the intermediate ones are not
39427 checked.
39428 </para>
39429 </listitem>
39430 <listitem>
39431 <para>
39432 If the file already exists but is not a regular file, or if the file&#x2019;s owner
39433 and group (if the group is being checked &ndash; see <option>check_group</option> above) are
39434 different from the user and group under which the delivery is running,
39435 delivery is deferred.
39436 </para>
39437 </listitem>
39438 <listitem>
39439 <para>
39440 If the file&#x2019;s permissions are more generous than specified, they are reduced.
39441 If they are insufficient, delivery is deferred, unless <option>mode_fail_narrower</option>
39442 is set false, in which case the delivery is tried using the existing
39443 permissions.
39444 </para>
39445 </listitem>
39446 <listitem>
39447 <para>
39448 The file&#x2019;s inode number is saved, and the file is then opened for appending.
39449 If this fails because the file has vanished, <command>appendfile</command> behaves as if it
39450 hadn&#x2019;t existed (see below). For any other failures, delivery is deferred.
39451 </para>
39452 </listitem>
39453 <listitem>
39454 <para>
39455 If the file is opened successfully, check that the inode number hasn&#x2019;t
39456 changed, that it is still a regular file, and that the owner and permissions
39457 have not changed. If anything is wrong, defer delivery and freeze the message.
39458 </para>
39459 </listitem>
39460 <listitem>
39461 <para>
39462 If the file did not exist originally, defer delivery if the <option>file_must_exist</option>
39463 option is set. Otherwise, check that the file is being created in a permitted
39464 directory if the <option>create_file</option> option is set (deferring on failure), and then
39465 open for writing as a new file, with the O_EXCL and O_CREAT options,
39466 except when dealing with a symbolic link (the <option>allow_symlink</option> option must be
39467 set). In this case, which can happen if the link points to a non-existent file,
39468 the file is opened for writing using O_CREAT but not O_EXCL, because
39469 that prevents link following.
39470 </para>
39471 </listitem>
39472 <listitem>
39473 <para>
39474 <indexterm role="concept">
39475 <primary>loop</primary>
39476 <secondary>while file testing</secondary>
39477 </indexterm>
39478 If opening fails because the file exists, obey the tests given above for
39479 existing files. However, to avoid looping in a situation where the file is
39480 being continuously created and destroyed, the exists/not-exists loop is broken
39481 after 10 repetitions, and the message is then frozen.
39482 </para>
39483 </listitem>
39484 <listitem>
39485 <para>
39486 If opening fails with any other error, defer delivery.
39487 </para>
39488 </listitem>
39489 <listitem>
39490 <para>
39491 <indexterm role="concept">
39492 <primary>file</primary>
39493 <secondary>locking</secondary>
39494 </indexterm>
39495 <indexterm role="concept">
39496 <primary>locking files</primary>
39497 </indexterm>
39498 Once the file is open, unless both <option>use_fcntl_lock</option> and <option>use_flock_lock</option>
39499 are false, it is locked using <function>fcntl()</function> or <function>flock()</function> or both. If
39500 <option>use_mbx_lock</option> is false, an exclusive lock is requested in each case.
39501 However, if <option>use_mbx_lock</option> is true, Exim takes out a shared lock on the open
39502 file, and an exclusive lock on the file whose name is
39503 </para>
39504 <literallayout class="monospaced">
39505 /tmp/.&lt;device-number&gt;.&lt;inode-number&gt;
39506 </literallayout>
39507 <para>
39508 using the device and inode numbers of the open mailbox file, in accordance with
39509 the MBX locking rules. This file is created with a mode that is specified by
39510 the <option>lockfile_mode</option> option.
39511 </para>
39512 <para>
39513 If Exim fails to lock the file, there are two possible courses of action,
39514 depending on the value of the locking timeout. This is obtained from
39515 <option>lock_fcntl_timeout</option> or <option>lock_flock_timeout</option>, as appropriate.
39516 </para>
39517 <para>
39518 If the timeout value is zero, the file is closed, Exim waits for
39519 <option>lock_interval</option>, and then goes back and re-opens the file as above and tries
39520 to lock it again. This happens up to <option>lock_retries</option> times, after which the
39521 delivery is deferred.
39522 </para>
39523 <para>
39524 If the timeout has a value greater than zero, blocking calls to <function>fcntl()</function> or
39525 <function>flock()</function> are used (with the given timeout), so there has already been some
39526 waiting involved by the time locking fails. Nevertheless, Exim does not give up
39527 immediately. It retries up to
39528 </para>
39529 <literallayout class="monospaced">
39530 (lock_retries * lock_interval) / &lt;timeout&gt;
39531 </literallayout>
39532 <para>
39533 times (rounded up).
39534 </para>
39535 </listitem>
39536 </itemizedlist>
39537 <para>
39538 At the end of delivery, Exim closes the file (which releases the <function>fcntl()</function>
39539 and/or <function>flock()</function> locks) and then deletes the lock file if one was created.
39540 </para>
39541 </section>
39542 <section id="SECTopdir">
39543 <title>Operational details for delivery to a new file</title>
39544 <para>
39545 <indexterm role="concept">
39546 <primary>delivery</primary>
39547 <secondary>to single file</secondary>
39548 </indexterm>
39549 <indexterm role="concept">
39550 <primary><quote>From</quote> line</primary>
39551 </indexterm>
39552 When the <option>directory</option> option is set instead of <option>file</option>, each message is
39553 delivered into a newly-created file or set of files. When <command>appendfile</command> is
39554 activated directly from a <command>redirect</command> router, neither <option>file</option> nor
39555 <option>directory</option> is normally set, because the path for delivery is supplied by the
39556 router. (See for example, the <command>address_file</command> transport in the default
39557 configuration.) In this case, delivery is to a new file if either the path name
39558 ends in <literal>/</literal>, or the <option>maildir_format</option> or <option>mailstore_format</option> option is set.
39559 </para>
39560 <para>
39561 No locking is required while writing the message to a new file, so the various
39562 locking options of the transport are ignored. The <quote>From</quote> line that by default
39563 separates messages in a single file is not normally needed, nor is the escaping
39564 of message lines that start with <quote>From</quote>, and there is no need to ensure a
39565 newline at the end of each message. Consequently, the default values for
39566 <option>check_string</option>, <option>message_prefix</option>, and <option>message_suffix</option> are all unset when
39567 any of <option>directory</option>, <option>maildir_format</option>, or <option>mailstore_format</option> is set.
39568 </para>
39569 <para>
39570 If Exim is required to check a <option>quota</option> setting, it adds up the sizes of all
39571 the files in the delivery directory by default. However, you can specify a
39572 different directory by setting <option>quota_directory</option>. Also, for maildir
39573 deliveries (see below) the <filename>maildirfolder</filename> convention is honoured.
39574 </para>
39575 <para>
39576 <indexterm role="concept">
39577 <primary>maildir format</primary>
39578 </indexterm>
39579 <indexterm role="concept">
39580 <primary>mailstore format</primary>
39581 </indexterm>
39582 There are three different ways in which delivery to individual files can be
39583 done, controlled by the settings of the <option>maildir_format</option> and
39584 <option>mailstore_format</option> options. Note that code to support maildir or mailstore
39585 formats is not included in the binary unless SUPPORT_MAILDIR or
39586 SUPPORT_MAILSTORE, respectively, is set in <filename>Local/Makefile</filename>.
39587 </para>
39588 <para>
39589 <indexterm role="concept">
39590 <primary>directory creation</primary>
39591 </indexterm>
39592 In all three cases an attempt is made to create the directory and any necessary
39593 sub-directories if they do not exist, provided that the <option>create_directory</option>
39594 option is set (the default). The location of a created directory can be
39595 constrained by setting <option>create_file</option>. A created directory&#x2019;s mode is given by
39596 the <option>directory_mode</option> option. If creation fails, or if the
39597 <option>create_directory</option> option is not set when creation is required, delivery is
39598 deferred.
39599 </para>
39600 </section>
39601 <section id="SECTmaildirdelivery">
39602 <title>Maildir delivery</title>
39603 <para>
39604 <indexterm role="concept">
39605 <primary>maildir format</primary>
39606 <secondary>description of</secondary>
39607 </indexterm>
39608 If the <option>maildir_format</option> option is true, Exim delivers each message by writing
39609 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
39610 directory that is defined by the <option>directory</option> option (the <quote>delivery
39611 directory</quote>). If the delivery is successful, the file is renamed into the
39612 <filename>new</filename> subdirectory.
39613 </para>
39614 <para>
39615 In the file name, &lt;<emphasis>stime</emphasis>&gt; is the current time of day in seconds, and
39616 &lt;<emphasis>mtime</emphasis>&gt; is the microsecond fraction of the time. After a maildir delivery,
39617 Exim checks that the time-of-day clock has moved on by at least one microsecond
39618 before terminating the delivery process. This guarantees uniqueness for the
39619 file name. However, as a precaution, Exim calls <function>stat()</function> for the file before
39620 opening it. If any response other than ENOENT (does not exist) is given,
39621 Exim waits 2 seconds and tries again, up to <option>maildir_retries</option> times.
39622 </para>
39623 <para>
39624 Before Exim carries out a maildir delivery, it ensures that subdirectories
39625 called <filename>new</filename>, <filename>cur</filename>, and <filename>tmp</filename> exist in the delivery directory. If they
39626 do not exist, Exim tries to create them and any superior directories in their
39627 path, subject to the <option>create_directory</option> and <option>create_file</option> options. If the
39628 <option>maildirfolder_create_regex</option> option is set, and the regular expression it
39629 contains matches the delivery directory, Exim also ensures that a file called
39630 <filename>maildirfolder</filename> exists in the delivery directory. If a missing directory or
39631 <filename>maildirfolder</filename> file cannot be created, delivery is deferred.
39632 </para>
39633 <para>
39634 These features make it possible to use Exim to create all the necessary files
39635 and directories in a maildir mailbox, including subdirectories for maildir++
39636 folders. Consider this example:
39637 </para>
39638 <literallayout class="monospaced">
39639 maildir_format = true
39640 directory = /var/mail/$local_part\
39641            ${if eq{$local_part_suffix}{}{}\
39642            {/.${substr_1:$local_part_suffix}}}
39643 maildirfolder_create_regex = /\.[^/]+$
39644 </literallayout>
39645 <para>
39646 If <varname>$local_part_suffix</varname> is empty (there was no suffix for the local part),
39647 delivery is into a toplevel maildir with a name like <filename>/var/mail/pimbo</filename> (for
39648 the user called <emphasis>pimbo</emphasis>). The pattern in <option>maildirfolder_create_regex</option> does
39649 not match this name, so Exim will not look for or create the file
39650 <filename>/var/mail/pimbo/maildirfolder</filename>, though it will create
39651 <filename>/var/mail/pimbo/{cur,new,tmp}</filename> if necessary.
39652 </para>
39653 <para>
39654 However, if <varname>$local_part_suffix</varname> contains <literal>-eximusers</literal> (for example),
39655 delivery is into the maildir++ folder <filename>/var/mail/pimbo/.eximusers</filename>, which
39656 does match <option>maildirfolder_create_regex</option>. In this case, Exim will create
39657 <filename>/var/mail/pimbo/.eximusers/maildirfolder</filename> as well as the three maildir
39658 directories <filename>/var/mail/pimbo/.eximusers/{cur,new,tmp}</filename>.
39659 </para>
39660 <para>
39661 <emphasis role="bold">Warning:</emphasis> Take care when setting <option>maildirfolder_create_regex</option> that it does
39662 not inadvertently match the toplevel maildir directory, because a
39663 <filename>maildirfolder</filename> file at top level would completely break quota calculations.
39664 </para>
39665 <para>
39666 <indexterm role="concept">
39667 <primary>quota</primary>
39668 <secondary>in maildir delivery</secondary>
39669 </indexterm>
39670 <indexterm role="concept">
39671 <primary>maildir++</primary>
39672 </indexterm>
39673 If Exim is required to check a <option>quota</option> setting before a maildir delivery, and
39674 <option>quota_directory</option> is not set, it looks for a file called <filename>maildirfolder</filename> in
39675 the maildir directory (alongside <filename>new</filename>, <filename>cur</filename>, <filename>tmp</filename>). If this exists,
39676 Exim assumes the directory is a maildir++ folder directory, which is one level
39677 down from the user&#x2019;s top level mailbox directory. This causes it to start at
39678 the parent directory instead of the current directory when calculating the
39679 amount of space used.
39680 </para>
39681 <para>
39682 One problem with delivering into a multi-file mailbox is that it is
39683 computationally expensive to compute the size of the mailbox for quota
39684 checking. Various approaches have been taken to reduce the amount of work
39685 needed. The next two sections describe two of them. A third alternative is to
39686 use some external process for maintaining the size data, and use the expansion
39687 of the <option>mailbox_size</option> option as a way of importing it into Exim.
39688 </para>
39689 </section>
39690 <section id="SECID135">
39691 <title>Using tags to record message sizes</title>
39692 <para>
39693 If <option>maildir_tag</option> is set, the string is expanded for each delivery.
39694 When the maildir file is renamed into the <filename>new</filename> sub-directory, the
39695 tag is added to its name. However, if adding the tag takes the length of the
39696 name to the point where the test <function>stat()</function> call fails with ENAMETOOLONG,
39697 the tag is dropped and the maildir file is created with no tag.
39698 </para>
39699 <para>
39700 <indexterm role="variable">
39701 <primary><varname>$message_size</varname></primary>
39702 </indexterm>
39703 Tags can be used to encode the size of files in their names; see
39704 <option>quota_size_regex</option> above for an example. The expansion of <option>maildir_tag</option>
39705 happens after the message has been written. The value of the <varname>$message_size</varname>
39706 variable is set to the number of bytes actually written. If the expansion is
39707 forced to fail, the tag is ignored, but a non-forced failure causes delivery to
39708 be deferred. The expanded tag may contain any printing characters except <quote>/</quote>.
39709 Non-printing characters in the string are ignored; if the resulting string is
39710 empty, it is ignored. If it starts with an alphanumeric character, a leading
39711 colon is inserted; this default has not proven to be the path that popular
39712 maildir implementations have chosen (but changing it in Exim would break
39713 backwards compatibility).
39714 </para>
39715 <para>
39716 For one common implementation, you might set:
39717 </para>
39718 <literallayout class="monospaced">
39719 maildir_tag = ,S=${message_size}
39720 </literallayout>
39721 <para>
39722 but you should check the documentation of the other software to be sure.
39723 </para>
39724 <para>
39725 It is advisable to also set <option>quota_size_regex</option> when setting <option>maildir_tag</option>
39726 as this allows Exim to extract the size from your tag, instead of having to
39727 <function>stat()</function> each message file.
39728 </para>
39729 </section>
39730 <section id="SECID136">
39731 <title>Using a maildirsize file</title>
39732 <para>
39733 <indexterm role="concept">
39734 <primary>quota</primary>
39735 <secondary>in maildir delivery</secondary>
39736 </indexterm>
39737 <indexterm role="concept">
39738 <primary>maildir format</primary>
39739 <secondary><filename>maildirsize</filename> file</secondary>
39740 </indexterm>
39741 If <option>maildir_use_size_file</option> is true, Exim implements the maildir++ rules for
39742 storing quota and message size information in a file called <filename>maildirsize</filename>
39743 within the toplevel maildir directory. If this file does not exist, Exim
39744 creates it, setting the quota from the <option>quota</option> option of the transport. If
39745 the maildir directory itself does not exist, it is created before any attempt
39746 to write a <filename>maildirsize</filename> file.
39747 </para>
39748 <para>
39749 The <filename>maildirsize</filename> file is used to hold information about the sizes of
39750 messages in the maildir, thus speeding up quota calculations. The quota value
39751 in the file is just a cache; if the quota is changed in the transport, the new
39752 value overrides the cached value when the next message is delivered. The cache
39753 is maintained for the benefit of other programs that access the maildir and
39754 need to know the quota.
39755 </para>
39756 <para>
39757 If the <option>quota</option> option in the transport is unset or zero, the <filename>maildirsize</filename>
39758 file is maintained (with a zero quota setting), but no quota is imposed.
39759 </para>
39760 <para>
39761 A regular expression is available for controlling which directories in the
39762 maildir participate in quota calculations when a <filename>maildirsizefile</filename> is in use.
39763 See the description of the <option>maildir_quota_directory_regex</option> option above for
39764 details.
39765 </para>
39766 </section>
39767 <section id="SECID137">
39768 <title>Mailstore delivery</title>
39769 <para>
39770 <indexterm role="concept">
39771 <primary>mailstore format</primary>
39772 <secondary>description of</secondary>
39773 </indexterm>
39774 If the <option>mailstore_format</option> option is true, each message is written as two
39775 files in the given directory. A unique base name is constructed from the
39776 message id and the current delivery process, and the files that are written use
39777 this base name plus the suffixes <filename>.env</filename> and <filename>.msg</filename>. The <filename>.env</filename> file
39778 contains the message&#x2019;s envelope, and the <filename>.msg</filename> file contains the message
39779 itself. The base name is placed in the variable <varname>$mailstore_basename</varname>.
39780 </para>
39781 <para>
39782 During delivery, the envelope is first written to a file with the suffix
39783 <filename>.tmp</filename>. The <filename>.msg</filename> file is then written, and when it is complete, the
39784 <filename>.tmp</filename> file is renamed as the <filename>.env</filename> file. Programs that access messages in
39785 mailstore format should wait for the presence of both a <filename>.msg</filename> and a <filename>.env</filename>
39786 file before accessing either of them. An alternative approach is to wait for
39787 the absence of a <filename>.tmp</filename> file.
39788 </para>
39789 <para>
39790 The envelope file starts with any text defined by the <option>mailstore_prefix</option>
39791 option, expanded and terminated by a newline if there isn&#x2019;t one. Then follows
39792 the sender address on one line, then all the recipient addresses, one per line.
39793 There can be more than one recipient only if the <option>batch_max</option> option is set
39794 greater than one. Finally, <option>mailstore_suffix</option> is expanded and the result
39795 appended to the file, followed by a newline if it does not end with one.
39796 </para>
39797 <para>
39798 If expansion of <option>mailstore_prefix</option> or <option>mailstore_suffix</option> ends with a forced
39799 failure, it is ignored. Other expansion errors are treated as serious
39800 configuration errors, and delivery is deferred. The variable
39801 <varname>$mailstore_basename</varname> is available for use during these expansions.
39802 </para>
39803 </section>
39804 <section id="SECID138">
39805 <title>Non-special new file delivery</title>
39806 <para>
39807 If neither <option>maildir_format</option> nor <option>mailstore_format</option> is set, a single new
39808 file is created directly in the named directory. For example, when delivering
39809 messages into files in batched SMTP format for later delivery to some host (see
39810 section <xref linkend="SECTbatchSMTP"/>), a setting such as
39811 </para>
39812 <literallayout class="monospaced">
39813 directory = /var/bsmtp/$host
39814 </literallayout>
39815 <para>
39816 might be used. A message is written to a file with a temporary name, which is
39817 then renamed when the delivery is complete. The final name is obtained by
39818 expanding the contents of the <option>directory_file</option> option.
39819 <indexterm role="concept" startref="IIDapptra1" class="endofrange"/>
39820 <indexterm role="concept" startref="IIDapptra2" class="endofrange"/>
39821 </para>
39822 </section>
39823 </chapter>
39824
39825 <chapter id="CHID8">
39826 <title>The autoreply transport</title>
39827 <para>
39828 <indexterm role="concept" id="IIDauttra1" class="startofrange">
39829 <primary>transports</primary>
39830 <secondary><command>autoreply</command></secondary>
39831 </indexterm>
39832 <indexterm role="concept" id="IIDauttra2" class="startofrange">
39833 <primary><command>autoreply</command> transport</primary>
39834 </indexterm>
39835 The <command>autoreply</command> transport is not a true transport in that it does not cause
39836 the message to be transmitted. Instead, it generates a new mail message as an
39837 automatic reply to the incoming message. <emphasis>References:</emphasis> and
39838 <emphasis>Auto-Submitted:</emphasis> header lines are included. These are constructed according
39839 to the rules in RFCs 2822 and 3834, respectively.
39840 </para>
39841 <para>
39842 If the router that passes the message to this transport does not have the
39843 <option>unseen</option> option set, the original message (for the current recipient) is not
39844 delivered anywhere. However, when the <option>unseen</option> option is set on the router
39845 that passes the message to this transport, routing of the address continues, so
39846 another router can set up a normal message delivery.
39847 </para>
39848 <para>
39849 The <command>autoreply</command> transport is usually run as the result of mail filtering, a
39850 <quote>vacation</quote> message being the standard example. However, it can also be run
39851 directly from a router like any other transport. To reduce the possibility of
39852 message cascades, messages created by the <command>autoreply</command> transport always have
39853 empty envelope sender addresses, like bounce messages.
39854 </para>
39855 <para>
39856 The parameters of the message to be sent can be specified in the configuration
39857 by options described below. However, these are used only when the address
39858 passed to the transport does not contain its own reply information. When the
39859 transport is run as a consequence of a
39860 <option>mail</option>
39861 or <option>vacation</option> command in a filter file, the parameters of the message are
39862 supplied by the filter, and passed with the address. The transport&#x2019;s options
39863 that define the message are then ignored (so they are not usually set in this
39864 case). The message is specified entirely by the filter or by the transport; it
39865 is never built from a mixture of options. However, the <option>file_optional</option>,
39866 <option>mode</option>, and <option>return_message</option> options apply in all cases.
39867 </para>
39868 <para>
39869 <command>Autoreply</command> is implemented as a local transport. When used as a result of a
39870 command in a user&#x2019;s filter file, <command>autoreply</command> normally runs under the uid and
39871 gid of the user, and with appropriate current and home directories (see chapter
39872 <xref linkend="CHAPenvironment"/>).
39873 </para>
39874 <para>
39875 There is a subtle difference between routing a message to a <command>pipe</command> transport
39876 that generates some text to be returned to the sender, and routing it to an
39877 <command>autoreply</command> transport. This difference is noticeable only if more than one
39878 address from the same message is so handled. In the case of a pipe, the
39879 separate outputs from the different addresses are gathered up and returned to
39880 the sender in a single message, whereas if <command>autoreply</command> is used, a separate
39881 message is generated for each address that is passed to it.
39882 </para>
39883 <para>
39884 Non-printing characters are not permitted in the header lines generated for the
39885 message that <command>autoreply</command> creates, with the exception of newlines that are
39886 immediately followed by white space. If any non-printing characters are found,
39887 the transport defers.
39888 Whether characters with the top bit set count as printing characters or not is
39889 controlled by the <option>print_topbitchars</option> global option.
39890 </para>
39891 <para>
39892 If any of the generic options for manipulating headers (for example,
39893 <option>headers_add</option>) are set on an <command>autoreply</command> transport, they apply to the copy
39894 of the original message that is included in the generated message when
39895 <option>return_message</option> is set. They do not apply to the generated message itself.
39896 </para>
39897 <para>
39898 <indexterm role="variable">
39899 <primary><varname>$sender_address</varname></primary>
39900 </indexterm>
39901 If the <command>autoreply</command> transport receives return code 2 from Exim when it submits
39902 the message, indicating that there were no recipients, it does not treat this
39903 as an error. This means that autoreplies sent to <varname>$sender_address</varname> when this
39904 is empty (because the incoming message is a bounce message) do not cause
39905 problems. They are just discarded.
39906 </para>
39907 <section id="SECID139">
39908 <title>Private options for autoreply</title>
39909 <para>
39910 <indexterm role="concept">
39911 <primary>options</primary>
39912 <secondary><command>autoreply</command> transport</secondary>
39913 </indexterm>
39914 </para>
39915 <para>
39916 <indexterm role="option">
39917 <primary><option>bcc</option></primary>
39918 </indexterm>
39919 </para>
39920 <informaltable frame="all">
39921 <tgroup cols="4" colsep="0" rowsep="0">
39922 <colspec colwidth="8*" align="left"/>
39923 <colspec colwidth="6*" align="center"/>
39924 <colspec colwidth="6*" align="center"/>
39925 <colspec colwidth="6*" align="right"/>
39926 <tbody>
39927 <row>
39928 <entry><option>bcc</option></entry>
39929 <entry>Use: <emphasis>autoreply</emphasis></entry>
39930 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39931 <entry>Default: <emphasis>unset</emphasis></entry>
39932 </row>
39933 </tbody>
39934 </tgroup>
39935 </informaltable>
39936 <para>
39937 This specifies the addresses that are to receive <quote>blind carbon copies</quote> of the
39938 message when the message is specified by the transport.
39939 </para>
39940 <para>
39941 <indexterm role="option">
39942 <primary><option>cc</option></primary>
39943 </indexterm>
39944 </para>
39945 <informaltable frame="all">
39946 <tgroup cols="4" colsep="0" rowsep="0">
39947 <colspec colwidth="8*" align="left"/>
39948 <colspec colwidth="6*" align="center"/>
39949 <colspec colwidth="6*" align="center"/>
39950 <colspec colwidth="6*" align="right"/>
39951 <tbody>
39952 <row>
39953 <entry><option>cc</option></entry>
39954 <entry>Use: <emphasis>autoreply</emphasis></entry>
39955 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39956 <entry>Default: <emphasis>unset</emphasis></entry>
39957 </row>
39958 </tbody>
39959 </tgroup>
39960 </informaltable>
39961 <para>
39962 This specifies recipients of the message and the contents of the <emphasis>Cc:</emphasis> header
39963 when the message is specified by the transport.
39964 </para>
39965 <para>
39966 <indexterm role="option">
39967 <primary><option>file</option></primary>
39968 </indexterm>
39969 </para>
39970 <informaltable frame="all">
39971 <tgroup cols="4" colsep="0" rowsep="0">
39972 <colspec colwidth="8*" align="left"/>
39973 <colspec colwidth="6*" align="center"/>
39974 <colspec colwidth="6*" align="center"/>
39975 <colspec colwidth="6*" align="right"/>
39976 <tbody>
39977 <row>
39978 <entry><option>file</option></entry>
39979 <entry>Use: <emphasis>autoreply</emphasis></entry>
39980 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39981 <entry>Default: <emphasis>unset</emphasis></entry>
39982 </row>
39983 </tbody>
39984 </tgroup>
39985 </informaltable>
39986 <para>
39987 The contents of the file are sent as the body of the message when the message
39988 is specified by the transport. If both <option>file</option> and <option>text</option> are set, the text
39989 string comes first.
39990 </para>
39991 <para>
39992 <indexterm role="option">
39993 <primary><option>file_expand</option></primary>
39994 </indexterm>
39995 </para>
39996 <informaltable frame="all">
39997 <tgroup cols="4" colsep="0" rowsep="0">
39998 <colspec colwidth="8*" align="left"/>
39999 <colspec colwidth="6*" align="center"/>
40000 <colspec colwidth="6*" align="center"/>
40001 <colspec colwidth="6*" align="right"/>
40002 <tbody>
40003 <row>
40004 <entry><option>file_expand</option></entry>
40005 <entry>Use: <emphasis>autoreply</emphasis></entry>
40006 <entry>Type: <emphasis>boolean</emphasis></entry>
40007 <entry>Default: <emphasis>false</emphasis></entry>
40008 </row>
40009 </tbody>
40010 </tgroup>
40011 </informaltable>
40012 <para>
40013 If this is set, the contents of the file named by the <option>file</option> option are
40014 subjected to string expansion as they are added to the message.
40015 </para>
40016 <para>
40017 <indexterm role="option">
40018 <primary><option>file_optional</option></primary>
40019 </indexterm>
40020 </para>
40021 <informaltable frame="all">
40022 <tgroup cols="4" colsep="0" rowsep="0">
40023 <colspec colwidth="8*" align="left"/>
40024 <colspec colwidth="6*" align="center"/>
40025 <colspec colwidth="6*" align="center"/>
40026 <colspec colwidth="6*" align="right"/>
40027 <tbody>
40028 <row>
40029 <entry><option>file_optional</option></entry>
40030 <entry>Use: <emphasis>autoreply</emphasis></entry>
40031 <entry>Type: <emphasis>boolean</emphasis></entry>
40032 <entry>Default: <emphasis>false</emphasis></entry>
40033 </row>
40034 </tbody>
40035 </tgroup>
40036 </informaltable>
40037 <para>
40038 If this option is true, no error is generated if the file named by the <option>file</option>
40039 option or passed with the address does not exist or cannot be read.
40040 </para>
40041 <para>
40042 <indexterm role="option">
40043 <primary><option>from</option></primary>
40044 </indexterm>
40045 </para>
40046 <informaltable frame="all">
40047 <tgroup cols="4" colsep="0" rowsep="0">
40048 <colspec colwidth="8*" align="left"/>
40049 <colspec colwidth="6*" align="center"/>
40050 <colspec colwidth="6*" align="center"/>
40051 <colspec colwidth="6*" align="right"/>
40052 <tbody>
40053 <row>
40054 <entry><option>from</option></entry>
40055 <entry>Use: <emphasis>autoreply</emphasis></entry>
40056 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40057 <entry>Default: <emphasis>unset</emphasis></entry>
40058 </row>
40059 </tbody>
40060 </tgroup>
40061 </informaltable>
40062 <para>
40063 This specifies the contents of the <emphasis>From:</emphasis> header when the message is
40064 specified by the transport.
40065 </para>
40066 <para>
40067 <indexterm role="option">
40068 <primary><option>headers</option></primary>
40069 </indexterm>
40070 </para>
40071 <informaltable frame="all">
40072 <tgroup cols="4" colsep="0" rowsep="0">
40073 <colspec colwidth="8*" align="left"/>
40074 <colspec colwidth="6*" align="center"/>
40075 <colspec colwidth="6*" align="center"/>
40076 <colspec colwidth="6*" align="right"/>
40077 <tbody>
40078 <row>
40079 <entry><option>headers</option></entry>
40080 <entry>Use: <emphasis>autoreply</emphasis></entry>
40081 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40082 <entry>Default: <emphasis>unset</emphasis></entry>
40083 </row>
40084 </tbody>
40085 </tgroup>
40086 </informaltable>
40087 <para>
40088 This specifies additional RFC 2822 headers that are to be added to the message
40089 when the message is specified by the transport. Several can be given by using
40090 <quote>\n</quote> to separate them. There is no check on the format.
40091 </para>
40092 <para>
40093 <indexterm role="option">
40094 <primary><option>log</option></primary>
40095 </indexterm>
40096 </para>
40097 <informaltable frame="all">
40098 <tgroup cols="4" colsep="0" rowsep="0">
40099 <colspec colwidth="8*" align="left"/>
40100 <colspec colwidth="6*" align="center"/>
40101 <colspec colwidth="6*" align="center"/>
40102 <colspec colwidth="6*" align="right"/>
40103 <tbody>
40104 <row>
40105 <entry><option>log</option></entry>
40106 <entry>Use: <emphasis>autoreply</emphasis></entry>
40107 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40108 <entry>Default: <emphasis>unset</emphasis></entry>
40109 </row>
40110 </tbody>
40111 </tgroup>
40112 </informaltable>
40113 <para>
40114 This option names a file in which a record of every message sent is logged when
40115 the message is specified by the transport.
40116 </para>
40117 <para>
40118 <indexterm role="option">
40119 <primary><option>mode</option></primary>
40120 </indexterm>
40121 </para>
40122 <informaltable frame="all">
40123 <tgroup cols="4" colsep="0" rowsep="0">
40124 <colspec colwidth="8*" align="left"/>
40125 <colspec colwidth="6*" align="center"/>
40126 <colspec colwidth="6*" align="center"/>
40127 <colspec colwidth="6*" align="right"/>
40128 <tbody>
40129 <row>
40130 <entry><option>mode</option></entry>
40131 <entry>Use: <emphasis>autoreply</emphasis></entry>
40132 <entry>Type: <emphasis>octal integer</emphasis></entry>
40133 <entry>Default: <emphasis>0600</emphasis></entry>
40134 </row>
40135 </tbody>
40136 </tgroup>
40137 </informaltable>
40138 <para>
40139 If either the log file or the <quote>once</quote> file has to be created, this mode is
40140 used.
40141 </para>
40142 <para>
40143 <indexterm role="option">
40144 <primary><option>never_mail</option></primary>
40145 </indexterm>
40146 </para>
40147 <informaltable frame="all">
40148 <tgroup cols="4" colsep="0" rowsep="0">
40149 <colspec colwidth="8*" align="left"/>
40150 <colspec colwidth="6*" align="center"/>
40151 <colspec colwidth="6*" align="center"/>
40152 <colspec colwidth="6*" align="right"/>
40153 <tbody>
40154 <row>
40155 <entry><option>never_mail</option></entry>
40156 <entry>Use: <emphasis>autoreply</emphasis></entry>
40157 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
40158 <entry>Default: <emphasis>unset</emphasis></entry>
40159 </row>
40160 </tbody>
40161 </tgroup>
40162 </informaltable>
40163 <para>
40164 If any run of the transport creates a message with a recipient that matches any
40165 item in the list, that recipient is quietly discarded. If all recipients are
40166 discarded, no message is created. This applies both when the recipients are
40167 generated by a filter and when they are specified in the transport.
40168 </para>
40169 <para>
40170 <indexterm role="option">
40171 <primary><option>once</option></primary>
40172 </indexterm>
40173 </para>
40174 <informaltable frame="all">
40175 <tgroup cols="4" colsep="0" rowsep="0">
40176 <colspec colwidth="8*" align="left"/>
40177 <colspec colwidth="6*" align="center"/>
40178 <colspec colwidth="6*" align="center"/>
40179 <colspec colwidth="6*" align="right"/>
40180 <tbody>
40181 <row>
40182 <entry><option>once</option></entry>
40183 <entry>Use: <emphasis>autoreply</emphasis></entry>
40184 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40185 <entry>Default: <emphasis>unset</emphasis></entry>
40186 </row>
40187 </tbody>
40188 </tgroup>
40189 </informaltable>
40190 <para>
40191 This option names a file or DBM database in which a record of each <emphasis>To:</emphasis>
40192 recipient is kept when the message is specified by the transport. <emphasis role="bold">Note</emphasis>:
40193 This does not apply to <emphasis>Cc:</emphasis> or <emphasis>Bcc:</emphasis> recipients.
40194 </para>
40195 <para>
40196 If <option>once</option> is unset, or is set to an empty string, the message is always sent.
40197 By default, if <option>once</option> is set to a non-empty file name, the message
40198 is not sent if a potential recipient is already listed in the database.
40199 However, if the <option>once_repeat</option> option specifies a time greater than zero, the
40200 message is sent if that much time has elapsed since a message was last sent to
40201 this recipient. A setting of zero time for <option>once_repeat</option> (the default)
40202 prevents a message from being sent a second time &ndash; in this case, zero means
40203 infinity.
40204 </para>
40205 <para>
40206 If <option>once_file_size</option> is zero, a DBM database is used to remember recipients,
40207 and it is allowed to grow as large as necessary. If <option>once_file_size</option> is set
40208 greater than zero, it changes the way Exim implements the <option>once</option> option.
40209 Instead of using a DBM file to record every recipient it sends to, it uses a
40210 regular file, whose size will never get larger than the given value.
40211 </para>
40212 <para>
40213 In the file, Exim keeps a linear list of recipient addresses and the times at
40214 which they were sent messages. If the file is full when a new address needs to
40215 be added, the oldest address is dropped. If <option>once_repeat</option> is not set, this
40216 means that a given recipient may receive multiple messages, but at
40217 unpredictable intervals that depend on the rate of turnover of addresses in the
40218 file. If <option>once_repeat</option> is set, it specifies a maximum time between repeats.
40219 </para>
40220 <para>
40221 <indexterm role="option">
40222 <primary><option>once_file_size</option></primary>
40223 </indexterm>
40224 </para>
40225 <informaltable frame="all">
40226 <tgroup cols="4" colsep="0" rowsep="0">
40227 <colspec colwidth="8*" align="left"/>
40228 <colspec colwidth="6*" align="center"/>
40229 <colspec colwidth="6*" align="center"/>
40230 <colspec colwidth="6*" align="right"/>
40231 <tbody>
40232 <row>
40233 <entry><option>once_file_size</option></entry>
40234 <entry>Use: <emphasis>autoreply</emphasis></entry>
40235 <entry>Type: <emphasis>integer</emphasis></entry>
40236 <entry>Default: <emphasis>0</emphasis></entry>
40237 </row>
40238 </tbody>
40239 </tgroup>
40240 </informaltable>
40241 <para>
40242 See <option>once</option> above.
40243 </para>
40244 <para>
40245 <indexterm role="option">
40246 <primary><option>once_repeat</option></primary>
40247 </indexterm>
40248 </para>
40249 <informaltable frame="all">
40250 <tgroup cols="4" colsep="0" rowsep="0">
40251 <colspec colwidth="8*" align="left"/>
40252 <colspec colwidth="6*" align="center"/>
40253 <colspec colwidth="6*" align="center"/>
40254 <colspec colwidth="6*" align="right"/>
40255 <tbody>
40256 <row>
40257 <entry><option>once_repeat</option></entry>
40258 <entry>Use: <emphasis>autoreply</emphasis></entry>
40259 <entry>Type: <emphasis>time</emphasis>&dagger;<emphasis></emphasis></entry>
40260 <entry>Default: <emphasis>0s</emphasis></entry>
40261 </row>
40262 </tbody>
40263 </tgroup>
40264 </informaltable>
40265 <para>
40266 See <option>once</option> above.
40267 After expansion, the value of this option must be a valid time value.
40268 </para>
40269 <para>
40270 <indexterm role="option">
40271 <primary><option>reply_to</option></primary>
40272 </indexterm>
40273 </para>
40274 <informaltable frame="all">
40275 <tgroup cols="4" colsep="0" rowsep="0">
40276 <colspec colwidth="8*" align="left"/>
40277 <colspec colwidth="6*" align="center"/>
40278 <colspec colwidth="6*" align="center"/>
40279 <colspec colwidth="6*" align="right"/>
40280 <tbody>
40281 <row>
40282 <entry><option>reply_to</option></entry>
40283 <entry>Use: <emphasis>autoreply</emphasis></entry>
40284 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40285 <entry>Default: <emphasis>unset</emphasis></entry>
40286 </row>
40287 </tbody>
40288 </tgroup>
40289 </informaltable>
40290 <para>
40291 This specifies the contents of the <emphasis>Reply-To:</emphasis> header when the message is
40292 specified by the transport.
40293 </para>
40294 <para>
40295 <indexterm role="option">
40296 <primary><option>return_message</option></primary>
40297 </indexterm>
40298 </para>
40299 <informaltable frame="all">
40300 <tgroup cols="4" colsep="0" rowsep="0">
40301 <colspec colwidth="8*" align="left"/>
40302 <colspec colwidth="6*" align="center"/>
40303 <colspec colwidth="6*" align="center"/>
40304 <colspec colwidth="6*" align="right"/>
40305 <tbody>
40306 <row>
40307 <entry><option>return_message</option></entry>
40308 <entry>Use: <emphasis>autoreply</emphasis></entry>
40309 <entry>Type: <emphasis>boolean</emphasis></entry>
40310 <entry>Default: <emphasis>false</emphasis></entry>
40311 </row>
40312 </tbody>
40313 </tgroup>
40314 </informaltable>
40315 <para>
40316 If this is set, a copy of the original message is returned with the new
40317 message, subject to the maximum size set in the <option>return_size_limit</option> global
40318 configuration option.
40319 </para>
40320 <para>
40321 <indexterm role="option">
40322 <primary><option>subject</option></primary>
40323 </indexterm>
40324 </para>
40325 <informaltable frame="all">
40326 <tgroup cols="4" colsep="0" rowsep="0">
40327 <colspec colwidth="8*" align="left"/>
40328 <colspec colwidth="6*" align="center"/>
40329 <colspec colwidth="6*" align="center"/>
40330 <colspec colwidth="6*" align="right"/>
40331 <tbody>
40332 <row>
40333 <entry><option>subject</option></entry>
40334 <entry>Use: <emphasis>autoreply</emphasis></entry>
40335 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40336 <entry>Default: <emphasis>unset</emphasis></entry>
40337 </row>
40338 </tbody>
40339 </tgroup>
40340 </informaltable>
40341 <para>
40342 This specifies the contents of the <emphasis>Subject:</emphasis> header when the message is
40343 specified by the transport. It is tempting to quote the original subject in
40344 automatic responses. For example:
40345 </para>
40346 <literallayout class="monospaced">
40347 subject = Re: $h_subject:
40348 </literallayout>
40349 <para>
40350 There is a danger in doing this, however. It may allow a third party to
40351 subscribe your users to an opt-in mailing list, provided that the list accepts
40352 bounce messages as subscription confirmations. Well-managed lists require a
40353 non-bounce message to confirm a subscription, so the danger is relatively
40354 small.
40355 </para>
40356 <para>
40357 <indexterm role="option">
40358 <primary><option>text</option></primary>
40359 </indexterm>
40360 </para>
40361 <informaltable frame="all">
40362 <tgroup cols="4" colsep="0" rowsep="0">
40363 <colspec colwidth="8*" align="left"/>
40364 <colspec colwidth="6*" align="center"/>
40365 <colspec colwidth="6*" align="center"/>
40366 <colspec colwidth="6*" align="right"/>
40367 <tbody>
40368 <row>
40369 <entry><option>text</option></entry>
40370 <entry>Use: <emphasis>autoreply</emphasis></entry>
40371 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40372 <entry>Default: <emphasis>unset</emphasis></entry>
40373 </row>
40374 </tbody>
40375 </tgroup>
40376 </informaltable>
40377 <para>
40378 This specifies a single string to be used as the body of the message when the
40379 message is specified by the transport. If both <option>text</option> and <option>file</option> are set,
40380 the text comes first.
40381 </para>
40382 <para>
40383 <indexterm role="option">
40384 <primary><option>to</option></primary>
40385 </indexterm>
40386 </para>
40387 <informaltable frame="all">
40388 <tgroup cols="4" colsep="0" rowsep="0">
40389 <colspec colwidth="8*" align="left"/>
40390 <colspec colwidth="6*" align="center"/>
40391 <colspec colwidth="6*" align="center"/>
40392 <colspec colwidth="6*" align="right"/>
40393 <tbody>
40394 <row>
40395 <entry><option>to</option></entry>
40396 <entry>Use: <emphasis>autoreply</emphasis></entry>
40397 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40398 <entry>Default: <emphasis>unset</emphasis></entry>
40399 </row>
40400 </tbody>
40401 </tgroup>
40402 </informaltable>
40403 <para>
40404 This specifies recipients of the message and the contents of the <emphasis>To:</emphasis> header
40405 when the message is specified by the transport.
40406 <indexterm role="concept" startref="IIDauttra1" class="endofrange"/>
40407 <indexterm role="concept" startref="IIDauttra2" class="endofrange"/>
40408 </para>
40409 </section>
40410 </chapter>
40411
40412 <chapter id="CHAPLMTP">
40413 <title>The lmtp transport</title>
40414 <para>
40415 <indexterm role="concept">
40416 <primary>transports</primary>
40417 <secondary><command>lmtp</command></secondary>
40418 </indexterm>
40419 <indexterm role="concept">
40420 <primary><command>lmtp</command> transport</primary>
40421 </indexterm>
40422 <indexterm role="concept">
40423 <primary>LMTP</primary>
40424 <secondary>over a pipe</secondary>
40425 </indexterm>
40426 <indexterm role="concept">
40427 <primary>LMTP</primary>
40428 <secondary>over a socket</secondary>
40429 </indexterm>
40430 The <command>lmtp</command> transport runs the LMTP protocol (RFC 2033) over a pipe to a
40431 specified command
40432 or by interacting with a Unix domain socket.
40433 This transport is something of a cross between the <command>pipe</command> and <command>smtp</command>
40434 transports. Exim also has support for using LMTP over TCP/IP; this is
40435 implemented as an option for the <command>smtp</command> transport. Because LMTP is expected
40436 to be of minority interest, the default build-time configure in <filename>src/EDITME</filename>
40437 has it commented out. You need to ensure that
40438 </para>
40439 <literallayout class="monospaced">
40440 TRANSPORT_LMTP=yes
40441 </literallayout>
40442 <para>
40443 <indexterm role="concept">
40444 <primary>options</primary>
40445 <secondary><command>lmtp</command> transport</secondary>
40446 </indexterm>
40447 is present in your <filename>Local/Makefile</filename> in order to have the <command>lmtp</command> transport
40448 included in the Exim binary. The private options of the <command>lmtp</command> transport are
40449 as follows:
40450 </para>
40451 <para>
40452 <indexterm role="option">
40453 <primary><option>batch_id</option></primary>
40454 </indexterm>
40455 </para>
40456 <informaltable frame="all">
40457 <tgroup cols="4" colsep="0" rowsep="0">
40458 <colspec colwidth="8*" align="left"/>
40459 <colspec colwidth="6*" align="center"/>
40460 <colspec colwidth="6*" align="center"/>
40461 <colspec colwidth="6*" align="right"/>
40462 <tbody>
40463 <row>
40464 <entry><option>batch_id</option></entry>
40465 <entry>Use: <emphasis>lmtp</emphasis></entry>
40466 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40467 <entry>Default: <emphasis>unset</emphasis></entry>
40468 </row>
40469 </tbody>
40470 </tgroup>
40471 </informaltable>
40472 <para>
40473 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
40474 </para>
40475 <para>
40476 <indexterm role="option">
40477 <primary><option>batch_max</option></primary>
40478 </indexterm>
40479 </para>
40480 <informaltable frame="all">
40481 <tgroup cols="4" colsep="0" rowsep="0">
40482 <colspec colwidth="8*" align="left"/>
40483 <colspec colwidth="6*" align="center"/>
40484 <colspec colwidth="6*" align="center"/>
40485 <colspec colwidth="6*" align="right"/>
40486 <tbody>
40487 <row>
40488 <entry><option>batch_max</option></entry>
40489 <entry>Use: <emphasis>lmtp</emphasis></entry>
40490 <entry>Type: <emphasis>integer</emphasis></entry>
40491 <entry>Default: <emphasis>1</emphasis></entry>
40492 </row>
40493 </tbody>
40494 </tgroup>
40495 </informaltable>
40496 <para>
40497 This limits the number of addresses that can be handled in a single delivery.
40498 Most LMTP servers can handle several addresses at once, so it is normally a
40499 good idea to increase this value. See the description of local delivery
40500 batching in chapter <xref linkend="CHAPbatching"/>.
40501 </para>
40502 <para>
40503 <indexterm role="option">
40504 <primary><option>command</option></primary>
40505 </indexterm>
40506 </para>
40507 <informaltable frame="all">
40508 <tgroup cols="4" colsep="0" rowsep="0">
40509 <colspec colwidth="8*" align="left"/>
40510 <colspec colwidth="6*" align="center"/>
40511 <colspec colwidth="6*" align="center"/>
40512 <colspec colwidth="6*" align="right"/>
40513 <tbody>
40514 <row>
40515 <entry><option>command</option></entry>
40516 <entry>Use: <emphasis>lmtp</emphasis></entry>
40517 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40518 <entry>Default: <emphasis>unset</emphasis></entry>
40519 </row>
40520 </tbody>
40521 </tgroup>
40522 </informaltable>
40523 <para>
40524 This option must be set if <option>socket</option> is not set. The string is a command which
40525 is run in a separate process. It is split up into a command name and list of
40526 arguments, each of which is separately expanded (so expansion cannot change the
40527 number of arguments). The command is run directly, not via a shell. The message
40528 is passed to the new process using the standard input and output to operate the
40529 LMTP protocol.
40530 </para>
40531 <para>
40532 <indexterm role="option">
40533 <primary><option>ignore_quota</option></primary>
40534 </indexterm>
40535 </para>
40536 <informaltable frame="all">
40537 <tgroup cols="4" colsep="0" rowsep="0">
40538 <colspec colwidth="8*" align="left"/>
40539 <colspec colwidth="6*" align="center"/>
40540 <colspec colwidth="6*" align="center"/>
40541 <colspec colwidth="6*" align="right"/>
40542 <tbody>
40543 <row>
40544 <entry><option>ignore_quota</option></entry>
40545 <entry>Use: <emphasis>lmtp</emphasis></entry>
40546 <entry>Type: <emphasis>boolean</emphasis></entry>
40547 <entry>Default: <emphasis>false</emphasis></entry>
40548 </row>
40549 </tbody>
40550 </tgroup>
40551 </informaltable>
40552 <para>
40553 <indexterm role="concept">
40554 <primary>LMTP</primary>
40555 <secondary>ignoring quota errors</secondary>
40556 </indexterm>
40557 If this option is set true, the string <literal>IGNOREQUOTA</literal> is added to RCPT
40558 commands, provided that the LMTP server has advertised support for IGNOREQUOTA
40559 in its response to the LHLO command.
40560 </para>
40561 <para>
40562 <indexterm role="option">
40563 <primary><option>socket</option></primary>
40564 </indexterm>
40565 </para>
40566 <informaltable frame="all">
40567 <tgroup cols="4" colsep="0" rowsep="0">
40568 <colspec colwidth="8*" align="left"/>
40569 <colspec colwidth="6*" align="center"/>
40570 <colspec colwidth="6*" align="center"/>
40571 <colspec colwidth="6*" align="right"/>
40572 <tbody>
40573 <row>
40574 <entry><option>socket</option></entry>
40575 <entry>Use: <emphasis>lmtp</emphasis></entry>
40576 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40577 <entry>Default: <emphasis>unset</emphasis></entry>
40578 </row>
40579 </tbody>
40580 </tgroup>
40581 </informaltable>
40582 <para>
40583 This option must be set if <option>command</option> is not set. The result of expansion must
40584 be the name of a Unix domain socket. The transport connects to the socket and
40585 delivers the message to it using the LMTP protocol.
40586 </para>
40587 <para>
40588 <indexterm role="option">
40589 <primary><option>timeout</option></primary>
40590 </indexterm>
40591 </para>
40592 <informaltable frame="all">
40593 <tgroup cols="4" colsep="0" rowsep="0">
40594 <colspec colwidth="8*" align="left"/>
40595 <colspec colwidth="6*" align="center"/>
40596 <colspec colwidth="6*" align="center"/>
40597 <colspec colwidth="6*" align="right"/>
40598 <tbody>
40599 <row>
40600 <entry><option>timeout</option></entry>
40601 <entry>Use: <emphasis>lmtp</emphasis></entry>
40602 <entry>Type: <emphasis>time</emphasis></entry>
40603 <entry>Default: <emphasis>5m</emphasis></entry>
40604 </row>
40605 </tbody>
40606 </tgroup>
40607 </informaltable>
40608 <para>
40609 The transport is aborted if the created process or Unix domain socket does not
40610 respond to LMTP commands or message input within this timeout. Delivery
40611 is deferred, and will be tried again later. Here is an example of a typical
40612 LMTP transport:
40613 </para>
40614 <literallayout class="monospaced">
40615 lmtp:
40616   driver = lmtp
40617   command = /some/local/lmtp/delivery/program
40618   batch_max = 20
40619   user = exim
40620 </literallayout>
40621 <para>
40622 This delivers up to 20 addresses at a time, in a mixture of domains if
40623 necessary, running as the user <emphasis>exim</emphasis>.
40624 </para>
40625 </chapter>
40626
40627 <chapter id="CHAPpipetransport">
40628 <title>The pipe transport</title>
40629 <para>
40630 <indexterm role="concept" id="IIDpiptra1" class="startofrange">
40631 <primary>transports</primary>
40632 <secondary><command>pipe</command></secondary>
40633 </indexterm>
40634 <indexterm role="concept" id="IIDpiptra2" class="startofrange">
40635 <primary><command>pipe</command> transport</primary>
40636 </indexterm>
40637 The <command>pipe</command> transport is used to deliver messages via a pipe to a command
40638 running in another process. One example is the use of <command>pipe</command> as a
40639 pseudo-remote transport for passing messages to some other delivery mechanism
40640 (such as UUCP). Another is the use by individual users to automatically process
40641 their incoming messages. The <command>pipe</command> transport can be used in one of the
40642 following ways:
40643 </para>
40644 <itemizedlist>
40645 <listitem>
40646 <para>
40647 <indexterm role="variable">
40648 <primary><varname>$local_part</varname></primary>
40649 </indexterm>
40650 A router routes one address to a transport in the normal way, and the
40651 transport is configured as a <command>pipe</command> transport. In this case, <varname>$local_part</varname>
40652 contains the local part of the address (as usual), and the command that is run
40653 is specified by the <option>command</option> option on the transport.
40654 </para>
40655 </listitem>
40656 <listitem>
40657 <para>
40658 <indexterm role="variable">
40659 <primary><varname>$pipe_addresses</varname></primary>
40660 </indexterm>
40661 If the <option>batch_max</option> option is set greater than 1 (the default is 1), the
40662 transport can handle more than one address in a single run. In this case, when
40663 more than one address is routed to the transport, <varname>$local_part</varname> is not set
40664 (because it is not unique). However, the pseudo-variable <varname>$pipe_addresses</varname>
40665 (described in section <xref linkend="SECThowcommandrun"/> below) contains all the addresses
40666 that are routed to the transport.
40667 </para>
40668 </listitem>
40669 <listitem>
40670 <para>
40671 <indexterm role="variable">
40672 <primary><varname>$address_pipe</varname></primary>
40673 </indexterm>
40674 A router redirects an address directly to a pipe command (for example, from an
40675 alias or forward file). In this case, <varname>$address_pipe</varname> contains the text of the
40676 pipe command, and the <option>command</option> option on the transport is ignored. If only
40677 one address is being transported (<option>batch_max</option> is not greater than one, or
40678 only one address was redirected to this pipe command), <varname>$local_part</varname> contains
40679 the local part that was redirected.
40680 </para>
40681 </listitem>
40682 </itemizedlist>
40683 <para>
40684 The <command>pipe</command> transport is a non-interactive delivery method. Exim can also
40685 deliver messages over pipes using the LMTP interactive protocol. This is
40686 implemented by the <command>lmtp</command> transport.
40687 </para>
40688 <para>
40689 In the case when <command>pipe</command> is run as a consequence of an entry in a local user&#x2019;s
40690 <filename>.forward</filename> file, the command runs under the uid and gid of that user. In
40691 other cases, the uid and gid have to be specified explicitly, either on the
40692 transport or on the router that handles the address. Current and <quote>home</quote>
40693 directories are also controllable. See chapter <xref linkend="CHAPenvironment"/> for
40694 details of the local delivery environment and chapter <xref linkend="CHAPbatching"/>
40695 for a discussion of local delivery batching.
40696 </para>
40697 <section id="SECID140">
40698 <title>Concurrent delivery</title>
40699 <para>
40700 If two messages arrive at almost the same time, and both are routed to a pipe
40701 delivery, the two pipe transports may be run concurrently. You must ensure that
40702 any pipe commands you set up are robust against this happening. If the commands
40703 write to a file, the <option>exim_lock</option> utility might be of use.
40704 </para>
40705 </section>
40706 <section id="SECID141">
40707 <title>Returned status and data</title>
40708 <para>
40709 <indexterm role="concept">
40710 <primary><command>pipe</command> transport</primary>
40711 <secondary>returned data</secondary>
40712 </indexterm>
40713 If the command exits with a non-zero return code, the delivery is deemed to
40714 have failed, unless either the <option>ignore_status</option> option is set (in which case
40715 the return code is treated as zero), or the return code is one of those listed
40716 in the <option>temp_errors</option> option, which are interpreted as meaning <quote>try again
40717 later</quote>. In this case, delivery is deferred. Details of a permanent failure are
40718 logged, but are not included in the bounce message, which merely contains
40719 <quote>local delivery failed</quote>.
40720 </para>
40721 <para>
40722 If the command exits on a signal and the <option>freeze_signal</option> option is set then
40723 the message will be frozen in the queue. If that option is not set, a bounce
40724 will be sent as normal.
40725 </para>
40726 <para>
40727 If the return code is greater than 128 and the command being run is a shell
40728 script, it normally means that the script was terminated by a signal whose
40729 value is the return code minus 128. The <option>freeze_signal</option> option does not
40730 apply in this case.
40731 </para>
40732 <para>
40733 If Exim is unable to run the command (that is, if <function>execve()</function> fails), the
40734 return code is set to 127. This is the value that a shell returns if it is
40735 asked to run a non-existent command. The wording for the log line suggests that
40736 a non-existent command may be the problem.
40737 </para>
40738 <para>
40739 The <option>return_output</option> option can affect the result of a pipe delivery. If it is
40740 set and the command produces any output on its standard output or standard
40741 error streams, the command is considered to have failed, even if it gave a zero
40742 return code or if <option>ignore_status</option> is set. The output from the command is
40743 included as part of the bounce message. The <option>return_fail_output</option> option is
40744 similar, except that output is returned only when the command exits with a
40745 failure return code, that is, a value other than zero or a code that matches
40746 <option>temp_errors</option>.
40747 </para>
40748 </section>
40749 <section id="SECThowcommandrun">
40750 <title>How the command is run</title>
40751 <para>
40752 <indexterm role="concept">
40753 <primary><command>pipe</command> transport</primary>
40754 <secondary>path for command</secondary>
40755 </indexterm>
40756 The command line is (by default) broken down into a command name and arguments
40757 by the <command>pipe</command> transport itself. The <option>allow_commands</option> and
40758 <option>restrict_to_path</option> options can be used to restrict the commands that may be
40759 run.
40760 </para>
40761 <para>
40762 <indexterm role="concept">
40763 <primary>quoting</primary>
40764 <secondary>in pipe command</secondary>
40765 </indexterm>
40766 Unquoted arguments are delimited by white space. If an argument appears in
40767 double quotes, backslash is interpreted as an escape character in the usual
40768 way. If an argument appears in single quotes, no escaping is done.
40769 </para>
40770 <para>
40771 String expansion is applied to the command line except when it comes from a
40772 traditional <filename>.forward</filename> file (commands from a filter file are expanded). The
40773 expansion is applied to each argument in turn rather than to the whole line.
40774 For this reason, any string expansion item that contains white space must be
40775 quoted so as to be contained within a single argument. A setting such as
40776 </para>
40777 <literallayout class="monospaced">
40778 command = /some/path ${if eq{$local_part}{postmaster}{xx}{yy}}
40779 </literallayout>
40780 <para>
40781 will not work, because the expansion item gets split between several
40782 arguments. You have to write
40783 </para>
40784 <literallayout class="monospaced">
40785 command = /some/path "${if eq{$local_part}{postmaster}{xx}{yy}}"
40786 </literallayout>
40787 <para>
40788 to ensure that it is all in one argument. The expansion is done in this way,
40789 argument by argument, so that the number of arguments cannot be changed as a
40790 result of expansion, and quotes or backslashes in inserted variables do not
40791 interact with external quoting. However, this leads to problems if you want to
40792 generate multiple arguments (or the command name plus arguments) from a single
40793 expansion. In this situation, the simplest solution is to use a shell. For
40794 example:
40795 </para>
40796 <literallayout class="monospaced">
40797 command = /bin/sh -c ${lookup{$local_part}lsearch{/some/file}}
40798 </literallayout>
40799 <para>
40800 <indexterm role="concept">
40801 <primary>transport</primary>
40802 <secondary>filter</secondary>
40803 </indexterm>
40804 <indexterm role="concept">
40805 <primary>filter</primary>
40806 <secondary>transport filter</secondary>
40807 </indexterm>
40808 <indexterm role="variable">
40809 <primary><varname>$pipe_addresses</varname></primary>
40810 </indexterm>
40811 Special handling takes place when an argument consists of precisely the text
40812 <literal>$pipe_addresses</literal>. This is not a general expansion variable; the only
40813 place this string is recognized is when it appears as an argument for a pipe or
40814 transport filter command. It causes each address that is being handled to be
40815 inserted in the argument list at that point <emphasis>as a separate argument</emphasis>. This
40816 avoids any problems with spaces or shell metacharacters, and is of use when a
40817 <command>pipe</command> transport is handling groups of addresses in a batch.
40818 </para>
40819 <para>
40820 After splitting up into arguments and expansion, the resulting command is run
40821 in a subprocess directly from the transport, <emphasis>not</emphasis> under a shell. The
40822 message that is being delivered is supplied on the standard input, and the
40823 standard output and standard error are both connected to a single pipe that is
40824 read by Exim. The <option>max_output</option> option controls how much output the command
40825 may produce, and the <option>return_output</option> and <option>return_fail_output</option> options
40826 control what is done with it.
40827 </para>
40828 <para>
40829 Not running the command under a shell (by default) lessens the security risks
40830 in cases when a command from a user&#x2019;s filter file is built out of data that was
40831 taken from an incoming message. If a shell is required, it can of course be
40832 explicitly specified as the command to be run. However, there are circumstances
40833 where existing commands (for example, in <filename>.forward</filename> files) expect to be run
40834 under a shell and cannot easily be modified. To allow for these cases, there is
40835 an option called <option>use_shell</option>, which changes the way the <command>pipe</command> transport
40836 works. Instead of breaking up the command line as just described, it expands it
40837 as a single string and passes the result to <filename>/bin/sh</filename>. The
40838 <option>restrict_to_path</option> option and the <varname>$pipe_addresses</varname> facility cannot be used
40839 with <option>use_shell</option>, and the whole mechanism is inherently less secure.
40840 </para>
40841 </section>
40842 <section id="SECTpipeenv">
40843 <title>Environment variables</title>
40844 <para>
40845 <indexterm role="concept">
40846 <primary><command>pipe</command> transport</primary>
40847 <secondary>environment for command</secondary>
40848 </indexterm>
40849 <indexterm role="concept">
40850 <primary>environment for pipe transport</primary>
40851 </indexterm>
40852 The environment variables listed below are set up when the command is invoked.
40853 This list is a compromise for maximum compatibility with other MTAs. Note that
40854 the <option>environment</option> option can be used to add additional variables to this
40855 environment.
40856 </para>
40857 <literallayout>
40858 <literal>DOMAIN            </literal>   the domain of the address
40859 <literal>HOME              </literal>   the home directory, if set
40860 <literal>HOST              </literal>   the host name when called from a router (see below)
40861 <literal>LOCAL_PART        </literal>   see below
40862 <literal>LOCAL_PART_PREFIX </literal>   see below
40863 <literal>LOCAL_PART_SUFFIX </literal>   see below
40864 <literal>LOGNAME           </literal>   see below
40865 <literal>MESSAGE_ID        </literal>   Exim&#x2019;s local ID for the message
40866 <literal>PATH              </literal>   as specified by the <option>path</option> option below
40867 <literal>QUALIFY_DOMAIN    </literal>   the sender qualification domain
40868 <literal>RECIPIENT         </literal>   the complete recipient address
40869 <literal>SENDER            </literal>   the sender of the message (empty if a bounce)
40870 <literal>SHELL             </literal>   <literal>/bin/sh</literal>
40871 <literal>TZ                </literal>   the value of the <option>timezone</option> option, if set
40872 <literal>USER              </literal>   see below
40873 </literallayout>
40874 <para>
40875 When a <command>pipe</command> transport is called directly from (for example) an <command>accept</command>
40876 router, LOCAL_PART is set to the local part of the address. When it is
40877 called as a result of a forward or alias expansion, LOCAL_PART is set to
40878 the local part of the address that was expanded. In both cases, any affixes are
40879 removed from the local part, and made available in LOCAL_PART_PREFIX and
40880 LOCAL_PART_SUFFIX, respectively. LOGNAME and USER are set to the
40881 same value as LOCAL_PART for compatibility with other MTAs.
40882 </para>
40883 <para>
40884 <indexterm role="concept">
40885 <primary>HOST</primary>
40886 </indexterm>
40887 HOST is set only when a <command>pipe</command> transport is called from a router that
40888 associates hosts with an address, typically when using <command>pipe</command> as a
40889 pseudo-remote transport. HOST is set to the first host name specified by
40890 the router.
40891 </para>
40892 <para>
40893 <indexterm role="concept">
40894 <primary>HOME</primary>
40895 </indexterm>
40896 If the transport&#x2019;s generic <option>home_directory</option> option is set, its value is used
40897 for the HOME environment variable. Otherwise, a home directory may be set
40898 by the router&#x2019;s <option>transport_home_directory</option> option, which defaults to the
40899 user&#x2019;s home directory if <option>check_local_user</option> is set.
40900 </para>
40901 </section>
40902 <section id="SECID142">
40903 <title>Private options for pipe</title>
40904 <para>
40905 <indexterm role="concept">
40906 <primary>options</primary>
40907 <secondary><command>pipe</command> transport</secondary>
40908 </indexterm>
40909 </para>
40910 <para>
40911 <indexterm role="option">
40912 <primary><option>allow_commands</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>allow_commands</option></entry>
40924 <entry>Use: <emphasis>pipe</emphasis></entry>
40925 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
40926 <entry>Default: <emphasis>unset</emphasis></entry>
40927 </row>
40928 </tbody>
40929 </tgroup>
40930 </informaltable>
40931 <para>
40932 <indexterm role="concept">
40933 <primary><command>pipe</command> transport</primary>
40934 <secondary>permitted commands</secondary>
40935 </indexterm>
40936 The string is expanded, and is then interpreted as a colon-separated list of
40937 permitted commands. If <option>restrict_to_path</option> is not set, the only commands
40938 permitted are those in the <option>allow_commands</option> list. They need not be absolute
40939 paths; the <option>path</option> option is still used for relative paths. If
40940 <option>restrict_to_path</option> is set with <option>allow_commands</option>, the command must either be
40941 in the <option>allow_commands</option> list, or a name without any slashes that is found on
40942 the path. In other words, if neither <option>allow_commands</option> nor
40943 <option>restrict_to_path</option> is set, there is no restriction on the command, but
40944 otherwise only commands that are permitted by one or the other are allowed. For
40945 example, if
40946 </para>
40947 <literallayout class="monospaced">
40948 allow_commands = /usr/bin/vacation
40949 </literallayout>
40950 <para>
40951 and <option>restrict_to_path</option> is not set, the only permitted command is
40952 <filename>/usr/bin/vacation</filename>. The <option>allow_commands</option> option may not be set if
40953 <option>use_shell</option> is set.
40954 </para>
40955 <para>
40956 <indexterm role="option">
40957 <primary><option>batch_id</option></primary>
40958 </indexterm>
40959 </para>
40960 <informaltable frame="all">
40961 <tgroup cols="4" colsep="0" rowsep="0">
40962 <colspec colwidth="8*" align="left"/>
40963 <colspec colwidth="6*" align="center"/>
40964 <colspec colwidth="6*" align="center"/>
40965 <colspec colwidth="6*" align="right"/>
40966 <tbody>
40967 <row>
40968 <entry><option>batch_id</option></entry>
40969 <entry>Use: <emphasis>pipe</emphasis></entry>
40970 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40971 <entry>Default: <emphasis>unset</emphasis></entry>
40972 </row>
40973 </tbody>
40974 </tgroup>
40975 </informaltable>
40976 <para>
40977 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
40978 </para>
40979 <para>
40980 <indexterm role="option">
40981 <primary><option>batch_max</option></primary>
40982 </indexterm>
40983 </para>
40984 <informaltable frame="all">
40985 <tgroup cols="4" colsep="0" rowsep="0">
40986 <colspec colwidth="8*" align="left"/>
40987 <colspec colwidth="6*" align="center"/>
40988 <colspec colwidth="6*" align="center"/>
40989 <colspec colwidth="6*" align="right"/>
40990 <tbody>
40991 <row>
40992 <entry><option>batch_max</option></entry>
40993 <entry>Use: <emphasis>pipe</emphasis></entry>
40994 <entry>Type: <emphasis>integer</emphasis></entry>
40995 <entry>Default: <emphasis>1</emphasis></entry>
40996 </row>
40997 </tbody>
40998 </tgroup>
40999 </informaltable>
41000 <para>
41001 This limits the number of addresses that can be handled in a single delivery.
41002 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
41003 </para>
41004 <para>
41005 <indexterm role="option">
41006 <primary><option>check_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>check_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 As <command>pipe</command> writes the message, the start of each line is tested for matching
41027 <option>check_string</option>, and if it does, the initial matching characters are replaced
41028 by the contents of <option>escape_string</option>, provided both are set. The value of
41029 <option>check_string</option> is a literal string, not a regular expression, and the case of
41030 any letters it contains is significant. When <option>use_bsmtp</option> is set, the contents
41031 of <option>check_string</option> and <option>escape_string</option> are forced to values that implement
41032 the SMTP escaping protocol. Any settings made in the configuration file are
41033 ignored.
41034 </para>
41035 <para>
41036 <indexterm role="option">
41037 <primary><option>command</option></primary>
41038 </indexterm>
41039 </para>
41040 <informaltable frame="all">
41041 <tgroup cols="4" colsep="0" rowsep="0">
41042 <colspec colwidth="8*" align="left"/>
41043 <colspec colwidth="6*" align="center"/>
41044 <colspec colwidth="6*" align="center"/>
41045 <colspec colwidth="6*" align="right"/>
41046 <tbody>
41047 <row>
41048 <entry><option>command</option></entry>
41049 <entry>Use: <emphasis>pipe</emphasis></entry>
41050 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41051 <entry>Default: <emphasis>unset</emphasis></entry>
41052 </row>
41053 </tbody>
41054 </tgroup>
41055 </informaltable>
41056 <para>
41057 This option need not be set when <command>pipe</command> is being used to deliver to pipes
41058 obtained directly from address redirections. In other cases, the option must be
41059 set, to provide a command to be run. It need not yield an absolute path (see
41060 the <option>path</option> option below). The command is split up into separate arguments by
41061 Exim, and each argument is separately expanded, as described in section
41062 <xref linkend="SECThowcommandrun"/> above.
41063 </para>
41064 <para>
41065 <indexterm role="option">
41066 <primary><option>environment</option></primary>
41067 </indexterm>
41068 </para>
41069 <informaltable frame="all">
41070 <tgroup cols="4" colsep="0" rowsep="0">
41071 <colspec colwidth="8*" align="left"/>
41072 <colspec colwidth="6*" align="center"/>
41073 <colspec colwidth="6*" align="center"/>
41074 <colspec colwidth="6*" align="right"/>
41075 <tbody>
41076 <row>
41077 <entry><option>environment</option></entry>
41078 <entry>Use: <emphasis>pipe</emphasis></entry>
41079 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41080 <entry>Default: <emphasis>unset</emphasis></entry>
41081 </row>
41082 </tbody>
41083 </tgroup>
41084 </informaltable>
41085 <para>
41086 <indexterm role="concept">
41087 <primary><command>pipe</command> transport</primary>
41088 <secondary>environment for command</secondary>
41089 </indexterm>
41090 <indexterm role="concept">
41091 <primary>environment for <command>pipe</command> transport</primary>
41092 </indexterm>
41093 This option is used to add additional variables to the environment in which the
41094 command runs (see section <xref linkend="SECTpipeenv"/> for the default list). Its value is
41095 a string which is expanded, and then interpreted as a colon-separated list of
41096 environment settings of the form &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt;.
41097 </para>
41098 <para>
41099 <indexterm role="option">
41100 <primary><option>escape_string</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>escape_string</option></entry>
41112 <entry>Use: <emphasis>pipe</emphasis></entry>
41113 <entry>Type: <emphasis>string</emphasis></entry>
41114 <entry>Default: <emphasis>unset</emphasis></entry>
41115 </row>
41116 </tbody>
41117 </tgroup>
41118 </informaltable>
41119 <para>
41120 See <option>check_string</option> above.
41121 </para>
41122 <para>
41123 <indexterm role="option">
41124 <primary><option>freeze_exec_fail</option></primary>
41125 </indexterm>
41126 </para>
41127 <informaltable frame="all">
41128 <tgroup cols="4" colsep="0" rowsep="0">
41129 <colspec colwidth="8*" align="left"/>
41130 <colspec colwidth="6*" align="center"/>
41131 <colspec colwidth="6*" align="center"/>
41132 <colspec colwidth="6*" align="right"/>
41133 <tbody>
41134 <row>
41135 <entry><option>freeze_exec_fail</option></entry>
41136 <entry>Use: <emphasis>pipe</emphasis></entry>
41137 <entry>Type: <emphasis>boolean</emphasis></entry>
41138 <entry>Default: <emphasis>false</emphasis></entry>
41139 </row>
41140 </tbody>
41141 </tgroup>
41142 </informaltable>
41143 <para>
41144 <indexterm role="concept">
41145 <primary>exec failure</primary>
41146 </indexterm>
41147 <indexterm role="concept">
41148 <primary>failure of exec</primary>
41149 </indexterm>
41150 <indexterm role="concept">
41151 <primary><command>pipe</command> transport</primary>
41152 <secondary>failure of exec</secondary>
41153 </indexterm>
41154 Failure to exec the command in a pipe transport is by default treated like
41155 any other failure while running the command. However, if <option>freeze_exec_fail</option>
41156 is set, failure to exec is treated specially, and causes the message to be
41157 frozen, whatever the setting of <option>ignore_status</option>.
41158 </para>
41159 <para>
41160 <indexterm role="option">
41161 <primary><option>freeze_signal</option></primary>
41162 </indexterm>
41163 </para>
41164 <informaltable frame="all">
41165 <tgroup cols="4" colsep="0" rowsep="0">
41166 <colspec colwidth="8*" align="left"/>
41167 <colspec colwidth="6*" align="center"/>
41168 <colspec colwidth="6*" align="center"/>
41169 <colspec colwidth="6*" align="right"/>
41170 <tbody>
41171 <row>
41172 <entry><option>freeze_signal</option></entry>
41173 <entry>Use: <emphasis>pipe</emphasis></entry>
41174 <entry>Type: <emphasis>boolean</emphasis></entry>
41175 <entry>Default: <emphasis>false</emphasis></entry>
41176 </row>
41177 </tbody>
41178 </tgroup>
41179 </informaltable>
41180 <para>
41181 <indexterm role="concept">
41182 <primary>signal exit</primary>
41183 </indexterm>
41184 <indexterm role="concept">
41185 <primary><command>pipe</command> transport</primary>
41186 <secondary>,</secondary>
41187 </indexterm>
41188 Normally if the process run by a command in a pipe transport exits on a signal,
41189 a bounce message is sent. If <option>freeze_signal</option> is set, the message will be
41190 frozen in Exim&#x2019;s queue instead.
41191 </para>
41192 <para>
41193 <indexterm role="option">
41194 <primary><option>ignore_status</option></primary>
41195 </indexterm>
41196 </para>
41197 <informaltable frame="all">
41198 <tgroup cols="4" colsep="0" rowsep="0">
41199 <colspec colwidth="8*" align="left"/>
41200 <colspec colwidth="6*" align="center"/>
41201 <colspec colwidth="6*" align="center"/>
41202 <colspec colwidth="6*" align="right"/>
41203 <tbody>
41204 <row>
41205 <entry><option>ignore_status</option></entry>
41206 <entry>Use: <emphasis>pipe</emphasis></entry>
41207 <entry>Type: <emphasis>boolean</emphasis></entry>
41208 <entry>Default: <emphasis>false</emphasis></entry>
41209 </row>
41210 </tbody>
41211 </tgroup>
41212 </informaltable>
41213 <para>
41214 If this option is true, the status returned by the subprocess that is set up to
41215 run the command is ignored, and Exim behaves as if zero had been returned.
41216 Otherwise, a non-zero status or termination by signal causes an error return
41217 from the transport unless the status value is one of those listed in
41218 <option>temp_errors</option>; these cause the delivery to be deferred and tried again later.
41219 </para>
41220 <para>
41221 <emphasis role="bold">Note</emphasis>: This option does not apply to timeouts, which do not return a status.
41222 See the <option>timeout_defer</option> option for how timeouts are handled.
41223 </para>
41224 <para>
41225 <indexterm role="option">
41226 <primary><option>log_defer_output</option></primary>
41227 </indexterm>
41228 </para>
41229 <informaltable frame="all">
41230 <tgroup cols="4" colsep="0" rowsep="0">
41231 <colspec colwidth="8*" align="left"/>
41232 <colspec colwidth="6*" align="center"/>
41233 <colspec colwidth="6*" align="center"/>
41234 <colspec colwidth="6*" align="right"/>
41235 <tbody>
41236 <row>
41237 <entry><option>log_defer_output</option></entry>
41238 <entry>Use: <emphasis>pipe</emphasis></entry>
41239 <entry>Type: <emphasis>boolean</emphasis></entry>
41240 <entry>Default: <emphasis>false</emphasis></entry>
41241 </row>
41242 </tbody>
41243 </tgroup>
41244 </informaltable>
41245 <para>
41246 <indexterm role="concept">
41247 <primary><command>pipe</command> transport</primary>
41248 <secondary>logging output</secondary>
41249 </indexterm>
41250 If this option is set, and the status returned by the command is
41251 one of the codes listed in <option>temp_errors</option> (that is, delivery was deferred),
41252 and any output was produced, the first line of it is written to the main log.
41253 </para>
41254 <para>
41255 <indexterm role="option">
41256 <primary><option>log_fail_output</option></primary>
41257 </indexterm>
41258 </para>
41259 <informaltable frame="all">
41260 <tgroup cols="4" colsep="0" rowsep="0">
41261 <colspec colwidth="8*" align="left"/>
41262 <colspec colwidth="6*" align="center"/>
41263 <colspec colwidth="6*" align="center"/>
41264 <colspec colwidth="6*" align="right"/>
41265 <tbody>
41266 <row>
41267 <entry><option>log_fail_output</option></entry>
41268 <entry>Use: <emphasis>pipe</emphasis></entry>
41269 <entry>Type: <emphasis>boolean</emphasis></entry>
41270 <entry>Default: <emphasis>false</emphasis></entry>
41271 </row>
41272 </tbody>
41273 </tgroup>
41274 </informaltable>
41275 <para>
41276 If this option is set, and the command returns any output, and also ends with a
41277 return code that is neither zero nor one of the return codes listed in
41278 <option>temp_errors</option> (that is, the delivery failed), the first line of output is
41279 written to the main log. This option and <option>log_output</option> are mutually exclusive.
41280 Only one of them may be set.
41281 </para>
41282 <para>
41283 <indexterm role="option">
41284 <primary><option>log_output</option></primary>
41285 </indexterm>
41286 </para>
41287 <informaltable frame="all">
41288 <tgroup cols="4" colsep="0" rowsep="0">
41289 <colspec colwidth="8*" align="left"/>
41290 <colspec colwidth="6*" align="center"/>
41291 <colspec colwidth="6*" align="center"/>
41292 <colspec colwidth="6*" align="right"/>
41293 <tbody>
41294 <row>
41295 <entry><option>log_output</option></entry>
41296 <entry>Use: <emphasis>pipe</emphasis></entry>
41297 <entry>Type: <emphasis>boolean</emphasis></entry>
41298 <entry>Default: <emphasis>false</emphasis></entry>
41299 </row>
41300 </tbody>
41301 </tgroup>
41302 </informaltable>
41303 <para>
41304 If this option is set and the command returns any output, the first line of
41305 output is written to the main log, whatever the return code. This option and
41306 <option>log_fail_output</option> are mutually exclusive. Only one of them may be set.
41307 </para>
41308 <para>
41309 <indexterm role="option">
41310 <primary><option>max_output</option></primary>
41311 </indexterm>
41312 </para>
41313 <informaltable frame="all">
41314 <tgroup cols="4" colsep="0" rowsep="0">
41315 <colspec colwidth="8*" align="left"/>
41316 <colspec colwidth="6*" align="center"/>
41317 <colspec colwidth="6*" align="center"/>
41318 <colspec colwidth="6*" align="right"/>
41319 <tbody>
41320 <row>
41321 <entry><option>max_output</option></entry>
41322 <entry>Use: <emphasis>pipe</emphasis></entry>
41323 <entry>Type: <emphasis>integer</emphasis></entry>
41324 <entry>Default: <emphasis>20K</emphasis></entry>
41325 </row>
41326 </tbody>
41327 </tgroup>
41328 </informaltable>
41329 <para>
41330 This specifies the maximum amount of output that the command may produce on its
41331 standard output and standard error file combined. If the limit is exceeded, the
41332 process running the command is killed. This is intended as a safety measure to
41333 catch runaway processes. The limit is applied independently of the settings of
41334 the options that control what is done with such output (for example,
41335 <option>return_output</option>). Because of buffering effects, the amount of output may
41336 exceed the limit by a small amount before Exim notices.
41337 </para>
41338 <para>
41339 <indexterm role="option">
41340 <primary><option>message_prefix</option></primary>
41341 </indexterm>
41342 </para>
41343 <informaltable frame="all">
41344 <tgroup cols="4" colsep="0" rowsep="0">
41345 <colspec colwidth="8*" align="left"/>
41346 <colspec colwidth="6*" align="center"/>
41347 <colspec colwidth="6*" align="center"/>
41348 <colspec colwidth="6*" align="right"/>
41349 <tbody>
41350 <row>
41351 <entry><option>message_prefix</option></entry>
41352 <entry>Use: <emphasis>pipe</emphasis></entry>
41353 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41354 <entry>Default: <emphasis>see below</emphasis></entry>
41355 </row>
41356 </tbody>
41357 </tgroup>
41358 </informaltable>
41359 <para>
41360 The string specified here is expanded and output at the start of every message.
41361 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is
41362 </para>
41363 <literallayout class="monospaced">
41364 message_prefix = \
41365   From ${if def:return_path{$return_path}{MAILER-DAEMON}}\
41366   ${tod_bsdinbox}\n
41367 </literallayout>
41368 <para>
41369 <indexterm role="concept">
41370 <primary>Cyrus</primary>
41371 </indexterm>
41372 <indexterm role="concept">
41373 <primary><option>tmail</option></primary>
41374 </indexterm>
41375 <indexterm role="concept">
41376 <primary><quote>From</quote> line</primary>
41377 </indexterm>
41378 This is required by the commonly used <filename>/usr/bin/vacation</filename> program.
41379 However, it must <emphasis>not</emphasis> be present if delivery is to the Cyrus IMAP server,
41380 or to the <option>tmail</option> local delivery agent. The prefix can be suppressed by
41381 setting
41382 </para>
41383 <literallayout class="monospaced">
41384 message_prefix =
41385 </literallayout>
41386 <para>
41387 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
41388 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_prefix</option>.
41389 </para>
41390 <para>
41391 <indexterm role="option">
41392 <primary><option>message_suffix</option></primary>
41393 </indexterm>
41394 </para>
41395 <informaltable frame="all">
41396 <tgroup cols="4" colsep="0" rowsep="0">
41397 <colspec colwidth="8*" align="left"/>
41398 <colspec colwidth="6*" align="center"/>
41399 <colspec colwidth="6*" align="center"/>
41400 <colspec colwidth="6*" align="right"/>
41401 <tbody>
41402 <row>
41403 <entry><option>message_suffix</option></entry>
41404 <entry>Use: <emphasis>pipe</emphasis></entry>
41405 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41406 <entry>Default: <emphasis>see below</emphasis></entry>
41407 </row>
41408 </tbody>
41409 </tgroup>
41410 </informaltable>
41411 <para>
41412 The string specified here is expanded and output at the end of every message.
41413 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is a single newline.
41414 The suffix can be suppressed by setting
41415 </para>
41416 <literallayout class="monospaced">
41417 message_suffix =
41418 </literallayout>
41419 <para>
41420 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
41421 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_suffix</option>.
41422 </para>
41423 <para>
41424 <indexterm role="option">
41425 <primary><option>path</option></primary>
41426 </indexterm>
41427 </para>
41428 <informaltable frame="all">
41429 <tgroup cols="4" colsep="0" rowsep="0">
41430 <colspec colwidth="8*" align="left"/>
41431 <colspec colwidth="6*" align="center"/>
41432 <colspec colwidth="6*" align="center"/>
41433 <colspec colwidth="6*" align="right"/>
41434 <tbody>
41435 <row>
41436 <entry><option>path</option></entry>
41437 <entry>Use: <emphasis>pipe</emphasis></entry>
41438 <entry>Type: <emphasis>string</emphasis></entry>
41439 <entry>Default: <emphasis>see below</emphasis></entry>
41440 </row>
41441 </tbody>
41442 </tgroup>
41443 </informaltable>
41444 <para>
41445 This option specifies the string that is set up in the PATH environment
41446 variable of the subprocess. The default is:
41447 </para>
41448 <literallayout class="monospaced">
41449 /bin:/usr/bin
41450 </literallayout>
41451 <para>
41452 If the <option>command</option> option does not yield an absolute path name, the command is
41453 sought in the PATH directories, in the usual way. <emphasis role="bold">Warning</emphasis>: This does not
41454 apply to a command specified as a transport filter.
41455 </para>
41456 <para>
41457 <indexterm role="option">
41458 <primary><option>permit_coredump</option></primary>
41459 </indexterm>
41460 </para>
41461 <informaltable frame="all">
41462 <tgroup cols="4" colsep="0" rowsep="0">
41463 <colspec colwidth="8*" align="left"/>
41464 <colspec colwidth="6*" align="center"/>
41465 <colspec colwidth="6*" align="center"/>
41466 <colspec colwidth="6*" align="right"/>
41467 <tbody>
41468 <row>
41469 <entry><option>permit_coredump</option></entry>
41470 <entry>Use: <emphasis>pipe</emphasis></entry>
41471 <entry>Type: <emphasis>boolean</emphasis></entry>
41472 <entry>Default: <emphasis>false</emphasis></entry>
41473 </row>
41474 </tbody>
41475 </tgroup>
41476 </informaltable>
41477 <para>
41478 Normally Exim inhibits core-dumps during delivery.  If you have a need to get
41479 a core-dump of a pipe command, enable this command.  This enables core-dumps
41480 during delivery and affects both the Exim binary and the pipe command run.
41481 It is recommended that this option remain off unless and until you have a need
41482 for it and that this only be enabled when needed, as the risk of excessive
41483 resource consumption can be quite high.  Note also that Exim is typically
41484 installed as a setuid binary and most operating systems will inhibit coredumps
41485 of these by default, so further OS-specific action may be required.
41486 </para>
41487 <para>
41488 <indexterm role="option">
41489 <primary><option>pipe_as_creator</option></primary>
41490 </indexterm>
41491 </para>
41492 <informaltable frame="all">
41493 <tgroup cols="4" colsep="0" rowsep="0">
41494 <colspec colwidth="8*" align="left"/>
41495 <colspec colwidth="6*" align="center"/>
41496 <colspec colwidth="6*" align="center"/>
41497 <colspec colwidth="6*" align="right"/>
41498 <tbody>
41499 <row>
41500 <entry><option>pipe_as_creator</option></entry>
41501 <entry>Use: <emphasis>pipe</emphasis></entry>
41502 <entry>Type: <emphasis>boolean</emphasis></entry>
41503 <entry>Default: <emphasis>false</emphasis></entry>
41504 </row>
41505 </tbody>
41506 </tgroup>
41507 </informaltable>
41508 <para>
41509 <indexterm role="concept">
41510 <primary>uid (user id)</primary>
41511 <secondary>local delivery</secondary>
41512 </indexterm>
41513 If the generic <option>user</option> option is not set and this option is true, the delivery
41514 process is run under the uid that was in force when Exim was originally called
41515 to accept the message. If the group id is not otherwise set (via the generic
41516 <option>group</option> option), the gid that was in force when Exim was originally called to
41517 accept the message is used.
41518 </para>
41519 <para>
41520 <indexterm role="option">
41521 <primary><option>restrict_to_path</option></primary>
41522 </indexterm>
41523 </para>
41524 <informaltable frame="all">
41525 <tgroup cols="4" colsep="0" rowsep="0">
41526 <colspec colwidth="8*" align="left"/>
41527 <colspec colwidth="6*" align="center"/>
41528 <colspec colwidth="6*" align="center"/>
41529 <colspec colwidth="6*" align="right"/>
41530 <tbody>
41531 <row>
41532 <entry><option>restrict_to_path</option></entry>
41533 <entry>Use: <emphasis>pipe</emphasis></entry>
41534 <entry>Type: <emphasis>boolean</emphasis></entry>
41535 <entry>Default: <emphasis>false</emphasis></entry>
41536 </row>
41537 </tbody>
41538 </tgroup>
41539 </informaltable>
41540 <para>
41541 When this option is set, any command name not listed in <option>allow_commands</option> must
41542 contain no slashes. The command is searched for only in the directories listed
41543 in the <option>path</option> option. This option is intended for use in the case when a pipe
41544 command has been generated from a user&#x2019;s <filename>.forward</filename> file. This is usually
41545 handled by a <command>pipe</command> transport called <option>address_pipe</option>.
41546 </para>
41547 <para>
41548 <indexterm role="option">
41549 <primary><option>return_fail_output</option></primary>
41550 </indexterm>
41551 </para>
41552 <informaltable frame="all">
41553 <tgroup cols="4" colsep="0" rowsep="0">
41554 <colspec colwidth="8*" align="left"/>
41555 <colspec colwidth="6*" align="center"/>
41556 <colspec colwidth="6*" align="center"/>
41557 <colspec colwidth="6*" align="right"/>
41558 <tbody>
41559 <row>
41560 <entry><option>return_fail_output</option></entry>
41561 <entry>Use: <emphasis>pipe</emphasis></entry>
41562 <entry>Type: <emphasis>boolean</emphasis></entry>
41563 <entry>Default: <emphasis>false</emphasis></entry>
41564 </row>
41565 </tbody>
41566 </tgroup>
41567 </informaltable>
41568 <para>
41569 If this option is true, and the command produced any output and ended with a
41570 return code other than zero or one of the codes listed in <option>temp_errors</option> (that
41571 is, the delivery failed), the output is returned in the bounce message.
41572 However, if the message has a null sender (that is, it is itself a bounce
41573 message), output from the command is discarded. This option and
41574 <option>return_output</option> are mutually exclusive. Only one of them may be set.
41575 </para>
41576 <para>
41577 <indexterm role="option">
41578 <primary><option>return_output</option></primary>
41579 </indexterm>
41580 </para>
41581 <informaltable frame="all">
41582 <tgroup cols="4" colsep="0" rowsep="0">
41583 <colspec colwidth="8*" align="left"/>
41584 <colspec colwidth="6*" align="center"/>
41585 <colspec colwidth="6*" align="center"/>
41586 <colspec colwidth="6*" align="right"/>
41587 <tbody>
41588 <row>
41589 <entry><option>return_output</option></entry>
41590 <entry>Use: <emphasis>pipe</emphasis></entry>
41591 <entry>Type: <emphasis>boolean</emphasis></entry>
41592 <entry>Default: <emphasis>false</emphasis></entry>
41593 </row>
41594 </tbody>
41595 </tgroup>
41596 </informaltable>
41597 <para>
41598 If this option is true, and the command produced any output, the delivery is
41599 deemed to have failed whatever the return code from the command, and the output
41600 is returned in the bounce message. Otherwise, the output is just discarded.
41601 However, if the message has a null sender (that is, it is a bounce message),
41602 output from the command is always discarded, whatever the setting of this
41603 option. This option and <option>return_fail_output</option> are mutually exclusive. Only one
41604 of them may be set.
41605 </para>
41606 <para>
41607 <indexterm role="option">
41608 <primary><option>temp_errors</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>temp_errors</option></entry>
41620 <entry>Use: <emphasis>pipe</emphasis></entry>
41621 <entry>Type: <emphasis>string list</emphasis></entry>
41622 <entry>Default: <emphasis>see below</emphasis></entry>
41623 </row>
41624 </tbody>
41625 </tgroup>
41626 </informaltable>
41627 <para>
41628 <indexterm role="concept">
41629 <primary><command>pipe</command> transport</primary>
41630 <secondary>temporary failure</secondary>
41631 </indexterm>
41632 This option contains either a colon-separated list of numbers, or a single
41633 asterisk. If <option>ignore_status</option> is false
41634 and <option>return_output</option> is not set,
41635 and the command exits with a non-zero return code, the failure is treated as
41636 temporary and the delivery is deferred if the return code matches one of the
41637 numbers, or if the setting is a single asterisk. Otherwise, non-zero return
41638 codes are treated as permanent errors. The default setting contains the codes
41639 defined by EX_TEMPFAIL and EX_CANTCREAT in <filename>sysexits.h</filename>. If Exim is
41640 compiled on a system that does not define these macros, it assumes values of 75
41641 and 73, respectively.
41642 </para>
41643 <para>
41644 <indexterm role="option">
41645 <primary><option>timeout</option></primary>
41646 </indexterm>
41647 </para>
41648 <informaltable frame="all">
41649 <tgroup cols="4" colsep="0" rowsep="0">
41650 <colspec colwidth="8*" align="left"/>
41651 <colspec colwidth="6*" align="center"/>
41652 <colspec colwidth="6*" align="center"/>
41653 <colspec colwidth="6*" align="right"/>
41654 <tbody>
41655 <row>
41656 <entry><option>timeout</option></entry>
41657 <entry>Use: <emphasis>pipe</emphasis></entry>
41658 <entry>Type: <emphasis>time</emphasis></entry>
41659 <entry>Default: <emphasis>1h</emphasis></entry>
41660 </row>
41661 </tbody>
41662 </tgroup>
41663 </informaltable>
41664 <para>
41665 If the command fails to complete within this time, it is killed. This normally
41666 causes the delivery to fail (but see <option>timeout_defer</option>). A zero time interval
41667 specifies no timeout. In order to ensure that any subprocesses created by the
41668 command are also killed, Exim makes the initial process a process group leader,
41669 and kills the whole process group on a timeout. However, this can be defeated
41670 if one of the processes starts a new process group.
41671 </para>
41672 <para>
41673 <indexterm role="option">
41674 <primary><option>timeout_defer</option></primary>
41675 </indexterm>
41676 </para>
41677 <informaltable frame="all">
41678 <tgroup cols="4" colsep="0" rowsep="0">
41679 <colspec colwidth="8*" align="left"/>
41680 <colspec colwidth="6*" align="center"/>
41681 <colspec colwidth="6*" align="center"/>
41682 <colspec colwidth="6*" align="right"/>
41683 <tbody>
41684 <row>
41685 <entry><option>timeout_defer</option></entry>
41686 <entry>Use: <emphasis>pipe</emphasis></entry>
41687 <entry>Type: <emphasis>boolean</emphasis></entry>
41688 <entry>Default: <emphasis>false</emphasis></entry>
41689 </row>
41690 </tbody>
41691 </tgroup>
41692 </informaltable>
41693 <para>
41694 A timeout in a <command>pipe</command> transport, either in the command that the transport
41695 runs, or in a transport filter that is associated with it, is by default
41696 treated as a hard error, and the delivery fails. However, if <option>timeout_defer</option>
41697 is set true, both kinds of timeout become temporary errors, causing the
41698 delivery to be deferred.
41699 </para>
41700 <para>
41701 <indexterm role="option">
41702 <primary><option>umask</option></primary>
41703 </indexterm>
41704 </para>
41705 <informaltable frame="all">
41706 <tgroup cols="4" colsep="0" rowsep="0">
41707 <colspec colwidth="8*" align="left"/>
41708 <colspec colwidth="6*" align="center"/>
41709 <colspec colwidth="6*" align="center"/>
41710 <colspec colwidth="6*" align="right"/>
41711 <tbody>
41712 <row>
41713 <entry><option>umask</option></entry>
41714 <entry>Use: <emphasis>pipe</emphasis></entry>
41715 <entry>Type: <emphasis>octal integer</emphasis></entry>
41716 <entry>Default: <emphasis>022</emphasis></entry>
41717 </row>
41718 </tbody>
41719 </tgroup>
41720 </informaltable>
41721 <para>
41722 This specifies the umask setting for the subprocess that runs the command.
41723 </para>
41724 <para>
41725 <indexterm role="option">
41726 <primary><option>use_bsmtp</option></primary>
41727 </indexterm>
41728 </para>
41729 <informaltable frame="all">
41730 <tgroup cols="4" colsep="0" rowsep="0">
41731 <colspec colwidth="8*" align="left"/>
41732 <colspec colwidth="6*" align="center"/>
41733 <colspec colwidth="6*" align="center"/>
41734 <colspec colwidth="6*" align="right"/>
41735 <tbody>
41736 <row>
41737 <entry><option>use_bsmtp</option></entry>
41738 <entry>Use: <emphasis>pipe</emphasis></entry>
41739 <entry>Type: <emphasis>boolean</emphasis></entry>
41740 <entry>Default: <emphasis>false</emphasis></entry>
41741 </row>
41742 </tbody>
41743 </tgroup>
41744 </informaltable>
41745 <para>
41746 <indexterm role="concept">
41747 <primary>envelope sender</primary>
41748 </indexterm>
41749 If this option is set true, the <command>pipe</command> transport writes messages in <quote>batch
41750 SMTP</quote> format, with the envelope sender and recipient(s) included as SMTP
41751 commands. If you want to include a leading HELO command with such messages,
41752 you can do so by setting the <option>message_prefix</option> option. See section
41753 <xref linkend="SECTbatchSMTP"/> for details of batch SMTP.
41754 </para>
41755 <para>
41756 <indexterm role="option">
41757 <primary><option>use_classresources</option></primary>
41758 </indexterm>
41759 </para>
41760 <informaltable frame="all">
41761 <tgroup cols="4" colsep="0" rowsep="0">
41762 <colspec colwidth="8*" align="left"/>
41763 <colspec colwidth="6*" align="center"/>
41764 <colspec colwidth="6*" align="center"/>
41765 <colspec colwidth="6*" align="right"/>
41766 <tbody>
41767 <row>
41768 <entry><option>use_classresources</option></entry>
41769 <entry>Use: <emphasis>pipe</emphasis></entry>
41770 <entry>Type: <emphasis>boolean</emphasis></entry>
41771 <entry>Default: <emphasis>false</emphasis></entry>
41772 </row>
41773 </tbody>
41774 </tgroup>
41775 </informaltable>
41776 <para>
41777 <indexterm role="concept">
41778 <primary>class resources (BSD)</primary>
41779 </indexterm>
41780 This option is available only when Exim is running on FreeBSD, NetBSD, or
41781 BSD/OS. If it is set true, the <function>setclassresources()</function> function is used to set
41782 resource limits when a <command>pipe</command> transport is run to perform a delivery. The
41783 limits for the uid under which the pipe is to run are obtained from the login
41784 class database.
41785 </para>
41786 <para>
41787 <indexterm role="option">
41788 <primary><option>use_crlf</option></primary>
41789 </indexterm>
41790 </para>
41791 <informaltable frame="all">
41792 <tgroup cols="4" colsep="0" rowsep="0">
41793 <colspec colwidth="8*" align="left"/>
41794 <colspec colwidth="6*" align="center"/>
41795 <colspec colwidth="6*" align="center"/>
41796 <colspec colwidth="6*" align="right"/>
41797 <tbody>
41798 <row>
41799 <entry><option>use_crlf</option></entry>
41800 <entry>Use: <emphasis>pipe</emphasis></entry>
41801 <entry>Type: <emphasis>boolean</emphasis></entry>
41802 <entry>Default: <emphasis>false</emphasis></entry>
41803 </row>
41804 </tbody>
41805 </tgroup>
41806 </informaltable>
41807 <para>
41808 <indexterm role="concept">
41809 <primary>carriage return</primary>
41810 </indexterm>
41811 <indexterm role="concept">
41812 <primary>linefeed</primary>
41813 </indexterm>
41814 This option causes lines to be terminated with the two-character CRLF sequence
41815 (carriage return, linefeed) instead of just a linefeed character. In the case
41816 of batched SMTP, the byte sequence written to the pipe is then an exact image
41817 of what would be sent down a real SMTP connection.
41818 </para>
41819 <para>
41820 The contents of the <option>message_prefix</option> and <option>message_suffix</option> options are
41821 written verbatim, so must contain their own carriage return characters if these
41822 are needed. When <option>use_bsmtp</option> is not set, the default values for both
41823 <option>message_prefix</option> and <option>message_suffix</option> end with a single linefeed, so their
41824 values must be changed to end with <literal>\r\n</literal> if <option>use_crlf</option> is set.
41825 </para>
41826 <para>
41827 <indexterm role="option">
41828 <primary><option>use_shell</option></primary>
41829 </indexterm>
41830 </para>
41831 <informaltable frame="all">
41832 <tgroup cols="4" colsep="0" rowsep="0">
41833 <colspec colwidth="8*" align="left"/>
41834 <colspec colwidth="6*" align="center"/>
41835 <colspec colwidth="6*" align="center"/>
41836 <colspec colwidth="6*" align="right"/>
41837 <tbody>
41838 <row>
41839 <entry><option>use_shell</option></entry>
41840 <entry>Use: <emphasis>pipe</emphasis></entry>
41841 <entry>Type: <emphasis>boolean</emphasis></entry>
41842 <entry>Default: <emphasis>false</emphasis></entry>
41843 </row>
41844 </tbody>
41845 </tgroup>
41846 </informaltable>
41847 <para>
41848 <indexterm role="variable">
41849 <primary><varname>$pipe_addresses</varname></primary>
41850 </indexterm>
41851 If this option is set, it causes the command to be passed to <filename>/bin/sh</filename>
41852 instead of being run directly from the transport, as described in section
41853 <xref linkend="SECThowcommandrun"/>. This is less secure, but is needed in some situations
41854 where the command is expected to be run under a shell and cannot easily be
41855 modified. The <option>allow_commands</option> and <option>restrict_to_path</option> options, and the
41856 <literal>$pipe_addresses</literal> facility are incompatible with <option>use_shell</option>. The
41857 command is expanded as a single string, and handed to <filename>/bin/sh</filename> as data for
41858 its <option>-c</option> option.
41859 </para>
41860 </section>
41861 <section id="SECID143">
41862 <title>Using an external local delivery agent</title>
41863 <para>
41864 <indexterm role="concept">
41865 <primary>local delivery</primary>
41866 <secondary>using an external agent</secondary>
41867 </indexterm>
41868 <indexterm role="concept">
41869 <primary><emphasis>procmail</emphasis></primary>
41870 </indexterm>
41871 <indexterm role="concept">
41872 <primary>external local delivery</primary>
41873 </indexterm>
41874 <indexterm role="concept">
41875 <primary>delivery</primary>
41876 <secondary><emphasis>procmail</emphasis></secondary>
41877 </indexterm>
41878 <indexterm role="concept">
41879 <primary>delivery</primary>
41880 <secondary>by external agent</secondary>
41881 </indexterm>
41882 The <command>pipe</command> transport can be used to pass all messages that require local
41883 delivery to a separate local delivery agent such as <option>procmail</option>. When doing
41884 this, care must be taken to ensure that the pipe is run under an appropriate
41885 uid and gid. In some configurations one wants this to be a uid that is trusted
41886 by the delivery agent to supply the correct sender of the message. It may be
41887 necessary to recompile or reconfigure the delivery agent so that it trusts an
41888 appropriate user. The following is an example transport and router
41889 configuration for <option>procmail</option>:
41890 </para>
41891 <literallayout class="monospaced">
41892 # transport
41893 procmail_pipe:
41894   driver = pipe
41895   command = /usr/local/bin/procmail -d $local_part
41896   return_path_add
41897   delivery_date_add
41898   envelope_to_add
41899   check_string = "From "
41900   escape_string = "&gt;From "
41901   umask = 077
41902   user = $local_part
41903   group = mail
41904
41905 # router
41906 procmail:
41907   driver = accept
41908   check_local_user
41909   transport = procmail_pipe
41910 </literallayout>
41911 <para>
41912 In this example, the pipe is run as the local user, but with the group set to
41913 <emphasis>mail</emphasis>. An alternative is to run the pipe as a specific user such as <emphasis>mail</emphasis>
41914 or <emphasis>exim</emphasis>, but in this case you must arrange for <option>procmail</option> to trust that
41915 user to supply a correct sender address. If you do not specify either a
41916 <option>group</option> or a <option>user</option> option, the pipe command is run as the local user. The
41917 home directory is the user&#x2019;s home directory by default.
41918 </para>
41919 <para>
41920 <emphasis role="bold">Note</emphasis>: The command that the pipe transport runs does <emphasis>not</emphasis> begin with
41921 </para>
41922 <literallayout class="monospaced">
41923 IFS=" "
41924 </literallayout>
41925 <para>
41926 as shown in some <option>procmail</option> documentation, because Exim does not by default
41927 use a shell to run pipe commands.
41928 </para>
41929 <para>
41930 <indexterm role="concept">
41931 <primary>Cyrus</primary>
41932 </indexterm>
41933 The next example shows a transport and a router for a system where local
41934 deliveries are handled by the Cyrus IMAP server.
41935 </para>
41936 <literallayout class="monospaced">
41937 # transport
41938 local_delivery_cyrus:
41939   driver = pipe
41940   command = /usr/cyrus/bin/deliver \
41941             -m ${substr_1:$local_part_suffix} -- $local_part
41942   user = cyrus
41943   group = mail
41944   return_output
41945   log_output
41946   message_prefix =
41947   message_suffix =
41948
41949 # router
41950 local_user_cyrus:
41951   driver = accept
41952   check_local_user
41953   local_part_suffix = .*
41954   transport = local_delivery_cyrus
41955 </literallayout>
41956 <para>
41957 Note the unsetting of <option>message_prefix</option> and <option>message_suffix</option>, and the use of
41958 <option>return_output</option> to cause any text written by Cyrus to be returned to the
41959 sender.
41960 <indexterm role="concept" startref="IIDpiptra1" class="endofrange"/>
41961 <indexterm role="concept" startref="IIDpiptra2" class="endofrange"/>
41962 </para>
41963 </section>
41964 </chapter>
41965
41966 <chapter id="CHAPsmtptrans">
41967 <title>The smtp transport</title>
41968 <para>
41969 <indexterm role="concept" id="IIDsmttra1" class="startofrange">
41970 <primary>transports</primary>
41971 <secondary><command>smtp</command></secondary>
41972 </indexterm>
41973 <indexterm role="concept" id="IIDsmttra2" class="startofrange">
41974 <primary><command>smtp</command> transport</primary>
41975 </indexterm>
41976 The <command>smtp</command> transport delivers messages over TCP/IP connections using the SMTP
41977 or LMTP protocol. The list of hosts to try can either be taken from the address
41978 that is being processed (having been set up by the router), or specified
41979 explicitly for the transport. Timeout and retry processing (see chapter
41980 <xref linkend="CHAPretry"/>) is applied to each IP address independently.
41981 </para>
41982 <section id="SECID144">
41983 <title>Multiple messages on a single connection</title>
41984 <para>
41985 The sending of multiple messages over a single TCP/IP connection can arise in
41986 two ways:
41987 </para>
41988 <itemizedlist>
41989 <listitem>
41990 <para>
41991 If a message contains more than <option>max_rcpt</option> (see below) addresses that are
41992 routed to the same host, more than one copy of the message has to be sent to
41993 that host. In this situation, multiple copies may be sent in a single run of
41994 the <command>smtp</command> transport over a single TCP/IP connection. (What Exim actually
41995 does when it has too many addresses to send in one message also depends on the
41996 value of the global <option>remote_max_parallel</option> option. Details are given in
41997 section <xref linkend="SECToutSMTPTCP"/>.)
41998 </para>
41999 </listitem>
42000 <listitem>
42001 <para>
42002 <indexterm role="concept">
42003 <primary>hints database</primary>
42004 <secondary>remembering routing</secondary>
42005 </indexterm>
42006 When a message has been successfully delivered over a TCP/IP connection, Exim
42007 looks in its hints database to see if there are any other messages awaiting a
42008 connection to the same host. If there are, a new delivery process is started
42009 for one of them, and the current TCP/IP connection is passed on to it. The new
42010 process may in turn send multiple copies and possibly create yet another
42011 process.
42012 </para>
42013 </listitem>
42014 </itemizedlist>
42015 <para>
42016 For each copy sent over the same TCP/IP connection, a sequence counter is
42017 incremented, and if it ever gets to the value of <option>connection_max_messages</option>,
42018 no further messages are sent over that connection.
42019 </para>
42020 </section>
42021 <section id="SECID145">
42022 <title>Use of the $host and $host_address variables</title>
42023 <para>
42024 <indexterm role="variable">
42025 <primary><varname>$host</varname></primary>
42026 </indexterm>
42027 <indexterm role="variable">
42028 <primary><varname>$host_address</varname></primary>
42029 </indexterm>
42030 At the start of a run of the <command>smtp</command> transport, the values of <varname>$host</varname> and
42031 <varname>$host_address</varname> are the name and IP address of the first host on the host list
42032 passed by the router. However, when the transport is about to connect to a
42033 specific host, and while it is connected to that host, <varname>$host</varname> and
42034 <varname>$host_address</varname> are set to the values for that host. These are the values
42035 that are in force when the <option>helo_data</option>, <option>hosts_try_auth</option>, <option>interface</option>,
42036 <option>serialize_hosts</option>, and the various TLS options are expanded.
42037 </para>
42038 </section>
42039 <section id="usecippeer">
42040 <title>Use of $tls_cipher and $tls_peerdn</title>
42041 <para>
42042 <indexterm role="variable">
42043 <primary><varname>$tls_cipher</varname></primary>
42044 </indexterm>
42045 <indexterm role="variable">
42046 <primary><varname>$tls_peerdn</varname></primary>
42047 </indexterm>
42048 At the start of a run of the <command>smtp</command> transport, the values of <varname>$tls_cipher</varname>
42049 and <varname>$tls_peerdn</varname> are the values that were set when the message was received.
42050 These are the values that are used for options that are expanded before any
42051 SMTP connections are made. Just before each connection is made, these two
42052 variables are emptied. If TLS is subsequently started, they are set to the
42053 appropriate values for the outgoing connection, and these are the values that
42054 are in force when any authenticators are run and when the
42055 <option>authenticated_sender</option> option is expanded.
42056 </para>
42057 </section>
42058 <section id="SECID146">
42059 <title>Private options for smtp</title>
42060 <para>
42061 <indexterm role="concept">
42062 <primary>options</primary>
42063 <secondary><command>smtp</command> transport</secondary>
42064 </indexterm>
42065 The private options of the <command>smtp</command> transport are as follows:
42066 </para>
42067 <para>
42068 <indexterm role="option">
42069 <primary><option>address_retry_include_sender</option></primary>
42070 </indexterm>
42071 </para>
42072 <informaltable frame="all">
42073 <tgroup cols="4" colsep="0" rowsep="0">
42074 <colspec colwidth="8*" align="left"/>
42075 <colspec colwidth="6*" align="center"/>
42076 <colspec colwidth="6*" align="center"/>
42077 <colspec colwidth="6*" align="right"/>
42078 <tbody>
42079 <row>
42080 <entry><option>address_retry_include_sender</option></entry>
42081 <entry>Use: <emphasis>smtp</emphasis></entry>
42082 <entry>Type: <emphasis>boolean</emphasis></entry>
42083 <entry>Default: <emphasis>true</emphasis></entry>
42084 </row>
42085 </tbody>
42086 </tgroup>
42087 </informaltable>
42088 <para>
42089 <indexterm role="concept">
42090 <primary>4<emphasis>xx</emphasis> responses</primary>
42091 <secondary>retrying after</secondary>
42092 </indexterm>
42093 When an address is delayed because of a 4<emphasis>xx</emphasis> response to a RCPT command, it
42094 is the combination of sender and recipient that is delayed in subsequent queue
42095 runs until the retry time is reached. You can delay the recipient without
42096 reference to the sender (which is what earlier versions of Exim did), by
42097 setting <option>address_retry_include_sender</option> false. However, this can lead to
42098 problems with servers that regularly issue 4<emphasis>xx</emphasis> responses to RCPT commands.
42099 </para>
42100 <para>
42101 <indexterm role="option">
42102 <primary><option>allow_localhost</option></primary>
42103 </indexterm>
42104 </para>
42105 <informaltable frame="all">
42106 <tgroup cols="4" colsep="0" rowsep="0">
42107 <colspec colwidth="8*" align="left"/>
42108 <colspec colwidth="6*" align="center"/>
42109 <colspec colwidth="6*" align="center"/>
42110 <colspec colwidth="6*" align="right"/>
42111 <tbody>
42112 <row>
42113 <entry><option>allow_localhost</option></entry>
42114 <entry>Use: <emphasis>smtp</emphasis></entry>
42115 <entry>Type: <emphasis>boolean</emphasis></entry>
42116 <entry>Default: <emphasis>false</emphasis></entry>
42117 </row>
42118 </tbody>
42119 </tgroup>
42120 </informaltable>
42121 <para>
42122 <indexterm role="concept">
42123 <primary>local host</primary>
42124 <secondary>sending to</secondary>
42125 </indexterm>
42126 <indexterm role="concept">
42127 <primary>fallback</primary>
42128 <secondary>hosts specified on transport</secondary>
42129 </indexterm>
42130 When a host specified in <option>hosts</option> or <option>fallback_hosts</option> (see below) turns out
42131 to be the local host, or is listed in <option>hosts_treat_as_local</option>, delivery is
42132 deferred by default. However, if <option>allow_localhost</option> is set, Exim goes on to do
42133 the delivery anyway. This should be used only in special cases when the
42134 configuration ensures that no looping will result (for example, a differently
42135 configured Exim is listening on the port to which the message is sent).
42136 </para>
42137 <para>
42138 <indexterm role="option">
42139 <primary><option>authenticated_sender</option></primary>
42140 </indexterm>
42141 </para>
42142 <informaltable frame="all">
42143 <tgroup cols="4" colsep="0" rowsep="0">
42144 <colspec colwidth="8*" align="left"/>
42145 <colspec colwidth="6*" align="center"/>
42146 <colspec colwidth="6*" align="center"/>
42147 <colspec colwidth="6*" align="right"/>
42148 <tbody>
42149 <row>
42150 <entry><option>authenticated_sender</option></entry>
42151 <entry>Use: <emphasis>smtp</emphasis></entry>
42152 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42153 <entry>Default: <emphasis>unset</emphasis></entry>
42154 </row>
42155 </tbody>
42156 </tgroup>
42157 </informaltable>
42158 <para>
42159 <indexterm role="concept">
42160 <primary>Cyrus</primary>
42161 </indexterm>
42162 When Exim has authenticated as a client, or if <option>authenticated_sender_force</option>
42163 is true, this option sets a value for the AUTH= item on outgoing MAIL commands,
42164 overriding any existing authenticated sender value. If the string expansion is
42165 forced to fail, the option is ignored. Other expansion failures cause delivery
42166 to be deferred. If the result of expansion is an empty string, that is also
42167 ignored.
42168 </para>
42169 <para>
42170 The expansion happens after the outgoing connection has been made and TLS
42171 started, if required. This means that the <varname>$host</varname>, <varname>$host_address</varname>,
42172 <varname>$tls_cipher</varname>, and <varname>$tls_peerdn</varname> variables are set according to the
42173 particular connection.
42174 </para>
42175 <para>
42176 If the SMTP session is not authenticated, the expansion of
42177 <option>authenticated_sender</option> still happens (and can cause the delivery to be
42178 deferred if it fails), but no AUTH= item is added to MAIL commands
42179 unless <option>authenticated_sender_force</option> is true.
42180 </para>
42181 <para>
42182 This option allows you to use the <command>smtp</command> transport in LMTP mode to
42183 deliver mail to Cyrus IMAP and provide the proper local part as the
42184 <quote>authenticated sender</quote>, via a setting such as:
42185 </para>
42186 <literallayout class="monospaced">
42187 authenticated_sender = $local_part
42188 </literallayout>
42189 <para>
42190 This removes the need for IMAP subfolders to be assigned special ACLs to
42191 allow direct delivery to those subfolders.
42192 </para>
42193 <para>
42194 Because of expected uses such as that just described for Cyrus (when no
42195 domain is involved), there is no checking on the syntax of the provided
42196 value.
42197 </para>
42198 <para>
42199 <indexterm role="option">
42200 <primary><option>authenticated_sender_force</option></primary>
42201 </indexterm>
42202 </para>
42203 <informaltable frame="all">
42204 <tgroup cols="4" colsep="0" rowsep="0">
42205 <colspec colwidth="8*" align="left"/>
42206 <colspec colwidth="6*" align="center"/>
42207 <colspec colwidth="6*" align="center"/>
42208 <colspec colwidth="6*" align="right"/>
42209 <tbody>
42210 <row>
42211 <entry><option>authenticated_sender_force</option></entry>
42212 <entry>Use: <emphasis>smtp</emphasis></entry>
42213 <entry>Type: <emphasis>boolean</emphasis></entry>
42214 <entry>Default: <emphasis>false</emphasis></entry>
42215 </row>
42216 </tbody>
42217 </tgroup>
42218 </informaltable>
42219 <para>
42220 If this option is set true, the <option>authenticated_sender</option> option&#x2019;s value
42221 is used for the AUTH= item on outgoing MAIL commands, even if Exim has not
42222 authenticated as a client.
42223 </para>
42224 <para>
42225 <indexterm role="option">
42226 <primary><option>command_timeout</option></primary>
42227 </indexterm>
42228 </para>
42229 <informaltable frame="all">
42230 <tgroup cols="4" colsep="0" rowsep="0">
42231 <colspec colwidth="8*" align="left"/>
42232 <colspec colwidth="6*" align="center"/>
42233 <colspec colwidth="6*" align="center"/>
42234 <colspec colwidth="6*" align="right"/>
42235 <tbody>
42236 <row>
42237 <entry><option>command_timeout</option></entry>
42238 <entry>Use: <emphasis>smtp</emphasis></entry>
42239 <entry>Type: <emphasis>time</emphasis></entry>
42240 <entry>Default: <emphasis>5m</emphasis></entry>
42241 </row>
42242 </tbody>
42243 </tgroup>
42244 </informaltable>
42245 <para>
42246 This sets a timeout for receiving a response to an SMTP command that has been
42247 sent out. It is also used when waiting for the initial banner line from the
42248 remote host. Its value must not be zero.
42249 </para>
42250 <para>
42251 <indexterm role="option">
42252 <primary><option>connect_timeout</option></primary>
42253 </indexterm>
42254 </para>
42255 <informaltable frame="all">
42256 <tgroup cols="4" colsep="0" rowsep="0">
42257 <colspec colwidth="8*" align="left"/>
42258 <colspec colwidth="6*" align="center"/>
42259 <colspec colwidth="6*" align="center"/>
42260 <colspec colwidth="6*" align="right"/>
42261 <tbody>
42262 <row>
42263 <entry><option>connect_timeout</option></entry>
42264 <entry>Use: <emphasis>smtp</emphasis></entry>
42265 <entry>Type: <emphasis>time</emphasis></entry>
42266 <entry>Default: <emphasis>5m</emphasis></entry>
42267 </row>
42268 </tbody>
42269 </tgroup>
42270 </informaltable>
42271 <para>
42272 This sets a timeout for the <function>connect()</function> function, which sets up a TCP/IP call
42273 to a remote host. A setting of zero allows the system timeout (typically
42274 several minutes) to act. To have any effect, the value of this option must be
42275 less than the system timeout. However, it has been observed that on some
42276 systems there is no system timeout, which is why the default value for this
42277 option is 5 minutes, a value recommended by RFC 1123.
42278 </para>
42279 <para>
42280 <indexterm role="option">
42281 <primary><option>connection_max_messages</option></primary>
42282 </indexterm>
42283 </para>
42284 <informaltable frame="all">
42285 <tgroup cols="4" colsep="0" rowsep="0">
42286 <colspec colwidth="8*" align="left"/>
42287 <colspec colwidth="6*" align="center"/>
42288 <colspec colwidth="6*" align="center"/>
42289 <colspec colwidth="6*" align="right"/>
42290 <tbody>
42291 <row>
42292 <entry><option>connection_max_messages</option></entry>
42293 <entry>Use: <emphasis>smtp</emphasis></entry>
42294 <entry>Type: <emphasis>integer</emphasis></entry>
42295 <entry>Default: <emphasis>500</emphasis></entry>
42296 </row>
42297 </tbody>
42298 </tgroup>
42299 </informaltable>
42300 <para>
42301 <indexterm role="concept">
42302 <primary>SMTP</primary>
42303 <secondary>passed connection</secondary>
42304 </indexterm>
42305 <indexterm role="concept">
42306 <primary>SMTP</primary>
42307 <secondary>multiple deliveries</secondary>
42308 </indexterm>
42309 <indexterm role="concept">
42310 <primary>multiple SMTP deliveries</primary>
42311 </indexterm>
42312 This controls the maximum number of separate message deliveries that are sent
42313 over a single TCP/IP connection. If the value is zero, there is no limit.
42314 For testing purposes, this value can be overridden by the <option>-oB</option> command line
42315 option.
42316 </para>
42317 <para>
42318 <indexterm role="option">
42319 <primary><option>data_timeout</option></primary>
42320 </indexterm>
42321 </para>
42322 <informaltable frame="all">
42323 <tgroup cols="4" colsep="0" rowsep="0">
42324 <colspec colwidth="8*" align="left"/>
42325 <colspec colwidth="6*" align="center"/>
42326 <colspec colwidth="6*" align="center"/>
42327 <colspec colwidth="6*" align="right"/>
42328 <tbody>
42329 <row>
42330 <entry><option>data_timeout</option></entry>
42331 <entry>Use: <emphasis>smtp</emphasis></entry>
42332 <entry>Type: <emphasis>time</emphasis></entry>
42333 <entry>Default: <emphasis>5m</emphasis></entry>
42334 </row>
42335 </tbody>
42336 </tgroup>
42337 </informaltable>
42338 <para>
42339 This sets a timeout for the transmission of each block in the data portion of
42340 the message. As a result, the overall timeout for a message depends on the size
42341 of the message. Its value must not be zero. See also <option>final_timeout</option>.
42342 </para>
42343 <para>
42344 <indexterm role="option">
42345 <primary><option>delay_after_cutoff</option></primary>
42346 </indexterm>
42347 </para>
42348 <informaltable frame="all">
42349 <tgroup cols="4" colsep="0" rowsep="0">
42350 <colspec colwidth="8*" align="left"/>
42351 <colspec colwidth="6*" align="center"/>
42352 <colspec colwidth="6*" align="center"/>
42353 <colspec colwidth="6*" align="right"/>
42354 <tbody>
42355 <row>
42356 <entry><option>delay_after_cutoff</option></entry>
42357 <entry>Use: <emphasis>smtp</emphasis></entry>
42358 <entry>Type: <emphasis>boolean</emphasis></entry>
42359 <entry>Default: <emphasis>true</emphasis></entry>
42360 </row>
42361 </tbody>
42362 </tgroup>
42363 </informaltable>
42364 <para>
42365 This option controls what happens when all remote IP addresses for a given
42366 domain have been inaccessible for so long that they have passed their retry
42367 cutoff times.
42368 </para>
42369 <para>
42370 In the default state, if the next retry time has not been reached for any of
42371 them, the address is bounced without trying any deliveries. In other words,
42372 Exim delays retrying an IP address after the final cutoff time until a new
42373 retry time is reached, and can therefore bounce an address without ever trying
42374 a delivery, when machines have been down for a long time. Some people are
42375 unhappy at this prospect, so...
42376 </para>
42377 <para>
42378 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
42379 addresses are past their final cutoff time, Exim tries to deliver to those
42380 IP addresses that have not been tried since the message arrived. If there are
42381 none, of if they all fail, the address is bounced. In other words, it does not
42382 delay when a new message arrives, but immediately tries those expired IP
42383 addresses that haven&#x2019;t been tried since the message arrived. If there is a
42384 continuous stream of messages for the dead hosts, unsetting
42385 <option>delay_after_cutoff</option> means that there will be many more attempts to deliver
42386 to them.
42387 </para>
42388 <para>
42389 <indexterm role="option">
42390 <primary><option>dns_qualify_single</option></primary>
42391 </indexterm>
42392 </para>
42393 <informaltable frame="all">
42394 <tgroup cols="4" colsep="0" rowsep="0">
42395 <colspec colwidth="8*" align="left"/>
42396 <colspec colwidth="6*" align="center"/>
42397 <colspec colwidth="6*" align="center"/>
42398 <colspec colwidth="6*" align="right"/>
42399 <tbody>
42400 <row>
42401 <entry><option>dns_qualify_single</option></entry>
42402 <entry>Use: <emphasis>smtp</emphasis></entry>
42403 <entry>Type: <emphasis>boolean</emphasis></entry>
42404 <entry>Default: <emphasis>true</emphasis></entry>
42405 </row>
42406 </tbody>
42407 </tgroup>
42408 </informaltable>
42409 <para>
42410 If the <option>hosts</option> or <option>fallback_hosts</option> option is being used,
42411 and the <option>gethostbyname</option> option is false,
42412 the RES_DEFNAMES resolver option is set. See the <option>qualify_single</option> option
42413 in chapter <xref linkend="CHAPdnslookup"/> for more details.
42414 </para>
42415 <para>
42416 <indexterm role="option">
42417 <primary><option>dns_search_parents</option></primary>
42418 </indexterm>
42419 </para>
42420 <informaltable frame="all">
42421 <tgroup cols="4" colsep="0" rowsep="0">
42422 <colspec colwidth="8*" align="left"/>
42423 <colspec colwidth="6*" align="center"/>
42424 <colspec colwidth="6*" align="center"/>
42425 <colspec colwidth="6*" align="right"/>
42426 <tbody>
42427 <row>
42428 <entry><option>dns_search_parents</option></entry>
42429 <entry>Use: <emphasis>smtp</emphasis></entry>
42430 <entry>Type: <emphasis>boolean</emphasis></entry>
42431 <entry>Default: <emphasis>false</emphasis></entry>
42432 </row>
42433 </tbody>
42434 </tgroup>
42435 </informaltable>
42436 <para>
42437 If the <option>hosts</option> or <option>fallback_hosts</option> option is being used, and the
42438 <option>gethostbyname</option> option is false, the RES_DNSRCH resolver option is set.
42439 See the <option>search_parents</option> option in chapter <xref linkend="CHAPdnslookup"/> for more
42440 details.
42441 </para>
42442 <para>
42443 <indexterm role="option">
42444 <primary><option>fallback_hosts</option></primary>
42445 </indexterm>
42446 </para>
42447 <informaltable frame="all">
42448 <tgroup cols="4" colsep="0" rowsep="0">
42449 <colspec colwidth="8*" align="left"/>
42450 <colspec colwidth="6*" align="center"/>
42451 <colspec colwidth="6*" align="center"/>
42452 <colspec colwidth="6*" align="right"/>
42453 <tbody>
42454 <row>
42455 <entry><option>fallback_hosts</option></entry>
42456 <entry>Use: <emphasis>smtp</emphasis></entry>
42457 <entry>Type: <emphasis>string list</emphasis></entry>
42458 <entry>Default: <emphasis>unset</emphasis></entry>
42459 </row>
42460 </tbody>
42461 </tgroup>
42462 </informaltable>
42463 <para>
42464 <indexterm role="concept">
42465 <primary>fallback</primary>
42466 <secondary>hosts specified on transport</secondary>
42467 </indexterm>
42468 String expansion is not applied to this option. The argument must be a
42469 colon-separated list of host names or IP addresses, optionally also including
42470 port numbers, though the separator can be changed, as described in section
42471 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
42472 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
42473 in section <xref linkend="SECTformatonehostitem"/>.
42474 </para>
42475 <para>
42476 Fallback hosts can also be specified on routers, which associate them with the
42477 addresses they process. As for the <option>hosts</option> option without <option>hosts_override</option>,
42478 <option>fallback_hosts</option> specified on the transport is used only if the address does
42479 not have its own associated fallback host list. Unlike <option>hosts</option>, a setting of
42480 <option>fallback_hosts</option> on an address is not overridden by <option>hosts_override</option>.
42481 However, <option>hosts_randomize</option> does apply to fallback host lists.
42482 </para>
42483 <para>
42484 If Exim is unable to deliver to any of the hosts for a particular address, and
42485 the errors are not permanent rejections, the address is put on a separate
42486 transport queue with its host list replaced by the fallback hosts, unless the
42487 address was routed via MX records and the current host was in the original MX
42488 list. In that situation, the fallback host list is not used.
42489 </para>
42490 <para>
42491 Once normal deliveries are complete, the fallback queue is delivered by
42492 re-running the same transports with the new host lists. If several failing
42493 addresses have the same fallback hosts (and <option>max_rcpt</option> permits it), a single
42494 copy of the message is sent.
42495 </para>
42496 <para>
42497 The resolution of the host names on the fallback list is controlled by the
42498 <option>gethostbyname</option> option, as for the <option>hosts</option> option. Fallback hosts apply
42499 both to cases when the host list comes with the address and when it is taken
42500 from <option>hosts</option>. This option provides a <quote>use a smart host only if delivery
42501 fails</quote> facility.
42502 </para>
42503 <para>
42504 <indexterm role="option">
42505 <primary><option>final_timeout</option></primary>
42506 </indexterm>
42507 </para>
42508 <informaltable frame="all">
42509 <tgroup cols="4" colsep="0" rowsep="0">
42510 <colspec colwidth="8*" align="left"/>
42511 <colspec colwidth="6*" align="center"/>
42512 <colspec colwidth="6*" align="center"/>
42513 <colspec colwidth="6*" align="right"/>
42514 <tbody>
42515 <row>
42516 <entry><option>final_timeout</option></entry>
42517 <entry>Use: <emphasis>smtp</emphasis></entry>
42518 <entry>Type: <emphasis>time</emphasis></entry>
42519 <entry>Default: <emphasis>10m</emphasis></entry>
42520 </row>
42521 </tbody>
42522 </tgroup>
42523 </informaltable>
42524 <para>
42525 This is the timeout that applies while waiting for the response to the final
42526 line containing just <quote>.</quote> that terminates a message. Its value must not be
42527 zero.
42528 </para>
42529 <para>
42530 <indexterm role="option">
42531 <primary><option>gethostbyname</option></primary>
42532 </indexterm>
42533 </para>
42534 <informaltable frame="all">
42535 <tgroup cols="4" colsep="0" rowsep="0">
42536 <colspec colwidth="8*" align="left"/>
42537 <colspec colwidth="6*" align="center"/>
42538 <colspec colwidth="6*" align="center"/>
42539 <colspec colwidth="6*" align="right"/>
42540 <tbody>
42541 <row>
42542 <entry><option>gethostbyname</option></entry>
42543 <entry>Use: <emphasis>smtp</emphasis></entry>
42544 <entry>Type: <emphasis>boolean</emphasis></entry>
42545 <entry>Default: <emphasis>false</emphasis></entry>
42546 </row>
42547 </tbody>
42548 </tgroup>
42549 </informaltable>
42550 <para>
42551 If this option is true when the <option>hosts</option> and/or <option>fallback_hosts</option> options are
42552 being used, names are looked up using <function>gethostbyname()</function>
42553 (or <function>getipnodebyname()</function> when available)
42554 instead of using the DNS. Of course, that function may in fact use the DNS, but
42555 it may also consult other sources of information such as <filename>/etc/hosts</filename>.
42556 </para>
42557 <para>
42558 <indexterm role="option">
42559 <primary><option>gnutls_require_kx</option></primary>
42560 </indexterm>
42561 </para>
42562 <informaltable frame="all">
42563 <tgroup cols="4" colsep="0" rowsep="0">
42564 <colspec colwidth="8*" align="left"/>
42565 <colspec colwidth="6*" align="center"/>
42566 <colspec colwidth="6*" align="center"/>
42567 <colspec colwidth="6*" align="right"/>
42568 <tbody>
42569 <row>
42570 <entry><option>gnutls_require_kx</option></entry>
42571 <entry>Use: <emphasis>smtp</emphasis></entry>
42572 <entry>Type: <emphasis>string</emphasis></entry>
42573 <entry>Default: <emphasis>unset</emphasis></entry>
42574 </row>
42575 </tbody>
42576 </tgroup>
42577 </informaltable>
42578 <para>
42579 This option controls the key exchange mechanisms when GnuTLS is used in an Exim
42580 client. For details, see section <xref linkend="SECTreqciphgnu"/>.
42581 </para>
42582 <para>
42583 <indexterm role="option">
42584 <primary><option>gnutls_require_mac</option></primary>
42585 </indexterm>
42586 </para>
42587 <informaltable frame="all">
42588 <tgroup cols="4" colsep="0" rowsep="0">
42589 <colspec colwidth="8*" align="left"/>
42590 <colspec colwidth="6*" align="center"/>
42591 <colspec colwidth="6*" align="center"/>
42592 <colspec colwidth="6*" align="right"/>
42593 <tbody>
42594 <row>
42595 <entry><option>gnutls_require_mac</option></entry>
42596 <entry>Use: <emphasis>smtp</emphasis></entry>
42597 <entry>Type: <emphasis>string</emphasis></entry>
42598 <entry>Default: <emphasis>unset</emphasis></entry>
42599 </row>
42600 </tbody>
42601 </tgroup>
42602 </informaltable>
42603 <para>
42604 This option controls the MAC algorithms when GnuTLS is used in an Exim
42605 client. For details, see section <xref linkend="SECTreqciphgnu"/>.
42606 </para>
42607 <para>
42608 <indexterm role="option">
42609 <primary><option>gnutls_require_protocols</option></primary>
42610 </indexterm>
42611 </para>
42612 <informaltable frame="all">
42613 <tgroup cols="4" colsep="0" rowsep="0">
42614 <colspec colwidth="8*" align="left"/>
42615 <colspec colwidth="6*" align="center"/>
42616 <colspec colwidth="6*" align="center"/>
42617 <colspec colwidth="6*" align="right"/>
42618 <tbody>
42619 <row>
42620 <entry><option>gnutls_require_protocols</option></entry>
42621 <entry>Use: <emphasis>smtp</emphasis></entry>
42622 <entry>Type: <emphasis>string</emphasis></entry>
42623 <entry>Default: <emphasis>unset</emphasis></entry>
42624 </row>
42625 </tbody>
42626 </tgroup>
42627 </informaltable>
42628 <para>
42629 This option controls the protocols when GnuTLS is used in an Exim
42630 client. For details, see section <xref linkend="SECTreqciphgnu"/>.
42631 </para>
42632 <para>
42633 <indexterm role="option">
42634 <primary><option>gnutls_compat_mode</option></primary>
42635 </indexterm>
42636 </para>
42637 <informaltable frame="all">
42638 <tgroup cols="4" colsep="0" rowsep="0">
42639 <colspec colwidth="8*" align="left"/>
42640 <colspec colwidth="6*" align="center"/>
42641 <colspec colwidth="6*" align="center"/>
42642 <colspec colwidth="6*" align="right"/>
42643 <tbody>
42644 <row>
42645 <entry><option>gnutls_compat_mode</option></entry>
42646 <entry>Use: <emphasis>smtp</emphasis></entry>
42647 <entry>Type: <emphasis>boolean</emphasis></entry>
42648 <entry>Default: <emphasis>unset</emphasis></entry>
42649 </row>
42650 </tbody>
42651 </tgroup>
42652 </informaltable>
42653 <para>
42654 This option controls whether GnuTLS is used in compatibility mode in an Exim
42655 server. This reduces security slightly, but improves interworking with older
42656 implementations of TLS.
42657 </para>
42658 <para>
42659 <indexterm role="option">
42660 <primary><option>helo_data</option></primary>
42661 </indexterm>
42662 </para>
42663 <informaltable frame="all">
42664 <tgroup cols="4" colsep="0" rowsep="0">
42665 <colspec colwidth="8*" align="left"/>
42666 <colspec colwidth="6*" align="center"/>
42667 <colspec colwidth="6*" align="center"/>
42668 <colspec colwidth="6*" align="right"/>
42669 <tbody>
42670 <row>
42671 <entry><option>helo_data</option></entry>
42672 <entry>Use: <emphasis>smtp</emphasis></entry>
42673 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42674 <entry>Default: <emphasis>see below</emphasis></entry>
42675 </row>
42676 </tbody>
42677 </tgroup>
42678 </informaltable>
42679 <para>
42680 <indexterm role="concept">
42681 <primary>HELO</primary>
42682 <secondary>argument, setting</secondary>
42683 </indexterm>
42684 <indexterm role="concept">
42685 <primary>EHLO</primary>
42686 <secondary>argument, setting</secondary>
42687 </indexterm>
42688 <indexterm role="concept">
42689 <primary>LHLO argument setting</primary>
42690 </indexterm>
42691 The value of this option is expanded after a connection to a another host has
42692 been set up. The result is used as the argument for the EHLO, HELO, or LHLO
42693 command that starts the outgoing SMTP or LMTP session. The default value of the
42694 option is:
42695 </para>
42696 <literallayout class="monospaced">
42697 $primary_hostname
42698 </literallayout>
42699 <para>
42700 During the expansion, the variables <varname>$host</varname> and <varname>$host_address</varname> are set to
42701 the identity of the remote host, and the variables <varname>$sending_ip_address</varname> and
42702 <varname>$sending_port</varname> are set to the local IP address and port number that are being
42703 used. These variables can be used to generate different values for different
42704 servers or different local IP addresses. For example, if you want the string
42705 that is used for <option>helo_data</option> to be obtained by a DNS lookup of the outgoing
42706 interface address, you could use this:
42707 </para>
42708 <literallayout class="monospaced">
42709 helo_data = ${lookup dnsdb{ptr=$sending_ip_address}{$value}\
42710   {$primary_hostname}}
42711 </literallayout>
42712 <para>
42713 The use of <option>helo_data</option> applies both to sending messages and when doing
42714 callouts.
42715 </para>
42716 <para>
42717 <indexterm role="option">
42718 <primary><option>hosts</option></primary>
42719 </indexterm>
42720 </para>
42721 <informaltable frame="all">
42722 <tgroup cols="4" colsep="0" rowsep="0">
42723 <colspec colwidth="8*" align="left"/>
42724 <colspec colwidth="6*" align="center"/>
42725 <colspec colwidth="6*" align="center"/>
42726 <colspec colwidth="6*" align="right"/>
42727 <tbody>
42728 <row>
42729 <entry><option>hosts</option></entry>
42730 <entry>Use: <emphasis>smtp</emphasis></entry>
42731 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
42732 <entry>Default: <emphasis>unset</emphasis></entry>
42733 </row>
42734 </tbody>
42735 </tgroup>
42736 </informaltable>
42737 <para>
42738 Hosts are associated with an address by a router such as <command>dnslookup</command>, which
42739 finds the hosts by looking up the address domain in the DNS, or by
42740 <command>manualroute</command>, which has lists of hosts in its configuration. However,
42741 email addresses can be passed to the <command>smtp</command> transport by any router, and not
42742 all of them can provide an associated list of hosts.
42743 </para>
42744 <para>
42745 The <option>hosts</option> option specifies a list of hosts to be used if the address being
42746 processed does not have any hosts associated with it. The hosts specified by
42747 <option>hosts</option> are also used, whether or not the address has its own hosts, if
42748 <option>hosts_override</option> is set.
42749 </para>
42750 <para>
42751 The string is first expanded, before being interpreted as a colon-separated
42752 list of host names or IP addresses, possibly including port numbers. The
42753 separator may be changed to something other than colon, as described in section
42754 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
42755 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
42756 in section <xref linkend="SECTformatonehostitem"/>. However, note that the <literal>/MX</literal> facility
42757 of the <command>manualroute</command> router is not available here.
42758 </para>
42759 <para>
42760 If the expansion fails, delivery is deferred. Unless the failure was caused by
42761 the inability to complete a lookup, the error is logged to the panic log as
42762 well as the main log. Host names are looked up either by searching directly for
42763 address records in the DNS or by calling <function>gethostbyname()</function> (or
42764 <function>getipnodebyname()</function> when available), depending on the setting of the
42765 <option>gethostbyname</option> option. When Exim is compiled with IPv6 support, if a host
42766 that is looked up in the DNS has both IPv4 and IPv6 addresses, both types of
42767 address are used.
42768 </para>
42769 <para>
42770 During delivery, the hosts are tried in order, subject to their retry status,
42771 unless <option>hosts_randomize</option> is set.
42772 </para>
42773 <para>
42774 <indexterm role="option">
42775 <primary><option>hosts_avoid_esmtp</option></primary>
42776 </indexterm>
42777 </para>
42778 <informaltable frame="all">
42779 <tgroup cols="4" colsep="0" rowsep="0">
42780 <colspec colwidth="8*" align="left"/>
42781 <colspec colwidth="6*" align="center"/>
42782 <colspec colwidth="6*" align="center"/>
42783 <colspec colwidth="6*" align="right"/>
42784 <tbody>
42785 <row>
42786 <entry><option>hosts_avoid_esmtp</option></entry>
42787 <entry>Use: <emphasis>smtp</emphasis></entry>
42788 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
42789 <entry>Default: <emphasis>unset</emphasis></entry>
42790 </row>
42791 </tbody>
42792 </tgroup>
42793 </informaltable>
42794 <para>
42795 <indexterm role="concept">
42796 <primary>ESMTP, avoiding use of</primary>
42797 </indexterm>
42798 <indexterm role="concept">
42799 <primary>HELO</primary>
42800 <secondary>forcing use of</secondary>
42801 </indexterm>
42802 <indexterm role="concept">
42803 <primary>EHLO</primary>
42804 <secondary>avoiding use of</secondary>
42805 </indexterm>
42806 <indexterm role="concept">
42807 <primary>PIPELINING</primary>
42808 <secondary>avoiding the use of</secondary>
42809 </indexterm>
42810 This option is for use with broken hosts that announce ESMTP facilities (for
42811 example, PIPELINING) and then fail to implement them properly. When a host
42812 matches <option>hosts_avoid_esmtp</option>, Exim sends HELO rather than EHLO at the
42813 start of the SMTP session. This means that it cannot use any of the ESMTP
42814 facilities such as AUTH, PIPELINING, SIZE, and STARTTLS.
42815 </para>
42816 <para>
42817 <indexterm role="option">
42818 <primary><option>hosts_avoid_pipelining</option></primary>
42819 </indexterm>
42820 </para>
42821 <informaltable frame="all">
42822 <tgroup cols="4" colsep="0" rowsep="0">
42823 <colspec colwidth="8*" align="left"/>
42824 <colspec colwidth="6*" align="center"/>
42825 <colspec colwidth="6*" align="center"/>
42826 <colspec colwidth="6*" align="right"/>
42827 <tbody>
42828 <row>
42829 <entry><option>hosts_avoid_pipelining</option></entry>
42830 <entry>Use: <emphasis>smtp</emphasis></entry>
42831 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
42832 <entry>Default: <emphasis>unset</emphasis></entry>
42833 </row>
42834 </tbody>
42835 </tgroup>
42836 </informaltable>
42837 <para>
42838 <indexterm role="concept">
42839 <primary>PIPELINING</primary>
42840 <secondary>avoiding the use of</secondary>
42841 </indexterm>
42842 Exim will not use the SMTP PIPELINING extension when delivering to any host
42843 that matches this list, even if the server host advertises PIPELINING support.
42844 </para>
42845 <para>
42846 <indexterm role="option">
42847 <primary><option>hosts_avoid_tls</option></primary>
42848 </indexterm>
42849 </para>
42850 <informaltable frame="all">
42851 <tgroup cols="4" colsep="0" rowsep="0">
42852 <colspec colwidth="8*" align="left"/>
42853 <colspec colwidth="6*" align="center"/>
42854 <colspec colwidth="6*" align="center"/>
42855 <colspec colwidth="6*" align="right"/>
42856 <tbody>
42857 <row>
42858 <entry><option>hosts_avoid_tls</option></entry>
42859 <entry>Use: <emphasis>smtp</emphasis></entry>
42860 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
42861 <entry>Default: <emphasis>unset</emphasis></entry>
42862 </row>
42863 </tbody>
42864 </tgroup>
42865 </informaltable>
42866 <para>
42867 <indexterm role="concept">
42868 <primary>TLS</primary>
42869 <secondary>avoiding for certain hosts</secondary>
42870 </indexterm>
42871 Exim will not try to start a TLS session when delivering to any host that
42872 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
42873 </para>
42874 <para>
42875 <indexterm role="option">
42876 <primary><option>hosts_max_try</option></primary>
42877 </indexterm>
42878 </para>
42879 <informaltable frame="all">
42880 <tgroup cols="4" colsep="0" rowsep="0">
42881 <colspec colwidth="8*" align="left"/>
42882 <colspec colwidth="6*" align="center"/>
42883 <colspec colwidth="6*" align="center"/>
42884 <colspec colwidth="6*" align="right"/>
42885 <tbody>
42886 <row>
42887 <entry><option>hosts_max_try</option></entry>
42888 <entry>Use: <emphasis>smtp</emphasis></entry>
42889 <entry>Type: <emphasis>integer</emphasis></entry>
42890 <entry>Default: <emphasis>5</emphasis></entry>
42891 </row>
42892 </tbody>
42893 </tgroup>
42894 </informaltable>
42895 <para>
42896 <indexterm role="concept">
42897 <primary>host</primary>
42898 <secondary>maximum number to try</secondary>
42899 </indexterm>
42900 <indexterm role="concept">
42901 <primary>limit</primary>
42902 <secondary>number of hosts tried</secondary>
42903 </indexterm>
42904 <indexterm role="concept">
42905 <primary>limit</primary>
42906 <secondary>number of MX tried</secondary>
42907 </indexterm>
42908 <indexterm role="concept">
42909 <primary>MX record</primary>
42910 <secondary>maximum tried</secondary>
42911 </indexterm>
42912 This option limits the number of IP addresses that are tried for any one
42913 delivery in cases where there are temporary delivery errors. Section
42914 <xref linkend="SECTvalhosmax"/> describes in detail how the value of this option is used.
42915 </para>
42916 <para>
42917 <indexterm role="option">
42918 <primary><option>hosts_max_try_hardlimit</option></primary>
42919 </indexterm>
42920 </para>
42921 <informaltable frame="all">
42922 <tgroup cols="4" colsep="0" rowsep="0">
42923 <colspec colwidth="8*" align="left"/>
42924 <colspec colwidth="6*" align="center"/>
42925 <colspec colwidth="6*" align="center"/>
42926 <colspec colwidth="6*" align="right"/>
42927 <tbody>
42928 <row>
42929 <entry><option>hosts_max_try_hardlimit</option></entry>
42930 <entry>Use: <emphasis>smtp</emphasis></entry>
42931 <entry>Type: <emphasis>integer</emphasis></entry>
42932 <entry>Default: <emphasis>50</emphasis></entry>
42933 </row>
42934 </tbody>
42935 </tgroup>
42936 </informaltable>
42937 <para>
42938 This is an additional check on the maximum number of IP addresses that Exim
42939 tries for any one delivery. Section <xref linkend="SECTvalhosmax"/> describes its use and
42940 why it exists.
42941 </para>
42942 <para>
42943 <indexterm role="option">
42944 <primary><option>hosts_nopass_tls</option></primary>
42945 </indexterm>
42946 </para>
42947 <informaltable frame="all">
42948 <tgroup cols="4" colsep="0" rowsep="0">
42949 <colspec colwidth="8*" align="left"/>
42950 <colspec colwidth="6*" align="center"/>
42951 <colspec colwidth="6*" align="center"/>
42952 <colspec colwidth="6*" align="right"/>
42953 <tbody>
42954 <row>
42955 <entry><option>hosts_nopass_tls</option></entry>
42956 <entry>Use: <emphasis>smtp</emphasis></entry>
42957 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
42958 <entry>Default: <emphasis>unset</emphasis></entry>
42959 </row>
42960 </tbody>
42961 </tgroup>
42962 </informaltable>
42963 <para>
42964 <indexterm role="concept">
42965 <primary>TLS</primary>
42966 <secondary>passing connection</secondary>
42967 </indexterm>
42968 <indexterm role="concept">
42969 <primary>multiple SMTP deliveries</primary>
42970 </indexterm>
42971 <indexterm role="concept">
42972 <primary>TLS</primary>
42973 <secondary>multiple message deliveries</secondary>
42974 </indexterm>
42975 For any host that matches this list, a connection on which a TLS session has
42976 been started will not be passed to a new delivery process for sending another
42977 message on the same connection. See section <xref linkend="SECTmulmessam"/> for an
42978 explanation of when this might be needed.
42979 </para>
42980 <para>
42981 <indexterm role="option">
42982 <primary><option>hosts_override</option></primary>
42983 </indexterm>
42984 </para>
42985 <informaltable frame="all">
42986 <tgroup cols="4" colsep="0" rowsep="0">
42987 <colspec colwidth="8*" align="left"/>
42988 <colspec colwidth="6*" align="center"/>
42989 <colspec colwidth="6*" align="center"/>
42990 <colspec colwidth="6*" align="right"/>
42991 <tbody>
42992 <row>
42993 <entry><option>hosts_override</option></entry>
42994 <entry>Use: <emphasis>smtp</emphasis></entry>
42995 <entry>Type: <emphasis>boolean</emphasis></entry>
42996 <entry>Default: <emphasis>false</emphasis></entry>
42997 </row>
42998 </tbody>
42999 </tgroup>
43000 </informaltable>
43001 <para>
43002 If this option is set and the <option>hosts</option> option is also set, any hosts that are
43003 attached to the address are ignored, and instead the hosts specified by the
43004 <option>hosts</option> option are always used. This option does not apply to
43005 <option>fallback_hosts</option>.
43006 </para>
43007 <para>
43008 <indexterm role="option">
43009 <primary><option>hosts_randomize</option></primary>
43010 </indexterm>
43011 </para>
43012 <informaltable frame="all">
43013 <tgroup cols="4" colsep="0" rowsep="0">
43014 <colspec colwidth="8*" align="left"/>
43015 <colspec colwidth="6*" align="center"/>
43016 <colspec colwidth="6*" align="center"/>
43017 <colspec colwidth="6*" align="right"/>
43018 <tbody>
43019 <row>
43020 <entry><option>hosts_randomize</option></entry>
43021 <entry>Use: <emphasis>smtp</emphasis></entry>
43022 <entry>Type: <emphasis>boolean</emphasis></entry>
43023 <entry>Default: <emphasis>false</emphasis></entry>
43024 </row>
43025 </tbody>
43026 </tgroup>
43027 </informaltable>
43028 <para>
43029 <indexterm role="concept">
43030 <primary>randomized host list</primary>
43031 </indexterm>
43032 <indexterm role="concept">
43033 <primary>host</primary>
43034 <secondary>list of; randomized</secondary>
43035 </indexterm>
43036 <indexterm role="concept">
43037 <primary>fallback</primary>
43038 <secondary>randomized hosts</secondary>
43039 </indexterm>
43040 If this option is set, and either the list of hosts is taken from the
43041 <option>hosts</option> or the <option>fallback_hosts</option> option, or the hosts supplied by the router
43042 were not obtained from MX records (this includes fallback hosts from the
43043 router), and were not randomized by the router, the order of trying the hosts
43044 is randomized each time the transport runs. Randomizing the order of a host
43045 list can be used to do crude load sharing.
43046 </para>
43047 <para>
43048 When <option>hosts_randomize</option> is true, a host list may be split into groups whose
43049 order is separately randomized. This makes it possible to set up MX-like
43050 behaviour. The boundaries between groups are indicated by an item that is just
43051 <literal>+</literal> in the host list. For example:
43052 </para>
43053 <literallayout class="monospaced">
43054 hosts = host1:host2:host3:+:host4:host5
43055 </literallayout>
43056 <para>
43057 The order of the first three hosts and the order of the last two hosts is
43058 randomized for each use, but the first three always end up before the last two.
43059 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored.
43060 </para>
43061 <para>
43062 <indexterm role="option">
43063 <primary><option>hosts_require_auth</option></primary>
43064 </indexterm>
43065 </para>
43066 <informaltable frame="all">
43067 <tgroup cols="4" colsep="0" rowsep="0">
43068 <colspec colwidth="8*" align="left"/>
43069 <colspec colwidth="6*" align="center"/>
43070 <colspec colwidth="6*" align="center"/>
43071 <colspec colwidth="6*" align="right"/>
43072 <tbody>
43073 <row>
43074 <entry><option>hosts_require_auth</option></entry>
43075 <entry>Use: <emphasis>smtp</emphasis></entry>
43076 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
43077 <entry>Default: <emphasis>unset</emphasis></entry>
43078 </row>
43079 </tbody>
43080 </tgroup>
43081 </informaltable>
43082 <para>
43083 <indexterm role="concept">
43084 <primary>authentication</primary>
43085 <secondary>required by client</secondary>
43086 </indexterm>
43087 This option provides a list of servers for which authentication must succeed
43088 before Exim will try to transfer a message. If authentication fails for
43089 servers which are not in this list, Exim tries to send unauthenticated. If
43090 authentication fails for one of these servers, delivery is deferred. This
43091 temporary error is detectable in the retry rules, so it can be turned into a
43092 hard failure if required. See also <option>hosts_try_auth</option>, and chapter
43093 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
43094 </para>
43095 <para>
43096 <indexterm role="option">
43097 <primary><option>hosts_require_tls</option></primary>
43098 </indexterm>
43099 </para>
43100 <informaltable frame="all">
43101 <tgroup cols="4" colsep="0" rowsep="0">
43102 <colspec colwidth="8*" align="left"/>
43103 <colspec colwidth="6*" align="center"/>
43104 <colspec colwidth="6*" align="center"/>
43105 <colspec colwidth="6*" align="right"/>
43106 <tbody>
43107 <row>
43108 <entry><option>hosts_require_tls</option></entry>
43109 <entry>Use: <emphasis>smtp</emphasis></entry>
43110 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
43111 <entry>Default: <emphasis>unset</emphasis></entry>
43112 </row>
43113 </tbody>
43114 </tgroup>
43115 </informaltable>
43116 <para>
43117 <indexterm role="concept">
43118 <primary>TLS</primary>
43119 <secondary>requiring for certain servers</secondary>
43120 </indexterm>
43121 Exim will insist on using a TLS session when delivering to any host that
43122 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
43123 <emphasis role="bold">Note</emphasis>: This option affects outgoing mail only. To insist on TLS for
43124 incoming messages, use an appropriate ACL.
43125 </para>
43126 <para>
43127 <indexterm role="option">
43128 <primary><option>hosts_try_auth</option></primary>
43129 </indexterm>
43130 </para>
43131 <informaltable frame="all">
43132 <tgroup cols="4" colsep="0" rowsep="0">
43133 <colspec colwidth="8*" align="left"/>
43134 <colspec colwidth="6*" align="center"/>
43135 <colspec colwidth="6*" align="center"/>
43136 <colspec colwidth="6*" align="right"/>
43137 <tbody>
43138 <row>
43139 <entry><option>hosts_try_auth</option></entry>
43140 <entry>Use: <emphasis>smtp</emphasis></entry>
43141 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
43142 <entry>Default: <emphasis>unset</emphasis></entry>
43143 </row>
43144 </tbody>
43145 </tgroup>
43146 </informaltable>
43147 <para>
43148 <indexterm role="concept">
43149 <primary>authentication</primary>
43150 <secondary>optional in client</secondary>
43151 </indexterm>
43152 This option provides a list of servers to which, provided they announce
43153 authentication support, Exim will attempt to authenticate as a client when it
43154 connects. If authentication fails, Exim will try to transfer the message
43155 unauthenticated. See also <option>hosts_require_auth</option>, and chapter
43156 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
43157 </para>
43158 <para>
43159 <indexterm role="option">
43160 <primary><option>interface</option></primary>
43161 </indexterm>
43162 </para>
43163 <informaltable frame="all">
43164 <tgroup cols="4" colsep="0" rowsep="0">
43165 <colspec colwidth="8*" align="left"/>
43166 <colspec colwidth="6*" align="center"/>
43167 <colspec colwidth="6*" align="center"/>
43168 <colspec colwidth="6*" align="right"/>
43169 <tbody>
43170 <row>
43171 <entry><option>interface</option></entry>
43172 <entry>Use: <emphasis>smtp</emphasis></entry>
43173 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
43174 <entry>Default: <emphasis>unset</emphasis></entry>
43175 </row>
43176 </tbody>
43177 </tgroup>
43178 </informaltable>
43179 <para>
43180 <indexterm role="concept">
43181 <primary>bind IP address</primary>
43182 </indexterm>
43183 <indexterm role="concept">
43184 <primary>IP address</primary>
43185 <secondary>binding</secondary>
43186 </indexterm>
43187 <indexterm role="variable">
43188 <primary><varname>$host</varname></primary>
43189 </indexterm>
43190 <indexterm role="variable">
43191 <primary><varname>$host_address</varname></primary>
43192 </indexterm>
43193 This option specifies which interface to bind to when making an outgoing SMTP
43194 call. The value is an IP address, not an interface name such as
43195 <literal>eth0</literal>. Do not confuse this with the interface address that was used when a
43196 message was received, which is in <varname>$received_ip_address</varname>, formerly known as
43197 <varname>$interface_address</varname>. The name was changed to minimize confusion with the
43198 outgoing interface address. There is no variable that contains an outgoing
43199 interface address because, unless it is set by this option, its value is
43200 unknown.
43201 </para>
43202 <para>
43203 During the expansion of the <option>interface</option> option the variables <varname>$host</varname> and
43204 <varname>$host_address</varname> refer to the host to which a connection is about to be made
43205 during the expansion of the string. Forced expansion failure, or an empty
43206 string result causes the option to be ignored. Otherwise, after expansion, the
43207 string must be a list of IP addresses, colon-separated by default, but the
43208 separator can be changed in the usual way. For example:
43209 </para>
43210 <literallayout class="monospaced">
43211 interface = &lt;; 192.168.123.123 ; 3ffe:ffff:836f::fe86:a061
43212 </literallayout>
43213 <para>
43214 The first interface of the correct type (IPv4 or IPv6) is used for the outgoing
43215 connection. If none of them are the correct type, the option is ignored. If
43216 <option>interface</option> is not set, or is ignored, the system&#x2019;s IP functions choose which
43217 interface to use if the host has more than one.
43218 </para>
43219 <para>
43220 <indexterm role="option">
43221 <primary><option>keepalive</option></primary>
43222 </indexterm>
43223 </para>
43224 <informaltable frame="all">
43225 <tgroup cols="4" colsep="0" rowsep="0">
43226 <colspec colwidth="8*" align="left"/>
43227 <colspec colwidth="6*" align="center"/>
43228 <colspec colwidth="6*" align="center"/>
43229 <colspec colwidth="6*" align="right"/>
43230 <tbody>
43231 <row>
43232 <entry><option>keepalive</option></entry>
43233 <entry>Use: <emphasis>smtp</emphasis></entry>
43234 <entry>Type: <emphasis>boolean</emphasis></entry>
43235 <entry>Default: <emphasis>true</emphasis></entry>
43236 </row>
43237 </tbody>
43238 </tgroup>
43239 </informaltable>
43240 <para>
43241 <indexterm role="concept">
43242 <primary>keepalive</primary>
43243 <secondary>on outgoing connection</secondary>
43244 </indexterm>
43245 This option controls the setting of SO_KEEPALIVE on outgoing TCP/IP socket
43246 connections. When set, it causes the kernel to probe idle connections
43247 periodically, by sending packets with <quote>old</quote> sequence numbers. The other end
43248 of the connection should send a acknowledgment if the connection is still okay
43249 or a reset if the connection has been aborted. The reason for doing this is
43250 that it has the beneficial effect of freeing up certain types of connection
43251 that can get stuck when the remote host is disconnected without tidying up the
43252 TCP/IP call properly. The keepalive mechanism takes several hours to detect
43253 unreachable hosts.
43254 </para>
43255 <para>
43256 <indexterm role="option">
43257 <primary><option>lmtp_ignore_quota</option></primary>
43258 </indexterm>
43259 </para>
43260 <informaltable frame="all">
43261 <tgroup cols="4" colsep="0" rowsep="0">
43262 <colspec colwidth="8*" align="left"/>
43263 <colspec colwidth="6*" align="center"/>
43264 <colspec colwidth="6*" align="center"/>
43265 <colspec colwidth="6*" align="right"/>
43266 <tbody>
43267 <row>
43268 <entry><option>lmtp_ignore_quota</option></entry>
43269 <entry>Use: <emphasis>smtp</emphasis></entry>
43270 <entry>Type: <emphasis>boolean</emphasis></entry>
43271 <entry>Default: <emphasis>false</emphasis></entry>
43272 </row>
43273 </tbody>
43274 </tgroup>
43275 </informaltable>
43276 <para>
43277 <indexterm role="concept">
43278 <primary>LMTP</primary>
43279 <secondary>ignoring quota errors</secondary>
43280 </indexterm>
43281 If this option is set true when the <option>protocol</option> option is set to <quote>lmtp</quote>, the
43282 string <literal>IGNOREQUOTA</literal> is added to RCPT commands, provided that the LMTP server
43283 has advertised support for IGNOREQUOTA in its response to the LHLO command.
43284 </para>
43285 <para>
43286 <indexterm role="option">
43287 <primary><option>max_rcpt</option></primary>
43288 </indexterm>
43289 </para>
43290 <informaltable frame="all">
43291 <tgroup cols="4" colsep="0" rowsep="0">
43292 <colspec colwidth="8*" align="left"/>
43293 <colspec colwidth="6*" align="center"/>
43294 <colspec colwidth="6*" align="center"/>
43295 <colspec colwidth="6*" align="right"/>
43296 <tbody>
43297 <row>
43298 <entry><option>max_rcpt</option></entry>
43299 <entry>Use: <emphasis>smtp</emphasis></entry>
43300 <entry>Type: <emphasis>integer</emphasis></entry>
43301 <entry>Default: <emphasis>100</emphasis></entry>
43302 </row>
43303 </tbody>
43304 </tgroup>
43305 </informaltable>
43306 <para>
43307 <indexterm role="concept">
43308 <primary>RCPT</primary>
43309 <secondary>maximum number of outgoing</secondary>
43310 </indexterm>
43311 This option limits the number of RCPT commands that are sent in a single
43312 SMTP message transaction. Each set of addresses is treated independently, and
43313 so can cause parallel connections to the same host if <option>remote_max_parallel</option>
43314 permits this.
43315 </para>
43316 <para>
43317 <indexterm role="option">
43318 <primary><option>multi_domain</option></primary>
43319 </indexterm>
43320 </para>
43321 <informaltable frame="all">
43322 <tgroup cols="4" colsep="0" rowsep="0">
43323 <colspec colwidth="8*" align="left"/>
43324 <colspec colwidth="6*" align="center"/>
43325 <colspec colwidth="6*" align="center"/>
43326 <colspec colwidth="6*" align="right"/>
43327 <tbody>
43328 <row>
43329 <entry><option>multi_domain</option></entry>
43330 <entry>Use: <emphasis>smtp</emphasis></entry>
43331 <entry>Type: <emphasis>boolean</emphasis></entry>
43332 <entry>Default: <emphasis>true</emphasis></entry>
43333 </row>
43334 </tbody>
43335 </tgroup>
43336 </informaltable>
43337 <para>
43338 <indexterm role="variable">
43339 <primary><varname>$domain</varname></primary>
43340 </indexterm>
43341 When this option is set, the <command>smtp</command> transport can handle a number of
43342 addresses containing a mixture of different domains provided they all resolve
43343 to the same list of hosts. Turning the option off restricts the transport to
43344 handling only one domain at a time. This is useful if you want to use
43345 <varname>$domain</varname> in an expansion for the transport, because it is set only when there
43346 is a single domain involved in a remote delivery.
43347 </para>
43348 <para>
43349 <indexterm role="option">
43350 <primary><option>port</option></primary>
43351 </indexterm>
43352 </para>
43353 <informaltable frame="all">
43354 <tgroup cols="4" colsep="0" rowsep="0">
43355 <colspec colwidth="8*" align="left"/>
43356 <colspec colwidth="6*" align="center"/>
43357 <colspec colwidth="6*" align="center"/>
43358 <colspec colwidth="6*" align="right"/>
43359 <tbody>
43360 <row>
43361 <entry><option>port</option></entry>
43362 <entry>Use: <emphasis>smtp</emphasis></entry>
43363 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43364 <entry>Default: <emphasis>see below</emphasis></entry>
43365 </row>
43366 </tbody>
43367 </tgroup>
43368 </informaltable>
43369 <para>
43370 <indexterm role="concept">
43371 <primary>port</primary>
43372 <secondary>sending TCP/IP</secondary>
43373 </indexterm>
43374 <indexterm role="concept">
43375 <primary>TCP/IP</primary>
43376 <secondary>setting outgoing port</secondary>
43377 </indexterm>
43378 This option specifies the TCP/IP port on the server to which Exim connects.
43379 <emphasis role="bold">Note:</emphasis> Do not confuse this with the port that was used when a message was
43380 received, which is in <varname>$received_port</varname>, formerly known as <varname>$interface_port</varname>.
43381 The name was changed to minimize confusion with the outgoing port. There is no
43382 variable that contains an outgoing port.
43383 </para>
43384 <para>
43385 If the value of this option begins with a digit it is taken as a port number;
43386 otherwise it is looked up using <function>getservbyname()</function>. The default value is
43387 normally <quote>smtp</quote>, but if <option>protocol</option> is set to <quote>lmtp</quote>, the default is
43388 <quote>lmtp</quote>. If the expansion fails, or if a port number cannot be found, delivery
43389 is deferred.
43390 </para>
43391 <para>
43392 <indexterm role="option">
43393 <primary><option>protocol</option></primary>
43394 </indexterm>
43395 </para>
43396 <informaltable frame="all">
43397 <tgroup cols="4" colsep="0" rowsep="0">
43398 <colspec colwidth="8*" align="left"/>
43399 <colspec colwidth="6*" align="center"/>
43400 <colspec colwidth="6*" align="center"/>
43401 <colspec colwidth="6*" align="right"/>
43402 <tbody>
43403 <row>
43404 <entry><option>protocol</option></entry>
43405 <entry>Use: <emphasis>smtp</emphasis></entry>
43406 <entry>Type: <emphasis>string</emphasis></entry>
43407 <entry>Default: <emphasis>smtp</emphasis></entry>
43408 </row>
43409 </tbody>
43410 </tgroup>
43411 </informaltable>
43412 <para>
43413 <indexterm role="concept">
43414 <primary>LMTP</primary>
43415 <secondary>over TCP/IP</secondary>
43416 </indexterm>
43417 <indexterm role="concept">
43418 <primary>ssmtp protocol</primary>
43419 <secondary>outbound</secondary>
43420 </indexterm>
43421 <indexterm role="concept">
43422 <primary>TLS</primary>
43423 <secondary>SSL-on-connect outbound</secondary>
43424 </indexterm>
43425 <indexterm role="variable">
43426 <primary><varname>$port</varname></primary>
43427 </indexterm>
43428 If this option is set to <quote>lmtp</quote> instead of <quote>smtp</quote>, the default value for
43429 the <option>port</option> option changes to <quote>lmtp</quote>, and the transport operates the LMTP
43430 protocol (RFC 2033) instead of SMTP. This protocol is sometimes used for local
43431 deliveries into closed message stores. Exim also has support for running LMTP
43432 over a pipe to a local process &ndash; see chapter <xref linkend="CHAPLMTP"/>.
43433 </para>
43434 <para revisionflag="changed">
43435 If this option is set to <quote>smtps</quote>, the default vaule for the <option>port</option> option
43436 changes to <quote>smtps</quote>, and the transport initiates TLS immediately after
43437 connecting, as an outbound SSL-on-connect, instead of using STARTTLS to upgrade.
43438 The Internet standards bodies strongly discourage use of this mode.
43439 </para>
43440 <para>
43441 <indexterm role="option">
43442 <primary><option>retry_include_ip_address</option></primary>
43443 </indexterm>
43444 </para>
43445 <informaltable frame="all">
43446 <tgroup cols="4" colsep="0" rowsep="0">
43447 <colspec colwidth="8*" align="left"/>
43448 <colspec colwidth="6*" align="center"/>
43449 <colspec colwidth="6*" align="center"/>
43450 <colspec colwidth="6*" align="right"/>
43451 <tbody>
43452 <row>
43453 <entry><option>retry_include_ip_address</option></entry>
43454 <entry>Use: <emphasis>smtp</emphasis></entry>
43455 <entry>Type: <emphasis>boolean</emphasis></entry>
43456 <entry>Default: <emphasis>true</emphasis></entry>
43457 </row>
43458 </tbody>
43459 </tgroup>
43460 </informaltable>
43461 <para>
43462 Exim normally includes both the host name and the IP address in the key it
43463 constructs for indexing retry data after a temporary delivery failure. This
43464 means that when one of several IP addresses for a host is failing, it gets
43465 tried periodically (controlled by the retry rules), but use of the other IP
43466 addresses is not affected.
43467 </para>
43468 <para>
43469 However, in some dialup environments hosts are assigned a different IP address
43470 each time they connect. In this situation the use of the IP address as part of
43471 the retry key leads to undesirable behaviour. Setting this option false causes
43472 Exim to use only the host name. This should normally be done on a separate
43473 instance of the <command>smtp</command> transport, set up specially to handle the dialup
43474 hosts.
43475 </para>
43476 <para>
43477 <indexterm role="option">
43478 <primary><option>serialize_hosts</option></primary>
43479 </indexterm>
43480 </para>
43481 <informaltable frame="all">
43482 <tgroup cols="4" colsep="0" rowsep="0">
43483 <colspec colwidth="8*" align="left"/>
43484 <colspec colwidth="6*" align="center"/>
43485 <colspec colwidth="6*" align="center"/>
43486 <colspec colwidth="6*" align="right"/>
43487 <tbody>
43488 <row>
43489 <entry><option>serialize_hosts</option></entry>
43490 <entry>Use: <emphasis>smtp</emphasis></entry>
43491 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
43492 <entry>Default: <emphasis>unset</emphasis></entry>
43493 </row>
43494 </tbody>
43495 </tgroup>
43496 </informaltable>
43497 <para>
43498 <indexterm role="concept">
43499 <primary>serializing connections</primary>
43500 </indexterm>
43501 <indexterm role="concept">
43502 <primary>host</primary>
43503 <secondary>serializing connections</secondary>
43504 </indexterm>
43505 Because Exim operates in a distributed manner, if several messages for the same
43506 host arrive at around the same time, more than one simultaneous connection to
43507 the remote host can occur. This is not usually a problem except when there is a
43508 slow link between the hosts. In that situation it may be helpful to restrict
43509 Exim to one connection at a time. This can be done by setting
43510 <option>serialize_hosts</option> to match the relevant hosts.
43511 </para>
43512 <para>
43513 <indexterm role="concept">
43514 <primary>hints database</primary>
43515 <secondary>serializing deliveries to a host</secondary>
43516 </indexterm>
43517 Exim implements serialization by means of a hints database in which a record is
43518 written whenever a process connects to one of the restricted hosts. The record
43519 is deleted when the connection is completed. Obviously there is scope for
43520 records to get left lying around if there is a system or program crash. To
43521 guard against this, Exim ignores any records that are more than six hours old.
43522 </para>
43523 <para>
43524 If you set up this kind of serialization, you should also arrange to delete the
43525 relevant hints database whenever your system reboots. The names of the files
43526 start with <filename>misc</filename> and they are kept in the <filename>spool/db</filename> directory. There
43527 may be one or two files, depending on the type of DBM in use. The same files
43528 are used for ETRN serialization.
43529 </para>
43530 <para>
43531 <indexterm role="option">
43532 <primary><option>size_addition</option></primary>
43533 </indexterm>
43534 </para>
43535 <informaltable frame="all">
43536 <tgroup cols="4" colsep="0" rowsep="0">
43537 <colspec colwidth="8*" align="left"/>
43538 <colspec colwidth="6*" align="center"/>
43539 <colspec colwidth="6*" align="center"/>
43540 <colspec colwidth="6*" align="right"/>
43541 <tbody>
43542 <row>
43543 <entry><option>size_addition</option></entry>
43544 <entry>Use: <emphasis>smtp</emphasis></entry>
43545 <entry>Type: <emphasis>integer</emphasis></entry>
43546 <entry>Default: <emphasis>1024</emphasis></entry>
43547 </row>
43548 </tbody>
43549 </tgroup>
43550 </informaltable>
43551 <para>
43552 <indexterm role="concept">
43553 <primary>SMTP</primary>
43554 <secondary>SIZE</secondary>
43555 </indexterm>
43556 <indexterm role="concept">
43557 <primary>message</primary>
43558 <secondary>size issue for transport filter</secondary>
43559 </indexterm>
43560 <indexterm role="concept">
43561 <primary>size</primary>
43562 <secondary>of message</secondary>
43563 </indexterm>
43564 <indexterm role="concept">
43565 <primary>transport</primary>
43566 <secondary>filter</secondary>
43567 </indexterm>
43568 <indexterm role="concept">
43569 <primary>filter</primary>
43570 <secondary>transport filter</secondary>
43571 </indexterm>
43572 If a remote SMTP server indicates that it supports the SIZE option of the
43573 MAIL command, Exim uses this to pass over the message size at the start of
43574 an SMTP transaction. It adds the value of <option>size_addition</option> to the value it
43575 sends, to allow for headers and other text that may be added during delivery by
43576 configuration options or in a transport filter. It may be necessary to increase
43577 this if a lot of text is added to messages.
43578 </para>
43579 <para>
43580 Alternatively, if the value of <option>size_addition</option> is set negative, it disables
43581 the use of the SIZE option altogether.
43582 </para>
43583 <para>
43584 <indexterm role="option">
43585 <primary><option>tls_certificate</option></primary>
43586 </indexterm>
43587 </para>
43588 <informaltable frame="all">
43589 <tgroup cols="4" colsep="0" rowsep="0">
43590 <colspec colwidth="8*" align="left"/>
43591 <colspec colwidth="6*" align="center"/>
43592 <colspec colwidth="6*" align="center"/>
43593 <colspec colwidth="6*" align="right"/>
43594 <tbody>
43595 <row>
43596 <entry><option>tls_certificate</option></entry>
43597 <entry>Use: <emphasis>smtp</emphasis></entry>
43598 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43599 <entry>Default: <emphasis>unset</emphasis></entry>
43600 </row>
43601 </tbody>
43602 </tgroup>
43603 </informaltable>
43604 <para>
43605 <indexterm role="concept">
43606 <primary>TLS</primary>
43607 <secondary>client certificate, location of</secondary>
43608 </indexterm>
43609 <indexterm role="concept">
43610 <primary>certificate</primary>
43611 <secondary>client, location of</secondary>
43612 </indexterm>
43613 <indexterm role="variable">
43614 <primary><varname>$host</varname></primary>
43615 </indexterm>
43616 <indexterm role="variable">
43617 <primary><varname>$host_address</varname></primary>
43618 </indexterm>
43619 The value of this option must be the absolute path to a file which contains the
43620 client&#x2019;s certificate, for possible use when sending a message over an encrypted
43621 connection. The values of <varname>$host</varname> and <varname>$host_address</varname> are set to the name and
43622 address of the server during the expansion. See chapter <xref linkend="CHAPTLS"/> for
43623 details of TLS.
43624 </para>
43625 <para>
43626 <emphasis role="bold">Note</emphasis>: This option must be set if you want Exim to be able to use a TLS
43627 certificate when sending messages as a client. The global option of the same
43628 name specifies the certificate for Exim as a server; it is not automatically
43629 assumed that the same certificate should be used when Exim is operating as a
43630 client.
43631 </para>
43632 <para>
43633 <indexterm role="option">
43634 <primary><option>tls_crl</option></primary>
43635 </indexterm>
43636 </para>
43637 <informaltable frame="all">
43638 <tgroup cols="4" colsep="0" rowsep="0">
43639 <colspec colwidth="8*" align="left"/>
43640 <colspec colwidth="6*" align="center"/>
43641 <colspec colwidth="6*" align="center"/>
43642 <colspec colwidth="6*" align="right"/>
43643 <tbody>
43644 <row>
43645 <entry><option>tls_crl</option></entry>
43646 <entry>Use: <emphasis>smtp</emphasis></entry>
43647 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43648 <entry>Default: <emphasis>unset</emphasis></entry>
43649 </row>
43650 </tbody>
43651 </tgroup>
43652 </informaltable>
43653 <para>
43654 <indexterm role="concept">
43655 <primary>TLS</primary>
43656 <secondary>client certificate revocation list</secondary>
43657 </indexterm>
43658 <indexterm role="concept">
43659 <primary>certificate</primary>
43660 <secondary>revocation list for client</secondary>
43661 </indexterm>
43662 This option specifies a certificate revocation list. The expanded value must
43663 be the name of a file that contains a CRL in PEM format.
43664 </para>
43665 <para>
43666 <indexterm role="option">
43667 <primary><option>tls_privatekey</option></primary>
43668 </indexterm>
43669 </para>
43670 <informaltable frame="all">
43671 <tgroup cols="4" colsep="0" rowsep="0">
43672 <colspec colwidth="8*" align="left"/>
43673 <colspec colwidth="6*" align="center"/>
43674 <colspec colwidth="6*" align="center"/>
43675 <colspec colwidth="6*" align="right"/>
43676 <tbody>
43677 <row>
43678 <entry><option>tls_privatekey</option></entry>
43679 <entry>Use: <emphasis>smtp</emphasis></entry>
43680 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43681 <entry>Default: <emphasis>unset</emphasis></entry>
43682 </row>
43683 </tbody>
43684 </tgroup>
43685 </informaltable>
43686 <para>
43687 <indexterm role="concept">
43688 <primary>TLS</primary>
43689 <secondary>client private key, location of</secondary>
43690 </indexterm>
43691 <indexterm role="variable">
43692 <primary><varname>$host</varname></primary>
43693 </indexterm>
43694 <indexterm role="variable">
43695 <primary><varname>$host_address</varname></primary>
43696 </indexterm>
43697 The value of this option must be the absolute path to a file which contains the
43698 client&#x2019;s private key. This is used when sending a message over an encrypted
43699 connection using a client certificate. The values of <varname>$host</varname> and
43700 <varname>$host_address</varname> are set to the name and address of the server during the
43701 expansion. If this option is unset, or the expansion is forced to fail, or the
43702 result is an empty string, the private key is assumed to be in the same file as
43703 the certificate. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
43704 </para>
43705 <para>
43706 <indexterm role="option">
43707 <primary><option>tls_require_ciphers</option></primary>
43708 </indexterm>
43709 </para>
43710 <informaltable frame="all">
43711 <tgroup cols="4" colsep="0" rowsep="0">
43712 <colspec colwidth="8*" align="left"/>
43713 <colspec colwidth="6*" align="center"/>
43714 <colspec colwidth="6*" align="center"/>
43715 <colspec colwidth="6*" align="right"/>
43716 <tbody>
43717 <row>
43718 <entry><option>tls_require_ciphers</option></entry>
43719 <entry>Use: <emphasis>smtp</emphasis></entry>
43720 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43721 <entry>Default: <emphasis>unset</emphasis></entry>
43722 </row>
43723 </tbody>
43724 </tgroup>
43725 </informaltable>
43726 <para>
43727 <indexterm role="concept">
43728 <primary>TLS</primary>
43729 <secondary>requiring specific ciphers</secondary>
43730 </indexterm>
43731 <indexterm role="concept">
43732 <primary>cipher</primary>
43733 <secondary>requiring specific</secondary>
43734 </indexterm>
43735 <indexterm role="variable">
43736 <primary><varname>$host</varname></primary>
43737 </indexterm>
43738 <indexterm role="variable">
43739 <primary><varname>$host_address</varname></primary>
43740 </indexterm>
43741 The value of this option must be a list of permitted cipher suites, for use
43742 when setting up an outgoing encrypted connection. (There is a global option of
43743 the same name for controlling incoming connections.) The values of <varname>$host</varname> and
43744 <varname>$host_address</varname> are set to the name and address of the server during the
43745 expansion. See chapter <xref linkend="CHAPTLS"/> for details of TLS; note that this option
43746 is used in different ways by OpenSSL and GnuTLS (see sections
43747 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>). For GnuTLS, the order of the
43748 ciphers is a preference order.
43749 </para>
43750 <para>
43751 <indexterm role="option">
43752 <primary><option>tls_tempfail_tryclear</option></primary>
43753 </indexterm>
43754 </para>
43755 <informaltable frame="all">
43756 <tgroup cols="4" colsep="0" rowsep="0">
43757 <colspec colwidth="8*" align="left"/>
43758 <colspec colwidth="6*" align="center"/>
43759 <colspec colwidth="6*" align="center"/>
43760 <colspec colwidth="6*" align="right"/>
43761 <tbody>
43762 <row>
43763 <entry><option>tls_tempfail_tryclear</option></entry>
43764 <entry>Use: <emphasis>smtp</emphasis></entry>
43765 <entry>Type: <emphasis>boolean</emphasis></entry>
43766 <entry>Default: <emphasis>true</emphasis></entry>
43767 </row>
43768 </tbody>
43769 </tgroup>
43770 </informaltable>
43771 <para>
43772 <indexterm role="concept">
43773 <primary>4<emphasis>xx</emphasis> responses</primary>
43774 <secondary>to STARTTLS</secondary>
43775 </indexterm>
43776 When the server host is not in <option>hosts_require_tls</option>, and there is a problem in
43777 setting up a TLS session, this option determines whether or not Exim should try
43778 to deliver the message unencrypted. If it is set false, delivery to the
43779 current host is deferred; if there are other hosts, they are tried. If this
43780 option is set true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis>
43781 response to STARTTLS. Also, if STARTTLS is accepted, but the subsequent
43782 TLS negotiation fails, Exim closes the current connection (because it is in an
43783 unknown state), opens a new one to the same host, and then tries the delivery
43784 in clear.
43785 </para>
43786 <para>
43787 <indexterm role="option">
43788 <primary><option>tls_verify_certificates</option></primary>
43789 </indexterm>
43790 </para>
43791 <informaltable frame="all">
43792 <tgroup cols="4" colsep="0" rowsep="0">
43793 <colspec colwidth="8*" align="left"/>
43794 <colspec colwidth="6*" align="center"/>
43795 <colspec colwidth="6*" align="center"/>
43796 <colspec colwidth="6*" align="right"/>
43797 <tbody>
43798 <row>
43799 <entry><option>tls_verify_certificates</option></entry>
43800 <entry>Use: <emphasis>smtp</emphasis></entry>
43801 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43802 <entry>Default: <emphasis>unset</emphasis></entry>
43803 </row>
43804 </tbody>
43805 </tgroup>
43806 </informaltable>
43807 <para>
43808 <indexterm role="concept">
43809 <primary>TLS</primary>
43810 <secondary>server certificate verification</secondary>
43811 </indexterm>
43812 <indexterm role="concept">
43813 <primary>certificate</primary>
43814 <secondary>verification of server</secondary>
43815 </indexterm>
43816 <indexterm role="variable">
43817 <primary><varname>$host</varname></primary>
43818 </indexterm>
43819 <indexterm role="variable">
43820 <primary><varname>$host_address</varname></primary>
43821 </indexterm>
43822 The value of this option must be the absolute path to a file containing
43823 permitted server certificates, for use when setting up an encrypted connection.
43824 Alternatively, if you are using OpenSSL, you can set
43825 <option>tls_verify_certificates</option> to the name of a directory containing certificate
43826 files. This does not work with GnuTLS; the option must be set to the name of a
43827 single file if you are using GnuTLS. The values of <varname>$host</varname> and
43828 <varname>$host_address</varname> are set to the name and address of the server during the
43829 expansion of this option. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
43830 </para>
43831 </section>
43832 <section id="SECTvalhosmax">
43833 <title>How the limits for the number of hosts to try are used</title>
43834 <para>
43835 <indexterm role="concept">
43836 <primary>host</primary>
43837 <secondary>maximum number to try</secondary>
43838 </indexterm>
43839 <indexterm role="concept">
43840 <primary>limit</primary>
43841 <secondary>hosts; maximum number tried</secondary>
43842 </indexterm>
43843 There are two options that are concerned with the number of hosts that are
43844 tried when an SMTP delivery takes place. They are <option>hosts_max_try</option> and
43845 <option>hosts_max_try_hardlimit</option>.
43846 </para>
43847 <para>
43848 The <option>hosts_max_try</option> option limits the number of hosts that are tried
43849 for a single delivery. However, despite the term <quote>host</quote> in its name, the
43850 option actually applies to each IP address independently. In other words, a
43851 multihomed host is treated as several independent hosts, just as it is for
43852 retrying.
43853 </para>
43854 <para>
43855 Many of the larger ISPs have multiple MX records which often point to
43856 multihomed hosts. As a result, a list of a dozen or more IP addresses may be
43857 created as a result of routing one of these domains.
43858 </para>
43859 <para>
43860 Trying every single IP address on such a long list does not seem sensible; if
43861 several at the top of the list fail, it is reasonable to assume there is some
43862 problem that is likely to affect all of them. Roughly speaking, the value of
43863 <option>hosts_max_try</option> is the maximum number that are tried before deferring the
43864 delivery. However, the logic cannot be quite that simple.
43865 </para>
43866 <para>
43867 Firstly, IP addresses that are skipped because their retry times have not
43868 arrived do not count, and in addition, addresses that are past their retry
43869 limits are also not counted, even when they are tried. This means that when
43870 some IP addresses are past their retry limits, more than the value of
43871 <option>hosts_max_retry</option> may be tried. The reason for this behaviour is to ensure
43872 that all IP addresses are considered before timing out an email address (but
43873 see below for an exception).
43874 </para>
43875 <para>
43876 Secondly, when the <option>hosts_max_try</option> limit is reached, Exim looks down the host
43877 list to see if there is a subsequent host with a different (higher valued) MX.
43878 If there is, that host is considered next, and the current IP address is used
43879 but not counted. This behaviour helps in the case of a domain with a retry rule
43880 that hardly ever delays any hosts, as is now explained:
43881 </para>
43882 <para>
43883 Consider the case of a long list of hosts with one MX value, and a few with a
43884 higher MX value. If <option>hosts_max_try</option> is small (the default is 5) only a few
43885 hosts at the top of the list are tried at first. With the default retry rule,
43886 which specifies increasing retry times, the higher MX hosts are eventually
43887 tried when those at the top of the list are skipped because they have not
43888 reached their retry times.
43889 </para>
43890 <para>
43891 However, it is common practice to put a fixed short retry time on domains for
43892 large ISPs, on the grounds that their servers are rarely down for very long.
43893 Unfortunately, these are exactly the domains that tend to resolve to long lists
43894 of hosts. The short retry time means that the lowest MX hosts are tried every
43895 time. The attempts may be in a different order because of random sorting, but
43896 without the special MX check, the higher MX hosts would never be tried until
43897 all the lower MX hosts had timed out (which might be several days), because
43898 there are always some lower MX hosts that have reached their retry times. With
43899 the special check, Exim considers at least one IP address from each MX value at
43900 every delivery attempt, even if the <option>hosts_max_try</option> limit has already been
43901 reached.
43902 </para>
43903 <para>
43904 The above logic means that <option>hosts_max_try</option> is not a hard limit, and in
43905 particular, Exim normally eventually tries all the IP addresses before timing
43906 out an email address. When <option>hosts_max_try</option> was implemented, this seemed a
43907 reasonable thing to do. Recently, however, some lunatic DNS configurations have
43908 been set up with hundreds of IP addresses for some domains. It can
43909 take a very long time indeed for an address to time out in these cases.
43910 </para>
43911 <para>
43912 The <option>hosts_max_try_hardlimit</option> option was added to help with this problem.
43913 Exim never tries more than this number of IP addresses; if it hits this limit
43914 and they are all timed out, the email address is bounced, even though not all
43915 possible IP addresses have been tried.
43916 <indexterm role="concept" startref="IIDsmttra1" class="endofrange"/>
43917 <indexterm role="concept" startref="IIDsmttra2" class="endofrange"/>
43918 </para>
43919 </section>
43920 </chapter>
43921
43922 <chapter id="CHAPrewrite">
43923 <title>Address rewriting</title>
43924 <para>
43925 <indexterm role="concept" id="IIDaddrew" class="startofrange">
43926 <primary>rewriting</primary>
43927 <secondary>addresses</secondary>
43928 </indexterm>
43929 There are some circumstances in which Exim automatically rewrites domains in
43930 addresses. The two most common are when an address is given without a domain
43931 (referred to as an <quote>unqualified address</quote>) or when an address contains an
43932 abbreviated domain that is expanded by DNS lookup.
43933 </para>
43934 <para>
43935 Unqualified envelope addresses are accepted only for locally submitted
43936 messages, or for messages that are received from hosts matching
43937 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
43938 appropriate. Unqualified addresses in header lines are qualified if they are in
43939 locally submitted messages, or messages from hosts that are permitted to send
43940 unqualified envelope addresses. Otherwise, unqualified addresses in header
43941 lines are neither qualified nor rewritten.
43942 </para>
43943 <para>
43944 One situation in which Exim does <emphasis>not</emphasis> automatically rewrite a domain is
43945 when it is the name of a CNAME record in the DNS. The older RFCs suggest that
43946 such a domain should be rewritten using the <quote>canonical</quote> name, and some MTAs
43947 do this. The new RFCs do not contain this suggestion.
43948 </para>
43949 <section id="SECID147">
43950 <title>Explicitly configured address rewriting</title>
43951 <para>
43952 This chapter describes the rewriting rules that can be used in the
43953 main rewrite section of the configuration file, and also in the generic
43954 <option>headers_rewrite</option> option that can be set on any transport.
43955 </para>
43956 <para>
43957 Some people believe that configured address rewriting is a Mortal Sin.
43958 Others believe that life is not possible without it. Exim provides the
43959 facility; you do not have to use it.
43960 </para>
43961 <para>
43962 The main rewriting rules that appear in the <quote>rewrite</quote> section of the
43963 configuration file are applied to addresses in incoming messages, both envelope
43964 addresses and addresses in header lines. Each rule specifies the types of
43965 address to which it applies.
43966 </para>
43967 <para>
43968 Whether or not addresses in header lines are rewritten depends on the origin of
43969 the headers and the type of rewriting. Global rewriting, that is, rewriting
43970 rules from the rewrite section of the configuration file, is applied only to
43971 those headers that were received with the message. Header lines that are added
43972 by ACLs or by a system filter or by individual routers or transports (which
43973 are specific to individual recipient addresses) are not rewritten by the global
43974 rules.
43975 </para>
43976 <para>
43977 Rewriting at transport time, by means of the <option>headers_rewrite</option> option,
43978 applies all headers except those added by routers and transports. That is, as
43979 well as the headers that were received with the message, it also applies to
43980 headers that were added by an ACL or a system filter.
43981 </para>
43982 <para>
43983 In general, rewriting addresses from your own system or domain has some
43984 legitimacy. Rewriting other addresses should be done only with great care and
43985 in special circumstances. The author of Exim believes that rewriting should be
43986 used sparingly, and mainly for <quote>regularizing</quote> addresses in your own domains.
43987 Although it can sometimes be used as a routing tool, this is very strongly
43988 discouraged.
43989 </para>
43990 <para>
43991 There are two commonly encountered circumstances where rewriting is used, as
43992 illustrated by these examples:
43993 </para>
43994 <itemizedlist>
43995 <listitem>
43996 <para>
43997 The company whose domain is <emphasis>hitch.fict.example</emphasis> has a number of hosts that
43998 exchange mail with each other behind a firewall, but there is only a single
43999 gateway to the outer world. The gateway rewrites <emphasis>*.hitch.fict.example</emphasis> as
44000 <emphasis>hitch.fict.example</emphasis> when sending mail off-site.
44001 </para>
44002 </listitem>
44003 <listitem>
44004 <para>
44005 A host rewrites the local parts of its own users so that, for example,
44006 <emphasis>fp42@hitch.fict.example</emphasis> becomes <emphasis>Ford.Prefect@hitch.fict.example</emphasis>.
44007 </para>
44008 </listitem>
44009 </itemizedlist>
44010 </section>
44011 <section id="SECID148">
44012 <title>When does rewriting happen?</title>
44013 <para>
44014 <indexterm role="concept">
44015 <primary>rewriting</primary>
44016 <secondary>timing of</secondary>
44017 </indexterm>
44018 <indexterm role="concept">
44019 <primary>access control lists (ACLs)</primary>
44020 <secondary>rewriting addresses in</secondary>
44021 </indexterm>
44022 Configured address rewriting can take place at several different stages of a
44023 message&#x2019;s processing.
44024 </para>
44025 <para>
44026 <indexterm role="variable">
44027 <primary><varname>$sender_address</varname></primary>
44028 </indexterm>
44029 At the start of an ACL for MAIL, the sender address may have been rewritten
44030 by a special SMTP-time rewrite rule (see section <xref linkend="SECTrewriteS"/>), but no
44031 ordinary rewrite rules have yet been applied. If, however, the sender address
44032 is verified in the ACL, it is rewritten before verification, and remains
44033 rewritten thereafter. The subsequent value of <varname>$sender_address</varname> is the
44034 rewritten address. This also applies if sender verification happens in a
44035 RCPT ACL. Otherwise, when the sender address is not verified, it is
44036 rewritten as soon as a message&#x2019;s header lines have been received.
44037 </para>
44038 <para>
44039 <indexterm role="variable">
44040 <primary><varname>$domain</varname></primary>
44041 </indexterm>
44042 <indexterm role="variable">
44043 <primary><varname>$local_part</varname></primary>
44044 </indexterm>
44045 Similarly, at the start of an ACL for RCPT, the current recipient&#x2019;s address
44046 may have been rewritten by a special SMTP-time rewrite rule, but no ordinary
44047 rewrite rules have yet been applied to it. However, the behaviour is different
44048 from the sender address when a recipient is verified. The address is rewritten
44049 for the verification, but the rewriting is not remembered at this stage. The
44050 value of <varname>$local_part</varname> and <varname>$domain</varname> after verification are always the same
44051 as they were before (that is, they contain the unrewritten &ndash; except for
44052 SMTP-time rewriting &ndash; address).
44053 </para>
44054 <para>
44055 As soon as a message&#x2019;s header lines have been received, all the envelope
44056 recipient addresses are permanently rewritten, and rewriting is also applied to
44057 the addresses in the header lines (if configured). This happens before adding
44058 any header lines that were specified in MAIL or RCPT ACLs, and
44059 <indexterm role="concept">
44060 <primary><function>local_scan()</function> function</primary>
44061 <secondary>address rewriting; timing of</secondary>
44062 </indexterm>
44063 before the DATA ACL and <function>local_scan()</function> functions are run.
44064 </para>
44065 <para>
44066 When an address is being routed, either for delivery or for verification,
44067 rewriting is applied immediately to child addresses that are generated by
44068 redirection, unless <option>no_rewrite</option> is set on the router.
44069 </para>
44070 <para>
44071 <indexterm role="concept">
44072 <primary>envelope sender</primary>
44073 <secondary>rewriting at transport time</secondary>
44074 </indexterm>
44075 <indexterm role="concept">
44076 <primary>rewriting</primary>
44077 <secondary>at transport time</secondary>
44078 </indexterm>
44079 <indexterm role="concept">
44080 <primary>header lines</primary>
44081 <secondary>rewriting at transport time</secondary>
44082 </indexterm>
44083 At transport time, additional rewriting of addresses in header lines can be
44084 specified by setting the generic <option>headers_rewrite</option> option on a transport.
44085 This option contains rules that are identical in form to those in the rewrite
44086 section of the configuration file. They are applied to the original message
44087 header lines and any that were added by ACLs or a system filter. They are not
44088 applied to header lines that are added by routers or the transport.
44089 </para>
44090 <para>
44091 The outgoing envelope sender can be rewritten by means of the <option>return_path</option>
44092 transport option. However, it is not possible to rewrite envelope recipients at
44093 transport time.
44094 </para>
44095 </section>
44096 <section id="SECID149">
44097 <title>Testing the rewriting rules that apply on input</title>
44098 <para>
44099 <indexterm role="concept">
44100 <primary>rewriting</primary>
44101 <secondary>testing</secondary>
44102 </indexterm>
44103 <indexterm role="concept">
44104 <primary>testing</primary>
44105 <secondary>rewriting</secondary>
44106 </indexterm>
44107 Exim&#x2019;s input rewriting configuration appears in a part of the run time
44108 configuration file headed by <quote>begin rewrite</quote>. It can be tested by the
44109 <option>-brw</option> command line option. This takes an address (which can be a full RFC
44110 2822 address) as its argument. The output is a list of how the address would be
44111 transformed by the rewriting rules for each of the different places it might
44112 appear in an incoming message, that is, for each different header and for the
44113 envelope sender and recipient fields. For example,
44114 </para>
44115 <literallayout class="monospaced">
44116 exim -brw ph10@exim.workshop.example
44117 </literallayout>
44118 <para>
44119 might produce the output
44120 </para>
44121 <literallayout class="monospaced">
44122 sender: Philip.Hazel@exim.workshop.example
44123 from: Philip.Hazel@exim.workshop.example
44124 to: ph10@exim.workshop.example
44125 cc: ph10@exim.workshop.example
44126 bcc: ph10@exim.workshop.example
44127 reply-to: Philip.Hazel@exim.workshop.example
44128 env-from: Philip.Hazel@exim.workshop.example
44129 env-to: ph10@exim.workshop.example
44130 </literallayout>
44131 <para>
44132 which shows that rewriting has been set up for that address when used in any of
44133 the source fields, but not when it appears as a recipient address. At the
44134 present time, there is no equivalent way of testing rewriting rules that are
44135 set for a particular transport.
44136 </para>
44137 </section>
44138 <section id="SECID150">
44139 <title>Rewriting rules</title>
44140 <para>
44141 <indexterm role="concept">
44142 <primary>rewriting</primary>
44143 <secondary>rules</secondary>
44144 </indexterm>
44145 The rewrite section of the configuration file consists of lines of rewriting
44146 rules in the form
44147 </para>
44148 <literallayout>
44149 &lt;<emphasis>source pattern</emphasis>&gt;  &lt;<emphasis>replacement</emphasis>&gt;  &lt;<emphasis>flags</emphasis>&gt;
44150 </literallayout>
44151 <para>
44152 Rewriting rules that are specified for the <option>headers_rewrite</option> generic
44153 transport option are given as a colon-separated list. Each item in the list
44154 takes the same form as a line in the main rewriting configuration (except that
44155 any colons must be doubled, of course).
44156 </para>
44157 <para>
44158 The formats of source patterns and replacement strings are described below.
44159 Each is terminated by white space, unless enclosed in double quotes, in which
44160 case normal quoting conventions apply inside the quotes. The flags are single
44161 characters which may appear in any order. Spaces and tabs between them are
44162 ignored.
44163 </para>
44164 <para>
44165 For each address that could potentially be rewritten, the rules are scanned in
44166 order, and replacements for the address from earlier rules can themselves be
44167 replaced by later rules (but see the <quote>q</quote> and <quote>R</quote> flags).
44168 </para>
44169 <para>
44170 The order in which addresses are rewritten is undefined, may change between
44171 releases, and must not be relied on, with one exception: when a message is
44172 received, the envelope sender is always rewritten first, before any header
44173 lines are rewritten. For example, the replacement string for a rewrite of an
44174 address in <emphasis>To:</emphasis> must not assume that the message&#x2019;s address in <emphasis>From:</emphasis> has
44175 (or has not) already been rewritten. However, a rewrite of <emphasis>From:</emphasis> may assume
44176 that the envelope sender has already been rewritten.
44177 </para>
44178 <para>
44179 <indexterm role="variable">
44180 <primary><varname>$domain</varname></primary>
44181 </indexterm>
44182 <indexterm role="variable">
44183 <primary><varname>$local_part</varname></primary>
44184 </indexterm>
44185 The variables <varname>$local_part</varname> and <varname>$domain</varname> can be used in the replacement
44186 string to refer to the address that is being rewritten. Note that lookup-driven
44187 rewriting can be done by a rule of the form
44188 </para>
44189 <literallayout class="monospaced">
44190 *@*   ${lookup ...
44191 </literallayout>
44192 <para>
44193 where the lookup key uses <varname>$1</varname> and <varname>$2</varname> or <varname>$local_part</varname> and <varname>$domain</varname> to
44194 refer to the address that is being rewritten.
44195 </para>
44196 </section>
44197 <section id="SECID151">
44198 <title>Rewriting patterns</title>
44199 <para>
44200 <indexterm role="concept">
44201 <primary>rewriting</primary>
44202 <secondary>patterns</secondary>
44203 </indexterm>
44204 <indexterm role="concept">
44205 <primary>address list</primary>
44206 <secondary>in a rewriting pattern</secondary>
44207 </indexterm>
44208 The source pattern in a rewriting rule is any item which may appear in an
44209 address list (see section <xref linkend="SECTaddresslist"/>). It is in fact processed as a
44210 single-item address list, which means that it is expanded before being tested
44211 against the address. As always, if you use a regular expression as a pattern,
44212 you must take care to escape dollar and backslash characters, or use the <literal>\N</literal>
44213 facility to suppress string expansion within the regular expression.
44214 </para>
44215 <para>
44216 Domains in patterns should be given in lower case. Local parts in patterns are
44217 case-sensitive. If you want to do case-insensitive matching of local parts, you
44218 can use a regular expression that starts with <literal>^(?i)</literal>.
44219 </para>
44220 <para>
44221 <indexterm role="concept">
44222 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
44223 <secondary>in rewriting rules</secondary>
44224 </indexterm>
44225 After matching, the numerical variables <varname>$1</varname>, <varname>$2</varname>, etc. may be set,
44226 depending on the type of match which occurred. These can be used in the
44227 replacement string to insert portions of the incoming address. <varname>$0</varname> always
44228 refers to the complete incoming address. When a regular expression is used, the
44229 numerical variables are set from its capturing subexpressions. For other types
44230 of pattern they are set as follows:
44231 </para>
44232 <itemizedlist>
44233 <listitem>
44234 <para>
44235 If a local part or domain starts with an asterisk, the numerical variables
44236 refer to the character strings matched by asterisks, with <varname>$1</varname> associated with
44237 the first asterisk, and <varname>$2</varname> with the second, if present. For example, if the
44238 pattern
44239 </para>
44240 <literallayout class="monospaced">
44241 *queen@*.fict.example
44242 </literallayout>
44243 <para>
44244 is matched against the address <emphasis>hearts-queen@wonderland.fict.example</emphasis> then
44245 </para>
44246 <literallayout class="monospaced">
44247 $0 = hearts-queen@wonderland.fict.example
44248 $1 = hearts-
44249 $2 = wonderland
44250 </literallayout>
44251 <para>
44252 Note that if the local part does not start with an asterisk, but the domain
44253 does, it is <varname>$1</varname> that contains the wild part of the domain.
44254 </para>
44255 </listitem>
44256 <listitem>
44257 <para>
44258 If the domain part of the pattern is a partial lookup, the wild and fixed parts
44259 of the domain are placed in the next available numerical variables. Suppose,
44260 for example, that the address <emphasis>foo@bar.baz.example</emphasis> is processed by a
44261 rewriting rule of the form
44262 </para>
44263 <literallayout>
44264 <literal>*@partial-dbm;/some/dbm/file</literal>    &lt;<emphasis>replacement string</emphasis>&gt;
44265 </literallayout>
44266 <para>
44267 and the key in the file that matches the domain is <literal>*.baz.example</literal>. Then
44268 </para>
44269 <literallayout class="monospaced">
44270 $1 = foo
44271 $2 = bar
44272 $3 = baz.example
44273 </literallayout>
44274 <para>
44275 If the address <emphasis>foo@baz.example</emphasis> is looked up, this matches the same
44276 wildcard file entry, and in this case <varname>$2</varname> is set to the empty string, but
44277 <varname>$3</varname> is still set to <emphasis>baz.example</emphasis>. If a non-wild key is matched in a
44278 partial lookup, <varname>$2</varname> is again set to the empty string and <varname>$3</varname> is set to the
44279 whole domain. For non-partial domain lookups, no numerical variables are set.
44280 </para>
44281 </listitem>
44282 </itemizedlist>
44283 </section>
44284 <section id="SECID152">
44285 <title>Rewriting replacements</title>
44286 <para>
44287 <indexterm role="concept">
44288 <primary>rewriting</primary>
44289 <secondary>replacements</secondary>
44290 </indexterm>
44291 If the replacement string for a rule is a single asterisk, addresses that
44292 match the pattern and the flags are <emphasis>not</emphasis> rewritten, and no subsequent
44293 rewriting rules are scanned. For example,
44294 </para>
44295 <literallayout class="monospaced">
44296 hatta@lookingglass.fict.example  *  f
44297 </literallayout>
44298 <para>
44299 specifies that <emphasis>hatta@lookingglass.fict.example</emphasis> is never to be rewritten in
44300 <emphasis>From:</emphasis> headers.
44301 </para>
44302 <para>
44303 <indexterm role="variable">
44304 <primary><varname>$domain</varname></primary>
44305 </indexterm>
44306 <indexterm role="variable">
44307 <primary><varname>$local_part</varname></primary>
44308 </indexterm>
44309 If the replacement string is not a single asterisk, it is expanded, and must
44310 yield a fully qualified address. Within the expansion, the variables
44311 <varname>$local_part</varname> and <varname>$domain</varname> refer to the address that is being rewritten.
44312 Any letters they contain retain their original case &ndash; they are not lower
44313 cased. The numerical variables are set up according to the type of pattern that
44314 matched the address, as described above. If the expansion is forced to fail by
44315 the presence of <quote>fail</quote> in a conditional or lookup item, rewriting by the
44316 current rule is abandoned, but subsequent rules may take effect. Any other
44317 expansion failure causes the entire rewriting operation to be abandoned, and an
44318 entry written to the panic log.
44319 </para>
44320 </section>
44321 <section id="SECID153">
44322 <title>Rewriting flags</title>
44323 <para>
44324 There are three different kinds of flag that may appear on rewriting rules:
44325 </para>
44326 <itemizedlist>
44327 <listitem>
44328 <para>
44329 Flags that specify which headers and envelope addresses to rewrite: E, F, T, b,
44330 c, f, h, r, s, t.
44331 </para>
44332 </listitem>
44333 <listitem>
44334 <para>
44335 A flag that specifies rewriting at SMTP time: S.
44336 </para>
44337 </listitem>
44338 <listitem>
44339 <para>
44340 Flags that control the rewriting process: Q, q, R, w.
44341 </para>
44342 </listitem>
44343 </itemizedlist>
44344 <para>
44345 For rules that are part of the <option>headers_rewrite</option> generic transport option,
44346 E, F, T, and S are not permitted.
44347 </para>
44348 </section>
44349 <section id="SECID154">
44350 <title>Flags specifying which headers and envelope addresses to rewrite</title>
44351 <para>
44352 <indexterm role="concept">
44353 <primary>rewriting</primary>
44354 <secondary>flags</secondary>
44355 </indexterm>
44356 If none of the following flag letters, nor the <quote>S</quote> flag (see section
44357 <xref linkend="SECTrewriteS"/>) are present, a main rewriting rule applies to all headers
44358 and to both the sender and recipient fields of the envelope, whereas a
44359 transport-time rewriting rule just applies to all headers. Otherwise, the
44360 rewriting rule is skipped unless the relevant addresses are being processed.
44361 </para>
44362 <literallayout>
44363 <literal>E</literal>       rewrite all envelope fields
44364 <literal>F</literal>       rewrite the envelope From field
44365 <literal>T</literal>       rewrite the envelope To field
44366 <literal>b</literal>       rewrite the <emphasis>Bcc:</emphasis> header
44367 <literal>c</literal>       rewrite the <emphasis>Cc:</emphasis> header
44368 <literal>f</literal>       rewrite the <emphasis>From:</emphasis> header
44369 <literal>h</literal>       rewrite all headers
44370 <literal>r</literal>       rewrite the <emphasis>Reply-To:</emphasis> header
44371 <literal>s</literal>       rewrite the <emphasis>Sender:</emphasis> header
44372 <literal>t</literal>       rewrite the <emphasis>To:</emphasis> header
44373 </literallayout>
44374 <para>
44375 "All headers" means all of the headers listed above that can be selected
44376 individually, plus their <emphasis>Resent-</emphasis> versions. It does not include
44377 other headers such as <emphasis>Subject:</emphasis> etc.
44378 </para>
44379 <para>
44380 You should be particularly careful about rewriting <emphasis>Sender:</emphasis> headers, and
44381 restrict this to special known cases in your own domains.
44382 </para>
44383 </section>
44384 <section id="SECTrewriteS">
44385 <title>The SMTP-time rewriting flag</title>
44386 <para>
44387 <indexterm role="concept">
44388 <primary>SMTP</primary>
44389 <secondary>rewriting malformed addresses</secondary>
44390 </indexterm>
44391 <indexterm role="concept">
44392 <primary>RCPT</primary>
44393 <secondary>rewriting argument of</secondary>
44394 </indexterm>
44395 <indexterm role="concept">
44396 <primary>MAIL</primary>
44397 <secondary>rewriting argument of</secondary>
44398 </indexterm>
44399 The rewrite flag <quote>S</quote> specifies a rewrite of incoming envelope addresses at
44400 SMTP time, as soon as an address is received in a MAIL or RCPT command, and
44401 before any other processing; even before syntax checking. The pattern is
44402 required to be a regular expression, and it is matched against the whole of the
44403 data for the command, including any surrounding angle brackets.
44404 </para>
44405 <para>
44406 <indexterm role="variable">
44407 <primary><varname>$domain</varname></primary>
44408 </indexterm>
44409 <indexterm role="variable">
44410 <primary><varname>$local_part</varname></primary>
44411 </indexterm>
44412 This form of rewrite rule allows for the handling of addresses that are not
44413 compliant with RFCs 2821 and 2822 (for example, <quote>bang paths</quote> in batched SMTP
44414 input). Because the input is not required to be a syntactically valid address,
44415 the variables <varname>$local_part</varname> and <varname>$domain</varname> are not available during the
44416 expansion of the replacement string. The result of rewriting replaces the
44417 original address in the MAIL or RCPT command.
44418 </para>
44419 </section>
44420 <section id="SECID155">
44421 <title>Flags controlling the rewriting process</title>
44422 <para>
44423 There are four flags which control the way the rewriting process works. These
44424 take effect only when a rule is invoked, that is, when the address is of the
44425 correct type (matches the flags) and matches the pattern:
44426 </para>
44427 <itemizedlist>
44428 <listitem>
44429 <para>
44430 If the <quote>Q</quote> flag is set on a rule, the rewritten address is permitted to be an
44431 unqualified local part. It is qualified with <option>qualify_recipient</option>. In the
44432 absence of <quote>Q</quote> the rewritten address must always include a domain.
44433 </para>
44434 </listitem>
44435 <listitem>
44436 <para>
44437 If the <quote>q</quote> flag is set on a rule, no further rewriting rules are considered,
44438 even if no rewriting actually takes place because of a <quote>fail</quote> in the
44439 expansion. The <quote>q</quote> flag is not effective if the address is of the wrong type
44440 (does not match the flags) or does not match the pattern.
44441 </para>
44442 </listitem>
44443 <listitem>
44444 <para>
44445 The <quote>R</quote> flag causes a successful rewriting rule to be re-applied to the new
44446 address, up to ten times. It can be combined with the <quote>q</quote> flag, to stop
44447 rewriting once it fails to match (after at least one successful rewrite).
44448 </para>
44449 </listitem>
44450 <listitem>
44451 <para>
44452 <indexterm role="concept">
44453 <primary>rewriting</primary>
44454 <secondary>whole addresses</secondary>
44455 </indexterm>
44456 When an address in a header is rewritten, the rewriting normally applies only
44457 to the working part of the address, with any comments and RFC 2822 <quote>phrase</quote>
44458 left unchanged. For example, rewriting might change
44459 </para>
44460 <literallayout class="monospaced">
44461 From: Ford Prefect &lt;fp42@restaurant.hitch.fict.example&gt;
44462 </literallayout>
44463 <para>
44464 into
44465 </para>
44466 <literallayout class="monospaced">
44467 From: Ford Prefect &lt;prefectf@hitch.fict.example&gt;
44468 </literallayout>
44469 <para>
44470 <indexterm role="concept">
44471 <primary>RFC 2047</primary>
44472 </indexterm>
44473 Sometimes there is a need to replace the whole address item, and this can be
44474 done by adding the flag letter <quote>w</quote> to a rule. If this is set on a rule that
44475 causes an address in a header line to be rewritten, the entire address is
44476 replaced, not just the working part. The replacement must be a complete RFC
44477 2822 address, including the angle brackets if necessary. If text outside angle
44478 brackets contains a character whose value is greater than 126 or less than 32
44479 (except for tab), the text is encoded according to RFC 2047. The character set
44480 is taken from <option>headers_charset</option>, which defaults to ISO-8859-1.
44481 </para>
44482 <para>
44483 When the <quote>w</quote> flag is set on a rule that causes an envelope address to be
44484 rewritten, all but the working part of the replacement address is discarded.
44485 </para>
44486 </listitem>
44487 </itemizedlist>
44488 </section>
44489 <section id="SECID156">
44490 <title>Rewriting examples</title>
44491 <para>
44492 Here is an example of the two common rewriting paradigms:
44493 </para>
44494 <literallayout class="monospaced">
44495 *@*.hitch.fict.example  $1@hitch.fict.example
44496 *@hitch.fict.example    ${lookup{$1}dbm{/etc/realnames}\
44497                      {$value}fail}@hitch.fict.example bctfrF
44498 </literallayout>
44499 <para>
44500 Note the use of <quote>fail</quote> in the lookup expansion in the second rule, forcing
44501 the string expansion to fail if the lookup does not succeed. In this context it
44502 has the effect of leaving the original address unchanged, but Exim goes on to
44503 consider subsequent rewriting rules, if any, because the <quote>q</quote> flag is not
44504 present in that rule. An alternative to <quote>fail</quote> would be to supply <varname>$1</varname>
44505 explicitly, which would cause the rewritten address to be the same as before,
44506 at the cost of a small bit of processing. Not supplying either of these is an
44507 error, since the rewritten address would then contain no local part.
44508 </para>
44509 <para>
44510 The first example above replaces the domain with a superior, more general
44511 domain. This may not be desirable for certain local parts. If the rule
44512 </para>
44513 <literallayout class="monospaced">
44514 root@*.hitch.fict.example  *
44515 </literallayout>
44516 <para>
44517 were inserted before the first rule, rewriting would be suppressed for the
44518 local part <emphasis>root</emphasis> at any domain ending in <emphasis>hitch.fict.example</emphasis>.
44519 </para>
44520 <para>
44521 Rewriting can be made conditional on a number of tests, by making use of
44522 <varname>${if</varname> in the expansion item. For example, to apply a rewriting rule only to
44523 messages that originate outside the local host:
44524 </para>
44525 <literallayout class="monospaced">
44526 *@*.hitch.fict.example  "${if !eq {$sender_host_address}{}\
44527                          {$1@hitch.fict.example}fail}"
44528 </literallayout>
44529 <para>
44530 The replacement string is quoted in this example because it contains white
44531 space.
44532 </para>
44533 <para>
44534 <indexterm role="concept">
44535 <primary>rewriting</primary>
44536 <secondary>bang paths</secondary>
44537 </indexterm>
44538 <indexterm role="concept">
44539 <primary>bang paths</primary>
44540 <secondary>rewriting</secondary>
44541 </indexterm>
44542 Exim does not handle addresses in the form of <quote>bang paths</quote>. If it sees such
44543 an address it treats it as an unqualified local part which it qualifies with
44544 the local qualification domain (if the source of the message is local or if the
44545 remote host is permitted to send unqualified addresses). Rewriting can
44546 sometimes be used to handle simple bang paths with a fixed number of
44547 components. For example, the rule
44548 </para>
44549 <literallayout class="monospaced">
44550 \N^([^!]+)!(.*)@your.domain.example$\N   $2@$1
44551 </literallayout>
44552 <para>
44553 rewrites a two-component bang path <emphasis>host.name!user</emphasis> as the domain address
44554 <emphasis>user@host.name</emphasis>. However, there is a security implication in using this as
44555 a global rewriting rule for envelope addresses. It can provide a backdoor
44556 method for using your system as a relay, because the incoming addresses appear
44557 to be local. If the bang path addresses are received via SMTP, it is safer to
44558 use the <quote>S</quote> flag to rewrite them as they are received, so that relay checking
44559 can be done on the rewritten addresses.
44560 <indexterm role="concept" startref="IIDaddrew" class="endofrange"/>
44561 </para>
44562 </section>
44563 </chapter>
44564
44565 <chapter id="CHAPretry">
44566 <title>Retry configuration</title>
44567 <para>
44568 <indexterm role="concept" id="IIDretconf1" class="startofrange">
44569 <primary>retry</primary>
44570 <secondary>configuration, description of</secondary>
44571 </indexterm>
44572 <indexterm role="concept" id="IIDregconf2" class="startofrange">
44573 <primary>configuration file</primary>
44574 <secondary>retry section</secondary>
44575 </indexterm>
44576 The <quote>retry</quote> section of the runtime configuration file contains a list of
44577 retry rules that control how often Exim tries to deliver messages that cannot
44578 be delivered at the first attempt. If there are no retry rules (the section is
44579 empty or not present), there are no retries. In this situation, temporary
44580 errors are treated as permanent. The default configuration contains a single,
44581 general-purpose retry rule (see section <xref linkend="SECID57"/>). The <option>-brt</option> command
44582 line option can be used to test which retry rule will be used for a given
44583 address, domain and error.
44584 </para>
44585 <para>
44586 The most common cause of retries is temporary failure to deliver to a remote
44587 host because the host is down, or inaccessible because of a network problem.
44588 Exim&#x2019;s retry processing in this case is applied on a per-host (strictly, per IP
44589 address) basis, not on a per-message basis. Thus, if one message has recently
44590 been delayed, delivery of a new message to the same host is not immediately
44591 tried, but waits for the host&#x2019;s retry time to arrive. If the <option>retry_defer</option>
44592 log selector is set, the message
44593 <indexterm role="concept">
44594 <primary>retry</primary>
44595 <secondary>time not reached</secondary>
44596 </indexterm>
44597 <quote>retry time not reached</quote> is written to the main log whenever a delivery is
44598 skipped for this reason. Section <xref linkend="SECToutSMTPerr"/> contains more details of
44599 the handling of errors during remote deliveries.
44600 </para>
44601 <para>
44602 Retry processing applies to routing as well as to delivering, except as covered
44603 in the next paragraph. The retry rules do not distinguish between these
44604 actions. It is not possible, for example, to specify different behaviour for
44605 failures to route the domain <emphasis>snark.fict.example</emphasis> and failures to deliver to
44606 the host <emphasis>snark.fict.example</emphasis>. I didn&#x2019;t think anyone would ever need this
44607 added complication, so did not implement it. However, although they share the
44608 same retry rule, the actual retry times for routing and transporting a given
44609 domain are maintained independently.
44610 </para>
44611 <para>
44612 When a delivery is not part of a queue run (typically an immediate delivery on
44613 receipt of a message), the routers are always run, and local deliveries are
44614 always attempted, even if retry times are set for them. This makes for better
44615 behaviour if one particular message is causing problems (for example, causing
44616 quota overflow, or provoking an error in a filter file). If such a delivery
44617 suffers a temporary failure, the retry data is updated as normal, and
44618 subsequent delivery attempts from queue runs occur only when the retry time for
44619 the local address is reached.
44620 </para>
44621 <section id="SECID157">
44622 <title>Changing retry rules</title>
44623 <para>
44624 If you change the retry rules in your configuration, you should consider
44625 whether or not to delete the retry data that is stored in Exim&#x2019;s spool area in
44626 files with names like <filename>db/retry</filename>. Deleting any of Exim&#x2019;s hints files is
44627 always safe; that is why they are called <quote>hints</quote>.
44628 </para>
44629 <para>
44630 The hints retry data contains suggested retry times based on the previous
44631 rules. In the case of a long-running problem with a remote host, it might
44632 record the fact that the host has timed out. If your new rules increase the
44633 timeout time for such a host, you should definitely remove the old retry data
44634 and let Exim recreate it, based on the new rules. Otherwise Exim might bounce
44635 messages that it should now be retaining.
44636 </para>
44637 </section>
44638 <section id="SECID158">
44639 <title>Format of retry rules</title>
44640 <para>
44641 <indexterm role="concept">
44642 <primary>retry</primary>
44643 <secondary>rules</secondary>
44644 </indexterm>
44645 Each retry rule occupies one line and consists of three or four parts,
44646 separated by white space: a pattern, an error name, an optional list of sender
44647 addresses, and a list of retry parameters. The pattern and sender lists must be
44648 enclosed in double quotes if they contain white space. The rules are searched
44649 in order until one is found where the pattern, error name, and sender list (if
44650 present) match the failing host or address, the error that occurred, and the
44651 message&#x2019;s sender, respectively.
44652 </para>
44653 <para>
44654 The pattern is any single item that may appear in an address list (see section
44655 <xref linkend="SECTaddresslist"/>). It is in fact processed as a one-item address list,
44656 which means that it is expanded before being tested against the address that
44657 has been delayed. A negated address list item is permitted. Address
44658 list processing treats a plain domain name as if it were preceded by <quote>*@</quote>,
44659 which makes it possible for many retry rules to start with just a domain. For
44660 example,
44661 </para>
44662 <literallayout class="monospaced">
44663 lookingglass.fict.example        *  F,24h,30m;
44664 </literallayout>
44665 <para>
44666 provides a rule for any address in the <emphasis>lookingglass.fict.example</emphasis> domain,
44667 whereas
44668 </para>
44669 <literallayout class="monospaced">
44670 alice@lookingglass.fict.example  *  F,24h,30m;
44671 </literallayout>
44672 <para>
44673 applies only to temporary failures involving the local part <option>alice</option>.
44674 In practice, almost all rules start with a domain name pattern without a local
44675 part.
44676 </para>
44677 <para>
44678 <indexterm role="concept">
44679 <primary>regular expressions</primary>
44680 <secondary>in retry rules</secondary>
44681 </indexterm>
44682 <emphasis role="bold">Warning</emphasis>: If you use a regular expression in a routing rule pattern, it
44683 must match a complete address, not just a domain, because that is how regular
44684 expressions work in address lists.
44685 </para>
44686 <literallayout>
44687 <literal>^\Nxyz\d+\.abc\.example$\N        *  G,1h,10m,2</literal>     <option>Wrong</option>
44688 <literal>^\N[^@]+@xyz\d+\.abc\.example$\N  *  G,1h,10m,2</literal>     <option>Right</option>
44689 </literallayout>
44690 </section>
44691 <section id="SECID159">
44692 <title>Choosing which retry rule to use for address errors</title>
44693 <para>
44694 When Exim is looking for a retry rule after a routing attempt has failed (for
44695 example, after a DNS timeout), each line in the retry configuration is tested
44696 against the complete address only if <option>retry_use_local_part</option> is set for the
44697 router. Otherwise, only the domain is used, except when matching against a
44698 regular expression, when the local part of the address is replaced with <quote>*</quote>.
44699 A domain on its own can match a domain pattern, or a pattern that starts with
44700 <quote>*@</quote>. By default, <option>retry_use_local_part</option> is true for routers where
44701 <option>check_local_user</option> is true, and false for other routers.
44702 </para>
44703 <para>
44704 Similarly, when Exim is looking for a retry rule after a local delivery has
44705 failed (for example, after a mailbox full error), each line in the retry
44706 configuration is tested against the complete address only if
44707 <option>retry_use_local_part</option> is set for the transport (it defaults true for all
44708 local transports).
44709 </para>
44710 <para>
44711 <indexterm role="concept">
44712 <primary>4<emphasis>xx</emphasis> responses</primary>
44713 <secondary>retry rules for</secondary>
44714 </indexterm>
44715 However, when Exim is looking for a retry rule after a remote delivery attempt
44716 suffers an address error (a 4<emphasis>xx</emphasis> SMTP response for a recipient address), the
44717 whole address is always used as the key when searching the retry rules. The
44718 rule that is found is used to create a retry time for the combination of the
44719 failing address and the message&#x2019;s sender. It is the combination of sender and
44720 recipient that is delayed in subsequent queue runs until its retry time is
44721 reached. You can delay the recipient without regard to the sender by setting
44722 <option>address_retry_include_sender</option> false in the <command>smtp</command> transport but this can
44723 lead to problems with servers that regularly issue 4<emphasis>xx</emphasis> responses to RCPT
44724 commands.
44725 </para>
44726 </section>
44727 <section id="SECID160">
44728 <title>Choosing which retry rule to use for host and message errors</title>
44729 <para>
44730 For a temporary error that is not related to an individual address (for
44731 example, a connection timeout), each line in the retry configuration is checked
44732 twice. First, the name of the remote host is used as a domain name (preceded by
44733 <quote>*@</quote> when matching a regular expression). If this does not match the line,
44734 the domain from the email address is tried in a similar fashion. For example,
44735 suppose the MX records for <emphasis>a.b.c.example</emphasis> are
44736 </para>
44737 <literallayout class="monospaced">
44738 a.b.c.example  MX  5  x.y.z.example
44739                MX  6  p.q.r.example
44740                MX  7  m.n.o.example
44741 </literallayout>
44742 <para>
44743 and the retry rules are
44744 </para>
44745 <literallayout class="monospaced">
44746 p.q.r.example    *      F,24h,30m;
44747 a.b.c.example    *      F,4d,45m;
44748 </literallayout>
44749 <para>
44750 and a delivery to the host <emphasis>x.y.z.example</emphasis> suffers a connection failure. The
44751 first rule matches neither the host nor the domain, so Exim looks at the second
44752 rule. This does not match the host, but it does match the domain, so it is used
44753 to calculate the retry time for the host <emphasis>x.y.z.example</emphasis>. Meanwhile, Exim
44754 tries to deliver to <emphasis>p.q.r.example</emphasis>. If this also suffers a host error, the
44755 first retry rule is used, because it matches the host.
44756 </para>
44757 <para>
44758 In other words, temporary failures to deliver to host <emphasis>p.q.r.example</emphasis> use the
44759 first rule to determine retry times, but for all the other hosts for the domain
44760 <emphasis>a.b.c.example</emphasis>, the second rule is used. The second rule is also used if
44761 routing to <emphasis>a.b.c.example</emphasis> suffers a temporary failure.
44762 </para>
44763 <para>
44764 <emphasis role="bold">Note</emphasis>: The host name is used when matching the patterns, not its IP address.
44765 However, if a message is routed directly to an IP address without the use of a
44766 host name, for example, if a <command>manualroute</command> router contains a setting such as:
44767 </para>
44768 <literallayout class="monospaced">
44769 route_list = *.a.example  192.168.34.23
44770 </literallayout>
44771 <para>
44772 then the <quote>host name</quote> that is used when searching for a retry rule is the
44773 textual form of the IP address.
44774 </para>
44775 </section>
44776 <section id="SECID161">
44777 <title>Retry rules for specific errors</title>
44778 <para>
44779 <indexterm role="concept">
44780 <primary>retry</primary>
44781 <secondary>specific errors; specifying</secondary>
44782 </indexterm>
44783 The second field in a retry rule is the name of a particular error, or an
44784 asterisk, which matches any error. The errors that can be tested for are:
44785 </para>
44786 <variablelist>
44787 <varlistentry>
44788 <term><option>auth_failed</option></term>
44789 <listitem>
44790 <para>
44791 Authentication failed when trying to send to a host in the
44792 <option>hosts_require_auth</option> list in an <command>smtp</command> transport.
44793 </para>
44794 </listitem></varlistentry>
44795 <varlistentry>
44796 <term><option>data_4xx</option></term>
44797 <listitem>
44798 <para>
44799 A 4<emphasis>xx</emphasis> error was received for an outgoing DATA command, either immediately
44800 after the command, or after sending the message&#x2019;s data.
44801 </para>
44802 </listitem></varlistentry>
44803 <varlistentry>
44804 <term><option>mail_4xx</option></term>
44805 <listitem>
44806 <para>
44807 A 4<emphasis>xx</emphasis> error was received for an outgoing MAIL command.
44808 </para>
44809 </listitem></varlistentry>
44810 <varlistentry>
44811 <term><option>rcpt_4xx</option></term>
44812 <listitem>
44813 <para>
44814 A 4<emphasis>xx</emphasis> error was received for an outgoing RCPT command.
44815 </para>
44816 </listitem></varlistentry>
44817 </variablelist>
44818 <para>
44819 For the three 4<emphasis>xx</emphasis> errors, either the first or both of the x&#x2019;s can be given
44820 as specific digits, for example: <literal>mail_45x</literal> or <literal>rcpt_436</literal>. For example, to
44821 recognize 452 errors given to RCPT commands for addresses in a certain domain,
44822 and have retries every ten minutes with a one-hour timeout, you could set up a
44823 retry rule of this form:
44824 </para>
44825 <literallayout class="monospaced">
44826 the.domain.name  rcpt_452   F,1h,10m
44827 </literallayout>
44828 <para>
44829 These errors apply to both outgoing SMTP (the <command>smtp</command> transport) and outgoing
44830 LMTP (either the <command>lmtp</command> transport, or the <command>smtp</command> transport in LMTP mode).
44831 </para>
44832 <variablelist>
44833 <varlistentry>
44834 <term><option>lost_connection</option></term>
44835 <listitem>
44836 <para>
44837 A server unexpectedly closed the SMTP connection. There may, of course,
44838 legitimate reasons for this (host died, network died), but if it repeats a lot
44839 for the same host, it indicates something odd.
44840 </para>
44841 </listitem></varlistentry>
44842 <varlistentry>
44843 <term><option>refused_MX</option></term>
44844 <listitem>
44845 <para>
44846 A connection to a host obtained from an MX record was refused.
44847 </para>
44848 </listitem></varlistentry>
44849 <varlistentry>
44850 <term><option>refused_A</option></term>
44851 <listitem>
44852 <para>
44853 A connection to a host not obtained from an MX record was refused.
44854 </para>
44855 </listitem></varlistentry>
44856 <varlistentry>
44857 <term><option>refused</option></term>
44858 <listitem>
44859 <para>
44860 A connection was refused.
44861 </para>
44862 </listitem></varlistentry>
44863 <varlistentry>
44864 <term><option>timeout_connect_MX</option></term>
44865 <listitem>
44866 <para>
44867 A connection attempt to a host obtained from an MX record timed out.
44868 </para>
44869 </listitem></varlistentry>
44870 <varlistentry>
44871 <term><option>timeout_connect_A</option></term>
44872 <listitem>
44873 <para>
44874 A connection attempt to a host not obtained from an MX record timed out.
44875 </para>
44876 </listitem></varlistentry>
44877 <varlistentry>
44878 <term><option>timeout_connect</option></term>
44879 <listitem>
44880 <para>
44881 A connection attempt timed out.
44882 </para>
44883 </listitem></varlistentry>
44884 <varlistentry>
44885 <term><option>timeout_MX</option></term>
44886 <listitem>
44887 <para>
44888 There was a timeout while connecting or during an SMTP session with a host
44889 obtained from an MX record.
44890 </para>
44891 </listitem></varlistentry>
44892 <varlistentry>
44893 <term><option>timeout_A</option></term>
44894 <listitem>
44895 <para>
44896 There was a timeout while connecting or during an SMTP session with a host not
44897 obtained from an MX record.
44898 </para>
44899 </listitem></varlistentry>
44900 <varlistentry>
44901 <term><option>timeout</option></term>
44902 <listitem>
44903 <para>
44904 There was a timeout while connecting or during an SMTP session.
44905 </para>
44906 </listitem></varlistentry>
44907 <varlistentry>
44908 <term><option>tls_required</option></term>
44909 <listitem>
44910 <para>
44911 The server was required to use TLS (it matched <option>hosts_require_tls</option> in the
44912 <command>smtp</command> transport), but either did not offer TLS, or it responded with 4<emphasis>xx</emphasis>
44913 to STARTTLS, or there was a problem setting up the TLS connection.
44914 </para>
44915 </listitem></varlistentry>
44916 <varlistentry>
44917 <term><option>quota</option></term>
44918 <listitem>
44919 <para>
44920 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
44921 transport.
44922 </para>
44923 </listitem></varlistentry>
44924 <varlistentry>
44925 <term><option>quota_</option>&lt;<emphasis>time</emphasis>&gt;</term>
44926 <listitem>
44927 <para>
44928 <indexterm role="concept">
44929 <primary>quota</primary>
44930 <secondary>error testing in retry rule</secondary>
44931 </indexterm>
44932 <indexterm role="concept">
44933 <primary>retry</primary>
44934 <secondary>quota error testing</secondary>
44935 </indexterm>
44936 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
44937 transport, and the mailbox has not been accessed for &lt;<emphasis>time</emphasis>&gt;. For example,
44938 <emphasis>quota_4d</emphasis> applies to a quota error when the mailbox has not been accessed
44939 for four days.
44940 </para>
44941 </listitem></varlistentry>
44942 </variablelist>
44943 <para>
44944 <indexterm role="concept">
44945 <primary>mailbox</primary>
44946 <secondary>time of last read</secondary>
44947 </indexterm>
44948 The idea of <option>quota_</option>&lt;<emphasis>time</emphasis>&gt; is to make it possible to have shorter
44949 timeouts when the mailbox is full and is not being read by its owner. Ideally,
44950 it should be based on the last time that the user accessed the mailbox.
44951 However, it is not always possible to determine this. Exim uses the following
44952 heuristic rules:
44953 </para>
44954 <itemizedlist>
44955 <listitem>
44956 <para>
44957 If the mailbox is a single file, the time of last access (the <quote>atime</quote>) is
44958 used. As no new messages are being delivered (because the mailbox is over
44959 quota), Exim does not access the file, so this is the time of last user access.
44960 </para>
44961 </listitem>
44962 <listitem>
44963 <para>
44964 <indexterm role="concept">
44965 <primary>maildir format</primary>
44966 <secondary>time of last read</secondary>
44967 </indexterm>
44968 For a maildir delivery, the time of last modification of the <filename>new</filename>
44969 subdirectory is used. As the mailbox is over quota, no new files are created in
44970 the <filename>new</filename> subdirectory, because no new messages are being delivered. Any
44971 change to the <filename>new</filename> subdirectory is therefore assumed to be the result of an
44972 MUA moving a new message to the <filename>cur</filename> directory when it is first read. The
44973 time that is used is therefore the last time that the user read a new message.
44974 </para>
44975 </listitem>
44976 <listitem>
44977 <para>
44978 For other kinds of multi-file mailbox, the time of last access cannot be
44979 obtained, so a retry rule that uses this type of error field is never matched.
44980 </para>
44981 </listitem>
44982 </itemizedlist>
44983 <para>
44984 The quota errors apply both to system-enforced quotas and to Exim&#x2019;s own quota
44985 mechanism in the <command>appendfile</command> transport. The <emphasis>quota</emphasis> error also applies
44986 when a local delivery is deferred because a partition is full (the ENOSPC
44987 error).
44988 </para>
44989 </section>
44990 <section id="SECID162">
44991 <title>Retry rules for specified senders</title>
44992 <para>
44993 <indexterm role="concept">
44994 <primary>retry</primary>
44995 <secondary>rules; sender-specific</secondary>
44996 </indexterm>
44997 You can specify retry rules that apply only when the failing message has a
44998 specific sender. In particular, this can be used to define retry rules that
44999 apply only to bounce messages. The third item in a retry rule can be of this
45000 form:
45001 </para>
45002 <literallayout>
45003 <literal>senders=</literal>&lt;<emphasis>address list</emphasis>&gt;
45004 </literallayout>
45005 <para>
45006 The retry timings themselves are then the fourth item. For example:
45007 </para>
45008 <literallayout class="monospaced">
45009 *   rcpt_4xx   senders=:   F,1h,30m
45010 </literallayout>
45011 <para>
45012 matches recipient 4<emphasis>xx</emphasis> errors for bounce messages sent to any address at any
45013 host. If the address list contains white space, it must be enclosed in quotes.
45014 For example:
45015 </para>
45016 <literallayout class="monospaced">
45017 a.domain  rcpt_452  senders="xb.dom : yc.dom"  G,8h,10m,1.5
45018 </literallayout>
45019 <para>
45020 <emphasis role="bold">Warning</emphasis>: This facility can be unhelpful if it is used for host errors
45021 (which do not depend on the recipient). The reason is that the sender is used
45022 only to match the retry rule. Once the rule has been found for a host error,
45023 its contents are used to set a retry time for the host, and this will apply to
45024 all messages, not just those with specific senders.
45025 </para>
45026 <para>
45027 When testing retry rules using <option>-brt</option>, you can supply a sender using the
45028 <option>-f</option> command line option, like this:
45029 </para>
45030 <literallayout class="monospaced">
45031 exim -f "" -brt user@dom.ain
45032 </literallayout>
45033 <para>
45034 If you do not set <option>-f</option> with <option>-brt</option>, a retry rule that contains a senders
45035 list is never matched.
45036 </para>
45037 </section>
45038 <section id="SECID163">
45039 <title>Retry parameters</title>
45040 <para>
45041 <indexterm role="concept">
45042 <primary>retry</primary>
45043 <secondary>parameters in rules</secondary>
45044 </indexterm>
45045 The third (or fourth, if a senders list is present) field in a retry rule is a
45046 sequence of retry parameter sets, separated by semicolons. Each set consists of
45047 </para>
45048 <literallayout>
45049 &lt;<emphasis>letter</emphasis>&gt;,&lt;<emphasis>cutoff time</emphasis>&gt;,&lt;<emphasis>arguments</emphasis>&gt;
45050 </literallayout>
45051 <para>
45052 The letter identifies the algorithm for computing a new retry time; the cutoff
45053 time is the time beyond which this algorithm no longer applies, and the
45054 arguments vary the algorithm&#x2019;s action. The cutoff time is measured from the
45055 time that the first failure for the domain (combined with the local part if
45056 relevant) was detected, not from the time the message was received.
45057 </para>
45058 <para>
45059 <indexterm role="concept">
45060 <primary>retry</primary>
45061 <secondary>algorithms</secondary>
45062 </indexterm>
45063 <indexterm role="concept">
45064 <primary>retry</primary>
45065 <secondary>fixed intervals</secondary>
45066 </indexterm>
45067 <indexterm role="concept">
45068 <primary>retry</primary>
45069 <secondary>increasing intervals</secondary>
45070 </indexterm>
45071 <indexterm role="concept">
45072 <primary>retry</primary>
45073 <secondary>random intervals</secondary>
45074 </indexterm>
45075 The available algorithms are:
45076 </para>
45077 <itemizedlist>
45078 <listitem>
45079 <para>
45080 <emphasis>F</emphasis>: retry at fixed intervals. There is a single time parameter specifying
45081 the interval.
45082 </para>
45083 </listitem>
45084 <listitem>
45085 <para>
45086 <emphasis>G</emphasis>: retry at geometrically increasing intervals. The first argument
45087 specifies a starting value for the interval, and the second a multiplier, which
45088 is used to increase the size of the interval at each retry.
45089 </para>
45090 </listitem>
45091 <listitem>
45092 <para>
45093 <emphasis>H</emphasis>: retry at randomized intervals. The arguments are as for <emphasis>G</emphasis>. For each
45094 retry, the previous interval is multiplied by the factor in order to get a
45095 maximum for the next interval. The minimum interval is the first argument of
45096 the parameter, and an actual interval is chosen randomly between them. Such a
45097 rule has been found to be helpful in cluster configurations when all the
45098 members of the cluster restart at once, and may therefore synchronize their
45099 queue processing times.
45100 </para>
45101 </listitem>
45102 </itemizedlist>
45103 <para>
45104 When computing the next retry time, the algorithm definitions are scanned in
45105 order until one whose cutoff time has not yet passed is reached. This is then
45106 used to compute a new retry time that is later than the current time. In the
45107 case of fixed interval retries, this simply means adding the interval to the
45108 current time. For geometrically increasing intervals, retry intervals are
45109 computed from the rule&#x2019;s parameters until one that is greater than the previous
45110 interval is found. The main configuration variable
45111 <indexterm role="concept">
45112 <primary>limit</primary>
45113 <secondary>retry interval</secondary>
45114 </indexterm>
45115 <indexterm role="concept">
45116 <primary>retry</primary>
45117 <secondary>interval, maximum</secondary>
45118 </indexterm>
45119 <indexterm role="option">
45120 <primary><option>retry_interval_max</option></primary>
45121 </indexterm>
45122 <option>retry_interval_max</option> limits the maximum interval between retries. It
45123 cannot be set greater than <literal>24h</literal>, which is its default value.
45124 </para>
45125 <para>
45126 A single remote domain may have a number of hosts associated with it, and each
45127 host may have more than one IP address. Retry algorithms are selected on the
45128 basis of the domain name, but are applied to each IP address independently. If,
45129 for example, a host has two IP addresses and one is unusable, Exim will
45130 generate retry times for it and will not try to use it until its next retry
45131 time comes. Thus the good IP address is likely to be tried first most of the
45132 time.
45133 </para>
45134 <para>
45135 <indexterm role="concept">
45136 <primary>hints database</primary>
45137 <secondary>use for retrying</secondary>
45138 </indexterm>
45139 Retry times are hints rather than promises. Exim does not make any attempt to
45140 run deliveries exactly at the computed times. Instead, a queue runner process
45141 starts delivery processes for delayed messages periodically, and these attempt
45142 new deliveries only for those addresses that have passed their next retry time.
45143 If a new message arrives for a deferred address, an immediate delivery attempt
45144 occurs only if the address has passed its retry time. In the absence of new
45145 messages, the minimum time between retries is the interval between queue runner
45146 processes. There is not much point in setting retry times of five minutes if
45147 your queue runners happen only once an hour, unless there are a significant
45148 number of incoming messages (which might be the case on a system that is
45149 sending everything to a smart host, for example).
45150 </para>
45151 <para>
45152 The data in the retry hints database can be inspected by using the
45153 <emphasis>exim_dumpdb</emphasis> or <emphasis>exim_fixdb</emphasis> utility programs (see chapter
45154 <xref linkend="CHAPutils"/>). The latter utility can also be used to change the data. The
45155 <emphasis>exinext</emphasis> utility script can be used to find out what the next retry times
45156 are for the hosts associated with a particular mail domain, and also for local
45157 deliveries that have been deferred.
45158 </para>
45159 </section>
45160 <section id="SECID164">
45161 <title>Retry rule examples</title>
45162 <para>
45163 Here are some example retry rules:
45164 </para>
45165 <literallayout class="monospaced">
45166 alice@wonderland.fict.example quota_5d  F,7d,3h
45167 wonderland.fict.example       quota_5d
45168 wonderland.fict.example       *         F,1h,15m; G,2d,1h,2;
45169 lookingglass.fict.example     *         F,24h,30m;
45170 *                 refused_A   F,2h,20m;
45171 *                 *           F,2h,15m; G,16h,1h,1.5; F,5d,8h
45172 </literallayout>
45173 <para>
45174 The first rule sets up special handling for mail to
45175 <emphasis>alice@wonderland.fict.example</emphasis> when there is an over-quota error and the
45176 mailbox has not been read for at least 5 days. Retries continue every three
45177 hours for 7 days. The second rule handles over-quota errors for all other local
45178 parts at <emphasis>wonderland.fict.example</emphasis>; the absence of a local part has the same
45179 effect as supplying <quote>*@</quote>. As no retry algorithms are supplied, messages that
45180 fail are bounced immediately if the mailbox has not been read for at least 5
45181 days.
45182 </para>
45183 <para>
45184 The third rule handles all other errors at <emphasis>wonderland.fict.example</emphasis>; retries
45185 happen every 15 minutes for an hour, then with geometrically increasing
45186 intervals until two days have passed since a delivery first failed. After the
45187 first hour there is a delay of one hour, then two hours, then four hours, and
45188 so on (this is a rather extreme example).
45189 </para>
45190 <para>
45191 The fourth rule controls retries for the domain <emphasis>lookingglass.fict.example</emphasis>.
45192 They happen every 30 minutes for 24 hours only. The remaining two rules handle
45193 all other domains, with special action for connection refusal from hosts that
45194 were not obtained from an MX record.
45195 </para>
45196 <para>
45197 The final rule in a retry configuration should always have asterisks in the
45198 first two fields so as to provide a general catch-all for any addresses that do
45199 not have their own special handling. This example tries every 15 minutes for 2
45200 hours, then with intervals starting at one hour and increasing by a factor of
45201 1.5 up to 16 hours, then every 8 hours up to 5 days.
45202 </para>
45203 </section>
45204 <section id="SECID165">
45205 <title>Timeout of retry data</title>
45206 <para>
45207 <indexterm role="concept">
45208 <primary>timeout</primary>
45209 <secondary>of retry data</secondary>
45210 </indexterm>
45211 <indexterm role="option">
45212 <primary><option>retry_data_expire</option></primary>
45213 </indexterm>
45214 <indexterm role="concept">
45215 <primary>hints database</primary>
45216 <secondary>data expiry</secondary>
45217 </indexterm>
45218 <indexterm role="concept">
45219 <primary>retry</primary>
45220 <secondary>timeout of data</secondary>
45221 </indexterm>
45222 Exim timestamps the data that it writes to its retry hints database. When it
45223 consults the data during a delivery it ignores any that is older than the value
45224 set in <option>retry_data_expire</option> (default 7 days). If, for example, a host hasn&#x2019;t
45225 been tried for 7 days, Exim will try to deliver to it immediately a message
45226 arrives, and if that fails, it will calculate a retry time as if it were
45227 failing for the first time.
45228 </para>
45229 <para>
45230 This improves the behaviour for messages routed to rarely-used hosts such as MX
45231 backups. If such a host was down at one time, and happens to be down again when
45232 Exim tries a month later, using the old retry data would imply that it had been
45233 down all the time, which is not a justified assumption.
45234 </para>
45235 <para>
45236 If a host really is permanently dead, this behaviour causes a burst of retries
45237 every now and again, but only if messages routed to it are rare. If there is a
45238 message at least once every 7 days the retry data never expires.
45239 </para>
45240 </section>
45241 <section id="SECID166">
45242 <title>Long-term failures</title>
45243 <para>
45244 <indexterm role="concept">
45245 <primary>delivery failure, long-term</primary>
45246 </indexterm>
45247 <indexterm role="concept">
45248 <primary>retry</primary>
45249 <secondary>after long-term failure</secondary>
45250 </indexterm>
45251 Special processing happens when an email address has been failing for so long
45252 that the cutoff time for the last algorithm is reached. For example, using the
45253 default retry rule:
45254 </para>
45255 <literallayout class="monospaced">
45256 * * F,2h,15m; G,16h,1h,1.5; F,4d,6h
45257 </literallayout>
45258 <para>
45259 the cutoff time is four days. Reaching the retry cutoff is independent of how
45260 long any specific message has been failing; it is the length of continuous
45261 failure for the recipient address that counts.
45262 </para>
45263 <para>
45264 When the cutoff time is reached for a local delivery, or for all the IP
45265 addresses associated with a remote delivery, a subsequent delivery failure
45266 causes Exim to give up on the address, and a bounce message is generated.
45267 In order to cater for new messages that use the failing address, a next retry
45268 time is still computed from the final algorithm, and is used as follows:
45269 </para>
45270 <para>
45271 For local deliveries, one delivery attempt is always made for any subsequent
45272 messages. If this delivery fails, the address fails immediately. The
45273 post-cutoff retry time is not used.
45274 </para>
45275 <para>
45276 If the delivery is remote, there are two possibilities, controlled by the
45277 <indexterm role="option">
45278 <primary><option>delay_after_cutoff</option></primary>
45279 </indexterm>
45280 <option>delay_after_cutoff</option> option of the <command>smtp</command> transport. The option is true by
45281 default. Until the post-cutoff retry time for one of the IP addresses is
45282 reached, the failing email address is bounced immediately, without a delivery
45283 attempt taking place. After that time, one new delivery attempt is made to
45284 those IP addresses that are past their retry times, and if that still fails,
45285 the address is bounced and new retry times are computed.
45286 </para>
45287 <para>
45288 In other words, when all the hosts for a given email address have been failing
45289 for a long time, Exim bounces rather then defers until one of the hosts&#x2019; retry
45290 times is reached. Then it tries once, and bounces if that attempt fails. This
45291 behaviour ensures that few resources are wasted in repeatedly trying to deliver
45292 to a broken destination, but if the host does recover, Exim will eventually
45293 notice.
45294 </para>
45295 <para>
45296 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
45297 addresses are past their final cutoff time, Exim tries to deliver to those IP
45298 addresses that have not been tried since the message arrived. If there are
45299 no suitable IP addresses, or if they all fail, the address is bounced. In other
45300 words, it does not delay when a new message arrives, but tries the expired
45301 addresses immediately, unless they have been tried since the message arrived.
45302 If there is a continuous stream of messages for the failing domains, setting
45303 <option>delay_after_cutoff</option> false means that there will be many more attempts to
45304 deliver to permanently failing IP addresses than when <option>delay_after_cutoff</option> is
45305 true.
45306 </para>
45307 </section>
45308 <section id="SECID167">
45309 <title>Deliveries that work intermittently</title>
45310 <para>
45311 <indexterm role="concept">
45312 <primary>retry</primary>
45313 <secondary>intermittently working deliveries</secondary>
45314 </indexterm>
45315 Some additional logic is needed to cope with cases where a host is
45316 intermittently available, or when a message has some attribute that prevents
45317 its delivery when others to the same address get through. In this situation,
45318 because some messages are successfully delivered, the <quote>retry clock</quote> for the
45319 host or address keeps getting reset by the successful deliveries, and so
45320 failing messages remain on the queue for ever because the cutoff time is never
45321 reached.
45322 </para>
45323 <para>
45324 Two exceptional actions are applied to prevent this happening. The first
45325 applies to errors that are related to a message rather than a remote host.
45326 Section <xref linkend="SECToutSMTPerr"/> has a discussion of the different kinds of error;
45327 examples of message-related errors are 4<emphasis>xx</emphasis> responses to MAIL or DATA
45328 commands, and quota failures. For this type of error, if a message&#x2019;s arrival
45329 time is earlier than the <quote>first failed</quote> time for the error, the earlier time
45330 is used when scanning the retry rules to decide when to try next and when to
45331 time out the address.
45332 </para>
45333 <para>
45334 The exceptional second action applies in all cases. If a message has been on
45335 the queue for longer than the cutoff time of any applicable retry rule for a
45336 given address, a delivery is attempted for that address, even if it is not yet
45337 time, and if this delivery fails, the address is timed out. A new retry time is
45338 not computed in this case, so that other messages for the same address are
45339 considered immediately.
45340 <indexterm role="concept" startref="IIDretconf1" class="endofrange"/>
45341 <indexterm role="concept" startref="IIDregconf2" class="endofrange"/>
45342 </para>
45343 </section>
45344 </chapter>
45345
45346 <chapter id="CHAPSMTPAUTH">
45347 <title>SMTP authentication</title>
45348 <para>
45349 <indexterm role="concept" id="IIDauthconf1" class="startofrange">
45350 <primary>SMTP</primary>
45351 <secondary>authentication configuration</secondary>
45352 </indexterm>
45353 <indexterm role="concept" id="IIDauthconf2" class="startofrange">
45354 <primary>authentication</primary>
45355 </indexterm>
45356 The <quote>authenticators</quote> section of Exim&#x2019;s run time configuration is concerned
45357 with SMTP authentication. This facility is an extension to the SMTP protocol,
45358 described in RFC 2554, which allows a client SMTP host to authenticate itself
45359 to a server. This is a common way for a server to recognize clients that are
45360 permitted to use it as a relay. SMTP authentication is not of relevance to the
45361 transfer of mail between servers that have no managerial connection with each
45362 other.
45363 </para>
45364 <para>
45365 <indexterm role="concept">
45366 <primary>AUTH</primary>
45367 <secondary>description of</secondary>
45368 </indexterm>
45369 Very briefly, the way SMTP authentication works is as follows:
45370 </para>
45371 <itemizedlist>
45372 <listitem>
45373 <para>
45374 The server advertises a number of authentication <emphasis>mechanisms</emphasis> in response to
45375 the client&#x2019;s EHLO command.
45376 </para>
45377 </listitem>
45378 <listitem>
45379 <para>
45380 The client issues an AUTH command, naming a specific mechanism. The command
45381 may, optionally, contain some authentication data.
45382 </para>
45383 </listitem>
45384 <listitem>
45385 <para>
45386 The server may issue one or more <emphasis>challenges</emphasis>, to which the client must send
45387 appropriate responses. In simple authentication mechanisms, the challenges are
45388 just prompts for user names and passwords. The server does not have to issue
45389 any challenges &ndash; in some mechanisms the relevant data may all be transmitted
45390 with the AUTH command.
45391 </para>
45392 </listitem>
45393 <listitem>
45394 <para>
45395 The server either accepts or denies authentication.
45396 </para>
45397 </listitem>
45398 <listitem>
45399 <para>
45400 If authentication succeeds, the client may optionally make use of the AUTH
45401 option on the MAIL command to pass an authenticated sender in subsequent
45402 mail transactions. Authentication lasts for the remainder of the SMTP
45403 connection.
45404 </para>
45405 </listitem>
45406 <listitem>
45407 <para>
45408 If authentication fails, the client may give up, or it may try a different
45409 authentication mechanism, or it may try transferring mail over the
45410 unauthenticated connection.
45411 </para>
45412 </listitem>
45413 </itemizedlist>
45414 <para>
45415 If you are setting up a client, and want to know which authentication
45416 mechanisms the server supports, you can use Telnet to connect to port 25 (the
45417 SMTP port) on the server, and issue an EHLO command. The response to this
45418 includes the list of supported mechanisms. For example:
45419 </para>
45420 <literallayout>
45421 <literal>$ </literal><emphasis role="bold"><literal>telnet server.example 25</literal></emphasis>
45422 <literal>Trying 192.168.34.25...</literal>
45423 <literal>Connected to server.example.</literal>
45424 <literal>Escape character is &#x0027;^]&#x0027;.</literal>
45425 <literal>220 server.example ESMTP Exim 4.20 ...</literal>
45426 <emphasis role="bold"><literal>ehlo client.example</literal></emphasis>
45427 <literal>250-server.example Hello client.example [10.8.4.5]</literal>
45428 <literal>250-SIZE 52428800</literal>
45429 <literal>250-PIPELINING</literal>
45430 <literal>250-AUTH PLAIN</literal>
45431 <literal>250 HELP</literal>
45432 </literallayout>
45433 <para>
45434 The second-last line of this example output shows that the server supports
45435 authentication using the PLAIN mechanism. In Exim, the different authentication
45436 mechanisms are configured by specifying <emphasis>authenticator</emphasis> drivers. Like the
45437 routers and transports, which authenticators are included in the binary is
45438 controlled by build-time definitions. The following are currently available,
45439 included by setting
45440 </para>
45441 <literallayout class="monospaced">
45442 AUTH_CRAM_MD5=yes
45443 AUTH_CYRUS_SASL=yes
45444 AUTH_PLAINTEXT=yes
45445 AUTH_SPA=yes
45446 </literallayout>
45447 <para>
45448 in <filename>Local/Makefile</filename>, respectively. The first of these supports the CRAM-MD5
45449 authentication mechanism (RFC 2195), and the second provides an interface to
45450 the Cyrus SASL authentication library. The third can be configured to support
45451 the PLAIN authentication mechanism (RFC 2595) or the LOGIN mechanism, which is
45452 not formally documented, but used by several MUAs. The fourth authenticator
45453 supports Microsoft&#x2019;s <emphasis>Secure Password Authentication</emphasis> mechanism.
45454 </para>
45455 <para>
45456 The authenticators are configured using the same syntax as other drivers (see
45457 section <xref linkend="SECTfordricon"/>). If no authenticators are required, no
45458 authentication section need be present in the configuration file. Each
45459 authenticator can in principle have both server and client functions. When Exim
45460 is receiving SMTP mail, it is acting as a server; when it is sending out
45461 messages over SMTP, it is acting as a client. Authenticator configuration
45462 options are provided for use in both these circumstances.
45463 </para>
45464 <para>
45465 To make it clear which options apply to which situation, the prefixes
45466 <option>server_</option> and <option>client_</option> are used on option names that are specific to
45467 either the server or the client function, respectively. Server and client
45468 functions are disabled if none of their options are set. If an authenticator is
45469 to be used for both server and client functions, a single definition, using
45470 both sets of options, is required. For example:
45471 </para>
45472 <literallayout class="monospaced">
45473 cram:
45474   driver = cram_md5
45475   public_name = CRAM-MD5
45476   server_secret = ${if eq{$auth1}{ph10}{secret1}fail}
45477   client_name = ph10
45478   client_secret = secret2
45479 </literallayout>
45480 <para>
45481 The <option>server_</option> option is used when Exim is acting as a server, and the
45482 <option>client_</option> options when it is acting as a client.
45483 </para>
45484 <para>
45485 Descriptions of the individual authenticators are given in subsequent chapters.
45486 The remainder of this chapter covers the generic options for the
45487 authenticators, followed by general discussion of the way authentication works
45488 in Exim.
45489 </para>
45490 <section id="SECID168">
45491 <title>Generic options for authenticators</title>
45492 <para>
45493 <indexterm role="concept">
45494 <primary>authentication</primary>
45495 <secondary>generic options</secondary>
45496 </indexterm>
45497 <indexterm role="concept">
45498 <primary>options</primary>
45499 <secondary>generic; for authenticators</secondary>
45500 </indexterm>
45501 </para>
45502 <para>
45503 <indexterm role="option">
45504 <primary><option>client_condition</option></primary>
45505 </indexterm>
45506 </para>
45507 <informaltable frame="all">
45508 <tgroup cols="4" colsep="0" rowsep="0">
45509 <colspec colwidth="8*" align="left"/>
45510 <colspec colwidth="6*" align="center"/>
45511 <colspec colwidth="6*" align="center"/>
45512 <colspec colwidth="6*" align="right"/>
45513 <tbody>
45514 <row>
45515 <entry><option>client_condition</option></entry>
45516 <entry>Use: <emphasis>authenticators</emphasis></entry>
45517 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45518 <entry>Default: <emphasis>unset</emphasis></entry>
45519 </row>
45520 </tbody>
45521 </tgroup>
45522 </informaltable>
45523 <para>
45524 When Exim is authenticating as a client, it skips any authenticator whose
45525 <option>client_condition</option> expansion yields <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>. This can be
45526 used, for example, to skip plain text authenticators when the connection is not
45527 encrypted by a setting such as:
45528 </para>
45529 <literallayout class="monospaced">
45530 client_condition = ${if !eq{$tls_cipher}{}}
45531 </literallayout>
45532 <para>
45533 (Older documentation incorrectly states that <varname>$tls_cipher</varname> contains the cipher
45534 used for incoming messages. In fact, during SMTP delivery, it contains the
45535 cipher used for the delivery.)
45536 </para>
45537 <para>
45538 <indexterm role="option">
45539 <primary><option>driver</option></primary>
45540 </indexterm>
45541 </para>
45542 <informaltable frame="all">
45543 <tgroup cols="4" colsep="0" rowsep="0">
45544 <colspec colwidth="8*" align="left"/>
45545 <colspec colwidth="6*" align="center"/>
45546 <colspec colwidth="6*" align="center"/>
45547 <colspec colwidth="6*" align="right"/>
45548 <tbody>
45549 <row>
45550 <entry><option>driver</option></entry>
45551 <entry>Use: <emphasis>authenticators</emphasis></entry>
45552 <entry>Type: <emphasis>string</emphasis></entry>
45553 <entry>Default: <emphasis>unset</emphasis></entry>
45554 </row>
45555 </tbody>
45556 </tgroup>
45557 </informaltable>
45558 <para>
45559 This option must always be set. It specifies which of the available
45560 authenticators is to be used.
45561 </para>
45562 <para>
45563 <indexterm role="option">
45564 <primary><option>public_name</option></primary>
45565 </indexterm>
45566 </para>
45567 <informaltable frame="all">
45568 <tgroup cols="4" colsep="0" rowsep="0">
45569 <colspec colwidth="8*" align="left"/>
45570 <colspec colwidth="6*" align="center"/>
45571 <colspec colwidth="6*" align="center"/>
45572 <colspec colwidth="6*" align="right"/>
45573 <tbody>
45574 <row>
45575 <entry><option>public_name</option></entry>
45576 <entry>Use: <emphasis>authenticators</emphasis></entry>
45577 <entry>Type: <emphasis>string</emphasis></entry>
45578 <entry>Default: <emphasis>unset</emphasis></entry>
45579 </row>
45580 </tbody>
45581 </tgroup>
45582 </informaltable>
45583 <para>
45584 This option specifies the name of the authentication mechanism that the driver
45585 implements, and by which it is known to the outside world. These names should
45586 contain only upper case letters, digits, underscores, and hyphens (RFC 2222),
45587 but Exim in fact matches them caselessly. If <option>public_name</option> is not set, it
45588 defaults to the driver&#x2019;s instance name.
45589 </para>
45590 <para>
45591 <indexterm role="option">
45592 <primary><option>server_advertise_condition</option></primary>
45593 </indexterm>
45594 </para>
45595 <informaltable frame="all">
45596 <tgroup cols="4" colsep="0" rowsep="0">
45597 <colspec colwidth="8*" align="left"/>
45598 <colspec colwidth="6*" align="center"/>
45599 <colspec colwidth="6*" align="center"/>
45600 <colspec colwidth="6*" align="right"/>
45601 <tbody>
45602 <row>
45603 <entry><option>server_advertise_condition</option></entry>
45604 <entry>Use: <emphasis>authenticators</emphasis></entry>
45605 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45606 <entry>Default: <emphasis>unset</emphasis></entry>
45607 </row>
45608 </tbody>
45609 </tgroup>
45610 </informaltable>
45611 <para>
45612 When a server is about to advertise an authentication mechanism, the condition
45613 is expanded. If it yields the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the
45614 mechanism is not advertised.
45615 If the expansion fails, the mechanism is not advertised. If the failure was not
45616 forced, and was not caused by a lookup defer, the incident is logged.
45617 See section <xref linkend="SECTauthexiser"/> below for further discussion.
45618 </para>
45619 <para>
45620 <indexterm role="option">
45621 <primary><option>server_condition</option></primary>
45622 </indexterm>
45623 </para>
45624 <informaltable frame="all">
45625 <tgroup cols="4" colsep="0" rowsep="0">
45626 <colspec colwidth="8*" align="left"/>
45627 <colspec colwidth="6*" align="center"/>
45628 <colspec colwidth="6*" align="center"/>
45629 <colspec colwidth="6*" align="right"/>
45630 <tbody>
45631 <row>
45632 <entry><option>server_condition</option></entry>
45633 <entry>Use: <emphasis>authenticators</emphasis></entry>
45634 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45635 <entry>Default: <emphasis>unset</emphasis></entry>
45636 </row>
45637 </tbody>
45638 </tgroup>
45639 </informaltable>
45640 <para>
45641 This option must be set for a <option>plaintext</option> server authenticator, where it
45642 is used directly to control authentication. See section <xref linkend="SECTplainserver"/>
45643 for details.
45644 </para>
45645 <para>
45646 For the other authenticators, <option>server_condition</option> can be used as an additional
45647 authentication or authorization mechanism that is applied after the other
45648 authenticator conditions succeed. If it is set, it is expanded when the
45649 authenticator would otherwise return a success code. If the expansion is forced
45650 to fail, authentication fails. Any other expansion failure causes a temporary
45651 error code to be returned. If the result of a successful expansion is an empty
45652 string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
45653 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds. For any
45654 other result, a temporary error code is returned, with the expanded string as
45655 the error text.
45656 </para>
45657 <para>
45658 <indexterm role="option">
45659 <primary><option>server_debug_print</option></primary>
45660 </indexterm>
45661 </para>
45662 <informaltable frame="all">
45663 <tgroup cols="4" colsep="0" rowsep="0">
45664 <colspec colwidth="8*" align="left"/>
45665 <colspec colwidth="6*" align="center"/>
45666 <colspec colwidth="6*" align="center"/>
45667 <colspec colwidth="6*" align="right"/>
45668 <tbody>
45669 <row>
45670 <entry><option>server_debug_print</option></entry>
45671 <entry>Use: <emphasis>authenticators</emphasis></entry>
45672 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45673 <entry>Default: <emphasis>unset</emphasis></entry>
45674 </row>
45675 </tbody>
45676 </tgroup>
45677 </informaltable>
45678 <para>
45679 If this option is set and authentication debugging is enabled (see the <option>-d</option>
45680 command line option), the string is expanded and included in the debugging
45681 output when the authenticator is run as a server. This can help with checking
45682 out the values of variables.
45683 If expansion of the string fails, the error message is written to the debugging
45684 output, and Exim carries on processing.
45685 </para>
45686 <para>
45687 <indexterm role="option">
45688 <primary><option>server_set_id</option></primary>
45689 </indexterm>
45690 </para>
45691 <informaltable frame="all">
45692 <tgroup cols="4" colsep="0" rowsep="0">
45693 <colspec colwidth="8*" align="left"/>
45694 <colspec colwidth="6*" align="center"/>
45695 <colspec colwidth="6*" align="center"/>
45696 <colspec colwidth="6*" align="right"/>
45697 <tbody>
45698 <row>
45699 <entry><option>server_set_id</option></entry>
45700 <entry>Use: <emphasis>authenticators</emphasis></entry>
45701 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45702 <entry>Default: <emphasis>unset</emphasis></entry>
45703 </row>
45704 </tbody>
45705 </tgroup>
45706 </informaltable>
45707 <para>
45708 <indexterm role="variable">
45709 <primary><varname>$authenticated_id</varname></primary>
45710 </indexterm>
45711 When an Exim server successfully authenticates a client, this string is
45712 expanded using data from the authentication, and preserved for any incoming
45713 messages in the variable <varname>$authenticated_id</varname>. It is also included in the log
45714 lines for incoming messages. For example, a user/password authenticator
45715 configuration might preserve the user name that was used to authenticate, and
45716 refer to it subsequently during delivery of the message.
45717 If expansion fails, the option is ignored.
45718 </para>
45719 <para>
45720 <indexterm role="option">
45721 <primary><option>server_mail_auth_condition</option></primary>
45722 </indexterm>
45723 </para>
45724 <informaltable frame="all">
45725 <tgroup cols="4" colsep="0" rowsep="0">
45726 <colspec colwidth="8*" align="left"/>
45727 <colspec colwidth="6*" align="center"/>
45728 <colspec colwidth="6*" align="center"/>
45729 <colspec colwidth="6*" align="right"/>
45730 <tbody>
45731 <row>
45732 <entry><option>server_mail_auth_condition</option></entry>
45733 <entry>Use: <emphasis>authenticators</emphasis></entry>
45734 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45735 <entry>Default: <emphasis>unset</emphasis></entry>
45736 </row>
45737 </tbody>
45738 </tgroup>
45739 </informaltable>
45740 <para>
45741 This option allows a server to discard authenticated sender addresses supplied
45742 as part of MAIL commands in SMTP connections that are authenticated by the
45743 driver on which <option>server_mail_auth_condition</option> is set. The option is not used
45744 as part of the authentication process; instead its (unexpanded) value is
45745 remembered for later use.
45746 How it is used is described in the following section.
45747 </para>
45748 </section>
45749 <section id="SECTauthparamail">
45750 <title>The AUTH parameter on MAIL commands</title>
45751 <para>
45752 <indexterm role="concept">
45753 <primary>authentication</primary>
45754 <secondary>sender; authenticated</secondary>
45755 </indexterm>
45756 <indexterm role="concept">
45757 <primary>AUTH</primary>
45758 <secondary>on MAIL command</secondary>
45759 </indexterm>
45760 When a client supplied an AUTH= item on a MAIL command, Exim applies
45761 the following checks before accepting it as the authenticated sender of the
45762 message:
45763 </para>
45764 <itemizedlist>
45765 <listitem>
45766 <para>
45767 If the connection is not using extended SMTP (that is, HELO was used rather
45768 than EHLO), the use of AUTH= is a syntax error.
45769 </para>
45770 </listitem>
45771 <listitem>
45772 <para>
45773 If the value of the AUTH= parameter is <quote>&lt;&gt;</quote>, it is ignored.
45774 </para>
45775 </listitem>
45776 <listitem>
45777 <para>
45778 <indexterm role="variable">
45779 <primary><varname>$authenticated_sender</varname></primary>
45780 </indexterm>
45781 If <option>acl_smtp_mailauth</option> is defined, the ACL it specifies is run. While it is
45782 running, the value of <varname>$authenticated_sender</varname> is set to the value obtained
45783 from the AUTH= parameter. If the ACL does not yield <quote>accept</quote>, the value of
45784 <varname>$authenticated_sender</varname> is deleted. The <option>acl_smtp_mailauth</option> ACL may not
45785 return <quote>drop</quote> or <quote>discard</quote>. If it defers, a temporary error code (451) is
45786 given for the MAIL command.
45787 </para>
45788 </listitem>
45789 <listitem>
45790 <para>
45791 If <option>acl_smtp_mailauth</option> is not defined, the value of the AUTH= parameter
45792 is accepted and placed in <varname>$authenticated_sender</varname> only if the client has
45793 authenticated.
45794 </para>
45795 </listitem>
45796 <listitem>
45797 <para>
45798 If the AUTH= value was accepted by either of the two previous rules, and
45799 the client has authenticated, and the authenticator has a setting for the
45800 <option>server_mail_auth_condition</option>, the condition is checked at this point. The
45801 valued that was saved from the authenticator is expanded. If the expansion
45802 fails, or yields an empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the value of
45803 <varname>$authenticated_sender</varname> is deleted. If the expansion yields any other value,
45804 the value of <varname>$authenticated_sender</varname> is retained and passed on with the
45805 message.
45806 </para>
45807 </listitem>
45808 </itemizedlist>
45809 <para>
45810 When <varname>$authenticated_sender</varname> is set for a message, it is passed on to other
45811 hosts to which Exim authenticates as a client. Do not confuse this value with
45812 <varname>$authenticated_id</varname>, which is a string obtained from the authentication
45813 process, and which is not usually a complete email address.
45814 </para>
45815 <para>
45816 <indexterm role="variable">
45817 <primary><varname>$sender_address</varname></primary>
45818 </indexterm>
45819 Whenever an AUTH= value is ignored, the incident is logged. The ACL for
45820 MAIL, if defined, is run after AUTH= is accepted or ignored. It can
45821 therefore make use of <varname>$authenticated_sender</varname>. The converse is not true: the
45822 value of <varname>$sender_address</varname> is not yet set up when the <option>acl_smtp_mailauth</option>
45823 ACL is run.
45824 </para>
45825 </section>
45826 <section id="SECTauthexiser">
45827 <title>Authentication on an Exim server</title>
45828 <para>
45829 <indexterm role="concept">
45830 <primary>authentication</primary>
45831 <secondary>on an Exim server</secondary>
45832 </indexterm>
45833 When Exim receives an EHLO command, it advertises the public names of those
45834 authenticators that are configured as servers, subject to the following
45835 conditions:
45836 </para>
45837 <itemizedlist>
45838 <listitem>
45839 <para>
45840 The client host must match <option>auth_advertise_hosts</option> (default *).
45841 </para>
45842 </listitem>
45843 <listitem>
45844 <para>
45845 It the <option>server_advertise_condition</option> option is set, its expansion must not
45846 yield the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>.
45847 </para>
45848 </listitem>
45849 </itemizedlist>
45850 <para>
45851 The order in which the authenticators are defined controls the order in which
45852 the mechanisms are advertised.
45853 </para>
45854 <para>
45855 Some mail clients (for example, some versions of Netscape) require the user to
45856 provide a name and password for authentication whenever AUTH is advertised,
45857 even though authentication may not in fact be needed (for example, Exim may be
45858 set up to allow unconditional relaying from the client by an IP address check).
45859 You can make such clients more friendly by not advertising AUTH to them.
45860 For example, if clients on the 10.9.8.0/24 network are permitted (by the ACL
45861 that runs for RCPT) to relay without authentication, you should set
45862 </para>
45863 <literallayout class="monospaced">
45864 auth_advertise_hosts = ! 10.9.8.0/24
45865 </literallayout>
45866 <para>
45867 so that no authentication mechanisms are advertised to them.
45868 </para>
45869 <para>
45870 The <option>server_advertise_condition</option> controls the advertisement of individual
45871 authentication mechanisms. For example, it can be used to restrict the
45872 advertisement of a particular mechanism to encrypted connections, by a setting
45873 such as:
45874 </para>
45875 <literallayout class="monospaced">
45876 server_advertise_condition = ${if eq{$tls_cipher}{}{no}{yes}}
45877 </literallayout>
45878 <para>
45879 <indexterm role="variable">
45880 <primary><varname>$tls_cipher</varname></primary>
45881 </indexterm>
45882 If the session is encrypted, <varname>$tls_cipher</varname> is not empty, and so the expansion
45883 yields <quote>yes</quote>, which allows the advertisement to happen.
45884 </para>
45885 <para>
45886 When an Exim server receives an AUTH command from a client, it rejects it
45887 immediately if AUTH was not advertised in response to an earlier EHLO
45888 command. This is the case if
45889 </para>
45890 <itemizedlist>
45891 <listitem>
45892 <para>
45893 The client host does not match <option>auth_advertise_hosts</option>; or
45894 </para>
45895 </listitem>
45896 <listitem>
45897 <para>
45898 No authenticators are configured with server options; or
45899 </para>
45900 </listitem>
45901 <listitem>
45902 <para>
45903 Expansion of <option>server_advertise_condition</option> blocked the advertising of all the
45904 server authenticators.
45905 </para>
45906 </listitem>
45907 </itemizedlist>
45908 <para>
45909 Otherwise, Exim runs the ACL specified by <option>acl_smtp_auth</option> in order
45910 to decide whether to accept the command. If <option>acl_smtp_auth</option> is not set,
45911 AUTH is accepted from any client host.
45912 </para>
45913 <para>
45914 If AUTH is not rejected by the ACL, Exim searches its configuration for a
45915 server authentication mechanism that was advertised in response to EHLO and
45916 that matches the one named in the AUTH command. If it finds one, it runs
45917 the appropriate authentication protocol, and authentication either succeeds or
45918 fails. If there is no matching advertised mechanism, the AUTH command is
45919 rejected with a 504 error.
45920 </para>
45921 <para>
45922 <indexterm role="variable">
45923 <primary><varname>$received_protocol</varname></primary>
45924 </indexterm>
45925 <indexterm role="variable">
45926 <primary><varname>$sender_host_authenticated</varname></primary>
45927 </indexterm>
45928 When a message is received from an authenticated host, the value of
45929 <varname>$received_protocol</varname> is set to <quote>esmtpa</quote> or <quote>esmtpsa</quote> instead of <quote>esmtp</quote>
45930 or <quote>esmtps</quote>, and <varname>$sender_host_authenticated</varname> contains the name (not the
45931 public name) of the authenticator driver that successfully authenticated the
45932 client from which the message was received. This variable is empty if there was
45933 no successful authentication.
45934 </para>
45935 </section>
45936 <section id="SECID169">
45937 <title>Testing server authentication</title>
45938 <para>
45939 <indexterm role="concept">
45940 <primary>authentication</primary>
45941 <secondary>testing a server</secondary>
45942 </indexterm>
45943 <indexterm role="concept">
45944 <primary>AUTH</primary>
45945 <secondary>testing a server</secondary>
45946 </indexterm>
45947 <indexterm role="concept">
45948 <primary>base64 encoding</primary>
45949 <secondary>creating authentication test data</secondary>
45950 </indexterm>
45951 Exim&#x2019;s <option>-bh</option> option can be useful for testing server authentication
45952 configurations. The data for the AUTH command has to be sent using base64
45953 encoding. A quick way to produce such data for testing is the following Perl
45954 script:
45955 </para>
45956 <literallayout class="monospaced">
45957 use MIME::Base64;
45958 printf ("%s", encode_base64(eval "\"$ARGV[0]\""));
45959 </literallayout>
45960 <para>
45961 <indexterm role="concept">
45962 <primary>binary zero</primary>
45963 <secondary>in authentication data</secondary>
45964 </indexterm>
45965 This interprets its argument as a Perl string, and then encodes it. The
45966 interpretation as a Perl string allows binary zeros, which are required for
45967 some kinds of authentication, to be included in the data. For example, a
45968 command line to run this script on such data might be
45969 </para>
45970 <literallayout class="monospaced">
45971 encode '\0user\0password'
45972 </literallayout>
45973 <para>
45974 Note the use of single quotes to prevent the shell interpreting the
45975 backslashes, so that they can be interpreted by Perl to specify characters
45976 whose code value is zero.
45977 </para>
45978 <para>
45979 <emphasis role="bold">Warning 1</emphasis>: If either of the user or password strings starts with an octal
45980 digit, you must use three zeros instead of one after the leading backslash. If
45981 you do not, the octal digit that starts your string will be incorrectly
45982 interpreted as part of the code for the first character.
45983 </para>
45984 <para>
45985 <emphasis role="bold">Warning 2</emphasis>: If there are characters in the strings that Perl interprets
45986 specially, you must use a Perl escape to prevent them being misinterpreted. For
45987 example, a command such as
45988 </para>
45989 <literallayout class="monospaced">
45990 encode '\0user@domain.com\0pas$$word'
45991 </literallayout>
45992 <para>
45993 gives an incorrect answer because of the unescaped <quote>@</quote> and <quote>$</quote> characters.
45994 </para>
45995 <para>
45996 If you have the <option>mimencode</option> command installed, another way to do produce
45997 base64-encoded strings is to run the command
45998 </para>
45999 <literallayout class="monospaced">
46000 echo -e -n `\0user\0password' | mimencode
46001 </literallayout>
46002 <para>
46003 The <option>-e</option> option of <option>echo</option> enables the interpretation of backslash escapes
46004 in the argument, and the <option>-n</option> option specifies no newline at the end of its
46005 output. However, not all versions of <option>echo</option> recognize these options, so you
46006 should check your version before relying on this suggestion.
46007 </para>
46008 </section>
46009 <section id="SECID170">
46010 <title>Authentication by an Exim client</title>
46011 <para>
46012 <indexterm role="concept">
46013 <primary>authentication</primary>
46014 <secondary>on an Exim client</secondary>
46015 </indexterm>
46016 The <command>smtp</command> transport has two options called <option>hosts_require_auth</option> and
46017 <option>hosts_try_auth</option>. When the <command>smtp</command> transport connects to a server that
46018 announces support for authentication, and the host matches an entry in either
46019 of these options, Exim (as a client) tries to authenticate as follows:
46020 </para>
46021 <itemizedlist>
46022 <listitem>
46023 <para>
46024 For each authenticator that is configured as a client, in the order in which
46025 they are defined in the configuration, it searches the authentication
46026 mechanisms announced by the server for one whose name matches the public name
46027 of the authenticator.
46028 </para>
46029 </listitem>
46030 <listitem>
46031 <para>
46032 <indexterm role="variable">
46033 <primary><varname>$host</varname></primary>
46034 </indexterm>
46035 <indexterm role="variable">
46036 <primary><varname>$host_address</varname></primary>
46037 </indexterm>
46038 When it finds one that matches, it runs the authenticator&#x2019;s client code. The
46039 variables <varname>$host</varname> and <varname>$host_address</varname> are available for any string expansions
46040 that the client might do. They are set to the server&#x2019;s name and IP address. If
46041 any expansion is forced to fail, the authentication attempt is abandoned, and
46042 Exim moves on to the next authenticator. Otherwise an expansion failure causes
46043 delivery to be deferred.
46044 </para>
46045 </listitem>
46046 <listitem>
46047 <para>
46048 If the result of the authentication attempt is a temporary error or a timeout,
46049 Exim abandons trying to send the message to the host for the moment. It will
46050 try again later. If there are any backup hosts available, they are tried in the
46051 usual way.
46052 </para>
46053 </listitem>
46054 <listitem>
46055 <para>
46056 If the response to authentication is a permanent error (5<emphasis>xx</emphasis> code), Exim
46057 carries on searching the list of authenticators and tries another one if
46058 possible. If all authentication attempts give permanent errors, or if there are
46059 no attempts because no mechanisms match (or option expansions force failure),
46060 what happens depends on whether the host matches <option>hosts_require_auth</option> or
46061 <option>hosts_try_auth</option>. In the first case, a temporary error is generated, and
46062 delivery is deferred. The error can be detected in the retry rules, and thereby
46063 turned into a permanent error if you wish. In the second case, Exim tries to
46064 deliver the message unauthenticated.
46065 </para>
46066 </listitem>
46067 </itemizedlist>
46068 <para>
46069 <indexterm role="concept">
46070 <primary>AUTH</primary>
46071 <secondary>on MAIL command</secondary>
46072 </indexterm>
46073 When Exim has authenticated itself to a remote server, it adds the AUTH
46074 parameter to the MAIL commands it sends, if it has an authenticated sender for
46075 the message. If the message came from a remote host, the authenticated sender
46076 is the one that was receiving on an incoming MAIL command, provided that the
46077 incoming connection was authenticated and the <option>server_mail_auth</option> condition
46078 allowed the authenticated sender to be retained. If a local process calls Exim
46079 to send a message, the sender address that is built from the login name and
46080 <option>qualify_domain</option> is treated as authenticated. However, if the
46081 <option>authenticated_sender</option> option is set on the <command>smtp</command> transport, it overrides
46082 the authenticated sender that was received with the message.
46083 <indexterm role="concept" startref="IIDauthconf1" class="endofrange"/>
46084 <indexterm role="concept" startref="IIDauthconf2" class="endofrange"/>
46085 </para>
46086 </section>
46087 </chapter>
46088
46089 <chapter id="CHAPplaintext">
46090 <title>The plaintext authenticator</title>
46091 <para>
46092 <indexterm role="concept" id="IIDplaiauth1" class="startofrange">
46093 <primary><command>plaintext</command> authenticator</primary>
46094 </indexterm>
46095 <indexterm role="concept" id="IIDplaiauth2" class="startofrange">
46096 <primary>authenticators</primary>
46097 <secondary><command>plaintext</command></secondary>
46098 </indexterm>
46099 The <command>plaintext</command> authenticator can be configured to support the PLAIN and
46100 LOGIN authentication mechanisms, both of which transfer authentication data as
46101 plain (unencrypted) text (though base64 encoded). The use of plain text is a
46102 security risk; you are strongly advised to insist on the use of SMTP encryption
46103 (see chapter <xref linkend="CHAPTLS"/>) if you use the PLAIN or LOGIN mechanisms. If you do
46104 use unencrypted plain text, you should not use the same passwords for SMTP
46105 connections as you do for login accounts.
46106 </para>
46107 <section id="SECID171">
46108 <title>Plaintext options</title>
46109 <para>
46110 <indexterm role="concept">
46111 <primary>options</primary>
46112 <secondary><command>plaintext</command> authenticator (server)</secondary>
46113 </indexterm>
46114 When configured as a server, <command>plaintext</command> uses the following options:
46115 </para>
46116 <para>
46117 <indexterm role="option">
46118 <primary><option>server_condition</option></primary>
46119 </indexterm>
46120 </para>
46121 <informaltable frame="all">
46122 <tgroup cols="4" colsep="0" rowsep="0">
46123 <colspec colwidth="8*" align="left"/>
46124 <colspec colwidth="6*" align="center"/>
46125 <colspec colwidth="6*" align="center"/>
46126 <colspec colwidth="6*" align="right"/>
46127 <tbody>
46128 <row>
46129 <entry><option>server_condition</option></entry>
46130 <entry>Use: <emphasis>authenticators</emphasis></entry>
46131 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46132 <entry>Default: <emphasis>unset</emphasis></entry>
46133 </row>
46134 </tbody>
46135 </tgroup>
46136 </informaltable>
46137 <para>
46138 This is actually a global authentication option, but it must be set in order to
46139 configure the <command>plaintext</command> driver as a server. Its use is described below.
46140 </para>
46141 <para>
46142 <indexterm role="option">
46143 <primary><option>server_prompts</option></primary>
46144 </indexterm>
46145 </para>
46146 <informaltable frame="all">
46147 <tgroup cols="4" colsep="0" rowsep="0">
46148 <colspec colwidth="8*" align="left"/>
46149 <colspec colwidth="6*" align="center"/>
46150 <colspec colwidth="6*" align="center"/>
46151 <colspec colwidth="6*" align="right"/>
46152 <tbody>
46153 <row>
46154 <entry><option>server_prompts</option></entry>
46155 <entry>Use: <emphasis>plaintext</emphasis></entry>
46156 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46157 <entry>Default: <emphasis>unset</emphasis></entry>
46158 </row>
46159 </tbody>
46160 </tgroup>
46161 </informaltable>
46162 <para>
46163 The contents of this option, after expansion, must be a colon-separated list of
46164 prompt strings. If expansion fails, a temporary authentication rejection is
46165 given.
46166 </para>
46167 </section>
46168 <section id="SECTplainserver">
46169 <title>Using plaintext in a server</title>
46170 <para>
46171 <indexterm role="concept">
46172 <primary>AUTH</primary>
46173 <secondary>in <command>plaintext</command> authenticator</secondary>
46174 </indexterm>
46175 <indexterm role="concept">
46176 <primary>binary zero</primary>
46177 <secondary>in <command>plaintext</command> authenticator</secondary>
46178 </indexterm>
46179 <indexterm role="concept">
46180 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
46181 <secondary>in <command>plaintext</command> authenticator</secondary>
46182 </indexterm>
46183 <indexterm role="variable">
46184 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
46185 </indexterm>
46186 <indexterm role="concept">
46187 <primary>base64 encoding</primary>
46188 <secondary>in <command>plaintext</command> authenticator</secondary>
46189 </indexterm>
46190 </para>
46191 <para>
46192 When running as a server, <command>plaintext</command> performs the authentication test by
46193 expanding a string. The data sent by the client with the AUTH command, or in
46194 response to subsequent prompts, is base64 encoded, and so may contain any byte
46195 values when decoded. If any data is supplied with the command, it is treated as
46196 a list of strings, separated by NULs (binary zeros), the first three of which
46197 are placed in the expansion variables <varname>$auth1</varname>, <varname>$auth2</varname>, and <varname>$auth3</varname>
46198 (neither LOGIN nor PLAIN uses more than three strings).
46199 </para>
46200 <para>
46201 For compatibility with previous releases of Exim, the values are also placed in
46202 the expansion variables <varname>$1</varname>, <varname>$2</varname>, and <varname>$3</varname>. However, the use of these
46203 variables for this purpose is now deprecated, as it can lead to confusion in
46204 string expansions that also use them for other things.
46205 </para>
46206 <para>
46207 If there are more strings in <option>server_prompts</option> than the number of strings
46208 supplied with the AUTH command, the remaining prompts are used to obtain more
46209 data. Each response from the client may be a list of NUL-separated strings.
46210 </para>
46211 <para>
46212 <indexterm role="variable">
46213 <primary><varname>$authenticated_id</varname></primary>
46214 </indexterm>
46215 Once a sufficient number of data strings have been received,
46216 <option>server_condition</option> is expanded. If the expansion is forced to fail,
46217 authentication fails. Any other expansion failure causes a temporary error code
46218 to be returned. If the result of a successful expansion is an empty string,
46219 <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
46220 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds and the
46221 generic <option>server_set_id</option> option is expanded and saved in <varname>$authenticated_id</varname>.
46222 For any other result, a temporary error code is returned, with the expanded
46223 string as the error text.
46224 </para>
46225 <para>
46226 <emphasis role="bold">Warning</emphasis>: If you use a lookup in the expansion to find the user&#x2019;s
46227 password, be sure to make the authentication fail if the user is unknown.
46228 There are good and bad examples at the end of the next section.
46229 </para>
46230 </section>
46231 <section id="SECID172">
46232 <title>The PLAIN authentication mechanism</title>
46233 <para>
46234 <indexterm role="concept">
46235 <primary>PLAIN authentication mechanism</primary>
46236 </indexterm>
46237 <indexterm role="concept">
46238 <primary>authentication</primary>
46239 <secondary>PLAIN mechanism</secondary>
46240 </indexterm>
46241 <indexterm role="concept">
46242 <primary>binary zero</primary>
46243 <secondary>in <command>plaintext</command> authenticator</secondary>
46244 </indexterm>
46245 The PLAIN authentication mechanism (RFC 2595) specifies that three strings be
46246 sent as one item of data (that is, one combined string containing two NUL
46247 separators). The data is sent either as part of the AUTH command, or
46248 subsequently in response to an empty prompt from the server.
46249 </para>
46250 <para>
46251 The second and third strings are a user name and a corresponding password.
46252 Using a single fixed user name and password as an example, this could be
46253 configured as follows:
46254 </para>
46255 <literallayout class="monospaced">
46256 fixed_plain:
46257   driver = plaintext
46258   public_name = PLAIN
46259   server_prompts = :
46260   server_condition = \
46261     ${if and {{eq{$auth2}{username}}{eq{$auth3}{mysecret}}}}
46262   server_set_id = $auth2
46263 </literallayout>
46264 <para>
46265 Note that the default result strings from <option>if</option> (<quote>true</quote> or an empty string)
46266 are exactly what we want here, so they need not be specified. Obviously, if the
46267 password contains expansion-significant characters such as dollar, backslash,
46268 or closing brace, they have to be escaped.
46269 </para>
46270 <para>
46271 The <option>server_prompts</option> setting specifies a single, empty prompt (empty items at
46272 the end of a string list are ignored). If all the data comes as part of the
46273 AUTH command, as is commonly the case, the prompt is not used. This
46274 authenticator is advertised in the response to EHLO as
46275 </para>
46276 <literallayout class="monospaced">
46277 250-AUTH PLAIN
46278 </literallayout>
46279 <para>
46280 and a client host can authenticate itself by sending the command
46281 </para>
46282 <literallayout class="monospaced">
46283 AUTH PLAIN AHVzZXJuYW1lAG15c2VjcmV0
46284 </literallayout>
46285 <para>
46286 As this contains three strings (more than the number of prompts), no further
46287 data is required from the client. Alternatively, the client may just send
46288 </para>
46289 <literallayout class="monospaced">
46290 AUTH PLAIN
46291 </literallayout>
46292 <para>
46293 to initiate authentication, in which case the server replies with an empty
46294 prompt. The client must respond with the combined data string.
46295 </para>
46296 <para>
46297 The data string is base64 encoded, as required by the RFC. This example,
46298 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;
46299 represents a zero byte. This is split up into three strings, the first of which
46300 is empty. The <option>server_condition</option> option in the authenticator checks that the
46301 second two are <literal>username</literal> and <literal>mysecret</literal> respectively.
46302 </para>
46303 <para>
46304 Having just one fixed user name and password, as in this example, is not very
46305 realistic, though for a small organization with only a handful of
46306 authenticating clients it could make sense.
46307 </para>
46308 <para>
46309 A more sophisticated instance of this authenticator could use the user name in
46310 <varname>$auth2</varname> to look up a password in a file or database, and maybe do an encrypted
46311 comparison (see <option>crypteq</option> in chapter <xref linkend="CHAPexpand"/>). Here is a example of
46312 this approach, where the passwords are looked up in a DBM file. <emphasis role="bold">Warning</emphasis>:
46313 This is an incorrect example:
46314 </para>
46315 <literallayout class="monospaced">
46316 server_condition = \
46317   ${if eq{$auth3}{${lookup{$auth2}dbm{/etc/authpwd}}}}
46318 </literallayout>
46319 <para>
46320 The expansion uses the user name (<varname>$auth2</varname>) as the key to look up a password,
46321 which it then compares to the supplied password (<varname>$auth3</varname>). Why is this example
46322 incorrect? It works fine for existing users, but consider what happens if a
46323 non-existent user name is given. The lookup fails, but as no success/failure
46324 strings are given for the lookup, it yields an empty string. Thus, to defeat
46325 the authentication, all a client has to do is to supply a non-existent user
46326 name and an empty password. The correct way of writing this test is:
46327 </para>
46328 <literallayout class="monospaced">
46329 server_condition = ${lookup{$auth2}dbm{/etc/authpwd}\
46330   {${if eq{$value}{$auth3}}} {false}}
46331 </literallayout>
46332 <para>
46333 In this case, if the lookup succeeds, the result is checked; if the lookup
46334 fails, <quote>false</quote> is returned and authentication fails. If <option>crypteq</option> is being
46335 used instead of <option>eq</option>, the first example is in fact safe, because <option>crypteq</option>
46336 always fails if its second argument is empty. However, the second way of
46337 writing the test makes the logic clearer.
46338 </para>
46339 </section>
46340 <section id="SECID173">
46341 <title>The LOGIN authentication mechanism</title>
46342 <para>
46343 <indexterm role="concept">
46344 <primary>LOGIN authentication mechanism</primary>
46345 </indexterm>
46346 <indexterm role="concept">
46347 <primary>authentication</primary>
46348 <secondary>LOGIN mechanism</secondary>
46349 </indexterm>
46350 The LOGIN authentication mechanism is not documented in any RFC, but is in use
46351 in a number of programs. No data is sent with the AUTH command. Instead, a
46352 user name and password are supplied separately, in response to prompts. The
46353 plaintext authenticator can be configured to support this as in this example:
46354 </para>
46355 <literallayout class="monospaced">
46356 fixed_login:
46357   driver = plaintext
46358   public_name = LOGIN
46359   server_prompts = User Name : Password
46360   server_condition = \
46361     ${if and {{eq{$auth1}{username}}{eq{$auth2}{mysecret}}}}
46362   server_set_id = $auth1
46363 </literallayout>
46364 <para>
46365 Because of the way plaintext operates, this authenticator accepts data supplied
46366 with the AUTH command (in contravention of the specification of LOGIN), but
46367 if the client does not supply it (as is the case for LOGIN clients), the prompt
46368 strings are used to obtain two data items.
46369 </para>
46370 <para>
46371 Some clients are very particular about the precise text of the prompts. For
46372 example, Outlook Express is reported to recognize only <quote>Username:</quote> and
46373 <quote>Password:</quote>. Here is an example of a LOGIN authenticator that uses those
46374 strings. It uses the <option>ldapauth</option> expansion condition to check the user
46375 name and password by binding to an LDAP server:
46376 </para>
46377 <literallayout class="monospaced">
46378 login:
46379   driver = plaintext
46380   public_name = LOGIN
46381   server_prompts = Username:: : Password::
46382   server_condition = ${if and{{ \
46383     !eq{}{$auth1} }{ \
46384     ldapauth{user="cn=${quote_ldap_dn:$auth1},ou=people,o=example.org" \
46385              pass=${quote:$auth2} \
46386              ldap://ldap.example.org/} }} }
46387   server_set_id = uid=$auth1,ou=people,o=example.org
46388 </literallayout>
46389 <para>
46390 We have to check that the username is not empty before using it, because LDAP
46391 does not permit empty DN components. We must also use the <option>quote_ldap_dn</option>
46392 operator to correctly quote the DN for authentication. However, the basic
46393 <option>quote</option> operator, rather than any of the LDAP quoting operators, is the
46394 correct one to use for the password, because quoting is needed only to make
46395 the password conform to the Exim syntax. At the LDAP level, the password is an
46396 uninterpreted string.
46397 </para>
46398 </section>
46399 <section id="SECID174">
46400 <title>Support for different kinds of authentication</title>
46401 <para>
46402 A number of string expansion features are provided for the purpose of
46403 interfacing to different ways of user authentication. These include checking
46404 traditionally encrypted passwords from <filename>/etc/passwd</filename> (or equivalent), PAM,
46405 Radius, <option>ldapauth</option>, <emphasis>pwcheck</emphasis>, and <emphasis>saslauthd</emphasis>. For details see section
46406 <xref linkend="SECTexpcond"/>.
46407 </para>
46408 </section>
46409 <section id="SECID175">
46410 <title>Using plaintext in a client</title>
46411 <para>
46412 <indexterm role="concept">
46413 <primary>options</primary>
46414 <secondary><command>plaintext</command> authenticator (client)</secondary>
46415 </indexterm>
46416 The <command>plaintext</command> authenticator has two client options:
46417 </para>
46418 <para>
46419 <indexterm role="option">
46420 <primary><option>client_ignore_invalid_base64</option></primary>
46421 </indexterm>
46422 </para>
46423 <informaltable frame="all">
46424 <tgroup cols="4" colsep="0" rowsep="0">
46425 <colspec colwidth="8*" align="left"/>
46426 <colspec colwidth="6*" align="center"/>
46427 <colspec colwidth="6*" align="center"/>
46428 <colspec colwidth="6*" align="right"/>
46429 <tbody>
46430 <row>
46431 <entry><option>client_ignore_invalid_base64</option></entry>
46432 <entry>Use: <emphasis>plaintext</emphasis></entry>
46433 <entry>Type: <emphasis>boolean</emphasis></entry>
46434 <entry>Default: <emphasis>false</emphasis></entry>
46435 </row>
46436 </tbody>
46437 </tgroup>
46438 </informaltable>
46439 <para>
46440 If the client receives a server prompt that is not a valid base64 string,
46441 authentication is abandoned by default. However, if this option is set true,
46442 the error in the challenge is ignored and the client sends the response as
46443 usual.
46444 </para>
46445 <para>
46446 <indexterm role="option">
46447 <primary><option>client_send</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>client_send</option></entry>
46459 <entry>Use: <emphasis>plaintext</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 The string is a colon-separated list of authentication data strings. Each
46468 string is independently expanded before being sent to the server. The first
46469 string is sent with the AUTH command; any more strings are sent in response
46470 to prompts from the server. Before each string is expanded, the value of the
46471 most recent prompt is placed in the next <varname>$auth</varname>&lt;<emphasis>n</emphasis>&gt; variable, starting
46472 with <varname>$auth1</varname> for the first prompt. Up to three prompts are stored in this
46473 way. Thus, the prompt that is received in response to sending the first string
46474 (with the AUTH command) can be used in the expansion of the second string, and
46475 so on. If an invalid base64 string is received when
46476 <option>client_ignore_invalid_base64</option> is set, an empty string is put in the
46477 <varname>$auth</varname>&lt;<emphasis>n</emphasis>&gt; variable.
46478 </para>
46479 <para>
46480 <emphasis role="bold">Note</emphasis>: You cannot use expansion to create multiple strings, because
46481 splitting takes priority and happens first.
46482 </para>
46483 <para>
46484 Because the PLAIN authentication mechanism requires NUL (binary zero) bytes in
46485 the data, further processing is applied to each string before it is sent. If
46486 there are any single circumflex characters in the string, they are converted to
46487 NULs. Should an actual circumflex be required as data, it must be doubled in
46488 the string.
46489 </para>
46490 <para>
46491 This is an example of a client configuration that implements the PLAIN
46492 authentication mechanism with a fixed user name and password:
46493 </para>
46494 <literallayout class="monospaced">
46495 fixed_plain:
46496   driver = plaintext
46497   public_name = PLAIN
46498   client_send = ^username^mysecret
46499 </literallayout>
46500 <para>
46501 The lack of colons means that the entire text is sent with the AUTH
46502 command, with the circumflex characters converted to NULs. A similar example
46503 that uses the LOGIN mechanism is:
46504 </para>
46505 <literallayout class="monospaced">
46506 fixed_login:
46507   driver = plaintext
46508   public_name = LOGIN
46509   client_send = : username : mysecret
46510 </literallayout>
46511 <para>
46512 The initial colon means that the first string is empty, so no data is sent with
46513 the AUTH command itself. The remaining strings are sent in response to
46514 prompts.
46515 <indexterm role="concept" startref="IIDplaiauth1" class="endofrange"/>
46516 <indexterm role="concept" startref="IIDplaiauth2" class="endofrange"/>
46517 </para>
46518 </section>
46519 </chapter>
46520
46521 <chapter id="CHID9">
46522 <title>The cram_md5 authenticator</title>
46523 <para>
46524 <indexterm role="concept" id="IIDcramauth1" class="startofrange">
46525 <primary><command>cram_md5</command> authenticator</primary>
46526 </indexterm>
46527 <indexterm role="concept" id="IIDcramauth2" class="startofrange">
46528 <primary>authenticators</primary>
46529 <secondary><command>cram_md5</command></secondary>
46530 </indexterm>
46531 <indexterm role="concept">
46532 <primary>CRAM-MD5 authentication mechanism</primary>
46533 </indexterm>
46534 <indexterm role="concept">
46535 <primary>authentication</primary>
46536 <secondary>CRAM-MD5 mechanism</secondary>
46537 </indexterm>
46538 The CRAM-MD5 authentication mechanism is described in RFC 2195. The server
46539 sends a challenge string to the client, and the response consists of a user
46540 name and the CRAM-MD5 digest of the challenge string combined with a secret
46541 string (password) which is known to both server and client. Thus, the secret
46542 is not sent over the network as plain text, which makes this authenticator more
46543 secure than <command>plaintext</command>. However, the downside is that the secret has to be
46544 available in plain text at either end.
46545 </para>
46546 <section id="SECID176">
46547 <title>Using cram_md5 as a server</title>
46548 <para>
46549 <indexterm role="concept">
46550 <primary>options</primary>
46551 <secondary><command>cram_md5</command> authenticator (server)</secondary>
46552 </indexterm>
46553 This authenticator has one server option, which must be set to configure the
46554 authenticator as a server:
46555 </para>
46556 <para>
46557 <indexterm role="option">
46558 <primary><option>server_secret</option></primary>
46559 </indexterm>
46560 </para>
46561 <informaltable frame="all">
46562 <tgroup cols="4" colsep="0" rowsep="0">
46563 <colspec colwidth="8*" align="left"/>
46564 <colspec colwidth="6*" align="center"/>
46565 <colspec colwidth="6*" align="center"/>
46566 <colspec colwidth="6*" align="right"/>
46567 <tbody>
46568 <row>
46569 <entry><option>server_secret</option></entry>
46570 <entry>Use: <emphasis>cram_md5</emphasis></entry>
46571 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46572 <entry>Default: <emphasis>unset</emphasis></entry>
46573 </row>
46574 </tbody>
46575 </tgroup>
46576 </informaltable>
46577 <para>
46578 <indexterm role="concept">
46579 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
46580 <secondary>in <command>cram_md5</command> authenticator</secondary>
46581 </indexterm>
46582 When the server receives the client&#x2019;s response, the user name is placed in
46583 the expansion variable <varname>$auth1</varname>, and <option>server_secret</option> is expanded to
46584 obtain the password for that user. The server then computes the CRAM-MD5 digest
46585 that the client should have sent, and checks that it received the correct
46586 string. If the expansion of <option>server_secret</option> is forced to fail, authentication
46587 fails. If the expansion fails for some other reason, a temporary error code is
46588 returned to the client.
46589 </para>
46590 <para>
46591 For compatibility with previous releases of Exim, the user name is also placed
46592 in <varname>$1</varname>. However, the use of this variables for this purpose is now
46593 deprecated, as it can lead to confusion in string expansions that also use
46594 numeric variables for other things.
46595 </para>
46596 <para>
46597 For example, the following authenticator checks that the user name given by the
46598 client is <quote>ph10</quote>, and if so, uses <quote>secret</quote> as the password. For any other
46599 user name, authentication fails.
46600 </para>
46601 <literallayout class="monospaced">
46602 fixed_cram:
46603   driver = cram_md5
46604   public_name = CRAM-MD5
46605   server_secret = ${if eq{$auth1}{ph10}{secret}fail}
46606   server_set_id = $auth1
46607 </literallayout>
46608 <para>
46609 <indexterm role="variable">
46610 <primary><varname>$authenticated_id</varname></primary>
46611 </indexterm>
46612 If authentication succeeds, the setting of <option>server_set_id</option> preserves the user
46613 name in <varname>$authenticated_id</varname>. A more typical configuration might look up the
46614 secret string in a file, using the user name as the key. For example:
46615 </para>
46616 <literallayout class="monospaced">
46617 lookup_cram:
46618   driver = cram_md5
46619   public_name = CRAM-MD5
46620   server_secret = ${lookup{$auth1}lsearch{/etc/authpwd}\
46621                   {$value}fail}
46622   server_set_id = $auth1
46623 </literallayout>
46624 <para>
46625 Note that this expansion explicitly forces failure if the lookup fails
46626 because <varname>$auth1</varname> contains an unknown user name.
46627 </para>
46628 </section>
46629 <section id="SECID177">
46630 <title>Using cram_md5 as a client</title>
46631 <para>
46632 <indexterm role="concept">
46633 <primary>options</primary>
46634 <secondary><command>cram_md5</command> authenticator (client)</secondary>
46635 </indexterm>
46636 When used as a client, the <command>cram_md5</command> authenticator has two options:
46637 </para>
46638 <para>
46639 <indexterm role="option">
46640 <primary><option>client_name</option></primary>
46641 </indexterm>
46642 </para>
46643 <informaltable frame="all">
46644 <tgroup cols="4" colsep="0" rowsep="0">
46645 <colspec colwidth="8*" align="left"/>
46646 <colspec colwidth="6*" align="center"/>
46647 <colspec colwidth="6*" align="center"/>
46648 <colspec colwidth="6*" align="right"/>
46649 <tbody>
46650 <row>
46651 <entry><option>client_name</option></entry>
46652 <entry>Use: <emphasis>cram_md5</emphasis></entry>
46653 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46654 <entry>Default: <emphasis>the primary host name</emphasis></entry>
46655 </row>
46656 </tbody>
46657 </tgroup>
46658 </informaltable>
46659 <para>
46660 This string is expanded, and the result used as the user name data when
46661 computing the response to the server&#x2019;s challenge.
46662 </para>
46663 <para>
46664 <indexterm role="option">
46665 <primary><option>client_secret</option></primary>
46666 </indexterm>
46667 </para>
46668 <informaltable frame="all">
46669 <tgroup cols="4" colsep="0" rowsep="0">
46670 <colspec colwidth="8*" align="left"/>
46671 <colspec colwidth="6*" align="center"/>
46672 <colspec colwidth="6*" align="center"/>
46673 <colspec colwidth="6*" align="right"/>
46674 <tbody>
46675 <row>
46676 <entry><option>client_secret</option></entry>
46677 <entry>Use: <emphasis>cram_md5</emphasis></entry>
46678 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46679 <entry>Default: <emphasis>unset</emphasis></entry>
46680 </row>
46681 </tbody>
46682 </tgroup>
46683 </informaltable>
46684 <para>
46685 This option must be set for the authenticator to work as a client. Its value is
46686 expanded and the result used as the secret string when computing the response.
46687 </para>
46688 <para>
46689 <indexterm role="variable">
46690 <primary><varname>$host</varname></primary>
46691 </indexterm>
46692 <indexterm role="variable">
46693 <primary><varname>$host_address</varname></primary>
46694 </indexterm>
46695 Different user names and secrets can be used for different servers by referring
46696 to <varname>$host</varname> or <varname>$host_address</varname> in the options. Forced failure of either
46697 expansion string is treated as an indication that this authenticator is not
46698 prepared to handle this case. Exim moves on to the next configured client
46699 authenticator. Any other expansion failure causes Exim to give up trying to
46700 send the message to the current server.
46701 </para>
46702 <para>
46703 A simple example configuration of a <command>cram_md5</command> authenticator, using fixed
46704 strings, is:
46705 </para>
46706 <literallayout class="monospaced">
46707 fixed_cram:
46708   driver = cram_md5
46709   public_name = CRAM-MD5
46710   client_name = ph10
46711   client_secret = secret
46712 </literallayout>
46713 <para>
46714 <indexterm role="concept" startref="IIDcramauth1" class="endofrange"/>
46715 <indexterm role="concept" startref="IIDcramauth2" class="endofrange"/>
46716 </para>
46717 </section>
46718 </chapter>
46719
46720 <chapter id="CHID10">
46721 <title>The cyrus_sasl authenticator</title>
46722 <para>
46723 <indexterm role="concept" id="IIDcyrauth1" class="startofrange">
46724 <primary><command>cyrus_sasl</command> authenticator</primary>
46725 </indexterm>
46726 <indexterm role="concept" id="IIDcyrauth2" class="startofrange">
46727 <primary>authenticators</primary>
46728 <secondary><command>cyrus_sasl</command></secondary>
46729 </indexterm>
46730 <indexterm role="concept">
46731 <primary>Cyrus</primary>
46732 <secondary>SASL library</secondary>
46733 </indexterm>
46734 <indexterm role="concept">
46735 <primary>Kerberos</primary>
46736 </indexterm>
46737 The code for this authenticator was provided by Matthew Byng-Maddick of A L
46738 Digital Ltd (<emphasis role="bold"><ulink url="http://www.aldigital.co.uk">http://www.aldigital.co.uk</ulink></emphasis>).
46739 </para>
46740 <para>
46741 The <command>cyrus_sasl</command> authenticator provides server support for the Cyrus SASL
46742 library implementation of the RFC 2222 (<quote>Simple Authentication and Security
46743 Layer</quote>). This library supports a number of authentication mechanisms,
46744 including PLAIN and LOGIN, but also several others that Exim does not support
46745 directly. In particular, there is support for Kerberos authentication.
46746 </para>
46747 <para>
46748 The <command>cyrus_sasl</command> authenticator provides a gatewaying mechanism directly to
46749 the Cyrus interface, so if your Cyrus library can do, for example, CRAM-MD5,
46750 then so can the <command>cyrus_sasl</command> authenticator. By default it uses the public
46751 name of the driver to determine which mechanism to support.
46752 </para>
46753 <para>
46754 Where access to some kind of secret file is required, for example in GSSAPI
46755 or CRAM-MD5, it is worth noting that the authenticator runs as the Exim
46756 user, and that the Cyrus SASL library has no way of escalating privileges
46757 by default. You may also find you need to set environment variables,
46758 depending on the driver you are using.
46759 </para>
46760 <para>
46761 The application name provided by Exim is <quote>exim</quote>, so various SASL options may
46762 be set in <filename>exim.conf</filename> in your SASL directory. If you are using GSSAPI for
46763 Kerberos, note that because of limitations in the GSSAPI interface,
46764 changing the server keytab might need to be communicated down to the Kerberos
46765 layer independently. The mechanism for doing so is dependent upon the Kerberos
46766 implementation. For example, for Heimdal, the environment variable KRB5_KTNAME
46767 may be set to point to an alternative keytab file. Exim will pass this
46768 variable through from its own inherited environment when started as root or the
46769 Exim user. The keytab file needs to be readable by the Exim user.
46770 </para>
46771 <section id="SECID178">
46772 <title>Using cyrus_sasl as a server</title>
46773 <para>
46774 The <command>cyrus_sasl</command> authenticator has four private options. It puts the username
46775 (on a successful authentication) into <varname>$auth1</varname>. For compatibility with
46776 previous releases of Exim, the username is also placed in <varname>$1</varname>. However, the
46777 use of this variable for this purpose is now deprecated, as it can lead to
46778 confusion in string expansions that also use numeric variables for other
46779 things.
46780 </para>
46781 <para>
46782 <indexterm role="option">
46783 <primary><option>server_hostname</option></primary>
46784 </indexterm>
46785 </para>
46786 <informaltable frame="all">
46787 <tgroup cols="4" colsep="0" rowsep="0">
46788 <colspec colwidth="8*" align="left"/>
46789 <colspec colwidth="6*" align="center"/>
46790 <colspec colwidth="6*" align="center"/>
46791 <colspec colwidth="6*" align="right"/>
46792 <tbody>
46793 <row>
46794 <entry><option>server_hostname</option></entry>
46795 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
46796 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46797 <entry>Default: <emphasis>see below</emphasis></entry>
46798 </row>
46799 </tbody>
46800 </tgroup>
46801 </informaltable>
46802 <para>
46803 This option selects the hostname that is used when communicating with the
46804 library. The default value is <literal>$primary_hostname</literal>. It is up to the underlying
46805 SASL plug-in what it does with this data.
46806 </para>
46807 <para>
46808 <indexterm role="option">
46809 <primary><option>server_mech</option></primary>
46810 </indexterm>
46811 </para>
46812 <informaltable frame="all">
46813 <tgroup cols="4" colsep="0" rowsep="0">
46814 <colspec colwidth="8*" align="left"/>
46815 <colspec colwidth="6*" align="center"/>
46816 <colspec colwidth="6*" align="center"/>
46817 <colspec colwidth="6*" align="right"/>
46818 <tbody>
46819 <row>
46820 <entry><option>server_mech</option></entry>
46821 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
46822 <entry>Type: <emphasis>string</emphasis></entry>
46823 <entry>Default: <emphasis>see below</emphasis></entry>
46824 </row>
46825 </tbody>
46826 </tgroup>
46827 </informaltable>
46828 <para>
46829 This option selects the authentication mechanism this driver should use. The
46830 default is the value of the generic <option>public_name</option> option. This option allows
46831 you to use a different underlying mechanism from the advertised name. For
46832 example:
46833 </para>
46834 <literallayout class="monospaced">
46835 sasl:
46836   driver = cyrus_sasl
46837   public_name = X-ANYTHING
46838   server_mech = CRAM-MD5
46839   server_set_id = $auth1
46840 </literallayout>
46841 <para>
46842 <indexterm role="option">
46843 <primary><option>server_realm</option></primary>
46844 </indexterm>
46845 </para>
46846 <informaltable frame="all">
46847 <tgroup cols="4" colsep="0" rowsep="0">
46848 <colspec colwidth="8*" align="left"/>
46849 <colspec colwidth="6*" align="center"/>
46850 <colspec colwidth="6*" align="center"/>
46851 <colspec colwidth="6*" align="right"/>
46852 <tbody>
46853 <row>
46854 <entry><option>server_realm</option></entry>
46855 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
46856 <entry>Type: <emphasis>string</emphasis></entry>
46857 <entry>Default: <emphasis>unset</emphasis></entry>
46858 </row>
46859 </tbody>
46860 </tgroup>
46861 </informaltable>
46862 <para>
46863 This specifies the SASL realm that the server claims to be in.
46864 </para>
46865 <para>
46866 <indexterm role="option">
46867 <primary><option>server_service</option></primary>
46868 </indexterm>
46869 </para>
46870 <informaltable frame="all">
46871 <tgroup cols="4" colsep="0" rowsep="0">
46872 <colspec colwidth="8*" align="left"/>
46873 <colspec colwidth="6*" align="center"/>
46874 <colspec colwidth="6*" align="center"/>
46875 <colspec colwidth="6*" align="right"/>
46876 <tbody>
46877 <row>
46878 <entry><option>server_service</option></entry>
46879 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
46880 <entry>Type: <emphasis>string</emphasis></entry>
46881 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
46882 </row>
46883 </tbody>
46884 </tgroup>
46885 </informaltable>
46886 <para>
46887 This is the SASL service that the server claims to implement.
46888 </para>
46889 <para>
46890 For straightforward cases, you do not need to set any of the authenticator&#x2019;s
46891 private options. All you need to do is to specify an appropriate mechanism as
46892 the public name. Thus, if you have a SASL library that supports CRAM-MD5 and
46893 PLAIN, you could have two authenticators as follows:
46894 </para>
46895 <literallayout class="monospaced">
46896 sasl_cram_md5:
46897   driver = cyrus_sasl
46898   public_name = CRAM-MD5
46899   server_set_id = $auth1
46900
46901 sasl_plain:
46902   driver = cyrus_sasl
46903   public_name = PLAIN
46904   server_set_id = $auth2
46905 </literallayout>
46906 <para>
46907 Cyrus SASL does implement the LOGIN authentication method, even though it is
46908 not a standard method. It is disabled by default in the source distribution,
46909 but it is present in many binary distributions.
46910 <indexterm role="concept" startref="IIDcyrauth1" class="endofrange"/>
46911 <indexterm role="concept" startref="IIDcyrauth2" class="endofrange"/>
46912 </para>
46913 </section>
46914 </chapter>
46915
46916 <chapter id="CHAPdovecot">
46917 <title>The dovecot authenticator</title>
46918 <para>
46919 <indexterm role="concept" id="IIDdcotauth1" class="startofrange">
46920 <primary><command>dovecot</command> authenticator</primary>
46921 </indexterm>
46922 <indexterm role="concept" id="IIDdcotauth2" class="startofrange">
46923 <primary>authenticators</primary>
46924 <secondary><command>dovecot</command></secondary>
46925 </indexterm>
46926 This authenticator is an interface to the authentication facility of the
46927 Dovecot POP/IMAP server, which can support a number of authentication methods.
46928 If you are using Dovecot to authenticate POP/IMAP clients, it might be helpful
46929 to use the same mechanisms for SMTP authentication. This is a server
46930 authenticator only. There is only one option:
46931 </para>
46932 <para>
46933 <indexterm role="option">
46934 <primary><option>server_socket</option></primary>
46935 </indexterm>
46936 </para>
46937 <informaltable frame="all">
46938 <tgroup cols="4" colsep="0" rowsep="0">
46939 <colspec colwidth="8*" align="left"/>
46940 <colspec colwidth="6*" align="center"/>
46941 <colspec colwidth="6*" align="center"/>
46942 <colspec colwidth="6*" align="right"/>
46943 <tbody>
46944 <row>
46945 <entry><option>server_socket</option></entry>
46946 <entry>Use: <emphasis>dovecot</emphasis></entry>
46947 <entry>Type: <emphasis>string</emphasis></entry>
46948 <entry>Default: <emphasis>unset</emphasis></entry>
46949 </row>
46950 </tbody>
46951 </tgroup>
46952 </informaltable>
46953 <para>
46954 This option must specify the socket that is the interface to Dovecot
46955 authentication. The <option>public_name</option> option must specify an authentication
46956 mechanism that Dovecot is configured to support. You can have several
46957 authenticators for different mechanisms. For example:
46958 </para>
46959 <literallayout class="monospaced">
46960 dovecot_plain:
46961   driver = dovecot
46962   public_name = PLAIN
46963   server_socket = /var/run/dovecot/auth-client
46964   server_set_id = $auth2
46965
46966 dovecot_ntlm:
46967   driver = dovecot
46968   public_name = NTLM
46969   server_socket = /var/run/dovecot/auth-client
46970   server_set_id = $auth1
46971 </literallayout>
46972 <para>
46973 If the SMTP connection is encrypted, or if <varname>$sender_host_address</varname> is equal to
46974 <varname>$received_ip_address</varname> (that is, the connection is local), the <quote>secured</quote>
46975 option is passed in the Dovecot authentication command. If, for a TLS
46976 connection, a client certificate has been verified, the <quote>valid-client-cert</quote>
46977 option is passed. When authentication succeeds, the identity of the user
46978 who authenticated is placed in <varname>$auth1</varname>.
46979 <indexterm role="concept" startref="IIDdcotauth1" class="endofrange"/>
46980 <indexterm role="concept" startref="IIDdcotauth2" class="endofrange"/>
46981 </para>
46982 </chapter>
46983
46984 <chapter id="CHAPspa">
46985 <title>The spa authenticator</title>
46986 <para>
46987 <indexterm role="concept" id="IIDspaauth1" class="startofrange">
46988 <primary><command>spa</command> authenticator</primary>
46989 </indexterm>
46990 <indexterm role="concept" id="IIDspaauth2" class="startofrange">
46991 <primary>authenticators</primary>
46992 <secondary><command>spa</command></secondary>
46993 </indexterm>
46994 <indexterm role="concept">
46995 <primary>authentication</primary>
46996 <secondary>Microsoft Secure Password</secondary>
46997 </indexterm>
46998 <indexterm role="concept">
46999 <primary>authentication</primary>
47000 <secondary>NTLM</secondary>
47001 </indexterm>
47002 <indexterm role="concept">
47003 <primary>Microsoft Secure Password Authentication</primary>
47004 </indexterm>
47005 <indexterm role="concept">
47006 <primary>NTLM authentication</primary>
47007 </indexterm>
47008 The <command>spa</command> authenticator provides client support for Microsoft&#x2019;s <emphasis>Secure
47009 Password Authentication</emphasis> mechanism,
47010 which is also sometimes known as NTLM (NT LanMan). The code for client side of
47011 this authenticator was contributed by Marc Prud&#x2019;hommeaux, and much of it is
47012 taken from the Samba project (<emphasis role="bold"><ulink url="http://www.samba.org">http://www.samba.org</ulink></emphasis>). The code for the
47013 server side was subsequently contributed by Tom Kistner. The mechanism works as
47014 follows:
47015 </para>
47016 <itemizedlist>
47017 <listitem>
47018 <para>
47019 After the AUTH command has been accepted, the client sends an SPA
47020 authentication request based on the user name and optional domain.
47021 </para>
47022 </listitem>
47023 <listitem>
47024 <para>
47025 The server sends back a challenge.
47026 </para>
47027 </listitem>
47028 <listitem>
47029 <para>
47030 The client builds a challenge response which makes use of the user&#x2019;s password
47031 and sends it to the server, which then accepts or rejects it.
47032 </para>
47033 </listitem>
47034 </itemizedlist>
47035 <para>
47036 Encryption is used to protect the password in transit.
47037 </para>
47038 <section id="SECID179">
47039 <title>Using spa as a server</title>
47040 <para>
47041 <indexterm role="concept">
47042 <primary>options</primary>
47043 <secondary><command>spa</command> authenticator (server)</secondary>
47044 </indexterm>
47045 The <command>spa</command> authenticator has just one server option:
47046 </para>
47047 <para>
47048 <indexterm role="option">
47049 <primary><option>server_password</option></primary>
47050 </indexterm>
47051 </para>
47052 <informaltable frame="all">
47053 <tgroup cols="4" colsep="0" rowsep="0">
47054 <colspec colwidth="8*" align="left"/>
47055 <colspec colwidth="6*" align="center"/>
47056 <colspec colwidth="6*" align="center"/>
47057 <colspec colwidth="6*" align="right"/>
47058 <tbody>
47059 <row>
47060 <entry><option>server_password</option></entry>
47061 <entry>Use: <emphasis>spa</emphasis></entry>
47062 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47063 <entry>Default: <emphasis>unset</emphasis></entry>
47064 </row>
47065 </tbody>
47066 </tgroup>
47067 </informaltable>
47068 <para>
47069 <indexterm role="concept">
47070 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
47071 <secondary>in <command>spa</command> authenticator</secondary>
47072 </indexterm>
47073 This option is expanded, and the result must be the cleartext password for the
47074 authenticating user, whose name is at this point in <varname>$auth1</varname>. For
47075 compatibility with previous releases of Exim, the user name is also placed in
47076 <varname>$1</varname>. However, the use of this variable for this purpose is now deprecated, as
47077 it can lead to confusion in string expansions that also use numeric variables
47078 for other things. For example:
47079 </para>
47080 <literallayout class="monospaced">
47081 spa:
47082   driver = spa
47083   public_name = NTLM
47084   server_password = \
47085     ${lookup{$auth1}lsearch{/etc/exim/spa_clearpass}{$value}fail}
47086 </literallayout>
47087 <para>
47088 If the expansion is forced to fail, authentication fails. Any other expansion
47089 failure causes a temporary error code to be returned.
47090 </para>
47091 </section>
47092 <section id="SECID180">
47093 <title>Using spa as a client</title>
47094 <para>
47095 <indexterm role="concept">
47096 <primary>options</primary>
47097 <secondary><command>spa</command> authenticator (client)</secondary>
47098 </indexterm>
47099 The <command>spa</command> authenticator has the following client options:
47100 </para>
47101 <para>
47102 <indexterm role="option">
47103 <primary><option>client_domain</option></primary>
47104 </indexterm>
47105 </para>
47106 <informaltable frame="all">
47107 <tgroup cols="4" colsep="0" rowsep="0">
47108 <colspec colwidth="8*" align="left"/>
47109 <colspec colwidth="6*" align="center"/>
47110 <colspec colwidth="6*" align="center"/>
47111 <colspec colwidth="6*" align="right"/>
47112 <tbody>
47113 <row>
47114 <entry><option>client_domain</option></entry>
47115 <entry>Use: <emphasis>spa</emphasis></entry>
47116 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47117 <entry>Default: <emphasis>unset</emphasis></entry>
47118 </row>
47119 </tbody>
47120 </tgroup>
47121 </informaltable>
47122 <para>
47123 This option specifies an optional domain for the authentication.
47124 </para>
47125 <para>
47126 <indexterm role="option">
47127 <primary><option>client_password</option></primary>
47128 </indexterm>
47129 </para>
47130 <informaltable frame="all">
47131 <tgroup cols="4" colsep="0" rowsep="0">
47132 <colspec colwidth="8*" align="left"/>
47133 <colspec colwidth="6*" align="center"/>
47134 <colspec colwidth="6*" align="center"/>
47135 <colspec colwidth="6*" align="right"/>
47136 <tbody>
47137 <row>
47138 <entry><option>client_password</option></entry>
47139 <entry>Use: <emphasis>spa</emphasis></entry>
47140 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47141 <entry>Default: <emphasis>unset</emphasis></entry>
47142 </row>
47143 </tbody>
47144 </tgroup>
47145 </informaltable>
47146 <para>
47147 This option specifies the user&#x2019;s password, and must be set.
47148 </para>
47149 <para>
47150 <indexterm role="option">
47151 <primary><option>client_username</option></primary>
47152 </indexterm>
47153 </para>
47154 <informaltable frame="all">
47155 <tgroup cols="4" colsep="0" rowsep="0">
47156 <colspec colwidth="8*" align="left"/>
47157 <colspec colwidth="6*" align="center"/>
47158 <colspec colwidth="6*" align="center"/>
47159 <colspec colwidth="6*" align="right"/>
47160 <tbody>
47161 <row>
47162 <entry><option>client_username</option></entry>
47163 <entry>Use: <emphasis>spa</emphasis></entry>
47164 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47165 <entry>Default: <emphasis>unset</emphasis></entry>
47166 </row>
47167 </tbody>
47168 </tgroup>
47169 </informaltable>
47170 <para>
47171 This option specifies the user name, and must be set. Here is an example of a
47172 configuration of this authenticator for use with the mail servers at
47173 <emphasis>msn.com</emphasis>:
47174 </para>
47175 <literallayout class="monospaced">
47176 msn:
47177   driver = spa
47178   public_name = MSN
47179   client_username = msn/msn_username
47180   client_password = msn_plaintext_password
47181   client_domain = DOMAIN_OR_UNSET
47182 </literallayout>
47183 <para>
47184 <indexterm role="concept" startref="IIDspaauth1" class="endofrange"/>
47185 <indexterm role="concept" startref="IIDspaauth2" class="endofrange"/>
47186 </para>
47187 </section>
47188 </chapter>
47189
47190 <chapter id="CHAPTLS">
47191 <title>Encrypted SMTP connections using TLS/SSL</title>
47192 <titleabbrev>Encrypted SMTP connections</titleabbrev>
47193 <para>
47194 <indexterm role="concept" id="IIDencsmtp1" class="startofrange">
47195 <primary>encryption</primary>
47196 <secondary>on SMTP connection</secondary>
47197 </indexterm>
47198 <indexterm role="concept" id="IIDencsmtp2" class="startofrange">
47199 <primary>SMTP</primary>
47200 <secondary>encryption</secondary>
47201 </indexterm>
47202 <indexterm role="concept">
47203 <primary>TLS</primary>
47204 <secondary>on SMTP connection</secondary>
47205 </indexterm>
47206 <indexterm role="concept">
47207 <primary>OpenSSL</primary>
47208 </indexterm>
47209 <indexterm role="concept">
47210 <primary>GnuTLS</primary>
47211 </indexterm>
47212 Support for TLS (Transport Layer Security), formerly known as SSL (Secure
47213 Sockets Layer), is implemented by making use of the OpenSSL library or the
47214 GnuTLS library (Exim requires GnuTLS release 1.0 or later). There is no
47215 cryptographic code in the Exim distribution itself for implementing TLS. In
47216 order to use this feature you must install OpenSSL or GnuTLS, and then build a
47217 version of Exim that includes TLS support (see section <xref linkend="SECTinctlsssl"/>).
47218 You also need to understand the basic concepts of encryption at a managerial
47219 level, and in particular, the way that public keys, private keys, and
47220 certificates are used.
47221 </para>
47222 <para>
47223 RFC 3207 defines how SMTP connections can make use of encryption. Once a
47224 connection is established, the client issues a STARTTLS command. If the
47225 server accepts this, the client and the server negotiate an encryption
47226 mechanism. If the negotiation succeeds, the data that subsequently passes
47227 between them is encrypted.
47228 </para>
47229 <para>
47230 Exim&#x2019;s ACLs can detect whether the current SMTP session is encrypted or not,
47231 and if so, what cipher suite is in use, whether the client supplied a
47232 certificate, and whether or not that certificate was verified. This makes it
47233 possible for an Exim server to deny or accept certain commands based on the
47234 encryption state.
47235 </para>
47236 <para>
47237 <emphasis role="bold">Warning</emphasis>: Certain types of firewall and certain anti-virus products can
47238 disrupt TLS connections. You need to turn off SMTP scanning for these products
47239 in order to get TLS to work.
47240 </para>
47241 <section id="SECID284">
47242 <title>Support for the legacy <quote>ssmtp</quote> (aka <quote>smtps</quote>) protocol</title>
47243 <para>
47244 <indexterm role="concept">
47245 <primary>ssmtp protocol</primary>
47246 </indexterm>
47247 <indexterm role="concept">
47248 <primary>smtps protocol</primary>
47249 </indexterm>
47250 <indexterm role="concept">
47251 <primary>SMTP</primary>
47252 <secondary>ssmtp protocol</secondary>
47253 </indexterm>
47254 <indexterm role="concept">
47255 <primary>SMTP</primary>
47256 <secondary>smtps protocol</secondary>
47257 </indexterm>
47258 Early implementations of encrypted SMTP used a different TCP port from normal
47259 SMTP, and expected an encryption negotiation to start immediately, instead of
47260 waiting for a STARTTLS command from the client using the standard SMTP
47261 port. The protocol was called <quote>ssmtp</quote> or <quote>smtps</quote>, and port 465 was
47262 allocated for this purpose.
47263 </para>
47264 <para>
47265 This approach was abandoned when encrypted SMTP was standardized, but there are
47266 still some legacy clients that use it. Exim supports these clients by means of
47267 the <option>tls_on_connect_ports</option> global option. Its value must be a list of port
47268 numbers; the most common use is expected to be:
47269 </para>
47270 <literallayout class="monospaced">
47271 tls_on_connect_ports = 465
47272 </literallayout>
47273 <para>
47274 The port numbers specified by this option apply to all SMTP connections, both
47275 via the daemon and via <emphasis>inetd</emphasis>. You still need to specify all the ports that
47276 the daemon uses (by setting <option>daemon_smtp_ports</option> or <option>local_interfaces</option> or
47277 the <option>-oX</option> command line option) because <option>tls_on_connect_ports</option> does not add
47278 an extra port &ndash; rather, it specifies different behaviour on a port that is
47279 defined elsewhere.
47280 </para>
47281 <para>
47282 There is also a <option>-tls-on-connect</option> command line option. This overrides
47283 <option>tls_on_connect_ports</option>; it forces the legacy behaviour for all ports.
47284 </para>
47285 </section>
47286 <section id="SECTopenvsgnu">
47287 <title>OpenSSL vs GnuTLS</title>
47288 <para>
47289 <indexterm role="concept">
47290 <primary>TLS</primary>
47291 <secondary>OpenSSL <emphasis>vs</emphasis> GnuTLS</secondary>
47292 </indexterm>
47293 The first TLS support in Exim was implemented using OpenSSL. Support for GnuTLS
47294 followed later, when the first versions of GnuTLS were released. To build Exim
47295 to use GnuTLS, you need to set
47296 </para>
47297 <literallayout class="monospaced">
47298 USE_GNUTLS=yes
47299 </literallayout>
47300 <para>
47301 in Local/Makefile, in addition to
47302 </para>
47303 <literallayout class="monospaced">
47304 SUPPORT_TLS=yes
47305 </literallayout>
47306 <para>
47307 You must also set TLS_LIBS and TLS_INCLUDE appropriately, so that the
47308 include files and libraries for GnuTLS can be found.
47309 </para>
47310 <para>
47311 There are some differences in usage when using GnuTLS instead of OpenSSL:
47312 </para>
47313 <itemizedlist>
47314 <listitem>
47315 <para>
47316 The <option>tls_verify_certificates</option> option must contain the name of a file, not the
47317 name of a directory (for OpenSSL it can be either).
47318 </para>
47319 </listitem>
47320 <listitem>
47321 <para>
47322 The <option>tls_dhparam</option> option is ignored, because early versions of GnuTLS had no
47323 facility for varying its Diffie-Hellman parameters. I understand that this has
47324 changed, but Exim has not been updated to provide this facility.
47325 </para>
47326 </listitem>
47327 <listitem>
47328 <para>
47329 <indexterm role="variable">
47330 <primary><varname>$tls_peerdn</varname></primary>
47331 </indexterm>
47332 Distinguished Name (DN) strings reported by the OpenSSL library use a slash for
47333 separating fields; GnuTLS uses commas, in accordance with RFC 2253. This
47334 affects the value of the <varname>$tls_peerdn</varname> variable.
47335 </para>
47336 </listitem>
47337 <listitem>
47338 <para>
47339 OpenSSL identifies cipher suites using hyphens as separators, for example:
47340 DES-CBC3-SHA. GnuTLS uses underscores, for example: RSA_ARCFOUR_SHA. What is
47341 more, OpenSSL complains if underscores are present in a cipher list. To make
47342 life simpler, Exim changes underscores to hyphens for OpenSSL and hyphens to
47343 underscores for GnuTLS when processing lists of cipher suites in the
47344 <option>tls_require_ciphers</option> options (the global option and the <command>smtp</command> transport
47345 option).
47346 </para>
47347 </listitem>
47348 <listitem>
47349 <para>
47350 The <option>tls_require_ciphers</option> options operate differently, as described in the
47351 sections <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
47352 </para>
47353 </listitem>
47354 </itemizedlist>
47355 </section>
47356 <section id="SECID181">
47357 <title>GnuTLS parameter computation</title>
47358 <para>
47359 GnuTLS uses D-H parameters that may take a substantial amount of time
47360 to compute. It is unreasonable to re-compute them for every TLS session.
47361 Therefore, Exim keeps this data in a file in its spool directory, called
47362 <filename>gnutls-params</filename>. The file is owned by the Exim user and is readable only by
47363 its owner. Every Exim process that start up GnuTLS reads the D-H
47364 parameters from this file. If the file does not exist, the first Exim process
47365 that needs it computes the data and writes it to a temporary file which is
47366 renamed once it is complete. It does not matter if several Exim processes do
47367 this simultaneously (apart from wasting a few resources). Once a file is in
47368 place, new Exim processes immediately start using it.
47369 </para>
47370 <para>
47371 For maximum security, the parameters that are stored in this file should be
47372 recalculated periodically, the frequency depending on your paranoia level.
47373 Arranging this is easy in principle; just delete the file when you want new
47374 values to be computed. However, there may be a problem. The calculation of new
47375 parameters needs random numbers, and these are obtained from <filename>/dev/random</filename>.
47376 If the system is not very active, <filename>/dev/random</filename> may delay returning data
47377 until enough randomness (entropy) is available. This may cause Exim to hang for
47378 a substantial amount of time, causing timeouts on incoming connections.
47379 </para>
47380 <para>
47381 The solution is to generate the parameters externally to Exim. They are stored
47382 in <filename>gnutls-params</filename> in PEM format, which means that they can be generated
47383 externally using the <command>certtool</command> command that is part of GnuTLS.
47384 </para>
47385 <para>
47386 To replace the parameters with new ones, instead of deleting the file
47387 and letting Exim re-create it, you can generate new parameters using
47388 <command>certtool</command> and, when this has been done, replace Exim&#x2019;s cache file by
47389 renaming. The relevant commands are something like this:
47390 </para>
47391 <literallayout class="monospaced">
47392 # rm -f new-params
47393 # touch new-params
47394 # chown exim:exim new-params
47395 # chmod 0400 new-params
47396 # certtool --generate-privkey --bits 512 &gt;new-params
47397 # echo "" &gt;&gt;new-params
47398 # certtool --generate-dh-params --bits 1024 &gt;&gt; new-params
47399 # mv new-params gnutls-params
47400 </literallayout>
47401 <para>
47402 If Exim never has to generate the parameters itself, the possibility of
47403 stalling is removed.
47404 </para>
47405 </section>
47406 <section id="SECTreqciphssl">
47407 <title>Requiring specific ciphers in OpenSSL</title>
47408 <para>
47409 <indexterm role="concept">
47410 <primary>TLS</primary>
47411 <secondary>requiring specific ciphers (OpenSSL)</secondary>
47412 </indexterm>
47413 <indexterm role="option">
47414 <primary><option>tls_require_ciphers</option></primary>
47415 <secondary>OpenSSL</secondary>
47416 </indexterm>
47417 There is a function in the OpenSSL library that can be passed a list of cipher
47418 suites before the cipher negotiation takes place. This specifies which ciphers
47419 are acceptable. The list is colon separated and may contain names like
47420 DES-CBC3-SHA. Exim passes the expanded value of <option>tls_require_ciphers</option>
47421 directly to this function call. The following quotation from the OpenSSL
47422 documentation specifies what forms of item are allowed in the cipher string:
47423 </para>
47424 <itemizedlist>
47425 <listitem>
47426 <para>
47427 It can consist of a single cipher suite such as RC4-SHA.
47428 </para>
47429 </listitem>
47430 <listitem>
47431 <para>
47432 It can represent a list of cipher suites containing a certain algorithm,
47433 or cipher suites of a certain type. For example SHA1 represents all
47434 ciphers suites using the digest algorithm SHA1 and SSLv3 represents all
47435 SSL v3 algorithms.
47436 </para>
47437 </listitem>
47438 <listitem>
47439 <para>
47440 Lists of cipher suites can be combined in a single cipher string using
47441 the + character. This is used as a logical and operation. For example
47442 SHA1+DES represents all cipher suites containing the SHA1 and the DES
47443 algorithms.
47444 </para>
47445 </listitem>
47446 </itemizedlist>
47447 <para>
47448 Each cipher string can be optionally preceded by one of the characters <literal>!</literal>,
47449 <literal>-</literal> or <literal>+</literal>.
47450 </para>
47451 <itemizedlist>
47452 <listitem>
47453 <para>
47454 If <literal>!</literal> is used, the ciphers are permanently deleted from the list. The
47455 ciphers deleted can never reappear in the list even if they are explicitly
47456 stated.
47457 </para>
47458 </listitem>
47459 <listitem>
47460 <para>
47461 If <literal>-</literal> is used, the ciphers are deleted from the list, but some or all
47462 of the ciphers can be added again by later options.
47463 </para>
47464 </listitem>
47465 <listitem>
47466 <para>
47467 If <literal>+</literal> is used, the ciphers are moved to the end of the list. This
47468 option does not add any new ciphers; it just moves matching existing ones.
47469 </para>
47470 </listitem>
47471 </itemizedlist>
47472 <para>
47473 If none of these characters is present, the string is interpreted as
47474 a list of ciphers to be appended to the current preference list. If the list
47475 includes any ciphers already present they will be ignored: that is, they will
47476 not be moved to the end of the list.
47477 </para>
47478 </section>
47479 <section id="SECTreqciphgnu">
47480 <title>Requiring specific ciphers or other parameters in GnuTLS</title>
47481 <para>
47482 <indexterm role="concept">
47483 <primary>GnuTLS</primary>
47484 <secondary>specifying parameters for</secondary>
47485 </indexterm>
47486 <indexterm role="concept">
47487 <primary>TLS</primary>
47488 <secondary>specifying ciphers (GnuTLS)</secondary>
47489 </indexterm>
47490 <indexterm role="concept">
47491 <primary>TLS</primary>
47492 <secondary>specifying key exchange methods (GnuTLS)</secondary>
47493 </indexterm>
47494 <indexterm role="concept">
47495 <primary>TLS</primary>
47496 <secondary>specifying MAC algorithms (GnuTLS)</secondary>
47497 </indexterm>
47498 <indexterm role="concept">
47499 <primary>TLS</primary>
47500 <secondary>specifying protocols (GnuTLS)</secondary>
47501 </indexterm>
47502 <indexterm role="option">
47503 <primary><option>tls_require_ciphers</option></primary>
47504 <secondary>GnuTLS</secondary>
47505 </indexterm>
47506 The GnuTLS library allows the caller to specify separate lists of permitted key
47507 exchange methods, main cipher algorithms, MAC algorithms, and protocols.
47508 Unfortunately, these lists are numerical, and the library does not have a
47509 function for turning names into numbers. Consequently, lists of recognized
47510 names have to be built into the application. The permitted key exchange
47511 methods, ciphers, and MAC algorithms may be used in any combination to form a
47512 cipher suite. This is unlike OpenSSL, where complete cipher suite names are
47513 passed to its control function.
47514 </para>
47515 <para>
47516 For compatibility with OpenSSL, the <option>tls_require_ciphers</option> option can be set
47517 to complete cipher suite names such as RSA_ARCFOUR_SHA, but for GnuTLS this
47518 option controls only the cipher algorithms. Exim searches each item in the
47519 list for the name of an available algorithm. For example, if the list
47520 contains RSA_AES_SHA, then AES is recognized, and the behaviour is exactly
47521 the same as if just AES were given.
47522 </para>
47523 <para>
47524 <indexterm role="option">
47525 <primary><option>gnutls_require_kx</option></primary>
47526 </indexterm>
47527 <indexterm role="option">
47528 <primary><option>gnutls_require_mac</option></primary>
47529 </indexterm>
47530 <indexterm role="option">
47531 <primary><option>gnutls_require_protocols</option></primary>
47532 </indexterm>
47533 There are additional options called <option>gnutls_require_kx</option>,
47534 <option>gnutls_require_mac</option>, and <option>gnutls_require_protocols</option> that can be used to
47535 restrict the key exchange methods, MAC algorithms, and protocols, respectively.
47536 These options are ignored if OpenSSL is in use.
47537 </para>
47538 <para>
47539 All four options are available as global options, controlling how Exim
47540 behaves as a server, and also as options of the <command>smtp</command> transport, controlling
47541 how Exim behaves as a client. All the values are string expanded. After
47542 expansion, the values must be colon-separated lists, though the separator
47543 can be changed in the usual way.
47544 </para>
47545 <para>
47546 Each of the four lists starts out with a default set of algorithms. If the
47547 first item in a list does <emphasis>not</emphasis> start with an exclamation mark, all the
47548 default items are deleted. In this case, only those that are explicitly
47549 specified can be used. If the first item in a list <emphasis>does</emphasis> start with an
47550 exclamation mark, the defaults are left on the list.
47551 </para>
47552 <para>
47553 Then, any item that starts with an exclamation mark causes the relevant
47554 entry to be removed from the list, and any item that does not start with an
47555 exclamation mark causes a new entry to be added to the list. Unrecognized
47556 items in the list are ignored. Thus:
47557 </para>
47558 <literallayout class="monospaced">
47559 tls_require_ciphers = !ARCFOUR
47560 </literallayout>
47561 <para>
47562 allows all the defaults except ARCFOUR, whereas
47563 </para>
47564 <literallayout class="monospaced">
47565 tls_require_ciphers = AES : 3DES
47566 </literallayout>
47567 <para>
47568 allows only cipher suites that use AES or 3DES.
47569 </para>
47570 <para>
47571 For <option>tls_require_ciphers</option> the recognized names are AES_256, AES_128, AES
47572 (both of the preceding), 3DES, ARCFOUR_128, ARCFOUR_40, and ARCFOUR (both of
47573 the preceding). The default list does not contain all of these; it just has
47574 AES_256, AES_128, 3DES, and ARCFOUR_128.
47575 </para>
47576 <para>
47577 For <option>gnutls_require_kx</option>, the recognized names are DHE_RSA, RSA (which
47578 includes DHE_RSA), DHE_DSS, and DHE (which includes both DHE_RSA and
47579 DHE_DSS). The default list contains RSA, DHE_DSS, DHE_RSA.
47580 </para>
47581 <para>
47582 For <option>gnutls_require_mac</option>, the recognized names are SHA (synonym SHA1), and
47583 MD5. The default list contains SHA, MD5.
47584 </para>
47585 <para revisionflag="changed">
47586 For <option>gnutls_require_protocols</option>, the recognized names are TLS1.2, TLS1.1,
47587 TLS1.0, (TLS1) and SSL3.
47588 The default list contains TLS1.2, TLS1.1, TLS1.0, SSL3.
47589 TLS1 is an alias for TLS1.0, for backwards compatibility.
47590 For sufficiently old versions of the GnuTLS library, TLS1.2 or TLS1.1 might
47591 not be supported and will not be recognised by Exim.
47592 </para>
47593 <para>
47594 In a server, the order of items in these lists is unimportant. The server
47595 advertises the availability of all the relevant cipher suites. However, in a
47596 client, the order in the <option>tls_require_ciphers</option> list specifies a preference
47597 order for the cipher algorithms. The first one in the client&#x2019;s list that is
47598 also advertised by the server is tried first. The default order is as listed
47599 above.
47600 </para>
47601 </section>
47602 <section id="SECID182">
47603 <title>Configuring an Exim server to use TLS</title>
47604 <para>
47605 <indexterm role="concept">
47606 <primary>TLS</primary>
47607 <secondary>configuring an Exim server</secondary>
47608 </indexterm>
47609 When Exim has been built with TLS support, it advertises the availability of
47610 the STARTTLS command to client hosts that match <option>tls_advertise_hosts</option>,
47611 but not to any others. The default value of this option is unset, which means
47612 that STARTTLS is not advertised at all. This default is chosen because you
47613 need to set some other options in order to make TLS available, and also it is
47614 sensible for systems that want to use TLS only as a client.
47615 </para>
47616 <para>
47617 If a client issues a STARTTLS command and there is some configuration
47618 problem in the server, the command is rejected with a 454 error. If the client
47619 persists in trying to issue SMTP commands, all except QUIT are rejected
47620 with the error
47621 </para>
47622 <literallayout class="monospaced">
47623 554 Security failure
47624 </literallayout>
47625 <para>
47626 If a STARTTLS command is issued within an existing TLS session, it is
47627 rejected with a 554 error code.
47628 </para>
47629 <para>
47630 To enable TLS operations on a server, you must set <option>tls_advertise_hosts</option> to
47631 match some hosts. You can, of course, set it to * to match all hosts.
47632 However, this is not all you need to do. TLS sessions to a server won&#x2019;t work
47633 without some further configuration at the server end.
47634 </para>
47635 <para>
47636 It is rumoured that all existing clients that support TLS/SSL use RSA
47637 encryption. To make this work you need to set, in the server,
47638 </para>
47639 <literallayout class="monospaced">
47640 tls_certificate = /some/file/name
47641 tls_privatekey = /some/file/name
47642 </literallayout>
47643 <para>
47644 These options are, in fact, expanded strings, so you can make them depend on
47645 the identity of the client that is connected if you wish. The first file
47646 contains the server&#x2019;s X509 certificate, and the second contains the private key
47647 that goes with it. These files need to be readable by the Exim user, and must
47648 always be given as full path names. They can be the same file if both the
47649 certificate and the key are contained within it. If <option>tls_privatekey</option> is not
47650 set, or if its expansion is forced to fail or results in an empty string, this
47651 is assumed to be the case. The certificate file may also contain intermediate
47652 certificates that need to be sent to the client to enable it to authenticate
47653 the server&#x2019;s certificate.
47654 </para>
47655 <para>
47656 If you do not understand about certificates and keys, please try to find a
47657 source of this background information, which is not Exim-specific. (There are a
47658 few comments below in section <xref linkend="SECTcerandall"/>.)
47659 </para>
47660 <para>
47661 <emphasis role="bold">Note</emphasis>: These options do not apply when Exim is operating as a client &ndash;
47662 they apply only in the case of a server. If you need to use a certificate in an
47663 Exim client, you must set the options of the same names in an <command>smtp</command>
47664 transport.
47665 </para>
47666 <para>
47667 With just these options, an Exim server will be able to use TLS. It does not
47668 require the client to have a certificate (but see below for how to insist on
47669 this). There is one other option that may be needed in other situations. If
47670 </para>
47671 <literallayout class="monospaced">
47672 tls_dhparam = /some/file/name
47673 </literallayout>
47674 <para>
47675 is set, the SSL library is initialized for the use of Diffie-Hellman ciphers
47676 with the parameters contained in the file. This increases the set of cipher
47677 suites that the server supports. See the command
47678 </para>
47679 <literallayout class="monospaced">
47680 openssl dhparam
47681 </literallayout>
47682 <para>
47683 for a way of generating this data. At present, <option>tls_dhparam</option> is used only
47684 when Exim is linked with OpenSSL. It is ignored if GnuTLS is being used.
47685 </para>
47686 <para>
47687 The strings supplied for these three options are expanded every time a client
47688 host connects. It is therefore possible to use different certificates and keys
47689 for different hosts, if you so wish, by making use of the client&#x2019;s IP address
47690 in <varname>$sender_host_address</varname> to control the expansion. If a string expansion is
47691 forced to fail, Exim behaves as if the option is not set.
47692 </para>
47693 <para>
47694 <indexterm role="concept">
47695 <primary>cipher</primary>
47696 <secondary>logging</secondary>
47697 </indexterm>
47698 <indexterm role="concept">
47699 <primary>log</primary>
47700 <secondary>TLS cipher</secondary>
47701 </indexterm>
47702 <indexterm role="variable">
47703 <primary><varname>$tls_cipher</varname></primary>
47704 </indexterm>
47705 The variable <varname>$tls_cipher</varname> is set to the cipher suite that was negotiated for
47706 an incoming TLS connection. It is included in the <emphasis>Received:</emphasis> header of an
47707 incoming message (by default &ndash; you can, of course, change this), and it is
47708 also included in the log line that records a message&#x2019;s arrival, keyed by
47709 <quote>X=</quote>, unless the <option>tls_cipher</option> log selector is turned off. The <option>encrypted</option>
47710 condition can be used to test for specific cipher suites in ACLs.
47711 (For outgoing SMTP deliveries, <varname>$tls_cipher</varname> is reset &ndash; see section
47712 <xref linkend="SECID185"/>.)
47713 </para>
47714 <para>
47715 Once TLS has been established, the ACLs that run for subsequent SMTP commands
47716 can check the name of the cipher suite and vary their actions accordingly. The
47717 cipher suite names vary, depending on which TLS library is being used. For
47718 example, OpenSSL uses the name DES-CBC3-SHA for the cipher suite which in other
47719 contexts is known as TLS_RSA_WITH_3DES_EDE_CBC_SHA. Check the OpenSSL or GnuTLS
47720 documentation for more details.
47721 </para>
47722 </section>
47723 <section id="SECID183">
47724 <title>Requesting and verifying client certificates</title>
47725 <para>
47726 <indexterm role="concept">
47727 <primary>certificate</primary>
47728 <secondary>verification of client</secondary>
47729 </indexterm>
47730 <indexterm role="concept">
47731 <primary>TLS</primary>
47732 <secondary>client certificate verification</secondary>
47733 </indexterm>
47734 If you want an Exim server to request a certificate when negotiating a TLS
47735 session with a client, you must set either <option>tls_verify_hosts</option> or
47736 <option>tls_try_verify_hosts</option>. You can, of course, set either of them to * to
47737 apply to all TLS connections. For any host that matches one of these options,
47738 Exim requests a certificate as part of the setup of the TLS session. The
47739 contents of the certificate are verified by comparing it with a list of
47740 expected certificates. These must be available in a file or,
47741 for OpenSSL only (not GnuTLS), a directory, identified by
47742 <option>tls_verify_certificates</option>.
47743 </para>
47744 <para>
47745 A file can contain multiple certificates, concatenated end to end. If a
47746 directory is used
47747 (OpenSSL only),
47748 each certificate must be in a separate file, with a name (or a symbolic link)
47749 of the form &lt;<emphasis>hash</emphasis>&gt;.0, where &lt;<emphasis>hash</emphasis>&gt; is a hash value constructed from the
47750 certificate. You can compute the relevant hash by running the command
47751 </para>
47752 <literallayout class="monospaced">
47753 openssl x509 -hash -noout -in /cert/file
47754 </literallayout>
47755 <para>
47756 where <filename>/cert/file</filename> contains a single certificate.
47757 </para>
47758 <para>
47759 The difference between <option>tls_verify_hosts</option> and <option>tls_try_verify_hosts</option> is
47760 what happens if the client does not supply a certificate, or if the certificate
47761 does not match any of the certificates in the collection named by
47762 <option>tls_verify_certificates</option>. If the client matches <option>tls_verify_hosts</option>, the
47763 attempt to set up a TLS session is aborted, and the incoming connection is
47764 dropped. If the client matches <option>tls_try_verify_hosts</option>, the (encrypted) SMTP
47765 session continues. ACLs that run for subsequent SMTP commands can detect the
47766 fact that no certificate was verified, and vary their actions accordingly. For
47767 example, you can insist on a certificate before accepting a message for
47768 relaying, but not when the message is destined for local delivery.
47769 </para>
47770 <para>
47771 <indexterm role="variable">
47772 <primary><varname>$tls_peerdn</varname></primary>
47773 </indexterm>
47774 When a client supplies a certificate (whether it verifies or not), the value of
47775 the Distinguished Name of the certificate is made available in the variable
47776 <varname>$tls_peerdn</varname> during subsequent processing of the message.
47777 </para>
47778 <para>
47779 <indexterm role="concept">
47780 <primary>log</primary>
47781 <secondary>distinguished name</secondary>
47782 </indexterm>
47783 Because it is often a long text string, it is not included in the log line or
47784 <emphasis>Received:</emphasis> header by default. You can arrange for it to be logged, keyed by
47785 <quote>DN=</quote>, by setting the <option>tls_peerdn</option> log selector, and you can use
47786 <option>received_header_text</option> to change the <emphasis>Received:</emphasis> header. When no
47787 certificate is supplied, <varname>$tls_peerdn</varname> is empty.
47788 </para>
47789 </section>
47790 <section id="SECID184">
47791 <title>Revoked certificates</title>
47792 <para>
47793 <indexterm role="concept">
47794 <primary>TLS</primary>
47795 <secondary>revoked certificates</secondary>
47796 </indexterm>
47797 <indexterm role="concept">
47798 <primary>revocation list</primary>
47799 </indexterm>
47800 <indexterm role="concept">
47801 <primary>certificate</primary>
47802 <secondary>revocation list</secondary>
47803 </indexterm>
47804 Certificate issuing authorities issue Certificate Revocation Lists (CRLs) when
47805 certificates are revoked. If you have such a list, you can pass it to an Exim
47806 server using the global option called <option>tls_crl</option> and to an Exim client using
47807 an identically named option for the <command>smtp</command> transport. In each case, the value
47808 of the option is expanded and must then be the name of a file that contains a
47809 CRL in PEM format.
47810 </para>
47811 </section>
47812 <section id="SECID185">
47813 <title>Configuring an Exim client to use TLS</title>
47814 <para>
47815 <indexterm role="concept">
47816 <primary>cipher</primary>
47817 <secondary>logging</secondary>
47818 </indexterm>
47819 <indexterm role="concept">
47820 <primary>log</primary>
47821 <secondary>TLS cipher</secondary>
47822 </indexterm>
47823 <indexterm role="concept">
47824 <primary>log</primary>
47825 <secondary>distinguished name</secondary>
47826 </indexterm>
47827 <indexterm role="concept">
47828 <primary>TLS</primary>
47829 <secondary>configuring an Exim client</secondary>
47830 </indexterm>
47831 The <option>tls_cipher</option> and <option>tls_peerdn</option> log selectors apply to outgoing SMTP
47832 deliveries as well as to incoming, the latter one causing logging of the
47833 server certificate&#x2019;s DN. The remaining client configuration for TLS is all
47834 within the <command>smtp</command> transport.
47835 </para>
47836 <para>
47837 It is not necessary to set any options to have TLS work in the <command>smtp</command>
47838 transport. If Exim is built with TLS support, and TLS is advertised by a
47839 server, the <command>smtp</command> transport always tries to start a TLS session. However,
47840 this can be prevented by setting <option>hosts_avoid_tls</option> (an option of the
47841 transport) to a list of server hosts for which TLS should not be used.
47842 </para>
47843 <para>
47844 If you do not want Exim to attempt to send messages unencrypted when an attempt
47845 to set up an encrypted connection fails in any way, you can set
47846 <option>hosts_require_tls</option> to a list of hosts for which encryption is mandatory. For
47847 those hosts, delivery is always deferred if an encrypted connection cannot be
47848 set up. If there are any other hosts for the address, they are tried in the
47849 usual way.
47850 </para>
47851 <para>
47852 When the server host is not in <option>hosts_require_tls</option>, Exim may try to deliver
47853 the message unencrypted. It always does this if the response to STARTTLS is
47854 a 5<emphasis>xx</emphasis> code. For a temporary error code, or for a failure to negotiate a TLS
47855 session after a success response code, what happens is controlled by the
47856 <option>tls_tempfail_tryclear</option> option of the <command>smtp</command> transport. If it is false,
47857 delivery to this host is deferred, and other hosts (if available) are tried. If
47858 it is true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis> response to
47859 STARTTLS, and if STARTTLS is accepted, but the subsequent TLS
47860 negotiation fails, Exim closes the current connection (because it is in an
47861 unknown state), opens a new one to the same host, and then tries the delivery
47862 unencrypted.
47863 </para>
47864 <para>
47865 The <option>tls_certificate</option> and <option>tls_privatekey</option> options of the <command>smtp</command>
47866 transport provide the client with a certificate, which is passed to the server
47867 if it requests it. If the server is Exim, it will request a certificate only if
47868 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> matches the client.
47869 </para>
47870 <para>
47871 If the <option>tls_verify_certificates</option> option is set on the <command>smtp</command> transport, it
47872 must name a file or,
47873 for OpenSSL only (not GnuTLS), a directory, that contains a collection of
47874 expected server certificates. The client verifies the server&#x2019;s certificate
47875 against this collection, taking into account any revoked certificates that are
47876 in the list defined by <option>tls_crl</option>.
47877 </para>
47878 <para>
47879 If
47880 <option>tls_require_ciphers</option> is set on the <command>smtp</command> transport, it must contain a
47881 list of permitted cipher suites. If either of these checks fails, delivery to
47882 the current host is abandoned, and the <command>smtp</command> transport tries to deliver to
47883 alternative hosts, if any.
47884 </para>
47885 <para>
47886  <emphasis role="bold">Note</emphasis>:
47887 These options must be set in the <command>smtp</command> transport for Exim to use TLS when it
47888 is operating as a client. Exim does not assume that a server certificate (set
47889 by the global options of the same name) should also be used when operating as a
47890 client.
47891 </para>
47892 <para>
47893 <indexterm role="variable">
47894 <primary><varname>$host</varname></primary>
47895 </indexterm>
47896 <indexterm role="variable">
47897 <primary><varname>$host_address</varname></primary>
47898 </indexterm>
47899 All the TLS options in the <command>smtp</command> transport are expanded before use, with
47900 <varname>$host</varname> and <varname>$host_address</varname> containing the name and address of the server to
47901 which the client is connected. Forced failure of an expansion causes Exim to
47902 behave as if the relevant option were unset.
47903 </para>
47904 <para>
47905 <indexterm role="variable">
47906 <primary><varname>$tls_cipher</varname></primary>
47907 </indexterm>
47908 <indexterm role="variable">
47909 <primary><varname>$tls_peerdn</varname></primary>
47910 </indexterm>
47911 Before an SMTP connection is established, the <varname>$tls_cipher</varname> and <varname>$tls_peerdn</varname>
47912 variables are emptied. (Until the first connection, they contain the values
47913 that were set when the message was received.) If STARTTLS is subsequently
47914 successfully obeyed, these variables are set to the relevant values for the
47915 outgoing connection.
47916 </para>
47917 </section>
47918 <section id="SECTmulmessam">
47919 <title>Multiple messages on the same encrypted TCP/IP connection</title>
47920 <para>
47921 <indexterm role="concept">
47922 <primary>multiple SMTP deliveries with TLS</primary>
47923 </indexterm>
47924 <indexterm role="concept">
47925 <primary>TLS</primary>
47926 <secondary>multiple message deliveries</secondary>
47927 </indexterm>
47928 Exim sends multiple messages down the same TCP/IP connection by starting up
47929 an entirely new delivery process for each message, passing the socket from
47930 one process to the next. This implementation does not fit well with the use
47931 of TLS, because there is quite a lot of state information associated with a TLS
47932 connection, not just a socket identification. Passing all the state information
47933 to a new process is not feasible. Consequently, Exim shuts down an existing TLS
47934 session before passing the socket to a new process. The new process may then
47935 try to start a new TLS session, and if successful, may try to re-authenticate
47936 if AUTH is in use, before sending the next message.
47937 </para>
47938 <para>
47939 The RFC is not clear as to whether or not an SMTP session continues in clear
47940 after TLS has been shut down, or whether TLS may be restarted again later, as
47941 just described. However, if the server is Exim, this shutdown and
47942 reinitialization works. It is not known which (if any) other servers operate
47943 successfully if the client closes a TLS session and continues with unencrypted
47944 SMTP, but there are certainly some that do not work. For such servers, Exim
47945 should not pass the socket to another process, because the failure of the
47946 subsequent attempt to use it would cause Exim to record a temporary host error,
47947 and delay other deliveries to that host.
47948 </para>
47949 <para>
47950 To test for this case, Exim sends an EHLO command to the server after
47951 closing down the TLS session. If this fails in any way, the connection is
47952 closed instead of being passed to a new delivery process, but no retry
47953 information is recorded.
47954 </para>
47955 <para>
47956 There is also a manual override; you can set <option>hosts_nopass_tls</option> on the
47957 <command>smtp</command> transport to match those hosts for which Exim should not pass
47958 connections to new processes if TLS has been used.
47959 </para>
47960 </section>
47961 <section id="SECTcerandall">
47962 <title>Certificates and all that</title>
47963 <para>
47964 <indexterm role="concept">
47965 <primary>certificate</primary>
47966 <secondary>references to discussion</secondary>
47967 </indexterm>
47968 In order to understand fully how TLS works, you need to know about
47969 certificates, certificate signing, and certificate authorities. This is not the
47970 place to give a tutorial, especially as I do not know very much about it
47971 myself. Some helpful introduction can be found in the FAQ for the SSL addition
47972 to Apache, currently at
47973 </para>
47974 <literallayout>
47975 <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>
47976 </literallayout>
47977 <para>
47978 Other parts of the <emphasis>modssl</emphasis> documentation are also helpful, and have
47979 links to further files.
47980 Eric Rescorla&#x2019;s book, <emphasis>SSL and TLS</emphasis>, published by Addison-Wesley (ISBN
47981 0-201-61598-3), contains both introductory and more in-depth descriptions.
47982 Some sample programs taken from the book are available from
47983 </para>
47984 <literallayout>
47985 <emphasis role="bold"><ulink url="http://www.rtfm.com/openssl-examples/">http://www.rtfm.com/openssl-examples/</ulink></emphasis>
47986 </literallayout>
47987 </section>
47988 <section id="SECID186">
47989 <title>Certificate chains</title>
47990 <para>
47991 The file named by <option>tls_certificate</option> may contain more than one
47992 certificate. This is useful in the case where the certificate that is being
47993 sent is validated by an intermediate certificate which the other end does
47994 not have. Multiple certificates must be in the correct order in the file.
47995 First the host&#x2019;s certificate itself, then the first intermediate
47996 certificate to validate the issuer of the host certificate, then the next
47997 intermediate certificate to validate the issuer of the first intermediate
47998 certificate, and so on, until finally (optionally) the root certificate.
47999 The root certificate must already be trusted by the recipient for
48000 validation to succeed, of course, but if it&#x2019;s not preinstalled, sending the
48001 root certificate along with the rest makes it available for the user to
48002 install if the receiving end is a client MUA that can interact with a user.
48003 </para>
48004 </section>
48005 <section id="SECID187">
48006 <title>Self-signed certificates</title>
48007 <para>
48008 <indexterm role="concept">
48009 <primary>certificate</primary>
48010 <secondary>self-signed</secondary>
48011 </indexterm>
48012 You can create a self-signed certificate using the <emphasis>req</emphasis> command provided
48013 with OpenSSL, like this:
48014 </para>
48015 <literallayout class="monospaced">
48016 openssl req -x509 -newkey rsa:1024 -keyout file1 -out file2 \
48017             -days 9999 -nodes
48018 </literallayout>
48019 <para>
48020 <filename>file1</filename> and <filename>file2</filename> can be the same file; the key and the certificate are
48021 delimited and so can be identified independently. The <option>-days</option> option
48022 specifies a period for which the certificate is valid. The <option>-nodes</option> option is
48023 important: if you do not set it, the key is encrypted with a passphrase
48024 that you are prompted for, and any use that is made of the key causes more
48025 prompting for the passphrase. This is not helpful if you are going to use
48026 this certificate and key in an MTA, where prompting is not possible.
48027 </para>
48028 <para>
48029 A self-signed certificate made in this way is sufficient for testing, and
48030 may be adequate for all your requirements if you are mainly interested in
48031 encrypting transfers, and not in secure identification.
48032 </para>
48033 <para>
48034 However, many clients require that the certificate presented by the server be a
48035 user (also called <quote>leaf</quote> or <quote>site</quote>) certificate, and not a self-signed
48036 certificate. In this situation, the self-signed certificate described above
48037 must be installed on the client host as a trusted root <emphasis>certification
48038 authority</emphasis> (CA), and the certificate used by Exim must be a user certificate
48039 signed with that self-signed certificate.
48040 </para>
48041 <para>
48042 For information on creating self-signed CA certificates and using them to sign
48043 user certificates, see the <emphasis>General implementation overview</emphasis> chapter of the
48044 Open-source PKI book, available online at
48045 <emphasis role="bold"><ulink url="http://ospkibook.sourceforge.net/">http://ospkibook.sourceforge.net/</ulink></emphasis>.
48046 <indexterm role="concept" startref="IIDencsmtp1" class="endofrange"/>
48047 <indexterm role="concept" startref="IIDencsmtp2" class="endofrange"/>
48048 </para>
48049 </section>
48050 </chapter>
48051
48052 <chapter id="CHAPACL">
48053 <title>Access control lists</title>
48054 <para>
48055 <indexterm role="concept" id="IIDacl" class="startofrange">
48056 <primary>access control lists (ACLs)</primary>
48057 <secondary>description</secondary>
48058 </indexterm>
48059 <indexterm role="concept">
48060 <primary>control of incoming mail</primary>
48061 </indexterm>
48062 <indexterm role="concept">
48063 <primary>message</primary>
48064 <secondary>controlling incoming</secondary>
48065 </indexterm>
48066 <indexterm role="concept">
48067 <primary>policy control</primary>
48068 <secondary>access control lists</secondary>
48069 </indexterm>
48070 Access Control Lists (ACLs) are defined in a separate section of the run time
48071 configuration file, headed by <quote>begin acl</quote>. Each ACL definition starts with a
48072 name, terminated by a colon. Here is a complete ACL section that contains just
48073 one very small ACL:
48074 </para>
48075 <literallayout class="monospaced">
48076 begin acl
48077 small_acl:
48078   accept   hosts = one.host.only
48079 </literallayout>
48080 <para>
48081 You can have as many lists as you like in the ACL section, and the order in
48082 which they appear does not matter. The lists are self-terminating.
48083 </para>
48084 <para>
48085 The majority of ACLs are used to control Exim&#x2019;s behaviour when it receives
48086 certain SMTP commands. This applies both to incoming TCP/IP connections, and
48087 when a local process submits a message using SMTP by specifying the <option>-bs</option>
48088 option. The most common use is for controlling which recipients are accepted
48089 in incoming messages. In addition, you can define an ACL that is used to check
48090 local non-SMTP messages. The default configuration file contains an example of
48091 a realistic ACL for checking RCPT commands. This is discussed in chapter
48092 <xref linkend="CHAPdefconfil"/>.
48093 </para>
48094 <section id="SECID188">
48095 <title>Testing ACLs</title>
48096 <para>
48097 The <option>-bh</option> command line option provides a way of testing your ACL
48098 configuration locally by running a fake SMTP session with which you interact.
48099 The host <emphasis>relay-test.mail-abuse.org</emphasis> provides a service for checking your
48100 relaying configuration (see section <xref linkend="SECTcheralcon"/> for more details).
48101 </para>
48102 </section>
48103 <section id="SECID189">
48104 <title>Specifying when ACLs are used</title>
48105 <para>
48106 <indexterm role="concept">
48107 <primary>access control lists (ACLs)</primary>
48108 <secondary>options for specifying</secondary>
48109 </indexterm>
48110 In order to cause an ACL to be used, you have to name it in one of the relevant
48111 options in the main part of the configuration. These options are:
48112 <indexterm role="concept">
48113 <primary>AUTH</primary>
48114 <secondary>ACL for</secondary>
48115 </indexterm>
48116 <indexterm role="concept">
48117 <primary>DATA</primary>
48118 <secondary>ACLs for</secondary>
48119 </indexterm>
48120 <indexterm role="concept">
48121 <primary>ETRN</primary>
48122 <secondary>ACL for</secondary>
48123 </indexterm>
48124 <indexterm role="concept">
48125 <primary>EXPN</primary>
48126 <secondary>ACL for</secondary>
48127 </indexterm>
48128 <indexterm role="concept">
48129 <primary>HELO</primary>
48130 <secondary>ACL for</secondary>
48131 </indexterm>
48132 <indexterm role="concept">
48133 <primary>EHLO</primary>
48134 <secondary>ACL for</secondary>
48135 </indexterm>
48136 <indexterm role="concept">
48137 <primary>MAIL</primary>
48138 <secondary>ACL for</secondary>
48139 </indexterm>
48140 <indexterm role="concept">
48141 <primary>QUIT, ACL for</primary>
48142 </indexterm>
48143 <indexterm role="concept">
48144 <primary>RCPT</primary>
48145 <secondary>ACL for</secondary>
48146 </indexterm>
48147 <indexterm role="concept">
48148 <primary>STARTTLS, ACL for</primary>
48149 </indexterm>
48150 <indexterm role="concept">
48151 <primary>VRFY</primary>
48152 <secondary>ACL for</secondary>
48153 </indexterm>
48154 <indexterm role="concept">
48155 <primary>SMTP</primary>
48156 <secondary>connection, ACL for</secondary>
48157 </indexterm>
48158 <indexterm role="concept">
48159 <primary>non-SMTP messages</primary>
48160 <secondary>ACLs for</secondary>
48161 </indexterm>
48162 <indexterm role="concept">
48163 <primary>MIME content scanning</primary>
48164 <secondary>ACL for</secondary>
48165 </indexterm>
48166 </para>
48167 <informaltable frame="none">
48168 <tgroup cols="2" colsep="0" rowsep="0">
48169 <colspec colwidth="140pt" align="left"/>
48170 <colspec colwidth="254pt" align="left"/>
48171 <tbody>
48172 <row>
48173 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp</option></entry>
48174 <entry>ACL for non-SMTP messages</entry>
48175 </row>
48176 <row>
48177 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp_mime</option></entry>
48178 <entry>ACL for non-SMTP MIME parts</entry>
48179 </row>
48180 <row>
48181 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp_start</option></entry>
48182 <entry>ACL at start of non-SMTP message</entry>
48183 </row>
48184 <row>
48185 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_auth</option></entry>
48186 <entry>ACL for AUTH</entry>
48187 </row>
48188 <row>
48189 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_connect</option></entry>
48190 <entry>ACL for start of SMTP connection</entry>
48191 </row>
48192 <row>
48193 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_data</option></entry>
48194 <entry>ACL after DATA is complete</entry>
48195 </row>
48196 <row>
48197 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_etrn</option></entry>
48198 <entry>ACL for ETRN</entry>
48199 </row>
48200 <row>
48201 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_expn</option></entry>
48202 <entry>ACL for EXPN</entry>
48203 </row>
48204 <row>
48205 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_helo</option></entry>
48206 <entry>ACL for HELO or EHLO</entry>
48207 </row>
48208 <row>
48209 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mail</option></entry>
48210 <entry>ACL for MAIL</entry>
48211 </row>
48212 <row>
48213 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mailauth</option></entry>
48214 <entry>ACL for the AUTH parameter of MAIL</entry>
48215 </row>
48216 <row>
48217 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mime</option></entry>
48218 <entry>ACL for content-scanning MIME parts</entry>
48219 </row>
48220 <row>
48221 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_notquit</option></entry>
48222 <entry>ACL for non-QUIT terminations</entry>
48223 </row>
48224 <row>
48225 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_predata</option></entry>
48226 <entry>ACL at start of DATA command</entry>
48227 </row>
48228 <row>
48229 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_quit</option></entry>
48230 <entry>ACL for QUIT</entry>
48231 </row>
48232 <row>
48233 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_rcpt</option></entry>
48234 <entry>ACL for RCPT</entry>
48235 </row>
48236 <row>
48237 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_starttls</option></entry>
48238 <entry>ACL for STARTTLS</entry>
48239 </row>
48240 <row>
48241 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_vrfy</option></entry>
48242 <entry>ACL for VRFY</entry>
48243 </row>
48244 </tbody>
48245 </tgroup>
48246 </informaltable>
48247 <para>
48248 For example, if you set
48249 </para>
48250 <literallayout class="monospaced">
48251 acl_smtp_rcpt = small_acl
48252 </literallayout>
48253 <para>
48254 the little ACL defined above is used whenever Exim receives a RCPT command
48255 in an SMTP dialogue. The majority of policy tests on incoming messages can be
48256 done when RCPT commands arrive. A rejection of RCPT should cause the
48257 sending MTA to give up on the recipient address contained in the RCPT
48258 command, whereas rejection at other times may cause the client MTA to keep on
48259 trying to deliver the message. It is therefore recommended that you do as much
48260 testing as possible at RCPT time.
48261 </para>
48262 </section>
48263 <section id="SECID190">
48264 <title>The non-SMTP ACLs</title>
48265 <para>
48266 <indexterm role="concept">
48267 <primary>non-SMTP messages</primary>
48268 <secondary>ACLs for</secondary>
48269 </indexterm>
48270 The non-SMTP ACLs apply to all non-interactive incoming messages, that is, they
48271 apply to batched SMTP as well as to non-SMTP messages. (Batched SMTP is not
48272 really SMTP.) Many of the ACL conditions (for example, host tests, and tests on
48273 the state of the SMTP connection such as encryption and authentication) are not
48274 relevant and are forbidden in these ACLs. However, the sender and recipients
48275 are known, so the <option>senders</option> and <option>sender_domains</option> conditions and the
48276 <varname>$sender_address</varname> and <varname>$recipients</varname> variables can be used. Variables such as
48277 <varname>$authenticated_sender</varname> are also available. You can specify added header lines
48278 in any of these ACLs.
48279 </para>
48280 <para>
48281 The <option>acl_not_smtp_start</option> ACL is run right at the start of receiving a
48282 non-SMTP message, before any of the message has been read. (This is the
48283 analogue of the <option>acl_smtp_predata</option> ACL for SMTP input.) In the case of
48284 batched SMTP input, it runs after the DATA command has been reached. The
48285 result of this ACL is ignored; it cannot be used to reject a message. If you
48286 really need to, you could set a value in an ACL variable here and reject based
48287 on that in the <option>acl_not_smtp</option> ACL. However, this ACL can be used to set
48288 controls, and in particular, it can be used to set
48289 </para>
48290 <literallayout class="monospaced">
48291 control = suppress_local_fixups
48292 </literallayout>
48293 <para>
48294 This cannot be used in the other non-SMTP ACLs because by the time they are
48295 run, it is too late.
48296 </para>
48297 <para>
48298 The <option>acl_not_smtp_mime</option> ACL is available only when Exim is compiled with the
48299 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
48300 </para>
48301 <para>
48302 The <option>acl_not_smtp</option> ACL is run just before the <function>local_scan()</function> function. Any
48303 kind of rejection is treated as permanent, because there is no way of sending a
48304 temporary error for these kinds of message.
48305 </para>
48306 </section>
48307 <section id="SECID191">
48308 <title>The SMTP connect ACL</title>
48309 <para>
48310 <indexterm role="concept">
48311 <primary>SMTP</primary>
48312 <secondary>connection, ACL for</secondary>
48313 </indexterm>
48314 <indexterm role="option">
48315 <primary><option>smtp_banner</option></primary>
48316 </indexterm>
48317 The ACL test specified by <option>acl_smtp_connect</option> happens at the start of an SMTP
48318 session, after the test specified by <option>host_reject_connection</option> (which is now
48319 an anomaly) and any TCP Wrappers testing (if configured). If the connection is
48320 accepted by an <option>accept</option> verb that has a <option>message</option> modifier, the contents of
48321 the message override the banner message that is otherwise specified by the
48322 <option>smtp_banner</option> option.
48323 </para>
48324 </section>
48325 <section id="SECID192">
48326 <title>The EHLO/HELO ACL</title>
48327 <para>
48328 <indexterm role="concept">
48329 <primary>EHLO</primary>
48330 <secondary>ACL for</secondary>
48331 </indexterm>
48332 <indexterm role="concept">
48333 <primary>HELO</primary>
48334 <secondary>ACL for</secondary>
48335 </indexterm>
48336 The ACL test specified by <option>acl_smtp_helo</option> happens when the client issues an
48337 EHLO or HELO command, after the tests specified by <option>helo_accept_junk_hosts</option>,
48338 <option>helo_allow_chars</option>, <option>helo_verify_hosts</option>, and <option>helo_try_verify_hosts</option>.
48339 Note that a client may issue more than one EHLO or HELO command in an SMTP
48340 session, and indeed is required to issue a new EHLO or HELO after successfully
48341 setting up encryption following a STARTTLS command.
48342 </para>
48343 <para>
48344 If the command is accepted by an <option>accept</option> verb that has a <option>message</option>
48345 modifier, the message may not contain more than one line (it will be truncated
48346 at the first newline and a panic logged if it does). Such a message cannot
48347 affect the EHLO options that are listed on the second and subsequent lines of
48348 an EHLO response.
48349 </para>
48350 </section>
48351 <section id="SECID193">
48352 <title>The DATA ACLs</title>
48353 <para>
48354 <indexterm role="concept">
48355 <primary>DATA</primary>
48356 <secondary>ACLs for</secondary>
48357 </indexterm>
48358 Two ACLs are associated with the DATA command, because it is two-stage
48359 command, with two responses being sent to the client.
48360 When the DATA command is received, the ACL defined by <option>acl_smtp_predata</option>
48361 is obeyed. This gives you control after all the RCPT commands, but before
48362 the message itself is received. It offers the opportunity to give a negative
48363 response to the DATA command before the data is transmitted. Header lines
48364 added by MAIL or RCPT ACLs are not visible at this time, but any that
48365 are defined here are visible when the <option>acl_smtp_data</option> ACL is run.
48366 </para>
48367 <para>
48368 You cannot test the contents of the message, for example, to verify addresses
48369 in the headers, at RCPT time or when the DATA command is received. Such
48370 tests have to appear in the ACL that is run after the message itself has been
48371 received, before the final response to the DATA command is sent. This is
48372 the ACL specified by <option>acl_smtp_data</option>, which is the second ACL that is
48373 associated with the DATA command.
48374 </para>
48375 <para>
48376 For both of these ACLs, it is not possible to reject individual recipients. An
48377 error response rejects the entire message. Unfortunately, it is known that some
48378 MTAs do not treat hard (5<emphasis>xx</emphasis>) responses to the DATA command (either
48379 before or after the data) correctly &ndash; they keep the message on their queues
48380 and try again later, but that is their problem, though it does waste some of
48381 your resources.
48382 </para>
48383 </section>
48384 <section id="SECTDKIMACL">
48385 <title>The SMTP DKIM ACL</title>
48386 <para>
48387 The <option>acl_smtp_dkim</option> ACL is available only when Exim is compiled with DKIM support
48388 enabled (which is the default).
48389 </para>
48390 <para>
48391 The ACL test specified by <option>acl_smtp_dkim</option> happens after a message has been
48392 received, and is executed for each DKIM signature found in a message.  If not
48393 otherwise specified, the default action is to accept.
48394 </para>
48395 <para>
48396 For details on the operation of DKIM, see chapter <xref linkend="CHID12"/>.
48397 </para>
48398 </section>
48399 <section id="SECID194">
48400 <title>The SMTP MIME ACL</title>
48401 <para>
48402 The <option>acl_smtp_mime</option> option is available only when Exim is compiled with the
48403 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
48404 </para>
48405 </section>
48406 <section id="SECTQUITACL">
48407 <title>The QUIT ACL</title>
48408 <para>
48409 <indexterm role="concept">
48410 <primary>QUIT, ACL for</primary>
48411 </indexterm>
48412 The ACL for the SMTP QUIT command is anomalous, in that the outcome of the ACL
48413 does not affect the response code to QUIT, which is always 221. Thus, the ACL
48414 does not in fact control any access. For this reason, the only verbs that are
48415 permitted are <option>accept</option> and <option>warn</option>.
48416 </para>
48417 <para>
48418 This ACL can be used for tasks such as custom logging at the end of an SMTP
48419 session. For example, you can use ACL variables in other ACLs to count
48420 messages, recipients, etc., and log the totals at QUIT time using one or
48421 more <option>logwrite</option> modifiers on a <option>warn</option> verb.
48422 </para>
48423 <para>
48424 <emphasis role="bold">Warning</emphasis>: Only the <varname>$acl_c</varname><emphasis>x</emphasis> variables can be used for this, because
48425 the <varname>$acl_m</varname><emphasis>x</emphasis> variables are reset at the end of each incoming message.
48426 </para>
48427 <para>
48428 You do not need to have a final <option>accept</option>, but if you do, you can use a
48429 <option>message</option> modifier to specify custom text that is sent as part of the 221
48430 response to QUIT.
48431 </para>
48432 <para>
48433 This ACL is run only for a <quote>normal</quote> QUIT. For certain kinds of disastrous
48434 failure (for example, failure to open a log file, or when Exim is bombing out
48435 because it has detected an unrecoverable error), all SMTP commands from the
48436 client are given temporary error responses until QUIT is received or the
48437 connection is closed. In these special cases, the QUIT ACL does not run.
48438 </para>
48439 </section>
48440 <section id="SECTNOTQUITACL">
48441 <title>The not-QUIT ACL</title>
48442 <para>
48443 <indexterm role="variable">
48444 <primary><varname>$acl_smtp_notquit</varname></primary>
48445 </indexterm>
48446 The not-QUIT ACL, specified by <option>acl_smtp_notquit</option>, is run in most cases when
48447 an SMTP session ends without sending QUIT. However, when Exim itself is is bad
48448 trouble, such as being unable to write to its log files, this ACL is not run,
48449 because it might try to do things (such as write to log files) that make the
48450 situation even worse.
48451 </para>
48452 <para>
48453 Like the QUIT ACL, this ACL is provided to make it possible to do customized
48454 logging or to gather statistics, and its outcome is ignored. The <option>delay</option>
48455 modifier is forbidden in this ACL, and the only permitted verbs are <option>accept</option>
48456 and <option>warn</option>.
48457 </para>
48458 <para>
48459 <indexterm role="variable">
48460 <primary><varname>$smtp_notquit_reason</varname></primary>
48461 </indexterm>
48462 When the not-QUIT ACL is running, the variable <varname>$smtp_notquit_reason</varname> is set
48463 to a string that indicates the reason for the termination of the SMTP
48464 connection. The possible values are:
48465 </para>
48466 <informaltable frame="none">
48467 <tgroup cols="2" colsep="0" rowsep="0">
48468 <colspec colwidth="196pt" align="left"/>
48469 <colspec colwidth="254pt" align="left"/>
48470 <tbody>
48471 <row>
48472 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>acl-drop</literal></entry>
48473 <entry>Another ACL issued a <option>drop</option> command</entry>
48474 </row>
48475 <row>
48476 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>bad-commands</literal></entry>
48477 <entry>Too many unknown or non-mail commands</entry>
48478 </row>
48479 <row>
48480 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>command-timeout</literal></entry>
48481 <entry>Timeout while reading SMTP commands</entry>
48482 </row>
48483 <row>
48484 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>connection-lost</literal></entry>
48485 <entry>The SMTP connection has been lost</entry>
48486 </row>
48487 <row>
48488 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>data-timeout</literal></entry>
48489 <entry>Timeout while reading message data</entry>
48490 </row>
48491 <row>
48492 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>local-scan-error</literal></entry>
48493 <entry>The <function>local_scan()</function> function crashed</entry>
48494 </row>
48495 <row>
48496 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>local-scan-timeout</literal></entry>
48497 <entry>The <function>local_scan()</function> function timed out</entry>
48498 </row>
48499 <row>
48500 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>signal-exit</literal></entry>
48501 <entry>SIGTERM or SIGINT</entry>
48502 </row>
48503 <row>
48504 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>synchronization-error</literal></entry>
48505 <entry>SMTP synchronization error</entry>
48506 </row>
48507 <row>
48508 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>tls-failed</literal></entry>
48509 <entry>TLS failed to start</entry>
48510 </row>
48511 </tbody>
48512 </tgroup>
48513 </informaltable>
48514 <para>
48515 In most cases when an SMTP connection is closed without having received QUIT,
48516 Exim sends an SMTP response message before actually closing the connection.
48517 With the exception of the <literal>acl-drop</literal> case, the default message can be
48518 overridden by the <option>message</option> modifier in the not-QUIT ACL. In the case of a
48519 <option>drop</option> verb in another ACL, it is the message from the other ACL that is
48520 used.
48521 </para>
48522 </section>
48523 <section id="SECID195">
48524 <title>Finding an ACL to use</title>
48525 <para>
48526 <indexterm role="concept">
48527 <primary>access control lists (ACLs)</primary>
48528 <secondary>finding which to use</secondary>
48529 </indexterm>
48530 The value of an <option>acl_smtp_</option><emphasis>xxx</emphasis> option is expanded before use, so
48531 you can use different ACLs in different circumstances. For example,
48532 </para>
48533 <literallayout class="monospaced">
48534 acl_smtp_rcpt = ${if ={25}{$interface_port} \
48535                      {acl_check_rcpt} {acl_check_rcpt_submit} }
48536 </literallayout>
48537 <para>
48538 In the default configuration file there are some example settings for
48539 providing an RFC 4409 message submission service on port 587 and a
48540 non-standard <quote>smtps</quote> service on port 465. You can use a string
48541 expansion like this to choose an ACL for MUAs on these ports which is
48542 more appropriate for this purpose than the default ACL on port 25.
48543 </para>
48544 <para>
48545 The expanded string does not have to be the name of an ACL in the
48546 configuration file; there are other possibilities. Having expanded the
48547 string, Exim searches for an ACL as follows:
48548 </para>
48549 <itemizedlist>
48550 <listitem>
48551 <para>
48552 If the string begins with a slash, Exim uses it as a file name, and reads its
48553 contents as an ACL. The lines are processed in the same way as lines in the
48554 Exim configuration file. In particular, continuation lines are supported, blank
48555 lines are ignored, as are lines whose first non-whitespace character is <quote>#</quote>.
48556 If the file does not exist or cannot be read, an error occurs (typically
48557 causing a temporary failure of whatever caused the ACL to be run). For example:
48558 </para>
48559 <literallayout class="monospaced">
48560 acl_smtp_data = /etc/acls/\
48561   ${lookup{$sender_host_address}lsearch\
48562   {/etc/acllist}{$value}{default}}
48563 </literallayout>
48564 <para>
48565 This looks up an ACL file to use on the basis of the host&#x2019;s IP address, falling
48566 back to a default if the lookup fails. If an ACL is successfully read from a
48567 file, it is retained in memory for the duration of the Exim process, so that it
48568 can be re-used without having to re-read the file.
48569 </para>
48570 </listitem>
48571 <listitem>
48572 <para>
48573 If the string does not start with a slash, and does not contain any spaces,
48574 Exim searches the ACL section of the configuration for an ACL whose name
48575 matches the string.
48576 </para>
48577 </listitem>
48578 <listitem>
48579 <para>
48580 If no named ACL is found, or if the string contains spaces, Exim parses
48581 the string as an inline ACL. This can save typing in cases where you just
48582 want to have something like
48583 </para>
48584 <literallayout class="monospaced">
48585 acl_smtp_vrfy = accept
48586 </literallayout>
48587 <para>
48588 in order to allow free use of the VRFY command. Such a string may contain
48589 newlines; it is processed in the same way as an ACL that is read from a file.
48590 </para>
48591 </listitem>
48592 </itemizedlist>
48593 </section>
48594 <section id="SECID196">
48595 <title>ACL return codes</title>
48596 <para>
48597 <indexterm role="concept">
48598 <primary>access control lists (ACLs)</primary>
48599 <secondary>return codes</secondary>
48600 </indexterm>
48601 Except for the QUIT ACL, which does not affect the SMTP return code (see
48602 section <xref linkend="SECTQUITACL"/> above), the result of running an ACL is either
48603 <quote>accept</quote> or <quote>deny</quote>, or, if some test cannot be completed (for example, if a
48604 database is down), <quote>defer</quote>. These results cause 2<emphasis>xx</emphasis>, 5<emphasis>xx</emphasis>, and 4<emphasis>xx</emphasis>
48605 return codes, respectively, to be used in the SMTP dialogue. A fourth return,
48606 <quote>error</quote>, occurs when there is an error such as invalid syntax in the ACL.
48607 This also causes a 4<emphasis>xx</emphasis> return code.
48608 </para>
48609 <para>
48610 For the non-SMTP ACL, <quote>defer</quote> and <quote>error</quote> are treated in the same way as
48611 <quote>deny</quote>, because there is no mechanism for passing temporary errors to the
48612 submitters of non-SMTP messages.
48613 </para>
48614 <para>
48615 ACLs that are relevant to message reception may also return <quote>discard</quote>. This
48616 has the effect of <quote>accept</quote>, but causes either the entire message or an
48617 individual recipient address to be discarded. In other words, it is a
48618 blackholing facility. Use it with care.
48619 </para>
48620 <para>
48621 If the ACL for MAIL returns <quote>discard</quote>, all recipients are discarded, and no
48622 ACL is run for subsequent RCPT commands. The effect of <quote>discard</quote> in a
48623 RCPT ACL is to discard just the one recipient address. If there are no
48624 recipients left when the message&#x2019;s data is received, the DATA ACL is not
48625 run. A <quote>discard</quote> return from the DATA or the non-SMTP ACL discards all the
48626 remaining recipients. The <quote>discard</quote> return is not permitted for the
48627 <option>acl_smtp_predata</option> ACL.
48628 </para>
48629 <para>
48630 <indexterm role="concept">
48631 <primary><function>local_scan()</function> function</primary>
48632 <secondary>when all recipients discarded</secondary>
48633 </indexterm>
48634 The <function>local_scan()</function> function is always run, even if there are no remaining
48635 recipients; it may create new recipients.
48636 </para>
48637 </section>
48638 <section id="SECID197">
48639 <title>Unset ACL options</title>
48640 <para>
48641 <indexterm role="concept">
48642 <primary>access control lists (ACLs)</primary>
48643 <secondary>unset options</secondary>
48644 </indexterm>
48645 The default actions when any of the <option>acl_</option><emphasis>xxx</emphasis> options are unset are not
48646 all the same. <emphasis role="bold">Note</emphasis>: These defaults apply only when the relevant ACL is
48647 not defined at all. For any defined ACL, the default action when control
48648 reaches the end of the ACL statements is <quote>deny</quote>.
48649 </para>
48650 <para>
48651 For <option>acl_smtp_quit</option> and <option>acl_not_smtp_start</option> there is no default because
48652 these two are ACLs that are used only for their side effects. They cannot be
48653 used to accept or reject anything.
48654 </para>
48655 <para>
48656 For <option>acl_not_smtp</option>, <option>acl_smtp_auth</option>, <option>acl_smtp_connect</option>,
48657 <option>acl_smtp_data</option>, <option>acl_smtp_helo</option>, <option>acl_smtp_mail</option>, <option>acl_smtp_mailauth</option>,
48658 <option>acl_smtp_mime</option>, <option>acl_smtp_predata</option>, and <option>acl_smtp_starttls</option>, the action
48659 when the ACL is not defined is <quote>accept</quote>.
48660 </para>
48661 <para>
48662 For the others (<option>acl_smtp_etrn</option>, <option>acl_smtp_expn</option>, <option>acl_smtp_rcpt</option>, and
48663 <option>acl_smtp_vrfy</option>), the action when the ACL is not defined is <quote>deny</quote>.
48664 This means that <option>acl_smtp_rcpt</option> must be defined in order to receive any
48665 messages over an SMTP connection. For an example, see the ACL in the default
48666 configuration file.
48667 </para>
48668 </section>
48669 <section id="SECID198">
48670 <title>Data for message ACLs</title>
48671 <para>
48672 <indexterm role="concept">
48673 <primary>access control lists (ACLs)</primary>
48674 <secondary>data for message ACL</secondary>
48675 </indexterm>
48676 <indexterm role="variable">
48677 <primary><varname>$domain</varname></primary>
48678 </indexterm>
48679 <indexterm role="variable">
48680 <primary><varname>$local_part</varname></primary>
48681 </indexterm>
48682 <indexterm role="variable">
48683 <primary><varname>$sender_address</varname></primary>
48684 </indexterm>
48685 <indexterm role="variable">
48686 <primary><varname>$sender_host_address</varname></primary>
48687 </indexterm>
48688 <indexterm role="variable">
48689 <primary><varname>$smtp_command</varname></primary>
48690 </indexterm>
48691 When a MAIL or RCPT ACL, or either of the DATA ACLs, is running, the variables
48692 that contain information about the host and the message&#x2019;s sender (for example,
48693 <varname>$sender_host_address</varname> and <varname>$sender_address</varname>) are set, and can be used in ACL
48694 statements. In the case of RCPT (but not MAIL or DATA), <varname>$domain</varname> and
48695 <varname>$local_part</varname> are set from the argument address. The entire SMTP command
48696 is available in <varname>$smtp_command</varname>.
48697 </para>
48698 <para>
48699 When an ACL for the AUTH parameter of MAIL is running, the variables that
48700 contain information about the host are set, but <varname>$sender_address</varname> is not yet
48701 set. Section <xref linkend="SECTauthparamail"/> contains a discussion of this parameter and
48702 how it is used.
48703 </para>
48704 <para>
48705 <indexterm role="variable">
48706 <primary><varname>$message_size</varname></primary>
48707 </indexterm>
48708 The <varname>$message_size</varname> variable is set to the value of the SIZE parameter on
48709 the MAIL command at MAIL, RCPT and pre-data time, or to -1 if
48710 that parameter is not given. The value is updated to the true message size by
48711 the time the final DATA ACL is run (after the message data has been
48712 received).
48713 </para>
48714 <para>
48715 <indexterm role="variable">
48716 <primary><varname>$rcpt_count</varname></primary>
48717 </indexterm>
48718 <indexterm role="variable">
48719 <primary><varname>$recipients_count</varname></primary>
48720 </indexterm>
48721 The <varname>$rcpt_count</varname> variable increases by one for each RCPT command received.
48722 The <varname>$recipients_count</varname> variable increases by one each time a RCPT command is
48723 accepted, so while an ACL for RCPT is being processed, it contains the number
48724 of previously accepted recipients. At DATA time (for both the DATA ACLs),
48725 <varname>$rcpt_count</varname> contains the total number of RCPT commands, and
48726 <varname>$recipients_count</varname> contains the total number of accepted recipients.
48727 </para>
48728 </section>
48729 <section id="SECTdatfornon">
48730 <title>Data for non-message ACLs</title>
48731 <para>
48732 <indexterm role="concept">
48733 <primary>access control lists (ACLs)</primary>
48734 <secondary>data for non-message ACL</secondary>
48735 </indexterm>
48736 <indexterm role="variable">
48737 <primary><varname>$smtp_command_argument</varname></primary>
48738 </indexterm>
48739 <indexterm role="variable">
48740 <primary><varname>$smtp_command</varname></primary>
48741 </indexterm>
48742 When an ACL is being run for AUTH, EHLO, ETRN, EXPN, HELO, STARTTLS, or VRFY,
48743 the remainder of the SMTP command line is placed in <varname>$smtp_command_argument</varname>,
48744 and the entire SMTP command is available in <varname>$smtp_command</varname>.
48745 These variables can be tested using a <option>condition</option> condition. For example,
48746 here is an ACL for use with AUTH, which insists that either the session is
48747 encrypted, or the CRAM-MD5 authentication method is used. In other words, it
48748 does not permit authentication methods that use cleartext passwords on
48749 unencrypted connections.
48750 </para>
48751 <literallayout class="monospaced">
48752 acl_check_auth:
48753   accept encrypted = *
48754   accept condition = ${if eq{${uc:$smtp_command_argument}}\
48755                      {CRAM-MD5}}
48756   deny   message   = TLS encryption or CRAM-MD5 required
48757 </literallayout>
48758 <para>
48759 (Another way of applying this restriction is to arrange for the authenticators
48760 that use cleartext passwords not to be advertised when the connection is not
48761 encrypted. You can use the generic <option>server_advertise_condition</option> authenticator
48762 option to do this.)
48763 </para>
48764 </section>
48765 <section id="SECID199">
48766 <title>Format of an ACL</title>
48767 <para>
48768 <indexterm role="concept">
48769 <primary>access control lists (ACLs)</primary>
48770 <secondary>format of</secondary>
48771 </indexterm>
48772 <indexterm role="concept">
48773 <primary>access control lists (ACLs)</primary>
48774 <secondary>verbs, definition of</secondary>
48775 </indexterm>
48776 An individual ACL consists of a number of statements. Each statement starts
48777 with a verb, optionally followed by a number of conditions and <quote>modifiers</quote>.
48778 Modifiers can change the way the verb operates, define error and log messages,
48779 set variables, insert delays, and vary the processing of accepted messages.
48780 </para>
48781 <para>
48782 If all the conditions are met, the verb is obeyed. The same condition may be
48783 used (with different arguments) more than once in the same statement. This
48784 provides a means of specifying an <quote>and</quote> conjunction between conditions. For
48785 example:
48786 </para>
48787 <literallayout class="monospaced">
48788 deny  dnslists = list1.example
48789 dnslists = list2.example
48790 </literallayout>
48791 <para>
48792 If there are no conditions, the verb is always obeyed. Exim stops evaluating
48793 the conditions and modifiers when it reaches a condition that fails. What
48794 happens then depends on the verb (and in one case, on a special modifier). Not
48795 all the conditions make sense at every testing point. For example, you cannot
48796 test a sender address in the ACL that is run for a VRFY command.
48797 </para>
48798 </section>
48799 <section id="SECID200">
48800 <title>ACL verbs</title>
48801 <para>
48802 The ACL verbs are as follows:
48803 </para>
48804 <itemizedlist>
48805 <listitem>
48806 <para>
48807 <indexterm role="concept">
48808 <primary><option>accept</option> ACL verb</primary>
48809 </indexterm>
48810 <option>accept</option>: If all the conditions are met, the ACL returns <quote>accept</quote>. If any
48811 of the conditions are not met, what happens depends on whether <option>endpass</option>
48812 appears among the conditions (for syntax see below). If the failing condition
48813 is before <option>endpass</option>, control is passed to the next ACL statement; if it is
48814 after <option>endpass</option>, the ACL returns <quote>deny</quote>. Consider this statement, used to
48815 check a RCPT command:
48816 </para>
48817 <literallayout class="monospaced">
48818 accept domains = +local_domains
48819 endpass
48820 verify = recipient
48821 </literallayout>
48822 <para>
48823 If the recipient domain does not match the <option>domains</option> condition, control
48824 passes to the next statement. If it does match, the recipient is verified, and
48825 the command is accepted if verification succeeds. However, if verification
48826 fails, the ACL yields <quote>deny</quote>, because the failing condition is after
48827 <option>endpass</option>.
48828 </para>
48829 <para>
48830 The <option>endpass</option> feature has turned out to be confusing to many people, so its
48831 use is not recommended nowadays. It is always possible to rewrite an ACL so
48832 that <option>endpass</option> is not needed, and it is no longer used in the default
48833 configuration.
48834 </para>
48835 <para>
48836 <indexterm role="concept">
48837 <primary><option>message</option> ACL modifier</primary>
48838 <secondary>with <option>accept</option></secondary>
48839 </indexterm>
48840 If a <option>message</option> modifier appears on an <option>accept</option> statement, its action
48841 depends on whether or not <option>endpass</option> is present. In the absence of <option>endpass</option>
48842 (when an <option>accept</option> verb either accepts or passes control to the next
48843 statement), <option>message</option> can be used to vary the message that is sent when an
48844 SMTP command is accepted. For example, in a RCPT ACL you could have:
48845 </para>
48846 <literallayout>
48847 <literal>accept  </literal>&lt;<emphasis>some conditions</emphasis>&gt;
48848 <literal>        message = OK, I will allow you through today</literal>
48849 </literallayout>
48850 <para>
48851 You can specify an SMTP response code, optionally followed by an <quote>extended
48852 response code</quote> at the start of the message, but the first digit must be the
48853 same as would be sent by default, which is 2 for an <option>accept</option> verb.
48854 </para>
48855 <para>
48856 If <option>endpass</option> is present in an <option>accept</option> statement, <option>message</option> specifies
48857 an error message that is used when access is denied. This behaviour is retained
48858 for backward compatibility, but current <quote>best practice</quote> is to avoid the use
48859 of <option>endpass</option>.
48860 </para>
48861 </listitem>
48862 <listitem>
48863 <para>
48864 <indexterm role="concept">
48865 <primary><option>defer</option> ACL verb</primary>
48866 </indexterm>
48867 <option>defer</option>: If all the conditions are true, the ACL returns <quote>defer</quote> which, in
48868 an SMTP session, causes a 4<emphasis>xx</emphasis> response to be given. For a non-SMTP ACL,
48869 <option>defer</option> is the same as <option>deny</option>, because there is no way of sending a
48870 temporary error. For a RCPT command, <option>defer</option> is much the same as using a
48871 <command>redirect</command> router and <literal>:defer:</literal> while verifying, but the <option>defer</option> verb can
48872 be used in any ACL, and even for a recipient it might be a simpler approach.
48873 </para>
48874 </listitem>
48875 <listitem>
48876 <para>
48877 <indexterm role="concept">
48878 <primary><option>deny</option> ACL verb</primary>
48879 </indexterm>
48880 <option>deny</option>: If all the conditions are met, the ACL returns <quote>deny</quote>. If any of
48881 the conditions are not met, control is passed to the next ACL statement. For
48882 example,
48883 </para>
48884 <literallayout class="monospaced">
48885 deny dnslists = blackholes.mail-abuse.org
48886 </literallayout>
48887 <para>
48888 rejects commands from hosts that are on a DNS black list.
48889 </para>
48890 </listitem>
48891 <listitem>
48892 <para>
48893 <indexterm role="concept">
48894 <primary><option>discard</option> ACL verb</primary>
48895 </indexterm>
48896 <option>discard</option>: This verb behaves like <option>accept</option>, except that it returns
48897 <quote>discard</quote> from the ACL instead of <quote>accept</quote>. It is permitted only on ACLs
48898 that are concerned with receiving messages. When all the conditions are true,
48899 the sending entity receives a <quote>success</quote> response. However, <option>discard</option> causes
48900 recipients to be discarded. If it is used in an ACL for RCPT, just the one
48901 recipient is discarded; if used for MAIL, DATA or in the non-SMTP ACL, all the
48902 message&#x2019;s recipients are discarded. Recipients that are discarded before DATA
48903 do not appear in the log line when the <option>received_recipients</option> log selector is set.
48904 </para>
48905 <para>
48906 If the <option>log_message</option> modifier is set when <option>discard</option> operates,
48907 its contents are added to the line that is automatically written to the log.
48908 The <option>message</option> modifier operates exactly as it does for <option>accept</option>.
48909 </para>
48910 </listitem>
48911 <listitem>
48912 <para>
48913 <indexterm role="concept">
48914 <primary><option>drop</option> ACL verb</primary>
48915 </indexterm>
48916 <option>drop</option>: This verb behaves like <option>deny</option>, except that an SMTP connection is
48917 forcibly closed after the 5<emphasis>xx</emphasis> error message has been sent. For example:
48918 </para>
48919 <literallayout class="monospaced">
48920 drop   message   = I don't take more than 20 RCPTs
48921        condition = ${if &gt; {$rcpt_count}{20}}
48922 </literallayout>
48923 <para>
48924 There is no difference between <option>deny</option> and <option>drop</option> for the connect-time ACL.
48925 The connection is always dropped after sending a 550 response.
48926 </para>
48927 </listitem>
48928 <listitem>
48929 <para>
48930 <indexterm role="concept">
48931 <primary><option>require</option> ACL verb</primary>
48932 </indexterm>
48933 <option>require</option>: If all the conditions are met, control is passed to the next ACL
48934 statement. If any of the conditions are not met, the ACL returns <quote>deny</quote>. For
48935 example, when checking a RCPT command,
48936 </para>
48937 <literallayout class="monospaced">
48938 require message = Sender did not verify
48939         verify  = sender
48940 </literallayout>
48941 <para>
48942 passes control to subsequent statements only if the message&#x2019;s sender can be
48943 verified. Otherwise, it rejects the command. Note the positioning of the
48944 <option>message</option> modifier, before the <option>verify</option> condition. The reason for this is
48945 discussed in section <xref linkend="SECTcondmodproc"/>.
48946 </para>
48947 </listitem>
48948 <listitem>
48949 <para>
48950 <indexterm role="concept">
48951 <primary><option>warn</option> ACL verb</primary>
48952 </indexterm>
48953 <option>warn</option>: If all the conditions are true, a line specified by the
48954 <option>log_message</option> modifier is written to Exim&#x2019;s main log. Control always passes
48955 to the next ACL statement. If any condition is false, the log line is not
48956 written. If an identical log line is requested several times in the same
48957 message, only one copy is actually written to the log. If you want to force
48958 duplicates to be written, use the <option>logwrite</option> modifier instead.
48959 </para>
48960 <para>
48961 If <option>log_message</option> is not present, a <option>warn</option> verb just checks its conditions
48962 and obeys any <quote>immediate</quote> modifiers (such as <option>control</option>, <option>set</option>,
48963 <option>logwrite</option>, and <option>add_header</option>) that appear before the first failing
48964 condition. There is more about adding header lines in section
48965 <xref linkend="SECTaddheadacl"/>.
48966 </para>
48967 <para>
48968 If any condition on a <option>warn</option> statement cannot be completed (that is, there is
48969 some sort of defer), the log line specified by <option>log_message</option> is not written.
48970 This does not include the case of a forced failure from a lookup, which
48971 is considered to be a successful completion. After a defer, no further
48972 conditions or modifiers in the <option>warn</option> statement are processed. The incident
48973 is logged, and the ACL continues to be processed, from the next statement
48974 onwards.
48975 </para>
48976 <para>
48977 <indexterm role="variable">
48978 <primary><varname>$acl_verify_message</varname></primary>
48979 </indexterm>
48980 When one of the <option>warn</option> conditions is an address verification that fails, the
48981 text of the verification failure message is in <varname>$acl_verify_message</varname>. If you
48982 want this logged, you must set it up explicitly. For example:
48983 </para>
48984 <literallayout class="monospaced">
48985 warn   !verify = sender
48986        log_message = sender verify failed: $acl_verify_message
48987 </literallayout>
48988 </listitem>
48989 </itemizedlist>
48990 <para>
48991 At the end of each ACL there is an implicit unconditional <option>deny</option>.
48992 </para>
48993 <para>
48994 As you can see from the examples above, the conditions and modifiers are
48995 written one to a line, with the first one on the same line as the verb, and
48996 subsequent ones on following lines. If you have a very long condition, you can
48997 continue it onto several physical lines by the usual backslash continuation
48998 mechanism. It is conventional to align the conditions vertically.
48999 </para>
49000 </section>
49001 <section id="SECTaclvariables">
49002 <title>ACL variables</title>
49003 <para>
49004 <indexterm role="concept">
49005 <primary>access control lists (ACLs)</primary>
49006 <secondary>variables</secondary>
49007 </indexterm>
49008 There are some special variables that can be set during ACL processing. They
49009 can be used to pass information between different ACLs, different invocations
49010 of the same ACL in the same SMTP connection, and between ACLs and the routers,
49011 transports, and filters that are used to deliver a message. The names of these
49012 variables must begin with <varname>$acl_c</varname> or <varname>$acl_m</varname>, followed either by a digit or
49013 an underscore, but the remainder of the name can be any sequence of
49014 alphanumeric characters and underscores that you choose. There is no limit on
49015 the number of ACL variables. The two sets act as follows:
49016 </para>
49017 <itemizedlist>
49018 <listitem>
49019 <para>
49020 The values of those variables whose names begin with <varname>$acl_c</varname> persist
49021 throughout an SMTP connection. They are never reset. Thus, a value that is set
49022 while receiving one message is still available when receiving the next message
49023 on the same SMTP connection.
49024 </para>
49025 </listitem>
49026 <listitem>
49027 <para>
49028 The values of those variables whose names begin with <varname>$acl_m</varname> persist only
49029 while a message is being received. They are reset afterwards. They are also
49030 reset by MAIL, RSET, EHLO, HELO, and after starting up a TLS session.
49031 </para>
49032 </listitem>
49033 </itemizedlist>
49034 <para>
49035 When a message is accepted, the current values of all the ACL variables are
49036 preserved with the message and are subsequently made available at delivery
49037 time. The ACL variables are set by a modifier called <option>set</option>. For example:
49038 </para>
49039 <literallayout class="monospaced">
49040 accept hosts = whatever
49041        set acl_m4 = some value
49042 accept authenticated = *
49043        set acl_c_auth = yes
49044 </literallayout>
49045 <para>
49046 <emphasis role="bold">Note</emphasis>: A leading dollar sign is not used when naming a variable that is to
49047 be set. If you want to set a variable without taking any action, you can use a
49048 <option>warn</option> verb without any other modifiers or conditions.
49049 </para>
49050 <para>
49051 <indexterm role="option">
49052 <primary><option>strict_acl_vars</option></primary>
49053 </indexterm>
49054 What happens if a syntactically valid but undefined ACL variable is
49055 referenced depends on the setting of the <option>strict_acl_vars</option> option. If it is
49056 false (the default), an empty string is substituted; if it is true, an
49057 error is generated.
49058 </para>
49059 <para>
49060 Versions of Exim before 4.64 have a limited set of numbered variables, but
49061 their names are compatible, so there is no problem with upgrading.
49062 </para>
49063 </section>
49064 <section id="SECTcondmodproc">
49065 <title>Condition and modifier processing</title>
49066 <para>
49067 <indexterm role="concept">
49068 <primary>access control lists (ACLs)</primary>
49069 <secondary>conditions; processing</secondary>
49070 </indexterm>
49071 <indexterm role="concept">
49072 <primary>access control lists (ACLs)</primary>
49073 <secondary>modifiers; processing</secondary>
49074 </indexterm>
49075 An exclamation mark preceding a condition negates its result. For example:
49076 </para>
49077 <literallayout class="monospaced">
49078 deny   domains = *.dom.example
49079       !verify  = recipient
49080 </literallayout>
49081 <para>
49082 causes the ACL to return <quote>deny</quote> if the recipient domain ends in
49083 <emphasis>dom.example</emphasis> and the recipient address cannot be verified. Sometimes
49084 negation can be used on the right-hand side of a condition. For example, these
49085 two statements are equivalent:
49086 </para>
49087 <literallayout class="monospaced">
49088 deny  hosts = !192.168.3.4
49089 deny !hosts =  192.168.3.4
49090 </literallayout>
49091 <para>
49092 However, for many conditions (<option>verify</option> being a good example), only left-hand
49093 side negation of the whole condition is possible.
49094 </para>
49095 <para>
49096 The arguments of conditions and modifiers are expanded. A forced failure
49097 of an expansion causes a condition to be ignored, that is, it behaves as if the
49098 condition is true. Consider these two statements:
49099 </para>
49100 <literallayout class="monospaced">
49101 accept  senders = ${lookup{$host_name}lsearch\
49102                   {/some/file}{$value}fail}
49103 accept  senders = ${lookup{$host_name}lsearch\
49104                   {/some/file}{$value}{}}
49105 </literallayout>
49106 <para>
49107 Each attempts to look up a list of acceptable senders. If the lookup succeeds,
49108 the returned list is searched, but if the lookup fails the behaviour is
49109 different in the two cases. The <option>fail</option> in the first statement causes the
49110 condition to be ignored, leaving no further conditions. The <option>accept</option> verb
49111 therefore succeeds. The second statement, however, generates an empty list when
49112 the lookup fails. No sender can match an empty list, so the condition fails,
49113 and therefore the <option>accept</option> also fails.
49114 </para>
49115 <para>
49116 ACL modifiers appear mixed in with conditions in ACL statements. Some of them
49117 specify actions that are taken as the conditions for a statement are checked;
49118 others specify text for messages that are used when access is denied or a
49119 warning is generated. The <option>control</option> modifier affects the way an incoming
49120 message is handled.
49121 </para>
49122 <para>
49123 The positioning of the modifiers in an ACL statement important, because the
49124 processing of a verb ceases as soon as its outcome is known. Only those
49125 modifiers that have already been encountered will take effect. For example,
49126 consider this use of the <option>message</option> modifier:
49127 </para>
49128 <literallayout class="monospaced">
49129 require message = Can't verify sender
49130         verify  = sender
49131         message = Can't verify recipient
49132         verify  = recipient
49133         message = This message cannot be used
49134 </literallayout>
49135 <para>
49136 If sender verification fails, Exim knows that the result of the statement is
49137 <quote>deny</quote>, so it goes no further. The first <option>message</option> modifier has been seen,
49138 so its text is used as the error message. If sender verification succeeds, but
49139 recipient verification fails, the second message is used. If recipient
49140 verification succeeds, the third message becomes <quote>current</quote>, but is never used
49141 because there are no more conditions to cause failure.
49142 </para>
49143 <para>
49144 For the <option>deny</option> verb, on the other hand, it is always the last <option>message</option>
49145 modifier that is used, because all the conditions must be true for rejection to
49146 happen. Specifying more than one <option>message</option> modifier does not make sense, and
49147 the message can even be specified after all the conditions. For example:
49148 </para>
49149 <literallayout class="monospaced">
49150 deny   hosts = ...
49151       !senders = *@my.domain.example
49152        message = Invalid sender from client host
49153 </literallayout>
49154 <para>
49155 The <quote>deny</quote> result does not happen until the end of the statement is reached,
49156 by which time Exim has set up the message.
49157 </para>
49158 </section>
49159 <section id="SECTACLmodi">
49160 <title>ACL modifiers</title>
49161 <para>
49162 <indexterm role="concept">
49163 <primary>access control lists (ACLs)</primary>
49164 <secondary>modifiers; list of</secondary>
49165 </indexterm>
49166 The ACL modifiers are as follows:
49167 </para>
49168 <variablelist>
49169 <varlistentry>
49170 <term><emphasis role="bold">add_header</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
49171 <listitem>
49172 <para>
49173 This modifier specifies one or more header lines that are to be added to an
49174 incoming message, assuming, of course, that the message is ultimately
49175 accepted. For details, see section <xref linkend="SECTaddheadacl"/>.
49176 </para>
49177 </listitem></varlistentry>
49178 <varlistentry>
49179 <term><emphasis role="bold">continue</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
49180 <listitem>
49181 <para>
49182 <indexterm role="concept">
49183 <primary><option>continue</option> ACL modifier</primary>
49184 </indexterm>
49185 <indexterm role="concept">
49186 <primary>database</primary>
49187 <secondary>updating in ACL</secondary>
49188 </indexterm>
49189 This modifier does nothing of itself, and processing of the ACL always
49190 continues with the next condition or modifier. The value of <option>continue</option> is in
49191 the side effects of expanding its argument. Typically this could be used to
49192 update a database. It is really just a syntactic tidiness, to avoid having to
49193 write rather ugly lines like this:
49194 </para>
49195 <literallayout>
49196 <literal>condition = ${if eq{0}{</literal>&lt;<emphasis>some expansion</emphasis>&gt;<literal>}{true}{true}}</literal>
49197 </literallayout>
49198 <para>
49199 Instead, all you need is
49200 </para>
49201 <literallayout>
49202 <literal>continue = </literal>&lt;<emphasis>some expansion</emphasis>&gt;
49203 </literallayout>
49204 </listitem></varlistentry>
49205 <varlistentry>
49206 <term><emphasis role="bold">control</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
49207 <listitem>
49208 <para>
49209 <indexterm role="concept">
49210 <primary><option>control</option> ACL modifier</primary>
49211 </indexterm>
49212 This modifier affects the subsequent processing of the SMTP connection or of an
49213 incoming message that is accepted. The effect of the first type of control
49214 lasts for the duration of the connection, whereas the effect of the second type
49215 lasts only until the current message has been received. The message-specific
49216 controls always apply to the whole message, not to individual recipients,
49217 even if the <option>control</option> modifier appears in a RCPT ACL.
49218 </para>
49219 <para>
49220 As there are now quite a few controls that can be applied, they are described
49221 separately in section <xref linkend="SECTcontrols"/>. The <option>control</option> modifier can be used
49222 in several different ways. For example:
49223 </para>
49224 <itemizedlist>
49225 <listitem>
49226 <para>
49227 It can be at the end of an <option>accept</option> statement:
49228 </para>
49229 <literallayout class="monospaced">
49230     accept  ...some conditions
49231             control = queue_only
49232 </literallayout>
49233 <para>
49234 In this case, the control is applied when this statement yields <quote>accept</quote>, in
49235 other words, when the conditions are all true.
49236 </para>
49237 </listitem>
49238 <listitem>
49239 <para>
49240 It can be in the middle of an <option>accept</option> statement:
49241 </para>
49242 <literallayout class="monospaced">
49243     accept  ...some conditions...
49244             control = queue_only
49245             ...some more conditions...
49246 </literallayout>
49247 <para>
49248 If the first set of conditions are true, the control is applied, even if the
49249 statement does not accept because one of the second set of conditions is false.
49250 In this case, some subsequent statement must yield <quote>accept</quote> for the control
49251 to be relevant.
49252 </para>
49253 </listitem>
49254 <listitem>
49255 <para>
49256 It can be used with <option>warn</option> to apply the control, leaving the
49257 decision about accepting or denying to a subsequent verb. For
49258 example:
49259 </para>
49260 <literallayout class="monospaced">
49261     warn    ...some conditions...
49262             control = freeze
49263     accept  ...
49264 </literallayout>
49265 <para>
49266 This example of <option>warn</option> does not contain <option>message</option>, <option>log_message</option>, or
49267 <option>logwrite</option>, so it does not add anything to the message and does not write a
49268 log entry.
49269 </para>
49270 </listitem>
49271 <listitem>
49272 <para>
49273 If you want to apply a control unconditionally, you can use it with a
49274 <option>require</option> verb. For example:
49275 </para>
49276 <literallayout class="monospaced">
49277     require  control = no_multiline_responses
49278 </literallayout>
49279 </listitem>
49280 </itemizedlist>
49281 </listitem></varlistentry>
49282 <varlistentry>
49283 <term><emphasis role="bold">delay</emphasis>&nbsp;=&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
49284 <listitem>
49285 <para>
49286 <indexterm role="concept">
49287 <primary><option>delay</option> ACL modifier</primary>
49288 </indexterm>
49289 <indexterm role="option">
49290 <primary><option>-bh</option></primary>
49291 </indexterm>
49292 This modifier may appear in any ACL. It causes Exim to wait for the time
49293 interval before proceeding. However, when testing Exim using the <option>-bh</option>
49294 option, the delay is not actually imposed (an appropriate message is output
49295 instead). The time is given in the usual Exim notation, and the delay happens
49296 as soon as the modifier is processed. In an SMTP session, pending output is
49297 flushed before the delay is imposed.
49298 </para>
49299 <para>
49300 Like <option>control</option>, <option>delay</option> can be used with <option>accept</option> or <option>deny</option>, for
49301 example:
49302 </para>
49303 <literallayout class="monospaced">
49304 deny    ...some conditions...
49305         delay = 30s
49306 </literallayout>
49307 <para>
49308 The delay happens if all the conditions are true, before the statement returns
49309 <quote>deny</quote>. Compare this with:
49310 </para>
49311 <literallayout class="monospaced">
49312 deny    delay = 30s
49313         ...some conditions...
49314 </literallayout>
49315 <para>
49316 which waits for 30s before processing the conditions. The <option>delay</option> modifier
49317 can also be used with <option>warn</option> and together with <option>control</option>:
49318 </para>
49319 <literallayout class="monospaced">
49320 warn    ...some conditions...
49321         delay = 2m
49322         control = freeze
49323 accept  ...
49324 </literallayout>
49325 <para>
49326 If <option>delay</option> is encountered when the SMTP PIPELINING extension is in use,
49327 responses to several commands are no longer buffered and sent in one packet (as
49328 they would normally be) because all output is flushed before imposing the
49329 delay. This optimization is disabled so that a number of small delays do not
49330 appear to the client as one large aggregated delay that might provoke an
49331 unwanted timeout. You can, however, disable output flushing for <option>delay</option> by
49332 using a <option>control</option> modifier to set <option>no_delay_flush</option>.
49333 </para>
49334 </listitem></varlistentry>
49335 <varlistentry>
49336 <term><emphasis role="bold">endpass</emphasis></term>
49337 <listitem>
49338 <para>
49339 <indexterm role="concept">
49340 <primary><option>endpass</option> ACL modifier</primary>
49341 </indexterm>
49342 This modifier, which has no argument, is recognized only in <option>accept</option> and
49343 <option>discard</option> statements. It marks the boundary between the conditions whose
49344 failure causes control to pass to the next statement, and the conditions whose
49345 failure causes the ACL to return <quote>deny</quote>. This concept has proved to be
49346 confusing to some people, so the use of <option>endpass</option> is no longer recommended as
49347 <quote>best practice</quote>. See the description of <option>accept</option> above for more details.
49348 </para>
49349 </listitem></varlistentry>
49350 <varlistentry>
49351 <term><emphasis role="bold">log_message</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
49352 <listitem>
49353 <para>
49354 <indexterm role="concept">
49355 <primary><option>log_message</option> ACL modifier</primary>
49356 </indexterm>
49357 This modifier sets up a message that is used as part of the log message if the
49358 ACL denies access or a <option>warn</option> statement&#x2019;s conditions are true. For example:
49359 </para>
49360 <literallayout class="monospaced">
49361 require log_message = wrong cipher suite $tls_cipher
49362         encrypted   = DES-CBC3-SHA
49363 </literallayout>
49364 <para>
49365 <option>log_message</option> is also used when recipients are discarded by <option>discard</option>. For
49366 example:
49367 </para>
49368 <literallayout>
49369 <literal>discard </literal>&lt;<emphasis>some conditions</emphasis>&gt;
49370 <literal>        log_message = Discarded $local_part@$domain because...</literal>
49371 </literallayout>
49372 <para>
49373 When access is denied, <option>log_message</option> adds to any underlying error message
49374 that may exist because of a condition failure. For example, while verifying a
49375 recipient address, a <emphasis>:fail:</emphasis> redirection might have already set up a
49376 message.
49377 </para>
49378 <para>
49379 The message may be defined before the conditions to which it applies, because
49380 the string expansion does not happen until Exim decides that access is to be
49381 denied. This means that any variables that are set by the condition are
49382 available for inclusion in the message. For example, the <varname>$dnslist_</varname>&lt;<emphasis>xxx</emphasis>&gt;
49383 variables are set after a DNS black list lookup succeeds. If the expansion of
49384 <option>log_message</option> fails, or if the result is an empty string, the modifier is
49385 ignored.
49386 </para>
49387 <para>
49388 <indexterm role="variable">
49389 <primary><varname>$acl_verify_message</varname></primary>
49390 </indexterm>
49391 If you want to use a <option>warn</option> statement to log the result of an address
49392 verification, you can use <varname>$acl_verify_message</varname> to include the verification
49393 error message.
49394 </para>
49395 <para>
49396 If <option>log_message</option> is used with a <option>warn</option> statement, <quote>Warning:</quote> is added to
49397 the start of the logged message. If the same warning log message is requested
49398 more than once while receiving  a single email message, only one copy is
49399 actually logged. If you want to log multiple copies, use <option>logwrite</option> instead
49400 of <option>log_message</option>. In the absence of <option>log_message</option> and <option>logwrite</option>, nothing
49401 is logged for a successful <option>warn</option> statement.
49402 </para>
49403 <para>
49404 If <option>log_message</option> is not present and there is no underlying error message (for
49405 example, from the failure of address verification), but <option>message</option> is present,
49406 the <option>message</option> text is used for logging rejections. However, if any text for
49407 logging contains newlines, only the first line is logged. In the absence of
49408 both <option>log_message</option> and <option>message</option>, a default built-in message is used for
49409 logging rejections.
49410 </para>
49411 </listitem></varlistentry>
49412 <varlistentry>
49413 <term><emphasis role="bold">log_reject_target</emphasis>&nbsp;=&nbsp;&lt;<emphasis>log name list</emphasis>&gt;</term>
49414 <listitem>
49415 <para>
49416 <indexterm role="concept">
49417 <primary><option>log_reject_target</option> ACL modifier</primary>
49418 </indexterm>
49419 <indexterm role="concept">
49420 <primary>logging in ACL</primary>
49421 <secondary>specifying which log</secondary>
49422 </indexterm>
49423 This modifier makes it possible to specify which logs are used for messages
49424 about ACL rejections. Its argument is a colon-separated list of words that can
49425 be <quote>main</quote>, <quote>reject</quote>, or <quote>panic</quote>. The default is <literal>main:reject</literal>. The list
49426 may be empty, in which case a rejection is not logged at all. For example, this
49427 ACL fragment writes no logging information when access is denied:
49428 </para>
49429 <literallayout>
49430 <literal>deny </literal>&lt;<emphasis>some conditions</emphasis>&gt;
49431 <literal>     log_reject_target =</literal>
49432 </literallayout>
49433 <para>
49434 This modifier can be used in SMTP and non-SMTP ACLs. It applies to both
49435 permanent and temporary rejections. Its effect lasts for the rest of the
49436 current ACL.
49437 </para>
49438 </listitem></varlistentry>
49439 <varlistentry>
49440 <term><emphasis role="bold">logwrite</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
49441 <listitem>
49442 <para>
49443 <indexterm role="concept">
49444 <primary><option>logwrite</option> ACL modifier</primary>
49445 </indexterm>
49446 <indexterm role="concept">
49447 <primary>logging in ACL</primary>
49448 <secondary>immediate</secondary>
49449 </indexterm>
49450 This modifier writes a message to a log file as soon as it is encountered when
49451 processing an ACL. (Compare <option>log_message</option>, which, except in the case of
49452 <option>warn</option> and <option>discard</option>, is used only if the ACL statement denies
49453 access.) The <option>logwrite</option> modifier can be used to log special incidents in
49454 ACLs. For example:
49455 </para>
49456 <literallayout>
49457 <literal>accept </literal>&lt;<emphasis>some special conditions</emphasis>&gt;
49458 <literal>       control  = freeze</literal>
49459 <literal>       logwrite = froze message because ...</literal>
49460 </literallayout>
49461 <para>
49462 By default, the message is written to the main log. However, it may begin
49463 with a colon, followed by a comma-separated list of log names, and then
49464 another colon, to specify exactly which logs are to be written. For
49465 example:
49466 </para>
49467 <literallayout class="monospaced">
49468 logwrite = :main,reject: text for main and reject logs
49469 logwrite = :panic: text for panic log only
49470 </literallayout>
49471 </listitem></varlistentry>
49472 <varlistentry>
49473 <term><emphasis role="bold">message</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
49474 <listitem>
49475 <para>
49476 <indexterm role="concept">
49477 <primary><option>message</option> ACL modifier</primary>
49478 </indexterm>
49479 This modifier sets up a text string that is expanded and used as a response
49480 message when an ACL statement terminates the ACL with an <quote>accept</quote>, <quote>deny</quote>,
49481 or <quote>defer</quote> response. (In the case of the <option>accept</option> and <option>discard</option> verbs,
49482 there is some complication if <option>endpass</option> is involved; see the description of
49483 <option>accept</option> for details.)
49484 </para>
49485 <para>
49486 The expansion of the message happens at the time Exim decides that the ACL is
49487 to end, not at the time it processes <option>message</option>. If the expansion fails, or
49488 generates an empty string, the modifier is ignored. Here is an example where
49489 <option>message</option> must be specified first, because the ACL ends with a rejection if
49490 the <option>hosts</option> condition fails:
49491 </para>
49492 <literallayout class="monospaced">
49493 require  message = Host not recognized
49494          hosts = 10.0.0.0/8
49495 </literallayout>
49496 <para>
49497 (Once a condition has failed, no further conditions or modifiers are
49498 processed.)
49499 </para>
49500 <para>
49501 <indexterm role="concept">
49502 <primary>SMTP</primary>
49503 <secondary>error codes</secondary>
49504 </indexterm>
49505 <indexterm role="option">
49506 <primary><option>smtp_banner</option></primary>
49507 </indexterm>
49508 For ACLs that are triggered by SMTP commands, the message is returned as part
49509 of the SMTP response. The use of <option>message</option> with <option>accept</option> (or <option>discard</option>)
49510 is meaningful only for SMTP, as no message is returned when a non-SMTP message
49511 is accepted. In the case of the connect ACL, accepting with a message modifier
49512 overrides the value of <option>smtp_banner</option>. For the EHLO/HELO ACL, a customized
49513 accept message may not contain more than one line (otherwise it will be
49514 truncated at the first newline and a panic logged), and it cannot affect the
49515 EHLO options.
49516 </para>
49517 <para>
49518 When SMTP is involved, the message may begin with an overriding response code,
49519 consisting of three digits optionally followed by an <quote>extended response code</quote>
49520 of the form <emphasis>n.n.n</emphasis>, each code being followed by a space. For example:
49521 </para>
49522 <literallayout class="monospaced">
49523 deny  message = 599 1.2.3 Host not welcome
49524       hosts = 192.168.34.0/24
49525 </literallayout>
49526 <para>
49527 The first digit of the supplied response code must be the same as would be sent
49528 by default. A panic occurs if it is not. Exim uses a 550 code when it denies
49529 access, but for the predata ACL, note that the default success code is 354, not
49530 2<emphasis>xx</emphasis>.
49531 </para>
49532 <para>
49533 Notwithstanding the previous paragraph, for the QUIT ACL, unlike the others,
49534 the message modifier cannot override the 221 response code.
49535 </para>
49536 <para>
49537 The text in a <option>message</option> modifier is literal; any quotes are taken as
49538 literals, but because the string is expanded, backslash escapes are processed
49539 anyway. If the message contains newlines, this gives rise to a multi-line SMTP
49540 response.
49541 </para>
49542 <para>
49543 <indexterm role="variable">
49544 <primary><varname>$acl_verify_message</varname></primary>
49545 </indexterm>
49546 If <option>message</option> is used on a statement that verifies an address, the message
49547 specified overrides any message that is generated by the verification process.
49548 However, the original message is available in the variable
49549 <varname>$acl_verify_message</varname>, so you can incorporate it into your message if you
49550 wish. In particular, if you want the text from <option>:fail:</option> items in <command>redirect</command>
49551 routers to be passed back as part of the SMTP response, you should either not
49552 use a <option>message</option> modifier, or make use of <varname>$acl_verify_message</varname>.
49553 </para>
49554 <para>
49555 For compatibility with previous releases of Exim, a <option>message</option> modifier that
49556 is used with a <option>warn</option> verb behaves in a similar way to the <option>add_header</option>
49557 modifier, but this usage is now deprecated. However, <option>message</option> acts only when
49558 all the conditions are true, wherever it appears in an ACL command, whereas
49559 <option>add_header</option> acts as soon as it is encountered. If <option>message</option> is used with
49560 <option>warn</option> in an ACL that is not concerned with receiving a message, it has no
49561 effect.
49562 </para>
49563 </listitem></varlistentry>
49564 <varlistentry>
49565 <term><emphasis role="bold">set</emphasis>&nbsp;&lt;<emphasis>acl_name</emphasis>&gt;&nbsp;=&nbsp;&lt;<emphasis>value</emphasis>&gt;</term>
49566 <listitem>
49567 <para>
49568 <indexterm role="concept">
49569 <primary><option>set</option> ACL modifier</primary>
49570 </indexterm>
49571 This modifier puts a value into one of the ACL variables (see section
49572 <xref linkend="SECTaclvariables"/>).
49573 </para>
49574 </listitem></varlistentry>
49575 </variablelist>
49576 </section>
49577 <section id="SECTcontrols">
49578 <title>Use of the control modifier</title>
49579 <para>
49580 <indexterm role="concept">
49581 <primary><option>control</option> ACL modifier</primary>
49582 </indexterm>
49583 The <option>control</option> modifier supports the following settings:
49584 </para>
49585 <variablelist>
49586 <varlistentry>
49587 <term><emphasis role="bold">control&nbsp;=&nbsp;allow_auth_unadvertised</emphasis></term>
49588 <listitem>
49589 <para>
49590 This modifier allows a client host to use the SMTP AUTH command even when it
49591 has not been advertised in response to EHLO. Furthermore, because there are
49592 apparently some really broken clients that do this, Exim will accept AUTH after
49593 HELO (rather than EHLO) when this control is set. It should be used only if you
49594 really need it, and you should limit its use to those broken clients that do
49595 not work without it. For example:
49596 </para>
49597 <literallayout class="monospaced">
49598 warn hosts   = 192.168.34.25
49599      control = allow_auth_unadvertised
49600 </literallayout>
49601 <para>
49602 Normally, when an Exim server receives an AUTH command, it checks the name of
49603 the authentication mechanism that is given in the command to ensure that it
49604 matches an advertised mechanism. When this control is set, the check that a
49605 mechanism has been advertised is bypassed. Any configured mechanism can be used
49606 by the client. This control is permitted only in the connection and HELO ACLs.
49607 </para>
49608 </listitem></varlistentry>
49609 <varlistentry>
49610 <term><emphasis role="bold">control&nbsp;=&nbsp;caseful_local_part</emphasis></term>
49611 <term><emphasis role="bold">control&nbsp;=&nbsp;caselower_local_part</emphasis></term>
49612 <listitem>
49613 <para>
49614 <indexterm role="concept">
49615 <primary>access control lists (ACLs)</primary>
49616 <secondary>case of local part in</secondary>
49617 </indexterm>
49618 <indexterm role="concept">
49619 <primary>case of local parts</primary>
49620 </indexterm>
49621 <indexterm role="variable">
49622 <primary><varname>$local_part</varname></primary>
49623 </indexterm>
49624 These two controls are permitted only in the ACL specified by <option>acl_smtp_rcpt</option>
49625 (that is, during RCPT processing). By default, the contents of <varname>$local_part</varname>
49626 are lower cased before ACL processing. If <quote>caseful_local_part</quote> is specified,
49627 any uppercase letters in the original local part are restored in <varname>$local_part</varname>
49628 for the rest of the ACL, or until a control that sets <quote>caselower_local_part</quote>
49629 is encountered.
49630 </para>
49631 <para>
49632 These controls affect only the current recipient. Moreover, they apply only to
49633 local part handling that takes place directly in the ACL (for example, as a key
49634 in lookups). If a test to verify the recipient is obeyed, the case-related
49635 handling of the local part during the verification is controlled by the router
49636 configuration (see the <option>caseful_local_part</option> generic router option).
49637 </para>
49638 <para>
49639 This facility could be used, for example, to add a spam score to local parts
49640 containing upper case letters. For example, using <varname>$acl_m4</varname> to accumulate the
49641 spam score:
49642 </para>
49643 <literallayout class="monospaced">
49644 warn  control = caseful_local_part
49645       set acl_m4 = ${eval:\
49646                      $acl_m4 + \
49647                      ${if match{$local_part}{[A-Z]}{1}{0}}\
49648                     }
49649       control = caselower_local_part
49650 </literallayout>
49651 <para>
49652 Notice that we put back the lower cased version afterwards, assuming that
49653 is what is wanted for subsequent tests.
49654 </para>
49655 </listitem></varlistentry>
49656 <varlistentry>
49657 <term><emphasis role="bold">control&nbsp;=&nbsp;debug/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
49658 <listitem>
49659 <para>
49660 <indexterm role="concept">
49661 <primary>access control lists (ACLs)</primary>
49662 <secondary>enabling debug logging</secondary>
49663 </indexterm>
49664 <indexterm role="concept">
49665 <primary>debugging</primary>
49666 <secondary>enabling from an ACL</secondary>
49667 </indexterm>
49668 This control turns on debug logging, almost as though Exim had been invoked
49669 with <literal>-d</literal>, with the output going to a new logfile, by default called
49670 <emphasis>debuglog</emphasis>.  The filename can be adjusted with the <emphasis>tag</emphasis> option, which
49671 may access any variables already defined.  The logging may be adjusted with
49672 the <emphasis>opts</emphasis> option, which takes the same values as the <literal>-d</literal> command-line
49673 option.  Some examples (which depend on variables that don&#x2019;t exist in all
49674 contexts):
49675 </para>
49676 <literallayout class="monospaced">
49677       control = debug
49678       control = debug/tag=.$sender_host_address
49679       control = debug/opts=+expand+acl
49680       control = debug/tag=.$message_exim_id/opts=+expand
49681 </literallayout>
49682 </listitem></varlistentry>
49683 <varlistentry>
49684 <term><emphasis role="bold">control&nbsp;=&nbsp;enforce_sync</emphasis></term>
49685 <term><emphasis role="bold">control&nbsp;=&nbsp;no_enforce_sync</emphasis></term>
49686 <listitem>
49687 <para>
49688 <indexterm role="concept">
49689 <primary>SMTP</primary>
49690 <secondary>synchronization checking</secondary>
49691 </indexterm>
49692 <indexterm role="concept">
49693 <primary>synchronization checking in SMTP</primary>
49694 </indexterm>
49695 These controls make it possible to be selective about when SMTP synchronization
49696 is enforced. The global option <option>smtp_enforce_sync</option> specifies the initial
49697 state of the switch (it is true by default). See the description of this option
49698 in chapter <xref linkend="CHAPmainconfig"/> for details of SMTP synchronization checking.
49699 </para>
49700 <para>
49701 The effect of these two controls lasts for the remainder of the SMTP
49702 connection. They can appear in any ACL except the one for the non-SMTP
49703 messages. The most straightforward place to put them is in the ACL defined by
49704 <option>acl_smtp_connect</option>, which is run at the start of an incoming SMTP connection,
49705 before the first synchronization check. The expected use is to turn off the
49706 synchronization checks for badly-behaved hosts that you nevertheless need to
49707 work with.
49708 </para>
49709 </listitem></varlistentry>
49710 <varlistentry>
49711 <term><emphasis role="bold">control&nbsp;=&nbsp;fakedefer/</emphasis>&lt;<emphasis>message</emphasis>&gt;</term>
49712 <listitem>
49713 <para>
49714 <indexterm role="concept">
49715 <primary>fake defer</primary>
49716 </indexterm>
49717 <indexterm role="concept">
49718 <primary>defer, fake</primary>
49719 </indexterm>
49720 This control works in exactly the same way as <option>fakereject</option> (described below)
49721 except that it causes an SMTP 450 response after the message data instead of a
49722 550 response. You must take care when using <option>fakedefer</option> because it causes the
49723 messages to be duplicated when the sender retries. Therefore, you should not
49724 use <option>fakedefer</option> if the message is to be delivered normally.
49725 </para>
49726 </listitem></varlistentry>
49727 <varlistentry>
49728 <term><emphasis role="bold">control&nbsp;=&nbsp;fakereject/</emphasis>&lt;<emphasis>message</emphasis>&gt;</term>
49729 <listitem>
49730 <para>
49731 <indexterm role="concept">
49732 <primary>fake rejection</primary>
49733 </indexterm>
49734 <indexterm role="concept">
49735 <primary>rejection, fake</primary>
49736 </indexterm>
49737 This control is permitted only for the MAIL, RCPT, and DATA ACLs, in other
49738 words, only when an SMTP message is being received. If Exim accepts the
49739 message, instead the final 250 response, a 550 rejection message is sent.
49740 However, Exim proceeds to deliver the message as normal. The control applies
49741 only to the current message, not to any subsequent ones that may be received in
49742 the same SMTP connection.
49743 </para>
49744 <para>
49745 The text for the 550 response is taken from the <option>control</option> modifier. If no
49746 message is supplied, the following is used:
49747 </para>
49748 <literallayout class="monospaced">
49749 550-Your message has been rejected but is being
49750 550-kept for evaluation.
49751 550-If it was a legitimate message, it may still be
49752 550 delivered to the target recipient(s).
49753 </literallayout>
49754 <para>
49755 This facility should be used with extreme caution.
49756 </para>
49757 </listitem></varlistentry>
49758 <varlistentry>
49759 <term><emphasis role="bold">control&nbsp;=&nbsp;freeze</emphasis></term>
49760 <listitem>
49761 <para>
49762 <indexterm role="concept">
49763 <primary>frozen messages</primary>
49764 <secondary>forcing in ACL</secondary>
49765 </indexterm>
49766 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
49767 other words, only when a message is being received. If the message is accepted,
49768 it is placed on Exim&#x2019;s queue and frozen. The control applies only to the
49769 current message, not to any subsequent ones that may be received in the same
49770 SMTP connection.
49771 </para>
49772 <para>
49773 This modifier can optionally be followed by <literal>/no_tell</literal>. If the global option
49774 <option>freeze_tell</option> is set, it is ignored for the current message (that is, nobody
49775 is told about the freezing), provided all the <emphasis role="bold">control=freeze</emphasis> modifiers that
49776 are obeyed for the current message have the <literal>/no_tell</literal> option.
49777 </para>
49778 </listitem></varlistentry>
49779 <varlistentry>
49780 <term><emphasis role="bold">control&nbsp;=&nbsp;no_delay_flush</emphasis></term>
49781 <listitem>
49782 <para>
49783 <indexterm role="concept">
49784 <primary>SMTP</primary>
49785 <secondary>output flushing, disabling for delay</secondary>
49786 </indexterm>
49787 Exim normally flushes SMTP output before implementing a delay in an ACL, to
49788 avoid unexpected timeouts in clients when the SMTP PIPELINING extension is in
49789 use. This control, as long as it is encountered before the <option>delay</option> modifier,
49790 disables such output flushing.
49791 </para>
49792 </listitem></varlistentry>
49793 <varlistentry>
49794 <term><emphasis role="bold">control&nbsp;=&nbsp;no_callout_flush</emphasis></term>
49795 <listitem>
49796 <para>
49797 <indexterm role="concept">
49798 <primary>SMTP</primary>
49799 <secondary>output flushing, disabling for callout</secondary>
49800 </indexterm>
49801 Exim normally flushes SMTP output before performing a callout in an ACL, to
49802 avoid unexpected timeouts in clients when the SMTP PIPELINING extension is in
49803 use. This control, as long as it is encountered before the <option>verify</option> condition
49804 that causes the callout, disables such output flushing.
49805 </para>
49806 </listitem></varlistentry>
49807 <varlistentry>
49808 <term><emphasis role="bold">control&nbsp;=&nbsp;no_mbox_unspool</emphasis></term>
49809 <listitem>
49810 <para>
49811 This control is available when Exim is compiled with the content scanning
49812 extension. Content scanning may require a copy of the current message, or parts
49813 of it, to be written in <quote>mbox format</quote> to a spool file, for passing to a virus
49814 or spam scanner. Normally, such copies are deleted when they are no longer
49815 needed. If this control is set, the copies are not deleted. The control applies
49816 only to the current message, not to any subsequent ones that may be received in
49817 the same SMTP connection. It is provided for debugging purposes and is unlikely
49818 to be useful in production.
49819 </para>
49820 </listitem></varlistentry>
49821 <varlistentry>
49822 <term><emphasis role="bold">control&nbsp;=&nbsp;no_multiline_responses</emphasis></term>
49823 <listitem>
49824 <para>
49825 <indexterm role="concept">
49826 <primary>multiline responses, suppressing</primary>
49827 </indexterm>
49828 This control is permitted for any ACL except the one for non-SMTP messages.
49829 It seems that there are broken clients in use that cannot handle multiline
49830 SMTP responses, despite the fact that RFC 821 defined them over 20 years ago.
49831 </para>
49832 <para>
49833 If this control is set, multiline SMTP responses from ACL rejections are
49834 suppressed. One way of doing this would have been to put out these responses as
49835 one long line. However, RFC 2821 specifies a maximum of 512 bytes per response
49836 (<quote>use multiline responses for more</quote> it says &ndash; ha!), and some of the
49837 responses might get close to that. So this facility, which is after all only a
49838 sop to broken clients, is implemented by doing two very easy things:
49839 </para>
49840 <itemizedlist>
49841 <listitem>
49842 <para>
49843 Extra information that is normally output as part of a rejection caused by
49844 sender verification failure is omitted. Only the final line (typically <quote>sender
49845 verification failed</quote>) is sent.
49846 </para>
49847 </listitem>
49848 <listitem>
49849 <para>
49850 If a <option>message</option> modifier supplies a multiline response, only the first
49851 line is output.
49852 </para>
49853 </listitem>
49854 </itemizedlist>
49855 <para>
49856 The setting of the switch can, of course, be made conditional on the
49857 calling host. Its effect lasts until the end of the SMTP connection.
49858 </para>
49859 </listitem></varlistentry>
49860 <varlistentry>
49861 <term><emphasis role="bold">control&nbsp;=&nbsp;no_pipelining</emphasis></term>
49862 <listitem>
49863 <para>
49864 <indexterm role="concept">
49865 <primary>PIPELINING</primary>
49866 <secondary>suppressing advertising</secondary>
49867 </indexterm>
49868 This control turns off the advertising of the PIPELINING extension to SMTP in
49869 the current session. To be useful, it must be obeyed before Exim sends its
49870 response to an EHLO command. Therefore, it should normally appear in an ACL
49871 controlled by <option>acl_smtp_connect</option> or <option>acl_smtp_helo</option>. See also
49872 <option>pipelining_advertise_hosts</option>.
49873 </para>
49874 </listitem></varlistentry>
49875 <varlistentry>
49876 <term><emphasis role="bold">control&nbsp;=&nbsp;queue_only</emphasis></term>
49877 <listitem>
49878 <para>
49879 <indexterm role="option">
49880 <primary><option>queue_only</option></primary>
49881 </indexterm>
49882 <indexterm role="concept">
49883 <primary>queueing incoming messages</primary>
49884 </indexterm>
49885 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
49886 other words, only when a message is being received. If the message is accepted,
49887 it is placed on Exim&#x2019;s queue and left there for delivery by a subsequent queue
49888 runner. No immediate delivery process is started. In other words, it has the
49889 effect as the <option>queue_only</option> global option. However, the control applies only
49890 to the current message, not to any subsequent ones that may be received in the
49891 same SMTP connection.
49892 </para>
49893 </listitem></varlistentry>
49894 <varlistentry>
49895 <term><emphasis role="bold">control&nbsp;=&nbsp;submission/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
49896 <listitem>
49897 <para>
49898 <indexterm role="concept">
49899 <primary>message</primary>
49900 <secondary>submission</secondary>
49901 </indexterm>
49902 <indexterm role="concept">
49903 <primary>submission mode</primary>
49904 </indexterm>
49905 This control is permitted only for the MAIL, RCPT, and start of data ACLs (the
49906 latter is the one defined by <option>acl_smtp_predata</option>). Setting it tells Exim that
49907 the current message is a submission from a local MUA. In this case, Exim
49908 operates in <quote>submission mode</quote>, and applies certain fixups to the message if
49909 necessary. For example, it adds a <emphasis>Date:</emphasis> header line if one is not present.
49910 This control is not permitted in the <option>acl_smtp_data</option> ACL, because that is too
49911 late (the message has already been created).
49912 </para>
49913 <para>
49914 Chapter <xref linkend="CHAPmsgproc"/> describes the processing that Exim applies to
49915 messages. Section <xref linkend="SECTsubmodnon"/> covers the processing that happens in
49916 submission mode; the available options for this control are described there.
49917 The control applies only to the current message, not to any subsequent ones
49918 that may be received in the same SMTP connection.
49919 </para>
49920 </listitem></varlistentry>
49921 <varlistentry>
49922 <term><emphasis role="bold">control&nbsp;=&nbsp;suppress_local_fixups</emphasis></term>
49923 <listitem>
49924 <para>
49925 <indexterm role="concept">
49926 <primary>submission fixups, suppressing</primary>
49927 </indexterm>
49928 This control applies to locally submitted (non TCP/IP) messages, and is the
49929 complement of <literal>control = submission</literal>. It disables the fixups that are
49930 normally applied to locally-submitted messages. Specifically:
49931 </para>
49932 <itemizedlist>
49933 <listitem>
49934 <para>
49935 Any <emphasis>Sender:</emphasis> header line is left alone (in this respect, it is a
49936 dynamic version of <option>local_sender_retain</option>).
49937 </para>
49938 </listitem>
49939 <listitem>
49940 <para>
49941 No <emphasis>Message-ID:</emphasis>, <emphasis>From:</emphasis>, or <emphasis>Date:</emphasis> header lines are added.
49942 </para>
49943 </listitem>
49944 <listitem>
49945 <para>
49946 There is no check that <emphasis>From:</emphasis> corresponds to the actual sender.
49947 </para>
49948 </listitem>
49949 </itemizedlist>
49950 <para>
49951 This control may be useful when a remotely-originated message is accepted,
49952 passed to some scanning program, and then re-submitted for delivery. It can be
49953 used only in the <option>acl_smtp_mail</option>, <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>,
49954 and <option>acl_not_smtp_start</option> ACLs, because it has to be set before the message&#x2019;s
49955 data is read.
49956 </para>
49957 <para>
49958 <emphasis role="bold">Note:</emphasis> This control applies only to the current message, not to any others
49959 that are being submitted at the same time using <option>-bs</option> or <option>-bS</option>.
49960 </para>
49961 </listitem></varlistentry>
49962 </variablelist>
49963 </section>
49964 <section id="SECTsummesfix">
49965 <title>Summary of message fixup control</title>
49966 <para>
49967 All four possibilities for message fixups can be specified:
49968 </para>
49969 <itemizedlist>
49970 <listitem>
49971 <para>
49972 Locally submitted, fixups applied: the default.
49973 </para>
49974 </listitem>
49975 <listitem>
49976 <para>
49977 Locally submitted, no fixups applied: use
49978 <literal>control = suppress_local_fixups</literal>.
49979 </para>
49980 </listitem>
49981 <listitem>
49982 <para>
49983 Remotely submitted, no fixups applied: the default.
49984 </para>
49985 </listitem>
49986 <listitem>
49987 <para>
49988 Remotely submitted, fixups applied: use <literal>control = submission</literal>.
49989 </para>
49990 </listitem>
49991 </itemizedlist>
49992 </section>
49993 <section id="SECTaddheadacl">
49994 <title>Adding header lines in ACLs</title>
49995 <para>
49996 <indexterm role="concept">
49997 <primary>header lines</primary>
49998 <secondary>adding in an ACL</secondary>
49999 </indexterm>
50000 <indexterm role="concept">
50001 <primary>header lines</primary>
50002 <secondary>position of added lines</secondary>
50003 </indexterm>
50004 <indexterm role="concept">
50005 <primary><option>message</option> ACL modifier</primary>
50006 </indexterm>
50007 The <option>add_header</option> modifier can be used to add one or more extra header lines
50008 to an incoming message, as in this example:
50009 </para>
50010 <literallayout class="monospaced">
50011 warn dnslists = sbl.spamhaus.org : \
50012                 dialup.mail-abuse.org
50013      add_header = X-blacklisted-at: $dnslist_domain
50014 </literallayout>
50015 <para>
50016 The <option>add_header</option> modifier is permitted in the MAIL, RCPT, PREDATA, DATA,
50017 MIME, and non-SMTP ACLs (in other words, those that are concerned with
50018 receiving a message). The message must ultimately be accepted for
50019 <option>add_header</option> to have any significant effect. You can use <option>add_header</option> with
50020 any ACL verb, including <option>deny</option> (though this is potentially useful only in a
50021 RCPT ACL).
50022 </para>
50023 <para>
50024 If the data for the <option>add_header</option> modifier contains one or more newlines that
50025 are not followed by a space or a tab, it is assumed to contain multiple header
50026 lines. Each one is checked for valid syntax; <literal>X-ACL-Warn:</literal> is added to the
50027 front of any line that is not a valid header line.
50028 </para>
50029 <para>
50030 Added header lines are accumulated during the MAIL, RCPT, and predata ACLs.
50031 They are added to the message before processing the DATA and MIME ACLs.
50032 However, if an identical header line is requested more than once, only one copy
50033 is actually added to the message. Further header lines may be accumulated
50034 during the DATA and MIME ACLs, after which they are added to the message, again
50035 with duplicates suppressed. Thus, it is possible to add two identical header
50036 lines to an SMTP message, but only if one is added before DATA and one after.
50037 In the case of non-SMTP messages, new headers are accumulated during the
50038 non-SMTP ACLs, and are added to the message after all the ACLs have run. If a
50039 message is rejected after DATA or by the non-SMTP ACL, all added header lines
50040 are included in the entry that is written to the reject log.
50041 </para>
50042 <para>
50043 <indexterm role="concept">
50044 <primary>header lines</primary>
50045 <secondary>added; visibility of</secondary>
50046 </indexterm>
50047 Header lines are not visible in string expansions until they are added to the
50048 message. It follows that header lines defined in the MAIL, RCPT, and predata
50049 ACLs are not visible until the DATA ACL and MIME ACLs are run. Similarly,
50050 header lines that are added by the DATA or MIME ACLs are not visible in those
50051 ACLs. Because of this restriction, you cannot use header lines as a way of
50052 passing data between (for example) the MAIL and RCPT ACLs. If you want to do
50053 this, you can use ACL variables, as described in section
50054 <xref linkend="SECTaclvariables"/>.
50055 </para>
50056 <para>
50057 The <option>add_header</option> modifier acts immediately it is encountered during the
50058 processing of an ACL. Notice the difference between these two cases:
50059 </para>
50060 <literallayout>
50061 <literal>accept add_header = ADDED: some text</literal>
50062 <literal>       </literal>&lt;<emphasis>some condition</emphasis>&gt;
50063
50064 <literal>accept </literal>&lt;<emphasis>some condition</emphasis>&gt;
50065 <literal>       add_header = ADDED: some text</literal>
50066 </literallayout>
50067 <para>
50068 In the first case, the header line is always added, whether or not the
50069 condition is true. In the second case, the header line is added only if the
50070 condition is true. Multiple occurrences of <option>add_header</option> may occur in the same
50071 ACL statement. All those that are encountered before a condition fails are
50072 honoured.
50073 </para>
50074 <para>
50075 <indexterm role="concept">
50076 <primary><option>warn</option> ACL verb</primary>
50077 </indexterm>
50078 For compatibility with previous versions of Exim, a <option>message</option> modifier for a
50079 <option>warn</option> verb acts in the same way as <option>add_header</option>, except that it takes
50080 effect only if all the conditions are true, even if it appears before some of
50081 them. Furthermore, only the last occurrence of <option>message</option> is honoured. This
50082 usage of <option>message</option> is now deprecated. If both <option>add_header</option> and <option>message</option>
50083 are present on a <option>warn</option> verb, both are processed according to their
50084 specifications.
50085 </para>
50086 <para>
50087 By default, new header lines are added to a message at the end of the existing
50088 header lines. However, you can specify that any particular header line should
50089 be added right at the start (before all the <emphasis>Received:</emphasis> lines), immediately
50090 after the first block of <emphasis>Received:</emphasis> lines, or immediately before any line
50091 that is not a <emphasis>Received:</emphasis> or <emphasis>Resent-something:</emphasis> header.
50092 </para>
50093 <para>
50094 This is done by specifying <quote>:at_start:</quote>, <quote>:after_received:</quote>, or
50095 <quote>:at_start_rfc:</quote> (or, for completeness, <quote>:at_end:</quote>) before the text of the
50096 header line, respectively. (Header text cannot start with a colon, as there has
50097 to be a header name first.) For example:
50098 </para>
50099 <literallayout class="monospaced">
50100 warn add_header = \
50101        :after_received:X-My-Header: something or other...
50102 </literallayout>
50103 <para>
50104 If more than one header line is supplied in a single <option>add_header</option> modifier,
50105 each one is treated independently and can therefore be placed differently. If
50106 you add more than one line at the start, or after the Received: block, they end
50107 up in reverse order.
50108 </para>
50109 <para>
50110 <emphasis role="bold">Warning</emphasis>: This facility currently applies only to header lines that are
50111 added in an ACL. It does NOT work for header lines that are added in a
50112 system filter or in a router or transport.
50113 </para>
50114 </section>
50115 <section id="SECTaclconditions">
50116 <title>ACL conditions</title>
50117 <para>
50118 <indexterm role="concept">
50119 <primary>access control lists (ACLs)</primary>
50120 <secondary>conditions; list of</secondary>
50121 </indexterm>
50122 Some of conditions listed in this section are available only when Exim is
50123 compiled with the content-scanning extension. They are included here briefly
50124 for completeness. More detailed descriptions can be found in the discussion on
50125 content scanning in chapter <xref linkend="CHAPexiscan"/>.
50126 </para>
50127 <para>
50128 Not all conditions are relevant in all circumstances. For example, testing
50129 senders and recipients does not make sense in an ACL that is being run as the
50130 result of the arrival of an ETRN command, and checks on message headers can be
50131 done only in the ACLs specified by <option>acl_smtp_data</option> and <option>acl_not_smtp</option>. You
50132 can use the same condition (with different parameters) more than once in the
50133 same ACL statement. This provides a way of specifying an <quote>and</quote> conjunction.
50134 The conditions are as follows:
50135 </para>
50136 <variablelist>
50137 <varlistentry>
50138 <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>
50139 <listitem>
50140 <para>
50141 <indexterm role="concept">
50142 <primary>access control lists (ACLs)</primary>
50143 <secondary>nested</secondary>
50144 </indexterm>
50145 <indexterm role="concept">
50146 <primary>access control lists (ACLs)</primary>
50147 <secondary>indirect</secondary>
50148 </indexterm>
50149 <indexterm role="concept">
50150 <primary><option>acl</option> ACL condition</primary>
50151 </indexterm>
50152 The possible values of the argument are the same as for the
50153 <option>acl_smtp_</option><emphasis>xxx</emphasis> options. The named or inline ACL is run. If it returns
50154 <quote>accept</quote> the condition is true; if it returns <quote>deny</quote> the condition is
50155 false. If it returns <quote>defer</quote>, the current ACL returns <quote>defer</quote> unless the
50156 condition is on a <option>warn</option> verb. In that case, a <quote>defer</quote> return makes the
50157 condition false. This means that further processing of the <option>warn</option> verb
50158 ceases, but processing of the ACL continues.
50159 </para>
50160 <para>
50161 If the nested <option>acl</option> returns <quote>drop</quote> and the outer condition denies access,
50162 the connection is dropped. If it returns <quote>discard</quote>, the verb must be
50163 <option>accept</option> or <option>discard</option>, and the action is taken immediately &ndash; no further
50164 conditions are tested.
50165 </para>
50166 <para>
50167 ACLs may be nested up to 20 deep; the limit exists purely to catch runaway
50168 loops. This condition allows you to use different ACLs in different
50169 circumstances. For example, different ACLs can be used to handle RCPT commands
50170 for different local users or different local domains.
50171 </para>
50172 </listitem></varlistentry>
50173 <varlistentry>
50174 <term><emphasis role="bold">authenticated&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string&nbsp;list</emphasis>&gt;</term>
50175 <listitem>
50176 <para>
50177 <indexterm role="concept">
50178 <primary><option>authenticated</option> ACL condition</primary>
50179 </indexterm>
50180 <indexterm role="concept">
50181 <primary>authentication</primary>
50182 <secondary>ACL checking</secondary>
50183 </indexterm>
50184 <indexterm role="concept">
50185 <primary>access control lists (ACLs)</primary>
50186 <secondary>testing for authentication</secondary>
50187 </indexterm>
50188 If the SMTP connection is not authenticated, the condition is false. Otherwise,
50189 the name of the authenticator is tested against the list. To test for
50190 authentication by any authenticator, you can set
50191 </para>
50192 <literallayout class="monospaced">
50193 authenticated = *
50194 </literallayout>
50195 </listitem></varlistentry>
50196 <varlistentry>
50197 <term><emphasis role="bold">condition&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string</emphasis>&gt;</term>
50198 <listitem>
50199 <para>
50200 <indexterm role="concept">
50201 <primary><option>condition</option> ACL condition</primary>
50202 </indexterm>
50203 <indexterm role="concept">
50204 <primary>customizing</primary>
50205 <secondary>ACL condition</secondary>
50206 </indexterm>
50207 <indexterm role="concept">
50208 <primary>access control lists (ACLs)</primary>
50209 <secondary>customized test</secondary>
50210 </indexterm>
50211 <indexterm role="concept">
50212 <primary>access control lists (ACLs)</primary>
50213 <secondary>testing, customized</secondary>
50214 </indexterm>
50215 This feature allows you to make up custom conditions. If the result of
50216 expanding the string is an empty string, the number zero, or one of the strings
50217 <quote>no</quote> or <quote>false</quote>, the condition is false. If the result is any non-zero
50218 number, or one of the strings <quote>yes</quote> or <quote>true</quote>, the condition is true. For
50219 any other value, some error is assumed to have occurred, and the ACL returns
50220 <quote>defer</quote>. However, if the expansion is forced to fail, the condition is
50221 ignored. The effect is to treat it as true, whether it is positive or
50222 negative.
50223 </para>
50224 </listitem></varlistentry>
50225 <varlistentry>
50226 <term><emphasis role="bold">decode&nbsp;=&nbsp;</emphasis>&lt;<emphasis>location</emphasis>&gt;</term>
50227 <listitem>
50228 <para>
50229 <indexterm role="concept">
50230 <primary><option>decode</option> ACL condition</primary>
50231 </indexterm>
50232 This condition is available only when Exim is compiled with the
50233 content-scanning extension, and it is allowed only in the ACL defined by
50234 <option>acl_smtp_mime</option>. It causes the current MIME part to be decoded into a file.
50235 If all goes well, the condition is true. It is false only if there are
50236 problems such as a syntax error or a memory shortage. For more details, see
50237 chapter <xref linkend="CHAPexiscan"/>.
50238 </para>
50239 </listitem></varlistentry>
50240 <varlistentry>
50241 <term><emphasis role="bold">demime&nbsp;=&nbsp;</emphasis>&lt;<emphasis>extension&nbsp;list</emphasis>&gt;</term>
50242 <listitem>
50243 <para>
50244 <indexterm role="concept">
50245 <primary><option>demime</option> ACL condition</primary>
50246 </indexterm>
50247 This condition is available only when Exim is compiled with the
50248 content-scanning extension. Its use is described in section
50249 <xref linkend="SECTdemimecond"/>.
50250 </para>
50251 </listitem></varlistentry>
50252 <varlistentry>
50253 <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>
50254 <listitem>
50255 <para>
50256 <indexterm role="concept">
50257 <primary><option>dnslists</option> ACL condition</primary>
50258 </indexterm>
50259 <indexterm role="concept">
50260 <primary>DNS list</primary>
50261 <secondary>in ACL</secondary>
50262 </indexterm>
50263 <indexterm role="concept">
50264 <primary>black list (DNS)</primary>
50265 </indexterm>
50266 <indexterm role="concept">
50267 <primary>access control lists (ACLs)</primary>
50268 <secondary>testing a DNS list</secondary>
50269 </indexterm>
50270 This condition checks for entries in DNS black lists. These are also known as
50271 <quote>RBL lists</quote>, after the original Realtime Blackhole List, but note that the
50272 use of the lists at <emphasis>mail-abuse.org</emphasis> now carries a charge. There are too many
50273 different variants of this condition to describe briefly here. See sections
50274 <xref linkend="SECTmorednslists"/>&ndash;<xref linkend="SECTmorednslistslast"/> for details.
50275 </para>
50276 </listitem></varlistentry>
50277 <varlistentry>
50278 <term><emphasis role="bold">domains&nbsp;=&nbsp;</emphasis>&lt;<emphasis>domain&nbsp;list</emphasis>&gt;</term>
50279 <listitem>
50280 <para>
50281 <indexterm role="concept">
50282 <primary><option>domains</option> ACL condition</primary>
50283 </indexterm>
50284 <indexterm role="concept">
50285 <primary>domain</primary>
50286 <secondary>ACL checking</secondary>
50287 </indexterm>
50288 <indexterm role="concept">
50289 <primary>access control lists (ACLs)</primary>
50290 <secondary>testing a recipient domain</secondary>
50291 </indexterm>
50292 <indexterm role="variable">
50293 <primary><varname>$domain_data</varname></primary>
50294 </indexterm>
50295 This condition is relevant only after a RCPT command. It checks that the domain
50296 of the recipient address is in the domain list. If percent-hack processing is
50297 enabled, it is done before this test is done. If the check succeeds with a
50298 lookup, the result of the lookup is placed in <varname>$domain_data</varname> until the next
50299 <option>domains</option> test.
50300 </para>
50301 <para>
50302 <emphasis role="bold">Note carefully</emphasis> (because many people seem to fall foul of this): you cannot
50303 use <option>domains</option> in a DATA ACL.
50304 </para>
50305 </listitem></varlistentry>
50306 <varlistentry>
50307 <term><emphasis role="bold">encrypted&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string&nbsp;list</emphasis>&gt;</term>
50308 <listitem>
50309 <para>
50310 <indexterm role="concept">
50311 <primary><option>encrypted</option> ACL condition</primary>
50312 </indexterm>
50313 <indexterm role="concept">
50314 <primary>encryption</primary>
50315 <secondary>checking in an ACL</secondary>
50316 </indexterm>
50317 <indexterm role="concept">
50318 <primary>access control lists (ACLs)</primary>
50319 <secondary>testing for encryption</secondary>
50320 </indexterm>
50321 If the SMTP connection is not encrypted, the condition is false. Otherwise, the
50322 name of the cipher suite in use is tested against the list. To test for
50323 encryption without testing for any specific cipher suite(s), set
50324 </para>
50325 <literallayout class="monospaced">
50326 encrypted = *
50327 </literallayout>
50328 </listitem></varlistentry>
50329 <varlistentry>
50330 <term><emphasis role="bold">hosts&nbsp;=&nbsp;</emphasis>&lt;<emphasis>&nbsp;host&nbsp;list</emphasis>&gt;</term>
50331 <listitem>
50332 <para>
50333 <indexterm role="concept">
50334 <primary><option>hosts</option> ACL condition</primary>
50335 </indexterm>
50336 <indexterm role="concept">
50337 <primary>host</primary>
50338 <secondary>ACL checking</secondary>
50339 </indexterm>
50340 <indexterm role="concept">
50341 <primary>access control lists (ACLs)</primary>
50342 <secondary>testing the client host</secondary>
50343 </indexterm>
50344 This condition tests that the calling host matches the host list. If you have
50345 name lookups or wildcarded host names and IP addresses in the same host list,
50346 you should normally put the IP addresses first. For example, you could have:
50347 </para>
50348 <literallayout class="monospaced">
50349 accept hosts = 10.9.8.7 : dbm;/etc/friendly/hosts
50350 </literallayout>
50351 <para>
50352 The lookup in this example uses the host name for its key. This is implied by
50353 the lookup type <quote>dbm</quote>. (For a host address lookup you would use <quote>net-dbm</quote>
50354 and it wouldn&#x2019;t matter which way round you had these two items.)
50355 </para>
50356 <para>
50357 The reason for the problem with host names lies in the left-to-right way that
50358 Exim processes lists. It can test IP addresses without doing any DNS lookups,
50359 but when it reaches an item that requires a host name, it fails if it cannot
50360 find a host name to compare with the pattern. If the above list is given in the
50361 opposite order, the <option>accept</option> statement fails for a host whose name cannot be
50362 found, even if its IP address is 10.9.8.7.
50363 </para>
50364 <para>
50365 If you really do want to do the name check first, and still recognize the IP
50366 address even if the name lookup fails, you can rewrite the ACL like this:
50367 </para>
50368 <literallayout class="monospaced">
50369 accept hosts = dbm;/etc/friendly/hosts
50370 accept hosts = 10.9.8.7
50371 </literallayout>
50372 <para>
50373 The default action on failing to find the host name is to assume that the host
50374 is not in the list, so the first <option>accept</option> statement fails. The second
50375 statement can then check the IP address.
50376 </para>
50377 <para>
50378 <indexterm role="variable">
50379 <primary><varname>$host_data</varname></primary>
50380 </indexterm>
50381 If a <option>hosts</option> condition is satisfied by means of a lookup, the result
50382 of the lookup is made available in the <varname>$host_data</varname> variable. This
50383 allows you, for example, to set up a statement like this:
50384 </para>
50385 <literallayout class="monospaced">
50386 deny  hosts = net-lsearch;/some/file
50387 message = $host_data
50388 </literallayout>
50389 <para>
50390 which gives a custom error message for each denied host.
50391 </para>
50392 </listitem></varlistentry>
50393 <varlistentry>
50394 <term><emphasis role="bold">local_parts&nbsp;=&nbsp;</emphasis>&lt;<emphasis>local&nbsp;part&nbsp;list</emphasis>&gt;</term>
50395 <listitem>
50396 <para>
50397 <indexterm role="concept">
50398 <primary><option>local_parts</option> ACL condition</primary>
50399 </indexterm>
50400 <indexterm role="concept">
50401 <primary>local part</primary>
50402 <secondary>ACL checking</secondary>
50403 </indexterm>
50404 <indexterm role="concept">
50405 <primary>access control lists (ACLs)</primary>
50406 <secondary>testing a local part</secondary>
50407 </indexterm>
50408 <indexterm role="variable">
50409 <primary><varname>$local_part_data</varname></primary>
50410 </indexterm>
50411 This condition is relevant only after a RCPT command. It checks that the local
50412 part of the recipient address is in the list. If percent-hack processing is
50413 enabled, it is done before this test. If the check succeeds with a lookup, the
50414 result of the lookup is placed in <varname>$local_part_data</varname>, which remains set until
50415 the next <option>local_parts</option> test.
50416 </para>
50417 </listitem></varlistentry>
50418 <varlistentry>
50419 <term><emphasis role="bold">malware&nbsp;=&nbsp;</emphasis>&lt;<emphasis>option</emphasis>&gt;</term>
50420 <listitem>
50421 <para>
50422 <indexterm role="concept">
50423 <primary><option>malware</option> ACL condition</primary>
50424 </indexterm>
50425 <indexterm role="concept">
50426 <primary>access control lists (ACLs)</primary>
50427 <secondary>virus scanning</secondary>
50428 </indexterm>
50429 <indexterm role="concept">
50430 <primary>access control lists (ACLs)</primary>
50431 <secondary>scanning for viruses</secondary>
50432 </indexterm>
50433 This condition is available only when Exim is compiled with the
50434 content-scanning extension. It causes the incoming message to be scanned for
50435 viruses. For details, see chapter <xref linkend="CHAPexiscan"/>.
50436 </para>
50437 </listitem></varlistentry>
50438 <varlistentry>
50439 <term><emphasis role="bold">mime_regex&nbsp;=&nbsp;</emphasis>&lt;<emphasis>list&nbsp;of&nbsp;regular&nbsp;expressions</emphasis>&gt;</term>
50440 <listitem>
50441 <para>
50442 <indexterm role="concept">
50443 <primary><option>mime_regex</option> ACL condition</primary>
50444 </indexterm>
50445 <indexterm role="concept">
50446 <primary>access control lists (ACLs)</primary>
50447 <secondary>testing by regex matching</secondary>
50448 </indexterm>
50449 This condition is available only when Exim is compiled with the
50450 content-scanning extension, and it is allowed only in the ACL defined by
50451 <option>acl_smtp_mime</option>. It causes the current MIME part to be scanned for a match
50452 with any of the regular expressions. For details, see chapter
50453 <xref linkend="CHAPexiscan"/>.
50454 </para>
50455 </listitem></varlistentry>
50456 <varlistentry>
50457 <term><emphasis role="bold">ratelimit&nbsp;=&nbsp;</emphasis>&lt;<emphasis>parameters</emphasis>&gt;</term>
50458 <listitem>
50459 <para>
50460 <indexterm role="concept">
50461 <primary>rate limiting</primary>
50462 </indexterm>
50463 This condition can be used to limit the rate at which a user or host submits
50464 messages. Details are given in section <xref linkend="SECTratelimiting"/>.
50465 </para>
50466 </listitem></varlistentry>
50467 <varlistentry>
50468 <term><emphasis role="bold">recipients&nbsp;=&nbsp;</emphasis>&lt;<emphasis>address&nbsp;list</emphasis>&gt;</term>
50469 <listitem>
50470 <para>
50471 <indexterm role="concept">
50472 <primary><option>recipients</option> ACL condition</primary>
50473 </indexterm>
50474 <indexterm role="concept">
50475 <primary>recipient</primary>
50476 <secondary>ACL checking</secondary>
50477 </indexterm>
50478 <indexterm role="concept">
50479 <primary>access control lists (ACLs)</primary>
50480 <secondary>testing a recipient</secondary>
50481 </indexterm>
50482 This condition is relevant only after a RCPT command. It checks the entire
50483 recipient address against a list of recipients.
50484 </para>
50485 </listitem></varlistentry>
50486 <varlistentry>
50487 <term><emphasis role="bold">regex&nbsp;=&nbsp;</emphasis>&lt;<emphasis>list&nbsp;of&nbsp;regular&nbsp;expressions</emphasis>&gt;</term>
50488 <listitem>
50489 <para>
50490 <indexterm role="concept">
50491 <primary><option>regex</option> ACL condition</primary>
50492 </indexterm>
50493 <indexterm role="concept">
50494 <primary>access control lists (ACLs)</primary>
50495 <secondary>testing by regex matching</secondary>
50496 </indexterm>
50497 This condition is available only when Exim is compiled with the
50498 content-scanning extension, and is available only in the DATA, MIME, and
50499 non-SMTP ACLs. It causes the incoming message to be scanned for a match with
50500 any of the regular expressions. For details, see chapter <xref linkend="CHAPexiscan"/>.
50501 </para>
50502 </listitem></varlistentry>
50503 <varlistentry>
50504 <term><emphasis role="bold">sender_domains&nbsp;=&nbsp;</emphasis>&lt;<emphasis>domain&nbsp;list</emphasis>&gt;</term>
50505 <listitem>
50506 <para>
50507 <indexterm role="concept">
50508 <primary><option>sender_domains</option> ACL condition</primary>
50509 </indexterm>
50510 <indexterm role="concept">
50511 <primary>sender</primary>
50512 <secondary>ACL checking</secondary>
50513 </indexterm>
50514 <indexterm role="concept">
50515 <primary>access control lists (ACLs)</primary>
50516 <secondary>testing a sender domain</secondary>
50517 </indexterm>
50518 <indexterm role="variable">
50519 <primary><varname>$domain</varname></primary>
50520 </indexterm>
50521 <indexterm role="variable">
50522 <primary><varname>$sender_address_domain</varname></primary>
50523 </indexterm>
50524 This condition tests the domain of the sender of the message against the given
50525 domain list. <emphasis role="bold">Note</emphasis>: The domain of the sender address is in
50526 <varname>$sender_address_domain</varname>. It is <emphasis>not</emphasis> put in <varname>$domain</varname> during the testing
50527 of this condition. This is an exception to the general rule for testing domain
50528 lists. It is done this way so that, if this condition is used in an ACL for a
50529 RCPT command, the recipient&#x2019;s domain (which is in <varname>$domain</varname>) can be used to
50530 influence the sender checking.
50531 </para>
50532 <para>
50533 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
50534 relaying, because sender addresses are easily, and commonly, forged.
50535 </para>
50536 </listitem></varlistentry>
50537 <varlistentry>
50538 <term><emphasis role="bold">senders&nbsp;=&nbsp;</emphasis>&lt;<emphasis>address&nbsp;list</emphasis>&gt;</term>
50539 <listitem>
50540 <para>
50541 <indexterm role="concept">
50542 <primary><option>senders</option> ACL condition</primary>
50543 </indexterm>
50544 <indexterm role="concept">
50545 <primary>sender</primary>
50546 <secondary>ACL checking</secondary>
50547 </indexterm>
50548 <indexterm role="concept">
50549 <primary>access control lists (ACLs)</primary>
50550 <secondary>testing a sender</secondary>
50551 </indexterm>
50552 This condition tests the sender of the message against the given list. To test
50553 for a bounce message, which has an empty sender, set
50554 </para>
50555 <literallayout class="monospaced">
50556 senders = :
50557 </literallayout>
50558 <para>
50559 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
50560 relaying, because sender addresses are easily, and commonly, forged.
50561 </para>
50562 </listitem></varlistentry>
50563 <varlistentry>
50564 <term><emphasis role="bold">spam&nbsp;=&nbsp;</emphasis>&lt;<emphasis>username</emphasis>&gt;</term>
50565 <listitem>
50566 <para>
50567 <indexterm role="concept">
50568 <primary><option>spam</option> ACL condition</primary>
50569 </indexterm>
50570 <indexterm role="concept">
50571 <primary>access control lists (ACLs)</primary>
50572 <secondary>scanning for spam</secondary>
50573 </indexterm>
50574 This condition is available only when Exim is compiled with the
50575 content-scanning extension. It causes the incoming message to be scanned by
50576 SpamAssassin. For details, see chapter <xref linkend="CHAPexiscan"/>.
50577 </para>
50578 </listitem></varlistentry>
50579 <varlistentry>
50580 <term><emphasis role="bold">verify&nbsp;=&nbsp;certificate</emphasis></term>
50581 <listitem>
50582 <para>
50583 <indexterm role="concept">
50584 <primary><option>verify</option> ACL condition</primary>
50585 </indexterm>
50586 <indexterm role="concept">
50587 <primary>TLS</primary>
50588 <secondary>client certificate verification</secondary>
50589 </indexterm>
50590 <indexterm role="concept">
50591 <primary>certificate</primary>
50592 <secondary>verification of client</secondary>
50593 </indexterm>
50594 <indexterm role="concept">
50595 <primary>access control lists (ACLs)</primary>
50596 <secondary>certificate verification</secondary>
50597 </indexterm>
50598 <indexterm role="concept">
50599 <primary>access control lists (ACLs)</primary>
50600 <secondary>testing a TLS certificate</secondary>
50601 </indexterm>
50602 This condition is true in an SMTP session if the session is encrypted, and a
50603 certificate was received from the client, and the certificate was verified. The
50604 server requests a certificate only if the client matches <option>tls_verify_hosts</option>
50605 or <option>tls_try_verify_hosts</option> (see chapter <xref linkend="CHAPTLS"/>).
50606 </para>
50607 </listitem></varlistentry>
50608 <varlistentry>
50609 <term><emphasis role="bold">verify&nbsp;=&nbsp;csa</emphasis></term>
50610 <listitem>
50611 <para>
50612 <indexterm role="concept">
50613 <primary>CSA verification</primary>
50614 </indexterm>
50615 This condition checks whether the sending host (the client) is authorized to
50616 send email. Details of how this works are given in section
50617 <xref linkend="SECTverifyCSA"/>.
50618 </para>
50619 </listitem></varlistentry>
50620 <varlistentry>
50621 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_sender/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
50622 <listitem>
50623 <para>
50624 <indexterm role="concept">
50625 <primary><option>verify</option> ACL condition</primary>
50626 </indexterm>
50627 <indexterm role="concept">
50628 <primary>access control lists (ACLs)</primary>
50629 <secondary>verifying sender in the header</secondary>
50630 </indexterm>
50631 <indexterm role="concept">
50632 <primary>header lines</primary>
50633 <secondary>verifying the sender in</secondary>
50634 </indexterm>
50635 <indexterm role="concept">
50636 <primary>sender</primary>
50637 <secondary>verifying in header</secondary>
50638 </indexterm>
50639 <indexterm role="concept">
50640 <primary>verifying</primary>
50641 <secondary>sender in header</secondary>
50642 </indexterm>
50643 This condition is relevant only in an ACL that is run after a message has been
50644 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
50645 <option>acl_not_smtp</option>. It checks that there is a verifiable address in at least one
50646 of the <emphasis>Sender:</emphasis>, <emphasis>Reply-To:</emphasis>, or <emphasis>From:</emphasis> header lines. Such an address
50647 is loosely thought of as a <quote>sender</quote> address (hence the name of the test).
50648 However, an address that appears in one of these headers need not be an address
50649 that accepts bounce messages; only sender addresses in envelopes are required
50650 to accept bounces. Therefore, if you use the callout option on this check, you
50651 might want to arrange for a non-empty address in the MAIL command.
50652 </para>
50653 <para>
50654 Details of address verification and the options are given later, starting at
50655 section <xref linkend="SECTaddressverification"/> (callouts are described in section
50656 <xref linkend="SECTcallver"/>). You can combine this condition with the <option>senders</option>
50657 condition to restrict it to bounce messages only:
50658 </para>
50659 <literallayout class="monospaced">
50660 deny    senders = :
50661         message = A valid sender header is required for bounces
50662        !verify  = header_sender
50663 </literallayout>
50664 </listitem></varlistentry>
50665 <varlistentry>
50666 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_syntax</emphasis></term>
50667 <listitem>
50668 <para>
50669 <indexterm role="concept">
50670 <primary><option>verify</option> ACL condition</primary>
50671 </indexterm>
50672 <indexterm role="concept">
50673 <primary>access control lists (ACLs)</primary>
50674 <secondary>verifying header syntax</secondary>
50675 </indexterm>
50676 <indexterm role="concept">
50677 <primary>header lines</primary>
50678 <secondary>verifying syntax</secondary>
50679 </indexterm>
50680 <indexterm role="concept">
50681 <primary>verifying</primary>
50682 <secondary>header syntax</secondary>
50683 </indexterm>
50684 This condition is relevant only in an ACL that is run after a message has been
50685 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
50686 <option>acl_not_smtp</option>. It checks the syntax of all header lines that can contain
50687 lists of addresses (<emphasis>Sender:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>,
50688 and <emphasis>Bcc:</emphasis>). Unqualified addresses (local parts without domains) are
50689 permitted only in locally generated messages and from hosts that match
50690 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
50691 appropriate.
50692 </para>
50693 <para>
50694 Note that this condition is a syntax check only. However, a common spamming
50695 ploy used to be to send syntactically invalid headers such as
50696 </para>
50697 <literallayout class="monospaced">
50698 To: @
50699 </literallayout>
50700 <para>
50701 and this condition can be used to reject such messages, though they are not as
50702 common as they used to be.
50703 </para>
50704 </listitem></varlistentry>
50705 <varlistentry>
50706 <term><emphasis role="bold">verify&nbsp;=&nbsp;helo</emphasis></term>
50707 <listitem>
50708 <para>
50709 <indexterm role="concept">
50710 <primary><option>verify</option> ACL condition</primary>
50711 </indexterm>
50712 <indexterm role="concept">
50713 <primary>access control lists (ACLs)</primary>
50714 <secondary>verifying HELO/EHLO</secondary>
50715 </indexterm>
50716 <indexterm role="concept">
50717 <primary>HELO</primary>
50718 <secondary>verifying</secondary>
50719 </indexterm>
50720 <indexterm role="concept">
50721 <primary>EHLO</primary>
50722 <secondary>verifying</secondary>
50723 </indexterm>
50724 <indexterm role="concept">
50725 <primary>verifying</primary>
50726 <secondary>EHLO</secondary>
50727 </indexterm>
50728 <indexterm role="concept">
50729 <primary>verifying</primary>
50730 <secondary>HELO</secondary>
50731 </indexterm>
50732 This condition is true if a HELO or EHLO command has been received from the
50733 client host, and its contents have been verified. If there has been no previous
50734 attempt to verify the HELO/EHLO contents, it is carried out when this
50735 condition is encountered. See the description of the <option>helo_verify_hosts</option> and
50736 <option>helo_try_verify_hosts</option> options for details of how to request verification
50737 independently of this condition.
50738 </para>
50739 <para>
50740 For SMTP input that does not come over TCP/IP (the <option>-bs</option> command line
50741 option), this condition is always true.
50742 </para>
50743 </listitem></varlistentry>
50744 <varlistentry>
50745 <term><emphasis role="bold">verify&nbsp;=&nbsp;not_blind</emphasis></term>
50746 <listitem>
50747 <para>
50748 <indexterm role="concept">
50749 <primary>verifying</primary>
50750 <secondary>not blind</secondary>
50751 </indexterm>
50752 <indexterm role="concept">
50753 <primary>bcc recipients, verifying none</primary>
50754 </indexterm>
50755 This condition checks that there are no blind (bcc) recipients in the message.
50756 Every envelope recipient must appear either in a <emphasis>To:</emphasis> header line or in a
50757 <emphasis>Cc:</emphasis> header line for this condition to be true. Local parts are checked
50758 case-sensitively; domains are checked case-insensitively. If <emphasis>Resent-To:</emphasis> or
50759 <emphasis>Resent-Cc:</emphasis> header lines exist, they are also checked. This condition can be
50760 used only in a DATA or non-SMTP ACL.
50761 </para>
50762 <para>
50763 There are, of course, many legitimate messages that make use of blind (bcc)
50764 recipients. This check should not be used on its own for blocking messages.
50765 </para>
50766 </listitem></varlistentry>
50767 <varlistentry>
50768 <term><emphasis role="bold">verify&nbsp;=&nbsp;recipient/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
50769 <listitem>
50770 <para>
50771 <indexterm role="concept">
50772 <primary><option>verify</option> ACL condition</primary>
50773 </indexterm>
50774 <indexterm role="concept">
50775 <primary>access control lists (ACLs)</primary>
50776 <secondary>verifying recipient</secondary>
50777 </indexterm>
50778 <indexterm role="concept">
50779 <primary>recipient</primary>
50780 <secondary>verifying</secondary>
50781 </indexterm>
50782 <indexterm role="concept">
50783 <primary>verifying</primary>
50784 <secondary>recipient</secondary>
50785 </indexterm>
50786 <indexterm role="variable">
50787 <primary><varname>$address_data</varname></primary>
50788 </indexterm>
50789 This condition is relevant only after a RCPT command. It verifies the current
50790 recipient. Details of address verification are given later, starting at section
50791 <xref linkend="SECTaddressverification"/>. After a recipient has been verified, the value
50792 of <varname>$address_data</varname> is the last value that was set while routing the address.
50793 This applies even if the verification fails. When an address that is being
50794 verified is redirected to a single address, verification continues with the new
50795 address, and in that case, the subsequent value of <varname>$address_data</varname> is the
50796 value for the child address.
50797 </para>
50798 </listitem></varlistentry>
50799 <varlistentry>
50800 <term><emphasis role="bold">verify&nbsp;=&nbsp;reverse_host_lookup</emphasis></term>
50801 <listitem>
50802 <para>
50803 <indexterm role="concept">
50804 <primary><option>verify</option> ACL condition</primary>
50805 </indexterm>
50806 <indexterm role="concept">
50807 <primary>access control lists (ACLs)</primary>
50808 <secondary>verifying host reverse lookup</secondary>
50809 </indexterm>
50810 <indexterm role="concept">
50811 <primary>host</primary>
50812 <secondary>verifying reverse lookup</secondary>
50813 </indexterm>
50814 This condition ensures that a verified host name has been looked up from the IP
50815 address of the client host. (This may have happened already if the host name
50816 was needed for checking a host list, or if the host matched <option>host_lookup</option>.)
50817 Verification ensures that the host name obtained from a reverse DNS lookup, or
50818 one of its aliases, does, when it is itself looked up in the DNS, yield the
50819 original IP address.
50820 </para>
50821 <para>
50822 If this condition is used for a locally generated message (that is, when there
50823 is no client host involved), it always succeeds.
50824 </para>
50825 </listitem></varlistentry>
50826 <varlistentry>
50827 <term><emphasis role="bold">verify&nbsp;=&nbsp;sender/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
50828 <listitem>
50829 <para>
50830 <indexterm role="concept">
50831 <primary><option>verify</option> ACL condition</primary>
50832 </indexterm>
50833 <indexterm role="concept">
50834 <primary>access control lists (ACLs)</primary>
50835 <secondary>verifying sender</secondary>
50836 </indexterm>
50837 <indexterm role="concept">
50838 <primary>sender</primary>
50839 <secondary>verifying</secondary>
50840 </indexterm>
50841 <indexterm role="concept">
50842 <primary>verifying</primary>
50843 <secondary>sender</secondary>
50844 </indexterm>
50845 This condition is relevant only after a MAIL or RCPT command, or after a
50846 message has been received (the <option>acl_smtp_data</option> or <option>acl_not_smtp</option> ACLs). If
50847 the message&#x2019;s sender is empty (that is, this is a bounce message), the
50848 condition is true. Otherwise, the sender address is verified.
50849 </para>
50850 <para>
50851 <indexterm role="variable">
50852 <primary><varname>$address_data</varname></primary>
50853 </indexterm>
50854 <indexterm role="variable">
50855 <primary><varname>$sender_address_data</varname></primary>
50856 </indexterm>
50857 If there is data in the <varname>$address_data</varname> variable at the end of routing, its
50858 value is placed in <varname>$sender_address_data</varname> at the end of verification. This
50859 value can be used in subsequent conditions and modifiers in the same ACL
50860 statement. It does not persist after the end of the current statement. If you
50861 want to preserve the value for longer, you can save it in an ACL variable.
50862 </para>
50863 <para>
50864 Details of verification are given later, starting at section
50865 <xref linkend="SECTaddressverification"/>. Exim caches the result of sender verification,
50866 to avoid doing it more than once per message.
50867 </para>
50868 </listitem></varlistentry>
50869 <varlistentry>
50870 <term><emphasis role="bold">verify&nbsp;=&nbsp;sender=</emphasis>&lt;<emphasis>address</emphasis>&gt;<emphasis role="bold">/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
50871 <listitem>
50872 <para>
50873 <indexterm role="concept">
50874 <primary><option>verify</option> ACL condition</primary>
50875 </indexterm>
50876 This is a variation of the previous option, in which a modified address is
50877 verified as a sender.
50878 </para>
50879 </listitem></varlistentry>
50880 </variablelist>
50881 </section>
50882 <section id="SECTmorednslists">
50883 <title>Using DNS lists</title>
50884 <para>
50885 <indexterm role="concept">
50886 <primary>DNS list</primary>
50887 <secondary>in ACL</secondary>
50888 </indexterm>
50889 <indexterm role="concept">
50890 <primary>black list (DNS)</primary>
50891 </indexterm>
50892 <indexterm role="concept">
50893 <primary>access control lists (ACLs)</primary>
50894 <secondary>testing a DNS list</secondary>
50895 </indexterm>
50896 In its simplest form, the <option>dnslists</option> condition tests whether the calling host
50897 is on at least one of a number of DNS lists by looking up the inverted IP
50898 address in one or more DNS domains. (Note that DNS list domains are not mail
50899 domains, so the <literal>+</literal> syntax for named lists doesn&#x2019;t work - it is used for
50900 special options instead.) For example, if the calling host&#x2019;s IP
50901 address is 192.168.62.43, and the ACL statement is
50902 </para>
50903 <literallayout class="monospaced">
50904 deny dnslists = blackholes.mail-abuse.org : \
50905                 dialups.mail-abuse.org
50906 </literallayout>
50907 <para>
50908 the following records are looked up:
50909 </para>
50910 <literallayout class="monospaced">
50911 43.62.168.192.blackholes.mail-abuse.org
50912 43.62.168.192.dialups.mail-abuse.org
50913 </literallayout>
50914 <para>
50915 As soon as Exim finds an existing DNS record, processing of the list stops.
50916 Thus, multiple entries on the list provide an <quote>or</quote> conjunction. If you want
50917 to test that a host is on more than one list (an <quote>and</quote> conjunction), you can
50918 use two separate conditions:
50919 </para>
50920 <literallayout class="monospaced">
50921 deny dnslists = blackholes.mail-abuse.org
50922      dnslists = dialups.mail-abuse.org
50923 </literallayout>
50924 <para>
50925 If a DNS lookup times out or otherwise fails to give a decisive answer, Exim
50926 behaves as if the host does not match the list item, that is, as if the DNS
50927 record does not exist. If there are further items in the DNS list, they are
50928 processed.
50929 </para>
50930 <para>
50931 This is usually the required action when <option>dnslists</option> is used with <option>deny</option>
50932 (which is the most common usage), because it prevents a DNS failure from
50933 blocking mail. However, you can change this behaviour by putting one of the
50934 following special items in the list:
50935 </para>
50936 <literallayout>
50937 <literal>+include_unknown </literal>   behave as if the item is on the list
50938 <literal>+exclude_unknown </literal>   behave as if the item is not on the list (default)
50939 <literal>+defer_unknown   </literal>   give a temporary error
50940 </literallayout>
50941 <para>
50942 <indexterm role="concept">
50943 <primary><literal>+include_unknown</literal></primary>
50944 </indexterm>
50945 <indexterm role="concept">
50946 <primary><literal>+exclude_unknown</literal></primary>
50947 </indexterm>
50948 <indexterm role="concept">
50949 <primary><literal>+defer_unknown</literal></primary>
50950 </indexterm>
50951 Each of these applies to any subsequent items on the list. For example:
50952 </para>
50953 <literallayout class="monospaced">
50954 deny dnslists = +defer_unknown : foo.bar.example
50955 </literallayout>
50956 <para>
50957 Testing the list of domains stops as soon as a match is found. If you want to
50958 warn for one list and block for another, you can use two different statements:
50959 </para>
50960 <literallayout class="monospaced">
50961 deny  dnslists = blackholes.mail-abuse.org
50962 warn  message  = X-Warn: sending host is on dialups list
50963       dnslists = dialups.mail-abuse.org
50964 </literallayout>
50965 <para>
50966 DNS list lookups are cached by Exim for the duration of the SMTP session,
50967 so a lookup based on the IP address is done at most once for any incoming
50968 connection. Exim does not share information between multiple incoming
50969 connections (but your local name server cache should be active).
50970 </para>
50971 </section>
50972 <section id="SECID201">
50973 <title>Specifying the IP address for a DNS list lookup</title>
50974 <para>
50975 <indexterm role="concept">
50976 <primary>DNS list</primary>
50977 <secondary>keyed by explicit IP address</secondary>
50978 </indexterm>
50979 By default, the IP address that is used in a DNS list lookup is the IP address
50980 of the calling host. However, you can specify another IP address by listing it
50981 after the domain name, introduced by a slash. For example:
50982 </para>
50983 <literallayout class="monospaced">
50984 deny dnslists = black.list.tld/192.168.1.2
50985 </literallayout>
50986 <para>
50987 This feature is not very helpful with explicit IP addresses; it is intended for
50988 use with IP addresses that are looked up, for example, the IP addresses of the
50989 MX hosts or nameservers of an email sender address. For an example, see section
50990 <xref linkend="SECTmulkeyfor"/> below.
50991 </para>
50992 </section>
50993 <section id="SECID202">
50994 <title>DNS lists keyed on domain names</title>
50995 <para>
50996 <indexterm role="concept">
50997 <primary>DNS list</primary>
50998 <secondary>keyed by domain name</secondary>
50999 </indexterm>
51000 There are some lists that are keyed on domain names rather than inverted IP
51001 addresses (see for example the <emphasis>domain based zones</emphasis> link at
51002 <emphasis role="bold"><ulink url="http://www.rfc-ignorant.org/">http://www.rfc-ignorant.org/</ulink></emphasis>). No reversing of components is used
51003 with these lists. You can change the name that is looked up in a DNS list by
51004 listing it after the domain name, introduced by a slash. For example,
51005 </para>
51006 <literallayout class="monospaced">
51007 deny  message  = Sender's domain is listed at $dnslist_domain
51008       dnslists = dsn.rfc-ignorant.org/$sender_address_domain
51009 </literallayout>
51010 <para>
51011 This particular example is useful only in ACLs that are obeyed after the
51012 RCPT or DATA commands, when a sender address is available. If (for
51013 example) the message&#x2019;s sender is <emphasis>user@tld.example</emphasis> the name that is looked
51014 up by this example is
51015 </para>
51016 <literallayout class="monospaced">
51017 tld.example.dsn.rfc-ignorant.org
51018 </literallayout>
51019 <para>
51020 A single <option>dnslists</option> condition can contain entries for both names and IP
51021 addresses. For example:
51022 </para>
51023 <literallayout class="monospaced">
51024 deny dnslists = sbl.spamhaus.org : \
51025                 dsn.rfc-ignorant.org/$sender_address_domain
51026 </literallayout>
51027 <para>
51028 The first item checks the sending host&#x2019;s IP address; the second checks a domain
51029 name. The whole condition is true if either of the DNS lookups succeeds.
51030 </para>
51031 </section>
51032 <section id="SECTmulkeyfor">
51033 <title>Multiple explicit keys for a DNS list</title>
51034 <para>
51035 <indexterm role="concept">
51036 <primary>DNS list</primary>
51037 <secondary>multiple keys for</secondary>
51038 </indexterm>
51039 The syntax described above for looking up explicitly-defined values (either
51040 names or IP addresses) in a DNS blacklist is a simplification. After the domain
51041 name for the DNS list, what follows the slash can in fact be a list of items.
51042 As with all lists in Exim, the default separator is a colon. However, because
51043 this is a sublist within the list of DNS blacklist domains, it is necessary
51044 either to double the separators like this:
51045 </para>
51046 <literallayout class="monospaced">
51047 dnslists = black.list.tld/name.1::name.2
51048 </literallayout>
51049 <para>
51050 or to change the separator character, like this:
51051 </para>
51052 <literallayout class="monospaced">
51053 dnslists = black.list.tld/&lt;;name.1;name.2
51054 </literallayout>
51055 <para>
51056 If an item in the list is an IP address, it is inverted before the DNS
51057 blacklist domain is appended. If it is not an IP address, no inversion
51058 occurs. Consider this condition:
51059 </para>
51060 <literallayout class="monospaced">
51061 dnslists = black.list.tld/&lt;;192.168.1.2;a.domain
51062 </literallayout>
51063 <para>
51064 The DNS lookups that occur are:
51065 </para>
51066 <literallayout class="monospaced">
51067 2.1.168.192.black.list.tld
51068 a.domain.black.list.tld
51069 </literallayout>
51070 <para>
51071 Once a DNS record has been found (that matches a specific IP return
51072 address, if specified &ndash; see section <xref linkend="SECTaddmatcon"/>), no further lookups
51073 are done. If there is a temporary DNS error, the rest of the sublist of domains
51074 or IP addresses is tried. A temporary error for the whole dnslists item occurs
51075 only if no other DNS lookup in this sublist succeeds. In other words, a
51076 successful lookup for any of the items in the sublist overrides a temporary
51077 error for a previous item.
51078 </para>
51079 <para>
51080 The ability to supply a list of items after the slash is in some sense just a
51081 syntactic convenience. These two examples have the same effect:
51082 </para>
51083 <literallayout class="monospaced">
51084 dnslists = black.list.tld/a.domain : black.list.tld/b.domain
51085 dnslists = black.list.tld/a.domain::b.domain
51086 </literallayout>
51087 <para>
51088 However, when the data for the list is obtained from a lookup, the second form
51089 is usually much more convenient. Consider this example:
51090 </para>
51091 <literallayout class="monospaced">
51092 deny message  = The mail servers for the domain \
51093                 $sender_address_domain \
51094                 are listed at $dnslist_domain ($dnslist_value); \
51095                 see $dnslist_text.
51096      dnslists = sbl.spamhaus.org/&lt;|${lookup dnsdb {&gt;|a=&lt;|\
51097                                    ${lookup dnsdb {&gt;|mxh=\
51098                                    $sender_address_domain} }} }
51099 </literallayout>
51100 <para>
51101 Note the use of <literal>&gt;|</literal> in the dnsdb lookup to specify the separator for
51102 multiple DNS records. The inner dnsdb lookup produces a list of MX hosts
51103 and the outer dnsdb lookup finds the IP addresses for these hosts. The result
51104 of expanding the condition might be something like this:
51105 </para>
51106 <literallayout class="monospaced">
51107 dnslists = sbl.spahmaus.org/&lt;|192.168.2.3|192.168.5.6|...
51108 </literallayout>
51109 <para>
51110 Thus, this example checks whether or not the IP addresses of the sender
51111 domain&#x2019;s mail servers are on the Spamhaus black list.
51112 </para>
51113 <para>
51114 The key that was used for a successful DNS list lookup is put into the variable
51115 <varname>$dnslist_matched</varname> (see section <xref linkend="SECID204"/>).
51116 </para>
51117 </section>
51118 <section id="SECID203">
51119 <title>Data returned by DNS lists</title>
51120 <para>
51121 <indexterm role="concept">
51122 <primary>DNS list</primary>
51123 <secondary>data returned from</secondary>
51124 </indexterm>
51125 DNS lists are constructed using address records in the DNS. The original RBL
51126 just used the address 127.0.0.1 on the right hand side of each record, but the
51127 RBL+ list and some other lists use a number of values with different meanings.
51128 The values used on the RBL+ list are:
51129 </para>
51130 <literallayout>
51131 127.1.0.1  RBL
51132 127.1.0.2  DUL
51133 127.1.0.3  DUL and RBL
51134 127.1.0.4  RSS
51135 127.1.0.5  RSS and RBL
51136 127.1.0.6  RSS and DUL
51137 127.1.0.7  RSS and DUL and RBL
51138 </literallayout>
51139 <para>
51140 Section <xref linkend="SECTaddmatcon"/> below describes how you can distinguish between
51141 different values. Some DNS lists may return more than one address record;
51142 see section <xref linkend="SECThanmuldnsrec"/> for details of how they are checked.
51143 </para>
51144 </section>
51145 <section id="SECID204">
51146 <title>Variables set from DNS lists</title>
51147 <para>
51148 <indexterm role="concept">
51149 <primary>expansion</primary>
51150 <secondary>variables, set from DNS list</secondary>
51151 </indexterm>
51152 <indexterm role="concept">
51153 <primary>DNS list</primary>
51154 <secondary>variables set from</secondary>
51155 </indexterm>
51156 <indexterm role="variable">
51157 <primary><varname>$dnslist_domain</varname></primary>
51158 </indexterm>
51159 <indexterm role="variable">
51160 <primary><varname>$dnslist_matched</varname></primary>
51161 </indexterm>
51162 <indexterm role="variable">
51163 <primary><varname>$dnslist_text</varname></primary>
51164 </indexterm>
51165 <indexterm role="variable">
51166 <primary><varname>$dnslist_value</varname></primary>
51167 </indexterm>
51168 When an entry is found in a DNS list, the variable <varname>$dnslist_domain</varname> contains
51169 the name of the overall domain that matched (for example,
51170 <literal>spamhaus.example</literal>), <varname>$dnslist_matched</varname> contains the key within that domain
51171 (for example, <literal>192.168.5.3</literal>), and <varname>$dnslist_value</varname> contains the data from
51172 the DNS record. When the key is an IP address, it is not reversed in
51173 <varname>$dnslist_matched</varname> (though it is, of course, in the actual lookup). In simple
51174 cases, for example:
51175 </para>
51176 <literallayout class="monospaced">
51177 deny dnslists = spamhaus.example
51178 </literallayout>
51179 <para>
51180 the key is also available in another variable (in this case,
51181 <varname>$sender_host_address</varname>). In more complicated cases, however, this is not true.
51182 For example, using a data lookup (as described in section <xref linkend="SECTmulkeyfor"/>)
51183 might generate a dnslists lookup like this:
51184 </para>
51185 <literallayout class="monospaced">
51186 deny dnslists = spamhaus.example/&lt;|192.168.1.2|192.168.6.7|...
51187 </literallayout>
51188 <para>
51189 If this condition succeeds, the value in <varname>$dnslist_matched</varname> might be
51190 <literal>192.168.6.7</literal> (for example).
51191 </para>
51192 <para>
51193 If more than one address record is returned by the DNS lookup, all the IP
51194 addresses are included in <varname>$dnslist_value</varname>, separated by commas and spaces.
51195 The variable <varname>$dnslist_text</varname> contains the contents of any associated TXT
51196 record. For lists such as RBL+ the TXT record for a merged entry is often not
51197 very meaningful. See section <xref linkend="SECTmordetinf"/> for a way of obtaining more
51198 information.
51199 </para>
51200 <para>
51201 You can use the DNS list variables in <option>message</option> or <option>log_message</option> modifiers
51202 &ndash; although these appear before the condition in the ACL, they are not
51203 expanded until after it has failed. For example:
51204 </para>
51205 <literallayout class="monospaced">
51206 deny    hosts = !+local_networks
51207         message = $sender_host_address is listed \
51208                   at $dnslist_domain
51209         dnslists = rbl-plus.mail-abuse.example
51210 </literallayout>
51211 </section>
51212 <section id="SECTaddmatcon">
51213 <title>Additional matching conditions for DNS lists</title>
51214 <para>
51215 <indexterm role="concept">
51216 <primary>DNS list</primary>
51217 <secondary>matching specific returned data</secondary>
51218 </indexterm>
51219 You can add an equals sign and an IP address after a <option>dnslists</option> domain name
51220 in order to restrict its action to DNS records with a matching right hand side.
51221 For example,
51222 </para>
51223 <literallayout class="monospaced">
51224 deny dnslists = rblplus.mail-abuse.org=127.0.0.2
51225 </literallayout>
51226 <para>
51227 rejects only those hosts that yield 127.0.0.2. Without this additional data,
51228 any address record is considered to be a match. For the moment, we assume
51229 that the DNS lookup returns just one record. Section <xref linkend="SECThanmuldnsrec"/>
51230 describes how multiple records are handled.
51231 </para>
51232 <para>
51233 More than one IP address may be given for checking, using a comma as a
51234 separator. These are alternatives &ndash; if any one of them matches, the
51235 <option>dnslists</option> condition is true. For example:
51236 </para>
51237 <literallayout class="monospaced">
51238 deny  dnslists = a.b.c=127.0.0.2,127.0.0.3
51239 </literallayout>
51240 <para>
51241 If you want to specify a constraining address list and also specify names or IP
51242 addresses to be looked up, the constraining address list must be specified
51243 first. For example:
51244 </para>
51245 <literallayout class="monospaced">
51246 deny dnslists = dsn.rfc-ignorant.org\
51247                 =127.0.0.2/$sender_address_domain
51248 </literallayout>
51249 <para>
51250 If the character <literal>&amp;</literal> is used instead of <literal>=</literal>, the comparison for each
51251 listed IP address is done by a bitwise <quote>and</quote> instead of by an equality test.
51252 In other words, the listed addresses are used as bit masks. The comparison is
51253 true if all the bits in the mask are present in the address that is being
51254 tested. For example:
51255 </para>
51256 <literallayout class="monospaced">
51257 dnslists = a.b.c&amp;0.0.0.3
51258 </literallayout>
51259 <para>
51260 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
51261 want to test whether one bit or another bit is present (as opposed to both
51262 being present), you must use multiple values. For example:
51263 </para>
51264 <literallayout class="monospaced">
51265 dnslists = a.b.c&amp;0.0.0.1,0.0.0.2
51266 </literallayout>
51267 <para>
51268 matches if the final component of the address is an odd number or two times
51269 an odd number.
51270 </para>
51271 </section>
51272 <section id="SECID205">
51273 <title>Negated DNS matching conditions</title>
51274 <para>
51275 You can supply a negative list of IP addresses as part of a <option>dnslists</option>
51276 condition. Whereas
51277 </para>
51278 <literallayout class="monospaced">
51279 deny  dnslists = a.b.c=127.0.0.2,127.0.0.3
51280 </literallayout>
51281 <para>
51282 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
51283 IP address yielded by the list is either 127.0.0.2 or 127.0.0.3</quote>,
51284 </para>
51285 <literallayout class="monospaced">
51286 deny  dnslists = a.b.c!=127.0.0.2,127.0.0.3
51287 </literallayout>
51288 <para>
51289 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
51290 IP address yielded by the list is not 127.0.0.2 and not 127.0.0.3</quote>. In other
51291 words, the result of the test is inverted if an exclamation mark appears before
51292 the <literal>=</literal> (or the <literal>&amp;</literal>) sign.
51293 </para>
51294 <para>
51295 <emphasis role="bold">Note</emphasis>: This kind of negation is not the same as negation in a domain,
51296 host, or address list (which is why the syntax is different).
51297 </para>
51298 <para>
51299 If you are using just one list, the negation syntax does not gain you much. The
51300 previous example is precisely equivalent to
51301 </para>
51302 <literallayout class="monospaced">
51303 deny  dnslists = a.b.c
51304      !dnslists = a.b.c=127.0.0.2,127.0.0.3
51305 </literallayout>
51306 <para>
51307 However, if you are using multiple lists, the negation syntax is clearer.
51308 Consider this example:
51309 </para>
51310 <literallayout class="monospaced">
51311 deny  dnslists = sbl.spamhaus.org : \
51312                  list.dsbl.org : \
51313                  dnsbl.njabl.org!=127.0.0.3 : \
51314                  relays.ordb.org
51315 </literallayout>
51316 <para>
51317 Using only positive lists, this would have to be:
51318 </para>
51319 <literallayout class="monospaced">
51320 deny  dnslists = sbl.spamhaus.org : \
51321                  list.dsbl.org
51322 deny  dnslists = dnsbl.njabl.org
51323      !dnslists = dnsbl.njabl.org=127.0.0.3
51324 deny  dnslists = relays.ordb.org
51325 </literallayout>
51326 <para>
51327 which is less clear, and harder to maintain.
51328 </para>
51329 </section>
51330 <section id="SECThanmuldnsrec">
51331 <title>Handling multiple DNS records from a DNS list</title>
51332 <para>
51333 A DNS lookup for a <option>dnslists</option> condition may return more than one DNS record,
51334 thereby providing more than one IP address. When an item in a <option>dnslists</option> list
51335 is followed by <literal>=</literal> or <literal>&amp;</literal> and a list of IP addresses, in order to restrict
51336 the match to specific results from the DNS lookup, there are two ways in which
51337 the checking can be handled. For example, consider the condition:
51338 </para>
51339 <literallayout class="monospaced">
51340 dnslists = a.b.c=127.0.0.1
51341 </literallayout>
51342 <para>
51343 What happens if the DNS lookup for the incoming IP address yields both
51344 127.0.0.1 and 127.0.0.2 by means of two separate DNS records? Is the
51345 condition true because at least one given value was found, or is it false
51346 because at least one of the found values was not listed? And how does this
51347 affect negated conditions? Both possibilities are provided for with the help of
51348 additional separators <literal>==</literal> and <literal>=&amp;</literal>.
51349 </para>
51350 <itemizedlist>
51351 <listitem>
51352 <para>
51353 If <literal>=</literal> or <literal>&amp;</literal> is used, the condition is true if any one of the looked up
51354 IP addresses matches one of the listed addresses. For the example above, the
51355 condition is true because 127.0.0.1 matches.
51356 </para>
51357 </listitem>
51358 <listitem>
51359 <para>
51360 If <literal>==</literal> or <literal>=&amp;</literal> is used, the condition is true only if every one of the
51361 looked up IP addresses matches one of the listed addresses. If the condition is
51362 changed to:
51363 </para>
51364 <literallayout class="monospaced">
51365 dnslists = a.b.c==127.0.0.1
51366 </literallayout>
51367 <para>
51368 and the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
51369 false because 127.0.0.2 is not listed. You would need to have:
51370 </para>
51371 <literallayout class="monospaced">
51372 dnslists = a.b.c==127.0.0.1,127.0.0.2
51373 </literallayout>
51374 <para>
51375 for the condition to be true.
51376 </para>
51377 </listitem>
51378 </itemizedlist>
51379 <para>
51380 When <literal>!</literal> is used to negate IP address matching, it inverts the result, giving
51381 the precise opposite of the behaviour above. Thus:
51382 </para>
51383 <itemizedlist>
51384 <listitem>
51385 <para>
51386 If <literal>!=</literal> or <literal>!&amp;</literal> is used, the condition is true if none of the looked up IP
51387 addresses matches one of the listed addresses. Consider:
51388 </para>
51389 <literallayout class="monospaced">
51390 dnslists = a.b.c!&amp;0.0.0.1
51391 </literallayout>
51392 <para>
51393 If the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
51394 false because 127.0.0.1 matches.
51395 </para>
51396 </listitem>
51397 <listitem>
51398 <para>
51399 If <literal>!==</literal> or <literal>!=&amp;</literal> is used, the condition is true there is at least one
51400 looked up IP address that does not match. Consider:
51401 </para>
51402 <literallayout class="monospaced">
51403 dnslists = a.b.c!=&amp;0.0.0.1
51404 </literallayout>
51405 <para>
51406 If the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
51407 true, because 127.0.0.2 does not match. You would need to have:
51408 </para>
51409 <literallayout class="monospaced">
51410 dnslists = a.b.c!=&amp;0.0.0.1,0.0.0.2
51411 </literallayout>
51412 <para>
51413 for the condition to be false.
51414 </para>
51415 </listitem>
51416 </itemizedlist>
51417 <para>
51418 When the DNS lookup yields only a single IP address, there is no difference
51419 between <literal>=</literal> and <literal>==</literal> and between <literal>&amp;</literal> and <literal>=&amp;</literal>.
51420 </para>
51421 </section>
51422 <section id="SECTmordetinf">
51423 <title>Detailed information from merged DNS lists</title>
51424 <para>
51425 <indexterm role="concept">
51426 <primary>DNS list</primary>
51427 <secondary>information from merged</secondary>
51428 </indexterm>
51429 When the facility for restricting the matching IP values in a DNS list is used,
51430 the text from the TXT record that is set in <varname>$dnslist_text</varname> may not reflect
51431 the true reason for rejection. This happens when lists are merged and the IP
51432 address in the A record is used to distinguish them; unfortunately there is
51433 only one TXT record. One way round this is not to use merged lists, but that
51434 can be inefficient because it requires multiple DNS lookups where one would do
51435 in the vast majority of cases when the host of interest is not on any of the
51436 lists.
51437 </para>
51438 <para>
51439 A less inefficient way of solving this problem is available. If
51440 two domain names, comma-separated, are given, the second is used first to
51441 do an initial check, making use of any IP value restrictions that are set.
51442 If there is a match, the first domain is used, without any IP value
51443 restrictions, to get the TXT record. As a byproduct of this, there is also
51444 a check that the IP being tested is indeed on the first list. The first
51445 domain is the one that is put in <varname>$dnslist_domain</varname>. For example:
51446 </para>
51447 <literallayout class="monospaced">
51448 reject message  = \
51449          rejected because $sender_host_address is blacklisted \
51450          at $dnslist_domain\n$dnslist_text
51451        dnslists = \
51452          sbl.spamhaus.org,sbl-xbl.spamhaus.org=127.0.0.2 : \
51453          dul.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.10
51454 </literallayout>
51455 <para>
51456 For the first blacklist item, this starts by doing a lookup in
51457 <emphasis>sbl-xbl.spamhaus.org</emphasis> and testing for a 127.0.0.2 return. If there is a
51458 match, it then looks in <emphasis>sbl.spamhaus.org</emphasis>, without checking the return
51459 value, and as long as something is found, it looks for the corresponding TXT
51460 record. If there is no match in <emphasis>sbl-xbl.spamhaus.org</emphasis>, nothing more is done.
51461 The second blacklist item is processed similarly.
51462 </para>
51463 <para>
51464 If you are interested in more than one merged list, the same list must be
51465 given several times, but because the results of the DNS lookups are cached,
51466 the DNS calls themselves are not repeated. For example:
51467 </para>
51468 <literallayout class="monospaced">
51469 reject dnslists = \
51470          http.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.2 : \
51471          socks.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.3 : \
51472          misc.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.4 : \
51473          dul.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.10
51474 </literallayout>
51475 <para>
51476 In this case there is one lookup in <emphasis>dnsbl.sorbs.net</emphasis>, and if none of the IP
51477 values matches (or if no record is found), this is the only lookup that is
51478 done. Only if there is a match is one of the more specific lists consulted.
51479 </para>
51480 </section>
51481 <section id="SECTmorednslistslast">
51482 <title>DNS lists and IPv6</title>
51483 <para>
51484 <indexterm role="concept">
51485 <primary>IPv6</primary>
51486 <secondary>DNS black lists</secondary>
51487 </indexterm>
51488 <indexterm role="concept">
51489 <primary>DNS list</primary>
51490 <secondary>IPv6 usage</secondary>
51491 </indexterm>
51492 If Exim is asked to do a dnslist lookup for an IPv6 address, it inverts it
51493 nibble by nibble. For example, if the calling host&#x2019;s IP address is
51494 3ffe:ffff:836f:0a00:000a:0800:200a:c031, Exim might look up
51495 </para>
51496 <literallayout class="monospaced">
51497 1.3.0.c.a.0.0.2.0.0.8.0.a.0.0.0.0.0.a.0.f.6.3.8.
51498   f.f.f.f.e.f.f.3.blackholes.mail-abuse.org
51499 </literallayout>
51500 <para>
51501 (split over two lines here to fit on the page). Unfortunately, some of the DNS
51502 lists contain wildcard records, intended for IPv4, that interact badly with
51503 IPv6. For example, the DNS entry
51504 </para>
51505 <literallayout class="monospaced">
51506 *.3.some.list.example.    A    127.0.0.1
51507 </literallayout>
51508 <para>
51509 is probably intended to put the entire 3.0.0.0/8 IPv4 network on the list.
51510 Unfortunately, it also matches the entire 3::/4 IPv6 network.
51511 </para>
51512 <para>
51513 You can exclude IPv6 addresses from DNS lookups by making use of a suitable
51514 <option>condition</option> condition, as in this example:
51515 </para>
51516 <literallayout class="monospaced">
51517 deny   condition = ${if isip4{$sender_host_address}}
51518        dnslists  = some.list.example
51519 </literallayout>
51520 </section>
51521 <section id="SECTratelimiting">
51522 <title>Rate limiting incoming messages</title>
51523 <para>
51524 <indexterm role="concept">
51525 <primary>rate limiting</primary>
51526 <secondary>client sending</secondary>
51527 </indexterm>
51528 <indexterm role="concept">
51529 <primary>limiting client sending rates</primary>
51530 </indexterm>
51531 <indexterm role="option">
51532 <primary><option>smtp_ratelimit_*</option></primary>
51533 </indexterm>
51534 The <option>ratelimit</option> ACL condition can be used to measure and control the rate at
51535 which clients can send email. This is more powerful than the
51536 <option>smtp_ratelimit_*</option> options, because those options control the rate of
51537 commands in a single SMTP session only, whereas the <option>ratelimit</option> condition
51538 works across all connections (concurrent and sequential) from the same client
51539 host. The syntax of the <option>ratelimit</option> condition is:
51540 </para>
51541 <literallayout>
51542 <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;
51543 </literallayout>
51544 <para>
51545 If the average client sending rate is less than <emphasis>m</emphasis> messages per time
51546 period <emphasis>p</emphasis> then the condition is false; otherwise it is true.
51547 </para>
51548 <para>
51549 As a side-effect, the <option>ratelimit</option> condition sets the expansion variable
51550 <varname>$sender_rate</varname> to the client&#x2019;s computed rate, <varname>$sender_rate_limit</varname> to the
51551 configured value of <emphasis>m</emphasis>, and <varname>$sender_rate_period</varname> to the configured value
51552 of <emphasis>p</emphasis>.
51553 </para>
51554 <para>
51555 The parameter <emphasis>p</emphasis> is the smoothing time constant, in the form of an Exim
51556 time interval, for example, <literal>8h</literal> for eight hours. A larger time constant
51557 means that it takes Exim longer to forget a client&#x2019;s past behaviour. The
51558 parameter <emphasis>m</emphasis> is the maximum number of messages that a client is permitted to
51559 send in each time interval. It also specifies the number of messages permitted
51560 in a fast burst. By increasing both <emphasis>m</emphasis> and <emphasis>p</emphasis> but keeping <emphasis>m/p</emphasis>
51561 constant, you can allow a client to send more messages in a burst without
51562 changing its long-term sending rate limit. Conversely, if <emphasis>m</emphasis> and <emphasis>p</emphasis> are
51563 both small, messages must be sent at an even rate.
51564 </para>
51565 <para>
51566 There is a script in <filename>util/ratelimit.pl</filename> which extracts sending rates from
51567 log files, to assist with choosing appropriate settings for <emphasis>m</emphasis> and <emphasis>p</emphasis>
51568 when deploying the <option>ratelimit</option> ACL condition. The script prints usage
51569 instructions when it is run with no arguments.
51570 </para>
51571 <para>
51572 The key is used to look up the data for calculating the client&#x2019;s average
51573 sending rate. This data is stored in Exim&#x2019;s spool directory, alongside the
51574 retry and other hints databases. The default key is <varname>$sender_host_address</varname>,
51575 which means Exim computes the sending rate of each client host IP address.
51576 By changing the key you can change how Exim identifies clients for the purpose
51577 of ratelimiting. For example, to limit the sending rate of each authenticated
51578 user, independent of the computer they are sending from, set the key to
51579 <varname>$authenticated_id</varname>. You must ensure that the lookup key is meaningful; for
51580 example, <varname>$authenticated_id</varname> is only meaningful if the client has
51581 authenticated (which you can check with the <option>authenticated</option> ACL condition).
51582 </para>
51583 <para>
51584 The lookup key does not have to identify clients: If you want to limit the
51585 rate at which a recipient receives messages, you can use the key
51586 <literal>$local_part@$domain</literal> with the <option>per_rcpt</option> option (see below) in a RCPT
51587 ACL.
51588 </para>
51589 <para>
51590 Each <option>ratelimit</option> condition can have up to four options. A <option>per_*</option> option
51591 specifies what Exim measures the rate of, for example messages or recipients
51592 or bytes. You can adjust the measurement using the <option>unique=</option> and/or
51593 <option>count=</option> options. You can also control when Exim updates the recorded rate
51594 using a <option>strict</option>, <option>leaky</option>, or <option>readonly</option> option. The options are
51595 separated by a slash, like the other parameters. They may appear in any order.
51596 </para>
51597 <para>
51598 Internally, Exim appends the smoothing constant <emphasis>p</emphasis> onto the lookup key with
51599 any options that alter the meaning of the stored data. The limit <emphasis>m</emphasis> is not
51600 stored, so you can alter the configured maximum rate and Exim will still
51601 remember clients&#x2019; past behaviour. If you change the <option>per_*</option> mode or add or
51602 remove the <option>unique=</option> option, the lookup key changes so Exim will forget past
51603 behaviour. The lookup key is not affected by changes to the update mode and
51604 the <option>count=</option> option.
51605 </para>
51606 </section>
51607 <section id="ratoptmea">
51608 <title>Ratelimit options for what is being measured</title>
51609 <para>
51610 <indexterm role="concept">
51611 <primary>rate limiting</primary>
51612 <secondary>per_* options</secondary>
51613 </indexterm>
51614 The <option>per_conn</option> option limits the client&#x2019;s connection rate. It is not
51615 normally used in the <option>acl_not_smtp</option>, <option>acl_not_smtp_mime</option>, or
51616 <option>acl_not_smtp_start</option> ACLs.
51617 </para>
51618 <para>
51619 The <option>per_mail</option> option limits the client&#x2019;s rate of sending messages. This is
51620 the default if none of the <option>per_*</option> options is specified. It can be used in
51621 <option>acl_smtp_mail</option>, <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>, <option>acl_smtp_mime</option>,
51622 <option>acl_smtp_data</option>, or <option>acl_not_smtp</option>.
51623 </para>
51624 <para>
51625 The <option>per_byte</option> option limits the sender&#x2019;s email bandwidth. It can be used in
51626 the same ACLs as the <option>per_mail</option> option, though it is best to use this option
51627 in the <option>acl_smtp_mime</option>, <option>acl_smtp_data</option> or <option>acl_not_smtp</option> ACLs; if it is
51628 used in an earlier ACL, Exim relies on the SIZE parameter given by the client
51629 in its MAIL command, which may be inaccurate or completely missing. You can
51630 follow the limit <emphasis>m</emphasis> in the configuration with K, M, or G to specify limits
51631 in kilobytes, megabytes, or gigabytes, respectively.
51632 </para>
51633 <para>
51634 The <option>per_rcpt</option> option causes Exim to limit the rate at which recipients are
51635 accepted. It can be used in the <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>,
51636 <option>acl_smtp_mime</option>, <option>acl_smtp_data</option>, or <option>acl_smtp_rcpt</option> ACLs. In
51637 <option>acl_smtp_rcpt</option> the rate is updated one recipient at a time; in the other
51638 ACLs the rate is updated with the total recipient count in one go. Note that
51639 in either case the rate limiting engine will see a message with many
51640 recipients as a large high-speed burst.
51641 </para>
51642 <para>
51643 The <option>per_addr</option> option is like the <option>per_rcpt</option> option, except it counts the
51644 number of different recipients that the client has sent messages to in the
51645 last time period. That is, if the client repeatedly sends messages to the same
51646 recipient, its measured rate is not increased. This option can only be used in
51647 <option>acl_smtp_rcpt</option>.
51648 </para>
51649 <para>
51650 The <option>per_cmd</option> option causes Exim to recompute the rate every time the
51651 condition is processed. This can be used to limit the rate of any SMTP
51652 command. If it is used in multiple ACLs it can limit the aggregate rate of
51653 multiple different commands.
51654 </para>
51655 <para>
51656 The <option>count=</option> option can be used to alter how much Exim adds to the client&#x2019;s
51657 measured rate. For example, the <option>per_byte</option> option is equivalent to
51658 <literal>per_mail/count=$message_size</literal>. If there is no <option>count=</option> option, Exim
51659 increases the measured rate by one (except for the <option>per_rcpt</option> option in ACLs
51660 other than <option>acl_smtp_rcpt</option>). The count does not have to be an integer.
51661 </para>
51662 <para>
51663 The <option>unique=</option> option is described in section <xref linkend="ratoptuniq"/> below.
51664 </para>
51665 </section>
51666 <section id="ratoptupd">
51667 <title>Ratelimit update modes</title>
51668 <para>
51669 <indexterm role="concept">
51670 <primary>rate limiting</primary>
51671 <secondary>reading data without updating</secondary>
51672 </indexterm>
51673 You can specify one of three options with the <option>ratelimit</option> condition to
51674 control when its database is updated. This section describes the <option>readonly</option>
51675 mode, and the next section describes the <option>strict</option> and <option>leaky</option> modes.
51676 </para>
51677 <para>
51678 If the <option>ratelimit</option> condition is used in <option>readonly</option> mode, Exim looks up a
51679 previously-computed rate to check against the limit.
51680 </para>
51681 <para>
51682 For example, you can test the client&#x2019;s sending rate and deny it access (when
51683 it is too fast) in the connect ACL. If the client passes this check then it
51684 can go on to send a message, in which case its recorded rate will be updated
51685 in the MAIL ACL. Subsequent connections from the same client will check this
51686 new rate.
51687 </para>
51688 <literallayout class="monospaced">
51689 acl_check_connect:
51690   deny ratelimit = 100 / 5m / readonly
51691        log_message = RATE CHECK: $sender_rate/$sender_rate_period \
51692                      (max $sender_rate_limit)
51693 # ...
51694 acl_check_mail:
51695   warn ratelimit = 100 / 5m / strict
51696        log_message  = RATE UPDATE: $sender_rate/$sender_rate_period \
51697                       (max $sender_rate_limit)
51698 </literallayout>
51699 <para>
51700 If Exim encounters multiple <option>ratelimit</option> conditions with the same key when
51701 processing a message then it may increase the client&#x2019;s measured rate more than
51702 it should. For example, this will happen if you check the <option>per_rcpt</option> option
51703 in both <option>acl_smtp_rcpt</option> and <option>acl_smtp_data</option>. However it&#x2019;s OK to check the
51704 same <option>ratelimit</option> condition multiple times in the same ACL. You can avoid any
51705 multiple update problems by using the <option>readonly</option> option on later ratelimit
51706 checks.
51707 </para>
51708 <para>
51709 The <option>per_*</option> options described above do not make sense in some ACLs. If you
51710 use a <option>per_*</option> option in an ACL where it is not normally permitted then the
51711 update mode defaults to <option>readonly</option> and you cannot specify the <option>strict</option> or
51712 <option>leaky</option> modes. In other ACLs the default update mode is <option>leaky</option> (see the
51713 next section) so you must specify the <option>readonly</option> option explicitly.
51714 </para>
51715 </section>
51716 <section id="ratoptfast">
51717 <title>Ratelimit options for handling fast clients</title>
51718 <para>
51719 <indexterm role="concept">
51720 <primary>rate limiting</primary>
51721 <secondary>strict and leaky modes</secondary>
51722 </indexterm>
51723 If a client&#x2019;s average rate is greater than the maximum, the rate limiting
51724 engine can react in two possible ways, depending on the presence of the
51725 <option>strict</option> or <option>leaky</option> update modes. This is independent of the other
51726 counter-measures (such as rejecting the message) that may be specified by the
51727 rest of the ACL.
51728 </para>
51729 <para>
51730 The <option>leaky</option> (default) option means that the client&#x2019;s recorded rate is not
51731 updated if it is above the limit. The effect of this is that Exim measures the
51732 client&#x2019;s average rate of successfully sent email, which cannot be greater than
51733 the maximum allowed. If the client is over the limit it may suffer some
51734 counter-measures (as specified in the ACL), but it will still be able to send
51735 email at the configured maximum rate, whatever the rate of its attempts. This
51736 is generally the better choice if you have clients that retry automatically.
51737 For example, it does not prevent a sender with an over-aggressive retry rate
51738 from getting any email through.
51739 </para>
51740 <para>
51741 The <option>strict</option> option means that the client&#x2019;s recorded rate is always
51742 updated. The effect of this is that Exim measures the client&#x2019;s average rate
51743 of attempts to send email, which can be much higher than the maximum it is
51744 actually allowed. If the client is over the limit it may be subjected to
51745 counter-measures by the ACL. It must slow down and allow sufficient time to
51746 pass that its computed rate falls below the maximum before it can send email
51747 again. The time (the number of smoothing periods) it must wait and not
51748 attempt to send mail can be calculated with this formula:
51749 </para>
51750 <literallayout class="monospaced">
51751         ln(peakrate/maxrate)
51752 </literallayout>
51753 </section>
51754 <section id="ratoptuniq">
51755 <title>Limiting the rate of different events</title>
51756 <para>
51757 <indexterm role="concept">
51758 <primary>rate limiting</primary>
51759 <secondary>counting unique events</secondary>
51760 </indexterm>
51761 The <option>ratelimit</option> <option>unique=</option> option controls a mechanism for counting the
51762 rate of different events. For example, the <option>per_addr</option> option uses this
51763 mechanism to count the number of different recipients that the client has
51764 sent messages to in the last time period; it is equivalent to
51765 <literal>per_rcpt/unique=$local_part@$domain</literal>. You could use this feature to
51766 measure the rate that a client uses different sender addresses with the
51767 options <literal>per_mail/unique=$sender_address</literal>.
51768 </para>
51769 <para>
51770 For each <option>ratelimit</option> key Exim stores the set of <option>unique=</option> values that it
51771 has seen for that key. The whole set is thrown away when it is older than the
51772 rate smoothing period <emphasis>p</emphasis>, so each different event is counted at most once
51773 per period. In the <option>leaky</option> update mode, an event that causes the client to
51774 go over the limit is not added to the set, in the same way that the client&#x2019;s
51775 recorded rate is not updated in the same situation.
51776 </para>
51777 <para>
51778 When you combine the <option>unique=</option> and <option>readonly</option> options, the specific
51779 <option>unique=</option> value is ignored, and Exim just retrieves the client&#x2019;s stored
51780 rate.
51781 </para>
51782 <para>
51783 The <option>unique=</option> mechanism needs more space in the ratelimit database than the
51784 other <option>ratelimit</option> options in order to store the event set. The number of
51785 unique values is potentially as large as the rate limit, so the extra space
51786 required increases with larger limits.
51787 </para>
51788 <para>
51789 The uniqueification is not perfect: there is a small probability that Exim
51790 will think a new event has happened before. If the sender&#x2019;s rate is less than
51791 the limit, Exim should be more than 99.9% correct. However in <option>strict</option> mode
51792 the measured rate can go above the limit, in which case Exim may under-count
51793 events by a significant margin. Fortunately, if the rate is high enough (2.7
51794 times the limit) that the false positive rate goes above 9%, then Exim will
51795 throw away the over-full event set before the measured rate falls below the
51796 limit. Therefore the only harm should be that exceptionally high sending rates
51797 are logged incorrectly; any countermeasures you configure will be as effective
51798 as intended.
51799 </para>
51800 </section>
51801 <section id="useratlim">
51802 <title>Using rate limiting</title>
51803 <para>
51804 Exim&#x2019;s other ACL facilities are used to define what counter-measures are taken
51805 when the rate limit is exceeded. This might be anything from logging a warning
51806 (for example, while measuring existing sending rates in order to define
51807 policy), through time delays to slow down fast senders, up to rejecting the
51808 message. For example:
51809 </para>
51810 <literallayout class="monospaced">
51811 # Log all senders' rates
51812 warn ratelimit = 0 / 1h / strict
51813      log_message = Sender rate $sender_rate / $sender_rate_period
51814
51815 # Slow down fast senders; note the need to truncate $sender_rate
51816 # at the decimal point.
51817 warn ratelimit = 100 / 1h / per_rcpt / strict
51818      delay     = ${eval: ${sg{$sender_rate}{[.].*}{}} - \
51819                    $sender_rate_limit }s
51820
51821 # Keep authenticated users under control
51822 deny authenticated = *
51823      ratelimit = 100 / 1d / strict / $authenticated_id
51824
51825 # System-wide rate limit
51826 defer message = Sorry, too busy. Try again later.
51827      ratelimit = 10 / 1s / $primary_hostname
51828
51829 # Restrict incoming rate from each host, with a default
51830 # set using a macro and special cases looked up in a table.
51831 defer message = Sender rate exceeds $sender_rate_limit \
51832                messages per $sender_rate_period
51833      ratelimit = ${lookup {$sender_host_address} \
51834                    cdb {DB/ratelimits.cdb} \
51835                    {$value} {RATELIMIT} }
51836 </literallayout>
51837 <para>
51838 <emphasis role="bold">Warning</emphasis>: If you have a busy server with a lot of <option>ratelimit</option> tests,
51839 especially with the <option>per_rcpt</option> option, you may suffer from a performance
51840 bottleneck caused by locking on the ratelimit hints database. Apart from
51841 making your ACLs less complicated, you can reduce the problem by using a
51842 RAM disk for Exim&#x2019;s hints directory (usually <filename>/var/spool/exim/db/</filename>). However
51843 this means that Exim will lose its hints data after a reboot (including retry
51844 hints, the callout cache, and ratelimit data).
51845 </para>
51846 </section>
51847 <section id="SECTaddressverification">
51848 <title>Address verification</title>
51849 <para>
51850 <indexterm role="concept">
51851 <primary>verifying address</primary>
51852 <secondary>options for</secondary>
51853 </indexterm>
51854 <indexterm role="concept">
51855 <primary>policy control</primary>
51856 <secondary>address verification</secondary>
51857 </indexterm>
51858 Several of the <option>verify</option> conditions described in section
51859 <xref linkend="SECTaclconditions"/> cause addresses to be verified. Section
51860 <xref linkend="SECTsenaddver"/> discusses the reporting of sender verification failures.
51861 The verification conditions can be followed by options that modify the
51862 verification process. The options are separated from the keyword and from each
51863 other by slashes, and some of them contain parameters. For example:
51864 </para>
51865 <literallayout class="monospaced">
51866 verify = sender/callout
51867 verify = recipient/defer_ok/callout=10s,defer_ok
51868 </literallayout>
51869 <para>
51870 The first stage of address verification, which always happens, is to run the
51871 address through the routers, in <quote>verify mode</quote>. Routers can detect the
51872 difference between verification and routing for delivery, and their actions can
51873 be varied by a number of generic options such as <option>verify</option> and <option>verify_only</option>
51874 (see chapter <xref linkend="CHAProutergeneric"/>). If routing fails, verification fails.
51875 The available options are as follows:
51876 </para>
51877 <itemizedlist>
51878 <listitem>
51879 <para>
51880 If the <option>callout</option> option is specified, successful routing to one or more
51881 remote hosts is followed by a <quote>callout</quote> to those hosts as an additional
51882 check. Callouts and their sub-options are discussed in the next section.
51883 </para>
51884 </listitem>
51885 <listitem>
51886 <para>
51887 If there is a defer error while doing verification routing, the ACL
51888 normally returns <quote>defer</quote>. However, if you include <option>defer_ok</option> in the
51889 options, the condition is forced to be true instead. Note that this is a main
51890 verification option as well as a suboption for callouts.
51891 </para>
51892 </listitem>
51893 <listitem>
51894 <para>
51895 The <option>no_details</option> option is covered in section <xref linkend="SECTsenaddver"/>, which
51896 discusses the reporting of sender address verification failures.
51897 </para>
51898 </listitem>
51899 <listitem>
51900 <para>
51901 The <option>success_on_redirect</option> option causes verification always to succeed
51902 immediately after a successful redirection. By default, if a redirection
51903 generates just one address, that address is also verified. See further
51904 discussion in section <xref linkend="SECTredirwhilveri"/>.
51905 </para>
51906 </listitem>
51907 </itemizedlist>
51908 <para>
51909 <indexterm role="concept">
51910 <primary>verifying address</primary>
51911 <secondary>differentiating failures</secondary>
51912 </indexterm>
51913 <indexterm role="variable">
51914 <primary><varname>$recipient_verify_failure</varname></primary>
51915 </indexterm>
51916 <indexterm role="variable">
51917 <primary><varname>$sender_verify_failure</varname></primary>
51918 </indexterm>
51919 <indexterm role="variable">
51920 <primary><varname>$acl_verify_message</varname></primary>
51921 </indexterm>
51922 After an address verification failure, <varname>$acl_verify_message</varname> contains the
51923 error message that is associated with the failure. It can be preserved by
51924 coding like this:
51925 </para>
51926 <literallayout class="monospaced">
51927 warn  !verify = sender
51928        set acl_m0 = $acl_verify_message
51929 </literallayout>
51930 <para>
51931 If you are writing your own custom rejection message or log message when
51932 denying access, you can use this variable to include information about the
51933 verification failure.
51934 </para>
51935 <para>
51936 In addition, <varname>$sender_verify_failure</varname> or <varname>$recipient_verify_failure</varname> (as
51937 appropriate) contains one of the following words:
51938 </para>
51939 <itemizedlist>
51940 <listitem>
51941 <para>
51942 <option>qualify</option>: The address was unqualified (no domain), and the message
51943 was neither local nor came from an exempted host.
51944 </para>
51945 </listitem>
51946 <listitem>
51947 <para>
51948 <option>route</option>: Routing failed.
51949 </para>
51950 </listitem>
51951 <listitem>
51952 <para>
51953 <option>mail</option>: Routing succeeded, and a callout was attempted; rejection
51954 occurred at or before the MAIL command (that is, on initial
51955 connection, HELO, or MAIL).
51956 </para>
51957 </listitem>
51958 <listitem>
51959 <para>
51960 <option>recipient</option>: The RCPT command in a callout was rejected.
51961 </para>
51962 </listitem>
51963 <listitem>
51964 <para>
51965 <option>postmaster</option>: The postmaster check in a callout was rejected.
51966 </para>
51967 </listitem>
51968 </itemizedlist>
51969 <para>
51970 The main use of these variables is expected to be to distinguish between
51971 rejections of MAIL and rejections of RCPT in callouts.
51972 </para>
51973 </section>
51974 <section id="SECTcallver">
51975 <title>Callout verification</title>
51976 <para>
51977 <indexterm role="concept">
51978 <primary>verifying address</primary>
51979 <secondary>by callout</secondary>
51980 </indexterm>
51981 <indexterm role="concept">
51982 <primary>callout</primary>
51983 <secondary>verification</secondary>
51984 </indexterm>
51985 <indexterm role="concept">
51986 <primary>SMTP</primary>
51987 <secondary>callout verification</secondary>
51988 </indexterm>
51989 For non-local addresses, routing verifies the domain, but is unable to do any
51990 checking of the local part. There are situations where some means of verifying
51991 the local part is desirable. One way this can be done is to make an SMTP
51992 <emphasis>callback</emphasis> to a delivery host for the sender address or a <emphasis>callforward</emphasis> to
51993 a subsequent host for a recipient address, to see if the host accepts the
51994 address. We use the term <emphasis>callout</emphasis> to cover both cases. Note that for a
51995 sender address, the callback is not to the client host that is trying to
51996 deliver the message, but to one of the hosts that accepts incoming mail for the
51997 sender&#x2019;s domain.
51998 </para>
51999 <para>
52000 Exim does not do callouts by default. If you want them to happen, you must
52001 request them by setting appropriate options on the <option>verify</option> condition, as
52002 described below. This facility should be used with care, because it can add a
52003 lot of resource usage to the cost of verifying an address. However, Exim does
52004 cache the results of callouts, which helps to reduce the cost. Details of
52005 caching are in section <xref linkend="SECTcallvercache"/>.
52006 </para>
52007 <para>
52008 Recipient callouts are usually used only between hosts that are controlled by
52009 the same administration. For example, a corporate gateway host could use
52010 callouts to check for valid recipients on an internal mailserver. A successful
52011 callout does not guarantee that a real delivery to the address would succeed;
52012 on the other hand, a failing callout does guarantee that a delivery would fail.
52013 </para>
52014 <para>
52015 If the <option>callout</option> option is present on a condition that verifies an address, a
52016 second stage of verification occurs if the address is successfully routed to
52017 one or more remote hosts. The usual case is routing by a <command>dnslookup</command> or a
52018 <command>manualroute</command> router, where the router specifies the hosts. However, if a
52019 router that does not set up hosts routes to an <command>smtp</command> transport with a
52020 <option>hosts</option> setting, the transport&#x2019;s hosts are used. If an <command>smtp</command> transport has
52021 <option>hosts_override</option> set, its hosts are always used, whether or not the router
52022 supplies a host list.
52023 </para>
52024 <para>
52025 The port that is used is taken from the transport, if it is specified and is a
52026 remote transport. (For routers that do verification only, no transport need be
52027 specified.) Otherwise, the default SMTP port is used. If a remote transport
52028 specifies an outgoing interface, this is used; otherwise the interface is not
52029 specified. Likewise, the text that is used for the HELO command is taken from
52030 the transport&#x2019;s <option>helo_data</option> option; if there is no transport, the value of
52031 <varname>$smtp_active_hostname</varname> is used.
52032 </para>
52033 <para>
52034 For a sender callout check, Exim makes SMTP connections to the remote hosts, to
52035 test whether a bounce message could be delivered to the sender address. The
52036 following SMTP commands are sent:
52037 </para>
52038 <literallayout>
52039 <literal>HELO </literal>&lt;<emphasis>local host name</emphasis>&gt;
52040 <literal>MAIL FROM:&lt;&gt;</literal>
52041 <literal>RCPT TO:</literal>&lt;<emphasis>the address to be tested</emphasis>&gt;
52042 <literal>QUIT</literal>
52043 </literallayout>
52044 <para>
52045 LHLO is used instead of HELO if the transport&#x2019;s <option>protocol</option> option is
52046 set to <quote>lmtp</quote>.
52047 </para>
52048 <para>
52049 A recipient callout check is similar. By default, it also uses an empty address
52050 for the sender. This default is chosen because most hosts do not make use of
52051 the sender address when verifying a recipient. Using the same address means
52052 that a single cache entry can be used for each recipient. Some sites, however,
52053 do make use of the sender address when verifying. These are catered for by the
52054 <option>use_sender</option> and <option>use_postmaster</option> options, described in the next section.
52055 </para>
52056 <para>
52057 If the response to the RCPT command is a 2<emphasis>xx</emphasis> code, the verification
52058 succeeds. If it is 5<emphasis>xx</emphasis>, the verification fails. For any other condition,
52059 Exim tries the next host, if any. If there is a problem with all the remote
52060 hosts, the ACL yields <quote>defer</quote>, unless the <option>defer_ok</option> parameter of the
52061 <option>callout</option> option is given, in which case the condition is forced to succeed.
52062 </para>
52063 <para>
52064 <indexterm role="concept">
52065 <primary>SMTP</primary>
52066 <secondary>output flushing, disabling for callout</secondary>
52067 </indexterm>
52068 A callout may take a little time. For this reason, Exim normally flushes SMTP
52069 output before performing a callout in an ACL, to avoid unexpected timeouts in
52070 clients when the SMTP PIPELINING extension is in use. The flushing can be
52071 disabled by using a <option>control</option> modifier to set <option>no_callout_flush</option>.
52072 </para>
52073 </section>
52074 <section id="CALLaddparcall">
52075 <title>Additional parameters for callouts</title>
52076 <para>
52077 <indexterm role="concept">
52078 <primary>callout</primary>
52079 <secondary>additional parameters for</secondary>
52080 </indexterm>
52081 The <option>callout</option> option can be followed by an equals sign and a number of
52082 optional parameters, separated by commas. For example:
52083 </para>
52084 <literallayout class="monospaced">
52085 verify = recipient/callout=10s,defer_ok
52086 </literallayout>
52087 <para>
52088 The old syntax, which had <option>callout_defer_ok</option> and <option>check_postmaster</option> as
52089 separate verify options, is retained for backwards compatibility, but is now
52090 deprecated. The additional parameters for <option>callout</option> are as follows:
52091 </para>
52092 <variablelist>
52093 <varlistentry>
52094 <term>&lt;<emphasis>a&nbsp;time&nbsp;interval</emphasis>&gt;</term>
52095 <listitem>
52096 <para>
52097 <indexterm role="concept">
52098 <primary>callout</primary>
52099 <secondary>timeout, specifying</secondary>
52100 </indexterm>
52101 This specifies the timeout that applies for the callout attempt to each host.
52102 For example:
52103 </para>
52104 <literallayout class="monospaced">
52105 verify = sender/callout=5s
52106 </literallayout>
52107 <para>
52108 The default is 30 seconds. The timeout is used for each response from the
52109 remote host. It is also used for the initial connection, unless overridden by
52110 the <option>connect</option> parameter.
52111 </para>
52112 </listitem></varlistentry>
52113 <varlistentry>
52114 <term><emphasis role="bold">connect&nbsp;=&nbsp;</emphasis>&lt;<emphasis>time&nbsp;interval</emphasis>&gt;</term>
52115 <listitem>
52116 <para>
52117 <indexterm role="concept">
52118 <primary>callout</primary>
52119 <secondary>connection timeout, specifying</secondary>
52120 </indexterm>
52121 This parameter makes it possible to set a different (usually smaller) timeout
52122 for making the SMTP connection. For example:
52123 </para>
52124 <literallayout class="monospaced">
52125 verify = sender/callout=5s,connect=1s
52126 </literallayout>
52127 <para>
52128 If not specified, this timeout defaults to the general timeout value.
52129 </para>
52130 </listitem></varlistentry>
52131 <varlistentry>
52132 <term><emphasis role="bold">defer_ok</emphasis></term>
52133 <listitem>
52134 <para>
52135 <indexterm role="concept">
52136 <primary>callout</primary>
52137 <secondary>defer, action on</secondary>
52138 </indexterm>
52139 When this parameter is present, failure to contact any host, or any other kind
52140 of temporary error, is treated as success by the ACL. However, the cache is not
52141 updated in this circumstance.
52142 </para>
52143 </listitem></varlistentry>
52144 <varlistentry>
52145 <term><emphasis role="bold">fullpostmaster</emphasis></term>
52146 <listitem>
52147 <para>
52148 <indexterm role="concept">
52149 <primary>callout</primary>
52150 <secondary>full postmaster check</secondary>
52151 </indexterm>
52152 This operates like the <option>postmaster</option> option (see below), but if the check for
52153 <emphasis>postmaster@domain</emphasis> fails, it tries just <emphasis>postmaster</emphasis>, without a domain, in
52154 accordance with the specification in RFC 2821. The RFC states that the
52155 unqualified address <emphasis>postmaster</emphasis> should be accepted.
52156 </para>
52157 </listitem></varlistentry>
52158 <varlistentry>
52159 <term><emphasis role="bold">mailfrom&nbsp;=&nbsp;</emphasis>&lt;<emphasis>email&nbsp;address</emphasis>&gt;</term>
52160 <listitem>
52161 <para>
52162 <indexterm role="concept">
52163 <primary>callout</primary>
52164 <secondary>sender when verifying header</secondary>
52165 </indexterm>
52166 When verifying addresses in header lines using the <option>header_sender</option>
52167 verification option, Exim behaves by default as if the addresses are envelope
52168 sender addresses from a message. Callout verification therefore tests to see
52169 whether a bounce message could be delivered, by using an empty address in the
52170 MAIL command. However, it is arguable that these addresses might never be used
52171 as envelope senders, and could therefore justifiably reject bounce messages
52172 (empty senders). The <option>mailfrom</option> callout parameter allows you to specify what
52173 address to use in the MAIL command. For example:
52174 </para>
52175 <literallayout class="monospaced">
52176 require  verify = header_sender/callout=mailfrom=abcd@x.y.z
52177 </literallayout>
52178 <para>
52179 This parameter is available only for the <option>header_sender</option> verification option.
52180 </para>
52181 </listitem></varlistentry>
52182 <varlistentry>
52183 <term><emphasis role="bold">maxwait&nbsp;=&nbsp;</emphasis>&lt;<emphasis>time&nbsp;interval</emphasis>&gt;</term>
52184 <listitem>
52185 <para>
52186 <indexterm role="concept">
52187 <primary>callout</primary>
52188 <secondary>overall timeout, specifying</secondary>
52189 </indexterm>
52190 This parameter sets an overall timeout for performing a callout verification.
52191 For example:
52192 </para>
52193 <literallayout class="monospaced">
52194 verify = sender/callout=5s,maxwait=30s
52195 </literallayout>
52196 <para>
52197 This timeout defaults to four times the callout timeout for individual SMTP
52198 commands. The overall timeout applies when there is more than one host that can
52199 be tried. The timeout is checked before trying the next host. This prevents
52200 very long delays if there are a large number of hosts and all are timing out
52201 (for example, when network connections are timing out).
52202 </para>
52203 </listitem></varlistentry>
52204 <varlistentry>
52205 <term><emphasis role="bold">no_cache</emphasis></term>
52206 <listitem>
52207 <para>
52208 <indexterm role="concept">
52209 <primary>callout</primary>
52210 <secondary>cache, suppressing</secondary>
52211 </indexterm>
52212 <indexterm role="concept">
52213 <primary>caching callout, suppressing</primary>
52214 </indexterm>
52215 When this parameter is given, the callout cache is neither read nor updated.
52216 </para>
52217 </listitem></varlistentry>
52218 <varlistentry>
52219 <term><emphasis role="bold">postmaster</emphasis></term>
52220 <listitem>
52221 <para>
52222 <indexterm role="concept">
52223 <primary>callout</primary>
52224 <secondary>postmaster; checking</secondary>
52225 </indexterm>
52226 When this parameter is set, a successful callout check is followed by a similar
52227 check for the local part <emphasis>postmaster</emphasis> at the same domain. If this address is
52228 rejected, the callout fails (but see <option>fullpostmaster</option> above). The result of
52229 the postmaster check is recorded in a cache record; if it is a failure, this is
52230 used to fail subsequent callouts for the domain without a connection being
52231 made, until the cache record expires.
52232 </para>
52233 </listitem></varlistentry>
52234 <varlistentry>
52235 <term><emphasis role="bold">postmaster_mailfrom&nbsp;=&nbsp;</emphasis>&lt;<emphasis>email&nbsp;address</emphasis>&gt;</term>
52236 <listitem>
52237 <para>
52238 The postmaster check uses an empty sender in the MAIL command by default.
52239 You can use this parameter to do a postmaster check using a different address.
52240 For example:
52241 </para>
52242 <literallayout class="monospaced">
52243 require  verify = sender/callout=postmaster_mailfrom=abc@x.y.z
52244 </literallayout>
52245 <para>
52246 If both <option>postmaster</option> and <option>postmaster_mailfrom</option> are present, the rightmost
52247 one overrides. The <option>postmaster</option> parameter is equivalent to this example:
52248 </para>
52249 <literallayout class="monospaced">
52250 require  verify = sender/callout=postmaster_mailfrom=
52251 </literallayout>
52252 <para>
52253 <emphasis role="bold">Warning</emphasis>: The caching arrangements for postmaster checking do not take
52254 account of the sender address. It is assumed that either the empty address or
52255 a fixed non-empty address will be used. All that Exim remembers is that the
52256 postmaster check for the domain succeeded or failed.
52257 </para>
52258 </listitem></varlistentry>
52259 <varlistentry>
52260 <term><emphasis role="bold">random</emphasis></term>
52261 <listitem>
52262 <para>
52263 <indexterm role="concept">
52264 <primary>callout</primary>
52265 <secondary><quote>random</quote> check</secondary>
52266 </indexterm>
52267 When this parameter is set, before doing the normal callout check, Exim does a
52268 check for a <quote>random</quote> local part at the same domain. The local part is not
52269 really random &ndash; it is defined by the expansion of the option
52270 <option>callout_random_local_part</option>, which defaults to
52271 </para>
52272 <literallayout class="monospaced">
52273 $primary_host_name-$tod_epoch-testing
52274 </literallayout>
52275 <para>
52276 The idea here is to try to determine whether the remote host accepts all local
52277 parts without checking. If it does, there is no point in doing callouts for
52278 specific local parts. If the <quote>random</quote> check succeeds, the result is saved in
52279 a cache record, and used to force the current and subsequent callout checks to
52280 succeed without a connection being made, until the cache record expires.
52281 </para>
52282 </listitem></varlistentry>
52283 <varlistentry>
52284 <term><emphasis role="bold">use_postmaster</emphasis></term>
52285 <listitem>
52286 <para>
52287 <indexterm role="concept">
52288 <primary>callout</primary>
52289 <secondary>sender for recipient check</secondary>
52290 </indexterm>
52291 This parameter applies to recipient callouts only. For example:
52292 </para>
52293 <literallayout class="monospaced">
52294 deny  !verify = recipient/callout=use_postmaster
52295 </literallayout>
52296 <para>
52297 <indexterm role="variable">
52298 <primary><varname>$qualify_domain</varname></primary>
52299 </indexterm>
52300 It causes a non-empty postmaster address to be used in the MAIL command when
52301 performing the callout for the recipient, and also for a <quote>random</quote> check if
52302 that is configured. The local part of the address is <literal>postmaster</literal> and the
52303 domain is the contents of <varname>$qualify_domain</varname>.
52304 </para>
52305 </listitem></varlistentry>
52306 <varlistentry>
52307 <term><emphasis role="bold">use_sender</emphasis></term>
52308 <listitem>
52309 <para>
52310 This option applies to recipient callouts only. For example:
52311 </para>
52312 <literallayout class="monospaced">
52313 require  verify = recipient/callout=use_sender
52314 </literallayout>
52315 <para>
52316 It causes the message&#x2019;s actual sender address to be used in the MAIL
52317 command when performing the callout, instead of an empty address. There is no
52318 need to use this option unless you know that the called hosts make use of the
52319 sender when checking recipients. If used indiscriminately, it reduces the
52320 usefulness of callout caching.
52321 </para>
52322 </listitem></varlistentry>
52323 </variablelist>
52324 <para>
52325 If you use any of the parameters that set a non-empty sender for the MAIL
52326 command (<option>mailfrom</option>, <option>postmaster_mailfrom</option>, <option>use_postmaster</option>, or
52327 <option>use_sender</option>), you should think about possible loops. Recipient checking is
52328 usually done between two hosts that are under the same management, and the host
52329 that receives the callouts is not normally configured to do callouts itself.
52330 Therefore, it is normally safe to use <option>use_postmaster</option> or <option>use_sender</option> in
52331 these circumstances.
52332 </para>
52333 <para>
52334 However, if you use a non-empty sender address for a callout to an arbitrary
52335 host, there is the likelihood that the remote host will itself initiate a
52336 callout check back to your host. As it is checking what appears to be a message
52337 sender, it is likely to use an empty address in MAIL, thus avoiding a
52338 callout loop. However, to be on the safe side it would be best to set up your
52339 own ACLs so that they do not do sender verification checks when the recipient
52340 is the address you use for header sender or postmaster callout checking.
52341 </para>
52342 <para>
52343 Another issue to think about when using non-empty senders for callouts is
52344 caching. When you set <option>mailfrom</option> or <option>use_sender</option>, the cache record is keyed
52345 by the sender/recipient combination; thus, for any given recipient, many more
52346 actual callouts are performed than when an empty sender or postmaster is used.
52347 </para>
52348 </section>
52349 <section id="SECTcallvercache">
52350 <title>Callout caching</title>
52351 <para>
52352 <indexterm role="concept">
52353 <primary>hints database</primary>
52354 <secondary>callout cache</secondary>
52355 </indexterm>
52356 <indexterm role="concept">
52357 <primary>callout</primary>
52358 <secondary>cache, description of</secondary>
52359 </indexterm>
52360 <indexterm role="concept">
52361 <primary>caching</primary>
52362 <secondary>callout</secondary>
52363 </indexterm>
52364 Exim caches the results of callouts in order to reduce the amount of resources
52365 used, unless you specify the <option>no_cache</option> parameter with the <option>callout</option>
52366 option. A hints database called <quote>callout</quote> is used for the cache. Two
52367 different record types are used: one records the result of a callout check for
52368 a specific address, and the other records information that applies to the
52369 entire domain (for example, that it accepts the local part <emphasis>postmaster</emphasis>).
52370 </para>
52371 <para>
52372 When an original callout fails, a detailed SMTP error message is given about
52373 the failure. However, for subsequent failures use the cache data, this message
52374 is not available.
52375 </para>
52376 <para>
52377 The expiry times for negative and positive address cache records are
52378 independent, and can be set by the global options <option>callout_negative_expire</option>
52379 (default 2h) and <option>callout_positive_expire</option> (default 24h), respectively.
52380 </para>
52381 <para>
52382 If a host gives a negative response to an SMTP connection, or rejects any
52383 commands up to and including
52384 </para>
52385 <literallayout class="monospaced">
52386 MAIL FROM:&lt;&gt;
52387 </literallayout>
52388 <para>
52389 (but not including the MAIL command with a non-empty address),
52390 any callout attempt is bound to fail. Exim remembers such failures in a
52391 domain cache record, which it uses to fail callouts for the domain without
52392 making new connections, until the domain record times out. There are two
52393 separate expiry times for domain cache records:
52394 <option>callout_domain_negative_expire</option> (default 3h) and
52395 <option>callout_domain_positive_expire</option> (default 7d).
52396 </para>
52397 <para>
52398 Domain records expire when the negative expiry time is reached if callouts
52399 cannot be made for the domain, or if the postmaster check failed.
52400 Otherwise, they expire when the positive expiry time is reached. This
52401 ensures that, for example, a host that stops accepting <quote>random</quote> local parts
52402 will eventually be noticed.
52403 </para>
52404 <para>
52405 The callout caching mechanism is based on the domain of the address that is
52406 being tested. If the domain routes to several hosts, it is assumed that their
52407 behaviour will be the same.
52408 </para>
52409 </section>
52410 <section id="SECTsenaddver">
52411 <title>Sender address verification reporting</title>
52412 <para>
52413 <indexterm role="concept">
52414 <primary>verifying</primary>
52415 <secondary>suppressing error details</secondary>
52416 </indexterm>
52417 See section <xref linkend="SECTaddressverification"/> for a general discussion of
52418 verification. When sender verification fails in an ACL, the details of the
52419 failure are given as additional output lines before the 550 response to the
52420 relevant SMTP command (RCPT or DATA). For example, if sender callout is in use,
52421 you might see:
52422 </para>
52423 <literallayout class="monospaced">
52424 MAIL FROM:&lt;xyz@abc.example&gt;
52425 250 OK
52426 RCPT TO:&lt;pqr@def.example&gt;
52427 550-Verification failed for &lt;xyz@abc.example&gt;
52428 550-Called:   192.168.34.43
52429 550-Sent:     RCPT TO:&lt;xyz@abc.example&gt;
52430 550-Response: 550 Unknown local part xyz in &lt;xyz@abc.example&gt;
52431 550 Sender verification failed
52432 </literallayout>
52433 <para>
52434 If more than one RCPT command fails in the same way, the details are given
52435 only for the first of them. However, some administrators do not want to send
52436 out this much information. You can suppress the details by adding
52437 <literal>/no_details</literal> to the ACL statement that requests sender verification. For
52438 example:
52439 </para>
52440 <literallayout class="monospaced">
52441 verify = sender/no_details
52442 </literallayout>
52443 </section>
52444 <section id="SECTredirwhilveri">
52445 <title>Redirection while verifying</title>
52446 <para>
52447 <indexterm role="concept">
52448 <primary>verifying</primary>
52449 <secondary>redirection while</secondary>
52450 </indexterm>
52451 <indexterm role="concept">
52452 <primary>address redirection</primary>
52453 <secondary>while verifying</secondary>
52454 </indexterm>
52455 A dilemma arises when a local address is redirected by aliasing or forwarding
52456 during verification: should the generated addresses themselves be verified,
52457 or should the successful expansion of the original address be enough to verify
52458 it? By default, Exim takes the following pragmatic approach:
52459 </para>
52460 <itemizedlist>
52461 <listitem>
52462 <para>
52463 When an incoming address is redirected to just one child address, verification
52464 continues with the child address, and if that fails to verify, the original
52465 verification also fails.
52466 </para>
52467 </listitem>
52468 <listitem>
52469 <para>
52470 When an incoming address is redirected to more than one child address,
52471 verification does not continue. A success result is returned.
52472 </para>
52473 </listitem>
52474 </itemizedlist>
52475 <para>
52476 This seems the most reasonable behaviour for the common use of aliasing as a
52477 way of redirecting different local parts to the same mailbox. It means, for
52478 example, that a pair of alias entries of the form
52479 </para>
52480 <literallayout class="monospaced">
52481 A.Wol:   aw123
52482 aw123:   :fail: Gone away, no forwarding address
52483 </literallayout>
52484 <para>
52485 work as expected, with both local parts causing verification failure. When a
52486 redirection generates more than one address, the behaviour is more like a
52487 mailing list, where the existence of the alias itself is sufficient for
52488 verification to succeed.
52489 </para>
52490 <para>
52491 It is possible, however, to change the default behaviour so that all successful
52492 redirections count as successful verifications, however many new addresses are
52493 generated. This is specified by the <option>success_on_redirect</option> verification
52494 option. For example:
52495 </para>
52496 <literallayout class="monospaced">
52497 require verify = recipient/success_on_redirect/callout=10s
52498 </literallayout>
52499 <para>
52500 In this example, verification succeeds if a router generates a new address, and
52501 the callout does not occur, because no address was routed to a remote host.
52502 </para>
52503 <para>
52504 When verification is being tested via the <option>-bv</option> option, the treatment of
52505 redirections is as just described, unless the <option>-v</option> or any debugging option is
52506 also specified. In that case, full verification is done for every generated
52507 address and a report is output for each of them.
52508 </para>
52509 </section>
52510 <section id="SECTverifyCSA">
52511 <title>Client SMTP authorization (CSA)</title>
52512 <para>
52513 <indexterm role="concept">
52514 <primary>CSA</primary>
52515 <secondary>verifying</secondary>
52516 </indexterm>
52517 Client SMTP Authorization is a system that allows a site to advertise
52518 which machines are and are not permitted to send email. This is done by placing
52519 special SRV records in the DNS; these are looked up using the client&#x2019;s HELO
52520 domain. At the time of writing, CSA is still an Internet Draft. Client SMTP
52521 Authorization checks in Exim are performed by the ACL condition:
52522 </para>
52523 <literallayout class="monospaced">
52524 verify = csa
52525 </literallayout>
52526 <para>
52527 This fails if the client is not authorized. If there is a DNS problem, or if no
52528 valid CSA SRV record is found, or if the client is authorized, the condition
52529 succeeds. These three cases can be distinguished using the expansion variable
52530 <varname>$csa_status</varname>, which can take one of the values <quote>fail</quote>, <quote>defer</quote>,
52531 <quote>unknown</quote>, or <quote>ok</quote>. The condition does not itself defer because that would
52532 be likely to cause problems for legitimate email.
52533 </para>
52534 <para>
52535 The error messages produced by the CSA code include slightly more
52536 detail. If <varname>$csa_status</varname> is <quote>defer</quote>, this may be because of problems
52537 looking up the CSA SRV record, or problems looking up the CSA target
52538 address record. There are four reasons for <varname>$csa_status</varname> being <quote>fail</quote>:
52539 </para>
52540 <itemizedlist>
52541 <listitem>
52542 <para>
52543 The client&#x2019;s host name is explicitly not authorized.
52544 </para>
52545 </listitem>
52546 <listitem>
52547 <para>
52548 The client&#x2019;s IP address does not match any of the CSA target IP addresses.
52549 </para>
52550 </listitem>
52551 <listitem>
52552 <para>
52553 The client&#x2019;s host name is authorized but it has no valid target IP addresses
52554 (for example, the target&#x2019;s addresses are IPv6 and the client is using IPv4).
52555 </para>
52556 </listitem>
52557 <listitem>
52558 <para>
52559 The client&#x2019;s host name has no CSA SRV record but a parent domain has asserted
52560 that all subdomains must be explicitly authorized.
52561 </para>
52562 </listitem>
52563 </itemizedlist>
52564 <para>
52565 The <option>csa</option> verification condition can take an argument which is the domain to
52566 use for the DNS query. The default is:
52567 </para>
52568 <literallayout class="monospaced">
52569 verify = csa/$sender_helo_name
52570 </literallayout>
52571 <para>
52572 This implementation includes an extension to CSA. If the query domain
52573 is an address literal such as [192.0.2.95], or if it is a bare IP
52574 address, Exim searches for CSA SRV records in the reverse DNS as if
52575 the HELO domain was (for example) <emphasis>95.2.0.192.in-addr.arpa</emphasis>. Therefore it is
52576 meaningful to say:
52577 </para>
52578 <literallayout class="monospaced">
52579 verify = csa/$sender_host_address
52580 </literallayout>
52581 <para>
52582 In fact, this is the check that Exim performs if the client does not say HELO.
52583 This extension can be turned off by setting the main configuration option
52584 <option>dns_csa_use_reverse</option> to be false.
52585 </para>
52586 <para>
52587 If a CSA SRV record is not found for the domain itself, a search
52588 is performed through its parent domains for a record which might be
52589 making assertions about subdomains. The maximum depth of this search is limited
52590 using the main configuration option <option>dns_csa_search_limit</option>, which is 5 by
52591 default. Exim does not look for CSA SRV records in a top level domain, so the
52592 default settings handle HELO domains as long as seven
52593 (<emphasis>hostname.five.four.three.two.one.com</emphasis>). This encompasses the vast majority
52594 of legitimate HELO domains.
52595 </para>
52596 <para>
52597 The <emphasis>dnsdb</emphasis> lookup also has support for CSA. Although <emphasis>dnsdb</emphasis> also supports
52598 direct SRV lookups, this is not sufficient because of the extra parent domain
52599 search behaviour of CSA, and (as with PTR lookups) <emphasis>dnsdb</emphasis> also turns IP
52600 addresses into lookups in the reverse DNS space. The result of a successful
52601 lookup such as:
52602 </para>
52603 <literallayout class="monospaced">
52604 ${lookup dnsdb {csa=$sender_helo_name}}
52605 </literallayout>
52606 <para>
52607 has two space-separated fields: an authorization code and a target host name.
52608 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
52609 authorization required but absent, or <quote>?</quote> for unknown.
52610 </para>
52611 </section>
52612 <section id="SECTverifyPRVS">
52613 <title>Bounce address tag validation</title>
52614 <para>
52615 <indexterm role="concept">
52616 <primary>BATV, verifying</primary>
52617 </indexterm>
52618 Bounce address tag validation (BATV) is a scheme whereby the envelope senders
52619 of outgoing messages have a cryptographic, timestamped <quote>tag</quote> added to them.
52620 Genuine incoming bounce messages should therefore always be addressed to
52621 recipients that have a valid tag. This scheme is a way of detecting unwanted
52622 bounce messages caused by sender address forgeries (often called <quote>collateral
52623 spam</quote>), because the recipients of such messages do not include valid tags.
52624 </para>
52625 <para>
52626 There are two expansion items to help with the implementation of the BATV
52627 <quote>prvs</quote> (private signature) scheme in an Exim configuration. This scheme signs
52628 the original envelope sender address by using a simple key to add a hash of the
52629 address and some time-based randomizing information. The <option>prvs</option> expansion
52630 item creates a signed address, and the <option>prvscheck</option> expansion item checks one.
52631 The syntax of these expansion items is described in section
52632 <xref linkend="SECTexpansionitems"/>.
52633 </para>
52634 <para>
52635 As an example, suppose the secret per-address keys are stored in an MySQL
52636 database. A query to look up the key for an address could be defined as a macro
52637 like this:
52638 </para>
52639 <literallayout class="monospaced">
52640 PRVSCHECK_SQL = ${lookup mysql{SELECT secret FROM batv_prvs \
52641                 WHERE sender='${quote_mysql:$prvscheck_address}'\
52642                 }{$value}}
52643 </literallayout>
52644 <para>
52645 Suppose also that the senders who make use of BATV are defined by an address
52646 list called <option>batv_senders</option>. Then, in the ACL for RCPT commands, you could
52647 use this:
52648 </para>
52649 <literallayout class="monospaced">
52650 # Bounces: drop unsigned addresses for BATV senders
52651 deny message = This address does not send an unsigned reverse path
52652      senders = :
52653      recipients = +batv_senders
52654
52655 # Bounces: In case of prvs-signed address, check signature.
52656 deny message = Invalid reverse path signature.
52657      senders = :
52658      condition  = ${prvscheck {$local_part@$domain}\
52659                   {PRVSCHECK_SQL}{1}}
52660      !condition = $prvscheck_result
52661 </literallayout>
52662 <para>
52663 The first statement rejects recipients for bounce messages that are addressed
52664 to plain BATV sender addresses, because it is known that BATV senders do not
52665 send out messages with plain sender addresses. The second statement rejects
52666 recipients that are prvs-signed, but with invalid signatures (either because
52667 the key is wrong, or the signature has timed out).
52668 </para>
52669 <para>
52670 A non-prvs-signed address is not rejected by the second statement, because the
52671 <option>prvscheck</option> expansion yields an empty string if its first argument is not a
52672 prvs-signed address, thus causing the <option>condition</option> condition to be false. If
52673 the first argument is a syntactically valid prvs-signed address, the yield is
52674 the third string (in this case <quote>1</quote>), whether or not the cryptographic and
52675 timeout checks succeed. The <varname>$prvscheck_result</varname> variable contains the result
52676 of the checks (empty for failure, <quote>1</quote> for success).
52677 </para>
52678 <para>
52679 There is one more issue you must consider when implementing prvs-signing:
52680 you have to ensure that the routers accept prvs-signed addresses and
52681 deliver them correctly. The easiest way to handle this is to use a <command>redirect</command>
52682 router to remove the signature with a configuration along these lines:
52683 </para>
52684 <literallayout class="monospaced">
52685 batv_redirect:
52686   driver = redirect
52687   data = ${prvscheck {$local_part@$domain}{PRVSCHECK_SQL}}
52688 </literallayout>
52689 <para>
52690 This works because, if the third argument of <option>prvscheck</option> is empty, the result
52691 of the expansion of a prvs-signed address is the decoded value of the original
52692 address. This router should probably be the first of your routers that handles
52693 local addresses.
52694 </para>
52695 <para>
52696 To create BATV-signed addresses in the first place, a transport of this form
52697 can be used:
52698 </para>
52699 <literallayout class="monospaced">
52700 external_smtp_batv:
52701   driver = smtp
52702   return_path = ${prvs {$return_path} \
52703                        {${lookup mysql{SELECT \
52704                        secret FROM batv_prvs WHERE \
52705                        sender='${quote_mysql:$sender_address}'} \
52706                        {$value}fail}}}
52707 </literallayout>
52708 <para>
52709 If no key can be found for the existing return path, no signing takes place.
52710 </para>
52711 </section>
52712 <section id="SECTrelaycontrol">
52713 <title>Using an ACL to control relaying</title>
52714 <para>
52715 <indexterm role="concept">
52716 <primary>access control lists (ACLs)</primary>
52717 <secondary>relay control</secondary>
52718 </indexterm>
52719 <indexterm role="concept">
52720 <primary>relaying</primary>
52721 <secondary>control by ACL</secondary>
52722 </indexterm>
52723 <indexterm role="concept">
52724 <primary>policy control</primary>
52725 <secondary>relay control</secondary>
52726 </indexterm>
52727 An MTA is said to <emphasis>relay</emphasis> a message if it receives it from some host and
52728 delivers it directly to another host as a result of a remote address contained
52729 within it. Redirecting a local address via an alias or forward file and then
52730 passing the message on to another host is not relaying,
52731 <indexterm role="concept">
52732 <primary><quote>percent hack</quote></primary>
52733 </indexterm>
52734 but a redirection as a result of the <quote>percent hack</quote> is.
52735 </para>
52736 <para>
52737 Two kinds of relaying exist, which are termed <quote>incoming</quote> and <quote>outgoing</quote>.
52738 A host which is acting as a gateway or an MX backup is concerned with incoming
52739 relaying from arbitrary hosts to a specific set of domains. On the other hand,
52740 a host which is acting as a smart host for a number of clients is concerned
52741 with outgoing relaying from those clients to the Internet at large. Often the
52742 same host is fulfilling both functions,
52743 but in principle these two kinds of relaying are entirely independent. What is
52744 not wanted is the transmission of mail from arbitrary remote hosts through your
52745 system to arbitrary domains.
52746 </para>
52747 <para>
52748 You can implement relay control by means of suitable statements in the ACL that
52749 runs for each RCPT command. For convenience, it is often easiest to use
52750 Exim&#x2019;s named list facility to define the domains and hosts involved. For
52751 example, suppose you want to do the following:
52752 </para>
52753 <itemizedlist>
52754 <listitem>
52755 <para>
52756 Deliver a number of domains to mailboxes on the local host (or process them
52757 locally in some other way). Let&#x2019;s say these are <emphasis>my.dom1.example</emphasis> and
52758 <emphasis>my.dom2.example</emphasis>.
52759 </para>
52760 </listitem>
52761 <listitem>
52762 <para>
52763 Relay mail for a number of other domains for which you are the secondary MX.
52764 These might be <emphasis>friend1.example</emphasis> and <emphasis>friend2.example</emphasis>.
52765 </para>
52766 </listitem>
52767 <listitem>
52768 <para>
52769 Relay mail from the hosts on your local LAN, to whatever domains are involved.
52770 Suppose your LAN is 192.168.45.0/24.
52771 </para>
52772 </listitem>
52773 </itemizedlist>
52774 <para>
52775 In the main part of the configuration, you put the following definitions:
52776 </para>
52777 <literallayout class="monospaced">
52778 domainlist local_domains = my.dom1.example : my.dom2.example
52779 domainlist relay_domains = friend1.example : friend2.example
52780 hostlist   relay_hosts   = 192.168.45.0/24
52781 </literallayout>
52782 <para>
52783 Now you can use these definitions in the ACL that is run for every RCPT
52784 command:
52785 </para>
52786 <literallayout class="monospaced">
52787 acl_check_rcpt:
52788   accept domains = +local_domains : +relay_domains
52789   accept hosts   = +relay_hosts
52790 </literallayout>
52791 <para>
52792 The first statement accepts any RCPT command that contains an address in
52793 the local or relay domains. For any other domain, control passes to the second
52794 statement, which accepts the command only if it comes from one of the relay
52795 hosts. In practice, you will probably want to make your ACL more sophisticated
52796 than this, for example, by including sender and recipient verification. The
52797 default configuration includes a more comprehensive example, which is described
52798 in chapter <xref linkend="CHAPdefconfil"/>.
52799 </para>
52800 </section>
52801 <section id="SECTcheralcon">
52802 <title>Checking a relay configuration</title>
52803 <para>
52804 <indexterm role="concept">
52805 <primary>relaying</primary>
52806 <secondary>checking control of</secondary>
52807 </indexterm>
52808 You can check the relay characteristics of your configuration in the same way
52809 that you can test any ACL behaviour for an incoming SMTP connection, by using
52810 the <option>-bh</option> option to run a fake SMTP session with which you interact.
52811 </para>
52812 <para>
52813 For specifically testing for unwanted relaying, the host
52814 <emphasis>relay-test.mail-abuse.org</emphasis> provides a useful service. If you telnet to this
52815 host from the host on which Exim is running, using the normal telnet port, you
52816 will see a normal telnet connection message and then quite a long delay. Be
52817 patient. The remote host is making an SMTP connection back to your host, and
52818 trying a number of common probes to test for open relay vulnerability. The
52819 results of the tests will eventually appear on your terminal.
52820 <indexterm role="concept" startref="IIDacl" class="endofrange"/>
52821 </para>
52822 </section>
52823 </chapter>
52824
52825 <chapter id="CHAPexiscan">
52826 <title>Content scanning at ACL time</title>
52827 <para>
52828 <indexterm role="concept" id="IIDcosca" class="startofrange">
52829 <primary>content scanning</primary>
52830 <secondary>at ACL time</secondary>
52831 </indexterm>
52832 The extension of Exim to include content scanning at ACL time, formerly known
52833 as <quote>exiscan</quote>, was originally implemented as a patch by Tom Kistner. The code
52834 was integrated into the main source for Exim release 4.50, and Tom continues to
52835 maintain it. Most of the wording of this chapter is taken from Tom&#x2019;s
52836 specification.
52837 </para>
52838 <para>
52839 It is also possible to scan the content of messages at other times. The
52840 <function>local_scan()</function> function (see chapter <xref linkend="CHAPlocalscan"/>) allows for content
52841 scanning after all the ACLs have run. A transport filter can be used to scan
52842 messages at delivery time (see the <option>transport_filter</option> option, described in
52843 chapter <xref linkend="CHAPtransportgeneric"/>).
52844 </para>
52845 <para>
52846 If you want to include the ACL-time content-scanning features when you compile
52847 Exim, you need to arrange for WITH_CONTENT_SCAN to be defined in your
52848 <filename>Local/Makefile</filename>. When you do that, the Exim binary is built with:
52849 </para>
52850 <itemizedlist>
52851 <listitem>
52852 <para>
52853 Two additional ACLs (<option>acl_smtp_mime</option> and <option>acl_not_smtp_mime</option>) that are run
52854 for all MIME parts for SMTP and non-SMTP messages, respectively.
52855 </para>
52856 </listitem>
52857 <listitem>
52858 <para>
52859 Additional ACL conditions and modifiers: <option>decode</option>, <option>malware</option>,
52860 <option>mime_regex</option>, <option>regex</option>, and <option>spam</option>. These can be used in the ACL that is
52861 run at the end of message reception (the <option>acl_smtp_data</option> ACL).
52862 </para>
52863 </listitem>
52864 <listitem>
52865 <para>
52866 An additional control feature (<quote>no_mbox_unspool</quote>) that saves spooled copies
52867 of messages, or parts of messages, for debugging purposes.
52868 </para>
52869 </listitem>
52870 <listitem>
52871 <para>
52872 Additional expansion variables that are set in the new ACL and by the new
52873 conditions.
52874 </para>
52875 </listitem>
52876 <listitem>
52877 <para>
52878 Two new main configuration options: <option>av_scanner</option> and <option>spamd_address</option>.
52879 </para>
52880 </listitem>
52881 </itemizedlist>
52882 <para>
52883 There is another content-scanning configuration option for <filename>Local/Makefile</filename>,
52884 called WITH_OLD_DEMIME. If this is set, the old, deprecated <option>demime</option> ACL
52885 condition is compiled, in addition to all the other content-scanning features.
52886 </para>
52887 <para>
52888 Content-scanning is continually evolving, and new features are still being
52889 added. While such features are still unstable and liable to incompatible
52890 changes, they are made available in Exim by setting options whose names begin
52891 EXPERIMENTAL_ in <filename>Local/Makefile</filename>. Such features are not documented in
52892 this manual. You can find out about them by reading the file called
52893 <filename>doc/experimental.txt</filename>.
52894 </para>
52895 <para>
52896 All the content-scanning facilities work on a MBOX copy of the message that is
52897 temporarily created in a file called:
52898 </para>
52899 <literallayout>
52900 &lt;<emphasis>spool_directory</emphasis>&gt;<literal>/scan/</literal>&lt;<emphasis>message_id</emphasis>&gt;/&lt;<emphasis>message_id</emphasis>&gt;<literal>.eml</literal>
52901 </literallayout>
52902 <para>
52903 The <filename>.eml</filename> extension is a friendly hint to virus scanners that they can
52904 expect an MBOX-like structure inside that file. The file is created when the
52905 first content scanning facility is called. Subsequent calls to content
52906 scanning conditions open the same file again. The directory is recursively
52907 removed when the <option>acl_smtp_data</option> ACL has finished running, unless
52908 </para>
52909 <literallayout class="monospaced">
52910 control = no_mbox_unspool
52911 </literallayout>
52912 <para>
52913 has been encountered. When the MIME ACL decodes files, they are put into the
52914 same directory by default.
52915 </para>
52916 <section id="SECTscanvirus">
52917 <title>Scanning for viruses</title>
52918 <para>
52919 <indexterm role="concept">
52920 <primary>virus scanning</primary>
52921 </indexterm>
52922 <indexterm role="concept">
52923 <primary>content scanning</primary>
52924 <secondary>for viruses</secondary>
52925 </indexterm>
52926 <indexterm role="concept">
52927 <primary>content scanning</primary>
52928 <secondary>the <option>malware</option> condition</secondary>
52929 </indexterm>
52930 The <option>malware</option> ACL condition lets you connect virus scanner software to Exim.
52931 It supports a <quote>generic</quote> interface to scanners called via the shell, and
52932 specialized interfaces for <quote>daemon</quote> type virus scanners, which are resident
52933 in memory and thus are much faster.
52934 </para>
52935 <para>
52936 <indexterm role="option">
52937 <primary><option>av_scanner</option></primary>
52938 </indexterm>
52939 You can set the <option>av_scanner</option> option in first part of the Exim configuration
52940 file to specify which scanner to use, together with any additional options that
52941 are needed. The basic syntax is as follows:
52942 </para>
52943 <literallayout>
52944 <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>
52945 </literallayout>
52946 <para>
52947 If you do not set <option>av_scanner</option>, it defaults to
52948 </para>
52949 <literallayout class="monospaced">
52950 av_scanner = sophie:/var/run/sophie
52951 </literallayout>
52952 <para>
52953 If the value of <option>av_scanner</option> starts with a dollar character, it is expanded
52954 before use. The following scanner types are supported in this release:
52955 </para>
52956 <variablelist>
52957 <varlistentry>
52958 <term><option>aveserver</option></term>
52959 <listitem>
52960 <para>
52961 <indexterm role="concept">
52962 <primary>virus scanners</primary>
52963 <secondary>Kaspersky</secondary>
52964 </indexterm>
52965 This is the scanner daemon of Kaspersky Version 5. You can get a trial version
52966 at <emphasis role="bold"><ulink url="http://www.kaspersky.com">http://www.kaspersky.com</ulink></emphasis>. This scanner type takes one option,
52967 which is the path to the daemon&#x2019;s UNIX socket. The default is shown in this
52968 example:
52969 </para>
52970 <literallayout class="monospaced">
52971 av_scanner = aveserver:/var/run/aveserver
52972 </literallayout>
52973 </listitem></varlistentry>
52974 <varlistentry>
52975 <term><option>clamd</option></term>
52976 <listitem>
52977 <para>
52978 <indexterm role="concept">
52979 <primary>virus scanners</primary>
52980 <secondary>clamd</secondary>
52981 </indexterm>
52982 This daemon-type scanner is GPL and free. You can get it at
52983 <emphasis role="bold"><ulink url="http://www.clamav.net/">http://www.clamav.net/</ulink></emphasis>. Some older versions of clamd do not seem to
52984 unpack MIME containers, so it used to be recommended to unpack MIME attachments
52985 in the MIME ACL. This no longer believed to be necessary. One option is
52986 required: either the path and name of a UNIX socket file, or a hostname or IP
52987 number, and a port, separated by space, as in the second of these examples:
52988 </para>
52989 <literallayout class="monospaced">
52990 av_scanner = clamd:/opt/clamd/socket
52991 av_scanner = clamd:192.0.2.3 1234
52992 av_scanner = clamd:192.0.2.3 1234:local
52993 </literallayout>
52994 <para>
52995 If the value of av_scanner points to a UNIX socket file or contains the local
52996 keyword, then the ClamAV interface will pass a filename containing the data
52997 to be scanned, which will should normally result in less I/O happening and be
52998 more efficient.  Normally in the TCP case, the data is streamed to ClamAV as
52999 Exim does not assume that there is a common filesystem with the remote host.
53000 There is an option WITH_OLD_CLAMAV_STREAM in <filename>src/EDITME</filename> available, should
53001 you be running a version of ClamAV prior to 0.95.
53002 If the option is unset, the default is <filename>/tmp/clamd</filename>. Thanks to David Saez for
53003 contributing the code for this scanner.
53004 </para>
53005 </listitem></varlistentry>
53006 <varlistentry>
53007 <term><option>cmdline</option></term>
53008 <listitem>
53009 <para>
53010 <indexterm role="concept">
53011 <primary>virus scanners</primary>
53012 <secondary>command line interface</secondary>
53013 </indexterm>
53014 This is the keyword for the generic command line scanner interface. It can be
53015 used to attach virus scanners that are invoked from the shell. This scanner
53016 type takes 3 mandatory options:
53017 </para>
53018 <orderedlist numeration="arabic">
53019 <listitem>
53020 <para>
53021 The full path and name of the scanner binary, with all command line options,
53022 and a placeholder (<literal>%s</literal>) for the directory to scan.
53023 </para>
53024 </listitem>
53025 <listitem>
53026 <para>
53027 A regular expression to match against the STDOUT and STDERR output of the
53028 virus scanner. If the expression matches, a virus was found. You must make
53029 absolutely sure that this expression matches on <quote>virus found</quote>. This is called
53030 the <quote>trigger</quote> expression.
53031 </para>
53032 </listitem>
53033 <listitem>
53034 <para>
53035 Another regular expression, containing exactly one pair of parentheses, to
53036 match the name of the virus found in the scanners output. This is called the
53037 <quote>name</quote> expression.
53038 </para>
53039 </listitem>
53040 </orderedlist>
53041 <para>
53042 For example, Sophos Sweep reports a virus on a line like this:
53043 </para>
53044 <literallayout class="monospaced">
53045 Virus 'W32/Magistr-B' found in file ./those.bat
53046 </literallayout>
53047 <para>
53048 For the trigger expression, we can match the phrase <quote>found in file</quote>. For the
53049 name expression, we want to extract the W32/Magistr-B string, so we can match
53050 for the single quotes left and right of it. Altogether, this makes the
53051 configuration setting:
53052 </para>
53053 <literallayout class="monospaced">
53054 av_scanner = cmdline:\
53055              /path/to/sweep -ss -all -rec -archive %s:\
53056              found in file:'(.+)'
53057 </literallayout>
53058 </listitem></varlistentry>
53059 <varlistentry>
53060 <term><option>drweb</option></term>
53061 <listitem>
53062 <para>
53063 <indexterm role="concept">
53064 <primary>virus scanners</primary>
53065 <secondary>DrWeb</secondary>
53066 </indexterm>
53067 The DrWeb daemon scanner (<emphasis role="bold"><ulink url="http://www.sald.com/">http://www.sald.com/</ulink></emphasis>) interface takes one
53068 argument, either a full path to a UNIX socket, or an IP address and port
53069 separated by white space, as in these examples:
53070 </para>
53071 <literallayout class="monospaced">
53072 av_scanner = drweb:/var/run/drwebd.sock
53073 av_scanner = drweb:192.168.2.20 31337
53074 </literallayout>
53075 <para>
53076 If you omit the argument, the default path <filename>/usr/local/drweb/run/drwebd.sock</filename>
53077 is used. Thanks to Alex Miller for contributing the code for this scanner.
53078 </para>
53079 </listitem></varlistentry>
53080 <varlistentry>
53081 <term><option>fsecure</option></term>
53082 <listitem>
53083 <para>
53084 <indexterm role="concept">
53085 <primary>virus scanners</primary>
53086 <secondary>F-Secure</secondary>
53087 </indexterm>
53088 The F-Secure daemon scanner (<emphasis role="bold"><ulink url="http://www.f-secure.com">http://www.f-secure.com</ulink></emphasis>) takes one
53089 argument which is the path to a UNIX socket. For example:
53090 </para>
53091 <literallayout class="monospaced">
53092 av_scanner = fsecure:/path/to/.fsav
53093 </literallayout>
53094 <para>
53095 If no argument is given, the default is <filename>/var/run/.fsav</filename>. Thanks to Johan
53096 Thelmen for contributing the code for this scanner.
53097 </para>
53098 </listitem></varlistentry>
53099 <varlistentry>
53100 <term><option>kavdaemon</option></term>
53101 <listitem>
53102 <para>
53103 <indexterm role="concept">
53104 <primary>virus scanners</primary>
53105 <secondary>Kaspersky</secondary>
53106 </indexterm>
53107 This is the scanner daemon of Kaspersky Version 4. This version of the
53108 Kaspersky scanner is outdated. Please upgrade (see <option>aveserver</option> above). This
53109 scanner type takes one option, which is the path to the daemon&#x2019;s UNIX socket.
53110 For example:
53111 </para>
53112 <literallayout class="monospaced">
53113 av_scanner = kavdaemon:/opt/AVP/AvpCtl
53114 </literallayout>
53115 <para>
53116 The default path is <filename>/var/run/AvpCtl</filename>.
53117 </para>
53118 </listitem></varlistentry>
53119 <varlistentry>
53120 <term><option>mksd</option></term>
53121 <listitem>
53122 <para>
53123 <indexterm role="concept">
53124 <primary>virus scanners</primary>
53125 <secondary>mksd</secondary>
53126 </indexterm>
53127 This is a daemon type scanner that is aimed mainly at Polish users, though some
53128 parts of documentation are now available in English. You can get it at
53129 <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
53130 the maximum number of processes used simultaneously to scan the attachments,
53131 provided that the demime facility is employed and also provided that mksd has
53132 been run with at least the same number of child processes. For example:
53133 </para>
53134 <literallayout class="monospaced">
53135 av_scanner = mksd:2
53136 </literallayout>
53137 <para>
53138 You can safely omit this option (the default value is 1).
53139 </para>
53140 </listitem></varlistentry>
53141 <varlistentry>
53142 <term><option>sophie</option></term>
53143 <listitem>
53144 <para>
53145 <indexterm role="concept">
53146 <primary>virus scanners</primary>
53147 <secondary>Sophos and Sophie</secondary>
53148 </indexterm>
53149 Sophie is a daemon that uses Sophos&#x2019; <option>libsavi</option> library to scan for viruses.
53150 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
53151 for this scanner type is the path to the UNIX socket that Sophie uses for
53152 client communication. For example:
53153 </para>
53154 <literallayout class="monospaced">
53155 av_scanner = sophie:/tmp/sophie
53156 </literallayout>
53157 <para>
53158 The default path is <filename>/var/run/sophie</filename>, so if you are using this, you can omit
53159 the option.
53160 </para>
53161 </listitem></varlistentry>
53162 </variablelist>
53163 <para>
53164 When <option>av_scanner</option> is correctly set, you can use the <option>malware</option> condition in
53165 the DATA ACL. <emphasis role="bold">Note</emphasis>: You cannot use the <option>malware</option> condition in the MIME
53166 ACL.
53167 </para>
53168 <para>
53169 The <option>av_scanner</option> option is expanded each time <option>malware</option> is called. This
53170 makes it possible to use different scanners. See further below for an example.
53171 The <option>malware</option> condition caches its results, so when you use it multiple times
53172 for the same message, the actual scanning process is only carried out once.
53173 However, using expandable items in <option>av_scanner</option> disables this caching, in
53174 which case each use of the <option>malware</option> condition causes a new scan of the
53175 message.
53176 </para>
53177 <para>
53178 The <option>malware</option> condition takes a right-hand argument that is expanded before
53179 use. It can then be one of
53180 </para>
53181 <itemizedlist>
53182 <listitem>
53183 <para>
53184 <quote>true</quote>, <quote>*</quote>, or <quote>1</quote>, in which case the message is scanned for viruses.
53185 The condition succeeds if a virus was found, and fail otherwise. This is the
53186 recommended usage.
53187 </para>
53188 </listitem>
53189 <listitem>
53190 <para>
53191 <quote>false</quote> or <quote>0</quote> or an empty string, in which case no scanning is done and
53192 the condition fails immediately.
53193 </para>
53194 </listitem>
53195 <listitem>
53196 <para>
53197 A regular expression, in which case the message is scanned for viruses. The
53198 condition succeeds if a virus is found and its name matches the regular
53199 expression. This allows you to take special actions on certain types of virus.
53200 </para>
53201 </listitem>
53202 </itemizedlist>
53203 <para>
53204 You can append <literal>/defer_ok</literal> to the <option>malware</option> condition to accept messages
53205 even if there is a problem with the virus scanner. Otherwise, such a problem
53206 causes the ACL to defer.
53207 </para>
53208 <para>
53209 <indexterm role="variable">
53210 <primary><varname>$malware_name</varname></primary>
53211 </indexterm>
53212 When a virus is found, the condition sets up an expansion variable called
53213 <varname>$malware_name</varname> that contains the name of the virus. You can use it in a
53214 <option>message</option> modifier that specifies the error returned to the sender, and/or in
53215 logging data.
53216 </para>
53217 <para>
53218 If your virus scanner cannot unpack MIME and TNEF containers itself, you should
53219 use the <option>demime</option> condition (see section <xref linkend="SECTdemimecond"/>) before the
53220 <option>malware</option> condition.
53221 </para>
53222 <para>
53223 Beware the interaction of Exim&#x2019;s <option>message_size_limit</option> with any size limits
53224 imposed by your anti-virus scanner.
53225 </para>
53226 <para>
53227 Here is a very simple scanning example:
53228 </para>
53229 <literallayout class="monospaced">
53230 deny message = This message contains malware ($malware_name)
53231      demime = *
53232      malware = *
53233 </literallayout>
53234 <para>
53235 The next example accepts messages when there is a problem with the scanner:
53236 </para>
53237 <literallayout class="monospaced">
53238 deny message = This message contains malware ($malware_name)
53239      demime = *
53240      malware = */defer_ok
53241 </literallayout>
53242 <para>
53243 The next example shows how to use an ACL variable to scan with both sophie and
53244 aveserver. It assumes you have set:
53245 </para>
53246 <literallayout class="monospaced">
53247 av_scanner = $acl_m0
53248 </literallayout>
53249 <para>
53250 in the main Exim configuration.
53251 </para>
53252 <literallayout class="monospaced">
53253 deny message = This message contains malware ($malware_name)
53254      set acl_m0 = sophie
53255      malware = *
53256
53257 deny message = This message contains malware ($malware_name)
53258      set acl_m0 = aveserver
53259      malware = *
53260 </literallayout>
53261 </section>
53262 <section id="SECTscanspamass">
53263 <title>Scanning with SpamAssassin</title>
53264 <para>
53265 <indexterm role="concept">
53266 <primary>content scanning</primary>
53267 <secondary>for spam</secondary>
53268 </indexterm>
53269 <indexterm role="concept">
53270 <primary>spam scanning</primary>
53271 </indexterm>
53272 <indexterm role="concept">
53273 <primary>SpamAssassin</primary>
53274 </indexterm>
53275 The <option>spam</option> ACL condition calls SpamAssassin&#x2019;s <option>spamd</option> daemon to get a spam
53276 score and a report for the message. You can get SpamAssassin at
53277 <emphasis role="bold"><ulink url="http://www.spamassassin.org">http://www.spamassassin.org</ulink></emphasis>, or, if you have a working Perl
53278 installation, you can use CPAN by running:
53279 </para>
53280 <literallayout class="monospaced">
53281 perl -MCPAN -e 'install Mail::SpamAssassin'
53282 </literallayout>
53283 <para>
53284 SpamAssassin has its own set of configuration files. Please review its
53285 documentation to see how you can tweak it. The default installation should work
53286 nicely, however.
53287 </para>
53288 <para>
53289 <indexterm role="option">
53290 <primary><option>spamd_address</option></primary>
53291 </indexterm>
53292 After having installed and configured SpamAssassin, start the <option>spamd</option> daemon.
53293 By default, it listens on 127.0.0.1, TCP port 783. If you use another host or
53294 port for <option>spamd</option>, you must set the <option>spamd_address</option> option in the global
53295 part of the Exim configuration as follows (example):
53296 </para>
53297 <literallayout class="monospaced">
53298 spamd_address = 192.168.99.45 387
53299 </literallayout>
53300 <para>
53301 You do not need to set this option if you use the default. As of version 2.60,
53302 <option>spamd</option> also supports communication over UNIX sockets. If you want to use
53303 these, supply <option>spamd_address</option> with an absolute file name instead of a
53304 address/port pair:
53305 </para>
53306 <literallayout class="monospaced">
53307 spamd_address = /var/run/spamd_socket
53308 </literallayout>
53309 <para>
53310 You can have multiple <option>spamd</option> servers to improve scalability. These can
53311 reside on other hardware reachable over the network. To specify multiple
53312 <option>spamd</option> servers, put multiple address/port pairs in the <option>spamd_address</option>
53313 option, separated with colons:
53314 </para>
53315 <literallayout class="monospaced">
53316 spamd_address = 192.168.2.10 783 : \
53317                 192.168.2.11 783 : \
53318                 192.168.2.12 783
53319 </literallayout>
53320 <para>
53321 Up to 32 <option>spamd</option> servers are supported. The servers are queried in a random
53322 fashion. When a server fails to respond to the connection attempt, all other
53323 servers are tried until one succeeds. If no server responds, the <option>spam</option>
53324 condition defers.
53325 </para>
53326 <para>
53327 <emphasis role="bold">Warning</emphasis>: It is not possible to use the UNIX socket connection method with
53328 multiple <option>spamd</option> servers.
53329 </para>
53330 <para>
53331 The <option>spamd_address</option> variable is expanded before use if it starts with
53332 a dollar sign. In this case, the expansion may return a string that is
53333 used as the list so that multiple spamd servers can be the result of an
53334 expansion.
53335 </para>
53336 </section>
53337 <section id="SECID206">
53338 <title>Calling SpamAssassin from an Exim ACL</title>
53339 <para>
53340 Here is a simple example of the use of the <option>spam</option> condition in a DATA ACL:
53341 </para>
53342 <literallayout class="monospaced">
53343 deny message = This message was classified as SPAM
53344      spam = joe
53345 </literallayout>
53346 <para>
53347 The right-hand side of the <option>spam</option> condition specifies a name. This is
53348 relevant if you have set up multiple SpamAssassin profiles. If you do not want
53349 to scan using a specific profile, but rather use the SpamAssassin system-wide
53350 default profile, you can scan for an unknown name, or simply use <quote>nobody</quote>.
53351 However, you must put something on the right-hand side.
53352 </para>
53353 <para>
53354 The name allows you to use per-domain or per-user antispam profiles in
53355 principle, but this is not straightforward in practice, because a message may
53356 have multiple recipients, not necessarily all in the same domain. Because the
53357 <option>spam</option> condition has to be called from a DATA ACL in order to be able to
53358 read the contents of the message, the variables <varname>$local_part</varname> and <varname>$domain</varname>
53359 are not set.
53360 </para>
53361 <para>
53362 The right-hand side of the <option>spam</option> condition is expanded before being used, so
53363 you can put lookups or conditions there. When the right-hand side evaluates to
53364 <quote>0</quote> or <quote>false</quote>, no scanning is done and the condition fails immediately.
53365 </para>
53366 <para>
53367 Scanning with SpamAssassin uses a lot of resources. If you scan every message,
53368 large ones may cause significant performance degradation. As most spam messages
53369 are quite small, it is recommended that you do not scan the big ones. For
53370 example:
53371 </para>
53372 <literallayout class="monospaced">
53373 deny message = This message was classified as SPAM
53374      condition = ${if &lt; {$message_size}{10K}}
53375      spam = nobody
53376 </literallayout>
53377 <para>
53378 The <option>spam</option> condition returns true if the threshold specified in the user&#x2019;s
53379 SpamAssassin profile has been matched or exceeded. If you want to use the
53380 <option>spam</option> condition for its side effects (see the variables below), you can make
53381 it always return <quote>true</quote> by appending <literal>:true</literal> to the username.
53382 </para>
53383 <para>
53384 <indexterm role="concept">
53385 <primary>spam scanning</primary>
53386 <secondary>returned variables</secondary>
53387 </indexterm>
53388 When the <option>spam</option> condition is run, it sets up a number of expansion
53389 variables. These variables are saved with the received message, thus they are
53390 available for use at delivery time.
53391 </para>
53392 <variablelist>
53393 <varlistentry>
53394 <term><varname>$spam_score</varname></term>
53395 <listitem>
53396 <para>
53397 The spam score of the message, for example <quote>3.4</quote> or <quote>30.5</quote>. This is useful
53398 for inclusion in log or reject messages.
53399 </para>
53400 </listitem></varlistentry>
53401 <varlistentry>
53402 <term><varname>$spam_score_int</varname></term>
53403 <listitem>
53404 <para>
53405 The spam score of the message, multiplied by ten, as an integer value. For
53406 example <quote>34</quote> or <quote>305</quote>. It may appear to disagree with <varname>$spam_score</varname>
53407 because <varname>$spam_score</varname> is rounded and <varname>$spam_score_int</varname> is truncated.
53408 The integer value is useful for numeric comparisons in conditions.
53409 </para>
53410 </listitem></varlistentry>
53411 <varlistentry>
53412 <term><varname>$spam_bar</varname></term>
53413 <listitem>
53414 <para>
53415 A string consisting of a number of <quote>+</quote> or <quote>-</quote> characters, representing the
53416 integer part of the spam score value. A spam score of 4.4 would have a
53417 <varname>$spam_bar</varname> value of <quote>++++</quote>. This is useful for inclusion in warning
53418 headers, since MUAs can match on such strings.
53419 </para>
53420 </listitem></varlistentry>
53421 <varlistentry>
53422 <term><varname>$spam_report</varname></term>
53423 <listitem>
53424 <para>
53425 A multiline text table, containing the full SpamAssassin report for the
53426 message. Useful for inclusion in headers or reject messages.
53427 </para>
53428 </listitem></varlistentry>
53429 </variablelist>
53430 <para>
53431 The <option>spam</option> condition caches its results unless expansion in
53432 spamd_address was used. If you call it again with the same user name, it
53433 does not scan again, but rather returns the same values as before.
53434 </para>
53435 <para>
53436 The <option>spam</option> condition returns DEFER if there is any error while running
53437 the message through SpamAssassin or if the expansion of spamd_address
53438 failed. If you want to treat DEFER as FAIL (to pass on to the next ACL
53439 statement block), append <literal>/defer_ok</literal> to the right-hand side of the
53440 spam condition, like this:
53441 </para>
53442 <literallayout class="monospaced">
53443 deny message = This message was classified as SPAM
53444      spam    = joe/defer_ok
53445 </literallayout>
53446 <para>
53447 This causes messages to be accepted even if there is a problem with <option>spamd</option>.
53448 </para>
53449 <para>
53450 Here is a longer, commented example of the use of the <option>spam</option>
53451 condition:
53452 </para>
53453 <literallayout class="monospaced">
53454 # put headers in all messages (no matter if spam or not)
53455 warn  spam = nobody:true
53456       add_header = X-Spam-Score: $spam_score ($spam_bar)
53457       add_header = X-Spam-Report: $spam_report
53458
53459 # add second subject line with *SPAM* marker when message
53460 # is over threshold
53461 warn  spam = nobody
53462       add_header = Subject: *SPAM* $h_Subject:
53463
53464 # reject spam at high scores (&gt; 12)
53465 deny  message = This message scored $spam_score spam points.
53466       spam = nobody:true
53467       condition = ${if &gt;{$spam_score_int}{120}{1}{0}}
53468 </literallayout>
53469 </section>
53470 <section id="SECTscanmimepart">
53471 <title>Scanning MIME parts</title>
53472 <para>
53473 <indexterm role="concept">
53474 <primary>content scanning</primary>
53475 <secondary>MIME parts</secondary>
53476 </indexterm>
53477 <indexterm role="concept">
53478 <primary>MIME content scanning</primary>
53479 </indexterm>
53480 <indexterm role="option">
53481 <primary><option>acl_smtp_mime</option></primary>
53482 </indexterm>
53483 <indexterm role="option">
53484 <primary><option>acl_not_smtp_mime</option></primary>
53485 </indexterm>
53486 The <option>acl_smtp_mime</option> global option specifies an ACL that is called once for
53487 each MIME part of an SMTP message, including multipart types, in the sequence
53488 of their position in the message. Similarly, the <option>acl_not_smtp_mime</option> option
53489 specifies an ACL that is used for the MIME parts of non-SMTP messages. These
53490 options may both refer to the same ACL if you want the same processing in both
53491 cases.
53492 </para>
53493 <para>
53494 These ACLs are called (possibly many times) just before the <option>acl_smtp_data</option>
53495 ACL in the case of an SMTP message, or just before the <option>acl_not_smtp</option> ACL in
53496 the case of a non-SMTP message. However, a MIME ACL is called only if the
53497 message contains a <emphasis>Content-Type:</emphasis> header line. When a call to a MIME
53498 ACL does not yield <quote>accept</quote>, ACL processing is aborted and the appropriate
53499 result code is sent to the client. In the case of an SMTP message, the
53500 <option>acl_smtp_data</option> ACL is not called when this happens.
53501 </para>
53502 <para>
53503 You cannot use the <option>malware</option> or <option>spam</option> conditions in a MIME ACL; these can
53504 only be used in the DATA or non-SMTP ACLs. However, you can use the <option>regex</option>
53505 condition to match against the raw MIME part. You can also use the
53506 <option>mime_regex</option> condition to match against the decoded MIME part (see section
53507 <xref linkend="SECTscanregex"/>).
53508 </para>
53509 <para>
53510 At the start of a MIME ACL, a number of variables are set from the header
53511 information for the relevant MIME part. These are described below. The contents
53512 of the MIME part are not by default decoded into a disk file except for MIME
53513 parts whose content-type is <quote>message/rfc822</quote>. If you want to decode a MIME
53514 part into a disk file, you can use the <option>decode</option> condition. The general
53515 syntax is:
53516 </para>
53517 <literallayout>
53518 <literal>decode = [/</literal>&lt;<emphasis>path</emphasis>&gt;<literal>/]</literal>&lt;<emphasis>filename</emphasis>&gt;
53519 </literallayout>
53520 <para>
53521 The right hand side is expanded before use. After expansion,
53522 the value can be:
53523 </para>
53524 <orderedlist numeration="arabic">
53525 <listitem>
53526 <para>
53527 <quote>0</quote> or <quote>false</quote>, in which case no decoding is done.
53528 </para>
53529 </listitem>
53530 <listitem>
53531 <para>
53532 The string <quote>default</quote>. In that case, the file is put in the temporary
53533 <quote>default</quote> directory &lt;<emphasis>spool_directory</emphasis>&gt;<filename>/scan/</filename>&lt;<emphasis>message_id</emphasis>&gt;<filename>/</filename> with
53534 a sequential file name consisting of the message id and a sequence number. The
53535 full path and name is available in <varname>$mime_decoded_filename</varname> after decoding.
53536 </para>
53537 </listitem>
53538 <listitem>
53539 <para>
53540 A full path name starting with a slash. If the full name is an existing
53541 directory, it is used as a replacement for the default directory. The filename
53542 is then sequentially assigned. If the path does not exist, it is used as
53543 the full path and file name.
53544 </para>
53545 </listitem>
53546 <listitem>
53547 <para>
53548 If the string does not start with a slash, it is used as the
53549 filename, and the default path is then used.
53550 </para>
53551 </listitem>
53552 </orderedlist>
53553 <para>
53554 The <option>decode</option> condition normally succeeds. It is only false for syntax
53555 errors or unusual circumstances such as memory shortages. You can easily decode
53556 a file with its original, proposed filename using
53557 </para>
53558 <literallayout class="monospaced">
53559 decode = $mime_filename
53560 </literallayout>
53561 <para>
53562 However, you should keep in mind that <varname>$mime_filename</varname> might contain
53563 anything. If you place files outside of the default path, they are not
53564 automatically unlinked.
53565 </para>
53566 <para>
53567 For RFC822 attachments (these are messages attached to messages, with a
53568 content-type of <quote>message/rfc822</quote>), the ACL is called again in the same manner
53569 as for the primary message, only that the <varname>$mime_is_rfc822</varname> expansion
53570 variable is set (see below). Attached messages are always decoded to disk
53571 before being checked, and the files are unlinked once the check is done.
53572 </para>
53573 <para>
53574 The MIME ACL supports the <option>regex</option> and <option>mime_regex</option> conditions. These can be
53575 used to match regular expressions against raw and decoded MIME parts,
53576 respectively. They are described in section <xref linkend="SECTscanregex"/>.
53577 </para>
53578 <para>
53579 <indexterm role="concept">
53580 <primary>MIME content scanning</primary>
53581 <secondary>returned variables</secondary>
53582 </indexterm>
53583 The following list describes all expansion variables that are
53584 available in the MIME ACL:
53585 </para>
53586 <variablelist>
53587 <varlistentry>
53588 <term><varname>$mime_boundary</varname></term>
53589 <listitem>
53590 <para>
53591 If the current part is a multipart (see <varname>$mime_is_multipart</varname>) below, it should
53592 have a boundary string, which is stored in this variable. If the current part
53593 has no boundary parameter in the <emphasis>Content-Type:</emphasis> header, this variable
53594 contains the empty string.
53595 </para>
53596 </listitem></varlistentry>
53597 <varlistentry>
53598 <term><varname>$mime_charset</varname></term>
53599 <listitem>
53600 <para>
53601 This variable contains the character set identifier, if one was found in the
53602 <emphasis>Content-Type:</emphasis> header. Examples for charset identifiers are:
53603 </para>
53604 <literallayout class="monospaced">
53605 us-ascii
53606 gb2312 (Chinese)
53607 iso-8859-1
53608 </literallayout>
53609 <para>
53610 Please note that this value is not normalized, so you should do matches
53611 case-insensitively.
53612 </para>
53613 </listitem></varlistentry>
53614 <varlistentry>
53615 <term><varname>$mime_content_description</varname></term>
53616 <listitem>
53617 <para>
53618 This variable contains the normalized content of the <emphasis>Content-Description:</emphasis>
53619 header. It can contain a human-readable description of the parts content. Some
53620 implementations repeat the filename for attachments here, but they are usually
53621 only used for display purposes.
53622 </para>
53623 </listitem></varlistentry>
53624 <varlistentry>
53625 <term><varname>$mime_content_disposition</varname></term>
53626 <listitem>
53627 <para>
53628 This variable contains the normalized content of the <emphasis>Content-Disposition:</emphasis>
53629 header. You can expect strings like <quote>attachment</quote> or <quote>inline</quote> here.
53630 </para>
53631 </listitem></varlistentry>
53632 <varlistentry>
53633 <term><varname>$mime_content_id</varname></term>
53634 <listitem>
53635 <para>
53636 This variable contains the normalized content of the <emphasis>Content-ID:</emphasis> header.
53637 This is a unique ID that can be used to reference a part from another part.
53638 </para>
53639 </listitem></varlistentry>
53640 <varlistentry>
53641 <term><varname>$mime_content_size</varname></term>
53642 <listitem>
53643 <para>
53644 This variable is set only after the <option>decode</option> modifier (see above) has been
53645 successfully run. It contains the size of the decoded part in kilobytes. The
53646 size is always rounded up to full kilobytes, so only a completely empty part
53647 has a <varname>$mime_content_size</varname> of zero.
53648 </para>
53649 </listitem></varlistentry>
53650 <varlistentry>
53651 <term><varname>$mime_content_transfer_encoding</varname></term>
53652 <listitem>
53653 <para>
53654 This variable contains the normalized content of the
53655 <emphasis>Content-transfer-encoding:</emphasis> header. This is a symbolic name for an encoding
53656 type. Typical values are <quote>base64</quote> and <quote>quoted-printable</quote>.
53657 </para>
53658 </listitem></varlistentry>
53659 <varlistentry>
53660 <term><varname>$mime_content_type</varname></term>
53661 <listitem>
53662 <para>
53663 If the MIME part has a <emphasis>Content-Type:</emphasis> header, this variable contains its
53664 value, lowercased, and without any options (like <quote>name</quote> or <quote>charset</quote>). Here
53665 are some examples of popular MIME types, as they may appear in this variable:
53666 </para>
53667 <literallayout class="monospaced">
53668 text/plain
53669 text/html
53670 application/octet-stream
53671 image/jpeg
53672 audio/midi
53673 </literallayout>
53674 <para>
53675 If the MIME part has no <emphasis>Content-Type:</emphasis> header, this variable contains the
53676 empty string.
53677 </para>
53678 </listitem></varlistentry>
53679 <varlistentry>
53680 <term><varname>$mime_decoded_filename</varname></term>
53681 <listitem>
53682 <para>
53683 This variable is set only after the <option>decode</option> modifier (see above) has been
53684 successfully run. It contains the full path and file name of the file
53685 containing the decoded data.
53686 </para>
53687 </listitem></varlistentry>
53688 </variablelist>
53689 <para>
53690 <indexterm role="concept">
53691 <primary>RFC 2047</primary>
53692 </indexterm>
53693 </para>
53694 <variablelist>
53695 <varlistentry>
53696 <term><varname>$mime_filename</varname></term>
53697 <listitem>
53698 <para>
53699 This is perhaps the most important of the MIME variables. It contains a
53700 proposed filename for an attachment, if one was found in either the
53701 <emphasis>Content-Type:</emphasis> or <emphasis>Content-Disposition:</emphasis> headers. The filename will be
53702 RFC2047 decoded, but no additional sanity checks are done. If no filename was
53703 found, this variable contains the empty string.
53704 </para>
53705 </listitem></varlistentry>
53706 <varlistentry>
53707 <term><varname>$mime_is_coverletter</varname></term>
53708 <listitem>
53709 <para>
53710 This variable attempts to differentiate the <quote>cover letter</quote> of an e-mail from
53711 attached data. It can be used to clamp down on flashy or unnecessarily encoded
53712 content in the cover letter, while not restricting attachments at all.
53713 </para>
53714 <para>
53715 The variable contains 1 (true) for a MIME part believed to be part of the
53716 cover letter, and 0 (false) for an attachment. At present, the algorithm is as
53717 follows:
53718 </para>
53719 <orderedlist numeration="arabic">
53720 <listitem>
53721 <para>
53722 The outermost MIME part of a message is always a cover letter.
53723 </para>
53724 </listitem>
53725 <listitem>
53726 <para>
53727 If a multipart/alternative or multipart/related MIME part is a cover letter,
53728 so are all MIME subparts within that multipart.
53729 </para>
53730 </listitem>
53731 <listitem>
53732 <para>
53733 If any other multipart is a cover letter, the first subpart is a cover letter,
53734 and the rest are attachments.
53735 </para>
53736 </listitem>
53737 <listitem>
53738 <para>
53739 All parts contained within an attachment multipart are attachments.
53740 </para>
53741 </listitem>
53742 </orderedlist>
53743 <para>
53744 As an example, the following will ban <quote>HTML mail</quote> (including that sent with
53745 alternative plain text), while allowing HTML files to be attached. HTML
53746 coverletter mail attached to non-HMTL coverletter mail will also be allowed:
53747 </para>
53748 <literallayout class="monospaced">
53749 deny message = HTML mail is not accepted here
53750 !condition = $mime_is_rfc822
53751 condition = $mime_is_coverletter
53752 condition = ${if eq{$mime_content_type}{text/html}{1}{0}}
53753 </literallayout>
53754 </listitem></varlistentry>
53755 <varlistentry>
53756 <term><varname>$mime_is_multipart</varname></term>
53757 <listitem>
53758 <para>
53759 This variable has the value 1 (true) when the current part has the main type
53760 <quote>multipart</quote>, for example <quote>multipart/alternative</quote> or <quote>multipart/mixed</quote>.
53761 Since multipart entities only serve as containers for other parts, you may not
53762 want to carry out specific actions on them.
53763 </para>
53764 </listitem></varlistentry>
53765 <varlistentry>
53766 <term><varname>$mime_is_rfc822</varname></term>
53767 <listitem>
53768 <para>
53769 This variable has the value 1 (true) if the current part is not a part of the
53770 checked message itself, but part of an attached message. Attached message
53771 decoding is fully recursive.
53772 </para>
53773 </listitem></varlistentry>
53774 <varlistentry>
53775 <term><varname>$mime_part_count</varname></term>
53776 <listitem>
53777 <para>
53778 This variable is a counter that is raised for each processed MIME part. It
53779 starts at zero for the very first part (which is usually a multipart). The
53780 counter is per-message, so it is reset when processing RFC822 attachments (see
53781 <varname>$mime_is_rfc822</varname>). The counter stays set after <option>acl_smtp_mime</option> is
53782 complete, so you can use it in the DATA ACL to determine the number of MIME
53783 parts of a message. For non-MIME messages, this variable contains the value -1.
53784 </para>
53785 </listitem></varlistentry>
53786 </variablelist>
53787 </section>
53788 <section id="SECTscanregex">
53789 <title>Scanning with regular expressions</title>
53790 <para>
53791 <indexterm role="concept">
53792 <primary>content scanning</primary>
53793 <secondary>with regular expressions</secondary>
53794 </indexterm>
53795 <indexterm role="concept">
53796 <primary>regular expressions</primary>
53797 <secondary>content scanning with</secondary>
53798 </indexterm>
53799 You can specify your own custom regular expression matches on the full body of
53800 the message, or on individual MIME parts.
53801 </para>
53802 <para>
53803 The <option>regex</option> condition takes one or more regular expressions as arguments and
53804 matches them against the full message (when called in the DATA ACL) or a raw
53805 MIME part (when called in the MIME ACL). The <option>regex</option> condition matches
53806 linewise, with a maximum line length of 32K characters. That means you cannot
53807 have multiline matches with the <option>regex</option> condition.
53808 </para>
53809 <para>
53810 The <option>mime_regex</option> condition can be called only in the MIME ACL. It matches up
53811 to 32K of decoded content (the whole content at once, not linewise). If the
53812 part has not been decoded with the <option>decode</option> modifier earlier in the ACL, it
53813 is decoded automatically when <option>mime_regex</option> is executed (using default path
53814 and filename values). If the decoded data is larger than  32K, only the first
53815 32K characters are checked.
53816 </para>
53817 <para>
53818 The regular expressions are passed as a colon-separated list. To include a
53819 literal colon, you must double it. Since the whole right-hand side string is
53820 expanded before being used, you must also escape dollar signs and backslashes
53821 with more backslashes, or use the <literal>\N</literal> facility to disable expansion.
53822 Here is a simple example that contains two regular expressions:
53823 </para>
53824 <literallayout class="monospaced">
53825 deny message = contains blacklisted regex ($regex_match_string)
53826      regex = [Mm]ortgage : URGENT BUSINESS PROPOSAL
53827 </literallayout>
53828 <para>
53829 The conditions returns true if any one of the regular expressions matches. The
53830 <varname>$regex_match_string</varname> expansion variable is then set up and contains the
53831 matching regular expression.
53832 </para>
53833 <para>
53834 <emphasis role="bold">Warning</emphasis>: With large messages, these conditions can be fairly
53835 CPU-intensive.
53836 </para>
53837 </section>
53838 <section id="SECTdemimecond">
53839 <title>The demime condition</title>
53840 <para>
53841 <indexterm role="concept">
53842 <primary>content scanning</primary>
53843 <secondary>MIME checking</secondary>
53844 </indexterm>
53845 <indexterm role="concept">
53846 <primary>MIME content scanning</primary>
53847 </indexterm>
53848 The <option>demime</option> ACL condition provides MIME unpacking, sanity checking and file
53849 extension blocking. It is usable only in the DATA and non-SMTP ACLs. The
53850 <option>demime</option> condition uses a simpler interface to MIME decoding than the MIME
53851 ACL functionality, but provides no additional facilities. Please note that this
53852 condition is deprecated and kept only for backward compatibility. You must set
53853 the WITH_OLD_DEMIME option in <filename>Local/Makefile</filename> at build time to be able to
53854 use the <option>demime</option> condition.
53855 </para>
53856 <para>
53857 The <option>demime</option> condition unpacks MIME containers in the message. It detects
53858 errors in MIME containers and can match file extensions found in the message
53859 against a list. Using this facility produces files containing the unpacked MIME
53860 parts of the message in the temporary scan directory. If you do antivirus
53861 scanning, it is recommended that you use the <option>demime</option> condition before the
53862 antivirus (<option>malware</option>) condition.
53863 </para>
53864 <para>
53865 On the right-hand side of the <option>demime</option> condition you can pass a
53866 colon-separated list of file extensions that it should match against. For
53867 example:
53868 </para>
53869 <literallayout class="monospaced">
53870 deny message = Found blacklisted file attachment
53871      demime  = vbs:com:bat:pif:prf:lnk
53872 </literallayout>
53873 <para>
53874 If one of the file extensions is found, the condition is true, otherwise it is
53875 false. If there is a temporary error while demimeing (for example, <quote>disk
53876 full</quote>), the condition defers, and the message is temporarily rejected (unless
53877 the condition is on a <option>warn</option> verb).
53878 </para>
53879 <para>
53880 The right-hand side is expanded before being treated as a list, so you can have
53881 conditions and lookups there. If it expands to an empty string, <quote>false</quote>, or
53882 zero (<quote>0</quote>), no demimeing is done and the condition is false.
53883 </para>
53884 <para>
53885 The <option>demime</option> condition set the following variables:
53886 </para>
53887 <variablelist>
53888 <varlistentry>
53889 <term><varname>$demime_errorlevel</varname></term>
53890 <listitem>
53891 <para>
53892 <indexterm role="variable">
53893 <primary><varname>$demime_errorlevel</varname></primary>
53894 </indexterm>
53895 When an error is detected in a MIME container, this variable contains the
53896 severity of the error, as an integer number. The higher the value, the more
53897 severe the error (the current maximum value is 3). If this variable is unset or
53898 zero, no error occurred.
53899 </para>
53900 </listitem></varlistentry>
53901 <varlistentry>
53902 <term><varname>$demime_reason</varname></term>
53903 <listitem>
53904 <para>
53905 <indexterm role="variable">
53906 <primary><varname>$demime_reason</varname></primary>
53907 </indexterm>
53908 When <varname>$demime_errorlevel</varname> is greater than zero, this variable contains a
53909 human-readable text string describing the MIME error that occurred.
53910 </para>
53911 </listitem></varlistentry>
53912 </variablelist>
53913 <variablelist>
53914 <varlistentry>
53915 <term><varname>$found_extension</varname></term>
53916 <listitem>
53917 <para>
53918 <indexterm role="variable">
53919 <primary><varname>$found_extension</varname></primary>
53920 </indexterm>
53921 When the <option>demime</option> condition is true, this variable contains the file
53922 extension it found.
53923 </para>
53924 </listitem></varlistentry>
53925 </variablelist>
53926 <para>
53927 Both <varname>$demime_errorlevel</varname> and <varname>$demime_reason</varname> are set by the first call of
53928 the <option>demime</option> condition, and are not changed on subsequent calls.
53929 </para>
53930 <para>
53931 If you do not want to check for file extensions, but rather use the <option>demime</option>
53932 condition for unpacking or error checking purposes, pass <quote>*</quote> as the
53933 right-hand side value. Here is a more elaborate example of how to use this
53934 facility:
53935 </para>
53936 <literallayout class="monospaced">
53937 # Reject messages with serious MIME container errors
53938 deny  message = Found MIME error ($demime_reason).
53939       demime = *
53940       condition = ${if &gt;{$demime_errorlevel}{2}{1}{0}}
53941
53942 # Reject known virus spreading file extensions.
53943 # Accepting these is pretty much braindead.
53944 deny  message = contains $found_extension file (blacklisted).
53945       demime  = com:vbs:bat:pif:scr
53946
53947 # Freeze .exe and .doc files. Postmaster can
53948 # examine them and eventually thaw them.
53949 deny  log_message = Another $found_extension file.
53950       demime = exe:doc
53951       control = freeze
53952 </literallayout>
53953 <para>
53954 <indexterm role="concept" startref="IIDcosca" class="endofrange"/>
53955 </para>
53956 </section>
53957 </chapter>
53958
53959 <chapter id="CHAPlocalscan">
53960 <title>Adding a local scan function to Exim</title>
53961 <titleabbrev>Local scan function</titleabbrev>
53962 <para>
53963 <indexterm role="concept" id="IIDlosca" class="startofrange">
53964 <primary><function>local_scan()</function> function</primary>
53965 <secondary>description of</secondary>
53966 </indexterm>
53967 <indexterm role="concept">
53968 <primary>customizing</primary>
53969 <secondary>input scan using C function</secondary>
53970 </indexterm>
53971 <indexterm role="concept">
53972 <primary>policy control</primary>
53973 <secondary>by local scan function</secondary>
53974 </indexterm>
53975 In these days of email worms, viruses, and ever-increasing spam, some sites
53976 want to apply a lot of checking to messages before accepting them.
53977 </para>
53978 <para>
53979 The content scanning extension (chapter <xref linkend="CHAPexiscan"/>) has facilities for
53980 passing messages to external virus and spam scanning software. You can also do
53981 a certain amount in Exim itself through string expansions and the <option>condition</option>
53982 condition in the ACL that runs after the SMTP DATA command or the ACL for
53983 non-SMTP messages (see chapter <xref linkend="CHAPACL"/>), but this has its limitations.
53984 </para>
53985 <para>
53986 To allow for further customization to a site&#x2019;s own requirements, there is the
53987 possibility of linking Exim with a private message scanning function, written
53988 in C. If you want to run code that is written in something other than C, you
53989 can of course use a little C stub to call it.
53990 </para>
53991 <para>
53992 The local scan function is run once for every incoming message, at the point
53993 when Exim is just about to accept the message.
53994 It can therefore be used to control non-SMTP messages from local processes as
53995 well as messages arriving via SMTP.
53996 </para>
53997 <para>
53998 Exim applies a timeout to calls of the local scan function, and there is an
53999 option called <option>local_scan_timeout</option> for setting it. The default is 5 minutes.
54000 Zero means <quote>no timeout</quote>.
54001 Exim also sets up signal handlers for SIGSEGV, SIGILL, SIGFPE, and SIGBUS
54002 before calling the local scan function, so that the most common types of crash
54003 are caught. If the timeout is exceeded or one of those signals is caught, the
54004 incoming message is rejected with a temporary error if it is an SMTP message.
54005 For a non-SMTP message, the message is dropped and Exim ends with a non-zero
54006 code. The incident is logged on the main and reject logs.
54007 </para>
54008 <section id="SECID207">
54009 <title>Building Exim to use a local scan function</title>
54010 <para>
54011 <indexterm role="concept">
54012 <primary><function>local_scan()</function> function</primary>
54013 <secondary>building Exim to use</secondary>
54014 </indexterm>
54015 To make use of the local scan function feature, you must tell Exim where your
54016 function is before building Exim, by setting LOCAL_SCAN_SOURCE in your
54017 <filename>Local/Makefile</filename>. A recommended place to put it is in the <filename>Local</filename>
54018 directory, so you might set
54019 </para>
54020 <literallayout class="monospaced">
54021 LOCAL_SCAN_SOURCE=Local/local_scan.c
54022 </literallayout>
54023 <para>
54024 for example. The function must be called <function>local_scan()</function>. It is called by
54025 Exim after it has received a message, when the success return code is about to
54026 be sent. This is after all the ACLs have been run. The return code from your
54027 function controls whether the message is actually accepted or not. There is a
54028 commented template function (that just accepts the message) in the file
54029 _src/local_scan.c_.
54030 </para>
54031 <para>
54032 If you want to make use of Exim&#x2019;s run time configuration file to set options
54033 for your <function>local_scan()</function> function, you must also set
54034 </para>
54035 <literallayout class="monospaced">
54036 LOCAL_SCAN_HAS_OPTIONS=yes
54037 </literallayout>
54038 <para>
54039 in <filename>Local/Makefile</filename> (see section <xref linkend="SECTconoptloc"/> below).
54040 </para>
54041 </section>
54042 <section id="SECTapiforloc">
54043 <title>API for local_scan()</title>
54044 <para>
54045 <indexterm role="concept">
54046 <primary><function>local_scan()</function> function</primary>
54047 <secondary>API description</secondary>
54048 </indexterm>
54049 You must include this line near the start of your code:
54050 </para>
54051 <literallayout class="monospaced">
54052 #include "local_scan.h"
54053 </literallayout>
54054 <para>
54055 This header file defines a number of variables and other values, and the
54056 prototype for the function itself. Exim is coded to use unsigned char values
54057 almost exclusively, and one of the things this header defines is a shorthand
54058 for <literal>unsigned char</literal> called <literal>uschar</literal>.
54059 It also contains the following macro definitions, to simplify casting character
54060 strings and pointers to character strings:
54061 </para>
54062 <literallayout class="monospaced">
54063 #define CS   (char *)
54064 #define CCS  (const char *)
54065 #define CSS  (char **)
54066 #define US   (unsigned char *)
54067 #define CUS  (const unsigned char *)
54068 #define USS  (unsigned char **)
54069 </literallayout>
54070 <para>
54071 The function prototype for <function>local_scan()</function> is:
54072 </para>
54073 <literallayout class="monospaced">
54074 extern int local_scan(int fd, uschar **return_text);
54075 </literallayout>
54076 <para>
54077 The arguments are as follows:
54078 </para>
54079 <itemizedlist>
54080 <listitem>
54081 <para>
54082 <option>fd</option> is a file descriptor for the file that contains the body of the message
54083 (the -D file). The file is open for reading and writing, but updating it is not
54084 recommended. <emphasis role="bold">Warning</emphasis>: You must <emphasis>not</emphasis> close this file descriptor.
54085 </para>
54086 <para>
54087 The descriptor is positioned at character 19 of the file, which is the first
54088 character of the body itself, because the first 19 characters are the message
54089 id followed by <literal>-D</literal> and a newline. If you rewind the file, you should use the
54090 macro SPOOL_DATA_START_OFFSET to reset to the start of the data, just in
54091 case this changes in some future version.
54092 </para>
54093 </listitem>
54094 <listitem>
54095 <para>
54096 <option>return_text</option> is an address which you can use to return a pointer to a text
54097 string at the end of the function. The value it points to on entry is NULL.
54098 </para>
54099 </listitem>
54100 </itemizedlist>
54101 <para>
54102 The function must return an <option>int</option> value which is one of the following macros:
54103 </para>
54104 <variablelist>
54105 <varlistentry>
54106 <term><literal>LOCAL_SCAN_ACCEPT</literal></term>
54107 <listitem>
54108 <para>
54109 <indexterm role="variable">
54110 <primary><varname>$local_scan_data</varname></primary>
54111 </indexterm>
54112 The message is accepted. If you pass back a string of text, it is saved with
54113 the message, and made available in the variable <varname>$local_scan_data</varname>. No
54114 newlines are permitted (if there are any, they are turned into spaces) and the
54115 maximum length of text is 1000 characters.
54116 </para>
54117 </listitem></varlistentry>
54118 <varlistentry>
54119 <term><literal>LOCAL_SCAN_ACCEPT_FREEZE</literal></term>
54120 <listitem>
54121 <para>
54122 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
54123 queued without immediate delivery, and is frozen.
54124 </para>
54125 </listitem></varlistentry>
54126 <varlistentry>
54127 <term><literal>LOCAL_SCAN_ACCEPT_QUEUE</literal></term>
54128 <listitem>
54129 <para>
54130 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
54131 queued without immediate delivery.
54132 </para>
54133 </listitem></varlistentry>
54134 <varlistentry>
54135 <term><literal>LOCAL_SCAN_REJECT</literal></term>
54136 <listitem>
54137 <para>
54138 The message is rejected; the returned text is used as an error message which is
54139 passed back to the sender and which is also logged. Newlines are permitted &ndash;
54140 they cause a multiline response for SMTP rejections, but are converted to
54141 <literal>\n</literal> in log lines. If no message is given, <quote>Administrative prohibition</quote> is
54142 used.
54143 </para>
54144 </listitem></varlistentry>
54145 <varlistentry>
54146 <term><literal>LOCAL_SCAN_TEMPREJECT</literal></term>
54147 <listitem>
54148 <para>
54149 The message is temporarily rejected; the returned text is used as an error
54150 message as for LOCAL_SCAN_REJECT. If no message is given, <quote>Temporary local
54151 problem</quote> is used.
54152 </para>
54153 </listitem></varlistentry>
54154 <varlistentry>
54155 <term><literal>LOCAL_SCAN_REJECT_NOLOGHDR</literal></term>
54156 <listitem>
54157 <para>
54158 This behaves as LOCAL_SCAN_REJECT, except that the header of the rejected
54159 message is not written to the reject log. It has the effect of unsetting the
54160 <option>rejected_header</option> log selector for just this rejection. If
54161 <option>rejected_header</option> is already unset (see the discussion of the
54162 <option>log_selection</option> option in section <xref linkend="SECTlogselector"/>), this code is the
54163 same as LOCAL_SCAN_REJECT.
54164 </para>
54165 </listitem></varlistentry>
54166 <varlistentry>
54167 <term><literal>LOCAL_SCAN_TEMPREJECT_NOLOGHDR</literal></term>
54168 <listitem>
54169 <para>
54170 This code is a variation of LOCAL_SCAN_TEMPREJECT in the same way that
54171 LOCAL_SCAN_REJECT_NOLOGHDR is a variation of LOCAL_SCAN_REJECT.
54172 </para>
54173 </listitem></varlistentry>
54174 </variablelist>
54175 <para>
54176 If the message is not being received by interactive SMTP, rejections are
54177 reported by writing to <option>stderr</option> or by sending an email, as configured by the
54178 <option>-oe</option> command line options.
54179 </para>
54180 </section>
54181 <section id="SECTconoptloc">
54182 <title>Configuration options for local_scan()</title>
54183 <para>
54184 <indexterm role="concept">
54185 <primary><function>local_scan()</function> function</primary>
54186 <secondary>configuration options</secondary>
54187 </indexterm>
54188 It is possible to have option settings in the main configuration file
54189 that set values in static variables in the <function>local_scan()</function> module. If you
54190 want to do this, you must have the line
54191 </para>
54192 <literallayout class="monospaced">
54193 LOCAL_SCAN_HAS_OPTIONS=yes
54194 </literallayout>
54195 <para>
54196 in your <filename>Local/Makefile</filename> when you build Exim. (This line is in
54197 <filename>OS/Makefile-Default</filename>, commented out). Then, in the <function>local_scan()</function> source
54198 file, you must define static variables to hold the option values, and a table
54199 to define them.
54200 </para>
54201 <para>
54202 The table must be a vector called <option>local_scan_options</option>, of type
54203 <literal>optionlist</literal>. Each entry is a triplet, consisting of a name, an option type,
54204 and a pointer to the variable that holds the value. The entries must appear in
54205 alphabetical order. Following <option>local_scan_options</option> you must also define a
54206 variable called <option>local_scan_options_count</option> that contains the number of
54207 entries in the table. Here is a short example, showing two kinds of option:
54208 </para>
54209 <literallayout class="monospaced">
54210 static int my_integer_option = 42;
54211 static uschar *my_string_option = US"a default string";
54212
54213 optionlist local_scan_options[] = {
54214   { "my_integer", opt_int,       &amp;my_integer_option },
54215   { "my_string",  opt_stringptr, &amp;my_string_option }
54216 };
54217
54218 int local_scan_options_count =
54219   sizeof(local_scan_options)/sizeof(optionlist);
54220 </literallayout>
54221 <para>
54222 The values of the variables can now be changed from Exim&#x2019;s runtime
54223 configuration file by including a local scan section as in this example:
54224 </para>
54225 <literallayout class="monospaced">
54226 begin local_scan
54227 my_integer = 99
54228 my_string = some string of text...
54229 </literallayout>
54230 <para>
54231 The available types of option data are as follows:
54232 </para>
54233 <variablelist>
54234 <varlistentry>
54235 <term><emphasis role="bold">opt_bool</emphasis></term>
54236 <listitem>
54237 <para>
54238 This specifies a boolean (true/false) option. The address should point to a
54239 variable of type <literal>BOOL</literal>, which will be set to TRUE or FALSE, which are macros
54240 that are defined as <quote>1</quote> and <quote>0</quote>, respectively. If you want to detect
54241 whether such a variable has been set at all, you can initialize it to
54242 TRUE_UNSET. (BOOL variables are integers underneath, so can hold more than two
54243 values.)
54244 </para>
54245 </listitem></varlistentry>
54246 <varlistentry>
54247 <term><emphasis role="bold">opt_fixed</emphasis></term>
54248 <listitem>
54249 <para>
54250 This specifies a fixed point number, such as is used for load averages.
54251 The address should point to a variable of type <literal>int</literal>. The value is stored
54252 multiplied by 1000, so, for example, 1.4142 is truncated and stored as 1414.
54253 </para>
54254 </listitem></varlistentry>
54255 <varlistentry>
54256 <term><emphasis role="bold">opt_int</emphasis></term>
54257 <listitem>
54258 <para>
54259 This specifies an integer; the address should point to a variable of type
54260 <literal>int</literal>. The value may be specified in any of the integer formats accepted by
54261 Exim.
54262 </para>
54263 </listitem></varlistentry>
54264 <varlistentry>
54265 <term><emphasis role="bold">opt_mkint</emphasis></term>
54266 <listitem>
54267 <para>
54268 This is the same as <option>opt_int</option>, except that when such a value is output in a
54269 <option>-bP</option> listing, if it is an exact number of kilobytes or megabytes, it is
54270 printed with the suffix K or M.
54271 </para>
54272 </listitem></varlistentry>
54273 <varlistentry>
54274 <term><emphasis role="bold">opt_octint</emphasis></term>
54275 <listitem>
54276 <para>
54277 This also specifies an integer, but the value is always interpreted as an
54278 octal integer, whether or not it starts with the digit zero, and it is
54279 always output in octal.
54280 </para>
54281 </listitem></varlistentry>
54282 <varlistentry>
54283 <term><emphasis role="bold">opt_stringptr</emphasis></term>
54284 <listitem>
54285 <para>
54286 This specifies a string value; the address must be a pointer to a
54287 variable that points to a string (for example, of type <literal>uschar *</literal>).
54288 </para>
54289 </listitem></varlistentry>
54290 <varlistentry>
54291 <term><emphasis role="bold">opt_time</emphasis></term>
54292 <listitem>
54293 <para>
54294 This specifies a time interval value. The address must point to a variable of
54295 type <literal>int</literal>. The value that is placed there is a number of seconds.
54296 </para>
54297 </listitem></varlistentry>
54298 </variablelist>
54299 <para>
54300 If the <option>-bP</option> command line option is followed by <literal>local_scan</literal>, Exim prints
54301 out the values of all the <function>local_scan()</function> options.
54302 </para>
54303 </section>
54304 <section id="SECID208">
54305 <title>Available Exim variables</title>
54306 <para>
54307 <indexterm role="concept">
54308 <primary><function>local_scan()</function> function</primary>
54309 <secondary>available Exim variables</secondary>
54310 </indexterm>
54311 The header <filename>local_scan.h</filename> gives you access to a number of C variables. These
54312 are the only ones that are guaranteed to be maintained from release to release.
54313 Note, however, that you can obtain the value of any Exim expansion variable,
54314 including <varname>$recipients</varname>, by calling <emphasis>expand_string()</emphasis>. The exported
54315 C variables are as follows:
54316 </para>
54317 <variablelist>
54318 <varlistentry>
54319 <term><emphasis role="bold">int&nbsp;body_linecount</emphasis></term>
54320 <listitem>
54321 <para>
54322 This variable contains the number of lines in the message&#x2019;s body.
54323 </para>
54324 </listitem></varlistentry>
54325 <varlistentry>
54326 <term><emphasis role="bold">int&nbsp;body_zerocount</emphasis></term>
54327 <listitem>
54328 <para>
54329 This variable contains the number of binary zero bytes in the message&#x2019;s body.
54330 </para>
54331 </listitem></varlistentry>
54332 <varlistentry>
54333 <term><emphasis role="bold">unsigned&nbsp;int&nbsp;debug_selector</emphasis></term>
54334 <listitem>
54335 <para>
54336 This variable is set to zero when no debugging is taking place. Otherwise, it
54337 is a bitmap of debugging selectors. Two bits are identified for use in
54338 <function>local_scan()</function>; they are defined as macros:
54339 </para>
54340 <itemizedlist>
54341 <listitem>
54342 <para>
54343 The <literal>D_v</literal> bit is set when <option>-v</option> was present on the command line. This is a
54344 testing option that is not privileged &ndash; any caller may set it. All the
54345 other selector bits can be set only by admin users.
54346 </para>
54347 </listitem>
54348 <listitem>
54349 <para>
54350 The <literal>D_local_scan</literal> bit is provided for use by <function>local_scan()</function>; it is set
54351 by the <literal>+local_scan</literal> debug selector. It is not included in the default set
54352 of debugging bits.
54353 </para>
54354 </listitem>
54355 </itemizedlist>
54356 <para>
54357 Thus, to write to the debugging output only when <literal>+local_scan</literal> has been
54358 selected, you should use code like this:
54359 </para>
54360 <literallayout class="monospaced">
54361 if ((debug_selector &amp; D_local_scan) != 0)
54362   debug_printf("xxx", ...);
54363 </literallayout>
54364 </listitem></varlistentry>
54365 <varlistentry>
54366 <term><emphasis role="bold">uschar&nbsp;*expand_string_message</emphasis></term>
54367 <listitem>
54368 <para>
54369 After a failing call to <emphasis>expand_string()</emphasis> (returned value NULL), the
54370 variable <option>expand_string_message</option> contains the error message, zero-terminated.
54371 </para>
54372 </listitem></varlistentry>
54373 <varlistentry>
54374 <term><emphasis role="bold">header_line&nbsp;*header_list</emphasis></term>
54375 <listitem>
54376 <para>
54377 A pointer to a chain of header lines. The <option>header_line</option> structure is
54378 discussed below.
54379 </para>
54380 </listitem></varlistentry>
54381 <varlistentry>
54382 <term><emphasis role="bold">header_line&nbsp;*header_last</emphasis></term>
54383 <listitem>
54384 <para>
54385 A pointer to the last of the header lines.
54386 </para>
54387 </listitem></varlistentry>
54388 <varlistentry>
54389 <term><emphasis role="bold">uschar&nbsp;*headers_charset</emphasis></term>
54390 <listitem>
54391 <para>
54392 The value of the <option>headers_charset</option> configuration option.
54393 </para>
54394 </listitem></varlistentry>
54395 <varlistentry>
54396 <term><emphasis role="bold">BOOL&nbsp;host_checking</emphasis></term>
54397 <listitem>
54398 <para>
54399 This variable is TRUE during a host checking session that is initiated by the
54400 <option>-bh</option> command line option.
54401 </para>
54402 </listitem></varlistentry>
54403 <varlistentry>
54404 <term><emphasis role="bold">uschar&nbsp;*interface_address</emphasis></term>
54405 <listitem>
54406 <para>
54407 The IP address of the interface that received the message, as a string. This
54408 is NULL for locally submitted messages.
54409 </para>
54410 </listitem></varlistentry>
54411 <varlistentry>
54412 <term><emphasis role="bold">int&nbsp;interface_port</emphasis></term>
54413 <listitem>
54414 <para>
54415 The port on which this message was received. When testing with the <option>-bh</option>
54416 command line option, the value of this variable is -1 unless a port has been
54417 specified via the <option>-oMi</option> option.
54418 </para>
54419 </listitem></varlistentry>
54420 <varlistentry>
54421 <term><emphasis role="bold">uschar&nbsp;*message_id</emphasis></term>
54422 <listitem>
54423 <para>
54424 This variable contains Exim&#x2019;s message id for the incoming message (the value of
54425 <varname>$message_exim_id</varname>) as a zero-terminated string.
54426 </para>
54427 </listitem></varlistentry>
54428 <varlistentry>
54429 <term><emphasis role="bold">uschar&nbsp;*received_protocol</emphasis></term>
54430 <listitem>
54431 <para>
54432 The name of the protocol by which the message was received.
54433 </para>
54434 </listitem></varlistentry>
54435 <varlistentry>
54436 <term><emphasis role="bold">int&nbsp;recipients_count</emphasis></term>
54437 <listitem>
54438 <para>
54439 The number of accepted recipients.
54440 </para>
54441 </listitem></varlistentry>
54442 <varlistentry>
54443 <term><emphasis role="bold">recipient_item&nbsp;*recipients_list</emphasis></term>
54444 <listitem>
54445 <para>
54446 <indexterm role="concept">
54447 <primary>recipient</primary>
54448 <secondary>adding in local scan</secondary>
54449 </indexterm>
54450 <indexterm role="concept">
54451 <primary>recipient</primary>
54452 <secondary>removing in local scan</secondary>
54453 </indexterm>
54454 The list of accepted recipients, held in a vector of length
54455 <option>recipients_count</option>. The <option>recipient_item</option> structure is discussed below. You
54456 can add additional recipients by calling <emphasis>receive_add_recipient()</emphasis> (see
54457 below). You can delete recipients by removing them from the vector and
54458 adjusting the value in <option>recipients_count</option>. In particular, by setting
54459 <option>recipients_count</option> to zero you remove all recipients. If you then return the
54460 value <literal>LOCAL_SCAN_ACCEPT</literal>, the message is accepted, but immediately
54461 blackholed. To replace the recipients, you can set <option>recipients_count</option> to zero
54462 and then call <emphasis>receive_add_recipient()</emphasis> as often as needed.
54463 </para>
54464 </listitem></varlistentry>
54465 <varlistentry>
54466 <term><emphasis role="bold">uschar&nbsp;*sender_address</emphasis></term>
54467 <listitem>
54468 <para>
54469 The envelope sender address. For bounce messages this is the empty string.
54470 </para>
54471 </listitem></varlistentry>
54472 <varlistentry>
54473 <term><emphasis role="bold">uschar&nbsp;*sender_host_address</emphasis></term>
54474 <listitem>
54475 <para>
54476 The IP address of the sending host, as a string. This is NULL for
54477 locally-submitted messages.
54478 </para>
54479 </listitem></varlistentry>
54480 <varlistentry>
54481 <term><emphasis role="bold">uschar&nbsp;*sender_host_authenticated</emphasis></term>
54482 <listitem>
54483 <para>
54484 The name of the authentication mechanism that was used, or NULL if the message
54485 was not received over an authenticated SMTP connection.
54486 </para>
54487 </listitem></varlistentry>
54488 <varlistentry>
54489 <term><emphasis role="bold">uschar&nbsp;*sender_host_name</emphasis></term>
54490 <listitem>
54491 <para>
54492 The name of the sending host, if known.
54493 </para>
54494 </listitem></varlistentry>
54495 <varlistentry>
54496 <term><emphasis role="bold">int&nbsp;sender_host_port</emphasis></term>
54497 <listitem>
54498 <para>
54499 The port on the sending host.
54500 </para>
54501 </listitem></varlistentry>
54502 <varlistentry>
54503 <term><emphasis role="bold">BOOL&nbsp;smtp_input</emphasis></term>
54504 <listitem>
54505 <para>
54506 This variable is TRUE for all SMTP input, including BSMTP.
54507 </para>
54508 </listitem></varlistentry>
54509 <varlistentry>
54510 <term><emphasis role="bold">BOOL&nbsp;smtp_batched_input</emphasis></term>
54511 <listitem>
54512 <para>
54513 This variable is TRUE for BSMTP input.
54514 </para>
54515 </listitem></varlistentry>
54516 <varlistentry>
54517 <term><emphasis role="bold">int&nbsp;store_pool</emphasis></term>
54518 <listitem>
54519 <para>
54520 The contents of this variable control which pool of memory is used for new
54521 requests. See section <xref linkend="SECTmemhanloc"/> for details.
54522 </para>
54523 </listitem></varlistentry>
54524 </variablelist>
54525 </section>
54526 <section id="SECID209">
54527 <title>Structure of header lines</title>
54528 <para>
54529 The <option>header_line</option> structure contains the members listed below.
54530 You can add additional header lines by calling the <emphasis>header_add()</emphasis> function
54531 (see below). You can cause header lines to be ignored (deleted) by setting
54532 their type to *.
54533 </para>
54534 <variablelist>
54535 <varlistentry>
54536 <term><emphasis role="bold">struct&nbsp;header_line&nbsp;*next</emphasis></term>
54537 <listitem>
54538 <para>
54539 A pointer to the next header line, or NULL for the last line.
54540 </para>
54541 </listitem></varlistentry>
54542 <varlistentry>
54543 <term><emphasis role="bold">int&nbsp;type</emphasis></term>
54544 <listitem>
54545 <para>
54546 A code identifying certain headers that Exim recognizes. The codes are printing
54547 characters, and are documented in chapter <xref linkend="CHAPspool"/> of this manual.
54548 Notice in particular that any header line whose type is * is not transmitted
54549 with the message. This flagging is used for header lines that have been
54550 rewritten, or are to be removed (for example, <emphasis>Envelope-sender:</emphasis> header
54551 lines.) Effectively, * means <quote>deleted</quote>.
54552 </para>
54553 </listitem></varlistentry>
54554 <varlistentry>
54555 <term><emphasis role="bold">int&nbsp;slen</emphasis></term>
54556 <listitem>
54557 <para>
54558 The number of characters in the header line, including the terminating and any
54559 internal newlines.
54560 </para>
54561 </listitem></varlistentry>
54562 <varlistentry>
54563 <term><emphasis role="bold">uschar&nbsp;*text</emphasis></term>
54564 <listitem>
54565 <para>
54566 A pointer to the text of the header. It always ends with a newline, followed by
54567 a zero byte. Internal newlines are preserved.
54568 </para>
54569 </listitem></varlistentry>
54570 </variablelist>
54571 </section>
54572 <section id="SECID210">
54573 <title>Structure of recipient items</title>
54574 <para>
54575 The <option>recipient_item</option> structure contains these members:
54576 </para>
54577 <variablelist>
54578 <varlistentry>
54579 <term><emphasis role="bold">uschar&nbsp;*address</emphasis></term>
54580 <listitem>
54581 <para>
54582 This is a pointer to the recipient address as it was received.
54583 </para>
54584 </listitem></varlistentry>
54585 <varlistentry>
54586 <term><emphasis role="bold">int&nbsp;pno</emphasis></term>
54587 <listitem>
54588 <para>
54589 This is used in later Exim processing when top level addresses are created by
54590 the <option>one_time</option> option. It is not relevant at the time <function>local_scan()</function> is run
54591 and must always contain -1 at this stage.
54592 </para>
54593 </listitem></varlistentry>
54594 <varlistentry>
54595 <term><emphasis role="bold">uschar&nbsp;*errors_to</emphasis></term>
54596 <listitem>
54597 <para>
54598 If this value is not NULL, bounce messages caused by failing to deliver to the
54599 recipient are sent to the address it contains. In other words, it overrides the
54600 envelope sender for this one recipient. (Compare the <option>errors_to</option> generic
54601 router option.) If a <function>local_scan()</function> function sets an <option>errors_to</option> field to
54602 an unqualified address, Exim qualifies it using the domain from
54603 <option>qualify_recipient</option>. When <function>local_scan()</function> is called, the <option>errors_to</option> field
54604 is NULL for all recipients.
54605 </para>
54606 </listitem></varlistentry>
54607 </variablelist>
54608 </section>
54609 <section id="SECID211">
54610 <title>Available Exim functions</title>
54611 <para>
54612 <indexterm role="concept">
54613 <primary><function>local_scan()</function> function</primary>
54614 <secondary>available Exim functions</secondary>
54615 </indexterm>
54616 The header <filename>local_scan.h</filename> gives you access to a number of Exim functions.
54617 These are the only ones that are guaranteed to be maintained from release to
54618 release:
54619 </para>
54620 <variablelist>
54621 <varlistentry>
54622 <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>
54623 <listitem>
54624 <para>
54625 This function creates a child process that runs the command specified by
54626 <option>argv</option>. The environment for the process is specified by <option>envp</option>, which can
54627 be NULL if no environment variables are to be passed. A new umask is supplied
54628 for the process in <option>newumask</option>.
54629 </para>
54630 <para>
54631 Pipes to the standard input and output of the new process are set up
54632 and returned to the caller via the <option>infdptr</option> and <option>outfdptr</option> arguments. The
54633 standard error is cloned to the standard output. If there are any file
54634 descriptors <quote>in the way</quote> in the new process, they are closed. If the final
54635 argument is TRUE, the new process is made into a process group leader.
54636 </para>
54637 <para>
54638 The function returns the pid of the new process, or -1 if things go wrong.
54639 </para>
54640 </listitem></varlistentry>
54641 <varlistentry>
54642 <term><emphasis role="bold">int&nbsp;child_close(pid_t&nbsp;pid,&nbsp;int&nbsp;timeout)</emphasis></term>
54643 <listitem>
54644 <para>
54645 This function waits for a child process to terminate, or for a timeout (in
54646 seconds) to expire. A timeout value of zero means wait as long as it takes. The
54647 return value is as follows:
54648 </para>
54649 <itemizedlist>
54650 <listitem>
54651 <para>
54652 &gt;= 0
54653 </para>
54654 <para>
54655 The process terminated by a normal exit and the value is the process
54656 ending status.
54657 </para>
54658 </listitem>
54659 <listitem>
54660 <para>
54661 &lt; 0 and &gt; &ndash;256
54662 </para>
54663 <para>
54664 The process was terminated by a signal and the value is the negation of the
54665 signal number.
54666 </para>
54667 </listitem>
54668 <listitem>
54669 <para>
54670 &ndash;256
54671 </para>
54672 <para>
54673 The process timed out.
54674 </para>
54675 </listitem>
54676 <listitem>
54677 <para>
54678 &ndash;257
54679 </para>
54680 <para>
54681 The was some other error in wait(); <option>errno</option> is still set.
54682 </para>
54683 </listitem>
54684 </itemizedlist>
54685 </listitem></varlistentry>
54686 <varlistentry>
54687 <term><emphasis role="bold">pid_t&nbsp;child_open_exim(int&nbsp;*fd)</emphasis></term>
54688 <listitem>
54689 <para>
54690 This function provide you with a means of submitting a new message to
54691 Exim. (Of course, you can also call <filename>/usr/sbin/sendmail</filename> yourself if you
54692 want, but this packages it all up for you.) The function creates a pipe,
54693 forks a subprocess that is running
54694 </para>
54695 <literallayout class="monospaced">
54696 exim -t -oem -oi -f &lt;&gt;
54697 </literallayout>
54698 <para>
54699 and returns to you (via the <literal>int *</literal> argument) a file descriptor for the pipe
54700 that is connected to the standard input. The yield of the function is the PID
54701 of the subprocess. You can then write a message to the file descriptor, with
54702 recipients in <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and/or <emphasis>Bcc:</emphasis> header lines.
54703 </para>
54704 <para>
54705 When you have finished, call <emphasis>child_close()</emphasis> to wait for the process to
54706 finish and to collect its ending status. A timeout value of zero is usually
54707 fine in this circumstance. Unless you have made a mistake with the recipient
54708 addresses, you should get a return code of zero.
54709 </para>
54710 </listitem></varlistentry>
54711 <varlistentry>
54712 <term><emphasis role="bold">pid_t&nbsp;child_open_exim2(int&nbsp;*fd,&nbsp;uschar&nbsp;*sender,&nbsp;uschar&nbsp;*sender_authentication)</emphasis></term>
54713 <listitem>
54714 <para>
54715 This function is a more sophisticated version of <emphasis>child_open()</emphasis>. The command
54716 that it runs is:
54717 </para>
54718 <literallayout>
54719 <literal>exim -t -oem -oi -f </literal><emphasis>sender</emphasis><literal> -oMas </literal><emphasis>sender_authentication</emphasis>
54720 </literallayout>
54721 <para>
54722 The third argument may be NULL, in which case the <option>-oMas</option> option is omitted.
54723 </para>
54724 </listitem></varlistentry>
54725 <varlistentry>
54726 <term><emphasis role="bold">void&nbsp;debug_printf(char&nbsp;*,&nbsp;...)</emphasis></term>
54727 <listitem>
54728 <para>
54729 This is Exim&#x2019;s debugging function, with arguments as for <emphasis>(printf()</emphasis>. The
54730 output is written to the standard error stream. If no debugging is selected,
54731 calls to <emphasis>debug_printf()</emphasis> have no effect. Normally, you should make calls
54732 conditional on the <literal>local_scan</literal> debug selector by coding like this:
54733 </para>
54734 <literallayout class="monospaced">
54735 if ((debug_selector &amp; D_local_scan) != 0)
54736   debug_printf("xxx", ...);
54737 </literallayout>
54738 </listitem></varlistentry>
54739 <varlistentry>
54740 <term><emphasis role="bold">uschar&nbsp;*expand_string(uschar&nbsp;*string)</emphasis></term>
54741 <listitem>
54742 <para>
54743 This is an interface to Exim&#x2019;s string expansion code. The return value is the
54744 expanded string, or NULL if there was an expansion failure.
54745 The C variable <option>expand_string_message</option> contains an error message after an
54746 expansion failure. If expansion does not change the string, the return value is
54747 the pointer to the input string. Otherwise, the return value points to a new
54748 block of memory that was obtained by a call to <emphasis>store_get()</emphasis>. See section
54749 <xref linkend="SECTmemhanloc"/> below for a discussion of memory handling.
54750 </para>
54751 </listitem></varlistentry>
54752 <varlistentry>
54753 <term><emphasis role="bold">void&nbsp;header_add(int&nbsp;type,&nbsp;char&nbsp;*format,&nbsp;...)</emphasis></term>
54754 <listitem>
54755 <para>
54756 This function allows you to an add additional header line at the end of the
54757 existing ones. The first argument is the type, and should normally be a space
54758 character. The second argument is a format string and any number of
54759 substitution arguments as for <function>sprintf()</function>. You may include internal newlines
54760 if you want, and you must ensure that the string ends with a newline.
54761 </para>
54762 </listitem></varlistentry>
54763 <varlistentry>
54764 <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>
54765 <listitem>
54766 <para>
54767 This function adds a new header line at a specified point in the header
54768 chain. The header itself is specified as for <emphasis>header_add()</emphasis>.
54769 </para>
54770 <para>
54771 If <option>name</option> is NULL, the new header is added at the end of the chain if
54772 <option>after</option> is true, or at the start if <option>after</option> is false. If <option>name</option> is not
54773 NULL, the header lines are searched for the first non-deleted header that
54774 matches the name. If one is found, the new header is added before it if
54775 <option>after</option> is false. If <option>after</option> is true, the new header is added after the
54776 found header and any adjacent subsequent ones with the same name (even if
54777 marked <quote>deleted</quote>). If no matching non-deleted header is found, the <option>topnot</option>
54778 option controls where the header is added. If it is true, addition is at the
54779 top; otherwise at the bottom. Thus, to add a header after all the <emphasis>Received:</emphasis>
54780 headers, or at the top if there are no <emphasis>Received:</emphasis> headers, you could use
54781 </para>
54782 <literallayout class="monospaced">
54783 header_add_at_position(TRUE, US"Received", TRUE,
54784   ' ', "X-xxx: ...");
54785 </literallayout>
54786 <para>
54787 Normally, there is always at least one non-deleted <emphasis>Received:</emphasis> header, but
54788 there may not be if <option>received_header_text</option> expands to an empty string.
54789 </para>
54790 </listitem></varlistentry>
54791 <varlistentry>
54792 <term><emphasis role="bold">void&nbsp;header_remove(int&nbsp;occurrence,&nbsp;uschar&nbsp;*name)</emphasis></term>
54793 <listitem>
54794 <para>
54795 This function removes header lines. If <option>occurrence</option> is zero or negative, all
54796 occurrences of the header are removed. If occurrence is greater than zero, that
54797 particular instance of the header is removed. If no header(s) can be found that
54798 match the specification, the function does nothing.
54799 </para>
54800 </listitem></varlistentry>
54801 <varlistentry>
54802 <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>
54803 <listitem>
54804 <para>
54805 This function tests whether the given header has the given name. It is not just
54806 a string comparison, because white space is permitted between the name and the
54807 colon. If the <option>notdel</option> argument is true, a false return is forced for all
54808 <quote>deleted</quote> headers; otherwise they are not treated specially. For example:
54809 </para>
54810 <literallayout class="monospaced">
54811 if (header_testname(h, US"X-Spam", 6, TRUE)) ...
54812 </literallayout>
54813 </listitem></varlistentry>
54814 <varlistentry>
54815 <term><emphasis role="bold">uschar&nbsp;*lss_b64encode(uschar&nbsp;*cleartext,&nbsp;int&nbsp;length)</emphasis></term>
54816 <listitem>
54817 <para>
54818 <indexterm role="concept">
54819 <primary>base64 encoding</primary>
54820 <secondary>functions for <function>local_scan()</function> use</secondary>
54821 </indexterm>
54822 This function base64-encodes a string, which is passed by address and length.
54823 The text may contain bytes of any value, including zero. The result is passed
54824 back in dynamic memory that is obtained by calling <emphasis>store_get()</emphasis>. It is
54825 zero-terminated.
54826 </para>
54827 </listitem></varlistentry>
54828 <varlistentry>
54829 <term><emphasis role="bold">int&nbsp;lss_b64decode(uschar&nbsp;*codetext,&nbsp;uschar&nbsp;**cleartext)</emphasis></term>
54830 <listitem>
54831 <para>
54832 This function decodes a base64-encoded string. Its arguments are a
54833 zero-terminated base64-encoded string and the address of a variable that is set
54834 to point to the result, which is in dynamic memory. The length of the decoded
54835 string is the yield of the function. If the input is invalid base64 data, the
54836 yield is -1. A zero byte is added to the end of the output string to make it
54837 easy to interpret as a C string (assuming it contains no zeros of its own). The
54838 added zero byte is not included in the returned count.
54839 </para>
54840 </listitem></varlistentry>
54841 <varlistentry>
54842 <term><emphasis role="bold">int&nbsp;lss_match_domain(uschar&nbsp;*domain,&nbsp;uschar&nbsp;*list)</emphasis></term>
54843 <listitem>
54844 <para>
54845 This function checks for a match in a domain list. Domains are always
54846 matched caselessly. The return value is one of the following:
54847 </para>
54848 <literallayout>
54849 <literal>OK     </literal> match succeeded
54850 <literal>FAIL   </literal> match failed
54851 <literal>DEFER  </literal> match deferred
54852 </literallayout>
54853 <para>
54854 DEFER is usually caused by some kind of lookup defer, such as the
54855 inability to contact a database.
54856 </para>
54857 </listitem></varlistentry>
54858 <varlistentry>
54859 <term><emphasis role="bold">int&nbsp;lss_match_local_part(uschar&nbsp;*localpart,&nbsp;uschar&nbsp;*list,&nbsp;BOOL&nbsp;caseless)</emphasis></term>
54860 <listitem>
54861 <para>
54862 This function checks for a match in a local part list. The third argument
54863 controls case-sensitivity. The return values are as for
54864 <emphasis>lss_match_domain()</emphasis>.
54865 </para>
54866 </listitem></varlistentry>
54867 <varlistentry>
54868 <term><emphasis role="bold">int&nbsp;lss_match_address(uschar&nbsp;*address,&nbsp;uschar&nbsp;*list,&nbsp;BOOL&nbsp;caseless)</emphasis></term>
54869 <listitem>
54870 <para>
54871 This function checks for a match in an address list. The third argument
54872 controls the case-sensitivity of the local part match. The domain is always
54873 matched caselessly. The return values are as for <emphasis>lss_match_domain()</emphasis>.
54874 </para>
54875 </listitem></varlistentry>
54876 <varlistentry>
54877 <term><emphasis role="bold">int&nbsp;lss_match_host(uschar&nbsp;*host_name,&nbsp;uschar&nbsp;*host_address,&nbsp;uschar&nbsp;*list)</emphasis></term>
54878 <listitem>
54879 <para>
54880 This function checks for a match in a host list. The most common usage is
54881 expected to be
54882 </para>
54883 <literallayout class="monospaced">
54884 lss_match_host(sender_host_name, sender_host_address, ...)
54885 </literallayout>
54886 <para>
54887 <indexterm role="variable">
54888 <primary><varname>$sender_host_address</varname></primary>
54889 </indexterm>
54890 An empty address field matches an empty item in the host list. If the host name
54891 is NULL, the name corresponding to <varname>$sender_host_address</varname> is automatically
54892 looked up if a host name is required to match an item in the list. The return
54893 values are as for <emphasis>lss_match_domain()</emphasis>, but in addition, <emphasis>lss_match_host()</emphasis>
54894 returns ERROR in the case when it had to look up a host name, but the lookup
54895 failed.
54896 </para>
54897 </listitem></varlistentry>
54898 <varlistentry>
54899 <term><emphasis role="bold">void&nbsp;log_write(unsigned&nbsp;int&nbsp;selector,&nbsp;int&nbsp;which,&nbsp;char&nbsp;*format,&nbsp;...)</emphasis></term>
54900 <listitem>
54901 <para>
54902 This function writes to Exim&#x2019;s log files. The first argument should be zero (it
54903 is concerned with <option>log_selector</option>). The second argument can be <literal>LOG_MAIN</literal> or
54904 <literal>LOG_REJECT</literal> or <literal>LOG_PANIC</literal> or the inclusive <quote>or</quote> of any combination of
54905 them. It specifies to which log or logs the message is written. The remaining
54906 arguments are a format and relevant insertion arguments. The string should not
54907 contain any newlines, not even at the end.
54908 </para>
54909 </listitem></varlistentry>
54910 <varlistentry>
54911 <term><emphasis role="bold">void&nbsp;receive_add_recipient(uschar&nbsp;*address,&nbsp;int&nbsp;pno)</emphasis></term>
54912 <listitem>
54913 <para>
54914 This function adds an additional recipient to the message. The first argument
54915 is the recipient address. If it is unqualified (has no domain), it is qualified
54916 with the <option>qualify_recipient</option> domain. The second argument must always be -1.
54917 </para>
54918 <para>
54919 This function does not allow you to specify a private <option>errors_to</option> address (as
54920 described with the structure of <option>recipient_item</option> above), because it pre-dates
54921 the addition of that field to the structure. However, it is easy to add such a
54922 value afterwards. For example:
54923 </para>
54924 <literallayout class="monospaced">
54925  receive_add_recipient(US"monitor@mydom.example", -1);
54926  recipients_list[recipients_count-1].errors_to =
54927    US"postmaster@mydom.example";
54928 </literallayout>
54929 </listitem></varlistentry>
54930 <varlistentry>
54931 <term><emphasis role="bold">BOOL&nbsp;receive_remove_recipient(uschar&nbsp;*recipient)</emphasis></term>
54932 <listitem>
54933 <para>
54934 This is a convenience function to remove a named recipient from the list of
54935 recipients. It returns true if a recipient was removed, and false if no
54936 matching recipient could be found. The argument must be a complete email
54937 address.
54938 </para>
54939 </listitem></varlistentry>
54940 </variablelist>
54941 <para>
54942 <indexterm role="concept">
54943 <primary>RFC 2047</primary>
54944 </indexterm>
54945 </para>
54946 <variablelist>
54947 <varlistentry>
54948 <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>
54949 <listitem>
54950 <para>
54951 This function decodes strings that are encoded according to RFC 2047. Typically
54952 these are the contents of header lines. First, each <quote>encoded word</quote> is decoded
54953 from the Q or B encoding into a byte-string. Then, if provided with the name of
54954 a charset encoding, and if the <function>iconv()</function> function is available, an attempt is
54955 made  to translate the result to the named character set. If this fails, the
54956 binary string is returned with an error message.
54957 </para>
54958 <para>
54959 The first argument is the string to be decoded. If <option>lencheck</option> is TRUE, the
54960 maximum MIME word length is enforced. The third argument is the target
54961 encoding, or NULL if no translation is wanted.
54962 </para>
54963 <para>
54964 <indexterm role="concept">
54965 <primary>binary zero</primary>
54966 <secondary>in RFC 2047 decoding</secondary>
54967 </indexterm>
54968 <indexterm role="concept">
54969 <primary>RFC 2047</primary>
54970 <secondary>binary zero in</secondary>
54971 </indexterm>
54972 If a binary zero is encountered in the decoded string, it is replaced by the
54973 contents of the <option>zeroval</option> argument. For use with Exim headers, the value must
54974 not be 0 because header lines are handled as zero-terminated strings.
54975 </para>
54976 <para>
54977 The function returns the result of processing the string, zero-terminated; if
54978 <option>lenptr</option> is not NULL, the length of the result is set in the variable to
54979 which it points. When <option>zeroval</option> is 0, <option>lenptr</option> should not be NULL.
54980 </para>
54981 <para>
54982 If an error is encountered, the function returns NULL and uses the <option>error</option>
54983 argument to return an error message. The variable pointed to by <option>error</option> is
54984 set to NULL if there is no error; it may be set non-NULL even when the function
54985 returns a non-NULL value if decoding was successful, but there was a problem
54986 with translation.
54987 </para>
54988 </listitem></varlistentry>
54989 <varlistentry>
54990 <term><emphasis role="bold">int&nbsp;smtp_fflush(void)</emphasis></term>
54991 <listitem>
54992 <para>
54993 This function is used in conjunction with <emphasis>smtp_printf()</emphasis>, as described
54994 below.
54995 </para>
54996 </listitem></varlistentry>
54997 <varlistentry>
54998 <term><emphasis role="bold">void&nbsp;smtp_printf(char&nbsp;*,&nbsp;...)</emphasis></term>
54999 <listitem>
55000 <para>
55001 The arguments of this function are like <function>printf()</function>; it writes to the SMTP
55002 output stream. You should use this function only when there is an SMTP output
55003 stream, that is, when the incoming message is being received via interactive
55004 SMTP. This is the case when <option>smtp_input</option> is TRUE and <option>smtp_batched_input</option>
55005 is FALSE. If you want to test for an incoming message from another host (as
55006 opposed to a local process that used the <option>-bs</option> command line option), you can
55007 test the value of <option>sender_host_address</option>, which is non-NULL when a remote host
55008 is involved.
55009 </para>
55010 <para>
55011 If an SMTP TLS connection is established, <emphasis>smtp_printf()</emphasis> uses the TLS
55012 output function, so it can be used for all forms of SMTP connection.
55013 </para>
55014 <para>
55015 Strings that are written by <emphasis>smtp_printf()</emphasis> from within <function>local_scan()</function>
55016 must start with an appropriate response code: 550 if you are going to return
55017 LOCAL_SCAN_REJECT, 451 if you are going to return
55018 LOCAL_SCAN_TEMPREJECT, and 250 otherwise. Because you are writing the
55019 initial lines of a multi-line response, the code must be followed by a hyphen
55020 to indicate that the line is not the final response line. You must also ensure
55021 that the lines you write terminate with CRLF. For example:
55022 </para>
55023 <literallayout class="monospaced">
55024 smtp_printf("550-this is some extra info\r\n");
55025 return LOCAL_SCAN_REJECT;
55026 </literallayout>
55027 <para>
55028 Note that you can also create multi-line responses by including newlines in
55029 the data returned via the <option>return_text</option> argument. The added value of using
55030 <emphasis>smtp_printf()</emphasis> is that, for instance, you could introduce delays between
55031 multiple output lines.
55032 </para>
55033 <para>
55034 The <emphasis>smtp_printf()</emphasis> function does not return any error indication, because it
55035 does not automatically flush pending output, and therefore does not test
55036 the state of the stream. (In the main code of Exim, flushing and error
55037 detection is done when Exim is ready for the next SMTP input command.) If
55038 you want to flush the output and check for an error (for example, the
55039 dropping of a TCP/IP connection), you can call <emphasis>smtp_fflush()</emphasis>, which has no
55040 arguments. It flushes the output stream, and returns a non-zero value if there
55041 is an error.
55042 </para>
55043 </listitem></varlistentry>
55044 <varlistentry>
55045 <term><emphasis role="bold">void&nbsp;*store_get(int)</emphasis></term>
55046 <listitem>
55047 <para>
55048 This function accesses Exim&#x2019;s internal store (memory) manager. It gets a new
55049 chunk of memory whose size is given by the argument. Exim bombs out if it ever
55050 runs out of memory. See the next section for a discussion of memory handling.
55051 </para>
55052 </listitem></varlistentry>
55053 <varlistentry>
55054 <term><emphasis role="bold">void&nbsp;*store_get_perm(int)</emphasis></term>
55055 <listitem>
55056 <para>
55057 This function is like <emphasis>store_get()</emphasis>, but it always gets memory from the
55058 permanent pool. See the next section for a discussion of memory handling.
55059 </para>
55060 </listitem></varlistentry>
55061 <varlistentry>
55062 <term><emphasis role="bold">uschar&nbsp;*string_copy(uschar&nbsp;*string)</emphasis></term>
55063 <listitem>
55064 <para>
55065 See below.
55066 </para>
55067 </listitem></varlistentry>
55068 <varlistentry>
55069 <term><emphasis role="bold">uschar&nbsp;*string_copyn(uschar&nbsp;*string,&nbsp;int&nbsp;length)</emphasis></term>
55070 <listitem>
55071 <para>
55072 See below.
55073 </para>
55074 </listitem></varlistentry>
55075 <varlistentry>
55076 <term><emphasis role="bold">uschar&nbsp;*string_sprintf(char&nbsp;*format,&nbsp;...)</emphasis></term>
55077 <listitem>
55078 <para>
55079 These three functions create strings using Exim&#x2019;s dynamic memory facilities.
55080 The first makes a copy of an entire string. The second copies up to a maximum
55081 number of characters, indicated by the second argument. The third uses a format
55082 and insertion arguments to create a new string. In each case, the result is a
55083 pointer to a new string in the current memory pool. See the next section for
55084 more discussion.
55085 </para>
55086 </listitem></varlistentry>
55087 </variablelist>
55088 </section>
55089 <section id="SECTmemhanloc">
55090 <title>More about Exim&#x2019;s memory handling</title>
55091 <para>
55092 <indexterm role="concept">
55093 <primary><function>local_scan()</function> function</primary>
55094 <secondary>memory handling</secondary>
55095 </indexterm>
55096 No function is provided for freeing memory, because that is never needed.
55097 The dynamic memory that Exim uses when receiving a message is automatically
55098 recycled if another message is received by the same process (this applies only
55099 to incoming SMTP connections &ndash; other input methods can supply only one
55100 message at a time). After receiving the last message, a reception process
55101 terminates.
55102 </para>
55103 <para>
55104 Because it is recycled, the normal dynamic memory cannot be used for holding
55105 data that must be preserved over a number of incoming messages on the same SMTP
55106 connection. However, Exim in fact uses two pools of dynamic memory; the second
55107 one is not recycled, and can be used for this purpose.
55108 </para>
55109 <para>
55110 If you want to allocate memory that remains available for subsequent messages
55111 in the same SMTP connection, you should set
55112 </para>
55113 <literallayout class="monospaced">
55114 store_pool = POOL_PERM
55115 </literallayout>
55116 <para>
55117 before calling the function that does the allocation. There is no need to
55118 restore the value if you do not need to; however, if you do want to revert to
55119 the normal pool, you can either restore the previous value of <option>store_pool</option> or
55120 set it explicitly to POOL_MAIN.
55121 </para>
55122 <para>
55123 The pool setting applies to all functions that get dynamic memory, including
55124 <emphasis>expand_string()</emphasis>, <emphasis>store_get()</emphasis>, and the <emphasis>string_xxx()</emphasis> functions.
55125 There is also a convenience function called <emphasis>store_get_perm()</emphasis> that gets a
55126 block of memory from the permanent pool while preserving the value of
55127 <option>store_pool</option>.
55128 <indexterm role="concept" startref="IIDlosca" class="endofrange"/>
55129 </para>
55130 </section>
55131 </chapter>
55132
55133 <chapter id="CHAPsystemfilter">
55134 <title>System-wide message filtering</title>
55135 <para>
55136 <indexterm role="concept" id="IIDsysfil1" class="startofrange">
55137 <primary>filter</primary>
55138 <secondary>system filter</secondary>
55139 </indexterm>
55140 <indexterm role="concept" id="IIDsysfil2" class="startofrange">
55141 <primary>filtering all mail</primary>
55142 </indexterm>
55143 <indexterm role="concept" id="IIDsysfil3" class="startofrange">
55144 <primary>system filter</primary>
55145 </indexterm>
55146 The previous chapters (on ACLs and the local scan function) describe checks
55147 that can be applied to messages before they are accepted by a host. There is
55148 also a mechanism for checking messages once they have been received, but before
55149 they are delivered. This is called the <emphasis>system filter</emphasis>.
55150 </para>
55151 <para>
55152 The system filter operates in a similar manner to users&#x2019; filter files, but it
55153 is run just once per message (however many recipients the message has).
55154 It should not normally be used as a substitute for routing, because <option>deliver</option>
55155 commands in a system router provide new envelope recipient addresses.
55156 The system filter must be an Exim filter. It cannot be a Sieve filter.
55157 </para>
55158 <para>
55159 The system filter is run at the start of a delivery attempt, before any routing
55160 is done. If a message fails to be completely delivered at the first attempt,
55161 the system filter is run again at the start of every retry.
55162 If you want your filter to do something only once per message, you can make use
55163 of the <option>first_delivery</option> condition in an <option>if</option> command in the filter to
55164 prevent it happening on retries.
55165 </para>
55166 <para>
55167 <indexterm role="variable">
55168 <primary><varname>$domain</varname></primary>
55169 </indexterm>
55170 <indexterm role="variable">
55171 <primary><varname>$local_part</varname></primary>
55172 </indexterm>
55173 <emphasis role="bold">Warning</emphasis>: Because the system filter runs just once, variables that are
55174 specific to individual recipient addresses, such as <varname>$local_part</varname> and
55175 <varname>$domain</varname>, are not set, and the <quote>personal</quote> condition is not meaningful. If
55176 you want to run a centrally-specified filter for each recipient address
55177 independently, you can do so by setting up a suitable <command>redirect</command> router, as
55178 described in section <xref linkend="SECTperaddfil"/> below.
55179 </para>
55180 <section id="SECID212">
55181 <title>Specifying a system filter</title>
55182 <para>
55183 <indexterm role="concept">
55184 <primary>uid (user id)</primary>
55185 <secondary>system filter</secondary>
55186 </indexterm>
55187 <indexterm role="concept">
55188 <primary>gid (group id)</primary>
55189 <secondary>system filter</secondary>
55190 </indexterm>
55191 The name of the file that contains the system filter must be specified by
55192 setting <option>system_filter</option>. If you want the filter to run under a uid and gid
55193 other than root, you must also set <option>system_filter_user</option> and
55194 <option>system_filter_group</option> as appropriate. For example:
55195 </para>
55196 <literallayout class="monospaced">
55197 system_filter = /etc/mail/exim.filter
55198 system_filter_user = exim
55199 </literallayout>
55200 <para>
55201 If a system filter generates any deliveries directly to files or pipes (via the
55202 <option>save</option> or <option>pipe</option> commands), transports to handle these deliveries must be
55203 specified by setting <option>system_filter_file_transport</option> and
55204 <option>system_filter_pipe_transport</option>, respectively. Similarly,
55205 <option>system_filter_reply_transport</option> must be set to handle any messages generated
55206 by the <option>reply</option> command.
55207 </para>
55208 </section>
55209 <section id="SECID213">
55210 <title>Testing a system filter</title>
55211 <para>
55212 You can run simple tests of a system filter in the same way as for a user
55213 filter, but you should use <option>-bF</option> rather than <option>-bf</option>, so that features that
55214 are permitted only in system filters are recognized.
55215 </para>
55216 <para>
55217 If you want to test the combined effect of a system filter and a user filter,
55218 you can use both <option>-bF</option> and <option>-bf</option> on the same command line.
55219 </para>
55220 </section>
55221 <section id="SECID214">
55222 <title>Contents of a system filter</title>
55223 <para>
55224 The language used to specify system filters is the same as for users&#x2019; filter
55225 files. It is described in the separate end-user document <emphasis>Exim&#x2019;s interface to
55226 mail filtering</emphasis>. However, there are some additional features that are
55227 available only in system filters; these are described in subsequent sections.
55228 If they are encountered in a user&#x2019;s filter file or when testing with <option>-bf</option>,
55229 they cause errors.
55230 </para>
55231 <para>
55232 <indexterm role="concept">
55233 <primary>frozen messages</primary>
55234 <secondary>manual thaw; testing in filter</secondary>
55235 </indexterm>
55236 There are two special conditions which, though available in users&#x2019; filter
55237 files, are designed for use in system filters. The condition <option>first_delivery</option>
55238 is true only for the first attempt at delivering a message, and
55239 <option>manually_thawed</option> is true only if the message has been frozen, and
55240 subsequently thawed by an admin user. An explicit forced delivery counts as a
55241 manual thaw, but thawing as a result of the <option>auto_thaw</option> setting does not.
55242 </para>
55243 <para>
55244 <emphasis role="bold">Warning</emphasis>: If a system filter uses the <option>first_delivery</option> condition to
55245 specify an <quote>unseen</quote> (non-significant) delivery, and that delivery does not
55246 succeed, it will not be tried again.
55247 If you want Exim to retry an unseen delivery until it succeeds, you should
55248 arrange to set it up every time the filter runs.
55249 </para>
55250 <para>
55251 When a system filter finishes running, the values of the variables <varname>$n0</varname> &ndash;
55252 <varname>$n9</varname> are copied into <varname>$sn0</varname> &ndash; <varname>$sn9</varname> and are thereby made available to
55253 users&#x2019; filter files. Thus a system filter can, for example, set up <quote>scores</quote>
55254 to which users&#x2019; filter files can refer.
55255 </para>
55256 </section>
55257 <section id="SECID215">
55258 <title>Additional variable for system filters</title>
55259 <para>
55260 <indexterm role="variable">
55261 <primary><varname>$recipients</varname></primary>
55262 </indexterm>
55263 The expansion variable <varname>$recipients</varname>, containing a list of all the recipients
55264 of the message (separated by commas and white space), is available in system
55265 filters. It is not available in users&#x2019; filters for privacy reasons.
55266 </para>
55267 </section>
55268 <section id="SECID216">
55269 <title>Defer, freeze, and fail commands for system filters</title>
55270 <para>
55271 <indexterm role="concept">
55272 <primary>freezing messages</primary>
55273 </indexterm>
55274 <indexterm role="concept">
55275 <primary>message</primary>
55276 <secondary>freezing</secondary>
55277 </indexterm>
55278 <indexterm role="concept">
55279 <primary>message</primary>
55280 <secondary>forced failure</secondary>
55281 </indexterm>
55282 <indexterm role="concept">
55283 <primary><option>fail</option></primary>
55284 <secondary>in system filter</secondary>
55285 </indexterm>
55286 <indexterm role="concept">
55287 <primary><option>freeze</option> in system filter</primary>
55288 </indexterm>
55289 <indexterm role="concept">
55290 <primary><option>defer</option> in system filter</primary>
55291 </indexterm>
55292 There are three extra commands (<option>defer</option>, <option>freeze</option> and <option>fail</option>) which are
55293 always available in system filters, but are not normally enabled in users&#x2019;
55294 filters. (See the <option>allow_defer</option>, <option>allow_freeze</option> and <option>allow_fail</option> options
55295 for the <command>redirect</command> router.) These commands can optionally be followed by the
55296 word <option>text</option> and a string containing an error message, for example:
55297 </para>
55298 <literallayout class="monospaced">
55299 fail text "this message looks like spam to me"
55300 </literallayout>
55301 <para>
55302 The keyword <option>text</option> is optional if the next character is a double quote.
55303 </para>
55304 <para>
55305 The <option>defer</option> command defers delivery of the original recipients of the
55306 message. The <option>fail</option> command causes all the original recipients to be failed,
55307 and a bounce message to be created. The <option>freeze</option> command suspends all
55308 delivery attempts for the original recipients. In all cases, any new deliveries
55309 that are specified by the filter are attempted as normal after the filter has
55310 run.
55311 </para>
55312 <para>
55313 The <option>freeze</option> command is ignored if the message has been manually unfrozen and
55314 not manually frozen since. This means that automatic freezing by a system
55315 filter can be used as a way of checking out suspicious messages. If a message
55316 is found to be all right, manually unfreezing it allows it to be delivered.
55317 </para>
55318 <para>
55319 <indexterm role="concept">
55320 <primary>log</primary>
55321 <secondary><option>fail</option> command log line</secondary>
55322 </indexterm>
55323 <indexterm role="concept">
55324 <primary><option>fail</option></primary>
55325 <secondary>log line; reducing</secondary>
55326 </indexterm>
55327 The text given with a fail command is used as part of the bounce message as
55328 well as being written to the log. If the message is quite long, this can fill
55329 up a lot of log space when such failures are common. To reduce the size of the
55330 log message, Exim interprets the text in a special way if it starts with the
55331 two characters <literal>&lt;&lt;</literal> and contains <literal>&gt;&gt;</literal> later. The text between these two
55332 strings is written to the log, and the rest of the text is used in the bounce
55333 message. For example:
55334 </para>
55335 <literallayout class="monospaced">
55336 fail "&lt;&lt;filter test 1&gt;&gt;Your message is rejected \
55337      because it contains attachments that we are \
55338      not prepared to receive."
55339 </literallayout>
55340 <para>
55341 <indexterm role="concept">
55342 <primary>loop</primary>
55343 <secondary>caused by <option>fail</option></secondary>
55344 </indexterm>
55345 Take great care with the <option>fail</option> command when basing the decision to fail on
55346 the contents of the message, because the bounce message will of course include
55347 the contents of the original message and will therefore trigger the <option>fail</option>
55348 command again (causing a mail loop) unless steps are taken to prevent this.
55349 Testing the <option>error_message</option> condition is one way to prevent this. You could
55350 use, for example
55351 </para>
55352 <literallayout class="monospaced">
55353 if $message_body contains "this is spam" and not error_message
55354 then fail text "spam is not wanted here" endif
55355 </literallayout>
55356 <para>
55357 though of course that might let through unwanted bounce messages. The
55358 alternative is clever checking of the body and/or headers to detect bounces
55359 generated by the filter.
55360 </para>
55361 <para>
55362 The interpretation of a system filter file ceases after a
55363 <option>defer</option>,
55364 <option>freeze</option>, or <option>fail</option> command is obeyed. However, any deliveries that were
55365 set up earlier in the filter file are honoured, so you can use a sequence such
55366 as
55367 </para>
55368 <literallayout class="monospaced">
55369 mail ...
55370 freeze
55371 </literallayout>
55372 <para>
55373 to send a specified message when the system filter is freezing (or deferring or
55374 failing) a message. The normal deliveries for the message do not, of course,
55375 take place.
55376 </para>
55377 </section>
55378 <section id="SECTaddremheasys">
55379 <title>Adding and removing headers in a system filter</title>
55380 <para>
55381 <indexterm role="concept">
55382 <primary>header lines</primary>
55383 <secondary>adding; in system filter</secondary>
55384 </indexterm>
55385 <indexterm role="concept">
55386 <primary>header lines</primary>
55387 <secondary>removing; in system filter</secondary>
55388 </indexterm>
55389 <indexterm role="concept">
55390 <primary>filter</primary>
55391 <secondary>header lines; adding/removing</secondary>
55392 </indexterm>
55393 Two filter commands that are available only in system filters are:
55394 </para>
55395 <literallayout class="monospaced">
55396 headers add &lt;string&gt;
55397 headers remove &lt;string&gt;
55398 </literallayout>
55399 <para>
55400 The argument for the <option>headers add</option> is a string that is expanded and then
55401 added to the end of the message&#x2019;s headers. It is the responsibility of the
55402 filter maintainer to make sure it conforms to RFC 2822 syntax. Leading white
55403 space is ignored, and if the string is otherwise empty, or if the expansion is
55404 forced to fail, the command has no effect.
55405 </para>
55406 <para>
55407 You can use <quote>\n</quote> within the string, followed by white space, to specify
55408 continued header lines. More than one header may be added in one command by
55409 including <quote>\n</quote> within the string without any following white space. For
55410 example:
55411 </para>
55412 <literallayout class="monospaced">
55413 headers add "X-header-1: ....\n  \
55414              continuation of X-header-1 ...\n\
55415              X-header-2: ...."
55416 </literallayout>
55417 <para>
55418 Note that the header line continuation white space after the first newline must
55419 be placed before the backslash that continues the input string, because white
55420 space after input continuations is ignored.
55421 </para>
55422 <para>
55423 The argument for <option>headers remove</option> is a colon-separated list of header names.
55424 This command applies only to those headers that are stored with the message;
55425 those that are added at delivery time (such as <emphasis>Envelope-To:</emphasis> and
55426 <emphasis>Return-Path:</emphasis>) cannot be removed by this means. If there is more than one
55427 header with the same name, they are all removed.
55428 </para>
55429 <para>
55430 The <option>headers</option> command in a system filter makes an immediate change to the set
55431 of header lines that was received with the message (with possible additions
55432 from ACL processing). Subsequent commands in the system filter operate on the
55433 modified set, which also forms the basis for subsequent message delivery.
55434 Unless further modified during routing or transporting, this set of headers is
55435 used for all recipients of the message.
55436 </para>
55437 <para>
55438 During routing and transporting, the variables that refer to the contents of
55439 header lines refer only to those lines that are in this set. Thus, header lines
55440 that are added by a system filter are visible to users&#x2019; filter files and to all
55441 routers and transports. This contrasts with the manipulation of header lines by
55442 routers and transports, which is not immediate, but which instead is saved up
55443 until the message is actually being written (see section
55444 <xref linkend="SECTheadersaddrem"/>).
55445 </para>
55446 <para>
55447 If the message is not delivered at the first attempt, header lines that were
55448 added by the system filter are stored with the message, and so are still
55449 present at the next delivery attempt. Header lines that were removed are still
55450 present, but marked <quote>deleted</quote> so that they are not transported with the
55451 message. For this reason, it is usual to make the <option>headers</option> command
55452 conditional on <option>first_delivery</option> so that the set of header lines is not
55453 modified more than once.
55454 </para>
55455 <para>
55456 Because header modification in a system filter acts immediately, you have to
55457 use an indirect approach if you want to modify the contents of a header line.
55458 For example:
55459 </para>
55460 <literallayout class="monospaced">
55461 headers add "Old-Subject: $h_subject:"
55462 headers remove "Subject"
55463 headers add "Subject: new subject (was: $h_old-subject:)"
55464 headers remove "Old-Subject"
55465 </literallayout>
55466 </section>
55467 <section id="SECID217">
55468 <title>Setting an errors address in a system filter</title>
55469 <para>
55470 <indexterm role="concept">
55471 <primary>envelope sender</primary>
55472 </indexterm>
55473 In a system filter, if a <option>deliver</option> command is followed by
55474 </para>
55475 <literallayout class="monospaced">
55476 errors_to &lt;some address&gt;
55477 </literallayout>
55478 <para>
55479 in order to change the envelope sender (and hence the error reporting) for that
55480 delivery, any address may be specified. (In a user filter, only the current
55481 user&#x2019;s address can be set.) For example, if some mail is being monitored, you
55482 might use
55483 </para>
55484 <literallayout class="monospaced">
55485 unseen deliver monitor@spying.example errors_to root@local.example
55486 </literallayout>
55487 <para>
55488 to take a copy which would not be sent back to the normal error reporting
55489 address if its delivery failed.
55490 </para>
55491 </section>
55492 <section id="SECTperaddfil">
55493 <title>Per-address filtering</title>
55494 <para>
55495 <indexterm role="variable">
55496 <primary><varname>$domain</varname></primary>
55497 </indexterm>
55498 <indexterm role="variable">
55499 <primary><varname>$local_part</varname></primary>
55500 </indexterm>
55501 In contrast to the system filter, which is run just once per message for each
55502 delivery attempt, it is also possible to set up a system-wide filtering
55503 operation that runs once for each recipient address. In this case, variables
55504 such as <varname>$local_part</varname> and <varname>$domain</varname> can be used, and indeed, the choice of
55505 filter file could be made dependent on them. This is an example of a router
55506 which implements such a filter:
55507 </para>
55508 <literallayout class="monospaced">
55509 central_filter:
55510   check_local_user
55511   driver = redirect
55512   domains = +local_domains
55513   file = /central/filters/$local_part
55514   no_verify
55515   allow_filter
55516   allow_freeze
55517 </literallayout>
55518 <para>
55519 The filter is run in a separate process under its own uid. Therefore, either
55520 <option>check_local_user</option> must be set (as above), in which case the filter is run as
55521 the local user, or the <option>user</option> option must be used to specify which user to
55522 use. If both are set, <option>user</option> overrides.
55523 </para>
55524 <para>
55525 Care should be taken to ensure that none of the commands in the filter file
55526 specify a significant delivery if the message is to go on to be delivered to
55527 its intended recipient. The router will not then claim to have dealt with the
55528 address, so it will be passed on to subsequent routers to be delivered in the
55529 normal way.
55530 <indexterm role="concept" startref="IIDsysfil1" class="endofrange"/>
55531 <indexterm role="concept" startref="IIDsysfil2" class="endofrange"/>
55532 <indexterm role="concept" startref="IIDsysfil3" class="endofrange"/>
55533 </para>
55534 </section>
55535 </chapter>
55536
55537 <chapter id="CHAPmsgproc">
55538 <title>Message processing</title>
55539 <para>
55540 <indexterm role="concept" id="IIDmesproc" class="startofrange">
55541 <primary>message</primary>
55542 <secondary>general processing</secondary>
55543 </indexterm>
55544 Exim performs various transformations on the sender and recipient addresses of
55545 all messages that it handles, and also on the messages&#x2019; header lines. Some of
55546 these are optional and configurable, while others always take place. All of
55547 this processing, except rewriting as a result of routing, and the addition or
55548 removal of header lines while delivering, happens when a message is received,
55549 before it is placed on Exim&#x2019;s queue.
55550 </para>
55551 <para>
55552 Some of the automatic processing takes place by default only for
55553 <quote>locally-originated</quote> messages. This adjective is used to describe messages
55554 that are not received over TCP/IP, but instead are passed to an Exim process on
55555 its standard input. This includes the interactive <quote>local SMTP</quote> case that is
55556 set up by the <option>-bs</option> command line option.
55557 </para>
55558 <para>
55559 <emphasis role="bold">Note</emphasis>: Messages received over TCP/IP on the loopback interface (127.0.0.1
55560 or ::1) are not considered to be locally-originated. Exim does not treat the
55561 loopback interface specially in any way.
55562 </para>
55563 <para>
55564 If you want the loopback interface to be treated specially, you must ensure
55565 that there are appropriate entries in your ACLs.
55566 </para>
55567 <section id="SECTsubmodnon">
55568 <title>Submission mode for non-local messages</title>
55569 <para>
55570 <indexterm role="concept">
55571 <primary>message</primary>
55572 <secondary>submission</secondary>
55573 </indexterm>
55574 <indexterm role="concept">
55575 <primary>submission mode</primary>
55576 </indexterm>
55577 Processing that happens automatically for locally-originated messages (unless
55578 <option>suppress_local_fixups</option> is set) can also be requested for messages that are
55579 received over TCP/IP. The term <quote>submission mode</quote> is used to describe this
55580 state. Submission mode is set by the modifier
55581 </para>
55582 <literallayout class="monospaced">
55583 control = submission
55584 </literallayout>
55585 <para>
55586 in a MAIL, RCPT, or pre-data ACL for an incoming message (see sections
55587 <xref linkend="SECTACLmodi"/> and <xref linkend="SECTcontrols"/>). This makes Exim treat the message as
55588 a local submission, and is normally used when the source of the message is
55589 known to be an MUA running on a client host (as opposed to an MTA). For
55590 example, to set submission mode for messages originating on the IPv4 loopback
55591 interface, you could include the following in the MAIL ACL:
55592 </para>
55593 <literallayout class="monospaced">
55594 warn  hosts = 127.0.0.1
55595       control = submission
55596 </literallayout>
55597 <para>
55598 <indexterm role="concept">
55599 <primary><option>sender_retain</option> submission option</primary>
55600 </indexterm>
55601 There are some options that can be used when setting submission mode. A slash
55602 is used to separate options. For example:
55603 </para>
55604 <literallayout class="monospaced">
55605 control = submission/sender_retain
55606 </literallayout>
55607 <para>
55608 Specifying <option>sender_retain</option> has the effect of setting <option>local_sender_retain</option>
55609 true and <option>local_from_check</option> false for the current incoming message. The first
55610 of these allows an existing <emphasis>Sender:</emphasis> header in the message to remain, and
55611 the second suppresses the check to ensure that <emphasis>From:</emphasis> matches the
55612 authenticated sender. With this setting, Exim still fixes up messages by adding
55613 <emphasis>Date:</emphasis> and <emphasis>Message-ID:</emphasis> header lines if they are missing, but makes no
55614 attempt to check sender authenticity in header lines.
55615 </para>
55616 <para>
55617 When <option>sender_retain</option> is not set, a submission mode setting may specify a
55618 domain to be used when generating a <emphasis>From:</emphasis> or <emphasis>Sender:</emphasis> header line. For
55619 example:
55620 </para>
55621 <literallayout class="monospaced">
55622 control = submission/domain=some.domain
55623 </literallayout>
55624 <para>
55625 The domain may be empty. How this value is used is described in sections
55626 <xref linkend="SECTthefrohea"/> and <xref linkend="SECTthesenhea"/>. There is also a <option>name</option> option
55627 that allows you to specify the user&#x2019;s full name for inclusion in a created
55628 <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis> header line. For example:
55629 </para>
55630 <literallayout class="monospaced">
55631 accept authenticated = *
55632        control = submission/domain=wonderland.example/\
55633                             name=${lookup {$authenticated_id} \
55634                                    lsearch {/etc/exim/namelist}}
55635 </literallayout>
55636 <para>
55637 Because the name may contain any characters, including slashes, the <option>name</option>
55638 option must be given last. The remainder of the string is used as the name. For
55639 the example above, if <filename>/etc/exim/namelist</filename> contains:
55640 </para>
55641 <literallayout class="monospaced">
55642 bigegg:  Humpty Dumpty
55643 </literallayout>
55644 <para>
55645 then when the sender has authenticated as <emphasis>bigegg</emphasis>, the generated <emphasis>Sender:</emphasis>
55646 line would be:
55647 </para>
55648 <literallayout class="monospaced">
55649 Sender: Humpty Dumpty &lt;bigegg@wonderland.example&gt;
55650 </literallayout>
55651 <para>
55652 <indexterm role="concept">
55653 <primary>return path</primary>
55654 <secondary>in submission mode</secondary>
55655 </indexterm>
55656 By default, submission mode forces the return path to the same address as is
55657 used to create the <emphasis>Sender:</emphasis> header. However, if <option>sender_retain</option> is
55658 specified, the return path is also left unchanged.
55659 </para>
55660 <para>
55661 <emphasis role="bold">Note</emphasis>: The changes caused by submission mode take effect after the predata
55662 ACL. This means that any sender checks performed before the fix-ups use the
55663 untrusted sender address specified by the user, not the trusted sender address
55664 specified by submission mode. Although this might be slightly unexpected, it
55665 does mean that you can configure ACL checks to spot that a user is trying to
55666 spoof another&#x2019;s address.
55667 </para>
55668 </section>
55669 <section id="SECTlineendings">
55670 <title>Line endings</title>
55671 <para>
55672 <indexterm role="concept">
55673 <primary>line endings</primary>
55674 </indexterm>
55675 <indexterm role="concept">
55676 <primary>carriage return</primary>
55677 </indexterm>
55678 <indexterm role="concept">
55679 <primary>linefeed</primary>
55680 </indexterm>
55681 RFC 2821 specifies that CRLF (two characters: carriage-return, followed by
55682 linefeed) is the line ending for messages transmitted over the Internet using
55683 SMTP over TCP/IP. However, within individual operating systems, different
55684 conventions are used. For example, Unix-like systems use just LF, but others
55685 use CRLF or just CR.
55686 </para>
55687 <para>
55688 Exim was designed for Unix-like systems, and internally, it stores messages
55689 using the system&#x2019;s convention of a single LF as a line terminator. When
55690 receiving a message, all line endings are translated to this standard format.
55691 Originally, it was thought that programs that passed messages directly to an
55692 MTA within an operating system would use that system&#x2019;s convention. Experience
55693 has shown that this is not the case; for example, there are Unix applications
55694 that use CRLF in this circumstance. For this reason, and for compatibility with
55695 other MTAs, the way Exim handles line endings for all messages is now as
55696 follows:
55697 </para>
55698 <itemizedlist>
55699 <listitem>
55700 <para>
55701 LF not preceded by CR is treated as a line ending.
55702 </para>
55703 </listitem>
55704 <listitem>
55705 <para>
55706 CR is treated as a line ending; if it is immediately followed by LF, the LF
55707 is ignored.
55708 </para>
55709 </listitem>
55710 <listitem>
55711 <para>
55712 The sequence <quote>CR, dot, CR</quote> does not terminate an incoming SMTP message,
55713 nor a local message in the state where a line containing only a dot is a
55714 terminator.
55715 </para>
55716 </listitem>
55717 <listitem>
55718 <para>
55719 If a bare CR is encountered within a header line, an extra space is added after
55720 the line terminator so as not to end the header line. The reasoning behind this
55721 is that bare CRs in header lines are most likely either to be mistakes, or
55722 people trying to play silly games.
55723 </para>
55724 </listitem>
55725 <listitem>
55726 <para>
55727 If the first header line received in a message ends with CRLF, a subsequent
55728 bare LF in a header line is treated in the same way as a bare CR in a header
55729 line.
55730 </para>
55731 </listitem>
55732 </itemizedlist>
55733 </section>
55734 <section id="SECID218">
55735 <title>Unqualified addresses</title>
55736 <para>
55737 <indexterm role="concept">
55738 <primary>unqualified addresses</primary>
55739 </indexterm>
55740 <indexterm role="concept">
55741 <primary>address</primary>
55742 <secondary>qualification</secondary>
55743 </indexterm>
55744 By default, Exim expects every envelope address it receives from an external
55745 host to be fully qualified. Unqualified addresses cause negative responses to
55746 SMTP commands. However, because SMTP is used as a means of transporting
55747 messages from MUAs running on personal workstations, there is sometimes a
55748 requirement to accept unqualified addresses from specific hosts or IP networks.
55749 </para>
55750 <para>
55751 Exim has two options that separately control which hosts may send unqualified
55752 sender or recipient addresses in SMTP commands, namely
55753 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>. In both
55754 cases, if an unqualified address is accepted, it is qualified by adding the
55755 value of <option>qualify_domain</option> or <option>qualify_recipient</option>, as appropriate.
55756 </para>
55757 <para>
55758 <indexterm role="option">
55759 <primary><option>qualify_domain</option></primary>
55760 </indexterm>
55761 <indexterm role="option">
55762 <primary><option>qualify_recipient</option></primary>
55763 </indexterm>
55764 Unqualified addresses in header lines are automatically qualified for messages
55765 that are locally originated, unless the <option>-bnq</option> option is given on the command
55766 line. For messages received over SMTP, unqualified addresses in header lines
55767 are qualified only if unqualified addresses are permitted in SMTP commands. In
55768 other words, such qualification is also controlled by
55769 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>,
55770 </para>
55771 </section>
55772 <section id="SECID219">
55773 <title>The UUCP From line</title>
55774 <para>
55775 <indexterm role="concept">
55776 <primary><quote>From</quote> line</primary>
55777 </indexterm>
55778 <indexterm role="concept">
55779 <primary>UUCP</primary>
55780 <secondary><quote>From</quote> line</secondary>
55781 </indexterm>
55782 <indexterm role="concept">
55783 <primary>sender</primary>
55784 <secondary>address</secondary>
55785 </indexterm>
55786 <indexterm role="option">
55787 <primary><option>uucp_from_pattern</option></primary>
55788 </indexterm>
55789 <indexterm role="option">
55790 <primary><option>uucp_from_sender</option></primary>
55791 </indexterm>
55792 <indexterm role="concept">
55793 <primary>envelope sender</primary>
55794 </indexterm>
55795 <indexterm role="concept">
55796 <primary>Sendmail compatibility</primary>
55797 <secondary><quote>From</quote> line</secondary>
55798 </indexterm>
55799 Messages that have come from UUCP (and some other applications) often begin
55800 with a line containing the envelope sender and a timestamp, following the word
55801 <quote>From</quote>. Examples of two common formats are:
55802 </para>
55803 <literallayout class="monospaced">
55804 From a.oakley@berlin.mus Fri Jan  5 12:35 GMT 1996
55805 From f.butler@berlin.mus Fri, 7 Jan 97 14:00:00 GMT
55806 </literallayout>
55807 <para>
55808 This line precedes the RFC 2822 header lines. For compatibility with Sendmail,
55809 Exim recognizes such lines at the start of messages that are submitted to it
55810 via the command line (that is, on the standard input). It does not recognize
55811 such lines in incoming SMTP messages, unless the sending host matches
55812 <option>ignore_fromline_hosts</option> or the <option>-bs</option> option was used for a local message
55813 and <option>ignore_fromline_local</option> is set. The recognition is controlled by a
55814 regular expression that is defined by the <option>uucp_from_pattern</option> option, whose
55815 default value matches the two common cases shown above and puts the address
55816 that follows <quote>From</quote> into <varname>$1</varname>.
55817 </para>
55818 <para>
55819 <indexterm role="concept">
55820 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
55821 <secondary>in <quote>From </quote> line handling</secondary>
55822 </indexterm>
55823 When the caller of Exim for a non-SMTP message that contains a <quote>From</quote> line is
55824 a trusted user, the message&#x2019;s sender address is constructed by expanding the
55825 contents of <option>uucp_sender_address</option>, whose default value is <quote>$1</quote>. This is
55826 then parsed as an RFC 2822 address. If there is no domain, the local part is
55827 qualified with <option>qualify_domain</option> unless it is the empty string. However, if
55828 the command line <option>-f</option> option is used, it overrides the <quote>From</quote> line.
55829 </para>
55830 <para>
55831 If the caller of Exim is not trusted, the <quote>From</quote> line is recognized, but the
55832 sender address is not changed. This is also the case for incoming SMTP messages
55833 that are permitted to contain <quote>From</quote> lines.
55834 </para>
55835 <para>
55836 Only one <quote>From</quote> line is recognized. If there is more than one, the second is
55837 treated as a data line that starts the body of the message, as it is not valid
55838 as a header line. This also happens if a <quote>From</quote> line is present in an
55839 incoming SMTP message from a source that is not permitted to send them.
55840 </para>
55841 </section>
55842 <section id="SECID220">
55843 <title>Resent- header lines</title>
55844 <para>
55845 <indexterm role="concept">
55846 <primary><option>Resent-</option> header lines</primary>
55847 </indexterm>
55848 RFC 2822 makes provision for sets of header lines starting with the string
55849 <literal>Resent-</literal> to be added to a message when it is resent by the original
55850 recipient to somebody else. These headers are <emphasis>Resent-Date:</emphasis>,
55851 <emphasis>Resent-From:</emphasis>, <emphasis>Resent-Sender:</emphasis>, <emphasis>Resent-To:</emphasis>, <emphasis>Resent-Cc:</emphasis>,
55852 <emphasis>Resent-Bcc:</emphasis> and <emphasis>Resent-Message-ID:</emphasis>. The RFC says:
55853 </para>
55854 <blockquote>
55855 <para>
55856 <emphasis>Resent fields are strictly informational. They MUST NOT be used in the normal
55857 processing of replies or other such automatic actions on messages.</emphasis>
55858 </para>
55859 </blockquote>
55860 <para>
55861 This leaves things a bit vague as far as other processing actions such as
55862 address rewriting are concerned. Exim treats <option>Resent-</option> header lines as
55863 follows:
55864 </para>
55865 <itemizedlist>
55866 <listitem>
55867 <para>
55868 A <emphasis>Resent-From:</emphasis> line that just contains the login id of the submitting user
55869 is automatically rewritten in the same way as <emphasis>From:</emphasis> (see below).
55870 </para>
55871 </listitem>
55872 <listitem>
55873 <para>
55874 If there&#x2019;s a rewriting rule for a particular header line, it is also applied to
55875 <option>Resent-</option> header lines of the same type. For example, a rule that rewrites
55876 <emphasis>From:</emphasis> also rewrites <emphasis>Resent-From:</emphasis>.
55877 </para>
55878 </listitem>
55879 <listitem>
55880 <para>
55881 For local messages, if <emphasis>Sender:</emphasis> is removed on input, <emphasis>Resent-Sender:</emphasis> is
55882 also removed.
55883 </para>
55884 </listitem>
55885 <listitem>
55886 <para>
55887 For a locally-submitted message,
55888 if there are any <option>Resent-</option> header lines but no <emphasis>Resent-Date:</emphasis>,
55889 <emphasis>Resent-From:</emphasis>, or <emphasis>Resent-Message-Id:</emphasis>, they are added as necessary. It is
55890 the contents of <emphasis>Resent-Message-Id:</emphasis> (rather than <emphasis>Message-Id:</emphasis>) which are
55891 included in log lines in this case.
55892 </para>
55893 </listitem>
55894 <listitem>
55895 <para>
55896 The logic for adding <emphasis>Sender:</emphasis> is duplicated for <emphasis>Resent-Sender:</emphasis> when any
55897 <option>Resent-</option> header lines are present.
55898 </para>
55899 </listitem>
55900 </itemizedlist>
55901 </section>
55902 <section id="SECID221">
55903 <title>The Auto-Submitted: header line</title>
55904 <para>
55905 Whenever Exim generates an autoreply, a bounce, or a delay warning message, it
55906 includes the header line:
55907 </para>
55908 <literallayout class="monospaced">
55909 Auto-Submitted: auto-replied
55910 </literallayout>
55911 </section>
55912 <section id="SECID222">
55913 <title>The Bcc: header line</title>
55914 <para>
55915 <indexterm role="concept">
55916 <primary><emphasis>Bcc:</emphasis> header line</primary>
55917 </indexterm>
55918 If Exim is called with the <option>-t</option> option, to take recipient addresses from a
55919 message&#x2019;s header, it removes any <emphasis>Bcc:</emphasis> header line that may exist (after
55920 extracting its addresses). If <option>-t</option> is not present on the command line, any
55921 existing <emphasis>Bcc:</emphasis> is not removed.
55922 </para>
55923 </section>
55924 <section id="SECID223">
55925 <title>The Date: header line</title>
55926 <para>
55927 <indexterm role="concept">
55928 <primary><emphasis>Date:</emphasis> header line</primary>
55929 </indexterm>
55930 If a locally-generated or submission-mode message has no <emphasis>Date:</emphasis> header line,
55931 Exim adds one, using the current date and time, unless the
55932 <option>suppress_local_fixups</option> control has been specified.
55933 </para>
55934 </section>
55935 <section id="SECID224">
55936 <title>The Delivery-date: header line</title>
55937 <para>
55938 <indexterm role="concept">
55939 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
55940 </indexterm>
55941 <indexterm role="option">
55942 <primary><option>delivery_date_remove</option></primary>
55943 </indexterm>
55944 <emphasis>Delivery-date:</emphasis> header lines are not part of the standard RFC 2822 header
55945 set. Exim can be configured to add them to the final delivery of messages. (See
55946 the generic <option>delivery_date_add</option> transport option.) They should not be present
55947 in messages in transit. If the <option>delivery_date_remove</option> configuration option is
55948 set (the default), Exim removes <emphasis>Delivery-date:</emphasis> header lines from incoming
55949 messages.
55950 </para>
55951 </section>
55952 <section id="SECID225">
55953 <title>The Envelope-to: header line</title>
55954 <para>
55955 <indexterm role="concept">
55956 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
55957 </indexterm>
55958 <indexterm role="option">
55959 <primary><option>envelope_to_remove</option></primary>
55960 </indexterm>
55961 <emphasis>Envelope-to:</emphasis> header lines are not part of the standard RFC 2822 header set.
55962 Exim can be configured to add them to the final delivery of messages. (See the
55963 generic <option>envelope_to_add</option> transport option.) They should not be present in
55964 messages in transit. If the <option>envelope_to_remove</option> configuration option is set
55965 (the default), Exim removes <emphasis>Envelope-to:</emphasis> header lines from incoming
55966 messages.
55967 </para>
55968 </section>
55969 <section id="SECTthefrohea">
55970 <title>The From: header line</title>
55971 <para>
55972 <indexterm role="concept">
55973 <primary><emphasis>From:</emphasis> header line</primary>
55974 </indexterm>
55975 <indexterm role="concept">
55976 <primary>Sendmail compatibility</primary>
55977 <secondary><quote>From</quote> line</secondary>
55978 </indexterm>
55979 <indexterm role="concept">
55980 <primary>message</primary>
55981 <secondary>submission</secondary>
55982 </indexterm>
55983 <indexterm role="concept">
55984 <primary>submission mode</primary>
55985 </indexterm>
55986 If a submission-mode message does not contain a <emphasis>From:</emphasis> header line, Exim
55987 adds one if either of the following conditions is true:
55988 </para>
55989 <itemizedlist>
55990 <listitem>
55991 <para>
55992 The envelope sender address is not empty (that is, this is not a bounce
55993 message). The added header line copies the envelope sender address.
55994 </para>
55995 </listitem>
55996 <listitem>
55997 <para>
55998 <indexterm role="variable">
55999 <primary><varname>$authenticated_id</varname></primary>
56000 </indexterm>
56001 The SMTP session is authenticated and <varname>$authenticated_id</varname> is not empty.
56002 </para>
56003 <orderedlist numeration="arabic">
56004 <listitem>
56005 <para>
56006 <indexterm role="variable">
56007 <primary><varname>$qualify_domain</varname></primary>
56008 </indexterm>
56009 If no domain is specified by the submission control, the local part is
56010 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
56011 </para>
56012 </listitem>
56013 <listitem>
56014 <para>
56015 If a non-empty domain is specified by the submission control, the local
56016 part is <varname>$authenticated_id</varname>, and the domain is the specified domain.
56017 </para>
56018 </listitem>
56019 <listitem>
56020 <para>
56021 If an empty domain is specified by the submission control,
56022 <varname>$authenticated_id</varname> is assumed to be the complete address.
56023 </para>
56024 </listitem>
56025 </orderedlist>
56026 </listitem>
56027 </itemizedlist>
56028 <para>
56029 A non-empty envelope sender takes precedence.
56030 </para>
56031 <para>
56032 If a locally-generated incoming message does not contain a <emphasis>From:</emphasis> header
56033 line, and the <option>suppress_local_fixups</option> control is not set, Exim adds one
56034 containing the sender&#x2019;s address. The calling user&#x2019;s login name and full name
56035 are used to construct the address, as described in section <xref linkend="SECTconstr"/>.
56036 They are obtained from the password data by calling <function>getpwuid()</function> (but see the
56037 <option>unknown_login</option> configuration option). The address is qualified with
56038 <option>qualify_domain</option>.
56039 </para>
56040 <para>
56041 For compatibility with Sendmail, if an incoming, non-SMTP message has a
56042 <emphasis>From:</emphasis> header line containing just the unqualified login name of the calling
56043 user, this is replaced by an address containing the user&#x2019;s login name and full
56044 name as described in section <xref linkend="SECTconstr"/>.
56045 </para>
56046 </section>
56047 <section id="SECID226">
56048 <title>The Message-ID: header line</title>
56049 <para>
56050 <indexterm role="concept">
56051 <primary><emphasis>Message-ID:</emphasis> header line</primary>
56052 </indexterm>
56053 <indexterm role="concept">
56054 <primary>message</primary>
56055 <secondary>submission</secondary>
56056 </indexterm>
56057 <indexterm role="option">
56058 <primary><option>message_id_header_text</option></primary>
56059 </indexterm>
56060 If a locally-generated or submission-mode incoming message does not contain a
56061 <emphasis>Message-ID:</emphasis> or <emphasis>Resent-Message-ID:</emphasis> header line, and the
56062 <option>suppress_local_fixups</option> control is not set, Exim adds a suitable header line
56063 to the message. If there are any <emphasis>Resent-:</emphasis> headers in the message, it
56064 creates <emphasis>Resent-Message-ID:</emphasis>. The id is constructed from Exim&#x2019;s internal
56065 message id, preceded by the letter E to ensure it starts with a letter, and
56066 followed by @ and the primary host name. Additional information can be included
56067 in this header line by setting the <option>message_id_header_text</option> and/or
56068 <option>message_id_header_domain</option> options.
56069 </para>
56070 </section>
56071 <section id="SECID227">
56072 <title>The Received: header line</title>
56073 <para>
56074 <indexterm role="concept">
56075 <primary><emphasis>Received:</emphasis> header line</primary>
56076 </indexterm>
56077 A <emphasis>Received:</emphasis> header line is added at the start of every message. The
56078 contents are defined by the <option>received_header_text</option> configuration option, and
56079 Exim automatically adds a semicolon and a timestamp to the configured string.
56080 </para>
56081 <para>
56082 The <emphasis>Received:</emphasis> header is generated as soon as the message&#x2019;s header lines
56083 have been received. At this stage, the timestamp in the <emphasis>Received:</emphasis> header
56084 line is the time that the message started to be received. This is the value
56085 that is seen by the DATA ACL and by the <function>local_scan()</function> function.
56086 </para>
56087 <para>
56088 Once a message is accepted, the timestamp in the <emphasis>Received:</emphasis> header line is
56089 changed to the time of acceptance, which is (apart from a small delay while the
56090 -H spool file is written) the earliest time at which delivery could start.
56091 </para>
56092 </section>
56093 <section id="SECID228">
56094 <title>The References: header line</title>
56095 <para>
56096 <indexterm role="concept">
56097 <primary><emphasis>References:</emphasis> header line</primary>
56098 </indexterm>
56099 Messages created by the <command>autoreply</command> transport include a <emphasis>References:</emphasis>
56100 header line. This is constructed according to the rules that are described in
56101 section 3.64 of RFC 2822 (which states that replies should contain such a
56102 header line), and section 3.14 of RFC 3834 (which states that automatic
56103 responses are not different in this respect). However, because some mail
56104 processing software does not cope well with very long header lines, no more
56105 than 12 message IDs are copied from the <emphasis>References:</emphasis> header line in the
56106 incoming message. If there are more than 12, the first one and then the final
56107 11 are copied, before adding the message ID of the incoming message.
56108 </para>
56109 </section>
56110 <section id="SECID229">
56111 <title>The Return-path: header line</title>
56112 <para>
56113 <indexterm role="concept">
56114 <primary><emphasis>Return-path:</emphasis> header line</primary>
56115 </indexterm>
56116 <indexterm role="option">
56117 <primary><option>return_path_remove</option></primary>
56118 </indexterm>
56119 <emphasis>Return-path:</emphasis> header lines are defined as something an MTA may insert when
56120 it does the final delivery of messages. (See the generic <option>return_path_add</option>
56121 transport option.) Therefore, they should not be present in messages in
56122 transit. If the <option>return_path_remove</option> configuration option is set (the
56123 default), Exim removes <emphasis>Return-path:</emphasis> header lines from incoming messages.
56124 </para>
56125 </section>
56126 <section id="SECTthesenhea">
56127 <title>The Sender: header line</title>
56128 <para>
56129 <indexterm role="concept">
56130 <primary><emphasis>Sender:</emphasis> header line</primary>
56131 </indexterm>
56132 <indexterm role="concept">
56133 <primary>message</primary>
56134 <secondary>submission</secondary>
56135 </indexterm>
56136 For a locally-originated message from an untrusted user, Exim may remove an
56137 existing <emphasis>Sender:</emphasis> header line, and it may add a new one. You can modify
56138 these actions by setting the <option>local_sender_retain</option> option true, the
56139 <option>local_from_check</option> option false, or by using the <option>suppress_local_fixups</option>
56140 control setting.
56141 </para>
56142 <para>
56143 When a local message is received from an untrusted user and
56144 <option>local_from_check</option> is true (the default), and the <option>suppress_local_fixups</option>
56145 control has not been set, a check is made to see if the address given in the
56146 <emphasis>From:</emphasis> header line is the correct (local) sender of the message. The address
56147 that is expected has the login name as the local part and the value of
56148 <option>qualify_domain</option> as the domain. Prefixes and suffixes for the local part can
56149 be permitted by setting <option>local_from_prefix</option> and <option>local_from_suffix</option>
56150 appropriately. If <emphasis>From:</emphasis> does not contain the correct sender, a <emphasis>Sender:</emphasis>
56151 line is added to the message.
56152 </para>
56153 <para>
56154 If you set <option>local_from_check</option> false, this checking does not occur. However,
56155 the removal of an existing <emphasis>Sender:</emphasis> line still happens, unless you also set
56156 <option>local_sender_retain</option> to be true. It is not possible to set both of these
56157 options true at the same time.
56158 </para>
56159 <para>
56160 <indexterm role="concept">
56161 <primary>submission mode</primary>
56162 </indexterm>
56163 By default, no processing of <emphasis>Sender:</emphasis> header lines is done for messages
56164 received over TCP/IP or for messages submitted by trusted users. However, when
56165 a message is received over TCP/IP in submission mode, and <option>sender_retain</option> is
56166 not specified on the submission control, the following processing takes place:
56167 </para>
56168 <para>
56169 <indexterm role="variable">
56170 <primary><varname>$authenticated_id</varname></primary>
56171 </indexterm>
56172 First, any existing <emphasis>Sender:</emphasis> lines are removed. Then, if the SMTP session is
56173 authenticated, and <varname>$authenticated_id</varname> is not empty, a sender address is
56174 created as follows:
56175 </para>
56176 <itemizedlist>
56177 <listitem>
56178 <para>
56179 <indexterm role="variable">
56180 <primary><varname>$qualify_domain</varname></primary>
56181 </indexterm>
56182 If no domain is specified by the submission control, the local part is
56183 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
56184 </para>
56185 </listitem>
56186 <listitem>
56187 <para>
56188 If a non-empty domain is specified by the submission control, the local part
56189 is <varname>$authenticated_id</varname>, and the domain is the specified domain.
56190 </para>
56191 </listitem>
56192 <listitem>
56193 <para>
56194 If an empty domain is specified by the submission control,
56195 <varname>$authenticated_id</varname> is assumed to be the complete address.
56196 </para>
56197 </listitem>
56198 </itemizedlist>
56199 <para>
56200 This address is compared with the address in the <emphasis>From:</emphasis> header line. If they
56201 are different, a <emphasis>Sender:</emphasis> header line containing the created address is
56202 added. Prefixes and suffixes for the local part in <emphasis>From:</emphasis> can be permitted
56203 by setting <option>local_from_prefix</option> and <option>local_from_suffix</option> appropriately.
56204 </para>
56205 <para>
56206 <indexterm role="concept">
56207 <primary>return path</primary>
56208 <secondary>created from <emphasis>Sender:</emphasis></secondary>
56209 </indexterm>
56210 <emphasis role="bold">Note</emphasis>: Whenever a <emphasis>Sender:</emphasis> header line is created, the return path for
56211 the message (the envelope sender address) is changed to be the same address,
56212 except in the case of submission mode when <option>sender_retain</option> is specified.
56213 </para>
56214 </section>
56215 <section id="SECTheadersaddrem">
56216 <title>Adding and removing header lines in routers and transports</title>
56217 <para>
56218 <indexterm role="concept">
56219 <primary>header lines</primary>
56220 <secondary>adding; in router or transport</secondary>
56221 </indexterm>
56222 <indexterm role="concept">
56223 <primary>header lines</primary>
56224 <secondary>removing; in router or transport</secondary>
56225 </indexterm>
56226 When a message is delivered, the addition and removal of header lines can be
56227 specified in a system filter, or on any of the routers and transports that
56228 process the message. Section <xref linkend="SECTaddremheasys"/> contains details about
56229 modifying headers in a system filter. Header lines can also be added in an ACL
56230 as a message is received (see section <xref linkend="SECTaddheadacl"/>).
56231 </para>
56232 <para>
56233 In contrast to what happens in a system filter, header modifications that are
56234 specified on routers and transports apply only to the particular recipient
56235 addresses that are being processed by those routers and transports. These
56236 changes do not actually take place until a copy of the message is being
56237 transported. Therefore, they do not affect the basic set of header lines, and
56238 they do not affect the values of the variables that refer to header lines.
56239 </para>
56240 <para>
56241 <emphasis role="bold">Note</emphasis>: In particular, this means that any expansions in the configuration of
56242 the transport cannot refer to the modified header lines, because such
56243 expansions all occur before the message is actually transported.
56244 </para>
56245 <para>
56246 For both routers and transports, the result of expanding a <option>headers_add</option>
56247 option must be in the form of one or more RFC 2822 header lines, separated by
56248 newlines (coded as <quote>\n</quote>). For example:
56249 </para>
56250 <literallayout class="monospaced">
56251 headers_add = X-added-header: added by $primary_hostname\n\
56252               X-added-second: another added header line
56253 </literallayout>
56254 <para>
56255 Exim does not check the syntax of these added header lines.
56256 </para>
56257 <para>
56258 The result of expanding <option>headers_remove</option> must consist of a colon-separated
56259 list of header names. This is confusing, because header names themselves are
56260 often terminated by colons. In this case, the colons are the list separators,
56261 not part of the names. For example:
56262 </para>
56263 <literallayout class="monospaced">
56264 headers_remove = return-receipt-to:acknowledge-to
56265 </literallayout>
56266 <para>
56267 When <option>headers_add</option> or <option>headers_remove</option> is specified on a router, its value
56268 is expanded at routing time, and then associated with all addresses that are
56269 accepted by that router, and also with any new addresses that it generates. If
56270 an address passes through several routers as a result of aliasing or
56271 forwarding, the changes are cumulative.
56272 </para>
56273 <para>
56274 <indexterm role="option">
56275 <primary><option>unseen</option></primary>
56276 </indexterm>
56277 However, this does not apply to multiple routers that result from the use of
56278 the <option>unseen</option> option. Any header modifications that were specified by the
56279 <quote>unseen</quote> router or its predecessors apply only to the <quote>unseen</quote> delivery.
56280 </para>
56281 <para>
56282 Addresses that end up with different <option>headers_add</option> or <option>headers_remove</option>
56283 settings cannot be delivered together in a batch, so a transport is always
56284 dealing with a set of addresses that have the same header-processing
56285 requirements.
56286 </para>
56287 <para>
56288 The transport starts by writing the original set of header lines that arrived
56289 with the message, possibly modified by the system filter. As it writes out
56290 these lines, it consults the list of header names that were attached to the
56291 recipient address(es) by <option>headers_remove</option> options in routers, and it also
56292 consults the transport&#x2019;s own <option>headers_remove</option> option. Header lines whose
56293 names are on either of these lists are not written out. If there are multiple
56294 instances of any listed header, they are all skipped.
56295 </para>
56296 <para>
56297 After the remaining original header lines have been written, new header
56298 lines that were specified by routers&#x2019; <option>headers_add</option> options are written, in
56299 the order in which they were attached to the address. These are followed by any
56300 header lines specified by the transport&#x2019;s <option>headers_add</option> option.
56301 </para>
56302 <para>
56303 This way of handling header line modifications in routers and transports has
56304 the following consequences:
56305 </para>
56306 <itemizedlist>
56307 <listitem>
56308 <para>
56309 The original set of header lines, possibly modified by the system filter,
56310 remains <quote>visible</quote>, in the sense that the <varname>$header_</varname><emphasis>xxx</emphasis> variables refer
56311 to it, at all times.
56312 </para>
56313 </listitem>
56314 <listitem>
56315 <para>
56316 Header lines that are added by a router&#x2019;s
56317 <option>headers_add</option> option are not accessible by means of the <varname>$header_</varname><emphasis>xxx</emphasis>
56318 expansion syntax in subsequent routers or the transport.
56319 </para>
56320 </listitem>
56321 <listitem>
56322 <para>
56323 Conversely, header lines that are specified for removal by <option>headers_remove</option>
56324 in a router remain visible to subsequent routers and the transport.
56325 </para>
56326 </listitem>
56327 <listitem>
56328 <para>
56329 Headers added to an address by <option>headers_add</option> in a router cannot be removed by
56330 a later router or by a transport.
56331 </para>
56332 </listitem>
56333 <listitem>
56334 <para>
56335 An added header can refer to the contents of an original header that is to be
56336 removed, even it has the same name as the added header. For example:
56337 </para>
56338 <literallayout class="monospaced">
56339 headers_remove = subject
56340 headers_add = Subject: new subject (was: $h_subject:)
56341 </literallayout>
56342 </listitem>
56343 </itemizedlist>
56344 <para>
56345 <emphasis role="bold">Warning</emphasis>: The <option>headers_add</option> and <option>headers_remove</option> options cannot be used
56346 for a <command>redirect</command> router that has the <option>one_time</option> option set.
56347 </para>
56348 </section>
56349 <section id="SECTconstr">
56350 <title>Constructed addresses</title>
56351 <para>
56352 <indexterm role="concept">
56353 <primary>address</primary>
56354 <secondary>constructed</secondary>
56355 </indexterm>
56356 <indexterm role="concept">
56357 <primary>constructed address</primary>
56358 </indexterm>
56359 When Exim constructs a sender address for a locally-generated message, it uses
56360 the form
56361 </para>
56362 <literallayout>
56363 &lt;<emphasis>user name</emphasis>&gt;&nbsp;&nbsp;&lt;<emphasis>login</emphasis><literal>@</literal><emphasis>qualify_domain</emphasis>&gt;
56364 </literallayout>
56365 <para>
56366 For example:
56367 </para>
56368 <literallayout class="monospaced">
56369 Zaphod Beeblebrox &lt;zaphod@end.univ.example&gt;
56370 </literallayout>
56371 <para>
56372 The user name is obtained from the <option>-F</option> command line option if set, or
56373 otherwise by looking up the calling user by <function>getpwuid()</function> and extracting the
56374 <quote>gecos</quote> field from the password entry. If the <quote>gecos</quote> field contains an
56375 ampersand character, this is replaced by the login name with the first letter
56376 upper cased, as is conventional in a number of operating systems. See the
56377 <option>gecos_name</option> option for a way to tailor the handling of the <quote>gecos</quote> field.
56378 The <option>unknown_username</option> option can be used to specify user names in cases when
56379 there is no password file entry.
56380 </para>
56381 <para>
56382 <indexterm role="concept">
56383 <primary>RFC 2047</primary>
56384 </indexterm>
56385 In all cases, the user name is made to conform to RFC 2822 by quoting all or
56386 parts of it if necessary. In addition, if it contains any non-printing
56387 characters, it is encoded as described in RFC 2047, which defines a way of
56388 including non-ASCII characters in header lines. The value of the
56389 <option>headers_charset</option> option specifies the name of the encoding that is used (the
56390 characters are assumed to be in this encoding). The setting of
56391 <option>print_topbitchars</option> controls whether characters with the top bit set (that
56392 is, with codes greater than 127) count as printing characters or not.
56393 </para>
56394 </section>
56395 <section id="SECID230">
56396 <title>Case of local parts</title>
56397 <para>
56398 <indexterm role="concept">
56399 <primary>case of local parts</primary>
56400 </indexterm>
56401 <indexterm role="concept">
56402 <primary>local part</primary>
56403 <secondary>case of</secondary>
56404 </indexterm>
56405 RFC 2822 states that the case of letters in the local parts of addresses cannot
56406 be assumed to be non-significant. Exim preserves the case of local parts of
56407 addresses, but by default it uses a lower-cased form when it is routing,
56408 because on most Unix systems, usernames are in lower case and case-insensitive
56409 routing is required. However, any particular router can be made to use the
56410 original case for local parts by setting the <option>caseful_local_part</option> generic
56411 router option.
56412 </para>
56413 <para>
56414 <indexterm role="concept">
56415 <primary>mixed-case login names</primary>
56416 </indexterm>
56417 If you must have mixed-case user names on your system, the best way to proceed,
56418 assuming you want case-independent handling of incoming email, is to set up
56419 your first router to convert incoming local parts in your domains to the
56420 correct case by means of a file lookup. For example:
56421 </para>
56422 <literallayout class="monospaced">
56423 correct_case:
56424   driver = redirect
56425   domains = +local_domains
56426   data = ${lookup{$local_part}cdb\
56427               {/etc/usercased.cdb}{$value}fail}\
56428               @$domain
56429 </literallayout>
56430 <para>
56431 For this router, the local part is forced to lower case by the default action
56432 (<option>caseful_local_part</option> is not set). The lower-cased local part is used to look
56433 up a new local part in the correct case. If you then set <option>caseful_local_part</option>
56434 on any subsequent routers which process your domains, they will operate on
56435 local parts with the correct case in a case-sensitive manner.
56436 </para>
56437 </section>
56438 <section id="SECID231">
56439 <title>Dots in local parts</title>
56440 <para>
56441 <indexterm role="concept">
56442 <primary>dot</primary>
56443 <secondary>in local part</secondary>
56444 </indexterm>
56445 <indexterm role="concept">
56446 <primary>local part</primary>
56447 <secondary>dots in</secondary>
56448 </indexterm>
56449 RFC 2822 forbids empty components in local parts. That is, an unquoted local
56450 part may not begin or end with a dot, nor have two consecutive dots in the
56451 middle. However, it seems that many MTAs do not enforce this, so Exim permits
56452 empty components for compatibility.
56453 </para>
56454 </section>
56455 <section id="SECID232">
56456 <title>Rewriting addresses</title>
56457 <para>
56458 <indexterm role="concept">
56459 <primary>rewriting</primary>
56460 <secondary>addresses</secondary>
56461 </indexterm>
56462 Rewriting of sender and recipient addresses, and addresses in headers, can
56463 happen automatically, or as the result of configuration options, as described
56464 in chapter <xref linkend="CHAPrewrite"/>. The headers that may be affected by this are
56465 <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>.
56466 </para>
56467 <para>
56468 Automatic rewriting includes qualification, as mentioned above. The other case
56469 in which it can happen is when an incomplete non-local domain is given. The
56470 routing process may cause this to be expanded into the full domain name. For
56471 example, a header such as
56472 </para>
56473 <literallayout class="monospaced">
56474 To: hare@teaparty
56475 </literallayout>
56476 <para>
56477 might get rewritten as
56478 </para>
56479 <literallayout class="monospaced">
56480 To: hare@teaparty.wonderland.fict.example
56481 </literallayout>
56482 <para>
56483 Rewriting as a result of routing is the one kind of message processing that
56484 does not happen at input time, as it cannot be done until the address has
56485 been routed.
56486 </para>
56487 <para>
56488 Strictly, one should not do <emphasis>any</emphasis> deliveries of a message until all its
56489 addresses have been routed, in case any of the headers get changed as a
56490 result of routing. However, doing this in practice would hold up many
56491 deliveries for unreasonable amounts of time, just because one address could not
56492 immediately be routed. Exim therefore does not delay other deliveries when
56493 routing of one or more addresses is deferred.
56494 <indexterm role="concept" startref="IIDmesproc" class="endofrange"/>
56495 </para>
56496 </section>
56497 </chapter>
56498
56499 <chapter id="CHAPSMTP">
56500 <title>SMTP processing</title>
56501 <para>
56502 <indexterm role="concept" id="IIDsmtpproc1" class="startofrange">
56503 <primary>SMTP</primary>
56504 <secondary>processing details</secondary>
56505 </indexterm>
56506 <indexterm role="concept" id="IIDsmtpproc2" class="startofrange">
56507 <primary>LMTP</primary>
56508 <secondary>processing details</secondary>
56509 </indexterm>
56510 Exim supports a number of different ways of using the SMTP protocol, and its
56511 LMTP variant, which is an interactive protocol for transferring messages into a
56512 closed mail store application. This chapter contains details of how SMTP is
56513 processed. For incoming mail, the following are available:
56514 </para>
56515 <itemizedlist>
56516 <listitem>
56517 <para>
56518 SMTP over TCP/IP (Exim daemon or <emphasis>inetd</emphasis>);
56519 </para>
56520 </listitem>
56521 <listitem>
56522 <para>
56523 SMTP over the standard input and output (the <option>-bs</option> option);
56524 </para>
56525 </listitem>
56526 <listitem>
56527 <para>
56528 Batched SMTP on the standard input (the <option>-bS</option> option).
56529 </para>
56530 </listitem>
56531 </itemizedlist>
56532 <para>
56533 For mail delivery, the following are available:
56534 </para>
56535 <itemizedlist>
56536 <listitem>
56537 <para>
56538 SMTP over TCP/IP (the <command>smtp</command> transport);
56539 </para>
56540 </listitem>
56541 <listitem>
56542 <para>
56543 LMTP over TCP/IP (the <command>smtp</command> transport with the <option>protocol</option> option set to
56544 <quote>lmtp</quote>);
56545 </para>
56546 </listitem>
56547 <listitem>
56548 <para>
56549 LMTP over a pipe to a process running in the local host (the <command>lmtp</command>
56550 transport);
56551 </para>
56552 </listitem>
56553 <listitem>
56554 <para>
56555 Batched SMTP to a file or pipe (the <command>appendfile</command> and <command>pipe</command> transports with
56556 the <option>use_bsmtp</option> option set).
56557 </para>
56558 </listitem>
56559 </itemizedlist>
56560 <para>
56561 <emphasis>Batched SMTP</emphasis> is the name for a process in which batches of messages are
56562 stored in or read from files (or pipes), in a format in which SMTP commands are
56563 used to contain the envelope information.
56564 </para>
56565 <section id="SECToutSMTPTCP">
56566 <title>Outgoing SMTP and LMTP over TCP/IP</title>
56567 <para>
56568 <indexterm role="concept">
56569 <primary>SMTP</primary>
56570 <secondary>outgoing over TCP/IP</secondary>
56571 </indexterm>
56572 <indexterm role="concept">
56573 <primary>outgoing SMTP over TCP/IP</primary>
56574 </indexterm>
56575 <indexterm role="concept">
56576 <primary>LMTP</primary>
56577 <secondary>over TCP/IP</secondary>
56578 </indexterm>
56579 <indexterm role="concept">
56580 <primary>outgoing LMTP over TCP/IP</primary>
56581 </indexterm>
56582 <indexterm role="concept">
56583 <primary>EHLO</primary>
56584 </indexterm>
56585 <indexterm role="concept">
56586 <primary>HELO</primary>
56587 </indexterm>
56588 <indexterm role="concept">
56589 <primary>SIZE option on MAIL command</primary>
56590 </indexterm>
56591 Outgoing SMTP and LMTP over TCP/IP is implemented by the <command>smtp</command> transport.
56592 The <option>protocol</option> option selects which protocol is to be used, but the actual
56593 processing is the same in both cases.
56594 </para>
56595 <para>
56596 If, in response to its EHLO command, Exim is told that the SIZE
56597 parameter is supported, it adds SIZE=&lt;<emphasis>n</emphasis>&gt; to each subsequent MAIL
56598 command. The value of &lt;<emphasis>n</emphasis>&gt; is the message size plus the value of the
56599 <option>size_addition</option> option (default 1024) to allow for additions to the message
56600 such as per-transport header lines, or changes made in a
56601 <indexterm role="concept">
56602 <primary>transport</primary>
56603 <secondary>filter</secondary>
56604 </indexterm>
56605 <indexterm role="concept">
56606 <primary>filter</primary>
56607 <secondary>transport filter</secondary>
56608 </indexterm>
56609 transport filter. If <option>size_addition</option> is set negative, the use of SIZE is
56610 suppressed.
56611 </para>
56612 <para>
56613 If the remote server advertises support for PIPELINING, Exim uses the
56614 pipelining extension to SMTP (RFC 2197) to reduce the number of TCP/IP packets
56615 required for the transaction.
56616 </para>
56617 <para>
56618 If the remote server advertises support for the STARTTLS command, and Exim
56619 was built to support TLS encryption, it tries to start a TLS session unless the
56620 server matches <option>hosts_avoid_tls</option>. See chapter <xref linkend="CHAPTLS"/> for more details.
56621 </para>
56622 <para>
56623 If the remote server advertises support for the AUTH command, Exim scans
56624 the authenticators configuration for any suitable client settings, as described
56625 in chapter <xref linkend="CHAPSMTPAUTH"/>.
56626 </para>
56627 <para>
56628 <indexterm role="concept">
56629 <primary>carriage return</primary>
56630 </indexterm>
56631 <indexterm role="concept">
56632 <primary>linefeed</primary>
56633 </indexterm>
56634 Responses from the remote host are supposed to be terminated by CR followed by
56635 LF. However, there are known to be hosts that do not send CR characters, so in
56636 order to be able to interwork with such hosts, Exim treats LF on its own as a
56637 line terminator.
56638 </para>
56639 <para>
56640 If a message contains a number of different addresses, all those with the same
56641 characteristics (for example, the same envelope sender) that resolve to the
56642 same set of hosts, in the same order, are sent in a single SMTP transaction,
56643 even if they are for different domains, unless there are more than the setting
56644 of the <option>max_rcpt</option>s option in the <command>smtp</command> transport allows, in which case
56645 they are split into groups containing no more than <option>max_rcpt</option>s addresses
56646 each. If <option>remote_max_parallel</option> is greater than one, such groups may be sent
56647 in parallel sessions. The order of hosts with identical MX values is not
56648 significant when checking whether addresses can be batched in this way.
56649 </para>
56650 <para>
56651 When the <command>smtp</command> transport suffers a temporary failure that is not
56652 message-related, Exim updates its transport-specific database, which contains
56653 records indexed by host name that remember which messages are waiting for each
56654 particular host. It also updates the retry database with new retry times.
56655 </para>
56656 <para>
56657 <indexterm role="concept">
56658 <primary>hints database</primary>
56659 <secondary>retry keys</secondary>
56660 </indexterm>
56661 Exim&#x2019;s retry hints are based on host name plus IP address, so if one address of
56662 a multi-homed host is broken, it will soon be skipped most of the time.
56663 See the next section for more detail about error handling.
56664 </para>
56665 <para>
56666 <indexterm role="concept">
56667 <primary>SMTP</primary>
56668 <secondary>passed connection</secondary>
56669 </indexterm>
56670 <indexterm role="concept">
56671 <primary>SMTP</primary>
56672 <secondary>batching over TCP/IP</secondary>
56673 </indexterm>
56674 When a message is successfully delivered over a TCP/IP SMTP connection, Exim
56675 looks in the hints database for the transport to see if there are any queued
56676 messages waiting for the host to which it is connected. If it finds one, it
56677 creates a new Exim process using the <option>-MC</option> option (which can only be used by
56678 a process running as root or the Exim user) and passes the TCP/IP socket to it
56679 so that it can deliver another message using the same socket. The new process
56680 does only those deliveries that are routed to the connected host, and may in
56681 turn pass the socket on to a third process, and so on.
56682 </para>
56683 <para>
56684 The <option>connection_max_messages</option> option of the <command>smtp</command> transport can be used to
56685 limit the number of messages sent down a single TCP/IP connection.
56686 </para>
56687 <para>
56688 <indexterm role="concept">
56689 <primary>asterisk</primary>
56690 <secondary>after IP address</secondary>
56691 </indexterm>
56692 The second and subsequent messages delivered down an existing connection are
56693 identified in the main log by the addition of an asterisk after the closing
56694 square bracket of the IP address.
56695 </para>
56696 </section>
56697 <section id="SECToutSMTPerr">
56698 <title>Errors in outgoing SMTP</title>
56699 <para>
56700 <indexterm role="concept">
56701 <primary>error</primary>
56702 <secondary>in outgoing SMTP</secondary>
56703 </indexterm>
56704 <indexterm role="concept">
56705 <primary>SMTP</primary>
56706 <secondary>errors in outgoing</secondary>
56707 </indexterm>
56708 <indexterm role="concept">
56709 <primary>host</primary>
56710 <secondary>error</secondary>
56711 </indexterm>
56712 Three different kinds of error are recognized for outgoing SMTP: host errors,
56713 message errors, and recipient errors.
56714 </para>
56715 <variablelist>
56716 <varlistentry>
56717 <term><emphasis role="bold">Host errors</emphasis></term>
56718 <listitem>
56719 <para>
56720 A host error is not associated with a particular message or with a
56721 particular recipient of a message. The host errors are:
56722 </para>
56723 <itemizedlist>
56724 <listitem>
56725 <para>
56726 Connection refused or timed out,
56727 </para>
56728 </listitem>
56729 <listitem>
56730 <para>
56731 Any error response code on connection,
56732 </para>
56733 </listitem>
56734 <listitem>
56735 <para>
56736 Any error response code to EHLO or HELO,
56737 </para>
56738 </listitem>
56739 <listitem>
56740 <para>
56741 Loss of connection at any time, except after <quote>.</quote>,
56742 </para>
56743 </listitem>
56744 <listitem>
56745 <para>
56746 I/O errors at any time,
56747 </para>
56748 </listitem>
56749 <listitem>
56750 <para>
56751 Timeouts during the session, other than in response to MAIL, RCPT or
56752 the <quote>.</quote> at the end of the data.
56753 </para>
56754 </listitem>
56755 </itemizedlist>
56756 <para>
56757 For a host error, a permanent error response on connection, or in response to
56758 EHLO, causes all addresses routed to the host to be failed. Any other host
56759 error causes all addresses to be deferred, and retry data to be created for the
56760 host. It is not tried again, for any message, until its retry time arrives. If
56761 the current set of addresses are not all delivered in this run (to some
56762 alternative host), the message is added to the list of those waiting for this
56763 host, so if it is still undelivered when a subsequent successful delivery is
56764 made to the host, it will be sent down the same SMTP connection.
56765 </para>
56766 </listitem></varlistentry>
56767 <varlistentry>
56768 <term><emphasis role="bold">Message errors</emphasis></term>
56769 <listitem>
56770 <para>
56771 <indexterm role="concept">
56772 <primary>message</primary>
56773 <secondary>error</secondary>
56774 </indexterm>
56775 A message error is associated with a particular message when sent to a
56776 particular host, but not with a particular recipient of the message. The
56777 message errors are:
56778 </para>
56779 <itemizedlist>
56780 <listitem>
56781 <para>
56782 Any error response code to MAIL, DATA, or the <quote>.</quote> that terminates
56783 the data,
56784 </para>
56785 </listitem>
56786 <listitem>
56787 <para>
56788 Timeout after MAIL,
56789 </para>
56790 </listitem>
56791 <listitem>
56792 <para>
56793 Timeout or loss of connection after the <quote>.</quote> that terminates the data. A
56794 timeout after the DATA command itself is treated as a host error, as is loss of
56795 connection at any other time.
56796 </para>
56797 </listitem>
56798 </itemizedlist>
56799 <para>
56800 For a message error, a permanent error response (5<emphasis>xx</emphasis>) causes all addresses
56801 to be failed, and a delivery error report to be returned to the sender. A
56802 temporary error response (4<emphasis>xx</emphasis>), or one of the timeouts, causes all
56803 addresses to be deferred. Retry data is not created for the host, but instead,
56804 a retry record for the combination of host plus message id is created. The
56805 message is not added to the list of those waiting for this host. This ensures
56806 that the failing message will not be sent to this host again until the retry
56807 time arrives. However, other messages that are routed to the host are not
56808 affected, so if it is some property of the message that is causing the error,
56809 it will not stop the delivery of other mail.
56810 </para>
56811 <para>
56812 If the remote host specified support for the SIZE parameter in its response
56813 to EHLO, Exim adds SIZE=<emphasis>nnn</emphasis> to the MAIL command, so an
56814 over-large message will cause a message error because the error arrives as a
56815 response to MAIL.
56816 </para>
56817 </listitem></varlistentry>
56818 <varlistentry>
56819 <term><emphasis role="bold">Recipient errors</emphasis></term>
56820 <listitem>
56821 <para>
56822 <indexterm role="concept">
56823 <primary>recipient</primary>
56824 <secondary>error</secondary>
56825 </indexterm>
56826 A recipient error is associated with a particular recipient of a message. The
56827 recipient errors are:
56828 </para>
56829 <itemizedlist>
56830 <listitem>
56831 <para>
56832 Any error response to RCPT,
56833 </para>
56834 </listitem>
56835 <listitem>
56836 <para>
56837 Timeout after RCPT.
56838 </para>
56839 </listitem>
56840 </itemizedlist>
56841 <para>
56842 For a recipient error, a permanent error response (5<emphasis>xx</emphasis>) causes the
56843 recipient address to be failed, and a bounce message to be returned to the
56844 sender. A temporary error response (4<emphasis>xx</emphasis>) or a timeout causes the failing
56845 address to be deferred, and routing retry data to be created for it. This is
56846 used to delay processing of the address in subsequent queue runs, until its
56847 routing retry time arrives. This applies to all messages, but because it
56848 operates only in queue runs, one attempt will be made to deliver a new message
56849 to the failing address before the delay starts to operate. This ensures that,
56850 if the failure is really related to the message rather than the recipient
56851 (<quote>message too big for this recipient</quote> is a possible example), other messages
56852 have a chance of getting delivered. If a delivery to the address does succeed,
56853 the retry information gets cleared, so all stuck messages get tried again, and
56854 the retry clock is reset.
56855 </para>
56856 <para>
56857 The message is not added to the list of those waiting for this host. Use of the
56858 host for other messages is unaffected, and except in the case of a timeout,
56859 other recipients are processed independently, and may be successfully delivered
56860 in the current SMTP session. After a timeout it is of course impossible to
56861 proceed with the session, so all addresses get deferred. However, those other
56862 than the one that failed do not suffer any subsequent retry delays. Therefore,
56863 if one recipient is causing trouble, the others have a chance of getting
56864 through when a subsequent delivery attempt occurs before the failing
56865 recipient&#x2019;s retry time.
56866 </para>
56867 </listitem></varlistentry>
56868 </variablelist>
56869 <para>
56870 In all cases, if there are other hosts (or IP addresses) available for the
56871 current set of addresses (for example, from multiple MX records), they are
56872 tried in this run for any undelivered addresses, subject of course to their
56873 own retry data. In other words, recipient error retry data does not take effect
56874 until the next delivery attempt.
56875 </para>
56876 <para>
56877 Some hosts have been observed to give temporary error responses to every
56878 MAIL command at certain times (<quote>insufficient space</quote> has been seen). It
56879 would be nice if such circumstances could be recognized, and defer data for the
56880 host itself created, but this is not possible within the current Exim design.
56881 What actually happens is that retry data for every (host, message) combination
56882 is created.
56883 </para>
56884 <para>
56885 The reason that timeouts after MAIL and RCPT are treated specially is that
56886 these can sometimes arise as a result of the remote host&#x2019;s verification
56887 procedures. Exim makes this assumption, and treats them as if a temporary error
56888 response had been received. A timeout after <quote>.</quote> is treated specially because
56889 it is known that some broken implementations fail to recognize the end of the
56890 message if the last character of the last line is a binary zero. Thus, it is
56891 helpful to treat this case as a message error.
56892 </para>
56893 <para>
56894 Timeouts at other times are treated as host errors, assuming a problem with the
56895 host, or the connection to it. If a timeout after MAIL, RCPT,
56896 or <quote>.</quote> is really a connection problem, the assumption is that at the next try
56897 the timeout is likely to occur at some other point in the dialogue, causing it
56898 then to be treated as a host error.
56899 </para>
56900 <para>
56901 There is experimental evidence that some MTAs drop the connection after the
56902 terminating <quote>.</quote> if they do not like the contents of the message for some
56903 reason, in contravention of the RFC, which indicates that a 5<emphasis>xx</emphasis> response
56904 should be given. That is why Exim treats this case as a message rather than a
56905 host error, in order not to delay other messages to the same host.
56906 </para>
56907 </section>
56908 <section id="SECID233">
56909 <title>Incoming SMTP messages over TCP/IP</title>
56910 <para>
56911 <indexterm role="concept">
56912 <primary>SMTP</primary>
56913 <secondary>incoming over TCP/IP</secondary>
56914 </indexterm>
56915 <indexterm role="concept">
56916 <primary>incoming SMTP over TCP/IP</primary>
56917 </indexterm>
56918 <indexterm role="concept">
56919 <primary>inetd</primary>
56920 </indexterm>
56921 <indexterm role="concept">
56922 <primary>daemon</primary>
56923 </indexterm>
56924 Incoming SMTP messages can be accepted in one of two ways: by running a
56925 listening daemon, or by using <emphasis>inetd</emphasis>. In the latter case, the entry in
56926 <filename>/etc/inetd.conf</filename> should be like this:
56927 </para>
56928 <literallayout class="monospaced">
56929 smtp stream tcp nowait exim /opt/exim/bin/exim in.exim -bs
56930 </literallayout>
56931 <para>
56932 Exim distinguishes between this case and the case of a locally running user
56933 agent using the <option>-bs</option> option by checking whether or not the standard input is
56934 a socket. When it is, either the port must be privileged (less than 1024), or
56935 the caller must be root or the Exim user. If any other user passes a socket
56936 with an unprivileged port number, Exim prints a message on the standard error
56937 stream and exits with an error code.
56938 </para>
56939 <para>
56940 By default, Exim does not make a log entry when a remote host connects or
56941 disconnects (either via the daemon or <emphasis>inetd</emphasis>), unless the disconnection is
56942 unexpected. It can be made to write such log entries by setting the
56943 <option>smtp_connection</option> log selector.
56944 </para>
56945 <para>
56946 <indexterm role="concept">
56947 <primary>carriage return</primary>
56948 </indexterm>
56949 <indexterm role="concept">
56950 <primary>linefeed</primary>
56951 </indexterm>
56952 Commands from the remote host are supposed to be terminated by CR followed by
56953 LF. However, there are known to be hosts that do not send CR characters. In
56954 order to be able to interwork with such hosts, Exim treats LF on its own as a
56955 line terminator.
56956 Furthermore, because common code is used for receiving messages from all
56957 sources, a CR on its own is also interpreted as a line terminator. However, the
56958 sequence <quote>CR, dot, CR</quote> does not terminate incoming SMTP data.
56959 </para>
56960 <para>
56961 <indexterm role="concept">
56962 <primary>EHLO</primary>
56963 <secondary>invalid data</secondary>
56964 </indexterm>
56965 <indexterm role="concept">
56966 <primary>HELO</primary>
56967 <secondary>invalid data</secondary>
56968 </indexterm>
56969 One area that sometimes gives rise to problems concerns the EHLO or
56970 HELO commands. Some clients send syntactically invalid versions of these
56971 commands, which Exim rejects by default. (This is nothing to do with verifying
56972 the data that is sent, so <option>helo_verify_hosts</option> is not relevant.) You can tell
56973 Exim not to apply a syntax check by setting <option>helo_accept_junk_hosts</option> to
56974 match the broken hosts that send invalid commands.
56975 </para>
56976 <para>
56977 <indexterm role="concept">
56978 <primary>SIZE option on MAIL command</primary>
56979 </indexterm>
56980 <indexterm role="concept">
56981 <primary>MAIL</primary>
56982 <secondary>SIZE option</secondary>
56983 </indexterm>
56984 The amount of disk space available is checked whenever SIZE is received on
56985 a MAIL command, independently of whether <option>message_size_limit</option> or
56986 <option>check_spool_space</option> is configured, unless <option>smtp_check_spool_space</option> is set
56987 false. A temporary error is given if there is not enough space. If
56988 <option>check_spool_space</option> is set, the check is for that amount of space plus the
56989 value given with SIZE, that is, it checks that the addition of the incoming
56990 message will not reduce the space below the threshold.
56991 </para>
56992 <para>
56993 When a message is successfully received, Exim includes the local message id in
56994 its response to the final <quote>.</quote> that terminates the data. If the remote host
56995 logs this text it can help with tracing what has happened to a message.
56996 </para>
56997 <para>
56998 The Exim daemon can limit the number of simultaneous incoming connections it is
56999 prepared to handle (see the <option>smtp_accept_max</option> option). It can also limit the
57000 number of simultaneous incoming connections from a single remote host (see the
57001 <option>smtp_accept_max_per_host</option> option). Additional connection attempts are
57002 rejected using the SMTP temporary error code 421.
57003 </para>
57004 <para>
57005 The Exim daemon does not rely on the SIGCHLD signal to detect when a
57006 subprocess has finished, as this can get lost at busy times. Instead, it looks
57007 for completed subprocesses every time it wakes up. Provided there are other
57008 things happening (new incoming calls, starts of queue runs), completed
57009 processes will be noticed and tidied away. On very quiet systems you may
57010 sometimes see a <quote>defunct</quote> Exim process hanging about. This is not a problem;
57011 it will be noticed when the daemon next wakes up.
57012 </para>
57013 <para>
57014 When running as a daemon, Exim can reserve some SMTP slots for specific hosts,
57015 and can also be set up to reject SMTP calls from non-reserved hosts at times of
57016 high system load &ndash; for details see the <option>smtp_accept_reserve</option>,
57017 <option>smtp_load_reserve</option>, and <option>smtp_reserve_hosts</option> options. The load check
57018 applies in both the daemon and <emphasis>inetd</emphasis> cases.
57019 </para>
57020 <para>
57021 Exim normally starts a delivery process for each message received, though this
57022 can be varied by means of the <option>-odq</option> command line option and the
57023 <option>queue_only</option>, <option>queue_only_file</option>, and <option>queue_only_load</option> options. The
57024 number of simultaneously running delivery processes started in this way from
57025 SMTP input can be limited by the <option>smtp_accept_queue</option> and
57026 <option>smtp_accept_queue_per_connection</option> options. When either limit is reached,
57027 subsequently received messages are just put on the input queue without starting
57028 a delivery process.
57029 </para>
57030 <para>
57031 The controls that involve counts of incoming SMTP calls (<option>smtp_accept_max</option>,
57032 <option>smtp_accept_queue</option>, <option>smtp_accept_reserve</option>) are not available when Exim is
57033 started up from the <emphasis>inetd</emphasis> daemon, because in that case each connection is
57034 handled by an entirely independent Exim process. Control by load average is,
57035 however, available with <emphasis>inetd</emphasis>.
57036 </para>
57037 <para>
57038 Exim can be configured to verify addresses in incoming SMTP commands as they
57039 are received. See chapter <xref linkend="CHAPACL"/> for details. It can also be configured
57040 to rewrite addresses at this time &ndash; before any syntax checking is done. See
57041 section <xref linkend="SECTrewriteS"/>.
57042 </para>
57043 <para>
57044 Exim can also be configured to limit the rate at which a client host submits
57045 MAIL and RCPT commands in a single SMTP session. See the
57046 <option>smtp_ratelimit_hosts</option> option.
57047 </para>
57048 </section>
57049 <section id="SECID234">
57050 <title>Unrecognized SMTP commands</title>
57051 <para>
57052 <indexterm role="concept">
57053 <primary>SMTP</primary>
57054 <secondary>unrecognized commands</secondary>
57055 </indexterm>
57056 If Exim receives more than <option>smtp_max_unknown_commands</option> unrecognized SMTP
57057 commands during a single SMTP connection, it drops the connection after sending
57058 the error response to the last command. The default value for
57059 <option>smtp_max_unknown_commands</option> is 3. This is a defence against some kinds of
57060 abuse that subvert web servers into making connections to SMTP ports; in these
57061 circumstances, a number of non-SMTP lines are sent first.
57062 </para>
57063 </section>
57064 <section id="SECID235">
57065 <title>Syntax and protocol errors in SMTP commands</title>
57066 <para>
57067 <indexterm role="concept">
57068 <primary>SMTP</primary>
57069 <secondary>syntax errors</secondary>
57070 </indexterm>
57071 <indexterm role="concept">
57072 <primary>SMTP</primary>
57073 <secondary>protocol errors</secondary>
57074 </indexterm>
57075 A syntax error is detected if an SMTP command is recognized, but there is
57076 something syntactically wrong with its data, for example, a malformed email
57077 address in a RCPT command. Protocol errors include invalid command
57078 sequencing such as RCPT before MAIL. If Exim receives more than
57079 <option>smtp_max_synprot_errors</option> such commands during a single SMTP connection, it
57080 drops the connection after sending the error response to the last command. The
57081 default value for <option>smtp_max_synprot_errors</option> is 3. This is a defence against
57082 broken clients that loop sending bad commands (yes, it has been seen).
57083 </para>
57084 </section>
57085 <section id="SECID236">
57086 <title>Use of non-mail SMTP commands</title>
57087 <para>
57088 <indexterm role="concept">
57089 <primary>SMTP</primary>
57090 <secondary>non-mail commands</secondary>
57091 </indexterm>
57092 The <quote>non-mail</quote> SMTP commands are those other than MAIL, RCPT, and
57093 DATA. Exim counts such commands, and drops the connection if there are too
57094 many of them in a single SMTP session. This action catches some
57095 denial-of-service attempts and things like repeated failing AUTHs, or a mad
57096 client looping sending EHLO. The global option <option>smtp_accept_max_nonmail</option>
57097 defines what <quote>too many</quote> means. Its default value is 10.
57098 </para>
57099 <para>
57100 When a new message is expected, one occurrence of RSET is not counted. This
57101 allows a client to send one RSET between messages (this is not necessary,
57102 but some clients do it). Exim also allows one uncounted occurrence of HELO
57103 or EHLO, and one occurrence of STARTTLS between messages. After
57104 starting up a TLS session, another EHLO is expected, and so it too is not
57105 counted.
57106 </para>
57107 <para>
57108 The first occurrence of AUTH in a connection, or immediately following
57109 STARTTLS is also not counted. Otherwise, all commands other than MAIL,
57110 RCPT, DATA, and QUIT are counted.
57111 </para>
57112 <para>
57113 You can control which hosts are subject to the limit set by
57114 <option>smtp_accept_max_nonmail</option> by setting
57115 <option>smtp_accept_max_nonmail_hosts</option>. The default value is <literal>*</literal>, which makes
57116 the limit apply to all hosts. This option means that you can exclude any
57117 specific badly-behaved hosts that you have to live with.
57118 </para>
57119 </section>
57120 <section id="SECID237">
57121 <title>The VRFY and EXPN commands</title>
57122 <para>
57123 When Exim receives a VRFY or EXPN command on a TCP/IP connection, it
57124 runs the ACL specified by <option>acl_smtp_vrfy</option> or <option>acl_smtp_expn</option> (as
57125 appropriate) in order to decide whether the command should be accepted or not.
57126 If no ACL is defined, the command is rejected.
57127 </para>
57128 <para>
57129 <indexterm role="concept">
57130 <primary>VRFY</primary>
57131 <secondary>processing</secondary>
57132 </indexterm>
57133 When VRFY is accepted, it runs exactly the same code as when Exim is
57134 called with the <option>-bv</option> option.
57135 </para>
57136 <para>
57137 <indexterm role="concept">
57138 <primary>EXPN</primary>
57139 <secondary>processing</secondary>
57140 </indexterm>
57141 When EXPN is accepted, a single-level expansion of the address is done.
57142 EXPN is treated as an <quote>address test</quote> (similar to the <option>-bt</option> option) rather
57143 than a verification (the <option>-bv</option> option). If an unqualified local part is given
57144 as the argument to EXPN, it is qualified with <option>qualify_domain</option>. Rejections
57145 of VRFY and EXPN commands are logged on the main and reject logs, and
57146 VRFY verification failures are logged on the main log for consistency with
57147 RCPT failures.
57148 </para>
57149 </section>
57150 <section id="SECTETRN">
57151 <title>The ETRN command</title>
57152 <para>
57153 <indexterm role="concept">
57154 <primary>ETRN</primary>
57155 <secondary>processing</secondary>
57156 </indexterm>
57157 RFC 1985 describes an SMTP command called ETRN that is designed to
57158 overcome the security problems of the TURN command (which has fallen into
57159 disuse). When Exim receives an ETRN command on a TCP/IP connection, it runs
57160 the ACL specified by <option>acl_smtp_etrn</option> in order to decide whether the command
57161 should be accepted or not. If no ACL is defined, the command is rejected.
57162 </para>
57163 <para>
57164 The ETRN command is concerned with <quote>releasing</quote> messages that are awaiting
57165 delivery to certain hosts. As Exim does not organize its message queue by host,
57166 the only form of ETRN that is supported by default is the one where the
57167 text starts with the <quote>#</quote> prefix, in which case the remainder of the text is
57168 specific to the SMTP server. A valid ETRN command causes a run of Exim with
57169 the <option>-R</option> option to happen, with the remainder of the ETRN text as its
57170 argument. For example,
57171 </para>
57172 <literallayout class="monospaced">
57173 ETRN #brigadoon
57174 </literallayout>
57175 <para>
57176 runs the command
57177 </para>
57178 <literallayout class="monospaced">
57179 exim -R brigadoon
57180 </literallayout>
57181 <para>
57182 which causes a delivery attempt on all messages with undelivered addresses
57183 containing the text <quote>brigadoon</quote>. When <option>smtp_etrn_serialize</option> is set (the
57184 default), Exim prevents the simultaneous execution of more than one queue run
57185 for the same argument string as a result of an ETRN command. This stops
57186 a misbehaving client from starting more than one queue runner at once.
57187 </para>
57188 <para>
57189 <indexterm role="concept">
57190 <primary>hints database</primary>
57191 <secondary>ETRN serialization</secondary>
57192 </indexterm>
57193 Exim implements the serialization by means of a hints database in which a
57194 record is written whenever a process is started by ETRN, and deleted when
57195 the process completes. However, Exim does not keep the SMTP session waiting for
57196 the ETRN process to complete. Once ETRN is accepted, the client is sent
57197 a <quote>success</quote> return code. Obviously there is scope for hints records to get
57198 left lying around if there is a system or program crash. To guard against this,
57199 Exim ignores any records that are more than six hours old.
57200 </para>
57201 <para>
57202 <indexterm role="option">
57203 <primary><option>smtp_etrn_command</option></primary>
57204 </indexterm>
57205 For more control over what ETRN does, the <option>smtp_etrn_command</option> option can
57206 used. This specifies a command that is run whenever ETRN is received,
57207 whatever the form of its argument. For
57208 example:
57209 </para>
57210 <literallayout class="monospaced">
57211 smtp_etrn_command = /etc/etrn_command $domain \
57212                     $sender_host_address
57213 </literallayout>
57214 <para>
57215 <indexterm role="variable">
57216 <primary><varname>$domain</varname></primary>
57217 </indexterm>
57218 The string is split up into arguments which are independently expanded. The
57219 expansion variable <varname>$domain</varname> is set to the argument of the ETRN command,
57220 and no syntax checking is done on the contents of this argument. Exim does not
57221 wait for the command to complete, so its status code is not checked. Exim runs
57222 under its own uid and gid when receiving incoming SMTP, so it is not possible
57223 for it to change them before running the command.
57224 </para>
57225 </section>
57226 <section id="SECID238">
57227 <title>Incoming local SMTP</title>
57228 <para>
57229 <indexterm role="concept">
57230 <primary>SMTP</primary>
57231 <secondary>local incoming</secondary>
57232 </indexterm>
57233 Some user agents use SMTP to pass messages to their local MTA using the
57234 standard input and output, as opposed to passing the envelope on the command
57235 line and writing the message to the standard input. This is supported by the
57236 <option>-bs</option> option. This form of SMTP is handled in the same way as incoming
57237 messages over TCP/IP (including the use of ACLs), except that the envelope
57238 sender given in a MAIL command is ignored unless the caller is trusted. In
57239 an ACL you can detect this form of SMTP input by testing for an empty host
57240 identification. It is common to have this as the first line in the ACL that
57241 runs for RCPT commands:
57242 </para>
57243 <literallayout class="monospaced">
57244 accept hosts = :
57245 </literallayout>
57246 <para>
57247 This accepts SMTP messages from local processes without doing any other tests.
57248 </para>
57249 </section>
57250 <section id="SECTbatchSMTP">
57251 <title>Outgoing batched SMTP</title>
57252 <para>
57253 <indexterm role="concept">
57254 <primary>SMTP</primary>
57255 <secondary>batched outgoing</secondary>
57256 </indexterm>
57257 <indexterm role="concept">
57258 <primary>batched SMTP output</primary>
57259 </indexterm>
57260 Both the <command>appendfile</command> and <command>pipe</command> transports can be used for handling
57261 batched SMTP. Each has an option called <option>use_bsmtp</option> which causes messages to
57262 be output in BSMTP format. No SMTP responses are possible for this form of
57263 delivery. All it is doing is using SMTP commands as a way of transmitting the
57264 envelope along with the message.
57265 </para>
57266 <para>
57267 The message is written to the file or pipe preceded by the SMTP commands
57268 MAIL and RCPT, and followed by a line containing a single dot. Lines in
57269 the message that start with a dot have an extra dot added. The SMTP command
57270 HELO is not normally used. If it is required, the <option>message_prefix</option> option
57271 can be used to specify it.
57272 </para>
57273 <para>
57274 Because <command>appendfile</command> and <command>pipe</command> are both local transports, they accept only
57275 one recipient address at a time by default. However, you can arrange for them
57276 to handle several addresses at once by setting the <option>batch_max</option> option. When
57277 this is done for BSMTP, messages may contain multiple RCPT commands. See
57278 chapter <xref linkend="CHAPbatching"/> for more details.
57279 </para>
57280 <para>
57281 <indexterm role="variable">
57282 <primary><varname>$host</varname></primary>
57283 </indexterm>
57284 When one or more addresses are routed to a BSMTP transport by a router that
57285 sets up a host list, the name of the first host on the list is available to the
57286 transport in the variable <varname>$host</varname>. Here is an example of such a transport and
57287 router:
57288 </para>
57289 <literallayout class="monospaced">
57290 begin routers
57291 route_append:
57292   driver = manualroute
57293   transport = smtp_appendfile
57294   route_list = domain.example  batch.host.example
57295
57296 begin transports
57297 smtp_appendfile:
57298   driver = appendfile
57299   directory = /var/bsmtp/$host
57300   batch_max = 1000
57301   use_bsmtp
57302   user = exim
57303 </literallayout>
57304 <para>
57305 This causes messages addressed to <emphasis>domain.example</emphasis> to be written in BSMTP
57306 format to <filename>/var/bsmtp/batch.host.example</filename>, with only a single copy of each
57307 message (unless there are more than 1000 recipients).
57308 </para>
57309 </section>
57310 <section id="SECTincomingbatchedSMTP">
57311 <title>Incoming batched SMTP</title>
57312 <para>
57313 <indexterm role="concept">
57314 <primary>SMTP</primary>
57315 <secondary>batched incoming</secondary>
57316 </indexterm>
57317 <indexterm role="concept">
57318 <primary>batched SMTP input</primary>
57319 </indexterm>
57320 The <option>-bS</option> command line option causes Exim to accept one or more messages by
57321 reading SMTP on the standard input, but to generate no responses. If the caller
57322 is trusted, the senders in the MAIL commands are believed; otherwise the
57323 sender is always the caller of Exim. Unqualified senders and receivers are not
57324 rejected (there seems little point) but instead just get qualified. HELO
57325 and EHLO act as RSET; VRFY, EXPN, ETRN and  HELP, act
57326 as NOOP; QUIT quits.
57327 </para>
57328 <para>
57329 Minimal policy checking is done for BSMTP input. Only the non-SMTP
57330 ACL is run in the same way as for non-SMTP local input.
57331 </para>
57332 <para>
57333 If an error is detected while reading a message, including a missing <quote>.</quote> at
57334 the end, Exim gives up immediately. It writes details of the error to the
57335 standard output in a stylized way that the calling program should be able to
57336 make some use of automatically, for example:
57337 </para>
57338 <literallayout class="monospaced">
57339 554 Unexpected end of file
57340 Transaction started in line 10
57341 Error detected in line 14
57342 </literallayout>
57343 <para>
57344 It writes a more verbose version, for human consumption, to the standard error
57345 file, for example:
57346 </para>
57347 <literallayout class="monospaced">
57348 An error was detected while processing a file of BSMTP input.
57349 The error message was:
57350
57351 501 '&gt;' missing at end of address
57352
57353 The SMTP transaction started in line 10.
57354 The error was detected in line 12.
57355 The SMTP command at fault was:
57356
57357 rcpt to:&lt;malformed@in.com.plete
57358
57359 1 previous message was successfully processed.
57360 The rest of the batch was abandoned.
57361 </literallayout>
57362 <para>
57363 The return code from Exim is zero only if there were no errors. It is 1 if some
57364 messages were accepted before an error was detected, and 2 if no messages were
57365 accepted.
57366 <indexterm role="concept" startref="IIDsmtpproc1" class="endofrange"/>
57367 <indexterm role="concept" startref="IIDsmtpproc2" class="endofrange"/>
57368 </para>
57369 </section>
57370 </chapter>
57371
57372 <chapter id="CHAPemsgcust">
57373 <title>Customizing bounce and warning messages</title>
57374 <titleabbrev>Customizing messages</titleabbrev>
57375 <para>
57376 When a message fails to be delivered, or remains on the queue for more than a
57377 configured amount of time, Exim sends a message to the original sender, or
57378 to an alternative configured address. The text of these messages is built into
57379 the code of Exim, but it is possible to change it, either by adding a single
57380 string, or by replacing each of the paragraphs by text supplied in a file.
57381 </para>
57382 <para>
57383 The <emphasis>From:</emphasis> and <emphasis>To:</emphasis> header lines are automatically generated; you can
57384 cause a <emphasis>Reply-To:</emphasis> line to be added by setting the <option>errors_reply_to</option>
57385 option. Exim also adds the line
57386 </para>
57387 <literallayout class="monospaced">
57388 Auto-Submitted: auto-generated
57389 </literallayout>
57390 <para>
57391 to all warning and bounce messages,
57392 </para>
57393 <section id="SECID239">
57394 <title>Customizing bounce messages</title>
57395 <para>
57396 <indexterm role="concept">
57397 <primary>customizing</primary>
57398 <secondary>bounce message</secondary>
57399 </indexterm>
57400 <indexterm role="concept">
57401 <primary>bounce message</primary>
57402 <secondary>customizing</secondary>
57403 </indexterm>
57404 If <option>bounce_message_text</option> is set, its contents are included in the default
57405 message immediately after <quote>This message was created automatically by mail
57406 delivery software.</quote> The string is not expanded. It is not used if
57407 <option>bounce_message_file</option> is set.
57408 </para>
57409 <para>
57410 When <option>bounce_message_file</option> is set, it must point to a template file for
57411 constructing error messages. The file consists of a series of text items,
57412 separated by lines consisting of exactly four asterisks. If the file cannot be
57413 opened, default text is used and a message is written to the main and panic
57414 logs. If any text item in the file is empty, default text is used for that
57415 item.
57416 </para>
57417 <para>
57418 <indexterm role="variable">
57419 <primary><varname>$bounce_recipient</varname></primary>
57420 </indexterm>
57421 <indexterm role="variable">
57422 <primary><varname>$bounce_return_size_limit</varname></primary>
57423 </indexterm>
57424 Each item of text that is read from the file is expanded, and there are two
57425 expansion variables which can be of use here: <varname>$bounce_recipient</varname> is set to
57426 the recipient of an error message while it is being created, and
57427 <varname>$bounce_return_size_limit</varname> contains the value of the <option>return_size_limit</option>
57428 option, rounded to a whole number.
57429 </para>
57430 <para>
57431 The items must appear in the file in the following order:
57432 </para>
57433 <itemizedlist>
57434 <listitem>
57435 <para>
57436 The first item is included in the headers, and should include at least a
57437 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
57438 </para>
57439 </listitem>
57440 <listitem>
57441 <para>
57442 The second item forms the start of the error message. After it, Exim lists the
57443 failing addresses with their error messages.
57444 </para>
57445 </listitem>
57446 <listitem>
57447 <para>
57448 The third item is used to introduce any text from pipe transports that is to be
57449 returned to the sender. It is omitted if there is no such text.
57450 </para>
57451 </listitem>
57452 <listitem>
57453 <para>
57454 The fourth item is used to introduce the copy of the message that is returned
57455 as part of the error report.
57456 </para>
57457 </listitem>
57458 <listitem>
57459 <para>
57460 The fifth item is added after the fourth one if the returned message is
57461 truncated because it is bigger than <option>return_size_limit</option>.
57462 </para>
57463 </listitem>
57464 <listitem>
57465 <para>
57466 The sixth item is added after the copy of the original message.
57467 </para>
57468 </listitem>
57469 </itemizedlist>
57470 <para>
57471 The default state (<option>bounce_message_file</option> unset) is equivalent to the
57472 following file, in which the sixth item is empty. The <emphasis>Subject:</emphasis> and some
57473 other lines have been split in order to fit them on the page:
57474 </para>
57475 <literallayout class="monospaced">
57476 Subject: Mail delivery failed
57477   ${if eq{$sender_address}{$bounce_recipient}
57478   {: returning message to sender}}
57479 ****
57480 This message was created automatically by mail delivery software.
57481
57482 A message ${if eq{$sender_address}{$bounce_recipient}
57483   {that you sent }{sent by
57484
57485 &lt;$sender_address&gt;
57486
57487 }}could not be delivered to all of its recipients.
57488 This is a permanent error. The following address(es) failed:
57489 ****
57490 The following text was generated during the delivery attempt(s):
57491 ****
57492 ------ This is a copy of the message, including all the headers.
57493   ------
57494 ****
57495 ------ The body of the message is $message_size characters long;
57496   only the first
57497 ------ $bounce_return_size_limit or so are included here.
57498 ****
57499 </literallayout>
57500 </section>
57501 <section id="SECTcustwarn">
57502 <title>Customizing warning messages</title>
57503 <para>
57504 <indexterm role="concept">
57505 <primary>customizing</primary>
57506 <secondary>warning message</secondary>
57507 </indexterm>
57508 <indexterm role="concept">
57509 <primary>warning of delay</primary>
57510 <secondary>customizing the message</secondary>
57511 </indexterm>
57512 The option <option>warn_message_file</option> can be pointed at a template file for use when
57513 warnings about message delays are created. In this case there are only three
57514 text sections:
57515 </para>
57516 <itemizedlist>
57517 <listitem>
57518 <para>
57519 The first item is included in the headers, and should include at least a
57520 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
57521 </para>
57522 </listitem>
57523 <listitem>
57524 <para>
57525 The second item forms the start of the warning message. After it, Exim lists
57526 the delayed addresses.
57527 </para>
57528 </listitem>
57529 <listitem>
57530 <para>
57531 The third item then ends the message.
57532 </para>
57533 </listitem>
57534 </itemizedlist>
57535 <para>
57536 The default state is equivalent to the following file, except that some lines
57537 have been split here, in order to fit them on the page:
57538 </para>
57539 <literallayout class="monospaced">
57540 Subject: Warning: message $message_exim_id delayed
57541   $warn_message_delay
57542 ****
57543 This message was created automatically by mail delivery software.
57544
57545 A message ${if eq{$sender_address}{$warn_message_recipients}
57546 {that you sent }{sent by
57547
57548 &lt;$sender_address&gt;
57549
57550 }}has not been delivered to all of its recipients after
57551 more than $warn_message_delay on the queue on $primary_hostname.
57552
57553 The message identifier is:     $message_exim_id
57554 The subject of the message is: $h_subject
57555 The date of the message is:    $h_date
57556
57557 The following address(es) have not yet been delivered:
57558 ****
57559 No action is required on your part. Delivery attempts will
57560 continue for some time, and this warning may be repeated at
57561 intervals if the message remains undelivered. Eventually the
57562 mail delivery software will give up, and when that happens,
57563 the message will be returned to you.
57564 </literallayout>
57565 <para>
57566 <indexterm role="variable">
57567 <primary><varname>$warn_message_delay</varname></primary>
57568 </indexterm>
57569 <indexterm role="variable">
57570 <primary><varname>$warn_message_recipients</varname></primary>
57571 </indexterm>
57572 However, in the default state the subject and date lines are omitted if no
57573 appropriate headers exist. During the expansion of this file,
57574 <varname>$warn_message_delay</varname> is set to the delay time in one of the forms <quote>&lt;<emphasis>n</emphasis>&gt;
57575 minutes</quote> or <quote>&lt;<emphasis>n</emphasis>&gt; hours</quote>, and <varname>$warn_message_recipients</varname> contains a list
57576 of recipients for the warning message. There may be more than one if there are
57577 multiple addresses with different <option>errors_to</option> settings on the routers that
57578 handled them.
57579 </para>
57580 </section>
57581 </chapter>
57582
57583 <chapter id="CHAPcomconreq">
57584 <title>Some common configuration settings</title>
57585 <para>
57586 This chapter discusses some configuration settings that seem to be fairly
57587 common. More examples and discussion can be found in the Exim book.
57588 </para>
57589 <section id="SECID240">
57590 <title>Sending mail to a smart host</title>
57591 <para>
57592 <indexterm role="concept">
57593 <primary>smart host</primary>
57594 <secondary>example router</secondary>
57595 </indexterm>
57596 If you want to send all mail for non-local domains to a <quote>smart host</quote>, you
57597 should replace the default <command>dnslookup</command> router with a router which does the
57598 routing explicitly:
57599 </para>
57600 <literallayout class="monospaced">
57601 send_to_smart_host:
57602   driver = manualroute
57603   route_list = !+local_domains smart.host.name
57604   transport = remote_smtp
57605 </literallayout>
57606 <para>
57607 You can use the smart host&#x2019;s IP address instead of the name if you wish.
57608 If you are using Exim only to submit messages to a smart host, and not for
57609 receiving incoming messages, you can arrange for it to do the submission
57610 synchronously by setting the <option>mua_wrapper</option> option (see chapter
57611 <xref linkend="CHAPnonqueueing"/>).
57612 </para>
57613 </section>
57614 <section id="SECTmailinglists">
57615 <title>Using Exim to handle mailing lists</title>
57616 <para>
57617 <indexterm role="concept">
57618 <primary>mailing lists</primary>
57619 </indexterm>
57620 Exim can be used to run simple mailing lists, but for large and/or complicated
57621 requirements, the use of additional specialized mailing list software such as
57622 Majordomo or Mailman is recommended.
57623 </para>
57624 <para>
57625 The <command>redirect</command> router can be used to handle mailing lists where each list
57626 is maintained in a separate file, which can therefore be managed by an
57627 independent manager. The <option>domains</option> router option can be used to run these
57628 lists in a separate domain from normal mail. For example:
57629 </para>
57630 <literallayout class="monospaced">
57631 lists:
57632   driver = redirect
57633   domains = lists.example
57634   file = /usr/lists/$local_part
57635   forbid_pipe
57636   forbid_file
57637   errors_to = $local_part-request@lists.example
57638   no_more
57639 </literallayout>
57640 <para>
57641 This router is skipped for domains other than <emphasis>lists.example</emphasis>. For addresses
57642 in that domain, it looks for a file that matches the local part. If there is no
57643 such file, the router declines, but because <option>no_more</option> is set, no subsequent
57644 routers are tried, and so the whole delivery fails.
57645 </para>
57646 <para>
57647 The <option>forbid_pipe</option> and <option>forbid_file</option> options prevent a local part from being
57648 expanded into a file name or a pipe delivery, which is usually inappropriate in
57649 a mailing list.
57650 </para>
57651 <para>
57652 <indexterm role="option">
57653 <primary><option>errors_to</option></primary>
57654 </indexterm>
57655 The <option>errors_to</option> option specifies that any delivery errors caused by addresses
57656 taken from a mailing list are to be sent to the given address rather than the
57657 original sender of the message. However, before acting on this, Exim verifies
57658 the error address, and ignores it if verification fails.
57659 </para>
57660 <para>
57661 For example, using the configuration above, mail sent to
57662 <emphasis>dicts@lists.example</emphasis> is passed on to those addresses contained in
57663 <filename>/usr/lists/dicts</filename>, with error reports directed to
57664 <emphasis>dicts-request@lists.example</emphasis>, provided that this address can be verified.
57665 There could be a file called <filename>/usr/lists/dicts-request</filename> containing
57666 the address(es) of this particular list&#x2019;s manager(s), but other approaches,
57667 such as setting up an earlier router (possibly using the <option>local_part_prefix</option>
57668 or <option>local_part_suffix</option> options) to handle addresses of the form
57669 <option>owner-</option><emphasis>xxx</emphasis> or <option>xxx-</option><emphasis>request</emphasis>, are also possible.
57670 </para>
57671 </section>
57672 <section id="SECID241">
57673 <title>Syntax errors in mailing lists</title>
57674 <para>
57675 <indexterm role="concept">
57676 <primary>mailing lists</primary>
57677 <secondary>syntax errors in</secondary>
57678 </indexterm>
57679 If an entry in redirection data contains a syntax error, Exim normally defers
57680 delivery of the original address. That means that a syntax error in a mailing
57681 list holds up all deliveries to the list. This may not be appropriate when a
57682 list is being maintained automatically from data supplied by users, and the
57683 addresses are not rigorously checked.
57684 </para>
57685 <para>
57686 If the <option>skip_syntax_errors</option> option is set, the <command>redirect</command> router just skips
57687 entries that fail to parse, noting the incident in the log. If in addition
57688 <option>syntax_errors_to</option> is set to a verifiable address, a message is sent to it
57689 whenever a broken address is skipped. It is usually appropriate to set
57690 <option>syntax_errors_to</option> to the same address as <option>errors_to</option>.
57691 </para>
57692 </section>
57693 <section id="SECID242">
57694 <title>Re-expansion of mailing lists</title>
57695 <para>
57696 <indexterm role="concept">
57697 <primary>mailing lists</primary>
57698 <secondary>re-expansion of</secondary>
57699 </indexterm>
57700 Exim remembers every individual address to which a message has been delivered,
57701 in order to avoid duplication, but it normally stores only the original
57702 recipient addresses with a message. If all the deliveries to a mailing list
57703 cannot be done at the first attempt, the mailing list is re-expanded when the
57704 delivery is next tried. This means that alterations to the list are taken into
57705 account at each delivery attempt, so addresses that have been added to
57706 the list since the message arrived will therefore receive a copy of the
57707 message, even though it pre-dates their subscription.
57708 </para>
57709 <para>
57710 If this behaviour is felt to be undesirable, the <option>one_time</option> option can be set
57711 on the <command>redirect</command> router. If this is done, any addresses generated by the
57712 router that fail to deliver at the first attempt are added to the message as
57713 <quote>top level</quote> addresses, and the parent address that generated them is marked
57714 <quote>delivered</quote>. Thus, expansion of the mailing list does not happen again at the
57715 subsequent delivery attempts. The disadvantage of this is that if any of the
57716 failing addresses are incorrect, correcting them in the file has no effect on
57717 pre-existing messages.
57718 </para>
57719 <para>
57720 The original top-level address is remembered with each of the generated
57721 addresses, and is output in any log messages. However, any intermediate parent
57722 addresses are not recorded. This makes a difference to the log only if the
57723 <option>all_parents</option> selector is set, but for mailing lists there is normally only
57724 one level of expansion anyway.
57725 </para>
57726 </section>
57727 <section id="SECID243">
57728 <title>Closed mailing lists</title>
57729 <para>
57730 <indexterm role="concept">
57731 <primary>mailing lists</primary>
57732 <secondary>closed</secondary>
57733 </indexterm>
57734 The examples so far have assumed open mailing lists, to which anybody may
57735 send mail. It is also possible to set up closed lists, where mail is accepted
57736 from specified senders only. This is done by making use of the generic
57737 <option>senders</option> option to restrict the router that handles the list.
57738 </para>
57739 <para>
57740 The following example uses the same file as a list of recipients and as a list
57741 of permitted senders. It requires three routers:
57742 </para>
57743 <literallayout class="monospaced">
57744 lists_request:
57745   driver = redirect
57746   domains = lists.example
57747   local_part_suffix = -request
57748   file = /usr/lists/$local_part$local_part_suffix
57749   no_more
57750
57751 lists_post:
57752   driver = redirect
57753   domains = lists.example
57754   senders = ${if exists {/usr/lists/$local_part}\
57755              {lsearch;/usr/lists/$local_part}{*}}
57756   file = /usr/lists/$local_part
57757   forbid_pipe
57758   forbid_file
57759   errors_to = $local_part-request@lists.example
57760   no_more
57761
57762 lists_closed:
57763   driver = redirect
57764   domains = lists.example
57765   allow_fail
57766   data = :fail: $local_part@lists.example is a closed mailing list
57767 </literallayout>
57768 <para>
57769 All three routers have the same <option>domains</option> setting, so for any other domains,
57770 they are all skipped. The first router runs only if the local part ends in
57771 <option>-request</option>. It handles messages to the list manager(s) by means of an open
57772 mailing list.
57773 </para>
57774 <para>
57775 The second router runs only if the <option>senders</option> precondition is satisfied. It
57776 checks for the existence of a list that corresponds to the local part, and then
57777 checks that the sender is on the list by means of a linear search. It is
57778 necessary to check for the existence of the file before trying to search it,
57779 because otherwise Exim thinks there is a configuration error. If the file does
57780 not exist, the expansion of <option>senders</option> is *, which matches all senders. This
57781 means that the router runs, but because there is no list, declines, and
57782 <option>no_more</option> ensures that no further routers are run. The address fails with an
57783 <quote>unrouteable address</quote> error.
57784 </para>
57785 <para>
57786 The third router runs only if the second router is skipped, which happens when
57787 a mailing list exists, but the sender is not on it. This router forcibly fails
57788 the address, giving a suitable error message.
57789 </para>
57790 </section>
57791 <section id="SECTverp">
57792 <title>Variable Envelope Return Paths (VERP)</title>
57793 <para>
57794 <indexterm role="concept">
57795 <primary>VERP</primary>
57796 </indexterm>
57797 <indexterm role="concept">
57798 <primary>Variable Envelope Return Paths</primary>
57799 </indexterm>
57800 <indexterm role="concept">
57801 <primary>envelope sender</primary>
57802 </indexterm>
57803 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;
57804 are a way of helping mailing list administrators discover which subscription
57805 address is the cause of a particular delivery failure. The idea is to encode
57806 the original recipient address in the outgoing envelope sender address, so that
57807 if the message is forwarded by another host and then subsequently bounces, the
57808 original recipient can be extracted from the recipient address of the bounce.
57809 </para>
57810 <para>
57811 <indexterm role="option">
57812 <primary><option>errors_to</option></primary>
57813 </indexterm>
57814 <indexterm role="option">
57815 <primary><option>return_path</option></primary>
57816 </indexterm>
57817 Envelope sender addresses can be modified by Exim using two different
57818 facilities: the <option>errors_to</option> option on a router (as shown in previous mailing
57819 list examples), or the <option>return_path</option> option on a transport. The second of
57820 these is effective only if the message is successfully delivered to another
57821 host; it is not used for errors detected on the local host (see the description
57822 of <option>return_path</option> in chapter <xref linkend="CHAPtransportgeneric"/>). Here is an example
57823 of the use of <option>return_path</option> to implement VERP on an <command>smtp</command> transport:
57824 </para>
57825 <literallayout class="monospaced">
57826 verp_smtp:
57827   driver = smtp
57828   max_rcpt = 1
57829   return_path = \
57830     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
57831       {$1-request+$local_part=$domain@your.dom.example}fail}
57832 </literallayout>
57833 <para>
57834 This has the effect of rewriting the return path (envelope sender) on outgoing
57835 SMTP messages, if the local part of the original return path ends in
57836 <quote>-request</quote>, and the domain is <emphasis>your.dom.example</emphasis>. The rewriting inserts the
57837 local part and domain of the recipient into the return path. Suppose, for
57838 example, that a message whose return path has been set to
57839 <emphasis>somelist-request@your.dom.example</emphasis> is sent to
57840 <emphasis>subscriber@other.dom.example</emphasis>. In the transport, the return path is
57841 rewritten as
57842 </para>
57843 <literallayout class="monospaced">
57844 somelist-request+subscriber=other.dom.example@your.dom.example
57845 </literallayout>
57846 <para>
57847 <indexterm role="variable">
57848 <primary><varname>$local_part</varname></primary>
57849 </indexterm>
57850 For this to work, you must tell Exim to send multiple copies of messages that
57851 have more than one recipient, so that each copy has just one recipient. This is
57852 achieved by setting <option>max_rcpt</option> to 1. Without this, a single copy of a message
57853 might be sent to several different recipients in the same domain, in which case
57854 <varname>$local_part</varname> is not available in the transport, because it is not unique.
57855 </para>
57856 <para>
57857 Unless your host is doing nothing but mailing list deliveries, you should
57858 probably use a separate transport for the VERP deliveries, so as not to use
57859 extra resources in making one-per-recipient copies for other deliveries. This
57860 can easily be done by expanding the <option>transport</option> option in the router:
57861 </para>
57862 <literallayout class="monospaced">
57863 dnslookup:
57864   driver = dnslookup
57865   domains = ! +local_domains
57866   transport = \
57867     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
57868       {verp_smtp}{remote_smtp}}
57869   no_more
57870 </literallayout>
57871 <para>
57872 If you want to change the return path using <option>errors_to</option> in a router instead
57873 of using <option>return_path</option> in the transport, you need to set <option>errors_to</option> on all
57874 routers that handle mailing list addresses. This will ensure that all delivery
57875 errors, including those detected on the local host, are sent to the VERP
57876 address.
57877 </para>
57878 <para>
57879 On a host that does no local deliveries and has no manual routing, only the
57880 <command>dnslookup</command> router needs to be changed. A special transport is not needed for
57881 SMTP deliveries. Every mailing list recipient has its own return path value,
57882 and so Exim must hand them to the transport one at a time. Here is an example
57883 of a <command>dnslookup</command> router that implements VERP:
57884 </para>
57885 <literallayout class="monospaced">
57886 verp_dnslookup:
57887   driver = dnslookup
57888   domains = ! +local_domains
57889   transport = remote_smtp
57890   errors_to = \
57891     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}}
57892      {$1-request+$local_part=$domain@your.dom.example}fail}
57893   no_more
57894 </literallayout>
57895 <para>
57896 Before you start sending out messages with VERPed return paths, you must also
57897 configure Exim to accept the bounce messages that come back to those paths.
57898 Typically this is done by setting a <option>local_part_suffix</option> option for a
57899 router, and using this to route the messages to wherever you want to handle
57900 them.
57901 </para>
57902 <para>
57903 The overhead incurred in using VERP depends very much on the size of the
57904 message, the number of recipient addresses that resolve to the same remote
57905 host, and the speed of the connection over which the message is being sent. If
57906 a lot of addresses resolve to the same host and the connection is slow, sending
57907 a separate copy of the message for each address may take substantially longer
57908 than sending a single copy with many recipients (for which VERP cannot be
57909 used).
57910 </para>
57911 </section>
57912 <section id="SECTvirtualdomains">
57913 <title>Virtual domains</title>
57914 <para>
57915 <indexterm role="concept">
57916 <primary>virtual domains</primary>
57917 </indexterm>
57918 <indexterm role="concept">
57919 <primary>domain</primary>
57920 <secondary>virtual</secondary>
57921 </indexterm>
57922 The phrase <emphasis>virtual domain</emphasis> is unfortunately used with two rather different
57923 meanings:
57924 </para>
57925 <itemizedlist>
57926 <listitem>
57927 <para>
57928 A domain for which there are no real mailboxes; all valid local parts are
57929 aliases for other email addresses. Common examples are organizational
57930 top-level domains and <quote>vanity</quote> domains.
57931 </para>
57932 </listitem>
57933 <listitem>
57934 <para>
57935 One of a number of independent domains that are all handled by the same host,
57936 with mailboxes on that host, but where the mailbox owners do not necessarily
57937 have login accounts on that host.
57938 </para>
57939 </listitem>
57940 </itemizedlist>
57941 <para>
57942 The first usage is probably more common, and does seem more <quote>virtual</quote> than
57943 the second. This kind of domain can be handled in Exim with a straightforward
57944 aliasing router. One approach is to create a separate alias file for each
57945 virtual domain. Exim can test for the existence of the alias file to determine
57946 whether the domain exists. The <command>dsearch</command> lookup type is useful here, leading
57947 to a router of this form:
57948 </para>
57949 <literallayout class="monospaced">
57950 virtual:
57951   driver = redirect
57952   domains = dsearch;/etc/mail/virtual
57953   data = ${lookup{$local_part}lsearch{/etc/mail/virtual/$domain}}
57954   no_more
57955 </literallayout>
57956 <para>
57957 The <option>domains</option> option specifies that the router is to be skipped, unless there
57958 is a file in the <filename>/etc/mail/virtual</filename> directory whose name is the same as the
57959 domain that is being processed. When the router runs, it looks up the local
57960 part in the file to find a new address (or list of addresses). The <option>no_more</option>
57961 setting ensures that if the lookup fails (leading to <option>data</option> being an empty
57962 string), Exim gives up on the address without trying any subsequent routers.
57963 </para>
57964 <para>
57965 This one router can handle all the virtual domains because the alias file names
57966 follow a fixed pattern. Permissions can be arranged so that appropriate people
57967 can edit the different alias files. A successful aliasing operation results in
57968 a new envelope recipient address, which is then routed from scratch.
57969 </para>
57970 <para>
57971 The other kind of <quote>virtual</quote> domain can also be handled in a straightforward
57972 way. One approach is to create a file for each domain containing a list of
57973 valid local parts, and use it in a router like this:
57974 </para>
57975 <literallayout class="monospaced">
57976 my_domains:
57977   driver = accept
57978   domains = dsearch;/etc/mail/domains
57979   local_parts = lsearch;/etc/mail/domains/$domain
57980   transport = my_mailboxes
57981 </literallayout>
57982 <para>
57983 The address is accepted if there is a file for the domain, and the local part
57984 can be found in the file. The <option>domains</option> option is used to check for the
57985 file&#x2019;s existence because <option>domains</option> is tested before the <option>local_parts</option>
57986 option (see section <xref linkend="SECTrouprecon"/>). You cannot use <option>require_files</option>,
57987 because that option is tested after <option>local_parts</option>. The transport is as
57988 follows:
57989 </para>
57990 <literallayout class="monospaced">
57991 my_mailboxes:
57992   driver = appendfile
57993   file = /var/mail/$domain/$local_part
57994   user = mail
57995 </literallayout>
57996 <para>
57997 This uses a directory of mailboxes for each domain. The <option>user</option> setting is
57998 required, to specify which uid is to be used for writing to the mailboxes.
57999 </para>
58000 <para>
58001 The configuration shown here is just one example of how you might support this
58002 requirement. There are many other ways this kind of configuration can be set
58003 up, for example, by using a database instead of separate files to hold all the
58004 information about the domains.
58005 </para>
58006 </section>
58007 <section id="SECTmulbox">
58008 <title>Multiple user mailboxes</title>
58009 <para>
58010 <indexterm role="concept">
58011 <primary>multiple mailboxes</primary>
58012 </indexterm>
58013 <indexterm role="concept">
58014 <primary>mailbox</primary>
58015 <secondary>multiple</secondary>
58016 </indexterm>
58017 <indexterm role="concept">
58018 <primary>local part</primary>
58019 <secondary>prefix</secondary>
58020 </indexterm>
58021 <indexterm role="concept">
58022 <primary>local part</primary>
58023 <secondary>suffix</secondary>
58024 </indexterm>
58025 Heavy email users often want to operate with multiple mailboxes, into which
58026 incoming mail is automatically sorted. A popular way of handling this is to
58027 allow users to use multiple sender addresses, so that replies can easily be
58028 identified. Users are permitted to add prefixes or suffixes to their local
58029 parts for this purpose. The wildcard facility of the generic router options
58030 <option>local_part_prefix</option> and <option>local_part_suffix</option> can be used for this. For
58031 example, consider this router:
58032 </para>
58033 <literallayout class="monospaced">
58034 userforward:
58035   driver = redirect
58036   check_local_user
58037   file = $home/.forward
58038   local_part_suffix = -*
58039   local_part_suffix_optional
58040   allow_filter
58041 </literallayout>
58042 <para>
58043 <indexterm role="variable">
58044 <primary><varname>$local_part_suffix</varname></primary>
58045 </indexterm>
58046 It runs a user&#x2019;s <filename>.forward</filename> file for all local parts of the form
58047 <emphasis>username-*</emphasis>. Within the filter file the user can distinguish different
58048 cases by testing the variable <varname>$local_part_suffix</varname>. For example:
58049 </para>
58050 <literallayout class="monospaced">
58051 if $local_part_suffix contains -special then
58052 save /home/$local_part/Mail/special
58053 endif
58054 </literallayout>
58055 <para>
58056 If the filter file does not exist, or does not deal with such addresses, they
58057 fall through to subsequent routers, and, assuming no subsequent use of the
58058 <option>local_part_suffix</option> option is made, they presumably fail. Thus, users have
58059 control over which suffixes are valid.
58060 </para>
58061 <para>
58062 Alternatively, a suffix can be used to trigger the use of a different
58063 <filename>.forward</filename> file &ndash; which is the way a similar facility is implemented in
58064 another MTA:
58065 </para>
58066 <literallayout class="monospaced">
58067 userforward:
58068   driver = redirect
58069   check_local_user
58070   file = $home/.forward$local_part_suffix
58071   local_part_suffix = -*
58072   local_part_suffix_optional
58073   allow_filter
58074 </literallayout>
58075 <para>
58076 If there is no suffix, <filename>.forward</filename> is used; if the suffix is <emphasis>-special</emphasis>, for
58077 example, <filename>.forward-special</filename> is used. Once again, if the appropriate file
58078 does not exist, or does not deal with the address, it is passed on to
58079 subsequent routers, which could, if required, look for an unqualified
58080 <filename>.forward</filename> file to use as a default.
58081 </para>
58082 </section>
58083 <section id="SECID244">
58084 <title>Simplified vacation processing</title>
58085 <para>
58086 <indexterm role="concept">
58087 <primary>vacation processing</primary>
58088 </indexterm>
58089 The traditional way of running the <emphasis>vacation</emphasis> program is for a user to set up
58090 a pipe command in a <filename>.forward</filename> file
58091 (see section <xref linkend="SECTspecitredli"/> for syntax details).
58092 This is prone to error by inexperienced users. There are two features of Exim
58093 that can be used to make this process simpler for users:
58094 </para>
58095 <itemizedlist>
58096 <listitem>
58097 <para>
58098 A local part prefix such as <quote>vacation-</quote> can be specified on a router which
58099 can cause the message to be delivered directly to the <emphasis>vacation</emphasis> program, or
58100 alternatively can use Exim&#x2019;s <command>autoreply</command> transport. The contents of a user&#x2019;s
58101 <filename>.forward</filename> file are then much simpler. For example:
58102 </para>
58103 <literallayout class="monospaced">
58104 spqr, vacation-spqr
58105 </literallayout>
58106 </listitem>
58107 <listitem>
58108 <para>
58109 The <option>require_files</option> generic router option can be used to trigger a
58110 vacation delivery by checking for the existence of a certain file in the
58111 user&#x2019;s home directory. The <option>unseen</option> generic option should also be used, to
58112 ensure that the original delivery also proceeds. In this case, all the user has
58113 to do is to create a file called, say, <filename>.vacation</filename>, containing a vacation
58114 message.
58115 </para>
58116 </listitem>
58117 </itemizedlist>
58118 <para>
58119 Another advantage of both these methods is that they both work even when the
58120 use of arbitrary pipes by users is locked out.
58121 </para>
58122 </section>
58123 <section id="SECID245">
58124 <title>Taking copies of mail</title>
58125 <para>
58126 <indexterm role="concept">
58127 <primary>message</primary>
58128 <secondary>copying every</secondary>
58129 </indexterm>
58130 Some installations have policies that require archive copies of all messages to
58131 be made. A single copy of each message can easily be taken by an appropriate
58132 command in a system filter, which could, for example, use a different file for
58133 each day&#x2019;s messages.
58134 </para>
58135 <para>
58136 There is also a shadow transport mechanism that can be used to take copies of
58137 messages that are successfully delivered by local transports, one copy per
58138 delivery. This could be used, <emphasis>inter alia</emphasis>, to implement automatic
58139 notification of delivery by sites that insist on doing such things.
58140 </para>
58141 </section>
58142 <section id="SECID246">
58143 <title>Intermittently connected hosts</title>
58144 <para>
58145 <indexterm role="concept">
58146 <primary>intermittently connected hosts</primary>
58147 </indexterm>
58148 It has become quite common (because it is cheaper) for hosts to connect to the
58149 Internet periodically rather than remain connected all the time. The normal
58150 arrangement is that mail for such hosts accumulates on a system that is
58151 permanently connected.
58152 </para>
58153 <para>
58154 Exim was designed for use on permanently connected hosts, and so it is not
58155 particularly well-suited to use in an intermittently connected environment.
58156 Nevertheless there are some features that can be used.
58157 </para>
58158 </section>
58159 <section id="SECID247">
58160 <title>Exim on the upstream server host</title>
58161 <para>
58162 It is tempting to arrange for incoming mail for the intermittently connected
58163 host to remain on Exim&#x2019;s queue until the client connects. However, this
58164 approach does not scale very well. Two different kinds of waiting message are
58165 being mixed up in the same queue &ndash; those that cannot be delivered because of
58166 some temporary problem, and those that are waiting for their destination host
58167 to connect. This makes it hard to manage the queue, as well as wasting
58168 resources, because each queue runner scans the entire queue.
58169 </para>
58170 <para>
58171 A better approach is to separate off those messages that are waiting for an
58172 intermittently connected host. This can be done by delivering these messages
58173 into local files in batch SMTP, <quote>mailstore</quote>, or other envelope-preserving
58174 format, from where they are transmitted by other software when their
58175 destination connects. This makes it easy to collect all the mail for one host
58176 in a single directory, and to apply local timeout rules on a per-message basis
58177 if required.
58178 </para>
58179 <para>
58180 On a very small scale, leaving the mail on Exim&#x2019;s queue can be made to work. If
58181 you are doing this, you should configure Exim with a long retry period for the
58182 intermittent host. For example:
58183 </para>
58184 <literallayout class="monospaced">
58185 cheshire.wonderland.fict.example    *   F,5d,24h
58186 </literallayout>
58187 <para>
58188 This stops a lot of failed delivery attempts from occurring, but Exim remembers
58189 which messages it has queued up for that host. Once the intermittent host comes
58190 online, forcing delivery of one message (either by using the <option>-M</option> or <option>-R</option>
58191 options, or by using the ETRN SMTP command (see section <xref linkend="SECTETRN"/>)
58192 causes all the queued up messages to be delivered, often down a single SMTP
58193 connection. While the host remains connected, any new messages get delivered
58194 immediately.
58195 </para>
58196 <para>
58197 If the connecting hosts do not have fixed IP addresses, that is, if a host is
58198 issued with a different IP address each time it connects, Exim&#x2019;s retry
58199 mechanisms on the holding host get confused, because the IP address is normally
58200 used as part of the key string for holding retry information. This can be
58201 avoided by unsetting <option>retry_include_ip_address</option> on the <command>smtp</command> transport.
58202 Since this has disadvantages for permanently connected hosts, it is best to
58203 arrange a separate transport for the intermittently connected ones.
58204 </para>
58205 </section>
58206 <section id="SECID248">
58207 <title>Exim on the intermittently connected client host</title>
58208 <para>
58209 The value of <option>smtp_accept_queue_per_connection</option> should probably be
58210 increased, or even set to zero (that is, disabled) on the intermittently
58211 connected host, so that all incoming messages down a single connection get
58212 delivered immediately.
58213 </para>
58214 <para>
58215 <indexterm role="concept">
58216 <primary>SMTP</primary>
58217 <secondary>passed connection</secondary>
58218 </indexterm>
58219 <indexterm role="concept">
58220 <primary>SMTP</primary>
58221 <secondary>multiple deliveries</secondary>
58222 </indexterm>
58223 <indexterm role="concept">
58224 <primary>multiple SMTP deliveries</primary>
58225 </indexterm>
58226 Mail waiting to be sent from an intermittently connected host will probably
58227 not have been routed, because without a connection DNS lookups are not
58228 possible. This means that if a normal queue run is done at connection time,
58229 each message is likely to be sent in a separate SMTP session. This can be
58230 avoided by starting the queue run with a command line option beginning with
58231 <option>-qq</option> instead of <option>-q</option>. In this case, the queue is scanned twice. In the
58232 first pass, routing is done but no deliveries take place. The second pass is a
58233 normal queue run; since all the messages have been previously routed, those
58234 destined for the same host are likely to get sent as multiple deliveries in a
58235 single SMTP connection.
58236 </para>
58237 </section>
58238 </chapter>
58239
58240 <chapter id="CHAPnonqueueing">
58241 <title>Using Exim as a non-queueing client</title>
58242 <titleabbrev>Exim as a non-queueing client</titleabbrev>
58243 <para>
58244 <indexterm role="concept">
58245 <primary>client, non-queueing</primary>
58246 </indexterm>
58247 <indexterm role="concept">
58248 <primary>smart host</primary>
58249 <secondary>suppressing queueing</secondary>
58250 </indexterm>
58251 On a personal computer, it is a common requirement for all
58252 email to be sent to a <quote>smart host</quote>. There are plenty of MUAs that can be
58253 configured to operate that way, for all the popular operating systems.
58254 However, there are some MUAs for Unix-like systems that cannot be so
58255 configured: they submit messages using the command line interface of
58256 <filename>/usr/sbin/sendmail</filename>. Furthermore, utility programs such as <emphasis>cron</emphasis> submit
58257 messages this way.
58258 </para>
58259 <para>
58260 If the personal computer runs continuously, there is no problem, because it can
58261 run a conventional MTA that handles delivery to the smart host, and deal with
58262 any delays via its queueing mechanism. However, if the computer does not run
58263 continuously or runs different operating systems at different times, queueing
58264 email is not desirable.
58265 </para>
58266 <para>
58267 There is therefore a requirement for something that can provide the
58268 <filename>/usr/sbin/sendmail</filename> interface but deliver messages to a smart host without
58269 any queueing or retrying facilities. Furthermore, the delivery to the smart
58270 host should be synchronous, so that if it fails, the sending MUA is immediately
58271 informed. In other words, we want something that extends an MUA that submits
58272 to a local MTA via the command line so that it behaves like one that submits
58273 to a remote smart host using TCP/SMTP.
58274 </para>
58275 <para>
58276 There are a number of applications (for example, there is one called <emphasis>ssmtp</emphasis>)
58277 that do this job. However, people have found them to be lacking in various
58278 ways. For instance, you might want to allow aliasing and forwarding to be done
58279 before sending a message to the smart host.
58280 </para>
58281 <para>
58282 Exim already had the necessary infrastructure for doing this job. Just a few
58283 tweaks were needed to make it behave as required, though it is somewhat of an
58284 overkill to use a fully-featured MTA for this purpose.
58285 </para>
58286 <para>
58287 <indexterm role="option">
58288 <primary><option>mua_wrapper</option></primary>
58289 </indexterm>
58290 There is a Boolean global option called <option>mua_wrapper</option>, defaulting false.
58291 Setting <option>mua_wrapper</option> true causes Exim to run in a special mode where it
58292 assumes that it is being used to <quote>wrap</quote> a command-line MUA in the manner
58293 just described. As well as setting <option>mua_wrapper</option>, you also need to provide a
58294 compatible router and transport configuration. Typically there will be just one
58295 router and one transport, sending everything to a smart host.
58296 </para>
58297 <para>
58298 When run in MUA wrapping mode, the behaviour of Exim changes in the
58299 following ways:
58300 </para>
58301 <itemizedlist>
58302 <listitem>
58303 <para>
58304 A daemon cannot be run, nor will Exim accept incoming messages from <emphasis>inetd</emphasis>.
58305 In other words, the only way to submit messages is via the command line.
58306 </para>
58307 </listitem>
58308 <listitem>
58309 <para>
58310 Each message is synchronously delivered as soon as it is received (<option>-odi</option> is
58311 assumed). All queueing options (<option>queue_only</option>, <option>queue_smtp_domains</option>,
58312 <option>control</option> in an ACL, etc.) are quietly ignored. The Exim reception process
58313 does not finish until the delivery attempt is complete. If the delivery is
58314 successful, a zero return code is given.
58315 </para>
58316 </listitem>
58317 <listitem>
58318 <para>
58319 Address redirection is permitted, but the final routing for all addresses must
58320 be to the same remote transport, and to the same list of hosts. Furthermore,
58321 the return address (envelope sender) must be the same for all recipients, as
58322 must any added or deleted header lines. In other words, it must be possible to
58323 deliver the message in a single SMTP transaction, however many recipients there
58324 are.
58325 </para>
58326 </listitem>
58327 <listitem>
58328 <para>
58329 If these conditions are not met, or if routing any address results in a
58330 failure or defer status, or if Exim is unable to deliver all the recipients
58331 successfully to one of the smart hosts, delivery of the entire message fails.
58332 </para>
58333 </listitem>
58334 <listitem>
58335 <para>
58336 Because no queueing is allowed, all failures are treated as permanent; there
58337 is no distinction between 4<emphasis>xx</emphasis> and 5<emphasis>xx</emphasis> SMTP response codes from the
58338 smart host. Furthermore, because only a single yes/no response can be given to
58339 the caller, it is not possible to deliver to some recipients and not others. If
58340 there is an error (temporary or permanent) for any recipient, all are failed.
58341 </para>
58342 </listitem>
58343 <listitem>
58344 <para>
58345 If more than one smart host is listed, Exim will try another host after a
58346 connection failure or a timeout, in the normal way. However, if this kind of
58347 failure happens for all the hosts, the delivery fails.
58348 </para>
58349 </listitem>
58350 <listitem>
58351 <para>
58352 When delivery fails, an error message is written to the standard error stream
58353 (as well as to Exim&#x2019;s log), and Exim exits to the caller with a return code
58354 value 1. The message is expunged from Exim&#x2019;s spool files. No bounce messages
58355 are ever generated.
58356 </para>
58357 </listitem>
58358 <listitem>
58359 <para>
58360 No retry data is maintained, and any retry rules are ignored.
58361 </para>
58362 </listitem>
58363 <listitem>
58364 <para>
58365 A number of Exim options are overridden: <option>deliver_drop_privilege</option> is forced
58366 true, <option>max_rcpt</option> in the <command>smtp</command> transport is forced to <quote>unlimited</quote>,
58367 <option>remote_max_parallel</option> is forced to one, and fallback hosts are ignored.
58368 </para>
58369 </listitem>
58370 </itemizedlist>
58371 <para>
58372 The overall effect is that Exim makes a single synchronous attempt to deliver
58373 the message, failing if there is any kind of problem. Because no local
58374 deliveries are done and no daemon can be run, Exim does not need root
58375 privilege. It should be possible to run it setuid to <emphasis>exim</emphasis> instead of setuid
58376 to <emphasis>root</emphasis>. See section <xref linkend="SECTrunexiwitpri"/> for a general discussion about
58377 the advantages and disadvantages of running without root privilege.
58378 </para>
58379 </chapter>
58380
58381 <chapter id="CHAPlog">
58382 <title>Log files</title>
58383 <para>
58384 <indexterm role="concept" id="IIDloggen" class="startofrange">
58385 <primary>log</primary>
58386 <secondary>general description</secondary>
58387 </indexterm>
58388 <indexterm role="concept">
58389 <primary>log</primary>
58390 <secondary>types of</secondary>
58391 </indexterm>
58392 Exim writes three different logs, referred to as the main log, the reject log,
58393 and the panic log:
58394 </para>
58395 <itemizedlist>
58396 <listitem>
58397 <para>
58398 <indexterm role="concept">
58399 <primary>main log</primary>
58400 </indexterm>
58401 The main log records the arrival of each message and each delivery in a single
58402 line in each case. The format is as compact as possible, in an attempt to keep
58403 down the size of log files. Two-character flag sequences make it easy to pick
58404 out these lines. A number of other events are recorded in the main log. Some of
58405 them are optional, in which case the <option>log_selector</option> option controls whether
58406 they are included or not. A Perl script called <emphasis>eximstats</emphasis>, which does simple
58407 analysis of main log files, is provided in the Exim distribution (see section
58408 <xref linkend="SECTmailstat"/>).
58409 </para>
58410 </listitem>
58411 <listitem>
58412 <para>
58413 <indexterm role="concept">
58414 <primary>reject log</primary>
58415 </indexterm>
58416 The reject log records information from messages that are rejected as a result
58417 of a configuration option (that is, for policy reasons).
58418 The first line of each rejection is a copy of the line that is also written to
58419 the main log. Then, if the message&#x2019;s header has been read at the time the log
58420 is written, its contents are written to this log. Only the original header
58421 lines are available; header lines added by ACLs are not logged. You can use the
58422 reject log to check that your policy controls are working correctly; on a busy
58423 host this may be easier than scanning the main log for rejection messages. You
58424 can suppress the writing of the reject log by setting <option>write_rejectlog</option>
58425 false.
58426 </para>
58427 </listitem>
58428 <listitem>
58429 <para>
58430 <indexterm role="concept">
58431 <primary>panic log</primary>
58432 </indexterm>
58433 <indexterm role="concept">
58434 <primary>system log</primary>
58435 </indexterm>
58436 When certain serious errors occur, Exim writes entries to its panic log. If the
58437 error is sufficiently disastrous, Exim bombs out afterwards. Panic log entries
58438 are usually written to the main log as well, but can get lost amid the mass of
58439 other entries. The panic log should be empty under normal circumstances. It is
58440 therefore a good idea to check it (or to have a <emphasis>cron</emphasis> script check it)
58441 regularly, in order to become aware of any problems. When Exim cannot open its
58442 panic log, it tries as a last resort to write to the system log (syslog). This
58443 is opened with LOG_PID+LOG_CONS and the facility code of LOG_MAIL. The
58444 message itself is written at priority LOG_CRIT.
58445 </para>
58446 </listitem>
58447 </itemizedlist>
58448 <para>
58449 Every log line starts with a timestamp, in the format shown in the following
58450 example. Note that many of the examples shown in this chapter are line-wrapped.
58451 In the log file, this would be all on one line:
58452 </para>
58453 <literallayout class="monospaced">
58454 2001-09-16 16:09:47 SMTP connection from [127.0.0.1] closed
58455   by QUIT
58456 </literallayout>
58457 <para>
58458 By default, the timestamps are in the local timezone. There are two
58459 ways of changing this:
58460 </para>
58461 <itemizedlist>
58462 <listitem>
58463 <para>
58464 You can set the <option>timezone</option> option to a different time zone; in particular, if
58465 you set
58466 </para>
58467 <literallayout class="monospaced">
58468 timezone = UTC
58469 </literallayout>
58470 <para>
58471 the timestamps will be in UTC (aka GMT).
58472 </para>
58473 </listitem>
58474 <listitem>
58475 <para>
58476 If you set <option>log_timezone</option> true, the time zone is added to the timestamp, for
58477 example:
58478 </para>
58479 <literallayout class="monospaced">
58480 2003-04-25 11:17:07 +0100 Start queue run: pid=12762
58481 </literallayout>
58482 </listitem>
58483 </itemizedlist>
58484 <para>
58485 <indexterm role="concept">
58486 <primary>log</primary>
58487 <secondary>process ids in</secondary>
58488 </indexterm>
58489 <indexterm role="concept">
58490 <primary>pid (process id)</primary>
58491 <secondary>in log lines</secondary>
58492 </indexterm>
58493 Exim does not include its process id in log lines by default, but you can
58494 request that it does so by specifying the <literal>pid</literal> log selector (see section
58495 <xref linkend="SECTlogselector"/>). When this is set, the process id is output, in square
58496 brackets, immediately after the time and date.
58497 </para>
58498 <section id="SECTwhelogwri">
58499 <title>Where the logs are written</title>
58500 <para>
58501 <indexterm role="concept">
58502 <primary>log</primary>
58503 <secondary>destination</secondary>
58504 </indexterm>
58505 <indexterm role="concept">
58506 <primary>log</primary>
58507 <secondary>to file</secondary>
58508 </indexterm>
58509 <indexterm role="concept">
58510 <primary>log</primary>
58511 <secondary>to syslog</secondary>
58512 </indexterm>
58513 <indexterm role="concept">
58514 <primary>syslog</primary>
58515 </indexterm>
58516 The logs may be written to local files, or to syslog, or both. However, it
58517 should be noted that many syslog implementations use UDP as a transport, and
58518 are therefore unreliable in the sense that messages are not guaranteed to
58519 arrive at the loghost, nor is the ordering of messages necessarily maintained.
58520 It has also been reported that on large log files (tens of megabytes) you may
58521 need to tweak syslog to prevent it syncing the file with each write &ndash; on
58522 Linux this has been seen to make syslog take 90% plus of CPU time.
58523 </para>
58524 <para>
58525 The destination for Exim&#x2019;s logs is configured by setting LOG_FILE_PATH in
58526 <filename>Local/Makefile</filename> or by setting <option>log_file_path</option> in the run time
58527 configuration. This latter string is expanded, so it can contain, for example,
58528 references to the host name:
58529 </para>
58530 <literallayout class="monospaced">
58531 log_file_path = /var/log/$primary_hostname/exim_%slog
58532 </literallayout>
58533 <para>
58534 It is generally advisable, however, to set the string in <filename>Local/Makefile</filename>
58535 rather than at run time, because then the setting is available right from the
58536 start of Exim&#x2019;s execution. Otherwise, if there&#x2019;s something it wants to log
58537 before it has read the configuration file (for example, an error in the
58538 configuration file) it will not use the path you want, and may not be able to
58539 log at all.
58540 </para>
58541 <para>
58542 The value of LOG_FILE_PATH or <option>log_file_path</option> is a colon-separated
58543 list, currently limited to at most two items. This is one option where the
58544 facility for changing a list separator may not be used. The list must always be
58545 colon-separated. If an item in the list is <quote>syslog</quote> then syslog is used;
58546 otherwise the item must either be an absolute path, containing <literal>%s</literal> at the
58547 point where <quote>main</quote>, <quote>reject</quote>, or <quote>panic</quote> is to be inserted, or be empty,
58548 implying the use of a default path.
58549 </para>
58550 <para>
58551 When Exim encounters an empty item in the list, it searches the list defined by
58552 LOG_FILE_PATH, and uses the first item it finds that is neither empty nor
58553 <quote>syslog</quote>. This means that an empty item in <option>log_file_path</option> can be used to
58554 mean <quote>use the path specified at build time</quote>. It no such item exists, log
58555 files are written in the <filename>log</filename> subdirectory of the spool directory. This is
58556 equivalent to the setting:
58557 </para>
58558 <literallayout class="monospaced">
58559 log_file_path = $spool_directory/log/%slog
58560 </literallayout>
58561 <para>
58562 If you do not specify anything at build time or run time, that is where the
58563 logs are written.
58564 </para>
58565 <para>
58566 A log file path may also contain <literal>%D</literal> or <literal>%M</literal> if datestamped log file names
58567 are in use &ndash; see section <xref linkend="SECTdatlogfil"/> below.
58568 </para>
58569 <para>
58570 Here are some examples of possible settings:
58571 </para>
58572 <literallayout>
58573 <literal>LOG_FILE_PATH=syslog                    </literal> syslog only
58574 <literal>LOG_FILE_PATH=:syslog                   </literal> syslog and default path
58575 <literal>LOG_FILE_PATH=syslog : /usr/log/exim_%s </literal> syslog and specified path
58576 <literal>LOG_FILE_PATH=/usr/log/exim_%s          </literal> specified path only
58577 </literallayout>
58578 <para>
58579 If there are more than two paths in the list, the first is used and a panic
58580 error is logged.
58581 </para>
58582 </section>
58583 <section id="SECID285">
58584 <title>Logging to local files that are periodically <quote>cycled</quote></title>
58585 <para>
58586 <indexterm role="concept">
58587 <primary>log</primary>
58588 <secondary>cycling local files</secondary>
58589 </indexterm>
58590 <indexterm role="concept">
58591 <primary>cycling logs</primary>
58592 </indexterm>
58593 <indexterm role="concept">
58594 <primary><emphasis>exicyclog</emphasis></primary>
58595 </indexterm>
58596 <indexterm role="concept">
58597 <primary>log</primary>
58598 <secondary>local files; writing to</secondary>
58599 </indexterm>
58600 Some operating systems provide centralized and standardized methods for cycling
58601 log files. For those that do not, a utility script called <emphasis>exicyclog</emphasis> is
58602 provided (see section <xref linkend="SECTcyclogfil"/>). This renames and compresses the
58603 main and reject logs each time it is called. The maximum number of old logs to
58604 keep can be set. It is suggested this script is run as a daily <emphasis>cron</emphasis> job.
58605 </para>
58606 <para>
58607 An Exim delivery process opens the main log when it first needs to write to it,
58608 and it keeps the file open in case subsequent entries are required &ndash; for
58609 example, if a number of different deliveries are being done for the same
58610 message. However, remote SMTP deliveries can take a long time, and this means
58611 that the file may be kept open long after it is renamed if <emphasis>exicyclog</emphasis> or
58612 something similar is being used to rename log files on a regular basis. To
58613 ensure that a switch of log files is noticed as soon as possible, Exim calls
58614 <function>stat()</function> on the main log&#x2019;s name before reusing an open file, and if the file
58615 does not exist, or its inode has changed, the old file is closed and Exim
58616 tries to open the main log from scratch. Thus, an old log file may remain open
58617 for quite some time, but no Exim processes should write to it once it has been
58618 renamed.
58619 </para>
58620 </section>
58621 <section id="SECTdatlogfil">
58622 <title>Datestamped log files</title>
58623 <para>
58624 <indexterm role="concept">
58625 <primary>log</primary>
58626 <secondary>datestamped files</secondary>
58627 </indexterm>
58628 Instead of cycling the main and reject log files by renaming them
58629 periodically, some sites like to use files whose names contain a datestamp,
58630 for example, <filename>mainlog-20031225</filename>. The datestamp is in the form <filename>yyyymmdd</filename> or
58631 <filename>yyyymm</filename>. Exim has support for this way of working. It is enabled by setting
58632 the <option>log_file_path</option> option to a path that includes <literal>%D</literal> or <literal>%M</literal> at the
58633 point where the datestamp is required. For example:
58634 </para>
58635 <literallayout class="monospaced">
58636 log_file_path = /var/spool/exim/log/%slog-%D
58637 log_file_path = /var/log/exim-%s-%D.log
58638 log_file_path = /var/spool/exim/log/%D-%slog
58639 log_file_path = /var/log/exim/%s.%M
58640 </literallayout>
58641 <para>
58642 As before, <literal>%s</literal> is replaced by <quote>main</quote> or <quote>reject</quote>; the following are
58643 examples of names generated by the above examples:
58644 </para>
58645 <literallayout class="monospaced">
58646 /var/spool/exim/log/mainlog-20021225
58647 /var/log/exim-reject-20021225.log
58648 /var/spool/exim/log/20021225-mainlog
58649 /var/log/exim/main.200212
58650 </literallayout>
58651 <para>
58652 When this form of log file is specified, Exim automatically switches to new
58653 files at midnight. It does not make any attempt to compress old logs; you
58654 will need to write your own script if you require this. You should not
58655 run <emphasis>exicyclog</emphasis> with this form of logging.
58656 </para>
58657 <para>
58658 The location of the panic log is also determined by <option>log_file_path</option>, but it
58659 is not datestamped, because rotation of the panic log does not make sense.
58660 When generating the name of the panic log, <literal>%D</literal> or <literal>%M</literal> are removed from
58661 the string. In addition, if it immediately follows a slash, a following
58662 non-alphanumeric character is removed; otherwise a preceding non-alphanumeric
58663 character is removed. Thus, the four examples above would give these panic
58664 log names:
58665 </para>
58666 <literallayout class="monospaced">
58667 /var/spool/exim/log/paniclog
58668 /var/log/exim-panic.log
58669 /var/spool/exim/log/paniclog
58670 /var/log/exim/panic
58671 </literallayout>
58672 </section>
58673 <section id="SECID249">
58674 <title>Logging to syslog</title>
58675 <para>
58676 <indexterm role="concept">
58677 <primary>log</primary>
58678 <secondary>syslog; writing to</secondary>
58679 </indexterm>
58680 The use of syslog does not change what Exim logs or the format of its messages,
58681 except in one respect. If <option>syslog_timestamp</option> is set false, the timestamps on
58682 Exim&#x2019;s log lines are omitted when these lines are sent to syslog. Apart from
58683 that, the same strings are written to syslog as to log files. The syslog
58684 <quote>facility</quote> is set to LOG_MAIL, and the program name to <quote>exim</quote>
58685 by default, but you can change these by setting the <option>syslog_facility</option> and
58686 <option>syslog_processname</option> options, respectively. If Exim was compiled with
58687 SYSLOG_LOG_PID set in <filename>Local/Makefile</filename> (this is the default in
58688 <filename>src/EDITME</filename>), then, on systems that permit it (all except ULTRIX), the
58689 LOG_PID flag is set so that the <function>syslog()</function> call adds the pid as well as
58690 the time and host name to each line.
58691 The three log streams are mapped onto syslog priorities as follows:
58692 </para>
58693 <itemizedlist>
58694 <listitem>
58695 <para>
58696 <emphasis>mainlog</emphasis> is mapped to LOG_INFO
58697 </para>
58698 </listitem>
58699 <listitem>
58700 <para>
58701 <emphasis>rejectlog</emphasis> is mapped to LOG_NOTICE
58702 </para>
58703 </listitem>
58704 <listitem>
58705 <para>
58706 <emphasis>paniclog</emphasis> is mapped to LOG_ALERT
58707 </para>
58708 </listitem>
58709 </itemizedlist>
58710 <para>
58711 Many log lines are written to both <emphasis>mainlog</emphasis> and <emphasis>rejectlog</emphasis>, and some are
58712 written to both <emphasis>mainlog</emphasis> and <emphasis>paniclog</emphasis>, so there will be duplicates if
58713 these are routed by syslog to the same place. You can suppress this duplication
58714 by setting <option>syslog_duplication</option> false.
58715 </para>
58716 <para>
58717 Exim&#x2019;s log lines can sometimes be very long, and some of its <emphasis>rejectlog</emphasis>
58718 entries contain multiple lines when headers are included. To cope with both
58719 these cases, entries written to syslog are split into separate <function>syslog()</function>
58720 calls at each internal newline, and also after a maximum of
58721 870 data characters. (This allows for a total syslog line length of 1024, when
58722 additions such as timestamps are added.) If you are running a syslog
58723 replacement that can handle lines longer than the 1024 characters allowed by
58724 RFC 3164, you should set
58725 </para>
58726 <literallayout class="monospaced">
58727 SYSLOG_LONG_LINES=yes
58728 </literallayout>
58729 <para>
58730 in <filename>Local/Makefile</filename> before building Exim. That stops Exim from splitting long
58731 lines, but it still splits at internal newlines in <emphasis>reject</emphasis> log entries.
58732 </para>
58733 <para>
58734 To make it easy to re-assemble split lines later, each component of a split
58735 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;]
58736 where &lt;<emphasis>n</emphasis>&gt; is the component number and &lt;<emphasis>m</emphasis>&gt; is the total number of
58737 components in the entry. The / delimiter is used when the line was split
58738 because it was too long; if it was split because of an internal newline, the \
58739 delimiter is used. For example, supposing the length limit to be 50 instead of
58740 870, the following would be the result of a typical rejection message to
58741 <emphasis>mainlog</emphasis> (LOG_INFO), each line in addition being preceded by the time, host
58742 name, and pid as added by syslog:
58743 </para>
58744 <literallayout class="monospaced">
58745 [1/5] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected from
58746 [2/5]  [127.0.0.1] (ph10): syntax error in 'From' header
58747 [3/5]  when scanning for sender: missing or malformed lo
58748 [4/5] cal part in "&lt;&gt;" (envelope sender is &lt;ph10@cam.exa
58749 [5/5] mple&gt;)
58750 </literallayout>
58751 <para>
58752 The same error might cause the following lines to be written to <quote>rejectlog</quote>
58753 (LOG_NOTICE):
58754 </para>
58755 <literallayout class="monospaced">
58756 [1/18] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected fro
58757 [2/18] m [127.0.0.1] (ph10): syntax error in 'From' head
58758 [3/18] er when scanning for sender: missing or malformed
58759 [4/18]  local part in "&lt;&gt;" (envelope sender is &lt;ph10@cam
58760 [5\18] .example&gt;)
58761 [6\18] Recipients: ph10@some.domain.cam.example
58762 [7\18] P Received: from [127.0.0.1] (ident=ph10)
58763 [8\18]        by xxxxx.cam.example with smtp (Exim 4.00)
58764 [9\18]        id 16RdAL-0006pc-00
58765 [10/18]        for ph10@cam.example; Mon, 16 Sep 2002 16:
58766 [11\18] 09:43 +0100
58767 [12\18] F From: &lt;&gt;
58768 [13\18]   Subject: this is a test header
58769 [18\18]   X-something: this is another header
58770 [15/18] I Message-Id: &lt;E16RdAL-0006pc-00@xxxxx.cam.examp
58771 [16\18] le&gt;
58772 [17\18] B Bcc:
58773 [18/18]   Date: Mon, 16 Sep 2002 16:09:43 +0100
58774 </literallayout>
58775 <para>
58776 Log lines that are neither too long nor contain newlines are written to syslog
58777 without modification.
58778 </para>
58779 <para>
58780 If only syslog is being used, the Exim monitor is unable to provide a log tail
58781 display, unless syslog is routing <emphasis>mainlog</emphasis> to a file on the local host and
58782 the environment variable EXIMON_LOG_FILE_PATH is set to tell the monitor
58783 where it is.
58784 </para>
58785 </section>
58786 <section id="SECID250">
58787 <title>Log line flags</title>
58788 <para>
58789 One line is written to the main log for each message received, and for each
58790 successful, unsuccessful, and delayed delivery. These lines can readily be
58791 picked out by the distinctive two-character flags that immediately follow the
58792 timestamp. The flags are:
58793 </para>
58794 <literallayout>
58795 <literal>&lt;=</literal>     message arrival
58796 <literal>=&gt;</literal>     normal message delivery
58797 <literal>-&gt;</literal>     additional address in same delivery
58798 <literal>*&gt;</literal>     delivery suppressed by <option>-N</option>
58799 <literal>**</literal>     delivery failed; address bounced
58800 <literal>==</literal>     delivery deferred; temporary problem
58801 </literallayout>
58802 </section>
58803 <section id="SECID251">
58804 <title>Logging message reception</title>
58805 <para>
58806 <indexterm role="concept">
58807 <primary>log</primary>
58808 <secondary>reception line</secondary>
58809 </indexterm>
58810 The format of the single-line entry in the main log that is written for every
58811 message received is shown in the basic example below, which is split over
58812 several lines in order to fit it on the page:
58813 </para>
58814 <literallayout class="monospaced">
58815 2002-10-31 08:57:53 16ZCW1-0005MB-00 &lt;= kryten@dwarf.fict.example
58816   H=mailer.fict.example [192.168.123.123] U=exim
58817   P=smtp S=5678 id=&lt;incoming message id&gt;
58818 </literallayout>
58819 <para>
58820 The address immediately following <quote>&lt;=</quote> is the envelope sender address. A
58821 bounce message is shown with the sender address <quote>&lt;&gt;</quote>, and if it is locally
58822 generated, this is followed by an item of the form
58823 </para>
58824 <literallayout class="monospaced">
58825 R=&lt;message id&gt;
58826 </literallayout>
58827 <para>
58828 which is a reference to the message that caused the bounce to be sent.
58829 </para>
58830 <para>
58831 <indexterm role="concept">
58832 <primary>HELO</primary>
58833 </indexterm>
58834 <indexterm role="concept">
58835 <primary>EHLO</primary>
58836 </indexterm>
58837 For messages from other hosts, the H and U fields identify the remote host and
58838 record the RFC 1413 identity of the user that sent the message, if one was
58839 received. The number given in square brackets is the IP address of the sending
58840 host. If there is a single, unparenthesized  host name in the H field, as
58841 above, it has been verified to correspond to the IP address (see the
58842 <option>host_lookup</option> option). If the name is in parentheses, it was the name quoted
58843 by the remote host in the SMTP HELO or EHLO command, and has not been
58844 verified. If verification yields a different name to that given for HELO or
58845 EHLO, the verified name appears first, followed by the HELO or EHLO
58846 name in parentheses.
58847 </para>
58848 <para>
58849 Misconfigured hosts (and mail forgers) sometimes put an IP address, with or
58850 without brackets, in the HELO or EHLO command, leading to entries in
58851 the log containing text like these examples:
58852 </para>
58853 <literallayout class="monospaced">
58854 H=(10.21.32.43) [192.168.8.34]
58855 H=([10.21.32.43]) [192.168.8.34]
58856 </literallayout>
58857 <para>
58858 This can be confusing. Only the final address in square brackets can be relied
58859 on.
58860 </para>
58861 <para>
58862 For locally generated messages (that is, messages not received over TCP/IP),
58863 the H field is omitted, and the U field contains the login name of the caller
58864 of Exim.
58865 </para>
58866 <para>
58867 <indexterm role="concept">
58868 <primary>authentication</primary>
58869 <secondary>logging</secondary>
58870 </indexterm>
58871 <indexterm role="concept">
58872 <primary>AUTH</primary>
58873 <secondary>logging</secondary>
58874 </indexterm>
58875 For all messages, the P field specifies the protocol used to receive the
58876 message. This is the value that is stored in <varname>$received_protocol</varname>. In the case
58877 of incoming SMTP messages, the value indicates whether or not any SMTP
58878 extensions (ESMTP), encryption, or authentication were used. If the SMTP
58879 session was encrypted, there is an additional X field that records the cipher
58880 suite that was used.
58881 </para>
58882 <para>
58883 The protocol is set to <quote>esmtpsa</quote> or <quote>esmtpa</quote> for messages received from
58884 hosts that have authenticated themselves using the SMTP AUTH command. The first
58885 value is used when the SMTP connection was encrypted (<quote>secure</quote>). In this case
58886 there is an additional item A= followed by the name of the authenticator that
58887 was used. If an authenticated identification was set up by the authenticator&#x2019;s
58888 <option>server_set_id</option> option, this is logged too, separated by a colon from the
58889 authenticator name.
58890 </para>
58891 <para>
58892 <indexterm role="concept">
58893 <primary>size</primary>
58894 <secondary>of message</secondary>
58895 </indexterm>
58896 The id field records the existing message id, if present. The size of the
58897 received message is given by the S field. When the message is delivered,
58898 headers may be removed or added, so that the size of delivered copies of the
58899 message may not correspond with this value (and indeed may be different to each
58900 other).
58901 </para>
58902 <para>
58903 The <option>log_selector</option> option can be used to request the logging of additional
58904 data when a message is received. See section <xref linkend="SECTlogselector"/> below.
58905 </para>
58906 </section>
58907 <section id="SECID252">
58908 <title>Logging deliveries</title>
58909 <para>
58910 <indexterm role="concept">
58911 <primary>log</primary>
58912 <secondary>delivery line</secondary>
58913 </indexterm>
58914 The format of the single-line entry in the main log that is written for every
58915 delivery is shown in one of the examples below, for local and remote
58916 deliveries, respectively. Each example has been split into two lines in order
58917 to fit it on the page:
58918 </para>
58919 <literallayout class="monospaced">
58920 2002-10-31 08:59:13 16ZCW1-0005MB-00 =&gt; marv
58921   &lt;marv@hitch.fict.example&gt; R=localuser T=local_delivery
58922 2002-10-31 09:00:10 16ZCW1-0005MB-00 =&gt;
58923   monk@holistic.fict.example R=dnslookup T=remote_smtp
58924   H=holistic.fict.example [192.168.234.234]
58925 </literallayout>
58926 <para>
58927 For ordinary local deliveries, the original address is given in angle brackets
58928 after the final delivery address, which might be a pipe or a file. If
58929 intermediate address(es) exist between the original and the final address, the
58930 last of these is given in parentheses after the final address. The R and T
58931 fields record the router and transport that were used to process the address.
58932 </para>
58933 <para>
58934 If a shadow transport was run after a successful local delivery, the log line
58935 for the successful delivery has an item added on the end, of the form
58936 </para>
58937 <literallayout>
58938 <literal>ST=&lt;</literal><emphasis>shadow transport name</emphasis><literal>&gt;</literal>
58939 </literallayout>
58940 <para>
58941 If the shadow transport did not succeed, the error message is put in
58942 parentheses afterwards.
58943 </para>
58944 <para>
58945 <indexterm role="concept">
58946 <primary>asterisk</primary>
58947 <secondary>after IP address</secondary>
58948 </indexterm>
58949 When more than one address is included in a single delivery (for example, two
58950 SMTP RCPT commands in one transaction) the second and subsequent addresses are
58951 flagged with <literal>-&gt;</literal> instead of <literal>=&gt;</literal>. When two or more messages are delivered
58952 down a single SMTP connection, an asterisk follows the IP address in the log
58953 lines for the second and subsequent messages.
58954 </para>
58955 <para>
58956 The generation of a reply message by a filter file gets logged as a
58957 <quote>delivery</quote> to the addressee, preceded by <quote>&gt;</quote>.
58958 </para>
58959 <para>
58960 The <option>log_selector</option> option can be used to request the logging of additional
58961 data when a message is delivered. See section <xref linkend="SECTlogselector"/> below.
58962 </para>
58963 </section>
58964 <section id="SECID253">
58965 <title>Discarded deliveries</title>
58966 <para>
58967 <indexterm role="concept">
58968 <primary>discarded messages</primary>
58969 </indexterm>
58970 <indexterm role="concept">
58971 <primary>message</primary>
58972 <secondary>discarded</secondary>
58973 </indexterm>
58974 <indexterm role="concept">
58975 <primary>delivery</primary>
58976 <secondary>discarded; logging</secondary>
58977 </indexterm>
58978 When a message is discarded as a result of the command <quote>seen finish</quote> being
58979 obeyed in a filter file which generates no deliveries, a log entry of the form
58980 </para>
58981 <literallayout class="monospaced">
58982 2002-12-10 00:50:49 16auJc-0001UB-00 =&gt; discarded
58983   &lt;low.club@bridge.example&gt; R=userforward
58984 </literallayout>
58985 <para>
58986 is written, to record why no deliveries are logged. When a message is discarded
58987 because it is aliased to <quote>:blackhole:</quote> the log line is like this:
58988 </para>
58989 <literallayout class="monospaced">
58990 1999-03-02 09:44:33 10HmaX-0005vi-00 =&gt; :blackhole:
58991   &lt;hole@nowhere.example&gt; R=blackhole_router
58992 </literallayout>
58993 </section>
58994 <section id="SECID254">
58995 <title>Deferred deliveries</title>
58996 <para>
58997 When a delivery is deferred, a line of the following form is logged:
58998 </para>
58999 <literallayout class="monospaced">
59000 2002-12-19 16:20:23 16aiQz-0002Q5-00 == marvin@endrest.example
59001   R=dnslookup T=smtp defer (146): Connection refused
59002 </literallayout>
59003 <para>
59004 In the case of remote deliveries, the error is the one that was given for the
59005 last IP address that was tried. Details of individual SMTP failures are also
59006 written to the log, so the above line would be preceded by something like
59007 </para>
59008 <literallayout class="monospaced">
59009 2002-12-19 16:20:23 16aiQz-0002Q5-00 Failed to connect to
59010   mail1.endrest.example [192.168.239.239]: Connection refused
59011 </literallayout>
59012 <para>
59013 When a deferred address is skipped because its retry time has not been reached,
59014 a message is written to the log, but this can be suppressed by setting an
59015 appropriate value in <option>log_selector</option>.
59016 </para>
59017 </section>
59018 <section id="SECID255">
59019 <title>Delivery failures</title>
59020 <para>
59021 <indexterm role="concept">
59022 <primary>delivery</primary>
59023 <secondary>failure; logging</secondary>
59024 </indexterm>
59025 If a delivery fails because an address cannot be routed, a line of the
59026 following form is logged:
59027 </para>
59028 <literallayout class="monospaced">
59029 1995-12-19 16:20:23 0tRiQz-0002Q5-00 ** jim@trek99.example
59030   &lt;jim@trek99.example&gt;: unknown mail domain
59031 </literallayout>
59032 <para>
59033 If a delivery fails at transport time, the router and transport are shown, and
59034 the response from the remote host is included, as in this example:
59035 </para>
59036 <literallayout class="monospaced">
59037 2002-07-11 07:14:17 17SXDU-000189-00 ** ace400@pb.example
59038   R=dnslookup T=remote_smtp: SMTP error from remote mailer
59039   after pipelined RCPT TO:&lt;ace400@pb.example&gt;: host
59040   pbmail3.py.example [192.168.63.111]: 553 5.3.0
59041   &lt;ace400@pb.example&gt;...Addressee unknown
59042 </literallayout>
59043 <para>
59044 The word <quote>pipelined</quote> indicates that the SMTP PIPELINING extension was being
59045 used. See <option>hosts_avoid_esmtp</option> in the <command>smtp</command> transport for a way of
59046 disabling PIPELINING. The log lines for all forms of delivery failure are
59047 flagged with <literal>**</literal>.
59048 </para>
59049 </section>
59050 <section id="SECID256">
59051 <title>Fake deliveries</title>
59052 <para>
59053 <indexterm role="concept">
59054 <primary>delivery</primary>
59055 <secondary>fake; logging</secondary>
59056 </indexterm>
59057 If a delivery does not actually take place because the <option>-N</option> option has been
59058 used to suppress it, a normal delivery line is written to the log, except that
59059 <quote>=&gt;</quote> is replaced by <quote>*&gt;</quote>.
59060 </para>
59061 </section>
59062 <section id="SECID257">
59063 <title>Completion</title>
59064 <para>
59065 A line of the form
59066 </para>
59067 <literallayout class="monospaced">
59068 2002-10-31 09:00:11 16ZCW1-0005MB-00 Completed
59069 </literallayout>
59070 <para>
59071 is written to the main log when a message is about to be removed from the spool
59072 at the end of its processing.
59073 </para>
59074 </section>
59075 <section id="SECID258">
59076 <title>Summary of Fields in Log Lines</title>
59077 <para>
59078 <indexterm role="concept">
59079 <primary>log</primary>
59080 <secondary>summary of fields</secondary>
59081 </indexterm>
59082 A summary of the field identifiers that are used in log lines is shown in
59083 the following table:
59084 </para>
59085 <literallayout>
59086 <literal>A   </literal>        authenticator name (and optional id)
59087 <literal>C   </literal>        SMTP confirmation on delivery
59088 <literal>    </literal>        command list for <quote>no mail in SMTP session</quote>
59089 <literal>CV  </literal>        certificate verification status
59090 <literal>D   </literal>        duration of <quote>no mail in SMTP session</quote>
59091 <literal>DN  </literal>        distinguished name from peer certificate
59092 <literal>DT  </literal>        on <literal>=&gt;</literal> lines: time taken for a delivery
59093 <literal>F   </literal>        sender address (on delivery lines)
59094 <literal>H   </literal>        host name and IP address
59095 <literal>I   </literal>        local interface used
59096 <literal>id  </literal>        message id for incoming message
59097 <literal>P   </literal>        on <literal>&lt;=</literal> lines: protocol used
59098 <literal>    </literal>        on <literal>=&gt;</literal> and <literal>**</literal> lines: return path
59099 <literal>QT  </literal>        on <literal>=&gt;</literal> lines: time spent on queue so far
59100 <literal>    </literal>        on <quote>Completed</quote> lines: time spent on queue
59101 <literal>R   </literal>        on <literal>&lt;=</literal> lines: reference for local bounce
59102 <literal>    </literal>        on <literal>=&gt;</literal>  <literal>**</literal> and <literal>==</literal> lines: router name
59103 <literal>S   </literal>        size of message
59104 <literal>ST  </literal>        shadow transport name
59105 <literal>T   </literal>        on <literal>&lt;=</literal> lines: message subject (topic)
59106 <literal>    </literal>        on <literal>=&gt;</literal> <literal>**</literal> and <literal>==</literal> lines: transport name
59107 <literal>U   </literal>        local user or RFC 1413 identity
59108 <literal>X   </literal>        TLS cipher suite
59109 </literallayout>
59110 </section>
59111 <section id="SECID259">
59112 <title>Other log entries</title>
59113 <para>
59114 Various other types of log entry are written from time to time. Most should be
59115 self-explanatory. Among the more common are:
59116 </para>
59117 <itemizedlist>
59118 <listitem>
59119 <para>
59120 <indexterm role="concept">
59121 <primary>retry</primary>
59122 <secondary>time not reached</secondary>
59123 </indexterm>
59124 <emphasis>retry time not reached</emphasis>&nbsp;&nbsp;An address previously suffered a temporary error
59125 during routing or local delivery, and the time to retry has not yet arrived.
59126 This message is not written to an individual message log file unless it happens
59127 during the first delivery attempt.
59128 </para>
59129 </listitem>
59130 <listitem>
59131 <para>
59132 <emphasis>retry time not reached for any host</emphasis>&nbsp;&nbsp;An address previously suffered
59133 temporary errors during remote delivery, and the retry time has not yet arrived
59134 for any of the hosts to which it is routed.
59135 </para>
59136 </listitem>
59137 <listitem>
59138 <para>
59139 <indexterm role="concept">
59140 <primary>spool directory</primary>
59141 <secondary>file locked</secondary>
59142 </indexterm>
59143 <emphasis>spool file locked</emphasis>&nbsp;&nbsp;An attempt to deliver a message cannot proceed because
59144 some other Exim process is already working on the message. This can be quite
59145 common if queue running processes are started at frequent intervals. The
59146 <emphasis>exiwhat</emphasis> utility script can be used to find out what Exim processes are
59147 doing.
59148 </para>
59149 </listitem>
59150 <listitem>
59151 <para>
59152 <indexterm role="concept">
59153 <primary>error</primary>
59154 <secondary>ignored</secondary>
59155 </indexterm>
59156 <emphasis>error ignored</emphasis>&nbsp;&nbsp;There are several circumstances that give rise to this
59157 message:
59158 </para>
59159 <orderedlist numeration="arabic">
59160 <listitem>
59161 <para>
59162 Exim failed to deliver a bounce message whose age was greater than
59163 <option>ignore_bounce_errors_after</option>. The bounce was discarded.
59164 </para>
59165 </listitem>
59166 <listitem>
59167 <para>
59168 A filter file set up a delivery using the <quote>noerror</quote> option, and the delivery
59169 failed. The delivery was discarded.
59170 </para>
59171 </listitem>
59172 <listitem>
59173 <para>
59174 A delivery set up by a router configured with
59175 </para>
59176 <literallayout class="monospaced">
59177     errors_to = &lt;&gt;
59178 </literallayout>
59179 <para>
59180 failed. The delivery was discarded.
59181 </para>
59182 </listitem>
59183 </orderedlist>
59184 </listitem>
59185 </itemizedlist>
59186 </section>
59187 <section id="SECTlogselector">
59188 <title>Reducing or increasing what is logged</title>
59189 <para>
59190 <indexterm role="concept">
59191 <primary>log</primary>
59192 <secondary>selectors</secondary>
59193 </indexterm>
59194 By setting the <option>log_selector</option> global option, you can disable some of Exim&#x2019;s
59195 default logging, or you can request additional logging. The value of
59196 <option>log_selector</option> is made up of names preceded by plus or minus characters. For
59197 example:
59198 </para>
59199 <literallayout class="monospaced">
59200 log_selector = +arguments -retry_defer
59201 </literallayout>
59202 <para>
59203 The list of optional log items is in the following table, with the default
59204 selection marked by asterisks:
59205 </para>
59206 <literallayout>
59207 <literal>*acl_warn_skipped           </literal>  skipped <option>warn</option> statement in ACL
59208 <literal> address_rewrite            </literal>  address rewriting
59209 <literal> all_parents                </literal>  all parents in =&gt; lines
59210 <literal> arguments                  </literal>  command line arguments
59211 <literal>*connection_reject          </literal>  connection rejections
59212 <literal>*delay_delivery             </literal>  immediate delivery delayed
59213 <literal> deliver_time               </literal>  time taken to perform delivery
59214 <literal> delivery_size              </literal>  add <literal>S=</literal><emphasis>nnn</emphasis> to =&gt; lines
59215 <literal>*dnslist_defer              </literal>  defers of DNS list (aka RBL) lookups
59216 <literal>*etrn                       </literal>  ETRN commands
59217 <literal>*host_lookup_failed         </literal>  as it says
59218 <literal> ident_timeout              </literal>  timeout for ident connection
59219 <literal> incoming_interface         </literal>  incoming interface on &lt;= lines
59220 <literal> incoming_port              </literal>  incoming port on &lt;= lines
59221 <literal>*lost_incoming_connection   </literal>  as it says (includes timeouts)
59222 <literal> outgoing_port              </literal>  add remote port to =&gt; lines
59223 <literal>*queue_run                  </literal>  start and end queue runs
59224 <literal> queue_time                 </literal>  time on queue for one recipient
59225 <literal> queue_time_overall         </literal>  time on queue for whole message
59226 <literal> pid                        </literal>  Exim process id
59227 <literal> received_recipients        </literal>  recipients on &lt;= lines
59228 <literal> received_sender            </literal>  sender on &lt;= lines
59229 <literal>*rejected_header            </literal>  header contents on reject log
59230 <literal>*retry_defer                </literal>  <quote>retry time not reached</quote>
59231 <literal> return_path_on_delivery    </literal>  put return path on =&gt; and ** lines
59232 <literal> sender_on_delivery         </literal>  add sender to =&gt; lines
59233 <literal>*sender_verify_fail         </literal>  sender verification failures
59234 <literal>*size_reject                </literal>  rejection because too big
59235 <literal>*skip_delivery              </literal>  delivery skipped in a queue run
59236 <literal> smtp_confirmation          </literal>  SMTP confirmation on =&gt; lines
59237 <literal> smtp_connection            </literal>  SMTP connections
59238 <literal> smtp_incomplete_transaction</literal>  incomplete SMTP transactions
59239 <literal> smtp_no_mail               </literal>  session with no MAIL commands
59240 <literal> smtp_protocol_error        </literal>  SMTP protocol errors
59241 <literal> smtp_syntax_error          </literal>  SMTP syntax errors
59242 <literal> subject                    </literal>  contents of <emphasis>Subject:</emphasis> on &lt;= lines
59243 <literal> tls_certificate_verified   </literal>  certificate verification status
59244 <literal>*tls_cipher                 </literal>  TLS cipher suite on &lt;= and =&gt; lines
59245 <literal> tls_peerdn                 </literal>  TLS peer DN on &lt;= and =&gt; lines
59246 <literal> unknown_in_list            </literal>  DNS lookup failed in list match
59247
59248 <literal> all                        </literal>  all of the above
59249 </literallayout>
59250 <para>
59251 More details on each of these items follows:
59252 </para>
59253 <itemizedlist>
59254 <listitem>
59255 <para>
59256 <indexterm role="concept">
59257 <primary><option>warn</option> ACL verb</primary>
59258 <secondary>log when skipping</secondary>
59259 </indexterm>
59260 <option>acl_warn_skipped</option>: When an ACL <option>warn</option> statement is skipped because one of
59261 its conditions cannot be evaluated, a log line to this effect is written if
59262 this log selector is set.
59263 </para>
59264 </listitem>
59265 <listitem>
59266 <para>
59267 <indexterm role="concept">
59268 <primary>log</primary>
59269 <secondary>rewriting</secondary>
59270 </indexterm>
59271 <indexterm role="concept">
59272 <primary>rewriting</primary>
59273 <secondary>logging</secondary>
59274 </indexterm>
59275 <option>address_rewrite</option>: This applies both to global rewrites and per-transport
59276 rewrites, but not to rewrites in filters run as an unprivileged user (because
59277 such users cannot access the log).
59278 </para>
59279 </listitem>
59280 <listitem>
59281 <para>
59282 <indexterm role="concept">
59283 <primary>log</primary>
59284 <secondary>full parentage</secondary>
59285 </indexterm>
59286 <option>all_parents</option>: Normally only the original and final addresses are logged on
59287 delivery lines; with this selector, intermediate parents are given in
59288 parentheses between them.
59289 </para>
59290 </listitem>
59291 <listitem>
59292 <para>
59293 <indexterm role="concept">
59294 <primary>log</primary>
59295 <secondary>Exim arguments</secondary>
59296 </indexterm>
59297 <indexterm role="concept">
59298 <primary>Exim arguments, logging</primary>
59299 </indexterm>
59300 <option>arguments</option>: This causes Exim to write the arguments with which it was called
59301 to the main log, preceded by the current working directory. This is a debugging
59302 feature, added to make it easier to find out how certain MUAs call
59303 <filename>/usr/sbin/sendmail</filename>. The logging does not happen if Exim has given up root
59304 privilege because it was called with the <option>-C</option> or <option>-D</option> options. Arguments
59305 that are empty or that contain white space are quoted. Non-printing characters
59306 are shown as escape sequences. This facility cannot log unrecognized arguments,
59307 because the arguments are checked before the configuration file is read. The
59308 only way to log such cases is to interpose a script such as <filename>util/logargs.sh</filename>
59309 between the caller and Exim.
59310 </para>
59311 </listitem>
59312 <listitem>
59313 <para>
59314 <indexterm role="concept">
59315 <primary>log</primary>
59316 <secondary>connection rejections</secondary>
59317 </indexterm>
59318 <option>connection_reject</option>: A log entry is written whenever an incoming SMTP
59319 connection is rejected, for whatever reason.
59320 </para>
59321 </listitem>
59322 <listitem>
59323 <para>
59324 <indexterm role="concept">
59325 <primary>log</primary>
59326 <secondary>delayed delivery</secondary>
59327 </indexterm>
59328 <indexterm role="concept">
59329 <primary>delayed delivery, logging</primary>
59330 </indexterm>
59331 <option>delay_delivery</option>: A log entry is written whenever a delivery process is not
59332 started for an incoming message because the load is too high or too many
59333 messages were received on one connection. Logging does not occur if no delivery
59334 process is started because <option>queue_only</option> is set or <option>-odq</option> was used.
59335 </para>
59336 </listitem>
59337 <listitem>
59338 <para>
59339 <indexterm role="concept">
59340 <primary>log</primary>
59341 <secondary>delivery duration</secondary>
59342 </indexterm>
59343 <option>deliver_time</option>: For each delivery, the amount of real time it has taken to
59344 perform the actual delivery is logged as DT=&lt;<emphasis>time</emphasis>&gt;, for example, <literal>DT=1s</literal>.
59345 </para>
59346 </listitem>
59347 <listitem>
59348 <para>
59349 <indexterm role="concept">
59350 <primary>log</primary>
59351 <secondary>message size on delivery</secondary>
59352 </indexterm>
59353 <indexterm role="concept">
59354 <primary>size</primary>
59355 <secondary>of message</secondary>
59356 </indexterm>
59357 <option>delivery_size</option>: For each delivery, the size of message delivered is added to
59358 the <quote>=&gt;</quote> line, tagged with S=.
59359 </para>
59360 </listitem>
59361 <listitem>
59362 <para>
59363 <indexterm role="concept">
59364 <primary>log</primary>
59365 <secondary>dnslist defer</secondary>
59366 </indexterm>
59367 <indexterm role="concept">
59368 <primary>DNS list</primary>
59369 <secondary>logging defer</secondary>
59370 </indexterm>
59371 <indexterm role="concept">
59372 <primary>black list (DNS)</primary>
59373 </indexterm>
59374 <option>dnslist_defer</option>: A log entry is written if an attempt to look up a host in a
59375 DNS black list suffers a temporary error.
59376 </para>
59377 </listitem>
59378 <listitem>
59379 <para>
59380 <indexterm role="concept">
59381 <primary>log</primary>
59382 <secondary>ETRN commands</secondary>
59383 </indexterm>
59384 <indexterm role="concept">
59385 <primary>ETRN</primary>
59386 <secondary>logging</secondary>
59387 </indexterm>
59388 <option>etrn</option>: Every valid ETRN command that is received is logged, before the ACL
59389 is run to determine whether or not it is actually accepted. An invalid ETRN
59390 command, or one received within a message transaction is not logged by this
59391 selector (see <option>smtp_syntax_error</option> and <option>smtp_protocol_error</option>).
59392 </para>
59393 </listitem>
59394 <listitem>
59395 <para>
59396 <indexterm role="concept">
59397 <primary>log</primary>
59398 <secondary>host lookup failure</secondary>
59399 </indexterm>
59400 <option>host_lookup_failed</option>: When a lookup of a host&#x2019;s IP addresses fails to find
59401 any addresses, or when a lookup of an IP address fails to find a host name, a
59402 log line is written. This logging does not apply to direct DNS lookups when
59403 routing email addresses, but it does apply to <quote>byname</quote> lookups.
59404 </para>
59405 </listitem>
59406 <listitem>
59407 <para>
59408 <indexterm role="concept">
59409 <primary>log</primary>
59410 <secondary>ident timeout</secondary>
59411 </indexterm>
59412 <indexterm role="concept">
59413 <primary>RFC 1413</primary>
59414 <secondary>logging timeout</secondary>
59415 </indexterm>
59416 <option>ident_timeout</option>: A log line is written whenever an attempt to connect to a
59417 client&#x2019;s ident port times out.
59418 </para>
59419 </listitem>
59420 <listitem>
59421 <para>
59422 <indexterm role="concept">
59423 <primary>log</primary>
59424 <secondary>incoming interface</secondary>
59425 </indexterm>
59426 <indexterm role="concept">
59427 <primary>interface</primary>
59428 <secondary>logging</secondary>
59429 </indexterm>
59430 <option>incoming_interface</option>: The interface on which a message was received is added
59431 to the <quote>&lt;=</quote> line as an IP address in square brackets, tagged by I= and
59432 followed by a colon and the port number. The local interface and port are also
59433 added to other SMTP log lines, for example <quote>SMTP connection from</quote>, and to
59434 rejection lines.
59435 </para>
59436 </listitem>
59437 <listitem>
59438 <para>
59439 <indexterm role="concept">
59440 <primary>log</primary>
59441 <secondary>incoming remote port</secondary>
59442 </indexterm>
59443 <indexterm role="concept">
59444 <primary>port</primary>
59445 <secondary>logging remote</secondary>
59446 </indexterm>
59447 <indexterm role="concept">
59448 <primary>TCP/IP</primary>
59449 <secondary>logging incoming remote port</secondary>
59450 </indexterm>
59451 <indexterm role="variable">
59452 <primary><varname>$sender_fullhost</varname></primary>
59453 </indexterm>
59454 <indexterm role="variable">
59455 <primary><varname>$sender_rcvhost</varname></primary>
59456 </indexterm>
59457 <option>incoming_port</option>: The remote port number from which a message was received is
59458 added to log entries and <emphasis>Received:</emphasis> header lines, following the IP address
59459 in square brackets, and separated from it by a colon. This is implemented by
59460 changing the value that is put in the <varname>$sender_fullhost</varname> and
59461 <varname>$sender_rcvhost</varname> variables. Recording the remote port number has become more
59462 important with the widening use of NAT (see RFC 2505).
59463 </para>
59464 </listitem>
59465 <listitem>
59466 <para>
59467 <indexterm role="concept">
59468 <primary>log</primary>
59469 <secondary>dropped connection</secondary>
59470 </indexterm>
59471 <option>lost_incoming_connection</option>: A log line is written when an incoming SMTP
59472 connection is unexpectedly dropped.
59473 </para>
59474 </listitem>
59475 <listitem>
59476 <para>
59477 <indexterm role="concept">
59478 <primary>log</primary>
59479 <secondary>outgoing remote port</secondary>
59480 </indexterm>
59481 <indexterm role="concept">
59482 <primary>port</primary>
59483 <secondary>logging outgoint remote</secondary>
59484 </indexterm>
59485 <indexterm role="concept">
59486 <primary>TCP/IP</primary>
59487 <secondary>logging ougtoing remote port</secondary>
59488 </indexterm>
59489 <option>outgoing_port</option>: The remote port number is added to delivery log lines (those
59490 containing =&gt; tags) following the IP address. This option is not included in
59491 the default setting, because for most ordinary configurations, the remote port
59492 number is always 25 (the SMTP port).
59493 </para>
59494 </listitem>
59495 <listitem>
59496 <para>
59497 <indexterm role="concept">
59498 <primary>log</primary>
59499 <secondary>process ids in</secondary>
59500 </indexterm>
59501 <indexterm role="concept">
59502 <primary>pid (process id)</primary>
59503 <secondary>in log lines</secondary>
59504 </indexterm>
59505 <option>pid</option>: The current process id is added to every log line, in square brackets,
59506 immediately after the time and date.
59507 </para>
59508 </listitem>
59509 <listitem>
59510 <para>
59511 <indexterm role="concept">
59512 <primary>log</primary>
59513 <secondary>queue run</secondary>
59514 </indexterm>
59515 <indexterm role="concept">
59516 <primary>queue runner</primary>
59517 <secondary>logging</secondary>
59518 </indexterm>
59519 <option>queue_run</option>: The start and end of every queue run are logged.
59520 </para>
59521 </listitem>
59522 <listitem>
59523 <para>
59524 <indexterm role="concept">
59525 <primary>log</primary>
59526 <secondary>queue time</secondary>
59527 </indexterm>
59528 <option>queue_time</option>: The amount of time the message has been in the queue on the
59529 local host is logged as QT=&lt;<emphasis>time</emphasis>&gt; on delivery (<literal>=&gt;</literal>) lines, for example,
59530 <literal>QT=3m45s</literal>. The clock starts when Exim starts to receive the message, so it
59531 includes reception time as well as the delivery time for the current address.
59532 This means that it may be longer than the difference between the arrival and
59533 delivery log line times, because the arrival log line is not written until the
59534 message has been successfully received.
59535 </para>
59536 </listitem>
59537 <listitem>
59538 <para>
59539 <option>queue_time_overall</option>: The amount of time the message has been in the queue on
59540 the local host is logged as QT=&lt;<emphasis>time</emphasis>&gt; on <quote>Completed</quote> lines, for
59541 example, <literal>QT=3m45s</literal>. The clock starts when Exim starts to receive the
59542 message, so it includes reception time as well as the total delivery time.
59543 </para>
59544 </listitem>
59545 <listitem>
59546 <para>
59547 <indexterm role="concept">
59548 <primary>log</primary>
59549 <secondary>recipients</secondary>
59550 </indexterm>
59551 <option>received_recipients</option>: The recipients of a message are listed in the main log
59552 as soon as the message is received. The list appears at the end of the log line
59553 that is written when a message is received, preceded by the word <quote>for</quote>. The
59554 addresses are listed after they have been qualified, but before any rewriting
59555 has taken place.
59556 Recipients that were discarded by an ACL for MAIL or RCPT do not appear
59557 in the list.
59558 </para>
59559 </listitem>
59560 <listitem>
59561 <para>
59562 <indexterm role="concept">
59563 <primary>log</primary>
59564 <secondary>sender reception</secondary>
59565 </indexterm>
59566 <option>received_sender</option>: The unrewritten original sender of a message is added to
59567 the end of the log line that records the message&#x2019;s arrival, after the word
59568 <quote>from</quote> (before the recipients if <option>received_recipients</option> is also set).
59569 </para>
59570 </listitem>
59571 <listitem>
59572 <para>
59573 <indexterm role="concept">
59574 <primary>log</primary>
59575 <secondary>header lines for rejection</secondary>
59576 </indexterm>
59577 <option>rejected_header</option>: If a message&#x2019;s header has been received at the time a
59578 rejection is written to the reject log, the complete header is added to the
59579 log. Header logging can be turned off individually for messages that are
59580 rejected by the <function>local_scan()</function> function (see section <xref linkend="SECTapiforloc"/>).
59581 </para>
59582 </listitem>
59583 <listitem>
59584 <para>
59585 <indexterm role="concept">
59586 <primary>log</primary>
59587 <secondary>retry defer</secondary>
59588 </indexterm>
59589 <option>retry_defer</option>: A log line is written if a delivery is deferred because a
59590 retry time has not yet been reached. However, this <quote>retry time not reached</quote>
59591 message is always omitted from individual message logs after the first delivery
59592 attempt.
59593 </para>
59594 </listitem>
59595 <listitem>
59596 <para>
59597 <indexterm role="concept">
59598 <primary>log</primary>
59599 <secondary>return path</secondary>
59600 </indexterm>
59601 <option>return_path_on_delivery</option>: The return path that is being transmitted with
59602 the message is included in delivery and bounce lines, using the tag P=.
59603 This is omitted if no delivery actually happens, for example, if routing fails,
59604 or if delivery is to <filename>/dev/null</filename> or to <literal>:blackhole:</literal>.
59605 </para>
59606 </listitem>
59607 <listitem>
59608 <para>
59609 <indexterm role="concept">
59610 <primary>log</primary>
59611 <secondary>sender on delivery</secondary>
59612 </indexterm>
59613 <option>sender_on_delivery</option>: The message&#x2019;s sender address is added to every delivery
59614 and bounce line, tagged by F= (for <quote>from</quote>).
59615 This is the original sender that was received with the message; it is not
59616 necessarily the same as the outgoing return path.
59617 </para>
59618 </listitem>
59619 <listitem>
59620 <para>
59621 <indexterm role="concept">
59622 <primary>log</primary>
59623 <secondary>sender verify failure</secondary>
59624 </indexterm>
59625 <option>sender_verify_fail</option>: If this selector is unset, the separate log line that
59626 gives details of a sender verification failure is not written. Log lines for
59627 the rejection of SMTP commands contain just <quote>sender verify failed</quote>, so some
59628 detail is lost.
59629 </para>
59630 </listitem>
59631 <listitem>
59632 <para>
59633 <indexterm role="concept">
59634 <primary>log</primary>
59635 <secondary>size rejection</secondary>
59636 </indexterm>
59637 <option>size_reject</option>: A log line is written whenever a message is rejected because
59638 it is too big.
59639 </para>
59640 </listitem>
59641 <listitem>
59642 <para>
59643 <indexterm role="concept">
59644 <primary>log</primary>
59645 <secondary>frozen messages; skipped</secondary>
59646 </indexterm>
59647 <indexterm role="concept">
59648 <primary>frozen messages</primary>
59649 <secondary>logging skipping</secondary>
59650 </indexterm>
59651 <option>skip_delivery</option>: A log line is written whenever a message is skipped during a
59652 queue run because it is frozen or because another process is already delivering
59653 it.
59654 <indexterm role="concept">
59655 <primary><quote>spool file is locked</quote></primary>
59656 </indexterm>
59657 The message that is written is <quote>spool file is locked</quote>.
59658 </para>
59659 </listitem>
59660 <listitem>
59661 <para>
59662 <indexterm role="concept">
59663 <primary>log</primary>
59664 <secondary>smtp confirmation</secondary>
59665 </indexterm>
59666 <indexterm role="concept">
59667 <primary>SMTP</primary>
59668 <secondary>logging confirmation</secondary>
59669 </indexterm>
59670 <option>smtp_confirmation</option>: The response to the final <quote>.</quote> in the SMTP dialogue for
59671 outgoing messages is added to delivery log lines in the form <literal>C=</literal>&lt;<emphasis>text</emphasis>&gt;.
59672 A number of MTAs (including Exim) return an identifying string in this
59673 response.
59674 </para>
59675 </listitem>
59676 <listitem>
59677 <para>
59678 <indexterm role="concept">
59679 <primary>log</primary>
59680 <secondary>SMTP connections</secondary>
59681 </indexterm>
59682 <indexterm role="concept">
59683 <primary>SMTP</primary>
59684 <secondary>logging connections</secondary>
59685 </indexterm>
59686 <option>smtp_connection</option>: A log line is written whenever an SMTP connection is
59687 established or closed, unless the connection is from a host that matches
59688 <option>hosts_connection_nolog</option>. (In contrast, <option>lost_incoming_connection</option> applies
59689 only when the closure is unexpected.) This applies to connections from local
59690 processes that use <option>-bs</option> as well as to TCP/IP connections. If a connection is
59691 dropped in the middle of a message, a log line is always written, whether or
59692 not this selector is set, but otherwise nothing is written at the start and end
59693 of connections unless this selector is enabled.
59694 </para>
59695 <para>
59696 For TCP/IP connections to an Exim daemon, the current number of connections is
59697 included in the log message for each new connection, but note that the count is
59698 reset if the daemon is restarted.
59699 Also, because connections are closed (and the closure is logged) in
59700 subprocesses, the count may not include connections that have been closed but
59701 whose termination the daemon has not yet noticed. Thus, while it is possible to
59702 match up the opening and closing of connections in the log, the value of the
59703 logged counts may not be entirely accurate.
59704 </para>
59705 </listitem>
59706 <listitem>
59707 <para>
59708 <indexterm role="concept">
59709 <primary>log</primary>
59710 <secondary>SMTP transaction; incomplete</secondary>
59711 </indexterm>
59712 <indexterm role="concept">
59713 <primary>SMTP</primary>
59714 <secondary>logging incomplete transactions</secondary>
59715 </indexterm>
59716 <option>smtp_incomplete_transaction</option>: When a mail transaction is aborted by
59717 RSET, QUIT, loss of connection, or otherwise, the incident is logged,
59718 and the message sender plus any accepted recipients are included in the log
59719 line. This can provide evidence of dictionary attacks.
59720 </para>
59721 </listitem>
59722 <listitem>
59723 <para>
59724 <indexterm role="concept">
59725 <primary>log</primary>
59726 <secondary>non-MAIL SMTP sessions</secondary>
59727 </indexterm>
59728 <indexterm role="concept">
59729 <primary>MAIL</primary>
59730 <secondary>logging session without</secondary>
59731 </indexterm>
59732 <option>smtp_no_mail</option>: A line is written to the main log whenever an accepted SMTP
59733 connection terminates without having issued a MAIL command. This includes both
59734 the case when the connection is dropped, and the case when QUIT is used. It
59735 does not include cases where the connection is rejected right at the start (by
59736 an ACL, or because there are too many connections, or whatever). These cases
59737 already have their own log lines.
59738 </para>
59739 <para>
59740 The log line that is written contains the identity of the client in the usual
59741 way, followed by D= and a time, which records the duration of the connection.
59742 If the connection was authenticated, this fact is logged exactly as it is for
59743 an incoming message, with an A= item. If the connection was encrypted, CV=,
59744 DN=, and X= items may appear as they do for an incoming message, controlled by
59745 the same logging options.
59746 </para>
59747 <para>
59748 Finally, if any SMTP commands were issued during the connection, a C= item
59749 is added to the line, listing the commands that were used. For example,
59750 </para>
59751 <literallayout class="monospaced">
59752 C=EHLO,QUIT
59753 </literallayout>
59754 <para>
59755 shows that the client issued QUIT straight after EHLO. If there were fewer
59756 than 20 commands, they are all listed. If there were more than 20 commands,
59757 the last 20 are listed, preceded by <quote>...</quote>. However, with the default
59758 setting of 10 for <option>smtp_accep_max_nonmail</option>, the connection will in any case
59759 have been aborted before 20 non-mail commands are processed.
59760 </para>
59761 </listitem>
59762 <listitem>
59763 <para>
59764 <indexterm role="concept">
59765 <primary>log</primary>
59766 <secondary>SMTP protocol error</secondary>
59767 </indexterm>
59768 <indexterm role="concept">
59769 <primary>SMTP</primary>
59770 <secondary>logging protocol error</secondary>
59771 </indexterm>
59772 <option>smtp_protocol_error</option>: A log line is written for every SMTP protocol error
59773 encountered. Exim does not have perfect detection of all protocol errors
59774 because of transmission delays and the use of pipelining. If PIPELINING has
59775 been advertised to a client, an Exim server assumes that the client will use
59776 it, and therefore it does not count <quote>expected</quote> errors (for example, RCPT
59777 received after rejecting MAIL) as protocol errors.
59778 </para>
59779 </listitem>
59780 <listitem>
59781 <para>
59782 <indexterm role="concept">
59783 <primary>SMTP</primary>
59784 <secondary>logging syntax errors</secondary>
59785 </indexterm>
59786 <indexterm role="concept">
59787 <primary>SMTP</primary>
59788 <secondary>syntax errors; logging</secondary>
59789 </indexterm>
59790 <indexterm role="concept">
59791 <primary>SMTP</primary>
59792 <secondary>unknown command; logging</secondary>
59793 </indexterm>
59794 <indexterm role="concept">
59795 <primary>log</primary>
59796 <secondary>unknown SMTP command</secondary>
59797 </indexterm>
59798 <indexterm role="concept">
59799 <primary>log</primary>
59800 <secondary>SMTP syntax error</secondary>
59801 </indexterm>
59802 <option>smtp_syntax_error</option>: A log line is written for every SMTP syntax error
59803 encountered. An unrecognized command is treated as a syntax error. For an
59804 external connection, the host identity is given; for an internal connection
59805 using <option>-bs</option> the sender identification (normally the calling user) is given.
59806 </para>
59807 </listitem>
59808 <listitem>
59809 <para>
59810 <indexterm role="concept">
59811 <primary>log</primary>
59812 <secondary>subject</secondary>
59813 </indexterm>
59814 <indexterm role="concept">
59815 <primary>subject, logging</primary>
59816 </indexterm>
59817 <option>subject</option>: The subject of the message is added to the arrival log line,
59818 preceded by <quote>T=</quote> (T for <quote>topic</quote>, since S is already used for <quote>size</quote>).
59819 Any MIME <quote>words</quote> in the subject are decoded. The <option>print_topbitchars</option> option
59820 specifies whether characters with values greater than 127 should be logged
59821 unchanged, or whether they should be rendered as escape sequences.
59822 </para>
59823 </listitem>
59824 <listitem>
59825 <para>
59826 <indexterm role="concept">
59827 <primary>log</primary>
59828 <secondary>certificate verification</secondary>
59829 </indexterm>
59830 <option>tls_certificate_verified</option>: An extra item is added to &lt;= and =&gt; log lines
59831 when TLS is in use. The item is <literal>CV=yes</literal> if the peer&#x2019;s certificate was
59832 verified, and <literal>CV=no</literal> if not.
59833 </para>
59834 </listitem>
59835 <listitem>
59836 <para>
59837 <indexterm role="concept">
59838 <primary>log</primary>
59839 <secondary>TLS cipher</secondary>
59840 </indexterm>
59841 <indexterm role="concept">
59842 <primary>TLS</primary>
59843 <secondary>logging cipher</secondary>
59844 </indexterm>
59845 <option>tls_cipher</option>: When a message is sent or received over an encrypted
59846 connection, the cipher suite used is added to the log line, preceded by X=.
59847 </para>
59848 </listitem>
59849 <listitem>
59850 <para>
59851 <indexterm role="concept">
59852 <primary>log</primary>
59853 <secondary>TLS peer DN</secondary>
59854 </indexterm>
59855 <indexterm role="concept">
59856 <primary>TLS</primary>
59857 <secondary>logging peer DN</secondary>
59858 </indexterm>
59859 <option>tls_peerdn</option>: When a message is sent or received over an encrypted
59860 connection, and a certificate is supplied by the remote host, the peer DN is
59861 added to the log line, preceded by DN=.
59862 </para>
59863 </listitem>
59864 <listitem>
59865 <para>
59866 <indexterm role="concept">
59867 <primary>log</primary>
59868 <secondary>DNS failure in list</secondary>
59869 </indexterm>
59870 <option>unknown_in_list</option>: This setting causes a log entry to be written when the
59871 result of a list match is failure because a DNS lookup failed.
59872 </para>
59873 </listitem>
59874 </itemizedlist>
59875 </section>
59876 <section id="SECID260">
59877 <title>Message log</title>
59878 <para>
59879 <indexterm role="concept">
59880 <primary>message</primary>
59881 <secondary>log file for</secondary>
59882 </indexterm>
59883 <indexterm role="concept">
59884 <primary>log</primary>
59885 <secondary>message log; description of</secondary>
59886 </indexterm>
59887 <indexterm role="concept">
59888 <primary><filename>msglog</filename> directory</primary>
59889 </indexterm>
59890 <indexterm role="option">
59891 <primary><option>preserve_message_logs</option></primary>
59892 </indexterm>
59893 In addition to the general log files, Exim writes a log file for each message
59894 that it handles. The names of these per-message logs are the message ids, and
59895 they are kept in the <filename>msglog</filename> sub-directory of the spool directory. Each
59896 message log contains copies of the log lines that apply to the message. This
59897 makes it easier to inspect the status of an individual message without having
59898 to search the main log. A message log is deleted when processing of the message
59899 is complete, unless <option>preserve_message_logs</option> is set, but this should be used
59900 only with great care because they can fill up your disk very quickly.
59901 </para>
59902 <para>
59903 On a heavily loaded system, it may be desirable to disable the use of
59904 per-message logs, in order to reduce disk I/O. This can be done by setting the
59905 <option>message_logs</option> option false.
59906 <indexterm role="concept" startref="IIDloggen" class="endofrange"/>
59907 </para>
59908 </section>
59909 </chapter>
59910
59911 <chapter id="CHAPutils">
59912 <title>Exim utilities</title>
59913 <para>
59914 <indexterm role="concept" id="IIDutils" class="startofrange">
59915 <primary>utilities</primary>
59916 </indexterm>
59917 A number of utility scripts and programs are supplied with Exim and are
59918 described in this chapter. There is also the Exim Monitor, which is covered in
59919 the next chapter. The utilities described here are:
59920 </para>
59921 <informaltable frame="none">
59922 <tgroup cols="3" colsep="0" rowsep="0">
59923 <colspec colwidth="7*" align="left"/>
59924 <colspec colwidth="15*" align="left"/>
59925 <colspec colwidth="40*" align="left"/>
59926 <tbody>
59927 <row>
59928 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTfinoutwha"/></entry>
59929 <entry><emphasis>exiwhat</emphasis></entry>
59930 <entry>list what Exim processes are doing</entry>
59931 </row>
59932 <row>
59933 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTgreptheque"/></entry>
59934 <entry><emphasis>exiqgrep</emphasis></entry>
59935 <entry>grep the queue</entry>
59936 </row>
59937 <row>
59938 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTsumtheque"/></entry>
59939 <entry><emphasis>exiqsumm</emphasis></entry>
59940 <entry>summarize the queue</entry>
59941 </row>
59942 <row>
59943 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTextspeinf"/></entry>
59944 <entry><emphasis>exigrep</emphasis></entry>
59945 <entry>search the main log</entry>
59946 </row>
59947 <row>
59948 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTexipick"/></entry>
59949 <entry><emphasis>exipick</emphasis></entry>
59950 <entry>select messages on various criteria</entry>
59951 </row>
59952 <row>
59953 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTcyclogfil"/></entry>
59954 <entry><emphasis>exicyclog</emphasis></entry>
59955 <entry>cycle (rotate) log files</entry>
59956 </row>
59957 <row>
59958 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTmailstat"/></entry>
59959 <entry><emphasis>eximstats</emphasis></entry>
59960 <entry>extract statistics from the log</entry>
59961 </row>
59962 <row>
59963 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTcheckaccess"/></entry>
59964 <entry><emphasis>exim_checkaccess</emphasis></entry>
59965 <entry>check address acceptance from given IP</entry>
59966 </row>
59967 <row>
59968 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTdbmbuild"/></entry>
59969 <entry><emphasis>exim_dbmbuild</emphasis></entry>
59970 <entry>build a DBM file</entry>
59971 </row>
59972 <row>
59973 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTfinindret"/></entry>
59974 <entry><emphasis>exinext</emphasis></entry>
59975 <entry>extract retry information</entry>
59976 </row>
59977 <row>
59978 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
59979 <entry><emphasis>exim_dumpdb</emphasis></entry>
59980 <entry>dump a hints database</entry>
59981 </row>
59982 <row>
59983 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
59984 <entry><emphasis>exim_tidydb</emphasis></entry>
59985 <entry>clean up a hints database</entry>
59986 </row>
59987 <row>
59988 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
59989 <entry><emphasis>exim_fixdb</emphasis></entry>
59990 <entry>patch a hints database</entry>
59991 </row>
59992 <row>
59993 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTmailboxmaint"/></entry>
59994 <entry><emphasis>exim_lock</emphasis></entry>
59995 <entry>lock a mailbox file</entry>
59996 </row>
59997 </tbody>
59998 </tgroup>
59999 </informaltable>
60000 <para>
60001 Another utility that might be of use to sites with many MTAs is Tom Kistner&#x2019;s
60002 <emphasis>exilog</emphasis>. It provides log visualizations across multiple Exim servers. See
60003 <emphasis role="bold"><ulink url="http://duncanthrax.net/exilog/">http://duncanthrax.net/exilog/</ulink></emphasis> for details.
60004 </para>
60005 <section id="SECTfinoutwha">
60006 <title>Finding out what Exim processes are doing (exiwhat)</title>
60007 <para>
60008 <indexterm role="concept">
60009 <primary><emphasis>exiwhat</emphasis></primary>
60010 </indexterm>
60011 <indexterm role="concept">
60012 <primary>process, querying</primary>
60013 </indexterm>
60014 <indexterm role="concept">
60015 <primary>SIGUSR1</primary>
60016 </indexterm>
60017 On operating systems that can restart a system call after receiving a signal
60018 (most modern OS), an Exim process responds to the SIGUSR1 signal by writing
60019 a line describing what it is doing to the file <filename>exim-process.info</filename> in the
60020 Exim spool directory. The <emphasis>exiwhat</emphasis> script sends the signal to all Exim
60021 processes it can find, having first emptied the file. It then waits for one
60022 second to allow the Exim processes to react before displaying the results. In
60023 order to run <emphasis>exiwhat</emphasis> successfully you have to have sufficient privilege to
60024 send the signal to the Exim processes, so it is normally run as root.
60025 </para>
60026 <para>
60027 <emphasis role="bold">Warning</emphasis>: This is not an efficient process. It is intended for occasional
60028 use by system administrators. It is not sensible, for example, to set up a
60029 script that sends SIGUSR1 signals to Exim processes at short intervals.
60030 </para>
60031 <para>
60032 Unfortunately, the <emphasis>ps</emphasis> command that <emphasis>exiwhat</emphasis> uses to find Exim processes
60033 varies in different operating systems. Not only are different options used,
60034 but the format of the output is different. For this reason, there are some
60035 system configuration options that configure exactly how <emphasis>exiwhat</emphasis> works. If
60036 it doesn&#x2019;t seem to be working for you, check the following compile-time
60037 options:
60038 </para>
60039 <literallayout>
60040 <literal>EXIWHAT_PS_CMD    </literal> the command for running <emphasis>ps</emphasis>
60041 <literal>EXIWHAT_PS_ARG    </literal> the argument for <emphasis>ps</emphasis>
60042 <literal>EXIWHAT_EGREP_ARG </literal> the argument for <emphasis>egrep</emphasis> to select from <emphasis>ps</emphasis> output
60043 <literal>EXIWHAT_KILL_ARG  </literal> the argument for the <emphasis>kill</emphasis> command
60044 </literallayout>
60045 <para>
60046 An example of typical output from <emphasis>exiwhat</emphasis> is
60047 </para>
60048 <literallayout class="monospaced">
60049 164 daemon: -q1h, listening on port 25
60050 10483 running queue: waiting for 0tAycK-0002ij-00 (10492)
60051 10492 delivering 0tAycK-0002ij-00 to mail.ref.example
60052   [10.19.42.42] (editor@ref.example)
60053 10592 handling incoming call from [192.168.243.242]
60054 10628 accepting a local non-SMTP message
60055 </literallayout>
60056 <para>
60057 The first number in the output line is the process number. The third line has
60058 been split here, in order to fit it on the page.
60059 </para>
60060 </section>
60061 <section id="SECTgreptheque">
60062 <title>Selective queue listing (exiqgrep)</title>
60063 <para>
60064 <indexterm role="concept">
60065 <primary><emphasis>exiqgrep</emphasis></primary>
60066 </indexterm>
60067 <indexterm role="concept">
60068 <primary>queue</primary>
60069 <secondary>grepping</secondary>
60070 </indexterm>
60071 This utility is a Perl script contributed by Matt Hubbard. It runs
60072 </para>
60073 <literallayout class="monospaced">
60074 exim -bpu
60075 </literallayout>
60076 <para>
60077 to obtain a queue listing with undelivered recipients only, and then greps the
60078 output to select messages that match given criteria. The following selection
60079 options are available:
60080 </para>
60081 <variablelist>
60082 <varlistentry>
60083 <term><emphasis role="bold">-f</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
60084 <listitem>
60085 <para>
60086 Match the sender address. The field that is tested is enclosed in angle
60087 brackets, so you can test for bounce messages with
60088 </para>
60089 <literallayout class="monospaced">
60090 exiqgrep -f '^&lt;&gt;$'
60091 </literallayout>
60092 </listitem></varlistentry>
60093 <varlistentry>
60094 <term><emphasis role="bold">-r</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
60095 <listitem>
60096 <para>
60097 Match a recipient address. The field that is tested is not enclosed in angle
60098 brackets.
60099 </para>
60100 </listitem></varlistentry>
60101 <varlistentry>
60102 <term><emphasis role="bold">-s</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
60103 <listitem>
60104 <para>
60105 Match against the size field.
60106 </para>
60107 </listitem></varlistentry>
60108 <varlistentry>
60109 <term><emphasis role="bold">-y</emphasis>&nbsp;&lt;<emphasis>seconds</emphasis>&gt;</term>
60110 <listitem>
60111 <para>
60112 Match messages that are younger than the given time.
60113 </para>
60114 </listitem></varlistentry>
60115 <varlistentry>
60116 <term><emphasis role="bold">-o</emphasis>&nbsp;&lt;<emphasis>seconds</emphasis>&gt;</term>
60117 <listitem>
60118 <para>
60119 Match messages that are older than the given time.
60120 </para>
60121 </listitem></varlistentry>
60122 <varlistentry>
60123 <term><emphasis role="bold">-z</emphasis></term>
60124 <listitem>
60125 <para>
60126 Match only frozen messages.
60127 </para>
60128 </listitem></varlistentry>
60129 <varlistentry>
60130 <term><emphasis role="bold">-x</emphasis></term>
60131 <listitem>
60132 <para>
60133 Match only non-frozen messages.
60134 </para>
60135 </listitem></varlistentry>
60136 </variablelist>
60137 <para>
60138 The following options control the format of the output:
60139 </para>
60140 <variablelist>
60141 <varlistentry>
60142 <term><emphasis role="bold">-c</emphasis></term>
60143 <listitem>
60144 <para>
60145 Display only the count of matching messages.
60146 </para>
60147 </listitem></varlistentry>
60148 <varlistentry>
60149 <term><emphasis role="bold">-l</emphasis></term>
60150 <listitem>
60151 <para>
60152 Long format &ndash; display the full message information as output by Exim. This is
60153 the default.
60154 </para>
60155 </listitem></varlistentry>
60156 <varlistentry>
60157 <term><emphasis role="bold">-i</emphasis></term>
60158 <listitem>
60159 <para>
60160 Display message ids only.
60161 </para>
60162 </listitem></varlistentry>
60163 <varlistentry>
60164 <term><emphasis role="bold">-b</emphasis></term>
60165 <listitem>
60166 <para>
60167 Brief format &ndash; one line per message.
60168 </para>
60169 </listitem></varlistentry>
60170 <varlistentry>
60171 <term><emphasis role="bold">-R</emphasis></term>
60172 <listitem>
60173 <para>
60174 Display messages in reverse order.
60175 </para>
60176 </listitem></varlistentry>
60177 </variablelist>
60178 <para>
60179 There is one more option, <option>-h</option>, which outputs a list of options.
60180 </para>
60181 </section>
60182 <section id="SECTsumtheque">
60183 <title>Summarizing the queue (exiqsumm)</title>
60184 <para>
60185 <indexterm role="concept">
60186 <primary><emphasis>exiqsumm</emphasis></primary>
60187 </indexterm>
60188 <indexterm role="concept">
60189 <primary>queue</primary>
60190 <secondary>summary</secondary>
60191 </indexterm>
60192 The <emphasis>exiqsumm</emphasis> utility is a Perl script which reads the output of <literal>exim
60193 -bp</literal> and produces a summary of the messages on the queue. Thus, you use it by
60194 running a command such as
60195 </para>
60196 <literallayout class="monospaced">
60197 exim -bp | exiqsumm
60198 </literallayout>
60199 <para>
60200 The output consists of one line for each domain that has messages waiting for
60201 it, as in the following example:
60202 </para>
60203 <literallayout class="monospaced">
60204 3   2322   74m   66m  msn.com.example
60205 </literallayout>
60206 <para>
60207 Each line lists the number of pending deliveries for a domain, their total
60208 volume, and the length of time that the oldest and the newest messages have
60209 been waiting. Note that the number of pending deliveries is greater than the
60210 number of messages when messages have more than one recipient.
60211 </para>
60212 <para>
60213 A summary line is output at the end. By default the output is sorted on the
60214 domain name, but <emphasis>exiqsumm</emphasis> has the options <option>-a</option> and <option>-c</option>, which cause
60215 the output to be sorted by oldest message and by count of messages,
60216 respectively. There are also three options that split the messages for each
60217 domain into two or more subcounts: <option>-b</option> separates bounce messages, <option>-f</option>
60218 separates frozen messages, and <option>-s</option> separates messages according to their
60219 sender.
60220 </para>
60221 <para>
60222 The output of <emphasis>exim -bp</emphasis> contains the original addresses in the message, so
60223 this also applies to the output from <emphasis>exiqsumm</emphasis>. No domains from addresses
60224 generated by aliasing or forwarding are included (unless the <option>one_time</option>
60225 option of the <command>redirect</command> router has been used to convert them into <quote>top
60226 level</quote> addresses).
60227 </para>
60228 </section>
60229 <section id="SECTextspeinf">
60230 <title>Extracting specific information from the log (exigrep)</title>
60231 <para>
60232 <indexterm role="concept">
60233 <primary><emphasis>exigrep</emphasis></primary>
60234 </indexterm>
60235 <indexterm role="concept">
60236 <primary>log</primary>
60237 <secondary>extracts; grepping for</secondary>
60238 </indexterm>
60239 The <emphasis>exigrep</emphasis> utility is a Perl script that searches one or more main log
60240 files for entries that match a given pattern. When it finds a match, it
60241 extracts all the log entries for the relevant message, not just those that
60242 match the pattern. Thus, <emphasis>exigrep</emphasis> can extract complete log entries for a
60243 given message, or all mail for a given user, or for a given host, for example.
60244 The input files can be in Exim log format or syslog format.
60245 If a matching log line is not associated with a specific message, it is
60246 included in <emphasis>exigrep</emphasis>&#x2019;s output without any additional lines. The usage is:
60247 </para>
60248 <literallayout>
60249 <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>
60250 </literallayout>
60251 <para>
60252 If no log file names are given on the command line, the standard input is read.
60253 </para>
60254 <para>
60255 The <option>-t</option> argument specifies a number of seconds. It adds an additional
60256 condition for message selection. Messages that are complete are shown only if
60257 they spent more than &lt;<emphasis>n</emphasis>&gt; seconds on the queue.
60258 </para>
60259 <para>
60260 By default, <emphasis>exigrep</emphasis> does case-insensitive matching. The <option>-I</option> option
60261 makes it case-sensitive. This may give a performance improvement when searching
60262 large log files. Without <option>-I</option>, the Perl pattern matches use Perl&#x2019;s <literal>/i</literal>
60263 option; with <option>-I</option> they do not. In both cases it is possible to change the
60264 case sensitivity within the pattern by using <literal>(?i)</literal> or <literal>(?-i)</literal>.
60265 </para>
60266 <para>
60267 The <option>-l</option> option means <quote>literal</quote>, that is, treat all characters in the
60268 pattern as standing for themselves. Otherwise the pattern must be a Perl
60269 regular expression.
60270 </para>
60271 <para>
60272 The <option>-v</option> option inverts the matching condition. That is, a line is selected
60273 if it does <emphasis>not</emphasis> match the pattern.
60274 </para>
60275 <para>
60276 If the location of a <emphasis>zcat</emphasis> command is known from the definition of
60277 ZCAT_COMMAND in <filename>Local/Makefile</filename>, <emphasis>exigrep</emphasis> automatically passes any file
60278 whose name ends in COMPRESS_SUFFIX through <emphasis>zcat</emphasis> as it searches it.
60279 </para>
60280 </section>
60281 <section id="SECTexipick">
60282 <title>Selecting messages by various criteria (exipick)</title>
60283 <para>
60284 <indexterm role="concept">
60285 <primary><emphasis>exipick</emphasis></primary>
60286 </indexterm>
60287 John Jetmore&#x2019;s <emphasis>exipick</emphasis> utility is included in the Exim distribution. It
60288 lists messages from the queue according to a variety of criteria. For details
60289 of <emphasis>exipick</emphasis>&#x2019;s facilities, visit the web page at
60290 <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
60291 the <option>--help</option> option.
60292 </para>
60293 </section>
60294 <section id="SECTcyclogfil">
60295 <title>Cycling log files (exicyclog)</title>
60296 <para>
60297 <indexterm role="concept">
60298 <primary>log</primary>
60299 <secondary>cycling local files</secondary>
60300 </indexterm>
60301 <indexterm role="concept">
60302 <primary>cycling logs</primary>
60303 </indexterm>
60304 <indexterm role="concept">
60305 <primary><emphasis>exicyclog</emphasis></primary>
60306 </indexterm>
60307 The <emphasis>exicyclog</emphasis> script can be used to cycle (rotate) <emphasis>mainlog</emphasis> and
60308 <emphasis>rejectlog</emphasis> files. This is not necessary if only syslog is being used, or if
60309 you are using log files with datestamps in their names (see section
60310 <xref linkend="SECTdatlogfil"/>). Some operating systems have their own standard mechanisms
60311 for log cycling, and these can be used instead of <emphasis>exicyclog</emphasis> if preferred.
60312 There are two command line options for <emphasis>exicyclog</emphasis>:
60313 </para>
60314 <itemizedlist>
60315 <listitem>
60316 <para>
60317 <option>-k</option> &lt;<emphasis>count</emphasis>&gt; specifies the number of log files to keep, overriding the
60318 default that is set when Exim is built. The default default is 10.
60319 </para>
60320 </listitem>
60321 <listitem>
60322 <para>
60323 <option>-l</option> &lt;<emphasis>path</emphasis>&gt; specifies the log file path, in the same format as Exim&#x2019;s
60324 <option>log_file_path</option> option (for example, <literal>/var/log/exim_%slog</literal>), again
60325 overriding the script&#x2019;s default, which is to find the setting from Exim&#x2019;s
60326 configuration.
60327 </para>
60328 </listitem>
60329 </itemizedlist>
60330 <para>
60331 Each time <emphasis>exicyclog</emphasis> is run the file names get <quote>shuffled down</quote> by one. If
60332 the main log file name is <filename>mainlog</filename> (the default) then when <emphasis>exicyclog</emphasis> is
60333 run <filename>mainlog</filename> becomes <filename>mainlog.01</filename>, the previous <filename>mainlog.01</filename> becomes
60334 <filename>mainlog.02</filename> and so on, up to the limit that is set in the script or by the
60335 <option>-k</option> option. Log files whose numbers exceed the limit are discarded. Reject
60336 logs are handled similarly.
60337 </para>
60338 <para>
60339 If the limit is greater than 99, the script uses 3-digit numbers such as
60340 <filename>mainlog.001</filename>, <filename>mainlog.002</filename>, etc. If you change from a number less than 99
60341 to one that is greater, or <emphasis>vice versa</emphasis>, you will have to fix the names of
60342 any existing log files.
60343 </para>
60344 <para>
60345 If no <filename>mainlog</filename> file exists, the script does nothing. Files that <quote>drop off</quote>
60346 the end are deleted. All files with numbers greater than 01 are compressed,
60347 using a compression command which is configured by the COMPRESS_COMMAND
60348 setting in <filename>Local/Makefile</filename>. It is usual to run <emphasis>exicyclog</emphasis> daily from a
60349 root <option>crontab</option> entry of the form
60350 </para>
60351 <literallayout class="monospaced">
60352 1 0 * * * su exim -c /usr/exim/bin/exicyclog
60353 </literallayout>
60354 <para>
60355 assuming you have used the name <quote>exim</quote> for the Exim user. You can run
60356 <emphasis>exicyclog</emphasis> as root if you wish, but there is no need.
60357 </para>
60358 </section>
60359 <section id="SECTmailstat">
60360 <title>Mail statistics (eximstats)</title>
60361 <para>
60362 <indexterm role="concept">
60363 <primary>statistics</primary>
60364 </indexterm>
60365 <indexterm role="concept">
60366 <primary><emphasis>eximstats</emphasis></primary>
60367 </indexterm>
60368 A Perl script called <emphasis>eximstats</emphasis> is provided for extracting statistical
60369 information from log files. The output is either plain text, or HTML.
60370 Exim log files are also supported by the <emphasis>Lire</emphasis> system produced by the
60371 LogReport Foundation <emphasis role="bold"><ulink url="http://www.logreport.org">http://www.logreport.org</ulink></emphasis>.
60372 </para>
60373 <para>
60374 The <emphasis>eximstats</emphasis> script has been hacked about quite a bit over time. The
60375 latest version is the result of some extensive revision by Steve Campbell. A
60376 lot of information is given by default, but there are options for suppressing
60377 various parts of it. Following any options, the arguments to the script are a
60378 list of files, which should be main log files. For example:
60379 </para>
60380 <literallayout class="monospaced">
60381 eximstats -nr /var/spool/exim/log/mainlog.01
60382 </literallayout>
60383 <para>
60384 By default, <emphasis>eximstats</emphasis> extracts information about the number and volume of
60385 messages received from or delivered to various hosts. The information is sorted
60386 both by message count and by volume, and the top fifty hosts in each category
60387 are listed on the standard output. Similar information, based on email
60388 addresses or domains instead of hosts can be requested by means of various
60389 options. For messages delivered and received locally, similar statistics are
60390 also produced per user.
60391 </para>
60392 <para>
60393 The output also includes total counts and statistics about delivery errors, and
60394 histograms showing the number of messages received and deliveries made in each
60395 hour of the day. A delivery with more than one address in its envelope (for
60396 example, an SMTP transaction with more than one RCPT command) is counted
60397 as a single delivery by <emphasis>eximstats</emphasis>.
60398 </para>
60399 <para>
60400 Though normally more deliveries than receipts are reported (as messages may
60401 have multiple recipients), it is possible for <emphasis>eximstats</emphasis> to report more
60402 messages received than delivered, even though the queue is empty at the start
60403 and end of the period in question. If an incoming message contains no valid
60404 recipients, no deliveries are recorded for it. A bounce message is handled as
60405 an entirely separate message.
60406 </para>
60407 <para>
60408 <emphasis>eximstats</emphasis> always outputs a grand total summary giving the volume and number
60409 of messages received and deliveries made, and the number of hosts involved in
60410 each case. It also outputs the number of messages that were delayed (that is,
60411 not completely delivered at the first attempt), and the number that had at
60412 least one address that failed.
60413 </para>
60414 <para>
60415 The remainder of the output is in sections that can be independently disabled
60416 or modified by various options. It consists of a summary of deliveries by
60417 transport, histograms of messages received and delivered per time interval
60418 (default per hour), information about the time messages spent on the queue,
60419 a list of relayed messages, lists of the top fifty sending hosts, local
60420 senders, destination hosts, and destination local users by count and by volume,
60421 and a list of delivery errors that occurred.
60422 </para>
60423 <para>
60424 The relay information lists messages that were actually relayed, that is, they
60425 came from a remote host and were directly delivered to some other remote host,
60426 without being processed (for example, for aliasing or forwarding) locally.
60427 </para>
60428 <para>
60429 There are quite a few options for <emphasis>eximstats</emphasis> to control exactly what it
60430 outputs. These are documented in the Perl script itself, and can be extracted
60431 by running the command <command>perldoc</command> on the script. For example:
60432 </para>
60433 <literallayout class="monospaced">
60434 perldoc /usr/exim/bin/eximstats
60435 </literallayout>
60436 </section>
60437 <section id="SECTcheckaccess">
60438 <title>Checking access policy (exim_checkaccess)</title>
60439 <para>
60440 <indexterm role="concept">
60441 <primary><emphasis>exim_checkaccess</emphasis></primary>
60442 </indexterm>
60443 <indexterm role="concept">
60444 <primary>policy control</primary>
60445 <secondary>checking access</secondary>
60446 </indexterm>
60447 <indexterm role="concept">
60448 <primary>checking access</primary>
60449 </indexterm>
60450 The <option>-bh</option> command line argument allows you to run a fake SMTP session with
60451 debugging output, in order to check what Exim is doing when it is applying
60452 policy controls to incoming SMTP mail. However, not everybody is sufficiently
60453 familiar with the SMTP protocol to be able to make full use of <option>-bh</option>, and
60454 sometimes you just want to answer the question <quote>Does this address have
60455 access?</quote> without bothering with any further details.
60456 </para>
60457 <para>
60458 The <emphasis>exim_checkaccess</emphasis> utility is a <quote>packaged</quote> version of <option>-bh</option>. It takes
60459 two arguments, an IP address and an email address:
60460 </para>
60461 <literallayout class="monospaced">
60462 exim_checkaccess 10.9.8.7 A.User@a.domain.example
60463 </literallayout>
60464 <para>
60465 The utility runs a call to Exim with the <option>-bh</option> option, to test whether the
60466 given email address would be accepted in a RCPT command in a TCP/IP
60467 connection from the host with the given IP address. The output of the utility
60468 is either the word <quote>accepted</quote>, or the SMTP error response, for example:
60469 </para>
60470 <literallayout class="monospaced">
60471 Rejected:
60472 550 Relay not permitted
60473 </literallayout>
60474 <para>
60475 When running this test, the utility uses <literal>&lt;&gt;</literal> as the envelope sender address
60476 for the MAIL command, but you can change this by providing additional
60477 options. These are passed directly to the Exim command. For example, to specify
60478 that the test is to be run with the sender address <emphasis>himself@there.example</emphasis>
60479 you can use:
60480 </para>
60481 <literallayout class="monospaced">
60482 exim_checkaccess 10.9.8.7 A.User@a.domain.example \
60483                  -f himself@there.example
60484 </literallayout>
60485 <para>
60486 Note that these additional Exim command line items must be given after the two
60487 mandatory arguments.
60488 </para>
60489 <para>
60490 Because the <option>exim_checkaccess</option> uses <option>-bh</option>, it does not perform callouts
60491 while running its checks. You can run checks that include callouts by using
60492 <option>-bhc</option>, but this is not yet available in a <quote>packaged</quote> form.
60493 </para>
60494 </section>
60495 <section id="SECTdbmbuild">
60496 <title>Making DBM files (exim_dbmbuild)</title>
60497 <para>
60498 <indexterm role="concept">
60499 <primary>DBM</primary>
60500 <secondary>building dbm files</secondary>
60501 </indexterm>
60502 <indexterm role="concept">
60503 <primary>building DBM files</primary>
60504 </indexterm>
60505 <indexterm role="concept">
60506 <primary><emphasis>exim_dbmbuild</emphasis></primary>
60507 </indexterm>
60508 <indexterm role="concept">
60509 <primary>lower casing</primary>
60510 </indexterm>
60511 <indexterm role="concept">
60512 <primary>binary zero</primary>
60513 <secondary>in lookup key</secondary>
60514 </indexterm>
60515 The <emphasis>exim_dbmbuild</emphasis> program reads an input file containing keys and data in
60516 the format used by the <command>lsearch</command> lookup (see section
60517 <xref linkend="SECTsinglekeylookups"/>). It writes a DBM file using the lower-cased alias
60518 names as keys and the remainder of the information as data. The lower-casing
60519 can be prevented by calling the program with the <option>-nolc</option> option.
60520 </para>
60521 <para>
60522 A terminating zero is included as part of the key string. This is expected by
60523 the <command>dbm</command> lookup type. However, if the option <option>-nozero</option> is given,
60524 <emphasis>exim_dbmbuild</emphasis> creates files without terminating zeroes in either the key
60525 strings or the data strings. The <command>dbmnz</command> lookup type can be used with such
60526 files.
60527 </para>
60528 <para>
60529 The program requires two arguments: the name of the input file (which can be a
60530 single hyphen to indicate the standard input), and the name of the output file.
60531 It creates the output under a temporary name, and then renames it if all went
60532 well.
60533 </para>
60534 <para>
60535 <indexterm role="concept">
60536 <primary>USE_DB</primary>
60537 </indexterm>
60538 If the native DB interface is in use (USE_DB is set in a compile-time
60539 configuration file &ndash; this is common in free versions of Unix) the two file
60540 names must be different, because in this mode the Berkeley DB functions create
60541 a single output file using exactly the name given. For example,
60542 </para>
60543 <literallayout class="monospaced">
60544 exim_dbmbuild /etc/aliases /etc/aliases.db
60545 </literallayout>
60546 <para>
60547 reads the system alias file and creates a DBM version of it in
60548 <filename>/etc/aliases.db</filename>.
60549 </para>
60550 <para>
60551 In systems that use the <emphasis>ndbm</emphasis> routines (mostly proprietary versions of
60552 Unix), two files are used, with the suffixes <filename>.dir</filename> and <filename>.pag</filename>. In this
60553 environment, the suffixes are added to the second argument of
60554 <emphasis>exim_dbmbuild</emphasis>, so it can be the same as the first. This is also the case
60555 when the Berkeley functions are used in compatibility mode (though this is not
60556 recommended), because in that case it adds a <filename>.db</filename> suffix to the file name.
60557 </para>
60558 <para>
60559 If a duplicate key is encountered, the program outputs a warning, and when it
60560 finishes, its return code is 1 rather than zero, unless the <option>-noduperr</option>
60561 option is used. By default, only the first of a set of duplicates is used &ndash;
60562 this makes it compatible with <command>lsearch</command> lookups. There is an option
60563 <option>-lastdup</option> which causes it to use the data for the last duplicate instead.
60564 There is also an option <option>-nowarn</option>, which stops it listing duplicate keys to
60565 <option>stderr</option>. For other errors, where it doesn&#x2019;t actually make a new file, the
60566 return code is 2.
60567 </para>
60568 </section>
60569 <section id="SECTfinindret">
60570 <title>Finding individual retry times (exinext)</title>
60571 <para>
60572 <indexterm role="concept">
60573 <primary>retry</primary>
60574 <secondary>times</secondary>
60575 </indexterm>
60576 <indexterm role="concept">
60577 <primary><emphasis>exinext</emphasis></primary>
60578 </indexterm>
60579 A utility called <emphasis>exinext</emphasis> (mostly a Perl script) provides the ability to
60580 fish specific information out of the retry database. Given a mail domain (or a
60581 complete address), it looks up the hosts for that domain, and outputs any retry
60582 information for the hosts or for the domain. At present, the retry information
60583 is obtained by running <emphasis>exim_dumpdb</emphasis> (see below) and post-processing the
60584 output. For example:
60585 </para>
60586 <literallayout class="monospaced">
60587 $ exinext piglet@milne.fict.example
60588 kanga.milne.example:192.168.8.1 error 146: Connection refused
60589   first failed: 21-Feb-1996 14:57:34
60590   last tried:   21-Feb-1996 14:57:34
60591   next try at:  21-Feb-1996 15:02:34
60592 roo.milne.example:192.168.8.3 error 146: Connection refused
60593   first failed: 20-Jan-1996 13:12:08
60594   last tried:   21-Feb-1996 11:42:03
60595   next try at:  21-Feb-1996 19:42:03
60596   past final cutoff time
60597 </literallayout>
60598 <para>
60599 You can also give <emphasis>exinext</emphasis> a local part, without a domain, and it
60600 will give any retry information for that local part in your default domain.
60601 A message id can be used to obtain retry information pertaining to a specific
60602 message. This exists only when an attempt to deliver a message to a remote host
60603 suffers a message-specific error (see section <xref linkend="SECToutSMTPerr"/>).
60604 <emphasis>exinext</emphasis> is not particularly efficient, but then it is not expected to be
60605 run very often.
60606 </para>
60607 <para>
60608 The <emphasis>exinext</emphasis> utility calls Exim to find out information such as the location
60609 of the spool directory. The utility has <option>-C</option> and <option>-D</option> options, which are
60610 passed on to the <emphasis>exim</emphasis> commands. The first specifies an alternate Exim
60611 configuration file, and the second sets macros for use within the configuration
60612 file. These features are mainly to help in testing, but might also be useful in
60613 environments where more than one configuration file is in use.
60614 </para>
60615 </section>
60616 <section id="SECThindatmai">
60617 <title>Hints database maintenance</title>
60618 <para>
60619 <indexterm role="concept">
60620 <primary>hints database</primary>
60621 <secondary>maintenance</secondary>
60622 </indexterm>
60623 <indexterm role="concept">
60624 <primary>maintaining Exim&#x2019;s hints database</primary>
60625 </indexterm>
60626 Three utility programs are provided for maintaining the DBM files that Exim
60627 uses to contain its delivery hint information. Each program requires two
60628 arguments. The first specifies the name of Exim&#x2019;s spool directory, and the
60629 second is the name of the database it is to operate on. These are as follows:
60630 </para>
60631 <itemizedlist>
60632 <listitem>
60633 <para>
60634 <emphasis>retry</emphasis>: the database of retry information
60635 </para>
60636 </listitem>
60637 <listitem>
60638 <para>
60639 <emphasis>wait-</emphasis>&lt;<emphasis>transport name</emphasis>&gt;: databases of information about messages waiting
60640 for remote hosts
60641 </para>
60642 </listitem>
60643 <listitem>
60644 <para>
60645 <emphasis>callout</emphasis>: the callout cache
60646 </para>
60647 </listitem>
60648 <listitem>
60649 <para>
60650 <emphasis>ratelimit</emphasis>: the data for implementing the ratelimit ACL condition
60651 </para>
60652 </listitem>
60653 <listitem>
60654 <para>
60655 <emphasis>misc</emphasis>: other hints data
60656 </para>
60657 </listitem>
60658 </itemizedlist>
60659 <para>
60660 The <emphasis>misc</emphasis> database is used for
60661 </para>
60662 <itemizedlist>
60663 <listitem>
60664 <para>
60665 Serializing ETRN runs (when <option>smtp_etrn_serialize</option> is set)
60666 </para>
60667 </listitem>
60668 <listitem>
60669 <para>
60670 Serializing delivery to a specific host (when <option>serialize_hosts</option> is set in an
60671 <command>smtp</command> transport)
60672 </para>
60673 </listitem>
60674 </itemizedlist>
60675 </section>
60676 <section id="SECID261">
60677 <title>exim_dumpdb</title>
60678 <para>
60679 <indexterm role="concept">
60680 <primary><emphasis>exim_dumpdb</emphasis></primary>
60681 </indexterm>
60682 The entire contents of a database are written to the standard output by the
60683 <emphasis>exim_dumpdb</emphasis> program, which has no options or arguments other than the
60684 spool and database names. For example, to dump the retry database:
60685 </para>
60686 <literallayout class="monospaced">
60687 exim_dumpdb /var/spool/exim retry
60688 </literallayout>
60689 <para>
60690 Two lines of output are produced for each entry:
60691 </para>
60692 <literallayout class="monospaced">
60693 T:mail.ref.example:192.168.242.242 146 77 Connection refused
60694 31-Oct-1995 12:00:12 02-Nov-1995 12:21:39 02-Nov-1995 20:21:39 *
60695 </literallayout>
60696 <para>
60697 The first item on the first line is the key of the record. It starts with one
60698 of the letters R, or T, depending on whether it refers to a routing or
60699 transport retry. For a local delivery, the next part is the local address; for
60700 a remote delivery it is the name of the remote host, followed by its failing IP
60701 address (unless <option>retry_include_ip_address</option> is set false on the <command>smtp</command>
60702 transport). If the remote port is not the standard one (port 25), it is added
60703 to the IP address. Then there follows an error code, an additional error code,
60704 and a textual description of the error.
60705 </para>
60706 <para>
60707 The three times on the second line are the time of first failure, the time of
60708 the last delivery attempt, and the computed time for the next attempt. The line
60709 ends with an asterisk if the cutoff time for the last retry rule has been
60710 exceeded.
60711 </para>
60712 <para>
60713 Each output line from <emphasis>exim_dumpdb</emphasis> for the <emphasis>wait-xxx</emphasis> databases
60714 consists of a host name followed by a list of ids for messages that are or were
60715 waiting to be delivered to that host. If there are a very large number for any
60716 one host, continuation records, with a sequence number added to the host name,
60717 may be seen. The data in these records is often out of date, because a message
60718 may be routed to several alternative hosts, and Exim makes no effort to keep
60719 cross-references.
60720 </para>
60721 </section>
60722 <section id="SECID262">
60723 <title>exim_tidydb</title>
60724 <para>
60725 <indexterm role="concept">
60726 <primary><emphasis>exim_tidydb</emphasis></primary>
60727 </indexterm>
60728 The <emphasis>exim_tidydb</emphasis> utility program is used to tidy up the contents of a hints
60729 database. If run with no options, it removes all records that are more than 30
60730 days old. The age is calculated from the date and time that the record was last
60731 updated. Note that, in the case of the retry database, it is <emphasis>not</emphasis> the time
60732 since the first delivery failure. Information about a host that has been down
60733 for more than 30 days will remain in the database, provided that the record is
60734 updated sufficiently often.
60735 </para>
60736 <para>
60737 The cutoff date can be altered by means of the <option>-t</option> option, which must be
60738 followed by a time. For example, to remove all records older than a week from
60739 the retry database:
60740 </para>
60741 <literallayout class="monospaced">
60742 exim_tidydb -t 7d /var/spool/exim retry
60743 </literallayout>
60744 <para>
60745 Both the <emphasis>wait-xxx</emphasis> and <emphasis>retry</emphasis> databases contain items that involve
60746 message ids. In the former these appear as data in records keyed by host &ndash;
60747 they were messages that were waiting for that host &ndash; and in the latter they
60748 are the keys for retry information for messages that have suffered certain
60749 types of error. When <emphasis>exim_tidydb</emphasis> is run, a check is made to ensure that
60750 message ids in database records are those of messages that are still on the
60751 queue. Message ids for messages that no longer exist are removed from
60752 <emphasis>wait-xxx</emphasis> records, and if this leaves any records empty, they are deleted.
60753 For the <emphasis>retry</emphasis> database, records whose keys are non-existent message ids are
60754 removed. The <emphasis>exim_tidydb</emphasis> utility outputs comments on the standard output
60755 whenever it removes information from the database.
60756 </para>
60757 <para>
60758 Certain records are automatically removed by Exim when they are no longer
60759 needed, but others are not. For example, if all the MX hosts for a domain are
60760 down, a retry record is created for each one. If the primary MX host comes back
60761 first, its record is removed when Exim successfully delivers to it, but the
60762 records for the others remain because Exim has not tried to use those hosts.
60763 </para>
60764 <para>
60765 It is important, therefore, to run <emphasis>exim_tidydb</emphasis> periodically on all the
60766 hints databases. You should do this at a quiet time of day, because it requires
60767 a database to be locked (and therefore inaccessible to Exim) while it does its
60768 work. Removing records from a DBM file does not normally make the file smaller,
60769 but all the common DBM libraries are able to re-use the space that is released.
60770 After an initial phase of increasing in size, the databases normally reach a
60771 point at which they no longer get any bigger, as long as they are regularly
60772 tidied.
60773 </para>
60774 <para>
60775 <emphasis role="bold">Warning</emphasis>: If you never run <emphasis>exim_tidydb</emphasis>, the space used by the hints
60776 databases is likely to keep on increasing.
60777 </para>
60778 </section>
60779 <section id="SECID263">
60780 <title>exim_fixdb</title>
60781 <para>
60782 <indexterm role="concept">
60783 <primary><emphasis>exim_fixdb</emphasis></primary>
60784 </indexterm>
60785 The <emphasis>exim_fixdb</emphasis> program is a utility for interactively modifying databases.
60786 Its main use is for testing Exim, but it might also be occasionally useful for
60787 getting round problems in a live system. It has no options, and its interface
60788 is somewhat crude. On entry, it prompts for input with a right angle-bracket. A
60789 key of a database record can then be entered, and the data for that record is
60790 displayed.
60791 </para>
60792 <para>
60793 If <quote>d</quote> is typed at the next prompt, the entire record is deleted. For all
60794 except the <emphasis>retry</emphasis> database, that is the only operation that can be carried
60795 out. For the <emphasis>retry</emphasis> database, each field is output preceded by a number, and
60796 data for individual fields can be changed by typing the field number followed
60797 by new data, for example:
60798 </para>
60799 <literallayout class="monospaced">
60800 &gt; 4 951102:1000
60801 </literallayout>
60802 <para>
60803 resets the time of the next delivery attempt. Time values are given as a
60804 sequence of digit pairs for year, month, day, hour, and minute. Colons can be
60805 used as optional separators.
60806 </para>
60807 </section>
60808 <section id="SECTmailboxmaint">
60809 <title>Mailbox maintenance (exim_lock)</title>
60810 <para>
60811 <indexterm role="concept">
60812 <primary>mailbox</primary>
60813 <secondary>maintenance</secondary>
60814 </indexterm>
60815 <indexterm role="concept">
60816 <primary><emphasis>exim_lock</emphasis></primary>
60817 </indexterm>
60818 <indexterm role="concept">
60819 <primary>locking mailboxes</primary>
60820 </indexterm>
60821 The <emphasis>exim_lock</emphasis> utility locks a mailbox file using the same algorithm as
60822 Exim. For a discussion of locking issues, see section <xref linkend="SECTopappend"/>.
60823 <emphasis>Exim_lock</emphasis> can be used to prevent any modification of a mailbox by Exim or
60824 a user agent while investigating a problem. The utility requires the name of
60825 the file as its first argument. If the locking is successful, the second
60826 argument is run as a command (using C&#x2019;s <function>system()</function> function); if there is no
60827 second argument, the value of the SHELL environment variable is used; if this
60828 is unset or empty, <filename>/bin/sh</filename> is run. When the command finishes, the mailbox
60829 is unlocked and the utility ends. The following options are available:
60830 </para>
60831 <variablelist>
60832 <varlistentry>
60833 <term><option>-fcntl</option></term>
60834 <listitem>
60835 <para>
60836 Use <function>fcntl()</function> locking on the open mailbox.
60837 </para>
60838 </listitem></varlistentry>
60839 <varlistentry>
60840 <term><option>-flock</option></term>
60841 <listitem>
60842 <para>
60843 Use <function>flock()</function> locking on the open mailbox, provided the operating system
60844 supports it.
60845 </para>
60846 </listitem></varlistentry>
60847 <varlistentry>
60848 <term><option>-interval</option></term>
60849 <listitem>
60850 <para>
60851 This must be followed by a number, which is a number of seconds; it sets the
60852 interval to sleep between retries (default 3).
60853 </para>
60854 </listitem></varlistentry>
60855 <varlistentry>
60856 <term><option>-lockfile</option></term>
60857 <listitem>
60858 <para>
60859 Create a lock file before opening the mailbox.
60860 </para>
60861 </listitem></varlistentry>
60862 <varlistentry>
60863 <term><option>-mbx</option></term>
60864 <listitem>
60865 <para>
60866 Lock the mailbox using MBX rules.
60867 </para>
60868 </listitem></varlistentry>
60869 <varlistentry>
60870 <term><option>-q</option></term>
60871 <listitem>
60872 <para>
60873 Suppress verification output.
60874 </para>
60875 </listitem></varlistentry>
60876 <varlistentry>
60877 <term><option>-retries</option></term>
60878 <listitem>
60879 <para>
60880 This must be followed by a number; it sets the number of times to try to get
60881 the lock (default 10).
60882 </para>
60883 </listitem></varlistentry>
60884 <varlistentry>
60885 <term><option>-restore_time</option></term>
60886 <listitem>
60887 <para>
60888 This option causes <option>exim_lock</option> to restore the modified and read times to the
60889 locked file before exiting. This allows you to access a locked mailbox (for
60890 example, to take a backup copy) without disturbing the times that the user
60891 subsequently sees.
60892 </para>
60893 </listitem></varlistentry>
60894 <varlistentry>
60895 <term><option>-timeout</option></term>
60896 <listitem>
60897 <para>
60898 This must be followed by a number, which is a number of seconds; it sets a
60899 timeout to be used with a blocking <function>fcntl()</function> lock. If it is not set (the
60900 default), a non-blocking call is used.
60901 </para>
60902 </listitem></varlistentry>
60903 <varlistentry>
60904 <term><option>-v</option></term>
60905 <listitem>
60906 <para>
60907 Generate verbose output.
60908 </para>
60909 </listitem></varlistentry>
60910 </variablelist>
60911 <para>
60912 If none of <option>-fcntl</option>, <option>-flock</option>, <option>-lockfile</option> or <option>-mbx</option> are given, the
60913 default is to create a lock file and also to use <function>fcntl()</function> locking on the
60914 mailbox, which is the same as Exim&#x2019;s default. The use of <option>-flock</option> or
60915 <option>-fcntl</option> requires that the file be writeable; the use of <option>-lockfile</option>
60916 requires that the directory containing the file be writeable. Locking by lock
60917 file does not last for ever; Exim assumes that a lock file is expired if it is
60918 more than 30 minutes old.
60919 </para>
60920 <para>
60921 The <option>-mbx</option> option can be used with either or both of <option>-fcntl</option> or
60922 <option>-flock</option>. It assumes <option>-fcntl</option> by default. MBX locking causes a shared lock
60923 to be taken out on the open mailbox, and an exclusive lock on the file
60924 <filename>/tmp/.n.m</filename> where <emphasis>n</emphasis> and <emphasis>m</emphasis> are the device number and inode
60925 number of the mailbox file. When the locking is released, if an exclusive lock
60926 can be obtained for the mailbox, the file in <filename>/tmp</filename> is deleted.
60927 </para>
60928 <para>
60929 The default output contains verification of the locking that takes place. The
60930 <option>-v</option> option causes some additional information to be given. The <option>-q</option> option
60931 suppresses all output except error messages.
60932 </para>
60933 <para>
60934 A command such as
60935 </para>
60936 <literallayout class="monospaced">
60937 exim_lock /var/spool/mail/spqr
60938 </literallayout>
60939 <para>
60940 runs an interactive shell while the file is locked, whereas
60941 </para>
60942 <literallayout>
60943 <literal>exim_lock -q /var/spool/mail/spqr &lt;&lt;End</literal>
60944 &lt;<emphasis>some commands</emphasis>&gt;
60945 <literal>End</literal>
60946 </literallayout>
60947 <para>
60948 runs a specific non-interactive sequence of commands while the file is locked,
60949 suppressing all verification output. A single command can be run by a command
60950 such as
60951 </para>
60952 <literallayout class="monospaced">
60953 exim_lock -q /var/spool/mail/spqr \
60954   "cp /var/spool/mail/spqr /some/where"
60955 </literallayout>
60956 <para>
60957 Note that if a command is supplied, it must be entirely contained within the
60958 second argument &ndash; hence the quotes.
60959 <indexterm role="concept" startref="IIDutils" class="endofrange"/>
60960 </para>
60961 </section>
60962 </chapter>
60963
60964 <chapter id="CHAPeximon">
60965 <title>The Exim monitor</title>
60966 <para>
60967 <indexterm role="concept" id="IIDeximon" class="startofrange">
60968 <primary>Exim monitor</primary>
60969 <secondary>description</secondary>
60970 </indexterm>
60971 <indexterm role="concept">
60972 <primary>X-windows</primary>
60973 </indexterm>
60974 <indexterm role="concept">
60975 <primary><emphasis>eximon</emphasis></primary>
60976 </indexterm>
60977 <indexterm role="concept">
60978 <primary>Local/eximon.conf</primary>
60979 </indexterm>
60980 <indexterm role="concept">
60981 <primary><filename>exim_monitor/EDITME</filename></primary>
60982 </indexterm>
60983 The Exim monitor is an application which displays in an X window information
60984 about the state of Exim&#x2019;s queue and what Exim is doing. An admin user can
60985 perform certain operations on messages from this GUI interface; however all
60986 such facilities are also available from the command line, and indeed, the
60987 monitor itself makes use of the command line to perform any actions requested.
60988 </para>
60989 <section id="SECID264">
60990 <title>Running the monitor</title>
60991 <para>
60992 The monitor is started by running the script called <emphasis>eximon</emphasis>. This is a shell
60993 script that sets up a number of environment variables, and then runs the
60994 binary called <filename>eximon.bin</filename>. The default appearance of the monitor window can
60995 be changed by editing the <filename>Local/eximon.conf</filename> file created by editing
60996 <filename>exim_monitor/EDITME</filename>. Comments in that file describe what the various
60997 parameters are for.
60998 </para>
60999 <para>
61000 The parameters that get built into the <emphasis>eximon</emphasis> script can be overridden for
61001 a particular invocation by setting up environment variables of the same names,
61002 preceded by <literal>EXIMON_</literal>. For example, a shell command such as
61003 </para>
61004 <literallayout class="monospaced">
61005 EXIMON_LOG_DEPTH=400 eximon
61006 </literallayout>
61007 <para>
61008 (in a Bourne-compatible shell) runs <emphasis>eximon</emphasis> with an overriding setting of
61009 the LOG_DEPTH parameter. If EXIMON_LOG_FILE_PATH is set in the environment, it
61010 overrides the Exim log file configuration. This makes it possible to have
61011 <emphasis>eximon</emphasis> tailing log data that is written to syslog, provided that MAIL.INFO
61012 syslog messages are routed to a file on the local host.
61013 </para>
61014 <para>
61015 X resources can be used to change the appearance of the window in the normal
61016 way. For example, a resource setting of the form
61017 </para>
61018 <literallayout class="monospaced">
61019 Eximon*background: gray94
61020 </literallayout>
61021 <para>
61022 changes the colour of the background to light grey rather than white. The
61023 stripcharts are drawn with both the data lines and the reference lines in
61024 black. This means that the reference lines are not visible when on top of the
61025 data. However, their colour can be changed by setting a resource called
61026 <quote>highlight</quote> (an odd name, but that&#x2019;s what the Athena stripchart widget uses).
61027 For example, if your X server is running Unix, you could set up lighter
61028 reference lines in the stripcharts by obeying
61029 </para>
61030 <literallayout class="monospaced">
61031 xrdb -merge &lt;&lt;End
61032 Eximon*highlight: gray
61033 End
61034 </literallayout>
61035 <para>
61036 <indexterm role="concept">
61037 <primary>admin user</primary>
61038 </indexterm>
61039 In order to see the contents of messages on the queue, and to operate on them,
61040 <emphasis>eximon</emphasis> must either be run as root or by an admin user.
61041 </para>
61042 <para>
61043 The monitor&#x2019;s window is divided into three parts. The first contains one or
61044 more stripcharts and two action buttons, the second contains a <quote>tail</quote> of the
61045 main log file, and the third is a display of the queue of messages awaiting
61046 delivery, with two more action buttons. The following sections describe these
61047 different parts of the display.
61048 </para>
61049 </section>
61050 <section id="SECID265">
61051 <title>The stripcharts</title>
61052 <para>
61053 <indexterm role="concept">
61054 <primary>stripchart</primary>
61055 </indexterm>
61056 The first stripchart is always a count of messages on the queue. Its name can
61057 be configured by setting QUEUE_STRIPCHART_NAME in the
61058 <filename>Local/eximon.conf</filename> file. The remaining stripcharts are defined in the
61059 configuration script by regular expression matches on log file entries, making
61060 it possible to display, for example, counts of messages delivered to certain
61061 hosts or using certain transports. The supplied defaults display counts of
61062 received and delivered messages, and of local and SMTP deliveries. The default
61063 period between stripchart updates is one minute; this can be adjusted by a
61064 parameter in the <filename>Local/eximon.conf</filename> file.
61065 </para>
61066 <para>
61067 The stripchart displays rescale themselves automatically as the value they are
61068 displaying changes. There are always 10 horizontal lines in each chart; the
61069 title string indicates the value of each division when it is greater than one.
61070 For example, <quote>x2</quote> means that each division represents a value of 2.
61071 </para>
61072 <para>
61073 It is also possible to have a stripchart which shows the percentage fullness of
61074 a particular disk partition, which is useful when local deliveries are confined
61075 to a single partition.
61076 </para>
61077 <para>
61078 <indexterm role="concept">
61079 <primary><option>statvfs</option> function</primary>
61080 </indexterm>
61081 This relies on the availability of the <function>statvfs()</function> function or equivalent in
61082 the operating system. Most, but not all versions of Unix that support Exim have
61083 this. For this particular stripchart, the top of the chart always represents
61084 100%, and the scale is given as <quote>x10%</quote>. This chart is configured by setting
61085 SIZE_STRIPCHART and (optionally) SIZE_STRIPCHART_NAME in the
61086 <filename>Local/eximon.conf</filename> file.
61087 </para>
61088 </section>
61089 <section id="SECID266">
61090 <title>Main action buttons</title>
61091 <para>
61092 <indexterm role="concept">
61093 <primary>size</primary>
61094 <secondary>of monitor window</secondary>
61095 </indexterm>
61096 <indexterm role="concept">
61097 <primary>Exim monitor</primary>
61098 <secondary>window size</secondary>
61099 </indexterm>
61100 <indexterm role="concept">
61101 <primary>window size</primary>
61102 </indexterm>
61103 Below the stripcharts there is an action button for quitting the monitor. Next
61104 to this is another button marked <quote>Size</quote>. They are placed here so that
61105 shrinking the window to its default minimum size leaves just the queue count
61106 stripchart and these two buttons visible. Pressing the <quote>Size</quote> button causes
61107 the window to expand to its maximum size, unless it is already at the maximum,
61108 in which case it is reduced to its minimum.
61109 </para>
61110 <para>
61111 When expanding to the maximum, if the window cannot be fully seen where it
61112 currently is, it is moved back to where it was the last time it was at full
61113 size. When it is expanding from its minimum size, the old position is
61114 remembered, and next time it is reduced to the minimum it is moved back there.
61115 </para>
61116 <para>
61117 The idea is that you can keep a reduced window just showing one or two
61118 stripcharts at a convenient place on your screen, easily expand it to show
61119 the full window when required, and just as easily put it back to what it was.
61120 The idea is copied from what the <emphasis>twm</emphasis> window manager does for its
61121 <emphasis>f.fullzoom</emphasis> action. The minimum size of the window can be changed by setting
61122 the MIN_HEIGHT and MIN_WIDTH values in <filename>Local/eximon.conf</filename>.
61123 </para>
61124 <para>
61125 Normally, the monitor starts up with the window at its full size, but it can be
61126 built so that it starts up with the window at its smallest size, by setting
61127 START_SMALL=yes in <filename>Local/eximon.conf</filename>.
61128 </para>
61129 </section>
61130 <section id="SECID267">
61131 <title>The log display</title>
61132 <para>
61133 <indexterm role="concept">
61134 <primary>log</primary>
61135 <secondary>tail of; in monitor</secondary>
61136 </indexterm>
61137 The second section of the window is an area in which a display of the tail of
61138 the main log is maintained.
61139 To save space on the screen, the timestamp on each log line is shortened by
61140 removing the date and, if <option>log_timezone</option> is set, the timezone.
61141 The log tail is not available when the only destination for logging data is
61142 syslog, unless the syslog lines are routed to a local file whose name is passed
61143 to <emphasis>eximon</emphasis> via the EXIMON_LOG_FILE_PATH environment variable.
61144 </para>
61145 <para>
61146 The log sub-window has a scroll bar at its lefthand side which can be used to
61147 move back to look at earlier text, and the up and down arrow keys also have a
61148 scrolling effect. The amount of log that is kept depends on the setting of
61149 LOG_BUFFER in <filename>Local/eximon.conf</filename>, which specifies the amount of memory
61150 to use. When this is full, the earlier 50% of data is discarded &ndash; this is
61151 much more efficient than throwing it away line by line. The sub-window also has
61152 a horizontal scroll bar for accessing the ends of long log lines. This is the
61153 only means of horizontal scrolling; the right and left arrow keys are not
61154 available. Text can be cut from this part of the window using the mouse in the
61155 normal way. The size of this subwindow is controlled by parameters in the
61156 configuration file <filename>Local/eximon.conf</filename>.
61157 </para>
61158 <para>
61159 Searches of the text in the log window can be carried out by means of the ^R
61160 and ^S keystrokes, which default to a reverse and a forward search,
61161 respectively. The search covers only the text that is displayed in the window.
61162 It cannot go further back up the log.
61163 </para>
61164 <para>
61165 The point from which the search starts is indicated by a caret marker. This is
61166 normally at the end of the text in the window, but can be positioned explicitly
61167 by pointing and clicking with the left mouse button, and is moved automatically
61168 by a successful search. If new text arrives in the window when it is scrolled
61169 back, the caret remains where it is, but if the window is not scrolled back,
61170 the caret is moved to the end of the new text.
61171 </para>
61172 <para>
61173 Pressing ^R or ^S pops up a window into which the search text can be typed.
61174 There are buttons for selecting forward or reverse searching, for carrying out
61175 the search, and for cancelling. If the <quote>Search</quote> button is pressed, the search
61176 happens and the window remains so that further searches can be done. If the
61177 <quote>Return</quote> key is pressed, a single search is done and the window is closed. If
61178 ^C is typed the search is cancelled.
61179 </para>
61180 <para>
61181 The searching facility is implemented using the facilities of the Athena text
61182 widget. By default this pops up a window containing both <quote>search</quote> and
61183 <quote>replace</quote> options. In order to suppress the unwanted <quote>replace</quote> portion for
61184 eximon, a modified version of the <option>TextPop</option> widget is distributed with Exim.
61185 However, the linkers in BSDI and HP-UX seem unable to handle an externally
61186 provided version of <option>TextPop</option> when the remaining parts of the text widget
61187 come from the standard libraries. The compile-time option EXIMON_TEXTPOP can be
61188 unset to cut out the modified <option>TextPop</option>, making it possible to build Eximon
61189 on these systems, at the expense of having unwanted items in the search popup
61190 window.
61191 </para>
61192 </section>
61193 <section id="SECID268">
61194 <title>The queue display</title>
61195 <para>
61196 <indexterm role="concept">
61197 <primary>queue</primary>
61198 <secondary>display in monitor</secondary>
61199 </indexterm>
61200 The bottom section of the monitor window contains a list of all messages that
61201 are on the queue, which includes those currently being received or delivered,
61202 as well as those awaiting delivery. The size of this subwindow is controlled by
61203 parameters in the configuration file <filename>Local/eximon.conf</filename>, and the frequency
61204 at which it is updated is controlled by another parameter in the same file &ndash;
61205 the default is 5 minutes, since queue scans can be quite expensive. However,
61206 there is an <quote>Update</quote> action button just above the display which can be used
61207 to force an update of the queue display at any time.
61208 </para>
61209 <para>
61210 When a host is down for some time, a lot of pending mail can build up for it,
61211 and this can make it hard to deal with other messages on the queue. To help
61212 with this situation there is a button next to <quote>Update</quote> called <quote>Hide</quote>. If
61213 pressed, a dialogue box called <quote>Hide addresses ending with</quote> is put up. If you
61214 type anything in here and press <quote>Return</quote>, the text is added to a chain of
61215 such texts, and if every undelivered address in a message matches at least one
61216 of the texts, the message is not displayed.
61217 </para>
61218 <para>
61219 If there is an address that does not match any of the texts, all the addresses
61220 are displayed as normal. The matching happens on the ends of addresses so, for
61221 example, <emphasis>cam.ac.uk</emphasis> specifies all addresses in Cambridge, while
61222 <emphasis>xxx@foo.com.example</emphasis> specifies just one specific address. When any hiding
61223 has been set up, a button called <quote>Unhide</quote> is displayed. If pressed, it
61224 cancels all hiding. Also, to ensure that hidden messages do not get forgotten,
61225 a hide request is automatically cancelled after one hour.
61226 </para>
61227 <para>
61228 While the dialogue box is displayed, you can&#x2019;t press any buttons or do anything
61229 else to the monitor window. For this reason, if you want to cut text from the
61230 queue display to use in the dialogue box, you have to do the cutting before
61231 pressing the <quote>Hide</quote> button.
61232 </para>
61233 <para>
61234 The queue display contains, for each unhidden queued message, the length of
61235 time it has been on the queue, the size of the message, the message id, the
61236 message sender, and the first undelivered recipient, all on one line. If it is
61237 a bounce message, the sender is shown as <quote>&lt;&gt;</quote>. If there is more than one
61238 recipient to which the message has not yet been delivered, subsequent ones are
61239 listed on additional lines, up to a maximum configured number, following which
61240 an ellipsis is displayed. Recipients that have already received the message are
61241 not shown.
61242 </para>
61243 <para>
61244 <indexterm role="concept">
61245 <primary>frozen messages</primary>
61246 <secondary>display</secondary>
61247 </indexterm>
61248 If a message is frozen, an asterisk is displayed at the left-hand side.
61249 </para>
61250 <para>
61251 The queue display has a vertical scroll bar, and can also be scrolled by means
61252 of the arrow keys. Text can be cut from it using the mouse in the normal way.
61253 The text searching facilities, as described above for the log window, are also
61254 available, but the caret is always moved to the end of the text when the queue
61255 display is updated.
61256 </para>
61257 </section>
61258 <section id="SECID269">
61259 <title>The queue menu</title>
61260 <para>
61261 <indexterm role="concept">
61262 <primary>queue</primary>
61263 <secondary>menu in monitor</secondary>
61264 </indexterm>
61265 If the <option>shift</option> key is held down and the left button is clicked when the mouse
61266 pointer is over the text for any message, an action menu pops up, and the first
61267 line of the queue display for the message is highlighted. This does not affect
61268 any selected text.
61269 </para>
61270 <para>
61271 If you want to use some other event for popping up the menu, you can set the
61272 MENU_EVENT parameter in <filename>Local/eximon.conf</filename> to change the default, or
61273 set EXIMON_MENU_EVENT in the environment before starting the monitor. The
61274 value set in this parameter is a standard X event description. For example, to
61275 run eximon using <option>ctrl</option> rather than <option>shift</option> you could use
61276 </para>
61277 <literallayout class="monospaced">
61278 EXIMON_MENU_EVENT='Ctrl&lt;Btn1Down&gt;' eximon
61279 </literallayout>
61280 <para>
61281 The title of the menu is the message id, and it contains entries which act as
61282 follows:
61283 </para>
61284 <itemizedlist>
61285 <listitem>
61286 <para>
61287 <emphasis>message log</emphasis>: The contents of the message log for the message are displayed
61288 in a new text window.
61289 </para>
61290 </listitem>
61291 <listitem>
61292 <para>
61293 <emphasis>headers</emphasis>: Information from the spool file that contains the envelope
61294 information and headers is displayed in a new text window. See chapter
61295 <xref linkend="CHAPspool"/> for a description of the format of spool files.
61296 </para>
61297 </listitem>
61298 <listitem>
61299 <para>
61300 <emphasis>body</emphasis>: The contents of the spool file containing the body of the message are
61301 displayed in a new text window. There is a default limit of 20,000 bytes to the
61302 amount of data displayed. This can be changed by setting the BODY_MAX
61303 option at compile time, or the EXIMON_BODY_MAX option at run time.
61304 </para>
61305 </listitem>
61306 <listitem>
61307 <para>
61308 <emphasis>deliver message</emphasis>: A call to Exim is made using the <option>-M</option> option to request
61309 delivery of the message. This causes an automatic thaw if the message is
61310 frozen. The <option>-v</option> option is also set, and the output from Exim is displayed in
61311 a new text window. The delivery is run in a separate process, to avoid holding
61312 up the monitor while the delivery proceeds.
61313 </para>
61314 </listitem>
61315 <listitem>
61316 <para>
61317 <emphasis>freeze message</emphasis>: A call to Exim is made using the <option>-Mf</option> option to request
61318 that the message be frozen.
61319 </para>
61320 </listitem>
61321 <listitem>
61322 <para>
61323 <indexterm role="concept">
61324 <primary>thawing messages</primary>
61325 </indexterm>
61326 <indexterm role="concept">
61327 <primary>unfreezing messages</primary>
61328 </indexterm>
61329 <indexterm role="concept">
61330 <primary>frozen messages</primary>
61331 <secondary>thawing</secondary>
61332 </indexterm>
61333 <emphasis>thaw message</emphasis>: A call to Exim is made using the <option>-Mt</option> option to request
61334 that the message be thawed.
61335 </para>
61336 </listitem>
61337 <listitem>
61338 <para>
61339 <indexterm role="concept">
61340 <primary>delivery</primary>
61341 <secondary>forcing failure</secondary>
61342 </indexterm>
61343 <emphasis>give up on msg</emphasis>: A call to Exim is made using the <option>-Mg</option> option to request
61344 that Exim gives up trying to deliver the message. A bounce message is generated
61345 for any remaining undelivered addresses.
61346 </para>
61347 </listitem>
61348 <listitem>
61349 <para>
61350 <emphasis>remove message</emphasis>: A call to Exim is made using the <option>-Mrm</option> option to request
61351 that the message be deleted from the system without generating a bounce
61352 message.
61353 </para>
61354 </listitem>
61355 <listitem>
61356 <para>
61357 <emphasis>add recipient</emphasis>: A dialog box is displayed into which a recipient address can
61358 be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
61359 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
61360 Otherwise it must be entered as a fully qualified address. Pressing RETURN
61361 causes a call to Exim to be made using the <option>-Mar</option> option to request that an
61362 additional recipient be added to the message, unless the entry box is empty, in
61363 which case no action is taken.
61364 </para>
61365 </listitem>
61366 <listitem>
61367 <para>
61368 <emphasis>mark delivered</emphasis>: A dialog box is displayed into which a recipient address
61369 can be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
61370 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
61371 Otherwise it must be entered as a fully qualified address. Pressing RETURN
61372 causes a call to Exim to be made using the <option>-Mmd</option> option to mark the given
61373 recipient address as already delivered, unless the entry box is empty, in which
61374 case no action is taken.
61375 </para>
61376 </listitem>
61377 <listitem>
61378 <para>
61379 <emphasis>mark all delivered</emphasis>: A call to Exim is made using the <option>-Mmad</option> option to
61380 mark all recipient addresses as already delivered.
61381 </para>
61382 </listitem>
61383 <listitem>
61384 <para>
61385 <emphasis>edit sender</emphasis>: A dialog box is displayed initialized with the current
61386 sender&#x2019;s address. Pressing RETURN causes a call to Exim to be made using the
61387 <option>-Mes</option> option to replace the sender address, unless the entry box is empty,
61388 in which case no action is taken. If you want to set an empty sender (as in
61389 bounce messages), you must specify it as <quote>&lt;&gt;</quote>. Otherwise, if the address is
61390 not qualified and the QUALIFY_DOMAIN parameter is set in <filename>Local/eximon.conf</filename>,
61391 the address is qualified with that domain.
61392 </para>
61393 </listitem>
61394 </itemizedlist>
61395 <para>
61396 When a delivery is forced, a window showing the <option>-v</option> output is displayed. In
61397 other cases when a call to Exim is made, if there is any output from Exim (in
61398 particular, if the command fails) a window containing the command and the
61399 output is displayed. Otherwise, the results of the action are normally apparent
61400 from the log and queue displays. However, if you set ACTION_OUTPUT=yes in
61401 <filename>Local/eximon.conf</filename>, a window showing the Exim command is always opened, even
61402 if no output is generated.
61403 </para>
61404 <para>
61405 The queue display is automatically updated for actions such as freezing and
61406 thawing, unless ACTION_QUEUE_UPDATE=no has been set in
61407 <filename>Local/eximon.conf</filename>. In this case the <quote>Update</quote> button has to be used to
61408 force an update of the display after one of these actions.
61409 </para>
61410 <para>
61411 In any text window that is displayed as result of a menu action, the normal
61412 cut-and-paste facility is available, and searching can be carried out using ^R
61413 and ^S, as described above for the log tail window.
61414 <indexterm role="concept" startref="IIDeximon" class="endofrange"/>
61415 </para>
61416 </section>
61417 </chapter>
61418
61419 <chapter id="CHAPsecurity">
61420 <title>Security considerations</title>
61421 <para>
61422 <indexterm role="concept" id="IIDsecurcon" class="startofrange">
61423 <primary>security</primary>
61424 <secondary>discussion of</secondary>
61425 </indexterm>
61426 This chapter discusses a number of issues concerned with security, some of
61427 which are also covered in other parts of this manual.
61428 </para>
61429 <para>
61430 For reasons that this author does not understand, some people have promoted
61431 Exim as a <quote>particularly secure</quote> mailer. Perhaps it is because of the
61432 existence of this chapter in the documentation. However, the intent of the
61433 chapter is simply to describe the way Exim works in relation to certain
61434 security concerns, not to make any specific claims about the effectiveness of
61435 its security as compared with other MTAs.
61436 </para>
61437 <para>
61438 What follows is a description of the way Exim is supposed to be. Best efforts
61439 have been made to try to ensure that the code agrees with the theory, but an
61440 absence of bugs can never be guaranteed. Any that are reported will get fixed
61441 as soon as possible.
61442 </para>
61443 <section id="SECID286">
61444 <title>Building a more <quote>hardened</quote> Exim</title>
61445 <para>
61446 <indexterm role="concept">
61447 <primary>security</primary>
61448 <secondary>build-time features</secondary>
61449 </indexterm>
61450 There are a number of build-time options that can be set in <filename>Local/Makefile</filename>
61451 to create Exim binaries that are <quote>harder</quote> to attack, in particular by a rogue
61452 Exim administrator who does not have the root password, or by someone who has
61453 penetrated the Exim (but not the root) account. These options are as follows:
61454 </para>
61455 <itemizedlist>
61456 <listitem>
61457 <para>
61458 ALT_CONFIG_PREFIX can be set to a string that is required to match the
61459 start of any file names used with the <option>-C</option> option. When it is set, these file
61460 names are also not allowed to contain the sequence <quote>/../</quote>. (However, if the
61461 value of the <option>-C</option> option is identical to the value of CONFIGURE_FILE in
61462 <filename>Local/Makefile</filename>, Exim ignores <option>-C</option> and proceeds as usual.) There is no
61463 default setting for <option>ALT_CONFIG_PREFIX</option>.
61464 </para>
61465 <para>
61466 If the permitted configuration files are confined to a directory to
61467 which only root has access, this guards against someone who has broken
61468 into the Exim account from running a privileged Exim with an arbitrary
61469 configuration file, and using it to break into other accounts.
61470 </para>
61471 </listitem>
61472 <listitem>
61473 <para>
61474 If a non-trusted configuration file (i.e. not the default configuration file
61475 or one which is trusted by virtue of being listed in the TRUSTED_CONFIG_LIST
61476 file) is specified with <option>-C</option>, or if macros are given with <option>-D</option> (but see
61477 the next item), then root privilege is retained only if the caller of Exim is
61478 root. This locks out the possibility of testing a configuration using <option>-C</option>
61479 right through message reception and delivery, even if the caller is root. The
61480 reception works, but by that time, Exim is running as the Exim user, so when
61481 it re-execs to regain privilege for the delivery, the use of <option>-C</option> causes
61482 privilege to be lost. However, root can test reception and delivery using two
61483 separate commands.
61484 </para>
61485 </listitem>
61486 <listitem>
61487 <para>
61488 The WHITELIST_D_MACROS build option declares some macros to be safe to override
61489 with <option>-D</option> if the real uid is one of root, the Exim run-time user or the
61490 CONFIGURE_OWNER, if defined.  The potential impact of this option is limited by
61491 requiring the run-time value supplied to <option>-D</option> to match a regex that errs on
61492 the restrictive side.  Requiring build-time selection of safe macros is onerous
61493 but this option is intended solely as a transition mechanism to permit
61494 previously-working configurations to continue to work after release 4.73.
61495 </para>
61496 </listitem>
61497 <listitem>
61498 <para>
61499 If DISABLE_D_OPTION is defined, the use of the <option>-D</option> command line option
61500 is disabled.
61501 </para>
61502 </listitem>
61503 <listitem>
61504 <para>
61505 FIXED_NEVER_USERS can be set to a colon-separated list of users that are
61506 never to be used for any deliveries. This is like the <option>never_users</option> runtime
61507 option, but it cannot be overridden; the runtime option adds additional users
61508 to the list. The default setting is <quote>root</quote>; this prevents a non-root user who
61509 is permitted to modify the runtime file from using Exim as a way to get root.
61510 </para>
61511 </listitem>
61512 </itemizedlist>
61513 </section>
61514 <section id="SECID270">
61515 <title>Root privilege</title>
61516 <para>
61517 <indexterm role="concept">
61518 <primary>setuid</primary>
61519 </indexterm>
61520 <indexterm role="concept">
61521 <primary>root privilege</primary>
61522 </indexterm>
61523 The Exim binary is normally setuid to root, which means that it gains root
61524 privilege (runs as root) when it starts execution. In some special cases (for
61525 example, when the daemon is not in use and there are no local deliveries), it
61526 may be possible to run Exim setuid to some user other than root. This is
61527 discussed in the next section. However, in most installations, root privilege
61528 is required for two things:
61529 </para>
61530 <itemizedlist>
61531 <listitem>
61532 <para>
61533 To set up a socket connected to the standard SMTP port (25) when initialising
61534 the listening daemon. If Exim is run from <emphasis>inetd</emphasis>, this privileged action is
61535 not required.
61536 </para>
61537 </listitem>
61538 <listitem>
61539 <para>
61540 To be able to change uid and gid in order to read users&#x2019; <filename>.forward</filename> files and
61541 perform local deliveries as the receiving user or as specified in the
61542 configuration.
61543 </para>
61544 </listitem>
61545 </itemizedlist>
61546 <para>
61547 It is not necessary to be root to do any of the other things Exim does, such as
61548 receiving messages and delivering them externally over SMTP, and it is
61549 obviously more secure if Exim does not run as root except when necessary.
61550 For this reason, a user and group for Exim to use must be defined in
61551 <filename>Local/Makefile</filename>. These are known as <quote>the Exim user</quote> and <quote>the Exim
61552 group</quote>. Their values can be changed by the run time configuration, though this
61553 is not recommended. Often a user called <emphasis>exim</emphasis> is used, but some sites use
61554 <emphasis>mail</emphasis> or another user name altogether.
61555 </para>
61556 <para>
61557 Exim uses <function>setuid()</function> whenever it gives up root privilege. This is a permanent
61558 abdication; the process cannot regain root afterwards. Prior to release 4.00,
61559 <function>seteuid()</function> was used in some circumstances, but this is no longer the case.
61560 </para>
61561 <para>
61562 After a new Exim process has interpreted its command line options, it changes
61563 uid and gid in the following cases:
61564 </para>
61565 <itemizedlist>
61566 <listitem>
61567 <para>
61568 <indexterm role="option">
61569 <primary><option>-C</option></primary>
61570 </indexterm>
61571 <indexterm role="option">
61572 <primary><option>-D</option></primary>
61573 </indexterm>
61574 If the <option>-C</option> option is used to specify an alternate configuration file, or if
61575 the <option>-D</option> option is used to define macro values for the configuration, and the
61576 calling process is not running as root, the uid and gid are changed to those of
61577 the calling process.
61578 However, if DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the <option>-D</option>
61579 option may not be used at all.
61580 If WHITELIST_D_MACROS is defined in <filename>Local/Makefile</filename>, then some macro values
61581 can be supplied if the calling process is running as root, the Exim run-time
61582 user or CONFIGURE_OWNER, if defined.
61583 </para>
61584 </listitem>
61585 <listitem>
61586 <para>
61587 <indexterm role="option">
61588 <primary><option>-be</option></primary>
61589 </indexterm>
61590 <indexterm role="option">
61591 <primary><option>-bf</option></primary>
61592 </indexterm>
61593 <indexterm role="option">
61594 <primary><option>-bF</option></primary>
61595 </indexterm>
61596 If the expansion test option (<option>-be</option>) or one of the filter testing options
61597 (<option>-bf</option> or <option>-bF</option>) are used, the uid and gid are changed to those of the
61598 calling process.
61599 </para>
61600 </listitem>
61601 <listitem>
61602 <para>
61603 If the process is not a daemon process or a queue runner process or a delivery
61604 process or a process for testing address routing (started with <option>-bt</option>), the
61605 uid and gid are changed to the Exim user and group. This means that Exim always
61606 runs under its own uid and gid when receiving messages. This also applies when
61607 testing address verification
61608 <indexterm role="option">
61609 <primary><option>-bv</option></primary>
61610 </indexterm>
61611 <indexterm role="option">
61612 <primary><option>-bh</option></primary>
61613 </indexterm>
61614 (the <option>-bv</option> option) and testing incoming message policy controls (the <option>-bh</option>
61615 option).
61616 </para>
61617 </listitem>
61618 <listitem>
61619 <para>
61620 For a daemon, queue runner, delivery, or address testing process, the uid
61621 remains as root at this stage, but the gid is changed to the Exim group.
61622 </para>
61623 </listitem>
61624 </itemizedlist>
61625 <para>
61626 The processes that initially retain root privilege behave as follows:
61627 </para>
61628 <itemizedlist>
61629 <listitem>
61630 <para>
61631 A daemon process changes the gid to the Exim group and the uid to the Exim
61632 user after setting up one or more listening sockets. The <function>initgroups()</function>
61633 function is called, so that if the Exim user is in any additional groups, they
61634 will be used during message reception.
61635 </para>
61636 </listitem>
61637 <listitem>
61638 <para>
61639 A queue runner process retains root privilege throughout its execution. Its
61640 job is to fork a controlled sequence of delivery processes.
61641 </para>
61642 </listitem>
61643 <listitem>
61644 <para>
61645 A delivery process retains root privilege throughout most of its execution,
61646 but any actual deliveries (that is, the transports themselves) are run in
61647 subprocesses which always change to a non-root uid and gid. For local
61648 deliveries this is typically the uid and gid of the owner of the mailbox; for
61649 remote deliveries, the Exim uid and gid are used. Once all the delivery
61650 subprocesses have been run, a delivery process changes to the Exim uid and gid
61651 while doing post-delivery tidying up such as updating the retry database and
61652 generating bounce and warning messages.
61653 </para>
61654 <para>
61655 While the recipient addresses in a message are being routed, the delivery
61656 process runs as root. However, if a user&#x2019;s filter file has to be processed,
61657 this is done in a subprocess that runs under the individual user&#x2019;s uid and
61658 gid. A system filter is run as root unless <option>system_filter_user</option> is set.
61659 </para>
61660 </listitem>
61661 <listitem>
61662 <para>
61663 A process that is testing addresses (the <option>-bt</option> option) runs as root so that
61664 the routing is done in the same environment as a message delivery.
61665 </para>
61666 </listitem>
61667 </itemizedlist>
61668 </section>
61669 <section id="SECTrunexiwitpri">
61670 <title>Running Exim without privilege</title>
61671 <para>
61672 <indexterm role="concept">
61673 <primary>privilege, running without</primary>
61674 </indexterm>
61675 <indexterm role="concept">
61676 <primary>unprivileged running</primary>
61677 </indexterm>
61678 <indexterm role="concept">
61679 <primary>root privilege</primary>
61680 <secondary>running without</secondary>
61681 </indexterm>
61682 Some installations like to run Exim in an unprivileged state for more of its
61683 operation, for added security. Support for this mode of operation is provided
61684 by the global option <option>deliver_drop_privilege</option>. When this is set, the uid and
61685 gid are changed to the Exim user and group at the start of a delivery process
61686 (and also queue runner and address testing processes). This means that address
61687 routing is no longer run as root, and the deliveries themselves cannot change
61688 to any other uid.
61689 </para>
61690 <para>
61691 <indexterm role="concept">
61692 <primary>SIGHUP</primary>
61693 </indexterm>
61694 <indexterm role="concept">
61695 <primary>daemon</primary>
61696 <secondary>restarting</secondary>
61697 </indexterm>
61698 Leaving the binary setuid to root, but setting <option>deliver_drop_privilege</option> means
61699 that the daemon can still be started in the usual way, and it can respond
61700 correctly to SIGHUP because the re-invocation regains root privilege.
61701 </para>
61702 <para>
61703 An alternative approach is to make Exim setuid to the Exim user and also setgid
61704 to the Exim group. If you do this, the daemon must be started from a root
61705 process. (Calling Exim from a root process makes it behave in the way it does
61706 when it is setuid root.) However, the daemon cannot restart itself after a
61707 SIGHUP signal because it cannot regain privilege.
61708 </para>
61709 <para>
61710 It is still useful to set <option>deliver_drop_privilege</option> in this case, because it
61711 stops Exim from trying to re-invoke itself to do a delivery after a message has
61712 been received. Such a re-invocation is a waste of resources because it has no
61713 effect.
61714 </para>
61715 <para>
61716 If restarting the daemon is not an issue (for example, if <option>mua_wrapper</option> is
61717 set, or <emphasis>inetd</emphasis> is being used instead of a daemon), having the binary setuid
61718 to the Exim user seems a clean approach, but there is one complication:
61719 </para>
61720 <para>
61721 In this style of operation, Exim is running with the real uid and gid set to
61722 those of the calling process, and the effective uid/gid set to Exim&#x2019;s values.
61723 Ideally, any association with the calling process&#x2019; uid/gid should be dropped,
61724 that is, the real uid/gid should be reset to the effective values so as to
61725 discard any privileges that the caller may have. While some operating systems
61726 have a function that permits this action for a non-root effective uid, quite a
61727 number of them do not. Because of this lack of standardization, Exim does not
61728 address this problem at this time.
61729 </para>
61730 <para>
61731 For this reason, the recommended approach for <quote>mostly unprivileged</quote> running
61732 is to keep the Exim binary setuid to root, and to set
61733 <option>deliver_drop_privilege</option>. This also has the advantage of allowing a daemon to
61734 be used in the most straightforward way.
61735 </para>
61736 <para>
61737 If you configure Exim not to run delivery processes as root, there are a
61738 number of restrictions on what you can do:
61739 </para>
61740 <itemizedlist>
61741 <listitem>
61742 <para>
61743 You can deliver only as the Exim user/group. You should  explicitly use the
61744 <option>user</option> and <option>group</option> options to override routers or local transports that
61745 normally deliver as the recipient. This makes sure that configurations that
61746 work in this mode function the same way in normal mode. Any implicit or
61747 explicit specification of another user causes an error.
61748 </para>
61749 </listitem>
61750 <listitem>
61751 <para>
61752 Use of <filename>.forward</filename> files is severely restricted, such that it is usually
61753 not worthwhile to include them in the configuration.
61754 </para>
61755 </listitem>
61756 <listitem>
61757 <para>
61758 Users who wish to use <filename>.forward</filename> would have to make their home directory and
61759 the file itself accessible to the Exim user. Pipe and append-to-file entries,
61760 and their equivalents in Exim filters, cannot be used. While they could be
61761 enabled in the Exim user&#x2019;s name, that would be insecure and not very useful.
61762 </para>
61763 </listitem>
61764 <listitem>
61765 <para>
61766 Unless the local user mailboxes are all owned by the Exim user (possible in
61767 some POP3 or IMAP-only environments):
61768 </para>
61769 <orderedlist numeration="arabic">
61770 <listitem>
61771 <para>
61772 They must be owned by the Exim group and be writeable by that group. This
61773 implies you must set <option>mode</option> in the appendfile configuration, as well as the
61774 mode of the mailbox files themselves.
61775 </para>
61776 </listitem>
61777 <listitem>
61778 <para>
61779 You must set <option>no_check_owner</option>, since most or all of the files will not be
61780 owned by the Exim user.
61781 </para>
61782 </listitem>
61783 <listitem>
61784 <para>
61785 You must set <option>file_must_exist</option>, because Exim cannot set the owner correctly
61786 on a newly created mailbox when unprivileged. This also implies that new
61787 mailboxes need to be created manually.
61788 </para>
61789 </listitem>
61790 </orderedlist>
61791 </listitem>
61792 </itemizedlist>
61793 <para>
61794 These restrictions severely restrict what can be done in local deliveries.
61795 However, there are no restrictions on remote deliveries. If you are running a
61796 gateway host that does no local deliveries, setting <option>deliver_drop_privilege</option>
61797 gives more security at essentially no cost.
61798 </para>
61799 <para>
61800 If you are using the <option>mua_wrapper</option> facility (see chapter
61801 <xref linkend="CHAPnonqueueing"/>), <option>deliver_drop_privilege</option> is forced to be true.
61802 </para>
61803 </section>
61804 <section id="SECID271">
61805 <title>Delivering to local files</title>
61806 <para>
61807 Full details of the checks applied by <command>appendfile</command> before it writes to a file
61808 are given in chapter <xref linkend="CHAPappendfile"/>.
61809 </para>
61810 </section>
61811 <section id="SECID272">
61812 <title>IPv4 source routing</title>
61813 <para>
61814 <indexterm role="concept">
61815 <primary>source routing</primary>
61816 <secondary>in IP packets</secondary>
61817 </indexterm>
61818 <indexterm role="concept">
61819 <primary>IP source routing</primary>
61820 </indexterm>
61821 Many operating systems suppress IP source-routed packets in the kernel, but
61822 some cannot be made to do this, so Exim does its own check. It logs incoming
61823 IPv4 source-routed TCP calls, and then drops them. Things are all different in
61824 IPv6. No special checking is currently done.
61825 </para>
61826 </section>
61827 <section id="SECID273">
61828 <title>The VRFY, EXPN, and ETRN commands in SMTP</title>
61829 <para>
61830 Support for these SMTP commands is disabled by default. If required, they can
61831 be enabled by defining suitable ACLs.
61832 </para>
61833 </section>
61834 <section id="SECID274">
61835 <title>Privileged users</title>
61836 <para>
61837 <indexterm role="concept">
61838 <primary>trusted users</primary>
61839 </indexterm>
61840 <indexterm role="concept">
61841 <primary>admin user</primary>
61842 </indexterm>
61843 <indexterm role="concept">
61844 <primary>privileged user</primary>
61845 </indexterm>
61846 <indexterm role="concept">
61847 <primary>user</primary>
61848 <secondary>trusted</secondary>
61849 </indexterm>
61850 <indexterm role="concept">
61851 <primary>user</primary>
61852 <secondary>admin</secondary>
61853 </indexterm>
61854 Exim recognizes two sets of users with special privileges. Trusted users are
61855 able to submit new messages to Exim locally, but supply their own sender
61856 addresses and information about a sending host. For other users submitting
61857 local messages, Exim sets up the sender address from the uid, and doesn&#x2019;t
61858 permit a remote host to be specified.
61859 </para>
61860 <para>
61861 <indexterm role="option">
61862 <primary><option>-f</option></primary>
61863 </indexterm>
61864 However, an untrusted user is permitted to use the <option>-f</option> command line option
61865 in the special form <option>-f &lt;&gt;</option> to indicate that a delivery failure for the
61866 message should not cause an error report. This affects the message&#x2019;s envelope,
61867 but it does not affect the <emphasis>Sender:</emphasis> header. Untrusted users may also be
61868 permitted to use specific forms of address with the <option>-f</option> option by setting
61869 the <option>untrusted_set_sender</option> option.
61870 </para>
61871 <para>
61872 Trusted users are used to run processes that receive mail messages from some
61873 other mail domain and pass them on to Exim for delivery either locally, or over
61874 the Internet. Exim trusts a caller that is running as root, as the Exim user,
61875 as any user listed in the <option>trusted_users</option> configuration option, or under any
61876 group listed in the <option>trusted_groups</option> option.
61877 </para>
61878 <para>
61879 Admin users are permitted to do things to the messages on Exim&#x2019;s queue. They
61880 can freeze or thaw messages, cause them to be returned to their senders, remove
61881 them entirely, or modify them in various ways. In addition, admin users can run
61882 the Exim monitor and see all the information it is capable of providing, which
61883 includes the contents of files on the spool.
61884 </para>
61885 <para>
61886 <indexterm role="option">
61887 <primary><option>-M</option></primary>
61888 </indexterm>
61889 <indexterm role="option">
61890 <primary><option>-q</option></primary>
61891 </indexterm>
61892 By default, the use of the <option>-M</option> and <option>-q</option> options to cause Exim to attempt
61893 delivery of messages on its queue is restricted to admin users. This
61894 restriction can be relaxed by setting the <option>no_prod_requires_admin</option> option.
61895 Similarly, the use of <option>-bp</option> (and its variants) to list the contents of the
61896 queue is also restricted to admin users. This restriction can be relaxed by
61897 setting <option>no_queue_list_requires_admin</option>.
61898 </para>
61899 <para>
61900 Exim recognizes an admin user if the calling process is running as root or as
61901 the Exim user or if any of the groups associated with the calling process is
61902 the Exim group. It is not necessary actually to be running under the Exim
61903 group. However, if admin users who are not root or the Exim user are to access
61904 the contents of files on the spool via the Exim monitor (which runs
61905 unprivileged), Exim must be built to allow group read access to its spool
61906 files.
61907 </para>
61908 </section>
61909 <section id="SECID275">
61910 <title>Spool files</title>
61911 <para>
61912 <indexterm role="concept">
61913 <primary>spool directory</primary>
61914 <secondary>files</secondary>
61915 </indexterm>
61916 Exim&#x2019;s spool directory and everything it contains is owned by the Exim user and
61917 set to the Exim group. The mode for spool files is defined in the
61918 <filename>Local/Makefile</filename> configuration file, and defaults to 0640. This means that
61919 any user who is a member of the Exim group can access these files.
61920 </para>
61921 </section>
61922 <section id="SECID276">
61923 <title>Use of argv[0]</title>
61924 <para>
61925 Exim examines the last component of <option>argv[0]</option>, and if it matches one of a set
61926 of specific strings, Exim assumes certain options. For example, calling Exim
61927 with the last component of <option>argv[0]</option> set to <quote>rsmtp</quote> is exactly equivalent
61928 to calling it with the option <option>-bS</option>. There are no security implications in
61929 this.
61930 </para>
61931 </section>
61932 <section id="SECID277">
61933 <title>Use of %f formatting</title>
61934 <para>
61935 The only use made of <quote>%f</quote> by Exim is in formatting load average values. These
61936 are actually stored in integer variables as 1000 times the load average.
61937 Consequently, their range is limited and so therefore is the length of the
61938 converted output.
61939 </para>
61940 </section>
61941 <section id="SECID278">
61942 <title>Embedded Exim path</title>
61943 <para>
61944 Exim uses its own path name, which is embedded in the code, only when it needs
61945 to re-exec in order to regain root privilege. Therefore, it is not root when it
61946 does so. If some bug allowed the path to get overwritten, it would lead to an
61947 arbitrary program&#x2019;s being run as exim, not as root.
61948 </para>
61949 </section>
61950 <section id="SECTdynmoddir">
61951 <title>Dynamic module directory</title>
61952 <para>
61953 Any dynamically loadable modules must be installed into the directory
61954 defined in <literal>LOOKUP_MODULE_DIR</literal> in <filename>Local/Makefile</filename> for Exim to permit
61955 loading it.
61956 </para>
61957 </section>
61958 <section id="SECID279">
61959 <title>Use of sprintf()</title>
61960 <para>
61961 <indexterm role="concept">
61962 <primary><function>sprintf()</function></primary>
61963 </indexterm>
61964 A large number of occurrences of <quote>sprintf</quote> in the code are actually calls to
61965 <emphasis>string_sprintf()</emphasis>, a function that returns the result in malloc&#x2019;d store.
61966 The intermediate formatting is done into a large fixed buffer by a function
61967 that runs through the format string itself, and checks the length of each
61968 conversion before performing it, thus preventing buffer overruns.
61969 </para>
61970 <para>
61971 The remaining uses of <function>sprintf()</function> happen in controlled circumstances where
61972 the output buffer is known to be sufficiently long to contain the converted
61973 string.
61974 </para>
61975 </section>
61976 <section id="SECID280">
61977 <title>Use of debug_printf() and log_write()</title>
61978 <para>
61979 Arbitrary strings are passed to both these functions, but they do their
61980 formatting by calling the function <emphasis>string_vformat()</emphasis>, which runs through
61981 the format string itself, and checks the length of each conversion.
61982 </para>
61983 </section>
61984 <section id="SECID281">
61985 <title>Use of strcat() and strcpy()</title>
61986 <para>
61987 These are used only in cases where the output buffer is known to be large
61988 enough to hold the result.
61989 <indexterm role="concept" startref="IIDsecurcon" class="endofrange"/>
61990 </para>
61991 </section>
61992 </chapter>
61993
61994 <chapter id="CHAPspool">
61995 <title>Format of spool files</title>
61996 <para>
61997 <indexterm role="concept" id="IIDforspo1" class="startofrange">
61998 <primary>format</primary>
61999 <secondary>spool files</secondary>
62000 </indexterm>
62001 <indexterm role="concept" id="IIDforspo2" class="startofrange">
62002 <primary>spool directory</primary>
62003 <secondary>format of files</secondary>
62004 </indexterm>
62005 <indexterm role="concept" id="IIDforspo3" class="startofrange">
62006 <primary>spool files</primary>
62007 <secondary>format of</secondary>
62008 </indexterm>
62009 <indexterm role="concept">
62010 <primary>spool files</primary>
62011 <secondary>editing</secondary>
62012 </indexterm>
62013 A message on Exim&#x2019;s queue consists of two files, whose names are the message id
62014 followed by -D and -H, respectively. The data portion of the message is kept in
62015 the -D file on its own. The message&#x2019;s envelope, status, and headers are all
62016 kept in the -H file, whose format is described in this chapter. Each of these
62017 two files contains the final component of its own name as its first line. This
62018 is insurance against disk crashes where the directory is lost but the files
62019 themselves are recoverable.
62020 </para>
62021 <para>
62022 Some people are tempted into editing -D files in order to modify messages. You
62023 need to be extremely careful if you do this; it is not recommended and you are
62024 on your own if you do it. Here are some of the pitfalls:
62025 </para>
62026 <itemizedlist>
62027 <listitem>
62028 <para>
62029 You must ensure that Exim does not try to deliver the message while you are
62030 fiddling with it. The safest way is to take out a write lock on the -D file,
62031 which is what Exim itself does, using <function>fcntl()</function>. If you update the file in
62032 place, the lock will be retained. If you write a new file and rename it, the
62033 lock will be lost at the instant of rename.
62034 </para>
62035 </listitem>
62036 <listitem>
62037 <para>
62038 <indexterm role="variable">
62039 <primary><varname>$body_linecount</varname></primary>
62040 </indexterm>
62041 If you change the number of lines in the file, the value of
62042 <varname>$body_linecount</varname>, which is stored in the -H file, will be incorrect. At
62043 present, this value is not used by Exim, but there is no guarantee that this
62044 will always be the case.
62045 </para>
62046 </listitem>
62047 <listitem>
62048 <para>
62049 If the message is in MIME format, you must take care not to break it.
62050 </para>
62051 </listitem>
62052 <listitem>
62053 <para>
62054 If the message is cryptographically signed, any change will invalidate the
62055 signature.
62056 </para>
62057 </listitem>
62058 </itemizedlist>
62059 <para>
62060 All in all, modifying -D files is fraught with danger.
62061 </para>
62062 <para>
62063 Files whose names end with -J may also be seen in the <filename>input</filename> directory (or
62064 its subdirectories when <option>split_spool_directory</option> is set). These are journal
62065 files, used to record addresses to which the message has been delivered during
62066 the course of a delivery attempt. If there are still undelivered recipients at
62067 the end, the -H file is updated, and the -J file is deleted. If, however, there
62068 is some kind of crash (for example, a power outage) before this happens, the -J
62069 file remains in existence. When Exim next processes the message, it notices the
62070 -J file and uses it to update the -H file before starting the next delivery
62071 attempt.
62072 </para>
62073 <section id="SECID282">
62074 <title>Format of the -H file</title>
62075 <para>
62076 <indexterm role="concept">
62077 <primary>uid (user id)</primary>
62078 <secondary>in spool file</secondary>
62079 </indexterm>
62080 <indexterm role="concept">
62081 <primary>gid (group id)</primary>
62082 <secondary>in spool file</secondary>
62083 </indexterm>
62084 The second line of the -H file contains the login name for the uid of the
62085 process that called Exim to read the message, followed by the numerical uid and
62086 gid. For a locally generated message, this is normally the user who sent the
62087 message. For a message received over TCP/IP via the daemon, it is
62088 normally the Exim user.
62089 </para>
62090 <para>
62091 The third line of the file contains the address of the message&#x2019;s sender as
62092 transmitted in the envelope, contained in angle brackets. The sender address is
62093 empty for bounce messages. For incoming SMTP mail, the sender address is given
62094 in the MAIL command. For locally generated mail, the sender address is
62095 created by Exim from the login name of the current user and the configured
62096 <option>qualify_domain</option>. However, this can be overridden by the <option>-f</option> option or a
62097 leading <quote>From&nbsp;</quote> line if the caller is trusted, or if the supplied address is
62098 <quote>&lt;&gt;</quote> or an address that matches <option>untrusted_set_senders</option>.
62099 </para>
62100 <para>
62101 The fourth line contains two numbers. The first is the time that the message
62102 was received, in the conventional Unix form &ndash; the number of seconds since the
62103 start of the epoch. The second number is a count of the number of messages
62104 warning of delayed delivery that have been sent to the sender.
62105 </para>
62106 <para>
62107 There follow a number of lines starting with a hyphen. These can appear in any
62108 order, and are omitted when not relevant:
62109 </para>
62110 <variablelist>
62111 <varlistentry>
62112 <term><option>-acl</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
62113 <listitem>
62114 <para>
62115 This item is obsolete, and is not generated from Exim release 4.61 onwards;
62116 <option>-aclc</option> and <option>-aclm</option> are used instead. However, <option>-acl</option> is still
62117 recognized, to provide backward compatibility. In the old format, a line of
62118 this form is present for every ACL variable that is not empty. The number
62119 identifies the variable; the <option>acl_c</option><emphasis role="bold">x</emphasis> variables are numbered 0&ndash;9 and
62120 the <option>acl_m</option><emphasis role="bold">x</emphasis> variables are numbered 10&ndash;19. The length is the length of
62121 the data string for the variable. The string itself starts at the beginning of
62122 the next line, and is followed by a newline character. It may contain internal
62123 newlines.
62124 </para>
62125 </listitem></varlistentry>
62126 <varlistentry>
62127 <term><option>-aclc</option>&nbsp;&lt;<emphasis>rest-of-name</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
62128 <listitem>
62129 <para>
62130 A line of this form is present for every ACL connection variable that is
62131 defined. Note that there is a space between <option>-aclc</option> and the rest of the name.
62132 The length is the length of the data string for the variable. The string itself
62133 starts at the beginning of the next line, and is followed by a newline
62134 character. It may contain internal newlines.
62135 </para>
62136 </listitem></varlistentry>
62137 <varlistentry>
62138 <term><option>-aclm</option>&nbsp;&lt;<emphasis>rest-of-name</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
62139 <listitem>
62140 <para>
62141 A line of this form is present for every ACL message variable that is defined.
62142 Note that there is a space between <option>-aclm</option> and the rest of the name. The
62143 length is the length of the data string for the variable. The string itself
62144 starts at the beginning of the next line, and is followed by a newline
62145 character. It may contain internal newlines.
62146 </para>
62147 </listitem></varlistentry>
62148 <varlistentry>
62149 <term><option>-active_hostname</option>&nbsp;&lt;<emphasis>hostname</emphasis>&gt;</term>
62150 <listitem>
62151 <para>
62152 This is present if, when the message was received over SMTP, the value of
62153 <varname>$smtp_active_hostname</varname> was different to the value of <varname>$primary_hostname</varname>.
62154 </para>
62155 </listitem></varlistentry>
62156 <varlistentry>
62157 <term><option>-allow_unqualified_recipient</option></term>
62158 <listitem>
62159 <para>
62160 This is present if unqualified recipient addresses are permitted in header
62161 lines (to stop such addresses from being qualified if rewriting occurs at
62162 transport time). Local messages that were input using <option>-bnq</option> and remote
62163 messages from hosts that match <option>recipient_unqualified_hosts</option> set this flag.
62164 </para>
62165 </listitem></varlistentry>
62166 <varlistentry>
62167 <term><option>-allow_unqualified_sender</option></term>
62168 <listitem>
62169 <para>
62170 This is present if unqualified sender addresses are permitted in header lines
62171 (to stop such addresses from being qualified if rewriting occurs at transport
62172 time). Local messages that were input using <option>-bnq</option> and remote messages from
62173 hosts that match <option>sender_unqualified_hosts</option> set this flag.
62174 </para>
62175 </listitem></varlistentry>
62176 <varlistentry>
62177 <term><option>-auth_id</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
62178 <listitem>
62179 <para>
62180 The id information for a message received on an authenticated SMTP connection
62181 &ndash; the value of the <varname>$authenticated_id</varname> variable.
62182 </para>
62183 </listitem></varlistentry>
62184 <varlistentry>
62185 <term><option>-auth_sender</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
62186 <listitem>
62187 <para>
62188 The address of an authenticated sender &ndash; the value of the
62189 <varname>$authenticated_sender</varname> variable.
62190 </para>
62191 </listitem></varlistentry>
62192 <varlistentry>
62193 <term><option>-body_linecount</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
62194 <listitem>
62195 <para>
62196 This records the number of lines in the body of the message, and is always
62197 present.
62198 </para>
62199 </listitem></varlistentry>
62200 <varlistentry>
62201 <term><option>-body_zerocount</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
62202 <listitem>
62203 <para>
62204 This records the number of binary zero bytes in the body of the message, and is
62205 present if the number is greater than zero.
62206 </para>
62207 </listitem></varlistentry>
62208 <varlistentry>
62209 <term><option>-deliver_firsttime</option></term>
62210 <listitem>
62211 <para>
62212 This is written when a new message is first added to the spool. When the spool
62213 file is updated after a deferral, it is omitted.
62214 </para>
62215 </listitem></varlistentry>
62216 <varlistentry>
62217 <term><option>-frozen</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
62218 <listitem>
62219 <para>
62220 <indexterm role="concept">
62221 <primary>frozen messages</primary>
62222 <secondary>spool data</secondary>
62223 </indexterm>
62224 The message is frozen, and the freezing happened at &lt;<emphasis>time</emphasis>&gt;.
62225 </para>
62226 </listitem></varlistentry>
62227 <varlistentry>
62228 <term><option>-helo_name</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
62229 <listitem>
62230 <para>
62231 This records the host name as specified by a remote host in a HELO or EHLO
62232 command.
62233 </para>
62234 </listitem></varlistentry>
62235 <varlistentry>
62236 <term><option>-host_address</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;.&lt;<emphasis>port</emphasis>&gt;</term>
62237 <listitem>
62238 <para>
62239 This records the IP address of the host from which the message was received and
62240 the remote port number that was used. It is omitted for locally generated
62241 messages.
62242 </para>
62243 </listitem></varlistentry>
62244 <varlistentry>
62245 <term><option>-host_auth</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
62246 <listitem>
62247 <para>
62248 If the message was received on an authenticated SMTP connection, this records
62249 the name of the authenticator &ndash; the value of the
62250 <varname>$sender_host_authenticated</varname> variable.
62251 </para>
62252 </listitem></varlistentry>
62253 <varlistentry>
62254 <term><option>-host_lookup_failed</option></term>
62255 <listitem>
62256 <para>
62257 This is present if an attempt to look up the sending host&#x2019;s name from its IP
62258 address failed. It corresponds to the <varname>$host_lookup_failed</varname> variable.
62259 </para>
62260 </listitem></varlistentry>
62261 <varlistentry>
62262 <term><option>-host_name</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
62263 <listitem>
62264 <para>
62265 <indexterm role="concept">
62266 <primary>reverse DNS lookup</primary>
62267 </indexterm>
62268 <indexterm role="concept">
62269 <primary>DNS</primary>
62270 <secondary>reverse lookup</secondary>
62271 </indexterm>
62272 This records the name of the remote host from which the message was received,
62273 if the host name was looked up from the IP address when the message was being
62274 received. It is not present if no reverse lookup was done.
62275 </para>
62276 </listitem></varlistentry>
62277 <varlistentry>
62278 <term><option>-ident</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
62279 <listitem>
62280 <para>
62281 For locally submitted messages, this records the login of the originating user,
62282 unless it was a trusted user and the <option>-oMt</option> option was used to specify an
62283 ident value. For messages received over TCP/IP, this records the ident string
62284 supplied by the remote host, if any.
62285 </para>
62286 </listitem></varlistentry>
62287 <varlistentry>
62288 <term><option>-interface_address</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;.&lt;<emphasis>port</emphasis>&gt;</term>
62289 <listitem>
62290 <para>
62291 This records the IP address of the local interface and the port number through
62292 which a message was received from a remote host. It is omitted for locally
62293 generated messages.
62294 </para>
62295 </listitem></varlistentry>
62296 <varlistentry>
62297 <term><option>-local</option></term>
62298 <listitem>
62299 <para>
62300 The message is from a local sender.
62301 </para>
62302 </listitem></varlistentry>
62303 <varlistentry>
62304 <term><option>-localerror</option></term>
62305 <listitem>
62306 <para>
62307 The message is a locally-generated bounce message.
62308 </para>
62309 </listitem></varlistentry>
62310 <varlistentry>
62311 <term><option>-local_scan</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
62312 <listitem>
62313 <para>
62314 This records the data string that was returned by the <function>local_scan()</function> function
62315 when the message was received &ndash; the value of the <varname>$local_scan_data</varname>
62316 variable. It is omitted if no data was returned.
62317 </para>
62318 </listitem></varlistentry>
62319 <varlistentry>
62320 <term><option>-manual_thaw</option></term>
62321 <listitem>
62322 <para>
62323 The message was frozen but has been thawed manually, that is, by an explicit
62324 Exim command rather than via the auto-thaw process.
62325 </para>
62326 </listitem></varlistentry>
62327 <varlistentry>
62328 <term><option>-N</option></term>
62329 <listitem>
62330 <para>
62331 A testing delivery process was started using the <option>-N</option> option to suppress any
62332 actual deliveries, but delivery was deferred. At any further delivery attempts,
62333 <option>-N</option> is assumed.
62334 </para>
62335 </listitem></varlistentry>
62336 <varlistentry>
62337 <term><option>-received_protocol</option></term>
62338 <listitem>
62339 <para>
62340 This records the value of the <varname>$received_protocol</varname> variable, which contains
62341 the name of the protocol by which the message was received.
62342 </para>
62343 </listitem></varlistentry>
62344 <varlistentry>
62345 <term><option>-sender_set_untrusted</option></term>
62346 <listitem>
62347 <para>
62348 The envelope sender of this message was set by an untrusted local caller (used
62349 to ensure that the caller is displayed in queue listings).
62350 </para>
62351 </listitem></varlistentry>
62352 <varlistentry>
62353 <term><option>-spam_score_int</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
62354 <listitem>
62355 <para>
62356 If a message was scanned by SpamAssassin, this is present. It records the value
62357 of <varname>$spam_score_int</varname>.
62358 </para>
62359 </listitem></varlistentry>
62360 <varlistentry>
62361 <term><option>-tls_certificate_verified</option></term>
62362 <listitem>
62363 <para>
62364 A TLS certificate was received from the client that sent this message, and the
62365 certificate was verified by the server.
62366 </para>
62367 </listitem></varlistentry>
62368 <varlistentry>
62369 <term><option>-tls_cipher</option>&nbsp;&lt;<emphasis>cipher name</emphasis>&gt;</term>
62370 <listitem>
62371 <para>
62372 When the message was received over an encrypted connection, this records the
62373 name of the cipher suite that was used.
62374 </para>
62375 </listitem></varlistentry>
62376 <varlistentry>
62377 <term><option>-tls_peerdn</option>&nbsp;&lt;<emphasis>peer DN</emphasis>&gt;</term>
62378 <listitem>
62379 <para>
62380 When the message was received over an encrypted connection, and a certificate
62381 was received from the client, this records the Distinguished Name from that
62382 certificate.
62383 </para>
62384 </listitem></varlistentry>
62385 </variablelist>
62386 <para>
62387 Following the options there is a list of those addresses to which the message
62388 is not to be delivered. This set of addresses is initialized from the command
62389 line when the <option>-t</option> option is used and <option>extract_addresses_remove_arguments</option>
62390 is set; otherwise it starts out empty. Whenever a successful delivery is made,
62391 the address is added to this set. The addresses are kept internally as a
62392 balanced binary tree, and it is a representation of that tree which is written
62393 to the spool file. If an address is expanded via an alias or forward file, the
62394 original address is added to the tree when deliveries to all its child
62395 addresses are complete.
62396 </para>
62397 <para>
62398 If the tree is empty, there is a single line in the spool file containing just
62399 the text <quote>XX</quote>. Otherwise, each line consists of two letters, which are either
62400 Y or N, followed by an address. The address is the value for the node of the
62401 tree, and the letters indicate whether the node has a left branch and/or a
62402 right branch attached to it, respectively. If branches exist, they immediately
62403 follow. Here is an example of a three-node tree:
62404 </para>
62405 <literallayout class="monospaced">
62406 YY darcy@austen.fict.example
62407 NN alice@wonderland.fict.example
62408 NN editor@thesaurus.ref.example
62409 </literallayout>
62410 <para>
62411 After the non-recipients tree, there is a list of the message&#x2019;s recipients.
62412 This is a simple list, preceded by a count. It includes all the original
62413 recipients of the message, including those to whom the message has already been
62414 delivered. In the simplest case, the list contains one address per line. For
62415 example:
62416 </para>
62417 <literallayout class="monospaced">
62418 4
62419 editor@thesaurus.ref.example
62420 darcy@austen.fict.example
62421 rdo@foundation
62422 alice@wonderland.fict.example
62423 </literallayout>
62424 <para>
62425 However, when a child address has been added to the top-level addresses as a
62426 result of the use of the <option>one_time</option> option on a <command>redirect</command> router, each
62427 line is of the following form:
62428 </para>
62429 <literallayout>
62430 &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;
62431 </literallayout>
62432 <para>
62433 The 01 flag bit indicates the presence of the three other fields that follow
62434 the top-level address. Other bits may be used in future to support additional
62435 fields. The &lt;<emphasis>parent number</emphasis>&gt; is the offset in the recipients list of the
62436 original parent of the <quote>one time</quote> address. The first two fields are the
62437 envelope sender that is associated with this address and its length. If the
62438 length is zero, there is no special envelope sender (there are then two space
62439 characters in the line). A non-empty field can arise from a <command>redirect</command> router
62440 that has an <option>errors_to</option> setting.
62441 </para>
62442 <para>
62443 A blank line separates the envelope and status information from the headers
62444 which follow. A header may occupy several lines of the file, and to save effort
62445 when reading it in, each header is preceded by a number and an identifying
62446 character. The number is the number of characters in the header, including any
62447 embedded newlines and the terminating newline. The character is one of the
62448 following:
62449 </para>
62450 <informaltable frame="none">
62451 <tgroup cols="2" colsep="0" rowsep="0">
62452 <colspec colwidth="50pt" align="left"/>
62453 <colspec colwidth="254pt" align="left"/>
62454 <tbody>
62455 <row>
62456 <entry>&lt;<emphasis>blank</emphasis>&gt;</entry>
62457 <entry>header in which Exim has no special interest</entry>
62458 </row>
62459 <row>
62460 <entry><literal>B</literal></entry>
62461 <entry><emphasis>Bcc:</emphasis> header</entry>
62462 </row>
62463 <row>
62464 <entry><literal>C</literal></entry>
62465 <entry><emphasis>Cc:</emphasis> header</entry>
62466 </row>
62467 <row>
62468 <entry><literal>F</literal></entry>
62469 <entry><emphasis>From:</emphasis> header</entry>
62470 </row>
62471 <row>
62472 <entry><literal>I</literal></entry>
62473 <entry><emphasis>Message-id:</emphasis> header</entry>
62474 </row>
62475 <row>
62476 <entry><literal>P</literal></entry>
62477 <entry><emphasis>Received:</emphasis> header &ndash; P for <quote>postmark</quote></entry>
62478 </row>
62479 <row>
62480 <entry><literal>R</literal></entry>
62481 <entry><emphasis>Reply-To:</emphasis> header</entry>
62482 </row>
62483 <row>
62484 <entry><literal>S</literal></entry>
62485 <entry><emphasis>Sender:</emphasis> header</entry>
62486 </row>
62487 <row>
62488 <entry><literal>T</literal></entry>
62489 <entry><emphasis>To:</emphasis> header</entry>
62490 </row>
62491 <row>
62492 <entry><literal>*</literal></entry>
62493 <entry>replaced or deleted header</entry>
62494 </row>
62495 </tbody>
62496 </tgroup>
62497 </informaltable>
62498 <para>
62499 Deleted or replaced (rewritten) headers remain in the spool file for debugging
62500 purposes. They are not transmitted when the message is delivered. Here is a
62501 typical set of headers:
62502 </para>
62503 <literallayout class="monospaced">
62504 111P Received: by hobbit.fict.example with local (Exim 4.00)
62505 id 14y9EI-00026G-00; Fri, 11 May 2001 10:28:59 +0100
62506 049  Message-Id: &lt;E14y9EI-00026G-00@hobbit.fict.example&gt;
62507 038* X-rewrote-sender: bb@hobbit.fict.example
62508 042* From: Bilbo Baggins &lt;bb@hobbit.fict.example&gt;
62509 049F From: Bilbo Baggins &lt;B.Baggins@hobbit.fict.example&gt;
62510 099* To: alice@wonderland.fict.example, rdo@foundation,
62511 darcy@austen.fict.example, editor@thesaurus.ref.example
62512 104T To: alice@wonderland.fict.example, rdo@foundation.example,
62513 darcy@austen.fict.example, editor@thesaurus.ref.example
62514 038  Date: Fri, 11 May 2001 10:28:59 +0100
62515 </literallayout>
62516 <para>
62517 The asterisked headers indicate that the envelope sender, <emphasis>From:</emphasis> header, and
62518 <emphasis>To:</emphasis> header have been rewritten, the last one because routing expanded the
62519 unqualified domain <emphasis>foundation</emphasis>.
62520 <indexterm role="concept" startref="IIDforspo1" class="endofrange"/>
62521 <indexterm role="concept" startref="IIDforspo2" class="endofrange"/>
62522 <indexterm role="concept" startref="IIDforspo3" class="endofrange"/>
62523 </para>
62524 </section>
62525 </chapter>
62526
62527 <chapter id="CHID12">
62528 <title>Support for DKIM (DomainKeys Identified Mail) - RFC4871</title>
62529 <titleabbrev>DKIM Support</titleabbrev>
62530 <para>
62531 <indexterm role="concept">
62532 <primary>DKIM</primary>
62533 </indexterm>
62534 </para>
62535 <para>
62536 Since version 4.70, DKIM support is compiled into Exim by default. It can be
62537 disabled by setting DISABLE_DKIM=yes in Local/Makefile.
62538 </para>
62539 <para>
62540 Exim&#x2019;s DKIM implementation allows to
62541 </para>
62542 <orderedlist numeration="arabic">
62543 <listitem>
62544 <para>
62545 Sign outgoing messages: This function is implemented in the SMTP transport.
62546 It can co-exist with all other Exim features, including transport filters.
62547 </para>
62548 </listitem>
62549 <listitem>
62550 <para>
62551 Verify signatures in incoming messages: This is implemented by an additional
62552 ACL (acl_smtp_dkim), which can be called several times per message, with
62553 different signature contexts.
62554 </para>
62555 </listitem>
62556 </orderedlist>
62557 <para>
62558 In typical Exim style, the verification implementation does not include any
62559 default "policy". Instead it enables you to build your own policy using
62560 Exim&#x2019;s standard controls.
62561 </para>
62562 <para>
62563 Please note that verification of DKIM signatures in incoming mail is turned
62564 on by default for logging purposes. For each signature in incoming email,
62565 exim will log a line displaying the most important signature details, and the
62566 signature status. Here is an example:
62567 </para>
62568 <literallayout class="monospaced">
62569 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]
62570 </literallayout>
62571 <para>
62572 You might want to turn off DKIM verification processing entirely for internal
62573 or relay mail sources. To do that, set the <option>dkim_disable_verify</option> ACL
62574 control modifier. This should typically be done in the RCPT ACL, at points
62575 where you accept mail from relay sources (internal hosts or authenticated
62576 senders).
62577 </para>
62578 <section id="SECID513">
62579 <title>Signing outgoing messages</title>
62580 <para>
62581 <indexterm role="concept">
62582 <primary>DKIM</primary>
62583 <secondary>signing</secondary>
62584 </indexterm>
62585 </para>
62586 <para>
62587 Signing is implemented by setting private options on the SMTP transport.
62588 These options take (expandable) strings as arguments.
62589 </para>
62590 <para>
62591 <indexterm role="option">
62592 <primary><option>dkim_domain</option></primary>
62593 </indexterm>
62594 </para>
62595 <informaltable frame="all">
62596 <tgroup cols="4" colsep="0" rowsep="0">
62597 <colspec colwidth="8*" align="left"/>
62598 <colspec colwidth="6*" align="center"/>
62599 <colspec colwidth="6*" align="center"/>
62600 <colspec colwidth="6*" align="right"/>
62601 <tbody>
62602 <row>
62603 <entry><option>dkim_domain</option></entry>
62604 <entry>Use: <emphasis>smtp</emphasis></entry>
62605 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
62606 <entry>Default: <emphasis>unset</emphasis></entry>
62607 </row>
62608 </tbody>
62609 </tgroup>
62610 </informaltable>
62611 <para>
62612 MANDATORY:
62613 The domain you want to sign with. The result of this expanded
62614 option is put into the <option>$dkim_domain</option> expansion variable.
62615 </para>
62616 <para>
62617 <indexterm role="option">
62618 <primary><option>dkim_selector</option></primary>
62619 </indexterm>
62620 </para>
62621 <informaltable frame="all">
62622 <tgroup cols="4" colsep="0" rowsep="0">
62623 <colspec colwidth="8*" align="left"/>
62624 <colspec colwidth="6*" align="center"/>
62625 <colspec colwidth="6*" align="center"/>
62626 <colspec colwidth="6*" align="right"/>
62627 <tbody>
62628 <row>
62629 <entry><option>dkim_selector</option></entry>
62630 <entry>Use: <emphasis>smtp</emphasis></entry>
62631 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
62632 <entry>Default: <emphasis>unset</emphasis></entry>
62633 </row>
62634 </tbody>
62635 </tgroup>
62636 </informaltable>
62637 <para>
62638 MANDATORY:
62639 This sets the key selector string. You can use the <option>$dkim_domain</option> expansion
62640 variable to look up a matching selector. The result is put in the expansion
62641 variable <option>$dkim_selector</option> which should be used in the <option>dkim_private_key</option>
62642 option along with <option>$dkim_domain</option>.
62643 </para>
62644 <para>
62645 <indexterm role="option">
62646 <primary><option>dkim_private_key</option></primary>
62647 </indexterm>
62648 </para>
62649 <informaltable frame="all">
62650 <tgroup cols="4" colsep="0" rowsep="0">
62651 <colspec colwidth="8*" align="left"/>
62652 <colspec colwidth="6*" align="center"/>
62653 <colspec colwidth="6*" align="center"/>
62654 <colspec colwidth="6*" align="right"/>
62655 <tbody>
62656 <row>
62657 <entry><option>dkim_private_key</option></entry>
62658 <entry>Use: <emphasis>smtp</emphasis></entry>
62659 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
62660 <entry>Default: <emphasis>unset</emphasis></entry>
62661 </row>
62662 </tbody>
62663 </tgroup>
62664 </informaltable>
62665 <para>
62666 MANDATORY:
62667 This sets the private key to use. You can use the <option>$dkim_domain</option> and
62668 <option>$dkim_selector</option> expansion variables to determine the private key to use.
62669 The result can either
62670 </para>
62671 <itemizedlist>
62672 <listitem>
62673 <para>
62674 be a valid RSA private key in ASCII armor, including line breaks.
62675 </para>
62676 </listitem>
62677 <listitem>
62678 <para>
62679 start with a slash, in which case it is treated as a file that contains
62680 the private key.
62681 </para>
62682 </listitem>
62683 <listitem>
62684 <para>
62685 be "0", "false" or the empty string, in which case the message will not
62686 be signed. This case will not result in an error, even if <option>dkim_strict</option>
62687 is set.
62688 </para>
62689 </listitem>
62690 </itemizedlist>
62691 <para>
62692 <indexterm role="option">
62693 <primary><option>dkim_canon</option></primary>
62694 </indexterm>
62695 </para>
62696 <informaltable frame="all">
62697 <tgroup cols="4" colsep="0" rowsep="0">
62698 <colspec colwidth="8*" align="left"/>
62699 <colspec colwidth="6*" align="center"/>
62700 <colspec colwidth="6*" align="center"/>
62701 <colspec colwidth="6*" align="right"/>
62702 <tbody>
62703 <row>
62704 <entry><option>dkim_canon</option></entry>
62705 <entry>Use: <emphasis>smtp</emphasis></entry>
62706 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
62707 <entry>Default: <emphasis>unset</emphasis></entry>
62708 </row>
62709 </tbody>
62710 </tgroup>
62711 </informaltable>
62712 <para>
62713 OPTIONAL:
62714 This option sets the canonicalization method used when signing a message.
62715 The DKIM RFC currently supports two methods: "simple" and "relaxed".
62716 The option defaults to "relaxed" when unset. Note: the current implementation
62717 only supports using the same canonicalization method for both headers and body.
62718 </para>
62719 <para>
62720 <indexterm role="option">
62721 <primary><option>dkim_strict</option></primary>
62722 </indexterm>
62723 </para>
62724 <informaltable frame="all">
62725 <tgroup cols="4" colsep="0" rowsep="0">
62726 <colspec colwidth="8*" align="left"/>
62727 <colspec colwidth="6*" align="center"/>
62728 <colspec colwidth="6*" align="center"/>
62729 <colspec colwidth="6*" align="right"/>
62730 <tbody>
62731 <row>
62732 <entry><option>dkim_strict</option></entry>
62733 <entry>Use: <emphasis>smtp</emphasis></entry>
62734 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
62735 <entry>Default: <emphasis>unset</emphasis></entry>
62736 </row>
62737 </tbody>
62738 </tgroup>
62739 </informaltable>
62740 <para>
62741 OPTIONAL:
62742 This  option  defines  how  Exim  behaves  when  signing a message that
62743 should be signed fails for some reason.  When the expansion evaluates to
62744 either "1" or "true", Exim will defer. Otherwise Exim will send the message
62745 unsigned. You can use the <option>$dkim_domain</option> and <option>$dkim_selector</option> expansion
62746 variables here.
62747 </para>
62748 <para>
62749 <indexterm role="option">
62750 <primary><option>dkim_sign_headers</option></primary>
62751 </indexterm>
62752 </para>
62753 <informaltable frame="all">
62754 <tgroup cols="4" colsep="0" rowsep="0">
62755 <colspec colwidth="8*" align="left"/>
62756 <colspec colwidth="6*" align="center"/>
62757 <colspec colwidth="6*" align="center"/>
62758 <colspec colwidth="6*" align="right"/>
62759 <tbody>
62760 <row>
62761 <entry><option>dkim_sign_headers</option></entry>
62762 <entry>Use: <emphasis>smtp</emphasis></entry>
62763 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
62764 <entry>Default: <emphasis>unset</emphasis></entry>
62765 </row>
62766 </tbody>
62767 </tgroup>
62768 </informaltable>
62769 <para>
62770 OPTIONAL:
62771 When set, this option must expand to (or be specified as) a colon-separated
62772 list of header names. Headers with these names will be included in the message
62773 signature. When unspecified, the header names recommended in RFC4871 will be
62774 used.
62775 </para>
62776 </section>
62777 <section id="SECID514">
62778 <title>Verifying DKIM signatures in incoming mail</title>
62779 <para>
62780 <indexterm role="concept">
62781 <primary>DKIM</primary>
62782 <secondary>verification</secondary>
62783 </indexterm>
62784 </para>
62785 <para>
62786 Verification of DKIM signatures in incoming email is implemented via the
62787 <option>acl_smtp_dkim</option> ACL. By default, this ACL is called once for each
62788 syntactically(!) correct signature in the incoming message.
62789 </para>
62790 <para>
62791 To evaluate the signature in the ACL a large number of expansion variables
62792 containing the signature status and its details are set up during the
62793 runtime of the ACL.
62794 </para>
62795 <para>
62796 Calling the ACL only for existing signatures is not sufficient to build
62797 more advanced policies. For that reason, the global option
62798 <option>dkim_verify_signers</option>, and a global expansion variable
62799 <option>$dkim_signers</option> exist.
62800 </para>
62801 <para>
62802 The global option <option>dkim_verify_signers</option> can be set to a colon-separated
62803 list of DKIM domains or identities for which the ACL <option>acl_smtp_dkim</option> is
62804 called. It is expanded when the message has been received. At this point,
62805 the expansion variable <option>$dkim_signers</option> already contains a colon-separated
62806 list of signer domains and identities for the message. When
62807 <option>dkim_verify_signers</option> is not specified in the main configuration,
62808 it defaults as:
62809 </para>
62810 <literallayout class="monospaced">
62811 dkim_verify_signers = $dkim_signers
62812 </literallayout>
62813 <para>
62814 This leads to the default behaviour of calling <option>acl_smtp_dkim</option> for each
62815 DKIM signature in the message. Current DKIM verifiers may want to explicitly
62816 call the ACL for known domains or identities. This would be achieved as follows:
62817 </para>
62818 <literallayout class="monospaced">
62819 dkim_verify_signers = paypal.com:ebay.com:$dkim_signers
62820 </literallayout>
62821 <para>
62822 This would result in <option>acl_smtp_dkim</option> always being called for "paypal.com"
62823 and "ebay.com", plus all domains and identities that have signatures in the message.
62824 You can also be more creative in constructing your policy. For example:
62825 </para>
62826 <literallayout class="monospaced">
62827 dkim_verify_signers = $sender_address_domain:$dkim_signers
62828 </literallayout>
62829 <para>
62830 If a domain or identity is listed several times in the (expanded) value of
62831 <option>dkim_verify_signers</option>, the ACL is only called once for that domain or identity.
62832 </para>
62833 <para>
62834 Inside the <option>acl_smtp_dkim</option>, the following expansion variables are
62835 available (from most to least important):
62836 </para>
62837 <variablelist>
62838 <varlistentry>
62839 <term><option>$dkim_cur_signer</option></term>
62840 <listitem>
62841 <para>
62842 The signer that is being evaluated in this ACL run. This can be a domain or
62843 an identity. This is one of the list items from the expanded main option
62844 <option>dkim_verify_signers</option> (see above).
62845 </para>
62846 </listitem></varlistentry>
62847 <varlistentry>
62848 <term><option>$dkim_verify_status</option></term>
62849 <listitem>
62850 <para>
62851 A string describing the general status of the signature. One of
62852 </para>
62853 <itemizedlist>
62854 <listitem>
62855 <para>
62856 <option>none</option>: There is no signature in the message for the current domain or
62857 identity (as reflected by <option>$dkim_cur_signer</option>).
62858 </para>
62859 </listitem>
62860 <listitem>
62861 <para>
62862 <option>invalid</option>: The signature could not be verified due to a processing error.
62863 More detail is available in <option>$dkim_verify_reason</option>.
62864 </para>
62865 </listitem>
62866 <listitem>
62867 <para>
62868 <option>fail</option>: Verification of the signature failed.  More detail is
62869 available in <option>$dkim_verify_reason</option>.
62870 </para>
62871 </listitem>
62872 <listitem>
62873 <para>
62874 <option>pass</option>: The signature passed verification. It is valid.
62875 </para>
62876 </listitem>
62877 </itemizedlist>
62878 </listitem></varlistentry>
62879 <varlistentry>
62880 <term><option>$dkim_verify_reason</option></term>
62881 <listitem>
62882 <para>
62883 A string giving a litte bit more detail when <option>$dkim_verify_status</option> is either
62884 "fail" or "invalid". One of
62885 </para>
62886 <itemizedlist>
62887 <listitem>
62888 <para>
62889 <option>pubkey_unavailable</option> (when <option>$dkim_verify_status</option>="invalid"): The public
62890 key for the domain could not be retrieved. This may be a temporary problem.
62891 </para>
62892 </listitem>
62893 <listitem>
62894 <para>
62895 <option>pubkey_syntax</option> (when <option>$dkim_verify_status</option>="invalid"): The public key
62896 record for the domain is syntactically invalid.
62897 </para>
62898 </listitem>
62899 <listitem>
62900 <para>
62901 <option>bodyhash_mismatch</option> (when <option>$dkim_verify_status</option>="fail"): The calculated
62902 body hash does not match the one specified in the signature header. This
62903 means that the message body was modified in transit.
62904 </para>
62905 </listitem>
62906 <listitem>
62907 <para>
62908 <option>signature_incorrect</option> (when <option>$dkim_verify_status</option>="fail"): The signature
62909 could not be verified. This may mean that headers were modified,
62910 re-written or otherwise changed in a way which is incompatible with
62911 DKIM verification. It may of course also mean that the signature is forged.
62912 </para>
62913 </listitem>
62914 </itemizedlist>
62915 </listitem></varlistentry>
62916 <varlistentry>
62917 <term><option>$dkim_domain</option></term>
62918 <listitem>
62919 <para>
62920 The signing domain. IMPORTANT: This variable is only populated if there is
62921 an actual signature in the message for the current domain or identity (as
62922 reflected by <option>$dkim_cur_signer</option>).
62923 </para>
62924 </listitem></varlistentry>
62925 <varlistentry>
62926 <term><option>$dkim_identity</option></term>
62927 <listitem>
62928 <para>
62929 The signing identity, if present. IMPORTANT: This variable is only populated
62930 if there is an actual signature in the message for the current domain or
62931 identity (as reflected by <option>$dkim_cur_signer</option>).
62932 </para>
62933 </listitem></varlistentry>
62934 <varlistentry>
62935 <term><option>$dkim_selector</option></term>
62936 <listitem>
62937 <para>
62938 The key record selector string.
62939 </para>
62940 </listitem></varlistentry>
62941 <varlistentry>
62942 <term><option>$dkim_algo</option></term>
62943 <listitem>
62944 <para>
62945 The algorithm used. One of &#x2019;rsa-sha1&#x2019; or &#x2019;rsa-sha256&#x2019;.
62946 </para>
62947 </listitem></varlistentry>
62948 <varlistentry>
62949 <term><option>$dkim_canon_body</option></term>
62950 <listitem>
62951 <para>
62952 The body canonicalization method. One of &#x2019;relaxed&#x2019; or &#x2019;simple&#x2019;.
62953 </para>
62954 </listitem></varlistentry>
62955 <varlistentry>
62956 <term><option>dkim_canon_headers</option></term>
62957 <listitem>
62958 <para>
62959 The header canonicalization method. One of &#x2019;relaxed&#x2019; or &#x2019;simple&#x2019;.
62960 </para>
62961 </listitem></varlistentry>
62962 <varlistentry>
62963 <term><option>$dkim_copiedheaders</option></term>
62964 <listitem>
62965 <para>
62966 A transcript of headers and their values which are included in the signature
62967 (copied from the &#x2019;z=&#x2019; tag of the signature).
62968 </para>
62969 </listitem></varlistentry>
62970 <varlistentry>
62971 <term><option>$dkim_bodylength</option></term>
62972 <listitem>
62973 <para>
62974 The number of signed body bytes. If zero ("0"), the body is unsigned. If no
62975 limit was set by the signer, "9999999999999" is returned. This makes sure
62976 that this variable always expands to an integer value.
62977 </para>
62978 </listitem></varlistentry>
62979 <varlistentry>
62980 <term><option>$dkim_created</option></term>
62981 <listitem>
62982 <para>
62983 UNIX timestamp reflecting the date and time when the signature was created.
62984 When this was not specified by the signer, "0" is returned.
62985 </para>
62986 </listitem></varlistentry>
62987 <varlistentry>
62988 <term><option>$dkim_expires</option></term>
62989 <listitem>
62990 <para>
62991 UNIX timestamp reflecting the date and time when the signer wants the
62992 signature to be treated as "expired". When this was not specified by the
62993 signer, "9999999999999" is returned. This makes it possible to do useful
62994 integer size comparisons against this value.
62995 </para>
62996 </listitem></varlistentry>
62997 <varlistentry>
62998 <term><option>$dkim_headernames</option></term>
62999 <listitem>
63000 <para>
63001 A colon-separated list of names of headers included in the signature.
63002 </para>
63003 </listitem></varlistentry>
63004 <varlistentry>
63005 <term><option>$dkim_key_testing</option></term>
63006 <listitem>
63007 <para>
63008 "1" if the key record has the "testing" flag set, "0" if not.
63009 </para>
63010 </listitem></varlistentry>
63011 <varlistentry>
63012 <term><option>$dkim_key_nosubdomaining</option></term>
63013 <listitem>
63014 <para>
63015 "1" if the key record forbids subdomaining, "0" otherwise.
63016 </para>
63017 </listitem></varlistentry>
63018 <varlistentry>
63019 <term><option>$dkim_key_srvtype</option></term>
63020 <listitem>
63021 <para>
63022 Service type (tag s=) from the key record. Defaults to "*" if not specified
63023 in the key record.
63024 </para>
63025 </listitem></varlistentry>
63026 <varlistentry>
63027 <term><option>$dkim_key_granularity</option></term>
63028 <listitem>
63029 <para>
63030 Key granularity (tag g=) from the key record. Defaults to "*" if not specified
63031 in the key record.
63032 </para>
63033 </listitem></varlistentry>
63034 <varlistentry>
63035 <term><option>$dkim_key_notes</option></term>
63036 <listitem>
63037 <para>
63038 Notes from the key record (tag n=).
63039 </para>
63040 </listitem></varlistentry>
63041 </variablelist>
63042 <para>
63043 In addition, two ACL conditions are provided:
63044 </para>
63045 <variablelist>
63046 <varlistentry>
63047 <term><option>dkim_signers</option></term>
63048 <listitem>
63049 <para>
63050 ACL condition that checks a colon-separated list of domains or identities
63051 for a match against the domain or identity that the ACL is currently verifying
63052 (reflected by <option>$dkim_cur_signer</option>). This is typically used to restrict an ACL
63053 verb to a group of domains or identities. For example:
63054 </para>
63055 <literallayout class="monospaced">
63056 # Warn when message apparently from GMail has no signature at all
63057 warn log_message = GMail sender without DKIM signature
63058      sender_domains = gmail.com
63059      dkim_signers = gmail.com
63060      dkim_status = none
63061 </literallayout>
63062 </listitem></varlistentry>
63063 <varlistentry>
63064 <term><option>dkim_status</option></term>
63065 <listitem>
63066 <para>
63067 ACL condition that checks a colon-separated list of possible DKIM verification
63068 results agains the actual result of verification. This is typically used
63069 to restrict an ACL verb to a list of verification outcomes, like:
63070 </para>
63071 <literallayout class="monospaced">
63072 deny message = Message from Paypal with invalid or missing signature
63073      sender_domains = paypal.com:paypal.de
63074      dkim_signers = paypal.com:paypal.de
63075      dkim_status = none:invalid:fail
63076 </literallayout>
63077 <para>
63078 The possible status keywords are: &#x2019;none&#x2019;,&#x2019;invalid&#x2019;,&#x2019;fail&#x2019; and &#x2019;pass&#x2019;. Please
63079 see the documentation of the <option>$dkim_verify_status</option> expansion variable above
63080 for more information of what they mean.
63081 </para>
63082 </listitem></varlistentry>
63083 </variablelist>
63084 </section>
63085 </chapter>
63086
63087 <chapter id="CHID13">
63088 <title>Adding new drivers or lookup types</title>
63089 <titleabbrev>Adding drivers or lookups</titleabbrev>
63090 <para>
63091 <indexterm role="concept">
63092 <primary>adding drivers</primary>
63093 </indexterm>
63094 <indexterm role="concept">
63095 <primary>new drivers, adding</primary>
63096 </indexterm>
63097 <indexterm role="concept">
63098 <primary>drivers</primary>
63099 <secondary>adding new</secondary>
63100 </indexterm>
63101 The following actions have to be taken in order to add a new router, transport,
63102 authenticator, or lookup type to Exim:
63103 </para>
63104 <orderedlist numeration="arabic">
63105 <listitem>
63106 <para>
63107 Choose a name for the driver or lookup type that does not conflict with any
63108 existing name; I will use <quote>newdriver</quote> in what follows.
63109 </para>
63110 </listitem>
63111 <listitem>
63112 <para>
63113 Add to <filename>src/EDITME</filename> the line:
63114 </para>
63115 <literallayout>
63116 &lt;<emphasis>type</emphasis>&gt;<literal>_NEWDRIVER=yes</literal>
63117 </literallayout>
63118 <para>
63119 where &lt;<emphasis>type</emphasis>&gt; is ROUTER, TRANSPORT, AUTH, or LOOKUP. If the
63120 code is not to be included in the binary by default, comment this line out. You
63121 should also add any relevant comments about the driver or lookup type.
63122 </para>
63123 </listitem>
63124 <listitem>
63125 <para>
63126 Add to <filename>src/config.h.defaults</filename> the line:
63127 </para>
63128 <literallayout class="monospaced">
63129 #define &lt;type&gt;_NEWDRIVER
63130 </literallayout>
63131 </listitem>
63132 <listitem>
63133 <para>
63134 Edit <filename>src/drtables.c</filename>, adding conditional code to pull in the private header
63135 and create a table entry as is done for all the other drivers and lookup types.
63136 </para>
63137 </listitem>
63138 <listitem>
63139 <para>
63140 Edit <filename>Makefile</filename> in the appropriate sub-directory (<filename>src/routers</filename>,
63141 <filename>src/transports</filename>, <filename>src/auths</filename>, or <filename>src/lookups</filename>); add a line for the new
63142 driver or lookup type and add it to the definition of OBJ.
63143 </para>
63144 </listitem>
63145 <listitem>
63146 <para>
63147 Create <filename>newdriver.h</filename> and <filename>newdriver.c</filename> in the appropriate sub-directory of
63148 <filename>src</filename>.
63149 </para>
63150 </listitem>
63151 <listitem>
63152 <para>
63153 Edit <filename>scripts/MakeLinks</filename> and add commands to link the <filename>.h</filename> and <filename>.c</filename> files
63154 as for other drivers and lookups.
63155 </para>
63156 </listitem>
63157 </orderedlist>
63158 <para>
63159 Then all you need to do is write the code! A good way to start is to make a
63160 proforma by copying an existing module of the same type, globally changing all
63161 occurrences of the name, and cutting out most of the code. Note that any
63162 options you create must be listed in alphabetical order, because the tables are
63163 searched using a binary chop procedure.
63164 </para>
63165 <para>
63166 There is a <filename>README</filename> file in each of the sub-directories of <filename>src</filename> describing
63167 the interface that is expected.
63168 </para>
63169 <?sdop
63170   format="newpage"
63171   foot_right_recto="&chaptertitle;"
63172   foot_right_verso="&chaptertitle;"
63173 ?>
63174 </chapter>
63175
63176 <index role="option">
63177 <title>Options index</title>
63178 </index>
63179
63180 <index role="variable">
63181 <title>Variables index</title>
63182 </index>
63183
63184 <index role="concept">
63185 <title>Concept index</title>
63186 </index>
63187
63188 </book>