c77b228ef47d67582b9e437bba5c50387e04da4c
[exim-website.git] / docbook / 4.50 / 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>29 May 2010</date>
16 <author><firstname>Exim</firstname><surname>Maintainers</surname></author>
17 <authorinitials>EM</authorinitials>
18 <revhistory><revision>
19   <revnumber>4.72</revnumber>
20   <date>29 May 2010</date>
21   <authorinitials>EM</authorinitials>
22 </revision></revhistory>
23 <copyright><year>2009</year><holder>University of Cambridge</holder></copyright>
24 </bookinfo>
25 <chapter id="CHID1">
26 <title>Introduction</title>
27
28 <indexterm role="variable">
29   <primary>$1, $2, etc.</primary>
30   <see><emphasis>numerical variables</emphasis></see>
31 </indexterm>
32 <indexterm role="concept">
33   <primary>address</primary>
34   <secondary>rewriting</secondary>
35   <see><emphasis>rewriting</emphasis></see>
36 </indexterm>
37 <indexterm role="concept">
38   <primary>Bounce Address Tag Validation</primary>
39   <see><emphasis>BATV</emphasis></see>
40 </indexterm>
41 <indexterm role="concept">
42   <primary>Client SMTP Authorization</primary>
43   <see><emphasis>CSA</emphasis></see>
44 </indexterm>
45 <indexterm role="concept">
46   <primary>CR character</primary>
47   <see><emphasis>carriage return</emphasis></see>
48 </indexterm>
49 <indexterm role="concept">
50   <primary>CRL</primary>
51   <see><emphasis>certificate revocation list</emphasis></see>
52 </indexterm>
53 <indexterm role="concept">
54   <primary>delivery</primary>
55   <secondary>failure report</secondary>
56   <see><emphasis>bounce message</emphasis></see>
57 </indexterm>
58 <indexterm role="concept">
59   <primary>dialup</primary>
60   <see><emphasis>intermittently connected hosts</emphasis></see>
61 </indexterm>
62 <indexterm role="concept">
63   <primary>exiscan</primary>
64   <see><emphasis>content scanning</emphasis></see>
65 </indexterm>
66 <indexterm role="concept">
67   <primary>failover</primary>
68   <see><emphasis>fallback</emphasis></see>
69 </indexterm>
70 <indexterm role="concept">
71   <primary>fallover</primary>
72   <see><emphasis>fallback</emphasis></see>
73 </indexterm>
74 <indexterm role="concept">
75   <primary>filter</primary>
76   <secondary>Sieve</secondary>
77   <see><emphasis>Sieve filter</emphasis></see>
78 </indexterm>
79 <indexterm role="concept">
80   <primary>ident</primary>
81   <see><emphasis>RFC 1413</emphasis></see>
82 </indexterm>
83 <indexterm role="concept">
84   <primary>LF character</primary>
85   <see><emphasis>linefeed</emphasis></see>
86 </indexterm>
87 <indexterm role="concept">
88   <primary>maximum</primary>
89   <seealso><emphasis>limit</emphasis></seealso>
90 </indexterm>
91 <indexterm role="concept">
92   <primary>monitor</primary>
93   <see><emphasis>Exim monitor</emphasis></see>
94 </indexterm>
95 <indexterm role="concept">
96   <primary>no_<emphasis>xxx</emphasis></primary>
97   <see>entry for xxx</see>
98 </indexterm>
99 <indexterm role="concept">
100   <primary>NUL</primary>
101   <see><emphasis>binary zero</emphasis></see>
102 </indexterm>
103 <indexterm role="concept">
104   <primary>passwd file</primary>
105   <see><emphasis>/etc/passwd</emphasis></see>
106 </indexterm>
107 <indexterm role="concept">
108   <primary>process id</primary>
109   <see><emphasis>pid</emphasis></see>
110 </indexterm>
111 <indexterm role="concept">
112   <primary>RBL</primary>
113   <see><emphasis>DNS list</emphasis></see>
114 </indexterm>
115 <indexterm role="concept">
116   <primary>redirection</primary>
117   <see><emphasis>address redirection</emphasis></see>
118 </indexterm>
119 <indexterm role="concept">
120   <primary>return path</primary>
121   <seealso><emphasis>envelope sender</emphasis></seealso>
122 </indexterm>
123 <indexterm role="concept">
124   <primary>scanning</primary>
125   <see><emphasis>content scanning</emphasis></see>
126 </indexterm>
127 <indexterm role="concept">
128   <primary>SSL</primary>
129   <see><emphasis>TLS</emphasis></see>
130 </indexterm>
131 <indexterm role="concept">
132   <primary>string</primary>
133   <secondary>expansion</secondary>
134   <see><emphasis>expansion</emphasis></see>
135 </indexterm>
136 <indexterm role="concept">
137   <primary>top bit</primary>
138   <see><emphasis>8-bit characters</emphasis></see>
139 </indexterm>
140 <indexterm role="concept">
141   <primary>variables</primary>
142   <see><emphasis>expansion, variables</emphasis></see>
143 </indexterm>
144 <indexterm role="concept">
145   <primary>zero, binary</primary>
146   <see><emphasis>binary zero</emphasis></see>
147 </indexterm>
148
149 <para>
150 Exim is a mail transfer agent (MTA) for hosts that are running Unix or
151 Unix-like operating systems. It was designed on the assumption that it would be
152 run on hosts that are permanently connected to the Internet. However, it can be
153 used on intermittently connected hosts with suitable configuration adjustments.
154 </para>
155 <para>
156 Configuration files currently exist for the following operating systems: AIX,
157 BSD/OS (aka BSDI), Darwin (Mac OS X), DGUX, Dragonfly, FreeBSD, GNU/Hurd,
158 GNU/Linux, HI-OSF (Hitachi), HI-UX, HP-UX, IRIX, MIPS RISCOS, NetBSD, OpenBSD,
159 OpenUNIX, QNX, SCO, SCO SVR4.2 (aka UNIX-SV), Solaris (aka SunOS5), SunOS4,
160 Tru64-Unix (formerly Digital UNIX, formerly DEC-OSF1), Ultrix, and Unixware.
161 Some of these operating systems are no longer current and cannot easily be
162 tested, so the configuration files may no longer work in practice.
163 </para>
164 <para>
165 There are also configuration files for compiling Exim in the Cygwin environment
166 that can be installed on systems running Windows. However, this document does
167 not contain any information about running Exim in the Cygwin environment.
168 </para>
169 <para>
170 The terms and conditions for the use and distribution of Exim are contained in
171 the file <filename>NOTICE</filename>. Exim is distributed under the terms of the GNU General
172 Public Licence, a copy of which may be found in the file <filename>LICENCE</filename>.
173 </para>
174 <para>
175 The use, supply or promotion of Exim for the purpose of sending bulk,
176 unsolicited electronic mail is incompatible with the basic aims of the program,
177 which revolve around the free provision of a service that enhances the quality
178 of personal communications. The author of Exim regards indiscriminate
179 mass-mailing as an antisocial, irresponsible abuse of the Internet.
180 </para>
181 <para>
182 Exim owes a great deal to Smail 3 and its author, Ron Karr. Without the
183 experience of running and working on the Smail 3 code, I could never have
184 contemplated starting to write a new MTA. Many of the ideas and user interfaces
185 were originally taken from Smail 3, though the actual code of Exim is entirely
186 new, and has developed far beyond the initial concept.
187 </para>
188 <para>
189 Many people, both in Cambridge and around the world, have contributed to the
190 development and the testing of Exim, and to porting it to various operating
191 systems. I am grateful to them all. The distribution now contains a file called
192 <filename>ACKNOWLEDGMENTS</filename>, in which I have started recording the names of
193 contributors.
194 </para>
195 <section id="SECID1">
196 <title>Exim documentation</title>
197 <para revisionflag="changed">
198 <indexterm role="concept">
199 <primary>documentation</primary>
200 </indexterm>
201 This edition of the Exim specification applies to version 4.72 of Exim.
202 Substantive changes from the 4.71 edition are marked in some
203 renditions of the document; this paragraph is so marked if the rendition is
204 capable of showing a change indicator.
205 </para>
206 <para>
207 This document is very much a reference manual; it is not a tutorial. The reader
208 is expected to have some familiarity with the SMTP mail transfer protocol and
209 with general Unix system administration. Although there are some discussions
210 and examples in places, the information is mostly organized in a way that makes
211 it easy to look up, rather than in a natural order for sequential reading.
212 Furthermore, the manual aims to cover every aspect of Exim in detail, including
213 a number of rarely-used, special-purpose features that are unlikely to be of
214 very wide interest.
215 </para>
216 <para>
217 <indexterm role="concept">
218 <primary>books about Exim</primary>
219 </indexterm>
220 An <quote>easier</quote> discussion of Exim which provides more in-depth explanatory,
221 introductory, and tutorial material can be found in a book entitled <emphasis>The Exim
222 SMTP Mail Server</emphasis> (second edition, 2007), published by UIT Cambridge
223 (<emphasis role="bold"><ulink url="http://www.uit.co.uk/exim-book/">http://www.uit.co.uk/exim-book/</ulink></emphasis>).
224 </para>
225 <para>
226 This book also contains a chapter that gives a general introduction to SMTP and
227 Internet mail. Inevitably, however, the book is unlikely to be fully up-to-date
228 with the latest release of Exim. (Note that the earlier book about Exim,
229 published by O&#x2019;Reilly, covers Exim 3, and many things have changed in Exim 4.)
230 </para>
231 <para>
232 <indexterm role="concept">
233 <primary>Debian</primary>
234 <secondary>information sources</secondary>
235 </indexterm>
236 If you are using a Debian distribution of Exim, you will find information about
237 Debian-specific features in the file
238 <filename>/usr/share/doc/exim4-base/README.Debian</filename>.
239 The command <command>man update-exim.conf</command> is another source of Debian-specific
240 information.
241 </para>
242 <para>
243 <indexterm role="concept">
244 <primary><filename>doc/NewStuff</filename></primary>
245 </indexterm>
246 <indexterm role="concept">
247 <primary><filename>doc/ChangeLog</filename></primary>
248 </indexterm>
249 <indexterm role="concept">
250 <primary>change log</primary>
251 </indexterm>
252 As the program develops, there may be features in newer versions that have not
253 yet made it into this document, which is updated only when the most significant
254 digit of the fractional part of the version number changes. Specifications of
255 new features that are not yet in this manual are placed in the file
256 <filename>doc/NewStuff</filename> in the Exim distribution.
257 </para>
258 <para>
259 Some features may be classified as <quote>experimental</quote>. These may change
260 incompatibly while they are developing, or even be withdrawn. For this reason,
261 they are not documented in this manual. Information about experimental features
262 can be found in the file <filename>doc/experimental.txt</filename>.
263 </para>
264 <para>
265 All changes to the program (whether new features, bug fixes, or other kinds of
266 change) are noted briefly in the file called <filename>doc/ChangeLog</filename>.
267 </para>
268 <para>
269 <indexterm role="concept">
270 <primary><filename>doc/spec.txt</filename></primary>
271 </indexterm>
272 This specification itself is available as an ASCII file in <filename>doc/spec.txt</filename> so
273 that it can easily be searched with a text editor. Other files in the <filename>doc</filename>
274 directory are:
275 </para>
276 <informaltable frame="none">
277 <tgroup cols="2" colsep="0" rowsep="0">
278 <colspec colwidth="100pt" align="left"/>
279 <colspec colwidth="254pt" align="left"/>
280 <tbody>
281 <row>
282 <entry><filename>OptionLists.txt</filename></entry>
283 <entry>list of all options in alphabetical order</entry>
284 </row>
285 <row>
286 <entry><filename>dbm.discuss.txt</filename></entry>
287 <entry>discussion about DBM libraries</entry>
288 </row>
289 <row>
290 <entry><filename>exim.8</filename></entry>
291 <entry>a man page of Exim&#x2019;s command line options</entry>
292 </row>
293 <row>
294 <entry><filename>experimental.txt</filename></entry>
295 <entry>documentation of experimental features</entry>
296 </row>
297 <row>
298 <entry><filename>filter.txt</filename></entry>
299 <entry>specification of the filter language</entry>
300 </row>
301 <row>
302 <entry><filename>Exim3.upgrade</filename></entry>
303 <entry>upgrade notes from release 2 to release 3</entry>
304 </row>
305 <row>
306 <entry><filename>Exim4.upgrade</filename></entry>
307 <entry>upgrade notes from release 3 to release 4</entry>
308 </row>
309 </tbody>
310 </tgroup>
311 </informaltable>
312 <para>
313 The main specification and the specification of the filtering language are also
314 available in other formats (HTML, PostScript, PDF, and Texinfo). Section
315 <xref linkend="SECTavail"/> below tells you how to get hold of these.
316 </para>
317 </section>
318 <section id="SECID2">
319 <title>FTP and web sites</title>
320 <para>
321 <indexterm role="concept">
322 <primary>web site</primary>
323 </indexterm>
324 <indexterm role="concept">
325 <primary>FTP site</primary>
326 </indexterm>
327 The primary site for Exim source distributions is currently the University of
328 Cambridge&#x2019;s FTP site, whose contents are described in <emphasis>Where to find the Exim
329 distribution</emphasis> below. In addition, there is a web site and an FTP site at
330 <option>exim.org</option>. These are now also hosted at the University of Cambridge. The
331 <option>exim.org</option> site was previously hosted for a number of years by Energis
332 Squared, formerly Planet Online Ltd, whose support I gratefully acknowledge.
333 </para>
334 <para>
335 <indexterm role="concept">
336 <primary>wiki</primary>
337 </indexterm>
338 <indexterm role="concept">
339 <primary>FAQ</primary>
340 </indexterm>
341 As well as Exim distribution tar files, the Exim web site contains a number of
342 differently formatted versions of the documentation. A recent addition to the
343 online information is the Exim wiki (<emphasis role="bold"><ulink url="http://wiki.exim.org">http://wiki.exim.org</ulink></emphasis>),
344 which contains what used to be a separate FAQ, as well as various other
345 examples, tips, and know-how that have been contributed by Exim users.
346 </para>
347 <para>
348 <indexterm role="concept">
349 <primary>Bugzilla</primary>
350 </indexterm>
351 An Exim Bugzilla exists at <emphasis role="bold"><ulink url="http://bugs.exim.org">http://bugs.exim.org</ulink></emphasis>. You can use
352 this to report bugs, and also to add items to the wish list. Please search
353 first to check that you are not duplicating a previous entry.
354 </para>
355 </section>
356 <section id="SECID3">
357 <title>Mailing lists</title>
358 <para>
359 <indexterm role="concept">
360 <primary>mailing lists</primary>
361 <secondary>for Exim users</secondary>
362 </indexterm>
363 The following Exim mailing lists exist:
364 </para>
365 <informaltable frame="none">
366 <tgroup cols="2" colsep="0" rowsep="0">
367 <colspec colwidth="140pt" align="left"/>
368 <colspec colwidth="254pt" align="left"/>
369 <tbody>
370 <row>
371 <entry><emphasis>exim-users@exim.org</emphasis></entry>
372 <entry>General discussion list</entry>
373 </row>
374 <row>
375 <entry><emphasis>exim-dev@exim.org</emphasis></entry>
376 <entry>Discussion of bugs, enhancements, etc.</entry>
377 </row>
378 <row>
379 <entry><emphasis>exim-announce@exim.org</emphasis></entry>
380 <entry>Moderated, low volume announcements list</entry>
381 </row>
382 <row>
383 <entry><emphasis>exim-future@exim.org</emphasis></entry>
384 <entry>Discussion of long-term development</entry>
385 </row>
386 </tbody>
387 </tgroup>
388 </informaltable>
389 <para>
390 You can subscribe to these lists, change your existing subscriptions, and view
391 or search the archives via the mailing lists link on the Exim home page.
392 <indexterm role="concept">
393 <primary>Debian</primary>
394 <secondary>mailing list for</secondary>
395 </indexterm>
396 If you are using a Debian distribution of Exim, you may wish to subscribe to
397 the Debian-specific mailing list <emphasis>pkg-exim4-users@lists.alioth.debian.org</emphasis>
398 via this web page:
399 </para>
400 <literallayout>
401 <emphasis role="bold"><ulink url="http://lists.alioth.debian.org/mailman/listinfo/pkg-exim4-users">http://lists.alioth.debian.org/mailman/listinfo/pkg-exim4-users</ulink></emphasis>
402 </literallayout>
403 <para>
404 Please ask Debian-specific questions on this list and not on the general Exim
405 lists.
406 </para>
407 </section>
408 <section id="SECID4">
409 <title>Exim training</title>
410 <para>
411 <indexterm role="concept">
412 <primary>training courses</primary>
413 </indexterm>
414 Training courses in Cambridge (UK) used to be run annually by the author of
415 Exim, before he retired. At the time of writing, there are no plans to run
416 further Exim courses in Cambridge. However, if that changes, relevant
417 information will be posted at <emphasis role="bold"><ulink url="http://www-tus.csx.cam.ac.uk/courses/exim/">http://www-tus.csx.cam.ac.uk/courses/exim/</ulink></emphasis>.
418 </para>
419 </section>
420 <section id="SECID5">
421 <title>Bug reports</title>
422 <para>
423 <indexterm role="concept">
424 <primary>bug reports</primary>
425 </indexterm>
426 <indexterm role="concept">
427 <primary>reporting bugs</primary>
428 </indexterm>
429 Reports of obvious bugs can be emailed to <emphasis>bugs@exim.org</emphasis> or reported
430 via the Bugzilla (<emphasis role="bold"><ulink url="http://bugs.exim.org">http://bugs.exim.org</ulink></emphasis>). However, if you are unsure
431 whether some behaviour is a bug or not, the best thing to do is to post a
432 message to the <emphasis>exim-dev</emphasis> mailing list and have it discussed.
433 </para>
434 </section>
435 <section id="SECTavail">
436 <title>Where to find the Exim distribution</title>
437 <para>
438 <indexterm role="concept">
439 <primary>FTP site</primary>
440 </indexterm>
441 <indexterm role="concept">
442 <primary>distribution</primary>
443 <secondary>ftp site</secondary>
444 </indexterm>
445 The master ftp site for the Exim distribution is
446 </para>
447 <literallayout>
448 <emphasis role="bold">ftp://ftp.csx.cam.ac.uk/pub/software/email/exim</emphasis>
449 </literallayout>
450 <para>
451 This is mirrored by
452 </para>
453 <literallayout>
454 <emphasis role="bold">ftp://ftp.exim.org/pub/exim</emphasis>
455 </literallayout>
456 <para>
457 The file references that follow are relative to the <filename>exim</filename> directories at
458 these sites. There are now quite a number of independent mirror sites around
459 the world. Those that I know about are listed in the file called <filename>Mirrors</filename>.
460 </para>
461 <para>
462 Within the <filename>exim</filename> directory there are subdirectories called <filename>exim3</filename> (for
463 previous Exim 3 distributions), <filename>exim4</filename> (for the latest Exim 4
464 distributions), and <filename>Testing</filename> for testing versions. In the <filename>exim4</filename>
465 subdirectory, the current release can always be found in files called
466 </para>
467 <literallayout>
468 <filename>exim-n.nn.tar.gz</filename>
469 <filename>exim-n.nn.tar.bz2</filename>
470 </literallayout>
471 <para>
472 where <emphasis>n.nn</emphasis> is the highest such version number in the directory. The two
473 files contain identical data; the only difference is the type of compression.
474 The <filename>.bz2</filename> file is usually a lot smaller than the <filename>.gz</filename> file.
475 </para>
476 <para>
477 <indexterm role="concept">
478 <primary>distribution</primary>
479 <secondary>signing details</secondary>
480 </indexterm>
481 <indexterm role="concept">
482 <primary>distribution</primary>
483 <secondary>public key</secondary>
484 </indexterm>
485 <indexterm role="concept">
486 <primary>public key for signed distribution</primary>
487 </indexterm>
488 The distributions are currently signed with Nigel Metheringham&#x2019;s GPG key. The
489 corresponding public key is available from a number of keyservers, and there is
490 also a copy in the file <filename>nigel-pubkey.asc</filename>. The signatures for the tar bundles are
491 in:
492 </para>
493 <literallayout>
494 <filename>exim-n.nn.tar.gz.asc</filename>
495 <filename>exim-n.nn.tar.bz2.asc</filename>
496 </literallayout>
497 <para>
498 For each released version, the log of changes is made separately available in a
499 separate file in the directory <filename>ChangeLogs</filename> so that it is possible to
500 find out what has changed without having to download the entire distribution.
501 </para>
502 <para>
503 <indexterm role="concept">
504 <primary>documentation</primary>
505 <secondary>available formats</secondary>
506 </indexterm>
507 The main distribution contains ASCII versions of this specification and other
508 documentation; other formats of the documents are available in separate files
509 inside the <filename>exim4</filename> directory of the FTP site:
510 </para>
511 <literallayout>
512 <filename>exim-html-n.nn.tar.gz</filename>
513 <filename>exim-pdf-n.nn.tar.gz</filename>
514 <filename>exim-postscript-n.nn.tar.gz</filename>
515 <filename>exim-texinfo-n.nn.tar.gz</filename>
516 </literallayout>
517 <para>
518 These tar files contain only the <filename>doc</filename> directory, not the complete
519 distribution, and are also available in <filename>.bz2</filename> as well as <filename>.gz</filename> forms.
520 </para>
521 </section>
522 <section id="SECID6">
523 <title>Limitations</title>
524 <itemizedlist>
525 <listitem>
526 <para>
527 <indexterm role="concept">
528 <primary>limitations of Exim</primary>
529 </indexterm>
530 <indexterm role="concept">
531 <primary>bang paths</primary>
532 <secondary>not handled by Exim</secondary>
533 </indexterm>
534 Exim is designed for use as an Internet MTA, and therefore handles addresses in
535 RFC 2822 domain format only. It cannot handle UUCP <quote>bang paths</quote>, though
536 simple two-component bang paths can be converted by a straightforward rewriting
537 configuration. This restriction does not prevent Exim from being interfaced to
538 UUCP as a transport mechanism, provided that domain addresses are used.
539 </para>
540 </listitem>
541 <listitem>
542 <para>
543 <indexterm role="concept">
544 <primary>domainless addresses</primary>
545 </indexterm>
546 <indexterm role="concept">
547 <primary>address</primary>
548 <secondary>without domain</secondary>
549 </indexterm>
550 Exim insists that every address it handles has a domain attached. For incoming
551 local messages, domainless addresses are automatically qualified with a
552 configured domain value. Configuration options specify from which remote
553 systems unqualified addresses are acceptable. These are then qualified on
554 arrival.
555 </para>
556 </listitem>
557 <listitem>
558 <para>
559 <indexterm role="concept">
560 <primary>transport</primary>
561 <secondary>external</secondary>
562 </indexterm>
563 <indexterm role="concept">
564 <primary>external transports</primary>
565 </indexterm>
566 The only external transport mechanisms that are currently implemented are SMTP
567 and LMTP over a TCP/IP network (including support for IPv6). However, a pipe
568 transport is available, and there are facilities for writing messages to files
569 and pipes, optionally in <emphasis>batched SMTP</emphasis> format; these facilities can be used
570 to send messages to other transport mechanisms such as UUCP, provided they can
571 handle domain-style addresses. Batched SMTP input is also catered for.
572 </para>
573 </listitem>
574 <listitem>
575 <para>
576 Exim is not designed for storing mail for dial-in hosts. When the volumes of
577 such mail are large, it is better to get the messages <quote>delivered</quote> into files
578 (that is, off Exim&#x2019;s queue) and subsequently passed on to the dial-in hosts by
579 other means.
580 </para>
581 </listitem>
582 <listitem>
583 <para>
584 Although Exim does have basic facilities for scanning incoming messages, these
585 are not comprehensive enough to do full virus or spam scanning. Such operations
586 are best carried out using additional specialized software packages. If you
587 compile Exim with the content-scanning extension, straightforward interfaces to
588 a number of common scanners are provided.
589 </para>
590 </listitem>
591 </itemizedlist>
592 </section>
593 <section id="SECID7">
594 <title>Run time configuration</title>
595 <para>
596 Exim&#x2019;s run time configuration is held in a single text file that is divided
597 into a number of sections. The entries in this file consist of keywords and
598 values, in the style of Smail 3 configuration files. A default configuration
599 file which is suitable for simple online installations is provided in the
600 distribution, and is described in chapter <xref linkend="CHAPdefconfil"/> below.
601 </para>
602 </section>
603 <section id="SECID8">
604 <title>Calling interface</title>
605 <para>
606 <indexterm role="concept">
607 <primary>Sendmail compatibility</primary>
608 <secondary>command line interface</secondary>
609 </indexterm>
610 Like many MTAs, Exim has adopted the Sendmail command line interface so that it
611 can be a straight replacement for <filename>/usr/lib/sendmail</filename> or
612 <filename>/usr/sbin/sendmail</filename> when sending mail, but you do not need to know anything
613 about Sendmail in order to run Exim. For actions other than sending messages,
614 Sendmail-compatible options also exist, but those that produce output (for
615 example, <option>-bp</option>, which lists the messages on the queue) do so in Exim&#x2019;s own
616 format. There are also some additional options that are compatible with Smail
617 3, and some further options that are new to Exim. Chapter <xref linkend="CHAPcommandline"/>
618 documents all Exim&#x2019;s command line options. This information is automatically
619 made into the man page that forms part of the Exim distribution.
620 </para>
621 <para>
622 Control of messages on the queue can be done via certain privileged command
623 line options. There is also an optional monitor program called <emphasis>eximon</emphasis>,
624 which displays current information in an X window, and which contains a menu
625 interface to Exim&#x2019;s command line administration options.
626 </para>
627 </section>
628 <section id="SECID9">
629 <title>Terminology</title>
630 <para>
631 <indexterm role="concept">
632 <primary>terminology definitions</primary>
633 </indexterm>
634 <indexterm role="concept">
635 <primary>body of message</primary>
636 <secondary>definition of</secondary>
637 </indexterm>
638 The <emphasis>body</emphasis> of a message is the actual data that the sender wants to transmit.
639 It is the last part of a message, and is separated from the <emphasis>header</emphasis> (see
640 below) by a blank line.
641 </para>
642 <para>
643 <indexterm role="concept">
644 <primary>bounce message</primary>
645 <secondary>definition of</secondary>
646 </indexterm>
647 When a message cannot be delivered, it is normally returned to the sender in a
648 delivery failure message or a <quote>non-delivery report</quote> (NDR). The term
649 <emphasis>bounce</emphasis> is commonly used for this action, and the error reports are often
650 called <emphasis>bounce messages</emphasis>. This is a convenient shorthand for <quote>delivery
651 failure error report</quote>. Such messages have an empty sender address in the
652 message&#x2019;s <emphasis>envelope</emphasis> (see below) to ensure that they cannot themselves give
653 rise to further bounce messages.
654 </para>
655 <para>
656 The term <emphasis>default</emphasis> appears frequently in this manual. It is used to qualify a
657 value which is used in the absence of any setting in the configuration. It may
658 also qualify an action which is taken unless a configuration setting specifies
659 otherwise.
660 </para>
661 <para>
662 The term <emphasis>defer</emphasis> is used when the delivery of a message to a specific
663 destination cannot immediately take place for some reason (a remote host may be
664 down, or a user&#x2019;s local mailbox may be full). Such deliveries are <emphasis>deferred</emphasis>
665 until a later time.
666 </para>
667 <para>
668 The word <emphasis>domain</emphasis> is sometimes used to mean all but the first component of a
669 host&#x2019;s name. It is <emphasis>not</emphasis> used in that sense here, where it normally refers to
670 the part of an email address following the @ sign.
671 </para>
672 <para>
673 <indexterm role="concept">
674 <primary>envelope, definition of</primary>
675 </indexterm>
676 <indexterm role="concept">
677 <primary>sender</primary>
678 <secondary>definition of</secondary>
679 </indexterm>
680 A message in transit has an associated <emphasis>envelope</emphasis>, as well as a header and a
681 body. The envelope contains a sender address (to which bounce messages should
682 be delivered), and any number of recipient addresses. References to the
683 sender or the recipients of a message usually mean the addresses in the
684 envelope. An MTA uses these addresses for delivery, and for returning bounce
685 messages, not the addresses that appear in the header lines.
686 </para>
687 <para>
688 <indexterm role="concept">
689 <primary>message</primary>
690 <secondary>header, definition of</secondary>
691 </indexterm>
692 <indexterm role="concept">
693 <primary>header section</primary>
694 <secondary>definition of</secondary>
695 </indexterm>
696 The <emphasis>header</emphasis> of a message is the first part of a message&#x2019;s text, consisting
697 of a number of lines, each of which has a name such as <emphasis>From:</emphasis>, <emphasis>To:</emphasis>,
698 <emphasis>Subject:</emphasis>, etc. Long header lines can be split over several text lines by
699 indenting the continuations. The header is separated from the body by a blank
700 line.
701 </para>
702 <para>
703 <indexterm role="concept">
704 <primary>local part</primary>
705 <secondary>definition of</secondary>
706 </indexterm>
707 <indexterm role="concept">
708 <primary>domain</primary>
709 <secondary>definition of</secondary>
710 </indexterm>
711 The term <emphasis>local part</emphasis>, which is taken from RFC 2822, is used to refer to that
712 part of an email address that precedes the @ sign. The part that follows the
713 @ sign is called the <emphasis>domain</emphasis> or <emphasis>mail domain</emphasis>.
714 </para>
715 <para>
716 <indexterm role="concept">
717 <primary>local delivery</primary>
718 <secondary>definition of</secondary>
719 </indexterm>
720 <indexterm role="concept">
721 <primary>remote delivery, definition of</primary>
722 </indexterm>
723 The terms <emphasis>local delivery</emphasis> and <emphasis>remote delivery</emphasis> are used to distinguish
724 delivery to a file or a pipe on the local host from delivery by SMTP over
725 TCP/IP to another host. As far as Exim is concerned, all hosts other than the
726 host it is running on are <emphasis>remote</emphasis>.
727 </para>
728 <para>
729 <indexterm role="concept">
730 <primary>return path</primary>
731 <secondary>definition of</secondary>
732 </indexterm>
733 <emphasis>Return path</emphasis> is another name that is used for the sender address in a
734 message&#x2019;s envelope.
735 </para>
736 <para>
737 <indexterm role="concept">
738 <primary>queue</primary>
739 <secondary>definition of</secondary>
740 </indexterm>
741 The term <emphasis>queue</emphasis> is used to refer to the set of messages awaiting delivery,
742 because this term is in widespread use in the context of MTAs. However, in
743 Exim&#x2019;s case the reality is more like a pool than a queue, because there is
744 normally no ordering of waiting messages.
745 </para>
746 <para>
747 <indexterm role="concept">
748 <primary>queue runner</primary>
749 <secondary>definition of</secondary>
750 </indexterm>
751 The term <emphasis>queue runner</emphasis> is used to describe a process that scans the queue
752 and attempts to deliver those messages whose retry times have come. This term
753 is used by other MTAs, and also relates to the command <option>runq</option>, but in Exim
754 the waiting messages are normally processed in an unpredictable order.
755 </para>
756 <para>
757 <indexterm role="concept">
758 <primary>spool directory</primary>
759 <secondary>definition of</secondary>
760 </indexterm>
761 The term <emphasis>spool directory</emphasis> is used for a directory in which Exim keeps the
762 messages on its queue &ndash; that is, those that it is in the process of
763 delivering. This should not be confused with the directory in which local
764 mailboxes are stored, which is called a <quote>spool directory</quote> by some people. In
765 the Exim documentation, <quote>spool</quote> is always used in the first sense.
766 </para>
767 </section>
768 </chapter>
769
770 <chapter id="CHID2">
771 <title>Incorporated code</title>
772 <para>
773 <indexterm role="concept">
774 <primary>incorporated code</primary>
775 </indexterm>
776 <indexterm role="concept">
777 <primary>regular expressions</primary>
778 <secondary>library</secondary>
779 </indexterm>
780 <indexterm role="concept">
781 <primary>PCRE</primary>
782 </indexterm>
783 A number of pieces of external code are included in the Exim distribution.
784 </para>
785 <itemizedlist>
786 <listitem>
787 <para>
788 Regular expressions are supported in the main Exim program and in the
789 Exim monitor using the freely-distributable PCRE library, copyright
790 &copy; University of Cambridge. The source to PCRE is no longer shipped with
791 Exim, so you will need to use the version of PCRE shipped with your system,
792 or obtain and install the full version of the library from
793 <emphasis role="bold"><ulink url="ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre">ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre</ulink></emphasis>.
794 </para>
795 </listitem>
796 <listitem>
797 <para>
798 <indexterm role="concept">
799 <primary>cdb</primary>
800 <secondary>acknowledgment</secondary>
801 </indexterm>
802 Support for the cdb (Constant DataBase) lookup method is provided by code
803 contributed by Nigel Metheringham of (at the time he contributed it) Planet
804 Online Ltd. The implementation is completely contained within the code of Exim.
805 It does not link against an external cdb library. The code contains the
806 following statements:
807 </para>
808 <blockquote>
809 <para>
810 Copyright &copy; 1998 Nigel Metheringham, Planet Online Ltd
811 </para>
812 <para>
813 This program is free software; you can redistribute it and/or modify it under
814 the terms of the GNU General Public License as published by the Free Software
815 Foundation; either version 2 of the License, or (at your option) any later
816 version.
817 This code implements Dan Bernstein&#x2019;s Constant DataBase (cdb) spec. Information,
818 the spec and sample code for cdb can be obtained from
819 <emphasis role="bold"><ulink url="http://www.pobox.com/~djb/cdb.html">http://www.pobox.com/~djb/cdb.html</ulink></emphasis>. This implementation borrows
820 some code from Dan Bernstein&#x2019;s implementation (which has no license
821 restrictions applied to it).
822 </para>
823 </blockquote>
824 </listitem>
825 <listitem>
826 <para>
827 <indexterm role="concept">
828 <primary>SPA authentication</primary>
829 </indexterm>
830 <indexterm role="concept">
831 <primary>Samba project</primary>
832 </indexterm>
833 <indexterm role="concept">
834 <primary>Microsoft Secure Password Authentication</primary>
835 </indexterm>
836 Client support for Microsoft&#x2019;s <emphasis>Secure Password Authentication</emphasis> is provided
837 by code contributed by Marc Prud&#x2019;hommeaux. Server support was contributed by
838 Tom Kistner. This includes code taken from the Samba project, which is released
839 under the Gnu GPL.
840 </para>
841 </listitem>
842 <listitem>
843 <para>
844 <indexterm role="concept">
845 <primary>Cyrus</primary>
846 </indexterm>
847 <indexterm role="concept">
848 <primary><emphasis>pwcheck</emphasis> daemon</primary>
849 </indexterm>
850 <indexterm role="concept">
851 <primary><emphasis>pwauthd</emphasis> daemon</primary>
852 </indexterm>
853 Support for calling the Cyrus <emphasis>pwcheck</emphasis> and <emphasis>saslauthd</emphasis> daemons is provided
854 by code taken from the Cyrus-SASL library and adapted by Alexander S.
855 Sabourenkov. The permission notice appears below, in accordance with the
856 conditions expressed therein.
857 </para>
858 <blockquote>
859 <para>
860 Copyright &copy; 2001 Carnegie Mellon University.  All rights reserved.
861 </para>
862 <para>
863 Redistribution and use in source and binary forms, with or without
864 modification, are permitted provided that the following conditions
865 are met:
866 </para>
867 <orderedlist numeration="arabic">
868 <listitem>
869 <para>
870 Redistributions of source code must retain the above copyright
871 notice, this list of conditions and the following disclaimer.
872 </para>
873 </listitem>
874 <listitem>
875 <para>
876 Redistributions in binary form must reproduce the above copyright
877 notice, this list of conditions and the following disclaimer in
878 the documentation and/or other materials provided with the
879 distribution.
880 </para>
881 </listitem>
882 <listitem>
883 <para>
884 The name <quote>Carnegie Mellon University</quote> must not be used to
885 endorse or promote products derived from this software without
886 prior written permission. For permission or any other legal
887 details, please contact
888 </para>
889 <literallayout>
890               Office of Technology Transfer
891               Carnegie Mellon University
892               5000 Forbes Avenue
893               Pittsburgh, PA  15213-3890
894               (412) 268-4387, fax: (412) 268-7395
895               tech-transfer@andrew.cmu.edu
896 </literallayout>
897 </listitem>
898 <listitem>
899 <para>
900 Redistributions of any form whatsoever must retain the following
901 acknowledgment:
902 </para>
903 <para>
904 <quote>This product includes software developed by Computing Services
905 at Carnegie Mellon University (<emphasis role="bold"><ulink url="http://www.cmu.edu/computing/">http://www.cmu.edu/computing/</ulink></emphasis>.</quote>
906 </para>
907 <para>
908 CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
909 THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
910 AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
911 FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
912 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
913 AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
914 OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
915 </para>
916 </listitem>
917 </orderedlist>
918 </blockquote>
919 </listitem>
920 <listitem>
921 <para>
922 <indexterm role="concept">
923 <primary>Exim monitor</primary>
924 <secondary>acknowledgment</secondary>
925 </indexterm>
926 <indexterm role="concept">
927 <primary>X-windows</primary>
928 </indexterm>
929 <indexterm role="concept">
930 <primary>Athena</primary>
931 </indexterm>
932 The Exim Monitor program, which is an X-Window application, includes
933 modified versions of the Athena StripChart and TextPop widgets.
934 This code is copyright by DEC and MIT, and their permission notice appears
935 below, in accordance with the conditions expressed therein.
936 </para>
937 <blockquote>
938 <para>
939 Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
940 and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
941 </para>
942 <para>
943 All Rights Reserved
944 </para>
945 <para>
946 Permission to use, copy, modify, and distribute this software and its
947 documentation for any purpose and without fee is hereby granted,
948 provided that the above copyright notice appear in all copies and that
949 both that copyright notice and this permission notice appear in
950 supporting documentation, and that the names of Digital or MIT not be
951 used in advertising or publicity pertaining to distribution of the
952 software without specific, written prior permission.
953 </para>
954 <para>
955 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
956 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
957 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
958 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
959 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
960 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
961 SOFTWARE.
962 </para>
963 </blockquote>
964 </listitem>
965 <listitem>
966 <para>
967 Many people have contributed code fragments, some large, some small, that were
968 not covered by any specific licence requirements. It is assumed that the
969 contributors are happy to see their code incorporated into Exim under the GPL.
970 </para>
971 </listitem>
972 </itemizedlist>
973 </chapter>
974
975 <chapter id="CHID11">
976 <title>How Exim receives and delivers mail</title>
977 <titleabbrev>Receiving and delivering mail</titleabbrev>
978 <section id="SECID10">
979 <title>Overall philosophy</title>
980 <para>
981 <indexterm role="concept">
982 <primary>design philosophy</primary>
983 </indexterm>
984 Exim is designed to work efficiently on systems that are permanently connected
985 to the Internet and are handling a general mix of mail. In such circumstances,
986 most messages can be delivered immediately. Consequently, Exim does not
987 maintain independent queues of messages for specific domains or hosts, though
988 it does try to send several messages in a single SMTP connection after a host
989 has been down, and it also maintains per-host retry information.
990 </para>
991 </section>
992 <section id="SECID11">
993 <title>Policy control</title>
994 <para>
995 <indexterm role="concept">
996 <primary>policy control</primary>
997 <secondary>overview</secondary>
998 </indexterm>
999 Policy controls are now an important feature of MTAs that are connected to the
1000 Internet. Perhaps their most important job is to stop MTAs being abused as
1001 <quote>open relays</quote> by misguided individuals who send out vast amounts of
1002 unsolicited junk, and want to disguise its source. Exim provides flexible
1003 facilities for specifying policy controls on incoming mail:
1004 </para>
1005 <itemizedlist>
1006 <listitem>
1007 <para>
1008 <indexterm role="concept">
1009 <primary>access control lists (ACLs)</primary>
1010 <secondary>introduction</secondary>
1011 </indexterm>
1012 Exim 4 (unlike previous versions of Exim) implements policy controls on
1013 incoming mail by means of <emphasis>Access Control Lists</emphasis> (ACLs). Each list is a
1014 series of statements that may either grant or deny access. ACLs can be used at
1015 several places in the SMTP dialogue while receiving a message from a remote
1016 host. However, the most common places are after each RCPT command, and at the
1017 very end of the message. The sysadmin can specify conditions for accepting or
1018 rejecting individual recipients or the entire message, respectively, at these
1019 two points (see chapter <xref linkend="CHAPACL"/>). Denial of access results in an SMTP
1020 error code.
1021 </para>
1022 </listitem>
1023 <listitem>
1024 <para>
1025 An ACL is also available for locally generated, non-SMTP messages. In this
1026 case, the only available actions are to accept or deny the entire message.
1027 </para>
1028 </listitem>
1029 <listitem>
1030 <para>
1031 When Exim is compiled with the content-scanning extension, facilities are
1032 provided in the ACL mechanism for passing the message to external virus and/or
1033 spam scanning software. The result of such a scan is passed back to the ACL,
1034 which can then use it to decide what to do with the message.
1035 </para>
1036 </listitem>
1037 <listitem>
1038 <para>
1039 When a message has been received, either from a remote host or from the local
1040 host, but before the final acknowledgment has been sent, a locally supplied C
1041 function called <function>local_scan()</function> can be run to inspect the message and decide
1042 whether to accept it or not (see chapter <xref linkend="CHAPlocalscan"/>). If the message
1043 is accepted, the list of recipients can be modified by the function.
1044 </para>
1045 </listitem>
1046 <listitem>
1047 <para>
1048 Using the <function>local_scan()</function> mechanism is another way of calling external scanner
1049 software. The <option>SA-Exim</option> add-on package works this way. It does not require
1050 Exim to be compiled with the content-scanning extension.
1051 </para>
1052 </listitem>
1053 <listitem>
1054 <para>
1055 After a message has been accepted, a further checking mechanism is available in
1056 the form of the <emphasis>system filter</emphasis> (see chapter <xref linkend="CHAPsystemfilter"/>). This
1057 runs at the start of every delivery process.
1058 </para>
1059 </listitem>
1060 </itemizedlist>
1061 </section>
1062 <section id="SECID12">
1063 <title>User filters</title>
1064 <para>
1065 <indexterm role="concept">
1066 <primary>filter</primary>
1067 <secondary>introduction</secondary>
1068 </indexterm>
1069 <indexterm role="concept">
1070 <primary>Sieve filter</primary>
1071 </indexterm>
1072 In a conventional Exim configuration, users are able to run private filters by
1073 setting up appropriate <filename>.forward</filename> files in their home directories. See
1074 chapter <xref linkend="CHAPredirect"/> (about the <command>redirect</command> router) for the
1075 configuration needed to support this, and the separate document entitled
1076 <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis> for user details. Two different kinds
1077 of filtering are available:
1078 </para>
1079 <itemizedlist>
1080 <listitem>
1081 <para>
1082 Sieve filters are written in the standard filtering language that is defined
1083 by RFC 3028.
1084 </para>
1085 </listitem>
1086 <listitem>
1087 <para>
1088 Exim filters are written in a syntax that is unique to Exim, but which is more
1089 powerful than Sieve, which it pre-dates.
1090 </para>
1091 </listitem>
1092 </itemizedlist>
1093 <para>
1094 User filters are run as part of the routing process, described below.
1095 </para>
1096 </section>
1097 <section id="SECTmessiden">
1098 <title>Message identification</title>
1099 <para>
1100 <indexterm role="concept">
1101 <primary>message ids</primary>
1102 <secondary>details of format</secondary>
1103 </indexterm>
1104 <indexterm role="concept">
1105 <primary>format</primary>
1106 <secondary>of message id</secondary>
1107 </indexterm>
1108 <indexterm role="concept">
1109 <primary>id of message</primary>
1110 </indexterm>
1111 <indexterm role="concept">
1112 <primary>base62</primary>
1113 </indexterm>
1114 <indexterm role="concept">
1115 <primary>base36</primary>
1116 </indexterm>
1117 <indexterm role="concept">
1118 <primary>Darwin</primary>
1119 </indexterm>
1120 <indexterm role="concept">
1121 <primary>Cygwin</primary>
1122 </indexterm>
1123 Every message handled by Exim is given a <emphasis>message id</emphasis> which is sixteen
1124 characters long. It is divided into three parts, separated by hyphens, for
1125 example <literal>16VDhn-0001bo-D3</literal>. Each part is a sequence of letters and digits,
1126 normally encoding numbers in base 62. However, in the Darwin operating
1127 system (Mac OS X) and when Exim is compiled to run under Cygwin, base 36
1128 (avoiding the use of lower case letters) is used instead, because the message
1129 id is used to construct file names, and the names of files in those systems are
1130 not always case-sensitive.
1131 </para>
1132 <para>
1133 <indexterm role="concept">
1134 <primary>pid (process id)</primary>
1135 <secondary>re-use of</secondary>
1136 </indexterm>
1137 The detail of the contents of the message id have changed as Exim has evolved.
1138 Earlier versions relied on the operating system not re-using a process id (pid)
1139 within one second. On modern operating systems, this assumption can no longer
1140 be made, so the algorithm had to be changed. To retain backward compatibility,
1141 the format of the message id was retained, which is why the following rules are
1142 somewhat eccentric:
1143 </para>
1144 <itemizedlist>
1145 <listitem>
1146 <para>
1147 The first six characters of the message id are the time at which the message
1148 started to be received, to a granularity of one second. That is, this field
1149 contains the number of seconds since the start of the epoch (the normal Unix
1150 way of representing the date and time of day).
1151 </para>
1152 </listitem>
1153 <listitem>
1154 <para>
1155 After the first hyphen, the next six characters are the id of the process that
1156 received the message.
1157 </para>
1158 </listitem>
1159 <listitem>
1160 <para>
1161 There are two different possibilities for the final two characters:
1162 </para>
1163 <orderedlist numeration="arabic">
1164 <listitem>
1165 <para>
1166 <indexterm role="option">
1167 <primary><option>localhost_number</option></primary>
1168 </indexterm>
1169 If <option>localhost_number</option> is not set, this value is the fractional part of the
1170 time of reception, normally in units of 1/2000 of a second, but for systems
1171 that must use base 36 instead of base 62 (because of case-insensitive file
1172 systems), the units are 1/1000 of a second.
1173 </para>
1174 </listitem>
1175 <listitem>
1176 <para>
1177 If <option>localhost_number</option> is set, it is multiplied by 200 (100) and added to
1178 the fractional part of the time, which in this case is in units of 1/200
1179 (1/100) of a second.
1180 </para>
1181 </listitem>
1182 </orderedlist>
1183 </listitem>
1184 </itemizedlist>
1185 <para>
1186 After a message has been received, Exim waits for the clock to tick at the
1187 appropriate resolution before proceeding, so that if another message is
1188 received by the same process, or by another process with the same (re-used)
1189 pid, it is guaranteed that the time will be different. In most cases, the clock
1190 will already have ticked while the message was being received.
1191 </para>
1192 </section>
1193 <section id="SECID13">
1194 <title>Receiving mail</title>
1195 <para>
1196 <indexterm role="concept">
1197 <primary>receiving mail</primary>
1198 </indexterm>
1199 <indexterm role="concept">
1200 <primary>message</primary>
1201 <secondary>reception</secondary>
1202 </indexterm>
1203 The only way Exim can receive mail from another host is using SMTP over
1204 TCP/IP, in which case the sender and recipient addresses are transferred using
1205 SMTP commands. However, from a locally running process (such as a user&#x2019;s MUA),
1206 there are several possibilities:
1207 </para>
1208 <itemizedlist>
1209 <listitem>
1210 <para>
1211 If the process runs Exim with the <option>-bm</option> option, the message is read
1212 non-interactively (usually via a pipe), with the recipients taken from the
1213 command line, or from the body of the message if <option>-t</option> is also used.
1214 </para>
1215 </listitem>
1216 <listitem>
1217 <para>
1218 If the process runs Exim with the <option>-bS</option> option, the message is also read
1219 non-interactively, but in this case the recipients are listed at the start of
1220 the message in a series of SMTP RCPT commands, terminated by a DATA
1221 command. This is so-called <quote>batch SMTP</quote> format,
1222 but it isn&#x2019;t really SMTP. The SMTP commands are just another way of passing
1223 envelope addresses in a non-interactive submission.
1224 </para>
1225 </listitem>
1226 <listitem>
1227 <para>
1228 If the process runs Exim with the <option>-bs</option> option, the message is read
1229 interactively, using the SMTP protocol. A two-way pipe is normally used for
1230 passing data between the local process and the Exim process.
1231 This is <quote>real</quote> SMTP and is handled in the same way as SMTP over TCP/IP. For
1232 example, the ACLs for SMTP commands are used for this form of submission.
1233 </para>
1234 </listitem>
1235 <listitem>
1236 <para>
1237 A local process may also make a TCP/IP call to the host&#x2019;s loopback address
1238 (127.0.0.1) or any other of its IP addresses. When receiving messages, Exim
1239 does not treat the loopback address specially. It treats all such connections
1240 in the same way as connections from other hosts.
1241 </para>
1242 </listitem>
1243 </itemizedlist>
1244 <para>
1245 <indexterm role="concept">
1246 <primary>message sender, constructed by Exim</primary>
1247 </indexterm>
1248 <indexterm role="concept">
1249 <primary>sender</primary>
1250 <secondary>constructed by Exim</secondary>
1251 </indexterm>
1252 In the three cases that do not involve TCP/IP, the sender address is
1253 constructed from the login name of the user that called Exim and a default
1254 qualification domain (which can be set by the <option>qualify_domain</option> configuration
1255 option). For local or batch SMTP, a sender address that is passed using the
1256 SMTP MAIL command is ignored. However, the system administrator may allow
1257 certain users (<quote>trusted users</quote>) to specify a different sender address
1258 unconditionally, or all users to specify certain forms of different sender
1259 address. The <option>-f</option> option or the SMTP MAIL command is used to specify these
1260 different addresses. See section <xref linkend="SECTtrustedadmin"/> for details of trusted
1261 users, and the <option>untrusted_set_sender</option> option for a way of allowing untrusted
1262 users to change sender addresses.
1263 </para>
1264 <para>
1265 Messages received by either of the non-interactive mechanisms are subject to
1266 checking by the non-SMTP ACL, if one is defined. Messages received using SMTP
1267 (either over TCP/IP, or interacting with a local process) can be checked by a
1268 number of ACLs that operate at different times during the SMTP session. Either
1269 individual recipients, or the entire message, can be rejected if local policy
1270 requirements are not met. The <function>local_scan()</function> function (see chapter
1271 <xref linkend="CHAPlocalscan"/>) is run for all incoming messages.
1272 </para>
1273 <para>
1274 Exim can be configured not to start a delivery process when a message is
1275 received; this can be unconditional, or depend on the number of incoming SMTP
1276 connections or the system load. In these situations, new messages wait on the
1277 queue until a queue runner process picks them up. However, in standard
1278 configurations under normal conditions, delivery is started as soon as a
1279 message is received.
1280 </para>
1281 </section>
1282 <section id="SECID14">
1283 <title>Handling an incoming message</title>
1284 <para>
1285 <indexterm role="concept">
1286 <primary>spool directory</primary>
1287 <secondary>files that hold a message</secondary>
1288 </indexterm>
1289 <indexterm role="concept">
1290 <primary>file</primary>
1291 <secondary>how a message is held</secondary>
1292 </indexterm>
1293 When Exim accepts a message, it writes two files in its spool directory. The
1294 first contains the envelope information, the current status of the message, and
1295 the header lines, and the second contains the body of the message. The names of
1296 the two spool files consist of the message id, followed by <literal>-H</literal> for the
1297 file containing the envelope and header, and <literal>-D</literal> for the data file.
1298 </para>
1299 <para>
1300 <indexterm role="concept">
1301 <primary>spool directory</primary>
1302 <secondary><filename>input</filename> sub-directory</secondary>
1303 </indexterm>
1304 By default all these message files are held in a single directory called
1305 <filename>input</filename> inside the general Exim spool directory. Some operating systems do
1306 not perform very well if the number of files in a directory gets large; to
1307 improve performance in such cases, the <option>split_spool_directory</option> option can be
1308 used. This causes Exim to split up the input files into 62 sub-directories
1309 whose names are single letters or digits. When this is done, the queue is
1310 processed one sub-directory at a time instead of all at once, which can improve
1311 overall performance even when there are not enough files in each directory to
1312 affect file system performance.
1313 </para>
1314 <para>
1315 The envelope information consists of the address of the message&#x2019;s sender and
1316 the addresses of the recipients. This information is entirely separate from
1317 any addresses contained in the header lines. The status of the message includes
1318 a list of recipients who have already received the message. The format of the
1319 first spool file is described in chapter <xref linkend="CHAPspool"/>.
1320 </para>
1321 <para>
1322 <indexterm role="concept">
1323 <primary>rewriting</primary>
1324 <secondary>addresses</secondary>
1325 </indexterm>
1326 Address rewriting that is specified in the rewrite section of the configuration
1327 (see chapter <xref linkend="CHAPrewrite"/>) is done once and for all on incoming addresses,
1328 both in the header lines and the envelope, at the time the message is accepted.
1329 If during the course of delivery additional addresses are generated (for
1330 example, via aliasing), these new addresses are rewritten as soon as they are
1331 generated. At the time a message is actually delivered (transported) further
1332 rewriting can take place; because this is a transport option, it can be
1333 different for different forms of delivery. It is also possible to specify the
1334 addition or removal of certain header lines at the time the message is
1335 delivered (see chapters <xref linkend="CHAProutergeneric"/> and
1336 <xref linkend="CHAPtransportgeneric"/>).
1337 </para>
1338 </section>
1339 <section id="SECID15">
1340 <title>Life of a message</title>
1341 <para>
1342 <indexterm role="concept">
1343 <primary>message</primary>
1344 <secondary>life of</secondary>
1345 </indexterm>
1346 <indexterm role="concept">
1347 <primary>message</primary>
1348 <secondary>frozen</secondary>
1349 </indexterm>
1350 A message remains in the spool directory until it is completely delivered to
1351 its recipients or to an error address, or until it is deleted by an
1352 administrator or by the user who originally created it. In cases when delivery
1353 cannot proceed &ndash; for example, when a message can neither be delivered to its
1354 recipients nor returned to its sender, the message is marked <quote>frozen</quote> on the
1355 spool, and no more deliveries are attempted.
1356 </para>
1357 <para>
1358 <indexterm role="concept">
1359 <primary>frozen messages</primary>
1360 <secondary>thawing</secondary>
1361 </indexterm>
1362 <indexterm role="concept">
1363 <primary>message</primary>
1364 <secondary>thawing frozen</secondary>
1365 </indexterm>
1366 An administrator can <quote>thaw</quote> such messages when the problem has been
1367 corrected, and can also freeze individual messages by hand if necessary. In
1368 addition, an administrator can force a delivery error, causing a bounce message
1369 to be sent.
1370 </para>
1371 <para>
1372 <indexterm role="option">
1373 <primary><option>timeout_frozen_after</option></primary>
1374 </indexterm>
1375 <indexterm role="option">
1376 <primary><option>ignore_bounce_errors_after</option></primary>
1377 </indexterm>
1378 There are options called <option>ignore_bounce_errors_after</option> and
1379 <option>timeout_frozen_after</option>, which discard frozen messages after a certain time.
1380 The first applies only to frozen bounces, the second to any frozen messages.
1381 </para>
1382 <para>
1383 <indexterm role="concept">
1384 <primary>message</primary>
1385 <secondary>log file for</secondary>
1386 </indexterm>
1387 <indexterm role="concept">
1388 <primary>log</primary>
1389 <secondary>file for each message</secondary>
1390 </indexterm>
1391 While Exim is working on a message, it writes information about each delivery
1392 attempt to its main log file. This includes successful, unsuccessful, and
1393 delayed deliveries for each recipient (see chapter <xref linkend="CHAPlog"/>). The log
1394 lines are also written to a separate <emphasis>message log</emphasis> file for each message.
1395 These logs are solely for the benefit of the administrator, and are normally
1396 deleted along with the spool files when processing of a message is complete.
1397 The use of individual message logs can be disabled by setting
1398 <option>no_message_logs</option>; this might give an improvement in performance on very busy
1399 systems.
1400 </para>
1401 <para>
1402 <indexterm role="concept">
1403 <primary>journal file</primary>
1404 </indexterm>
1405 <indexterm role="concept">
1406 <primary>file</primary>
1407 <secondary>journal</secondary>
1408 </indexterm>
1409 All the information Exim itself needs to set up a delivery is kept in the first
1410 spool file, along with the header lines. When a successful delivery occurs, the
1411 address is immediately written at the end of a journal file, whose name is the
1412 message id followed by <literal>-J</literal>. At the end of a delivery run, if there are some
1413 addresses left to be tried again later, the first spool file (the <literal>-H</literal> file)
1414 is updated to indicate which these are, and the journal file is then deleted.
1415 Updating the spool file is done by writing a new file and renaming it, to
1416 minimize the possibility of data loss.
1417 </para>
1418 <para>
1419 Should the system or the program crash after a successful delivery but before
1420 the spool file has been updated, the journal is left lying around. The next
1421 time Exim attempts to deliver the message, it reads the journal file and
1422 updates the spool file before proceeding. This minimizes the chances of double
1423 deliveries caused by crashes.
1424 </para>
1425 </section>
1426 <section id="SECTprocaddress">
1427 <title>Processing an address for delivery</title>
1428 <para>
1429 <indexterm role="concept">
1430 <primary>drivers</primary>
1431 <secondary>definition of</secondary>
1432 </indexterm>
1433 <indexterm role="concept">
1434 <primary>router</primary>
1435 <secondary>definition of</secondary>
1436 </indexterm>
1437 <indexterm role="concept">
1438 <primary>transport</primary>
1439 <secondary>definition of</secondary>
1440 </indexterm>
1441 The main delivery processing elements of Exim are called <emphasis>routers</emphasis> and
1442 <emphasis>transports</emphasis>, and collectively these are known as <emphasis>drivers</emphasis>. Code for a
1443 number of them is provided in the source distribution, and compile-time options
1444 specify which ones are included in the binary. Run time options specify which
1445 ones are actually used for delivering messages.
1446 </para>
1447 <para>
1448 <indexterm role="concept">
1449 <primary>drivers</primary>
1450 <secondary>instance definition</secondary>
1451 </indexterm>
1452 Each driver that is specified in the run time configuration is an <emphasis>instance</emphasis>
1453 of that particular driver type. Multiple instances are allowed; for example,
1454 you can set up several different <command>smtp</command> transports, each with different
1455 option values that might specify different ports or different timeouts. Each
1456 instance has its own identifying name. In what follows we will normally use the
1457 instance name when discussing one particular instance (that is, one specific
1458 configuration of the driver), and the generic driver name when discussing
1459 the driver&#x2019;s features in general.
1460 </para>
1461 <para>
1462 A <emphasis>router</emphasis> is a driver that operates on an address, either determining how
1463 its delivery should happen, by assigning it to a specific transport, or
1464 converting the address into one or more new addresses (for example, via an
1465 alias file). A router may also explicitly choose to fail an address, causing it
1466 to be bounced.
1467 </para>
1468 <para>
1469 A <emphasis>transport</emphasis> is a driver that transmits a copy of the message from Exim&#x2019;s
1470 spool to some destination. There are two kinds of transport: for a <emphasis>local</emphasis>
1471 transport, the destination is a file or a pipe on the local host, whereas for a
1472 <emphasis>remote</emphasis> transport the destination is some other host. A message is passed
1473 to a specific transport as a result of successful routing. If a message has
1474 several recipients, it may be passed to a number of different transports.
1475 </para>
1476 <para>
1477 <indexterm role="concept">
1478 <primary>preconditions</primary>
1479 <secondary>definition of</secondary>
1480 </indexterm>
1481 An address is processed by passing it to each configured router instance in
1482 turn, subject to certain preconditions, until a router accepts the address or
1483 specifies that it should be bounced. We will describe this process in more
1484 detail shortly. First, as a simple example, we consider how each recipient
1485 address in a message is processed in a small configuration of three routers.
1486 </para>
1487 <para>
1488 To make this a more concrete example, it is described in terms of some actual
1489 routers, but remember, this is only an example. You can configure Exim&#x2019;s
1490 routers in many different ways, and there may be any number of routers in a
1491 configuration.
1492 </para>
1493 <para>
1494 The first router that is specified in a configuration is often one that handles
1495 addresses in domains that are not recognized specially by the local host. These
1496 are typically addresses for arbitrary domains on the Internet. A precondition
1497 is set up which looks for the special domains known to the host (for example,
1498 its own domain name), and the router is run for addresses that do <emphasis>not</emphasis>
1499 match. Typically, this is a router that looks up domains in the DNS in order to
1500 find the hosts to which this address routes. If it succeeds, the address is
1501 assigned to a suitable SMTP transport; if it does not succeed, the router is
1502 configured to fail the address.
1503 </para>
1504 <para>
1505 The second router is reached only when the domain is recognized as one that
1506 <quote>belongs</quote> to the local host. This router does redirection &ndash; also known as
1507 aliasing and forwarding. When it generates one or more new addresses from the
1508 original, each of them is routed independently from the start. Otherwise, the
1509 router may cause an address to fail, or it may simply decline to handle the
1510 address, in which case the address is passed to the next router.
1511 </para>
1512 <para>
1513 The final router in many configurations is one that checks to see if the
1514 address belongs to a local mailbox. The precondition may involve a check to
1515 see if the local part is the name of a login account, or it may look up the
1516 local part in a file or a database. If its preconditions are not met, or if
1517 the router declines, we have reached the end of the routers. When this happens,
1518 the address is bounced.
1519 </para>
1520 </section>
1521 <section id="SECID16">
1522 <title>Processing an address for verification</title>
1523 <para>
1524 <indexterm role="concept">
1525 <primary>router</primary>
1526 <secondary>for verification</secondary>
1527 </indexterm>
1528 <indexterm role="concept">
1529 <primary>verifying address</primary>
1530 <secondary>overview</secondary>
1531 </indexterm>
1532 As well as being used to decide how to deliver to an address, Exim&#x2019;s routers
1533 are also used for <emphasis>address verification</emphasis>. Verification can be requested as
1534 one of the checks to be performed in an ACL for incoming messages, on both
1535 sender and recipient addresses, and it can be tested using the <option>-bv</option> and
1536 <option>-bvs</option> command line options.
1537 </para>
1538 <para>
1539 When an address is being verified, the routers are run in <quote>verify mode</quote>. This
1540 does not affect the way the routers work, but it is a state that can be
1541 detected. By this means, a router can be skipped or made to behave differently
1542 when verifying. A common example is a configuration in which the first router
1543 sends all messages to a message-scanning program, unless they have been
1544 previously scanned. Thus, the first router accepts all addresses without any
1545 checking, making it useless for verifying. Normally, the <option>no_verify</option> option
1546 would be set for such a router, causing it to be skipped in verify mode.
1547 </para>
1548 </section>
1549 <section id="SECTrunindrou">
1550 <title>Running an individual router</title>
1551 <para>
1552 <indexterm role="concept">
1553 <primary>router</primary>
1554 <secondary>running details</secondary>
1555 </indexterm>
1556 <indexterm role="concept">
1557 <primary>preconditions</primary>
1558 <secondary>checking</secondary>
1559 </indexterm>
1560 <indexterm role="concept">
1561 <primary>router</primary>
1562 <secondary>result of running</secondary>
1563 </indexterm>
1564 As explained in the example above, a number of preconditions are checked before
1565 running a router. If any are not met, the router is skipped, and the address is
1566 passed to the next router. When all the preconditions on a router <emphasis>are</emphasis> met,
1567 the router is run. What happens next depends on the outcome, which is one of
1568 the following:
1569 </para>
1570 <itemizedlist>
1571 <listitem>
1572 <para>
1573 <emphasis>accept</emphasis>: The router accepts the address, and either assigns it to a
1574 transport, or generates one or more <quote>child</quote> addresses. Processing the
1575 original address ceases,
1576 <indexterm role="option">
1577 <primary><option>unseen</option></primary>
1578 </indexterm>
1579 unless the <option>unseen</option> option is set on the router. This option
1580 can be used to set up multiple deliveries with different routing (for example,
1581 for keeping archive copies of messages). When <option>unseen</option> is set, the address is
1582 passed to the next router. Normally, however, an <emphasis>accept</emphasis> return marks the
1583 end of routing.
1584 </para>
1585 <para>
1586 Any child addresses generated by the router are processed independently,
1587 starting with the first router by default. It is possible to change this by
1588 setting the <option>redirect_router</option> option to specify which router to start at for
1589 child addresses. Unlike <option>pass_router</option> (see below) the router specified by
1590 <option>redirect_router</option> may be anywhere in the router configuration.
1591 </para>
1592 </listitem>
1593 <listitem>
1594 <para>
1595 <emphasis>pass</emphasis>: The router recognizes the address, but cannot handle it itself. It
1596 requests that the address be passed to another router. By default the address
1597 is passed to the next router, but this can be changed by setting the
1598 <option>pass_router</option> option. However, (unlike <option>redirect_router</option>) the named router
1599 must be below the current router (to avoid loops).
1600 </para>
1601 </listitem>
1602 <listitem>
1603 <para>
1604 <emphasis>decline</emphasis>: The router declines to accept the address because it does not
1605 recognize it at all. By default, the address is passed to the next router, but
1606 this can be prevented by setting the <option>no_more</option> option. When <option>no_more</option> is
1607 set, all the remaining routers are skipped. In effect, <option>no_more</option> converts
1608 <emphasis>decline</emphasis> into <emphasis>fail</emphasis>.
1609 </para>
1610 </listitem>
1611 <listitem>
1612 <para>
1613 <emphasis>fail</emphasis>: The router determines that the address should fail, and queues it for
1614 the generation of a bounce message. There is no further processing of the
1615 original address unless <option>unseen</option> is set on the router.
1616 </para>
1617 </listitem>
1618 <listitem>
1619 <para>
1620 <emphasis>defer</emphasis>: The router cannot handle the address at the present time. (A
1621 database may be offline, or a DNS lookup may have timed out.) No further
1622 processing of the address happens in this delivery attempt. It is tried again
1623 next time the message is considered for delivery.
1624 </para>
1625 </listitem>
1626 <listitem>
1627 <para>
1628 <emphasis>error</emphasis>: There is some error in the router (for example, a syntax error in
1629 its configuration). The action is as for defer.
1630 </para>
1631 </listitem>
1632 </itemizedlist>
1633 <para>
1634 If an address reaches the end of the routers without having been accepted by
1635 any of them, it is bounced as unrouteable. The default error message in this
1636 situation is <quote>unrouteable address</quote>, but you can set your own message by
1637 making use of the <option>cannot_route_message</option> option. This can be set for any
1638 router; the value from the last router that <quote>saw</quote> the address is used.
1639 </para>
1640 <para>
1641 Sometimes while routing you want to fail a delivery when some conditions are
1642 met but others are not, instead of passing the address on for further routing.
1643 You can do this by having a second router that explicitly fails the delivery
1644 when the relevant conditions are met. The <command>redirect</command> router has a <quote>fail</quote>
1645 facility for this purpose.
1646 </para>
1647 </section>
1648 <section id="SECID17">
1649 <title>Duplicate addresses</title>
1650 <para>
1651 <indexterm role="concept">
1652 <primary>case of local parts</primary>
1653 </indexterm>
1654 <indexterm role="concept">
1655 <primary>address duplicate, discarding</primary>
1656 </indexterm>
1657 <indexterm role="concept">
1658 <primary>duplicate addresses</primary>
1659 </indexterm>
1660 Once routing is complete, Exim scans the addresses that are assigned to local
1661 and remote transports, and discards any duplicates that it finds. During this
1662 check, local parts are treated as case-sensitive. This happens only when
1663 actually delivering a message; when testing routers with <option>-bt</option>, all the
1664 routed addresses are shown.
1665 </para>
1666 </section>
1667 <section id="SECTrouprecon">
1668 <title>Router preconditions</title>
1669 <para>
1670 <indexterm role="concept">
1671 <primary>router</primary>
1672 <secondary>preconditions, order of processing</secondary>
1673 </indexterm>
1674 <indexterm role="concept">
1675 <primary>preconditions</primary>
1676 <secondary>order of processing</secondary>
1677 </indexterm>
1678 The preconditions that are tested for each router are listed below, in the
1679 order in which they are tested. The individual configuration options are
1680 described in more detail in chapter <xref linkend="CHAProutergeneric"/>.
1681 </para>
1682 <itemizedlist>
1683 <listitem>
1684 <para>
1685 The <option>local_part_prefix</option> and <option>local_part_suffix</option> options can specify that
1686 the local parts handled by the router may or must have certain prefixes and/or
1687 suffixes. If a mandatory affix (prefix or suffix) is not present, the router is
1688 skipped. These conditions are tested first. When an affix is present, it is
1689 removed from the local part before further processing, including the evaluation
1690 of any other conditions.
1691 </para>
1692 </listitem>
1693 <listitem>
1694 <para>
1695 Routers can be designated for use only when not verifying an address, that is,
1696 only when routing it for delivery (or testing its delivery routing). If the
1697 <option>verify</option> option is set false, the router is skipped when Exim is verifying an
1698 address.
1699 Setting the <option>verify</option> option actually sets two options, <option>verify_sender</option> and
1700 <option>verify_recipient</option>, which independently control the use of the router for
1701 sender and recipient verification. You can set these options directly if
1702 you want a router to be used for only one type of verification.
1703 </para>
1704 </listitem>
1705 <listitem>
1706 <para>
1707 If the <option>address_test</option> option is set false, the router is skipped when Exim is
1708 run with the <option>-bt</option> option to test an address routing. This can be helpful
1709 when the first router sends all new messages to a scanner of some sort; it
1710 makes it possible to use <option>-bt</option> to test subsequent delivery routing without
1711 having to simulate the effect of the scanner.
1712 </para>
1713 </listitem>
1714 <listitem>
1715 <para>
1716 Routers can be designated for use only when verifying an address, as
1717 opposed to routing it for delivery. The <option>verify_only</option> option controls this.
1718 </para>
1719 </listitem>
1720 <listitem>
1721 <para>
1722 Individual routers can be explicitly skipped when running the routers to
1723 check an address given in the SMTP EXPN command (see the <option>expn</option> option).
1724 </para>
1725 </listitem>
1726 <listitem>
1727 <para>
1728 If the <option>domains</option> option is set, the domain of the address must be in the set
1729 of domains that it defines.
1730 </para>
1731 </listitem>
1732 <listitem>
1733 <para>
1734 <indexterm role="variable">
1735 <primary><varname>$local_part_prefix</varname></primary>
1736 </indexterm>
1737 <indexterm role="variable">
1738 <primary><varname>$local_part</varname></primary>
1739 </indexterm>
1740 <indexterm role="variable">
1741 <primary><varname>$local_part_suffix</varname></primary>
1742 </indexterm>
1743 If the <option>local_parts</option> option is set, the local part of the address must be in
1744 the set of local parts that it defines. If <option>local_part_prefix</option> or
1745 <option>local_part_suffix</option> is in use, the prefix or suffix is removed from the local
1746 part before this check. If you want to do precondition tests on local parts
1747 that include affixes, you can do so by using a <option>condition</option> option (see below)
1748 that uses the variables <varname>$local_part</varname>, <varname>$local_part_prefix</varname>, and
1749 <varname>$local_part_suffix</varname> as necessary.
1750 </para>
1751 </listitem>
1752 <listitem>
1753 <para>
1754 <indexterm role="variable">
1755 <primary><varname>$local_user_uid</varname></primary>
1756 </indexterm>
1757 <indexterm role="variable">
1758 <primary><varname>$local_user_gid</varname></primary>
1759 </indexterm>
1760 <indexterm role="variable">
1761 <primary><varname>$home</varname></primary>
1762 </indexterm>
1763 If the <option>check_local_user</option> option is set, the local part must be the name of
1764 an account on the local host. If this check succeeds, the uid and gid of the
1765 local user are placed in <varname>$local_user_uid</varname> and <varname>$local_user_gid</varname> and the
1766 user&#x2019;s home directory is placed in <varname>$home</varname>; these values can be used in the
1767 remaining preconditions.
1768 </para>
1769 </listitem>
1770 <listitem>
1771 <para>
1772 If the <option>router_home_directory</option> option is set, it is expanded at this point,
1773 because it overrides the value of <varname>$home</varname>. If this expansion were left till
1774 later, the value of <varname>$home</varname> as set by <option>check_local_user</option> would be used in
1775 subsequent tests. Having two different values of <varname>$home</varname> in the same router
1776 could lead to confusion.
1777 </para>
1778 </listitem>
1779 <listitem>
1780 <para>
1781 If the <option>senders</option> option is set, the envelope sender address must be in the
1782 set of addresses that it defines.
1783 </para>
1784 </listitem>
1785 <listitem>
1786 <para>
1787 If the <option>require_files</option> option is set, the existence or non-existence of
1788 specified files is tested.
1789 </para>
1790 </listitem>
1791 <listitem>
1792 <para>
1793 <indexterm role="concept">
1794 <primary>customizing</primary>
1795 <secondary>precondition</secondary>
1796 </indexterm>
1797 If the <option>condition</option> option is set, it is evaluated and tested. This option
1798 uses an expanded string to allow you to set up your own custom preconditions.
1799 Expanded strings are described in chapter <xref linkend="CHAPexpand"/>.
1800 </para>
1801 </listitem>
1802 </itemizedlist>
1803 <para>
1804 Note that <option>require_files</option> comes near the end of the list, so you cannot use
1805 it to check for the existence of a file in which to lookup up a domain, local
1806 part, or sender. However, as these options are all expanded, you can use the
1807 <option>exists</option> expansion condition to make such tests within each condition. The
1808 <option>require_files</option> option is intended for checking files that the router may be
1809 going to use internally, or which are needed by a specific transport (for
1810 example, <filename>.procmailrc</filename>).
1811 </para>
1812 </section>
1813 <section id="SECID18">
1814 <title>Delivery in detail</title>
1815 <para>
1816 <indexterm role="concept">
1817 <primary>delivery</primary>
1818 <secondary>in detail</secondary>
1819 </indexterm>
1820 When a message is to be delivered, the sequence of events is as follows:
1821 </para>
1822 <itemizedlist>
1823 <listitem>
1824 <para>
1825 If a system-wide filter file is specified, the message is passed to it. The
1826 filter may add recipients to the message, replace the recipients, discard the
1827 message, cause a new message to be generated, or cause the message delivery to
1828 fail. The format of the system filter file is the same as for Exim user filter
1829 files, described in the separate document entitled <emphasis>Exim&#x2019;s interfaces to mail
1830 filtering</emphasis>.
1831 <indexterm role="concept">
1832 <primary>Sieve filter</primary>
1833 <secondary>not available for system filter</secondary>
1834 </indexterm>
1835 (<emphasis role="bold">Note</emphasis>: Sieve cannot be used for system filter files.)
1836 </para>
1837 <para>
1838 Some additional features are available in system filters &ndash; see chapter
1839 <xref linkend="CHAPsystemfilter"/> for details. Note that a message is passed to the system
1840 filter only once per delivery attempt, however many recipients it has. However,
1841 if there are several delivery attempts because one or more addresses could not
1842 be immediately delivered, the system filter is run each time. The filter
1843 condition <option>first_delivery</option> can be used to detect the first run of the system
1844 filter.
1845 </para>
1846 </listitem>
1847 <listitem>
1848 <para>
1849 Each recipient address is offered to each configured router in turn, subject to
1850 its preconditions, until one is able to handle it. If no router can handle the
1851 address, that is, if they all decline, the address is failed. Because routers
1852 can be targeted at particular domains, several locally handled domains can be
1853 processed entirely independently of each other.
1854 </para>
1855 </listitem>
1856 <listitem>
1857 <para>
1858 <indexterm role="concept">
1859 <primary>routing</primary>
1860 <secondary>loops in</secondary>
1861 </indexterm>
1862 <indexterm role="concept">
1863 <primary>loop</primary>
1864 <secondary>while routing</secondary>
1865 </indexterm>
1866 A router that accepts an address may assign it to a local or a remote
1867 transport. However, the transport is not run at this time. Instead, the address
1868 is placed on a list for the particular transport, which will be run later.
1869 Alternatively, the router may generate one or more new addresses (typically
1870 from alias, forward, or filter files). New addresses are fed back into this
1871 process from the top, but in order to avoid loops, a router ignores any address
1872 which has an identically-named ancestor that was processed by itself.
1873 </para>
1874 </listitem>
1875 <listitem>
1876 <para>
1877 When all the routing has been done, addresses that have been successfully
1878 handled are passed to their assigned transports. When local transports are
1879 doing real local deliveries, they handle only one address at a time, but if a
1880 local transport is being used as a pseudo-remote transport (for example, to
1881 collect batched SMTP messages for transmission by some other means) multiple
1882 addresses can be handled. Remote transports can always handle more than one
1883 address at a time, but can be configured not to do so, or to restrict multiple
1884 addresses to the same domain.
1885 </para>
1886 </listitem>
1887 <listitem>
1888 <para>
1889 Each local delivery to a file or a pipe runs in a separate process under a
1890 non-privileged uid, and these deliveries are run one at a time. Remote
1891 deliveries also run in separate processes, normally under a uid that is private
1892 to Exim (<quote>the Exim user</quote>), but in this case, several remote deliveries can be
1893 run in parallel. The maximum number of simultaneous remote deliveries for any
1894 one message is set by the <option>remote_max_parallel</option> option.
1895 The order in which deliveries are done is not defined, except that all local
1896 deliveries happen before any remote deliveries.
1897 </para>
1898 </listitem>
1899 <listitem>
1900 <para>
1901 <indexterm role="concept">
1902 <primary>queue runner</primary>
1903 </indexterm>
1904 When it encounters a local delivery during a queue run, Exim checks its retry
1905 database to see if there has been a previous temporary delivery failure for the
1906 address before running the local transport. If there was a previous failure,
1907 Exim does not attempt a new delivery until the retry time for the address is
1908 reached. However, this happens only for delivery attempts that are part of a
1909 queue run. Local deliveries are always attempted when delivery immediately
1910 follows message reception, even if retry times are set for them. This makes for
1911 better behaviour if one particular message is causing problems (for example,
1912 causing quota overflow, or provoking an error in a filter file).
1913 </para>
1914 </listitem>
1915 <listitem>
1916 <para>
1917 <indexterm role="concept">
1918 <primary>delivery</primary>
1919 <secondary>retry in remote transports</secondary>
1920 </indexterm>
1921 Remote transports do their own retry handling, since an address may be
1922 deliverable to one of a number of hosts, each of which may have a different
1923 retry time. If there have been previous temporary failures and no host has
1924 reached its retry time, no delivery is attempted, whether in a queue run or
1925 not. See chapter <xref linkend="CHAPretry"/> for details of retry strategies.
1926 </para>
1927 </listitem>
1928 <listitem>
1929 <para>
1930 If there were any permanent errors, a bounce message is returned to an
1931 appropriate address (the sender in the common case), with details of the error
1932 for each failing address. Exim can be configured to send copies of bounce
1933 messages to other addresses.
1934 </para>
1935 </listitem>
1936 <listitem>
1937 <para>
1938 <indexterm role="concept">
1939 <primary>delivery</primary>
1940 <secondary>deferral</secondary>
1941 </indexterm>
1942 If one or more addresses suffered a temporary failure, the message is left on
1943 the queue, to be tried again later. Delivery of these addresses is said to be
1944 <emphasis>deferred</emphasis>.
1945 </para>
1946 </listitem>
1947 <listitem>
1948 <para>
1949 When all the recipient addresses have either been delivered or bounced,
1950 handling of the message is complete. The spool files and message log are
1951 deleted, though the message log can optionally be preserved if required.
1952 </para>
1953 </listitem>
1954 </itemizedlist>
1955 </section>
1956 <section id="SECID19">
1957 <title>Retry mechanism</title>
1958 <para>
1959 <indexterm role="concept">
1960 <primary>delivery</primary>
1961 <secondary>retry mechanism</secondary>
1962 </indexterm>
1963 <indexterm role="concept">
1964 <primary>retry</primary>
1965 <secondary>description of mechanism</secondary>
1966 </indexterm>
1967 <indexterm role="concept">
1968 <primary>queue runner</primary>
1969 </indexterm>
1970 Exim&#x2019;s mechanism for retrying messages that fail to get delivered at the first
1971 attempt is the queue runner process. You must either run an Exim daemon that
1972 uses the <option>-q</option> option with a time interval to start queue runners at regular
1973 intervals, or use some other means (such as <emphasis>cron</emphasis>) to start them. If you do
1974 not arrange for queue runners to be run, messages that fail temporarily at the
1975 first attempt will remain on your queue for ever. A queue runner process works
1976 its way through the queue, one message at a time, trying each delivery that has
1977 passed its retry time.
1978 You can run several queue runners at once.
1979 </para>
1980 <para>
1981 Exim uses a set of configured rules to determine when next to retry the failing
1982 address (see chapter <xref linkend="CHAPretry"/>). These rules also specify when Exim
1983 should give up trying to deliver to the address, at which point it generates a
1984 bounce message. If no retry rules are set for a particular host, address, and
1985 error combination, no retries are attempted, and temporary errors are treated
1986 as permanent.
1987 </para>
1988 </section>
1989 <section id="SECID20">
1990 <title>Temporary delivery failure</title>
1991 <para>
1992 <indexterm role="concept">
1993 <primary>delivery</primary>
1994 <secondary>temporary failure</secondary>
1995 </indexterm>
1996 There are many reasons why a message may not be immediately deliverable to a
1997 particular address. Failure to connect to a remote machine (because it, or the
1998 connection to it, is down) is one of the most common. Temporary failures may be
1999 detected during routing as well as during the transport stage of delivery.
2000 Local deliveries may be delayed if NFS files are unavailable, or if a mailbox
2001 is on a file system where the user is over quota. Exim can be configured to
2002 impose its own quotas on local mailboxes; where system quotas are set they will
2003 also apply.
2004 </para>
2005 <para>
2006 If a host is unreachable for a period of time, a number of messages may be
2007 waiting for it by the time it recovers, and sending them in a single SMTP
2008 connection is clearly beneficial. Whenever a delivery to a remote host is
2009 deferred,
2010 </para>
2011 <para>
2012 <indexterm role="concept">
2013 <primary>hints database</primary>
2014 </indexterm>
2015 Exim makes a note in its hints database, and whenever a successful
2016 SMTP delivery has happened, it looks to see if any other messages are waiting
2017 for the same host. If any are found, they are sent over the same SMTP
2018 connection, subject to a configuration limit as to the maximum number in any
2019 one connection.
2020 </para>
2021 </section>
2022 <section id="SECID21">
2023 <title>Permanent delivery failure</title>
2024 <para>
2025 <indexterm role="concept">
2026 <primary>delivery</primary>
2027 <secondary>permanent failure</secondary>
2028 </indexterm>
2029 <indexterm role="concept">
2030 <primary>bounce message</primary>
2031 <secondary>when generated</secondary>
2032 </indexterm>
2033 When a message cannot be delivered to some or all of its intended recipients, a
2034 bounce message is generated. Temporary delivery failures turn into permanent
2035 errors when their timeout expires. All the addresses that fail in a given
2036 delivery attempt are listed in a single message. If the original message has
2037 many recipients, it is possible for some addresses to fail in one delivery
2038 attempt and others to fail subsequently, giving rise to more than one bounce
2039 message. The wording of bounce messages can be customized by the administrator.
2040 See chapter <xref linkend="CHAPemsgcust"/> for details.
2041 </para>
2042 <para>
2043 <indexterm role="concept">
2044 <primary><emphasis>X-Failed-Recipients:</emphasis> header line</primary>
2045 </indexterm>
2046 Bounce messages contain an <emphasis>X-Failed-Recipients:</emphasis> header line that lists the
2047 failed addresses, for the benefit of programs that try to analyse such messages
2048 automatically.
2049 </para>
2050 <para>
2051 <indexterm role="concept">
2052 <primary>bounce message</primary>
2053 <secondary>recipient of</secondary>
2054 </indexterm>
2055 A bounce message is normally sent to the sender of the original message, as
2056 obtained from the message&#x2019;s envelope. For incoming SMTP messages, this is the
2057 address given in the MAIL command. However, when an address is expanded via a
2058 forward or alias file, an alternative address can be specified for delivery
2059 failures of the generated addresses. For a mailing list expansion (see section
2060 <xref linkend="SECTmailinglists"/>) it is common to direct bounce messages to the manager
2061 of the list.
2062 </para>
2063 </section>
2064 <section id="SECID22">
2065 <title>Failures to deliver bounce messages</title>
2066 <para>
2067 <indexterm role="concept">
2068 <primary>bounce message</primary>
2069 <secondary>failure to deliver</secondary>
2070 </indexterm>
2071 If a bounce message (either locally generated or received from a remote host)
2072 itself suffers a permanent delivery failure, the message is left on the queue,
2073 but it is frozen, awaiting the attention of an administrator. There are options
2074 that can be used to make Exim discard such failed messages, or to keep them
2075 for only a short time (see <option>timeout_frozen_after</option> and
2076 <option>ignore_bounce_errors_after</option>).
2077 </para>
2078 </section>
2079 </chapter>
2080
2081 <chapter id="CHID3">
2082 <title>Building and installing Exim</title>
2083 <para>
2084 <indexterm role="concept" id="IIDbuex" class="startofrange">
2085 <primary>building Exim</primary>
2086 </indexterm>
2087 </para>
2088 <section id="SECID23">
2089 <title>Unpacking</title>
2090 <para>
2091 Exim is distributed as a gzipped or bzipped tar file which, when unpacked,
2092 creates a directory with the name of the current release (for example,
2093 <filename>exim-4.72</filename>) into which the following files are placed:
2094 </para>
2095 <informaltable frame="none">
2096 <tgroup cols="2" colsep="0" rowsep="0">
2097 <colspec colwidth="140pt" align="left"/>
2098 <colspec colwidth="254pt" align="left"/>
2099 <tbody>
2100 <row>
2101 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>ACKNOWLEDGMENTS</filename></entry>
2102 <entry>contains some acknowledgments</entry>
2103 </row>
2104 <row>
2105 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>CHANGES</filename></entry>
2106 <entry>contains a reference to where changes are documented</entry>
2107 </row>
2108 <row>
2109 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>LICENCE</filename></entry>
2110 <entry>the GNU General Public Licence</entry>
2111 </row>
2112 <row>
2113 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>Makefile</filename></entry>
2114 <entry>top-level make file</entry>
2115 </row>
2116 <row>
2117 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>NOTICE</filename></entry>
2118 <entry>conditions for the use of Exim</entry>
2119 </row>
2120 <row>
2121 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>README</filename></entry>
2122 <entry>list of files, directories and simple build instructions</entry>
2123 </row>
2124 </tbody>
2125 </tgroup>
2126 </informaltable>
2127 <para>
2128 Other files whose names begin with <filename>README</filename> may also be present. The
2129 following subdirectories are created:
2130 </para>
2131 <informaltable frame="none">
2132 <tgroup cols="2" colsep="0" rowsep="0">
2133 <colspec colwidth="140pt" align="left"/>
2134 <colspec colwidth="254pt" align="left"/>
2135 <tbody>
2136 <row>
2137 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>Local</filename></entry>
2138 <entry>an empty directory for local configuration files</entry>
2139 </row>
2140 <row>
2141 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>OS</filename></entry>
2142 <entry>OS-specific files</entry>
2143 </row>
2144 <row>
2145 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>doc</filename></entry>
2146 <entry>documentation files</entry>
2147 </row>
2148 <row>
2149 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>exim_monitor</filename></entry>
2150 <entry>source files for the Exim monitor</entry>
2151 </row>
2152 <row>
2153 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>scripts</filename></entry>
2154 <entry>scripts used in the build process</entry>
2155 </row>
2156 <row>
2157 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>src</filename></entry>
2158 <entry>remaining source files</entry>
2159 </row>
2160 <row>
2161 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>util</filename></entry>
2162 <entry>independent utilities</entry>
2163 </row>
2164 </tbody>
2165 </tgroup>
2166 </informaltable>
2167 <para>
2168 The main utility programs are contained in the <filename>src</filename> directory, and are built
2169 with the Exim binary. The <filename>util</filename> directory contains a few optional scripts
2170 that may be useful to some sites.
2171 </para>
2172 </section>
2173 <section id="SECID24">
2174 <title>Multiple machine architectures and operating systems</title>
2175 <para>
2176 <indexterm role="concept">
2177 <primary>building Exim</primary>
2178 <secondary>multiple OS/architectures</secondary>
2179 </indexterm>
2180 The building process for Exim is arranged to make it easy to build binaries for
2181 a number of different architectures and operating systems from the same set of
2182 source files. Compilation does not take place in the <filename>src</filename> directory.
2183 Instead, a <emphasis>build directory</emphasis> is created for each architecture and operating
2184 system.
2185 <indexterm role="concept">
2186 <primary>symbolic link</primary>
2187 <secondary>to build directory</secondary>
2188 </indexterm>
2189 Symbolic links to the sources are installed in this directory, which is where
2190 the actual building takes place. In most cases, Exim can discover the machine
2191 architecture and operating system for itself, but the defaults can be
2192 overridden if necessary.
2193 </para>
2194 </section>
2195 <section id="SECTpcre">
2196 <title>PCRE library</title>
2197 <para>
2198 <indexterm role="concept">
2199 <primary>PCRE library</primary>
2200 </indexterm>
2201 Exim no longer has an embedded PCRE library as the vast majority of
2202 modern systems include PCRE as a system library, although you may need
2203 to install the PCRE or PCRE development package for your operating
2204 system. If your system has a normal PCRE installation the Exim build
2205 process will need no further configuration. If the library or the
2206 headers are in an unusual location you will need to set the PCRE_LIBS
2207 and INCLUDE directives appropriately. If your operating system has no
2208 PCRE support then you will need to obtain and build the current PCRE
2209 from <emphasis role="bold"><ulink url="ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/">ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/</ulink></emphasis>.
2210 </para>
2211 </section>
2212 <section id="SECTdb">
2213 <title>DBM libraries</title>
2214 <para>
2215 <indexterm role="concept">
2216 <primary>DBM libraries</primary>
2217 <secondary>discussion of</secondary>
2218 </indexterm>
2219 <indexterm role="concept">
2220 <primary>hints database</primary>
2221 <secondary>DBM files used for</secondary>
2222 </indexterm>
2223 Even if you do not use any DBM files in your configuration, Exim still needs a
2224 DBM library in order to operate, because it uses indexed files for its hints
2225 databases. Unfortunately, there are a number of DBM libraries in existence, and
2226 different operating systems often have different ones installed.
2227 </para>
2228 <para>
2229 <indexterm role="concept">
2230 <primary>Solaris</primary>
2231 <secondary>DBM library for</secondary>
2232 </indexterm>
2233 <indexterm role="concept">
2234 <primary>IRIX, DBM library for</primary>
2235 </indexterm>
2236 <indexterm role="concept">
2237 <primary>BSD, DBM library for</primary>
2238 </indexterm>
2239 <indexterm role="concept">
2240 <primary>Linux, DBM library for</primary>
2241 </indexterm>
2242 If you are using Solaris, IRIX, one of the modern BSD systems, or a modern
2243 Linux distribution, the DBM configuration should happen automatically, and you
2244 may be able to ignore this section. Otherwise, you may have to learn more than
2245 you would like about DBM libraries from what follows.
2246 </para>
2247 <para>
2248 <indexterm role="concept">
2249 <primary><emphasis>ndbm</emphasis> DBM library</primary>
2250 </indexterm>
2251 Licensed versions of Unix normally contain a library of DBM functions operating
2252 via the <emphasis>ndbm</emphasis> interface, and this is what Exim expects by default. Free
2253 versions of Unix seem to vary in what they contain as standard. In particular,
2254 some early versions of Linux have no default DBM library, and different
2255 distributors have chosen to bundle different libraries with their packaged
2256 versions. However, the more recent releases seem to have standardized on the
2257 Berkeley DB library.
2258 </para>
2259 <para>
2260 Different DBM libraries have different conventions for naming the files they
2261 use. When a program opens a file called <filename>dbmfile</filename>, there are several
2262 possibilities:
2263 </para>
2264 <orderedlist numeration="arabic">
2265 <listitem>
2266 <para>
2267 A traditional <emphasis>ndbm</emphasis> implementation, such as that supplied as part of
2268 Solaris, operates on two files called <filename>dbmfile.dir</filename> and <filename>dbmfile.pag</filename>.
2269 </para>
2270 </listitem>
2271 <listitem>
2272 <para>
2273 <indexterm role="concept">
2274 <primary><emphasis>gdbm</emphasis> DBM library</primary>
2275 </indexterm>
2276 The GNU library, <emphasis>gdbm</emphasis>, operates on a single file. If used via its <emphasis>ndbm</emphasis>
2277 compatibility interface it makes two different hard links to it with names
2278 <filename>dbmfile.dir</filename> and <filename>dbmfile.pag</filename>, but if used via its native interface, the
2279 file name is used unmodified.
2280 </para>
2281 </listitem>
2282 <listitem>
2283 <para>
2284 <indexterm role="concept">
2285 <primary>Berkeley DB library</primary>
2286 </indexterm>
2287 The Berkeley DB package, if called via its <emphasis>ndbm</emphasis> compatibility interface,
2288 operates on a single file called <filename>dbmfile.db</filename>, but otherwise looks to the
2289 programmer exactly the same as the traditional <emphasis>ndbm</emphasis> implementation.
2290 </para>
2291 </listitem>
2292 <listitem>
2293 <para>
2294 If the Berkeley package is used in its native mode, it operates on a single
2295 file called <filename>dbmfile</filename>; the programmer&#x2019;s interface is somewhat different to
2296 the traditional <emphasis>ndbm</emphasis> interface.
2297 </para>
2298 </listitem>
2299 <listitem>
2300 <para>
2301 To complicate things further, there are several very different versions of the
2302 Berkeley DB package. Version 1.85 was stable for a very long time, releases
2303 2.<emphasis>x</emphasis> and 3.<emphasis>x</emphasis> were current for a while, but the latest versions are now
2304 numbered 4.<emphasis>x</emphasis>. Maintenance of some of the earlier releases has ceased. All
2305 versions of Berkeley DB can be obtained from
2306 <emphasis role="bold"><ulink url="http://www.sleepycat.com/">http://www.sleepycat.com/</ulink></emphasis>.
2307 </para>
2308 </listitem>
2309 <listitem>
2310 <para>
2311 <indexterm role="concept">
2312 <primary><emphasis>tdb</emphasis> DBM library</primary>
2313 </indexterm>
2314 Yet another DBM library, called <emphasis>tdb</emphasis>, is available from
2315 <emphasis role="bold"><ulink url="http://download.sourceforge.net/tdb">http://download.sourceforge.net/tdb</ulink></emphasis>. It has its own interface, and also
2316 operates on a single file.
2317 </para>
2318 </listitem>
2319 </orderedlist>
2320 <para>
2321 <indexterm role="concept">
2322 <primary>USE_DB</primary>
2323 </indexterm>
2324 <indexterm role="concept">
2325 <primary>DBM libraries</primary>
2326 <secondary>configuration for building</secondary>
2327 </indexterm>
2328 Exim and its utilities can be compiled to use any of these interfaces. In order
2329 to use any version of the Berkeley DB package in native mode, you must set
2330 USE_DB in an appropriate configuration file (typically
2331 <filename>Local/Makefile</filename>). For example:
2332 </para>
2333 <literallayout class="monospaced">
2334 USE_DB=yes
2335 </literallayout>
2336 <para>
2337 Similarly, for gdbm you set USE_GDBM, and for tdb you set USE_TDB. An
2338 error is diagnosed if you set more than one of these.
2339 </para>
2340 <para>
2341 At the lowest level, the build-time configuration sets none of these options,
2342 thereby assuming an interface of type (1). However, some operating system
2343 configuration files (for example, those for the BSD operating systems and
2344 Linux) assume type (4) by setting USE_DB as their default, and the
2345 configuration files for Cygwin set USE_GDBM. Anything you set in
2346 <filename>Local/Makefile</filename>, however, overrides these system defaults.
2347 </para>
2348 <para>
2349 As well as setting USE_DB, USE_GDBM, or USE_TDB, it may also be
2350 necessary to set DBMLIB, to cause inclusion of the appropriate library, as
2351 in one of these lines:
2352 </para>
2353 <literallayout class="monospaced">
2354 DBMLIB = -ldb
2355 DBMLIB = -ltdb
2356 </literallayout>
2357 <para>
2358 Settings like that will work if the DBM library is installed in the standard
2359 place. Sometimes it is not, and the library&#x2019;s header file may also not be in
2360 the default path. You may need to set INCLUDE to specify where the header
2361 file is, and to specify the path to the library more fully in DBMLIB, as in
2362 this example:
2363 </para>
2364 <literallayout class="monospaced">
2365 INCLUDE=-I/usr/local/include/db-4.1
2366 DBMLIB=/usr/local/lib/db-4.1/libdb.a
2367 </literallayout>
2368 <para>
2369 There is further detailed discussion about the various DBM libraries in the
2370 file <filename>doc/dbm.discuss.txt</filename> in the Exim distribution.
2371 </para>
2372 </section>
2373 <section id="SECID25">
2374 <title>Pre-building configuration</title>
2375 <para>
2376 <indexterm role="concept">
2377 <primary>building Exim</primary>
2378 <secondary>pre-building configuration</secondary>
2379 </indexterm>
2380 <indexterm role="concept">
2381 <primary>configuration for building Exim</primary>
2382 </indexterm>
2383 <indexterm role="concept">
2384 <primary><filename>Local/Makefile</filename></primary>
2385 </indexterm>
2386 <indexterm role="concept">
2387 <primary><filename>src/EDITME</filename></primary>
2388 </indexterm>
2389 Before building Exim, a local configuration file that specifies options
2390 independent of any operating system has to be created with the name
2391 <filename>Local/Makefile</filename>. A template for this file is supplied as the file
2392 <filename>src/EDITME</filename>, and it contains full descriptions of all the option settings
2393 therein. These descriptions are therefore not repeated here. If you are
2394 building Exim for the first time, the simplest thing to do is to copy
2395 <filename>src/EDITME</filename> to <filename>Local/Makefile</filename>, then read it and edit it appropriately.
2396 </para>
2397 <para>
2398 There are three settings that you must supply, because Exim will not build
2399 without them. They are the location of the run time configuration file
2400 (CONFIGURE_FILE), the directory in which Exim binaries will be installed
2401 (BIN_DIRECTORY), and the identity of the Exim user (EXIM_USER and
2402 maybe EXIM_GROUP as well). The value of CONFIGURE_FILE can in fact be
2403 a colon-separated list of file names; Exim uses the first of them that exists.
2404 </para>
2405 <para>
2406 There are a few other parameters that can be specified either at build time or
2407 at run time, to enable the same binary to be used on a number of different
2408 machines. However, if the locations of Exim&#x2019;s spool directory and log file
2409 directory (if not within the spool directory) are fixed, it is recommended that
2410 you specify them in <filename>Local/Makefile</filename> instead of at run time, so that errors
2411 detected early in Exim&#x2019;s execution (such as a malformed configuration file) can
2412 be logged.
2413 </para>
2414 <para>
2415 <indexterm role="concept">
2416 <primary>content scanning</primary>
2417 <secondary>specifying at build time</secondary>
2418 </indexterm>
2419 Exim&#x2019;s interfaces for calling virus and spam scanning software directly from
2420 access control lists are not compiled by default. If you want to include these
2421 facilities, you need to set
2422 </para>
2423 <literallayout class="monospaced">
2424 WITH_CONTENT_SCAN=yes
2425 </literallayout>
2426 <para>
2427 in your <filename>Local/Makefile</filename>. For details of the facilities themselves, see
2428 chapter <xref linkend="CHAPexiscan"/>.
2429 </para>
2430 <para>
2431 <indexterm role="concept">
2432 <primary><filename>Local/eximon.conf</filename></primary>
2433 </indexterm>
2434 <indexterm role="concept">
2435 <primary><filename>exim_monitor/EDITME</filename></primary>
2436 </indexterm>
2437 If you are going to build the Exim monitor, a similar configuration process is
2438 required. The file <filename>exim_monitor/EDITME</filename> must be edited appropriately for
2439 your installation and saved under the name <filename>Local/eximon.conf</filename>. If you are
2440 happy with the default settings described in <filename>exim_monitor/EDITME</filename>,
2441 <filename>Local/eximon.conf</filename> can be empty, but it must exist.
2442 </para>
2443 <para>
2444 This is all the configuration that is needed in straightforward cases for known
2445 operating systems. However, the building process is set up so that it is easy
2446 to override options that are set by default or by operating-system-specific
2447 configuration files, for example to change the name of the C compiler, which
2448 defaults to <option>gcc</option>. See section <xref linkend="SECToverride"/> below for details of how to
2449 do this.
2450 </para>
2451 </section>
2452 <section id="SECID26">
2453 <title>Support for iconv()</title>
2454 <para>
2455 <indexterm role="concept">
2456 <primary><function>iconv()</function> support</primary>
2457 </indexterm>
2458 <indexterm role="concept">
2459 <primary>RFC 2047</primary>
2460 </indexterm>
2461 The contents of header lines in messages may be encoded according to the rules
2462 described RFC 2047. This makes it possible to transmit characters that are not
2463 in the ASCII character set, and to label them as being in a particular
2464 character set. When Exim is inspecting header lines by means of the <option>$h_</option>
2465 mechanism, it decodes them, and translates them into a specified character set
2466 (default ISO-8859-1). The translation is possible only if the operating system
2467 supports the <function>iconv()</function> function.
2468 </para>
2469 <para>
2470 However, some of the operating systems that supply <function>iconv()</function> do not support
2471 very many conversions. The GNU <option>libiconv</option> library (available from
2472 <emphasis role="bold"><ulink url="http://www.gnu.org/software/libiconv/">http://www.gnu.org/software/libiconv/</ulink></emphasis>) can be installed on such
2473 systems to remedy this deficiency, as well as on systems that do not supply
2474 <function>iconv()</function> at all. After installing <option>libiconv</option>, you should add
2475 </para>
2476 <literallayout class="monospaced">
2477 HAVE_ICONV=yes
2478 </literallayout>
2479 <para>
2480 to your <filename>Local/Makefile</filename> and rebuild Exim.
2481 </para>
2482 </section>
2483 <section id="SECTinctlsssl">
2484 <title>Including TLS/SSL encryption support</title>
2485 <para>
2486 <indexterm role="concept">
2487 <primary>TLS</primary>
2488 <secondary>including support for TLS</secondary>
2489 </indexterm>
2490 <indexterm role="concept">
2491 <primary>encryption</primary>
2492 <secondary>including support for</secondary>
2493 </indexterm>
2494 <indexterm role="concept">
2495 <primary>SUPPORT_TLS</primary>
2496 </indexterm>
2497 <indexterm role="concept">
2498 <primary>OpenSSL</primary>
2499 <secondary>building Exim with</secondary>
2500 </indexterm>
2501 <indexterm role="concept">
2502 <primary>GnuTLS</primary>
2503 <secondary>building Exim with</secondary>
2504 </indexterm>
2505 Exim can be built to support encrypted SMTP connections, using the STARTTLS
2506 command as per RFC 2487. It can also support legacy clients that expect to
2507 start a TLS session immediately on connection to a non-standard port (see the
2508 <option>tls_on_connect_ports</option> runtime option and the <option>-tls-on-connect</option> command
2509 line option).
2510 </para>
2511 <para>
2512 If you want to build Exim with TLS support, you must first install either the
2513 OpenSSL or GnuTLS library. There is no cryptographic code in Exim itself for
2514 implementing SSL.
2515 </para>
2516 <para>
2517 If OpenSSL is installed, you should set
2518 </para>
2519 <literallayout class="monospaced">
2520 SUPPORT_TLS=yes
2521 TLS_LIBS=-lssl -lcrypto
2522 </literallayout>
2523 <para>
2524 in <filename>Local/Makefile</filename>. You may also need to specify the locations of the
2525 OpenSSL library and include files. For example:
2526 </para>
2527 <literallayout class="monospaced">
2528 SUPPORT_TLS=yes
2529 TLS_LIBS=-L/usr/local/openssl/lib -lssl -lcrypto
2530 TLS_INCLUDE=-I/usr/local/openssl/include/
2531 </literallayout>
2532 <para>
2533 <indexterm role="concept">
2534 <primary>USE_GNUTLS</primary>
2535 </indexterm>
2536 If GnuTLS is installed, you should set
2537 </para>
2538 <literallayout class="monospaced">
2539 SUPPORT_TLS=yes
2540 USE_GNUTLS=yes
2541 TLS_LIBS=-lgnutls -ltasn1 -lgcrypt
2542 </literallayout>
2543 <para>
2544 in <filename>Local/Makefile</filename>, and again you may need to specify the locations of the
2545 library and include files. For example:
2546 </para>
2547 <literallayout class="monospaced">
2548 SUPPORT_TLS=yes
2549 USE_GNUTLS=yes
2550 TLS_LIBS=-L/usr/gnu/lib -lgnutls -ltasn1 -lgcrypt
2551 TLS_INCLUDE=-I/usr/gnu/include
2552 </literallayout>
2553 <para>
2554 You do not need to set TLS_INCLUDE if the relevant directory is already
2555 specified in INCLUDE. Details of how to configure Exim to make use of TLS are
2556 given in chapter <xref linkend="CHAPTLS"/>.
2557 </para>
2558 </section>
2559 <section id="SECID27">
2560 <title>Use of tcpwrappers</title>
2561 <para>
2562 <indexterm role="concept">
2563 <primary>tcpwrappers, building Exim to support</primary>
2564 </indexterm>
2565 <indexterm role="concept">
2566 <primary>USE_TCP_WRAPPERS</primary>
2567 </indexterm>
2568 Exim can be linked with the <emphasis>tcpwrappers</emphasis> library in order to check incoming
2569 SMTP calls using the <emphasis>tcpwrappers</emphasis> control files. This may be a convenient
2570 alternative to Exim&#x2019;s own checking facilities for installations that are
2571 already making use of <emphasis>tcpwrappers</emphasis> for other purposes. To do this, you
2572 should set USE_TCP_WRAPPERS in <filename>Local/Makefile</filename>, arrange for the file
2573 <filename>tcpd.h</filename> to be available at compile time, and also ensure that the library
2574 <filename>libwrap.a</filename> is available at link time, typically by including <option>-lwrap</option> in
2575 EXTRALIBS_EXIM. For example, if <emphasis>tcpwrappers</emphasis> is installed in <filename>/usr/local</filename>,
2576 you might have
2577 </para>
2578 <literallayout class="monospaced">
2579 USE_TCP_WRAPPERS=yes
2580 CFLAGS=-O -I/usr/local/include
2581 EXTRALIBS_EXIM=-L/usr/local/lib -lwrap
2582 </literallayout>
2583 <para>
2584 in <filename>Local/Makefile</filename>. The name to use in the <emphasis>tcpwrappers</emphasis> control files is
2585 <quote>exim</quote>. For example, the line
2586 </para>
2587 <literallayout class="monospaced">
2588 exim : LOCAL  192.168.1.  .friendly.domain.example
2589 </literallayout>
2590 <para>
2591 in your <filename>/etc/hosts.allow</filename> file allows connections from the local host, from
2592 the subnet 192.168.1.0/24, and from all hosts in <emphasis>friendly.domain.example</emphasis>.
2593 All other connections are denied. Consult the <emphasis>tcpwrappers</emphasis> documentation for
2594 further details.
2595 </para>
2596 </section>
2597 <section id="SECID28">
2598 <title>Including support for IPv6</title>
2599 <para>
2600 <indexterm role="concept">
2601 <primary>IPv6</primary>
2602 <secondary>including support for</secondary>
2603 </indexterm>
2604 Exim contains code for use on systems that have IPv6 support. Setting
2605 <literal>HAVE_IPV6=YES</literal> in <filename>Local/Makefile</filename> causes the IPv6 code to be included;
2606 it may also be necessary to set IPV6_INCLUDE and IPV6_LIBS on systems
2607 where the IPv6 support is not fully integrated into the normal include and
2608 library files.
2609 </para>
2610 <para>
2611 Two different types of DNS record for handling IPv6 addresses have been
2612 defined. AAAA records (analogous to A records for IPv4) are in use, and are
2613 currently seen as the mainstream. Another record type called A6 was proposed
2614 as better than AAAA because it had more flexibility. However, it was felt to be
2615 over-complex, and its status was reduced to <quote>experimental</quote>. It is not known
2616 if anyone is actually using A6 records. Exim has support for A6 records, but
2617 this is included only if you set <literal>SUPPORT_A6=YES</literal> in <filename>Local/Makefile</filename>. The
2618 support has not been tested for some time.
2619 </para>
2620 </section>
2621 <section id="SECID29">
2622 <title>The building process</title>
2623 <para>
2624 <indexterm role="concept">
2625 <primary>build directory</primary>
2626 </indexterm>
2627 Once <filename>Local/Makefile</filename> (and <filename>Local/eximon.conf</filename>, if required) have been
2628 created, run <emphasis>make</emphasis> at the top level. It determines the architecture and
2629 operating system types, and creates a build directory if one does not exist.
2630 For example, on a Sun system running Solaris 8, the directory
2631 <filename>build-SunOS5-5.8-sparc</filename> is created.
2632 <indexterm role="concept">
2633 <primary>symbolic link</primary>
2634 <secondary>to source files</secondary>
2635 </indexterm>
2636 Symbolic links to relevant source files are installed in the build directory.
2637 </para>
2638 <para>
2639 <emphasis role="bold">Warning</emphasis>: The <option>-j</option> (parallel) flag must not be used with <emphasis>make</emphasis>; the
2640 building process fails if it is set.
2641 </para>
2642 <para>
2643 If this is the first time <emphasis>make</emphasis> has been run, it calls a script that builds
2644 a make file inside the build directory, using the configuration files from the
2645 <filename>Local</filename> directory. The new make file is then passed to another instance of
2646 <emphasis>make</emphasis>. This does the real work, building a number of utility scripts, and
2647 then compiling and linking the binaries for the Exim monitor (if configured), a
2648 number of utility programs, and finally Exim itself. The command <literal>make
2649 makefile</literal> can be used to force a rebuild of the make file in the build
2650 directory, should this ever be necessary.
2651 </para>
2652 <para>
2653 If you have problems building Exim, check for any comments there may be in the
2654 <filename>README</filename> file concerning your operating system, and also take a look at the
2655 FAQ, where some common problems are covered.
2656 </para>
2657 </section>
2658 <section id="SECID283">
2659 <title>Output from <quote>make</quote></title>
2660 <para>
2661 The output produced by the <emphasis>make</emphasis> process for compile lines is often very
2662 unreadable, because these lines can be very long. For this reason, the normal
2663 output is suppressed by default, and instead output similar to that which
2664 appears when compiling the 2.6 Linux kernel is generated: just a short line for
2665 each module that is being compiled or linked. However, it is still possible to
2666 get the full output, by calling <emphasis>make</emphasis> like this:
2667 </para>
2668 <literallayout class="monospaced">
2669 FULLECHO='' make -e
2670 </literallayout>
2671 <para>
2672 The value of FULLECHO defaults to <quote>@</quote>, the flag character that suppresses
2673 command reflection in <emphasis>make</emphasis>. When you ask for the full output, it is
2674 given in addition to the short output.
2675 </para>
2676 </section>
2677 <section id="SECToverride">
2678 <title>Overriding build-time options for Exim</title>
2679 <para>
2680 <indexterm role="concept">
2681 <primary>build-time options, overriding</primary>
2682 </indexterm>
2683 The main make file that is created at the beginning of the building process
2684 consists of the concatenation of a number of files which set configuration
2685 values, followed by a fixed set of <emphasis>make</emphasis> instructions. If a value is set
2686 more than once, the last setting overrides any previous ones. This provides a
2687 convenient way of overriding defaults. The files that are concatenated are, in
2688 order:
2689 </para>
2690 <literallayout>
2691 <filename>OS/Makefile-Default</filename>
2692 <filename>OS/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;
2693 <filename>Local/Makefile</filename>
2694 <filename>Local/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;
2695 <filename>Local/Makefile-</filename>&lt;<emphasis>archtype</emphasis>&gt;
2696 <filename>Local/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;-&lt;<emphasis>archtype</emphasis>&gt;
2697 <filename>OS/Makefile-Base</filename>
2698 </literallayout>
2699 <para>
2700 <indexterm role="concept">
2701 <primary><filename>Local/Makefile</filename></primary>
2702 </indexterm>
2703 <indexterm role="concept">
2704 <primary>building Exim</primary>
2705 <secondary>operating system type</secondary>
2706 </indexterm>
2707 <indexterm role="concept">
2708 <primary>building Exim</primary>
2709 <secondary>architecture type</secondary>
2710 </indexterm>
2711 where &lt;<emphasis>ostype</emphasis>&gt; is the operating system type and &lt;<emphasis>archtype</emphasis>&gt; is the
2712 architecture type. <filename>Local/Makefile</filename> is required to exist, and the building
2713 process fails if it is absent. The other three <filename>Local</filename> files are optional,
2714 and are often not needed.
2715 </para>
2716 <para>
2717 The values used for &lt;<emphasis>ostype</emphasis>&gt; and &lt;<emphasis>archtype</emphasis>&gt; are obtained from scripts
2718 called <filename>scripts/os-type</filename> and <filename>scripts/arch-type</filename> respectively. If either of
2719 the environment variables EXIM_OSTYPE or EXIM_ARCHTYPE is set, their
2720 values are used, thereby providing a means of forcing particular settings.
2721 Otherwise, the scripts try to get values from the <option>uname</option> command. If this
2722 fails, the shell variables OSTYPE and ARCHTYPE are inspected. A number
2723 of <emphasis>ad hoc</emphasis> transformations are then applied, to produce the standard names
2724 that Exim expects. You can run these scripts directly from the shell in order
2725 to find out what values are being used on your system.
2726 </para>
2727 <para>
2728 <filename>OS/Makefile-Default</filename> contains comments about the variables that are set
2729 therein. Some (but not all) are mentioned below. If there is something that
2730 needs changing, review the contents of this file and the contents of the make
2731 file for your operating system (<filename>OS/Makefile-&lt;ostype&gt;</filename>) to see what the
2732 default values are.
2733 </para>
2734 <para>
2735 <indexterm role="concept">
2736 <primary>building Exim</primary>
2737 <secondary>overriding default settings</secondary>
2738 </indexterm>
2739 If you need to change any of the values that are set in <filename>OS/Makefile-Default</filename>
2740 or in <filename>OS/Makefile-&lt;ostype&gt;</filename>, or to add any new definitions, you do not
2741 need to change the original files. Instead, you should make the changes by
2742 putting the new values in an appropriate <filename>Local</filename> file. For example,
2743 <indexterm role="concept">
2744 <primary>Tru64-Unix build-time settings</primary>
2745 </indexterm>
2746 when building Exim in many releases of the Tru64-Unix (formerly Digital UNIX,
2747 formerly DEC-OSF1) operating system, it is necessary to specify that the C
2748 compiler is called <emphasis>cc</emphasis> rather than <emphasis>gcc</emphasis>. Also, the compiler must be
2749 called with the option <option>-std1</option>, to make it recognize some of the features of
2750 Standard C that Exim uses. (Most other compilers recognize Standard C by
2751 default.) To do this, you should create a file called <filename>Local/Makefile-OSF1</filename>
2752 containing the lines
2753 </para>
2754 <literallayout class="monospaced">
2755 CC=cc
2756 CFLAGS=-std1
2757 </literallayout>
2758 <para>
2759 If you are compiling for just one operating system, it may be easier to put
2760 these lines directly into <filename>Local/Makefile</filename>.
2761 </para>
2762 <para>
2763 Keeping all your local configuration settings separate from the distributed
2764 files makes it easy to transfer them to new versions of Exim simply by copying
2765 the contents of the <filename>Local</filename> directory.
2766 </para>
2767 <para>
2768 <indexterm role="concept">
2769 <primary>NIS lookup type</primary>
2770 <secondary>including support for</secondary>
2771 </indexterm>
2772 <indexterm role="concept">
2773 <primary>NIS+ lookup type</primary>
2774 <secondary>including support for</secondary>
2775 </indexterm>
2776 <indexterm role="concept">
2777 <primary>LDAP</primary>
2778 <secondary>including support for</secondary>
2779 </indexterm>
2780 <indexterm role="concept">
2781 <primary>lookup</primary>
2782 <secondary>inclusion in binary</secondary>
2783 </indexterm>
2784 Exim contains support for doing LDAP, NIS, NIS+, and other kinds of file
2785 lookup, but not all systems have these components installed, so the default is
2786 not to include the relevant code in the binary. All the different kinds of file
2787 and database lookup that Exim supports are implemented as separate code modules
2788 which are included only if the relevant compile-time options are set. In the
2789 case of LDAP, NIS, and NIS+, the settings for <filename>Local/Makefile</filename> are:
2790 </para>
2791 <literallayout class="monospaced">
2792 LOOKUP_LDAP=yes
2793 LOOKUP_NIS=yes
2794 LOOKUP_NISPLUS=yes
2795 </literallayout>
2796 <para>
2797 and similar settings apply to the other lookup types. They are all listed in
2798 <filename>src/EDITME</filename>. In many cases the relevant include files and interface
2799 libraries need to be installed before compiling Exim.
2800 <indexterm role="concept">
2801 <primary>cdb</primary>
2802 <secondary>including support for</secondary>
2803 </indexterm>
2804 However, there are some optional lookup types (such as cdb) for which
2805 the code is entirely contained within Exim, and no external include
2806 files or libraries are required. When a lookup type is not included in the
2807 binary, attempts to configure Exim to use it cause run time configuration
2808 errors.
2809 </para>
2810 <para>
2811 <indexterm role="concept">
2812 <primary>Perl</primary>
2813 <secondary>including support for</secondary>
2814 </indexterm>
2815 Exim can be linked with an embedded Perl interpreter, allowing Perl
2816 subroutines to be called during string expansion. To enable this facility,
2817 </para>
2818 <literallayout class="monospaced">
2819 EXIM_PERL=perl.o
2820 </literallayout>
2821 <para>
2822 must be defined in <filename>Local/Makefile</filename>. Details of this facility are given in
2823 chapter <xref linkend="CHAPperl"/>.
2824 </para>
2825 <para>
2826 <indexterm role="concept">
2827 <primary>X11 libraries, location of</primary>
2828 </indexterm>
2829 The location of the X11 libraries is something that varies a lot between
2830 operating systems, and there may be different versions of X11 to cope
2831 with. Exim itself makes no use of X11, but if you are compiling the Exim
2832 monitor, the X11 libraries must be available.
2833 The following three variables are set in <filename>OS/Makefile-Default</filename>:
2834 </para>
2835 <literallayout class="monospaced">
2836 X11=/usr/X11R6
2837 XINCLUDE=-I$(X11)/include
2838 XLFLAGS=-L$(X11)/lib
2839 </literallayout>
2840 <para>
2841 These are overridden in some of the operating-system configuration files. For
2842 example, in <filename>OS/Makefile-SunOS5</filename> there is
2843 </para>
2844 <literallayout class="monospaced">
2845 X11=/usr/openwin
2846 XINCLUDE=-I$(X11)/include
2847 XLFLAGS=-L$(X11)/lib -R$(X11)/lib
2848 </literallayout>
2849 <para>
2850 If you need to override the default setting for your operating system, place a
2851 definition of all three of these variables into your
2852 <filename>Local/Makefile-&lt;ostype&gt;</filename> file.
2853 </para>
2854 <para>
2855 <indexterm role="concept">
2856 <primary>EXTRALIBS</primary>
2857 </indexterm>
2858 If you need to add any extra libraries to the link steps, these can be put in a
2859 variable called EXTRALIBS, which appears in all the link commands, but by
2860 default is not defined. In contrast, EXTRALIBS_EXIM is used only on the
2861 command for linking the main Exim binary, and not for any associated utilities.
2862 </para>
2863 <para>
2864 <indexterm role="concept">
2865 <primary>DBM libraries</primary>
2866 <secondary>configuration for building</secondary>
2867 </indexterm>
2868 There is also DBMLIB, which appears in the link commands for binaries that
2869 use DBM functions (see also section <xref linkend="SECTdb"/>). Finally, there is
2870 EXTRALIBS_EXIMON, which appears only in the link step for the Exim monitor
2871 binary, and which can be used, for example, to include additional X11
2872 libraries.
2873 </para>
2874 <para>
2875 <indexterm role="concept">
2876 <primary>configuration file</primary>
2877 <secondary>editing</secondary>
2878 </indexterm>
2879 The make file copes with rebuilding Exim correctly if any of the configuration
2880 files are edited. However, if an optional configuration file is deleted, it is
2881 necessary to touch the associated non-optional file (that is,
2882 <filename>Local/Makefile</filename> or <filename>Local/eximon.conf</filename>) before rebuilding.
2883 </para>
2884 </section>
2885 <section id="SECID30">
2886 <title>OS-specific header files</title>
2887 <para>
2888 <indexterm role="concept">
2889 <primary><filename>os.h</filename></primary>
2890 </indexterm>
2891 <indexterm role="concept">
2892 <primary>building Exim</primary>
2893 <secondary>OS-specific C header files</secondary>
2894 </indexterm>
2895 The <filename>OS</filename> directory contains a number of files with names of the form
2896 <filename>os.h-&lt;ostype&gt;</filename>. These are system-specific C header files that should not
2897 normally need to be changed. There is a list of macro settings that are
2898 recognized in the file <filename>OS/os.configuring</filename>, which should be consulted if you
2899 are porting Exim to a new operating system.
2900 </para>
2901 </section>
2902 <section id="SECID31">
2903 <title>Overriding build-time options for the monitor</title>
2904 <para>
2905 <indexterm role="concept">
2906 <primary>building Eximon</primary>
2907 </indexterm>
2908 A similar process is used for overriding things when building the Exim monitor,
2909 where the files that are involved are
2910 </para>
2911 <literallayout>
2912 <filename>OS/eximon.conf-Default</filename>
2913 <filename>OS/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;
2914 <filename>Local/eximon.conf</filename>
2915 <filename>Local/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;
2916 <filename>Local/eximon.conf-</filename>&lt;<emphasis>archtype</emphasis>&gt;
2917 <filename>Local/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;-&lt;<emphasis>archtype</emphasis>&gt;
2918 </literallayout>
2919 <para>
2920 <indexterm role="concept">
2921 <primary><filename>Local/eximon.conf</filename></primary>
2922 </indexterm>
2923 As with Exim itself, the final three files need not exist, and in this case the
2924 <filename>OS/eximon.conf-&lt;ostype&gt;</filename> file is also optional. The default values in
2925 <filename>OS/eximon.conf-Default</filename> can be overridden dynamically by setting environment
2926 variables of the same name, preceded by EXIMON_. For example, setting
2927 EXIMON_LOG_DEPTH in the environment overrides the value of
2928 LOG_DEPTH at run time.
2929 <indexterm role="concept" startref="IIDbuex" class="endofrange"/>
2930 </para>
2931 </section>
2932 <section id="SECID32">
2933 <title>Installing Exim binaries and scripts</title>
2934 <para>
2935 <indexterm role="concept">
2936 <primary>installing Exim</primary>
2937 </indexterm>
2938 <indexterm role="concept">
2939 <primary>BIN_DIRECTORY</primary>
2940 </indexterm>
2941 The command <literal>make install</literal> runs the <command>exim_install</command> script with no
2942 arguments. The script copies binaries and utility scripts into the directory
2943 whose name is specified by the BIN_DIRECTORY setting in <filename>Local/Makefile</filename>.
2944 <indexterm role="concept">
2945 <primary>setuid</primary>
2946 <secondary>installing Exim with</secondary>
2947 </indexterm>
2948 The install script copies files only if they are newer than the files they are
2949 going to replace. The Exim binary is required to be owned by root and have the
2950 <emphasis>setuid</emphasis> bit set, for normal configurations. Therefore, you must run <literal>make
2951 install</literal> as root so that it can set up the Exim binary in this way. However, in
2952 some special situations (for example, if a host is doing no local deliveries)
2953 it may be possible to run Exim without making the binary setuid root (see
2954 chapter <xref linkend="CHAPsecurity"/> for details).
2955 </para>
2956 <para>
2957 <indexterm role="concept">
2958 <primary>CONFIGURE_FILE</primary>
2959 </indexterm>
2960 Exim&#x2019;s run time configuration file is named by the CONFIGURE_FILE setting
2961 in <filename>Local/Makefile</filename>. If this names a single file, and the file does not
2962 exist, the default configuration file <filename>src/configure.default</filename> is copied there
2963 by the installation script. If a run time configuration file already exists, it
2964 is left alone. If CONFIGURE_FILE is a colon-separated list, naming several
2965 alternative files, no default is installed.
2966 </para>
2967 <para>
2968 <indexterm role="concept">
2969 <primary>system aliases file</primary>
2970 </indexterm>
2971 <indexterm role="concept">
2972 <primary><filename>/etc/aliases</filename></primary>
2973 </indexterm>
2974 One change is made to the default configuration file when it is installed: the
2975 default configuration contains a router that references a system aliases file.
2976 The path to this file is set to the value specified by
2977 SYSTEM_ALIASES_FILE in <filename>Local/Makefile</filename> (<filename>/etc/aliases</filename> by default).
2978 If the system aliases file does not exist, the installation script creates it,
2979 and outputs a comment to the user.
2980 </para>
2981 <para>
2982 The created file contains no aliases, but it does contain comments about the
2983 aliases a site should normally have. Mail aliases have traditionally been
2984 kept in <filename>/etc/aliases</filename>. However, some operating systems are now using
2985 <filename>/etc/mail/aliases</filename>. You should check if yours is one of these, and change
2986 Exim&#x2019;s configuration if necessary.
2987 </para>
2988 <para>
2989 The default configuration uses the local host&#x2019;s name as the only local domain,
2990 and is set up to do local deliveries into the shared directory <filename>/var/mail</filename>,
2991 running as the local user. System aliases and <filename>.forward</filename> files in users&#x2019; home
2992 directories are supported, but no NIS or NIS+ support is configured. Domains
2993 other than the name of the local host are routed using the DNS, with delivery
2994 over SMTP.
2995 </para>
2996 <para>
2997 It is possible to install Exim for special purposes (such as building a binary
2998 distribution) in a private part of the file system. You can do this by a
2999 command such as
3000 </para>
3001 <literallayout class="monospaced">
3002 make DESTDIR=/some/directory/ install
3003 </literallayout>
3004 <para>
3005 This has the effect of pre-pending the specified directory to all the file
3006 paths, except the name of the system aliases file that appears in the default
3007 configuration. (If a default alias file is created, its name <emphasis>is</emphasis> modified.)
3008 For backwards compatibility, ROOT is used if DESTDIR is not set,
3009 but this usage is deprecated.
3010 </para>
3011 <para>
3012 <indexterm role="concept">
3013 <primary>installing Exim</primary>
3014 <secondary>what is not installed</secondary>
3015 </indexterm>
3016 Running <emphasis>make install</emphasis> does not copy the Exim 4 conversion script
3017 <emphasis>convert4r4</emphasis>. You will probably run this only once if you are
3018 upgrading from Exim 3. None of the documentation files in the <filename>doc</filename>
3019 directory are copied, except for the info files when you have set
3020 INFO_DIRECTORY, as described in section <xref linkend="SECTinsinfdoc"/> below.
3021 </para>
3022 <para>
3023 For the utility programs, old versions are renamed by adding the suffix <filename>.O</filename>
3024 to their names. The Exim binary itself, however, is handled differently. It is
3025 installed under a name that includes the version number and the compile number,
3026 for example <filename>exim-4.72-1</filename>. The script then arranges for a symbolic link
3027 called <filename>exim</filename> to point to the binary. If you are updating a previous version
3028 of Exim, the script takes care to ensure that the name <filename>exim</filename> is never absent
3029 from the directory (as seen by other processes).
3030 </para>
3031 <para>
3032 <indexterm role="concept">
3033 <primary>installing Exim</primary>
3034 <secondary>testing the script</secondary>
3035 </indexterm>
3036 If you want to see what the <emphasis>make install</emphasis> will do before running it for
3037 real, you can pass the <option>-n</option> option to the installation script by this
3038 command:
3039 </para>
3040 <literallayout class="monospaced">
3041 make INSTALL_ARG=-n install
3042 </literallayout>
3043 <para>
3044 The contents of the variable INSTALL_ARG are passed to the installation
3045 script. You do not need to be root to run this test. Alternatively, you can run
3046 the installation script directly, but this must be from within the build
3047 directory. For example, from the top-level Exim directory you could use this
3048 command:
3049 </para>
3050 <literallayout class="monospaced">
3051 (cd build-SunOS5-5.5.1-sparc; ../scripts/exim_install -n)
3052 </literallayout>
3053 <para>
3054 <indexterm role="concept">
3055 <primary>installing Exim</primary>
3056 <secondary>install script options</secondary>
3057 </indexterm>
3058 There are two other options that can be supplied to the installation script.
3059 </para>
3060 <itemizedlist>
3061 <listitem>
3062 <para>
3063 <option>-no_chown</option> bypasses the call to change the owner of the installed binary
3064 to root, and the call to make it a setuid binary.
3065 </para>
3066 </listitem>
3067 <listitem>
3068 <para>
3069 <option>-no_symlink</option> bypasses the setting up of the symbolic link <filename>exim</filename> to the
3070 installed binary.
3071 </para>
3072 </listitem>
3073 </itemizedlist>
3074 <para>
3075 INSTALL_ARG can be used to pass these options to the script. For example:
3076 </para>
3077 <literallayout class="monospaced">
3078 make INSTALL_ARG=-no_symlink install
3079 </literallayout>
3080 <para>
3081 The installation script can also be given arguments specifying which files are
3082 to be copied. For example, to install just the Exim binary, and nothing else,
3083 without creating the symbolic link, you could use:
3084 </para>
3085 <literallayout class="monospaced">
3086 make INSTALL_ARG='-no_symlink exim' install
3087 </literallayout>
3088 </section>
3089 <section id="SECTinsinfdoc">
3090 <title>Installing info documentation</title>
3091 <para>
3092 <indexterm role="concept">
3093 <primary>installing Exim</primary>
3094 <secondary><emphasis>info</emphasis> documentation</secondary>
3095 </indexterm>
3096 Not all systems use the GNU <emphasis>info</emphasis> system for documentation, and for this
3097 reason, the Texinfo source of Exim&#x2019;s documentation is not included in the main
3098 distribution. Instead it is available separately from the ftp site (see section
3099 <xref linkend="SECTavail"/>).
3100 </para>
3101 <para>
3102 If you have defined INFO_DIRECTORY in <filename>Local/Makefile</filename> and the Texinfo
3103 source of the documentation is found in the source tree, running <literal>make
3104 install</literal> automatically builds the info files and installs them.
3105 </para>
3106 </section>
3107 <section id="SECID33">
3108 <title>Setting up the spool directory</title>
3109 <para>
3110 <indexterm role="concept">
3111 <primary>spool directory</primary>
3112 <secondary>creating</secondary>
3113 </indexterm>
3114 When it starts up, Exim tries to create its spool directory if it does not
3115 exist. The Exim uid and gid are used for the owner and group of the spool
3116 directory. Sub-directories are automatically created in the spool directory as
3117 necessary.
3118 </para>
3119 </section>
3120 <section id="SECID34">
3121 <title>Testing</title>
3122 <para>
3123 <indexterm role="concept">
3124 <primary>testing</primary>
3125 <secondary>installation</secondary>
3126 </indexterm>
3127 Having installed Exim, you can check that the run time configuration file is
3128 syntactically valid by running the following command, which assumes that the
3129 Exim binary directory is within your PATH environment variable:
3130 </para>
3131 <literallayout class="monospaced">
3132 exim -bV
3133 </literallayout>
3134 <para>
3135 If there are any errors in the configuration file, Exim outputs error messages.
3136 Otherwise it outputs the version number and build date,
3137 the DBM library that is being used, and information about which drivers and
3138 other optional code modules are included in the binary.
3139 Some simple routing tests can be done by using the address testing option. For
3140 example,
3141 </para>
3142 <literallayout>
3143 <literal>exim -bt</literal> &lt;<emphasis>local username</emphasis>&gt;
3144 </literallayout>
3145 <para>
3146 should verify that it recognizes a local mailbox, and
3147 </para>
3148 <literallayout>
3149 <literal>exim -bt</literal> &lt;<emphasis>remote address</emphasis>&gt;
3150 </literallayout>
3151 <para>
3152 a remote one. Then try getting it to deliver mail, both locally and remotely.
3153 This can be done by passing messages directly to Exim, without going through a
3154 user agent. For example:
3155 </para>
3156 <literallayout class="monospaced">
3157 exim -v postmaster@your.domain.example
3158 From: user@your.domain.example
3159 To: postmaster@your.domain.example
3160 Subject: Testing Exim
3161
3162 This is a test message.
3163 ^D
3164 </literallayout>
3165 <para>
3166 The <option>-v</option> option causes Exim to output some verification of what it is doing.
3167 In this case you should see copies of three log lines, one for the message&#x2019;s
3168 arrival, one for its delivery, and one containing <quote>Completed</quote>.
3169 </para>
3170 <para>
3171 <indexterm role="concept">
3172 <primary>delivery</primary>
3173 <secondary>problems with</secondary>
3174 </indexterm>
3175 If you encounter problems, look at Exim&#x2019;s log files (<emphasis>mainlog</emphasis> and
3176 <emphasis>paniclog</emphasis>) to see if there is any relevant information there. Another source
3177 of information is running Exim with debugging turned on, by specifying the
3178 <option>-d</option> option. If a message is stuck on Exim&#x2019;s spool, you can force a delivery
3179 with debugging turned on by a command of the form
3180 </para>
3181 <literallayout>
3182 <literal>exim -d -M</literal> &lt;<emphasis>exim-message-id</emphasis>&gt;
3183 </literallayout>
3184 <para>
3185 You must be root or an <quote>admin user</quote> in order to do this. The <option>-d</option> option
3186 produces rather a lot of output, but you can cut this down to specific areas.
3187 For example, if you use <option>-d-all+route</option> only the debugging information
3188 relevant to routing is included. (See the <option>-d</option> option in chapter
3189 <xref linkend="CHAPcommandline"/> for more details.)
3190 </para>
3191 <para>
3192 <indexterm role="concept">
3193 <primary><quote>sticky</quote> bit</primary>
3194 </indexterm>
3195 <indexterm role="concept">
3196 <primary>lock files</primary>
3197 </indexterm>
3198 One specific problem that has shown up on some sites is the inability to do
3199 local deliveries into a shared mailbox directory, because it does not have the
3200 <quote>sticky bit</quote> set on it. By default, Exim tries to create a lock file before
3201 writing to a mailbox file, and if it cannot create the lock file, the delivery
3202 is deferred. You can get round this either by setting the <quote>sticky bit</quote> on the
3203 directory, or by setting a specific group for local deliveries and allowing
3204 that group to create files in the directory (see the comments above the
3205 <command>local_delivery</command> transport in the default configuration file). Another
3206 approach is to configure Exim not to use lock files, but just to rely on
3207 <function>fcntl()</function> locking instead. However, you should do this only if all user
3208 agents also use <function>fcntl()</function> locking. For further discussion of locking issues,
3209 see chapter <xref linkend="CHAPappendfile"/>.
3210 </para>
3211 <para>
3212 One thing that cannot be tested on a system that is already running an MTA is
3213 the receipt of incoming SMTP mail on the standard SMTP port. However, the
3214 <option>-oX</option> option can be used to run an Exim daemon that listens on some other
3215 port, or <emphasis>inetd</emphasis> can be used to do this. The <option>-bh</option> option and the
3216 <emphasis>exim_checkaccess</emphasis> utility can be used to check out policy controls on
3217 incoming SMTP mail.
3218 </para>
3219 <para>
3220 Testing a new version on a system that is already running Exim can most easily
3221 be done by building a binary with a different CONFIGURE_FILE setting. From
3222 within the run time configuration, all other file and directory names
3223 that Exim uses can be altered, in order to keep it entirely clear of the
3224 production version.
3225 </para>
3226 </section>
3227 <section id="SECID35">
3228 <title>Replacing another MTA with Exim</title>
3229 <para>
3230 <indexterm role="concept">
3231 <primary>replacing another MTA</primary>
3232 </indexterm>
3233 Building and installing Exim for the first time does not of itself put it in
3234 general use. The name by which the system&#x2019;s MTA is called by mail user agents
3235 is either <filename>/usr/sbin/sendmail</filename>, or <filename>/usr/lib/sendmail</filename> (depending on the
3236 operating system), and it is necessary to make this name point to the <emphasis>exim</emphasis>
3237 binary in order to get the user agents to pass messages to Exim. This is
3238 normally done by renaming any existing file and making <filename>/usr/sbin/sendmail</filename>
3239 or <filename>/usr/lib/sendmail</filename>
3240 <indexterm role="concept">
3241 <primary>symbolic link</primary>
3242 <secondary>to <emphasis>exim</emphasis> binary</secondary>
3243 </indexterm>
3244 a symbolic link to the <emphasis>exim</emphasis> binary. It is a good idea to remove any setuid
3245 privilege and executable status from the old MTA. It is then necessary to stop
3246 and restart the mailer daemon, if one is running.
3247 </para>
3248 <para>
3249 <indexterm role="concept">
3250 <primary>FreeBSD, MTA indirection</primary>
3251 </indexterm>
3252 <indexterm role="concept">
3253 <primary><filename>/etc/mail/mailer.conf</filename></primary>
3254 </indexterm>
3255 Some operating systems have introduced alternative ways of switching MTAs. For
3256 example, if you are running FreeBSD, you need to edit the file
3257 <filename>/etc/mail/mailer.conf</filename> instead of setting up a symbolic link as just
3258 described. A typical example of the contents of this file for running Exim is
3259 as follows:
3260 </para>
3261 <literallayout class="monospaced">
3262 sendmail            /usr/exim/bin/exim
3263 send-mail           /usr/exim/bin/exim
3264 mailq               /usr/exim/bin/exim -bp
3265 newaliases          /usr/bin/true
3266 </literallayout>
3267 <para>
3268 Once you have set up the symbolic link, or edited <filename>/etc/mail/mailer.conf</filename>,
3269 your Exim installation is <quote>live</quote>. Check it by sending a message from your
3270 favourite user agent.
3271 </para>
3272 <para>
3273 You should consider what to tell your users about the change of MTA. Exim may
3274 have different capabilities to what was previously running, and there are
3275 various operational differences such as the text of messages produced by
3276 command line options and in bounce messages. If you allow your users to make
3277 use of Exim&#x2019;s filtering capabilities, you should make the document entitled
3278 <emphasis>Exim&#x2019;s interface to mail filtering</emphasis> available to them.
3279 </para>
3280 </section>
3281 <section id="SECID36">
3282 <title>Upgrading Exim</title>
3283 <para>
3284 <indexterm role="concept">
3285 <primary>upgrading Exim</primary>
3286 </indexterm>
3287 If you are already running Exim on your host, building and installing a new
3288 version automatically makes it available to MUAs, or any other programs that
3289 call the MTA directly. However, if you are running an Exim daemon, you do need
3290 to send it a HUP signal, to make it re-execute itself, and thereby pick up the
3291 new binary. You do not need to stop processing mail in order to install a new
3292 version of Exim. The install script does not modify an existing runtime
3293 configuration file.
3294 </para>
3295 </section>
3296 <section id="SECID37">
3297 <title>Stopping the Exim daemon on Solaris</title>
3298 <para>
3299 <indexterm role="concept">
3300 <primary>Solaris</primary>
3301 <secondary>stopping Exim on</secondary>
3302 </indexterm>
3303 The standard command for stopping the mailer daemon on Solaris is
3304 </para>
3305 <literallayout class="monospaced">
3306 /etc/init.d/sendmail stop
3307 </literallayout>
3308 <para>
3309 If <filename>/usr/lib/sendmail</filename> has been turned into a symbolic link, this script
3310 fails to stop Exim because it uses the command <emphasis>ps -e</emphasis> and greps the output
3311 for the text <quote>sendmail</quote>; this is not present because the actual program name
3312 (that is, <quote>exim</quote>) is given by the <emphasis>ps</emphasis> command with these options. A
3313 solution is to replace the line that finds the process id with something like
3314 </para>
3315 <literallayout class="monospaced">
3316 pid=`cat /var/spool/exim/exim-daemon.pid`
3317 </literallayout>
3318 <para>
3319 to obtain the daemon&#x2019;s pid directly from the file that Exim saves it in.
3320 </para>
3321 <para>
3322 Note, however, that stopping the daemon does not <quote>stop Exim</quote>. Messages can
3323 still be received from local processes, and if automatic delivery is configured
3324 (the normal case), deliveries will still occur.
3325 </para>
3326 </section>
3327 </chapter>
3328
3329 <chapter id="CHAPcommandline">
3330 <title>The Exim command line</title>
3331 <para>
3332 <indexterm role="concept" id="IIDclo1" class="startofrange">
3333 <primary>command line</primary>
3334 <secondary>options</secondary>
3335 </indexterm>
3336 <indexterm role="concept" id="IIDclo2" class="startofrange">
3337 <primary>options</primary>
3338 <secondary>command line</secondary>
3339 </indexterm>
3340 Exim&#x2019;s command line takes the standard Unix form of a sequence of options,
3341 each starting with a hyphen character, followed by a number of arguments. The
3342 options are compatible with the main options of Sendmail, and there are also
3343 some additional options, some of which are compatible with Smail 3. Certain
3344 combinations of options do not make sense, and provoke an error if used.
3345 The form of the arguments depends on which options are set.
3346 </para>
3347 <section id="SECID38">
3348 <title>Setting options by program name</title>
3349 <para>
3350 <indexterm role="concept">
3351 <primary><emphasis>mailq</emphasis></primary>
3352 </indexterm>
3353 If Exim is called under the name <emphasis>mailq</emphasis>, it behaves as if the option <option>-bp</option>
3354 were present before any other options.
3355 The <option>-bp</option> option requests a listing of the contents of the mail queue on the
3356 standard output.
3357 This feature is for compatibility with some systems that contain a command of
3358 that name in one of the standard libraries, symbolically linked to
3359 <filename>/usr/sbin/sendmail</filename> or <filename>/usr/lib/sendmail</filename>.
3360 </para>
3361 <para>
3362 <indexterm role="concept">
3363 <primary><emphasis>rsmtp</emphasis></primary>
3364 </indexterm>
3365 If Exim is called under the name <emphasis>rsmtp</emphasis> it behaves as if the option <option>-bS</option>
3366 were present before any other options, for compatibility with Smail. The
3367 <option>-bS</option> option is used for reading in a number of messages in batched SMTP
3368 format.
3369 </para>
3370 <para>
3371 <indexterm role="concept">
3372 <primary><emphasis>rmail</emphasis></primary>
3373 </indexterm>
3374 If Exim is called under the name <emphasis>rmail</emphasis> it behaves as if the <option>-i</option> and
3375 <option>-oee</option> options were present before any other options, for compatibility with
3376 Smail. The name <emphasis>rmail</emphasis> is used as an interface by some UUCP systems.
3377 </para>
3378 <para>
3379 <indexterm role="concept">
3380 <primary><emphasis>runq</emphasis></primary>
3381 </indexterm>
3382 <indexterm role="concept">
3383 <primary>queue runner</primary>
3384 </indexterm>
3385 If Exim is called under the name <emphasis>runq</emphasis> it behaves as if the option <option>-q</option>
3386 were present before any other options, for compatibility with Smail. The <option>-q</option>
3387 option causes a single queue runner process to be started.
3388 </para>
3389 <para>
3390 <indexterm role="concept">
3391 <primary><emphasis>newaliases</emphasis></primary>
3392 </indexterm>
3393 <indexterm role="concept">
3394 <primary>alias file</primary>
3395 <secondary>building</secondary>
3396 </indexterm>
3397 <indexterm role="concept">
3398 <primary>Sendmail compatibility</primary>
3399 <secondary>calling Exim as <emphasis>newaliases</emphasis></secondary>
3400 </indexterm>
3401 If Exim is called under the name <emphasis>newaliases</emphasis> it behaves as if the option
3402 <option>-bi</option> were present before any other options, for compatibility with Sendmail.
3403 This option is used for rebuilding Sendmail&#x2019;s alias file. Exim does not have
3404 the concept of a single alias file, but can be configured to run a given
3405 command if called with the <option>-bi</option> option.
3406 </para>
3407 </section>
3408 <section id="SECTtrustedadmin">
3409 <title>Trusted and admin users</title>
3410 <para>
3411 Some Exim options are available only to <emphasis>trusted users</emphasis> and others are
3412 available only to <emphasis>admin users</emphasis>. In the description below, the phrases <quote>Exim
3413 user</quote> and <quote>Exim group</quote> mean the user and group defined by EXIM_USER and
3414 EXIM_GROUP in <filename>Local/Makefile</filename> or set by the <option>exim_user</option> and
3415 <option>exim_group</option> options. These do not necessarily have to use the name <quote>exim</quote>.
3416 </para>
3417 <itemizedlist>
3418 <listitem>
3419 <para>
3420 <indexterm role="concept">
3421 <primary>trusted users</primary>
3422 <secondary>definition of</secondary>
3423 </indexterm>
3424 <indexterm role="concept">
3425 <primary>user</primary>
3426 <secondary>trusted definition of</secondary>
3427 </indexterm>
3428 The trusted users are root, the Exim user, any user listed in the
3429 <option>trusted_users</option> configuration option, and any user whose current group or any
3430 supplementary group is one of those listed in the <option>trusted_groups</option>
3431 configuration option. Note that the Exim group is not automatically trusted.
3432 </para>
3433 <para>
3434 <indexterm role="concept">
3435 <primary><quote>From</quote> line</primary>
3436 </indexterm>
3437 <indexterm role="concept">
3438 <primary>envelope sender</primary>
3439 </indexterm>
3440 Trusted users are always permitted to use the <option>-f</option> option or a leading
3441 <quote>From&nbsp;</quote> line to specify the envelope sender of a message that is passed to
3442 Exim through the local interface (see the <option>-bm</option> and <option>-f</option> options below).
3443 See the <option>untrusted_set_sender</option> option for a way of permitting non-trusted
3444 users to set envelope senders.
3445 </para>
3446 <para>
3447 <indexterm role="concept">
3448 <primary><emphasis>From:</emphasis> header line</primary>
3449 </indexterm>
3450 <indexterm role="concept">
3451 <primary><emphasis>Sender:</emphasis> header line</primary>
3452 </indexterm>
3453 For a trusted user, there is never any check on the contents of the <emphasis>From:</emphasis>
3454 header line, and a <emphasis>Sender:</emphasis> line is never added. Furthermore, any existing
3455 <emphasis>Sender:</emphasis> line in incoming local (non-TCP/IP) messages is not removed.
3456 </para>
3457 <para>
3458 Trusted users may also specify a host name, host address, interface address,
3459 protocol name, ident value, and authentication data when submitting a message
3460 locally. Thus, they are able to insert messages into Exim&#x2019;s queue locally that
3461 have the characteristics of messages received from a remote host. Untrusted
3462 users may in some circumstances use <option>-f</option>, but can never set the other values
3463 that are available to trusted users.
3464 </para>
3465 </listitem>
3466 <listitem>
3467 <para>
3468 <indexterm role="concept">
3469 <primary>user</primary>
3470 <secondary>admin definition of</secondary>
3471 </indexterm>
3472 <indexterm role="concept">
3473 <primary>admin user</primary>
3474 <secondary>definition of</secondary>
3475 </indexterm>
3476 The admin users are root, the Exim user, and any user that is a member of the
3477 Exim group or of any group listed in the <option>admin_groups</option> configuration option.
3478 The current group does not have to be one of these groups.
3479 </para>
3480 <para>
3481 Admin users are permitted to list the queue, and to carry out certain
3482 operations on messages, for example, to force delivery failures. It is also
3483 necessary to be an admin user in order to see the full information provided by
3484 the Exim monitor, and full debugging output.
3485 </para>
3486 <para>
3487 By default, the use of the <option>-M</option>, <option>-q</option>, <option>-R</option>, and <option>-S</option> options to cause
3488 Exim to attempt delivery of messages on its queue is restricted to admin users.
3489 However, this restriction can be relaxed by setting the <option>prod_requires_admin</option>
3490 option false (that is, specifying <option>no_prod_requires_admin</option>).
3491 </para>
3492 <para>
3493 Similarly, the use of the <option>-bp</option> option to list all the messages in the queue
3494 is restricted to admin users unless <option>queue_list_requires_admin</option> is set
3495 false.
3496 </para>
3497 </listitem>
3498 </itemizedlist>
3499 <para>
3500 <emphasis role="bold">Warning</emphasis>: If you configure your system so that admin users are able to
3501 edit Exim&#x2019;s configuration file, you are giving those users an easy way of
3502 getting root. There is further discussion of this issue at the start of chapter
3503 <xref linkend="CHAPconf"/>.
3504 </para>
3505 </section>
3506 <section id="SECID39">
3507 <title>Command line options</title>
3508 <para>
3509 Exim&#x2019;s command line options are described in alphabetical order below. If none
3510 of the options that specifies a specific action (such as starting the daemon or
3511 a queue runner, or testing an address, or receiving a message in a specific
3512 format, or listing the queue) are present, and there is at least one argument
3513 on the command line, <option>-bm</option> (accept a local message on the standard input,
3514 with the arguments specifying the recipients) is assumed. Otherwise, Exim
3515 outputs a brief message about itself and exits.
3516 </para>
3517 <!-- === Start of command line options === -->
3518 <variablelist>
3519 <varlistentry>
3520 <term><option>--</option></term>
3521 <listitem>
3522 <para>
3523 <indexterm role="option">
3524 <primary>--</primary>
3525 </indexterm>
3526 <indexterm role="concept">
3527 <primary>options</primary>
3528 <secondary>command line; terminating</secondary>
3529 </indexterm>
3530 This is a pseudo-option whose only purpose is to terminate the options and
3531 therefore to cause subsequent command line items to be treated as arguments
3532 rather than options, even if they begin with hyphens.
3533 </para>
3534 </listitem></varlistentry>
3535 <varlistentry>
3536 <term><option>--help</option></term>
3537 <listitem>
3538 <para>
3539 <indexterm role="option">
3540 <primary><option>--help</option></primary>
3541 </indexterm>
3542 This option causes Exim to output a few sentences stating what it is.
3543 The same output is generated if the Exim binary is called with no options and
3544 no arguments.
3545 </para>
3546 </listitem></varlistentry>
3547 <varlistentry>
3548 <term><option>-B</option>&lt;<emphasis>type</emphasis>&gt;</term>
3549 <listitem>
3550 <para>
3551 <indexterm role="option">
3552 <primary><option>-B</option></primary>
3553 </indexterm>
3554 <indexterm role="concept">
3555 <primary>8-bit characters</primary>
3556 </indexterm>
3557 <indexterm role="concept">
3558 <primary>Sendmail compatibility</primary>
3559 <secondary>8-bit characters</secondary>
3560 </indexterm>
3561 This is a Sendmail option for selecting 7 or 8 bit processing. Exim is 8-bit
3562 clean; it ignores this option.
3563 </para>
3564 </listitem></varlistentry>
3565 <varlistentry>
3566 <term><option>-bd</option></term>
3567 <listitem>
3568 <para>
3569 <indexterm role="option">
3570 <primary><option>-bd</option></primary>
3571 </indexterm>
3572 <indexterm role="concept">
3573 <primary>daemon</primary>
3574 </indexterm>
3575 <indexterm role="concept">
3576 <primary>SMTP</primary>
3577 <secondary>listener</secondary>
3578 </indexterm>
3579 <indexterm role="concept">
3580 <primary>queue runner</primary>
3581 </indexterm>
3582 This option runs Exim as a daemon, awaiting incoming SMTP connections. Usually
3583 the <option>-bd</option> option is combined with the <option>-q</option>&lt;<emphasis>time</emphasis>&gt; option, to specify
3584 that the daemon should also initiate periodic queue runs.
3585 </para>
3586 <para>
3587 The <option>-bd</option> option can be used only by an admin user. If either of the <option>-d</option>
3588 (debugging) or <option>-v</option> (verifying) options are set, the daemon does not
3589 disconnect from the controlling terminal. When running this way, it can be
3590 stopped by pressing ctrl-C.
3591 </para>
3592 <para>
3593 By default, Exim listens for incoming connections to the standard SMTP port on
3594 all the host&#x2019;s running interfaces. However, it is possible to listen on other
3595 ports, on multiple ports, and only on specific interfaces. Chapter
3596 <xref linkend="CHAPinterfaces"/> contains a description of the options that control this.
3597 </para>
3598 <para>
3599 When a listening daemon
3600 <indexterm role="concept">
3601 <primary>daemon</primary>
3602 <secondary>process id (pid)</secondary>
3603 </indexterm>
3604 <indexterm role="concept">
3605 <primary>pid (process id)</primary>
3606 <secondary>of daemon</secondary>
3607 </indexterm>
3608 is started without the use of <option>-oX</option> (that is, without overriding the normal
3609 configuration), it writes its process id to a file called <filename>exim-daemon.pid</filename>
3610 in Exim&#x2019;s spool directory. This location can be overridden by setting
3611 PID_FILE_PATH in <filename>Local/Makefile</filename>. The file is written while Exim is still
3612 running as root.
3613 </para>
3614 <para>
3615 When <option>-oX</option> is used on the command line to start a listening daemon, the
3616 process id is not written to the normal pid file path. However, <option>-oP</option> can be
3617 used to specify a path on the command line if a pid file is required.
3618 </para>
3619 <para>
3620 The SIGHUP signal
3621 <indexterm role="concept">
3622 <primary>SIGHUP</primary>
3623 </indexterm>
3624 <indexterm role="concept">
3625 <primary>daemon</primary>
3626 <secondary>restarting</secondary>
3627 </indexterm>
3628 can be used to cause the daemon to re-execute itself. This should be done
3629 whenever Exim&#x2019;s configuration file, or any file that is incorporated into it by
3630 means of the <option>.include</option> facility, is changed, and also whenever a new version
3631 of Exim is installed. It is not necessary to do this when other files that are
3632 referenced from the configuration (for example, alias files) are changed,
3633 because these are reread each time they are used.
3634 </para>
3635 </listitem></varlistentry>
3636 <varlistentry>
3637 <term><option>-bdf</option></term>
3638 <listitem>
3639 <para>
3640 <indexterm role="option">
3641 <primary><option>-bdf</option></primary>
3642 </indexterm>
3643 This option has the same effect as <option>-bd</option> except that it never disconnects
3644 from the controlling terminal, even when no debugging is specified.
3645 </para>
3646 </listitem></varlistentry>
3647 <varlistentry>
3648 <term><option>-be</option></term>
3649 <listitem>
3650 <para>
3651 <indexterm role="option">
3652 <primary><option>-be</option></primary>
3653 </indexterm>
3654 <indexterm role="concept">
3655 <primary>testing</primary>
3656 <secondary>string expansion</secondary>
3657 </indexterm>
3658 <indexterm role="concept">
3659 <primary>expansion</primary>
3660 <secondary>testing</secondary>
3661 </indexterm>
3662 Run Exim in expansion testing mode. Exim discards its root privilege, to
3663 prevent ordinary users from using this mode to read otherwise inaccessible
3664 files. If no arguments are given, Exim runs interactively, prompting for lines
3665 of data. Otherwise, it processes each argument in turn.
3666 </para>
3667 <para>
3668 If Exim was built with USE_READLINE=yes in <filename>Local/Makefile</filename>, it tries
3669 to load the <option>libreadline</option> library dynamically whenever the <option>-be</option> option is
3670 used without command line arguments. If successful, it uses the <function>readline()</function>
3671 function, which provides extensive line-editing facilities, for reading the
3672 test data. A line history is supported.
3673 </para>
3674 <para>
3675 Long expansion expressions can be split over several lines by using backslash
3676 continuations. As in Exim&#x2019;s run time configuration, white space at the start of
3677 continuation lines is ignored. Each argument or data line is passed through the
3678 string expansion mechanism, and the result is output. Variable values from the
3679 configuration file (for example, <varname>$qualify_domain</varname>) are available, but no
3680 message-specific values (such as <varname>$sender_domain</varname>) are set, because no message
3681 is being processed (but see <option>-bem</option> and <option>-Mset</option>).
3682 </para>
3683 <para>
3684 <emphasis role="bold">Note</emphasis>: If you use this mechanism to test lookups, and you change the data
3685 files or databases you are using, you must exit and restart Exim before trying
3686 the same lookup again. Otherwise, because each Exim process caches the results
3687 of lookups, you will just get the same result as before.
3688 </para>
3689 </listitem></varlistentry>
3690 <varlistentry>
3691 <term><option>-bem</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
3692 <listitem>
3693 <para>
3694 <indexterm role="option">
3695 <primary><option>-bem</option></primary>
3696 </indexterm>
3697 <indexterm role="concept">
3698 <primary>testing</primary>
3699 <secondary>string expansion</secondary>
3700 </indexterm>
3701 <indexterm role="concept">
3702 <primary>expansion</primary>
3703 <secondary>testing</secondary>
3704 </indexterm>
3705 This option operates like <option>-be</option> except that it must be followed by the name
3706 of a file. For example:
3707 </para>
3708 <literallayout class="monospaced">
3709 exim -bem /tmp/testmessage
3710 </literallayout>
3711 <para>
3712 The file is read as a message (as if receiving a locally-submitted non-SMTP
3713 message) before any of the test expansions are done. Thus, message-specific
3714 variables such as <varname>$message_size</varname> and <varname>$header_from:</varname> are available. However,
3715 no <emphasis>Received:</emphasis> header is added to the message. If the <option>-t</option> option is set,
3716 recipients are read from the headers in the normal way, and are shown in the
3717 <varname>$recipients</varname> variable. Note that recipients cannot be given on the command
3718 line, because further arguments are taken as strings to expand (just like
3719 <option>-be</option>).
3720 </para>
3721 </listitem></varlistentry>
3722 <varlistentry>
3723 <term><option>-bF</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
3724 <listitem>
3725 <para>
3726 <indexterm role="option">
3727 <primary><option>-bF</option></primary>
3728 </indexterm>
3729 <indexterm role="concept">
3730 <primary>system filter</primary>
3731 <secondary>testing</secondary>
3732 </indexterm>
3733 <indexterm role="concept">
3734 <primary>testing</primary>
3735 <secondary>system filter</secondary>
3736 </indexterm>
3737 This option is the same as <option>-bf</option> except that it assumes that the filter being
3738 tested is a system filter. The additional commands that are available only in
3739 system filters are recognized.
3740 </para>
3741 </listitem></varlistentry>
3742 <varlistentry>
3743 <term><option>-bf</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
3744 <listitem>
3745 <para>
3746 <indexterm role="option">
3747 <primary><option>-bf</option></primary>
3748 </indexterm>
3749 <indexterm role="concept">
3750 <primary>filter</primary>
3751 <secondary>testing</secondary>
3752 </indexterm>
3753 <indexterm role="concept">
3754 <primary>testing</primary>
3755 <secondary>filter file</secondary>
3756 </indexterm>
3757 <indexterm role="concept">
3758 <primary>forward file</primary>
3759 <secondary>testing</secondary>
3760 </indexterm>
3761 <indexterm role="concept">
3762 <primary>testing</primary>
3763 <secondary>forward file</secondary>
3764 </indexterm>
3765 <indexterm role="concept">
3766 <primary>Sieve filter</primary>
3767 <secondary>testing</secondary>
3768 </indexterm>
3769 This option runs Exim in user filter testing mode; the file is the filter file
3770 to be tested, and a test message must be supplied on the standard input. If
3771 there are no message-dependent tests in the filter, an empty file can be
3772 supplied.
3773 </para>
3774 <para>
3775 If you want to test a system filter file, use <option>-bF</option> instead of <option>-bf</option>. You
3776 can use both <option>-bF</option> and <option>-bf</option> on the same command, in order to test a system
3777 filter and a user filter in the same run. For example:
3778 </para>
3779 <literallayout class="monospaced">
3780 exim -bF /system/filter -bf /user/filter &lt;/test/message
3781 </literallayout>
3782 <para>
3783 This is helpful when the system filter adds header lines or sets filter
3784 variables that are used by the user filter.
3785 </para>
3786 <para>
3787 If the test filter file does not begin with one of the special lines
3788 </para>
3789 <literallayout class="monospaced">
3790 # Exim filter
3791 # Sieve filter
3792 </literallayout>
3793 <para>
3794 it is taken to be a normal <filename>.forward</filename> file, and is tested for validity under
3795 that interpretation. See sections <xref linkend="SECTitenonfilred"/> to
3796 <xref linkend="SECTspecitredli"/> for a description of the possible contents of non-filter
3797 redirection lists.
3798 </para>
3799 <para>
3800 The result of an Exim command that uses <option>-bf</option>, provided no errors are
3801 detected, is a list of the actions that Exim would try to take if presented
3802 with the message for real. More details of filter testing are given in the
3803 separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>.
3804 </para>
3805 <para>
3806 When testing a filter file,
3807 <indexterm role="concept">
3808 <primary><quote>From</quote> line</primary>
3809 </indexterm>
3810 <indexterm role="concept">
3811 <primary>envelope sender</primary>
3812 </indexterm>
3813 <indexterm role="option">
3814 <primary><option>-f</option></primary>
3815 <secondary>for filter testing</secondary>
3816 </indexterm>
3817 the envelope sender can be set by the <option>-f</option> option,
3818 or by a <quote>From&nbsp;</quote> line at the start of the test message. Various parameters
3819 that would normally be taken from the envelope recipient address of the message
3820 can be set by means of additional command line options (see the next four
3821 options).
3822 </para>
3823 </listitem></varlistentry>
3824 <varlistentry>
3825 <term><option>-bfd</option>&nbsp;&lt;<emphasis>domain</emphasis>&gt;</term>
3826 <listitem>
3827 <para>
3828 <indexterm role="option">
3829 <primary><option>-bfd</option></primary>
3830 </indexterm>
3831 <indexterm role="variable">
3832 <primary><varname>$qualify_domain</varname></primary>
3833 </indexterm>
3834 This sets the domain of the recipient address when a filter file is being
3835 tested by means of the <option>-bf</option> option. The default is the value of
3836 <varname>$qualify_domain</varname>.
3837 </para>
3838 </listitem></varlistentry>
3839 <varlistentry>
3840 <term><option>-bfl</option>&nbsp;&lt;<emphasis>local&nbsp;part</emphasis>&gt;</term>
3841 <listitem>
3842 <para>
3843 <indexterm role="option">
3844 <primary><option>-bfl</option></primary>
3845 </indexterm>
3846 This sets the local part of the recipient address when a filter file is being
3847 tested by means of the <option>-bf</option> option. The default is the username of the
3848 process that calls Exim. A local part should be specified with any prefix or
3849 suffix stripped, because that is how it appears to the filter when a message is
3850 actually being delivered.
3851 </para>
3852 </listitem></varlistentry>
3853 <varlistentry>
3854 <term><option>-bfp</option>&nbsp;&lt;<emphasis>prefix</emphasis>&gt;</term>
3855 <listitem>
3856 <para>
3857 <indexterm role="option">
3858 <primary><option>-bfp</option></primary>
3859 </indexterm>
3860 This sets the prefix of the local part of the recipient address when a filter
3861 file is being tested by means of the <option>-bf</option> option. The default is an empty
3862 prefix.
3863 </para>
3864 </listitem></varlistentry>
3865 <varlistentry>
3866 <term><option>-bfs</option>&nbsp;&lt;<emphasis>suffix</emphasis>&gt;</term>
3867 <listitem>
3868 <para>
3869 <indexterm role="option">
3870 <primary><option>-bfs</option></primary>
3871 </indexterm>
3872 This sets the suffix of the local part of the recipient address when a filter
3873 file is being tested by means of the <option>-bf</option> option. The default is an empty
3874 suffix.
3875 </para>
3876 </listitem></varlistentry>
3877 <varlistentry>
3878 <term><option>-bh</option>&nbsp;&lt;<emphasis>IP&nbsp;address</emphasis>&gt;</term>
3879 <listitem>
3880 <para>
3881 <indexterm role="option">
3882 <primary><option>-bh</option></primary>
3883 </indexterm>
3884 <indexterm role="concept">
3885 <primary>testing</primary>
3886 <secondary>incoming SMTP</secondary>
3887 </indexterm>
3888 <indexterm role="concept">
3889 <primary>SMTP</primary>
3890 <secondary>testing incoming</secondary>
3891 </indexterm>
3892 <indexterm role="concept">
3893 <primary>testing</primary>
3894 <secondary>relay control</secondary>
3895 </indexterm>
3896 <indexterm role="concept">
3897 <primary>relaying</primary>
3898 <secondary>testing configuration</secondary>
3899 </indexterm>
3900 <indexterm role="concept">
3901 <primary>policy control</primary>
3902 <secondary>testing</secondary>
3903 </indexterm>
3904 <indexterm role="concept">
3905 <primary>debugging</primary>
3906 <secondary><option>-bh</option> option</secondary>
3907 </indexterm>
3908 This option runs a fake SMTP session as if from the given IP address, using the
3909 standard input and output. The IP address may include a port number at the end,
3910 after a full stop. For example:
3911 </para>
3912 <literallayout class="monospaced">
3913 exim -bh 10.9.8.7.1234
3914 exim -bh fe80::a00:20ff:fe86:a061.5678
3915 </literallayout>
3916 <para>
3917 When an IPv6 address is given, it is converted into canonical form. In the case
3918 of the second example above, the value of <varname>$sender_host_address</varname> after
3919 conversion to the canonical form is
3920 <literal>fe80:0000:0000:0a00:20ff:fe86:a061.5678</literal>.
3921 </para>
3922 <para>
3923 Comments as to what is going on are written to the standard error file. These
3924 include lines beginning with <quote>LOG</quote> for anything that would have been logged.
3925 This facility is provided for testing configuration options for incoming
3926 messages, to make sure they implement the required policy. For example, you can
3927 test your relay controls using <option>-bh</option>.
3928 </para>
3929 <para>
3930 <emphasis role="bold">Warning 1</emphasis>:
3931 <indexterm role="concept">
3932 <primary>RFC 1413</primary>
3933 </indexterm>
3934 You can test features of the configuration that rely on ident (RFC 1413)
3935 information by using the <option>-oMt</option> option. However, Exim cannot actually perform
3936 an ident callout when testing using <option>-bh</option> because there is no incoming SMTP
3937 connection.
3938 </para>
3939 <para>
3940 <emphasis role="bold">Warning 2</emphasis>: Address verification callouts (see section <xref linkend="SECTcallver"/>)
3941 are also skipped when testing using <option>-bh</option>. If you want these callouts to
3942 occur, use <option>-bhc</option> instead.
3943 </para>
3944 <para>
3945 Messages supplied during the testing session are discarded, and nothing is
3946 written to any of the real log files. There may be pauses when DNS (and other)
3947 lookups are taking place, and of course these may time out. The <option>-oMi</option> option
3948 can be used to specify a specific IP interface and port if this is important,
3949 and <option>-oMaa</option> and <option>-oMai</option> can be used to set parameters as if the SMTP
3950 session were authenticated.
3951 </para>
3952 <para>
3953 The <emphasis>exim_checkaccess</emphasis> utility is a <quote>packaged</quote> version of <option>-bh</option> whose
3954 output just states whether a given recipient address from a given host is
3955 acceptable or not. See section <xref linkend="SECTcheckaccess"/>.
3956 </para>
3957 <para>
3958 Features such as authentication and encryption, where the client input is not
3959 plain text, cannot easily be tested with <option>-bh</option>. Instead, you should use a
3960 specialized SMTP test program such as
3961 <emphasis role="bold"><ulink url="http://jetmore.org/john/code/#swaks">swaks</ulink></emphasis>.
3962 </para>
3963 </listitem></varlistentry>
3964 <varlistentry>
3965 <term><option>-bhc</option>&nbsp;&lt;<emphasis>IP&nbsp;address</emphasis>&gt;</term>
3966 <listitem>
3967 <para>
3968 <indexterm role="option">
3969 <primary><option>-bhc</option></primary>
3970 </indexterm>
3971 This option operates in the same way as <option>-bh</option>, except that address
3972 verification callouts are performed if required. This includes consulting and
3973 updating the callout cache database.
3974 </para>
3975 </listitem></varlistentry>
3976 <varlistentry>
3977 <term><option>-bi</option></term>
3978 <listitem>
3979 <para>
3980 <indexterm role="option">
3981 <primary><option>-bi</option></primary>
3982 </indexterm>
3983 <indexterm role="concept">
3984 <primary>alias file</primary>
3985 <secondary>building</secondary>
3986 </indexterm>
3987 <indexterm role="concept">
3988 <primary>building alias file</primary>
3989 </indexterm>
3990 <indexterm role="concept">
3991 <primary>Sendmail compatibility</primary>
3992 <secondary><option>-bi</option> option</secondary>
3993 </indexterm>
3994 Sendmail interprets the <option>-bi</option> option as a request to rebuild its alias file.
3995 Exim does not have the concept of a single alias file, and so it cannot mimic
3996 this behaviour. However, calls to <filename>/usr/lib/sendmail</filename> with the <option>-bi</option> option
3997 tend to appear in various scripts such as NIS make files, so the option must be
3998 recognized.
3999 </para>
4000 <para>
4001 If <option>-bi</option> is encountered, the command specified by the <option>bi_command</option>
4002 configuration option is run, under the uid and gid of the caller of Exim. If
4003 the <option>-oA</option> option is used, its value is passed to the command as an argument.
4004 The command set by <option>bi_command</option> may not contain arguments. The command can
4005 use the <emphasis>exim_dbmbuild</emphasis> utility, or some other means, to rebuild alias files
4006 if this is required. If the <option>bi_command</option> option is not set, calling Exim with
4007 <option>-bi</option> is a no-op.
4008 </para>
4009 </listitem></varlistentry>
4010 <varlistentry>
4011 <term><option>-bm</option></term>
4012 <listitem>
4013 <para>
4014 <indexterm role="option">
4015 <primary><option>-bm</option></primary>
4016 </indexterm>
4017 <indexterm role="concept">
4018 <primary>local message reception</primary>
4019 </indexterm>
4020 This option runs an Exim receiving process that accepts an incoming,
4021 locally-generated message on the current input. The recipients are given as the
4022 command arguments (except when <option>-t</option> is also present &ndash; see below). Each
4023 argument can be a comma-separated list of RFC 2822 addresses. This is the
4024 default option for selecting the overall action of an Exim call; it is assumed
4025 if no other conflicting option is present.
4026 </para>
4027 <para>
4028 If any addresses in the message are unqualified (have no domain), they are
4029 qualified by the values of the <option>qualify_domain</option> or <option>qualify_recipient</option>
4030 options, as appropriate. The <option>-bnq</option> option (see below) provides a way of
4031 suppressing this for special cases.
4032 </para>
4033 <para>
4034 Policy checks on the contents of local messages can be enforced by means of
4035 the non-SMTP ACL. See chapter <xref linkend="CHAPACL"/> for details.
4036 </para>
4037 <para>
4038 <indexterm role="concept">
4039 <primary>return code</primary>
4040 <secondary>for <option>-bm</option></secondary>
4041 </indexterm>
4042 The return code is zero if the message is successfully accepted. Otherwise, the
4043 action is controlled by the <option>-oe</option><emphasis>x</emphasis> option setting &ndash; see below.
4044 </para>
4045 <para>
4046 The format
4047 <indexterm role="concept">
4048 <primary>message</primary>
4049 <secondary>format</secondary>
4050 </indexterm>
4051 <indexterm role="concept">
4052 <primary>format</primary>
4053 <secondary>message</secondary>
4054 </indexterm>
4055 <indexterm role="concept">
4056 <primary><quote>From</quote> line</primary>
4057 </indexterm>
4058 <indexterm role="concept">
4059 <primary>UUCP</primary>
4060 <secondary><quote>From</quote> line</secondary>
4061 </indexterm>
4062 <indexterm role="concept">
4063 <primary>Sendmail compatibility</primary>
4064 <secondary><quote>From</quote> line</secondary>
4065 </indexterm>
4066 of the message must be as defined in RFC 2822, except that, for
4067 compatibility with Sendmail and Smail, a line in one of the forms
4068 </para>
4069 <literallayout class="monospaced">
4070 From sender Fri Jan  5 12:55 GMT 1997
4071 From sender Fri, 5 Jan 97 12:55:01
4072 </literallayout>
4073 <para>
4074 (with the weekday optional, and possibly with additional text after the date)
4075 is permitted to appear at the start of the message. There appears to be no
4076 authoritative specification of the format of this line. Exim recognizes it by
4077 matching against the regular expression defined by the <option>uucp_from_pattern</option>
4078 option, which can be changed if necessary.
4079 </para>
4080 <para>
4081 <indexterm role="option">
4082 <primary><option>-f</option></primary>
4083 <secondary>overriding <quote>From</quote> line</secondary>
4084 </indexterm>
4085 The specified sender is treated as if it were given as the argument to the
4086 <option>-f</option> option, but if a <option>-f</option> option is also present, its argument is used in
4087 preference to the address taken from the message. The caller of Exim must be a
4088 trusted user for the sender of a message to be set in this way.
4089 </para>
4090 </listitem></varlistentry>
4091 <varlistentry>
4092 <term><option>-bnq</option></term>
4093 <listitem>
4094 <para>
4095 <indexterm role="option">
4096 <primary><option>-bnq</option></primary>
4097 </indexterm>
4098 <indexterm role="concept">
4099 <primary>address qualification, suppressing</primary>
4100 </indexterm>
4101 By default, Exim automatically qualifies unqualified addresses (those
4102 without domains) that appear in messages that are submitted locally (that
4103 is, not over TCP/IP). This qualification applies both to addresses in
4104 envelopes, and addresses in header lines. Sender addresses are qualified using
4105 <option>qualify_domain</option>, and recipient addresses using <option>qualify_recipient</option> (which
4106 defaults to the value of <option>qualify_domain</option>).
4107 </para>
4108 <para>
4109 Sometimes, qualification is not wanted. For example, if <option>-bS</option> (batch SMTP) is
4110 being used to re-submit messages that originally came from remote hosts after
4111 content scanning, you probably do not want to qualify unqualified addresses in
4112 header lines. (Such lines will be present only if you have not enabled a header
4113 syntax check in the appropriate ACL.)
4114 </para>
4115 <para>
4116 The <option>-bnq</option> option suppresses all qualification of unqualified addresses in
4117 messages that originate on the local host. When this is used, unqualified
4118 addresses in the envelope provoke errors (causing message rejection) and
4119 unqualified addresses in header lines are left alone.
4120 </para>
4121 </listitem></varlistentry>
4122 <varlistentry>
4123 <term><option>-bP</option></term>
4124 <listitem>
4125 <para>
4126 <indexterm role="option">
4127 <primary><option>-bP</option></primary>
4128 </indexterm>
4129 <indexterm role="concept">
4130 <primary>configuration options</primary>
4131 <secondary>extracting</secondary>
4132 </indexterm>
4133 <indexterm role="concept">
4134 <primary>options</primary>
4135 <secondary>configuration &ndash; extracting</secondary>
4136 </indexterm>
4137 If this option is given with no arguments, it causes the values of all Exim&#x2019;s
4138 main configuration options to be written to the standard output. The values
4139 of one or more specific options can be requested by giving their names as
4140 arguments, for example:
4141 </para>
4142 <literallayout class="monospaced">
4143 exim -bP qualify_domain hold_domains
4144 </literallayout>
4145 <para>
4146 <indexterm role="concept">
4147 <primary>hiding configuration option values</primary>
4148 </indexterm>
4149 <indexterm role="concept">
4150 <primary>configuration options</primary>
4151 <secondary>hiding value of</secondary>
4152 </indexterm>
4153 <indexterm role="concept">
4154 <primary>options</primary>
4155 <secondary>hiding value of</secondary>
4156 </indexterm>
4157 However, any option setting that is preceded by the word <quote>hide</quote> in the
4158 configuration file is not shown in full, except to an admin user. For other
4159 users, the output is as in this example:
4160 </para>
4161 <literallayout class="monospaced">
4162 mysql_servers = &lt;value not displayable&gt;
4163 </literallayout>
4164 <para>
4165 If <option>configure_file</option> is given as an argument, the name of the run time
4166 configuration file is output.
4167 If a list of configuration files was supplied, the value that is output here
4168 is the name of the file that was actually used.
4169 </para>
4170 <para>
4171 <indexterm role="concept">
4172 <primary>daemon</primary>
4173 <secondary>process id (pid)</secondary>
4174 </indexterm>
4175 <indexterm role="concept">
4176 <primary>pid (process id)</primary>
4177 <secondary>of daemon</secondary>
4178 </indexterm>
4179 If <option>log_file_path</option> or <option>pid_file_path</option> are given, the names of the
4180 directories where log files and daemon pid files are written are output,
4181 respectively. If these values are unset, log files are written in a
4182 sub-directory of the spool directory called <option>log</option>, and the pid file is
4183 written directly into the spool directory.
4184 </para>
4185 <para>
4186 If <option>-bP</option> is followed by a name preceded by <literal>+</literal>, for example,
4187 </para>
4188 <literallayout class="monospaced">
4189 exim -bP +local_domains
4190 </literallayout>
4191 <para>
4192 it searches for a matching named list of any type (domain, host, address, or
4193 local part) and outputs what it finds.
4194 </para>
4195 <para>
4196 <indexterm role="concept">
4197 <primary>options</primary>
4198 <secondary>router &ndash; extracting</secondary>
4199 </indexterm>
4200 <indexterm role="concept">
4201 <primary>options</primary>
4202 <secondary>transport &ndash; extracting</secondary>
4203 </indexterm>
4204 <indexterm role="concept">
4205 <primary>options</primary>
4206 <secondary>authenticator &ndash; extracting</secondary>
4207 </indexterm>
4208 If one of the words <option>router</option>, <option>transport</option>, or <option>authenticator</option> is given,
4209 followed by the name of an appropriate driver instance, the option settings for
4210 that driver are output. For example:
4211 </para>
4212 <literallayout class="monospaced">
4213 exim -bP transport local_delivery
4214 </literallayout>
4215 <para>
4216 The generic driver options are output first, followed by the driver&#x2019;s private
4217 options. A list of the names of drivers of a particular type can be obtained by
4218 using one of the words <option>router_list</option>, <option>transport_list</option>, or
4219 <option>authenticator_list</option>, and a complete list of all drivers with their option
4220 settings can be obtained by using <option>routers</option>, <option>transports</option>, or
4221 <option>authenticators</option>.
4222 </para>
4223 <para>
4224 <indexterm role="concept">
4225 <primary>options</primary>
4226 <secondary>macro &ndash; extracting</secondary>
4227 </indexterm>
4228 If invoked by an admin user, then <option>macro</option>, <option>macro_list</option> and <option>macros</option>
4229 are available, similarly to the drivers.  Because macros are sometimes used
4230 for storing passwords, this option is restricted.
4231 The output format is one item per line.
4232 </para>
4233 </listitem></varlistentry>
4234 <varlistentry>
4235 <term><option>-bp</option></term>
4236 <listitem>
4237 <para>
4238 <indexterm role="option">
4239 <primary><option>-bp</option></primary>
4240 </indexterm>
4241 <indexterm role="concept">
4242 <primary>queue</primary>
4243 <secondary>listing messages on</secondary>
4244 </indexterm>
4245 <indexterm role="concept">
4246 <primary>listing</primary>
4247 <secondary>messages on the queue</secondary>
4248 </indexterm>
4249 This option requests a listing of the contents of the mail queue on the
4250 standard output. If the <option>-bp</option> option is followed by a list of message ids,
4251 just those messages are listed. By default, this option can be used only by an
4252 admin user. However, the <option>queue_list_requires_admin</option> option can be set false
4253 to allow any user to see the queue.
4254 </para>
4255 <para>
4256 Each message on the queue is displayed as in the following example:
4257 </para>
4258 <literallayout class="monospaced">
4259 25m  2.9K 0t5C6f-0000c8-00 &lt;alice@wonderland.fict.example&gt;
4260           red.king@looking-glass.fict.example
4261           &lt;other addresses&gt;
4262 </literallayout>
4263 <para>
4264 <indexterm role="concept">
4265 <primary>message</primary>
4266 <secondary>size in queue listing</secondary>
4267 </indexterm>
4268 <indexterm role="concept">
4269 <primary>size</primary>
4270 <secondary>of message</secondary>
4271 </indexterm>
4272 The first line contains the length of time the message has been on the queue
4273 (in this case 25 minutes), the size of the message (2.9K), the unique local
4274 identifier for the message, and the message sender, as contained in the
4275 envelope. For bounce messages, the sender address is empty, and appears as
4276 <quote>&lt;&gt;</quote>. If the message was submitted locally by an untrusted user who overrode
4277 the default sender address, the user&#x2019;s login name is shown in parentheses
4278 before the sender address.
4279 </para>
4280 <para>
4281 <indexterm role="concept">
4282 <primary>frozen messages</primary>
4283 <secondary>in queue listing</secondary>
4284 </indexterm>
4285 If the message is frozen (attempts to deliver it are suspended) then the text
4286 <quote>*** frozen ***</quote> is displayed at the end of this line.
4287 </para>
4288 <para>
4289 The recipients of the message (taken from the envelope, not the headers) are
4290 displayed on subsequent lines. Those addresses to which the message has already
4291 been delivered are marked with the letter D. If an original address gets
4292 expanded into several addresses via an alias or forward file, the original is
4293 displayed with a D only when deliveries for all of its child addresses are
4294 complete.
4295 </para>
4296 </listitem></varlistentry>
4297 <varlistentry>
4298 <term><option>-bpa</option></term>
4299 <listitem>
4300 <para>
4301 <indexterm role="option">
4302 <primary><option>-bpa</option></primary>
4303 </indexterm>
4304 This option operates like <option>-bp</option>, but in addition it shows delivered addresses
4305 that were generated from the original top level address(es) in each message by
4306 alias or forwarding operations. These addresses are flagged with <quote>+D</quote> instead
4307 of just <quote>D</quote>.
4308 </para>
4309 </listitem></varlistentry>
4310 <varlistentry>
4311 <term><option>-bpc</option></term>
4312 <listitem>
4313 <para>
4314 <indexterm role="option">
4315 <primary><option>-bpc</option></primary>
4316 </indexterm>
4317 <indexterm role="concept">
4318 <primary>queue</primary>
4319 <secondary>count of messages on</secondary>
4320 </indexterm>
4321 This option counts the number of messages on the queue, and writes the total
4322 to the standard output. It is restricted to admin users, unless
4323 <option>queue_list_requires_admin</option> is set false.
4324 </para>
4325 </listitem></varlistentry>
4326 <varlistentry>
4327 <term><option>-bpr</option></term>
4328 <listitem>
4329 <para>
4330 <indexterm role="option">
4331 <primary><option>-bpr</option></primary>
4332 </indexterm>
4333 This option operates like <option>-bp</option>, but the output is not sorted into
4334 chronological order of message arrival. This can speed it up when there are
4335 lots of messages on the queue, and is particularly useful if the output is
4336 going to be post-processed in a way that doesn&#x2019;t need the sorting.
4337 </para>
4338 </listitem></varlistentry>
4339 <varlistentry>
4340 <term><option>-bpra</option></term>
4341 <listitem>
4342 <para>
4343 <indexterm role="option">
4344 <primary><option>-bpra</option></primary>
4345 </indexterm>
4346 This option is a combination of <option>-bpr</option> and <option>-bpa</option>.
4347 </para>
4348 </listitem></varlistentry>
4349 <varlistentry>
4350 <term><option>-bpru</option></term>
4351 <listitem>
4352 <para>
4353 <indexterm role="option">
4354 <primary><option>-bpru</option></primary>
4355 </indexterm>
4356 This option is a combination of <option>-bpr</option> and <option>-bpu</option>.
4357 </para>
4358 </listitem></varlistentry>
4359 <varlistentry>
4360 <term><option>-bpu</option></term>
4361 <listitem>
4362 <para>
4363 <indexterm role="option">
4364 <primary><option>-bpu</option></primary>
4365 </indexterm>
4366 This option operates like <option>-bp</option> but shows only undelivered top-level
4367 addresses for each message displayed. Addresses generated by aliasing or
4368 forwarding are not shown, unless the message was deferred after processing by a
4369 router with the <option>one_time</option> option set.
4370 </para>
4371 </listitem></varlistentry>
4372 <varlistentry>
4373 <term><option>-brt</option></term>
4374 <listitem>
4375 <para>
4376 <indexterm role="option">
4377 <primary><option>-brt</option></primary>
4378 </indexterm>
4379 <indexterm role="concept">
4380 <primary>testing</primary>
4381 <secondary>retry configuration</secondary>
4382 </indexterm>
4383 <indexterm role="concept">
4384 <primary>retry</primary>
4385 <secondary>configuration testing</secondary>
4386 </indexterm>
4387 This option is for testing retry rules, and it must be followed by up to three
4388 arguments. It causes Exim to look for a retry rule that matches the values
4389 and to write it to the standard output. For example:
4390 </para>
4391 <literallayout class="monospaced">
4392 exim -brt bach.comp.mus.example
4393 Retry rule: *.comp.mus.example  F,2h,15m; F,4d,30m;
4394 </literallayout>
4395 <para>
4396 See chapter <xref linkend="CHAPretry"/> for a description of Exim&#x2019;s retry rules. The first
4397 argument, which is required, can be a complete address in the form
4398 <emphasis>local_part@domain</emphasis>, or it can be just a domain name. If the second argument
4399 contains a dot, it is interpreted as an optional second domain name; if no
4400 retry rule is found for the first argument, the second is tried. This ties in
4401 with Exim&#x2019;s behaviour when looking for retry rules for remote hosts &ndash; if no
4402 rule is found that matches the host, one that matches the mail domain is
4403 sought. Finally, an argument that is the name of a specific delivery error, as
4404 used in setting up retry rules, can be given. For example:
4405 </para>
4406 <literallayout class="monospaced">
4407 exim -brt haydn.comp.mus.example quota_3d
4408 Retry rule: *@haydn.comp.mus.example quota_3d  F,1h,15m
4409 </literallayout>
4410 </listitem></varlistentry>
4411 <varlistentry>
4412 <term><option>-brw</option></term>
4413 <listitem>
4414 <para>
4415 <indexterm role="option">
4416 <primary><option>-brw</option></primary>
4417 </indexterm>
4418 <indexterm role="concept">
4419 <primary>testing</primary>
4420 <secondary>rewriting</secondary>
4421 </indexterm>
4422 <indexterm role="concept">
4423 <primary>rewriting</primary>
4424 <secondary>testing</secondary>
4425 </indexterm>
4426 This option is for testing address rewriting rules, and it must be followed by
4427 a single argument, consisting of either a local part without a domain, or a
4428 complete address with a fully qualified domain. Exim outputs how this address
4429 would be rewritten for each possible place it might appear. See chapter
4430 <xref linkend="CHAPrewrite"/> for further details.
4431 </para>
4432 </listitem></varlistentry>
4433 <varlistentry>
4434 <term><option>-bS</option></term>
4435 <listitem>
4436 <para>
4437 <indexterm role="option">
4438 <primary><option>-bS</option></primary>
4439 </indexterm>
4440 <indexterm role="concept">
4441 <primary>SMTP</primary>
4442 <secondary>batched incoming</secondary>
4443 </indexterm>
4444 <indexterm role="concept">
4445 <primary>batched SMTP input</primary>
4446 </indexterm>
4447 This option is used for batched SMTP input, which is an alternative interface
4448 for non-interactive local message submission. A number of messages can be
4449 submitted in a single run. However, despite its name, this is not really SMTP
4450 input. Exim reads each message&#x2019;s envelope from SMTP commands on the standard
4451 input, but generates no responses. If the caller is trusted, or
4452 <option>untrusted_set_sender</option> is set, the senders in the SMTP MAIL commands are
4453 believed; otherwise the sender is always the caller of Exim.
4454 </para>
4455 <para>
4456 The message itself is read from the standard input, in SMTP format (leading
4457 dots doubled), terminated by a line containing just a single dot. An error is
4458 provoked if the terminating dot is missing. A further message may then follow.
4459 </para>
4460 <para>
4461 As for other local message submissions, the contents of incoming batch SMTP
4462 messages can be checked using the non-SMTP ACL (see chapter <xref linkend="CHAPACL"/>).
4463 Unqualified addresses are automatically qualified using <option>qualify_domain</option> and
4464 <option>qualify_recipient</option>, as appropriate, unless the <option>-bnq</option> option is used.
4465 </para>
4466 <para>
4467 Some other SMTP commands are recognized in the input. HELO and EHLO act
4468 as RSET; VRFY, EXPN, ETRN, and HELP act as NOOP;
4469 QUIT quits, ignoring the rest of the standard input.
4470 </para>
4471 <para>
4472 <indexterm role="concept">
4473 <primary>return code</primary>
4474 <secondary>for <option>-bS</option></secondary>
4475 </indexterm>
4476 If any error is encountered, reports are written to the standard output and
4477 error streams, and Exim gives up immediately. The return code is 0 if no error
4478 was detected; it is 1 if one or more messages were accepted before the error
4479 was detected; otherwise it is 2.
4480 </para>
4481 <para>
4482 More details of input using batched SMTP are given in section
4483 <xref linkend="SECTincomingbatchedSMTP"/>.
4484 </para>
4485 </listitem></varlistentry>
4486 <varlistentry>
4487 <term><option>-bs</option></term>
4488 <listitem>
4489 <para>
4490 <indexterm role="option">
4491 <primary><option>-bs</option></primary>
4492 </indexterm>
4493 <indexterm role="concept">
4494 <primary>SMTP</primary>
4495 <secondary>local input</secondary>
4496 </indexterm>
4497 <indexterm role="concept">
4498 <primary>local SMTP input</primary>
4499 </indexterm>
4500 This option causes Exim to accept one or more messages by reading SMTP commands
4501 on the standard input, and producing SMTP replies on the standard output. SMTP
4502 policy controls, as defined in ACLs (see chapter <xref linkend="CHAPACL"/>) are applied.
4503 Some user agents use this interface as a way of passing locally-generated
4504 messages to the MTA.
4505 </para>
4506 <para>
4507 In
4508 <indexterm role="concept">
4509 <primary>sender</primary>
4510 <secondary>source of</secondary>
4511 </indexterm>
4512 this usage, if the caller of Exim is trusted, or <option>untrusted_set_sender</option> is
4513 set, the senders of messages are taken from the SMTP MAIL commands.
4514 Otherwise the content of these commands is ignored and the sender is set up as
4515 the calling user. Unqualified addresses are automatically qualified using
4516 <option>qualify_domain</option> and <option>qualify_recipient</option>, as appropriate, unless the
4517 <option>-bnq</option> option is used.
4518 </para>
4519 <para>
4520 <indexterm role="concept">
4521 <primary>inetd</primary>
4522 </indexterm>
4523 The
4524 <option>-bs</option> option is also used to run Exim from <emphasis>inetd</emphasis>, as an alternative to
4525 using a listening daemon. Exim can distinguish the two cases by checking
4526 whether the standard input is a TCP/IP socket. When Exim is called from
4527 <emphasis>inetd</emphasis>, the source of the mail is assumed to be remote, and the comments
4528 above concerning senders and qualification do not apply. In this situation,
4529 Exim behaves in exactly the same way as it does when receiving a message via
4530 the listening daemon.
4531 </para>
4532 </listitem></varlistentry>
4533 <varlistentry>
4534 <term><option>-bt</option></term>
4535 <listitem>
4536 <para>
4537 <indexterm role="option">
4538 <primary><option>-bt</option></primary>
4539 </indexterm>
4540 <indexterm role="concept">
4541 <primary>testing</primary>
4542 <secondary>addresses</secondary>
4543 </indexterm>
4544 <indexterm role="concept">
4545 <primary>address</primary>
4546 <secondary>testing</secondary>
4547 </indexterm>
4548 This option runs Exim in address testing mode, in which each argument is taken
4549 as a recipient address to be tested for deliverability. The results are
4550 written to the standard output. If a test fails, and the caller is not an admin
4551 user, no details of the failure are output, because these might contain
4552 sensitive information such as usernames and passwords for database lookups.
4553 </para>
4554 <para>
4555 If no arguments are given, Exim runs in an interactive manner, prompting with a
4556 right angle bracket for addresses to be tested.
4557 </para>
4558 <para>
4559 Unlike the <option>-be</option> test option, you cannot arrange for Exim to use the
4560 <function>readline()</function> function, because it is running as <emphasis>root</emphasis> and there are
4561 security issues.
4562 </para>
4563 <para>
4564 Each address is handled as if it were the recipient address of a message
4565 (compare the <option>-bv</option> option). It is passed to the routers and the result is
4566 written to the standard output. However, any router that has
4567 <option>no_address_test</option> set is bypassed. This can make <option>-bt</option> easier to use for
4568 genuine routing tests if your first router passes everything to a scanner
4569 program.
4570 </para>
4571 <para>
4572 <indexterm role="concept">
4573 <primary>return code</primary>
4574 <secondary>for <option>-bt</option></secondary>
4575 </indexterm>
4576 The return code is 2 if any address failed outright; it is 1 if no address
4577 failed outright but at least one could not be resolved for some reason. Return
4578 code 0 is given only when all addresses succeed.
4579 </para>
4580 <para>
4581 <indexterm role="concept">
4582 <primary>duplicate addresses</primary>
4583 </indexterm>
4584 <emphasis role="bold">Note</emphasis>: When actually delivering a message, Exim removes duplicate recipient
4585 addresses after routing is complete, so that only one delivery takes place.
4586 This does not happen when testing with <option>-bt</option>; the full results of routing are
4587 always shown.
4588 </para>
4589 <para>
4590 <emphasis role="bold">Warning</emphasis>: <option>-bt</option> can only do relatively simple testing. If any of the
4591 routers in the configuration makes any tests on the sender address of a
4592 message,
4593 <indexterm role="option">
4594 <primary><option>-f</option></primary>
4595 <secondary>for address testing</secondary>
4596 </indexterm>
4597 you can use the <option>-f</option> option to set an appropriate sender when running
4598 <option>-bt</option> tests. Without it, the sender is assumed to be the calling user at the
4599 default qualifying domain. However, if you have set up (for example) routers
4600 whose behaviour depends on the contents of an incoming message, you cannot test
4601 those conditions using <option>-bt</option>. The <option>-N</option> option provides a possible way of
4602 doing such tests.
4603 </para>
4604 </listitem></varlistentry>
4605 <varlistentry>
4606 <term><option>-bV</option></term>
4607 <listitem>
4608 <para>
4609 <indexterm role="option">
4610 <primary><option>-bV</option></primary>
4611 </indexterm>
4612 <indexterm role="concept">
4613 <primary>version number of Exim</primary>
4614 </indexterm>
4615 This option causes Exim to write the current version number, compilation
4616 number, and compilation date of the <emphasis>exim</emphasis> binary to the standard output.
4617 It also lists the DBM library this is being used, the optional modules (such as
4618 specific lookup types), the drivers that are included in the binary, and the
4619 name of the run time configuration file that is in use.
4620 </para>
4621 <para>
4622 As part of its operation, <option>-bV</option> causes Exim to read and syntax check its
4623 configuration file. However, this is a static check only. It cannot check
4624 values that are to be expanded. For example, although a misspelt ACL verb is
4625 detected, an error in the verb&#x2019;s arguments is not. You cannot rely on <option>-bV</option>
4626 alone to discover (for example) all the typos in the configuration; some
4627 realistic testing is needed. The <option>-bh</option> and <option>-N</option> options provide more
4628 dynamic testing facilities.
4629 </para>
4630 </listitem></varlistentry>
4631 <varlistentry>
4632 <term><option>-bv</option></term>
4633 <listitem>
4634 <para>
4635 <indexterm role="option">
4636 <primary><option>-bv</option></primary>
4637 </indexterm>
4638 <indexterm role="concept">
4639 <primary>verifying address</primary>
4640 <secondary>using <option>-bv</option></secondary>
4641 </indexterm>
4642 <indexterm role="concept">
4643 <primary>address</primary>
4644 <secondary>verification</secondary>
4645 </indexterm>
4646 This option runs Exim in address verification mode, in which each argument is
4647 taken as a recipient address to be verified by the routers. (This does
4648 not involve any verification callouts). During normal operation, verification
4649 happens mostly as a consequence processing a <option>verify</option> condition in an ACL
4650 (see chapter <xref linkend="CHAPACL"/>). If you want to test an entire ACL, possibly
4651 including callouts, see the <option>-bh</option> and <option>-bhc</option> options.
4652 </para>
4653 <para>
4654 If verification fails, and the caller is not an admin user, no details of the
4655 failure are output, because these might contain sensitive information such as
4656 usernames and passwords for database lookups.
4657 </para>
4658 <para>
4659 If no arguments are given, Exim runs in an interactive manner, prompting with a
4660 right angle bracket for addresses to be verified.
4661 </para>
4662 <para>
4663 Unlike the <option>-be</option> test option, you cannot arrange for Exim to use the
4664 <function>readline()</function> function, because it is running as <emphasis>exim</emphasis> and there are
4665 security issues.
4666 </para>
4667 <para>
4668 Verification differs from address testing (the <option>-bt</option> option) in that routers
4669 that have <option>no_verify</option> set are skipped, and if the address is accepted by a
4670 router that has <option>fail_verify</option> set, verification fails. The address is
4671 verified as a recipient if <option>-bv</option> is used; to test verification for a sender
4672 address, <option>-bvs</option> should be used.
4673 </para>
4674 <para>
4675 If the <option>-v</option> option is not set, the output consists of a single line for each
4676 address, stating whether it was verified or not, and giving a reason in the
4677 latter case. Without <option>-v</option>, generating more than one address by redirection
4678 causes verification to end successfully, without considering the generated
4679 addresses. However, if just one address is generated, processing continues,
4680 and the generated address must verify successfully for the overall verification
4681 to succeed.
4682 </para>
4683 <para>
4684 When <option>-v</option> is set, more details are given of how the address has been handled,
4685 and in the case of address redirection, all the generated addresses are also
4686 considered. Verification may succeed for some and fail for others.
4687 </para>
4688 <para>
4689 The
4690 <indexterm role="concept">
4691 <primary>return code</primary>
4692 <secondary>for <option>-bv</option></secondary>
4693 </indexterm>
4694 return code is 2 if any address failed outright; it is 1 if no address
4695 failed outright but at least one could not be resolved for some reason. Return
4696 code 0 is given only when all addresses succeed.
4697 </para>
4698 <para>
4699 If any of the routers in the configuration makes any tests on the sender
4700 address of a message, you should use the <option>-f</option> option to set an appropriate
4701 sender when running <option>-bv</option> tests. Without it, the sender is assumed to be the
4702 calling user at the default qualifying domain.
4703 </para>
4704 </listitem></varlistentry>
4705 <varlistentry>
4706 <term><option>-bvs</option></term>
4707 <listitem>
4708 <para>
4709 <indexterm role="option">
4710 <primary><option>-bvs</option></primary>
4711 </indexterm>
4712 This option acts like <option>-bv</option>, but verifies the address as a sender rather
4713 than a recipient address. This affects any rewriting and qualification that
4714 might happen.
4715 </para>
4716 </listitem></varlistentry>
4717 <varlistentry>
4718 <term><option>-C</option>&nbsp;&lt;<emphasis>filelist</emphasis>&gt;</term>
4719 <listitem>
4720 <para>
4721 <indexterm role="option">
4722 <primary><option>-C</option></primary>
4723 </indexterm>
4724 <indexterm role="concept">
4725 <primary>configuration file</primary>
4726 <secondary>alternate</secondary>
4727 </indexterm>
4728 <indexterm role="concept">
4729 <primary>CONFIGURE_FILE</primary>
4730 </indexterm>
4731 <indexterm role="concept">
4732 <primary>alternate configuration file</primary>
4733 </indexterm>
4734 This option causes Exim to find the run time configuration file from the given
4735 list instead of from the list specified by the CONFIGURE_FILE
4736 compile-time setting. Usually, the list will consist of just a single file
4737 name, but it can be a colon-separated list of names. In this case, the first
4738 file that exists is used. Failure to open an existing file stops Exim from
4739 proceeding any further along the list, and an error is generated.
4740 </para>
4741 <para>
4742 When this option is used by a caller other than root or the Exim user, and the
4743 list is different from the compiled-in list, Exim gives up its root privilege
4744 immediately, and runs with the real and effective uid and gid set to those of
4745 the caller. However, if ALT_CONFIG_ROOT_ONLY is defined in
4746 <filename>Local/Makefile</filename>, root privilege is retained for <option>-C</option> only if the caller of
4747 Exim is root.
4748 </para>
4749 <para>
4750 That is, the Exim user is no longer privileged in this regard. This build-time
4751 option is not set by default in the Exim source distribution tarbundle.
4752 However, if you are using a <quote>packaged</quote> version of Exim (source or binary),
4753 the packagers might have enabled it.
4754 </para>
4755 <para>
4756 Setting ALT_CONFIG_ROOT_ONLY locks out the possibility of testing a
4757 configuration using <option>-C</option> right through message reception and delivery, even
4758 if the caller is root. The reception works, but by that time, Exim is running
4759 as the Exim user, so when it re-executes to regain privilege for the delivery,
4760 the use of <option>-C</option> causes privilege to be lost. However, root can test reception
4761 and delivery using two separate commands (one to put a message on the queue,
4762 using <option>-odq</option>, and another to do the delivery, using <option>-M</option>).
4763 </para>
4764 <para>
4765 If ALT_CONFIG_PREFIX is defined <filename>in Local/Makefile</filename>, it specifies a
4766 prefix string with which any file named in a <option>-C</option> command line option
4767 must start. In addition, the file name must not contain the sequence <literal>/../</literal>.
4768 However, if the value of the <option>-C</option> option is identical to the value of
4769 CONFIGURE_FILE in <filename>Local/Makefile</filename>, Exim ignores <option>-C</option> and proceeds as
4770 usual. There is no default setting for ALT_CONFIG_PREFIX; when it is
4771 unset, any file name can be used with <option>-C</option>.
4772 </para>
4773 <para>
4774 ALT_CONFIG_PREFIX can be used to confine alternative configuration files
4775 to a directory to which only root has access. This prevents someone who has
4776 broken into the Exim account from running a privileged Exim with an arbitrary
4777 configuration file.
4778 </para>
4779 <para>
4780 The <option>-C</option> facility is useful for ensuring that configuration files are
4781 syntactically correct, but cannot be used for test deliveries, unless the
4782 caller is privileged, or unless it is an exotic configuration that does not
4783 require privilege. No check is made on the owner or group of the files
4784 specified by this option.
4785 </para>
4786 </listitem></varlistentry>
4787 <varlistentry>
4788 <term><option>-D</option>&lt;<emphasis>macro</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt;</term>
4789 <listitem>
4790 <para>
4791 <indexterm role="option">
4792 <primary><option>-D</option></primary>
4793 </indexterm>
4794 <indexterm role="concept">
4795 <primary>macro</primary>
4796 <secondary>setting on command line</secondary>
4797 </indexterm>
4798 This option can be used to override macro definitions in the configuration file
4799 (see section <xref linkend="SECTmacrodefs"/>). However, like <option>-C</option>, if it is used by an
4800 unprivileged caller, it causes Exim to give up its root privilege.
4801 If DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the use of <option>-D</option> is
4802 completely disabled, and its use causes an immediate error exit.
4803 </para>
4804 <para>
4805 The entire option (including equals sign if present) must all be within one
4806 command line item. <option>-D</option> can be used to set the value of a macro to the empty
4807 string, in which case the equals sign is optional. These two commands are
4808 synonymous:
4809 </para>
4810 <literallayout class="monospaced">
4811 exim -DABC  ...
4812 exim -DABC= ...
4813 </literallayout>
4814 <para>
4815 To include spaces in a macro definition item, quotes must be used. If you use
4816 quotes, spaces are permitted around the macro name and the equals sign. For
4817 example:
4818 </para>
4819 <literallayout class="monospaced">
4820 exim '-D ABC = something' ...
4821 </literallayout>
4822 <para>
4823 <option>-D</option> may be repeated up to 10 times on a command line.
4824 </para>
4825 </listitem></varlistentry>
4826 <varlistentry>
4827 <term><option>-d</option>&lt;<emphasis>debug&nbsp;options</emphasis>&gt;</term>
4828 <listitem>
4829 <para>
4830 <indexterm role="option">
4831 <primary><option>-d</option></primary>
4832 </indexterm>
4833 <indexterm role="concept">
4834 <primary>debugging</primary>
4835 <secondary>list of selectors</secondary>
4836 </indexterm>
4837 <indexterm role="concept">
4838 <primary>debugging</primary>
4839 <secondary><option>-d</option> option</secondary>
4840 </indexterm>
4841 This option causes debugging information to be written to the standard
4842 error stream. It is restricted to admin users because debugging output may show
4843 database queries that contain password information. Also, the details of users&#x2019;
4844 filter files should be protected. If a non-admin user uses <option>-d</option>, Exim
4845 writes an error message to the standard error stream and exits with a non-zero
4846 return code.
4847 </para>
4848 <para>
4849 When <option>-d</option> is used, <option>-v</option> is assumed. If <option>-d</option> is given on its own, a lot of
4850 standard debugging data is output. This can be reduced, or increased to include
4851 some more rarely needed information, by directly following <option>-d</option> with a string
4852 made up of names preceded by plus or minus characters. These add or remove sets
4853 of debugging data, respectively. For example, <option>-d+filter</option> adds filter
4854 debugging, whereas <option>-d-all+filter</option> selects only filter debugging. Note that
4855 no spaces are allowed in the debug setting. The available debugging categories
4856 are:
4857 </para>
4858 <literallayout>
4859 <literal>acl            </literal> ACL interpretation
4860 <literal>auth           </literal> authenticators
4861 <literal>deliver        </literal> general delivery logic
4862 <literal>dns            </literal> DNS lookups (see also resolver)
4863 <literal>dnsbl          </literal> DNS black list (aka RBL) code
4864 <literal>exec           </literal> arguments for <function>execv()</function> calls
4865 <literal>expand         </literal> detailed debugging for string expansions
4866 <literal>filter         </literal> filter handling
4867 <literal>hints_lookup   </literal> hints data lookups
4868 <literal>host_lookup    </literal> all types of name-to-IP address handling
4869 <literal>ident          </literal> ident lookup
4870 <literal>interface      </literal> lists of local interfaces
4871 <literal>lists          </literal> matching things in lists
4872 <literal>load           </literal> system load checks
4873 <literal>local_scan     </literal> can be used by <function>local_scan()</function> (see chapter <xref linkend="CHAPlocalscan"/>)
4874 <literal>lookup         </literal> general lookup code and all lookups
4875 <literal>memory         </literal> memory handling
4876 <literal>pid            </literal> add pid to debug output lines
4877 <literal>process_info   </literal> setting info for the process log
4878 <literal>queue_run      </literal> queue runs
4879 <literal>receive        </literal> general message reception logic
4880 <literal>resolver       </literal> turn on the DNS resolver&#x2019;s debugging output
4881 <literal>retry          </literal> retry handling
4882 <literal>rewrite        </literal> address rewriting
4883 <literal>route          </literal> address routing
4884 <literal>timestamp      </literal> add timestamp to debug output lines
4885 <literal>tls            </literal> TLS logic
4886 <literal>transport      </literal> transports
4887 <literal>uid            </literal> changes of uid/gid and looking up uid/gid
4888 <literal>verify         </literal> address verification logic
4889 <literal>all            </literal> almost all of the above (see below), and also <option>-v</option>
4890 </literallayout>
4891 <para>
4892 The <literal>all</literal> option excludes <literal>memory</literal> when used as <literal>+all</literal>, but includes it
4893 for <literal>-all</literal>. The reason for this is that <literal>+all</literal> is something that people
4894 tend to use when generating debug output for Exim maintainers. If <literal>+memory</literal>
4895 is included, an awful lot of output that is very rarely of interest is
4896 generated, so it now has to be explicitly requested. However, <literal>-all</literal> does
4897 turn everything off.
4898 </para>
4899 <para>
4900 <indexterm role="concept">
4901 <primary>resolver, debugging output</primary>
4902 </indexterm>
4903 <indexterm role="concept">
4904 <primary>DNS resolver, debugging output</primary>
4905 </indexterm>
4906 The <literal>resolver</literal> option produces output only if the DNS resolver was compiled
4907 with DEBUG enabled. This is not the case in some operating systems. Also,
4908 unfortunately, debugging output from the DNS resolver is written to stdout
4909 rather than stderr.
4910 </para>
4911 <para>
4912 The default (<option>-d</option> with no argument) omits <literal>expand</literal>, <literal>filter</literal>,
4913 <literal>interface</literal>, <literal>load</literal>, <literal>memory</literal>, <literal>pid</literal>, <literal>resolver</literal>, and <literal>timestamp</literal>.
4914 However, the <literal>pid</literal> selector is forced when debugging is turned on for a
4915 daemon, which then passes it on to any re-executed Exims. Exim also
4916 automatically adds the pid to debug lines when several remote deliveries are
4917 run in parallel.
4918 </para>
4919 <para>
4920 The <literal>timestamp</literal> selector causes the current time to be inserted at the start
4921 of all debug output lines. This can be useful when trying to track down delays
4922 in processing.
4923 </para>
4924 <para>
4925 If the <option>debug_print</option> option is set in any driver, it produces output whenever
4926 any debugging is selected, or if <option>-v</option> is used.
4927 </para>
4928 </listitem></varlistentry>
4929 <varlistentry>
4930 <term><option>-dd</option>&lt;<emphasis>debug&nbsp;options</emphasis>&gt;</term>
4931 <listitem>
4932 <para>
4933 <indexterm role="option">
4934 <primary><option>-dd</option></primary>
4935 </indexterm>
4936 This option behaves exactly like <option>-d</option> except when used on a command that
4937 starts a daemon process. In that case, debugging is turned off for the
4938 subprocesses that the daemon creates. Thus, it is useful for monitoring the
4939 behaviour of the daemon without creating as much output as full debugging does.
4940 </para>
4941 </listitem></varlistentry>
4942 <varlistentry>
4943 <term><option>-dropcr</option></term>
4944 <listitem>
4945 <para>
4946 <indexterm role="option">
4947 <primary><option>-dropcr</option></primary>
4948 </indexterm>
4949 This is an obsolete option that is now a no-op. It used to affect the way Exim
4950 handled CR and LF characters in incoming messages. What happens now is
4951 described in section <xref linkend="SECTlineendings"/>.
4952 </para>
4953 </listitem></varlistentry>
4954 <varlistentry>
4955 <term><option>-E</option></term>
4956 <listitem>
4957 <para>
4958 <indexterm role="option">
4959 <primary><option>-E</option></primary>
4960 </indexterm>
4961 <indexterm role="concept">
4962 <primary>bounce message</primary>
4963 <secondary>generating</secondary>
4964 </indexterm>
4965 This option specifies that an incoming message is a locally-generated delivery
4966 failure report. It is used internally by Exim when handling delivery failures
4967 and is not intended for external use. Its only effect is to stop Exim
4968 generating certain messages to the postmaster, as otherwise message cascades
4969 could occur in some situations. As part of the same option, a message id may
4970 follow the characters <option>-E</option>. If it does, the log entry for the receipt of the
4971 new message contains the id, following <quote>R=</quote>, as a cross-reference.
4972 </para>
4973 </listitem></varlistentry>
4974 <varlistentry>
4975 <term><option>-e</option><emphasis>x</emphasis></term>
4976 <listitem>
4977 <para>
4978 <indexterm role="option">
4979 <primary><option>-e</option><emphasis>x</emphasis></primary>
4980 </indexterm>
4981 There are a number of Sendmail options starting with <option>-oe</option> which seem to be
4982 called by various programs without the leading <option>o</option> in the option. For
4983 example, the <option>vacation</option> program uses <option>-eq</option>. Exim treats all options of the
4984 form <option>-e</option><emphasis>x</emphasis> as synonymous with the corresponding <option>-oe</option><emphasis>x</emphasis> options.
4985 </para>
4986 </listitem></varlistentry>
4987 <varlistentry>
4988 <term><option>-F</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
4989 <listitem>
4990 <para>
4991 <indexterm role="option">
4992 <primary><option>-F</option></primary>
4993 </indexterm>
4994 <indexterm role="concept">
4995 <primary>sender</primary>
4996 <secondary>name</secondary>
4997 </indexterm>
4998 <indexterm role="concept">
4999 <primary>name</primary>
5000 <secondary>of sender</secondary>
5001 </indexterm>
5002 This option sets the sender&#x2019;s full name for use when a locally-generated
5003 message is being accepted. In the absence of this option, the user&#x2019;s <emphasis>gecos</emphasis>
5004 entry from the password data is used. As users are generally permitted to alter
5005 their <emphasis>gecos</emphasis> entries, no security considerations are involved. White space
5006 between <option>-F</option> and the &lt;<emphasis>string</emphasis>&gt; is optional.
5007 </para>
5008 </listitem></varlistentry>
5009 <varlistentry>
5010 <term><option>-f</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
5011 <listitem>
5012 <para>
5013 <indexterm role="option">
5014 <primary><option>-f</option></primary>
5015 </indexterm>
5016 <indexterm role="concept">
5017 <primary>sender</primary>
5018 <secondary>address</secondary>
5019 </indexterm>
5020 <indexterm role="concept">
5021 <primary>address</primary>
5022 <secondary>sender</secondary>
5023 </indexterm>
5024 <indexterm role="concept">
5025 <primary>trusted users</primary>
5026 </indexterm>
5027 <indexterm role="concept">
5028 <primary>envelope sender</primary>
5029 </indexterm>
5030 <indexterm role="concept">
5031 <primary>user</primary>
5032 <secondary>trusted</secondary>
5033 </indexterm>
5034 This option sets the address of the envelope sender of a locally-generated
5035 message (also known as the return path). The option can normally be used only
5036 by a trusted user, but <option>untrusted_set_sender</option> can be set to allow untrusted
5037 users to use it.
5038 </para>
5039 <para>
5040 Processes running as root or the Exim user are always trusted. Other
5041 trusted users are defined by the <option>trusted_users</option> or <option>trusted_groups</option>
5042 options. In the absence of <option>-f</option>, or if the caller is not trusted, the sender
5043 of a local message is set to the caller&#x2019;s login name at the default qualify
5044 domain.
5045 </para>
5046 <para>
5047 There is one exception to the restriction on the use of <option>-f</option>: an empty sender
5048 can be specified by any user, trusted or not, to create a message that can
5049 never provoke a bounce. An empty sender can be specified either as an empty
5050 string, or as a pair of angle brackets with nothing between them, as in these
5051 examples of shell commands:
5052 </para>
5053 <literallayout class="monospaced">
5054 exim -f '&lt;&gt;' user@domain
5055 exim -f "" user@domain
5056 </literallayout>
5057 <para>
5058 In addition, the use of <option>-f</option> is not restricted when testing a filter file
5059 with <option>-bf</option> or when testing or verifying addresses using the <option>-bt</option> or
5060 <option>-bv</option> options.
5061 </para>
5062 <para>
5063 Allowing untrusted users to change the sender address does not of itself make
5064 it possible to send anonymous mail. Exim still checks that the <emphasis>From:</emphasis> header
5065 refers to the local user, and if it does not, it adds a <emphasis>Sender:</emphasis> header,
5066 though this can be overridden by setting <option>no_local_from_check</option>.
5067 </para>
5068 <para>
5069 White
5070 <indexterm role="concept">
5071 <primary><quote>From</quote> line</primary>
5072 </indexterm>
5073 space between <option>-f</option> and the &lt;<emphasis>address</emphasis>&gt; is optional (that is, they can be
5074 given as two arguments or one combined argument). The sender of a
5075 locally-generated message can also be set (when permitted) by an initial
5076 <quote>From&nbsp;</quote> line in the message &ndash; see the description of <option>-bm</option> above &ndash; but
5077 if <option>-f</option> is also present, it overrides <quote>From&nbsp;</quote>.
5078 </para>
5079 </listitem></varlistentry>
5080 <varlistentry>
5081 <term><option>-G</option></term>
5082 <listitem>
5083 <para>
5084 <indexterm role="option">
5085 <primary><option>-G</option></primary>
5086 </indexterm>
5087 <indexterm role="concept">
5088 <primary>Sendmail compatibility</primary>
5089 <secondary><option>-G</option> option ignored</secondary>
5090 </indexterm>
5091 This is a Sendmail option which is ignored by Exim.
5092 </para>
5093 </listitem></varlistentry>
5094 <varlistentry>
5095 <term><option>-h</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
5096 <listitem>
5097 <para>
5098 <indexterm role="option">
5099 <primary><option>-h</option></primary>
5100 </indexterm>
5101 <indexterm role="concept">
5102 <primary>Sendmail compatibility</primary>
5103 <secondary><option>-h</option> option ignored</secondary>
5104 </indexterm>
5105 This option is accepted for compatibility with Sendmail, but has no effect. (In
5106 Sendmail it overrides the <quote>hop count</quote> obtained by counting <emphasis>Received:</emphasis>
5107 headers.)
5108 </para>
5109 </listitem></varlistentry>
5110 <varlistentry>
5111 <term><option>-i</option></term>
5112 <listitem>
5113 <para>
5114 <indexterm role="option">
5115 <primary><option>-i</option></primary>
5116 </indexterm>
5117 <indexterm role="concept">
5118 <primary>Solaris</primary>
5119 <secondary><emphasis>mail</emphasis> command</secondary>
5120 </indexterm>
5121 <indexterm role="concept">
5122 <primary>dot</primary>
5123 <secondary>in incoming non-SMTP message</secondary>
5124 </indexterm>
5125 This option, which has the same effect as <option>-oi</option>, specifies that a dot on a
5126 line by itself should not terminate an incoming, non-SMTP message. I can find
5127 no documentation for this option in Solaris 2.4 Sendmail, but the <emphasis>mailx</emphasis>
5128 command in Solaris 2.4 uses it. See also <option>-ti</option>.
5129 </para>
5130 </listitem></varlistentry>
5131 <varlistentry>
5132 <term><option>-M</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5133 <listitem>
5134 <para>
5135 <indexterm role="option">
5136 <primary><option>-M</option></primary>
5137 </indexterm>
5138 <indexterm role="concept">
5139 <primary>forcing delivery</primary>
5140 </indexterm>
5141 <indexterm role="concept">
5142 <primary>delivery</primary>
5143 <secondary>forcing attempt</secondary>
5144 </indexterm>
5145 <indexterm role="concept">
5146 <primary>frozen messages</primary>
5147 <secondary>forcing delivery</secondary>
5148 </indexterm>
5149 This option requests Exim to run a delivery attempt on each message in turn. If
5150 any of the messages are frozen, they are automatically thawed before the
5151 delivery attempt. The settings of <option>queue_domains</option>, <option>queue_smtp_domains</option>,
5152 and <option>hold_domains</option> are ignored.
5153 </para>
5154 <para>
5155 Retry
5156 <indexterm role="concept">
5157 <primary>hints database</primary>
5158 <secondary>overriding retry hints</secondary>
5159 </indexterm>
5160 hints for any of the addresses are overridden &ndash; Exim tries to deliver even if
5161 the normal retry time has not yet been reached. This option requires the caller
5162 to be an admin user. However, there is an option called <option>prod_requires_admin</option>
5163 which can be set false to relax this restriction (and also the same requirement
5164 for the <option>-q</option>, <option>-R</option>, and <option>-S</option> options).
5165 </para>
5166 <para>
5167 The deliveries happen synchronously, that is, the original Exim process does
5168 not terminate until all the delivery attempts have finished. No output is
5169 produced unless there is a serious error. If you want to see what is happening,
5170 use the <option>-v</option> option as well, or inspect Exim&#x2019;s main log.
5171 </para>
5172 </listitem></varlistentry>
5173 <varlistentry>
5174 <term><option>-Mar</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>address</emphasis>&gt;&nbsp;&lt;<emphasis>address</emphasis>&gt;&nbsp;...</term>
5175 <listitem>
5176 <para>
5177 <indexterm role="option">
5178 <primary><option>-Mar</option></primary>
5179 </indexterm>
5180 <indexterm role="concept">
5181 <primary>message</primary>
5182 <secondary>adding recipients</secondary>
5183 </indexterm>
5184 <indexterm role="concept">
5185 <primary>recipient</primary>
5186 <secondary>adding</secondary>
5187 </indexterm>
5188 This option requests Exim to add the addresses to the list of recipients of the
5189 message (<quote>ar</quote> for <quote>add recipients</quote>). The first argument must be a message
5190 id, and the remaining ones must be email addresses. However, if the message is
5191 active (in the middle of a delivery attempt), it is not altered. This option
5192 can be used only by an admin user.
5193 </para>
5194 </listitem></varlistentry>
5195 <varlistentry>
5196 <term><option>-MC</option>&nbsp;&lt;<emphasis>transport</emphasis>&gt;&nbsp;&lt;<emphasis>hostname</emphasis>&gt;&nbsp;&lt;<emphasis>sequence&nbsp;number</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5197 <listitem>
5198 <para>
5199 <indexterm role="option">
5200 <primary><option>-MC</option></primary>
5201 </indexterm>
5202 <indexterm role="concept">
5203 <primary>SMTP</primary>
5204 <secondary>passed connection</secondary>
5205 </indexterm>
5206 <indexterm role="concept">
5207 <primary>SMTP</primary>
5208 <secondary>multiple deliveries</secondary>
5209 </indexterm>
5210 <indexterm role="concept">
5211 <primary>multiple SMTP deliveries</primary>
5212 </indexterm>
5213 This option is not intended for use by external callers. It is used internally
5214 by Exim to invoke another instance of itself to deliver a waiting message using
5215 an existing SMTP connection, which is passed as the standard input. Details are
5216 given in chapter <xref linkend="CHAPSMTP"/>. This must be the final option, and the caller
5217 must be root or the Exim user in order to use it.
5218 </para>
5219 </listitem></varlistentry>
5220 <varlistentry>
5221 <term><option>-MCA</option></term>
5222 <listitem>
5223 <para>
5224 <indexterm role="option">
5225 <primary><option>-MCA</option></primary>
5226 </indexterm>
5227 This option is not intended for use by external callers. It is used internally
5228 by Exim in conjunction with the <option>-MC</option> option. It signifies that the
5229 connection to the remote host has been authenticated.
5230 </para>
5231 </listitem></varlistentry>
5232 <varlistentry>
5233 <term><option>-MCP</option></term>
5234 <listitem>
5235 <para>
5236 <indexterm role="option">
5237 <primary><option>-MCP</option></primary>
5238 </indexterm>
5239 This option is not intended for use by external callers. It is used internally
5240 by Exim in conjunction with the <option>-MC</option> option. It signifies that the server to
5241 which Exim is connected supports pipelining.
5242 </para>
5243 </listitem></varlistentry>
5244 <varlistentry>
5245 <term><option>-MCQ</option>&nbsp;&lt;<emphasis>process&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>pipe&nbsp;fd</emphasis>&gt;</term>
5246 <listitem>
5247 <para>
5248 <indexterm role="option">
5249 <primary><option>-MCQ</option></primary>
5250 </indexterm>
5251 This option is not intended for use by external callers. It is used internally
5252 by Exim in conjunction with the <option>-MC</option> option when the original delivery was
5253 started by a queue runner. It passes on the process id of the queue runner,
5254 together with the file descriptor number of an open pipe. Closure of the pipe
5255 signals the final completion of the sequence of processes that are passing
5256 messages through the same SMTP connection.
5257 </para>
5258 </listitem></varlistentry>
5259 <varlistentry>
5260 <term><option>-MCS</option></term>
5261 <listitem>
5262 <para>
5263 <indexterm role="option">
5264 <primary><option>-MCS</option></primary>
5265 </indexterm>
5266 This option is not intended for use by external callers. It is used internally
5267 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
5268 SMTP SIZE option should be used on messages delivered down the existing
5269 connection.
5270 </para>
5271 </listitem></varlistentry>
5272 <varlistentry>
5273 <term><option>-MCT</option></term>
5274 <listitem>
5275 <para>
5276 <indexterm role="option">
5277 <primary><option>-MCT</option></primary>
5278 </indexterm>
5279 This option is not intended for use by external callers. It is used internally
5280 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
5281 host to which Exim is connected supports TLS encryption.
5282 </para>
5283 </listitem></varlistentry>
5284 <varlistentry>
5285 <term><option>-Mc</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5286 <listitem>
5287 <para>
5288 <indexterm role="option">
5289 <primary><option>-Mc</option></primary>
5290 </indexterm>
5291 <indexterm role="concept">
5292 <primary>hints database</primary>
5293 <secondary>not overridden by <option>-Mc</option></secondary>
5294 </indexterm>
5295 <indexterm role="concept">
5296 <primary>delivery</primary>
5297 <secondary>manually started &ndash; not forced</secondary>
5298 </indexterm>
5299 This option requests Exim to run a delivery attempt on each message in turn,
5300 but unlike the <option>-M</option> option, it does check for retry hints, and respects any
5301 that are found. This option is not very useful to external callers. It is
5302 provided mainly for internal use by Exim when it needs to re-invoke itself in
5303 order to regain root privilege for a delivery (see chapter <xref linkend="CHAPsecurity"/>).
5304 However, <option>-Mc</option> can be useful when testing, in order to run a delivery that
5305 respects retry times and other options such as <option>hold_domains</option> that are
5306 overridden when <option>-M</option> is used. Such a delivery does not count as a queue run.
5307 If you want to run a specific delivery as if in a queue run, you should use
5308 <option>-q</option> with a message id argument. A distinction between queue run deliveries
5309 and other deliveries is made in one or two places.
5310 </para>
5311 </listitem></varlistentry>
5312 <varlistentry>
5313 <term><option>-Mes</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
5314 <listitem>
5315 <para>
5316 <indexterm role="option">
5317 <primary><option>-Mes</option></primary>
5318 </indexterm>
5319 <indexterm role="concept">
5320 <primary>message</primary>
5321 <secondary>changing sender</secondary>
5322 </indexterm>
5323 <indexterm role="concept">
5324 <primary>sender</primary>
5325 <secondary>changing</secondary>
5326 </indexterm>
5327 This option requests Exim to change the sender address in the message to the
5328 given address, which must be a fully qualified address or <quote>&lt;&gt;</quote> (<quote>es</quote> for
5329 <quote>edit sender</quote>). There must be exactly two arguments. The first argument must
5330 be a message id, and the second one an email address. However, if the message
5331 is active (in the middle of a delivery attempt), its status is not altered.
5332 This option can be used only by an admin user.
5333 </para>
5334 </listitem></varlistentry>
5335 <varlistentry>
5336 <term><option>-Mf</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5337 <listitem>
5338 <para>
5339 <indexterm role="option">
5340 <primary><option>-Mf</option></primary>
5341 </indexterm>
5342 <indexterm role="concept">
5343 <primary>freezing messages</primary>
5344 </indexterm>
5345 <indexterm role="concept">
5346 <primary>message</primary>
5347 <secondary>manually freezing</secondary>
5348 </indexterm>
5349 This option requests Exim to mark each listed message as <quote>frozen</quote>. This
5350 prevents any delivery attempts taking place until the message is <quote>thawed</quote>,
5351 either manually or as a result of the <option>auto_thaw</option> configuration option.
5352 However, if any of the messages are active (in the middle of a delivery
5353 attempt), their status is not altered. This option can be used only by an admin
5354 user.
5355 </para>
5356 </listitem></varlistentry>
5357 <varlistentry>
5358 <term><option>-Mg</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5359 <listitem>
5360 <para>
5361 <indexterm role="option">
5362 <primary><option>-Mg</option></primary>
5363 </indexterm>
5364 <indexterm role="concept">
5365 <primary>giving up on messages</primary>
5366 </indexterm>
5367 <indexterm role="concept">
5368 <primary>message</primary>
5369 <secondary>abandoning delivery attempts</secondary>
5370 </indexterm>
5371 <indexterm role="concept">
5372 <primary>delivery</primary>
5373 <secondary>abandoning further attempts</secondary>
5374 </indexterm>
5375 This option requests Exim to give up trying to deliver the listed messages,
5376 including any that are frozen. However, if any of the messages are active,
5377 their status is not altered. For non-bounce messages, a delivery error message
5378 is sent to the sender, containing the text <quote>cancelled by administrator</quote>.
5379 Bounce messages are just discarded. This option can be used only by an admin
5380 user.
5381 </para>
5382 </listitem></varlistentry>
5383 <varlistentry>
5384 <term><option>-Mmad</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5385 <listitem>
5386 <para>
5387 <indexterm role="option">
5388 <primary><option>-Mmad</option></primary>
5389 </indexterm>
5390 <indexterm role="concept">
5391 <primary>delivery</primary>
5392 <secondary>cancelling all</secondary>
5393 </indexterm>
5394 This option requests Exim to mark all the recipient addresses in the messages
5395 as already delivered (<quote>mad</quote> for <quote>mark all delivered</quote>). However, if any
5396 message is active (in the middle of a delivery attempt), its status is not
5397 altered. This option can be used only by an admin user.
5398 </para>
5399 </listitem></varlistentry>
5400 <varlistentry>
5401 <term><option>-Mmd</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>address</emphasis>&gt;&nbsp;&lt;<emphasis>address</emphasis>&gt;&nbsp;...</term>
5402 <listitem>
5403 <para>
5404 <indexterm role="option">
5405 <primary><option>-Mmd</option></primary>
5406 </indexterm>
5407 <indexterm role="concept">
5408 <primary>delivery</primary>
5409 <secondary>cancelling by address</secondary>
5410 </indexterm>
5411 <indexterm role="concept">
5412 <primary>recipient</primary>
5413 <secondary>removing</secondary>
5414 </indexterm>
5415 <indexterm role="concept">
5416 <primary>removing recipients</primary>
5417 </indexterm>
5418 This option requests Exim to mark the given addresses as already delivered
5419 (<quote>md</quote> for <quote>mark delivered</quote>). The first argument must be a message id, and
5420 the remaining ones must be email addresses. These are matched to recipient
5421 addresses in the message in a case-sensitive manner. If the message is active
5422 (in the middle of a delivery attempt), its status is not altered. This option
5423 can be used only by an admin user.
5424 </para>
5425 </listitem></varlistentry>
5426 <varlistentry>
5427 <term><option>-Mrm</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5428 <listitem>
5429 <para>
5430 <indexterm role="option">
5431 <primary><option>-Mrm</option></primary>
5432 </indexterm>
5433 <indexterm role="concept">
5434 <primary>removing messages</primary>
5435 </indexterm>
5436 <indexterm role="concept">
5437 <primary>abandoning mail</primary>
5438 </indexterm>
5439 <indexterm role="concept">
5440 <primary>message</primary>
5441 <secondary>manually discarding</secondary>
5442 </indexterm>
5443 This option requests Exim to remove the given messages from the queue. No
5444 bounce messages are sent; each message is simply forgotten. However, if any of
5445 the messages are active, their status is not altered. This option can be used
5446 only by an admin user or by the user who originally caused the message to be
5447 placed on the queue.
5448 </para>
5449 </listitem></varlistentry>
5450 <varlistentry>
5451 <term><option>-Mset</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5452 <listitem>
5453 <para>
5454 <indexterm role="option">
5455 <primary><option>-Mset</option></primary>
5456 </indexterm>
5457 <indexterm role="concept">
5458 <primary>testing</primary>
5459 <secondary>string expansion</secondary>
5460 </indexterm>
5461 <indexterm role="concept">
5462 <primary>expansion</primary>
5463 <secondary>testing</secondary>
5464 </indexterm>
5465 This option is useful only in conjunction with <option>-be</option> (that is, when testing
5466 string expansions). Exim loads the given message from its spool before doing
5467 the test expansions, thus setting message-specific variables such as
5468 <varname>$message_size</varname> and the header variables. The <varname>$recipients</varname> variable is made
5469 available. This feature is provided to make it easier to test expansions that
5470 make use of these variables. However, this option can be used only by an admin
5471 user. See also <option>-bem</option>.
5472 </para>
5473 </listitem></varlistentry>
5474 <varlistentry>
5475 <term><option>-Mt</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5476 <listitem>
5477 <para>
5478 <indexterm role="option">
5479 <primary><option>-Mt</option></primary>
5480 </indexterm>
5481 <indexterm role="concept">
5482 <primary>thawing messages</primary>
5483 </indexterm>
5484 <indexterm role="concept">
5485 <primary>unfreezing messages</primary>
5486 </indexterm>
5487 <indexterm role="concept">
5488 <primary>frozen messages</primary>
5489 <secondary>thawing</secondary>
5490 </indexterm>
5491 <indexterm role="concept">
5492 <primary>message</primary>
5493 <secondary>thawing frozen</secondary>
5494 </indexterm>
5495 This option requests Exim to <quote>thaw</quote> any of the listed messages that are
5496 <quote>frozen</quote>, so that delivery attempts can resume. However, if any of the
5497 messages are active, their status is not altered. This option can be used only
5498 by an admin user.
5499 </para>
5500 </listitem></varlistentry>
5501 <varlistentry>
5502 <term><option>-Mvb</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5503 <listitem>
5504 <para>
5505 <indexterm role="option">
5506 <primary><option>-Mvb</option></primary>
5507 </indexterm>
5508 <indexterm role="concept">
5509 <primary>listing</primary>
5510 <secondary>message body</secondary>
5511 </indexterm>
5512 <indexterm role="concept">
5513 <primary>message</primary>
5514 <secondary>listing body of</secondary>
5515 </indexterm>
5516 This option causes the contents of the message body (-D) spool file to be
5517 written to the standard output. This option can be used only by an admin user.
5518 </para>
5519 </listitem></varlistentry>
5520 <varlistentry>
5521 <term><option>-Mvc</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5522 <listitem>
5523 <para>
5524 <indexterm role="option">
5525 <primary><option>-Mvc</option></primary>
5526 </indexterm>
5527 <indexterm role="concept">
5528 <primary>message</primary>
5529 <secondary>listing in RFC 2822 format</secondary>
5530 </indexterm>
5531 <indexterm role="concept">
5532 <primary>listing</primary>
5533 <secondary>message in RFC 2922 format</secondary>
5534 </indexterm>
5535 This option causes a copy of the complete message (header lines plus body) to
5536 be written to the standard output in RFC 2822 format. This option can be used
5537 only by an admin user.
5538 </para>
5539 </listitem></varlistentry>
5540 <varlistentry>
5541 <term><option>-Mvh</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5542 <listitem>
5543 <para>
5544 <indexterm role="option">
5545 <primary><option>-Mvh</option></primary>
5546 </indexterm>
5547 <indexterm role="concept">
5548 <primary>listing</primary>
5549 <secondary>message headers</secondary>
5550 </indexterm>
5551 <indexterm role="concept">
5552 <primary>header lines</primary>
5553 <secondary>listing</secondary>
5554 </indexterm>
5555 <indexterm role="concept">
5556 <primary>message</primary>
5557 <secondary>listing header lines</secondary>
5558 </indexterm>
5559 This option causes the contents of the message headers (-H) spool file to be
5560 written to the standard output. This option can be used only by an admin user.
5561 </para>
5562 </listitem></varlistentry>
5563 <varlistentry>
5564 <term><option>-Mvl</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5565 <listitem>
5566 <para>
5567 <indexterm role="option">
5568 <primary><option>-Mvl</option></primary>
5569 </indexterm>
5570 <indexterm role="concept">
5571 <primary>listing</primary>
5572 <secondary>message log</secondary>
5573 </indexterm>
5574 <indexterm role="concept">
5575 <primary>message</primary>
5576 <secondary>listing message log</secondary>
5577 </indexterm>
5578 This option causes the contents of the message log spool file to be written to
5579 the standard output. This option can be used only by an admin user.
5580 </para>
5581 </listitem></varlistentry>
5582 <varlistentry>
5583 <term><option>-m</option></term>
5584 <listitem>
5585 <para>
5586 <indexterm role="option">
5587 <primary><option>-m</option></primary>
5588 </indexterm>
5589 This is apparently a synonym for <option>-om</option> that is accepted by Sendmail, so Exim
5590 treats it that way too.
5591 </para>
5592 </listitem></varlistentry>
5593 <varlistentry>
5594 <term><option>-N</option></term>
5595 <listitem>
5596 <para>
5597 <indexterm role="option">
5598 <primary><option>-N</option></primary>
5599 </indexterm>
5600 <indexterm role="concept">
5601 <primary>debugging</primary>
5602 <secondary><option>-N</option> option</secondary>
5603 </indexterm>
5604 <indexterm role="concept">
5605 <primary>debugging</primary>
5606 <secondary>suppressing delivery</secondary>
5607 </indexterm>
5608 This is a debugging option that inhibits delivery of a message at the transport
5609 level. It implies <option>-v</option>. Exim goes through many of the motions of delivery &ndash;
5610 it just doesn&#x2019;t actually transport the message, but instead behaves as if it
5611 had successfully done so. However, it does not make any updates to the retry
5612 database, and the log entries for deliveries are flagged with <quote>*&gt;</quote> rather
5613 than <quote>=&gt;</quote>.
5614 </para>
5615 <para>
5616 Because <option>-N</option> discards any message to which it applies, only root or the Exim
5617 user are allowed to use it with <option>-bd</option>, <option>-q</option>, <option>-R</option> or <option>-M</option>. In other
5618 words, an ordinary user can use it only when supplying an incoming message to
5619 which it will apply. Although transportation never fails when <option>-N</option> is set, an
5620 address may be deferred because of a configuration problem on a transport, or a
5621 routing problem. Once <option>-N</option> has been used for a delivery attempt, it sticks to
5622 the message, and applies to any subsequent delivery attempts that may happen
5623 for that message.
5624 </para>
5625 </listitem></varlistentry>
5626 <varlistentry>
5627 <term><option>-n</option></term>
5628 <listitem>
5629 <para>
5630 <indexterm role="option">
5631 <primary><option>-n</option></primary>
5632 </indexterm>
5633 <indexterm role="concept">
5634 <primary>Sendmail compatibility</primary>
5635 <secondary><option>-n</option> option ignored</secondary>
5636 </indexterm>
5637 This option is interpreted by Sendmail to mean <quote>no aliasing</quote>. It is ignored
5638 by Exim.
5639 </para>
5640 </listitem></varlistentry>
5641 <varlistentry>
5642 <term><option>-O</option>&nbsp;&lt;<emphasis>data</emphasis>&gt;</term>
5643 <listitem>
5644 <para>
5645 <indexterm role="option">
5646 <primary><option>-O</option></primary>
5647 </indexterm>
5648 This option is interpreted by Sendmail to mean <literal>set option</literal>. It is ignored by
5649 Exim.
5650 </para>
5651 </listitem></varlistentry>
5652 <varlistentry>
5653 <term><option>-oA</option>&nbsp;&lt;<emphasis>file&nbsp;name</emphasis>&gt;</term>
5654 <listitem>
5655 <para>
5656 <indexterm role="option">
5657 <primary><option>-oA</option></primary>
5658 </indexterm>
5659 <indexterm role="concept">
5660 <primary>Sendmail compatibility</primary>
5661 <secondary><option>-oA</option> option</secondary>
5662 </indexterm>
5663 This option is used by Sendmail in conjunction with <option>-bi</option> to specify an
5664 alternative alias file name. Exim handles <option>-bi</option> differently; see the
5665 description above.
5666 </para>
5667 </listitem></varlistentry>
5668 <varlistentry>
5669 <term><option>-oB</option>&nbsp;&lt;<emphasis>n</emphasis>&gt;</term>
5670 <listitem>
5671 <para>
5672 <indexterm role="option">
5673 <primary><option>-oB</option></primary>
5674 </indexterm>
5675 <indexterm role="concept">
5676 <primary>SMTP</primary>
5677 <secondary>passed connection</secondary>
5678 </indexterm>
5679 <indexterm role="concept">
5680 <primary>SMTP</primary>
5681 <secondary>multiple deliveries</secondary>
5682 </indexterm>
5683 <indexterm role="concept">
5684 <primary>multiple SMTP deliveries</primary>
5685 </indexterm>
5686 This is a debugging option which limits the maximum number of messages that can
5687 be delivered down one SMTP connection, overriding the value set in any <command>smtp</command>
5688 transport. If &lt;<emphasis>n</emphasis>&gt; is omitted, the limit is set to 1.
5689 </para>
5690 </listitem></varlistentry>
5691 <varlistentry>
5692 <term><option>-odb</option></term>
5693 <listitem>
5694 <para>
5695 <indexterm role="option">
5696 <primary><option>-odb</option></primary>
5697 </indexterm>
5698 <indexterm role="concept">
5699 <primary>background delivery</primary>
5700 </indexterm>
5701 <indexterm role="concept">
5702 <primary>delivery</primary>
5703 <secondary>in the background</secondary>
5704 </indexterm>
5705 This option applies to all modes in which Exim accepts incoming messages,
5706 including the listening daemon. It requests <quote>background</quote> delivery of such
5707 messages, which means that the accepting process automatically starts a
5708 delivery process for each message received, but does not wait for the delivery
5709 processes to finish.
5710 </para>
5711 <para>
5712 When all the messages have been received, the reception process exits,
5713 leaving the delivery processes to finish in their own time. The standard output
5714 and error streams are closed at the start of each delivery process.
5715 This is the default action if none of the <option>-od</option> options are present.
5716 </para>
5717 <para>
5718 If one of the queueing options in the configuration file
5719 (<option>queue_only</option> or <option>queue_only_file</option>, for example) is in effect, <option>-odb</option>
5720 overrides it if <option>queue_only_override</option> is set true, which is the default
5721 setting. If <option>queue_only_override</option> is set false, <option>-odb</option> has no effect.
5722 </para>
5723 </listitem></varlistentry>
5724 <varlistentry>
5725 <term><option>-odf</option></term>
5726 <listitem>
5727 <para>
5728 <indexterm role="option">
5729 <primary><option>-odf</option></primary>
5730 </indexterm>
5731 <indexterm role="concept">
5732 <primary>foreground delivery</primary>
5733 </indexterm>
5734 <indexterm role="concept">
5735 <primary>delivery</primary>
5736 <secondary>in the foreground</secondary>
5737 </indexterm>
5738 This option requests <quote>foreground</quote> (synchronous) delivery when Exim has
5739 accepted a locally-generated message. (For the daemon it is exactly the same as
5740 <option>-odb</option>.) A delivery process is automatically started to deliver the message,
5741 and Exim waits for it to complete before proceeding.
5742 </para>
5743 <para>
5744 The original Exim reception process does not finish until the delivery
5745 process for the final message has ended. The standard error stream is left open
5746 during deliveries.
5747 </para>
5748 <para>
5749 However, like <option>-odb</option>, this option has no effect if <option>queue_only_override</option> is
5750 false and one of the queueing options in the configuration file is in effect.
5751 </para>
5752 <para>
5753 If there is a temporary delivery error during foreground delivery, the
5754 message is left on the queue for later delivery, and the original reception
5755 process exits. See chapter <xref linkend="CHAPnonqueueing"/> for a way of setting up a
5756 restricted configuration that never queues messages.
5757 </para>
5758 </listitem></varlistentry>
5759 <varlistentry>
5760 <term><option>-odi</option></term>
5761 <listitem>
5762 <para>
5763 <indexterm role="option">
5764 <primary><option>-odi</option></primary>
5765 </indexterm>
5766 This option is synonymous with <option>-odf</option>. It is provided for compatibility with
5767 Sendmail.
5768 </para>
5769 </listitem></varlistentry>
5770 <varlistentry>
5771 <term><option>-odq</option></term>
5772 <listitem>
5773 <para>
5774 <indexterm role="option">
5775 <primary><option>-odq</option></primary>
5776 </indexterm>
5777 <indexterm role="concept">
5778 <primary>non-immediate delivery</primary>
5779 </indexterm>
5780 <indexterm role="concept">
5781 <primary>delivery</primary>
5782 <secondary>suppressing immediate</secondary>
5783 </indexterm>
5784 <indexterm role="concept">
5785 <primary>queueing incoming messages</primary>
5786 </indexterm>
5787 This option applies to all modes in which Exim accepts incoming messages,
5788 including the listening daemon. It specifies that the accepting process should
5789 not automatically start a delivery process for each message received. Messages
5790 are placed on the queue, and remain there until a subsequent queue runner
5791 process encounters them. There are several configuration options (such as
5792 <option>queue_only</option>) that can be used to queue incoming messages under certain
5793 conditions. This option overrides all of them and also <option>-odqs</option>. It always
5794 forces queueing.
5795 </para>
5796 </listitem></varlistentry>
5797 <varlistentry>
5798 <term><option>-odqs</option></term>
5799 <listitem>
5800 <para>
5801 <indexterm role="option">
5802 <primary><option>-odqs</option></primary>
5803 </indexterm>
5804 <indexterm role="concept">
5805 <primary>SMTP</primary>
5806 <secondary>delaying delivery</secondary>
5807 </indexterm>
5808 This option is a hybrid between <option>-odb</option>/<option>-odi</option> and <option>-odq</option>.
5809 However, like <option>-odb</option> and <option>-odi</option>, this option has no effect if
5810 <option>queue_only_override</option> is false and one of the queueing options in the
5811 configuration file is in effect.
5812 </para>
5813 <para>
5814 When <option>-odqs</option> does operate, a delivery process is started for each incoming
5815 message, in the background by default, but in the foreground if <option>-odi</option> is
5816 also present. The recipient addresses are routed, and local deliveries are done
5817 in the normal way. However, if any SMTP deliveries are required, they are not
5818 done at this time, so the message remains on the queue until a subsequent queue
5819 runner process encounters it. Because routing was done, Exim knows which
5820 messages are waiting for which hosts, and so a number of messages for the same
5821 host can be sent in a single SMTP connection. The <option>queue_smtp_domains</option>
5822 configuration option has the same effect for specific domains. See also the
5823 <option>-qq</option> option.
5824 </para>
5825 </listitem></varlistentry>
5826 <varlistentry>
5827 <term><option>-oee</option></term>
5828 <listitem>
5829 <para>
5830 <indexterm role="option">
5831 <primary><option>-oee</option></primary>
5832 </indexterm>
5833 <indexterm role="concept">
5834 <primary>error</primary>
5835 <secondary>reporting</secondary>
5836 </indexterm>
5837 If an error is detected while a non-SMTP message is being received (for
5838 example, a malformed address), the error is reported to the sender in a mail
5839 message.
5840 </para>
5841 <para>
5842 <indexterm role="concept">
5843 <primary>return code</primary>
5844 <secondary>for <option>-oee</option></secondary>
5845 </indexterm>
5846 Provided
5847 this error message is successfully sent, the Exim receiving process
5848 exits with a return code of zero. If not, the return code is 2 if the problem
5849 is that the original message has no recipients, or 1 any other error. This is
5850 the default <option>-oe</option><emphasis>x</emphasis> option if Exim is called as <emphasis>rmail</emphasis>.
5851 </para>
5852 </listitem></varlistentry>
5853 <varlistentry>
5854 <term><option>-oem</option></term>
5855 <listitem>
5856 <para>
5857 <indexterm role="option">
5858 <primary><option>-oem</option></primary>
5859 </indexterm>
5860 <indexterm role="concept">
5861 <primary>error</primary>
5862 <secondary>reporting</secondary>
5863 </indexterm>
5864 <indexterm role="concept">
5865 <primary>return code</primary>
5866 <secondary>for <option>-oem</option></secondary>
5867 </indexterm>
5868 This is the same as <option>-oee</option>, except that Exim always exits with a non-zero
5869 return code, whether or not the error message was successfully sent.
5870 This is the default <option>-oe</option><emphasis>x</emphasis> option, unless Exim is called as <emphasis>rmail</emphasis>.
5871 </para>
5872 </listitem></varlistentry>
5873 <varlistentry>
5874 <term><option>-oep</option></term>
5875 <listitem>
5876 <para>
5877 <indexterm role="option">
5878 <primary><option>-oep</option></primary>
5879 </indexterm>
5880 <indexterm role="concept">
5881 <primary>error</primary>
5882 <secondary>reporting</secondary>
5883 </indexterm>
5884 If an error is detected while a non-SMTP message is being received, the
5885 error is reported by writing a message to the standard error file (stderr).
5886 <indexterm role="concept">
5887 <primary>return code</primary>
5888 <secondary>for <option>-oep</option></secondary>
5889 </indexterm>
5890 The return code is 1 for all errors.
5891 </para>
5892 </listitem></varlistentry>
5893 <varlistentry>
5894 <term><option>-oeq</option></term>
5895 <listitem>
5896 <para>
5897 <indexterm role="option">
5898 <primary><option>-oeq</option></primary>
5899 </indexterm>
5900 <indexterm role="concept">
5901 <primary>error</primary>
5902 <secondary>reporting</secondary>
5903 </indexterm>
5904 This option is supported for compatibility with Sendmail, but has the same
5905 effect as <option>-oep</option>.
5906 </para>
5907 </listitem></varlistentry>
5908 <varlistentry>
5909 <term><option>-oew</option></term>
5910 <listitem>
5911 <para>
5912 <indexterm role="option">
5913 <primary><option>-oew</option></primary>
5914 </indexterm>
5915 <indexterm role="concept">
5916 <primary>error</primary>
5917 <secondary>reporting</secondary>
5918 </indexterm>
5919 This option is supported for compatibility with Sendmail, but has the same
5920 effect as <option>-oem</option>.
5921 </para>
5922 </listitem></varlistentry>
5923 <varlistentry>
5924 <term><option>-oi</option></term>
5925 <listitem>
5926 <para>
5927 <indexterm role="option">
5928 <primary><option>-oi</option></primary>
5929 </indexterm>
5930 <indexterm role="concept">
5931 <primary>dot</primary>
5932 <secondary>in incoming non-SMTP message</secondary>
5933 </indexterm>
5934 This option, which has the same effect as <option>-i</option>, specifies that a dot on a
5935 line by itself should not terminate an incoming, non-SMTP message. Otherwise, a
5936 single dot does terminate, though Exim does no special processing for other
5937 lines that start with a dot. This option is set by default if Exim is called as
5938 <emphasis>rmail</emphasis>. See also <option>-ti</option>.
5939 </para>
5940 </listitem></varlistentry>
5941 <varlistentry>
5942 <term><option>-oitrue</option></term>
5943 <listitem>
5944 <para>
5945 <indexterm role="option">
5946 <primary><option>-oitrue</option></primary>
5947 </indexterm>
5948 This option is treated as synonymous with <option>-oi</option>.
5949 </para>
5950 </listitem></varlistentry>
5951 <varlistentry>
5952 <term><option>-oMa</option>&nbsp;&lt;<emphasis>host&nbsp;address</emphasis>&gt;</term>
5953 <listitem>
5954 <para>
5955 <indexterm role="option">
5956 <primary><option>-oMa</option></primary>
5957 </indexterm>
5958 <indexterm role="concept">
5959 <primary>sender</primary>
5960 <secondary>host address, specifying for local message</secondary>
5961 </indexterm>
5962 A number of options starting with <option>-oM</option> can be used to set values associated
5963 with remote hosts on locally-submitted messages (that is, messages not received
5964 over TCP/IP). These options can be used by any caller in conjunction with the
5965 <option>-bh</option>, <option>-be</option>, <option>-bf</option>, <option>-bF</option>, <option>-bt</option>, or <option>-bv</option> testing options. In
5966 other circumstances, they are ignored unless the caller is trusted.
5967 </para>
5968 <para>
5969 The <option>-oMa</option> option sets the sender host address. This may include a port
5970 number at the end, after a full stop (period). For example:
5971 </para>
5972 <literallayout class="monospaced">
5973 exim -bs -oMa 10.9.8.7.1234
5974 </literallayout>
5975 <para>
5976 An alternative syntax is to enclose the IP address in square brackets,
5977 followed by a colon and the port number:
5978 </para>
5979 <literallayout class="monospaced">
5980 exim -bs -oMa [10.9.8.7]:1234
5981 </literallayout>
5982 <para>
5983 The IP address is placed in the <varname>$sender_host_address</varname> variable, and the
5984 port, if present, in <varname>$sender_host_port</varname>. If both <option>-oMa</option> and <option>-bh</option>
5985 are present on the command line, the sender host IP address is taken from
5986 whichever one is last.
5987 </para>
5988 </listitem></varlistentry>
5989 <varlistentry>
5990 <term><option>-oMaa</option>&nbsp;&lt;<emphasis>name</emphasis>&gt;</term>
5991 <listitem>
5992 <para>
5993 <indexterm role="option">
5994 <primary><option>-oMaa</option></primary>
5995 </indexterm>
5996 <indexterm role="concept">
5997 <primary>authentication</primary>
5998 <secondary>name, specifying for local message</secondary>
5999 </indexterm>
6000 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMaa</option>
6001 option sets the value of <varname>$sender_host_authenticated</varname> (the authenticator
6002 name). See chapter <xref linkend="CHAPSMTPAUTH"/> for a discussion of SMTP authentication.
6003 This option can be used with <option>-bh</option> and <option>-bs</option> to set up an
6004 authenticated SMTP session without actually using the SMTP AUTH command.
6005 </para>
6006 </listitem></varlistentry>
6007 <varlistentry>
6008 <term><option>-oMai</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6009 <listitem>
6010 <para>
6011 <indexterm role="option">
6012 <primary><option>-oMai</option></primary>
6013 </indexterm>
6014 <indexterm role="concept">
6015 <primary>authentication</primary>
6016 <secondary>id, specifying for local message</secondary>
6017 </indexterm>
6018 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMai</option>
6019 option sets the value of <varname>$authenticated_id</varname> (the id that was authenticated).
6020 This overrides the default value (the caller&#x2019;s login id, except with <option>-bh</option>,
6021 where there is no default) for messages from local sources. See chapter
6022 <xref linkend="CHAPSMTPAUTH"/> for a discussion of authenticated ids.
6023 </para>
6024 </listitem></varlistentry>
6025 <varlistentry>
6026 <term><option>-oMas</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
6027 <listitem>
6028 <para>
6029 <indexterm role="option">
6030 <primary><option>-oMas</option></primary>
6031 </indexterm>
6032 <indexterm role="concept">
6033 <primary>authentication</primary>
6034 <secondary>sender, specifying for local message</secondary>
6035 </indexterm>
6036 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMas</option>
6037 option sets the authenticated sender value in <varname>$authenticated_sender</varname>. It
6038 overrides the sender address that is created from the caller&#x2019;s login id for
6039 messages from local sources, except when <option>-bh</option> is used, when there is no
6040 default. For both <option>-bh</option> and <option>-bs</option>, an authenticated sender that is
6041 specified on a MAIL command overrides this value. See chapter
6042 <xref linkend="CHAPSMTPAUTH"/> for a discussion of authenticated senders.
6043 </para>
6044 </listitem></varlistentry>
6045 <varlistentry>
6046 <term><option>-oMi</option>&nbsp;&lt;<emphasis>interface&nbsp;address</emphasis>&gt;</term>
6047 <listitem>
6048 <para>
6049 <indexterm role="option">
6050 <primary><option>-oMi</option></primary>
6051 </indexterm>
6052 <indexterm role="concept">
6053 <primary>interface</primary>
6054 <secondary>address, specifying for local message</secondary>
6055 </indexterm>
6056 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMi</option>
6057 option sets the IP interface address value. A port number may be included,
6058 using the same syntax as for <option>-oMa</option>. The interface address is placed in
6059 <varname>$received_ip_address</varname> and the port number, if present, in <varname>$received_port</varname>.
6060 </para>
6061 </listitem></varlistentry>
6062 <varlistentry>
6063 <term><option>-oMr</option>&nbsp;&lt;<emphasis>protocol&nbsp;name</emphasis>&gt;</term>
6064 <listitem>
6065 <para>
6066 <indexterm role="option">
6067 <primary><option>-oMr</option></primary>
6068 </indexterm>
6069 <indexterm role="concept">
6070 <primary>protocol, specifying for local message</primary>
6071 </indexterm>
6072 <indexterm role="variable">
6073 <primary><varname>$received_protocol</varname></primary>
6074 </indexterm>
6075 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMr</option>
6076 option sets the received protocol value that is stored in
6077 <varname>$received_protocol</varname>. However, it does not apply (and is ignored) when <option>-bh</option>
6078 or <option>-bs</option> is used. For <option>-bh</option>, the protocol is forced to one of the standard
6079 SMTP protocol names (see the description of <varname>$received_protocol</varname> in section
6080 <xref linkend="SECTexpvar"/>). For <option>-bs</option>, the protocol is always <quote>local-</quote> followed by
6081 one of those same names. For <option>-bS</option> (batched SMTP) however, the protocol can
6082 be set by <option>-oMr</option>.
6083 </para>
6084 </listitem></varlistentry>
6085 <varlistentry>
6086 <term><option>-oMs</option>&nbsp;&lt;<emphasis>host&nbsp;name</emphasis>&gt;</term>
6087 <listitem>
6088 <para>
6089 <indexterm role="option">
6090 <primary><option>-oMs</option></primary>
6091 </indexterm>
6092 <indexterm role="concept">
6093 <primary>sender</primary>
6094 <secondary>host name, specifying for local message</secondary>
6095 </indexterm>
6096 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMs</option>
6097 option sets the sender host name in <varname>$sender_host_name</varname>. When this option is
6098 present, Exim does not attempt to look up a host name from an IP address; it
6099 uses the name it is given.
6100 </para>
6101 </listitem></varlistentry>
6102 <varlistentry>
6103 <term><option>-oMt</option>&nbsp;&lt;<emphasis>ident&nbsp;string</emphasis>&gt;</term>
6104 <listitem>
6105 <para>
6106 <indexterm role="option">
6107 <primary><option>-oMt</option></primary>
6108 </indexterm>
6109 <indexterm role="concept">
6110 <primary>sender</primary>
6111 <secondary>ident string, specifying for local message</secondary>
6112 </indexterm>
6113 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMt</option>
6114 option sets the sender ident value in <varname>$sender_ident</varname>. The default setting for
6115 local callers is the login id of the calling process, except when <option>-bh</option> is
6116 used, when there is no default.
6117 </para>
6118 </listitem></varlistentry>
6119 <varlistentry>
6120 <term><option>-om</option></term>
6121 <listitem>
6122 <para>
6123 <indexterm role="option">
6124 <primary><option>-om</option></primary>
6125 </indexterm>
6126 <indexterm role="concept">
6127 <primary>Sendmail compatibility</primary>
6128 <secondary><option>-om</option> option ignored</secondary>
6129 </indexterm>
6130 In Sendmail, this option means <quote>me too</quote>, indicating that the sender of a
6131 message should receive a copy of the message if the sender appears in an alias
6132 expansion. Exim always does this, so the option does nothing.
6133 </para>
6134 </listitem></varlistentry>
6135 <varlistentry>
6136 <term><option>-oo</option></term>
6137 <listitem>
6138 <para>
6139 <indexterm role="option">
6140 <primary><option>-oo</option></primary>
6141 </indexterm>
6142 <indexterm role="concept">
6143 <primary>Sendmail compatibility</primary>
6144 <secondary><option>-oo</option> option ignored</secondary>
6145 </indexterm>
6146 This option is ignored. In Sendmail it specifies <quote>old style headers</quote>,
6147 whatever that means.
6148 </para>
6149 </listitem></varlistentry>
6150 <varlistentry>
6151 <term><option>-oP</option>&nbsp;&lt;<emphasis>path</emphasis>&gt;</term>
6152 <listitem>
6153 <para>
6154 <indexterm role="option">
6155 <primary><option>-oP</option></primary>
6156 </indexterm>
6157 <indexterm role="concept">
6158 <primary>pid (process id)</primary>
6159 <secondary>of daemon</secondary>
6160 </indexterm>
6161 <indexterm role="concept">
6162 <primary>daemon</primary>
6163 <secondary>process id (pid)</secondary>
6164 </indexterm>
6165 This option is useful only in conjunction with <option>-bd</option> or <option>-q</option> with a time
6166 value. The option specifies the file to which the process id of the daemon is
6167 written. When <option>-oX</option> is used with <option>-bd</option>, or when <option>-q</option> with a time is used
6168 without <option>-bd</option>, this is the only way of causing Exim to write a pid file,
6169 because in those cases, the normal pid file is not used.
6170 </para>
6171 </listitem></varlistentry>
6172 <varlistentry>
6173 <term><option>-or</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
6174 <listitem>
6175 <para>
6176 <indexterm role="option">
6177 <primary><option>-or</option></primary>
6178 </indexterm>
6179 <indexterm role="concept">
6180 <primary>timeout</primary>
6181 <secondary>for non-SMTP input</secondary>
6182 </indexterm>
6183 This option sets a timeout value for incoming non-SMTP messages. If it is not
6184 set, Exim will wait forever for the standard input. The value can also be set
6185 by the <option>receive_timeout</option> option. The format used for specifying times is
6186 described in section <xref linkend="SECTtimeformat"/>.
6187 </para>
6188 </listitem></varlistentry>
6189 <varlistentry>
6190 <term><option>-os</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
6191 <listitem>
6192 <para>
6193 <indexterm role="option">
6194 <primary><option>-os</option></primary>
6195 </indexterm>
6196 <indexterm role="concept">
6197 <primary>timeout</primary>
6198 <secondary>for SMTP input</secondary>
6199 </indexterm>
6200 <indexterm role="concept">
6201 <primary>SMTP</primary>
6202 <secondary>input timeout</secondary>
6203 </indexterm>
6204 This option sets a timeout value for incoming SMTP messages. The timeout
6205 applies to each SMTP command and block of data. The value can also be set by
6206 the <option>smtp_receive_timeout</option> option; it defaults to 5 minutes. The format used
6207 for specifying times is described in section <xref linkend="SECTtimeformat"/>.
6208 </para>
6209 </listitem></varlistentry>
6210 <varlistentry>
6211 <term><option>-ov</option></term>
6212 <listitem>
6213 <para>
6214 <indexterm role="option">
6215 <primary><option>-ov</option></primary>
6216 </indexterm>
6217 This option has exactly the same effect as <option>-v</option>.
6218 </para>
6219 </listitem></varlistentry>
6220 <varlistentry>
6221 <term><option>-oX</option>&nbsp;&lt;<emphasis>number&nbsp;or&nbsp;string</emphasis>&gt;</term>
6222 <listitem>
6223 <para>
6224 <indexterm role="option">
6225 <primary><option>-oX</option></primary>
6226 </indexterm>
6227 <indexterm role="concept">
6228 <primary>TCP/IP</primary>
6229 <secondary>setting listening ports</secondary>
6230 </indexterm>
6231 <indexterm role="concept">
6232 <primary>TCP/IP</primary>
6233 <secondary>setting listening interfaces</secondary>
6234 </indexterm>
6235 <indexterm role="concept">
6236 <primary>port</primary>
6237 <secondary>receiving TCP/IP</secondary>
6238 </indexterm>
6239 This option is relevant only when the <option>-bd</option> (start listening daemon) option
6240 is also given. It controls which ports and interfaces the daemon uses. Details
6241 of the syntax, and how it interacts with configuration file options, are given
6242 in chapter <xref linkend="CHAPinterfaces"/>. When <option>-oX</option> is used to start a daemon, no pid
6243 file is written unless <option>-oP</option> is also present to specify a pid file name.
6244 </para>
6245 </listitem></varlistentry>
6246 <varlistentry>
6247 <term><option>-pd</option></term>
6248 <listitem>
6249 <para>
6250 <indexterm role="option">
6251 <primary><option>-pd</option></primary>
6252 </indexterm>
6253 <indexterm role="concept">
6254 <primary>Perl</primary>
6255 <secondary>starting the interpreter</secondary>
6256 </indexterm>
6257 This option applies when an embedded Perl interpreter is linked with Exim (see
6258 chapter <xref linkend="CHAPperl"/>). It overrides the setting of the <option>perl_at_start</option>
6259 option, forcing the starting of the interpreter to be delayed until it is
6260 needed.
6261 </para>
6262 </listitem></varlistentry>
6263 <varlistentry>
6264 <term><option>-ps</option></term>
6265 <listitem>
6266 <para>
6267 <indexterm role="option">
6268 <primary><option>-ps</option></primary>
6269 </indexterm>
6270 <indexterm role="concept">
6271 <primary>Perl</primary>
6272 <secondary>starting the interpreter</secondary>
6273 </indexterm>
6274 This option applies when an embedded Perl interpreter is linked with Exim (see
6275 chapter <xref linkend="CHAPperl"/>). It overrides the setting of the <option>perl_at_start</option>
6276 option, forcing the starting of the interpreter to occur as soon as Exim is
6277 started.
6278 </para>
6279 </listitem></varlistentry>
6280 <varlistentry>
6281 <term><option>-p</option>&lt;<emphasis>rval</emphasis>&gt;:&lt;<emphasis>sval</emphasis>&gt;</term>
6282 <listitem>
6283 <para>
6284 <indexterm role="option">
6285 <primary><option>-p</option></primary>
6286 </indexterm>
6287 For compatibility with Sendmail, this option is equivalent to
6288 </para>
6289 <literallayout>
6290 <literal>-oMr</literal> &lt;<emphasis>rval</emphasis>&gt; <literal>-oMs</literal> &lt;<emphasis>sval</emphasis>&gt;
6291 </literallayout>
6292 <para>
6293 It sets the incoming protocol and host name (for trusted callers). The
6294 host name and its colon can be omitted when only the protocol is to be set.
6295 Note the Exim already has two private options, <option>-pd</option> and <option>-ps</option>, that refer
6296 to embedded Perl. It is therefore impossible to set a protocol value of <literal>p</literal>
6297 or <literal>s</literal> using this option (but that does not seem a real limitation).
6298 </para>
6299 </listitem></varlistentry>
6300 <varlistentry>
6301 <term><option>-q</option></term>
6302 <listitem>
6303 <para>
6304 <indexterm role="option">
6305 <primary><option>-q</option></primary>
6306 </indexterm>
6307 <indexterm role="concept">
6308 <primary>queue runner</primary>
6309 <secondary>starting manually</secondary>
6310 </indexterm>
6311 This option is normally restricted to admin users. However, there is a
6312 configuration option called <option>prod_requires_admin</option> which can be set false to
6313 relax this restriction (and also the same requirement for the <option>-M</option>, <option>-R</option>,
6314 and <option>-S</option> options).
6315 </para>
6316 <para>
6317 <indexterm role="concept">
6318 <primary>queue runner</primary>
6319 <secondary>description of operation</secondary>
6320 </indexterm>
6321 The <option>-q</option> option starts one queue runner process. This scans the queue of
6322 waiting messages, and runs a delivery process for each one in turn. It waits
6323 for each delivery process to finish before starting the next one. A delivery
6324 process may not actually do any deliveries if the retry times for the addresses
6325 have not been reached. Use <option>-qf</option> (see below) if you want to override this.
6326 </para>
6327 <para>
6328 If
6329 <indexterm role="concept">
6330 <primary>SMTP</primary>
6331 <secondary>passed connection</secondary>
6332 </indexterm>
6333 <indexterm role="concept">
6334 <primary>SMTP</primary>
6335 <secondary>multiple deliveries</secondary>
6336 </indexterm>
6337 <indexterm role="concept">
6338 <primary>multiple SMTP deliveries</primary>
6339 </indexterm>
6340 the delivery process spawns other processes to deliver other messages down
6341 passed SMTP connections, the queue runner waits for these to finish before
6342 proceeding.
6343 </para>
6344 <para>
6345 When all the queued messages have been considered, the original queue runner
6346 process terminates. In other words, a single pass is made over the waiting
6347 mail, one message at a time. Use <option>-q</option> with a time (see below) if you want
6348 this to be repeated periodically.
6349 </para>
6350 <para>
6351 Exim processes the waiting messages in an unpredictable order. It isn&#x2019;t very
6352 random, but it is likely to be different each time, which is all that matters.
6353 If one particular message screws up a remote MTA, other messages to the same
6354 MTA have a chance of getting through if they get tried first.
6355 </para>
6356 <para>
6357 It is possible to cause the messages to be processed in lexical message id
6358 order, which is essentially the order in which they arrived, by setting the
6359 <option>queue_run_in_order</option> option, but this is not recommended for normal use.
6360 </para>
6361 </listitem></varlistentry>
6362 <varlistentry>
6363 <term><option>-q</option>&lt;<emphasis>qflags</emphasis>&gt;</term>
6364 <listitem>
6365 <para>
6366 The <option>-q</option> option may be followed by one or more flag letters that change its
6367 behaviour. They are all optional, but if more than one is present, they must
6368 appear in the correct order. Each flag is described in a separate item below.
6369 </para>
6370 </listitem></varlistentry>
6371 <varlistentry>
6372 <term><option>-qq...</option></term>
6373 <listitem>
6374 <para>
6375 <indexterm role="option">
6376 <primary><option>-qq</option></primary>
6377 </indexterm>
6378 <indexterm role="concept">
6379 <primary>queue</primary>
6380 <secondary>double scanning</secondary>
6381 </indexterm>
6382 <indexterm role="concept">
6383 <primary>queue</primary>
6384 <secondary>routing</secondary>
6385 </indexterm>
6386 <indexterm role="concept">
6387 <primary>routing</primary>
6388 <secondary>whole queue before delivery</secondary>
6389 </indexterm>
6390 An option starting with <option>-qq</option> requests a two-stage queue run. In the first
6391 stage, the queue is scanned as if the <option>queue_smtp_domains</option> option matched
6392 every domain. Addresses are routed, local deliveries happen, but no remote
6393 transports are run.
6394 </para>
6395 <para>
6396 <indexterm role="concept">
6397 <primary>hints database</primary>
6398 <secondary>remembering routing</secondary>
6399 </indexterm>
6400 The hints database that remembers which messages are waiting for specific hosts
6401 is updated, as if delivery to those hosts had been deferred. After this is
6402 complete, a second, normal queue scan happens, with routing and delivery taking
6403 place as normal. Messages that are routed to the same host should mostly be
6404 delivered down a single SMTP
6405 <indexterm role="concept">
6406 <primary>SMTP</primary>
6407 <secondary>passed connection</secondary>
6408 </indexterm>
6409 <indexterm role="concept">
6410 <primary>SMTP</primary>
6411 <secondary>multiple deliveries</secondary>
6412 </indexterm>
6413 <indexterm role="concept">
6414 <primary>multiple SMTP deliveries</primary>
6415 </indexterm>
6416 connection because of the hints that were set up during the first queue scan.
6417 This option may be useful for hosts that are connected to the Internet
6418 intermittently.
6419 </para>
6420 </listitem></varlistentry>
6421 <varlistentry>
6422 <term><option>-q[q]i...</option></term>
6423 <listitem>
6424 <para>
6425 <indexterm role="option">
6426 <primary><option>-qi</option></primary>
6427 </indexterm>
6428 <indexterm role="concept">
6429 <primary>queue</primary>
6430 <secondary>initial delivery</secondary>
6431 </indexterm>
6432 If the <emphasis>i</emphasis> flag is present, the queue runner runs delivery processes only for
6433 those messages that haven&#x2019;t previously been tried. (<emphasis>i</emphasis> stands for <quote>initial
6434 delivery</quote>.) This can be helpful if you are putting messages on the queue using
6435 <option>-odq</option> and want a queue runner just to process the new messages.
6436 </para>
6437 </listitem></varlistentry>
6438 <varlistentry>
6439 <term><option>-q[q][i]f...</option></term>
6440 <listitem>
6441 <para>
6442 <indexterm role="option">
6443 <primary><option>-qf</option></primary>
6444 </indexterm>
6445 <indexterm role="concept">
6446 <primary>queue</primary>
6447 <secondary>forcing delivery</secondary>
6448 </indexterm>
6449 <indexterm role="concept">
6450 <primary>delivery</primary>
6451 <secondary>forcing in queue run</secondary>
6452 </indexterm>
6453 If one <emphasis>f</emphasis> flag is present, a delivery attempt is forced for each non-frozen
6454 message, whereas without <emphasis>f</emphasis> only those non-frozen addresses that have passed
6455 their retry times are tried.
6456 </para>
6457 </listitem></varlistentry>
6458 <varlistentry>
6459 <term><option>-q[q][i]ff...</option></term>
6460 <listitem>
6461 <para>
6462 <indexterm role="option">
6463 <primary><option>-qff</option></primary>
6464 </indexterm>
6465 <indexterm role="concept">
6466 <primary>frozen messages</primary>
6467 <secondary>forcing delivery</secondary>
6468 </indexterm>
6469 If <emphasis>ff</emphasis> is present, a delivery attempt is forced for every message, whether
6470 frozen or not.
6471 </para>
6472 </listitem></varlistentry>
6473 <varlistentry>
6474 <term><option>-q[q][i][f[f]]l</option></term>
6475 <listitem>
6476 <para>
6477 <indexterm role="option">
6478 <primary><option>-ql</option></primary>
6479 </indexterm>
6480 <indexterm role="concept">
6481 <primary>queue</primary>
6482 <secondary>local deliveries only</secondary>
6483 </indexterm>
6484 The <emphasis>l</emphasis> (the letter <quote>ell</quote>) flag specifies that only local deliveries are to
6485 be done. If a message requires any remote deliveries, it remains on the queue
6486 for later delivery.
6487 </para>
6488 </listitem></varlistentry>
6489 <varlistentry>
6490 <term><option>-q</option>&lt;<emphasis>qflags</emphasis>&gt;&nbsp;&lt;<emphasis>start&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>end&nbsp;id</emphasis>&gt;</term>
6491 <listitem>
6492 <para>
6493 <indexterm role="concept">
6494 <primary>queue</primary>
6495 <secondary>delivering specific messages</secondary>
6496 </indexterm>
6497 When scanning the queue, Exim can be made to skip over messages whose ids are
6498 lexically less than a given value by following the <option>-q</option> option with a
6499 starting message id. For example:
6500 </para>
6501 <literallayout class="monospaced">
6502 exim -q 0t5C6f-0000c8-00
6503 </literallayout>
6504 <para>
6505 Messages that arrived earlier than <literal>0t5C6f-0000c8-00</literal> are not inspected. If a
6506 second message id is given, messages whose ids are lexically greater than it
6507 are also skipped. If the same id is given twice, for example,
6508 </para>
6509 <literallayout class="monospaced">
6510 exim -q 0t5C6f-0000c8-00 0t5C6f-0000c8-00
6511 </literallayout>
6512 <para>
6513 just one delivery process is started, for that message. This differs from
6514 <option>-M</option> in that retry data is respected, and it also differs from <option>-Mc</option> in
6515 that it counts as a delivery from a queue run. Note that the selection
6516 mechanism does not affect the order in which the messages are scanned. There
6517 are also other ways of selecting specific sets of messages for delivery in a
6518 queue run &ndash; see <option>-R</option> and <option>-S</option>.
6519 </para>
6520 </listitem></varlistentry>
6521 <varlistentry>
6522 <term><option>-q</option>&lt;<emphasis>qflags</emphasis>&gt;&lt;<emphasis>time</emphasis>&gt;</term>
6523 <listitem>
6524 <para>
6525 <indexterm role="concept">
6526 <primary>queue runner</primary>
6527 <secondary>starting periodically</secondary>
6528 </indexterm>
6529 <indexterm role="concept">
6530 <primary>periodic queue running</primary>
6531 </indexterm>
6532 When a time value is present, the <option>-q</option> option causes Exim to run as a daemon,
6533 starting a queue runner process at intervals specified by the given time value
6534 (whose format is described in section <xref linkend="SECTtimeformat"/>). This form of the
6535 <option>-q</option> option is commonly combined with the <option>-bd</option> option, in which case a
6536 single daemon process handles both functions. A common way of starting up a
6537 combined daemon at system boot time is to use a command such as
6538 </para>
6539 <literallayout class="monospaced">
6540 /usr/exim/bin/exim -bd -q30m
6541 </literallayout>
6542 <para>
6543 Such a daemon listens for incoming SMTP calls, and also starts a queue runner
6544 process every 30 minutes.
6545 </para>
6546 <para>
6547 When a daemon is started by <option>-q</option> with a time value, but without <option>-bd</option>, no
6548 pid file is written unless one is explicitly requested by the <option>-oP</option> option.
6549 </para>
6550 </listitem></varlistentry>
6551 <varlistentry>
6552 <term><option>-qR</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6553 <listitem>
6554 <para>
6555 <indexterm role="option">
6556 <primary><option>-qR</option></primary>
6557 </indexterm>
6558 This option is synonymous with <option>-R</option>. It is provided for Sendmail
6559 compatibility.
6560 </para>
6561 </listitem></varlistentry>
6562 <varlistentry>
6563 <term><option>-qS</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6564 <listitem>
6565 <para>
6566 <indexterm role="option">
6567 <primary><option>-qS</option></primary>
6568 </indexterm>
6569 This option is synonymous with <option>-S</option>.
6570 </para>
6571 </listitem></varlistentry>
6572 <varlistentry>
6573 <term><option>-R</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6574 <listitem>
6575 <para>
6576 <indexterm role="option">
6577 <primary><option>-R</option></primary>
6578 </indexterm>
6579 <indexterm role="concept">
6580 <primary>queue runner</primary>
6581 <secondary>for specific recipients</secondary>
6582 </indexterm>
6583 <indexterm role="concept">
6584 <primary>delivery</primary>
6585 <secondary>to given domain</secondary>
6586 </indexterm>
6587 <indexterm role="concept">
6588 <primary>domain</primary>
6589 <secondary>delivery to</secondary>
6590 </indexterm>
6591 The &lt;<emphasis>rsflags</emphasis>&gt; may be empty, in which case the white space before the string
6592 is optional, unless the string is <emphasis>f</emphasis>, <emphasis>ff</emphasis>, <emphasis>r</emphasis>, <emphasis>rf</emphasis>, or <emphasis>rff</emphasis>,
6593 which are the possible values for &lt;<emphasis>rsflags</emphasis>&gt;. White space is required if
6594 &lt;<emphasis>rsflags</emphasis>&gt; is not empty.
6595 </para>
6596 <para>
6597 This option is similar to <option>-q</option> with no time value, that is, it causes Exim to
6598 perform a single queue run, except that, when scanning the messages on the
6599 queue, Exim processes only those that have at least one undelivered recipient
6600 address containing the given string, which is checked in a case-independent
6601 way. If the &lt;<emphasis>rsflags</emphasis>&gt; start with <emphasis>r</emphasis>, &lt;<emphasis>string</emphasis>&gt; is interpreted as a
6602 regular expression; otherwise it is a literal string.
6603 </para>
6604 <para>
6605 If you want to do periodic queue runs for messages with specific recipients,
6606 you can combine <option>-R</option> with <option>-q</option> and a time value. For example:
6607 </para>
6608 <literallayout class="monospaced">
6609 exim -q25m -R @special.domain.example
6610 </literallayout>
6611 <para>
6612 This example does a queue run for messages with recipients in the given domain
6613 every 25 minutes. Any additional flags that are specified with <option>-q</option> are
6614 applied to each queue run.
6615 </para>
6616 <para>
6617 Once a message is selected for delivery by this mechanism, all its addresses
6618 are processed. For the first selected message, Exim overrides any retry
6619 information and forces a delivery attempt for each undelivered address. This
6620 means that if delivery of any address in the first message is successful, any
6621 existing retry information is deleted, and so delivery attempts for that
6622 address in subsequently selected messages (which are processed without forcing)
6623 will run. However, if delivery of any address does not succeed, the retry
6624 information is updated, and in subsequently selected messages, the failing
6625 address will be skipped.
6626 </para>
6627 <para>
6628 <indexterm role="concept">
6629 <primary>frozen messages</primary>
6630 <secondary>forcing delivery</secondary>
6631 </indexterm>
6632 If the &lt;<emphasis>rsflags</emphasis>&gt; contain <emphasis>f</emphasis> or <emphasis>ff</emphasis>, the delivery forcing applies to
6633 all selected messages, not just the first; frozen messages are included when
6634 <emphasis>ff</emphasis> is present.
6635 </para>
6636 <para>
6637 The <option>-R</option> option makes it straightforward to initiate delivery of all messages
6638 to a given domain after a host has been down for some time. When the SMTP
6639 command ETRN is accepted by its ACL (see chapter <xref linkend="CHAPACL"/>), its default
6640 effect is to run Exim with the <option>-R</option> option, but it can be configured to run
6641 an arbitrary command instead.
6642 </para>
6643 </listitem></varlistentry>
6644 <varlistentry>
6645 <term><option>-r</option></term>
6646 <listitem>
6647 <para>
6648 <indexterm role="option">
6649 <primary><option>-r</option></primary>
6650 </indexterm>
6651 This is a documented (for Sendmail) obsolete alternative name for <option>-f</option>.
6652 </para>
6653 </listitem></varlistentry>
6654 <varlistentry>
6655 <term><option>-S</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6656 <listitem>
6657 <para>
6658 <indexterm role="option">
6659 <primary><option>-S</option></primary>
6660 </indexterm>
6661 <indexterm role="concept">
6662 <primary>delivery</primary>
6663 <secondary>from given sender</secondary>
6664 </indexterm>
6665 <indexterm role="concept">
6666 <primary>queue runner</primary>
6667 <secondary>for specific senders</secondary>
6668 </indexterm>
6669 This option acts like <option>-R</option> except that it checks the string against each
6670 message&#x2019;s sender instead of against the recipients. If <option>-R</option> is also set, both
6671 conditions must be met for a message to be selected. If either of the options
6672 has <emphasis>f</emphasis> or <emphasis>ff</emphasis> in its flags, the associated action is taken.
6673 </para>
6674 </listitem></varlistentry>
6675 <varlistentry>
6676 <term><option>-Tqt</option>&nbsp;&lt;<emphasis>times</emphasis>&gt;</term>
6677 <listitem>
6678 <para>
6679 <indexterm role="option">
6680 <primary><option>-Tqt</option></primary>
6681 </indexterm>
6682 This an option that is exclusively for use by the Exim testing suite. It is not
6683 recognized when Exim is run normally. It allows for the setting up of explicit
6684 <quote>queue times</quote> so that various warning/retry features can be tested.
6685 </para>
6686 </listitem></varlistentry>
6687 <varlistentry>
6688 <term><option>-t</option></term>
6689 <listitem>
6690 <para>
6691 <indexterm role="option">
6692 <primary><option>-t</option></primary>
6693 </indexterm>
6694 <indexterm role="concept">
6695 <primary>recipient</primary>
6696 <secondary>extracting from header lines</secondary>
6697 </indexterm>
6698 <indexterm role="concept">
6699 <primary><emphasis>Bcc:</emphasis> header line</primary>
6700 </indexterm>
6701 <indexterm role="concept">
6702 <primary><emphasis>Cc:</emphasis> header line</primary>
6703 </indexterm>
6704 <indexterm role="concept">
6705 <primary><emphasis>To:</emphasis> header line</primary>
6706 </indexterm>
6707 When Exim is receiving a locally-generated, non-SMTP message on its standard
6708 input, the <option>-t</option> option causes the recipients of the message to be obtained
6709 from the <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and <emphasis>Bcc:</emphasis> header lines in the message instead of
6710 from the command arguments. The addresses are extracted before any rewriting
6711 takes place and the <emphasis>Bcc:</emphasis> header line, if present, is then removed.
6712 </para>
6713 <para>
6714 <indexterm role="concept">
6715 <primary>Sendmail compatibility</primary>
6716 <secondary><option>-t</option> option</secondary>
6717 </indexterm>
6718 If the command has any arguments, they specify addresses to which the message
6719 is <emphasis>not</emphasis> to be delivered. That is, the argument addresses are removed from
6720 the recipients list obtained from the headers. This is compatible with Smail 3
6721 and in accordance with the documented behaviour of several versions of
6722 Sendmail, as described in man pages on a number of operating systems (e.g.
6723 Solaris 8, IRIX 6.5, HP-UX 11). However, some versions of Sendmail <emphasis>add</emphasis>
6724 argument addresses to those obtained from the headers, and the O&#x2019;Reilly
6725 Sendmail book documents it that way. Exim can be made to add argument addresses
6726 instead of subtracting them by setting the option
6727 <option>extract_addresses_remove_arguments</option> false.
6728 </para>
6729 <para>
6730 <indexterm role="concept">
6731 <primary><option>Resent-</option> header lines</primary>
6732 <secondary>with <option>-t</option></secondary>
6733 </indexterm>
6734 If there are any <option>Resent-</option> header lines in the message, Exim extracts
6735 recipients from all <emphasis>Resent-To:</emphasis>, <emphasis>Resent-Cc:</emphasis>, and <emphasis>Resent-Bcc:</emphasis> header
6736 lines instead of from <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and <emphasis>Bcc:</emphasis>. This is for compatibility
6737 with Sendmail and other MTAs. (Prior to release 4.20, Exim gave an error if
6738 <option>-t</option> was used in conjunction with <option>Resent-</option> header lines.)
6739 </para>
6740 <para>
6741 RFC 2822 talks about different sets of <option>Resent-</option> header lines (for when a
6742 message is resent several times). The RFC also specifies that they should be
6743 added at the front of the message, and separated by <emphasis>Received:</emphasis> lines. It is
6744 not at all clear how <option>-t</option> should operate in the present of multiple sets,
6745 nor indeed exactly what constitutes a <quote>set</quote>.
6746 In practice, it seems that MUAs do not follow the RFC. The <option>Resent-</option> lines
6747 are often added at the end of the header, and if a message is resent more than
6748 once, it is common for the original set of <option>Resent-</option> headers to be renamed as
6749 <option>X-Resent-</option> when a new set is added. This removes any possible ambiguity.
6750 </para>
6751 </listitem></varlistentry>
6752 <varlistentry>
6753 <term><option>-ti</option></term>
6754 <listitem>
6755 <para>
6756 <indexterm role="option">
6757 <primary><option>-ti</option></primary>
6758 </indexterm>
6759 This option is exactly equivalent to <option>-t</option> <option>-i</option>. It is provided for
6760 compatibility with Sendmail.
6761 </para>
6762 </listitem></varlistentry>
6763 <varlistentry>
6764 <term><option>-tls-on-connect</option></term>
6765 <listitem>
6766 <para>
6767 <indexterm role="option">
6768 <primary><option>-tls-on-connect</option></primary>
6769 </indexterm>
6770 <indexterm role="concept">
6771 <primary>TLS</primary>
6772 <secondary>use without STARTTLS</secondary>
6773 </indexterm>
6774 <indexterm role="concept">
6775 <primary>TLS</primary>
6776 <secondary>automatic start</secondary>
6777 </indexterm>
6778 This option is available when Exim is compiled with TLS support. It forces all
6779 incoming SMTP connections to behave as if the incoming port is listed in the
6780 <option>tls_on_connect_ports</option> option. See section <xref linkend="SECTsupobssmt"/> and chapter
6781 <xref linkend="CHAPTLS"/> for further details.
6782 </para>
6783 </listitem></varlistentry>
6784 <varlistentry>
6785 <term><option>-U</option></term>
6786 <listitem>
6787 <para>
6788 <indexterm role="option">
6789 <primary><option>-U</option></primary>
6790 </indexterm>
6791 <indexterm role="concept">
6792 <primary>Sendmail compatibility</primary>
6793 <secondary><option>-U</option> option ignored</secondary>
6794 </indexterm>
6795 Sendmail uses this option for <quote>initial message submission</quote>, and its
6796 documentation states that in future releases, it may complain about
6797 syntactically invalid messages rather than fixing them when this flag is not
6798 set. Exim ignores this option.
6799 </para>
6800 </listitem></varlistentry>
6801 <varlistentry>
6802 <term><option>-v</option></term>
6803 <listitem>
6804 <para>
6805 <indexterm role="option">
6806 <primary><option>-v</option></primary>
6807 </indexterm>
6808 This option causes Exim to write information to the standard error stream,
6809 describing what it is doing. In particular, it shows the log lines for
6810 receiving and delivering a message, and if an SMTP connection is made, the SMTP
6811 dialogue is shown. Some of the log lines shown may not actually be written to
6812 the log if the setting of <option>log_selector</option> discards them. Any relevant
6813 selectors are shown with each log line. If none are shown, the logging is
6814 unconditional.
6815 </para>
6816 </listitem></varlistentry>
6817 <varlistentry>
6818 <term><option>-x</option></term>
6819 <listitem>
6820 <para>
6821 <indexterm role="option">
6822 <primary><option>-x</option></primary>
6823 </indexterm>
6824 AIX uses <option>-x</option> for a private purpose (<quote>mail from a local mail program has
6825 National Language Support extended characters in the body of the mail item</quote>).
6826 It sets <option>-x</option> when calling the MTA from its <option>mail</option> command. Exim ignores
6827 this option.
6828 </para>
6829 </listitem></varlistentry>
6830 </variablelist>
6831 <para>
6832 <indexterm role="concept" startref="IIDclo1" class="endofrange"/>
6833 <indexterm role="concept" startref="IIDclo2" class="endofrange"/>
6834 </para>
6835 <!-- === End of command line options === -->
6836 </section>
6837 </chapter>
6838
6839 <chapter id="CHAPconf">
6840 <title>The Exim run time configuration file</title>
6841 <titleabbrev>The runtime configuration file</titleabbrev>
6842 <para>
6843 <indexterm role="concept">
6844 <primary>run time configuration</primary>
6845 </indexterm>
6846 <indexterm role="concept">
6847 <primary>configuration file</primary>
6848 <secondary>general description</secondary>
6849 </indexterm>
6850 <indexterm role="concept">
6851 <primary>CONFIGURE_FILE</primary>
6852 </indexterm>
6853 <indexterm role="concept">
6854 <primary>configuration file</primary>
6855 <secondary>errors in</secondary>
6856 </indexterm>
6857 <indexterm role="concept">
6858 <primary>error</primary>
6859 <secondary>in configuration file</secondary>
6860 </indexterm>
6861 <indexterm role="concept">
6862 <primary>return code</primary>
6863 <secondary>for bad configuration</secondary>
6864 </indexterm>
6865 Exim uses a single run time configuration file that is read whenever an Exim
6866 binary is executed. Note that in normal operation, this happens frequently,
6867 because Exim is designed to operate in a distributed manner, without central
6868 control.
6869 </para>
6870 <para>
6871 If a syntax error is detected while reading the configuration file, Exim
6872 writes a message on the standard error, and exits with a non-zero return code.
6873 The message is also written to the panic log. <emphasis role="bold">Note</emphasis>: Only simple syntax
6874 errors can be detected at this time. The values of any expanded options are
6875 not checked until the expansion happens, even when the expansion does not
6876 actually alter the string.
6877 </para>
6878 <para>
6879 The name of the configuration file is compiled into the binary for security
6880 reasons, and is specified by the CONFIGURE_FILE compilation option. In
6881 most configurations, this specifies a single file. However, it is permitted to
6882 give a colon-separated list of file names, in which case Exim uses the first
6883 existing file in the list.
6884 </para>
6885 <para>
6886 <indexterm role="concept">
6887 <primary>EXIM_USER</primary>
6888 </indexterm>
6889 <indexterm role="concept">
6890 <primary>EXIM_GROUP</primary>
6891 </indexterm>
6892 <indexterm role="concept">
6893 <primary>CONFIGURE_OWNER</primary>
6894 </indexterm>
6895 <indexterm role="concept">
6896 <primary>CONFIGURE_GROUP</primary>
6897 </indexterm>
6898 <indexterm role="concept">
6899 <primary>configuration file</primary>
6900 <secondary>ownership</secondary>
6901 </indexterm>
6902 <indexterm role="concept">
6903 <primary>ownership</primary>
6904 <secondary>configuration file</secondary>
6905 </indexterm>
6906 The run time configuration file must be owned by root or by the user that is
6907 specified at compile time by the EXIM_USER option, or by the user that is
6908 specified at compile time by the CONFIGURE_OWNER option (if set). The
6909 configuration file must not be world-writeable or group-writeable, unless its
6910 group is the one specified at compile time by the EXIM_GROUP option or by the
6911 CONFIGURE_GROUP option.
6912 </para>
6913 <para>
6914 <emphasis role="bold">Warning</emphasis>: In a conventional configuration, where the Exim binary is setuid
6915 to root, anybody who is able to edit the run time configuration file has an
6916 easy way to run commands as root. If you make your mail administrators members
6917 of the Exim group, but do not trust them with root, make sure that the run time
6918 configuration is not group writeable.
6919 </para>
6920 <para>
6921 A default configuration file, which will work correctly in simple situations,
6922 is provided in the file <filename>src/configure.default</filename>. If CONFIGURE_FILE
6923 defines just one file name, the installation process copies the default
6924 configuration to a new file of that name if it did not previously exist. If
6925 CONFIGURE_FILE is a list, no default is automatically installed. Chapter
6926 <xref linkend="CHAPdefconfil"/> is a <quote>walk-through</quote> discussion of the default
6927 configuration.
6928 </para>
6929 <section id="SECID40">
6930 <title>Using a different configuration file</title>
6931 <para>
6932 <indexterm role="concept">
6933 <primary>configuration file</primary>
6934 <secondary>alternate</secondary>
6935 </indexterm>
6936 A one-off alternate configuration can be specified by the <option>-C</option> command line
6937 option, which may specify a single file or a list of files. However, when
6938 <option>-C</option> is used, Exim gives up its root privilege, unless called by root or the
6939 Exim user (or unless the argument for <option>-C</option> is identical to the built-in value
6940 from CONFIGURE_FILE). <option>-C</option> is useful mainly for checking the syntax of
6941 configuration files before installing them. No owner or group checks are done
6942 on a configuration file specified by <option>-C</option>.
6943 </para>
6944 <para>
6945 The privileged use of <option>-C</option> by the Exim user can be locked out by setting
6946 ALT_CONFIG_ROOT_ONLY in <filename>Local/Makefile</filename> when building Exim. However,
6947 if you do this, you also lock out the possibility of testing a
6948 configuration using <option>-C</option> right through message reception and delivery, even
6949 if the caller is root. The reception works, but by that time, Exim is running
6950 as the Exim user, so when it re-execs to regain privilege for the delivery, the
6951 use of <option>-C</option> causes privilege to be lost. However, root can test reception and
6952 delivery using two separate commands (one to put a message on the queue, using
6953 <option>-odq</option>, and another to do the delivery, using <option>-M</option>).
6954 </para>
6955 <para>
6956 If ALT_CONFIG_PREFIX is defined <filename>in Local/Makefile</filename>, it specifies a
6957 prefix string with which any file named in a <option>-C</option> command line option must
6958 start. In addition, the file name must not contain the sequence <quote><literal>/../</literal></quote>.
6959 There is no default setting for ALT_CONFIG_PREFIX; when it is unset, any file
6960 name can be used with <option>-C</option>.
6961 </para>
6962 <para>
6963 One-off changes to a configuration can be specified by the <option>-D</option> command line
6964 option, which defines and overrides values for macros used inside the
6965 configuration file. However, like <option>-C</option>, the use of this option by a
6966 non-privileged user causes Exim to discard its root privilege.
6967 If DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the use of <option>-D</option> is
6968 completely disabled, and its use causes an immediate error exit.
6969 </para>
6970 <para>
6971 Some sites may wish to use the same Exim binary on different machines that
6972 share a file system, but to use different configuration files on each machine.
6973 If CONFIGURE_FILE_USE_NODE is defined in <filename>Local/Makefile</filename>, Exim first
6974 looks for a file whose name is the configuration file name followed by a dot
6975 and the machine&#x2019;s node name, as obtained from the <function>uname()</function> function. If this
6976 file does not exist, the standard name is tried. This processing occurs for
6977 each file name in the list given by CONFIGURE_FILE or <option>-C</option>.
6978 </para>
6979 <para>
6980 In some esoteric situations different versions of Exim may be run under
6981 different effective uids and the CONFIGURE_FILE_USE_EUID is defined to
6982 help with this. See the comments in <filename>src/EDITME</filename> for details.
6983 </para>
6984 </section>
6985 <section id="SECTconffilfor">
6986 <title>Configuration file format</title>
6987 <para>
6988 <indexterm role="concept">
6989 <primary>configuration file</primary>
6990 <secondary>format of</secondary>
6991 </indexterm>
6992 <indexterm role="concept">
6993 <primary>format</primary>
6994 <secondary>configuration file</secondary>
6995 </indexterm>
6996 Exim&#x2019;s configuration file is divided into a number of different parts. General
6997 option settings must always appear at the start of the file. The other parts
6998 are all optional, and may appear in any order. Each part other than the first
6999 is introduced by the word <quote>begin</quote> followed by the name of the part. The
7000 optional parts are:
7001 </para>
7002 <itemizedlist>
7003 <listitem>
7004 <para>
7005 <emphasis>ACL</emphasis>: Access control lists for controlling incoming SMTP mail (see chapter
7006 <xref linkend="CHAPACL"/>).
7007 </para>
7008 </listitem>
7009 <listitem>
7010 <para>
7011 <indexterm role="concept">
7012 <primary>AUTH</primary>
7013 <secondary>configuration</secondary>
7014 </indexterm>
7015 <emphasis>authenticators</emphasis>: Configuration settings for the authenticator drivers. These
7016 are concerned with the SMTP AUTH command (see chapter <xref linkend="CHAPSMTPAUTH"/>).
7017 </para>
7018 </listitem>
7019 <listitem>
7020 <para>
7021 <emphasis>routers</emphasis>: Configuration settings for the router drivers. Routers process
7022 addresses and determine how the message is to be delivered (see chapters
7023 <xref linkend="CHAProutergeneric"/>&ndash;<xref linkend="CHAPredirect"/>).
7024 </para>
7025 </listitem>
7026 <listitem>
7027 <para>
7028 <emphasis>transports</emphasis>: Configuration settings for the transport drivers. Transports
7029 define mechanisms for copying messages to destinations (see chapters
7030 <xref linkend="CHAPtransportgeneric"/>&ndash;<xref linkend="CHAPsmtptrans"/>).
7031 </para>
7032 </listitem>
7033 <listitem>
7034 <para>
7035 <emphasis>retry</emphasis>: Retry rules, for use when a message cannot be delivered immediately.
7036 If there is no retry section, or if it is empty (that is, no retry rules are
7037 defined), Exim will not retry deliveries. In this situation, temporary errors
7038 are treated the same as permanent errors. Retry rules are discussed in chapter
7039 <xref linkend="CHAPretry"/>.
7040 </para>
7041 </listitem>
7042 <listitem>
7043 <para>
7044 <emphasis>rewrite</emphasis>: Global address rewriting rules, for use when a message arrives and
7045 when new addresses are generated during delivery. Rewriting is discussed in
7046 chapter <xref linkend="CHAPrewrite"/>.
7047 </para>
7048 </listitem>
7049 <listitem>
7050 <para>
7051 <emphasis>local_scan</emphasis>: Private options for the <function>local_scan()</function> function. If you
7052 want to use this feature, you must set
7053 </para>
7054 <literallayout class="monospaced">
7055 LOCAL_SCAN_HAS_OPTIONS=yes
7056 </literallayout>
7057 <para>
7058 in <filename>Local/Makefile</filename> before building Exim. Details of the <function>local_scan()</function>
7059 facility are given in chapter <xref linkend="CHAPlocalscan"/>.
7060 </para>
7061 </listitem>
7062 </itemizedlist>
7063 <para>
7064 <indexterm role="concept">
7065 <primary>configuration file</primary>
7066 <secondary>leading white space in</secondary>
7067 </indexterm>
7068 <indexterm role="concept">
7069 <primary>configuration file</primary>
7070 <secondary>trailing white space in</secondary>
7071 </indexterm>
7072 <indexterm role="concept">
7073 <primary>white space</primary>
7074 <secondary>in configuration file</secondary>
7075 </indexterm>
7076 Leading and trailing white space in configuration lines is always ignored.
7077 </para>
7078 <para>
7079 Blank lines in the file, and lines starting with a # character (ignoring
7080 leading white space) are treated as comments and are ignored. <emphasis role="bold">Note</emphasis>: A
7081 # character other than at the beginning of a line is not treated specially,
7082 and does not introduce a comment.
7083 </para>
7084 <para>
7085 Any non-comment line can be continued by ending it with a backslash. Note that
7086 the general rule for white space means that trailing white space after the
7087 backslash and leading white space at the start of continuation
7088 lines is ignored. Comment lines beginning with # (but not empty lines) may
7089 appear in the middle of a sequence of continuation lines.
7090 </para>
7091 <para>
7092 A convenient way to create a configuration file is to start from the
7093 default, which is supplied in <filename>src/configure.default</filename>, and add, delete, or
7094 change settings as required.
7095 </para>
7096 <para>
7097 The ACLs, retry rules, and rewriting rules have their own syntax which is
7098 described in chapters <xref linkend="CHAPACL"/>, <xref linkend="CHAPretry"/>, and <xref linkend="CHAPrewrite"/>,
7099 respectively. The other parts of the configuration file have some syntactic
7100 items in common, and these are described below, from section <xref linkend="SECTcos"/>
7101 onwards. Before that, the inclusion, macro, and conditional facilities are
7102 described.
7103 </para>
7104 </section>
7105 <section id="SECID41">
7106 <title>File inclusions in the configuration file</title>
7107 <para>
7108 <indexterm role="concept">
7109 <primary>inclusions in configuration file</primary>
7110 </indexterm>
7111 <indexterm role="concept">
7112 <primary>configuration file</primary>
7113 <secondary>including other files</secondary>
7114 </indexterm>
7115 <indexterm role="concept">
7116 <primary><literal>.include</literal> in configuration file</primary>
7117 </indexterm>
7118 <indexterm role="concept">
7119 <primary><literal>.include_if_exists</literal> in configuration file</primary>
7120 </indexterm>
7121 You can include other files inside Exim&#x2019;s run time configuration file by
7122 using this syntax:
7123 </para>
7124 <literallayout>
7125 <literal>.include</literal> &lt;<emphasis>file name</emphasis>&gt;
7126 <literal>.include_if_exists</literal> &lt;<emphasis>file name</emphasis>&gt;
7127 </literallayout>
7128 <para>
7129 on a line by itself. Double quotes round the file name are optional. If you use
7130 the first form, a configuration error occurs if the file does not exist; the
7131 second form does nothing for non-existent files. In all cases, an absolute file
7132 name is required.
7133 </para>
7134 <para>
7135 Includes may be nested to any depth, but remember that Exim reads its
7136 configuration file often, so it is a good idea to keep them to a minimum.
7137 If you change the contents of an included file, you must HUP the daemon,
7138 because an included file is read only when the configuration itself is read.
7139 </para>
7140 <para>
7141 The processing of inclusions happens early, at a physical line level, so, like
7142 comment lines, an inclusion can be used in the middle of an option setting,
7143 for example:
7144 </para>
7145 <literallayout class="monospaced">
7146 hosts_lookup = a.b.c \
7147                .include /some/file
7148 </literallayout>
7149 <para>
7150 Include processing happens after macro processing (see below). Its effect is to
7151 process the lines of the included file as if they occurred inline where the
7152 inclusion appears.
7153 </para>
7154 </section>
7155 <section id="SECTmacrodefs">
7156 <title>Macros in the configuration file</title>
7157 <para>
7158 <indexterm role="concept">
7159 <primary>macro</primary>
7160 <secondary>description of</secondary>
7161 </indexterm>
7162 <indexterm role="concept">
7163 <primary>configuration file</primary>
7164 <secondary>macros</secondary>
7165 </indexterm>
7166 If a line in the main part of the configuration (that is, before the first
7167 <quote>begin</quote> line) begins with an upper case letter, it is taken as a macro
7168 definition, and must be of the form
7169 </para>
7170 <literallayout>
7171 &lt;<emphasis>name</emphasis>&gt; = &lt;<emphasis>rest of line</emphasis>&gt;
7172 </literallayout>
7173 <para>
7174 The name must consist of letters, digits, and underscores, and need not all be
7175 in upper case, though that is recommended. The rest of the line, including any
7176 continuations, is the replacement text, and has leading and trailing white
7177 space removed. Quotes are not removed. The replacement text can never end with
7178 a backslash character, but this doesn&#x2019;t seem to be a serious limitation.
7179 </para>
7180 <para>
7181 Macros may also be defined between router, transport, authenticator, or ACL
7182 definitions. They may not, however, be defined within an individual driver or
7183 ACL, or in the <option>local_scan</option>, retry, or rewrite sections of the configuration.
7184 </para>
7185 </section>
7186 <section id="SECID42">
7187 <title>Macro substitution</title>
7188 <para>
7189 Once a macro is defined, all subsequent lines in the file (and any included
7190 files) are scanned for the macro name; if there are several macros, the line is
7191 scanned for each in turn, in the order in which the macros are defined. The
7192 replacement text is not re-scanned for the current macro, though it is scanned
7193 for subsequently defined macros. For this reason, a macro name may not contain
7194 the name of a previously defined macro as a substring. You could, for example,
7195 define
7196 </para>
7197 <literallayout>
7198 <literal>ABCD_XYZ = </literal>&lt;<emphasis>something</emphasis>&gt;
7199 <literal>ABCD = </literal>&lt;<emphasis>something else</emphasis>&gt;
7200 </literallayout>
7201 <para>
7202 but putting the definitions in the opposite order would provoke a configuration
7203 error. Macro expansion is applied to individual physical lines from the file,
7204 before checking for line continuation or file inclusion (see above). If a line
7205 consists solely of a macro name, and the expansion of the macro is empty, the
7206 line is ignored. A macro at the start of a line may turn the line into a
7207 comment line or a <literal>.include</literal> line.
7208 </para>
7209 </section>
7210 <section id="SECID43">
7211 <title>Redefining macros</title>
7212 <para>
7213 Once defined, the value of a macro can be redefined later in the configuration
7214 (or in an included file). Redefinition is specified by using <emphasis>==</emphasis> instead of
7215 <emphasis>=</emphasis>. For example:
7216 </para>
7217 <literallayout class="monospaced">
7218 MAC =  initial value
7219 ...
7220 MAC == updated value
7221 </literallayout>
7222 <para>
7223 Redefinition does not alter the order in which the macros are applied to the
7224 subsequent lines of the configuration file. It is still the same order in which
7225 the macros were originally defined. All that changes is the macro&#x2019;s value.
7226 Redefinition makes it possible to accumulate values. For example:
7227 </para>
7228 <literallayout class="monospaced">
7229 MAC =  initial value
7230 ...
7231 MAC == MAC and something added
7232 </literallayout>
7233 <para>
7234 This can be helpful in situations where the configuration file is built
7235 from a number of other files.
7236 </para>
7237 </section>
7238 <section id="SECID44">
7239 <title>Overriding macro values</title>
7240 <para>
7241 The values set for macros in the configuration file can be overridden by the
7242 <option>-D</option> command line option, but Exim gives up its root privilege when <option>-D</option> is
7243 used, unless called by root or the Exim user. A definition on the command line
7244 using the <option>-D</option> option causes all definitions and redefinitions within the
7245 file to be ignored.
7246 </para>
7247 </section>
7248 <section id="SECID45">
7249 <title>Example of macro usage</title>
7250 <para>
7251 As an example of macro usage, consider a configuration where aliases are looked
7252 up in a MySQL database. It helps to keep the file less cluttered if long
7253 strings such as SQL statements are defined separately as macros, for example:
7254 </para>
7255 <literallayout class="monospaced">
7256 ALIAS_QUERY = select mailbox from user where \
7257               login='${quote_mysql:$local_part}';
7258 </literallayout>
7259 <para>
7260 This can then be used in a <command>redirect</command> router setting like this:
7261 </para>
7262 <literallayout class="monospaced">
7263 data = ${lookup mysql{ALIAS_QUERY}}
7264 </literallayout>
7265 <para>
7266 In earlier versions of Exim macros were sometimes used for domain, host, or
7267 address lists. In Exim 4 these are handled better by named lists &ndash; see
7268 section <xref linkend="SECTnamedlists"/>.
7269 </para>
7270 </section>
7271 <section id="SECID46">
7272 <title>Conditional skips in the configuration file</title>
7273 <para>
7274 <indexterm role="concept">
7275 <primary>configuration file</primary>
7276 <secondary>conditional skips</secondary>
7277 </indexterm>
7278 <indexterm role="concept">
7279 <primary><literal>.ifdef</literal></primary>
7280 </indexterm>
7281 You can use the directives <literal>.ifdef</literal>, <literal>.ifndef</literal>, <literal>.elifdef</literal>,
7282 <literal>.elifndef</literal>, <literal>.else</literal>, and <literal>.endif</literal> to dynamically include or exclude
7283 portions of the configuration file. The processing happens whenever the file is
7284 read (that is, when an Exim binary starts to run).
7285 </para>
7286 <para>
7287 The implementation is very simple. Instances of the first four directives must
7288 be followed by text that includes the names of one or macros. The condition
7289 that is tested is whether or not any macro substitution has taken place in the
7290 line. Thus:
7291 </para>
7292 <literallayout class="monospaced">
7293 .ifdef AAA
7294 message_size_limit = 50M
7295 .else
7296 message_size_limit = 100M
7297 .endif
7298 </literallayout>
7299 <para>
7300 sets a message size limit of 50M if the macro <literal>AAA</literal> is defined, and 100M
7301 otherwise. If there is more than one macro named on the line, the condition
7302 is true if any of them are defined. That is, it is an <quote>or</quote> condition. To
7303 obtain an <quote>and</quote> condition, you need to use nested <literal>.ifdef</literal>s.
7304 </para>
7305 <para>
7306 Although you can use a macro expansion to generate one of these directives,
7307 it is not very useful, because the condition <quote>there was a macro substitution
7308 in this line</quote> will always be true.
7309 </para>
7310 <para>
7311 Text following <literal>.else</literal> and <literal>.endif</literal> is ignored, and can be used as comment
7312 to clarify complicated nestings.
7313 </para>
7314 </section>
7315 <section id="SECTcos">
7316 <title>Common option syntax</title>
7317 <para>
7318 <indexterm role="concept">
7319 <primary>common option syntax</primary>
7320 </indexterm>
7321 <indexterm role="concept">
7322 <primary>syntax of common options</primary>
7323 </indexterm>
7324 <indexterm role="concept">
7325 <primary>configuration file</primary>
7326 <secondary>common option syntax</secondary>
7327 </indexterm>
7328 For the main set of options, driver options, and <function>local_scan()</function> options,
7329 each setting is on a line by itself, and starts with a name consisting of
7330 lower-case letters and underscores. Many options require a data value, and in
7331 these cases the name must be followed by an equals sign (with optional white
7332 space) and then the value. For example:
7333 </para>
7334 <literallayout class="monospaced">
7335 qualify_domain = mydomain.example.com
7336 </literallayout>
7337 <para>
7338 <indexterm role="concept">
7339 <primary>hiding configuration option values</primary>
7340 </indexterm>
7341 <indexterm role="concept">
7342 <primary>configuration options</primary>
7343 <secondary>hiding value of</secondary>
7344 </indexterm>
7345 <indexterm role="concept">
7346 <primary>options</primary>
7347 <secondary>hiding value of</secondary>
7348 </indexterm>
7349 Some option settings may contain sensitive data, for example, passwords for
7350 accessing databases. To stop non-admin users from using the <option>-bP</option> command
7351 line option to read these values, you can precede the option settings with the
7352 word <quote>hide</quote>. For example:
7353 </para>
7354 <literallayout class="monospaced">
7355 hide mysql_servers = localhost/users/admin/secret-password
7356 </literallayout>
7357 <para>
7358 For non-admin users, such options are displayed like this:
7359 </para>
7360 <literallayout class="monospaced">
7361 mysql_servers = &lt;value not displayable&gt;
7362 </literallayout>
7363 <para>
7364 If <quote>hide</quote> is used on a driver option, it hides the value of that option on
7365 all instances of the same driver.
7366 </para>
7367 <para>
7368 The following sections describe the syntax used for the different data types
7369 that are found in option settings.
7370 </para>
7371 </section>
7372 <section id="SECID47">
7373 <title>Boolean options</title>
7374 <para>
7375 <indexterm role="concept">
7376 <primary>format</primary>
7377 <secondary>boolean</secondary>
7378 </indexterm>
7379 <indexterm role="concept">
7380 <primary>boolean configuration values</primary>
7381 </indexterm>
7382 <indexterm role="option">
7383 <primary><option>no_</option><emphasis>xxx</emphasis></primary>
7384 </indexterm>
7385 <indexterm role="option">
7386 <primary><option>not_</option><emphasis>xxx</emphasis></primary>
7387 </indexterm>
7388 Options whose type is given as boolean are on/off switches. There are two
7389 different ways of specifying such options: with and without a data value. If
7390 the option name is specified on its own without data, the switch is turned on;
7391 if it is preceded by <quote>no_</quote> or <quote>not_</quote> the switch is turned off. However,
7392 boolean options may be followed by an equals sign and one of the words
7393 <quote>true</quote>, <quote>false</quote>, <quote>yes</quote>, or <quote>no</quote>, as an alternative syntax. For example,
7394 the following two settings have exactly the same effect:
7395 </para>
7396 <literallayout class="monospaced">
7397 queue_only
7398 queue_only = true
7399 </literallayout>
7400 <para>
7401 The following two lines also have the same (opposite) effect:
7402 </para>
7403 <literallayout class="monospaced">
7404 no_queue_only
7405 queue_only = false
7406 </literallayout>
7407 <para>
7408 You can use whichever syntax you prefer.
7409 </para>
7410 </section>
7411 <section id="SECID48">
7412 <title>Integer values</title>
7413 <para>
7414 <indexterm role="concept">
7415 <primary>integer configuration values</primary>
7416 </indexterm>
7417 <indexterm role="concept">
7418 <primary>format</primary>
7419 <secondary>integer</secondary>
7420 </indexterm>
7421 If an option&#x2019;s type is given as <quote>integer</quote>, the value can be given in decimal,
7422 hexadecimal, or octal. If it starts with a digit greater than zero, a decimal
7423 number is assumed. Otherwise, it is treated as an octal number unless it starts
7424 with the characters <quote>0x</quote>, in which case the remainder is interpreted as a
7425 hexadecimal number.
7426 </para>
7427 <para>
7428 If an integer value is followed by the letter K, it is multiplied by 1024; if
7429 it is followed by the letter M, it is multiplied by 1024x1024. When the values
7430 of integer option settings are output, values which are an exact multiple of
7431 1024 or 1024x1024 are sometimes, but not always, printed using the letters K
7432 and M. The printing style is independent of the actual input format that was
7433 used.
7434 </para>
7435 </section>
7436 <section id="SECID49">
7437 <title>Octal integer values</title>
7438 <para>
7439 <indexterm role="concept">
7440 <primary>integer format</primary>
7441 </indexterm>
7442 <indexterm role="concept">
7443 <primary>format</primary>
7444 <secondary>octal integer</secondary>
7445 </indexterm>
7446 If an option&#x2019;s type is given as <quote>octal integer</quote>, its value is always
7447 interpreted as an octal number, whether or not it starts with the digit zero.
7448 Such options are always output in octal.
7449 </para>
7450 </section>
7451 <section id="SECID50">
7452 <title>Fixed point numbers</title>
7453 <para>
7454 <indexterm role="concept">
7455 <primary>fixed point configuration values</primary>
7456 </indexterm>
7457 <indexterm role="concept">
7458 <primary>format</primary>
7459 <secondary>fixed point</secondary>
7460 </indexterm>
7461 If an option&#x2019;s type is given as <quote>fixed-point</quote>, its value must be a decimal
7462 integer, optionally followed by a decimal point and up to three further digits.
7463 </para>
7464 </section>
7465 <section id="SECTtimeformat">
7466 <title>Time intervals</title>
7467 <para>
7468 <indexterm role="concept">
7469 <primary>time interval</primary>
7470 <secondary>specifying in configuration</secondary>
7471 </indexterm>
7472 <indexterm role="concept">
7473 <primary>format</primary>
7474 <secondary>time interval</secondary>
7475 </indexterm>
7476 A time interval is specified as a sequence of numbers, each followed by one of
7477 the following letters, with no intervening white space:
7478 </para>
7479 <informaltable frame="none">
7480 <tgroup cols="2" colsep="0" rowsep="0">
7481 <colspec colwidth="30pt" align="left"/>
7482 <colspec colwidth="254pt" align="left"/>
7483 <tbody>
7484 <row>
7485 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>s</option></entry>
7486 <entry>seconds</entry>
7487 </row>
7488 <row>
7489 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>m</option></entry>
7490 <entry>minutes</entry>
7491 </row>
7492 <row>
7493 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>h</option></entry>
7494 <entry>hours</entry>
7495 </row>
7496 <row>
7497 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>d</option></entry>
7498 <entry>days</entry>
7499 </row>
7500 <row>
7501 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>w</option></entry>
7502 <entry>weeks</entry>
7503 </row>
7504 </tbody>
7505 </tgroup>
7506 </informaltable>
7507 <para>
7508 For example, <quote>3h50m</quote> specifies 3 hours and 50 minutes. The values of time
7509 intervals are output in the same format. Exim does not restrict the values; it
7510 is perfectly acceptable, for example, to specify <quote>90m</quote> instead of <quote>1h30m</quote>.
7511 </para>
7512 </section>
7513 <section id="SECTstrings">
7514 <title>String values</title>
7515 <para>
7516 <indexterm role="concept">
7517 <primary>string</primary>
7518 <secondary>format of configuration values</secondary>
7519 </indexterm>
7520 <indexterm role="concept">
7521 <primary>format</primary>
7522 <secondary>string</secondary>
7523 </indexterm>
7524 If an option&#x2019;s type is specified as <quote>string</quote>, the value can be specified with
7525 or without double-quotes. If it does not start with a double-quote, the value
7526 consists of the remainder of the line plus any continuation lines, starting at
7527 the first character after any leading white space, with trailing white space
7528 removed, and with no interpretation of the characters in the string. Because
7529 Exim removes comment lines (those beginning with #) at an early stage, they can
7530 appear in the middle of a multi-line string. The following two settings are
7531 therefore equivalent:
7532 </para>
7533 <literallayout class="monospaced">
7534 trusted_users = uucp:mail
7535 trusted_users = uucp:\
7536                 # This comment line is ignored
7537                 mail
7538 </literallayout>
7539 <para>
7540 <indexterm role="concept">
7541 <primary>string</primary>
7542 <secondary>quoted</secondary>
7543 </indexterm>
7544 <indexterm role="concept">
7545 <primary>escape characters in quoted strings</primary>
7546 </indexterm>
7547 If a string does start with a double-quote, it must end with a closing
7548 double-quote, and any backslash characters other than those used for line
7549 continuation are interpreted as escape characters, as follows:
7550 </para>
7551 <informaltable frame="none">
7552 <tgroup cols="2" colsep="0" rowsep="0">
7553 <colspec colwidth="100pt" align="left"/>
7554 <colspec colwidth="254pt" align="left"/>
7555 <tbody>
7556 <row>
7557 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\\</literal></entry>
7558 <entry>single backslash</entry>
7559 </row>
7560 <row>
7561 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\n</literal></entry>
7562 <entry>newline</entry>
7563 </row>
7564 <row>
7565 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\r</literal></entry>
7566 <entry>carriage return</entry>
7567 </row>
7568 <row>
7569 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\t</literal></entry>
7570 <entry>tab</entry>
7571 </row>
7572 <row>
7573 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\</literal>&lt;<emphasis>octal digits</emphasis>&gt;</entry>
7574 <entry>up to 3 octal digits specify one character</entry>
7575 </row>
7576 <row>
7577 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\x</literal>&lt;<emphasis>hex digits</emphasis>&gt;</entry>
7578 <entry>up to 2 hexadecimal digits specify one character</entry>
7579 </row>
7580 </tbody>
7581 </tgroup>
7582 </informaltable>
7583 <para>
7584 If a backslash is followed by some other character, including a double-quote
7585 character, that character replaces the pair.
7586 </para>
7587 <para>
7588 Quoting is necessary only if you want to make use of the backslash escapes to
7589 insert special characters, or if you need to specify a value with leading or
7590 trailing spaces. These cases are rare, so quoting is almost never needed in
7591 current versions of Exim. In versions of Exim before 3.14, quoting was required
7592 in order to continue lines, so you may come across older configuration files
7593 and examples that apparently quote unnecessarily.
7594 </para>
7595 </section>
7596 <section id="SECID51">
7597 <title>Expanded strings</title>
7598 <para>
7599 <indexterm role="concept">
7600 <primary>expansion</primary>
7601 <secondary>definition of</secondary>
7602 </indexterm>
7603 Some strings in the configuration file are subjected to <emphasis>string expansion</emphasis>,
7604 by which means various parts of the string may be changed according to the
7605 circumstances (see chapter <xref linkend="CHAPexpand"/>). The input syntax for such strings
7606 is as just described; in particular, the handling of backslashes in quoted
7607 strings is done as part of the input process, before expansion takes place.
7608 However, backslash is also an escape character for the expander, so any
7609 backslashes that are required for that reason must be doubled if they are
7610 within a quoted configuration string.
7611 </para>
7612 </section>
7613 <section id="SECID52">
7614 <title>User and group names</title>
7615 <para>
7616 <indexterm role="concept">
7617 <primary>user name</primary>
7618 <secondary>format of</secondary>
7619 </indexterm>
7620 <indexterm role="concept">
7621 <primary>format</primary>
7622 <secondary>user name</secondary>
7623 </indexterm>
7624 <indexterm role="concept">
7625 <primary>groups</primary>
7626 <secondary>name format</secondary>
7627 </indexterm>
7628 <indexterm role="concept">
7629 <primary>format</primary>
7630 <secondary>group name</secondary>
7631 </indexterm>
7632 User and group names are specified as strings, using the syntax described
7633 above, but the strings are interpreted specially. A user or group name must
7634 either consist entirely of digits, or be a name that can be looked up using the
7635 <function>getpwnam()</function> or <function>getgrnam()</function> function, as appropriate.
7636 </para>
7637 </section>
7638 <section id="SECTlistconstruct">
7639 <title>List construction</title>
7640 <para>
7641 <indexterm role="concept">
7642 <primary>list</primary>
7643 <secondary>syntax of in configuration</secondary>
7644 </indexterm>
7645 <indexterm role="concept">
7646 <primary>format</primary>
7647 <secondary>list item in configuration</secondary>
7648 </indexterm>
7649 <indexterm role="concept">
7650 <primary>string</primary>
7651 <secondary>list, definition of</secondary>
7652 </indexterm>
7653 The data for some configuration options is a list of items, with colon as the
7654 default separator. Many of these options are shown with type <quote>string list</quote> in
7655 the descriptions later in this document. Others are listed as <quote>domain list</quote>,
7656 <quote>host list</quote>, <quote>address list</quote>, or <quote>local part list</quote>. Syntactically, they
7657 are all the same; however, those other than <quote>string list</quote> are subject to
7658 particular kinds of interpretation, as described in chapter
7659 <xref linkend="CHAPdomhosaddlists"/>.
7660 </para>
7661 <para>
7662 In all these cases, the entire list is treated as a single string as far as the
7663 input syntax is concerned. The <option>trusted_users</option> setting in section
7664 <xref linkend="SECTstrings"/> above is an example. If a colon is actually needed in an item
7665 in a list, it must be entered as two colons. Leading and trailing white space
7666 on each item in a list is ignored. This makes it possible to include items that
7667 start with a colon, and in particular, certain forms of IPv6 address. For
7668 example, the list
7669 </para>
7670 <literallayout class="monospaced">
7671 local_interfaces = 127.0.0.1 : ::::1
7672 </literallayout>
7673 <para>
7674 contains two IP addresses, the IPv4 address 127.0.0.1 and the IPv6 address ::1.
7675 </para>
7676 <para>
7677 <emphasis role="bold">Note</emphasis>: Although leading and trailing white space is ignored in individual
7678 list items, it is not ignored when parsing the list. The space after the first
7679 colon in the example above is necessary. If it were not there, the list would
7680 be interpreted as the two items 127.0.0.1:: and 1.
7681 </para>
7682 </section>
7683 <section id="SECID53">
7684 <title>Changing list separators</title>
7685 <para>
7686 <indexterm role="concept">
7687 <primary>list separator</primary>
7688 <secondary>changing</secondary>
7689 </indexterm>
7690 <indexterm role="concept">
7691 <primary>IPv6</primary>
7692 <secondary>addresses in lists</secondary>
7693 </indexterm>
7694 Doubling colons in IPv6 addresses is an unwelcome chore, so a mechanism was
7695 introduced to allow the separator character to be changed. If a list begins
7696 with a left angle bracket, followed by any punctuation character, that
7697 character is used instead of colon as the list separator. For example, the list
7698 above can be rewritten to use a semicolon separator like this:
7699 </para>
7700 <literallayout class="monospaced">
7701 local_interfaces = &lt;; 127.0.0.1 ; ::1
7702 </literallayout>
7703 <para>
7704 This facility applies to all lists, with the exception of the list in
7705 <option>log_file_path</option>. It is recommended that the use of non-colon separators be
7706 confined to circumstances where they really are needed.
7707 </para>
7708 <para>
7709 <indexterm role="concept">
7710 <primary>list separator</primary>
7711 <secondary>newline as</secondary>
7712 </indexterm>
7713 <indexterm role="concept">
7714 <primary>newline</primary>
7715 <secondary>as list separator</secondary>
7716 </indexterm>
7717 It is also possible to use newline and other control characters (those with
7718 code values less than 32, plus DEL) as separators in lists. Such separators
7719 must be provided literally at the time the list is processed. For options that
7720 are string-expanded, you can write the separator using a normal escape
7721 sequence. This will be processed by the expander before the string is
7722 interpreted as a list. For example, if a newline-separated list of domains is
7723 generated by a lookup, you can process it directly by a line such as this:
7724 </para>
7725 <literallayout class="monospaced">
7726 domains = &lt;\n ${lookup mysql{.....}}
7727 </literallayout>
7728 <para>
7729 This avoids having to change the list separator in such data. You are unlikely
7730 to want to use a control character as a separator in an option that is not
7731 expanded, because the value is literal text. However, it can be done by giving
7732 the value in quotes. For example:
7733 </para>
7734 <literallayout class="monospaced">
7735 local_interfaces = "&lt;\n 127.0.0.1 \n ::1"
7736 </literallayout>
7737 <para>
7738 Unlike printing character separators, which can be included in list items by
7739 doubling, it is not possible to include a control character as data when it is
7740 set as the separator. Two such characters in succession are interpreted as
7741 enclosing an empty list item.
7742 </para>
7743 </section>
7744 <section id="SECTempitelis">
7745 <title>Empty items in lists</title>
7746 <para>
7747 <indexterm role="concept">
7748 <primary>list</primary>
7749 <secondary>empty item in</secondary>
7750 </indexterm>
7751 An empty item at the end of a list is always ignored. In other words, trailing
7752 separator characters are ignored. Thus, the list in
7753 </para>
7754 <literallayout class="monospaced">
7755 senders = user@domain :
7756 </literallayout>
7757 <para>
7758 contains only a single item. If you want to include an empty string as one item
7759 in a list, it must not be the last item. For example, this list contains three
7760 items, the second of which is empty:
7761 </para>
7762 <literallayout class="monospaced">
7763 senders = user1@domain : : user2@domain
7764 </literallayout>
7765 <para>
7766 <emphasis role="bold">Note</emphasis>: There must be white space between the two colons, as otherwise they
7767 are interpreted as representing a single colon data character (and the list
7768 would then contain just one item). If you want to specify a list that contains
7769 just one, empty item, you can do it as in this example:
7770 </para>
7771 <literallayout class="monospaced">
7772 senders = :
7773 </literallayout>
7774 <para>
7775 In this case, the first item is empty, and the second is discarded because it
7776 is at the end of the list.
7777 </para>
7778 </section>
7779 <section id="SECTfordricon">
7780 <title>Format of driver configurations</title>
7781 <para>
7782 <indexterm role="concept">
7783 <primary>drivers</primary>
7784 <secondary>configuration format</secondary>
7785 </indexterm>
7786 There are separate parts in the configuration for defining routers, transports,
7787 and authenticators. In each part, you are defining a number of driver
7788 instances, each with its own set of options. Each driver instance is defined by
7789 a sequence of lines like this:
7790 </para>
7791 <literallayout>
7792 &lt;<emphasis>instance name</emphasis>&gt;:
7793   &lt;<emphasis>option</emphasis>&gt;
7794   ...
7795   &lt;<emphasis>option</emphasis>&gt;
7796 </literallayout>
7797 <para>
7798 In the following example, the instance name is <command>localuser</command>, and it is
7799 followed by three options settings:
7800 </para>
7801 <literallayout class="monospaced">
7802 localuser:
7803   driver = accept
7804   check_local_user
7805   transport = local_delivery
7806 </literallayout>
7807 <para>
7808 For each driver instance, you specify which Exim code module it uses &ndash; by the
7809 setting of the <option>driver</option> option &ndash; and (optionally) some configuration
7810 settings. For example, in the case of transports, if you want a transport to
7811 deliver with SMTP you would use the <command>smtp</command> driver; if you want to deliver to
7812 a local file you would use the <command>appendfile</command> driver. Each of the drivers is
7813 described in detail in its own separate chapter later in this manual.
7814 </para>
7815 <para>
7816 You can have several routers, transports, or authenticators that are based on
7817 the same underlying driver (each must have a different instance name).
7818 </para>
7819 <para>
7820 The order in which routers are defined is important, because addresses are
7821 passed to individual routers one by one, in order. The order in which
7822 transports are defined does not matter at all. The order in which
7823 authenticators are defined is used only when Exim, as a client, is searching
7824 them to find one that matches an authentication mechanism offered by the
7825 server.
7826 </para>
7827 <para>
7828 <indexterm role="concept">
7829 <primary>generic options</primary>
7830 </indexterm>
7831 <indexterm role="concept">
7832 <primary>options</primary>
7833 <secondary>generic &ndash; definition of</secondary>
7834 </indexterm>
7835 Within a driver instance definition, there are two kinds of option: <emphasis>generic</emphasis>
7836 and <emphasis>private</emphasis>. The generic options are those that apply to all drivers of the
7837 same type (that is, all routers, all transports or all authenticators). The
7838 <option>driver</option> option is a generic option that must appear in every definition.
7839 <indexterm role="concept">
7840 <primary>private options</primary>
7841 </indexterm>
7842 The private options are special for each driver, and none need appear, because
7843 they all have default values.
7844 </para>
7845 <para>
7846 The options may appear in any order, except that the <option>driver</option> option must
7847 precede any private options, since these depend on the particular driver. For
7848 this reason, it is recommended that <option>driver</option> always be the first option.
7849 </para>
7850 <para>
7851 Driver instance names, which are used for reference in log entries and
7852 elsewhere, can be any sequence of letters, digits, and underscores (starting
7853 with a letter) and must be unique among drivers of the same type. A router and
7854 a transport (for example) can each have the same name, but no two router
7855 instances can have the same name. The name of a driver instance should not be
7856 confused with the name of the underlying driver module. For example, the
7857 configuration lines:
7858 </para>
7859 <literallayout class="monospaced">
7860 remote_smtp:
7861   driver = smtp
7862 </literallayout>
7863 <para>
7864 create an instance of the <command>smtp</command> transport driver whose name is
7865 <command>remote_smtp</command>. The same driver code can be used more than once, with
7866 different instance names and different option settings each time. A second
7867 instance of the <command>smtp</command> transport, with different options, might be defined
7868 thus:
7869 </para>
7870 <literallayout class="monospaced">
7871 special_smtp:
7872   driver = smtp
7873   port = 1234
7874   command_timeout = 10s
7875 </literallayout>
7876 <para>
7877 The names <command>remote_smtp</command> and <command>special_smtp</command> would be used to reference
7878 these transport instances from routers, and these names would appear in log
7879 lines.
7880 </para>
7881 <para>
7882 Comment lines may be present in the middle of driver specifications. The full
7883 list of option settings for any particular driver instance, including all the
7884 defaulted values, can be extracted by making use of the <option>-bP</option> command line
7885 option.
7886 </para>
7887 </section>
7888 </chapter>
7889
7890 <chapter id="CHAPdefconfil">
7891 <title>The default configuration file</title>
7892 <para>
7893 <indexterm role="concept" id="IIDconfiwal" class="startofrange">
7894 <primary>configuration file</primary>
7895 <secondary>default <quote>walk through</quote></secondary>
7896 </indexterm>
7897 <indexterm role="concept">
7898 <primary>default</primary>
7899 <secondary>configuration file <quote>walk through</quote></secondary>
7900 </indexterm>
7901 The default configuration file supplied with Exim as <filename>src/configure.default</filename>
7902 is sufficient for a host with simple mail requirements. As an introduction to
7903 the way Exim is configured, this chapter <quote>walks through</quote> the default
7904 configuration, giving brief explanations of the settings. Detailed descriptions
7905 of the options are given in subsequent chapters. The default configuration file
7906 itself contains extensive comments about ways you might want to modify the
7907 initial settings. However, note that there are many options that are not
7908 mentioned at all in the default configuration.
7909 </para>
7910 <section id="SECTdefconfmain">
7911 <title>Main configuration settings</title>
7912 <para>
7913 The main (global) configuration option settings must always come first in the
7914 file. The first thing you&#x2019;ll see in the file, after some initial comments, is
7915 the line
7916 </para>
7917 <literallayout class="monospaced">
7918 # primary_hostname =
7919 </literallayout>
7920 <para>
7921 This is a commented-out setting of the <option>primary_hostname</option> option. Exim needs
7922 to know the official, fully qualified name of your host, and this is where you
7923 can specify it. However, in most cases you do not need to set this option. When
7924 it is unset, Exim uses the <function>uname()</function> system function to obtain the host name.
7925 </para>
7926 <para>
7927 The first three non-comment configuration lines are as follows:
7928 </para>
7929 <literallayout class="monospaced">
7930 domainlist local_domains = @
7931 domainlist relay_to_domains =
7932 hostlist   relay_from_hosts = 127.0.0.1
7933 </literallayout>
7934 <para>
7935 These are not, in fact, option settings. They are definitions of two named
7936 domain lists and one named host list. Exim allows you to give names to lists of
7937 domains, hosts, and email addresses, in order to make it easier to manage the
7938 configuration file (see section <xref linkend="SECTnamedlists"/>).
7939 </para>
7940 <para>
7941 The first line defines a domain list called <emphasis>local_domains</emphasis>; this is used
7942 later in the configuration to identify domains that are to be delivered
7943 on the local host.
7944 </para>
7945 <para>
7946 <indexterm role="concept">
7947 <primary>@ in a domain list</primary>
7948 </indexterm>
7949 There is just one item in this list, the string <quote>@</quote>. This is a special form
7950 of entry which means <quote>the name of the local host</quote>. Thus, if the local host is
7951 called <emphasis>a.host.example</emphasis>, mail to <emphasis>any.user@a.host.example</emphasis> is expected to
7952 be delivered locally. Because the local host&#x2019;s name is referenced indirectly,
7953 the same configuration file can be used on different hosts.
7954 </para>
7955 <para>
7956 The second line defines a domain list called <emphasis>relay_to_domains</emphasis>, but the
7957 list itself is empty. Later in the configuration we will come to the part that
7958 controls mail relaying through the local host; it allows relaying to any
7959 domains in this list. By default, therefore, no relaying on the basis of a mail
7960 domain is permitted.
7961 </para>
7962 <para>
7963 The third line defines a host list called <emphasis>relay_from_hosts</emphasis>. This list is
7964 used later in the configuration to permit relaying from any host or IP address
7965 that matches the list. The default contains just the IP address of the IPv4
7966 loopback interface, which means that processes on the local host are able to
7967 submit mail for relaying by sending it over TCP/IP to that interface. No other
7968 hosts are permitted to submit messages for relaying.
7969 </para>
7970 <para>
7971 Just to be sure there&#x2019;s no misunderstanding: at this point in the configuration
7972 we aren&#x2019;t actually setting up any controls. We are just defining some domains
7973 and hosts that will be used in the controls that are specified later.
7974 </para>
7975 <para>
7976 The next two configuration lines are genuine option settings:
7977 </para>
7978 <literallayout class="monospaced">
7979 acl_smtp_rcpt = acl_check_rcpt
7980 acl_smtp_data = acl_check_data
7981 </literallayout>
7982 <para>
7983 These options specify <emphasis>Access Control Lists</emphasis> (ACLs) that are to be used
7984 during an incoming SMTP session for every recipient of a message (every RCPT
7985 command), and after the contents of the message have been received,
7986 respectively. The names of the lists are <emphasis>acl_check_rcpt</emphasis> and
7987 <emphasis>acl_check_data</emphasis>, and we will come to their definitions below, in the ACL
7988 section of the configuration. The RCPT ACL controls which recipients are
7989 accepted for an incoming message &ndash; if a configuration does not provide an ACL
7990 to check recipients, no SMTP mail can be accepted. The DATA ACL allows the
7991 contents of a message to be checked.
7992 </para>
7993 <para>
7994 Two commented-out option settings are next:
7995 </para>
7996 <literallayout class="monospaced">
7997 # av_scanner = clamd:/tmp/clamd
7998 # spamd_address = 127.0.0.1 783
7999 </literallayout>
8000 <para>
8001 These are example settings that can be used when Exim is compiled with the
8002 content-scanning extension. The first specifies the interface to the virus
8003 scanner, and the second specifies the interface to SpamAssassin. Further
8004 details are given in chapter <xref linkend="CHAPexiscan"/>.
8005 </para>
8006 <para>
8007 Three more commented-out option settings follow:
8008 </para>
8009 <literallayout class="monospaced">
8010 # tls_advertise_hosts = *
8011 # tls_certificate = /etc/ssl/exim.crt
8012 # tls_privatekey = /etc/ssl/exim.pem
8013 </literallayout>
8014 <para>
8015 These are example settings that can be used when Exim is compiled with
8016 support for TLS (aka SSL) as described in section <xref linkend="SECTinctlsssl"/>. The
8017 first one specifies the list of clients that are allowed to use TLS when
8018 connecting to this server; in this case the wildcard means all clients. The
8019 other options specify where Exim should find its TLS certificate and private
8020 key, which together prove the server&#x2019;s identity to any clients that connect.
8021 More details are given in chapter <xref linkend="CHAPTLS"/>.
8022 </para>
8023 <para>
8024 Another two commented-out option settings follow:
8025 </para>
8026 <literallayout class="monospaced">
8027 # daemon_smtp_ports = 25 : 465 : 587
8028 # tls_on_connect_ports = 465
8029 </literallayout>
8030 <para>
8031 <indexterm role="concept">
8032 <primary>port</primary>
8033 <secondary>465 and 587</secondary>
8034 </indexterm>
8035 <indexterm role="concept">
8036 <primary>port</primary>
8037 <secondary>for message submission</secondary>
8038 </indexterm>
8039 <indexterm role="concept">
8040 <primary>message</primary>
8041 <secondary>submission, ports for</secondary>
8042 </indexterm>
8043 <indexterm role="concept">
8044 <primary>ssmtp protocol</primary>
8045 </indexterm>
8046 <indexterm role="concept">
8047 <primary>smtps protocol</primary>
8048 </indexterm>
8049 <indexterm role="concept">
8050 <primary>SMTP</primary>
8051 <secondary>ssmtp protocol</secondary>
8052 </indexterm>
8053 <indexterm role="concept">
8054 <primary>SMTP</primary>
8055 <secondary>smtps protocol</secondary>
8056 </indexterm>
8057 These options provide better support for roaming users who wish to use this
8058 server for message submission. They are not much use unless you have turned on
8059 TLS (as described in the previous paragraph) and authentication (about which
8060 more in section <xref linkend="SECTdefconfauth"/>). The usual SMTP port 25 is often blocked
8061 on end-user networks, so RFC 4409 specifies that message submission should use
8062 port 587 instead. However some software (notably Microsoft Outlook) cannot be
8063 configured to use port 587 correctly, so these settings also enable the
8064 non-standard <quote>smtps</quote> (aka <quote>ssmtp</quote>) port 465 (see section
8065 <xref linkend="SECTsupobssmt"/>).
8066 </para>
8067 <para>
8068 Two more commented-out options settings follow:
8069 </para>
8070 <literallayout class="monospaced">
8071 # qualify_domain =
8072 # qualify_recipient =
8073 </literallayout>
8074 <para>
8075 The first of these specifies a domain that Exim uses when it constructs a
8076 complete email address from a local login name. This is often needed when Exim
8077 receives a message from a local process. If you do not set <option>qualify_domain</option>,
8078 the value of <option>primary_hostname</option> is used. If you set both of these options,
8079 you can have different qualification domains for sender and recipient
8080 addresses. If you set only the first one, its value is used in both cases.
8081 </para>
8082 <para>
8083 <indexterm role="concept">
8084 <primary>domain literal</primary>
8085 <secondary>recognizing format</secondary>
8086 </indexterm>
8087 The following line must be uncommented if you want Exim to recognize
8088 addresses of the form <emphasis>user@[10.11.12.13]</emphasis> that is, with a <quote>domain literal</quote>
8089 (an IP address within square brackets) instead of a named domain.
8090 </para>
8091 <literallayout class="monospaced">
8092 # allow_domain_literals
8093 </literallayout>
8094 <para>
8095 The RFCs still require this form, but many people think that in the modern
8096 Internet it makes little sense to permit mail to be sent to specific hosts by
8097 quoting their IP addresses. This ancient format has been used by people who
8098 try to abuse hosts by using them for unwanted relaying. However, some
8099 people believe there are circumstances (for example, messages addressed to
8100 <emphasis>postmaster</emphasis>) where domain literals are still useful.
8101 </para>
8102 <para>
8103 The next configuration line is a kind of trigger guard:
8104 </para>
8105 <literallayout class="monospaced">
8106 never_users = root
8107 </literallayout>
8108 <para>
8109 It specifies that no delivery must ever be run as the root user. The normal
8110 convention is to set up <emphasis>root</emphasis> as an alias for the system administrator. This
8111 setting is a guard against slips in the configuration.
8112 The list of users specified by <option>never_users</option> is not, however, the complete
8113 list; the build-time configuration in <filename>Local/Makefile</filename> has an option called
8114 FIXED_NEVER_USERS specifying a list that cannot be overridden. The
8115 contents of <option>never_users</option> are added to this list. By default
8116 FIXED_NEVER_USERS also specifies root.
8117 </para>
8118 <para>
8119 When a remote host connects to Exim in order to send mail, the only information
8120 Exim has about the host&#x2019;s identity is its IP address. The next configuration
8121 line,
8122 </para>
8123 <literallayout class="monospaced">
8124 host_lookup = *
8125 </literallayout>
8126 <para>
8127 specifies that Exim should do a reverse DNS lookup on all incoming connections,
8128 in order to get a host name. This improves the quality of the logging
8129 information, but if you feel it is too expensive, you can remove it entirely,
8130 or restrict the lookup to hosts on <quote>nearby</quote> networks.
8131 Note that it is not always possible to find a host name from an IP address,
8132 because not all DNS reverse zones are maintained, and sometimes DNS servers are
8133 unreachable.
8134 </para>
8135 <para>
8136 The next two lines are concerned with <emphasis>ident</emphasis> callbacks, as defined by RFC
8137 1413 (hence their names):
8138 </para>
8139 <literallayout class="monospaced">
8140 rfc1413_hosts = *
8141 rfc1413_query_timeout = 5s
8142 </literallayout>
8143 <para>
8144 These settings cause Exim to make ident callbacks for all incoming SMTP calls.
8145 You can limit the hosts to which these calls are made, or change the timeout
8146 that is used. If you set the timeout to zero, all ident calls are disabled.
8147 Although they are cheap and can provide useful information for tracing problem
8148 messages, some hosts and firewalls have problems with ident calls. This can
8149 result in a timeout instead of an immediate refused connection, leading to
8150 delays on starting up an incoming SMTP session.
8151 </para>
8152 <para>
8153 When Exim receives messages over SMTP connections, it expects all addresses to
8154 be fully qualified with a domain, as required by the SMTP definition. However,
8155 if you are running a server to which simple clients submit messages, you may
8156 find that they send unqualified addresses. The two commented-out options:
8157 </para>
8158 <literallayout class="monospaced">
8159 # sender_unqualified_hosts =
8160 # recipient_unqualified_hosts =
8161 </literallayout>
8162 <para>
8163 show how you can specify hosts that are permitted to send unqualified sender
8164 and recipient addresses, respectively.
8165 </para>
8166 <para>
8167 The <option>percent_hack_domains</option> option is also commented out:
8168 </para>
8169 <literallayout class="monospaced">
8170 # percent_hack_domains =
8171 </literallayout>
8172 <para>
8173 It provides a list of domains for which the <quote>percent hack</quote> is to operate.
8174 This is an almost obsolete form of explicit email routing. If you do not know
8175 anything about it, you can safely ignore this topic.
8176 </para>
8177 <para>
8178 The last two settings in the main part of the default configuration are
8179 concerned with messages that have been <quote>frozen</quote> on Exim&#x2019;s queue. When a
8180 message is frozen, Exim no longer continues to try to deliver it. Freezing
8181 occurs when a bounce message encounters a permanent failure because the sender
8182 address of the original message that caused the bounce is invalid, so the
8183 bounce cannot be delivered. This is probably the most common case, but there
8184 are also other conditions that cause freezing, and frozen messages are not
8185 always bounce messages.
8186 </para>
8187 <literallayout class="monospaced">
8188 ignore_bounce_errors_after = 2d
8189 timeout_frozen_after = 7d
8190 </literallayout>
8191 <para>
8192 The first of these options specifies that failing bounce messages are to be
8193 discarded after 2 days on the queue. The second specifies that any frozen
8194 message (whether a bounce message or not) is to be timed out (and discarded)
8195 after a week. In this configuration, the first setting ensures that no failing
8196 bounce message ever lasts a week.
8197 </para>
8198 </section>
8199 <section id="SECID54">
8200 <title>ACL configuration</title>
8201 <para>
8202 <indexterm role="concept">
8203 <primary>default</primary>
8204 <secondary>ACLs</secondary>
8205 </indexterm>
8206 <indexterm role="concept">
8207 <primary>access control lists (ACLs)</primary>
8208 <secondary>default configuration</secondary>
8209 </indexterm>
8210 In the default configuration, the ACL section follows the main configuration.
8211 It starts with the line
8212 </para>
8213 <literallayout class="monospaced">
8214 begin acl
8215 </literallayout>
8216 <para>
8217 and it contains the definitions of two ACLs, called <emphasis>acl_check_rcpt</emphasis> and
8218 <emphasis>acl_check_data</emphasis>, that were referenced in the settings of <option>acl_smtp_rcpt</option>
8219 and <option>acl_smtp_data</option> above.
8220 </para>
8221 <para>
8222 <indexterm role="concept">
8223 <primary>RCPT</primary>
8224 <secondary>ACL for</secondary>
8225 </indexterm>
8226 The first ACL is used for every RCPT command in an incoming SMTP message. Each
8227 RCPT command specifies one of the message&#x2019;s recipients. The ACL statements
8228 are considered in order, until the recipient address is either accepted or
8229 rejected. The RCPT command is then accepted or rejected, according to the
8230 result of the ACL processing.
8231 </para>
8232 <literallayout class="monospaced">
8233 acl_check_rcpt:
8234 </literallayout>
8235 <para>
8236 This line, consisting of a name terminated by a colon, marks the start of the
8237 ACL, and names it.
8238 </para>
8239 <literallayout class="monospaced">
8240 accept  hosts = :
8241 </literallayout>
8242 <para>
8243 This ACL statement accepts the recipient if the sending host matches the list.
8244 But what does that strange list mean? It doesn&#x2019;t actually contain any host
8245 names or IP addresses. The presence of the colon puts an empty item in the
8246 list; Exim matches this only if the incoming message did not come from a remote
8247 host, because in that case, the remote hostname is empty. The colon is
8248 important. Without it, the list itself is empty, and can never match anything.
8249 </para>
8250 <para>
8251 What this statement is doing is to accept unconditionally all recipients in
8252 messages that are submitted by SMTP from local processes using the standard
8253 input and output (that is, not using TCP/IP). A number of MUAs operate in this
8254 manner.
8255 </para>
8256 <literallayout class="monospaced">
8257 deny    message       = Restricted characters in address
8258         domains       = +local_domains
8259         local_parts   = ^[.] : ^.*[@%!/|]
8260
8261 deny    message       = Restricted characters in address
8262         domains       = !+local_domains
8263         local_parts   = ^[./|] : ^.*[@%!] : ^.*/\\.\\./
8264 </literallayout>
8265 <para>
8266 These statements are concerned with local parts that contain any of the
8267 characters <quote>@</quote>, <quote>%</quote>, <quote>!</quote>, <quote>/</quote>, <quote>|</quote>, or dots in unusual places.
8268 Although these characters are entirely legal in local parts (in the case of
8269 <quote>@</quote> and leading dots, only if correctly quoted), they do not commonly occur
8270 in Internet mail addresses.
8271 </para>
8272 <para>
8273 The first three have in the past been associated with explicitly routed
8274 addresses (percent is still sometimes used &ndash; see the <option>percent_hack_domains</option>
8275 option). Addresses containing these characters are regularly tried by spammers
8276 in an attempt to bypass relaying restrictions, and also by open relay testing
8277 programs. Unless you really need them it is safest to reject these characters
8278 at this early stage. This configuration is heavy-handed in rejecting these
8279 characters for all messages it accepts from remote hosts. This is a deliberate
8280 policy of being as safe as possible.
8281 </para>
8282 <para>
8283 The first rule above is stricter, and is applied to messages that are addressed
8284 to one of the local domains handled by this host. This is implemented by the
8285 first condition, which restricts it to domains that are listed in the
8286 <emphasis>local_domains</emphasis> domain list. The <quote>+</quote> character is used to indicate a
8287 reference to a named list. In this configuration, there is just one domain in
8288 <emphasis>local_domains</emphasis>, but in general there may be many.
8289 </para>
8290 <para>
8291 The second condition on the first statement uses two regular expressions to
8292 block local parts that begin with a dot or contain <quote>@</quote>, <quote>%</quote>, <quote>!</quote>, <quote>/</quote>,
8293 or <quote>|</quote>. If you have local accounts that include these characters, you will
8294 have to modify this rule.
8295 </para>
8296 <para>
8297 Empty components (two dots in a row) are not valid in RFC 2822, but Exim
8298 allows them because they have been encountered in practice. (Consider the
8299 common convention of local parts constructed as
8300 <quote><emphasis>first-initial.second-initial.family-name</emphasis></quote> when applied to someone like
8301 the author of Exim, who has no second initial.) However, a local part starting
8302 with a dot or containing <quote>/../</quote> can cause trouble if it is used as part of a
8303 file name (for example, for a mailing list). This is also true for local parts
8304 that contain slashes. A pipe symbol can also be troublesome if the local part
8305 is incorporated unthinkingly into a shell command line.
8306 </para>
8307 <para>
8308 The second rule above applies to all other domains, and is less strict. This
8309 allows your own users to send outgoing messages to sites that use slashes
8310 and vertical bars in their local parts. It blocks local parts that begin
8311 with a dot, slash, or vertical bar, but allows these characters within the
8312 local part. However, the sequence <quote>/../</quote> is barred. The use of <quote>@</quote>, <quote>%</quote>,
8313 and <quote>!</quote> is blocked, as before. The motivation here is to prevent your users
8314 (or your users&#x2019; viruses) from mounting certain kinds of attack on remote sites.
8315 </para>
8316 <literallayout class="monospaced">
8317 accept  local_parts   = postmaster
8318         domains       = +local_domains
8319 </literallayout>
8320 <para>
8321 This statement, which has two conditions, accepts an incoming address if the
8322 local part is <emphasis>postmaster</emphasis> and the domain is one of those listed in the
8323 <emphasis>local_domains</emphasis> domain list. The <quote>+</quote> character is used to indicate a
8324 reference to a named list. In this configuration, there is just one domain in
8325 <emphasis>local_domains</emphasis>, but in general there may be many.
8326 </para>
8327 <para>
8328 The presence of this statement means that mail to postmaster is never blocked
8329 by any of the subsequent tests. This can be helpful while sorting out problems
8330 in cases where the subsequent tests are incorrectly denying access.
8331 </para>
8332 <literallayout class="monospaced">
8333 require verify        = sender
8334 </literallayout>
8335 <para>
8336 This statement requires the sender address to be verified before any subsequent
8337 ACL statement can be used. If verification fails, the incoming recipient
8338 address is refused. Verification consists of trying to route the address, to
8339 see if a bounce message could be delivered to it. In the case of remote
8340 addresses, basic verification checks only the domain, but <emphasis>callouts</emphasis> can be
8341 used for more verification if required. Section <xref linkend="SECTaddressverification"/>
8342 discusses the details of address verification.
8343 </para>
8344 <literallayout class="monospaced">
8345 accept  hosts         = +relay_from_hosts
8346         control       = submission
8347 </literallayout>
8348 <para>
8349 This statement accepts the address if the message is coming from one of the
8350 hosts that are defined as being allowed to relay through this host. Recipient
8351 verification is omitted here, because in many cases the clients are dumb MUAs
8352 that do not cope well with SMTP error responses. For the same reason, the
8353 second line specifies <quote>submission mode</quote> for messages that are accepted. This
8354 is described in detail in section <xref linkend="SECTsubmodnon"/>; it causes Exim to fix
8355 messages that are deficient in some way, for example, because they lack a
8356 <emphasis>Date:</emphasis> header line. If you are actually relaying out from MTAs, you should
8357 probably add recipient verification here, and disable submission mode.
8358 </para>
8359 <literallayout class="monospaced">
8360 accept  authenticated = *
8361         control       = submission
8362 </literallayout>
8363 <para>
8364 This statement accepts the address if the client host has authenticated itself.
8365 Submission mode is again specified, on the grounds that such messages are most
8366 likely to come from MUAs. The default configuration does not define any
8367 authenticators, though it does include some nearly complete commented-out
8368 examples described in <xref linkend="SECTdefconfauth"/>. This means that no client can in
8369 fact authenticate until you complete the authenticator definitions.
8370 </para>
8371 <literallayout class="monospaced">
8372 require message = relay not permitted
8373         domains = +local_domains : +relay_domains
8374 </literallayout>
8375 <para>
8376 This statement rejects the address if its domain is neither a local domain nor
8377 one of the domains for which this host is a relay.
8378 </para>
8379 <literallayout class="monospaced">
8380 require verify = recipient
8381 </literallayout>
8382 <para>
8383 This statement requires the recipient address to be verified; if verification
8384 fails, the address is rejected.
8385 </para>
8386 <literallayout class="monospaced">
8387 # deny    message     = rejected because $sender_host_address \
8388 #                       is in a black list at $dnslist_domain\n\
8389 #                       $dnslist_text
8390 #         dnslists    = black.list.example
8391 #
8392 # warn    dnslists    = black.list.example
8393 #         add_header  = X-Warning: $sender_host_address is in \
8394 #                       a black list at $dnslist_domain
8395 #         log_message = found in $dnslist_domain
8396 </literallayout>
8397 <para>
8398 These commented-out lines are examples of how you could configure Exim to check
8399 sending hosts against a DNS black list. The first statement rejects messages
8400 from blacklisted hosts, whereas the second just inserts a warning header
8401 line.
8402 </para>
8403 <literallayout class="monospaced">
8404 # require verify = csa
8405 </literallayout>
8406 <para>
8407 This commented-out line is an example of how you could turn on client SMTP
8408 authorization (CSA) checking. Such checks do DNS lookups for special SRV
8409 records.
8410 </para>
8411 <literallayout class="monospaced">
8412 accept
8413 </literallayout>
8414 <para>
8415 The final statement in the first ACL unconditionally accepts any recipient
8416 address that has successfully passed all the previous tests.
8417 </para>
8418 <literallayout class="monospaced">
8419 acl_check_data:
8420 </literallayout>
8421 <para>
8422 This line marks the start of the second ACL, and names it. Most of the contents
8423 of this ACL are commented out:
8424 </para>
8425 <literallayout class="monospaced">
8426 # deny    malware   = *
8427 #         message   = This message contains a virus \
8428 #                     ($malware_name).
8429 </literallayout>
8430 <para>
8431 These lines are examples of how to arrange for messages to be scanned for
8432 viruses when Exim has been compiled with the content-scanning extension, and a
8433 suitable virus scanner is installed. If the message is found to contain a
8434 virus, it is rejected with the given custom error message.
8435 </para>
8436 <literallayout class="monospaced">
8437 # warn    spam      = nobody
8438 #         message   = X-Spam_score: $spam_score\n\
8439 #                     X-Spam_score_int: $spam_score_int\n\
8440 #                     X-Spam_bar: $spam_bar\n\
8441 #                     X-Spam_report: $spam_report
8442 </literallayout>
8443 <para>
8444 These lines are an example of how to arrange for messages to be scanned by
8445 SpamAssassin when Exim has been compiled with the content-scanning extension,
8446 and SpamAssassin has been installed. The SpamAssassin check is run with
8447 <literal>nobody</literal> as its user parameter, and the results are added to the message as a
8448 series of extra header line. In this case, the message is not rejected,
8449 whatever the spam score.
8450 </para>
8451 <literallayout class="monospaced">
8452 accept
8453 </literallayout>
8454 <para>
8455 This final line in the DATA ACL accepts the message unconditionally.
8456 </para>
8457 </section>
8458 <section id="SECID55">
8459 <title>Router configuration</title>
8460 <para>
8461 <indexterm role="concept">
8462 <primary>default</primary>
8463 <secondary>routers</secondary>
8464 </indexterm>
8465 <indexterm role="concept">
8466 <primary>routers</primary>
8467 <secondary>default</secondary>
8468 </indexterm>
8469 The router configuration comes next in the default configuration, introduced
8470 by the line
8471 </para>
8472 <literallayout class="monospaced">
8473 begin routers
8474 </literallayout>
8475 <para>
8476 Routers are the modules in Exim that make decisions about where to send
8477 messages. An address is passed to each router in turn, until it is either
8478 accepted, or failed. This means that the order in which you define the routers
8479 matters. Each router is fully described in its own chapter later in this
8480 manual. Here we give only brief overviews.
8481 </para>
8482 <literallayout class="monospaced">
8483 # domain_literal:
8484 #   driver = ipliteral
8485 #   domains = !+local_domains
8486 #   transport = remote_smtp
8487 </literallayout>
8488 <para>
8489 <indexterm role="concept">
8490 <primary>domain literal</primary>
8491 <secondary>default router</secondary>
8492 </indexterm>
8493 This router is commented out because the majority of sites do not want to
8494 support domain literal addresses (those of the form <emphasis>user@[10.9.8.7]</emphasis>). If
8495 you uncomment this router, you also need to uncomment the setting of
8496 <option>allow_domain_literals</option> in the main part of the configuration.
8497 </para>
8498 <literallayout class="monospaced">
8499 dnslookup:
8500   driver = dnslookup
8501   domains = ! +local_domains
8502   transport = remote_smtp
8503   ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
8504   no_more
8505 </literallayout>
8506 <para>
8507 The first uncommented router handles addresses that do not involve any local
8508 domains. This is specified by the line
8509 </para>
8510 <literallayout class="monospaced">
8511 domains = ! +local_domains
8512 </literallayout>
8513 <para>
8514 The <option>domains</option> option lists the domains to which this router applies, but the
8515 exclamation mark is a negation sign, so the router is used only for domains
8516 that are not in the domain list called <emphasis>local_domains</emphasis> (which was defined at
8517 the start of the configuration). The plus sign before <emphasis>local_domains</emphasis>
8518 indicates that it is referring to a named list. Addresses in other domains are
8519 passed on to the following routers.
8520 </para>
8521 <para>
8522 The name of the router driver is <command>dnslookup</command>,
8523 and is specified by the <option>driver</option> option. Do not be confused by the fact that
8524 the name of this router instance is the same as the name of the driver. The
8525 instance name is arbitrary, but the name set in the <option>driver</option> option must be
8526 one of the driver modules that is in the Exim binary.
8527 </para>
8528 <para>
8529 The <command>dnslookup</command> router routes addresses by looking up their domains in the
8530 DNS in order to obtain a list of hosts to which the address is routed. If the
8531 router succeeds, the address is queued for the <command>remote_smtp</command> transport, as
8532 specified by the <option>transport</option> option. If the router does not find the domain
8533 in the DNS, no further routers are tried because of the <option>no_more</option> setting, so
8534 the address fails and is bounced.
8535 </para>
8536 <para>
8537 The <option>ignore_target_hosts</option> option specifies a list of IP addresses that are to
8538 be entirely ignored. This option is present because a number of cases have been
8539 encountered where MX records in the DNS point to host names
8540 whose IP addresses are 0.0.0.0 or are in the 127 subnet (typically 127.0.0.1).
8541 Completely ignoring these IP addresses causes Exim to fail to route the
8542 email address, so it bounces. Otherwise, Exim would log a routing problem, and
8543 continue to try to deliver the message periodically until the address timed
8544 out.
8545 </para>
8546 <literallayout class="monospaced">
8547 system_aliases:
8548   driver = redirect
8549   allow_fail
8550   allow_defer
8551   data = ${lookup{$local_part}lsearch{/etc/aliases}}
8552 # user = exim
8553   file_transport = address_file
8554   pipe_transport = address_pipe
8555 </literallayout>
8556 <para>
8557 Control reaches this and subsequent routers only for addresses in the local
8558 domains. This router checks to see whether the local part is defined as an
8559 alias in the <filename>/etc/aliases</filename> file, and if so, redirects it according to the
8560 data that it looks up from that file. If no data is found for the local part,
8561 the value of the <option>data</option> option is empty, causing the address to be passed to
8562 the next router.
8563 </para>
8564 <para>
8565 <filename>/etc/aliases</filename> is a conventional name for the system aliases file that is
8566 often used. That is why it is referenced by from the default configuration
8567 file. However, you can change this by setting SYSTEM_ALIASES_FILE in
8568 <filename>Local/Makefile</filename> before building Exim.
8569 </para>
8570 <literallayout class="monospaced">
8571 userforward:
8572   driver = redirect
8573   check_local_user
8574 # local_part_suffix = +* : -*
8575 # local_part_suffix_optional
8576   file = $home/.forward
8577 # allow_filter
8578   no_verify
8579   no_expn
8580   check_ancestor
8581   file_transport = address_file
8582   pipe_transport = address_pipe
8583   reply_transport = address_reply
8584 </literallayout>
8585 <para>
8586 This is the most complicated router in the default configuration. It is another
8587 redirection router, but this time it is looking for forwarding data set up by
8588 individual users. The <option>check_local_user</option> setting specifies a check that the
8589 local part of the address is the login name of a local user. If it is not, the
8590 router is skipped. The two commented options that follow <option>check_local_user</option>,
8591 namely:
8592 </para>
8593 <literallayout class="monospaced">
8594 # local_part_suffix = +* : -*
8595 # local_part_suffix_optional
8596 </literallayout>
8597 <para>
8598 <indexterm role="variable">
8599 <primary><varname>$local_part_suffix</varname></primary>
8600 </indexterm>
8601 show how you can specify the recognition of local part suffixes. If the first
8602 is uncommented, a suffix beginning with either a plus or a minus sign, followed
8603 by any sequence of characters, is removed from the local part and placed in the
8604 variable <varname>$local_part_suffix</varname>. The second suffix option specifies that the
8605 presence of a suffix in the local part is optional. When a suffix is present,
8606 the check for a local login uses the local part with the suffix removed.
8607 </para>
8608 <para>
8609 When a local user account is found, the file called <filename>.forward</filename> in the user&#x2019;s
8610 home directory is consulted. If it does not exist, or is empty, the router
8611 declines. Otherwise, the contents of <filename>.forward</filename> are interpreted as
8612 redirection data (see chapter <xref linkend="CHAPredirect"/> for more details).
8613 </para>
8614 <para>
8615 <indexterm role="concept">
8616 <primary>Sieve filter</primary>
8617 <secondary>enabling in default router</secondary>
8618 </indexterm>
8619 Traditional <filename>.forward</filename> files contain just a list of addresses, pipes, or
8620 files. Exim supports this by default. However, if <option>allow_filter</option> is set (it
8621 is commented out by default), the contents of the file are interpreted as a set
8622 of Exim or Sieve filtering instructions, provided the file begins with <quote>#Exim
8623 filter</quote> or <quote>#Sieve filter</quote>, respectively. User filtering is discussed in the
8624 separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>.
8625 </para>
8626 <para>
8627 The <option>no_verify</option> and <option>no_expn</option> options mean that this router is skipped when
8628 verifying addresses, or when running as a consequence of an SMTP EXPN command.
8629 There are two reasons for doing this:
8630 </para>
8631 <orderedlist numeration="arabic">
8632 <listitem>
8633 <para>
8634 Whether or not a local user has a <filename>.forward</filename> file is not really relevant when
8635 checking an address for validity; it makes sense not to waste resources doing
8636 unnecessary work.
8637 </para>
8638 </listitem>
8639 <listitem>
8640 <para>
8641 More importantly, when Exim is verifying addresses or handling an EXPN
8642 command during an SMTP session, it is running as the Exim user, not as root.
8643 The group is the Exim group, and no additional groups are set up.
8644 It may therefore not be possible for Exim to read users&#x2019; <filename>.forward</filename> files at
8645 this time.
8646 </para>
8647 </listitem>
8648 </orderedlist>
8649 <para>
8650 The setting of <option>check_ancestor</option> prevents the router from generating a new
8651 address that is the same as any previous address that was redirected. (This
8652 works round a problem concerning a bad interaction between aliasing and
8653 forwarding &ndash; see section <xref linkend="SECTredlocmai"/>).
8654 </para>
8655 <para>
8656 The final three option settings specify the transports that are to be used when
8657 forwarding generates a direct delivery to a file, or to a pipe, or sets up an
8658 auto-reply, respectively. For example, if a <filename>.forward</filename> file contains
8659 </para>
8660 <literallayout class="monospaced">
8661 a.nother@elsewhere.example, /home/spqr/archive
8662 </literallayout>
8663 <para>
8664 the delivery to <filename>/home/spqr/archive</filename> is done by running the <option>address_file</option>
8665 transport.
8666 </para>
8667 <literallayout class="monospaced">
8668 localuser:
8669   driver = accept
8670   check_local_user
8671 # local_part_suffix = +* : -*
8672 # local_part_suffix_optional
8673   transport = local_delivery
8674 </literallayout>
8675 <para>
8676 The final router sets up delivery into local mailboxes, provided that the local
8677 part is the name of a local login, by accepting the address and assigning it to
8678 the <command>local_delivery</command> transport. Otherwise, we have reached the end of the
8679 routers, so the address is bounced. The commented suffix settings fulfil the
8680 same purpose as they do for the <command>userforward</command> router.
8681 </para>
8682 </section>
8683 <section id="SECID56">
8684 <title>Transport configuration</title>
8685 <para>
8686 <indexterm role="concept">
8687 <primary>default</primary>
8688 <secondary>transports</secondary>
8689 </indexterm>
8690 <indexterm role="concept">
8691 <primary>transports</primary>
8692 <secondary>default</secondary>
8693 </indexterm>
8694 Transports define mechanisms for actually delivering messages. They operate
8695 only when referenced from routers, so the order in which they are defined does
8696 not matter. The transports section of the configuration starts with
8697 </para>
8698 <literallayout class="monospaced">
8699 begin transports
8700 </literallayout>
8701 <para>
8702 One remote transport and four local transports are defined.
8703 </para>
8704 <literallayout class="monospaced">
8705 remote_smtp:
8706   driver = smtp
8707 </literallayout>
8708 <para>
8709 This transport is used for delivering messages over SMTP connections. All its
8710 options are defaulted. The list of remote hosts comes from the router.
8711 </para>
8712 <literallayout class="monospaced">
8713 local_delivery:
8714   driver = appendfile
8715   file = /var/mail/$local_part
8716   delivery_date_add
8717   envelope_to_add
8718   return_path_add
8719 # group = mail
8720 # mode = 0660
8721 </literallayout>
8722 <para>
8723 This <command>appendfile</command> transport is used for local delivery to user mailboxes in
8724 traditional BSD mailbox format. By default it runs under the uid and gid of the
8725 local user, which requires the sticky bit to be set on the <filename>/var/mail</filename>
8726 directory. Some systems use the alternative approach of running mail deliveries
8727 under a particular group instead of using the sticky bit. The commented options
8728 show how this can be done.
8729 </para>
8730 <para>
8731 Exim adds three headers to the message as it delivers it: <emphasis>Delivery-date:</emphasis>,
8732 <emphasis>Envelope-to:</emphasis> and <emphasis>Return-path:</emphasis>. This action is requested by the three
8733 similarly-named options above.
8734 </para>
8735 <literallayout class="monospaced">
8736 address_pipe:
8737   driver = pipe
8738   return_output
8739 </literallayout>
8740 <para>
8741 This transport is used for handling deliveries to pipes that are generated by
8742 redirection (aliasing or users&#x2019; <filename>.forward</filename> files). The <option>return_output</option>
8743 option specifies that any output generated by the pipe is to be returned to the
8744 sender.
8745 </para>
8746 <literallayout class="monospaced">
8747 address_file:
8748   driver = appendfile
8749   delivery_date_add
8750   envelope_to_add
8751   return_path_add
8752 </literallayout>
8753 <para>
8754 This transport is used for handling deliveries to files that are generated by
8755 redirection. The name of the file is not specified in this instance of
8756 <command>appendfile</command>, because it comes from the <command>redirect</command> router.
8757 </para>
8758 <literallayout class="monospaced">
8759 address_reply:
8760   driver = autoreply
8761 </literallayout>
8762 <para>
8763 This transport is used for handling automatic replies generated by users&#x2019;
8764 filter files.
8765 </para>
8766 </section>
8767 <section id="SECID57">
8768 <title>Default retry rule</title>
8769 <para>
8770 <indexterm role="concept">
8771 <primary>retry</primary>
8772 <secondary>default rule</secondary>
8773 </indexterm>
8774 <indexterm role="concept">
8775 <primary>default</primary>
8776 <secondary>retry rule</secondary>
8777 </indexterm>
8778 The retry section of the configuration file contains rules which affect the way
8779 Exim retries deliveries that cannot be completed at the first attempt. It is
8780 introduced by the line
8781 </para>
8782 <literallayout class="monospaced">
8783 begin retry
8784 </literallayout>
8785 <para>
8786 In the default configuration, there is just one rule, which applies to all
8787 errors:
8788 </para>
8789 <literallayout class="monospaced">
8790 *   *   F,2h,15m; G,16h,1h,1.5; F,4d,6h
8791 </literallayout>
8792 <para>
8793 This causes any temporarily failing address to be retried every 15 minutes for
8794 2 hours, then at intervals starting at one hour and increasing by a factor of
8795 1.5 until 16 hours have passed, then every 6 hours up to 4 days. If an address
8796 is not delivered after 4 days of temporary failure, it is bounced.
8797 </para>
8798 <para>
8799 If the retry section is removed from the configuration, or is empty (that is,
8800 if no retry rules are defined), Exim will not retry deliveries. This turns
8801 temporary errors into permanent errors.
8802 </para>
8803 </section>
8804 <section id="SECID58">
8805 <title>Rewriting configuration</title>
8806 <para>
8807 The rewriting section of the configuration, introduced by
8808 </para>
8809 <literallayout class="monospaced">
8810 begin rewrite
8811 </literallayout>
8812 <para>
8813 contains rules for rewriting addresses in messages as they arrive. There are no
8814 rewriting rules in the default configuration file.
8815 </para>
8816 </section>
8817 <section id="SECTdefconfauth">
8818 <title>Authenticators configuration</title>
8819 <para>
8820 <indexterm role="concept">
8821 <primary>AUTH</primary>
8822 <secondary>configuration</secondary>
8823 </indexterm>
8824 The authenticators section of the configuration, introduced by
8825 </para>
8826 <literallayout class="monospaced">
8827 begin authenticators
8828 </literallayout>
8829 <para>
8830 defines mechanisms for the use of the SMTP AUTH command. The default
8831 configuration file contains two commented-out example authenticators
8832 which support plaintext username/password authentication using the
8833 standard PLAIN mechanism and the traditional but non-standard LOGIN
8834 mechanism, with Exim acting as the server. PLAIN and LOGIN are enough
8835 to support most MUA software.
8836 </para>
8837 <para>
8838 The example PLAIN authenticator looks like this:
8839 </para>
8840 <literallayout class="monospaced">
8841 #PLAIN:
8842 #  driver                  = plaintext
8843 #  server_set_id           = $auth2
8844 #  server_prompts          = :
8845 #  server_condition        = Authentication is not yet configured
8846 #  server_advertise_condition = ${if def:tls_cipher }
8847 </literallayout>
8848 <para>
8849 And the example LOGIN authenticator looks like this:
8850 </para>
8851 <literallayout class="monospaced">
8852 #LOGIN:
8853 #  driver                  = plaintext
8854 #  server_set_id           = $auth1
8855 #  server_prompts          = &lt;| Username: | Password:
8856 #  server_condition        = Authentication is not yet configured
8857 #  server_advertise_condition = ${if def:tls_cipher }
8858 </literallayout>
8859 <para>
8860 The <option>server_set_id</option> option makes Exim remember the authenticated username
8861 in <varname>$authenticated_id</varname>, which can be used later in ACLs or routers. The
8862 <option>server_prompts</option> option configures the <command>plaintext</command> authenticator so
8863 that it implements the details of the specific authentication mechanism,
8864 i.e. PLAIN or LOGIN. The <option>server_advertise_condition</option> setting controls
8865 when Exim offers authentication to clients; in the examples, this is only
8866 when TLS or SSL has been started, so to enable the authenticators you also
8867 need to add support for TLS as described in <xref linkend="SECTdefconfmain"/>.
8868 </para>
8869 <para>
8870 The <option>server_condition</option> setting defines how to verify that the username and
8871 password are correct. In the examples it just produces an error message.
8872 To make the authenticators work, you can use a string expansion
8873 expression like one of the examples in <xref linkend="CHAPplaintext"/>.
8874 </para>
8875 <para>
8876 Beware that the sequence of the parameters to PLAIN and LOGIN differ; the
8877 usercode and password are in different positions.  <xref linkend="CHAPplaintext"/>
8878 covers both.
8879 </para>
8880 <para>
8881 <indexterm role="concept" startref="IIDconfiwal" class="endofrange"/>
8882 </para>
8883 </section>
8884 </chapter>
8885
8886 <chapter id="CHAPregexp">
8887 <title>Regular expressions</title>
8888 <para>
8889 <indexterm role="concept">
8890 <primary>regular expressions</primary>
8891 <secondary>library</secondary>
8892 </indexterm>
8893 <indexterm role="concept">
8894 <primary>PCRE</primary>
8895 </indexterm>
8896 Exim supports the use of regular expressions in many of its options. It
8897 uses the PCRE regular expression library; this provides regular expression
8898 matching that is compatible with Perl 5. The syntax and semantics of
8899 regular expressions is discussed in many Perl reference books, and also in
8900 Jeffrey Friedl&#x2019;s <emphasis>Mastering Regular Expressions</emphasis>, which is published by
8901 O&#x2019;Reilly (see <emphasis role="bold"><ulink url="http://www.oreilly.com/catalog/regex2/">http://www.oreilly.com/catalog/regex2/</ulink></emphasis>).
8902 </para>
8903 <para>
8904 The documentation for the syntax and semantics of the regular expressions that
8905 are supported by PCRE is included in the PCRE distribution, and no further
8906 description is included here. The PCRE functions are called from Exim using
8907 the default option settings (that is, with no PCRE options set), except that
8908 the PCRE_CASELESS option is set when the matching is required to be
8909 case-insensitive.
8910 </para>
8911 <para>
8912 In most cases, when a regular expression is required in an Exim configuration,
8913 it has to start with a circumflex, in order to distinguish it from plain text
8914 or an <quote>ends with</quote> wildcard. In this example of a configuration setting, the
8915 second item in the colon-separated list is a regular expression.
8916 </para>
8917 <literallayout class="monospaced">
8918 domains = a.b.c : ^\\d{3} : *.y.z : ...
8919 </literallayout>
8920 <para>
8921 The doubling of the backslash is required because of string expansion that
8922 precedes interpretation &ndash; see section <xref linkend="SECTlittext"/> for more discussion
8923 of this issue, and a way of avoiding the need for doubling backslashes. The
8924 regular expression that is eventually used in this example contains just one
8925 backslash. The circumflex is included in the regular expression, and has the
8926 normal effect of <quote>anchoring</quote> it to the start of the string that is being
8927 matched.
8928 </para>
8929 <para>
8930 There are, however, two cases where a circumflex is not required for the
8931 recognition of a regular expression: these are the <option>match</option> condition in a
8932 string expansion, and the <option>matches</option> condition in an Exim filter file. In
8933 these cases, the relevant string is always treated as a regular expression; if
8934 it does not start with a circumflex, the expression is not anchored, and can
8935 match anywhere in the subject string.
8936 </para>
8937 <para>
8938 In all cases, if you want a regular expression to match at the end of a string,
8939 you must code the $ metacharacter to indicate this. For example:
8940 </para>
8941 <literallayout class="monospaced">
8942 domains = ^\\d{3}\\.example
8943 </literallayout>
8944 <para>
8945 matches the domain <emphasis>123.example</emphasis>, but it also matches <emphasis>123.example.com</emphasis>.
8946 You need to use:
8947 </para>
8948 <literallayout class="monospaced">
8949 domains = ^\\d{3}\\.example\$
8950 </literallayout>
8951 <para>
8952 if you want <emphasis>example</emphasis> to be the top-level domain. The backslash before the
8953 $ is needed because string expansion also interprets dollar characters.
8954 </para>
8955 </chapter>
8956
8957 <chapter id="CHAPfdlookup">
8958 <title>File and database lookups</title>
8959 <para>
8960 <indexterm role="concept" id="IIDfidalo1" class="startofrange">
8961 <primary>file</primary>
8962 <secondary>lookups</secondary>
8963 </indexterm>
8964 <indexterm role="concept" id="IIDfidalo2" class="startofrange">
8965 <primary>database</primary>
8966 <secondary>lookups</secondary>
8967 </indexterm>
8968 <indexterm role="concept">
8969 <primary>lookup</primary>
8970 <secondary>description of</secondary>
8971 </indexterm>
8972 Exim can be configured to look up data in files or databases as it processes
8973 messages. Two different kinds of syntax are used:
8974 </para>
8975 <orderedlist numeration="arabic">
8976 <listitem>
8977 <para>
8978 A string that is to be expanded may contain explicit lookup requests. These
8979 cause parts of the string to be replaced by data that is obtained from the
8980 lookup. Lookups of this type are conditional expansion items. Different results
8981 can be defined for the cases of lookup success and failure. See chapter
8982 <xref linkend="CHAPexpand"/>, where string expansions are described in detail.
8983 </para>
8984 </listitem>
8985 <listitem>
8986 <para>
8987 Lists of domains, hosts, and email addresses can contain lookup requests as a
8988 way of avoiding excessively long linear lists. In this case, the data that is
8989 returned by the lookup is often (but not always) discarded; whether the lookup
8990 succeeds or fails is what really counts. These kinds of list are described in
8991 chapter <xref linkend="CHAPdomhosaddlists"/>.
8992 </para>
8993 </listitem>
8994 </orderedlist>
8995 <para>
8996 String expansions, lists, and lookups interact with each other in such a way
8997 that there is no order in which to describe any one of them that does not
8998 involve references to the others. Each of these three chapters makes more sense
8999 if you have read the other two first. If you are reading this for the first
9000 time, be aware that some of it will make a lot more sense after you have read
9001 chapters <xref linkend="CHAPdomhosaddlists"/> and <xref linkend="CHAPexpand"/>.
9002 </para>
9003 <section id="SECID60">
9004 <title>Examples of different lookup syntax</title>
9005 <para>
9006 It is easy to confuse the two different kinds of lookup, especially as the
9007 lists that may contain the second kind are always expanded before being
9008 processed as lists. Therefore, they may also contain lookups of the first kind.
9009 Be careful to distinguish between the following two examples:
9010 </para>
9011 <literallayout class="monospaced">
9012 domains = ${lookup{$sender_host_address}lsearch{/some/file}}
9013 domains = lsearch;/some/file
9014 </literallayout>
9015 <para>
9016 The first uses a string expansion, the result of which must be a domain list.
9017 No strings have been specified for a successful or a failing lookup; the
9018 defaults in this case are the looked-up data and an empty string, respectively.
9019 The expansion takes place before the string is processed as a list, and the
9020 file that is searched could contain lines like this:
9021 </para>
9022 <literallayout class="monospaced">
9023 192.168.3.4: domain1:domain2:...
9024 192.168.1.9: domain3:domain4:...
9025 </literallayout>
9026 <para>
9027 When the lookup succeeds, the result of the expansion is a list of domains (and
9028 possibly other types of item that are allowed in domain lists).
9029 </para>
9030 <para>
9031 In the second example, the lookup is a single item in a domain list. It causes
9032 Exim to use a lookup to see if the domain that is being processed can be found
9033 in the file. The file could contains lines like this:
9034 </para>
9035 <literallayout class="monospaced">
9036 domain1:
9037 domain2:
9038 </literallayout>
9039 <para>
9040 Any data that follows the keys is not relevant when checking that the domain
9041 matches the list item.
9042 </para>
9043 <para>
9044 It is possible, though no doubt confusing, to use both kinds of lookup at once.
9045 Consider a file containing lines like this:
9046 </para>
9047 <literallayout class="monospaced">
9048 192.168.5.6: lsearch;/another/file
9049 </literallayout>
9050 <para>
9051 If the value of <varname>$sender_host_address</varname> is 192.168.5.6, expansion of the
9052 first <option>domains</option> setting above generates the second setting, which therefore
9053 causes a second lookup to occur.
9054 </para>
9055 <para>
9056 The rest of this chapter describes the different lookup types that are
9057 available. Any of them can be used in any part of the configuration where a
9058 lookup is permitted.
9059 </para>
9060 </section>
9061 <section id="SECID61">
9062 <title>Lookup types</title>
9063 <para>
9064 <indexterm role="concept">
9065 <primary>lookup</primary>
9066 <secondary>types of</secondary>
9067 </indexterm>
9068 <indexterm role="concept">
9069 <primary>single-key lookup</primary>
9070 <secondary>definition of</secondary>
9071 </indexterm>
9072 Two different types of data lookup are implemented:
9073 </para>
9074 <itemizedlist>
9075 <listitem>
9076 <para>
9077 The <emphasis>single-key</emphasis> type requires the specification of a file in which to look,
9078 and a single key to search for. The key must be a non-empty string for the
9079 lookup to succeed. The lookup type determines how the file is searched.
9080 </para>
9081 </listitem>
9082 <listitem>
9083 <para>
9084 <indexterm role="concept">
9085 <primary>query-style lookup</primary>
9086 <secondary>definition of</secondary>
9087 </indexterm>
9088 The <emphasis>query-style</emphasis> type accepts a generalized database query. No particular
9089 key value is assumed by Exim for query-style lookups. You can use whichever
9090 Exim variables you need to construct the database query.
9091 </para>
9092 </listitem>
9093 </itemizedlist>
9094 <para>
9095 The code for each lookup type is in a separate source file that is included in
9096 the binary of Exim only if the corresponding compile-time option is set. The
9097 default settings in <filename>src/EDITME</filename> are:
9098 </para>
9099 <literallayout class="monospaced">
9100 LOOKUP_DBM=yes
9101 LOOKUP_LSEARCH=yes
9102 </literallayout>
9103 <para>
9104 which means that only linear searching and DBM lookups are included by default.
9105 For some types of lookup (e.g. SQL databases), you need to install appropriate
9106 libraries and header files before building Exim.
9107 </para>
9108 </section>
9109 <section id="SECTsinglekeylookups">
9110 <title>Single-key lookup types</title>
9111 <para>
9112 <indexterm role="concept">
9113 <primary>lookup</primary>
9114 <secondary>single-key types</secondary>
9115 </indexterm>
9116 <indexterm role="concept">
9117 <primary>single-key lookup</primary>
9118 <secondary>list of types</secondary>
9119 </indexterm>
9120 The following single-key lookup types are implemented:
9121 </para>
9122 <itemizedlist>
9123 <listitem>
9124 <para>
9125 <indexterm role="concept">
9126 <primary>cdb</primary>
9127 <secondary>description of</secondary>
9128 </indexterm>
9129 <indexterm role="concept">
9130 <primary>lookup</primary>
9131 <secondary>cdb</secondary>
9132 </indexterm>
9133 <indexterm role="concept">
9134 <primary>binary zero</primary>
9135 <secondary>in lookup key</secondary>
9136 </indexterm>
9137 <command>cdb</command>: The given file is searched as a Constant DataBase file, using the key
9138 string without a terminating binary zero. The cdb format is designed for
9139 indexed files that are read frequently and never updated, except by total
9140 re-creation. As such, it is particularly suitable for large files containing
9141 aliases or other indexed data referenced by an MTA. Information about cdb can
9142 be found in several places:
9143 </para>
9144 <literallayout>
9145 <emphasis role="bold"><ulink url="http://www.pobox.com/~djb/cdb.html">http://www.pobox.com/~djb/cdb.html</ulink></emphasis>
9146 <emphasis role="bold"><ulink url="ftp://ftp.corpit.ru/pub/tinycdb/">ftp://ftp.corpit.ru/pub/tinycdb/</ulink></emphasis>
9147 <emphasis role="bold"><ulink url="http://packages.debian.org/stable/utils/freecdb.html">http://packages.debian.org/stable/utils/freecdb.html</ulink></emphasis>
9148 </literallayout>
9149 <para>
9150 A cdb distribution is not needed in order to build Exim with cdb support,
9151 because the code for reading cdb files is included directly in Exim itself.
9152 However, no means of building or testing cdb files is provided with Exim, so
9153 you need to obtain a cdb distribution in order to do this.
9154 </para>
9155 </listitem>
9156 <listitem>
9157 <para>
9158 <indexterm role="concept">
9159 <primary>DBM</primary>
9160 <secondary>lookup type</secondary>
9161 </indexterm>
9162 <indexterm role="concept">
9163 <primary>lookup</primary>
9164 <secondary>dbm</secondary>
9165 </indexterm>
9166 <indexterm role="concept">
9167 <primary>binary zero</primary>
9168 <secondary>in lookup key</secondary>
9169 </indexterm>
9170 <command>dbm</command>: Calls to DBM library functions are used to extract data from the given
9171 DBM file by looking up the record with the given key. A terminating binary
9172 zero is included in the key that is passed to the DBM library. See section
9173 <xref linkend="SECTdb"/> for a discussion of DBM libraries.
9174 </para>
9175 <para>
9176 <indexterm role="concept">
9177 <primary>Berkeley DB library</primary>
9178 <secondary>file format</secondary>
9179 </indexterm>
9180 For all versions of Berkeley DB, Exim uses the DB_HASH style of database
9181 when building DBM files using the <option>exim_dbmbuild</option> utility. However, when
9182 using Berkeley DB versions 3 or 4, it opens existing databases for reading with
9183 the DB_UNKNOWN option. This enables it to handle any of the types of database
9184 that the library supports, and can be useful for accessing DBM files created by
9185 other applications. (For earlier DB versions, DB_HASH is always used.)
9186 </para>
9187 </listitem>
9188 <listitem>
9189 <para>
9190 <indexterm role="concept">
9191 <primary>lookup</primary>
9192 <secondary>dbmnz</secondary>
9193 </indexterm>
9194 <indexterm role="concept">
9195 <primary>lookup</primary>
9196 <secondary>dbm &ndash; terminating zero</secondary>
9197 </indexterm>
9198 <indexterm role="concept">
9199 <primary>binary zero</primary>
9200 <secondary>in lookup key</secondary>
9201 </indexterm>
9202 <indexterm role="concept">
9203 <primary>Courier</primary>
9204 </indexterm>
9205 <indexterm role="concept">
9206 <primary><filename>/etc/userdbshadow.dat</filename></primary>
9207 </indexterm>
9208 <indexterm role="concept">
9209 <primary>dmbnz lookup type</primary>
9210 </indexterm>
9211 <command>dbmnz</command>: This is the same as <command>dbm</command>, except that a terminating binary zero
9212 is not included in the key that is passed to the DBM library. You may need this
9213 if you want to look up data in files that are created by or shared with some
9214 other application that does not use terminating zeros. For example, you need to
9215 use <command>dbmnz</command> rather than <command>dbm</command> if you want to authenticate incoming SMTP
9216 calls using the passwords from Courier&#x2019;s <filename>/etc/userdbshadow.dat</filename> file. Exim&#x2019;s
9217 utility program for creating DBM files (<emphasis>exim_dbmbuild</emphasis>) includes the zeros
9218 by default, but has an option to omit them (see section <xref linkend="SECTdbmbuild"/>).
9219 </para>
9220 </listitem>
9221 <listitem>
9222 <para>
9223 <indexterm role="concept">
9224 <primary>lookup</primary>
9225 <secondary>dsearch</secondary>
9226 </indexterm>
9227 <indexterm role="concept">
9228 <primary>dsearch lookup type</primary>
9229 </indexterm>
9230 <command>dsearch</command>: The given file must be a directory; this is searched for an entry
9231 whose name is the key by calling the <function>lstat()</function> function. The key may not
9232 contain any forward slash characters. If <function>lstat()</function> succeeds, the result of
9233 the lookup is the name of the entry, which may be a file, directory,
9234 symbolic link, or any other kind of directory entry. An example of how this
9235 lookup can be used to support virtual domains is given in section
9236 <xref linkend="SECTvirtualdomains"/>.
9237 </para>
9238 </listitem>
9239 <listitem>
9240 <para>
9241 <indexterm role="concept">
9242 <primary>lookup</primary>
9243 <secondary>iplsearch</secondary>
9244 </indexterm>
9245 <indexterm role="concept">
9246 <primary>iplsearch lookup type</primary>
9247 </indexterm>
9248 <command>iplsearch</command>: The given file is a text file containing keys and data. A key is
9249 terminated by a colon or white space or the end of the line. The keys in the
9250 file must be IP addresses, or IP addresses with CIDR masks. Keys that involve
9251 IPv6 addresses must be enclosed in quotes to prevent the first internal colon
9252 being interpreted as a key terminator. For example:
9253 </para>
9254 <literallayout class="monospaced">
9255 1.2.3.4:           data for 1.2.3.4
9256 192.168.0.0/16:    data for 192.168.0.0/16
9257 "abcd::cdab":      data for abcd::cdab
9258 "abcd:abcd::/32"   data for abcd:abcd::/32
9259 </literallayout>
9260 <para>
9261 The key for an <command>iplsearch</command> lookup must be an IP address (without a mask). The
9262 file is searched linearly, using the CIDR masks where present, until a matching
9263 key is found. The first key that matches is used; there is no attempt to find a
9264 <quote>best</quote> match. Apart from the way the keys are matched, the processing for
9265 <command>iplsearch</command> is the same as for <command>lsearch</command>.
9266 </para>
9267 <para>
9268 <emphasis role="bold">Warning 1</emphasis>: Unlike most other single-key lookup types, a file of data for
9269 <command>iplsearch</command> can <emphasis>not</emphasis> be turned into a DBM or cdb file, because those
9270 lookup types support only literal keys.
9271 </para>
9272 <para>
9273 <emphasis role="bold">Warning 2</emphasis>: In a host list, you must always use <command>net-iplsearch</command> so that
9274 the implicit key is the host&#x2019;s IP address rather than its name (see section
9275 <xref linkend="SECThoslispatsikey"/>).
9276 </para>
9277 </listitem>
9278 <listitem>
9279 <para>
9280 <indexterm role="concept">
9281 <primary>linear search</primary>
9282 </indexterm>
9283 <indexterm role="concept">
9284 <primary>lookup</primary>
9285 <secondary>lsearch</secondary>
9286 </indexterm>
9287 <indexterm role="concept">
9288 <primary>lsearch lookup type</primary>
9289 </indexterm>
9290 <indexterm role="concept">
9291 <primary>case sensitivity</primary>
9292 <secondary>in lsearch lookup</secondary>
9293 </indexterm>
9294 <command>lsearch</command>: The given file is a text file that is searched linearly for a
9295 line beginning with the search key, terminated by a colon or white space or the
9296 end of the line. The search is case-insensitive; that is, upper and lower case
9297 letters are treated as the same. The first occurrence of the key that is found
9298 in the file is used.
9299 </para>
9300 <para>
9301 White space between the key and the colon is permitted. The remainder of the
9302 line, with leading and trailing white space removed, is the data. This can be
9303 continued onto subsequent lines by starting them with any amount of white
9304 space, but only a single space character is included in the data at such a
9305 junction. If the data begins with a colon, the key must be terminated by a
9306 colon, for example:
9307 </para>
9308 <literallayout class="monospaced">
9309 baduser:  :fail:
9310 </literallayout>
9311 <para>
9312 Empty lines and lines beginning with # are ignored, even if they occur in the
9313 middle of an item. This is the traditional textual format of alias files. Note
9314 that the keys in an <command>lsearch</command> file are literal strings. There is no
9315 wildcarding of any kind.
9316 </para>
9317 <para>
9318 <indexterm role="concept">
9319 <primary>lookup</primary>
9320 <secondary>lsearch &ndash; colons in keys</secondary>
9321 </indexterm>
9322 <indexterm role="concept">
9323 <primary>white space</primary>
9324 <secondary>in lsearch key</secondary>
9325 </indexterm>
9326 In most <command>lsearch</command> files, keys are not required to contain colons or #
9327 characters, or white space. However, if you need this feature, it is available.
9328 If a key begins with a doublequote character, it is terminated only by a
9329 matching quote (or end of line), and the normal escaping rules apply to its
9330 contents (see section <xref linkend="SECTstrings"/>). An optional colon is permitted after
9331 quoted keys (exactly as for unquoted keys). There is no special handling of
9332 quotes for the data part of an <command>lsearch</command> line.
9333 </para>
9334 </listitem>
9335 <listitem>
9336 <para>
9337 <indexterm role="concept">
9338 <primary>NIS lookup type</primary>
9339 </indexterm>
9340 <indexterm role="concept">
9341 <primary>lookup</primary>
9342 <secondary>NIS</secondary>
9343 </indexterm>
9344 <indexterm role="concept">
9345 <primary>binary zero</primary>
9346 <secondary>in lookup key</secondary>
9347 </indexterm>
9348 <command>nis</command>: The given file is the name of a NIS map, and a NIS lookup is done with
9349 the given key, without a terminating binary zero. There is a variant called
9350 <command>nis0</command> which does include the terminating binary zero in the key. This is
9351 reportedly needed for Sun-style alias files. Exim does not recognize NIS
9352 aliases; the full map names must be used.
9353 </para>
9354 </listitem>
9355 <listitem>
9356 <para>
9357 <indexterm role="concept">
9358 <primary>wildlsearch lookup type</primary>
9359 </indexterm>
9360 <indexterm role="concept">
9361 <primary>lookup</primary>
9362 <secondary>wildlsearch</secondary>
9363 </indexterm>
9364 <indexterm role="concept">
9365 <primary>nwildlsearch lookup type</primary>
9366 </indexterm>
9367 <indexterm role="concept">
9368 <primary>lookup</primary>
9369 <secondary>nwildlsearch</secondary>
9370 </indexterm>
9371 <command>wildlsearch</command> or <command>nwildlsearch</command>: These search a file linearly, like
9372 <command>lsearch</command>, but instead of being interpreted as a literal string, each key in
9373 the file may be wildcarded. The difference between these two lookup types is
9374 that for <command>wildlsearch</command>, each key in the file is string-expanded before being
9375 used, whereas for <command>nwildlsearch</command>, no expansion takes place.
9376 </para>
9377 <para>
9378 <indexterm role="concept">
9379 <primary>case sensitivity</primary>
9380 <secondary>in (n)wildlsearch lookup</secondary>
9381 </indexterm>
9382 Like <command>lsearch</command>, the testing is done case-insensitively. However, keys in the
9383 file that are regular expressions can be made case-sensitive by the use of
9384 <literal>(-i)</literal> within the pattern. The following forms of wildcard are recognized:
9385 </para>
9386 <orderedlist numeration="arabic">
9387 <listitem>
9388 <para>
9389 The string may begin with an asterisk to mean <quote>ends with</quote>. For example:
9390 </para>
9391 <literallayout class="monospaced">
9392     *.a.b.c       data for anything.a.b.c
9393     *fish         data for anythingfish
9394 </literallayout>
9395 </listitem>
9396 <listitem>
9397 <para>
9398 The string may begin with a circumflex to indicate a regular expression. For
9399 example, for <command>wildlsearch</command>:
9400 </para>
9401 <literallayout class="monospaced">
9402     ^\N\d+\.a\.b\N    data for &lt;digits&gt;.a.b
9403 </literallayout>
9404 <para>
9405 Note the use of <literal>\N</literal> to disable expansion of the contents of the regular
9406 expression. If you are using <command>nwildlsearch</command>, where the keys are not
9407 string-expanded, the equivalent entry is:
9408 </para>
9409 <literallayout class="monospaced">
9410     ^\d+\.a\.b        data for &lt;digits&gt;.a.b
9411 </literallayout>
9412 <para>
9413 The case-insensitive flag is set at the start of compiling the regular
9414 expression, but it can be turned off by using <literal>(-i)</literal> at an appropriate point.
9415 For example, to make the entire pattern case-sensitive:
9416 </para>
9417 <literallayout class="monospaced">
9418     ^(?-i)\d+\.a\.b        data for &lt;digits&gt;.a.b
9419 </literallayout>
9420 <para>
9421 If the regular expression contains white space or colon characters, you must
9422 either quote it (see <command>lsearch</command> above), or represent these characters in other
9423 ways. For example, <literal>\s</literal> can be used for white space and <literal>\x3A</literal> for a
9424 colon. This may be easier than quoting, because if you quote, you have to
9425 escape all the backslashes inside the quotes.
9426 </para>
9427 <para>
9428 <emphasis role="bold">Note</emphasis>: It is not possible to capture substrings in a regular expression
9429 match for later use, because the results of all lookups are cached. If a lookup
9430 is repeated, the result is taken from the cache, and no actual pattern matching
9431 takes place. The values of all the numeric variables are unset after a
9432 <command>(n)wildlsearch</command> match.
9433 </para>
9434 </listitem>
9435 <listitem>
9436 <para>
9437 Although I cannot see it being of much use, the general matching function that
9438 is used to implement <command>(n)wildlsearch</command> means that the string may begin with a
9439 lookup name terminated by a semicolon, and followed by lookup data. For
9440 example:
9441 </para>
9442 <literallayout class="monospaced">
9443     cdb;/some/file  data for keys that match the file
9444 </literallayout>
9445 <para>
9446 The data that is obtained from the nested lookup is discarded.
9447 </para>
9448 </listitem>
9449 </orderedlist>
9450 <para>
9451 Keys that do not match any of these patterns are interpreted literally. The
9452 continuation rules for the data are the same as for <command>lsearch</command>, and keys may
9453 be followed by optional colons.
9454 </para>
9455 <para>
9456 <emphasis role="bold">Warning</emphasis>: Unlike most other single-key lookup types, a file of data for
9457 <command>(n)wildlsearch</command> can <emphasis>not</emphasis> be turned into a DBM or cdb file, because those
9458 lookup types support only literal keys.
9459 </para>
9460 </listitem>
9461 </itemizedlist>
9462 </section>
9463 <section id="SECID62">
9464 <title>Query-style lookup types</title>
9465 <para>
9466 <indexterm role="concept">
9467 <primary>lookup</primary>
9468 <secondary>query-style types</secondary>
9469 </indexterm>
9470 <indexterm role="concept">
9471 <primary>query-style lookup</primary>
9472 <secondary>list of types</secondary>
9473 </indexterm>
9474 The supported query-style lookup types are listed below. Further details about
9475 many of them are given in later sections.
9476 </para>
9477 <itemizedlist>
9478 <listitem>
9479 <para>
9480 <indexterm role="concept">
9481 <primary>DNS</primary>
9482 <secondary>as a lookup type</secondary>
9483 </indexterm>
9484 <indexterm role="concept">
9485 <primary>lookup</primary>
9486 <secondary>DNS</secondary>
9487 </indexterm>
9488 <command>dnsdb</command>: This does a DNS search for one or more records whose domain names
9489 are given in the supplied query. The resulting data is the contents of the
9490 records. See section <xref linkend="SECTdnsdb"/>.
9491 </para>
9492 </listitem>
9493 <listitem>
9494 <para>
9495 <indexterm role="concept">
9496 <primary>InterBase lookup type</primary>
9497 </indexterm>
9498 <indexterm role="concept">
9499 <primary>lookup</primary>
9500 <secondary>InterBase</secondary>
9501 </indexterm>
9502 <command>ibase</command>: This does a lookup in an InterBase database.
9503 </para>
9504 </listitem>
9505 <listitem>
9506 <para>
9507 <indexterm role="concept">
9508 <primary>LDAP</primary>
9509 <secondary>lookup type</secondary>
9510 </indexterm>
9511 <indexterm role="concept">
9512 <primary>lookup</primary>
9513 <secondary>LDAP</secondary>
9514 </indexterm>
9515 <command>ldap</command>: This does an LDAP lookup using a query in the form of a URL, and
9516 returns attributes from a single entry. There is a variant called <command>ldapm</command>
9517 that permits values from multiple entries to be returned. A third variant
9518 called <command>ldapdn</command> returns the Distinguished Name of a single entry instead of
9519 any attribute values. See section <xref linkend="SECTldap"/>.
9520 </para>
9521 </listitem>
9522 <listitem>
9523 <para>
9524 <indexterm role="concept">
9525 <primary>MySQL</primary>
9526 <secondary>lookup type</secondary>
9527 </indexterm>
9528 <indexterm role="concept">
9529 <primary>lookup</primary>
9530 <secondary>MySQL</secondary>
9531 </indexterm>
9532 <command>mysql</command>: The format of the query is an SQL statement that is passed to a
9533 MySQL database. See section <xref linkend="SECTsql"/>.
9534 </para>
9535 </listitem>
9536 <listitem>
9537 <para>
9538 <indexterm role="concept">
9539 <primary>NIS+ lookup type</primary>
9540 </indexterm>
9541 <indexterm role="concept">
9542 <primary>lookup</primary>
9543 <secondary>NIS+</secondary>
9544 </indexterm>
9545 <command>nisplus</command>: This does a NIS+ lookup using a query that can specify the name of
9546 the field to be returned. See section <xref linkend="SECTnisplus"/>.
9547 </para>
9548 </listitem>
9549 <listitem>
9550 <para>
9551 <indexterm role="concept">
9552 <primary>Oracle</primary>
9553 <secondary>lookup type</secondary>
9554 </indexterm>
9555 <indexterm role="concept">
9556 <primary>lookup</primary>
9557 <secondary>Oracle</secondary>
9558 </indexterm>
9559 <command>oracle</command>: The format of the query is an SQL statement that is passed to an
9560 Oracle database. See section <xref linkend="SECTsql"/>.
9561 </para>
9562 </listitem>
9563 <listitem>
9564 <para>
9565 <indexterm role="concept">
9566 <primary>lookup</primary>
9567 <secondary>passwd</secondary>
9568 </indexterm>
9569 <indexterm role="concept">
9570 <primary>passwd lookup type</primary>
9571 </indexterm>
9572 <indexterm role="concept">
9573 <primary><filename>/etc/passwd</filename></primary>
9574 </indexterm>
9575 <command>passwd</command> is a query-style lookup with queries that are just user names. The
9576 lookup calls <function>getpwnam()</function> to interrogate the system password data, and on
9577 success, the result string is the same as you would get from an <command>lsearch</command>
9578 lookup on a traditional <filename>/etc/passwd file</filename>, though with <literal>*</literal> for the
9579 password value. For example:
9580 </para>
9581 <literallayout class="monospaced">
9582 *:42:42:King Rat:/home/kr:/bin/bash
9583 </literallayout>
9584 </listitem>
9585 <listitem>
9586 <para>
9587 <indexterm role="concept">
9588 <primary>PostgreSQL lookup type</primary>
9589 </indexterm>
9590 <indexterm role="concept">
9591 <primary>lookup</primary>
9592 <secondary>PostgreSQL</secondary>
9593 </indexterm>
9594 <command>pgsql</command>: The format of the query is an SQL statement that is passed to a
9595 PostgreSQL database. See section <xref linkend="SECTsql"/>.
9596 </para>
9597 </listitem>
9598 <listitem>
9599 <para>
9600 <indexterm role="concept">
9601 <primary>sqlite lookup type</primary>
9602 </indexterm>
9603 <indexterm role="concept">
9604 <primary>lookup</primary>
9605 <secondary>sqlite</secondary>
9606 </indexterm>
9607 <command>sqlite</command>: The format of the query is a file name followed by an SQL statement
9608 that is passed to an SQLite database. See section <xref linkend="SECTsqlite"/>.
9609 </para>
9610 </listitem>
9611 <listitem>
9612 <para>
9613 <command>testdb</command>: This is a lookup type that is used for testing Exim. It is
9614 not likely to be useful in normal operation.
9615 </para>
9616 </listitem>
9617 <listitem>
9618 <para>
9619 <indexterm role="concept">
9620 <primary>whoson lookup type</primary>
9621 </indexterm>
9622 <indexterm role="concept">
9623 <primary>lookup</primary>
9624 <secondary>whoson</secondary>
9625 </indexterm>
9626 <command>whoson</command>: <emphasis>Whoson</emphasis> (<emphasis role="bold"><ulink url="http://whoson.sourceforge.net">http://whoson.sourceforge.net</ulink></emphasis>) is a protocol that
9627 allows a server to check whether a particular (dynamically allocated) IP
9628 address is currently allocated to a known (trusted) user and, optionally, to
9629 obtain the identity of the said user. For SMTP servers, <emphasis>Whoson</emphasis> was popular
9630 at one time for <quote>POP before SMTP</quote> authentication, but that approach has been
9631 superseded by SMTP authentication. In Exim, <emphasis>Whoson</emphasis> can be used to implement
9632 <quote>POP before SMTP</quote> checking using ACL statements such as
9633 </para>
9634 <literallayout class="monospaced">
9635 require condition = \
9636   ${lookup whoson {$sender_host_address}{yes}{no}}
9637 </literallayout>
9638 <para>
9639 The query consists of a single IP address. The value returned is the name of
9640 the authenticated user, which is stored in the variable <varname>$value</varname>. However, in
9641 this example, the data in <varname>$value</varname> is not used; the result of the lookup is
9642 one of the fixed strings <quote>yes</quote> or <quote>no</quote>.
9643 </para>
9644 </listitem>
9645 </itemizedlist>
9646 </section>
9647 <section id="SECID63">
9648 <title>Temporary errors in lookups</title>
9649 <para>
9650 <indexterm role="concept">
9651 <primary>lookup</primary>
9652 <secondary>temporary error in</secondary>
9653 </indexterm>
9654 Lookup functions can return temporary error codes if the lookup cannot be
9655 completed. For example, an SQL or LDAP database might be unavailable. For this
9656 reason, it is not advisable to use a lookup that might do this for critical
9657 options such as a list of local domains.
9658 </para>
9659 <para>
9660 When a lookup cannot be completed in a router or transport, delivery
9661 of the message (to the relevant address) is deferred, as for any other
9662 temporary error. In other circumstances Exim may assume the lookup has failed,
9663 or may give up altogether.
9664 </para>
9665 </section>
9666 <section id="SECTdefaultvaluelookups">
9667 <title>Default values in single-key lookups</title>
9668 <para>
9669 <indexterm role="concept">
9670 <primary>wildcard lookups</primary>
9671 </indexterm>
9672 <indexterm role="concept">
9673 <primary>lookup</primary>
9674 <secondary>default values</secondary>
9675 </indexterm>
9676 <indexterm role="concept">
9677 <primary>lookup</primary>
9678 <secondary>wildcard</secondary>
9679 </indexterm>
9680 <indexterm role="concept">
9681 <primary>lookup</primary>
9682 <secondary>* added to type</secondary>
9683 </indexterm>
9684 <indexterm role="concept">
9685 <primary>default</primary>
9686 <secondary>in single-key lookups</secondary>
9687 </indexterm>
9688 In this context, a <quote>default value</quote> is a value specified by the administrator
9689 that is to be used if a lookup fails.
9690 </para>
9691 <para>
9692 <emphasis role="bold">Note:</emphasis> This section applies only to single-key lookups. For query-style
9693 lookups, the facilities of the query language must be used. An attempt to
9694 specify a default for a query-style lookup provokes an error.
9695 </para>
9696 <para>
9697 If <quote>*</quote> is added to a single-key lookup type (for example, <option>lsearch*</option>)
9698 and the initial lookup fails, the key <quote>*</quote> is looked up in the file to
9699 provide a default value. See also the section on partial matching below.
9700 </para>
9701 <para>
9702 <indexterm role="concept">
9703 <primary>*@ with single-key lookup</primary>
9704 </indexterm>
9705 <indexterm role="concept">
9706 <primary>lookup</primary>
9707 <secondary>*@ added to type</secondary>
9708 </indexterm>
9709 <indexterm role="concept">
9710 <primary>alias file</primary>
9711 <secondary>per-domain default</secondary>
9712 </indexterm>
9713 Alternatively, if <quote>*@</quote> is added to a single-key lookup type (for example
9714 <option>dbm*@</option>) then, if the initial lookup fails and the key contains an @
9715 character, a second lookup is done with everything before the last @ replaced
9716 by *. This makes it possible to provide per-domain defaults in alias files
9717 that include the domains in the keys. If the second lookup fails (or doesn&#x2019;t
9718 take place because there is no @ in the key), <quote>*</quote> is looked up.
9719 For example, a <command>redirect</command> router might contain:
9720 </para>
9721 <literallayout class="monospaced">
9722 data = ${lookup{$local_part@$domain}lsearch*@{/etc/mix-aliases}}
9723 </literallayout>
9724 <para>
9725 Suppose the address that is being processed is <emphasis>jane@eyre.example</emphasis>. Exim
9726 looks up these keys, in this order:
9727 </para>
9728 <literallayout class="monospaced">
9729 jane@eyre.example
9730 *@eyre.example
9731 *
9732 </literallayout>
9733 <para>
9734 The data is taken from whichever key it finds first. <emphasis role="bold">Note</emphasis>: In an
9735 <command>lsearch</command> file, this does not mean the first of these keys in the file. A
9736 complete scan is done for each key, and only if it is not found at all does
9737 Exim move on to try the next key.
9738 </para>
9739 </section>
9740 <section id="SECTpartiallookup">
9741 <title>Partial matching in single-key lookups</title>
9742 <para>
9743 <indexterm role="concept">
9744 <primary>partial matching</primary>
9745 </indexterm>
9746 <indexterm role="concept">
9747 <primary>wildcard lookups</primary>
9748 </indexterm>
9749 <indexterm role="concept">
9750 <primary>lookup</primary>
9751 <secondary>partial matching</secondary>
9752 </indexterm>
9753 <indexterm role="concept">
9754 <primary>lookup</primary>
9755 <secondary>wildcard</secondary>
9756 </indexterm>
9757 <indexterm role="concept">
9758 <primary>asterisk</primary>
9759 <secondary>in search type</secondary>
9760 </indexterm>
9761 The normal operation of a single-key lookup is to search the file for an exact
9762 match with the given key. However, in a number of situations where domains are
9763 being looked up, it is useful to be able to do partial matching. In this case,
9764 information in the file that has a key starting with <quote>*.</quote> is matched by any
9765 domain that ends with the components that follow the full stop. For example, if
9766 a key in a DBM file is
9767 </para>
9768 <literallayout class="monospaced">
9769 *.dates.fict.example
9770 </literallayout>
9771 <para>
9772 then when partial matching is enabled this is matched by (amongst others)
9773 <emphasis>2001.dates.fict.example</emphasis> and <emphasis>1984.dates.fict.example</emphasis>. It is also matched
9774 by <emphasis>dates.fict.example</emphasis>, if that does not appear as a separate key in the
9775 file.
9776 </para>
9777 <para>
9778 <emphasis role="bold">Note</emphasis>: Partial matching is not available for query-style lookups. It is
9779 also not available for any lookup items in address lists (see section
9780 <xref linkend="SECTaddresslist"/>).
9781 </para>
9782 <para>
9783 Partial matching is implemented by doing a series of separate lookups using
9784 keys constructed by modifying the original subject key. This means that it can
9785 be used with any of the single-key lookup types, provided that
9786 partial matching keys
9787 beginning with a special prefix (default <quote>*.</quote>) are included in the data file.
9788 Keys in the file that do not begin with the prefix are matched only by
9789 unmodified subject keys when partial matching is in use.
9790 </para>
9791 <para>
9792 Partial matching is requested by adding the string <quote>partial-</quote> to the front of
9793 the name of a single-key lookup type, for example, <option>partial-dbm</option>. When this
9794 is done, the subject key is first looked up unmodified; if that fails, <quote>*.</quote>
9795 is added at the start of the subject key, and it is looked up again. If that
9796 fails, further lookups are tried with dot-separated components removed from the
9797 start of the subject key, one-by-one, and <quote>*.</quote> added on the front of what
9798 remains.
9799 </para>
9800 <para>
9801 A minimum number of two non-* components are required. This can be adjusted
9802 by including a number before the hyphen in the search type. For example,
9803 <option>partial3-lsearch</option> specifies a minimum of three non-* components in the
9804 modified keys. Omitting the number is equivalent to <quote>partial2-</quote>. If the
9805 subject key is <emphasis>2250.dates.fict.example</emphasis> then the following keys are looked
9806 up when the minimum number of non-* components is two:
9807 </para>
9808 <literallayout class="monospaced">
9809 2250.dates.fict.example
9810 *.2250.dates.fict.example
9811 *.dates.fict.example
9812 *.fict.example
9813 </literallayout>
9814 <para>
9815 As soon as one key in the sequence is successfully looked up, the lookup
9816 finishes.
9817 </para>
9818 <para>
9819 <indexterm role="concept">
9820 <primary>lookup</primary>
9821 <secondary>partial matching &ndash; changing prefix</secondary>
9822 </indexterm>
9823 <indexterm role="concept">
9824 <primary>prefix</primary>
9825 <secondary>for partial matching</secondary>
9826 </indexterm>
9827 The use of <quote>*.</quote> as the partial matching prefix is a default that can be
9828 changed. The motivation for this feature is to allow Exim to operate with file
9829 formats that are used by other MTAs. A different prefix can be supplied in
9830 parentheses instead of the hyphen after <quote>partial</quote>. For example:
9831 </para>
9832 <literallayout class="monospaced">
9833 domains = partial(.)lsearch;/some/file
9834 </literallayout>
9835 <para>
9836 In this example, if the domain is <emphasis>a.b.c</emphasis>, the sequence of lookups is
9837 <literal>a.b.c</literal>, <literal>.a.b.c</literal>, and <literal>.b.c</literal> (the default minimum of 2 non-wild
9838 components is unchanged). The prefix may consist of any punctuation characters
9839 other than a closing parenthesis. It may be empty, for example:
9840 </para>
9841 <literallayout class="monospaced">
9842 domains = partial1()cdb;/some/file
9843 </literallayout>
9844 <para>
9845 For this example, if the domain is <emphasis>a.b.c</emphasis>, the sequence of lookups is
9846 <literal>a.b.c</literal>, <literal>b.c</literal>, and <literal>c</literal>.
9847 </para>
9848 <para>
9849 If <quote>partial0</quote> is specified, what happens at the end (when the lookup with
9850 just one non-wild component has failed, and the original key is shortened right
9851 down to the null string) depends on the prefix:
9852 </para>
9853 <itemizedlist>
9854 <listitem>
9855 <para>
9856 If the prefix has zero length, the whole lookup fails.
9857 </para>
9858 </listitem>
9859 <listitem>
9860 <para>
9861 If the prefix has length 1, a lookup for just the prefix is done. For
9862 example, the final lookup for <quote>partial0(.)</quote> is for <literal>.</literal> alone.
9863 </para>
9864 </listitem>
9865 <listitem>
9866 <para>
9867 Otherwise, if the prefix ends in a dot, the dot is removed, and the
9868 remainder is looked up. With the default prefix, therefore, the final lookup is
9869 for <quote>*</quote> on its own.
9870 </para>
9871 </listitem>
9872 <listitem>
9873 <para>
9874 Otherwise, the whole prefix is looked up.
9875 </para>
9876 </listitem>
9877 </itemizedlist>
9878 <para>
9879 If the search type ends in <quote>*</quote> or <quote>*@</quote> (see section
9880 <xref linkend="SECTdefaultvaluelookups"/> above), the search for an ultimate default that
9881 this implies happens after all partial lookups have failed. If <quote>partial0</quote> is
9882 specified, adding <quote>*</quote> to the search type has no effect with the default
9883 prefix, because the <quote>*</quote> key is already included in the sequence of partial
9884 lookups. However, there might be a use for lookup types such as
9885 <quote>partial0(.)lsearch*</quote>.
9886 </para>
9887 <para>
9888 The use of <quote>*</quote> in lookup partial matching differs from its use as a wildcard
9889 in domain lists and the like. Partial matching works only in terms of
9890 dot-separated components; a key such as <literal>*fict.example</literal>
9891 in a database file is useless, because the asterisk in a partial matching
9892 subject key is always followed by a dot.
9893 </para>
9894 </section>
9895 <section id="SECID64">
9896 <title>Lookup caching</title>
9897 <para>
9898 <indexterm role="concept">
9899 <primary>lookup</primary>
9900 <secondary>caching</secondary>
9901 </indexterm>
9902 <indexterm role="concept">
9903 <primary>caching</primary>
9904 <secondary>lookup data</secondary>
9905 </indexterm>
9906 Exim caches all lookup results in order to avoid needless repetition of
9907 lookups. However, because (apart from the daemon) Exim operates as a collection
9908 of independent, short-lived processes, this caching applies only within a
9909 single Exim process. There is no inter-process lookup caching facility.
9910 </para>
9911 <para>
9912 For single-key lookups, Exim keeps the relevant files open in case there is
9913 another lookup that needs them. In some types of configuration this can lead to
9914 many files being kept open for messages with many recipients. To avoid hitting
9915 the operating system limit on the number of simultaneously open files, Exim
9916 closes the least recently used file when it needs to open more files than its
9917 own internal limit, which can be changed via the <option>lookup_open_max</option> option.
9918 </para>
9919 <para>
9920 The single-key lookup files are closed and the lookup caches are flushed at
9921 strategic points during delivery &ndash; for example, after all routing is
9922 complete.
9923 </para>
9924 </section>
9925 <section id="SECID65">
9926 <title>Quoting lookup data</title>
9927 <para>
9928 <indexterm role="concept">
9929 <primary>lookup</primary>
9930 <secondary>quoting</secondary>
9931 </indexterm>
9932 <indexterm role="concept">
9933 <primary>quoting</primary>
9934 <secondary>in lookups</secondary>
9935 </indexterm>
9936 When data from an incoming message is included in a query-style lookup, there
9937 is the possibility of special characters in the data messing up the syntax of
9938 the query. For example, a NIS+ query that contains
9939 </para>
9940 <literallayout class="monospaced">
9941 [name=$local_part]
9942 </literallayout>
9943 <para>
9944 will be broken if the local part happens to contain a closing square bracket.
9945 For NIS+, data can be enclosed in double quotes like this:
9946 </para>
9947 <literallayout class="monospaced">
9948 [name="$local_part"]
9949 </literallayout>
9950 <para>
9951 but this still leaves the problem of a double quote in the data. The rule for
9952 NIS+ is that double quotes must be doubled. Other lookup types have different
9953 rules, and to cope with the differing requirements, an expansion operator
9954 of the following form is provided:
9955 </para>
9956 <literallayout class="monospaced">
9957 ${quote_&lt;lookup-type&gt;:&lt;string&gt;}
9958 </literallayout>
9959 <para>
9960 For example, the safest way to write the NIS+ query is
9961 </para>
9962 <literallayout class="monospaced">
9963 [name="${quote_nisplus:$local_part}"]
9964 </literallayout>
9965 <para>
9966 See chapter <xref linkend="CHAPexpand"/> for full coverage of string expansions. The quote
9967 operator can be used for all lookup types, but has no effect for single-key
9968 lookups, since no quoting is ever needed in their key strings.
9969 </para>
9970 </section>
9971 <section id="SECTdnsdb">
9972 <title>More about dnsdb</title>
9973 <para>
9974 <indexterm role="concept">
9975 <primary>dnsdb lookup</primary>
9976 </indexterm>
9977 <indexterm role="concept">
9978 <primary>lookup</primary>
9979 <secondary>dnsdb</secondary>
9980 </indexterm>
9981 <indexterm role="concept">
9982 <primary>DNS</primary>
9983 <secondary>as a lookup type</secondary>
9984 </indexterm>
9985 The <command>dnsdb</command> lookup type uses the DNS as its database. A simple query consists
9986 of a record type and a domain name, separated by an equals sign. For example,
9987 an expansion string could contain:
9988 </para>
9989 <literallayout class="monospaced">
9990 ${lookup dnsdb{mx=a.b.example}{$value}fail}
9991 </literallayout>
9992 <para>
9993 If the lookup succeeds, the result is placed in <varname>$value</varname>, which in this case
9994 is used on its own as the result. If the lookup does not succeed, the
9995 <literal>fail</literal> keyword causes a <emphasis>forced expansion failure</emphasis> &ndash; see section
9996 <xref linkend="SECTforexpfai"/> for an explanation of what this means.
9997 </para>
9998 <para>
9999 The supported DNS record types are A, CNAME, MX, NS, PTR, SRV, and TXT, and,
10000 when Exim is compiled with IPv6 support, AAAA (and A6 if that is also
10001 configured). If no type is given, TXT is assumed. When the type is PTR,
10002 the data can be an IP address, written as normal; inversion and the addition of
10003 <option>in-addr.arpa</option> or <option>ip6.arpa</option> happens automatically. For example:
10004 </para>
10005 <literallayout class="monospaced">
10006 ${lookup dnsdb{ptr=192.168.4.5}{$value}fail}
10007 </literallayout>
10008 <para>
10009 If the data for a PTR record is not a syntactically valid IP address, it is not
10010 altered and nothing is added.
10011 </para>
10012 <para>
10013 <indexterm role="concept">
10014 <primary>MX record</primary>
10015 <secondary>in <command>dnsdb</command> lookup</secondary>
10016 </indexterm>
10017 <indexterm role="concept">
10018 <primary>SRV record</primary>
10019 <secondary>in <command>dnsdb</command> lookup</secondary>
10020 </indexterm>
10021 For an MX lookup, both the preference value and the host name are returned for
10022 each record, separated by a space. For an SRV lookup, the priority, weight,
10023 port, and host name are returned for each record, separated by spaces.
10024 </para>
10025 <para>
10026 For any record type, if multiple records are found (or, for A6 lookups, if a
10027 single record leads to multiple addresses), the data is returned as a
10028 concatenation, with newline as the default separator. The order, of course,
10029 depends on the DNS resolver. You can specify a different separator character
10030 between multiple records by putting a right angle-bracket followed immediately
10031 by the new separator at the start of the query. For example:
10032 </para>
10033 <literallayout class="monospaced">
10034 ${lookup dnsdb{&gt;: a=host1.example}}
10035 </literallayout>
10036 <para>
10037 It is permitted to specify a space as the separator character. Further
10038 white space is ignored.
10039 </para>
10040 <para revisionflag="changed">
10041 <indexterm role="concept">
10042 <primary>TXT record</primary>
10043 <secondary>in <command>dnsdb</command> lookup</secondary>
10044 </indexterm>
10045 For TXT records with multiple items of data, only the first item is returned,
10046 unless a separator for them is specified using a comma after the separator
10047 character followed immediately by the TXT record item separator. To concatenate
10048 items without a separator, use a semicolon instead.
10049 </para>
10050 <literallayout class="monospaced" revisionflag="changed">
10051 ${lookup dnsdb{&gt;\n,: txt=a.b.example}}
10052 ${lookup dnsdb{&gt;\n; txt=a.b.example}}
10053 </literallayout>
10054 <para revisionflag="changed">
10055 It is permitted to specify a space as the separator character. Further
10056 white space is ignored.
10057 </para>
10058 </section>
10059 <section id="SECID66">
10060 <title>Pseudo dnsdb record types</title>
10061 <para>
10062 <indexterm role="concept">
10063 <primary>MX record</primary>
10064 <secondary>in <command>dnsdb</command> lookup</secondary>
10065 </indexterm>
10066 By default, both the preference value and the host name are returned for
10067 each MX record, separated by a space. If you want only host names, you can use
10068 the pseudo-type MXH:
10069 </para>
10070 <literallayout class="monospaced">
10071 ${lookup dnsdb{mxh=a.b.example}}
10072 </literallayout>
10073 <para>
10074 In this case, the preference values are omitted, and just the host names are
10075 returned.
10076 </para>
10077 <para>
10078 <indexterm role="concept">
10079 <primary>name server for enclosing domain</primary>
10080 </indexterm>
10081 Another pseudo-type is ZNS (for <quote>zone NS</quote>). It performs a lookup for NS
10082 records on the given domain, but if none are found, it removes the first
10083 component of the domain name, and tries again. This process continues until NS
10084 records are found or there are no more components left (or there is a DNS
10085 error). In other words, it may return the name servers for a top-level domain,
10086 but it never returns the root name servers. If there are no NS records for the
10087 top-level domain, the lookup fails. Consider these examples:
10088 </para>
10089 <literallayout class="monospaced">
10090 ${lookup dnsdb{zns=xxx.quercite.com}}
10091 ${lookup dnsdb{zns=xxx.edu}}
10092 </literallayout>
10093 <para>
10094 Assuming that in each case there are no NS records for the full domain name,
10095 the first returns the name servers for <option>quercite.com</option>, and the second returns
10096 the name servers for <option>edu</option>.
10097 </para>
10098 <para>
10099 You should be careful about how you use this lookup because, unless the
10100 top-level domain does not exist, the lookup always returns some host names. The
10101 sort of use to which this might be put is for seeing if the name servers for a
10102 given domain are on a blacklist. You can probably assume that the name servers
10103 for the high-level domains such as <option>com</option> or <option>co.uk</option> are not going to be on
10104 such a list.
10105 </para>
10106 <para>
10107 <indexterm role="concept">
10108 <primary>CSA</primary>
10109 <secondary>in <command>dnsdb</command> lookup</secondary>
10110 </indexterm>
10111 A third pseudo-type is CSA (Client SMTP Authorization). This looks up SRV
10112 records according to the CSA rules, which are described in section
10113 <xref linkend="SECTverifyCSA"/>. Although <command>dnsdb</command> supports SRV lookups directly, this is
10114 not sufficient because of the extra parent domain search behaviour of CSA. The
10115 result of a successful lookup such as:
10116 </para>
10117 <literallayout class="monospaced">
10118 ${lookup dnsdb {csa=$sender_helo_name}}
10119 </literallayout>
10120 <para>
10121 has two space-separated fields: an authorization code and a target host name.
10122 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
10123 authorization required but absent, or <quote>?</quote> for unknown.
10124 </para>
10125 </section>
10126 <section id="SECID67">
10127 <title>Multiple dnsdb lookups</title>
10128 <para>
10129 In the previous sections, <command>dnsdb</command> lookups for a single domain are described.
10130 However, you can specify a list of domains or IP addresses in a single
10131 <command>dnsdb</command> lookup. The list is specified in the normal Exim way, with colon as
10132 the default separator, but with the ability to change this. For example:
10133 </para>
10134 <literallayout class="monospaced">
10135 ${lookup dnsdb{one.domain.com:two.domain.com}}
10136 ${lookup dnsdb{a=one.host.com:two.host.com}}
10137 ${lookup dnsdb{ptr = &lt;; 1.2.3.4 ; 4.5.6.8}}
10138 </literallayout>
10139 <para>
10140 In order to retain backwards compatibility, there is one special case: if
10141 the lookup type is PTR and no change of separator is specified, Exim looks
10142 to see if the rest of the string is precisely one IPv6 address. In this
10143 case, it does not treat it as a list.
10144 </para>
10145 <para>
10146 The data from each lookup is concatenated, with newline separators by default,
10147 in the same way that multiple DNS records for a single item are handled. A
10148 different separator can be specified, as described above.
10149 </para>
10150 <para>
10151 The <command>dnsdb</command> lookup fails only if all the DNS lookups fail. If there is a
10152 temporary DNS error for any of them, the behaviour is controlled by
10153 an optional keyword followed by a comma that may appear before the record
10154 type. The possible keywords are <quote>defer_strict</quote>, <quote>defer_never</quote>, and
10155 <quote>defer_lax</quote>. With <quote>strict</quote> behaviour, any temporary DNS error causes the
10156 whole lookup to defer. With <quote>never</quote> behaviour, a temporary DNS error is
10157 ignored, and the behaviour is as if the DNS lookup failed to find anything.
10158 With <quote>lax</quote> behaviour, all the queries are attempted, but a temporary DNS
10159 error causes the whole lookup to defer only if none of the other lookups
10160 succeed. The default is <quote>lax</quote>, so the following lookups are equivalent:
10161 </para>
10162 <literallayout class="monospaced">
10163 ${lookup dnsdb{defer_lax,a=one.host.com:two.host.com}}
10164 ${lookup dnsdb{a=one.host.com:two.host.com}}
10165 </literallayout>
10166 <para>
10167 Thus, in the default case, as long as at least one of the DNS lookups
10168 yields some data, the lookup succeeds.
10169 </para>
10170 </section>
10171 <section id="SECTldap">
10172 <title>More about LDAP</title>
10173 <para>
10174 <indexterm role="concept">
10175 <primary>LDAP</primary>
10176 <secondary>lookup, more about</secondary>
10177 </indexterm>
10178 <indexterm role="concept">
10179 <primary>lookup</primary>
10180 <secondary>LDAP</secondary>
10181 </indexterm>
10182 <indexterm role="concept">
10183 <primary>Solaris</primary>
10184 <secondary>LDAP</secondary>
10185 </indexterm>
10186 The original LDAP implementation came from the University of Michigan; this has
10187 become <quote>Open LDAP</quote>, and there are now two different releases. Another
10188 implementation comes from Netscape, and Solaris 7 and subsequent releases
10189 contain inbuilt LDAP support. Unfortunately, though these are all compatible at
10190 the lookup function level, their error handling is different. For this reason
10191 it is necessary to set a compile-time variable when building Exim with LDAP, to
10192 indicate which LDAP library is in use. One of the following should appear in
10193 your <filename>Local/Makefile</filename>:
10194 </para>
10195 <literallayout class="monospaced">
10196 LDAP_LIB_TYPE=UMICHIGAN
10197 LDAP_LIB_TYPE=OPENLDAP1
10198 LDAP_LIB_TYPE=OPENLDAP2
10199 LDAP_LIB_TYPE=NETSCAPE
10200 LDAP_LIB_TYPE=SOLARIS
10201 </literallayout>
10202 <para>
10203 If LDAP_LIB_TYPE is not set, Exim assumes <literal>OPENLDAP1</literal>, which has the
10204 same interface as the University of Michigan version.
10205 </para>
10206 <para>
10207 There are three LDAP lookup types in Exim. These behave slightly differently in
10208 the way they handle the results of a query:
10209 </para>
10210 <itemizedlist>
10211 <listitem>
10212 <para>
10213 <command>ldap</command> requires the result to contain just one entry; if there are more, it
10214 gives an error.
10215 </para>
10216 </listitem>
10217 <listitem>
10218 <para>
10219 <command>ldapdn</command> also requires the result to contain just one entry, but it is the
10220 Distinguished Name that is returned rather than any attribute values.
10221 </para>
10222 </listitem>
10223 <listitem>
10224 <para>
10225 <command>ldapm</command> permits the result to contain more than one entry; the attributes
10226 from all of them are returned.
10227 </para>
10228 </listitem>
10229 </itemizedlist>
10230 <para>
10231 For <command>ldap</command> and <command>ldapm</command>, if a query finds only entries with no attributes,
10232 Exim behaves as if the entry did not exist, and the lookup fails. The format of
10233 the data returned by a successful lookup is described in the next section.
10234 First we explain how LDAP queries are coded.
10235 </para>
10236 </section>
10237 <section id="SECTforldaque">
10238 <title>Format of LDAP queries</title>
10239 <para>
10240 <indexterm role="concept">
10241 <primary>LDAP</primary>
10242 <secondary>query format</secondary>
10243 </indexterm>
10244 An LDAP query takes the form of a URL as defined in RFC 2255. For example, in
10245 the configuration of a <command>redirect</command> router one might have this setting:
10246 </para>
10247 <literallayout class="monospaced">
10248 data = ${lookup ldap \
10249   {ldap:///cn=$local_part,o=University%20of%20Cambridge,\
10250   c=UK?mailbox?base?}}
10251 </literallayout>
10252 <para>
10253 <indexterm role="concept">
10254 <primary>LDAP</primary>
10255 <secondary>with TLS</secondary>
10256 </indexterm>
10257 The URL may begin with <literal>ldap</literal> or <literal>ldaps</literal> if your LDAP library supports
10258 secure (encrypted) LDAP connections. The second of these ensures that an
10259 encrypted TLS connection is used.
10260 </para>
10261 </section>
10262 <section id="SECID68">
10263 <title>LDAP quoting</title>
10264 <para>
10265 <indexterm role="concept">
10266 <primary>LDAP</primary>
10267 <secondary>quoting</secondary>
10268 </indexterm>
10269 Two levels of quoting are required in LDAP queries, the first for LDAP itself
10270 and the second because the LDAP query is represented as a URL. Furthermore,
10271 within an LDAP query, two different kinds of quoting are required. For this
10272 reason, there are two different LDAP-specific quoting operators.
10273 </para>
10274 <para>
10275 The <option>quote_ldap</option> operator is designed for use on strings that are part of
10276 filter specifications. Conceptually, it first does the following conversions on
10277 the string:
10278 </para>
10279 <literallayout class="monospaced">
10280 *   =&gt;   \2A
10281 (   =&gt;   \28
10282 )   =&gt;   \29
10283 \   =&gt;   \5C
10284 </literallayout>
10285 <para>
10286 in accordance with RFC 2254. The resulting string is then quoted according
10287 to the rules for URLs, that is, all non-alphanumeric characters except
10288 </para>
10289 <literallayout class="monospaced">
10290 ! $ ' - . _ ( ) * +
10291 </literallayout>
10292 <para>
10293 are converted to their hex values, preceded by a percent sign. For example:
10294 </para>
10295 <literallayout class="monospaced">
10296 ${quote_ldap: a(bc)*, a&lt;yz&gt;; }
10297 </literallayout>
10298 <para>
10299 yields
10300 </para>
10301 <literallayout class="monospaced">
10302 %20a%5C28bc%5C29%5C2A%2C%20a%3Cyz%3E%3B%20
10303 </literallayout>
10304 <para>
10305 Removing the URL quoting, this is (with a leading and a trailing space):
10306 </para>
10307 <literallayout class="monospaced">
10308 a\28bc\29\2A, a&lt;yz&gt;;
10309 </literallayout>
10310 <para>
10311 The <option>quote_ldap_dn</option> operator is designed for use on strings that are part of
10312 base DN specifications in queries. Conceptually, it first converts the string
10313 by inserting a backslash in front of any of the following characters:
10314 </para>
10315 <literallayout class="monospaced">
10316 , + " \ &lt; &gt; ;
10317 </literallayout>
10318 <para>
10319 It also inserts a backslash before any leading spaces or # characters, and
10320 before any trailing spaces. (These rules are in RFC 2253.) The resulting string
10321 is then quoted according to the rules for URLs. For example:
10322 </para>
10323 <literallayout class="monospaced">
10324 ${quote_ldap_dn: a(bc)*, a&lt;yz&gt;; }
10325 </literallayout>
10326 <para>
10327 yields
10328 </para>
10329 <literallayout class="monospaced">
10330 %5C%20a(bc)*%5C%2C%20a%5C%3Cyz%5C%3E%5C%3B%5C%20
10331 </literallayout>
10332 <para>
10333 Removing the URL quoting, this is (with a trailing space):
10334 </para>
10335 <literallayout class="monospaced">
10336 \ a(bc)*\, a\&lt;yz\&gt;\;\
10337 </literallayout>
10338 <para>
10339 There are some further comments about quoting in the section on LDAP
10340 authentication below.
10341 </para>
10342 </section>
10343 <section id="SECID69">
10344 <title>LDAP connections</title>
10345 <para>
10346 <indexterm role="concept">
10347 <primary>LDAP</primary>
10348 <secondary>connections</secondary>
10349 </indexterm>
10350 The connection to an LDAP server may either be over TCP/IP, or, when OpenLDAP
10351 is in use, via a Unix domain socket. The example given above does not specify
10352 an LDAP server. A server that is reached by TCP/IP can be specified in a query
10353 by starting it with
10354 </para>
10355 <literallayout class="monospaced">
10356 ldap://&lt;hostname&gt;:&lt;port&gt;/...
10357 </literallayout>
10358 <para>
10359 If the port (and preceding colon) are omitted, the standard LDAP port (389) is
10360 used. When no server is specified in a query, a list of default servers is
10361 taken from the <option>ldap_default_servers</option> configuration option. This supplies a
10362 colon-separated list of servers which are tried in turn until one successfully
10363 handles a query, or there is a serious error. Successful handling either
10364 returns the requested data, or indicates that it does not exist. Serious errors
10365 are syntactical, or multiple values when only a single value is expected.
10366 Errors which cause the next server to be tried are connection failures, bind
10367 failures, and timeouts.
10368 </para>
10369 <para>
10370 For each server name in the list, a port number can be given. The standard way
10371 of specifying a host and port is to use a colon separator (RFC 1738). Because
10372 <option>ldap_default_servers</option> is a colon-separated list, such colons have to be
10373 doubled. For example
10374 </para>
10375 <literallayout class="monospaced">
10376 ldap_default_servers = ldap1.example.com::145:ldap2.example.com
10377 </literallayout>
10378 <para>
10379 If <option>ldap_default_servers</option> is unset, a URL with no server name is passed
10380 to the LDAP library with no server name, and the library&#x2019;s default (normally
10381 the local host) is used.
10382 </para>
10383 <para>
10384 If you are using the OpenLDAP library, you can connect to an LDAP server using
10385 a Unix domain socket instead of a TCP/IP connection. This is specified by using
10386 <literal>ldapi</literal> instead of <literal>ldap</literal> in LDAP queries. What follows here applies only
10387 to OpenLDAP. If Exim is compiled with a different LDAP library, this feature is
10388 not available.
10389 </para>
10390 <para>
10391 For this type of connection, instead of a host name for the server, a pathname
10392 for the socket is required, and the port number is not relevant. The pathname
10393 can be specified either as an item in <option>ldap_default_servers</option>, or inline in
10394 the query. In the former case, you can have settings such as
10395 </para>
10396 <literallayout class="monospaced">
10397 ldap_default_servers = /tmp/ldap.sock : backup.ldap.your.domain
10398 </literallayout>
10399 <para>
10400 When the pathname is given in the query, you have to escape the slashes as
10401 <literal>%2F</literal> to fit in with the LDAP URL syntax. For example:
10402 </para>
10403 <literallayout class="monospaced">
10404 ${lookup ldap {ldapi://%2Ftmp%2Fldap.sock/o=...
10405 </literallayout>
10406 <para>
10407 When Exim processes an LDAP lookup and finds that the <quote>hostname</quote> is really
10408 a pathname, it uses the Unix domain socket code, even if the query actually
10409 specifies <literal>ldap</literal> or <literal>ldaps</literal>. In particular, no encryption is used for a
10410 socket connection. This behaviour means that you can use a setting of
10411 <option>ldap_default_servers</option> such as in the example above with traditional <literal>ldap</literal>
10412 or <literal>ldaps</literal> queries, and it will work. First, Exim tries a connection via
10413 the Unix domain socket; if that fails, it tries a TCP/IP connection to the
10414 backup host.
10415 </para>
10416 <para>
10417 If an explicit <literal>ldapi</literal> type is given in a query when a host name is
10418 specified, an error is diagnosed. However, if there are more items in
10419 <option>ldap_default_servers</option>, they are tried. In other words:
10420 </para>
10421 <itemizedlist>
10422 <listitem>
10423 <para>
10424 Using a pathname with <literal>ldap</literal> or <literal>ldaps</literal> forces the use of the Unix domain
10425 interface.
10426 </para>
10427 </listitem>
10428 <listitem>
10429 <para>
10430 Using <literal>ldapi</literal> with a host name causes an error.
10431 </para>
10432 </listitem>
10433 </itemizedlist>
10434 <para>
10435 Using <literal>ldapi</literal> with no host or path in the query, and no setting of
10436 <option>ldap_default_servers</option>, does whatever the library does by default.
10437 </para>
10438 </section>
10439 <section id="SECID70">
10440 <title>LDAP authentication and control information</title>
10441 <para>
10442 <indexterm role="concept">
10443 <primary>LDAP</primary>
10444 <secondary>authentication</secondary>
10445 </indexterm>
10446 The LDAP URL syntax provides no way of passing authentication and other control
10447 information to the server. To make this possible, the URL in an LDAP query may
10448 be preceded by any number of &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt; settings, separated by
10449 spaces. If a value contains spaces it must be enclosed in double quotes, and
10450 when double quotes are used, backslash is interpreted in the usual way inside
10451 them. The following names are recognized:
10452 </para>
10453 <literallayout>
10454 <literal>DEREFERENCE</literal>  set the dereferencing parameter
10455 <literal>NETTIME    </literal>  set a timeout for a network operation
10456 <literal>USER       </literal>  set the DN, for authenticating the LDAP bind
10457 <literal>PASS       </literal>  set the password, likewise
10458 <literal>REFERRALS  </literal>  set the referrals parameter
10459 <literal>SIZE       </literal>  set the limit for the number of entries returned
10460 <literal>TIME       </literal>  set the maximum waiting time for a query
10461 </literallayout>
10462 <para>
10463 The value of the DEREFERENCE parameter must be one of the words <quote>never</quote>,
10464 <quote>searching</quote>, <quote>finding</quote>, or <quote>always</quote>. The value of the REFERRALS parameter
10465 must be <quote>follow</quote> (the default) or <quote>nofollow</quote>. The latter stops the LDAP
10466 library from trying to follow referrals issued by the LDAP server.
10467 </para>
10468 <para>
10469 The name CONNECT is an obsolete name for NETTIME, retained for
10470 backwards compatibility. This timeout (specified as a number of seconds) is
10471 enforced from the client end for operations that can be carried out over a
10472 network. Specifically, it applies to network connections and calls to the
10473 <emphasis>ldap_result()</emphasis> function. If the value is greater than zero, it is used if
10474 LDAP_OPT_NETWORK_TIMEOUT is defined in the LDAP headers (OpenLDAP), or
10475 if LDAP_X_OPT_CONNECT_TIMEOUT is defined in the LDAP headers (Netscape
10476 SDK 4.1). A value of zero forces an explicit setting of <quote>no timeout</quote> for
10477 Netscape SDK; for OpenLDAP no action is taken.
10478 </para>
10479 <para>
10480 The TIME parameter (also a number of seconds) is passed to the server to
10481 set a server-side limit on the time taken to complete a search.
10482 </para>
10483 <para>
10484 Here is an example of an LDAP query in an Exim lookup that uses some of these
10485 values. This is a single line, folded to fit on the page:
10486 </para>
10487 <literallayout class="monospaced">
10488 ${lookup ldap
10489   {user="cn=manager,o=University of Cambridge,c=UK" pass=secret
10490   ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=foo)}
10491   {$value}fail}
10492 </literallayout>
10493 <para>
10494 The encoding of spaces as <literal>%20</literal> is a URL thing which should not be done for
10495 any of the auxiliary data. Exim configuration settings that include lookups
10496 which contain password information should be preceded by <quote>hide</quote> to prevent
10497 non-admin users from using the <option>-bP</option> option to see their values.
10498 </para>
10499 <para>
10500 The auxiliary data items may be given in any order. The default is no
10501 connection timeout (the system timeout is used), no user or password, no limit
10502 on the number of entries returned, and no time limit on queries.
10503 </para>
10504 <para>
10505 When a DN is quoted in the USER= setting for LDAP authentication, Exim
10506 removes any URL quoting that it may contain before passing it LDAP. Apparently
10507 some libraries do this for themselves, but some do not. Removing the URL
10508 quoting has two advantages:
10509 </para>
10510 <itemizedlist>
10511 <listitem>
10512 <para>
10513 It makes it possible to use the same <option>quote_ldap_dn</option> expansion for USER=
10514 DNs as with DNs inside actual queries.
10515 </para>
10516 </listitem>
10517 <listitem>
10518 <para>
10519 It permits spaces inside USER= DNs.
10520 </para>
10521 </listitem>
10522 </itemizedlist>
10523 <para>
10524 For example, a setting such as
10525 </para>
10526 <literallayout class="monospaced">
10527 USER=cn=${quote_ldap_dn:$1}
10528 </literallayout>
10529 <para>
10530 should work even if <varname>$1</varname> contains spaces.
10531 </para>
10532 <para>
10533 Expanded data for the PASS= value should be quoted using the <option>quote</option>
10534 expansion operator, rather than the LDAP quote operators. The only reason this
10535 field needs quoting is to ensure that it conforms to the Exim syntax, which
10536 does not allow unquoted spaces. For example:
10537 </para>
10538 <literallayout class="monospaced">
10539 PASS=${quote:$3}
10540 </literallayout>
10541 <para>
10542 The LDAP authentication mechanism can be used to check passwords as part of
10543 SMTP authentication. See the <option>ldapauth</option> expansion string condition in chapter
10544 <xref linkend="CHAPexpand"/>.
10545 </para>
10546 </section>
10547 <section id="SECID71">
10548 <title>Format of data returned by LDAP</title>
10549 <para>
10550 <indexterm role="concept">
10551 <primary>LDAP</primary>
10552 <secondary>returned data formats</secondary>
10553 </indexterm>
10554 The <command>ldapdn</command> lookup type returns the Distinguished Name from a single entry
10555 as a sequence of values, for example
10556 </para>
10557 <literallayout class="monospaced">
10558 cn=manager, o=University of Cambridge, c=UK
10559 </literallayout>
10560 <para>
10561 The <command>ldap</command> lookup type generates an error if more than one entry matches the
10562 search filter, whereas <command>ldapm</command> permits this case, and inserts a newline in
10563 the result between the data from different entries. It is possible for multiple
10564 values to be returned for both <command>ldap</command> and <command>ldapm</command>, but in the former case
10565 you know that whatever values are returned all came from a single entry in the
10566 directory.
10567 </para>
10568 <para>
10569 In the common case where you specify a single attribute in your LDAP query, the
10570 result is not quoted, and does not contain the attribute name. If the attribute
10571 has multiple values, they are separated by commas.
10572 </para>
10573 <para>
10574 If you specify multiple attributes, the result contains space-separated, quoted
10575 strings, each preceded by the attribute name and an equals sign. Within the
10576 quotes, the quote character, backslash, and newline are escaped with
10577 backslashes, and commas are used to separate multiple values for the attribute.
10578 Apart from the escaping, the string within quotes takes the same form as the
10579 output when a single attribute is requested. Specifying no attributes is the
10580 same as specifying all of an entry&#x2019;s attributes.
10581 </para>
10582 <para>
10583 Here are some examples of the output format. The first line of each pair is an
10584 LDAP query, and the second is the data that is returned. The attribute called
10585 <option>attr1</option> has two values, whereas <option>attr2</option> has only one value:
10586 </para>
10587 <literallayout class="monospaced">
10588 ldap:///o=base?attr1?sub?(uid=fred)
10589 value1.1, value1.2
10590
10591 ldap:///o=base?attr2?sub?(uid=fred)
10592 value two
10593
10594 ldap:///o=base?attr1,attr2?sub?(uid=fred)
10595 attr1="value1.1, value1.2" attr2="value two"
10596
10597 ldap:///o=base??sub?(uid=fred)
10598 objectClass="top" attr1="value1.1, value1.2" attr2="value two"
10599 </literallayout>
10600 <para>
10601 The <option>extract</option> operator in string expansions can be used to pick out
10602 individual fields from data that consists of <emphasis>key</emphasis>=<emphasis>value</emphasis> pairs. You can
10603 make use of Exim&#x2019;s <option>-be</option> option to run expansion tests and thereby check the
10604 results of LDAP lookups.
10605 </para>
10606 </section>
10607 <section id="SECTnisplus">
10608 <title>More about NIS+</title>
10609 <para>
10610 <indexterm role="concept">
10611 <primary>NIS+ lookup type</primary>
10612 </indexterm>
10613 <indexterm role="concept">
10614 <primary>lookup</primary>
10615 <secondary>NIS+</secondary>
10616 </indexterm>
10617 NIS+ queries consist of a NIS+ <emphasis>indexed name</emphasis> followed by an optional colon
10618 and field name. If this is given, the result of a successful query is the
10619 contents of the named field; otherwise the result consists of a concatenation
10620 of <emphasis>field-name=field-value</emphasis> pairs, separated by spaces. Empty values and
10621 values containing spaces are quoted. For example, the query
10622 </para>
10623 <literallayout class="monospaced">
10624 [name=mg1456],passwd.org_dir
10625 </literallayout>
10626 <para>
10627 might return the string
10628 </para>
10629 <literallayout class="monospaced">
10630 name=mg1456 passwd="" uid=999 gid=999 gcos="Martin Guerre"
10631 home=/home/mg1456 shell=/bin/bash shadow=""
10632 </literallayout>
10633 <para>
10634 (split over two lines here to fit on the page), whereas
10635 </para>
10636 <literallayout class="monospaced">
10637 [name=mg1456],passwd.org_dir:gcos
10638 </literallayout>
10639 <para>
10640 would just return
10641 </para>
10642 <literallayout class="monospaced">
10643 Martin Guerre
10644 </literallayout>
10645 <para>
10646 with no quotes. A NIS+ lookup fails if NIS+ returns more than one table entry
10647 for the given indexed key. The effect of the <option>quote_nisplus</option> expansion
10648 operator is to double any quote characters within the text.
10649 </para>
10650 </section>
10651 <section id="SECTsql">
10652 <title>SQL lookups</title>
10653 <para>
10654 <indexterm role="concept">
10655 <primary>SQL lookup types</primary>
10656 </indexterm>
10657 <indexterm role="concept">
10658 <primary>MySQL</primary>
10659 <secondary>lookup type</secondary>
10660 </indexterm>
10661 <indexterm role="concept">
10662 <primary>PostgreSQL lookup type</primary>
10663 </indexterm>
10664 <indexterm role="concept">
10665 <primary>lookup</primary>
10666 <secondary>MySQL</secondary>
10667 </indexterm>
10668 <indexterm role="concept">
10669 <primary>lookup</primary>
10670 <secondary>PostgreSQL</secondary>
10671 </indexterm>
10672 <indexterm role="concept">
10673 <primary>Oracle</primary>
10674 <secondary>lookup type</secondary>
10675 </indexterm>
10676 <indexterm role="concept">
10677 <primary>lookup</primary>
10678 <secondary>Oracle</secondary>
10679 </indexterm>
10680 <indexterm role="concept">
10681 <primary>InterBase lookup type</primary>
10682 </indexterm>
10683 <indexterm role="concept">
10684 <primary>lookup</primary>
10685 <secondary>InterBase</secondary>
10686 </indexterm>
10687 Exim can support lookups in InterBase, MySQL, Oracle, PostgreSQL, and SQLite
10688 databases. Queries for these databases contain SQL statements, so an example
10689 might be
10690 </para>
10691 <literallayout class="monospaced">
10692 ${lookup mysql{select mailbox from users where id='userx'}\
10693   {$value}fail}
10694 </literallayout>
10695 <para>
10696 If the result of the query contains more than one field, the data for each
10697 field in the row is returned, preceded by its name, so the result of
10698 </para>
10699 <literallayout class="monospaced">
10700 ${lookup pgsql{select home,name from users where id='userx'}\
10701   {$value}}
10702 </literallayout>
10703 <para>
10704 might be
10705 </para>
10706 <literallayout class="monospaced">
10707 home=/home/userx name="Mister X"
10708 </literallayout>
10709 <para>
10710 Empty values and values containing spaces are double quoted, with embedded
10711 quotes escaped by a backslash. If the result of the query contains just one
10712 field, the value is passed back verbatim, without a field name, for example:
10713 </para>
10714 <literallayout class="monospaced">
10715 Mister X
10716 </literallayout>
10717 <para>
10718 If the result of the query yields more than one row, it is all concatenated,
10719 with a newline between the data for each row.
10720 </para>
10721 </section>
10722 <section id="SECID72">
10723 <title>More about MySQL, PostgreSQL, Oracle, and InterBase</title>
10724 <para>
10725 <indexterm role="concept">
10726 <primary>MySQL</primary>
10727 <secondary>lookup type</secondary>
10728 </indexterm>
10729 <indexterm role="concept">
10730 <primary>PostgreSQL lookup type</primary>
10731 </indexterm>
10732 <indexterm role="concept">
10733 <primary>lookup</primary>
10734 <secondary>MySQL</secondary>
10735 </indexterm>
10736 <indexterm role="concept">
10737 <primary>lookup</primary>
10738 <secondary>PostgreSQL</secondary>
10739 </indexterm>
10740 <indexterm role="concept">
10741 <primary>Oracle</primary>
10742 <secondary>lookup type</secondary>
10743 </indexterm>
10744 <indexterm role="concept">
10745 <primary>lookup</primary>
10746 <secondary>Oracle</secondary>
10747 </indexterm>
10748 <indexterm role="concept">
10749 <primary>InterBase lookup type</primary>
10750 </indexterm>
10751 <indexterm role="concept">
10752 <primary>lookup</primary>
10753 <secondary>InterBase</secondary>
10754 </indexterm>
10755 If any MySQL, PostgreSQL, Oracle, or InterBase lookups are used, the
10756 <option>mysql_servers</option>, <option>pgsql_servers</option>, <option>oracle_servers</option>, or <option>ibase_servers</option>
10757 option (as appropriate) must be set to a colon-separated list of server
10758 information.
10759 (For MySQL and PostgreSQL only, the global option need not be set if all
10760 queries contain their own server information &ndash; see section
10761 <xref linkend="SECTspeserque"/>.) Each item in the list is a slash-separated list of four
10762 items: host name, database name, user name, and password. In the case of
10763 Oracle, the host name field is used for the <quote>service name</quote>, and the database
10764 name field is not used and should be empty. For example:
10765 </para>
10766 <literallayout class="monospaced">
10767 hide oracle_servers = oracle.plc.example//userx/abcdwxyz
10768 </literallayout>
10769 <para>
10770 Because password data is sensitive, you should always precede the setting with
10771 <quote>hide</quote>, to prevent non-admin users from obtaining the setting via the <option>-bP</option>
10772 option. Here is an example where two MySQL servers are listed:
10773 </para>
10774 <literallayout class="monospaced">
10775 hide mysql_servers = localhost/users/root/secret:\
10776                      otherhost/users/root/othersecret
10777 </literallayout>
10778 <para>
10779 For MySQL and PostgreSQL, a host may be specified as &lt;<emphasis>name</emphasis>&gt;:&lt;<emphasis>port</emphasis>&gt; but
10780 because this is a colon-separated list, the colon has to be doubled. For each
10781 query, these parameter groups are tried in order until a connection is made and
10782 a query is successfully processed. The result of a query may be that no data is
10783 found, but that is still a successful query. In other words, the list of
10784 servers provides a backup facility, not a list of different places to look.
10785 </para>
10786 <para>
10787 The <option>quote_mysql</option>, <option>quote_pgsql</option>, and <option>quote_oracle</option> expansion operators
10788 convert newline, tab, carriage return, and backspace to \n, \t, \r, and \b
10789 respectively, and the characters single-quote, double-quote, and backslash
10790 itself are escaped with backslashes. The <option>quote_pgsql</option> expansion operator, in
10791 addition, escapes the percent and underscore characters. This cannot be done
10792 for MySQL because these escapes are not recognized in contexts where these
10793 characters are not special.
10794 </para>
10795 </section>
10796 <section id="SECTspeserque">
10797 <title>Specifying the server in the query</title>
10798 <para>
10799 For MySQL and PostgreSQL lookups (but not currently for Oracle and InterBase),
10800 it is possible to specify a list of servers with an individual query. This is
10801 done by starting the query with
10802 </para>
10803 <literallayout>
10804 <literal>servers=</literal><emphasis>server1:server2:server3:...</emphasis><literal>;</literal>
10805 </literallayout>
10806 <para>
10807 Each item in the list may take one of two forms:
10808 </para>
10809 <orderedlist numeration="arabic">
10810 <listitem>
10811 <para>
10812 If it contains no slashes it is assumed to be just a host name. The appropriate
10813 global option (<option>mysql_servers</option> or <option>pgsql_servers</option>) is searched for a host
10814 of the same name, and the remaining parameters (database, user, password) are
10815 taken from there.
10816 </para>
10817 </listitem>
10818 <listitem>
10819 <para>
10820 If it contains any slashes, it is taken as a complete parameter set.
10821 </para>
10822 </listitem>
10823 </orderedlist>
10824 <para>
10825 The list of servers is used in exactly the same way as the global list.
10826 Once a connection to a server has happened and a query has been
10827 successfully executed, processing of the lookup ceases.
10828 </para>
10829 <para>
10830 This feature is intended for use in master/slave situations where updates
10831 are occurring and you want to update the master rather than a slave. If the
10832 master is in the list as a backup for reading, you might have a global setting
10833 like this:
10834 </para>
10835 <literallayout class="monospaced">
10836 mysql_servers = slave1/db/name/pw:\
10837                 slave2/db/name/pw:\
10838                 master/db/name/pw
10839 </literallayout>
10840 <para>
10841 In an updating lookup, you could then write:
10842 </para>
10843 <literallayout class="monospaced">
10844 ${lookup mysql{servers=master; UPDATE ...} }
10845 </literallayout>
10846 <para>
10847 That query would then be sent only to the master server. If, on the other hand,
10848 the master is not to be used for reading, and so is not present in the global
10849 option, you can still update it by a query of this form:
10850 </para>
10851 <literallayout class="monospaced">
10852 ${lookup pgsql{servers=master/db/name/pw; UPDATE ...} }
10853 </literallayout>
10854 </section>
10855 <section id="SECID73">
10856 <title>Special MySQL features</title>
10857 <para>
10858 For MySQL, an empty host name or the use of <quote>localhost</quote> in <option>mysql_servers</option>
10859 causes a connection to the server on the local host by means of a Unix domain
10860 socket. An alternate socket can be specified in parentheses. The full syntax of
10861 each item in <option>mysql_servers</option> is:
10862 </para>
10863 <literallayout>
10864 &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;
10865 </literallayout>
10866 <para>
10867 Any of the three sub-parts of the first field can be omitted. For normal use on
10868 the local host it can be left blank or set to just <quote>localhost</quote>.
10869 </para>
10870 <para>
10871 No database need be supplied &ndash; but if it is absent here, it must be given in
10872 the queries.
10873 </para>
10874 <para>
10875 If a MySQL query is issued that does not request any data (an insert, update,
10876 or delete command), the result of the lookup is the number of rows affected.
10877 </para>
10878 <para>
10879 <emphasis role="bold">Warning</emphasis>: This can be misleading. If an update does not actually change
10880 anything (for example, setting a field to the value it already has), the result
10881 is zero because no rows are affected.
10882 </para>
10883 </section>
10884 <section id="SECID74">
10885 <title>Special PostgreSQL features</title>
10886 <para>
10887 PostgreSQL lookups can also use Unix domain socket connections to the database.
10888 This is usually faster and costs less CPU time than a TCP/IP connection.
10889 However it can be used only if the mail server runs on the same machine as the
10890 database server. A configuration line for PostgreSQL via Unix domain sockets
10891 looks like this:
10892 </para>
10893 <literallayout class="monospaced">
10894 hide pgsql_servers = (/tmp/.s.PGSQL.5432)/db/user/password : ...
10895 </literallayout>
10896 <para>
10897 In other words, instead of supplying a host name, a path to the socket is
10898 given. The path name is enclosed in parentheses so that its slashes aren&#x2019;t
10899 visually confused with the delimiters for the other server parameters.
10900 </para>
10901 <para>
10902 If a PostgreSQL query is issued that does not request any data (an insert,
10903 update, or delete command), the result of the lookup is the number of rows
10904 affected.
10905 </para>
10906 </section>
10907 <section id="SECTsqlite">
10908 <title>More about SQLite</title>
10909 <para>
10910 <indexterm role="concept">
10911 <primary>lookup</primary>
10912 <secondary>SQLite</secondary>
10913 </indexterm>
10914 <indexterm role="concept">
10915 <primary>sqlite lookup type</primary>
10916 </indexterm>
10917 SQLite is different to the other SQL lookups because a file name is required in
10918 addition to the SQL query. An SQLite database is a single file, and there is no
10919 daemon as in the other SQL databases. The interface to Exim requires the name
10920 of the file, as an absolute path, to be given at the start of the query. It is
10921 separated from the query by white space. This means that the path name cannot
10922 contain white space. Here is a lookup expansion example:
10923 </para>
10924 <literallayout class="monospaced">
10925 ${lookup sqlite {/some/thing/sqlitedb \
10926   select name from aliases where id='userx';}}
10927 </literallayout>
10928 <para>
10929 In a list, the syntax is similar. For example:
10930 </para>
10931 <literallayout class="monospaced">
10932 domainlist relay_domains = sqlite;/some/thing/sqlitedb \
10933    select * from relays where ip='$sender_host_address';
10934 </literallayout>
10935 <para>
10936 The only character affected by the <option>quote_sqlite</option> operator is a single
10937 quote, which it doubles.
10938 </para>
10939 <para>
10940 The SQLite library handles multiple simultaneous accesses to the database
10941 internally. Multiple readers are permitted, but only one process can
10942 update at once. Attempts to access the database while it is being updated
10943 are rejected after a timeout period, during which the SQLite library
10944 waits for the lock to be released. In Exim, the default timeout is set
10945 to 5 seconds, but it can be changed by means of the <option>sqlite_lock_timeout</option>
10946 option.
10947 <indexterm role="concept" startref="IIDfidalo1" class="endofrange"/>
10948 <indexterm role="concept" startref="IIDfidalo2" class="endofrange"/>
10949 </para>
10950 </section>
10951 </chapter>
10952
10953 <chapter id="CHAPdomhosaddlists">
10954 <title>Domain, host, address, and local part lists</title>
10955 <titleabbrev>Domain, host, and address lists</titleabbrev>
10956 <para>
10957 <indexterm role="concept" id="IIDdohoadli" class="startofrange">
10958 <primary>lists of domains; hosts; etc.</primary>
10959 </indexterm>
10960 A number of Exim configuration options contain lists of domains, hosts,
10961 email addresses, or local parts. For example, the <option>hold_domains</option> option
10962 contains a list of domains whose delivery is currently suspended. These lists
10963 are also used as data in ACL statements (see chapter <xref linkend="CHAPACL"/>), and as
10964 arguments to expansion conditions such as <option>match_domain</option>.
10965 </para>
10966 <para>
10967 Each item in one of these lists is a pattern to be matched against a domain,
10968 host, email address, or local part, respectively. In the sections below, the
10969 different types of pattern for each case are described, but first we cover some
10970 general facilities that apply to all four kinds of list.
10971 </para>
10972 <section id="SECID75">
10973 <title>Expansion of lists</title>
10974 <para>
10975 <indexterm role="concept">
10976 <primary>expansion</primary>
10977 <secondary>of lists</secondary>
10978 </indexterm>
10979 Each list is expanded as a single string before it is used. The result of
10980 expansion must be a list, possibly containing empty items, which is split up
10981 into separate items for matching. By default, colon is the separator character,
10982 but this can be varied if necessary. See sections <xref linkend="SECTlistconstruct"/> and
10983 <xref linkend="SECTempitelis"/> for details of the list syntax; the second of these
10984 discusses the way to specify empty list items.
10985 </para>
10986 <para>
10987 If the string expansion is forced to fail, Exim behaves as if the item it is
10988 testing (domain, host, address, or local part) is not in the list. Other
10989 expansion failures cause temporary errors.
10990 </para>
10991 <para>
10992 If an item in a list is a regular expression, backslashes, dollars and possibly
10993 other special characters in the expression must be protected against
10994 misinterpretation by the string expander. The easiest way to do this is to use
10995 the <literal>\N</literal> expansion feature to indicate that the contents of the regular
10996 expression should not be expanded. For example, in an ACL you might have:
10997 </para>
10998 <literallayout class="monospaced">
10999 deny senders = \N^\d{8}\w@.*\.baddomain\.example$\N : \
11000                ${lookup{$domain}lsearch{/badsenders/bydomain}}
11001 </literallayout>
11002 <para>
11003 The first item is a regular expression that is protected from expansion by
11004 <literal>\N</literal>, whereas the second uses the expansion to obtain a list of unwanted
11005 senders based on the receiving domain.
11006 </para>
11007 </section>
11008 <section id="SECID76">
11009 <title>Negated items in lists</title>
11010 <para>
11011 <indexterm role="concept">
11012 <primary>list</primary>
11013 <secondary>negation</secondary>
11014 </indexterm>
11015 <indexterm role="concept">
11016 <primary>negation</primary>
11017 <secondary>in lists</secondary>
11018 </indexterm>
11019 Items in a list may be positive or negative. Negative items are indicated by a
11020 leading exclamation mark, which may be followed by optional white space. A list
11021 defines a set of items (domains, etc). When Exim processes one of these lists,
11022 it is trying to find out whether a domain, host, address, or local part
11023 (respectively) is in the set that is defined by the list. It works like this:
11024 </para>
11025 <para>
11026 The list is scanned from left to right. If a positive item is matched, the
11027 subject that is being checked is in the set; if a negative item is matched, the
11028 subject is not in the set. If the end of the list is reached without the
11029 subject having matched any of the patterns, it is in the set if the last item
11030 was a negative one, but not if it was a positive one. For example, the list in
11031 </para>
11032 <literallayout class="monospaced">
11033 domainlist relay_domains = !a.b.c : *.b.c
11034 </literallayout>
11035 <para>
11036 matches any domain ending in <emphasis>.b.c</emphasis> except for <emphasis>a.b.c</emphasis>. Domains that match
11037 neither <emphasis>a.b.c</emphasis> nor <emphasis>*.b.c</emphasis> do not match, because the last item in the
11038 list is positive. However, if the setting were
11039 </para>
11040 <literallayout class="monospaced">
11041 domainlist relay_domains = !a.b.c
11042 </literallayout>
11043 <para>
11044 then all domains other than <emphasis>a.b.c</emphasis> would match because the last item in the
11045 list is negative. In other words, a list that ends with a negative item behaves
11046 as if it had an extra item <literal>:*</literal> on the end.
11047 </para>
11048 <para>
11049 Another way of thinking about positive and negative items in lists is to read
11050 the connector as <quote>or</quote> after a positive item and as <quote>and</quote> after a negative
11051 item.
11052 </para>
11053 </section>
11054 <section id="SECTfilnamlis">
11055 <title>File names in lists</title>
11056 <para>
11057 <indexterm role="concept">
11058 <primary>list</primary>
11059 <secondary>file name in</secondary>
11060 </indexterm>
11061 If an item in a domain, host, address, or local part list is an absolute file
11062 name (beginning with a slash character), each line of the file is read and
11063 processed as if it were an independent item in the list, except that further
11064 file names are not allowed,
11065 and no expansion of the data from the file takes place.
11066 Empty lines in the file are ignored, and the file may also contain comment
11067 lines:
11068 </para>
11069 <itemizedlist>
11070 <listitem>
11071 <para>
11072 For domain and host lists, if a # character appears anywhere in a line of the
11073 file, it and all following characters are ignored.
11074 </para>
11075 </listitem>
11076 <listitem>
11077 <para>
11078 Because local parts may legitimately contain # characters, a comment in an
11079 address list or local part list file is recognized only if # is preceded by
11080 white space or the start of the line. For example:
11081 </para>
11082 <literallayout class="monospaced">
11083 not#comment@x.y.z   # but this is a comment
11084 </literallayout>
11085 </listitem>
11086 </itemizedlist>
11087 <para>
11088 Putting a file name in a list has the same effect as inserting each line of the
11089 file as an item in the list (blank lines and comments excepted). However, there
11090 is one important difference: the file is read each time the list is processed,
11091 so if its contents vary over time, Exim&#x2019;s behaviour changes.
11092 </para>
11093 <para>
11094 If a file name is preceded by an exclamation mark, the sense of any match
11095 within the file is inverted. For example, if
11096 </para>
11097 <literallayout class="monospaced">
11098 hold_domains = !/etc/nohold-domains
11099 </literallayout>
11100 <para>
11101 and the file contains the lines
11102 </para>
11103 <literallayout class="monospaced">
11104 !a.b.c
11105 *.b.c
11106 </literallayout>
11107 <para>
11108 then <emphasis>a.b.c</emphasis> is in the set of domains defined by <option>hold_domains</option>, whereas
11109 any domain matching <literal>*.b.c</literal> is not.
11110 </para>
11111 </section>
11112 <section id="SECID77">
11113 <title>An lsearch file is not an out-of-line list</title>
11114 <para>
11115 As will be described in the sections that follow, lookups can be used in lists
11116 to provide indexed methods of checking list membership. There has been some
11117 confusion about the way <command>lsearch</command> lookups work in lists. Because
11118 an <command>lsearch</command> file contains plain text and is scanned sequentially, it is
11119 sometimes thought that it is allowed to contain wild cards and other kinds of
11120 non-constant pattern. This is not the case. The keys in an <command>lsearch</command> file are
11121 always fixed strings, just as for any other single-key lookup type.
11122 </para>
11123 <para>
11124 If you want to use a file to contain wild-card patterns that form part of a
11125 list, just give the file name on its own, without a search type, as described
11126 in the previous section. You could also use the <command>wildlsearch</command> or
11127 <command>nwildlsearch</command>, but there is no advantage in doing this.
11128 </para>
11129 </section>
11130 <section id="SECTnamedlists">
11131 <title>Named lists</title>
11132 <para>
11133 <indexterm role="concept">
11134 <primary>named lists</primary>
11135 </indexterm>
11136 <indexterm role="concept">
11137 <primary>list</primary>
11138 <secondary>named</secondary>
11139 </indexterm>
11140 A list of domains, hosts, email addresses, or local parts can be given a name
11141 which is then used to refer to the list elsewhere in the configuration. This is
11142 particularly convenient if the same list is required in several different
11143 places. It also allows lists to be given meaningful names, which can improve
11144 the readability of the configuration. For example, it is conventional to define
11145 a domain list called <emphasis>local_domains</emphasis> for all the domains that are handled
11146 locally on a host, using a configuration line such as
11147 </para>
11148 <literallayout class="monospaced">
11149 domainlist local_domains = localhost:my.dom.example
11150 </literallayout>
11151 <para>
11152 Named lists are referenced by giving their name preceded by a plus sign, so,
11153 for example, a router that is intended to handle local domains would be
11154 configured with the line
11155 </para>
11156 <literallayout class="monospaced">
11157 domains = +local_domains
11158 </literallayout>
11159 <para>
11160 The first router in a configuration is often one that handles all domains
11161 except the local ones, using a configuration with a negated item like this:
11162 </para>
11163 <literallayout class="monospaced">
11164 dnslookup:
11165   driver = dnslookup
11166   domains = ! +local_domains
11167   transport = remote_smtp
11168   no_more
11169 </literallayout>
11170 <para>
11171 The four kinds of named list are created by configuration lines starting with
11172 the words <option>domainlist</option>, <option>hostlist</option>, <option>addresslist</option>, or <option>localpartlist</option>,
11173 respectively. Then there follows the name that you are defining, followed by an
11174 equals sign and the list itself. For example:
11175 </para>
11176 <literallayout class="monospaced">
11177 hostlist    relay_hosts = 192.168.23.0/24 : my.friend.example
11178 addresslist bad_senders = cdb;/etc/badsenders
11179 </literallayout>
11180 <para>
11181 A named list may refer to other named lists:
11182 </para>
11183 <literallayout class="monospaced">
11184 domainlist  dom1 = first.example : second.example
11185 domainlist  dom2 = +dom1 : third.example
11186 domainlist  dom3 = fourth.example : +dom2 : fifth.example
11187 </literallayout>
11188 <para>
11189 <emphasis role="bold">Warning</emphasis>: If the last item in a referenced list is a negative one, the
11190 effect may not be what you intended, because the negation does not propagate
11191 out to the higher level. For example, consider:
11192 </para>
11193 <literallayout class="monospaced">
11194 domainlist  dom1 = !a.b
11195 domainlist  dom2 = +dom1 : *.b
11196 </literallayout>
11197 <para>
11198 The second list specifies <quote>either in the <option>dom1</option> list or <emphasis>*.b</emphasis></quote>. The first
11199 list specifies just <quote>not <emphasis>a.b</emphasis></quote>, so the domain <emphasis>x.y</emphasis> matches it. That
11200 means it matches the second list as well. The effect is not the same as
11201 </para>
11202 <literallayout class="monospaced">
11203 domainlist  dom2 = !a.b : *.b
11204 </literallayout>
11205 <para>
11206 where <emphasis>x.y</emphasis> does not match. It&#x2019;s best to avoid negation altogether in
11207 referenced lists if you can.
11208 </para>
11209 <para>
11210 Named lists may have a performance advantage. When Exim is routing an
11211 address or checking an incoming message, it caches the result of tests on named
11212 lists. So, if you have a setting such as
11213 </para>
11214 <literallayout class="monospaced">
11215 domains = +local_domains
11216 </literallayout>
11217 <para>
11218 on several of your routers
11219 or in several ACL statements,
11220 the actual test is done only for the first one. However, the caching works only
11221 if there are no expansions within the list itself or any sublists that it
11222 references. In other words, caching happens only for lists that are known to be
11223 the same each time they are referenced.
11224 </para>
11225 <para>
11226 By default, there may be up to 16 named lists of each type. This limit can be
11227 extended by changing a compile-time variable. The use of domain and host lists
11228 is recommended for concepts such as local domains, relay domains, and relay
11229 hosts. The default configuration is set up like this.
11230 </para>
11231 </section>
11232 <section id="SECID78">
11233 <title>Named lists compared with macros</title>
11234 <para>
11235 <indexterm role="concept">
11236 <primary>list</primary>
11237 <secondary>named compared with macro</secondary>
11238 </indexterm>
11239 <indexterm role="concept">
11240 <primary>macro</primary>
11241 <secondary>compared with named list</secondary>
11242 </indexterm>
11243 At first sight, named lists might seem to be no different from macros in the
11244 configuration file. However, macros are just textual substitutions. If you
11245 write
11246 </para>
11247 <literallayout class="monospaced">
11248 ALIST = host1 : host2
11249 auth_advertise_hosts = !ALIST
11250 </literallayout>
11251 <para>
11252 it probably won&#x2019;t do what you want, because that is exactly the same as
11253 </para>
11254 <literallayout class="monospaced">
11255 auth_advertise_hosts = !host1 : host2
11256 </literallayout>
11257 <para>
11258 Notice that the second host name is not negated. However, if you use a host
11259 list, and write
11260 </para>
11261 <literallayout class="monospaced">
11262 hostlist alist = host1 : host2
11263 auth_advertise_hosts = ! +alist
11264 </literallayout>
11265 <para>
11266 the negation applies to the whole list, and so that is equivalent to
11267 </para>
11268 <literallayout class="monospaced">
11269 auth_advertise_hosts = !host1 : !host2
11270 </literallayout>
11271 </section>
11272 <section id="SECID79">
11273 <title>Named list caching</title>
11274 <para>
11275 <indexterm role="concept">
11276 <primary>list</primary>
11277 <secondary>caching of named</secondary>
11278 </indexterm>
11279 <indexterm role="concept">
11280 <primary>caching</primary>
11281 <secondary>named lists</secondary>
11282 </indexterm>
11283 While processing a message, Exim caches the result of checking a named list if
11284 it is sure that the list is the same each time. In practice, this means that
11285 the cache operates only if the list contains no $ characters, which guarantees
11286 that it will not change when it is expanded. Sometimes, however, you may have
11287 an expanded list that you know will be the same each time within a given
11288 message. For example:
11289 </para>
11290 <literallayout class="monospaced">
11291 domainlist special_domains = \
11292            ${lookup{$sender_host_address}cdb{/some/file}}
11293 </literallayout>
11294 <para>
11295 This provides a list of domains that depends only on the sending host&#x2019;s IP
11296 address. If this domain list is referenced a number of times (for example,
11297 in several ACL lines, or in several routers) the result of the check is not
11298 cached by default, because Exim does not know that it is going to be the
11299 same list each time.
11300 </para>
11301 <para>
11302 By appending <literal>_cache</literal> to <literal>domainlist</literal> you can tell Exim to go ahead and
11303 cache the result anyway. For example:
11304 </para>
11305 <literallayout class="monospaced">
11306 domainlist_cache special_domains = ${lookup{...
11307 </literallayout>
11308 <para>
11309 If you do this, you should be absolutely sure that caching is going to do
11310 the right thing in all cases. When in doubt, leave it out.
11311 </para>
11312 </section>
11313 <section id="SECTdomainlist">
11314 <title>Domain lists</title>
11315 <para>
11316 <indexterm role="concept">
11317 <primary>domain list</primary>
11318 <secondary>patterns for</secondary>
11319 </indexterm>
11320 <indexterm role="concept">
11321 <primary>list</primary>
11322 <secondary>domain list</secondary>
11323 </indexterm>
11324 Domain lists contain patterns that are to be matched against a mail domain.
11325 The following types of item may appear in domain lists:
11326 </para>
11327 <itemizedlist>
11328 <listitem>
11329 <para>
11330 <indexterm role="concept">
11331 <primary>primary host name</primary>
11332 </indexterm>
11333 <indexterm role="concept">
11334 <primary>host name</primary>
11335 <secondary>matched in domain list</secondary>
11336 </indexterm>
11337 <indexterm role="option">
11338 <primary><option>primary_hostname</option></primary>
11339 </indexterm>
11340 <indexterm role="concept">
11341 <primary>domain list</primary>
11342 <secondary>matching primary host name</secondary>
11343 </indexterm>
11344 <indexterm role="concept">
11345 <primary>@ in a domain list</primary>
11346 </indexterm>
11347 If a pattern consists of a single @ character, it matches the local host name,
11348 as set by the <option>primary_hostname</option> option (or defaulted). This makes it
11349 possible to use the same configuration file on several different hosts that
11350 differ only in their names.
11351 </para>
11352 </listitem>
11353 <listitem>
11354 <para>
11355 <indexterm role="concept">
11356 <primary>@[] in a domain list</primary>
11357 </indexterm>
11358 <indexterm role="concept">
11359 <primary>domain list</primary>
11360 <secondary>matching local IP interfaces</secondary>
11361 </indexterm>
11362 <indexterm role="concept">
11363 <primary>domain literal</primary>
11364 </indexterm>
11365 If a pattern consists of the string <literal>@[]</literal> it matches an IP address enclosed
11366 in square brackets (as in an email address that contains a domain literal), but
11367 only if that IP address is recognized as local for email routing purposes. The
11368 <option>local_interfaces</option> and <option>extra_local_interfaces</option> options can be used to
11369 control which of a host&#x2019;s several IP addresses are treated as local.
11370 In today&#x2019;s Internet, the use of domain literals is controversial.
11371 </para>
11372 </listitem>
11373 <listitem>
11374 <para>
11375 <indexterm role="concept">
11376 <primary>@mx_any</primary>
11377 </indexterm>
11378 <indexterm role="concept">
11379 <primary>@mx_primary</primary>
11380 </indexterm>
11381 <indexterm role="concept">
11382 <primary>@mx_secondary</primary>
11383 </indexterm>
11384 <indexterm role="concept">
11385 <primary>domain list</primary>
11386 <secondary>matching MX pointers to local host</secondary>
11387 </indexterm>
11388 If a pattern consists of the string <literal>@mx_any</literal> it matches any domain that
11389 has an MX record pointing to the local host or to any host that is listed in
11390 <indexterm role="option">
11391 <primary><option>hosts_treat_as_local</option></primary>
11392 </indexterm>
11393 <option>hosts_treat_as_local</option>. The items <literal>@mx_primary</literal> and <literal>@mx_secondary</literal>
11394 are similar, except that the first matches only when a primary MX target is the
11395 local host, and the second only when no primary MX target is the local host,
11396 but a secondary MX target is. <quote>Primary</quote> means an MX record with the lowest
11397 preference value &ndash; there may of course be more than one of them.
11398 </para>
11399 <para>
11400 The MX lookup that takes place when matching a pattern of this type is
11401 performed with the resolver options for widening names turned off. Thus, for
11402 example, a single-component domain will <emphasis>not</emphasis> be expanded by adding the
11403 resolver&#x2019;s default domain. See the <option>qualify_single</option> and <option>search_parents</option>
11404 options of the <command>dnslookup</command> router for a discussion of domain widening.
11405 </para>
11406 <para>
11407 Sometimes you may want to ignore certain IP addresses when using one of these
11408 patterns. You can specify this by following the pattern with <literal>/ignore=</literal>&lt;<emphasis>ip
11409 list</emphasis>&gt;, where &lt;<emphasis>ip list</emphasis>&gt; is a list of IP addresses. These addresses are
11410 ignored when processing the pattern (compare the <option>ignore_target_hosts</option> option
11411 on a router). For example:
11412 </para>
11413 <literallayout class="monospaced">
11414 domains = @mx_any/ignore=127.0.0.1
11415 </literallayout>
11416 <para>
11417 This example matches any domain that has an MX record pointing to one of
11418 the local host&#x2019;s IP addresses other than 127.0.0.1.
11419 </para>
11420 <para>
11421 The list of IP addresses is in fact processed by the same code that processes
11422 host lists, so it may contain CIDR-coded network specifications and it may also
11423 contain negative items.
11424 </para>
11425 <para>
11426 Because the list of IP addresses is a sublist within a domain list, you have to
11427 be careful about delimiters if there is more than one address. Like any other
11428 list, the default delimiter can be changed. Thus, you might have:
11429 </para>
11430 <literallayout class="monospaced">
11431 domains = @mx_any/ignore=&lt;;127.0.0.1;0.0.0.0 : \
11432           an.other.domain : ...
11433 </literallayout>
11434 <para>
11435 so that the sublist uses semicolons for delimiters. When IPv6 addresses are
11436 involved, it is easiest to change the delimiter for the main list as well:
11437 </para>
11438 <literallayout class="monospaced">
11439 domains = &lt;? @mx_any/ignore=&lt;;127.0.0.1;::1 ? \
11440           an.other.domain ? ...
11441 </literallayout>
11442 </listitem>
11443 <listitem>
11444 <para>
11445 <indexterm role="concept">
11446 <primary>asterisk</primary>
11447 <secondary>in domain list</secondary>
11448 </indexterm>
11449 <indexterm role="concept">
11450 <primary>domain list</primary>
11451 <secondary>asterisk in</secondary>
11452 </indexterm>
11453 <indexterm role="concept">
11454 <primary>domain list</primary>
11455 <secondary>matching <quote>ends with</quote></secondary>
11456 </indexterm>
11457 If a pattern starts with an asterisk, the remaining characters of the pattern
11458 are compared with the terminating characters of the domain. The use of <quote>*</quote> in
11459 domain lists differs from its use in partial matching lookups. In a domain
11460 list, the character following the asterisk need not be a dot, whereas partial
11461 matching works only in terms of dot-separated components. For example, a domain
11462 list item such as <literal>*key.ex</literal> matches <emphasis>donkey.ex</emphasis> as well as
11463 <emphasis>cipher.key.ex</emphasis>.
11464 </para>
11465 </listitem>
11466 <listitem>
11467 <para>
11468 <indexterm role="concept">
11469 <primary>regular expressions</primary>
11470 <secondary>in domain list</secondary>
11471 </indexterm>
11472 <indexterm role="concept">
11473 <primary>domain list</primary>
11474 <secondary>matching regular expression</secondary>
11475 </indexterm>
11476 If a pattern starts with a circumflex character, it is treated as a regular
11477 expression, and matched against the domain using a regular expression matching
11478 function. The circumflex is treated as part of the regular expression.
11479 Email domains are case-independent, so this regular expression match is by
11480 default case-independent, but you can make it case-dependent by starting it
11481 with <literal>(?-i)</literal>. References to descriptions of the syntax of regular expressions
11482 are given in chapter <xref linkend="CHAPregexp"/>.
11483 </para>
11484 <para>
11485 <emphasis role="bold">Warning</emphasis>: Because domain lists are expanded before being processed, you
11486 must escape any backslash and dollar characters in the regular expression, or
11487 use the special <literal>\N</literal> sequence (see chapter <xref linkend="CHAPexpand"/>) to specify that
11488 it is not to be expanded (unless you really do want to build a regular
11489 expression by expansion, of course).
11490 </para>
11491 </listitem>
11492 <listitem>
11493 <para>
11494 <indexterm role="concept">
11495 <primary>lookup</primary>
11496 <secondary>in domain list</secondary>
11497 </indexterm>
11498 <indexterm role="concept">
11499 <primary>domain list</primary>
11500 <secondary>matching by lookup</secondary>
11501 </indexterm>
11502 If a pattern starts with the name of a single-key lookup type followed by a
11503 semicolon (for example, <quote>dbm;</quote> or <quote>lsearch;</quote>), the remainder of the pattern
11504 must be a file name in a suitable format for the lookup type. For example, for
11505 <quote>cdb;</quote> it must be an absolute path:
11506 </para>
11507 <literallayout class="monospaced">
11508 domains = cdb;/etc/mail/local_domains.cdb
11509 </literallayout>
11510 <para>
11511 The appropriate type of lookup is done on the file using the domain name as the
11512 key. In most cases, the data that is looked up is not used; Exim is interested
11513 only in whether or not the key is present in the file. However, when a lookup
11514 is used for the <option>domains</option> option on a router
11515 or a <option>domains</option> condition in an ACL statement, the data is preserved in the
11516 <varname>$domain_data</varname> variable and can be referred to in other router options or
11517 other statements in the same ACL.
11518 </para>
11519 </listitem>
11520 <listitem>
11521 <para>
11522 Any of the single-key lookup type names may be preceded by
11523 <literal>partial</literal>&lt;<emphasis>n</emphasis>&gt;<literal>-</literal>, where the &lt;<emphasis>n</emphasis>&gt; is optional, for example,
11524 </para>
11525 <literallayout class="monospaced">
11526 domains = partial-dbm;/partial/domains
11527 </literallayout>
11528 <para>
11529 This causes partial matching logic to be invoked; a description of how this
11530 works is given in section <xref linkend="SECTpartiallookup"/>.
11531 </para>
11532 </listitem>
11533 <listitem>
11534 <para>
11535 <indexterm role="concept">
11536 <primary>asterisk</primary>
11537 <secondary>in lookup type</secondary>
11538 </indexterm>
11539 Any of the single-key lookup types may be followed by an asterisk. This causes
11540 a default lookup for a key consisting of a single asterisk to be done if the
11541 original lookup fails. This is not a useful feature when using a domain list to
11542 select particular domains (because any domain would match), but it might have
11543 value if the result of the lookup is being used via the <varname>$domain_data</varname>
11544 expansion variable.
11545 </para>
11546 </listitem>
11547 <listitem>
11548 <para>
11549 If the pattern starts with the name of a query-style lookup type followed by a
11550 semicolon (for example, <quote>nisplus;</quote> or <quote>ldap;</quote>), the remainder of the
11551 pattern must be an appropriate query for the lookup type, as described in
11552 chapter <xref linkend="CHAPfdlookup"/>. For example:
11553 </para>
11554 <literallayout class="monospaced">
11555 hold_domains = mysql;select domain from holdlist \
11556   where domain = '$domain';
11557 </literallayout>
11558 <para>
11559 In most cases, the data that is looked up is not used (so for an SQL query, for
11560 example, it doesn&#x2019;t matter what field you select). Exim is interested only in
11561 whether or not the query succeeds. However, when a lookup is used for the
11562 <option>domains</option> option on a router, the data is preserved in the <varname>$domain_data</varname>
11563 variable and can be referred to in other options.
11564 </para>
11565 </listitem>
11566 <listitem>
11567 <para>
11568 <indexterm role="concept">
11569 <primary>domain list</primary>
11570 <secondary>matching literal domain name</secondary>
11571 </indexterm>
11572 If none of the above cases apply, a caseless textual comparison is made
11573 between the pattern and the domain.
11574 </para>
11575 </listitem>
11576 </itemizedlist>
11577 <para>
11578 Here is an example that uses several different kinds of pattern:
11579 </para>
11580 <literallayout class="monospaced">
11581 domainlist funny_domains = \
11582   @ : \
11583   lib.unseen.edu : \
11584   *.foundation.fict.example : \
11585   \N^[1-2]\d{3}\.fict\.example$\N : \
11586   partial-dbm;/opt/data/penguin/book : \
11587   nis;domains.byname : \
11588   nisplus;[name=$domain,status=local],domains.org_dir
11589 </literallayout>
11590 <para>
11591 There are obvious processing trade-offs among the various matching modes. Using
11592 an asterisk is faster than a regular expression, and listing a few names
11593 explicitly probably is too. The use of a file or database lookup is expensive,
11594 but may be the only option if hundreds of names are required. Because the
11595 patterns are tested in order, it makes sense to put the most commonly matched
11596 patterns earlier.
11597 </para>
11598 </section>
11599 <section id="SECThostlist">
11600 <title>Host lists</title>
11601 <para>
11602 <indexterm role="concept">
11603 <primary>host list</primary>
11604 <secondary>patterns in</secondary>
11605 </indexterm>
11606 <indexterm role="concept">
11607 <primary>list</primary>
11608 <secondary>host list</secondary>
11609 </indexterm>
11610 Host lists are used to control what remote hosts are allowed to do. For
11611 example, some hosts may be allowed to use the local host as a relay, and some
11612 may be permitted to use the SMTP ETRN command. Hosts can be identified in
11613 two different ways, by name or by IP address. In a host list, some types of
11614 pattern are matched to a host name, and some are matched to an IP address.
11615 You need to be particularly careful with this when single-key lookups are
11616 involved, to ensure that the right value is being used as the key.
11617 </para>
11618 </section>
11619 <section id="SECID80">
11620 <title>Special host list patterns</title>
11621 <para>
11622 <indexterm role="concept">
11623 <primary>empty item in hosts list</primary>
11624 </indexterm>
11625 <indexterm role="concept">
11626 <primary>host list</primary>
11627 <secondary>empty string in</secondary>
11628 </indexterm>
11629 If a host list item is the empty string, it matches only when no remote host is
11630 involved. This is the case when a message is being received from a local
11631 process using SMTP on the standard input, that is, when a TCP/IP connection is
11632 not used.
11633 </para>
11634 <para>
11635 <indexterm role="concept">
11636 <primary>asterisk</primary>
11637 <secondary>in host list</secondary>
11638 </indexterm>
11639 The special pattern <quote>*</quote> in a host list matches any host or no host. Neither
11640 the IP address nor the name is actually inspected.
11641 </para>
11642 </section>
11643 <section id="SECThoslispatip">
11644 <title>Host list patterns that match by IP address</title>
11645 <para>
11646 <indexterm role="concept">
11647 <primary>host list</primary>
11648 <secondary>matching IP addresses</secondary>
11649 </indexterm>
11650 If an IPv4 host calls an IPv6 host and the call is accepted on an IPv6 socket,
11651 the incoming address actually appears in the IPv6 host as
11652 <literal>::ffff:</literal>&lt;<emphasis>v4address</emphasis>&gt;. When such an address is tested against a host
11653 list, it is converted into a traditional IPv4 address first. (Not all operating
11654 systems accept IPv4 calls on IPv6 sockets, as there have been some security
11655 concerns.)
11656 </para>
11657 <para>
11658 The following types of pattern in a host list check the remote host by
11659 inspecting its IP address:
11660 </para>
11661 <itemizedlist>
11662 <listitem>
11663 <para>
11664 If the pattern is a plain domain name (not a regular expression, not starting
11665 with *, not a lookup of any kind), Exim calls the operating system function
11666 to find the associated IP address(es). Exim uses the newer
11667 <function>getipnodebyname()</function> function when available, otherwise <function>gethostbyname()</function>.
11668 This typically causes a forward DNS lookup of the name. The result is compared
11669 with the IP address of the subject host.
11670 </para>
11671 <para>
11672 If there is a temporary problem (such as a DNS timeout) with the host name
11673 lookup, a temporary error occurs. For example, if the list is being used in an
11674 ACL condition, the ACL gives a <quote>defer</quote> response, usually leading to a
11675 temporary SMTP error code. If no IP address can be found for the host name,
11676 what happens is described in section <xref linkend="SECTbehipnot"/> below.
11677 </para>
11678 </listitem>
11679 <listitem>
11680 <para>
11681 <indexterm role="concept">
11682 <primary>@ in a host list</primary>
11683 </indexterm>
11684 If the pattern is <quote>@</quote>, the primary host name is substituted and used as a
11685 domain name, as just described.
11686 </para>
11687 </listitem>
11688 <listitem>
11689 <para>
11690 If the pattern is an IP address, it is matched against the IP address of the
11691 subject host. IPv4 addresses are given in the normal <quote>dotted-quad</quote> notation.
11692 IPv6 addresses can be given in colon-separated format, but the colons have to
11693 be doubled so as not to be taken as item separators when the default list
11694 separator is used. IPv6 addresses are recognized even when Exim is compiled
11695 without IPv6 support. This means that if they appear in a host list on an
11696 IPv4-only host, Exim will not treat them as host names. They are just addresses
11697 that can never match a client host.
11698 </para>
11699 </listitem>
11700 <listitem>
11701 <para>
11702 <indexterm role="concept">
11703 <primary>@[] in a host list</primary>
11704 </indexterm>
11705 If the pattern is <quote>@[]</quote>, it matches the IP address of any IP interface on
11706 the local host. For example, if the local host is an IPv4 host with one
11707 interface address 10.45.23.56, these two ACL statements have the same effect:
11708 </para>
11709 <literallayout class="monospaced">
11710 accept hosts = 127.0.0.1 : 10.45.23.56
11711 accept hosts = @[]
11712 </literallayout>
11713 </listitem>
11714 <listitem>
11715 <para>
11716 <indexterm role="concept">
11717 <primary>CIDR notation</primary>
11718 </indexterm>
11719 If the pattern is an IP address followed by a slash and a mask length (for
11720 example 10.11.42.0/24), it is matched against the IP address of the subject
11721 host under the given mask. This allows, an entire network of hosts to be
11722 included (or excluded) by a single item. The mask uses CIDR notation; it
11723 specifies the number of address bits that must match, starting from the most
11724 significant end of the address.
11725 </para>
11726 <para>
11727 <emphasis role="bold">Note</emphasis>: The mask is <emphasis>not</emphasis> a count of addresses, nor is it the high number
11728 of a range of addresses. It is the number of bits in the network portion of the
11729 address. The above example specifies a 24-bit netmask, so it matches all 256
11730 addresses in the 10.11.42.0 network. An item such as
11731 </para>
11732 <literallayout class="monospaced">
11733 192.168.23.236/31
11734 </literallayout>
11735 <para>
11736 matches just two addresses, 192.168.23.236 and 192.168.23.237. A mask value of
11737 32 for an IPv4 address is the same as no mask at all; just a single address
11738 matches.
11739 </para>
11740 <para>
11741 Here is another example which shows an IPv4 and an IPv6 network:
11742 </para>
11743 <literallayout class="monospaced">
11744 recipient_unqualified_hosts = 192.168.0.0/16: \
11745                               3ffe::ffff::836f::::/48
11746 </literallayout>
11747 <para>
11748 The doubling of list separator characters applies only when these items
11749 appear inline in a host list. It is not required when indirecting via a file.
11750 For example:
11751 </para>
11752 <literallayout class="monospaced">
11753 recipient_unqualified_hosts = /opt/exim/unqualnets
11754 </literallayout>
11755 <para>
11756 could make use of a file containing
11757 </para>
11758 <literallayout class="monospaced">
11759 172.16.0.0/12
11760 3ffe:ffff:836f::/48
11761 </literallayout>
11762 <para>
11763 to have exactly the same effect as the previous example. When listing IPv6
11764 addresses inline, it is usually more convenient to use the facility for
11765 changing separator characters. This list contains the same two networks:
11766 </para>
11767 <literallayout class="monospaced">
11768 recipient_unqualified_hosts = &lt;; 172.16.0.0/12; \
11769                                  3ffe:ffff:836f::/48
11770 </literallayout>
11771 <para>
11772 The separator is changed to semicolon by the leading <quote>&lt;;</quote> at the start of the
11773 list.
11774 </para>
11775 </listitem>
11776 </itemizedlist>
11777 </section>
11778 <section id="SECThoslispatsikey">
11779 <title>Host list patterns for single-key lookups by host address</title>
11780 <para>
11781 <indexterm role="concept">
11782 <primary>host list</primary>
11783 <secondary>lookup of IP address</secondary>
11784 </indexterm>
11785 When a host is to be identified by a single-key lookup of its complete IP
11786 address, the pattern takes this form:
11787 </para>
11788 <literallayout>
11789 <literal>net-&lt;</literal><emphasis>single-key-search-type</emphasis><literal>&gt;;&lt;</literal><emphasis>search-data</emphasis><literal>&gt;</literal>
11790 </literallayout>
11791 <para>
11792 For example:
11793 </para>
11794 <literallayout class="monospaced">
11795 hosts_lookup = net-cdb;/hosts-by-ip.db
11796 </literallayout>
11797 <para>
11798 The text form of the IP address of the subject host is used as the lookup key.
11799 IPv6 addresses are converted to an unabbreviated form, using lower case
11800 letters, with dots as separators because colon is the key terminator in
11801 <command>lsearch</command> files. [Colons can in fact be used in keys in <command>lsearch</command> files by
11802 quoting the keys, but this is a facility that was added later.] The data
11803 returned by the lookup is not used.
11804 </para>
11805 <para>
11806 <indexterm role="concept">
11807 <primary>IP address</primary>
11808 <secondary>masking</secondary>
11809 </indexterm>
11810 <indexterm role="concept">
11811 <primary>host list</primary>
11812 <secondary>masked IP address</secondary>
11813 </indexterm>
11814 Single-key lookups can also be performed using masked IP addresses, using
11815 patterns of this form:
11816 </para>
11817 <literallayout>
11818 <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>
11819 </literallayout>
11820 <para>
11821 For example:
11822 </para>
11823 <literallayout class="monospaced">
11824 net24-dbm;/networks.db
11825 </literallayout>
11826 <para>
11827 The IP address of the subject host is masked using &lt;<emphasis>number</emphasis>&gt; as the mask
11828 length. A textual string is constructed from the masked value, followed by the
11829 mask, and this is used as the lookup key. For example, if the host&#x2019;s IP address
11830 is 192.168.34.6, the key that is looked up for the above example is
11831 <quote>192.168.34.0/24</quote>.
11832 </para>
11833 <para>
11834 When an IPv6 address is converted to a string, dots are normally used instead
11835 of colons, so that keys in <command>lsearch</command> files need not contain colons (which
11836 terminate <command>lsearch</command> keys). This was implemented some time before the ability
11837 to quote keys was made available in <command>lsearch</command> files. However, the more
11838 recently implemented <command>iplsearch</command> files do require colons in IPv6 keys
11839 (notated using the quoting facility) so as to distinguish them from IPv4 keys.
11840 For this reason, when the lookup type is <command>iplsearch</command>, IPv6 addresses are
11841 converted using colons and not dots. In all cases, full, unabbreviated IPv6
11842 addresses are always used.
11843 </para>
11844 <para>
11845 Ideally, it would be nice to tidy up this anomalous situation by changing to
11846 colons in all cases, given that quoting is now available for <command>lsearch</command>.
11847 However, this would be an incompatible change that might break some existing
11848 configurations.
11849 </para>
11850 <para>
11851 <emphasis role="bold">Warning</emphasis>: Specifying <option>net32-</option> (for an IPv4 address) or <option>net128-</option> (for an
11852 IPv6 address) is not the same as specifying just <option>net-</option> without a number. In
11853 the former case the key strings include the mask value, whereas in the latter
11854 case the IP address is used on its own.
11855 </para>
11856 </section>
11857 <section id="SECThoslispatnam">
11858 <title>Host list patterns that match by host name</title>
11859 <para>
11860 <indexterm role="concept">
11861 <primary>host</primary>
11862 <secondary>lookup failures</secondary>
11863 </indexterm>
11864 <indexterm role="concept">
11865 <primary>unknown host name</primary>
11866 </indexterm>
11867 <indexterm role="concept">
11868 <primary>host list</primary>
11869 <secondary>matching host name</secondary>
11870 </indexterm>
11871 There are several types of pattern that require Exim to know the name of the
11872 remote host. These are either wildcard patterns or lookups by name. (If a
11873 complete hostname is given without any wildcarding, it is used to find an IP
11874 address to match against, as described in the section <xref linkend="SECThoslispatip"/>
11875 above.)
11876 </para>
11877 <para>
11878 If the remote host name is not already known when Exim encounters one of these
11879 patterns, it has to be found from the IP address.
11880 Although many sites on the Internet are conscientious about maintaining reverse
11881 DNS data for their hosts, there are also many that do not do this.
11882 Consequently, a name cannot always be found, and this may lead to unwanted
11883 effects. Take care when configuring host lists with wildcarded name patterns.
11884 Consider what will happen if a name cannot be found.
11885 </para>
11886 <para>
11887 Because of the problems of determining host names from IP addresses, matching
11888 against host names is not as common as matching against IP addresses.
11889 </para>
11890 <para>
11891 By default, in order to find a host name, Exim first does a reverse DNS lookup;
11892 if no name is found in the DNS, the system function (<function>gethostbyaddr()</function> or
11893 <function>getipnodebyaddr()</function> if available) is tried. The order in which these lookups
11894 are done can be changed by setting the <option>host_lookup_order</option> option. For
11895 security, once Exim has found one or more names, it looks up the IP addresses
11896 for these names and compares them with the IP address that it started with.
11897 Only those names whose IP addresses match are accepted. Any other names are
11898 discarded. If no names are left, Exim behaves as if the host name cannot be
11899 found. In the most common case there is only one name and one IP address.
11900 </para>
11901 <para>
11902 There are some options that control what happens if a host name cannot be
11903 found. These are described in section <xref linkend="SECTbehipnot"/> below.
11904 </para>
11905 <para>
11906 <indexterm role="concept">
11907 <primary>host</primary>
11908 <secondary>alias for</secondary>
11909 </indexterm>
11910 <indexterm role="concept">
11911 <primary>alias for host</primary>
11912 </indexterm>
11913 As a result of aliasing, hosts may have more than one name. When processing any
11914 of the following types of pattern, all the host&#x2019;s names are checked:
11915 </para>
11916 <itemizedlist>
11917 <listitem>
11918 <para>
11919 <indexterm role="concept">
11920 <primary>asterisk</primary>
11921 <secondary>in host list</secondary>
11922 </indexterm>
11923 If a pattern starts with <quote>*</quote> the remainder of the item must match the end of
11924 the host name. For example, <literal>*.b.c</literal> matches all hosts whose names end in
11925 <emphasis>.b.c</emphasis>. This special simple form is provided because this is a very common
11926 requirement. Other kinds of wildcarding require the use of a regular
11927 expression.
11928 </para>
11929 </listitem>
11930 <listitem>
11931 <para>
11932 <indexterm role="concept">
11933 <primary>regular expressions</primary>
11934 <secondary>in host list</secondary>
11935 </indexterm>
11936 <indexterm role="concept">
11937 <primary>host list</primary>
11938 <secondary>regular expression in</secondary>
11939 </indexterm>
11940 If the item starts with <quote>^</quote> it is taken to be a regular expression which is
11941 matched against the host name. Host names are case-independent, so this regular
11942 expression match is by default case-independent, but you can make it
11943 case-dependent by starting it with <literal>(?-i)</literal>. References to descriptions of the
11944 syntax of regular expressions are given in chapter <xref linkend="CHAPregexp"/>. For
11945 example,
11946 </para>
11947 <literallayout class="monospaced">
11948 ^(a|b)\.c\.d$
11949 </literallayout>
11950 <para>
11951 is a regular expression that matches either of the two hosts <emphasis>a.c.d</emphasis> or
11952 <emphasis>b.c.d</emphasis>. When a regular expression is used in a host list, you must take care
11953 that backslash and dollar characters are not misinterpreted as part of the
11954 string expansion. The simplest way to do this is to use <literal>\N</literal> to mark that
11955 part of the string as non-expandable. For example:
11956 </para>
11957 <literallayout class="monospaced">
11958 sender_unqualified_hosts = \N^(a|b)\.c\.d$\N : ....
11959 </literallayout>
11960 <para>
11961 <emphasis role="bold">Warning</emphasis>: If you want to match a complete host name, you must include the
11962 <literal>$</literal> terminating metacharacter in the regular expression, as in the above
11963 example. Without it, a match at the start of the host name is all that is
11964 required.
11965 </para>
11966 </listitem>
11967 </itemizedlist>
11968 </section>
11969 <section id="SECTbehipnot">
11970 <title>Behaviour when an IP address or name cannot be found</title>
11971 <para>
11972 <indexterm role="concept">
11973 <primary>host</primary>
11974 <secondary>lookup failures, permanent</secondary>
11975 </indexterm>
11976 While processing a host list, Exim may need to look up an IP address from a
11977 name (see section <xref linkend="SECThoslispatip"/>), or it may need to look up a host name
11978 from an IP address (see section <xref linkend="SECThoslispatnam"/>). In either case, the
11979 behaviour when it fails to find the information it is seeking is the same.
11980 </para>
11981 <para>
11982 <emphasis role="bold">Note</emphasis>: This section applies to permanent lookup failures. It does <emphasis>not</emphasis>
11983 apply to temporary DNS errors, whose handling is described in the next section.
11984 </para>
11985 <para>
11986 <indexterm role="concept">
11987 <primary><literal>+include_unknown</literal></primary>
11988 </indexterm>
11989 <indexterm role="concept">
11990 <primary><literal>+ignore_unknown</literal></primary>
11991 </indexterm>
11992 By default, Exim behaves as if the host does not match the list. This may not
11993 always be what you want to happen. To change Exim&#x2019;s behaviour, the special
11994 items <literal>+include_unknown</literal> or <literal>+ignore_unknown</literal> may appear in the list (at
11995 top level &ndash; they are not recognized in an indirected file).
11996 </para>
11997 <itemizedlist>
11998 <listitem>
11999 <para>
12000 If any item that follows <literal>+include_unknown</literal> requires information that
12001 cannot found, Exim behaves as if the host does match the list. For example,
12002 </para>
12003 <literallayout class="monospaced">
12004 host_reject_connection = +include_unknown:*.enemy.ex
12005 </literallayout>
12006 <para>
12007 rejects connections from any host whose name matches <literal>*.enemy.ex</literal>, and also
12008 any hosts whose name it cannot find.
12009 </para>
12010 </listitem>
12011 <listitem>
12012 <para>
12013 If any item that follows <literal>+ignore_unknown</literal> requires information that cannot
12014 be found, Exim ignores that item and proceeds to the rest of the list. For
12015 example:
12016 </para>
12017 <literallayout class="monospaced">
12018 accept hosts = +ignore_unknown : friend.example : \
12019                192.168.4.5
12020 </literallayout>
12021 <para>
12022 accepts from any host whose name is <emphasis>friend.example</emphasis> and from 192.168.4.5,
12023 whether or not its host name can be found. Without <literal>+ignore_unknown</literal>, if no
12024 name can be found for 192.168.4.5, it is rejected.
12025 </para>
12026 </listitem>
12027 </itemizedlist>
12028 <para>
12029 Both <literal>+include_unknown</literal> and <literal>+ignore_unknown</literal> may appear in the same
12030 list. The effect of each one lasts until the next, or until the end of the
12031 list.
12032 </para>
12033 </section>
12034 <section id="SECTtemdnserr">
12035 <title>Temporary DNS errors when looking up host information</title>
12036 <para>
12037 <indexterm role="concept">
12038 <primary>host</primary>
12039 <secondary>lookup failures, temporary</secondary>
12040 </indexterm>
12041 <indexterm role="concept">
12042 <primary><literal>+include_defer</literal></primary>
12043 </indexterm>
12044 <indexterm role="concept">
12045 <primary><literal>+ignore_defer</literal></primary>
12046 </indexterm>
12047 A temporary DNS lookup failure normally causes a defer action (except when
12048 <option>dns_again_means_nonexist</option> converts it into a permanent error). However,
12049 host lists can include <literal>+ignore_defer</literal> and <literal>+include_defer</literal>, analagous to
12050 <literal>+ignore_unknown</literal> and <literal>+include_unknown</literal>, as described in the previous
12051 section. These options should be used with care, probably only in non-critical
12052 host lists such as whitelists.
12053 </para>
12054 </section>
12055 <section id="SECThoslispatnamsk">
12056 <title>Host list patterns for single-key lookups by host name</title>
12057 <para>
12058 <indexterm role="concept">
12059 <primary>unknown host name</primary>
12060 </indexterm>
12061 <indexterm role="concept">
12062 <primary>host list</primary>
12063 <secondary>matching host name</secondary>
12064 </indexterm>
12065 If a pattern is of the form
12066 </para>
12067 <literallayout>
12068 &lt;<emphasis>single-key-search-type</emphasis>&gt;;&lt;<emphasis>search-data</emphasis>&gt;
12069 </literallayout>
12070 <para>
12071 for example
12072 </para>
12073 <literallayout class="monospaced">
12074 dbm;/host/accept/list
12075 </literallayout>
12076 <para>
12077 a single-key lookup is performed, using the host name as its key. If the
12078 lookup succeeds, the host matches the item. The actual data that is looked up
12079 is not used.
12080 </para>
12081 <para>
12082 <emphasis role="bold">Reminder</emphasis>: With this kind of pattern, you must have host <emphasis>names</emphasis> as
12083 keys in the file, not IP addresses. If you want to do lookups based on IP
12084 addresses, you must precede the search type with <quote>net-</quote> (see section
12085 <xref linkend="SECThoslispatsikey"/>). There is, however, no reason why you could not use
12086 two items in the same list, one doing an address lookup and one doing a name
12087 lookup, both using the same file.
12088 </para>
12089 </section>
12090 <section id="SECID81">
12091 <title>Host list patterns for query-style lookups</title>
12092 <para>
12093 If a pattern is of the form
12094 </para>
12095 <literallayout>
12096 &lt;<emphasis>query-style-search-type</emphasis>&gt;;&lt;<emphasis>query</emphasis>&gt;
12097 </literallayout>
12098 <para>
12099 the query is obeyed, and if it succeeds, the host matches the item. The actual
12100 data that is looked up is not used. The variables <varname>$sender_host_address</varname> and
12101 <varname>$sender_host_name</varname> can be used in the query. For example:
12102 </para>
12103 <literallayout class="monospaced">
12104 hosts_lookup = pgsql;\
12105   select ip from hostlist where ip='$sender_host_address'
12106 </literallayout>
12107 <para>
12108 The value of <varname>$sender_host_address</varname> for an IPv6 address contains colons. You
12109 can use the <option>sg</option> expansion item to change this if you need to. If you want to
12110 use masked IP addresses in database queries, you can use the <option>mask</option> expansion
12111 operator.
12112 </para>
12113 <para>
12114 If the query contains a reference to <varname>$sender_host_name</varname>, Exim automatically
12115 looks up the host name if has not already done so. (See section
12116 <xref linkend="SECThoslispatnam"/> for comments on finding host names.)
12117 </para>
12118 <para>
12119 Historical note: prior to release 4.30, Exim would always attempt to find a
12120 host name before running the query, unless the search type was preceded by
12121 <literal>net-</literal>. This is no longer the case. For backwards compatibility, <literal>net-</literal> is
12122 still recognized for query-style lookups, but its presence or absence has no
12123 effect. (Of course, for single-key lookups, <literal>net-</literal> <emphasis>is</emphasis> important.
12124 See section <xref linkend="SECThoslispatsikey"/>.)
12125 </para>
12126 </section>
12127 <section id="SECTmixwilhos">
12128 <title>Mixing wildcarded host names and addresses in host lists</title>
12129 <para>
12130 <indexterm role="concept">
12131 <primary>host list</primary>
12132 <secondary>mixing names and addresses in</secondary>
12133 </indexterm>
12134 If you have name lookups or wildcarded host names and IP addresses in the same
12135 host list, you should normally put the IP addresses first. For example, in an
12136 ACL you could have:
12137 </para>
12138 <literallayout class="monospaced">
12139 accept hosts = 10.9.8.7 : *.friend.example
12140 </literallayout>
12141 <para>
12142 The reason for this lies in the left-to-right way that Exim processes lists.
12143 It can test IP addresses without doing any DNS lookups, but when it reaches an
12144 item that requires a host name, it fails if it cannot find a host name to
12145 compare with the pattern. If the above list is given in the opposite order, the
12146 <option>accept</option> statement fails for a host whose name cannot be found, even if its
12147 IP address is 10.9.8.7.
12148 </para>
12149 <para>
12150 If you really do want to do the name check first, and still recognize the IP
12151 address, you can rewrite the ACL like this:
12152 </para>
12153 <literallayout class="monospaced">
12154 accept hosts = *.friend.example
12155 accept hosts = 10.9.8.7
12156 </literallayout>
12157 <para>
12158 If the first <option>accept</option> fails, Exim goes on to try the second one. See chapter
12159 <xref linkend="CHAPACL"/> for details of ACLs.
12160 </para>
12161 </section>
12162 <section id="SECTaddresslist">
12163 <title>Address lists</title>
12164 <para>
12165 <indexterm role="concept">
12166 <primary>list</primary>
12167 <secondary>address list</secondary>
12168 </indexterm>
12169 <indexterm role="concept">
12170 <primary>address list</primary>
12171 <secondary>empty item</secondary>
12172 </indexterm>
12173 <indexterm role="concept">
12174 <primary>address list</primary>
12175 <secondary>patterns</secondary>
12176 </indexterm>
12177 Address lists contain patterns that are matched against mail addresses. There
12178 is one special case to be considered: the sender address of a bounce message is
12179 always empty. You can test for this by providing an empty item in an address
12180 list. For example, you can set up a router to process bounce messages by
12181 using this option setting:
12182 </para>
12183 <literallayout class="monospaced">
12184 senders = :
12185 </literallayout>
12186 <para>
12187 The presence of the colon creates an empty item. If you do not provide any
12188 data, the list is empty and matches nothing. The empty sender can also be
12189 detected by a regular expression that matches an empty string,
12190 and by a query-style lookup that succeeds when <varname>$sender_address</varname> is empty.
12191 </para>
12192 <para>
12193 Non-empty items in an address list can be straightforward email addresses. For
12194 example:
12195 </para>
12196 <literallayout class="monospaced">
12197 senders = jbc@askone.example : hs@anacreon.example
12198 </literallayout>
12199 <para>
12200 A certain amount of wildcarding is permitted. If a pattern contains an @
12201 character, but is not a regular expression and does not begin with a
12202 semicolon-terminated lookup type (described below), the local part of the
12203 subject address is compared with the local part of the pattern, which may start
12204 with an asterisk. If the local parts match, the domain is checked in exactly
12205 the same way as for a pattern in a domain list. For example, the domain can be
12206 wildcarded, refer to a named list, or be a lookup:
12207 </para>
12208 <literallayout class="monospaced">
12209 deny senders = *@*.spamming.site:\
12210                *@+hostile_domains:\
12211                bozo@partial-lsearch;/list/of/dodgy/sites:\
12212                *@dbm;/bad/domains.db
12213 </literallayout>
12214 <para>
12215 <indexterm role="concept">
12216 <primary>local part</primary>
12217 <secondary>starting with !</secondary>
12218 </indexterm>
12219 <indexterm role="concept">
12220 <primary>address list</primary>
12221 <secondary>local part starting with !</secondary>
12222 </indexterm>
12223 If a local part that begins with an exclamation mark is required, it has to be
12224 specified using a regular expression, because otherwise the exclamation mark is
12225 treated as a sign of negation, as is standard in lists.
12226 </para>
12227 <para>
12228 If a non-empty pattern that is not a regular expression or a lookup does not
12229 contain an @ character, it is matched against the domain part of the subject
12230 address. The only two formats that are recognized this way are a literal
12231 domain, or a domain pattern that starts with *. In both these cases, the effect
12232 is the same as if <literal>*@</literal> preceded the pattern. For example:
12233 </para>
12234 <literallayout class="monospaced">
12235 deny senders = enemy.domain : *.enemy.domain
12236 </literallayout>
12237 <para>
12238 The following kinds of more complicated address list pattern can match any
12239 address, including the empty address that is characteristic of bounce message
12240 senders:
12241 </para>
12242 <itemizedlist>
12243 <listitem>
12244 <para>
12245 <indexterm role="concept">
12246 <primary>regular expressions</primary>
12247 <secondary>in address list</secondary>
12248 </indexterm>
12249 <indexterm role="concept">
12250 <primary>address list</primary>
12251 <secondary>regular expression in</secondary>
12252 </indexterm>
12253 If (after expansion) a pattern starts with <quote>^</quote>, a regular expression match is
12254 done against the complete address, with the pattern as the regular expression.
12255 You must take care that backslash and dollar characters are not misinterpreted
12256 as part of the string expansion. The simplest way to do this is to use <literal>\N</literal>
12257 to mark that part of the string as non-expandable. For example:
12258 </para>
12259 <literallayout class="monospaced">
12260 deny senders = \N^.*this.*@example\.com$\N : \
12261                \N^\d{8}.+@spamhaus.example$\N : ...
12262 </literallayout>
12263 <para>
12264 The <literal>\N</literal> sequences are removed by the expansion, so these items do indeed
12265 start with <quote>^</quote> by the time they are being interpreted as address patterns.
12266 </para>
12267 </listitem>
12268 <listitem>
12269 <para>
12270 <indexterm role="concept">
12271 <primary>address list</primary>
12272 <secondary>lookup for complete address</secondary>
12273 </indexterm>
12274 Complete addresses can be looked up by using a pattern that starts with a
12275 lookup type terminated by a semicolon, followed by the data for the lookup. For
12276 example:
12277 </para>
12278 <literallayout class="monospaced">
12279 deny senders = cdb;/etc/blocked.senders : \
12280   mysql;select address from blocked where \
12281   address='${quote_mysql:$sender_address}'
12282 </literallayout>
12283 <para>
12284 Both query-style and single-key lookup types can be used. For a single-key
12285 lookup type, Exim uses the complete address as the key. However, empty keys are
12286 not supported for single-key lookups, so a match against the empty address
12287 always fails. This restriction does not apply to query-style lookups.
12288 </para>
12289 <para>
12290 Partial matching for single-key lookups (section <xref linkend="SECTpartiallookup"/>)
12291 cannot be used, and is ignored if specified, with an entry being written to the
12292 panic log.
12293 <indexterm role="concept">
12294 <primary>*@ with single-key lookup</primary>
12295 </indexterm>
12296 However, you can configure lookup defaults, as described in section
12297 <xref linkend="SECTdefaultvaluelookups"/>, but this is useful only for the <quote>*@</quote> type of
12298 default. For example, with this lookup:
12299 </para>
12300 <literallayout class="monospaced">
12301 accept senders = lsearch*@;/some/file
12302 </literallayout>
12303 <para>
12304 the file could contains lines like this:
12305 </para>
12306 <literallayout class="monospaced">
12307 user1@domain1.example
12308 *@domain2.example
12309 </literallayout>
12310 <para>
12311 and for the sender address <emphasis>nimrod@jaeger.example</emphasis>, the sequence of keys
12312 that are tried is:
12313 </para>
12314 <literallayout class="monospaced">
12315 nimrod@jaeger.example
12316 *@jaeger.example
12317 *
12318 </literallayout>
12319 <para>
12320 <emphasis role="bold">Warning 1</emphasis>: Do not include a line keyed by <quote>*</quote> in the file, because that
12321 would mean that every address matches, thus rendering the test useless.
12322 </para>
12323 <para>
12324 <emphasis role="bold">Warning 2</emphasis>: Do not confuse these two kinds of item:
12325 </para>
12326 <literallayout class="monospaced">
12327 deny recipients = dbm*@;/some/file
12328 deny recipients = *@dbm;/some/file
12329 </literallayout>
12330 <para>
12331 The first does a whole address lookup, with defaulting, as just described,
12332 because it starts with a lookup type. The second matches the local part and
12333 domain independently, as described in a bullet point below.
12334 </para>
12335 </listitem>
12336 </itemizedlist>
12337 <para>
12338 The following kinds of address list pattern can match only non-empty addresses.
12339 If the subject address is empty, a match against any of these pattern types
12340 always fails.
12341 </para>
12342 <itemizedlist>
12343 <listitem>
12344 <para>
12345 <indexterm role="concept">
12346 <primary>@@ with single-key lookup</primary>
12347 </indexterm>
12348 <indexterm role="concept">
12349 <primary>address list</primary>
12350 <secondary>@@ lookup type</secondary>
12351 </indexterm>
12352 <indexterm role="concept">
12353 <primary>address list</primary>
12354 <secondary>split local part and domain</secondary>
12355 </indexterm>
12356 If a pattern starts with <quote>@@</quote> followed by a single-key lookup item
12357 (for example, <literal>@@lsearch;/some/file</literal>), the address that is being checked is
12358 split into a local part and a domain. The domain is looked up in the file. If
12359 it is not found, there is no match. If it is found, the data that is looked up
12360 from the file is treated as a colon-separated list of local part patterns, each
12361 of which is matched against the subject local part in turn.
12362 </para>
12363 <para>
12364 <indexterm role="concept">
12365 <primary>asterisk</primary>
12366 <secondary>in address list</secondary>
12367 </indexterm>
12368 The lookup may be a partial one, and/or one involving a search for a default
12369 keyed by <quote>*</quote> (see section <xref linkend="SECTdefaultvaluelookups"/>). The local part
12370 patterns that are looked up can be regular expressions or begin with <quote>*</quote>, or
12371 even be further lookups. They may also be independently negated. For example,
12372 with
12373 </para>
12374 <literallayout class="monospaced">
12375 deny senders = @@dbm;/etc/reject-by-domain
12376 </literallayout>
12377 <para>
12378 the data from which the DBM file is built could contain lines like
12379 </para>
12380 <literallayout class="monospaced">
12381 baddomain.com:  !postmaster : *
12382 </literallayout>
12383 <para>
12384 to reject all senders except <option>postmaster</option> from that domain.
12385 </para>
12386 <para>
12387 <indexterm role="concept">
12388 <primary>local part</primary>
12389 <secondary>starting with !</secondary>
12390 </indexterm>
12391 If a local part that actually begins with an exclamation mark is required, it
12392 has to be specified using a regular expression. In <command>lsearch</command> files, an entry
12393 may be split over several lines by indenting the second and subsequent lines,
12394 but the separating colon must still be included at line breaks. White space
12395 surrounding the colons is ignored. For example:
12396 </para>
12397 <literallayout class="monospaced">
12398 aol.com:  spammer1 : spammer2 : ^[0-9]+$ :
12399 spammer3 : spammer4
12400 </literallayout>
12401 <para>
12402 As in all colon-separated lists in Exim, a colon can be included in an item by
12403 doubling.
12404 </para>
12405 <para>
12406 If the last item in the list starts with a right angle-bracket, the remainder
12407 of the item is taken as a new key to look up in order to obtain a continuation
12408 list of local parts. The new key can be any sequence of characters. Thus one
12409 might have entries like
12410 </para>
12411 <literallayout class="monospaced">
12412 aol.com: spammer1 : spammer 2 : &gt;*
12413 xyz.com: spammer3 : &gt;*
12414 *:       ^\d{8}$
12415 </literallayout>
12416 <para>
12417 in a file that was searched with <option>@@dbm*</option>, to specify a match for 8-digit
12418 local parts for all domains, in addition to the specific local parts listed for
12419 each domain. Of course, using this feature costs another lookup each time a
12420 chain is followed, but the effort needed to maintain the data is reduced.
12421 </para>
12422 <para>
12423 <indexterm role="concept">
12424 <primary>loop</primary>
12425 <secondary>in lookups</secondary>
12426 </indexterm>
12427 It is possible to construct loops using this facility, and in order to catch
12428 them, the chains may be no more than fifty items long.
12429 </para>
12430 </listitem>
12431 <listitem>
12432 <para>
12433 The @@&lt;<emphasis>lookup</emphasis>&gt; style of item can also be used with a query-style
12434 lookup, but in this case, the chaining facility is not available. The lookup
12435 can only return a single list of local parts.
12436 </para>
12437 </listitem>
12438 </itemizedlist>
12439 <para>
12440 <emphasis role="bold">Warning</emphasis>: There is an important difference between the address list items
12441 in these two examples:
12442 </para>
12443 <literallayout class="monospaced">
12444 senders = +my_list
12445 senders = *@+my_list
12446 </literallayout>
12447 <para>
12448 In the first one, <literal>my_list</literal> is a named address list, whereas in the second
12449 example it is a named domain list.
12450 </para>
12451 </section>
12452 <section id="SECTcasletadd">
12453 <title>Case of letters in address lists</title>
12454 <para>
12455 <indexterm role="concept">
12456 <primary>case of local parts</primary>
12457 </indexterm>
12458 <indexterm role="concept">
12459 <primary>address list</primary>
12460 <secondary>case forcing</secondary>
12461 </indexterm>
12462 <indexterm role="concept">
12463 <primary>case forcing in address lists</primary>
12464 </indexterm>
12465 Domains in email addresses are always handled caselessly, but for local parts
12466 case may be significant on some systems (see <option>caseful_local_part</option> for how
12467 Exim deals with this when routing addresses). However, RFC 2505 (<emphasis>Anti-Spam
12468 Recommendations for SMTP MTAs</emphasis>) suggests that matching of addresses to
12469 blocking lists should be done in a case-independent manner. Since most address
12470 lists in Exim are used for this kind of control, Exim attempts to do this by
12471 default.
12472 </para>
12473 <para>
12474 The domain portion of an address is always lowercased before matching it to an
12475 address list. The local part is lowercased by default, and any string
12476 comparisons that take place are done caselessly. This means that the data in
12477 the address list itself, in files included as plain file names, and in any file
12478 that is looked up using the <quote>@@</quote> mechanism, can be in any case. However, the
12479 keys in files that are looked up by a search type other than <command>lsearch</command> (which
12480 works caselessly) must be in lower case, because these lookups are not
12481 case-independent.
12482 </para>
12483 <para>
12484 <indexterm role="concept">
12485 <primary><literal>+caseful</literal></primary>
12486 </indexterm>
12487 To allow for the possibility of caseful address list matching, if an item in
12488 an address list is the string <quote>+caseful</quote>, the original case of the local
12489 part is restored for any comparisons that follow, and string comparisons are no
12490 longer case-independent. This does not affect the domain, which remains in
12491 lower case. However, although independent matches on the domain alone are still
12492 performed caselessly, regular expressions that match against an entire address
12493 become case-sensitive after <quote>+caseful</quote> has been seen.
12494 </para>
12495 </section>
12496 <section id="SECTlocparlis">
12497 <title>Local part lists</title>
12498 <para>
12499 <indexterm role="concept">
12500 <primary>list</primary>
12501 <secondary>local part list</secondary>
12502 </indexterm>
12503 <indexterm role="concept">
12504 <primary>local part</primary>
12505 <secondary>list</secondary>
12506 </indexterm>
12507 Case-sensitivity in local part lists is handled in the same way as for address
12508 lists, as just described. The <quote>+caseful</quote> item can be used if required. In a
12509 setting of the <option>local_parts</option> option in a router with <option>caseful_local_part</option>
12510 set false, the subject is lowercased and the matching is initially
12511 case-insensitive. In this case, <quote>+caseful</quote> will restore case-sensitive
12512 matching in the local part list, but not elsewhere in the router. If
12513 <option>caseful_local_part</option> is set true in a router, matching in the <option>local_parts</option>
12514 option is case-sensitive from the start.
12515 </para>
12516 <para>
12517 If a local part list is indirected to a file (see section <xref linkend="SECTfilnamlis"/>),
12518 comments are handled in the same way as address lists &ndash; they are recognized
12519 only if the # is preceded by white space or the start of the line.
12520 Otherwise, local part lists are matched in the same way as domain lists, except
12521 that the special items that refer to the local host (<literal>@</literal>, <literal>@[]</literal>,
12522 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal>) are not recognized.
12523 Refer to section <xref linkend="SECTdomainlist"/> for details of the other available item
12524 types.
12525 <indexterm role="concept" startref="IIDdohoadli" class="endofrange"/>
12526 </para>
12527 </section>
12528 </chapter>
12529
12530 <chapter id="CHAPexpand">
12531 <title>String expansions</title>
12532 <para>
12533 <indexterm role="concept" id="IIDstrexp" class="startofrange">
12534 <primary>expansion</primary>
12535 <secondary>of strings</secondary>
12536 </indexterm>
12537 Many strings in Exim&#x2019;s run time configuration are expanded before use. Some of
12538 them are expanded every time they are used; others are expanded only once.
12539 </para>
12540 <para>
12541 When a string is being expanded it is copied verbatim from left to right except
12542 when a dollar or backslash character is encountered. A dollar specifies the
12543 start of a portion of the string that is interpreted and replaced as described
12544 below in section <xref linkend="SECTexpansionitems"/> onwards. Backslash is used as an
12545 escape character, as described in the following section.
12546 </para>
12547 <section id="SECTlittext">
12548 <title>Literal text in expanded strings</title>
12549 <para>
12550 <indexterm role="concept">
12551 <primary>expansion</primary>
12552 <secondary>including literal text</secondary>
12553 </indexterm>
12554 An uninterpreted dollar can be included in an expanded string by putting a
12555 backslash in front of it. A backslash can be used to prevent any special
12556 character being treated specially in an expansion, including backslash itself.
12557 If the string appears in quotes in the configuration file, two backslashes are
12558 required because the quotes themselves cause interpretation of backslashes when
12559 the string is read in (see section <xref linkend="SECTstrings"/>).
12560 </para>
12561 <para>
12562 <indexterm role="concept">
12563 <primary>expansion</primary>
12564 <secondary>non-expandable substrings</secondary>
12565 </indexterm>
12566 A portion of the string can specified as non-expandable by placing it between
12567 two occurrences of <literal>\N</literal>. This is particularly useful for protecting regular
12568 expressions, which often contain backslashes and dollar signs. For example:
12569 </para>
12570 <literallayout class="monospaced">
12571 deny senders = \N^\d{8}[a-z]@some\.site\.example$\N
12572 </literallayout>
12573 <para>
12574 On encountering the first <literal>\N</literal>, the expander copies subsequent characters
12575 without interpretation until it reaches the next <literal>\N</literal> or the end of the
12576 string.
12577 </para>
12578 </section>
12579 <section id="SECID82">
12580 <title>Character escape sequences in expanded strings</title>
12581 <para>
12582 <indexterm role="concept">
12583 <primary>expansion</primary>
12584 <secondary>escape sequences</secondary>
12585 </indexterm>
12586 A backslash followed by one of the letters <quote>n</quote>, <quote>r</quote>, or <quote>t</quote> in an
12587 expanded string is recognized as an escape sequence for the character newline,
12588 carriage return, or tab, respectively. A backslash followed by up to three
12589 octal digits is recognized as an octal encoding for a single character, and a
12590 backslash followed by <quote>x</quote> and up to two hexadecimal digits is a hexadecimal
12591 encoding.
12592 </para>
12593 <para>
12594 These escape sequences are also recognized in quoted strings when they are read
12595 in. Their interpretation in expansions as well is useful for unquoted strings,
12596 and for other cases such as looked-up strings that are then expanded.
12597 </para>
12598 </section>
12599 <section id="SECID83">
12600 <title>Testing string expansions</title>
12601 <para>
12602 <indexterm role="concept">
12603 <primary>expansion</primary>
12604 <secondary>testing</secondary>
12605 </indexterm>
12606 <indexterm role="concept">
12607 <primary>testing</primary>
12608 <secondary>string expansion</secondary>
12609 </indexterm>
12610 <indexterm role="option">
12611 <primary><option>-be</option></primary>
12612 </indexterm>
12613 Many expansions can be tested by calling Exim with the <option>-be</option> option. This
12614 takes the command arguments, or lines from the standard input if there are no
12615 arguments, runs them through the string expansion code, and writes the results
12616 to the standard output. Variables based on configuration values are set up, but
12617 since no message is being processed, variables such as <varname>$local_part</varname> have no
12618 value. Nevertheless the <option>-be</option> option can be useful for checking out file and
12619 database lookups, and the use of expansion operators such as <option>sg</option>, <option>substr</option>
12620 and <option>nhash</option>.
12621 </para>
12622 <para>
12623 Exim gives up its root privilege when it is called with the <option>-be</option> option, and
12624 instead runs under the uid and gid it was called with, to prevent users from
12625 using <option>-be</option> for reading files to which they do not have access.
12626 </para>
12627 <para>
12628 <indexterm role="option">
12629 <primary><option>-bem</option></primary>
12630 </indexterm>
12631 If you want to test expansions that include variables whose values are taken
12632 from a message, there are two other options that can be used. The <option>-bem</option>
12633 option is like <option>-be</option> except that it is followed by a file name. The file is
12634 read as a message before doing the test expansions. For example:
12635 </para>
12636 <literallayout class="monospaced">
12637 exim -bem /tmp/test.message '$h_subject:'
12638 </literallayout>
12639 <para>
12640 The <option>-Mset</option> option is used in conjunction with <option>-be</option> and is followed by an
12641 Exim message identifier. For example:
12642 </para>
12643 <literallayout class="monospaced">
12644 exim -be -Mset 1GrA8W-0004WS-LQ '$recipients'
12645 </literallayout>
12646 <para>
12647 This loads the message from Exim&#x2019;s spool before doing the test expansions, and
12648 is therefore restricted to admin users.
12649 </para>
12650 </section>
12651 <section id="SECTforexpfai">
12652 <title>Forced expansion failure</title>
12653 <para>
12654 <indexterm role="concept">
12655 <primary>expansion</primary>
12656 <secondary>forced failure</secondary>
12657 </indexterm>
12658 A number of expansions that are described in the following section have
12659 alternative <quote>true</quote> and <quote>false</quote> substrings, enclosed in brace characters
12660 (which are sometimes called <quote>curly brackets</quote>). Which of the two strings is
12661 used depends on some condition that is evaluated as part of the expansion. If,
12662 instead of a <quote>false</quote> substring, the word <quote>fail</quote> is used (not in braces),
12663 the entire string expansion fails in a way that can be detected by the code
12664 that requested the expansion. This is called <quote>forced expansion failure</quote>, and
12665 its consequences depend on the circumstances. In some cases it is no different
12666 from any other expansion failure, but in others a different action may be
12667 taken. Such variations are mentioned in the documentation of the option that is
12668 being expanded.
12669 </para>
12670 </section>
12671 <section id="SECTexpansionitems">
12672 <title>Expansion items</title>
12673 <para>
12674 The following items are recognized in expanded strings. White space may be used
12675 between sub-items that are keywords or substrings enclosed in braces inside an
12676 outer set of braces, to improve readability. <emphasis role="bold">Warning</emphasis>: Within braces,
12677 white space is significant.
12678 </para>
12679 <variablelist>
12680 <varlistentry>
12681 <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>
12682 <listitem>
12683 <para>
12684 <indexterm role="concept">
12685 <primary>expansion</primary>
12686 <secondary>variables</secondary>
12687 </indexterm>
12688 Substitute the contents of the named variable, for example:
12689 </para>
12690 <literallayout class="monospaced">
12691 $local_part
12692 ${domain}
12693 </literallayout>
12694 <para>
12695 The second form can be used to separate the name from subsequent alphanumeric
12696 characters. This form (using braces) is available only for variables; it does
12697 <emphasis>not</emphasis> apply to message headers. The names of the variables are given in
12698 section <xref linkend="SECTexpvar"/> below. If the name of a non-existent variable is
12699 given, the expansion fails.
12700 </para>
12701 </listitem></varlistentry>
12702 <varlistentry>
12703 <term><emphasis role="bold">${</emphasis>&lt;<emphasis>op</emphasis>&gt;<emphasis role="bold">:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
12704 <listitem>
12705 <para>
12706 <indexterm role="concept">
12707 <primary>expansion</primary>
12708 <secondary>operators</secondary>
12709 </indexterm>
12710 The string is first itself expanded, and then the operation specified by
12711 &lt;<emphasis>op</emphasis>&gt; is applied to it. For example:
12712 </para>
12713 <literallayout class="monospaced">
12714 ${lc:$local_part}
12715 </literallayout>
12716 <para>
12717 The string starts with the first character after the colon, which may be
12718 leading white space. A list of operators is given in section <xref linkend="SECTexpop"/>
12719 below. The operator notation is used for simple expansion items that have just
12720 one argument, because it reduces the number of braces and therefore makes the
12721 string easier to understand.
12722 </para>
12723 </listitem></varlistentry>
12724 <varlistentry>
12725 <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>
12726 <listitem>
12727 <para>
12728 This item inserts <quote>basic</quote> header lines. It is described with the <option>header</option>
12729 expansion item below.
12730 </para>
12731 </listitem></varlistentry>
12732 <varlistentry>
12733 <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>
12734 <listitem>
12735 <para>
12736 <indexterm role="concept">
12737 <primary><option>dlfunc</option></primary>
12738 </indexterm>
12739 This expansion dynamically loads and then calls a locally-written C function.
12740 This functionality is available only if Exim is compiled with
12741 </para>
12742 <literallayout class="monospaced">
12743 EXPAND_DLFUNC=yes
12744 </literallayout>
12745 <para>
12746 set in <filename>Local/Makefile</filename>. Once loaded, Exim remembers the dynamically loaded
12747 object so that it doesn&#x2019;t reload the same object file in the same Exim process
12748 (but of course Exim does start new processes frequently).
12749 </para>
12750 <para>
12751 There may be from zero to eight arguments to the function. When compiling
12752 a local function that is to be called in this way, <filename>local_scan.h</filename> should be
12753 included. The Exim variables and functions that are defined by that API
12754 are also available for dynamically loaded functions. The function itself
12755 must have the following type:
12756 </para>
12757 <literallayout class="monospaced">
12758 int dlfunction(uschar **yield, int argc, uschar *argv[])
12759 </literallayout>
12760 <para>
12761 Where <literal>uschar</literal> is a typedef for <literal>unsigned char</literal> in <filename>local_scan.h</filename>. The
12762 function should return one of the following values:
12763 </para>
12764 <para>
12765 <literal>OK</literal>: Success. The string that is placed in the variable <emphasis>yield</emphasis> is put
12766 into the expanded string that is being built.
12767 </para>
12768 <para>
12769 <literal>FAIL</literal>: A non-forced expansion failure occurs, with the error message taken
12770 from <emphasis>yield</emphasis>, if it is set.
12771 </para>
12772 <para>
12773 <literal>FAIL_FORCED</literal>: A forced expansion failure occurs, with the error message
12774 taken from <emphasis>yield</emphasis> if it is set.
12775 </para>
12776 <para>
12777 <literal>ERROR</literal>: Same as <literal>FAIL</literal>, except that a panic log entry is written.
12778 </para>
12779 <para>
12780 When compiling a function that is to be used in this way with gcc,
12781 you need to add <option>-shared</option> to the gcc command. Also, in the Exim build-time
12782 configuration, you must add <option>-export-dynamic</option> to EXTRALIBS.
12783 </para>
12784 </listitem></varlistentry>
12785 <varlistentry>
12786 <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>
12787 <listitem>
12788 <para>
12789 <indexterm role="concept">
12790 <primary>expansion</primary>
12791 <secondary>extracting substrings by key</secondary>
12792 </indexterm>
12793 <indexterm role="concept">
12794 <primary><option>extract</option></primary>
12795 <secondary>substrings by key</secondary>
12796 </indexterm>
12797 The key and &lt;<emphasis>string1</emphasis>&gt; are first expanded separately. Leading and trailing
12798 white space is removed from the key (but not from any of the strings). The key
12799 must not consist entirely of digits. The expanded &lt;<emphasis>string1</emphasis>&gt; must be of the
12800 form:
12801 </para>
12802 <literallayout>
12803 &lt;<emphasis>key1</emphasis>&gt; = &lt;<emphasis>value1</emphasis>&gt;  &lt;<emphasis>key2</emphasis>&gt; = &lt;<emphasis>value2</emphasis>&gt; ...
12804 </literallayout>
12805 <para>
12806 <indexterm role="variable">
12807 <primary><varname>$value</varname></primary>
12808 </indexterm>
12809 where the equals signs and spaces (but not both) are optional. If any of the
12810 values contain white space, they must be enclosed in double quotes, and any
12811 values that are enclosed in double quotes are subject to escape processing as
12812 described in section <xref linkend="SECTstrings"/>. The expanded &lt;<emphasis>string1</emphasis>&gt; is searched
12813 for the value that corresponds to the key. The search is case-insensitive. If
12814 the key is found, &lt;<emphasis>string2</emphasis>&gt; is expanded, and replaces the whole item;
12815 otherwise &lt;<emphasis>string3</emphasis>&gt; is used. During the expansion of &lt;<emphasis>string2</emphasis>&gt; the
12816 variable <varname>$value</varname> contains the value that has been extracted. Afterwards, it
12817 is restored to any previous value it might have had.
12818 </para>
12819 <para>
12820 If {&lt;<emphasis>string3</emphasis>&gt;} is omitted, the item is replaced by an empty string if the
12821 key is not found. If {&lt;<emphasis>string2</emphasis>&gt;} is also omitted, the value that was
12822 extracted is used. Thus, for example, these two expansions are identical, and
12823 yield <quote>2001</quote>:
12824 </para>
12825 <literallayout class="monospaced">
12826 ${extract{gid}{uid=1984 gid=2001}}
12827 ${extract{gid}{uid=1984 gid=2001}{$value}}
12828 </literallayout>
12829 <para>
12830 Instead of {&lt;<emphasis>string3</emphasis>&gt;} the word <quote>fail</quote> (not in curly brackets) can
12831 appear, for example:
12832 </para>
12833 <literallayout class="monospaced">
12834 ${extract{Z}{A=... B=...}{$value} fail }
12835 </literallayout>
12836 <para>
12837 This forces an expansion failure (see section <xref linkend="SECTforexpfai"/>);
12838 {&lt;<emphasis>string2</emphasis>&gt;} must be present for <quote>fail</quote> to be recognized.
12839 </para>
12840 </listitem></varlistentry>
12841 <varlistentry>
12842 <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>
12843 <listitem>
12844 <para>
12845 <indexterm role="concept">
12846 <primary>expansion</primary>
12847 <secondary>extracting substrings by number</secondary>
12848 </indexterm>
12849 <indexterm role="concept">
12850 <primary><option>extract</option></primary>
12851 <secondary>substrings by number</secondary>
12852 </indexterm>
12853 The &lt;<emphasis>number</emphasis>&gt; argument must consist entirely of decimal digits,
12854 apart from leading and trailing white space, which is ignored.
12855 This is what distinguishes this form of <option>extract</option> from the previous kind. It
12856 behaves in the same way, except that, instead of extracting a named field, it
12857 extracts from &lt;<emphasis>string1</emphasis>&gt; the field whose number is given as the first
12858 argument. You can use <varname>$value</varname> in &lt;<emphasis>string2</emphasis>&gt; or <literal>fail</literal> instead of
12859 &lt;<emphasis>string3</emphasis>&gt; as before.
12860 </para>
12861 <para>
12862 The fields in the string are separated by any one of the characters in the
12863 separator string. These may include space or tab characters.
12864 The first field is numbered one. If the number is negative, the fields are
12865 counted from the end of the string, with the rightmost one numbered -1. If the
12866 number given is zero, the entire string is returned. If the modulus of the
12867 number is greater than the number of fields in the string, the result is the
12868 expansion of &lt;<emphasis>string3</emphasis>&gt;, or the empty string if &lt;<emphasis>string3</emphasis>&gt; is not
12869 provided. For example:
12870 </para>
12871 <literallayout class="monospaced">
12872 ${extract{2}{:}{x:42:99:&amp; Mailer::/bin/bash}}
12873 </literallayout>
12874 <para>
12875 yields <quote>42</quote>, and
12876 </para>
12877 <literallayout class="monospaced">
12878 ${extract{-4}{:}{x:42:99:&amp; Mailer::/bin/bash}}
12879 </literallayout>
12880 <para>
12881 yields <quote>99</quote>. Two successive separators mean that the field between them is
12882 empty (for example, the fifth field above).
12883 </para>
12884 </listitem></varlistentry>
12885 <varlistentry>
12886 <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>
12887 <listitem>
12888 <para>
12889 <indexterm role="concept">
12890 <primary>list</primary>
12891 <secondary>selecting by condition</secondary>
12892 </indexterm>
12893 <indexterm role="concept">
12894 <primary>expansion</primary>
12895 <secondary>selecting from list by condition</secondary>
12896 </indexterm>
12897 <indexterm role="variable">
12898 <primary><varname>$item</varname></primary>
12899 </indexterm>
12900 After expansion, &lt;<emphasis>string</emphasis>&gt; is interpreted as a list, colon-separated by
12901 default, but the separator can be changed in the usual way. For each item
12902 in this list, its value is place in <varname>$item</varname>, and then the condition is
12903 evaluated. If the condition is true, <varname>$item</varname> is added to the output as an
12904 item in a new list; if the condition is false, the item is discarded. The
12905 separator used for the output list is the same as the one used for the
12906 input, but a separator setting is not included in the output. For example:
12907 </para>
12908 <literallayout class="monospaced">
12909 ${filter{a:b:c}{!eq{$item}{b}}
12910 </literallayout>
12911 <para>
12912 yields <literal>a:c</literal>. At the end of the expansion, the value of <varname>$item</varname> is restored
12913 to what it was before. See also the <emphasis role="bold">map</emphasis> and <emphasis role="bold">reduce</emphasis> expansion items.
12914 </para>
12915 </listitem></varlistentry>
12916 <varlistentry>
12917 <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>
12918 <listitem>
12919 <para>
12920 <indexterm role="concept">
12921 <primary>hash function</primary>
12922 <secondary>textual</secondary>
12923 </indexterm>
12924 <indexterm role="concept">
12925 <primary>expansion</primary>
12926 <secondary>textual hash</secondary>
12927 </indexterm>
12928 This is a textual hashing function, and was the first to be implemented in
12929 early versions of Exim. In current releases, there are other hashing functions
12930 (numeric, MD5, and SHA-1), which are described below.
12931 </para>
12932 <para>
12933 The first two strings, after expansion, must be numbers. Call them &lt;<emphasis>m</emphasis>&gt; and
12934 &lt;<emphasis>n</emphasis>&gt;. If you are using fixed values for these numbers, that is, if
12935 &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you can
12936 use the simpler operator notation that avoids some of the braces:
12937 </para>
12938 <literallayout class="monospaced">
12939 ${hash_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
12940 </literallayout>
12941 <para>
12942 The second number is optional (in both notations). If &lt;<emphasis>n</emphasis>&gt; is greater than
12943 or equal to the length of the string, the expansion item returns the string.
12944 Otherwise it computes a new string of length &lt;<emphasis>n</emphasis>&gt; by applying a hashing
12945 function to the string. The new string consists of characters taken from the
12946 first &lt;<emphasis>m</emphasis>&gt; characters of the string
12947 </para>
12948 <literallayout class="monospaced">
12949 abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQWRSTUVWXYZ0123456789
12950 </literallayout>
12951 <para>
12952 If &lt;<emphasis>m</emphasis>&gt; is not present the value 26 is used, so that only lower case
12953 letters appear. For example:
12954 </para>
12955 <literallayout>
12956 <literal>$hash{3}{monty}}           </literal>   yields  <literal>jmg</literal>
12957 <literal>$hash{5}{monty}}           </literal>   yields  <literal>monty</literal>
12958 <literal>$hash{4}{62}{monty python}}</literal>   yields  <literal>fbWx</literal>
12959 </literallayout>
12960 </listitem></varlistentry>
12961 <varlistentry>
12962 <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>
12963 <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>
12964 <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>
12965 <listitem>
12966 <para>
12967 <indexterm role="concept">
12968 <primary>expansion</primary>
12969 <secondary>header insertion</secondary>
12970 </indexterm>
12971 <indexterm role="variable">
12972 <primary><varname>$header_</varname></primary>
12973 </indexterm>
12974 <indexterm role="variable">
12975 <primary><varname>$bheader_</varname></primary>
12976 </indexterm>
12977 <indexterm role="variable">
12978 <primary><varname>$rheader_</varname></primary>
12979 </indexterm>
12980 <indexterm role="concept">
12981 <primary>header lines</primary>
12982 <secondary>in expansion strings</secondary>
12983 </indexterm>
12984 <indexterm role="concept">
12985 <primary>header lines</primary>
12986 <secondary>character sets</secondary>
12987 </indexterm>
12988 <indexterm role="concept">
12989 <primary>header lines</primary>
12990 <secondary>decoding</secondary>
12991 </indexterm>
12992 Substitute the contents of the named message header line, for example
12993 </para>
12994 <literallayout class="monospaced">
12995 $header_reply-to:
12996 </literallayout>
12997 <para>
12998 The newline that terminates a header line is not included in the expansion, but
12999 internal newlines (caused by splitting the header line over several physical
13000 lines) may be present.
13001 </para>
13002 <para>
13003 The difference between <option>rheader</option>, <option>bheader</option>, and <option>header</option> is in the way
13004 the data in the header line is interpreted.
13005 </para>
13006 <itemizedlist>
13007 <listitem>
13008 <para>
13009 <indexterm role="concept">
13010 <primary>white space</primary>
13011 <secondary>in header lines</secondary>
13012 </indexterm>
13013 <option>rheader</option> gives the original <quote>raw</quote> content of the header line, with no
13014 processing at all, and without the removal of leading and trailing white space.
13015 </para>
13016 </listitem>
13017 <listitem>
13018 <para>
13019 <indexterm role="concept">
13020 <primary>base64 encoding</primary>
13021 <secondary>in header lines</secondary>
13022 </indexterm>
13023 <option>bheader</option> removes leading and trailing white space, and then decodes base64
13024 or quoted-printable MIME <quote>words</quote> within the header text, but does no
13025 character set translation. If decoding of what looks superficially like a MIME
13026 <quote>word</quote> fails, the raw string is returned. If decoding
13027 <indexterm role="concept">
13028 <primary>binary zero</primary>
13029 <secondary>in header line</secondary>
13030 </indexterm>
13031 produces a binary zero character, it is replaced by a question mark &ndash; this is
13032 what Exim does for binary zeros that are actually received in header lines.
13033 </para>
13034 </listitem>
13035 <listitem>
13036 <para>
13037 <option>header</option> tries to translate the string as decoded by <option>bheader</option> to a
13038 standard character set. This is an attempt to produce the same string as would
13039 be displayed on a user&#x2019;s MUA. If translation fails, the <option>bheader</option> string is
13040 returned. Translation is attempted only on operating systems that support the
13041 <function>iconv()</function> function. This is indicated by the compile-time macro HAVE_ICONV in
13042 a system Makefile or in <filename>Local/Makefile</filename>.
13043 </para>
13044 </listitem>
13045 </itemizedlist>
13046 <para>
13047 In a filter file, the target character set for <option>header</option> can be specified by a
13048 command of the following form:
13049 </para>
13050 <literallayout class="monospaced">
13051 headers charset "UTF-8"
13052 </literallayout>
13053 <para>
13054 This command affects all references to <varname>$h_</varname> (or <varname>$header_</varname>) expansions in
13055 subsequently obeyed filter commands. In the absence of this command, the target
13056 character set in a filter is taken from the setting of the <option>headers_charset</option>
13057 option in the runtime configuration. The value of this option defaults to the
13058 value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The ultimate default is
13059 ISO-8859-1.
13060 </para>
13061 <para>
13062 Header names follow the syntax of RFC 2822, which states that they may contain
13063 any printing characters except space and colon. Consequently, curly brackets
13064 <emphasis>do not</emphasis> terminate header names, and should not be used to enclose them as
13065 if they were variables. Attempting to do so causes a syntax error.
13066 </para>
13067 <para>
13068 Only header lines that are common to all copies of a message are visible to
13069 this mechanism. These are the original header lines that are received with the
13070 message, and any that are added by an ACL statement or by a system
13071 filter. Header lines that are added to a particular copy of a message by a
13072 router or transport are not accessible.
13073 </para>
13074 <para>
13075 For incoming SMTP messages, no header lines are visible in ACLs that are obeyed
13076 before the DATA ACL, because the header structure is not set up until the
13077 message is received. Header lines that are added in a RCPT ACL (for example)
13078 are saved until the message&#x2019;s incoming header lines are available, at which
13079 point they are added. When a DATA ACL is running, however, header lines added
13080 by earlier ACLs are visible.
13081 </para>
13082 <para>
13083 Upper case and lower case letters are synonymous in header names. If the
13084 following character is white space, the terminating colon may be omitted, but
13085 this is not recommended, because you may then forget it when it is needed. When
13086 white space terminates the header name, it is included in the expanded string.
13087 If the message does not contain the given header, the expansion item is
13088 replaced by an empty string. (See the <option>def</option> condition in section
13089 <xref linkend="SECTexpcond"/> for a means of testing for the existence of a header.)
13090 </para>
13091 <para>
13092 If there is more than one header with the same name, they are all concatenated
13093 to form the substitution string, up to a maximum length of 64K. Unless
13094 <option>rheader</option> is being used, leading and trailing white space is removed from
13095 each header before concatenation, and a completely empty header is ignored. A
13096 newline character is then inserted between non-empty headers, but there is no
13097 newline at the very end. For the <option>header</option> and <option>bheader</option> expansion, for
13098 those headers that contain lists of addresses, a comma is also inserted at the
13099 junctions between headers. This does not happen for the <option>rheader</option> expansion.
13100 </para>
13101 </listitem></varlistentry>
13102 <varlistentry>
13103 <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>
13104 <listitem>
13105 <para>
13106 <indexterm role="concept">
13107 <primary>expansion</primary>
13108 <secondary>hmac hashing</secondary>
13109 </indexterm>
13110 <indexterm role="concept">
13111 <primary><option>hmac</option></primary>
13112 </indexterm>
13113 This function uses cryptographic hashing (either MD5 or SHA-1) to convert a
13114 shared secret and some text into a message authentication code, as specified in
13115 RFC 2104. This differs from <literal>${md5:secret_text...}</literal> or
13116 <literal>${sha1:secret_text...}</literal> in that the hmac step adds a signature to the
13117 cryptographic hash, allowing for authentication that is not possible with MD5
13118 or SHA-1 alone. The hash name must expand to either <literal>md5</literal> or <literal>sha1</literal> at
13119 present. For example:
13120 </para>
13121 <literallayout class="monospaced">
13122 ${hmac{md5}{somesecret}{$primary_hostname $tod_log}}
13123 </literallayout>
13124 <para>
13125 For the hostname <emphasis>mail.example.com</emphasis> and time 2002-10-17 11:30:59, this
13126 produces:
13127 </para>
13128 <literallayout class="monospaced">
13129 dd97e3ba5d1a61b5006108f8c8252953
13130 </literallayout>
13131 <para>
13132 As an example of how this might be used, you might put in the main part of
13133 an Exim configuration:
13134 </para>
13135 <literallayout class="monospaced">
13136 SPAMSCAN_SECRET=cohgheeLei2thahw
13137 </literallayout>
13138 <para>
13139 In a router or a transport you could then have:
13140 </para>
13141 <literallayout class="monospaced">
13142 headers_add = \
13143   X-Spam-Scanned: ${primary_hostname} ${message_exim_id} \
13144   ${hmac{md5}{SPAMSCAN_SECRET}\
13145   {${primary_hostname},${message_exim_id},$h_message-id:}}
13146 </literallayout>
13147 <para>
13148 Then given a message, you can check where it was scanned by looking at the
13149 <emphasis>X-Spam-Scanned:</emphasis> header line. If you know the secret, you can check that
13150 this header line is authentic by recomputing the authentication code from the
13151 host name, message ID and the <emphasis>Message-id:</emphasis> header line. This can be done
13152 using Exim&#x2019;s <option>-be</option> option, or by other means, for example by using the
13153 <emphasis>hmac_md5_hex()</emphasis> function in Perl.
13154 </para>
13155 </listitem></varlistentry>
13156 <varlistentry>
13157 <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>
13158 <listitem>
13159 <para>
13160 <indexterm role="concept">
13161 <primary>expansion</primary>
13162 <secondary>conditional</secondary>
13163 </indexterm>
13164 <indexterm role="concept">
13165 <primary><option>if</option>, expansion item</primary>
13166 </indexterm>
13167 If &lt;<emphasis>condition</emphasis>&gt; is true, &lt;<emphasis>string1</emphasis>&gt; is expanded and replaces the whole
13168 item; otherwise &lt;<emphasis>string2</emphasis>&gt; is used. The available conditions are described
13169 in section <xref linkend="SECTexpcond"/> below. For example:
13170 </para>
13171 <literallayout class="monospaced">
13172 ${if eq {$local_part}{postmaster} {yes}{no} }
13173 </literallayout>
13174 <para>
13175 The second string need not be present; if it is not and the condition is not
13176 true, the item is replaced with nothing. Alternatively, the word <quote>fail</quote> may
13177 be present instead of the second string (without any curly brackets). In this
13178 case, the expansion is forced to fail if the condition is not true (see section
13179 <xref linkend="SECTforexpfai"/>).
13180 </para>
13181 <para>
13182 If both strings are omitted, the result is the string <literal>true</literal> if the condition
13183 is true, and the empty string if the condition is false. This makes it less
13184 cumbersome to write custom ACL and router conditions. For example, instead of
13185 </para>
13186 <literallayout class="monospaced">
13187 condition = ${if &gt;{$acl_m4}{3}{true}{false}}
13188 </literallayout>
13189 <para>
13190 you can use
13191 </para>
13192 <literallayout class="monospaced">
13193 condition = ${if &gt;{$acl_m4}{3}}
13194 </literallayout>
13195 </listitem></varlistentry>
13196 <varlistentry>
13197 <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>
13198 <listitem>
13199 <para>
13200 <indexterm role="concept">
13201 <primary>expansion</primary>
13202 <secondary>string truncation</secondary>
13203 </indexterm>
13204 <indexterm role="concept">
13205 <primary><option>length</option> expansion item</primary>
13206 </indexterm>
13207 The <option>length</option> item is used to extract the initial portion of a string. Both
13208 strings are expanded, and the first one must yield a number, &lt;<emphasis>n</emphasis>&gt;, say. If
13209 you are using a fixed value for the number, that is, if &lt;<emphasis>string1</emphasis>&gt; does not
13210 change when expanded, you can use the simpler operator notation that avoids
13211 some of the braces:
13212 </para>
13213 <literallayout class="monospaced">
13214 ${length_&lt;n&gt;:&lt;string&gt;}
13215 </literallayout>
13216 <para>
13217 The result of this item is either the first &lt;<emphasis>n</emphasis>&gt; characters or the whole
13218 of &lt;<emphasis>string2</emphasis>&gt;, whichever is the shorter. Do not confuse <option>length</option> with
13219 <option>strlen</option>, which gives the length of a string.
13220 </para>
13221 </listitem></varlistentry>
13222 <varlistentry>
13223 <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>
13224 <listitem>
13225 <para>
13226 This is the first of one of two different types of lookup item, which are both
13227 described in the next item.
13228 </para>
13229 </listitem></varlistentry>
13230 <varlistentry>
13231 <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>
13232 <listitem>
13233 <para>
13234 <indexterm role="concept">
13235 <primary>expansion</primary>
13236 <secondary>lookup in</secondary>
13237 </indexterm>
13238 <indexterm role="concept">
13239 <primary>file</primary>
13240 <secondary>lookups</secondary>
13241 </indexterm>
13242 <indexterm role="concept">
13243 <primary>lookup</primary>
13244 <secondary>in expanded string</secondary>
13245 </indexterm>
13246 The two forms of lookup item specify data lookups in files and databases, as
13247 discussed in chapter <xref linkend="CHAPfdlookup"/>. The first form is used for single-key
13248 lookups, and the second is used for query-style lookups. The &lt;<emphasis>key</emphasis>&gt;,
13249 &lt;<emphasis>file</emphasis>&gt;, and &lt;<emphasis>query</emphasis>&gt; strings are expanded before use.
13250 </para>
13251 <para>
13252 If there is any white space in a lookup item which is part of a filter command,
13253 a retry or rewrite rule, a routing rule for the <command>manualroute</command> router, or any
13254 other place where white space is significant, the lookup item must be enclosed
13255 in double quotes. The use of data lookups in users&#x2019; filter files may be locked
13256 out by the system administrator.
13257 </para>
13258 <para>
13259 <indexterm role="variable">
13260 <primary><varname>$value</varname></primary>
13261 </indexterm>
13262 If the lookup succeeds, &lt;<emphasis>string1</emphasis>&gt; is expanded and replaces the entire item.
13263 During its expansion, the variable <varname>$value</varname> contains the data returned by the
13264 lookup. Afterwards it reverts to the value it had previously (at the outer
13265 level it is empty). If the lookup fails, &lt;<emphasis>string2</emphasis>&gt; is expanded and replaces
13266 the entire item. If {&lt;<emphasis>string2</emphasis>&gt;} is omitted, the replacement is the empty
13267 string on failure. If &lt;<emphasis>string2</emphasis>&gt; is provided, it can itself be a nested
13268 lookup, thus providing a mechanism for looking up a default value when the
13269 original lookup fails.
13270 </para>
13271 <para>
13272 If a nested lookup is used as part of &lt;<emphasis>string1</emphasis>&gt;, <varname>$value</varname> contains the
13273 data for the outer lookup while the parameters of the second lookup are
13274 expanded, and also while &lt;<emphasis>string2</emphasis>&gt; of the second lookup is expanded, should
13275 the second lookup fail. Instead of {&lt;<emphasis>string2</emphasis>&gt;} the word <quote>fail</quote> can
13276 appear, and in this case, if the lookup fails, the entire expansion is forced
13277 to fail (see section <xref linkend="SECTforexpfai"/>). If both {&lt;<emphasis>string1</emphasis>&gt;} and
13278 {&lt;<emphasis>string2</emphasis>&gt;} are omitted, the result is the looked up value in the case of a
13279 successful lookup, and nothing in the case of failure.
13280 </para>
13281 <para>
13282 For single-key lookups, the string <quote>partial</quote> is permitted to precede the
13283 search type in order to do partial matching, and * or *@ may follow a search
13284 type to request default lookups if the key does not match (see sections
13285 <xref linkend="SECTdefaultvaluelookups"/> and <xref linkend="SECTpartiallookup"/> for details).
13286 </para>
13287 <para>
13288 <indexterm role="concept">
13289 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
13290 <secondary>in lookup expansion</secondary>
13291 </indexterm>
13292 If a partial search is used, the variables <varname>$1</varname> and <varname>$2</varname> contain the wild
13293 and non-wild parts of the key during the expansion of the replacement text.
13294 They return to their previous values at the end of the lookup item.
13295 </para>
13296 <para>
13297 This example looks up the postmaster alias in the conventional alias file:
13298 </para>
13299 <literallayout class="monospaced">
13300 ${lookup {postmaster} lsearch {/etc/aliases} {$value}}
13301 </literallayout>
13302 <para>
13303 This example uses NIS+ to look up the full name of the user corresponding to
13304 the local part of an address, forcing the expansion to fail if it is not found:
13305 </para>
13306 <literallayout class="monospaced">
13307 ${lookup nisplus {[name=$local_part],passwd.org_dir:gcos} \
13308   {$value}fail}
13309 </literallayout>
13310 </listitem></varlistentry>
13311 <varlistentry>
13312 <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>
13313 <listitem>
13314 <para>
13315 <indexterm role="concept">
13316 <primary>expansion</primary>
13317 <secondary>list creation</secondary>
13318 </indexterm>
13319 <indexterm role="variable">
13320 <primary><varname>$item</varname></primary>
13321 </indexterm>
13322 After expansion, &lt;<emphasis>string1</emphasis>&gt; is interpreted as a list, colon-separated by
13323 default, but the separator can be changed in the usual way. For each item
13324 in this list, its value is place in <varname>$item</varname>, and then &lt;<emphasis>string2</emphasis>&gt; is
13325 expanded and added to the output as an item in a new list. The separator used
13326 for the output list is the same as the one used for the input, but a separator
13327 setting is not included in the output. For example:
13328 </para>
13329 <literallayout class="monospaced">
13330 ${map{a:b:c}{[$item]}} ${map{&lt;- x-y-z}{($item)}}
13331 </literallayout>
13332 <para>
13333 expands to <literal>[a]:[b]:[c] (x)-(y)-(z)</literal>. At the end of the expansion, the
13334 value of <varname>$item</varname> is restored to what it was before. See also the <emphasis role="bold">filter</emphasis>
13335 and <emphasis role="bold">reduce</emphasis> expansion items.
13336 </para>
13337 </listitem></varlistentry>
13338 <varlistentry>
13339 <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>
13340 <listitem>
13341 <para>
13342 <indexterm role="concept">
13343 <primary>expansion</primary>
13344 <secondary>numeric hash</secondary>
13345 </indexterm>
13346 <indexterm role="concept">
13347 <primary>hash function</primary>
13348 <secondary>numeric</secondary>
13349 </indexterm>
13350 The three strings are expanded; the first two must yield numbers. Call them
13351 &lt;<emphasis>n</emphasis>&gt; and &lt;<emphasis>m</emphasis>&gt;. If you are using fixed values for these numbers, that is,
13352 if &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you
13353 can use the simpler operator notation that avoids some of the braces:
13354 </para>
13355 <literallayout class="monospaced">
13356 ${nhash_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
13357 </literallayout>
13358 <para>
13359 The second number is optional (in both notations). If there is only one number,
13360 the result is a number in the range 0&ndash;&lt;<emphasis>n</emphasis>&gt;-1. Otherwise, the string is
13361 processed by a div/mod hash function that returns two numbers, separated by a
13362 slash, in the ranges 0 to &lt;<emphasis>n</emphasis>&gt;-1 and 0 to &lt;<emphasis>m</emphasis>&gt;-1, respectively. For
13363 example,
13364 </para>
13365 <literallayout class="monospaced">
13366 ${nhash{8}{64}{supercalifragilisticexpialidocious}}
13367 </literallayout>
13368 <para>
13369 returns the string <quote>6/33</quote>.
13370 </para>
13371 </listitem></varlistentry>
13372 <varlistentry>
13373 <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>
13374 <listitem>
13375 <para>
13376 <indexterm role="concept">
13377 <primary>Perl</primary>
13378 <secondary>use in expanded string</secondary>
13379 </indexterm>
13380 <indexterm role="concept">
13381 <primary>expansion</primary>
13382 <secondary>calling Perl from</secondary>
13383 </indexterm>
13384 This item is available only if Exim has been built to include an embedded Perl
13385 interpreter. The subroutine name and the arguments are first separately
13386 expanded, and then the Perl subroutine is called with those arguments. No
13387 additional arguments need be given; the maximum number permitted, including the
13388 name of the subroutine, is nine.
13389 </para>
13390 <para>
13391 The return value of the subroutine is inserted into the expanded string, unless
13392 the return value is <option>undef</option>. In that case, the expansion fails in the same
13393 way as an explicit <quote>fail</quote> on a lookup item. The return value is a scalar.
13394 Whatever you return is evaluated in a scalar context. For example, if you
13395 return the name of a Perl vector, the return value is the size of the vector,
13396 not its contents.
13397 </para>
13398 <para>
13399 If the subroutine exits by calling Perl&#x2019;s <option>die</option> function, the expansion fails
13400 with the error message that was passed to <option>die</option>. More details of the embedded
13401 Perl facility are given in chapter <xref linkend="CHAPperl"/>.
13402 </para>
13403 <para>
13404 The <command>redirect</command> router has an option called <option>forbid_filter_perl</option> which locks
13405 out the use of this expansion item in filter files.
13406 </para>
13407 </listitem></varlistentry>
13408 <varlistentry>
13409 <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>
13410 <listitem>
13411 <para>
13412 <indexterm role="concept">
13413 <primary><option>prvs</option> expansion item</primary>
13414 </indexterm>
13415 The first argument is a complete email address and the second is secret
13416 keystring. The third argument, specifying a key number, is optional. If absent,
13417 it defaults to 0. The result of the expansion is a prvs-signed email address,
13418 to be typically used with the <option>return_path</option> option on an <command>smtp</command> transport
13419 as part of a bounce address tag validation (BATV) scheme. For more discussion
13420 and an example, see section <xref linkend="SECTverifyPRVS"/>.
13421 </para>
13422 </listitem></varlistentry>
13423 <varlistentry>
13424 <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>
13425 <listitem>
13426 <para>
13427 <indexterm role="concept">
13428 <primary><option>prvscheck</option> expansion item</primary>
13429 </indexterm>
13430 This expansion item is the complement of the <option>prvs</option> item. It is used for
13431 checking prvs-signed addresses. If the expansion of the first argument does not
13432 yield a syntactically valid prvs-signed address, the whole item expands to the
13433 empty string. When the first argument does expand to a syntactically valid
13434 prvs-signed address, the second argument is expanded, with the prvs-decoded
13435 version of the address and the key number extracted from the address in the
13436 variables <varname>$prvscheck_address</varname> and <varname>$prvscheck_keynum</varname>, respectively.
13437 </para>
13438 <para>
13439 These two variables can be used in the expansion of the second argument to
13440 retrieve the secret. The validity of the prvs-signed address is then checked
13441 against the secret. The result is stored in the variable <varname>$prvscheck_result</varname>,
13442 which is empty for failure or <quote>1</quote> for success.
13443 </para>
13444 <para>
13445 The third argument is optional; if it is missing, it defaults to an empty
13446 string. This argument is now expanded. If the result is an empty string, the
13447 result of the expansion is the decoded version of the address. This is the case
13448 whether or not the signature was valid. Otherwise, the result of the expansion
13449 is the expansion of the third argument.
13450 </para>
13451 <para>
13452 All three variables can be used in the expansion of the third argument.
13453 However, once the expansion is complete, only <varname>$prvscheck_result</varname> remains set.
13454 For more discussion and an example, see section <xref linkend="SECTverifyPRVS"/>.
13455 </para>
13456 </listitem></varlistentry>
13457 <varlistentry>
13458 <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>
13459 <listitem>
13460 <para>
13461 <indexterm role="concept">
13462 <primary>expansion</primary>
13463 <secondary>inserting an entire file</secondary>
13464 </indexterm>
13465 <indexterm role="concept">
13466 <primary>file</primary>
13467 <secondary>inserting into expansion</secondary>
13468 </indexterm>
13469 <indexterm role="concept">
13470 <primary><option>readfile</option> expansion item</primary>
13471 </indexterm>
13472 The file name and end-of-line string are first expanded separately. The file is
13473 then read, and its contents replace the entire item. All newline characters in
13474 the file are replaced by the end-of-line string if it is present. Otherwise,
13475 newlines are left in the string.
13476 String expansion is not applied to the contents of the file. If you want this,
13477 you must wrap the item in an <option>expand</option> operator. If the file cannot be read,
13478 the string expansion fails.
13479 </para>
13480 <para>
13481 The <command>redirect</command> router has an option called <option>forbid_filter_readfile</option> which
13482 locks out the use of this expansion item in filter files.
13483 </para>
13484 </listitem></varlistentry>
13485 <varlistentry>
13486 <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>
13487 <listitem>
13488 <para>
13489 <indexterm role="concept">
13490 <primary>expansion</primary>
13491 <secondary>inserting from a socket</secondary>
13492 </indexterm>
13493 <indexterm role="concept">
13494 <primary>socket, use of in expansion</primary>
13495 </indexterm>
13496 <indexterm role="concept">
13497 <primary><option>readsocket</option> expansion item</primary>
13498 </indexterm>
13499 This item inserts data from a Unix domain or Internet socket into the expanded
13500 string. The minimal way of using it uses just two arguments, as in these
13501 examples:
13502 </para>
13503 <literallayout class="monospaced">
13504 ${readsocket{/socket/name}{request string}}
13505 ${readsocket{inet:some.host:1234}{request string}}
13506 </literallayout>
13507 <para>
13508 For a Unix domain socket, the first substring must be the path to the socket.
13509 For an Internet socket, the first substring must contain <literal>inet:</literal> followed by
13510 a host name or IP address, followed by a colon and a port, which can be a
13511 number or the name of a TCP port in <filename>/etc/services</filename>. An IP address may
13512 optionally be enclosed in square brackets. This is best for IPv6 addresses. For
13513 example:
13514 </para>
13515 <literallayout class="monospaced">
13516 ${readsocket{inet:[::1]:1234}{request string}}
13517 </literallayout>
13518 <para>
13519 Only a single host name may be given, but if looking it up yields more than
13520 one IP address, they are each tried in turn until a connection is made. For
13521 both kinds of socket, Exim makes a connection, writes the request string
13522 (unless it is an empty string) and reads from the socket until an end-of-file
13523 is read. A timeout of 5 seconds is applied. Additional, optional arguments
13524 extend what can be done. Firstly, you can vary the timeout. For example:
13525 </para>
13526 <literallayout class="monospaced">
13527 ${readsocket{/socket/name}{request string}{3s}}
13528 </literallayout>
13529 <para>
13530 A fourth argument allows you to change any newlines that are in the data
13531 that is read, in the same way as for <option>readfile</option> (see above). This example
13532 turns them into spaces:
13533 </para>
13534 <literallayout class="monospaced">
13535 ${readsocket{inet:127.0.0.1:3294}{request string}{3s}{ }}
13536 </literallayout>
13537 <para>
13538 As with all expansions, the substrings are expanded before the processing
13539 happens. Errors in these sub-expansions cause the expansion to fail. In
13540 addition, the following errors can occur:
13541 </para>
13542 <itemizedlist>
13543 <listitem>
13544 <para>
13545 Failure to create a socket file descriptor;
13546 </para>
13547 </listitem>
13548 <listitem>
13549 <para>
13550 Failure to connect the socket;
13551 </para>
13552 </listitem>
13553 <listitem>
13554 <para>
13555 Failure to write the request string;
13556 </para>
13557 </listitem>
13558 <listitem>
13559 <para>
13560 Timeout on reading from the socket.
13561 </para>
13562 </listitem>
13563 </itemizedlist>
13564 <para>
13565 By default, any of these errors causes the expansion to fail. However, if
13566 you supply a fifth substring, it is expanded and used when any of the above
13567 errors occurs. For example:
13568 </para>
13569 <literallayout class="monospaced">
13570 ${readsocket{/socket/name}{request string}{3s}{\n}\
13571   {socket failure}}
13572 </literallayout>
13573 <para>
13574 You can test for the existence of a Unix domain socket by wrapping this
13575 expansion in <literal>${if exists</literal>, but there is a race condition between that test
13576 and the actual opening of the socket, so it is safer to use the fifth argument
13577 if you want to be absolutely sure of avoiding an expansion error for a
13578 non-existent Unix domain socket, or a failure to connect to an Internet socket.
13579 </para>
13580 <para>
13581 The <command>redirect</command> router has an option called <option>forbid_filter_readsocket</option> which
13582 locks out the use of this expansion item in filter files.
13583 </para>
13584 </listitem></varlistentry>
13585 <varlistentry>
13586 <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>
13587 <listitem>
13588 <para>
13589 <indexterm role="concept">
13590 <primary>expansion</primary>
13591 <secondary>reducing a list to a scalar</secondary>
13592 </indexterm>
13593 <indexterm role="concept">
13594 <primary>list</primary>
13595 <secondary>reducing to a scalar</secondary>
13596 </indexterm>
13597 <indexterm role="variable">
13598 <primary><varname>$value</varname></primary>
13599 </indexterm>
13600 <indexterm role="variable">
13601 <primary><varname>$item</varname></primary>
13602 </indexterm>
13603 This operation reduces a list to a single, scalar string. After expansion,
13604 &lt;<emphasis>string1</emphasis>&gt; is interpreted as a list, colon-separated by default, but the
13605 separator can be changed in the usual way. Then &lt;<emphasis>string2</emphasis>&gt; is expanded and
13606 assigned to the <varname>$value</varname> variable. After this, each item in the &lt;<emphasis>string1</emphasis>&gt;
13607 list is assigned to <varname>$item</varname> in turn, and &lt;<emphasis>string3</emphasis>&gt; is expanded for each of
13608 them. The result of that expansion is assigned to <varname>$value</varname> before the next
13609 iteration. When the end of the list is reached, the final value of <varname>$value</varname> is
13610 added to the expansion output. The <emphasis role="bold">reduce</emphasis> expansion item can be used in a
13611 number of ways. For example, to add up a list of numbers:
13612 </para>
13613 <literallayout class="monospaced">
13614 ${reduce {&lt;, 1,2,3}{0}{${eval:$value+$item}}}
13615 </literallayout>
13616 <para>
13617 The result of that expansion would be <literal>6</literal>. The maximum of a list of numbers
13618 can be found:
13619 </para>
13620 <literallayout class="monospaced">
13621 ${reduce {3:0:9:4:6}{0}{${if &gt;{$item}{$value}{$item}{$value}}}}
13622 </literallayout>
13623 <para>
13624 At the end of a <emphasis role="bold">reduce</emphasis> expansion, the values of <varname>$item</varname> and <varname>$value</varname> are
13625 restored to what they were before. See also the <emphasis role="bold">filter</emphasis> and <emphasis role="bold">map</emphasis>
13626 expansion items.
13627 </para>
13628 </listitem></varlistentry>
13629 <varlistentry>
13630 <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>
13631 <listitem>
13632 <para>
13633 This item inserts <quote>raw</quote> header lines. It is described with the <option>header</option>
13634 expansion item above.
13635 </para>
13636 </listitem></varlistentry>
13637 <varlistentry>
13638 <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>
13639 <listitem>
13640 <para>
13641 <indexterm role="concept">
13642 <primary>expansion</primary>
13643 <secondary>running a command</secondary>
13644 </indexterm>
13645 <indexterm role="concept">
13646 <primary><option>run</option> expansion item</primary>
13647 </indexterm>
13648 The command and its arguments are first expanded separately, and then the
13649 command is run in a separate process, but under the same uid and gid. As in
13650 other command executions from Exim, a shell is not used by default. If you want
13651 a shell, you must explicitly code it.
13652 </para>
13653 <para>
13654 The standard input for the command exists, but is empty. The standard output
13655 and standard error are set to the same file descriptor.
13656 <indexterm role="concept">
13657 <primary>return code</primary>
13658 <secondary>from <option>run</option> expansion</secondary>
13659 </indexterm>
13660 <indexterm role="variable">
13661 <primary><varname>$value</varname></primary>
13662 </indexterm>
13663 If the command succeeds (gives a zero return code) &lt;<emphasis>string1</emphasis>&gt; is expanded
13664 and replaces the entire item; during this expansion, the standard output/error
13665 from the command is in the variable <varname>$value</varname>. If the command fails,
13666 &lt;<emphasis>string2</emphasis>&gt;, if present, is expanded and used. Once again, during the
13667 expansion, the standard output/error from the command is in the variable
13668 <varname>$value</varname>.
13669 </para>
13670 <para>
13671 If &lt;<emphasis>string2</emphasis>&gt; is absent, the result is empty. Alternatively, &lt;<emphasis>string2</emphasis>&gt;
13672 can be the word <quote>fail</quote> (not in braces) to force expansion failure if the
13673 command does not succeed. If both strings are omitted, the result is contents
13674 of the standard output/error on success, and nothing on failure.
13675 </para>
13676 <para>
13677 <indexterm role="variable">
13678 <primary><varname>$runrc</varname></primary>
13679 </indexterm>
13680 The return code from the command is put in the variable <varname>$runrc</varname>, and this
13681 remains set afterwards, so in a filter file you can do things like this:
13682 </para>
13683 <literallayout class="monospaced">
13684 if "${run{x y z}{}}$runrc" is 1 then ...
13685   elif $runrc is 2 then ...
13686   ...
13687 endif
13688 </literallayout>
13689 <para>
13690 If execution of the command fails (for example, the command does not exist),
13691 the return code is 127 &ndash; the same code that shells use for non-existent
13692 commands.
13693 </para>
13694 <para>
13695 <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot assume the order in which
13696 option values are expanded, except for those preconditions whose order of
13697 testing is documented. Therefore, you cannot reliably expect to set <varname>$runrc</varname>
13698 by the expansion of one option, and use it in another.
13699 </para>
13700 <para>
13701 The <command>redirect</command> router has an option called <option>forbid_filter_run</option> which locks
13702 out the use of this expansion item in filter files.
13703 </para>
13704 </listitem></varlistentry>
13705 <varlistentry>
13706 <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>
13707 <listitem>
13708 <para>
13709 <indexterm role="concept">
13710 <primary>expansion</primary>
13711 <secondary>string substitution</secondary>
13712 </indexterm>
13713 <indexterm role="concept">
13714 <primary><option>sg</option> expansion item</primary>
13715 </indexterm>
13716 This item works like Perl&#x2019;s substitution operator (s) with the global (/g)
13717 option; hence its name. However, unlike the Perl equivalent, Exim does not
13718 modify the subject string; instead it returns the modified string for insertion
13719 into the overall expansion. The item takes three arguments: the subject string,
13720 a regular expression, and a substitution string. For example:
13721 </para>
13722 <literallayout class="monospaced">
13723 ${sg{abcdefabcdef}{abc}{xyz}}
13724 </literallayout>
13725 <para>
13726 yields <quote>xyzdefxyzdef</quote>. Because all three arguments are expanded before use,
13727 if any $ or \ characters are required in the regular expression or in the
13728 substitution string, they have to be escaped. For example:
13729 </para>
13730 <literallayout class="monospaced">
13731 ${sg{abcdef}{^(...)(...)\$}{\$2\$1}}
13732 </literallayout>
13733 <para>
13734 yields <quote>defabc</quote>, and
13735 </para>
13736 <literallayout class="monospaced">
13737 ${sg{1=A 4=D 3=C}{\N(\d+)=\N}{K\$1=}}
13738 </literallayout>
13739 <para>
13740 yields <quote>K1=A K4=D K3=C</quote>. Note the use of <literal>\N</literal> to protect the contents of
13741 the regular expression from string expansion.
13742 </para>
13743 </listitem></varlistentry>
13744 <varlistentry>
13745 <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>
13746 <listitem>
13747 <para>
13748 <indexterm role="concept">
13749 <primary><option>substr</option> expansion item</primary>
13750 </indexterm>
13751 <indexterm role="concept">
13752 <primary>substring extraction</primary>
13753 </indexterm>
13754 <indexterm role="concept">
13755 <primary>expansion</primary>
13756 <secondary>substring extraction</secondary>
13757 </indexterm>
13758 The three strings are expanded; the first two must yield numbers. Call them
13759 &lt;<emphasis>n</emphasis>&gt; and &lt;<emphasis>m</emphasis>&gt;. If you are using fixed values for these numbers, that is,
13760 if &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you
13761 can use the simpler operator notation that avoids some of the braces:
13762 </para>
13763 <literallayout class="monospaced">
13764 ${substr_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
13765 </literallayout>
13766 <para>
13767 The second number is optional (in both notations).
13768 If it is absent in the simpler format, the preceding underscore must also be
13769 omitted.
13770 </para>
13771 <para>
13772 The <option>substr</option> item can be used to extract more general substrings than
13773 <option>length</option>. The first number, &lt;<emphasis>n</emphasis>&gt;, is a starting offset, and &lt;<emphasis>m</emphasis>&gt; is the
13774 length required. For example
13775 </para>
13776 <literallayout class="monospaced">
13777 ${substr{3}{2}{$local_part}}
13778 </literallayout>
13779 <para>
13780 If the starting offset is greater than the string length the result is the
13781 null string; if the length plus starting offset is greater than the string
13782 length, the result is the right-hand part of the string, starting from the
13783 given offset. The first character in the string has offset zero.
13784 </para>
13785 <para>
13786 The <option>substr</option> expansion item can take negative offset values to count
13787 from the right-hand end of its operand. The last character is offset -1, the
13788 second-last is offset -2, and so on. Thus, for example,
13789 </para>
13790 <literallayout class="monospaced">
13791 ${substr{-5}{2}{1234567}}
13792 </literallayout>
13793 <para>
13794 yields <quote>34</quote>. If the absolute value of a negative offset is greater than the
13795 length of the string, the substring starts at the beginning of the string, and
13796 the length is reduced by the amount of overshoot. Thus, for example,
13797 </para>
13798 <literallayout class="monospaced">
13799 ${substr{-5}{2}{12}}
13800 </literallayout>
13801 <para>
13802 yields an empty string, but
13803 </para>
13804 <literallayout class="monospaced">
13805 ${substr{-3}{2}{12}}
13806 </literallayout>
13807 <para>
13808 yields <quote>1</quote>.
13809 </para>
13810 <para>
13811 When the second number is omitted from <option>substr</option>, the remainder of the string
13812 is taken if the offset is positive. If it is negative, all characters in the
13813 string preceding the offset point are taken. For example, an offset of -1 and
13814 no length, as in these semantically identical examples:
13815 </para>
13816 <literallayout class="monospaced">
13817 ${substr_-1:abcde}
13818 ${substr{-1}{abcde}}
13819 </literallayout>
13820 <para>
13821 yields all but the last character of the string, that is, <quote>abcd</quote>.
13822 </para>
13823 </listitem></varlistentry>
13824 <varlistentry>
13825 <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>
13826 <listitem>
13827 <para>
13828 <indexterm role="concept">
13829 <primary>expansion</primary>
13830 <secondary>character translation</secondary>
13831 </indexterm>
13832 <indexterm role="concept">
13833 <primary><option>tr</option> expansion item</primary>
13834 </indexterm>
13835 This item does single-character translation on its subject string. The second
13836 argument is a list of characters to be translated in the subject string. Each
13837 matching character is replaced by the corresponding character from the
13838 replacement list. For example
13839 </para>
13840 <literallayout class="monospaced">
13841 ${tr{abcdea}{ac}{13}}
13842 </literallayout>
13843 <para>
13844 yields <literal>1b3de1</literal>. If there are duplicates in the second character string, the
13845 last occurrence is used. If the third string is shorter than the second, its
13846 last character is replicated. However, if it is empty, no translation takes
13847 place.
13848 </para>
13849 </listitem></varlistentry>
13850 </variablelist>
13851 </section>
13852 <section id="SECTexpop">
13853 <title>Expansion operators</title>
13854 <para>
13855 <indexterm role="concept">
13856 <primary>expansion</primary>
13857 <secondary>operators</secondary>
13858 </indexterm>
13859 For expansion items that perform transformations on a single argument string,
13860 the <quote>operator</quote> notation is used because it is simpler and uses fewer braces.
13861 The substring is first expanded before the operation is applied to it. The
13862 following operations can be performed:
13863 </para>
13864 <variablelist>
13865 <varlistentry>
13866 <term><emphasis role="bold">${address:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13867 <listitem>
13868 <para>
13869 <indexterm role="concept">
13870 <primary>expansion</primary>
13871 <secondary>RFC 2822 address handling</secondary>
13872 </indexterm>
13873 <indexterm role="concept">
13874 <primary><option>address</option> expansion item</primary>
13875 </indexterm>
13876 The string is interpreted as an RFC 2822 address, as it might appear in a
13877 header line, and the effective address is extracted from it. If the string does
13878 not parse successfully, the result is empty.
13879 </para>
13880 </listitem></varlistentry>
13881 <varlistentry>
13882 <term><emphasis role="bold">${addresses:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13883 <listitem>
13884 <para>
13885 <indexterm role="concept">
13886 <primary>expansion</primary>
13887 <secondary>RFC 2822 address handling</secondary>
13888 </indexterm>
13889 <indexterm role="concept">
13890 <primary><option>addresses</option> expansion item</primary>
13891 </indexterm>
13892 The string (after expansion) is interpreted as a list of addresses in RFC
13893 2822 format, such as can be found in a <emphasis>To:</emphasis> or <emphasis>Cc:</emphasis> header line. The
13894 operative address (<emphasis>local-part@domain</emphasis>) is extracted from each item, and the
13895 result of the expansion is a colon-separated list, with appropriate
13896 doubling of colons should any happen to be present in the email addresses.
13897 Syntactically invalid RFC2822 address items are omitted from the output.
13898 </para>
13899 <para>
13900 It is possible to specify a character other than colon for the output
13901 separator by starting the string with &gt; followed by the new separator
13902 character. For example:
13903 </para>
13904 <literallayout class="monospaced">
13905 ${addresses:&gt;&amp; Chief &lt;ceo@up.stairs&gt;, sec@base.ment (dogsbody)}
13906 </literallayout>
13907 <para>
13908 expands to <literal>ceo@up.stairs&amp;sec@base.ment</literal>. Compare the <emphasis role="bold">address</emphasis> (singular)
13909 expansion item, which extracts the working address from a single RFC2822
13910 address. See the <emphasis role="bold">filter</emphasis>, <emphasis role="bold">map</emphasis>, and <emphasis role="bold">reduce</emphasis> items for ways of
13911 processing lists.
13912 </para>
13913 </listitem></varlistentry>
13914 <varlistentry>
13915 <term><emphasis role="bold">${base62:</emphasis>&lt;<emphasis>digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13916 <listitem>
13917 <para>
13918 <indexterm role="concept">
13919 <primary><option>base62</option> expansion item</primary>
13920 </indexterm>
13921 <indexterm role="concept">
13922 <primary>expansion</primary>
13923 <secondary>conversion to base 62</secondary>
13924 </indexterm>
13925 The string must consist entirely of decimal digits. The number is converted to
13926 base 62 and output as a string of six characters, including leading zeros. In
13927 the few operating environments where Exim uses base 36 instead of base 62 for
13928 its message identifiers (because those systems do not have case-sensitive file
13929 names), base 36 is used by this operator, despite its name. <emphasis role="bold">Note</emphasis>: Just to
13930 be absolutely clear: this is <emphasis>not</emphasis> base64 encoding.
13931 </para>
13932 </listitem></varlistentry>
13933 <varlistentry>
13934 <term><emphasis role="bold">${base62d:</emphasis>&lt;<emphasis>base-62&nbsp;digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13935 <listitem>
13936 <para>
13937 <indexterm role="concept">
13938 <primary><option>base62d</option> expansion item</primary>
13939 </indexterm>
13940 <indexterm role="concept">
13941 <primary>expansion</primary>
13942 <secondary>conversion to base 62</secondary>
13943 </indexterm>
13944 The string must consist entirely of base-62 digits, or, in operating
13945 environments where Exim uses base 36 instead of base 62 for its message
13946 identifiers, base-36 digits. The number is converted to decimal and output as a
13947 string.
13948 </para>
13949 </listitem></varlistentry>
13950 <varlistentry>
13951 <term><emphasis role="bold">${domain:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13952 <listitem>
13953 <para>
13954 <indexterm role="concept">
13955 <primary>domain</primary>
13956 <secondary>extraction</secondary>
13957 </indexterm>
13958 <indexterm role="concept">
13959 <primary>expansion</primary>
13960 <secondary>domain extraction</secondary>
13961 </indexterm>
13962 The string is interpreted as an RFC 2822 address and the domain is extracted
13963 from it. If the string does not parse successfully, the result is empty.
13964 </para>
13965 </listitem></varlistentry>
13966 <varlistentry>
13967 <term><emphasis role="bold">${escape:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13968 <listitem>
13969 <para>
13970 <indexterm role="concept">
13971 <primary>expansion</primary>
13972 <secondary>escaping non-printing characters</secondary>
13973 </indexterm>
13974 <indexterm role="concept">
13975 <primary><option>escape</option> expansion item</primary>
13976 </indexterm>
13977 If the string contains any non-printing characters, they are converted to
13978 escape sequences starting with a backslash. Whether characters with the most
13979 significant bit set (so-called <quote>8-bit characters</quote>) count as printing or not
13980 is controlled by the <option>print_topbitchars</option> option.
13981 </para>
13982 </listitem></varlistentry>
13983 <varlistentry>
13984 <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>
13985 <listitem>
13986 <para>
13987 <indexterm role="concept">
13988 <primary>expansion</primary>
13989 <secondary>expression evaluation</secondary>
13990 </indexterm>
13991 <indexterm role="concept">
13992 <primary>expansion</primary>
13993 <secondary>arithmetic expression</secondary>
13994 </indexterm>
13995 <indexterm role="concept">
13996 <primary><option>eval</option> expansion item</primary>
13997 </indexterm>
13998 These items supports simple arithmetic and bitwise logical operations in
13999 expansion strings. The string (after expansion) must be a conventional
14000 arithmetic expression, but it is limited to basic arithmetic operators, bitwise
14001 logical operators, and parentheses. All operations are carried out using
14002 integer arithmetic. The operator priorities are as follows (the same as in the
14003 C programming language):
14004 </para>
14005 <informaltable frame="none">
14006 <tgroup cols="2" colsep="0" rowsep="0">
14007 <colspec colwidth="70pt" align="left"/>
14008 <colspec colwidth="300pt" align="left"/>
14009 <tbody>
14010 <row>
14011 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>highest:</emphasis></entry>
14012 <entry>not (~), negate (-)</entry>
14013 </row>
14014 <row>
14015 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
14016 <entry>multiply (*), divide (/), remainder (%)</entry>
14017 </row>
14018 <row>
14019 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
14020 <entry>plus (+), minus (-)</entry>
14021 </row>
14022 <row>
14023 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
14024 <entry>shift-left (&lt;&lt;), shift-right (&gt;&gt;)</entry>
14025 </row>
14026 <row>
14027 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
14028 <entry>and (&amp;)</entry>
14029 </row>
14030 <row>
14031 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
14032 <entry>xor (^)</entry>
14033 </row>
14034 <row>
14035 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>lowest:</emphasis></entry>
14036 <entry>or (|)</entry>
14037 </row>
14038 </tbody>
14039 </tgroup>
14040 </informaltable>
14041 <para>
14042 Binary operators with the same priority are evaluated from left to right. White
14043 space is permitted before or after operators.
14044 </para>
14045 <para>
14046 For <option>eval</option>, numbers may be decimal, octal (starting with <quote>0</quote>) or
14047 hexadecimal (starting with <quote>0x</quote>). For <option>eval10</option>, all numbers are taken as
14048 decimal, even if they start with a leading zero; hexadecimal numbers are not
14049 permitted. This can be useful when processing numbers extracted from dates or
14050 times, which often do have leading zeros.
14051 </para>
14052 <para>
14053 A number may be followed by <quote>K</quote> or <quote>M</quote> to multiply it by 1024 or 1024*1024,
14054 respectively. Negative numbers are supported. The result of the computation is
14055 a decimal representation of the answer (without <quote>K</quote> or <quote>M</quote>). For example:
14056 </para>
14057 <literallayout>
14058 <literal>${eval:1+1}            </literal>  yields 2
14059 <literal>${eval:1+2*3}          </literal>  yields 7
14060 <literal>${eval:(1+2)*3}        </literal>  yields 9
14061 <literal>${eval:2+42%5}         </literal>  yields 4
14062 <literal>${eval:0xc&amp;5}          </literal>  yields 4
14063 <literal>${eval:0xc|5}          </literal>  yields 13
14064 <literal>${eval:0xc^5}          </literal>  yields 9
14065 <literal>${eval:0xc&gt;&gt;1}         </literal>  yields 6
14066 <literal>${eval:0xc&lt;&lt;1}         </literal>  yields 24
14067 <literal>${eval:~255&amp;0x1234}    </literal>  yields 4608
14068 <literal>${eval:-(~255&amp;0x1234)} </literal>  yields -4608
14069 </literallayout>
14070 <para>
14071 As a more realistic example, in an ACL you might have
14072 </para>
14073 <literallayout class="monospaced">
14074 deny   message = Too many bad recipients
14075        condition =                    \
14076          ${if and {                   \
14077            {&gt;{$rcpt_count}{10}}       \
14078            {                          \
14079            &lt;                          \
14080              {$recipients_count}      \
14081              {${eval:$rcpt_count/2}}  \
14082            }                          \
14083          }{yes}{no}}
14084 </literallayout>
14085 <para>
14086 The condition is true if there have been more than 10 RCPT commands and
14087 fewer than half of them have resulted in a valid recipient.
14088 </para>
14089 </listitem></varlistentry>
14090 <varlistentry>
14091 <term><emphasis role="bold">${expand:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14092 <listitem>
14093 <para>
14094 <indexterm role="concept">
14095 <primary>expansion</primary>
14096 <secondary>re-expansion of substring</secondary>
14097 </indexterm>
14098 The <option>expand</option> operator causes a string to be expanded for a second time. For
14099 example,
14100 </para>
14101 <literallayout class="monospaced">
14102 ${expand:${lookup{$domain}dbm{/some/file}{$value}}}
14103 </literallayout>
14104 <para>
14105 first looks up a string in a file while expanding the operand for <option>expand</option>,
14106 and then re-expands what it has found.
14107 </para>
14108 </listitem></varlistentry>
14109 <varlistentry>
14110 <term><emphasis role="bold">${from_utf8:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14111 <listitem>
14112 <para>
14113 <indexterm role="concept">
14114 <primary>Unicode</primary>
14115 </indexterm>
14116 <indexterm role="concept">
14117 <primary>UTF-8</primary>
14118 <secondary>conversion from</secondary>
14119 </indexterm>
14120 <indexterm role="concept">
14121 <primary>expansion</primary>
14122 <secondary>UTF-8 conversion</secondary>
14123 </indexterm>
14124 <indexterm role="concept">
14125 <primary><option>from_utf8</option> expansion item</primary>
14126 </indexterm>
14127 The world is slowly moving towards Unicode, although there are no standards for
14128 email yet. However, other applications (including some databases) are starting
14129 to store data in Unicode, using UTF-8 encoding. This operator converts from a
14130 UTF-8 string to an ISO-8859-1 string. UTF-8 code values greater than 255 are
14131 converted to underscores. The input must be a valid UTF-8 string. If it is not,
14132 the result is an undefined sequence of bytes.
14133 </para>
14134 <para>
14135 Unicode code points with values less than 256 are compatible with ASCII and
14136 ISO-8859-1 (also known as Latin-1).
14137 For example, character 169 is the copyright symbol in both cases, though the
14138 way it is encoded is different. In UTF-8, more than one byte is needed for
14139 characters with code values greater than 127, whereas ISO-8859-1 is a
14140 single-byte encoding (but thereby limited to 256 characters). This makes
14141 translation from UTF-8 to ISO-8859-1 straightforward.
14142 </para>
14143 </listitem></varlistentry>
14144 <varlistentry>
14145 <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>
14146 <listitem>
14147 <para>
14148 <indexterm role="concept">
14149 <primary>hash function</primary>
14150 <secondary>textual</secondary>
14151 </indexterm>
14152 <indexterm role="concept">
14153 <primary>expansion</primary>
14154 <secondary>textual hash</secondary>
14155 </indexterm>
14156 The <option>hash</option> operator is a simpler interface to the hashing function that can
14157 be used when the two parameters are fixed numbers (as opposed to strings that
14158 change when expanded). The effect is the same as
14159 </para>
14160 <literallayout class="monospaced">
14161 ${hash{&lt;n&gt;}{&lt;m&gt;}{&lt;string&gt;}}
14162 </literallayout>
14163 <para>
14164 See the description of the general <option>hash</option> item above for details. The
14165 abbreviation <option>h</option> can be used when <option>hash</option> is used as an operator.
14166 </para>
14167 </listitem></varlistentry>
14168 <varlistentry>
14169 <term><emphasis role="bold">${hex2b64:</emphasis>&lt;<emphasis>hexstring</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14170 <listitem>
14171 <para>
14172 <indexterm role="concept">
14173 <primary>base64 encoding</primary>
14174 <secondary>conversion from hex</secondary>
14175 </indexterm>
14176 <indexterm role="concept">
14177 <primary>expansion</primary>
14178 <secondary>hex to base64</secondary>
14179 </indexterm>
14180 <indexterm role="concept">
14181 <primary><option>hex2b64</option> expansion item</primary>
14182 </indexterm>
14183 This operator converts a hex string into one that is base64 encoded. This can
14184 be useful for processing the output of the MD5 and SHA-1 hashing functions.
14185 </para>
14186 </listitem></varlistentry>
14187 <varlistentry>
14188 <term><emphasis role="bold">${lc:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14189 <listitem>
14190 <para>
14191 <indexterm role="concept">
14192 <primary>case forcing in strings</primary>
14193 </indexterm>
14194 <indexterm role="concept">
14195 <primary>string</primary>
14196 <secondary>case forcing</secondary>
14197 </indexterm>
14198 <indexterm role="concept">
14199 <primary>lower casing</primary>
14200 </indexterm>
14201 <indexterm role="concept">
14202 <primary>expansion</primary>
14203 <secondary>case forcing</secondary>
14204 </indexterm>
14205 <indexterm role="concept">
14206 <primary><option>lc</option> expansion item</primary>
14207 </indexterm>
14208 This forces the letters in the string into lower-case, for example:
14209 </para>
14210 <literallayout class="monospaced">
14211 ${lc:$local_part}
14212 </literallayout>
14213 </listitem></varlistentry>
14214 <varlistentry>
14215 <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>
14216 <listitem>
14217 <para>
14218 <indexterm role="concept">
14219 <primary>expansion</primary>
14220 <secondary>string truncation</secondary>
14221 </indexterm>
14222 <indexterm role="concept">
14223 <primary><option>length</option> expansion item</primary>
14224 </indexterm>
14225 The <option>length</option> operator is a simpler interface to the <option>length</option> function that
14226 can be used when the parameter is a fixed number (as opposed to a string that
14227 changes when expanded). The effect is the same as
14228 </para>
14229 <literallayout class="monospaced">
14230 ${length{&lt;number&gt;}{&lt;string&gt;}}
14231 </literallayout>
14232 <para>
14233 See the description of the general <option>length</option> item above for details. Note that
14234 <option>length</option> is not the same as <option>strlen</option>. The abbreviation <option>l</option> can be used
14235 when <option>length</option> is used as an operator.
14236 </para>
14237 </listitem></varlistentry>
14238 <varlistentry>
14239 <term><emphasis role="bold">${local_part:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14240 <listitem>
14241 <para>
14242 <indexterm role="concept">
14243 <primary>expansion</primary>
14244 <secondary>local part extraction</secondary>
14245 </indexterm>
14246 <indexterm role="concept">
14247 <primary><option>local_part</option> expansion item</primary>
14248 </indexterm>
14249 The string is interpreted as an RFC 2822 address and the local part is
14250 extracted from it. If the string does not parse successfully, the result is
14251 empty.
14252 </para>
14253 </listitem></varlistentry>
14254 <varlistentry>
14255 <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>
14256 <listitem>
14257 <para>
14258 <indexterm role="concept">
14259 <primary>masked IP address</primary>
14260 </indexterm>
14261 <indexterm role="concept">
14262 <primary>IP address</primary>
14263 <secondary>masking</secondary>
14264 </indexterm>
14265 <indexterm role="concept">
14266 <primary>CIDR notation</primary>
14267 </indexterm>
14268 <indexterm role="concept">
14269 <primary>expansion</primary>
14270 <secondary>IP address masking</secondary>
14271 </indexterm>
14272 <indexterm role="concept">
14273 <primary><option>mask</option> expansion item</primary>
14274 </indexterm>
14275 If the form of the string to be operated on is not an IP address followed by a
14276 slash and an integer (that is, a network address in CIDR notation), the
14277 expansion fails. Otherwise, this operator converts the IP address to binary,
14278 masks off the least significant bits according to the bit count, and converts
14279 the result back to text, with mask appended. For example,
14280 </para>
14281 <literallayout class="monospaced">
14282 ${mask:10.111.131.206/28}
14283 </literallayout>
14284 <para>
14285 returns the string <quote>10.111.131.192/28</quote>. Since this operation is expected to
14286 be mostly used for looking up masked addresses in files, the result for an IPv6
14287 address uses dots to separate components instead of colons, because colon
14288 terminates a key string in lsearch files. So, for example,
14289 </para>
14290 <literallayout class="monospaced">
14291 ${mask:3ffe:ffff:836f:0a00:000a:0800:200a:c031/99}
14292 </literallayout>
14293 <para>
14294 returns the string
14295 </para>
14296 <literallayout class="monospaced">
14297 3ffe.ffff.836f.0a00.000a.0800.2000.0000/99
14298 </literallayout>
14299 <para>
14300 Letters in IPv6 addresses are always output in lower case.
14301 </para>
14302 </listitem></varlistentry>
14303 <varlistentry>
14304 <term><emphasis role="bold">${md5:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14305 <listitem>
14306 <para>
14307 <indexterm role="concept">
14308 <primary>MD5 hash</primary>
14309 </indexterm>
14310 <indexterm role="concept">
14311 <primary>expansion</primary>
14312 <secondary>MD5 hash</secondary>
14313 </indexterm>
14314 <indexterm role="concept">
14315 <primary><option>md5</option> expansion item</primary>
14316 </indexterm>
14317 The <option>md5</option> operator computes the MD5 hash value of the string, and returns it
14318 as a 32-digit hexadecimal number, in which any letters are in lower case.
14319 </para>
14320 </listitem></varlistentry>
14321 <varlistentry>
14322 <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>
14323 <listitem>
14324 <para>
14325 <indexterm role="concept">
14326 <primary>expansion</primary>
14327 <secondary>numeric hash</secondary>
14328 </indexterm>
14329 <indexterm role="concept">
14330 <primary>hash function</primary>
14331 <secondary>numeric</secondary>
14332 </indexterm>
14333 The <option>nhash</option> operator is a simpler interface to the numeric hashing function
14334 that can be used when the two parameters are fixed numbers (as opposed to
14335 strings that change when expanded). The effect is the same as
14336 </para>
14337 <literallayout class="monospaced">
14338 ${nhash{&lt;n&gt;}{&lt;m&gt;}{&lt;string&gt;}}
14339 </literallayout>
14340 <para>
14341 See the description of the general <option>nhash</option> item above for details.
14342 </para>
14343 </listitem></varlistentry>
14344 <varlistentry>
14345 <term><emphasis role="bold">${quote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14346 <listitem>
14347 <para>
14348 <indexterm role="concept">
14349 <primary>quoting</primary>
14350 <secondary>in string expansions</secondary>
14351 </indexterm>
14352 <indexterm role="concept">
14353 <primary>expansion</primary>
14354 <secondary>quoting</secondary>
14355 </indexterm>
14356 <indexterm role="concept">
14357 <primary><option>quote</option> expansion item</primary>
14358 </indexterm>
14359 The <option>quote</option> operator puts its argument into double quotes if it
14360 is an empty string or
14361 contains anything other than letters, digits, underscores, dots, and hyphens.
14362 Any occurrences of double quotes and backslashes are escaped with a backslash.
14363 Newlines and carriage returns are converted to <literal>\n</literal> and <literal>\r</literal>,
14364 respectively For example,
14365 </para>
14366 <literallayout class="monospaced">
14367 ${quote:ab"*"cd}
14368 </literallayout>
14369 <para>
14370 becomes
14371 </para>
14372 <literallayout class="monospaced">
14373 "ab\"*\"cd"
14374 </literallayout>
14375 <para>
14376 The place where this is useful is when the argument is a substitution from a
14377 variable or a message header.
14378 </para>
14379 </listitem></varlistentry>
14380 <varlistentry>
14381 <term><emphasis role="bold">${quote_local_part:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14382 <listitem>
14383 <para>
14384 <indexterm role="concept">
14385 <primary><option>quote_local_part</option> expansion item</primary>
14386 </indexterm>
14387 This operator is like <option>quote</option>, except that it quotes the string only if
14388 required to do so by the rules of RFC 2822 for quoting local parts. For
14389 example, a plus sign would not cause quoting (but it would for <option>quote</option>).
14390 If you are creating a new email address from the contents of <varname>$local_part</varname>
14391 (or any other unknown data), you should always use this operator.
14392 </para>
14393 </listitem></varlistentry>
14394 <varlistentry>
14395 <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>
14396 <listitem>
14397 <para>
14398 <indexterm role="concept">
14399 <primary>quoting</primary>
14400 <secondary>lookup-specific</secondary>
14401 </indexterm>
14402 This operator applies lookup-specific quoting rules to the string. Each
14403 query-style lookup type has its own quoting rules which are described with
14404 the lookups in chapter <xref linkend="CHAPfdlookup"/>. For example,
14405 </para>
14406 <literallayout class="monospaced">
14407 ${quote_ldap:two * two}
14408 </literallayout>
14409 <para>
14410 returns
14411 </para>
14412 <literallayout class="monospaced">
14413 two%20%5C2A%20two
14414 </literallayout>
14415 <para>
14416 For single-key lookup types, no quoting is ever necessary and this operator
14417 yields an unchanged string.
14418 </para>
14419 </listitem></varlistentry>
14420 <varlistentry>
14421 <term><emphasis role="bold">${randint:</emphasis>&lt;<emphasis>n</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14422 <listitem>
14423 <para>
14424 <indexterm role="concept">
14425 <primary>random number</primary>
14426 </indexterm>
14427 This operator returns a somewhat random number which is less than the
14428 supplied number and is at least 0.  The quality of this randomness depends
14429 on how Exim was built; the values are not suitable for keying material.
14430 If Exim is linked against OpenSSL then RAND_pseudo_bytes() is used.
14431 Otherwise, the implementation may be arc4random(), random() seeded by
14432 srandomdev() or srandom(), or a custom implementation even weaker than
14433 random().
14434 </para>
14435 </listitem></varlistentry>
14436 <varlistentry>
14437 <term><emphasis role="bold">${rfc2047:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14438 <listitem>
14439 <para>
14440 <indexterm role="concept">
14441 <primary>expansion</primary>
14442 <secondary>RFC 2047</secondary>
14443 </indexterm>
14444 <indexterm role="concept">
14445 <primary>RFC 2047</primary>
14446 <secondary>expansion operator</secondary>
14447 </indexterm>
14448 <indexterm role="concept">
14449 <primary><option>rfc2047</option> expansion item</primary>
14450 </indexterm>
14451 This operator encodes text according to the rules of RFC 2047. This is an
14452 encoding that is used in header lines to encode non-ASCII characters. It is
14453 assumed that the input string is in the encoding specified by the
14454 <option>headers_charset</option> option, which defaults to ISO-8859-1. If the string
14455 contains only characters in the range 33&ndash;126, and no instances of the
14456 characters
14457 </para>
14458 <literallayout class="monospaced">
14459 ? = ( ) &lt; &gt; @ , ; : \ " . [ ] _
14460 </literallayout>
14461 <para>
14462 it is not modified. Otherwise, the result is the RFC 2047 encoding of the
14463 string, using as many <quote>encoded words</quote> as necessary to encode all the
14464 characters.
14465 </para>
14466 </listitem></varlistentry>
14467 <varlistentry>
14468 <term><emphasis role="bold">${rfc2047d:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14469 <listitem>
14470 <para>
14471 <indexterm role="concept">
14472 <primary>expansion</primary>
14473 <secondary>RFC 2047</secondary>
14474 </indexterm>
14475 <indexterm role="concept">
14476 <primary>RFC 2047</primary>
14477 <secondary>decoding</secondary>
14478 </indexterm>
14479 <indexterm role="concept">
14480 <primary><option>rfc2047d</option> expansion item</primary>
14481 </indexterm>
14482 This operator decodes strings that are encoded as per RFC 2047. Binary zero
14483 bytes are replaced by question marks. Characters are converted into the
14484 character set defined by <option>headers_charset</option>. Overlong RFC 2047 <quote>words</quote> are
14485 not recognized unless <option>check_rfc2047_length</option> is set false.
14486 </para>
14487 <para>
14488 <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
14489 access a header line, RFC 2047 decoding is done automatically. You do not need
14490 to use this operator as well.
14491 </para>
14492 </listitem></varlistentry>
14493 <varlistentry>
14494 <term><emphasis role="bold">${rxquote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14495 <listitem>
14496 <para>
14497 <indexterm role="concept">
14498 <primary>quoting</primary>
14499 <secondary>in regular expressions</secondary>
14500 </indexterm>
14501 <indexterm role="concept">
14502 <primary>regular expressions</primary>
14503 <secondary>quoting</secondary>
14504 </indexterm>
14505 <indexterm role="concept">
14506 <primary><option>rxquote</option> expansion item</primary>
14507 </indexterm>
14508 The <option>rxquote</option> operator inserts a backslash before any non-alphanumeric
14509 characters in its argument. This is useful when substituting the values of
14510 variables or headers inside regular expressions.
14511 </para>
14512 </listitem></varlistentry>
14513 <varlistentry>
14514 <term><emphasis role="bold">${sha1:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14515 <listitem>
14516 <para>
14517 <indexterm role="concept">
14518 <primary>SHA-1 hash</primary>
14519 </indexterm>
14520 <indexterm role="concept">
14521 <primary>expansion</primary>
14522 <secondary>SHA-1 hashing</secondary>
14523 </indexterm>
14524 <indexterm role="concept">
14525 <primary><option>sha2</option> expansion item</primary>
14526 </indexterm>
14527 The <option>sha1</option> operator computes the SHA-1 hash value of the string, and returns
14528 it as a 40-digit hexadecimal number, in which any letters are in upper case.
14529 </para>
14530 </listitem></varlistentry>
14531 <varlistentry>
14532 <term><emphasis role="bold">${stat:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14533 <listitem>
14534 <para>
14535 <indexterm role="concept">
14536 <primary>expansion</primary>
14537 <secondary>statting a file</secondary>
14538 </indexterm>
14539 <indexterm role="concept">
14540 <primary>file</primary>
14541 <secondary>extracting characteristics</secondary>
14542 </indexterm>
14543 <indexterm role="concept">
14544 <primary><option>stat</option> expansion item</primary>
14545 </indexterm>
14546 The string, after expansion, must be a file path. A call to the <function>stat()</function>
14547 function is made for this path. If <function>stat()</function> fails, an error occurs and the
14548 expansion fails. If it succeeds, the data from the stat replaces the item, as a
14549 series of &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt; pairs, where the values are all numerical,
14550 except for the value of <quote>smode</quote>. The names are: <quote>mode</quote> (giving the mode as
14551 a 4-digit octal number), <quote>smode</quote> (giving the mode in symbolic format as a
14552 10-character string, as for the <emphasis>ls</emphasis> command), <quote>inode</quote>, <quote>device</quote>,
14553 <quote>links</quote>, <quote>uid</quote>, <quote>gid</quote>, <quote>size</quote>, <quote>atime</quote>, <quote>mtime</quote>, and <quote>ctime</quote>. You
14554 can extract individual fields using the <option>extract</option> expansion item.
14555 </para>
14556 <para>
14557 The use of the <option>stat</option> expansion in users&#x2019; filter files can be locked out by
14558 the system administrator. <emphasis role="bold">Warning</emphasis>: The file size may be incorrect on 32-bit
14559 systems for files larger than 2GB.
14560 </para>
14561 </listitem></varlistentry>
14562 <varlistentry>
14563 <term><emphasis role="bold">${str2b64:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14564 <listitem>
14565 <para>
14566 <indexterm role="concept">
14567 <primary>expansion</primary>
14568 <secondary>base64 encoding</secondary>
14569 </indexterm>
14570 <indexterm role="concept">
14571 <primary>base64 encoding</primary>
14572 <secondary>in string expansion</secondary>
14573 </indexterm>
14574 <indexterm role="concept">
14575 <primary><option>str2b64</option> expansion item</primary>
14576 </indexterm>
14577 This operator converts a string into one that is base64 encoded.
14578 </para>
14579 </listitem></varlistentry>
14580 <varlistentry>
14581 <term><emphasis role="bold">${strlen:</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>string length</secondary>
14587 </indexterm>
14588 <indexterm role="concept">
14589 <primary>string</primary>
14590 <secondary>length in expansion</secondary>
14591 </indexterm>
14592 <indexterm role="concept">
14593 <primary><option>strlen</option> expansion item</primary>
14594 </indexterm>
14595 The item is replace by the length of the expanded string, expressed as a
14596 decimal number. <emphasis role="bold">Note</emphasis>: Do not confuse <option>strlen</option> with <option>length</option>.
14597 </para>
14598 </listitem></varlistentry>
14599 <varlistentry>
14600 <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>
14601 <listitem>
14602 <para>
14603 <indexterm role="concept">
14604 <primary><option>substr</option> expansion item</primary>
14605 </indexterm>
14606 <indexterm role="concept">
14607 <primary>substring extraction</primary>
14608 </indexterm>
14609 <indexterm role="concept">
14610 <primary>expansion</primary>
14611 <secondary>substring expansion</secondary>
14612 </indexterm>
14613 The <option>substr</option> operator is a simpler interface to the <option>substr</option> function that
14614 can be used when the two parameters are fixed numbers (as opposed to strings
14615 that change when expanded). The effect is the same as
14616 </para>
14617 <literallayout class="monospaced">
14618 ${substr{&lt;start&gt;}{&lt;length&gt;}{&lt;string&gt;}}
14619 </literallayout>
14620 <para>
14621 See the description of the general <option>substr</option> item above for details. The
14622 abbreviation <option>s</option> can be used when <option>substr</option> is used as an operator.
14623 </para>
14624 </listitem></varlistentry>
14625 <varlistentry>
14626 <term><emphasis role="bold">${time_eval:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14627 <listitem>
14628 <para>
14629 <indexterm role="concept">
14630 <primary><option>time_eval</option> expansion item</primary>
14631 </indexterm>
14632 <indexterm role="concept">
14633 <primary>time interval</primary>
14634 <secondary>decoding</secondary>
14635 </indexterm>
14636 This item converts an Exim time interval such as <literal>2d4h5m</literal> into a number of
14637 seconds.
14638 </para>
14639 </listitem></varlistentry>
14640 <varlistentry>
14641 <term><emphasis role="bold">${time_interval:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14642 <listitem>
14643 <para>
14644 <indexterm role="concept">
14645 <primary><option>time_interval</option> expansion item</primary>
14646 </indexterm>
14647 <indexterm role="concept">
14648 <primary>time interval</primary>
14649 <secondary>formatting</secondary>
14650 </indexterm>
14651 The argument (after sub-expansion) must be a sequence of decimal digits that
14652 represents an interval of time as a number of seconds. It is converted into a
14653 number of larger units and output in Exim&#x2019;s normal time format, for example,
14654 <literal>1w3d4h2m6s</literal>.
14655 </para>
14656 </listitem></varlistentry>
14657 <varlistentry>
14658 <term><emphasis role="bold">${uc:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14659 <listitem>
14660 <para>
14661 <indexterm role="concept">
14662 <primary>case forcing in strings</primary>
14663 </indexterm>
14664 <indexterm role="concept">
14665 <primary>string</primary>
14666 <secondary>case forcing</secondary>
14667 </indexterm>
14668 <indexterm role="concept">
14669 <primary>upper casing</primary>
14670 </indexterm>
14671 <indexterm role="concept">
14672 <primary>expansion</primary>
14673 <secondary>case forcing</secondary>
14674 </indexterm>
14675 <indexterm role="concept">
14676 <primary><option>uc</option> expansion item</primary>
14677 </indexterm>
14678 This forces the letters in the string into upper-case.
14679 </para>
14680 </listitem></varlistentry>
14681 </variablelist>
14682 </section>
14683 <section id="SECTexpcond">
14684 <title>Expansion conditions</title>
14685 <para>
14686 <indexterm role="concept" id="IIDexpcond" class="startofrange">
14687 <primary>expansion</primary>
14688 <secondary>conditions</secondary>
14689 </indexterm>
14690 The following conditions are available for testing by the <option>${if</option> construct
14691 while expanding strings:
14692 </para>
14693 <variablelist>
14694 <varlistentry>
14695 <term><emphasis role="bold">!</emphasis>&lt;<emphasis>condition</emphasis>&gt;</term>
14696 <listitem>
14697 <para>
14698 <indexterm role="concept">
14699 <primary>expansion</primary>
14700 <secondary>negating a condition</secondary>
14701 </indexterm>
14702 <indexterm role="concept">
14703 <primary>negation</primary>
14704 <secondary>in expansion condition</secondary>
14705 </indexterm>
14706 Preceding any condition with an exclamation mark negates the result of the
14707 condition.
14708 </para>
14709 </listitem></varlistentry>
14710 <varlistentry>
14711 <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>
14712 <listitem>
14713 <para>
14714 <indexterm role="concept">
14715 <primary>numeric comparison</primary>
14716 </indexterm>
14717 <indexterm role="concept">
14718 <primary>expansion</primary>
14719 <secondary>numeric comparison</secondary>
14720 </indexterm>
14721 There are a number of symbolic operators for doing numeric comparisons. They
14722 are:
14723 </para>
14724 <literallayout>
14725 <literal>=   </literal>   equal
14726 <literal>==  </literal>   equal
14727 <literal>&gt;   </literal>   greater
14728 <literal>&gt;=  </literal>   greater or equal
14729 <literal>&lt;   </literal>   less
14730 <literal>&lt;=  </literal>   less or equal
14731 </literallayout>
14732 <para>
14733 For example:
14734 </para>
14735 <literallayout class="monospaced">
14736 ${if &gt;{$message_size}{10M} ...
14737 </literallayout>
14738 <para>
14739 Note that the general negation operator provides for inequality testing. The
14740 two strings must take the form of optionally signed decimal integers,
14741 optionally followed by one of the letters <quote>K</quote> or <quote>M</quote> (in either upper or
14742 lower case), signifying multiplication by 1024 or 1024*1024, respectively.
14743 As a special case, the numerical value of an empty string is taken as
14744 zero.
14745 </para>
14746 </listitem></varlistentry>
14747 <varlistentry>
14748 <term><emphasis role="bold">bool&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14749 <listitem>
14750 <para>
14751 <indexterm role="concept">
14752 <primary>expansion</primary>
14753 <secondary>boolean parsing</secondary>
14754 </indexterm>
14755 <indexterm role="concept">
14756 <primary><option>bool</option> expansion condition</primary>
14757 </indexterm>
14758 This condition turns a string holding a true or false representation into
14759 a boolean state.  It parses <quote>true</quote>, <quote>false</quote>, <quote>yes</quote> and <quote>no</quote>
14760 (case-insensitively); also positive integer numbers map to true if non-zero,
14761 false if zero.  Leading whitespace is ignored.
14762 All other string values will result in expansion failure.
14763 </para>
14764 <para>
14765 When combined with ACL variables, this expansion condition will let you
14766 make decisions in one place and act on those decisions in another place.
14767 For example,
14768 </para>
14769 <literallayout class="monospaced">
14770 ${if bool{$acl_m_privileged_sender} ...
14771 </literallayout>
14772 </listitem></varlistentry>
14773 <varlistentry>
14774 <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>
14775 <listitem>
14776 <para>
14777 <indexterm role="concept">
14778 <primary>expansion</primary>
14779 <secondary>encrypted comparison</secondary>
14780 </indexterm>
14781 <indexterm role="concept">
14782 <primary>encrypted strings, comparing</primary>
14783 </indexterm>
14784 <indexterm role="concept">
14785 <primary><option>crypteq</option> expansion condition</primary>
14786 </indexterm>
14787 This condition is included in the Exim binary if it is built to support any
14788 authentication mechanisms (see chapter <xref linkend="CHAPSMTPAUTH"/>). Otherwise, it is
14789 necessary to define SUPPORT_CRYPTEQ in <filename>Local/Makefile</filename> to get <option>crypteq</option>
14790 included in the binary.
14791 </para>
14792 <para>
14793 The <option>crypteq</option> condition has two arguments. The first is encrypted and
14794 compared against the second, which is already encrypted. The second string may
14795 be in the LDAP form for storing encrypted strings, which starts with the
14796 encryption type in curly brackets, followed by the data. If the second string
14797 does not begin with <quote>{</quote> it is assumed to be encrypted with <function>crypt()</function> or
14798 <function>crypt16()</function> (see below), since such strings cannot begin with <quote>{</quote>.
14799 Typically this will be a field from a password file. An example of an encrypted
14800 string in LDAP form is:
14801 </para>
14802 <literallayout class="monospaced">
14803 {md5}CY9rzUYh03PK3k6DJie09g==
14804 </literallayout>
14805 <para>
14806 If such a string appears directly in an expansion, the curly brackets have to
14807 be quoted, because they are part of the expansion syntax. For example:
14808 </para>
14809 <literallayout class="monospaced">
14810 ${if crypteq {test}{\{md5\}CY9rzUYh03PK3k6DJie09g==}{yes}{no}}
14811 </literallayout>
14812 <para>
14813 The following encryption types (whose names are matched case-independently) are
14814 supported:
14815 </para>
14816 <itemizedlist>
14817 <listitem>
14818 <para>
14819 <indexterm role="concept">
14820 <primary>MD5 hash</primary>
14821 </indexterm>
14822 <indexterm role="concept">
14823 <primary>base64 encoding</primary>
14824 <secondary>in encrypted password</secondary>
14825 </indexterm>
14826 <option>{md5}</option> computes the MD5 digest of the first string, and expresses this as
14827 printable characters to compare with the remainder of the second string. If the
14828 length of the comparison string is 24, Exim assumes that it is base64 encoded
14829 (as in the above example). If the length is 32, Exim assumes that it is a
14830 hexadecimal encoding of the MD5 digest. If the length not 24 or 32, the
14831 comparison fails.
14832 </para>
14833 </listitem>
14834 <listitem>
14835 <para>
14836 <indexterm role="concept">
14837 <primary>SHA-1 hash</primary>
14838 </indexterm>
14839 <option>{sha1}</option> computes the SHA-1 digest of the first string, and expresses this as
14840 printable characters to compare with the remainder of the second string. If the
14841 length of the comparison string is 28, Exim assumes that it is base64 encoded.
14842 If the length is 40, Exim assumes that it is a hexadecimal encoding of the
14843 SHA-1 digest. If the length is not 28 or 40, the comparison fails.
14844 </para>
14845 </listitem>
14846 <listitem>
14847 <para>
14848 <indexterm role="concept">
14849 <primary><function>crypt()</function></primary>
14850 </indexterm>
14851 <option>{crypt}</option> calls the <function>crypt()</function> function, which traditionally used to use
14852 only the first eight characters of the password. However, in modern operating
14853 systems this is no longer true, and in many cases the entire password is used,
14854 whatever its length.
14855 </para>
14856 </listitem>
14857 <listitem>
14858 <para>
14859 <indexterm role="concept">
14860 <primary><function>crypt16()</function></primary>
14861 </indexterm>
14862 <option>{crypt16}</option> calls the <function>crypt16()</function> function, which was originally created to
14863 use up to 16 characters of the password in some operating systems. Again, in
14864 modern operating systems, more characters may be used.
14865 </para>
14866 </listitem>
14867 </itemizedlist>
14868 <para>
14869 Exim has its own version of <function>crypt16()</function>, which is just a double call to
14870 <function>crypt()</function>. For operating systems that have their own version, setting
14871 HAVE_CRYPT16 in <filename>Local/Makefile</filename> when building Exim causes it to use the
14872 operating system version instead of its own. This option is set by default in
14873 the OS-dependent <filename>Makefile</filename> for those operating systems that are known to
14874 support <function>crypt16()</function>.
14875 </para>
14876 <para>
14877 Some years after Exim&#x2019;s <function>crypt16()</function> was implemented, a user discovered that
14878 it was not using the same algorithm as some operating systems&#x2019; versions. It
14879 turns out that as well as <function>crypt16()</function> there is a function called
14880 <function>bigcrypt()</function> in some operating systems. This may or may not use the same
14881 algorithm, and both of them may be different to Exim&#x2019;s built-in <function>crypt16()</function>.
14882 </para>
14883 <para>
14884 However, since there is now a move away from the traditional <function>crypt()</function>
14885 functions towards using SHA1 and other algorithms, tidying up this area of
14886 Exim is seen as very low priority.
14887 </para>
14888 <para>
14889 If you do not put a encryption type (in curly brackets) in a <option>crypteq</option>
14890 comparison, the default is usually either <literal>{crypt}</literal> or <literal>{crypt16}</literal>, as
14891 determined by the setting of DEFAULT_CRYPT in <filename>Local/Makefile</filename>. The default
14892 default is <literal>{crypt}</literal>. Whatever the default, you can always use either
14893 function by specifying it explicitly in curly brackets.
14894 </para>
14895 </listitem></varlistentry>
14896 <varlistentry>
14897 <term><emphasis role="bold">def:</emphasis>&lt;<emphasis>variable&nbsp;name</emphasis>&gt;</term>
14898 <listitem>
14899 <para>
14900 <indexterm role="concept">
14901 <primary>expansion</primary>
14902 <secondary>checking for empty variable</secondary>
14903 </indexterm>
14904 <indexterm role="concept">
14905 <primary><option>def</option> expansion condition</primary>
14906 </indexterm>
14907 The <option>def</option> condition must be followed by the name of one of the expansion
14908 variables defined in section <xref linkend="SECTexpvar"/>. The condition is true if the
14909 variable does not contain the empty string. For example:
14910 </para>
14911 <literallayout class="monospaced">
14912 ${if def:sender_ident {from $sender_ident}}
14913 </literallayout>
14914 <para>
14915 Note that the variable name is given without a leading <option>$</option> character. If the
14916 variable does not exist, the expansion fails.
14917 </para>
14918 </listitem></varlistentry>
14919 <varlistentry>
14920 <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>
14921 <listitem>
14922 <para>
14923 <indexterm role="concept">
14924 <primary>expansion</primary>
14925 <secondary>checking header line existence</secondary>
14926 </indexterm>
14927 This condition is true if a message is being processed and the named header
14928 exists in the message. For example,
14929 </para>
14930 <literallayout class="monospaced">
14931 ${if def:header_reply-to:{$h_reply-to:}{$h_from:}}
14932 </literallayout>
14933 <para>
14934 <emphasis role="bold">Note</emphasis>: No <option>$</option> appears before <option>header_</option> or <option>h_</option> in the condition, and
14935 the header name must be terminated by a colon if white space does not follow.
14936 </para>
14937 </listitem></varlistentry>
14938 <varlistentry>
14939 <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>
14940 <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>
14941 <listitem>
14942 <para>
14943 <indexterm role="concept">
14944 <primary>string</primary>
14945 <secondary>comparison</secondary>
14946 </indexterm>
14947 <indexterm role="concept">
14948 <primary>expansion</primary>
14949 <secondary>string comparison</secondary>
14950 </indexterm>
14951 <indexterm role="concept">
14952 <primary><option>eq</option> expansion condition</primary>
14953 </indexterm>
14954 <indexterm role="concept">
14955 <primary><option>eqi</option> expansion condition</primary>
14956 </indexterm>
14957 The two substrings are first expanded. The condition is true if the two
14958 resulting strings are identical. For <option>eq</option> the comparison includes the case of
14959 letters, whereas for <option>eqi</option> the comparison is case-independent.
14960 </para>
14961 </listitem></varlistentry>
14962 <varlistentry>
14963 <term><emphasis role="bold">exists&nbsp;{</emphasis>&lt;<emphasis>file&nbsp;name</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14964 <listitem>
14965 <para>
14966 <indexterm role="concept">
14967 <primary>expansion</primary>
14968 <secondary>file existence test</secondary>
14969 </indexterm>
14970 <indexterm role="concept">
14971 <primary>file</primary>
14972 <secondary>existence test</secondary>
14973 </indexterm>
14974 <indexterm role="concept">
14975 <primary><option>exists</option>, expansion condition</primary>
14976 </indexterm>
14977 The substring is first expanded and then interpreted as an absolute path. The
14978 condition is true if the named file (or directory) exists. The existence test
14979 is done by calling the <function>stat()</function> function. The use of the <option>exists</option> test in
14980 users&#x2019; filter files may be locked out by the system administrator.
14981 </para>
14982 </listitem></varlistentry>
14983 <varlistentry>
14984 <term><emphasis role="bold">first_delivery</emphasis></term>
14985 <listitem>
14986 <para>
14987 <indexterm role="concept">
14988 <primary>delivery</primary>
14989 <secondary>first</secondary>
14990 </indexterm>
14991 <indexterm role="concept">
14992 <primary>first delivery</primary>
14993 </indexterm>
14994 <indexterm role="concept">
14995 <primary>expansion</primary>
14996 <secondary>first delivery test</secondary>
14997 </indexterm>
14998 <indexterm role="concept">
14999 <primary><option>first_delivery</option> expansion condition</primary>
15000 </indexterm>
15001 This condition, which has no data, is true during a message&#x2019;s first delivery
15002 attempt. It is false during any subsequent delivery attempts.
15003 </para>
15004 </listitem></varlistentry>
15005 <varlistentry>
15006 <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>
15007 <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>
15008 <listitem>
15009 <para>
15010 <indexterm role="concept">
15011 <primary>list</primary>
15012 <secondary>iterative conditions</secondary>
15013 </indexterm>
15014 <indexterm role="concept">
15015 <primary>expansion</primary>
15016 <secondary><emphasis role="bold">forall</emphasis> condition</secondary>
15017 </indexterm>
15018 <indexterm role="concept">
15019 <primary>expansion</primary>
15020 <secondary><emphasis role="bold">forany</emphasis> condition</secondary>
15021 </indexterm>
15022 <indexterm role="variable">
15023 <primary><varname>$item</varname></primary>
15024 </indexterm>
15025 These conditions iterate over a list. The first argument is expanded to form
15026 the list. By default, the list separator is a colon, but it can be changed by
15027 the normal method. The second argument is interpreted as a condition that is to
15028 be applied to each item in the list in turn. During the interpretation of the
15029 condition, the current list item is placed in a variable called <varname>$item</varname>.
15030 </para>
15031 <itemizedlist>
15032 <listitem>
15033 <para>
15034 For <emphasis role="bold">forany</emphasis>, interpretation stops if the condition is true for any item, and
15035 the result of the whole condition is true. If the condition is false for all
15036 items in the list, the overall condition is false.
15037 </para>
15038 </listitem>
15039 <listitem>
15040 <para>
15041 For <emphasis role="bold">forall</emphasis>, interpretation stops if the condition is false for any item,
15042 and the result of the whole condition is false. If the condition is true for
15043 all items in the list, the overall condition is true.
15044 </para>
15045 </listitem>
15046 </itemizedlist>
15047 <para>
15048 Note that negation of <emphasis role="bold">forany</emphasis> means that the condition must be false for all
15049 items for the overall condition to succeed, and negation of <emphasis role="bold">forall</emphasis> means
15050 that the condition must be false for at least one item. In this example, the
15051 list separator is changed to a comma:
15052 </para>
15053 <literallayout class="monospaced">
15054 ${if forany{&lt;, $recipients}{match{$item}{^user3@}}{yes}{no}}
15055 </literallayout>
15056 <para>
15057 The value of <varname>$item</varname> is saved and restored while <emphasis role="bold">forany</emphasis> or <emphasis role="bold">forall</emphasis> is
15058 being processed, to enable these expansion items to be nested.
15059 </para>
15060 </listitem></varlistentry>
15061 <varlistentry>
15062 <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>
15063 <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>
15064 <listitem>
15065 <para>
15066 <indexterm role="concept">
15067 <primary>string</primary>
15068 <secondary>comparison</secondary>
15069 </indexterm>
15070 <indexterm role="concept">
15071 <primary>expansion</primary>
15072 <secondary>string comparison</secondary>
15073 </indexterm>
15074 <indexterm role="concept">
15075 <primary><option>ge</option> expansion condition</primary>
15076 </indexterm>
15077 <indexterm role="concept">
15078 <primary><option>gei</option> expansion condition</primary>
15079 </indexterm>
15080 The two substrings are first expanded. The condition is true if the first
15081 string is lexically greater than or equal to the second string. For <option>ge</option> the
15082 comparison includes the case of letters, whereas for <option>gei</option> the comparison is
15083 case-independent.
15084 </para>
15085 </listitem></varlistentry>
15086 <varlistentry>
15087 <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>
15088 <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>
15089 <listitem>
15090 <para>
15091 <indexterm role="concept">
15092 <primary>string</primary>
15093 <secondary>comparison</secondary>
15094 </indexterm>
15095 <indexterm role="concept">
15096 <primary>expansion</primary>
15097 <secondary>string comparison</secondary>
15098 </indexterm>
15099 <indexterm role="concept">
15100 <primary><option>gt</option> expansion condition</primary>
15101 </indexterm>
15102 <indexterm role="concept">
15103 <primary><option>gti</option> expansion condition</primary>
15104 </indexterm>
15105 The two substrings are first expanded. The condition is true if the first
15106 string is lexically greater than the second string. For <option>gt</option> the comparison
15107 includes the case of letters, whereas for <option>gti</option> the comparison is
15108 case-independent.
15109 </para>
15110 </listitem></varlistentry>
15111 <varlistentry>
15112 <term><emphasis role="bold">isip&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15113 <term><emphasis role="bold">isip4&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15114 <term><emphasis role="bold">isip6&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15115 <listitem>
15116 <para>
15117 <indexterm role="concept">
15118 <primary>IP address</primary>
15119 <secondary>testing string format</secondary>
15120 </indexterm>
15121 <indexterm role="concept">
15122 <primary>string</primary>
15123 <secondary>testing for IP address</secondary>
15124 </indexterm>
15125 <indexterm role="concept">
15126 <primary><option>isip</option> expansion condition</primary>
15127 </indexterm>
15128 <indexterm role="concept">
15129 <primary><option>isip4</option> expansion condition</primary>
15130 </indexterm>
15131 <indexterm role="concept">
15132 <primary><option>isip6</option> expansion condition</primary>
15133 </indexterm>
15134 The substring is first expanded, and then tested to see if it has the form of
15135 an IP address. Both IPv4 and IPv6 addresses are valid for <option>isip</option>, whereas
15136 <option>isip4</option> and <option>isip6</option> test specifically for IPv4 or IPv6 addresses.
15137 </para>
15138 <para>
15139 For an IPv4 address, the test is for four dot-separated components, each of
15140 which consists of from one to three digits. For an IPv6 address, up to eight
15141 colon-separated components are permitted, each containing from one to four
15142 hexadecimal digits. There may be fewer than eight components if an empty
15143 component (adjacent colons) is present. Only one empty component is permitted.
15144 </para>
15145 <para>
15146 <emphasis role="bold">Note</emphasis>: The checks are just on the form of the address; actual numerical
15147 values are not considered. Thus, for example, 999.999.999.999 passes the IPv4
15148 check. The main use of these tests is to distinguish between IP addresses and
15149 host names, or between IPv4 and IPv6 addresses. For example, you could use
15150 </para>
15151 <literallayout class="monospaced">
15152 ${if isip4{$sender_host_address}...
15153 </literallayout>
15154 <para>
15155 to test which IP version an incoming SMTP connection is using.
15156 </para>
15157 </listitem></varlistentry>
15158 <varlistentry>
15159 <term><emphasis role="bold">ldapauth&nbsp;{</emphasis>&lt;<emphasis>ldap&nbsp;query</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15160 <listitem>
15161 <para>
15162 <indexterm role="concept">
15163 <primary>LDAP</primary>
15164 <secondary>use for authentication</secondary>
15165 </indexterm>
15166 <indexterm role="concept">
15167 <primary>expansion</primary>
15168 <secondary>LDAP authentication test</secondary>
15169 </indexterm>
15170 <indexterm role="concept">
15171 <primary><option>ldapauth</option> expansion condition</primary>
15172 </indexterm>
15173 This condition supports user authentication using LDAP. See section
15174 <xref linkend="SECTldap"/> for details of how to use LDAP in lookups and the syntax of
15175 queries. For this use, the query must contain a user name and password. The
15176 query itself is not used, and can be empty. The condition is true if the
15177 password is not empty, and the user name and password are accepted by the LDAP
15178 server. An empty password is rejected without calling LDAP because LDAP binds
15179 with an empty password are considered anonymous regardless of the username, and
15180 will succeed in most configurations. See chapter <xref linkend="CHAPSMTPAUTH"/> for details
15181 of SMTP authentication, and chapter <xref linkend="CHAPplaintext"/> for an example of how
15182 this can be used.
15183 </para>
15184 </listitem></varlistentry>
15185 <varlistentry>
15186 <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>
15187 <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>
15188 <listitem>
15189 <para>
15190 <indexterm role="concept">
15191 <primary>string</primary>
15192 <secondary>comparison</secondary>
15193 </indexterm>
15194 <indexterm role="concept">
15195 <primary>expansion</primary>
15196 <secondary>string comparison</secondary>
15197 </indexterm>
15198 <indexterm role="concept">
15199 <primary><option>le</option> expansion condition</primary>
15200 </indexterm>
15201 <indexterm role="concept">
15202 <primary><option>lei</option> expansion condition</primary>
15203 </indexterm>
15204 The two substrings are first expanded. The condition is true if the first
15205 string is lexically less than or equal to the second string. For <option>le</option> the
15206 comparison includes the case of letters, whereas for <option>lei</option> the comparison is
15207 case-independent.
15208 </para>
15209 </listitem></varlistentry>
15210 <varlistentry>
15211 <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>
15212 <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>
15213 <listitem>
15214 <para>
15215 <indexterm role="concept">
15216 <primary>string</primary>
15217 <secondary>comparison</secondary>
15218 </indexterm>
15219 <indexterm role="concept">
15220 <primary>expansion</primary>
15221 <secondary>string comparison</secondary>
15222 </indexterm>
15223 <indexterm role="concept">
15224 <primary><option>lt</option> expansion condition</primary>
15225 </indexterm>
15226 <indexterm role="concept">
15227 <primary><option>lti</option> expansion condition</primary>
15228 </indexterm>
15229 The two substrings are first expanded. The condition is true if the first
15230 string is lexically less than the second string. For <option>lt</option> the comparison
15231 includes the case of letters, whereas for <option>lti</option> the comparison is
15232 case-independent.
15233 </para>
15234 </listitem></varlistentry>
15235 <varlistentry>
15236 <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>
15237 <listitem>
15238 <para>
15239 <indexterm role="concept">
15240 <primary>expansion</primary>
15241 <secondary>regular expression comparison</secondary>
15242 </indexterm>
15243 <indexterm role="concept">
15244 <primary>regular expressions</primary>
15245 <secondary>match in expanded string</secondary>
15246 </indexterm>
15247 <indexterm role="concept">
15248 <primary><option>match</option> expansion condition</primary>
15249 </indexterm>
15250 The two substrings are first expanded. The second is then treated as a regular
15251 expression and applied to the first. Because of the pre-expansion, if the
15252 regular expression contains dollar, or backslash characters, they must be
15253 escaped. Care must also be taken if the regular expression contains braces
15254 (curly brackets). A closing brace must be escaped so that it is not taken as a
15255 premature termination of &lt;<emphasis>string2</emphasis>&gt;. The easiest approach is to use the
15256 <literal>\N</literal> feature to disable expansion of the regular expression.
15257 For example,
15258 </para>
15259 <literallayout class="monospaced">
15260 ${if match {$local_part}{\N^\d{3}\N} ...
15261 </literallayout>
15262 <para>
15263 If the whole expansion string is in double quotes, further escaping of
15264 backslashes is also required.
15265 </para>
15266 <para>
15267 The condition is true if the regular expression match succeeds.
15268 The regular expression is not required to begin with a circumflex
15269 metacharacter, but if there is no circumflex, the expression is not anchored,
15270 and it may match anywhere in the subject, not just at the start. If you want
15271 the pattern to match at the end of the subject, you must include the <literal>$</literal>
15272 metacharacter at an appropriate point.
15273 </para>
15274 <para>
15275 <indexterm role="concept">
15276 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
15277 <secondary>in <option>if</option> expansion</secondary>
15278 </indexterm>
15279 At the start of an <option>if</option> expansion the values of the numeric variable
15280 substitutions <varname>$1</varname> etc. are remembered. Obeying a <option>match</option> condition that
15281 succeeds causes them to be reset to the substrings of that condition and they
15282 will have these values during the expansion of the success string. At the end
15283 of the <option>if</option> expansion, the previous values are restored. After testing a
15284 combination of conditions using <option>or</option>, the subsequent values of the numeric
15285 variables are those of the condition that succeeded.
15286 </para>
15287 </listitem></varlistentry>
15288 <varlistentry>
15289 <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>
15290 <listitem>
15291 <para>
15292 <indexterm role="concept">
15293 <primary><option>match_address</option> expansion condition</primary>
15294 </indexterm>
15295 See <emphasis role="bold">match_local_part</emphasis>.
15296 </para>
15297 </listitem></varlistentry>
15298 <varlistentry>
15299 <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>
15300 <listitem>
15301 <para>
15302 <indexterm role="concept">
15303 <primary><option>match_domain</option> expansion condition</primary>
15304 </indexterm>
15305 See <emphasis role="bold">match_local_part</emphasis>.
15306 </para>
15307 </listitem></varlistentry>
15308 <varlistentry>
15309 <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>
15310 <listitem>
15311 <para>
15312 <indexterm role="concept">
15313 <primary><option>match_ip</option> expansion condition</primary>
15314 </indexterm>
15315 This condition matches an IP address to a list of IP address patterns. It must
15316 be followed by two argument strings. The first (after expansion) must be an IP
15317 address or an empty string. The second (after expansion) is a restricted host
15318 list that can match only an IP address, not a host name. For example:
15319 </para>
15320 <literallayout class="monospaced">
15321 ${if match_ip{$sender_host_address}{1.2.3.4:5.6.7.8}{...}{...}}
15322 </literallayout>
15323 <para>
15324 The specific types of host list item that are permitted in the list are:
15325 </para>
15326 <itemizedlist>
15327 <listitem>
15328 <para>
15329 An IP address, optionally with a CIDR mask.
15330 </para>
15331 </listitem>
15332 <listitem>
15333 <para>
15334 A single asterisk, which matches any IP address.
15335 </para>
15336 </listitem>
15337 <listitem>
15338 <para>
15339 An empty item, which matches only if the IP address is empty. This could be
15340 useful for testing for a locally submitted message or one from specific hosts
15341 in a single test such as
15342 </para>
15343 <literallayout class="monospaced">
15344   ${if match_ip{$sender_host_address}{:4.3.2.1:...}{...}{...}}
15345 </literallayout>
15346 <para>
15347 where the first item in the list is the empty string.
15348 </para>
15349 </listitem>
15350 <listitem>
15351 <para>
15352 The item @[] matches any of the local host&#x2019;s interface addresses.
15353 </para>
15354 </listitem>
15355 <listitem>
15356 <para>
15357 Single-key lookups are assumed to be like <quote>net-</quote> style lookups in host lists,
15358 even if <literal>net-</literal> is not specified. There is never any attempt to turn the IP
15359 address into a host name. The most common type of linear search for
15360 <emphasis role="bold">match_ip</emphasis> is likely to be <emphasis role="bold">iplsearch</emphasis>, in which the file can contain CIDR
15361 masks. For example:
15362 </para>
15363 <literallayout class="monospaced">
15364   ${if match_ip{$sender_host_address}{iplsearch;/some/file}...
15365 </literallayout>
15366 <para>
15367 It is of course possible to use other kinds of lookup, and in such a case, you
15368 do need to specify the <literal>net-</literal> prefix if you want to specify a specific
15369 address mask, for example:
15370 </para>
15371 <literallayout class="monospaced">
15372   ${if match_ip{$sender_host_address}{net24-dbm;/some/file}...
15373 </literallayout>
15374 <para>
15375 However, unless you are combining a <option>match_ip</option> condition with others, it is
15376 just as easy to use the fact that a lookup is itself a condition, and write:
15377 </para>
15378 <literallayout class="monospaced">
15379   ${lookup{${mask:$sender_host_address/24}}dbm{/a/file}...
15380 </literallayout>
15381 </listitem>
15382 </itemizedlist>
15383 <para>
15384 Consult section <xref linkend="SECThoslispatip"/> for further details of these patterns.
15385 </para>
15386 </listitem></varlistentry>
15387 <varlistentry>
15388 <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>
15389 <listitem>
15390 <para>
15391 <indexterm role="concept">
15392 <primary>domain list</primary>
15393 <secondary>in expansion condition</secondary>
15394 </indexterm>
15395 <indexterm role="concept">
15396 <primary>address list</primary>
15397 <secondary>in expansion condition</secondary>
15398 </indexterm>
15399 <indexterm role="concept">
15400 <primary>local part</primary>
15401 <secondary>list, in expansion condition</secondary>
15402 </indexterm>
15403 <indexterm role="concept">
15404 <primary><option>match_local_part</option> expansion condition</primary>
15405 </indexterm>
15406 This condition, together with <option>match_address</option> and <option>match_domain</option>, make it
15407 possible to test domain, address, and local part lists within expansions. Each
15408 condition requires two arguments: an item and a list to match. A trivial
15409 example is:
15410 </para>
15411 <literallayout class="monospaced">
15412 ${if match_domain{a.b.c}{x.y.z:a.b.c:p.q.r}{yes}{no}}
15413 </literallayout>
15414 <para>
15415 In each case, the second argument may contain any of the allowable items for a
15416 list of the appropriate type. Also, because the second argument (after
15417 expansion) is a standard form of list, it is possible to refer to a named list.
15418 Thus, you can use conditions like this:
15419 </para>
15420 <literallayout class="monospaced">
15421 ${if match_domain{$domain}{+local_domains}{...
15422 </literallayout>
15423 <para>
15424 <indexterm role="concept">
15425 <primary><literal>+caseful</literal></primary>
15426 </indexterm>
15427 For address lists, the matching starts off caselessly, but the <literal>+caseful</literal>
15428 item can be used, as in all address lists, to cause subsequent items to
15429 have their local parts matched casefully. Domains are always matched
15430 caselessly.
15431 </para>
15432 <para>
15433 <emphasis role="bold">Note</emphasis>: Host lists are <emphasis>not</emphasis> supported in this way. This is because
15434 hosts have two identities: a name and an IP address, and it is not clear
15435 how to specify cleanly how such a test would work. However, IP addresses can be
15436 matched using <option>match_ip</option>.
15437 </para>
15438 </listitem></varlistentry>
15439 <varlistentry>
15440 <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>
15441 <listitem>
15442 <para>
15443 <indexterm role="concept">
15444 <primary>PAM authentication</primary>
15445 </indexterm>
15446 <indexterm role="concept">
15447 <primary>AUTH</primary>
15448 <secondary>with PAM</secondary>
15449 </indexterm>
15450 <indexterm role="concept">
15451 <primary>Solaris</primary>
15452 <secondary>PAM support</secondary>
15453 </indexterm>
15454 <indexterm role="concept">
15455 <primary>expansion</primary>
15456 <secondary>PAM authentication test</secondary>
15457 </indexterm>
15458 <indexterm role="concept">
15459 <primary><option>pam</option> expansion condition</primary>
15460 </indexterm>
15461 <emphasis>Pluggable Authentication Modules</emphasis>
15462 (<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
15463 available in the latest releases of Solaris and in some GNU/Linux
15464 distributions. The Exim support, which is intended for use in conjunction with
15465 the SMTP AUTH command, is available only if Exim is compiled with
15466 </para>
15467 <literallayout class="monospaced">
15468 SUPPORT_PAM=yes
15469 </literallayout>
15470 <para>
15471 in <filename>Local/Makefile</filename>. You probably need to add <option>-lpam</option> to EXTRALIBS, and
15472 in some releases of GNU/Linux <option>-ldl</option> is also needed.
15473 </para>
15474 <para>
15475 The argument string is first expanded, and the result must be a
15476 colon-separated list of strings. Leading and trailing white space is ignored.
15477 The PAM module is initialized with the service name <quote>exim</quote> and the user name
15478 taken from the first item in the colon-separated data string (&lt;<emphasis>string1</emphasis>&gt;).
15479 The remaining items in the data string are passed over in response to requests
15480 from the authentication function. In the simple case there will only be one
15481 request, for a password, so the data consists of just two strings.
15482 </para>
15483 <para>
15484 There can be problems if any of the strings are permitted to contain colon
15485 characters. In the usual way, these have to be doubled to avoid being taken as
15486 separators. If the data is being inserted from a variable, the <option>sg</option> expansion
15487 item can be used to double any existing colons. For example, the configuration
15488 of a LOGIN authenticator might contain this setting:
15489 </para>
15490 <literallayout class="monospaced">
15491 server_condition = ${if pam{$auth1:${sg{$auth2}{:}{::}}}}
15492 </literallayout>
15493 <para>
15494 For a PLAIN authenticator you could use:
15495 </para>
15496 <literallayout class="monospaced">
15497 server_condition = ${if pam{$auth2:${sg{$auth3}{:}{::}}}}
15498 </literallayout>
15499 <para>
15500 In some operating systems, PAM authentication can be done only from a process
15501 running as root. Since Exim is running as the Exim user when receiving
15502 messages, this means that PAM cannot be used directly in those systems.
15503 A patched version of the <emphasis>pam_unix</emphasis> module that comes with the
15504 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>.
15505 The patched module allows one special uid/gid combination, in addition to root,
15506 to authenticate. If you build the patched module to allow the Exim user and
15507 group, PAM can then be used from an Exim authenticator.
15508 </para>
15509 </listitem></varlistentry>
15510 <varlistentry>
15511 <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>
15512 <listitem>
15513 <para>
15514 <indexterm role="concept">
15515 <primary><emphasis>pwcheck</emphasis> daemon</primary>
15516 </indexterm>
15517 <indexterm role="concept">
15518 <primary>Cyrus</primary>
15519 </indexterm>
15520 <indexterm role="concept">
15521 <primary>expansion</primary>
15522 <secondary><emphasis>pwcheck</emphasis> authentication test</secondary>
15523 </indexterm>
15524 <indexterm role="concept">
15525 <primary><option>pwcheck</option> expansion condition</primary>
15526 </indexterm>
15527 This condition supports user authentication using the Cyrus <emphasis>pwcheck</emphasis> daemon.
15528 This is one way of making it possible for passwords to be checked by a process
15529 that is not running as root. <emphasis role="bold">Note</emphasis>: The use of <emphasis>pwcheck</emphasis> is now
15530 deprecated. Its replacement is <emphasis>saslauthd</emphasis> (see below).
15531 </para>
15532 <para>
15533 The pwcheck support is not included in Exim by default. You need to specify
15534 the location of the pwcheck daemon&#x2019;s socket in <filename>Local/Makefile</filename> before
15535 building Exim. For example:
15536 </para>
15537 <literallayout class="monospaced">
15538 CYRUS_PWCHECK_SOCKET=/var/pwcheck/pwcheck
15539 </literallayout>
15540 <para>
15541 You do not need to install the full Cyrus software suite in order to use
15542 the pwcheck daemon. You can compile and install just the daemon alone
15543 from the Cyrus SASL library. Ensure that <emphasis>exim</emphasis> is the only user that has
15544 access to the <filename>/var/pwcheck</filename> directory.
15545 </para>
15546 <para>
15547 The <option>pwcheck</option> condition takes one argument, which must be the user name and
15548 password, separated by a colon. For example, in a LOGIN authenticator
15549 configuration, you might have this:
15550 </para>
15551 <literallayout class="monospaced">
15552 server_condition = ${if pwcheck{$auth1:$auth2}}
15553 </literallayout>
15554 <para>
15555 Again, for a PLAIN authenticator configuration, this would be:
15556 </para>
15557 <literallayout class="monospaced">
15558 server_condition = ${if pwcheck{$auth2:$auth3}}
15559 </literallayout>
15560 </listitem></varlistentry>
15561 <varlistentry>
15562 <term><emphasis role="bold">queue_running</emphasis></term>
15563 <listitem>
15564 <para>
15565 <indexterm role="concept">
15566 <primary>queue runner</primary>
15567 <secondary>detecting when delivering from</secondary>
15568 </indexterm>
15569 <indexterm role="concept">
15570 <primary>expansion</primary>
15571 <secondary>queue runner test</secondary>
15572 </indexterm>
15573 <indexterm role="concept">
15574 <primary><option>queue_running</option> expansion condition</primary>
15575 </indexterm>
15576 This condition, which has no data, is true during delivery attempts that are
15577 initiated by queue runner processes, and false otherwise.
15578 </para>
15579 </listitem></varlistentry>
15580 <varlistentry>
15581 <term><emphasis role="bold">radius&nbsp;{</emphasis>&lt;<emphasis>authentication&nbsp;string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15582 <listitem>
15583 <para>
15584 <indexterm role="concept">
15585 <primary>Radius</primary>
15586 </indexterm>
15587 <indexterm role="concept">
15588 <primary>expansion</primary>
15589 <secondary>Radius authentication</secondary>
15590 </indexterm>
15591 <indexterm role="concept">
15592 <primary><option>radius</option> expansion condition</primary>
15593 </indexterm>
15594 Radius authentication (RFC 2865) is supported in a similar way to PAM. You must
15595 set RADIUS_CONFIG_FILE in <filename>Local/Makefile</filename> to specify the location of
15596 the Radius client configuration file in order to build Exim with Radius
15597 support.
15598 </para>
15599 <para>
15600 With just that one setting, Exim expects to be linked with the <option>radiusclient</option>
15601 library, using the original API. If you are using release 0.4.0 or later of
15602 this library, you need to set
15603 </para>
15604 <literallayout class="monospaced">
15605 RADIUS_LIB_TYPE=RADIUSCLIENTNEW
15606 </literallayout>
15607 <para>
15608 in <filename>Local/Makefile</filename> when building Exim. You can also link Exim with the
15609 <option>libradius</option> library that comes with FreeBSD. To do this, set
15610 </para>
15611 <literallayout class="monospaced">
15612 RADIUS_LIB_TYPE=RADLIB
15613 </literallayout>
15614 <para>
15615 in <filename>Local/Makefile</filename>, in addition to setting RADIUS_CONFIGURE_FILE.
15616 You may also have to supply a suitable setting in EXTRALIBS so that the
15617 Radius library can be found when Exim is linked.
15618 </para>
15619 <para>
15620 The string specified by RADIUS_CONFIG_FILE is expanded and passed to the
15621 Radius client library, which calls the Radius server. The condition is true if
15622 the authentication is successful. For example:
15623 </para>
15624 <literallayout class="monospaced">
15625 server_condition = ${if radius{&lt;arguments&gt;}}
15626 </literallayout>
15627 </listitem></varlistentry>
15628 <varlistentry>
15629 <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>
15630 <listitem>
15631 <para>
15632 <indexterm role="concept">
15633 <primary><emphasis>saslauthd</emphasis> daemon</primary>
15634 </indexterm>
15635 <indexterm role="concept">
15636 <primary>Cyrus</primary>
15637 </indexterm>
15638 <indexterm role="concept">
15639 <primary>expansion</primary>
15640 <secondary><emphasis>saslauthd</emphasis> authentication test</secondary>
15641 </indexterm>
15642 <indexterm role="concept">
15643 <primary><option>saslauthd</option> expansion condition</primary>
15644 </indexterm>
15645 This condition supports user authentication using the Cyrus <emphasis>saslauthd</emphasis>
15646 daemon. This replaces the older <emphasis>pwcheck</emphasis> daemon, which is now deprecated.
15647 Using this daemon is one way of making it possible for passwords to be checked
15648 by a process that is not running as root.
15649 </para>
15650 <para>
15651 The saslauthd support is not included in Exim by default. You need to specify
15652 the location of the saslauthd daemon&#x2019;s socket in <filename>Local/Makefile</filename> before
15653 building Exim. For example:
15654 </para>
15655 <literallayout class="monospaced">
15656 CYRUS_SASLAUTHD_SOCKET=/var/state/saslauthd/mux
15657 </literallayout>
15658 <para>
15659 You do not need to install the full Cyrus software suite in order to use
15660 the saslauthd daemon. You can compile and install just the daemon alone
15661 from the Cyrus SASL library.
15662 </para>
15663 <para>
15664 Up to four arguments can be supplied to the <option>saslauthd</option> condition, but only
15665 two are mandatory. For example:
15666 </para>
15667 <literallayout class="monospaced">
15668 server_condition = ${if saslauthd{{$auth1}{$auth2}}}
15669 </literallayout>
15670 <para>
15671 The service and the realm are optional (which is why the arguments are enclosed
15672 in their own set of braces). For details of the meaning of the service and
15673 realm, and how to run the daemon, consult the Cyrus documentation.
15674 </para>
15675 </listitem></varlistentry>
15676 </variablelist>
15677 </section>
15678 <section id="SECID84">
15679 <title>Combining expansion conditions</title>
15680 <para>
15681 <indexterm role="concept">
15682 <primary>expansion</primary>
15683 <secondary>combining conditions</secondary>
15684 </indexterm>
15685 Several conditions can be tested at once by combining them using the <option>and</option>
15686 and <option>or</option> combination conditions. Note that <option>and</option> and <option>or</option> are complete
15687 conditions on their own, and precede their lists of sub-conditions. Each
15688 sub-condition must be enclosed in braces within the overall braces that contain
15689 the list. No repetition of <option>if</option> is used.
15690 </para>
15691 <variablelist>
15692 <varlistentry>
15693 <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>
15694 <listitem>
15695 <para>
15696 <indexterm role="concept">
15697 <primary><quote>or</quote> expansion condition</primary>
15698 </indexterm>
15699 <indexterm role="concept">
15700 <primary>expansion</primary>
15701 <secondary><quote>or</quote> of conditions</secondary>
15702 </indexterm>
15703 The sub-conditions are evaluated from left to right. The condition is true if
15704 any one of the sub-conditions is true.
15705 For example,
15706 </para>
15707 <literallayout class="monospaced">
15708 ${if or {{eq{$local_part}{spqr}}{eq{$domain}{testing.com}}}...
15709 </literallayout>
15710 <para>
15711 When a true sub-condition is found, the following ones are parsed but not
15712 evaluated. If there are several <quote>match</quote> sub-conditions the values of the
15713 numeric variables afterwards are taken from the first one that succeeds.
15714 </para>
15715 </listitem></varlistentry>
15716 <varlistentry>
15717 <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>
15718 <listitem>
15719 <para>
15720 <indexterm role="concept">
15721 <primary><quote>and</quote> expansion condition</primary>
15722 </indexterm>
15723 <indexterm role="concept">
15724 <primary>expansion</primary>
15725 <secondary><quote>and</quote> of conditions</secondary>
15726 </indexterm>
15727 The sub-conditions are evaluated from left to right. The condition is true if
15728 all of the sub-conditions are true. If there are several <quote>match</quote>
15729 sub-conditions, the values of the numeric variables afterwards are taken from
15730 the last one. When a false sub-condition is found, the following ones are
15731 parsed but not evaluated.
15732 </para>
15733 </listitem></varlistentry>
15734 </variablelist>
15735 <para>
15736 <indexterm role="concept" startref="IIDexpcond" class="endofrange"/>
15737 </para>
15738 </section>
15739 <section id="SECTexpvar">
15740 <title>Expansion variables</title>
15741 <para>
15742 <indexterm role="concept">
15743 <primary>expansion</primary>
15744 <secondary>variables, list of</secondary>
15745 </indexterm>
15746 This section contains an alphabetical list of all the expansion variables. Some
15747 of them are available only when Exim is compiled with specific options such as
15748 support for TLS or the content scanning extension.
15749 </para>
15750 <variablelist>
15751 <varlistentry>
15752 <term><varname>$0</varname>, <varname>$1</varname>, etc</term>
15753 <listitem>
15754 <para>
15755 <indexterm role="concept">
15756 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
15757 </indexterm>
15758 When a <option>match</option> expansion condition succeeds, these variables contain the
15759 captured substrings identified by the regular expression during subsequent
15760 processing of the success string of the containing <option>if</option> expansion item.
15761 However, they do not retain their values afterwards; in fact, their previous
15762 values are restored at the end of processing an <option>if</option> item. The numerical
15763 variables may also be set externally by some other matching process which
15764 precedes the expansion of the string. For example, the commands available in
15765 Exim filter files include an <option>if</option> command with its own regular expression
15766 matching condition.
15767 </para>
15768 </listitem></varlistentry>
15769 <varlistentry>
15770 <term><varname>$acl_c...</varname></term>
15771 <listitem>
15772 <para>
15773 Values can be placed in these variables by the <option>set</option> modifier in an ACL. They
15774 can be given any name that starts with <varname>$acl_c</varname> and is at least six characters
15775 long, but the sixth character must be either a digit or an underscore. For
15776 example: <varname>$acl_c5</varname>, <varname>$acl_c_mycount</varname>. The values of the <varname>$acl_c...</varname>
15777 variables persist throughout the lifetime of an SMTP connection. They can be
15778 used to pass information between ACLs and between different invocations of the
15779 same ACL. When a message is received, the values of these variables are saved
15780 with the message, and can be accessed by filters, routers, and transports
15781 during subsequent delivery.
15782 </para>
15783 </listitem></varlistentry>
15784 <varlistentry>
15785 <term><varname>$acl_m...</varname></term>
15786 <listitem>
15787 <para>
15788 These variables are like the <varname>$acl_c...</varname> variables, except that their values
15789 are reset after a message has been received. Thus, if several messages are
15790 received in one SMTP connection, <varname>$acl_m...</varname> values are not passed on from one
15791 message to the next, as <varname>$acl_c...</varname> values are. The <varname>$acl_m...</varname> variables are
15792 also reset by MAIL, RSET, EHLO, HELO, and after starting a TLS session. When a
15793 message is received, the values of these variables are saved with the message,
15794 and can be accessed by filters, routers, and transports during subsequent
15795 delivery.
15796 </para>
15797 </listitem></varlistentry>
15798 <varlistentry>
15799 <term><varname>$acl_verify_message</varname></term>
15800 <listitem>
15801 <para>
15802 <indexterm role="variable">
15803 <primary><varname>$acl_verify_message</varname></primary>
15804 </indexterm>
15805 After an address verification has failed, this variable contains the failure
15806 message. It retains its value for use in subsequent modifiers. The message can
15807 be preserved by coding like this:
15808 </para>
15809 <literallayout class="monospaced">
15810 warn !verify = sender
15811      set acl_m0 = $acl_verify_message
15812 </literallayout>
15813 <para>
15814 You can use <varname>$acl_verify_message</varname> during the expansion of the <option>message</option> or
15815 <option>log_message</option> modifiers, to include information about the verification
15816 failure.
15817 </para>
15818 </listitem></varlistentry>
15819 <varlistentry>
15820 <term><varname>$address_data</varname></term>
15821 <listitem>
15822 <para>
15823 <indexterm role="variable">
15824 <primary><varname>$address_data</varname></primary>
15825 </indexterm>
15826 This variable is set by means of the <option>address_data</option> option in routers. The
15827 value then remains with the address while it is processed by subsequent routers
15828 and eventually a transport. If the transport is handling multiple addresses,
15829 the value from the first address is used. See chapter <xref linkend="CHAProutergeneric"/>
15830 for more details. <emphasis role="bold">Note</emphasis>: The contents of <varname>$address_data</varname> are visible in
15831 user filter files.
15832 </para>
15833 <para>
15834 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify
15835 a recipient address, the final value is still in the variable for subsequent
15836 conditions and modifiers of the ACL statement. If routing the address caused it
15837 to be redirected to just one address, the child address is also routed as part
15838 of the verification, and in this case the final value of <varname>$address_data</varname> is
15839 from the child&#x2019;s routing.
15840 </para>
15841 <para>
15842 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
15843 sender address, the final value is also preserved, but this time in
15844 <varname>$sender_address_data</varname>, to distinguish it from data from a recipient
15845 address.
15846 </para>
15847 <para>
15848 In both cases (recipient and sender verification), the value does not persist
15849 after the end of the current ACL statement. If you want to preserve
15850 these values for longer, you can save them in ACL variables.
15851 </para>
15852 </listitem></varlistentry>
15853 <varlistentry>
15854 <term><varname>$address_file</varname></term>
15855 <listitem>
15856 <para>
15857 <indexterm role="variable">
15858 <primary><varname>$address_file</varname></primary>
15859 </indexterm>
15860 When, as a result of aliasing, forwarding, or filtering, a message is directed
15861 to a specific file, this variable holds the name of the file when the transport
15862 is running. At other times, the variable is empty. For example, using the
15863 default configuration, if user <option>r2d2</option> has a <filename>.forward</filename> file containing
15864 </para>
15865 <literallayout class="monospaced">
15866 /home/r2d2/savemail
15867 </literallayout>
15868 <para>
15869 then when the <command>address_file</command> transport is running, <varname>$address_file</varname>
15870 contains the text string <literal>/home/r2d2/savemail</literal>.
15871 <indexterm role="concept">
15872 <primary>Sieve filter</primary>
15873 <secondary>value of <varname>$address_file</varname></secondary>
15874 </indexterm>
15875 For Sieve filters, the value may be <quote>inbox</quote> or a relative folder name. It is
15876 then up to the transport configuration to generate an appropriate absolute path
15877 to the relevant file.
15878 </para>
15879 </listitem></varlistentry>
15880 <varlistentry>
15881 <term><varname>$address_pipe</varname></term>
15882 <listitem>
15883 <para>
15884 <indexterm role="variable">
15885 <primary><varname>$address_pipe</varname></primary>
15886 </indexterm>
15887 When, as a result of aliasing or forwarding, a message is directed to a pipe,
15888 this variable holds the pipe command when the transport is running.
15889 </para>
15890 </listitem></varlistentry>
15891 <varlistentry>
15892 <term><varname>$auth1</varname> &ndash; <varname>$auth3</varname></term>
15893 <listitem>
15894 <para>
15895 <indexterm role="variable">
15896 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
15897 </indexterm>
15898 These variables are used in SMTP authenticators (see chapters
15899 <xref linkend="CHAPplaintext"/>&ndash;<xref linkend="CHAPspa"/>). Elsewhere, they are empty.
15900 </para>
15901 </listitem></varlistentry>
15902 <varlistentry>
15903 <term><varname>$authenticated_id</varname></term>
15904 <listitem>
15905 <para>
15906 <indexterm role="concept">
15907 <primary>authentication</primary>
15908 <secondary>id</secondary>
15909 </indexterm>
15910 <indexterm role="variable">
15911 <primary><varname>$authenticated_id</varname></primary>
15912 </indexterm>
15913 When a server successfully authenticates a client it may be configured to
15914 preserve some of the authentication information in the variable
15915 <varname>$authenticated_id</varname> (see chapter <xref linkend="CHAPSMTPAUTH"/>). For example, a
15916 user/password authenticator configuration might preserve the user name for use
15917 in the routers. Note that this is not the same information that is saved in
15918 <varname>$sender_host_authenticated</varname>.
15919 When a message is submitted locally (that is, not over a TCP connection)
15920 the value of <varname>$authenticated_id</varname> is normally the login name of the calling
15921 process. However, a trusted user can override this by means of the <option>-oMai</option>
15922 command line option.
15923 </para>
15924 </listitem></varlistentry>
15925 <varlistentry>
15926 <term><varname>$authenticated_sender</varname></term>
15927 <listitem>
15928 <para>
15929 <indexterm role="concept">
15930 <primary>sender</primary>
15931 <secondary>authenticated</secondary>
15932 </indexterm>
15933 <indexterm role="concept">
15934 <primary>authentication</primary>
15935 <secondary>sender</secondary>
15936 </indexterm>
15937 <indexterm role="concept">
15938 <primary>AUTH</primary>
15939 <secondary>on MAIL command</secondary>
15940 </indexterm>
15941 <indexterm role="variable">
15942 <primary><varname>$authenticated_sender</varname></primary>
15943 </indexterm>
15944 When acting as a server, Exim takes note of the AUTH= parameter on an incoming
15945 SMTP MAIL command if it believes the sender is sufficiently trusted, as
15946 described in section <xref linkend="SECTauthparamail"/>. Unless the data is the string
15947 <quote>&lt;&gt;</quote>, it is set as the authenticated sender of the message, and the value is
15948 available during delivery in the <varname>$authenticated_sender</varname> variable. If the
15949 sender is not trusted, Exim accepts the syntax of AUTH=, but ignores the data.
15950 </para>
15951 <para>
15952 <indexterm role="variable">
15953 <primary><varname>$qualify_domain</varname></primary>
15954 </indexterm>
15955 When a message is submitted locally (that is, not over a TCP connection), the
15956 value of <varname>$authenticated_sender</varname> is an address constructed from the login
15957 name of the calling process and <varname>$qualify_domain</varname>, except that a trusted user
15958 can override this by means of the <option>-oMas</option> command line option.
15959 </para>
15960 </listitem></varlistentry>
15961 <varlistentry>
15962 <term><varname>$authentication_failed</varname></term>
15963 <listitem>
15964 <para>
15965 <indexterm role="concept">
15966 <primary>authentication</primary>
15967 <secondary>failure</secondary>
15968 </indexterm>
15969 <indexterm role="variable">
15970 <primary><varname>$authentication_failed</varname></primary>
15971 </indexterm>
15972 This variable is set to <quote>1</quote> in an Exim server if a client issues an AUTH
15973 command that does not succeed. Otherwise it is set to <quote>0</quote>. This makes it
15974 possible to distinguish between <quote>did not try to authenticate</quote>
15975 (<varname>$sender_host_authenticated</varname> is empty and <varname>$authentication_failed</varname> is set to
15976 <quote>0</quote>) and <quote>tried to authenticate but failed</quote> (<varname>$sender_host_authenticated</varname>
15977 is empty and <varname>$authentication_failed</varname> is set to <quote>1</quote>). Failure includes any
15978 negative response to an AUTH command, including (for example) an attempt to use
15979 an undefined mechanism.
15980 </para>
15981 </listitem></varlistentry>
15982 <varlistentry>
15983 <term><varname>$body_linecount</varname></term>
15984 <listitem>
15985 <para>
15986 <indexterm role="concept">
15987 <primary>message body</primary>
15988 <secondary>line count</secondary>
15989 </indexterm>
15990 <indexterm role="concept">
15991 <primary>body of message</primary>
15992 <secondary>line count</secondary>
15993 </indexterm>
15994 <indexterm role="variable">
15995 <primary><varname>$body_linecount</varname></primary>
15996 </indexterm>
15997 When a message is being received or delivered, this variable contains the
15998 number of lines in the message&#x2019;s body. See also <varname>$message_linecount</varname>.
15999 </para>
16000 </listitem></varlistentry>
16001 <varlistentry>
16002 <term><varname>$body_zerocount</varname></term>
16003 <listitem>
16004 <para>
16005 <indexterm role="concept">
16006 <primary>message body</primary>
16007 <secondary>binary zero count</secondary>
16008 </indexterm>
16009 <indexterm role="concept">
16010 <primary>body of message</primary>
16011 <secondary>binary zero count</secondary>
16012 </indexterm>
16013 <indexterm role="concept">
16014 <primary>binary zero</primary>
16015 <secondary>in message body</secondary>
16016 </indexterm>
16017 <indexterm role="variable">
16018 <primary><varname>$body_zerocount</varname></primary>
16019 </indexterm>
16020 When a message is being received or delivered, this variable contains the
16021 number of binary zero bytes in the message&#x2019;s body.
16022 </para>
16023 </listitem></varlistentry>
16024 <varlistentry>
16025 <term><varname>$bounce_recipient</varname></term>
16026 <listitem>
16027 <para>
16028 <indexterm role="variable">
16029 <primary><varname>$bounce_recipient</varname></primary>
16030 </indexterm>
16031 This is set to the recipient address of a bounce message while Exim is creating
16032 it. It is useful if a customized bounce message text file is in use (see
16033 chapter <xref linkend="CHAPemsgcust"/>).
16034 </para>
16035 </listitem></varlistentry>
16036 <varlistentry>
16037 <term><varname>$bounce_return_size_limit</varname></term>
16038 <listitem>
16039 <para>
16040 <indexterm role="variable">
16041 <primary><varname>$bounce_return_size_limit</varname></primary>
16042 </indexterm>
16043 This contains the value set in the <option>bounce_return_size_limit</option> option, rounded
16044 up to a multiple of 1000. It is useful when a customized error message text
16045 file is in use (see chapter <xref linkend="CHAPemsgcust"/>).
16046 </para>
16047 </listitem></varlistentry>
16048 <varlistentry>
16049 <term><varname>$caller_gid</varname></term>
16050 <listitem>
16051 <para>
16052 <indexterm role="concept">
16053 <primary>gid (group id)</primary>
16054 <secondary>caller</secondary>
16055 </indexterm>
16056 <indexterm role="variable">
16057 <primary><varname>$caller_gid</varname></primary>
16058 </indexterm>
16059 The real group id under which the process that called Exim was running. This is
16060 not the same as the group id of the originator of a message (see
16061 <varname>$originator_gid</varname>). If Exim re-execs itself, this variable in the new
16062 incarnation normally contains the Exim gid.
16063 </para>
16064 </listitem></varlistentry>
16065 <varlistentry>
16066 <term><varname>$caller_uid</varname></term>
16067 <listitem>
16068 <para>
16069 <indexterm role="concept">
16070 <primary>uid (user id)</primary>
16071 <secondary>caller</secondary>
16072 </indexterm>
16073 <indexterm role="variable">
16074 <primary><varname>$caller_uid</varname></primary>
16075 </indexterm>
16076 The real user id under which the process that called Exim was running. This is
16077 not the same as the user id of the originator of a message (see
16078 <varname>$originator_uid</varname>). If Exim re-execs itself, this variable in the new
16079 incarnation normally contains the Exim uid.
16080 </para>
16081 </listitem></varlistentry>
16082 <varlistentry>
16083 <term><varname>$compile_date</varname></term>
16084 <listitem>
16085 <para>
16086 <indexterm role="variable">
16087 <primary><varname>$compile_date</varname></primary>
16088 </indexterm>
16089 The date on which the Exim binary was compiled.
16090 </para>
16091 </listitem></varlistentry>
16092 <varlistentry>
16093 <term><varname>$compile_number</varname></term>
16094 <listitem>
16095 <para>
16096 <indexterm role="variable">
16097 <primary><varname>$compile_number</varname></primary>
16098 </indexterm>
16099 The building process for Exim keeps a count of the number
16100 of times it has been compiled. This serves to distinguish different
16101 compilations of the same version of the program.
16102 </para>
16103 </listitem></varlistentry>
16104 <varlistentry>
16105 <term><varname>$demime_errorlevel</varname></term>
16106 <listitem>
16107 <para>
16108 <indexterm role="variable">
16109 <primary><varname>$demime_errorlevel</varname></primary>
16110 </indexterm>
16111 This variable is available when Exim is compiled with
16112 the content-scanning extension and the obsolete <option>demime</option> condition. For
16113 details, see section <xref linkend="SECTdemimecond"/>.
16114 </para>
16115 </listitem></varlistentry>
16116 <varlistentry>
16117 <term><varname>$demime_reason</varname></term>
16118 <listitem>
16119 <para>
16120 <indexterm role="variable">
16121 <primary><varname>$demime_reason</varname></primary>
16122 </indexterm>
16123 This variable is available when Exim is compiled with the
16124 content-scanning extension and the obsolete <option>demime</option> condition. For details,
16125 see section <xref linkend="SECTdemimecond"/>.
16126 </para>
16127 </listitem></varlistentry>
16128 <varlistentry>
16129 <term><varname>$dnslist_domain</varname></term>
16130 <term><varname>$dnslist_matched</varname></term>
16131 <term><varname>$dnslist_text</varname></term>
16132 <term><varname>$dnslist_value</varname></term>
16133 <listitem>
16134 <para>
16135 <indexterm role="variable">
16136 <primary><varname>$dnslist_domain</varname></primary>
16137 </indexterm>
16138 <indexterm role="variable">
16139 <primary><varname>$dnslist_matched</varname></primary>
16140 </indexterm>
16141 <indexterm role="variable">
16142 <primary><varname>$dnslist_text</varname></primary>
16143 </indexterm>
16144 <indexterm role="variable">
16145 <primary><varname>$dnslist_value</varname></primary>
16146 </indexterm>
16147 <indexterm role="concept">
16148 <primary>black list (DNS)</primary>
16149 </indexterm>
16150 When a DNS (black) list lookup succeeds, these variables are set to contain
16151 the following data from the lookup: the list&#x2019;s domain name, the key that was
16152 looked up, the contents of any associated TXT record, and the value from the
16153 main A record. See section <xref linkend="SECID204"/> for more details.
16154 </para>
16155 </listitem></varlistentry>
16156 <varlistentry>
16157 <term><varname>$domain</varname></term>
16158 <listitem>
16159 <para>
16160 <indexterm role="variable">
16161 <primary><varname>$domain</varname></primary>
16162 </indexterm>
16163 When an address is being routed, or delivered on its own, this variable
16164 contains the domain. Uppercase letters in the domain are converted into lower
16165 case for <varname>$domain</varname>.
16166 </para>
16167 <para>
16168 Global address rewriting happens when a message is received, so the value of
16169 <varname>$domain</varname> during routing and delivery is the value after rewriting. <varname>$domain</varname>
16170 is set during user filtering, but not during system filtering, because a
16171 message may have many recipients and the system filter is called just once.
16172 </para>
16173 <para>
16174 When more than one address is being delivered at once (for example, several
16175 RCPT commands in one SMTP delivery), <varname>$domain</varname> is set only if they all
16176 have the same domain. Transports can be restricted to handling only one domain
16177 at a time if the value of <varname>$domain</varname> is required at transport time &ndash; this is
16178 the default for local transports. For further details of the environment in
16179 which local transports are run, see chapter <xref linkend="CHAPenvironment"/>.
16180 </para>
16181 <para>
16182 <indexterm role="option">
16183 <primary><option>delay_warning_condition</option></primary>
16184 </indexterm>
16185 At the end of a delivery, if all deferred addresses have the same domain, it is
16186 set in <varname>$domain</varname> during the expansion of <option>delay_warning_condition</option>.
16187 </para>
16188 <para>
16189 The <varname>$domain</varname> variable is also used in some other circumstances:
16190 </para>
16191 <itemizedlist>
16192 <listitem>
16193 <para>
16194 When an ACL is running for a RCPT command, <varname>$domain</varname> contains the domain of
16195 the recipient address. The domain of the <emphasis>sender</emphasis> address is in
16196 <varname>$sender_address_domain</varname> at both MAIL time and at RCPT time. <varname>$domain</varname> is not
16197 normally set during the running of the MAIL ACL. However, if the sender address
16198 is verified with a callout during the MAIL ACL, the sender domain is placed in
16199 <varname>$domain</varname> during the expansions of <option>hosts</option>, <option>interface</option>, and <option>port</option> in
16200 the <command>smtp</command> transport.
16201 </para>
16202 </listitem>
16203 <listitem>
16204 <para>
16205 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
16206 <varname>$domain</varname> contains the domain portion of the address that is being rewritten;
16207 it can be used in the expansion of the replacement address, for example, to
16208 rewrite domains by file lookup.
16209 </para>
16210 </listitem>
16211 <listitem>
16212 <para>
16213 With one important exception, whenever a domain list is being scanned,
16214 <varname>$domain</varname> contains the subject domain. <emphasis role="bold">Exception</emphasis>: When a domain list in
16215 a <option>sender_domains</option> condition in an ACL is being processed, the subject domain
16216 is in <varname>$sender_address_domain</varname> and not in <varname>$domain</varname>. It works this way so
16217 that, in a RCPT ACL, the sender domain list can be dependent on the
16218 recipient domain (which is what is in <varname>$domain</varname> at this time).
16219 </para>
16220 </listitem>
16221 <listitem>
16222 <para>
16223 <indexterm role="concept">
16224 <primary>ETRN</primary>
16225 <secondary>value of <varname>$domain</varname></secondary>
16226 </indexterm>
16227 <indexterm role="option">
16228 <primary><option>smtp_etrn_command</option></primary>
16229 </indexterm>
16230 When the <option>smtp_etrn_command</option> option is being expanded, <varname>$domain</varname> contains
16231 the complete argument of the ETRN command (see section <xref linkend="SECTETRN"/>).
16232 </para>
16233 </listitem>
16234 </itemizedlist>
16235 </listitem></varlistentry>
16236 <varlistentry>
16237 <term><varname>$domain_data</varname></term>
16238 <listitem>
16239 <para>
16240 <indexterm role="variable">
16241 <primary><varname>$domain_data</varname></primary>
16242 </indexterm>
16243 When the <option>domains</option> option on a router matches a domain by
16244 means of a lookup, the data read by the lookup is available during the running
16245 of the router as <varname>$domain_data</varname>. In addition, if the driver routes the
16246 address to a transport, the value is available in that transport. If the
16247 transport is handling multiple addresses, the value from the first address is
16248 used.
16249 </para>
16250 <para>
16251 <varname>$domain_data</varname> is also set when the <option>domains</option> condition in an ACL matches a
16252 domain by means of a lookup. The data read by the lookup is available during
16253 the rest of the ACL statement. In all other situations, this variable expands
16254 to nothing.
16255 </para>
16256 </listitem></varlistentry>
16257 <varlistentry>
16258 <term><varname>$exim_gid</varname></term>
16259 <listitem>
16260 <para>
16261 <indexterm role="variable">
16262 <primary><varname>$exim_gid</varname></primary>
16263 </indexterm>
16264 This variable contains the numerical value of the Exim group id.
16265 </para>
16266 </listitem></varlistentry>
16267 <varlistentry>
16268 <term><varname>$exim_path</varname></term>
16269 <listitem>
16270 <para>
16271 <indexterm role="variable">
16272 <primary><varname>$exim_path</varname></primary>
16273 </indexterm>
16274 This variable contains the path to the Exim binary.
16275 </para>
16276 </listitem></varlistentry>
16277 <varlistentry>
16278 <term><varname>$exim_uid</varname></term>
16279 <listitem>
16280 <para>
16281 <indexterm role="variable">
16282 <primary><varname>$exim_uid</varname></primary>
16283 </indexterm>
16284 This variable contains the numerical value of the Exim user id.
16285 </para>
16286 </listitem></varlistentry>
16287 <varlistentry>
16288 <term><varname>$found_extension</varname></term>
16289 <listitem>
16290 <para>
16291 <indexterm role="variable">
16292 <primary><varname>$found_extension</varname></primary>
16293 </indexterm>
16294 This variable is available when Exim is compiled with the
16295 content-scanning extension and the obsolete <option>demime</option> condition. For details,
16296 see section <xref linkend="SECTdemimecond"/>.
16297 </para>
16298 </listitem></varlistentry>
16299 <varlistentry>
16300 <term><varname>$header_</varname>&lt;<emphasis>name</emphasis>&gt;</term>
16301 <listitem>
16302 <para>
16303 This is not strictly an expansion variable. It is expansion syntax for
16304 inserting the message header line with the given name. Note that the name must
16305 be terminated by colon or white space, because it may contain a wide variety of
16306 characters. Note also that braces must <emphasis>not</emphasis> be used.
16307 </para>
16308 </listitem></varlistentry>
16309 <varlistentry>
16310 <term><varname>$home</varname></term>
16311 <listitem>
16312 <para>
16313 <indexterm role="variable">
16314 <primary><varname>$home</varname></primary>
16315 </indexterm>
16316 When the <option>check_local_user</option> option is set for a router, the user&#x2019;s home
16317 directory is placed in <varname>$home</varname> when the check succeeds. In particular, this
16318 means it is set during the running of users&#x2019; filter files. A router may also
16319 explicitly set a home directory for use by a transport; this can be overridden
16320 by a setting on the transport itself.
16321 </para>
16322 <para>
16323 When running a filter test via the <option>-bf</option> option, <varname>$home</varname> is set to the value
16324 of the environment variable HOME.
16325 </para>
16326 </listitem></varlistentry>
16327 <varlistentry>
16328 <term><varname>$host</varname></term>
16329 <listitem>
16330 <para>
16331 <indexterm role="variable">
16332 <primary><varname>$host</varname></primary>
16333 </indexterm>
16334 If a router assigns an address to a transport (any transport), and passes a
16335 list of hosts with the address, the value of <varname>$host</varname> when the transport starts
16336 to run is the name of the first host on the list. Note that this applies both
16337 to local and remote transports.
16338 </para>
16339 <para>
16340 <indexterm role="concept">
16341 <primary>transport</primary>
16342 <secondary>filter</secondary>
16343 </indexterm>
16344 <indexterm role="concept">
16345 <primary>filter</primary>
16346 <secondary>transport filter</secondary>
16347 </indexterm>
16348 For the <command>smtp</command> transport, if there is more than one host, the value of
16349 <varname>$host</varname> changes as the transport works its way through the list. In
16350 particular, when the <command>smtp</command> transport is expanding its options for encryption
16351 using TLS, or for specifying a transport filter (see chapter
16352 <xref linkend="CHAPtransportgeneric"/>), <varname>$host</varname> contains the name of the host to which it
16353 is connected.
16354 </para>
16355 <para>
16356 When used in the client part of an authenticator configuration (see chapter
16357 <xref linkend="CHAPSMTPAUTH"/>), <varname>$host</varname> contains the name of the server to which the
16358 client is connected.
16359 </para>
16360 </listitem></varlistentry>
16361 <varlistentry>
16362 <term><varname>$host_address</varname></term>
16363 <listitem>
16364 <para>
16365 <indexterm role="variable">
16366 <primary><varname>$host_address</varname></primary>
16367 </indexterm>
16368 This variable is set to the remote host&#x2019;s IP address whenever <varname>$host</varname> is set
16369 for a remote connection. It is also set to the IP address that is being checked
16370 when the <option>ignore_target_hosts</option> option is being processed.
16371 </para>
16372 </listitem></varlistentry>
16373 <varlistentry>
16374 <term><varname>$host_data</varname></term>
16375 <listitem>
16376 <para>
16377 <indexterm role="variable">
16378 <primary><varname>$host_data</varname></primary>
16379 </indexterm>
16380 If a <option>hosts</option> condition in an ACL is satisfied by means of a lookup, the
16381 result of the lookup is made available in the <varname>$host_data</varname> variable. This
16382 allows you, for example, to do things like this:
16383 </para>
16384 <literallayout class="monospaced">
16385 deny  hosts = net-lsearch;/some/file
16386 message = $host_data
16387 </literallayout>
16388 </listitem></varlistentry>
16389 <varlistentry>
16390 <term><varname>$host_lookup_deferred</varname></term>
16391 <listitem>
16392 <para>
16393 <indexterm role="concept">
16394 <primary>host name</primary>
16395 <secondary>lookup, failure of</secondary>
16396 </indexterm>
16397 <indexterm role="variable">
16398 <primary><varname>$host_lookup_deferred</varname></primary>
16399 </indexterm>
16400 This variable normally contains <quote>0</quote>, as does <varname>$host_lookup_failed</varname>. When a
16401 message comes from a remote host and there is an attempt to look up the host&#x2019;s
16402 name from its IP address, and the attempt is not successful, one of these
16403 variables is set to <quote>1</quote>.
16404 </para>
16405 <itemizedlist>
16406 <listitem>
16407 <para>
16408 If the lookup receives a definite negative response (for example, a DNS lookup
16409 succeeded, but no records were found), <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
16410 </para>
16411 </listitem>
16412 <listitem>
16413 <para>
16414 If there is any kind of problem during the lookup, such that Exim cannot
16415 tell whether or not the host name is defined (for example, a timeout for a DNS
16416 lookup), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>.
16417 </para>
16418 </listitem>
16419 </itemizedlist>
16420 <para>
16421 Looking up a host&#x2019;s name from its IP address consists of more than just a
16422 single reverse lookup. Exim checks that a forward lookup of at least one of the
16423 names it receives from a reverse lookup yields the original IP address. If this
16424 is not the case, Exim does not accept the looked up name(s), and
16425 <varname>$host_lookup_failed</varname> is set to <quote>1</quote>. Thus, being able to find a name from an
16426 IP address (for example, the existence of a PTR record in the DNS) is not
16427 sufficient on its own for the success of a host name lookup. If the reverse
16428 lookup succeeds, but there is a lookup problem such as a timeout when checking
16429 the result, the name is not accepted, and <varname>$host_lookup_deferred</varname> is set to
16430 <quote>1</quote>. See also <varname>$sender_host_name</varname>.
16431 </para>
16432 </listitem></varlistentry>
16433 <varlistentry>
16434 <term><varname>$host_lookup_failed</varname></term>
16435 <listitem>
16436 <para>
16437 <indexterm role="variable">
16438 <primary><varname>$host_lookup_failed</varname></primary>
16439 </indexterm>
16440 See <varname>$host_lookup_deferred</varname>.
16441 </para>
16442 </listitem></varlistentry>
16443 <varlistentry>
16444 <term><varname>$inode</varname></term>
16445 <listitem>
16446 <para>
16447 <indexterm role="variable">
16448 <primary><varname>$inode</varname></primary>
16449 </indexterm>
16450 The only time this variable is set is while expanding the <option>directory_file</option>
16451 option in the <command>appendfile</command> transport. The variable contains the inode number
16452 of the temporary file which is about to be renamed. It can be used to construct
16453 a unique name for the file.
16454 </para>
16455 </listitem></varlistentry>
16456 <varlistentry>
16457 <term><varname>$interface_address</varname></term>
16458 <listitem>
16459 <para>
16460 <indexterm role="variable">
16461 <primary><varname>$interface_address</varname></primary>
16462 </indexterm>
16463 This is an obsolete name for <varname>$received_ip_address</varname>.
16464 </para>
16465 </listitem></varlistentry>
16466 <varlistentry>
16467 <term><varname>$interface_port</varname></term>
16468 <listitem>
16469 <para>
16470 <indexterm role="variable">
16471 <primary><varname>$interface_port</varname></primary>
16472 </indexterm>
16473 This is an obsolete name for <varname>$received_port</varname>.
16474 </para>
16475 </listitem></varlistentry>
16476 <varlistentry>
16477 <term><varname>$item</varname></term>
16478 <listitem>
16479 <para>
16480 <indexterm role="variable">
16481 <primary><varname>$item</varname></primary>
16482 </indexterm>
16483 This variable is used during the expansion of <emphasis role="bold">forall</emphasis> and <emphasis role="bold">forany</emphasis>
16484 conditions (see section <xref linkend="SECTexpcond"/>), and <emphasis role="bold">filter</emphasis>, <emphasis role="bold">map</emphasis>, and
16485 <emphasis role="bold">reduce</emphasis> items (see section <xref linkend="SECTexpcond"/>). In other circumstances, it is
16486 empty.
16487 </para>
16488 </listitem></varlistentry>
16489 <varlistentry>
16490 <term><varname>$ldap_dn</varname></term>
16491 <listitem>
16492 <para>
16493 <indexterm role="variable">
16494 <primary><varname>$ldap_dn</varname></primary>
16495 </indexterm>
16496 This variable, which is available only when Exim is compiled with LDAP support,
16497 contains the DN from the last entry in the most recently successful LDAP
16498 lookup.
16499 </para>
16500 </listitem></varlistentry>
16501 <varlistentry>
16502 <term><varname>$load_average</varname></term>
16503 <listitem>
16504 <para>
16505 <indexterm role="variable">
16506 <primary><varname>$load_average</varname></primary>
16507 </indexterm>
16508 This variable contains the system load average, multiplied by 1000 so that it
16509 is an integer. For example, if the load average is 0.21, the value of the
16510 variable is 210. The value is recomputed every time the variable is referenced.
16511 </para>
16512 </listitem></varlistentry>
16513 <varlistentry>
16514 <term><varname>$local_part</varname></term>
16515 <listitem>
16516 <para>
16517 <indexterm role="variable">
16518 <primary><varname>$local_part</varname></primary>
16519 </indexterm>
16520 When an address is being routed, or delivered on its own, this
16521 variable contains the local part. When a number of addresses are being
16522 delivered together (for example, multiple RCPT commands in an SMTP
16523 session), <varname>$local_part</varname> is not set.
16524 </para>
16525 <para>
16526 Global address rewriting happens when a message is received, so the value of
16527 <varname>$local_part</varname> during routing and delivery is the value after rewriting.
16528 <varname>$local_part</varname> is set during user filtering, but not during system filtering,
16529 because a message may have many recipients and the system filter is called just
16530 once.
16531 </para>
16532 <para>
16533 <indexterm role="variable">
16534 <primary><varname>$local_part_prefix</varname></primary>
16535 </indexterm>
16536 <indexterm role="variable">
16537 <primary><varname>$local_part_suffix</varname></primary>
16538 </indexterm>
16539 If a local part prefix or suffix has been recognized, it is not included in the
16540 value of <varname>$local_part</varname> during routing and subsequent delivery. The values of
16541 any prefix or suffix are in <varname>$local_part_prefix</varname> and
16542 <varname>$local_part_suffix</varname>, respectively.
16543 </para>
16544 <para>
16545 When a message is being delivered to a file, pipe, or autoreply transport as a
16546 result of aliasing or forwarding, <varname>$local_part</varname> is set to the local part of
16547 the parent address, not to the file name or command (see <varname>$address_file</varname> and
16548 <varname>$address_pipe</varname>).
16549 </para>
16550 <para>
16551 When an ACL is running for a RCPT command, <varname>$local_part</varname> contains the
16552 local part of the recipient address.
16553 </para>
16554 <para>
16555 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
16556 <varname>$local_part</varname> contains the local part of the address that is being rewritten;
16557 it can be used in the expansion of the replacement address, for example.
16558 </para>
16559 <para>
16560 In all cases, all quoting is removed from the local part. For example, for both
16561 the addresses
16562 </para>
16563 <literallayout class="monospaced">
16564 "abc:xyz"@test.example
16565 abc\:xyz@test.example
16566 </literallayout>
16567 <para>
16568 the value of <varname>$local_part</varname> is
16569 </para>
16570 <literallayout class="monospaced">
16571 abc:xyz
16572 </literallayout>
16573 <para>
16574 If you use <varname>$local_part</varname> to create another address, you should always wrap it
16575 inside a quoting operator. For example, in a <command>redirect</command> router you could
16576 have:
16577 </para>
16578 <literallayout class="monospaced">
16579 data = ${quote_local_part:$local_part}@new.domain.example
16580 </literallayout>
16581 <para>
16582 <emphasis role="bold">Note</emphasis>: The value of <varname>$local_part</varname> is normally lower cased. If you want
16583 to process local parts in a case-dependent manner in a router, you can set the
16584 <option>caseful_local_part</option> option (see chapter <xref linkend="CHAProutergeneric"/>).
16585 </para>
16586 </listitem></varlistentry>
16587 <varlistentry>
16588 <term><varname>$local_part_data</varname></term>
16589 <listitem>
16590 <para>
16591 <indexterm role="variable">
16592 <primary><varname>$local_part_data</varname></primary>
16593 </indexterm>
16594 When the <option>local_parts</option> option on a router matches a local part by means of a
16595 lookup, the data read by the lookup is available during the running of the
16596 router as <varname>$local_part_data</varname>. In addition, if the driver routes the address
16597 to a transport, the value is available in that transport. If the transport is
16598 handling multiple addresses, the value from the first address is used.
16599 </para>
16600 <para>
16601 <varname>$local_part_data</varname> is also set when the <option>local_parts</option> condition in an ACL
16602 matches a local part by means of a lookup. The data read by the lookup is
16603 available during the rest of the ACL statement. In all other situations, this
16604 variable expands to nothing.
16605 </para>
16606 </listitem></varlistentry>
16607 <varlistentry>
16608 <term><varname>$local_part_prefix</varname></term>
16609 <listitem>
16610 <para>
16611 <indexterm role="variable">
16612 <primary><varname>$local_part_prefix</varname></primary>
16613 </indexterm>
16614 When an address is being routed or delivered, and a
16615 specific prefix for the local part was recognized, it is available in this
16616 variable, having been removed from <varname>$local_part</varname>.
16617 </para>
16618 </listitem></varlistentry>
16619 <varlistentry>
16620 <term><varname>$local_part_suffix</varname></term>
16621 <listitem>
16622 <para>
16623 <indexterm role="variable">
16624 <primary><varname>$local_part_suffix</varname></primary>
16625 </indexterm>
16626 When an address is being routed or delivered, and a
16627 specific suffix for the local part was recognized, it is available in this
16628 variable, having been removed from <varname>$local_part</varname>.
16629 </para>
16630 </listitem></varlistentry>
16631 <varlistentry>
16632 <term><varname>$local_scan_data</varname></term>
16633 <listitem>
16634 <para>
16635 <indexterm role="variable">
16636 <primary><varname>$local_scan_data</varname></primary>
16637 </indexterm>
16638 This variable contains the text returned by the <function>local_scan()</function> function when
16639 a message is received. See chapter <xref linkend="CHAPlocalscan"/> for more details.
16640 </para>
16641 </listitem></varlistentry>
16642 <varlistentry>
16643 <term><varname>$local_user_gid</varname></term>
16644 <listitem>
16645 <para>
16646 <indexterm role="variable">
16647 <primary><varname>$local_user_gid</varname></primary>
16648 </indexterm>
16649 See <varname>$local_user_uid</varname>.
16650 </para>
16651 </listitem></varlistentry>
16652 <varlistentry>
16653 <term><varname>$local_user_uid</varname></term>
16654 <listitem>
16655 <para>
16656 <indexterm role="variable">
16657 <primary><varname>$local_user_uid</varname></primary>
16658 </indexterm>
16659 This variable and <varname>$local_user_gid</varname> are set to the uid and gid after the
16660 <option>check_local_user</option> router precondition succeeds. This means that their values
16661 are available for the remaining preconditions (<option>senders</option>, <option>require_files</option>,
16662 and <option>condition</option>), for the <option>address_data</option> expansion, and for any
16663 router-specific expansions. At all other times, the values in these variables
16664 are <literal>(uid_t)(-1)</literal> and <literal>(gid_t)(-1)</literal>, respectively.
16665 </para>
16666 </listitem></varlistentry>
16667 <varlistentry>
16668 <term><varname>$localhost_number</varname></term>
16669 <listitem>
16670 <para>
16671 <indexterm role="variable">
16672 <primary><varname>$localhost_number</varname></primary>
16673 </indexterm>
16674 This contains the expanded value of the
16675 <option>localhost_number</option> option. The expansion happens after the main options have
16676 been read.
16677 </para>
16678 </listitem></varlistentry>
16679 <varlistentry>
16680 <term><varname>$log_inodes</varname></term>
16681 <listitem>
16682 <para>
16683 <indexterm role="variable">
16684 <primary><varname>$log_inodes</varname></primary>
16685 </indexterm>
16686 The number of free inodes in the disk partition where Exim&#x2019;s
16687 log files are being written. The value is recalculated whenever the variable is
16688 referenced. If the relevant file system does not have the concept of inodes,
16689 the value of is -1. See also the <option>check_log_inodes</option> option.
16690 </para>
16691 </listitem></varlistentry>
16692 <varlistentry>
16693 <term><varname>$log_space</varname></term>
16694 <listitem>
16695 <para>
16696 <indexterm role="variable">
16697 <primary><varname>$log_space</varname></primary>
16698 </indexterm>
16699 The amount of free space (as a number of kilobytes) in the disk
16700 partition where Exim&#x2019;s log files are being written. The value is recalculated
16701 whenever the variable is referenced. If the operating system does not have the
16702 ability to find the amount of free space (only true for experimental systems),
16703 the space value is -1. See also the <option>check_log_space</option> option.
16704 </para>
16705 </listitem></varlistentry>
16706 <varlistentry>
16707 <term><varname>$mailstore_basename</varname></term>
16708 <listitem>
16709 <para>
16710 <indexterm role="variable">
16711 <primary><varname>$mailstore_basename</varname></primary>
16712 </indexterm>
16713 This variable is set only when doing deliveries in <quote>mailstore</quote> format in the
16714 <command>appendfile</command> transport. During the expansion of the <option>mailstore_prefix</option>,
16715 <option>mailstore_suffix</option>, <option>message_prefix</option>, and <option>message_suffix</option> options, it
16716 contains the basename of the files that are being written, that is, the name
16717 without the <quote>.tmp</quote>, <quote>.env</quote>, or <quote>.msg</quote> suffix. At all other times, this
16718 variable is empty.
16719 </para>
16720 </listitem></varlistentry>
16721 <varlistentry>
16722 <term><varname>$malware_name</varname></term>
16723 <listitem>
16724 <para>
16725 <indexterm role="variable">
16726 <primary><varname>$malware_name</varname></primary>
16727 </indexterm>
16728 This variable is available when Exim is compiled with the
16729 content-scanning extension. It is set to the name of the virus that was found
16730 when the ACL <option>malware</option> condition is true (see section <xref linkend="SECTscanvirus"/>).
16731 </para>
16732 </listitem></varlistentry>
16733 <varlistentry>
16734 <term><varname>$max_received_linelength</varname></term>
16735 <listitem>
16736 <para>
16737 <indexterm role="variable">
16738 <primary><varname>$max_received_linelength</varname></primary>
16739 </indexterm>
16740 <indexterm role="concept">
16741 <primary>maximum</primary>
16742 <secondary>line length</secondary>
16743 </indexterm>
16744 <indexterm role="concept">
16745 <primary>line length</primary>
16746 <secondary>maximum</secondary>
16747 </indexterm>
16748 This variable contains the number of bytes in the longest line that was
16749 received as part of the message, not counting the line termination
16750 character(s).
16751 </para>
16752 </listitem></varlistentry>
16753 <varlistentry>
16754 <term><varname>$message_age</varname></term>
16755 <listitem>
16756 <para>
16757 <indexterm role="concept">
16758 <primary>message</primary>
16759 <secondary>age of</secondary>
16760 </indexterm>
16761 <indexterm role="variable">
16762 <primary><varname>$message_age</varname></primary>
16763 </indexterm>
16764 This variable is set at the start of a delivery attempt to contain the number
16765 of seconds since the message was received. It does not change during a single
16766 delivery attempt.
16767 </para>
16768 </listitem></varlistentry>
16769 <varlistentry>
16770 <term><varname>$message_body</varname></term>
16771 <listitem>
16772 <para>
16773 <indexterm role="concept">
16774 <primary>body of message</primary>
16775 <secondary>expansion variable</secondary>
16776 </indexterm>
16777 <indexterm role="concept">
16778 <primary>message body</primary>
16779 <secondary>in expansion</secondary>
16780 </indexterm>
16781 <indexterm role="concept">
16782 <primary>binary zero</primary>
16783 <secondary>in message body</secondary>
16784 </indexterm>
16785 <indexterm role="variable">
16786 <primary><varname>$message_body</varname></primary>
16787 </indexterm>
16788 <indexterm role="option">
16789 <primary><option>message_body_visible</option></primary>
16790 </indexterm>
16791 This variable contains the initial portion of a message&#x2019;s body while it is
16792 being delivered, and is intended mainly for use in filter files. The maximum
16793 number of characters of the body that are put into the variable is set by the
16794 <option>message_body_visible</option> configuration option; the default is 500.
16795 </para>
16796 <para>
16797 <indexterm role="option">
16798 <primary><option>message_body_newlines</option></primary>
16799 </indexterm>
16800 By default, newlines are converted into spaces in <varname>$message_body</varname>, to make it
16801 easier to search for phrases that might be split over a line break. However,
16802 this can be disabled by setting <option>message_body_newlines</option> to be true. Binary
16803 zeros are always converted into spaces.
16804 </para>
16805 </listitem></varlistentry>
16806 <varlistentry>
16807 <term><varname>$message_body_end</varname></term>
16808 <listitem>
16809 <para>
16810 <indexterm role="concept">
16811 <primary>body of message</primary>
16812 <secondary>expansion variable</secondary>
16813 </indexterm>
16814 <indexterm role="concept">
16815 <primary>message body</primary>
16816 <secondary>in expansion</secondary>
16817 </indexterm>
16818 <indexterm role="variable">
16819 <primary><varname>$message_body_end</varname></primary>
16820 </indexterm>
16821 This variable contains the final portion of a message&#x2019;s
16822 body while it is being delivered. The format and maximum size are as for
16823 <varname>$message_body</varname>.
16824 </para>
16825 </listitem></varlistentry>
16826 <varlistentry>
16827 <term><varname>$message_body_size</varname></term>
16828 <listitem>
16829 <para>
16830 <indexterm role="concept">
16831 <primary>body of message</primary>
16832 <secondary>size</secondary>
16833 </indexterm>
16834 <indexterm role="concept">
16835 <primary>message body</primary>
16836 <secondary>size</secondary>
16837 </indexterm>
16838 <indexterm role="variable">
16839 <primary><varname>$message_body_size</varname></primary>
16840 </indexterm>
16841 When a message is being delivered, this variable contains the size of the body
16842 in bytes. The count starts from the character after the blank line that
16843 separates the body from the header. Newlines are included in the count. See
16844 also <varname>$message_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
16845 </para>
16846 </listitem></varlistentry>
16847 <varlistentry>
16848 <term><varname>$message_exim_id</varname></term>
16849 <listitem>
16850 <para>
16851 <indexterm role="variable">
16852 <primary><varname>$message_exim_id</varname></primary>
16853 </indexterm>
16854 When a message is being received or delivered, this variable contains the
16855 unique message id that is generated and used by Exim to identify the message.
16856 An id is not created for a message until after its header has been successfully
16857 received. <emphasis role="bold">Note</emphasis>: This is <emphasis>not</emphasis> the contents of the <emphasis>Message-ID:</emphasis> header
16858 line; it is the local id that Exim assigns to the message, for example:
16859 <literal>1BXTIK-0001yO-VA</literal>.
16860 </para>
16861 </listitem></varlistentry>
16862 <varlistentry>
16863 <term><varname>$message_headers</varname></term>
16864 <listitem>
16865 <para>
16866 <indexterm role="variable">
16867 <primary><varname>$message_headers</varname></primary>
16868 </indexterm>
16869 This variable contains a concatenation of all the header lines when a message
16870 is being processed, except for lines added by routers or transports. The header
16871 lines are separated by newline characters. Their contents are decoded in the
16872 same way as a header line that is inserted by <option>bheader</option>.
16873 </para>
16874 </listitem></varlistentry>
16875 <varlistentry>
16876 <term><varname>$message_headers_raw</varname></term>
16877 <listitem>
16878 <para>
16879 <indexterm role="variable">
16880 <primary><varname>$message_headers_raw</varname></primary>
16881 </indexterm>
16882 This variable is like <varname>$message_headers</varname> except that no processing of the
16883 contents of header lines is done.
16884 </para>
16885 </listitem></varlistentry>
16886 <varlistentry>
16887 <term><varname>$message_id</varname></term>
16888 <listitem>
16889 <para>
16890 This is an old name for <varname>$message_exim_id</varname>, which is now deprecated.
16891 </para>
16892 </listitem></varlistentry>
16893 <varlistentry>
16894 <term><varname>$message_linecount</varname></term>
16895 <listitem>
16896 <para>
16897 <indexterm role="variable">
16898 <primary><varname>$message_linecount</varname></primary>
16899 </indexterm>
16900 This variable contains the total number of lines in the header and body of the
16901 message. Compare <varname>$body_linecount</varname>, which is the count for the body only.
16902 During the DATA and content-scanning ACLs, <varname>$message_linecount</varname> contains the
16903 number of lines received. Before delivery happens (that is, before filters,
16904 routers, and transports run) the count is increased to include the
16905 <emphasis>Received:</emphasis> header line that Exim standardly adds, and also any other header
16906 lines that are added by ACLs. The blank line that separates the message header
16907 from the body is not counted. Here is an example of the use of this variable in
16908 a DATA ACL:
16909 </para>
16910 <literallayout class="monospaced">
16911 deny message   = Too many lines in message header
16912      condition = \
16913       ${if &lt;{250}{${eval:$message_linecount - $body_linecount}}}
16914 </literallayout>
16915 <para>
16916 In the MAIL and RCPT ACLs, the value is zero because at that stage the
16917 message has not yet been received.
16918 </para>
16919 </listitem></varlistentry>
16920 <varlistentry>
16921 <term><varname>$message_size</varname></term>
16922 <listitem>
16923 <para>
16924 <indexterm role="concept">
16925 <primary>size</primary>
16926 <secondary>of message</secondary>
16927 </indexterm>
16928 <indexterm role="concept">
16929 <primary>message</primary>
16930 <secondary>size</secondary>
16931 </indexterm>
16932 <indexterm role="variable">
16933 <primary><varname>$message_size</varname></primary>
16934 </indexterm>
16935 When a message is being processed, this variable contains its size in bytes. In
16936 most cases, the size includes those headers that were received with the
16937 message, but not those (such as <emphasis>Envelope-to:</emphasis>) that are added to individual
16938 deliveries as they are written. However, there is one special case: during the
16939 expansion of the <option>maildir_tag</option> option in the <command>appendfile</command> transport while
16940 doing a delivery in maildir format, the value of <varname>$message_size</varname> is the
16941 precise size of the file that has been written. See also
16942 <varname>$message_body_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
16943 </para>
16944 <para>
16945 <indexterm role="concept">
16946 <primary>RCPT</primary>
16947 <secondary>value of <varname>$message_size</varname></secondary>
16948 </indexterm>
16949 While running a per message ACL (mail/rcpt/predata), <varname>$message_size</varname>
16950 contains the size supplied on the MAIL command, or -1 if no size was given. The
16951 value may not, of course, be truthful.
16952 </para>
16953 </listitem></varlistentry>
16954 <varlistentry>
16955 <term><varname>$mime_</varname><emphasis>xxx</emphasis></term>
16956 <listitem>
16957 <para>
16958 A number of variables whose names start with <varname>$mime</varname> are
16959 available when Exim is compiled with the content-scanning extension. For
16960 details, see section <xref linkend="SECTscanmimepart"/>.
16961 </para>
16962 </listitem></varlistentry>
16963 <varlistentry>
16964 <term><varname>$n0</varname> &ndash; <varname>$n9</varname></term>
16965 <listitem>
16966 <para>
16967 These variables are counters that can be incremented by means
16968 of the <option>add</option> command in filter files.
16969 </para>
16970 </listitem></varlistentry>
16971 <varlistentry>
16972 <term><varname>$original_domain</varname></term>
16973 <listitem>
16974 <para>
16975 <indexterm role="variable">
16976 <primary><varname>$domain</varname></primary>
16977 </indexterm>
16978 <indexterm role="variable">
16979 <primary><varname>$original_domain</varname></primary>
16980 </indexterm>
16981 When a top-level address is being processed for delivery, this contains the
16982 same value as <varname>$domain</varname>. However, if a <quote>child</quote> address (for example,
16983 generated by an alias, forward, or filter file) is being processed, this
16984 variable contains the domain of the original address (lower cased). This
16985 differs from <varname>$parent_domain</varname> only when there is more than one level of
16986 aliasing or forwarding. When more than one address is being delivered in a
16987 single transport run, <varname>$original_domain</varname> is not set.
16988 </para>
16989 <para>
16990 If a new address is created by means of a <option>deliver</option> command in a system
16991 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
16992 part <emphasis>system-filter</emphasis> and the default qualify domain.
16993 </para>
16994 </listitem></varlistentry>
16995 <varlistentry>
16996 <term><varname>$original_local_part</varname></term>
16997 <listitem>
16998 <para>
16999 <indexterm role="variable">
17000 <primary><varname>$local_part</varname></primary>
17001 </indexterm>
17002 <indexterm role="variable">
17003 <primary><varname>$original_local_part</varname></primary>
17004 </indexterm>
17005 When a top-level address is being processed for delivery, this contains the
17006 same value as <varname>$local_part</varname>, unless a prefix or suffix was removed from the
17007 local part, because <varname>$original_local_part</varname> always contains the full local
17008 part. When a <quote>child</quote> address (for example, generated by an alias, forward, or
17009 filter file) is being processed, this variable contains the full local part of
17010 the original address.
17011 </para>
17012 <para>
17013 If the router that did the redirection processed the local part
17014 case-insensitively, the value in <varname>$original_local_part</varname> is in lower case.
17015 This variable differs from <varname>$parent_local_part</varname> only when there is more than
17016 one level of aliasing or forwarding. When more than one address is being
17017 delivered in a single transport run, <varname>$original_local_part</varname> is not set.
17018 </para>
17019 <para>
17020 If a new address is created by means of a <option>deliver</option> command in a system
17021 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
17022 part <emphasis>system-filter</emphasis> and the default qualify domain.
17023 </para>
17024 </listitem></varlistentry>
17025 <varlistentry>
17026 <term><varname>$originator_gid</varname></term>
17027 <listitem>
17028 <para>
17029 <indexterm role="concept">
17030 <primary>gid (group id)</primary>
17031 <secondary>of originating user</secondary>
17032 </indexterm>
17033 <indexterm role="concept">
17034 <primary>sender</primary>
17035 <secondary>gid</secondary>
17036 </indexterm>
17037 <indexterm role="variable">
17038 <primary><varname>$caller_gid</varname></primary>
17039 </indexterm>
17040 <indexterm role="variable">
17041 <primary><varname>$originator_gid</varname></primary>
17042 </indexterm>
17043 This variable contains the value of <varname>$caller_gid</varname> that was set when the
17044 message was received. For messages received via the command line, this is the
17045 gid of the sending user. For messages received by SMTP over TCP/IP, this is
17046 normally the gid of the Exim user.
17047 </para>
17048 </listitem></varlistentry>
17049 <varlistentry>
17050 <term><varname>$originator_uid</varname></term>
17051 <listitem>
17052 <para>
17053 <indexterm role="concept">
17054 <primary>uid (user id)</primary>
17055 <secondary>of originating user</secondary>
17056 </indexterm>
17057 <indexterm role="concept">
17058 <primary>sender</primary>
17059 <secondary>uid</secondary>
17060 </indexterm>
17061 <indexterm role="variable">
17062 <primary><varname>$caller_uid</varname></primary>
17063 </indexterm>
17064 <indexterm role="variable">
17065 <primary><varname>$originaltor_uid</varname></primary>
17066 </indexterm>
17067 The value of <varname>$caller_uid</varname> that was set when the message was received. For
17068 messages received via the command line, this is the uid of the sending user.
17069 For messages received by SMTP over TCP/IP, this is normally the uid of the Exim
17070 user.
17071 </para>
17072 </listitem></varlistentry>
17073 <varlistentry>
17074 <term><varname>$parent_domain</varname></term>
17075 <listitem>
17076 <para>
17077 <indexterm role="variable">
17078 <primary><varname>$parent_domain</varname></primary>
17079 </indexterm>
17080 This variable is similar to <varname>$original_domain</varname> (see
17081 above), except that it refers to the immediately preceding parent address.
17082 </para>
17083 </listitem></varlistentry>
17084 <varlistentry>
17085 <term><varname>$parent_local_part</varname></term>
17086 <listitem>
17087 <para>
17088 <indexterm role="variable">
17089 <primary><varname>$parent_local_part</varname></primary>
17090 </indexterm>
17091 This variable is similar to <varname>$original_local_part</varname>
17092 (see above), except that it refers to the immediately preceding parent address.
17093 </para>
17094 </listitem></varlistentry>
17095 <varlistentry>
17096 <term><varname>$pid</varname></term>
17097 <listitem>
17098 <para>
17099 <indexterm role="concept">
17100 <primary>pid (process id)</primary>
17101 <secondary>of current process</secondary>
17102 </indexterm>
17103 <indexterm role="variable">
17104 <primary><varname>$pid</varname></primary>
17105 </indexterm>
17106 This variable contains the current process id.
17107 </para>
17108 </listitem></varlistentry>
17109 <varlistentry>
17110 <term><varname>$pipe_addresses</varname></term>
17111 <listitem>
17112 <para>
17113 <indexterm role="concept">
17114 <primary>filter</primary>
17115 <secondary>transport filter</secondary>
17116 </indexterm>
17117 <indexterm role="concept">
17118 <primary>transport</primary>
17119 <secondary>filter</secondary>
17120 </indexterm>
17121 <indexterm role="variable">
17122 <primary><varname>$pipe_addresses</varname></primary>
17123 </indexterm>
17124 This is not an expansion variable, but is mentioned here because the string
17125 <literal>$pipe_addresses</literal> is handled specially in the command specification for the
17126 <command>pipe</command> transport (chapter <xref linkend="CHAPpipetransport"/>) and in transport filters
17127 (described under <option>transport_filter</option> in chapter <xref linkend="CHAPtransportgeneric"/>).
17128 It cannot be used in general expansion strings, and provokes an <quote>unknown
17129 variable</quote> error if encountered.
17130 </para>
17131 </listitem></varlistentry>
17132 <varlistentry>
17133 <term><varname>$primary_hostname</varname></term>
17134 <listitem>
17135 <para>
17136 <indexterm role="variable">
17137 <primary><varname>$primary_hostname</varname></primary>
17138 </indexterm>
17139 This variable contains the value set by <option>primary_hostname</option> in the
17140 configuration file, or read by the <function>uname()</function> function. If <function>uname()</function> returns
17141 a single-component name, Exim calls <function>gethostbyname()</function> (or
17142 <function>getipnodebyname()</function> where available) in an attempt to acquire a fully
17143 qualified host name. See also <varname>$smtp_active_hostname</varname>.
17144 </para>
17145 </listitem></varlistentry>
17146 <varlistentry>
17147 <term><varname>$prvscheck_address</varname></term>
17148 <listitem>
17149 <para>
17150 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
17151 which is described in sections <xref linkend="SECTexpansionitems"/> and
17152 <xref linkend="SECTverifyPRVS"/>.
17153 </para>
17154 </listitem></varlistentry>
17155 <varlistentry>
17156 <term><varname>$prvscheck_keynum</varname></term>
17157 <listitem>
17158 <para>
17159 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
17160 which is described in sections <xref linkend="SECTexpansionitems"/> and
17161 <xref linkend="SECTverifyPRVS"/>.
17162 </para>
17163 </listitem></varlistentry>
17164 <varlistentry>
17165 <term><varname>$prvscheck_result</varname></term>
17166 <listitem>
17167 <para>
17168 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
17169 which is described in sections <xref linkend="SECTexpansionitems"/> and
17170 <xref linkend="SECTverifyPRVS"/>.
17171 </para>
17172 </listitem></varlistentry>
17173 <varlistentry>
17174 <term><varname>$qualify_domain</varname></term>
17175 <listitem>
17176 <para>
17177 <indexterm role="variable">
17178 <primary><varname>$qualify_domain</varname></primary>
17179 </indexterm>
17180 The value set for the <option>qualify_domain</option> option in the configuration file.
17181 </para>
17182 </listitem></varlistentry>
17183 <varlistentry>
17184 <term><varname>$qualify_recipient</varname></term>
17185 <listitem>
17186 <para>
17187 <indexterm role="variable">
17188 <primary><varname>$qualify_recipient</varname></primary>
17189 </indexterm>
17190 The value set for the <option>qualify_recipient</option> option in the configuration file,
17191 or if not set, the value of <varname>$qualify_domain</varname>.
17192 </para>
17193 </listitem></varlistentry>
17194 <varlistentry>
17195 <term><varname>$rcpt_count</varname></term>
17196 <listitem>
17197 <para>
17198 <indexterm role="variable">
17199 <primary><varname>$rcpt_count</varname></primary>
17200 </indexterm>
17201 When a message is being received by SMTP, this variable contains the number of
17202 RCPT commands received for the current message. If this variable is used in a
17203 RCPT ACL, its value includes the current command.
17204 </para>
17205 </listitem></varlistentry>
17206 <varlistentry>
17207 <term><varname>$rcpt_defer_count</varname></term>
17208 <listitem>
17209 <para>
17210 <indexterm role="variable">
17211 <primary><varname>$rcpt_defer_count</varname></primary>
17212 </indexterm>
17213 <indexterm role="concept">
17214 <primary>4<emphasis>xx</emphasis> responses</primary>
17215 <secondary>count of</secondary>
17216 </indexterm>
17217 When a message is being received by SMTP, this variable contains the number of
17218 RCPT commands in the current message that have previously been rejected with a
17219 temporary (4<emphasis>xx</emphasis>) response.
17220 </para>
17221 </listitem></varlistentry>
17222 <varlistentry>
17223 <term><varname>$rcpt_fail_count</varname></term>
17224 <listitem>
17225 <para>
17226 <indexterm role="variable">
17227 <primary><varname>$rcpt_fail_count</varname></primary>
17228 </indexterm>
17229 When a message is being received by SMTP, this variable contains the number of
17230 RCPT commands in the current message that have previously been rejected with a
17231 permanent (5<emphasis>xx</emphasis>) response.
17232 </para>
17233 </listitem></varlistentry>
17234 <varlistentry>
17235 <term><varname>$received_count</varname></term>
17236 <listitem>
17237 <para>
17238 <indexterm role="variable">
17239 <primary><varname>$received_count</varname></primary>
17240 </indexterm>
17241 This variable contains the number of <emphasis>Received:</emphasis> header lines in the message,
17242 including the one added by Exim (so its value is always greater than zero). It
17243 is available in the DATA ACL, the non-SMTP ACL, and while routing and
17244 delivering.
17245 </para>
17246 </listitem></varlistentry>
17247 <varlistentry>
17248 <term><varname>$received_for</varname></term>
17249 <listitem>
17250 <para>
17251 <indexterm role="variable">
17252 <primary><varname>$received_for</varname></primary>
17253 </indexterm>
17254 If there is only a single recipient address in an incoming message, this
17255 variable contains that address when the <emphasis>Received:</emphasis> header line is being
17256 built. The value is copied after recipient rewriting has happened, but before
17257 the <function>local_scan()</function> function is run.
17258 </para>
17259 </listitem></varlistentry>
17260 <varlistentry>
17261 <term><varname>$received_ip_address</varname></term>
17262 <listitem>
17263 <para>
17264 <indexterm role="variable">
17265 <primary><varname>$received_ip_address</varname></primary>
17266 </indexterm>
17267 As soon as an Exim server starts processing an incoming TCP/IP connection, this
17268 variable is set to the address of the local IP interface, and <varname>$received_port</varname>
17269 is set to the local port number. (The remote IP address and port are in
17270 <varname>$sender_host_address</varname> and <varname>$sender_host_port</varname>.) When testing with <option>-bh</option>,
17271 the port value is -1 unless it has been set using the <option>-oMi</option> command line
17272 option.
17273 </para>
17274 <para>
17275 As well as being useful in ACLs (including the <quote>connect</quote> ACL), these variable
17276 could be used, for example, to make the file name for a TLS certificate depend
17277 on which interface and/or port is being used for the incoming connection. The
17278 values of <varname>$received_ip_address</varname> and <varname>$received_port</varname> are saved with any
17279 messages that are received, thus making these variables available at delivery
17280 time.
17281 </para>
17282 <para>
17283 <emphasis role="bold">Note:</emphasis> There are no equivalent variables for outgoing connections, because
17284 the values are unknown (unless they are explicitly set by options of the
17285 <command>smtp</command> transport).
17286 </para>
17287 </listitem></varlistentry>
17288 <varlistentry>
17289 <term><varname>$received_port</varname></term>
17290 <listitem>
17291 <para>
17292 <indexterm role="variable">
17293 <primary><varname>$received_port</varname></primary>
17294 </indexterm>
17295 See <varname>$received_ip_address</varname>.
17296 </para>
17297 </listitem></varlistentry>
17298 <varlistentry>
17299 <term><varname>$received_protocol</varname></term>
17300 <listitem>
17301 <para>
17302 <indexterm role="variable">
17303 <primary><varname>$received_protocol</varname></primary>
17304 </indexterm>
17305 When a message is being processed, this variable contains the name of the
17306 protocol by which it was received. Most of the names used by Exim are defined
17307 by RFCs 821, 2821, and 3848. They start with <quote>smtp</quote> (the client used HELO) or
17308 <quote>esmtp</quote> (the client used EHLO). This can be followed by <quote>s</quote> for secure
17309 (encrypted) and/or <quote>a</quote> for authenticated. Thus, for example, if the protocol
17310 is set to <quote>esmtpsa</quote>, the message was received over an encrypted SMTP
17311 connection and the client was successfully authenticated.
17312 </para>
17313 <para>
17314 Exim uses the protocol name <quote>smtps</quote> for the case when encryption is
17315 automatically set up on connection without the use of STARTTLS (see
17316 <option>tls_on_connect_ports</option>), and the client uses HELO to initiate the
17317 encrypted SMTP session. The name <quote>smtps</quote> is also used for the rare situation
17318 where the client initially uses EHLO, sets up an encrypted connection using
17319 STARTTLS, and then uses HELO afterwards.
17320 </para>
17321 <para>
17322 The <option>-oMr</option> option provides a way of specifying a custom protocol name for
17323 messages that are injected locally by trusted callers. This is commonly used to
17324 identify messages that are being re-injected after some kind of scanning.
17325 </para>
17326 </listitem></varlistentry>
17327 <varlistentry>
17328 <term><varname>$received_time</varname></term>
17329 <listitem>
17330 <para>
17331 <indexterm role="variable">
17332 <primary><varname>$received_time</varname></primary>
17333 </indexterm>
17334 This variable contains the date and time when the current message was received,
17335 as a number of seconds since the start of the Unix epoch.
17336 </para>
17337 </listitem></varlistentry>
17338 <varlistentry>
17339 <term><varname>$recipient_data</varname></term>
17340 <listitem>
17341 <para>
17342 <indexterm role="variable">
17343 <primary><varname>$recipient_data</varname></primary>
17344 </indexterm>
17345 This variable is set after an indexing lookup success in an ACL <option>recipients</option>
17346 condition. It contains the data from the lookup, and the value remains set
17347 until the next <option>recipients</option> test. Thus, you can do things like this:
17348 </para>
17349 <literallayout>
17350 <literal>require recipients  = cdb*@;/some/file</literal>
17351 <literal>deny    </literal><emphasis>some further test involving</emphasis> <literal>$recipient_data</literal>
17352 </literallayout>
17353 <para>
17354 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
17355 method in the address list, using the semicolon syntax as in the example above.
17356 The variable is not set for a lookup that is used as part of the string
17357 expansion that all such lists undergo before being interpreted.
17358 </para>
17359 </listitem></varlistentry>
17360 <varlistentry>
17361 <term><varname>$recipient_verify_failure</varname></term>
17362 <listitem>
17363 <para>
17364 <indexterm role="variable">
17365 <primary><varname>$recipient_verify_failure</varname></primary>
17366 </indexterm>
17367 In an ACL, when a recipient verification fails, this variable contains
17368 information about the failure. It is set to one of the following words:
17369 </para>
17370 <itemizedlist>
17371 <listitem>
17372 <para>
17373 <quote>qualify</quote>: The address was unqualified (no domain), and the message
17374 was neither local nor came from an exempted host.
17375 </para>
17376 </listitem>
17377 <listitem>
17378 <para>
17379 <quote>route</quote>: Routing failed.
17380 </para>
17381 </listitem>
17382 <listitem>
17383 <para>
17384 <quote>mail</quote>: Routing succeeded, and a callout was attempted; rejection occurred at
17385 or before the MAIL command (that is, on initial connection, HELO, or
17386 MAIL).
17387 </para>
17388 </listitem>
17389 <listitem>
17390 <para>
17391 <quote>recipient</quote>: The RCPT command in a callout was rejected.
17392 </para>
17393 </listitem>
17394 <listitem>
17395 <para>
17396 <quote>postmaster</quote>: The postmaster check in a callout was rejected.
17397 </para>
17398 </listitem>
17399 </itemizedlist>
17400 <para>
17401 The main use of this variable is expected to be to distinguish between
17402 rejections of MAIL and rejections of RCPT.
17403 </para>
17404 </listitem></varlistentry>
17405 <varlistentry>
17406 <term><varname>$recipients</varname></term>
17407 <listitem>
17408 <para>
17409 <indexterm role="variable">
17410 <primary><varname>$recipients</varname></primary>
17411 </indexterm>
17412 This variable contains a list of envelope recipients for a message. A comma and
17413 a space separate the addresses in the replacement text. However, the variable
17414 is not generally available, to prevent exposure of Bcc recipients in
17415 unprivileged users&#x2019; filter files. You can use <varname>$recipients</varname> only in these
17416 cases:
17417 </para>
17418 <orderedlist numeration="arabic">
17419 <listitem>
17420 <para>
17421 In a system filter file.
17422 </para>
17423 </listitem>
17424 <listitem>
17425 <para>
17426 In the ACLs associated with the DATA command and with non-SMTP messages, that
17427 is, the ACLs defined by <option>acl_smtp_predata</option>, <option>acl_smtp_data</option>,
17428 <option>acl_smtp_mime</option>, <option>acl_not_smtp_start</option>, <option>acl_not_smtp</option>, and
17429 <option>acl_not_smtp_mime</option>.
17430 </para>
17431 </listitem>
17432 <listitem>
17433 <para>
17434 From within a <function>local_scan()</function> function.
17435 </para>
17436 </listitem>
17437 </orderedlist>
17438 </listitem></varlistentry>
17439 <varlistentry>
17440 <term><varname>$recipients_count</varname></term>
17441 <listitem>
17442 <para>
17443 <indexterm role="variable">
17444 <primary><varname>$recipients_count</varname></primary>
17445 </indexterm>
17446 When a message is being processed, this variable contains the number of
17447 envelope recipients that came with the message. Duplicates are not excluded
17448 from the count. While a message is being received over SMTP, the number
17449 increases for each accepted recipient. It can be referenced in an ACL.
17450 </para>
17451 </listitem></varlistentry>
17452 <varlistentry>
17453 <term><varname>$regex_match_string</varname></term>
17454 <listitem>
17455 <para>
17456 <indexterm role="variable">
17457 <primary><varname>$regex_match_string</varname></primary>
17458 </indexterm>
17459 This variable is set to contain the matching regular expression after a
17460 <option>regex</option> ACL condition has matched (see section <xref linkend="SECTscanregex"/>).
17461 </para>
17462 </listitem></varlistentry>
17463 <varlistentry>
17464 <term><varname>$reply_address</varname></term>
17465 <listitem>
17466 <para>
17467 <indexterm role="variable">
17468 <primary><varname>$reply_address</varname></primary>
17469 </indexterm>
17470 When a message is being processed, this variable contains the contents of the
17471 <emphasis>Reply-To:</emphasis> header line if one exists and it is not empty, or otherwise the
17472 contents of the <emphasis>From:</emphasis> header line. Apart from the removal of leading
17473 white space, the value is not processed in any way. In particular, no RFC 2047
17474 decoding or character code translation takes place.
17475 </para>
17476 </listitem></varlistentry>
17477 <varlistentry>
17478 <term><varname>$return_path</varname></term>
17479 <listitem>
17480 <para>
17481 <indexterm role="variable">
17482 <primary><varname>$return_path</varname></primary>
17483 </indexterm>
17484 When a message is being delivered, this variable contains the return path &ndash;
17485 the sender field that will be sent as part of the envelope. It is not enclosed
17486 in &lt;&gt; characters. At the start of routing an address, <varname>$return_path</varname> has the
17487 same value as <varname>$sender_address</varname>, but if, for example, an incoming message to a
17488 mailing list has been expanded by a router which specifies a different address
17489 for bounce messages, <varname>$return_path</varname> subsequently contains the new bounce
17490 address, whereas <varname>$sender_address</varname> always contains the original sender address
17491 that was received with the message. In other words, <varname>$sender_address</varname> contains
17492 the incoming envelope sender, and <varname>$return_path</varname> contains the outgoing
17493 envelope sender.
17494 </para>
17495 </listitem></varlistentry>
17496 <varlistentry>
17497 <term><varname>$return_size_limit</varname></term>
17498 <listitem>
17499 <para>
17500 <indexterm role="variable">
17501 <primary><varname>$return_size_limit</varname></primary>
17502 </indexterm>
17503 This is an obsolete name for <varname>$bounce_return_size_limit</varname>.
17504 </para>
17505 </listitem></varlistentry>
17506 <varlistentry>
17507 <term><varname>$runrc</varname></term>
17508 <listitem>
17509 <para>
17510 <indexterm role="concept">
17511 <primary>return code</primary>
17512 <secondary>from <option>run</option> expansion</secondary>
17513 </indexterm>
17514 <indexterm role="variable">
17515 <primary><varname>$runrc</varname></primary>
17516 </indexterm>
17517 This variable contains the return code from a command that is run by the
17518 <option>${run...}</option> expansion item. <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot
17519 assume the order in which option values are expanded, except for those
17520 preconditions whose order of testing is documented. Therefore, you cannot
17521 reliably expect to set <varname>$runrc</varname> by the expansion of one option, and use it in
17522 another.
17523 </para>
17524 </listitem></varlistentry>
17525 <varlistentry>
17526 <term><varname>$self_hostname</varname></term>
17527 <listitem>
17528 <para>
17529 <indexterm role="option">
17530 <primary><option>self</option></primary>
17531 <secondary>value of host name</secondary>
17532 </indexterm>
17533 <indexterm role="variable">
17534 <primary><varname>$self_hostname</varname></primary>
17535 </indexterm>
17536 When an address is routed to a supposedly remote host that turns out to be the
17537 local host, what happens is controlled by the <option>self</option> generic router option.
17538 One of its values causes the address to be passed to another router. When this
17539 happens, <varname>$self_hostname</varname> is set to the name of the local host that the
17540 original router encountered. In other circumstances its contents are null.
17541 </para>
17542 </listitem></varlistentry>
17543 <varlistentry>
17544 <term><varname>$sender_address</varname></term>
17545 <listitem>
17546 <para>
17547 <indexterm role="variable">
17548 <primary><varname>$sender_address</varname></primary>
17549 </indexterm>
17550 When a message is being processed, this variable contains the sender&#x2019;s address
17551 that was received in the message&#x2019;s envelope. The case of letters in the address
17552 is retained, in both the local part and the domain. For bounce messages, the
17553 value of this variable is the empty string. See also <varname>$return_path</varname>.
17554 </para>
17555 </listitem></varlistentry>
17556 <varlistentry>
17557 <term><varname>$sender_address_data</varname></term>
17558 <listitem>
17559 <para>
17560 <indexterm role="variable">
17561 <primary><varname>$address_data</varname></primary>
17562 </indexterm>
17563 <indexterm role="variable">
17564 <primary><varname>$sender_address_data</varname></primary>
17565 </indexterm>
17566 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
17567 sender address, the final value is preserved in <varname>$sender_address_data</varname>, to
17568 distinguish it from data from a recipient address. The value does not persist
17569 after the end of the current ACL statement. If you want to preserve it for
17570 longer, you can save it in an ACL variable.
17571 </para>
17572 </listitem></varlistentry>
17573 <varlistentry>
17574 <term><varname>$sender_address_domain</varname></term>
17575 <listitem>
17576 <para>
17577 <indexterm role="variable">
17578 <primary><varname>$sender_address_domain</varname></primary>
17579 </indexterm>
17580 The domain portion of <varname>$sender_address</varname>.
17581 </para>
17582 </listitem></varlistentry>
17583 <varlistentry>
17584 <term><varname>$sender_address_local_part</varname></term>
17585 <listitem>
17586 <para>
17587 <indexterm role="variable">
17588 <primary><varname>$sender_address_local_part</varname></primary>
17589 </indexterm>
17590 The local part portion of <varname>$sender_address</varname>.
17591 </para>
17592 </listitem></varlistentry>
17593 <varlistentry>
17594 <term><varname>$sender_data</varname></term>
17595 <listitem>
17596 <para>
17597 <indexterm role="variable">
17598 <primary><varname>$sender_data</varname></primary>
17599 </indexterm>
17600 This variable is set after a lookup success in an ACL <option>senders</option> condition or
17601 in a router <option>senders</option> option. It contains the data from the lookup, and the
17602 value remains set until the next <option>senders</option> test. Thus, you can do things like
17603 this:
17604 </para>
17605 <literallayout>
17606 <literal>require senders      = cdb*@;/some/file</literal>
17607 <literal>deny    </literal><emphasis>some further test involving</emphasis> <literal>$sender_data</literal>
17608 </literallayout>
17609 <para>
17610 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
17611 method in the address list, using the semicolon syntax as in the example above.
17612 The variable is not set for a lookup that is used as part of the string
17613 expansion that all such lists undergo before being interpreted.
17614 </para>
17615 </listitem></varlistentry>
17616 <varlistentry>
17617 <term><varname>$sender_fullhost</varname></term>
17618 <listitem>
17619 <para>
17620 <indexterm role="variable">
17621 <primary><varname>$sender_fullhost</varname></primary>
17622 </indexterm>
17623 When a message is received from a remote host, this variable contains the host
17624 name and IP address in a single string. It ends with the IP address in square
17625 brackets, followed by a colon and a port number if the logging of ports is
17626 enabled. The format of the rest of the string depends on whether the host
17627 issued a HELO or EHLO SMTP command, and whether the host name was verified by
17628 looking up its IP address. (Looking up the IP address can be forced by the
17629 <option>host_lookup</option> option, independent of verification.) A plain host name at the
17630 start of the string is a verified host name; if this is not present,
17631 verification either failed or was not requested. A host name in parentheses is
17632 the argument of a HELO or EHLO command. This is omitted if it is identical to
17633 the verified host name or to the host&#x2019;s IP address in square brackets.
17634 </para>
17635 </listitem></varlistentry>
17636 <varlistentry>
17637 <term><varname>$sender_helo_name</varname></term>
17638 <listitem>
17639 <para>
17640 <indexterm role="variable">
17641 <primary><varname>$sender_helo_name</varname></primary>
17642 </indexterm>
17643 When a message is received from a remote host that has issued a HELO or EHLO
17644 command, the argument of that command is placed in this variable. It is also
17645 set if HELO or EHLO is used when a message is received using SMTP locally via
17646 the <option>-bs</option> or <option>-bS</option> options.
17647 </para>
17648 </listitem></varlistentry>
17649 <varlistentry>
17650 <term><varname>$sender_host_address</varname></term>
17651 <listitem>
17652 <para>
17653 <indexterm role="variable">
17654 <primary><varname>$sender_host_address</varname></primary>
17655 </indexterm>
17656 When a message is received from a remote host, this variable contains that
17657 host&#x2019;s IP address. For locally submitted messages, it is empty.
17658 </para>
17659 </listitem></varlistentry>
17660 <varlistentry>
17661 <term><varname>$sender_host_authenticated</varname></term>
17662 <listitem>
17663 <para>
17664 <indexterm role="variable">
17665 <primary><varname>$sender_host_authenticated</varname></primary>
17666 </indexterm>
17667 This variable contains the name (not the public name) of the authenticator
17668 driver that successfully authenticated the client from which the message was
17669 received. It is empty if there was no successful authentication. See also
17670 <varname>$authenticated_id</varname>.
17671 </para>
17672 </listitem></varlistentry>
17673 <varlistentry>
17674 <term><varname>$sender_host_name</varname></term>
17675 <listitem>
17676 <para>
17677 <indexterm role="variable">
17678 <primary><varname>$sender_host_name</varname></primary>
17679 </indexterm>
17680 When a message is received from a remote host, this variable contains the
17681 host&#x2019;s name as obtained by looking up its IP address. For messages received by
17682 other means, this variable is empty.
17683 </para>
17684 <para>
17685 <indexterm role="variable">
17686 <primary><varname>$host_lookup_failed</varname></primary>
17687 </indexterm>
17688 If the host name has not previously been looked up, a reference to
17689 <varname>$sender_host_name</varname> triggers a lookup (for messages from remote hosts).
17690 A looked up name is accepted only if it leads back to the original IP address
17691 via a forward lookup. If either the reverse or the forward lookup fails to find
17692 any data, or if the forward lookup does not yield the original IP address,
17693 <varname>$sender_host_name</varname> remains empty, and <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
17694 </para>
17695 <para>
17696 <indexterm role="variable">
17697 <primary><varname>$host_lookup_deferred</varname></primary>
17698 </indexterm>
17699 However, if either of the lookups cannot be completed (for example, there is a
17700 DNS timeout), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>, and
17701 <varname>$host_lookup_failed</varname> remains set to <quote>0</quote>.
17702 </para>
17703 <para>
17704 Once <varname>$host_lookup_failed</varname> is set to <quote>1</quote>, Exim does not try to look up the
17705 host name again if there is a subsequent reference to <varname>$sender_host_name</varname>
17706 in the same Exim process, but it does try again if <varname>$host_lookup_deferred</varname>
17707 is set to <quote>1</quote>.
17708 </para>
17709 <para>
17710 Exim does not automatically look up every calling host&#x2019;s name. If you want
17711 maximum efficiency, you should arrange your configuration so that it avoids
17712 these lookups altogether. The lookup happens only if one or more of the
17713 following are true:
17714 </para>
17715 <itemizedlist>
17716 <listitem>
17717 <para>
17718 A string containing <varname>$sender_host_name</varname> is expanded.
17719 </para>
17720 </listitem>
17721 <listitem>
17722 <para>
17723 The calling host matches the list in <option>host_lookup</option>. In the default
17724 configuration, this option is set to *, so it must be changed if lookups are
17725 to be avoided. (In the code, the default for <option>host_lookup</option> is unset.)
17726 </para>
17727 </listitem>
17728 <listitem>
17729 <para>
17730 Exim needs the host name in order to test an item in a host list. The items
17731 that require this are described in sections <xref linkend="SECThoslispatnam"/> and
17732 <xref linkend="SECThoslispatnamsk"/>.
17733 </para>
17734 </listitem>
17735 <listitem>
17736 <para>
17737 The calling host matches <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>.
17738 In this case, the host name is required to compare with the name quoted in any
17739 EHLO or HELO commands that the client issues.
17740 </para>
17741 </listitem>
17742 <listitem>
17743 <para>
17744 The remote host issues a EHLO or HELO command that quotes one of the
17745 domains in <option>helo_lookup_domains</option>. The default value of this option is
17746 </para>
17747 <literallayout class="monospaced">
17748   helo_lookup_domains = @ : @[]
17749 </literallayout>
17750 <para>
17751 which causes a lookup if a remote host (incorrectly) gives the server&#x2019;s name or
17752 IP address in an EHLO or HELO command.
17753 </para>
17754 </listitem>
17755 </itemizedlist>
17756 </listitem></varlistentry>
17757 <varlistentry>
17758 <term><varname>$sender_host_port</varname></term>
17759 <listitem>
17760 <para>
17761 <indexterm role="variable">
17762 <primary><varname>$sender_host_port</varname></primary>
17763 </indexterm>
17764 When a message is received from a remote host, this variable contains the port
17765 number that was used on the remote host.
17766 </para>
17767 </listitem></varlistentry>
17768 <varlistentry>
17769 <term><varname>$sender_ident</varname></term>
17770 <listitem>
17771 <para>
17772 <indexterm role="variable">
17773 <primary><varname>$sender_ident</varname></primary>
17774 </indexterm>
17775 When a message is received from a remote host, this variable contains the
17776 identification received in response to an RFC 1413 request. When a message has
17777 been received locally, this variable contains the login name of the user that
17778 called Exim.
17779 </para>
17780 </listitem></varlistentry>
17781 <varlistentry>
17782 <term><varname>$sender_rate_</varname><emphasis>xxx</emphasis></term>
17783 <listitem>
17784 <para>
17785 A number of variables whose names begin <varname>$sender_rate_</varname> are set as part of the
17786 <option>ratelimit</option> ACL condition. Details are given in section
17787 <xref linkend="SECTratelimiting"/>.
17788 </para>
17789 </listitem></varlistentry>
17790 <varlistentry>
17791 <term><varname>$sender_rcvhost</varname></term>
17792 <listitem>
17793 <para>
17794 <indexterm role="concept">
17795 <primary>DNS</primary>
17796 <secondary>reverse lookup</secondary>
17797 </indexterm>
17798 <indexterm role="concept">
17799 <primary>reverse DNS lookup</primary>
17800 </indexterm>
17801 <indexterm role="variable">
17802 <primary><varname>$sender_rcvhost</varname></primary>
17803 </indexterm>
17804 This is provided specifically for use in <emphasis>Received:</emphasis> headers. It starts with
17805 either the verified host name (as obtained from a reverse DNS lookup) or, if
17806 there is no verified host name, the IP address in square brackets. After that
17807 there may be text in parentheses. When the first item is a verified host name,
17808 the first thing in the parentheses is the IP address in square brackets,
17809 followed by a colon and a port number if port logging is enabled. When the
17810 first item is an IP address, the port is recorded as <quote>port=<emphasis>xxxx</emphasis></quote> inside
17811 the parentheses.
17812 </para>
17813 <para>
17814 There may also be items of the form <quote>helo=<emphasis>xxxx</emphasis></quote> if HELO or EHLO
17815 was used and its argument was not identical to the real host name or IP
17816 address, and <quote>ident=<emphasis>xxxx</emphasis></quote> if an RFC 1413 ident string is available. If
17817 all three items are present in the parentheses, a newline and tab are inserted
17818 into the string, to improve the formatting of the <emphasis>Received:</emphasis> header.
17819 </para>
17820 </listitem></varlistentry>
17821 <varlistentry>
17822 <term><varname>$sender_verify_failure</varname></term>
17823 <listitem>
17824 <para>
17825 <indexterm role="variable">
17826 <primary><varname>$sender_verify_failure</varname></primary>
17827 </indexterm>
17828 In an ACL, when a sender verification fails, this variable contains information
17829 about the failure. The details are the same as for
17830 <varname>$recipient_verify_failure</varname>.
17831 </para>
17832 </listitem></varlistentry>
17833 <varlistentry>
17834 <term><varname>$sending_ip_address</varname></term>
17835 <listitem>
17836 <para>
17837 <indexterm role="variable">
17838 <primary><varname>$sending_ip_address</varname></primary>
17839 </indexterm>
17840 This variable is set whenever an outgoing SMTP connection to another host has
17841 been set up. It contains the IP address of the local interface that is being
17842 used. This is useful if a host that has more than one IP address wants to take
17843 on different personalities depending on which one is being used. For incoming
17844 connections, see <varname>$received_ip_address</varname>.
17845 </para>
17846 </listitem></varlistentry>
17847 <varlistentry>
17848 <term><varname>$sending_port</varname></term>
17849 <listitem>
17850 <para>
17851 <indexterm role="variable">
17852 <primary><varname>$sending_port</varname></primary>
17853 </indexterm>
17854 This variable is set whenever an outgoing SMTP connection to another host has
17855 been set up. It contains the local port that is being used. For incoming
17856 connections, see <varname>$received_port</varname>.
17857 </para>
17858 </listitem></varlistentry>
17859 <varlistentry>
17860 <term><varname>$smtp_active_hostname</varname></term>
17861 <listitem>
17862 <para>
17863 <indexterm role="variable">
17864 <primary><varname>$smtp_active_hostname</varname></primary>
17865 </indexterm>
17866 During an incoming SMTP session, this variable contains the value of the active
17867 host name, as specified by the <option>smtp_active_hostname</option> option. The value of
17868 <varname>$smtp_active_hostname</varname> is saved with any message that is received, so its
17869 value can be consulted during routing and delivery.
17870 </para>
17871 </listitem></varlistentry>
17872 <varlistentry>
17873 <term><varname>$smtp_command</varname></term>
17874 <listitem>
17875 <para>
17876 <indexterm role="variable">
17877 <primary><varname>$smtp_command</varname></primary>
17878 </indexterm>
17879 During the processing of an incoming SMTP command, this variable contains the
17880 entire command. This makes it possible to distinguish between HELO and EHLO in
17881 the HELO ACL, and also to distinguish between commands such as these:
17882 </para>
17883 <literallayout class="monospaced">
17884 MAIL FROM:&lt;&gt;
17885 MAIL FROM: &lt;&gt;
17886 </literallayout>
17887 <para>
17888 For a MAIL command, extra parameters such as SIZE can be inspected. For a RCPT
17889 command, the address in <varname>$smtp_command</varname> is the original address before any
17890 rewriting, whereas the values in <varname>$local_part</varname> and <varname>$domain</varname> are taken from
17891 the address after SMTP-time rewriting.
17892 </para>
17893 </listitem></varlistentry>
17894 <varlistentry>
17895 <term><varname>$smtp_command_argument</varname></term>
17896 <listitem>
17897 <para>
17898 <indexterm role="concept">
17899 <primary>SMTP</primary>
17900 <secondary>command, argument for</secondary>
17901 </indexterm>
17902 <indexterm role="variable">
17903 <primary><varname>$smtp_command_argument</varname></primary>
17904 </indexterm>
17905 While an ACL is running to check an SMTP command, this variable contains the
17906 argument, that is, the text that follows the command name, with leading white
17907 space removed. Following the introduction of <varname>$smtp_command</varname>, this variable is
17908 somewhat redundant, but is retained for backwards compatibility.
17909 </para>
17910 </listitem></varlistentry>
17911 <varlistentry>
17912 <term><varname>$smtp_count_at_connection_start</varname></term>
17913 <listitem>
17914 <para>
17915 <indexterm role="variable">
17916 <primary><varname>$smtp_count_at_connection_start</varname></primary>
17917 </indexterm>
17918 This variable is set greater than zero only in processes spawned by the Exim
17919 daemon for handling incoming SMTP connections. The name is deliberately long,
17920 in order to emphasize what the contents are. When the daemon accepts a new
17921 connection, it increments this variable. A copy of the variable is passed to
17922 the child process that handles the connection, but its value is fixed, and
17923 never changes. It is only an approximation of how many incoming connections
17924 there actually are, because many other connections may come and go while a
17925 single connection is being processed. When a child process terminates, the
17926 daemon decrements its copy of the variable.
17927 </para>
17928 </listitem></varlistentry>
17929 <varlistentry>
17930 <term><varname>$sn0</varname> &ndash; <varname>$sn9</varname></term>
17931 <listitem>
17932 <para>
17933 These variables are copies of the values of the <varname>$n0</varname> &ndash; <varname>$n9</varname> accumulators
17934 that were current at the end of the system filter file. This allows a system
17935 filter file to set values that can be tested in users&#x2019; filter files. For
17936 example, a system filter could set a value indicating how likely it is that a
17937 message is junk mail.
17938 </para>
17939 </listitem></varlistentry>
17940 <varlistentry>
17941 <term><varname>$spam_</varname><emphasis>xxx</emphasis></term>
17942 <listitem>
17943 <para>
17944 A number of variables whose names start with <varname>$spam</varname> are available when Exim
17945 is compiled with the content-scanning extension. For details, see section
17946 <xref linkend="SECTscanspamass"/>.
17947 </para>
17948 </listitem></varlistentry>
17949 <varlistentry>
17950 <term><varname>$spool_directory</varname></term>
17951 <listitem>
17952 <para>
17953 <indexterm role="variable">
17954 <primary><varname>$spool_directory</varname></primary>
17955 </indexterm>
17956 The name of Exim&#x2019;s spool directory.
17957 </para>
17958 </listitem></varlistentry>
17959 <varlistentry>
17960 <term><varname>$spool_inodes</varname></term>
17961 <listitem>
17962 <para>
17963 <indexterm role="variable">
17964 <primary><varname>$spool_inodes</varname></primary>
17965 </indexterm>
17966 The number of free inodes in the disk partition where Exim&#x2019;s spool files are
17967 being written. The value is recalculated whenever the variable is referenced.
17968 If the relevant file system does not have the concept of inodes, the value of
17969 is -1. See also the <option>check_spool_inodes</option> option.
17970 </para>
17971 </listitem></varlistentry>
17972 <varlistentry>
17973 <term><varname>$spool_space</varname></term>
17974 <listitem>
17975 <para>
17976 <indexterm role="variable">
17977 <primary><varname>$spool_space</varname></primary>
17978 </indexterm>
17979 The amount of free space (as a number of kilobytes) in the disk partition where
17980 Exim&#x2019;s spool files are being written. The value is recalculated whenever the
17981 variable is referenced. If the operating system does not have the ability to
17982 find the amount of free space (only true for experimental systems), the space
17983 value is -1. For example, to check in an ACL that there is at least 50
17984 megabytes free on the spool, you could write:
17985 </para>
17986 <literallayout class="monospaced">
17987 condition = ${if &gt; {$spool_space}{50000}}
17988 </literallayout>
17989 <para>
17990 See also the <option>check_spool_space</option> option.
17991 </para>
17992 </listitem></varlistentry>
17993 <varlistentry>
17994 <term><varname>$thisaddress</varname></term>
17995 <listitem>
17996 <para>
17997 <indexterm role="variable">
17998 <primary><varname>$thisaddress</varname></primary>
17999 </indexterm>
18000 This variable is set only during the processing of the <option>foranyaddress</option>
18001 command in a filter file. Its use is explained in the description of that
18002 command, which can be found in the separate document entitled <emphasis>Exim&#x2019;s
18003 interfaces to mail filtering</emphasis>.
18004 </para>
18005 </listitem></varlistentry>
18006 <varlistentry>
18007 <term><varname>$tls_certificate_verified</varname></term>
18008 <listitem>
18009 <para>
18010 <indexterm role="variable">
18011 <primary><varname>$tls_certificate_verified</varname></primary>
18012 </indexterm>
18013 This variable is set to <quote>1</quote> if a TLS certificate was verified when the
18014 message was received, and <quote>0</quote> otherwise.
18015 </para>
18016 </listitem></varlistentry>
18017 <varlistentry>
18018 <term><varname>$tls_cipher</varname></term>
18019 <listitem>
18020 <para>
18021 <indexterm role="variable">
18022 <primary><varname>$tls_cipher</varname></primary>
18023 </indexterm>
18024 When a message is received from a remote host over an encrypted SMTP
18025 connection, this variable is set to the cipher suite that was negotiated, for
18026 example DES-CBC3-SHA. In other circumstances, in particular, for message
18027 received over unencrypted connections, the variable is empty. Testing
18028 <varname>$tls_cipher</varname> for emptiness is one way of distinguishing between encrypted and
18029 non-encrypted connections during ACL processing.
18030 </para>
18031 <para>
18032 The <varname>$tls_cipher</varname> variable retains its value during message delivery, except
18033 when an outward SMTP delivery takes place via the <command>smtp</command> transport. In this
18034 case, <varname>$tls_cipher</varname> is cleared before any outgoing SMTP connection is made,
18035 and then set to the outgoing cipher suite if one is negotiated. See chapter
18036 <xref linkend="CHAPTLS"/> for details of TLS support and chapter <xref linkend="CHAPsmtptrans"/> for
18037 details of the <command>smtp</command> transport.
18038 </para>
18039 </listitem></varlistentry>
18040 <varlistentry>
18041 <term><varname>$tls_peerdn</varname></term>
18042 <listitem>
18043 <para>
18044 <indexterm role="variable">
18045 <primary><varname>$tls_peerdn</varname></primary>
18046 </indexterm>
18047 When a message is received from a remote host over an encrypted SMTP
18048 connection, and Exim is configured to request a certificate from the client,
18049 the value of the Distinguished Name of the certificate is made available in the
18050 <varname>$tls_peerdn</varname> during subsequent processing. Like <varname>$tls_cipher</varname>, the
18051 value is retained during message delivery, except during outbound SMTP
18052 deliveries.
18053 </para>
18054 </listitem></varlistentry>
18055 <varlistentry>
18056 <term><varname>$tod_bsdinbox</varname></term>
18057 <listitem>
18058 <para>
18059 <indexterm role="variable">
18060 <primary><varname>$tod_bsdinbox</varname></primary>
18061 </indexterm>
18062 The time of day and the date, in the format required for BSD-style mailbox
18063 files, for example: Thu Oct 17 17:14:09 1995.
18064 </para>
18065 </listitem></varlistentry>
18066 <varlistentry>
18067 <term><varname>$tod_epoch</varname></term>
18068 <listitem>
18069 <para>
18070 <indexterm role="variable">
18071 <primary><varname>$tod_epoch</varname></primary>
18072 </indexterm>
18073 The time and date as a number of seconds since the start of the Unix epoch.
18074 </para>
18075 </listitem></varlistentry>
18076 <varlistentry>
18077 <term><varname>$tod_full</varname></term>
18078 <listitem>
18079 <para>
18080 <indexterm role="variable">
18081 <primary><varname>$tod_full</varname></primary>
18082 </indexterm>
18083 A full version of the time and date, for example: Wed, 16 Oct 1995 09:51:40
18084 +0100. The timezone is always given as a numerical offset from UTC, with
18085 positive values used for timezones that are ahead (east) of UTC, and negative
18086 values for those that are behind (west).
18087 </para>
18088 </listitem></varlistentry>
18089 <varlistentry>
18090 <term><varname>$tod_log</varname></term>
18091 <listitem>
18092 <para>
18093 <indexterm role="variable">
18094 <primary><varname>$tod_log</varname></primary>
18095 </indexterm>
18096 The time and date in the format used for writing Exim&#x2019;s log files, for example:
18097 1995-10-12 15:32:29, but without a timezone.
18098 </para>
18099 </listitem></varlistentry>
18100 <varlistentry>
18101 <term><varname>$tod_logfile</varname></term>
18102 <listitem>
18103 <para>
18104 <indexterm role="variable">
18105 <primary><varname>$tod_logfile</varname></primary>
18106 </indexterm>
18107 This variable contains the date in the format yyyymmdd. This is the format that
18108 is used for datestamping log files when <option>log_file_path</option> contains the <literal>%D</literal>
18109 flag.
18110 </para>
18111 </listitem></varlistentry>
18112 <varlistentry>
18113 <term><varname>$tod_zone</varname></term>
18114 <listitem>
18115 <para>
18116 <indexterm role="variable">
18117 <primary><varname>$tod_zone</varname></primary>
18118 </indexterm>
18119 This variable contains the numerical value of the local timezone, for example:
18120 -0500.
18121 </para>
18122 </listitem></varlistentry>
18123 <varlistentry>
18124 <term><varname>$tod_zulu</varname></term>
18125 <listitem>
18126 <para>
18127 <indexterm role="variable">
18128 <primary><varname>$tod_zulu</varname></primary>
18129 </indexterm>
18130 This variable contains the UTC date and time in <quote>Zulu</quote> format, as specified
18131 by ISO 8601, for example: 20030221154023Z.
18132 </para>
18133 </listitem></varlistentry>
18134 <varlistentry>
18135 <term><varname>$value</varname></term>
18136 <listitem>
18137 <para>
18138 <indexterm role="variable">
18139 <primary><varname>$value</varname></primary>
18140 </indexterm>
18141 This variable contains the result of an expansion lookup, extraction operation,
18142 or external command, as described above. It is also used during a
18143 <emphasis role="bold">reduce</emphasis> expansion.
18144 </para>
18145 </listitem></varlistentry>
18146 <varlistentry>
18147 <term><varname>$version_number</varname></term>
18148 <listitem>
18149 <para>
18150 <indexterm role="variable">
18151 <primary><varname>$version_number</varname></primary>
18152 </indexterm>
18153 The version number of Exim.
18154 </para>
18155 </listitem></varlistentry>
18156 <varlistentry>
18157 <term><varname>$warn_message_delay</varname></term>
18158 <listitem>
18159 <para>
18160 <indexterm role="variable">
18161 <primary><varname>$warn_message_delay</varname></primary>
18162 </indexterm>
18163 This variable is set only during the creation of a message warning about a
18164 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
18165 </para>
18166 </listitem></varlistentry>
18167 <varlistentry>
18168 <term><varname>$warn_message_recipients</varname></term>
18169 <listitem>
18170 <para>
18171 <indexterm role="variable">
18172 <primary><varname>$warn_message_recipients</varname></primary>
18173 </indexterm>
18174 This variable is set only during the creation of a message warning about a
18175 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
18176 </para>
18177 </listitem></varlistentry>
18178 </variablelist>
18179 <para>
18180 <indexterm role="concept" startref="IIDstrexp" class="endofrange"/>
18181 </para>
18182 </section>
18183 </chapter>
18184
18185 <chapter id="CHAPperl">
18186 <title>Embedded Perl</title>
18187 <para>
18188 <indexterm role="concept" id="IIDperl" class="startofrange">
18189 <primary>Perl</primary>
18190 <secondary>calling from Exim</secondary>
18191 </indexterm>
18192 Exim can be built to include an embedded Perl interpreter. When this is done,
18193 Perl subroutines can be called as part of the string expansion process. To make
18194 use of the Perl support, you need version 5.004 or later of Perl installed on
18195 your system. To include the embedded interpreter in the Exim binary, include
18196 the line
18197 </para>
18198 <literallayout class="monospaced">
18199 EXIM_PERL = perl.o
18200 </literallayout>
18201 <para>
18202 in your <filename>Local/Makefile</filename> and then build Exim in the normal way.
18203 </para>
18204 <section id="SECID85">
18205 <title>Setting up so Perl can be used</title>
18206 <para>
18207 <indexterm role="option">
18208 <primary><option>perl_startup</option></primary>
18209 </indexterm>
18210 Access to Perl subroutines is via a global configuration option called
18211 <option>perl_startup</option> and an expansion string operator <option>${perl ...}</option>. If there is
18212 no <option>perl_startup</option> option in the Exim configuration file then no Perl
18213 interpreter is started and there is almost no overhead for Exim (since none of
18214 the Perl library will be paged in unless used). If there is a <option>perl_startup</option>
18215 option then the associated value is taken to be Perl code which is executed in
18216 a newly created Perl interpreter.
18217 </para>
18218 <para>
18219 The value of <option>perl_startup</option> is not expanded in the Exim sense, so you do not
18220 need backslashes before any characters to escape special meanings. The option
18221 should usually be something like
18222 </para>
18223 <literallayout class="monospaced">
18224 perl_startup = do '/etc/exim.pl'
18225 </literallayout>
18226 <para>
18227 where <filename>/etc/exim.pl</filename> is Perl code which defines any subroutines you want to
18228 use from Exim. Exim can be configured either to start up a Perl interpreter as
18229 soon as it is entered, or to wait until the first time it is needed. Starting
18230 the interpreter at the beginning ensures that it is done while Exim still has
18231 its setuid privilege, but can impose an unnecessary overhead if Perl is not in
18232 fact used in a particular run. Also, note that this does not mean that Exim is
18233 necessarily running as root when Perl is called at a later time. By default,
18234 the interpreter is started only when it is needed, but this can be changed in
18235 two ways:
18236 </para>
18237 <itemizedlist>
18238 <listitem>
18239 <para>
18240 <indexterm role="option">
18241 <primary><option>perl_at_start</option></primary>
18242 </indexterm>
18243 Setting <option>perl_at_start</option> (a boolean option) in the configuration requests
18244 a startup when Exim is entered.
18245 </para>
18246 </listitem>
18247 <listitem>
18248 <para>
18249 The command line option <option>-ps</option> also requests a startup when Exim is entered,
18250 overriding the setting of <option>perl_at_start</option>.
18251 </para>
18252 </listitem>
18253 </itemizedlist>
18254 <para>
18255 There is also a command line option <option>-pd</option> (for delay) which suppresses the
18256 initial startup, even if <option>perl_at_start</option> is set.
18257 </para>
18258 </section>
18259 <section id="SECID86">
18260 <title>Calling Perl subroutines</title>
18261 <para>
18262 When the configuration file includes a <option>perl_startup</option> option you can make use
18263 of the string expansion item to call the Perl subroutines that are defined
18264 by the <option>perl_startup</option> code. The operator is used in any of the following
18265 forms:
18266 </para>
18267 <literallayout class="monospaced">
18268 ${perl{foo}}
18269 ${perl{foo}{argument}}
18270 ${perl{foo}{argument1}{argument2} ... }
18271 </literallayout>
18272 <para>
18273 which calls the subroutine <option>foo</option> with the given arguments. A maximum of eight
18274 arguments may be passed. Passing more than this results in an expansion failure
18275 with an error message of the form
18276 </para>
18277 <literallayout class="monospaced">
18278 Too many arguments passed to Perl subroutine "foo" (max is 8)
18279 </literallayout>
18280 <para>
18281 The return value of the Perl subroutine is evaluated in a scalar context before
18282 it is passed back to Exim to be inserted into the expanded string. If the
18283 return value is <emphasis>undef</emphasis>, the expansion is forced to fail in the same way as
18284 an explicit <quote>fail</quote> on an <option>if</option> or <option>lookup</option> item. If the subroutine aborts
18285 by obeying Perl&#x2019;s <option>die</option> function, the expansion fails with the error message
18286 that was passed to <option>die</option>.
18287 </para>
18288 </section>
18289 <section id="SECID87">
18290 <title>Calling Exim functions from Perl</title>
18291 <para>
18292 Within any Perl code called from Exim, the function <emphasis>Exim::expand_string()</emphasis>
18293 is available to call back into Exim&#x2019;s string expansion function. For example,
18294 the Perl code
18295 </para>
18296 <literallayout class="monospaced">
18297 my $lp = Exim::expand_string('$local_part');
18298 </literallayout>
18299 <para>
18300 makes the current Exim <varname>$local_part</varname> available in the Perl variable <varname>$lp</varname>.
18301 Note those are single quotes and not double quotes to protect against
18302 <varname>$local_part</varname> being interpolated as a Perl variable.
18303 </para>
18304 <para>
18305 If the string expansion is forced to fail by a <quote>fail</quote> item, the result of
18306 <emphasis>Exim::expand_string()</emphasis> is <option>undef</option>. If there is a syntax error in the
18307 expansion string, the Perl call from the original expansion string fails with
18308 an appropriate error message, in the same way as if <option>die</option> were used.
18309 </para>
18310 <para>
18311 <indexterm role="concept">
18312 <primary>debugging</primary>
18313 <secondary>from embedded Perl</secondary>
18314 </indexterm>
18315 <indexterm role="concept">
18316 <primary>log</primary>
18317 <secondary>writing from embedded Perl</secondary>
18318 </indexterm>
18319 Two other Exim functions are available for use from within Perl code.
18320 <emphasis>Exim::debug_write()</emphasis> writes a string to the standard error stream if Exim&#x2019;s
18321 debugging is enabled. If you want a newline at the end, you must supply it.
18322 <emphasis>Exim::log_write()</emphasis> writes a string to Exim&#x2019;s main log, adding a leading
18323 timestamp. In this case, you should not supply a terminating newline.
18324 </para>
18325 </section>
18326 <section id="SECID88">
18327 <title>Use of standard output and error by Perl</title>
18328 <para>
18329 <indexterm role="concept">
18330 <primary>Perl</primary>
18331 <secondary>standard output and error</secondary>
18332 </indexterm>
18333 You should not write to the standard error or output streams from within your
18334 Perl code, as it is not defined how these are set up. In versions of Exim
18335 before 4.50, it is possible for the standard output or error to refer to the
18336 SMTP connection during message reception via the daemon. Writing to this stream
18337 is certain to cause chaos. From Exim 4.50 onwards, the standard output and
18338 error streams are connected to <filename>/dev/null</filename> in the daemon. The chaos is
18339 avoided, but the output is lost.
18340 </para>
18341 <para>
18342 <indexterm role="concept">
18343 <primary>Perl</primary>
18344 <secondary>use of <option>warn</option></secondary>
18345 </indexterm>
18346 The Perl <option>warn</option> statement writes to the standard error stream by default.
18347 Calls to <option>warn</option> may be embedded in Perl modules that you use, but over which
18348 you have no control. When Exim starts up the Perl interpreter, it arranges for
18349 output from the <option>warn</option> statement to be written to the Exim main log. You can
18350 change this by including appropriate Perl magic somewhere in your Perl code.
18351 For example, to discard <option>warn</option> output completely, you need this:
18352 </para>
18353 <literallayout class="monospaced">
18354 $SIG{__WARN__} = sub { };
18355 </literallayout>
18356 <para>
18357 Whenever a <option>warn</option> is obeyed, the anonymous subroutine is called. In this
18358 example, the code for the subroutine is empty, so it does nothing, but you can
18359 include any Perl code that you like. The text of the <option>warn</option> message is passed
18360 as the first subroutine argument.
18361 <indexterm role="concept" startref="IIDperl" class="endofrange"/>
18362 </para>
18363 </section>
18364 </chapter>
18365
18366 <chapter id="CHAPinterfaces">
18367 <title>Starting the daemon and the use of network interfaces</title>
18368 <titleabbrev>Starting the daemon</titleabbrev>
18369 <para>
18370 <indexterm role="concept">
18371 <primary>daemon</primary>
18372 <secondary>starting</secondary>
18373 </indexterm>
18374 <indexterm role="concept">
18375 <primary>interface</primary>
18376 <secondary>listening</secondary>
18377 </indexterm>
18378 <indexterm role="concept">
18379 <primary>network interface</primary>
18380 </indexterm>
18381 <indexterm role="concept">
18382 <primary>interface</primary>
18383 <secondary>network</secondary>
18384 </indexterm>
18385 <indexterm role="concept">
18386 <primary>IP address</primary>
18387 <secondary>for listening</secondary>
18388 </indexterm>
18389 <indexterm role="concept">
18390 <primary>daemon</primary>
18391 <secondary>listening IP addresses</secondary>
18392 </indexterm>
18393 <indexterm role="concept">
18394 <primary>TCP/IP</primary>
18395 <secondary>setting listening interfaces</secondary>
18396 </indexterm>
18397 <indexterm role="concept">
18398 <primary>TCP/IP</primary>
18399 <secondary>setting listening ports</secondary>
18400 </indexterm>
18401 A host that is connected to a TCP/IP network may have one or more physical
18402 hardware network interfaces. Each of these interfaces may be configured as one
18403 or more <quote>logical</quote> interfaces, which are the entities that a program actually
18404 works with. Each of these logical interfaces is associated with an IP address.
18405 In addition, TCP/IP software supports <quote>loopback</quote> interfaces (127.0.0.1 in
18406 IPv4 and ::1 in IPv6), which do not use any physical hardware. Exim requires
18407 knowledge about the host&#x2019;s interfaces for use in three different circumstances:
18408 </para>
18409 <orderedlist numeration="arabic">
18410 <listitem>
18411 <para>
18412 When a listening daemon is started, Exim needs to know which interfaces
18413 and ports to listen on.
18414 </para>
18415 </listitem>
18416 <listitem>
18417 <para>
18418 When Exim is routing an address, it needs to know which IP addresses
18419 are associated with local interfaces. This is required for the correct
18420 processing of MX lists by removing the local host and others with the
18421 same or higher priority values. Also, Exim needs to detect cases
18422 when an address is routed to an IP address that in fact belongs to the
18423 local host. Unless the <option>self</option> router option or the <option>allow_localhost</option>
18424 option of the smtp transport is set (as appropriate), this is treated
18425 as an error situation.
18426 </para>
18427 </listitem>
18428 <listitem>
18429 <para>
18430 When Exim connects to a remote host, it may need to know which interface to use
18431 for the outgoing connection.
18432 </para>
18433 </listitem>
18434 </orderedlist>
18435 <para>
18436 Exim&#x2019;s default behaviour is likely to be appropriate in the vast majority
18437 of cases. If your host has only one interface, and you want all its IP
18438 addresses to be treated in the same way, and you are using only the
18439 standard SMTP port, you should not need to take any special action. The
18440 rest of this chapter does not apply to you.
18441 </para>
18442 <para>
18443 In a more complicated situation you may want to listen only on certain
18444 interfaces, or on different ports, and for this reason there are a number of
18445 options that can be used to influence Exim&#x2019;s behaviour. The rest of this
18446 chapter describes how they operate.
18447 </para>
18448 <para>
18449 When a message is received over TCP/IP, the interface and port that were
18450 actually used are set in <varname>$received_ip_address</varname> and <varname>$received_port</varname>.
18451 </para>
18452 <section id="SECID89">
18453 <title>Starting a listening daemon</title>
18454 <para>
18455 When a listening daemon is started (by means of the <option>-bd</option> command line
18456 option), the interfaces and ports on which it listens are controlled by the
18457 following options:
18458 </para>
18459 <itemizedlist>
18460 <listitem>
18461 <para>
18462 <option>daemon_smtp_ports</option> contains a list of default ports. (For backward
18463 compatibility, this option can also be specified in the singular.)
18464 </para>
18465 </listitem>
18466 <listitem>
18467 <para>
18468 <option>local_interfaces</option> contains list of interface IP addresses on which to
18469 listen. Each item may optionally also specify a port.
18470 </para>
18471 </listitem>
18472 </itemizedlist>
18473 <para>
18474 The default list separator in both cases is a colon, but this can be changed as
18475 described in section <xref linkend="SECTlistconstruct"/>. When IPv6 addresses are involved,
18476 it is usually best to change the separator to avoid having to double all the
18477 colons. For example:
18478 </para>
18479 <literallayout class="monospaced">
18480 local_interfaces = &lt;; 127.0.0.1 ; \
18481                       192.168.23.65 ; \
18482                       ::1 ; \
18483                       3ffe:ffff:836f::fe86:a061
18484 </literallayout>
18485 <para>
18486 There are two different formats for specifying a port along with an IP address
18487 in <option>local_interfaces</option>:
18488 </para>
18489 <orderedlist numeration="arabic">
18490 <listitem>
18491 <para>
18492 The port is added onto the address with a dot separator. For example, to listen
18493 on port 1234 on two different IP addresses:
18494 </para>
18495 <literallayout class="monospaced">
18496 local_interfaces = &lt;; 192.168.23.65.1234 ; \
18497                       3ffe:ffff:836f::fe86:a061.1234
18498 </literallayout>
18499 </listitem>
18500 <listitem>
18501 <para>
18502 The IP address is enclosed in square brackets, and the port is added
18503 with a colon separator, for example:
18504 </para>
18505 <literallayout class="monospaced">
18506 local_interfaces = &lt;; [192.168.23.65]:1234 ; \
18507                       [3ffe:ffff:836f::fe86:a061]:1234
18508 </literallayout>
18509 </listitem>
18510 </orderedlist>
18511 <para>
18512 When a port is not specified, the value of <option>daemon_smtp_ports</option> is used. The
18513 default setting contains just one port:
18514 </para>
18515 <literallayout class="monospaced">
18516 daemon_smtp_ports = smtp
18517 </literallayout>
18518 <para>
18519 If more than one port is listed, each interface that does not have its own port
18520 specified listens on all of them. Ports that are listed in
18521 <option>daemon_smtp_ports</option> can be identified either by name (defined in
18522 <filename>/etc/services</filename>) or by number. However, when ports are given with individual
18523 IP addresses in <option>local_interfaces</option>, only numbers (not names) can be used.
18524 </para>
18525 </section>
18526 <section id="SECID90">
18527 <title>Special IP listening addresses</title>
18528 <para>
18529 The addresses 0.0.0.0 and ::0 are treated specially. They are interpreted
18530 as <quote>all IPv4 interfaces</quote> and <quote>all IPv6 interfaces</quote>, respectively. In each
18531 case, Exim tells the TCP/IP stack to <quote>listen on all IPv<emphasis>x</emphasis> interfaces</quote>
18532 instead of setting up separate listening sockets for each interface. The
18533 default value of <option>local_interfaces</option> is
18534 </para>
18535 <literallayout class="monospaced">
18536 local_interfaces = 0.0.0.0
18537 </literallayout>
18538 <para>
18539 when Exim is built without IPv6 support; otherwise it is:
18540 </para>
18541 <literallayout class="monospaced">
18542 local_interfaces = &lt;; ::0 ; 0.0.0.0
18543 </literallayout>
18544 <para>
18545 Thus, by default, Exim listens on all available interfaces, on the SMTP port.
18546 </para>
18547 </section>
18548 <section id="SECID91">
18549 <title>Overriding local_interfaces and daemon_smtp_ports</title>
18550 <para>
18551 The <option>-oX</option> command line option can be used to override the values of
18552 <option>daemon_smtp_ports</option> and/or <option>local_interfaces</option> for a particular daemon
18553 instance. Another way of doing this would be to use macros and the <option>-D</option>
18554 option. However, <option>-oX</option> can be used by any admin user, whereas modification of
18555 the runtime configuration by <option>-D</option> is allowed only when the caller is root or
18556 exim.
18557 </para>
18558 <para>
18559 The value of <option>-oX</option> is a list of items. The default colon separator can be
18560 changed in the usual way if required. If there are any items that do not
18561 contain dots or colons (that is, are not IP addresses), the value of
18562 <option>daemon_smtp_ports</option> is replaced by the list of those items. If there are any
18563 items that do contain dots or colons, the value of <option>local_interfaces</option> is
18564 replaced by those items. Thus, for example,
18565 </para>
18566 <literallayout class="monospaced">
18567 -oX 1225
18568 </literallayout>
18569 <para>
18570 overrides <option>daemon_smtp_ports</option>, but leaves <option>local_interfaces</option> unchanged,
18571 whereas
18572 </para>
18573 <literallayout class="monospaced">
18574 -oX 192.168.34.5.1125
18575 </literallayout>
18576 <para>
18577 overrides <option>local_interfaces</option>, leaving <option>daemon_smtp_ports</option> unchanged.
18578 (However, since <option>local_interfaces</option> now contains no items without ports, the
18579 value of <option>daemon_smtp_ports</option> is no longer relevant in this example.)
18580 </para>
18581 </section>
18582 <section id="SECTsupobssmt">
18583 <title>Support for the obsolete SSMTP (or SMTPS) protocol</title>
18584 <para>
18585 <indexterm role="concept">
18586 <primary>ssmtp protocol</primary>
18587 </indexterm>
18588 <indexterm role="concept">
18589 <primary>smtps protocol</primary>
18590 </indexterm>
18591 <indexterm role="concept">
18592 <primary>SMTP</primary>
18593 <secondary>ssmtp protocol</secondary>
18594 </indexterm>
18595 <indexterm role="concept">
18596 <primary>SMTP</primary>
18597 <secondary>smtps protocol</secondary>
18598 </indexterm>
18599 Exim supports the obsolete SSMTP protocol (also known as SMTPS) that was used
18600 before the STARTTLS command was standardized for SMTP. Some legacy clients
18601 still use this protocol. If the <option>tls_on_connect_ports</option> option is set to a
18602 list of port numbers, connections to those ports must use SSMTP. The most
18603 common use of this option is expected to be
18604 </para>
18605 <literallayout class="monospaced">
18606 tls_on_connect_ports = 465
18607 </literallayout>
18608 <para>
18609 because 465 is the usual port number used by the legacy clients. There is also
18610 a command line option <option>-tls-on-connect</option>, which forces all ports to behave in
18611 this way when a daemon is started.
18612 </para>
18613 <para>
18614 <emphasis role="bold">Warning</emphasis>: Setting <option>tls_on_connect_ports</option> does not of itself cause the
18615 daemon to listen on those ports. You must still specify them in
18616 <option>daemon_smtp_ports</option>, <option>local_interfaces</option>, or the <option>-oX</option> option. (This is
18617 because <option>tls_on_connect_ports</option> applies to <option>inetd</option> connections as well as to
18618 connections via the daemon.)
18619 </para>
18620 </section>
18621 <section id="SECID92">
18622 <title>IPv6 address scopes</title>
18623 <para>
18624 <indexterm role="concept">
18625 <primary>IPv6</primary>
18626 <secondary>address scopes</secondary>
18627 </indexterm>
18628 IPv6 addresses have <quote>scopes</quote>, and a host with multiple hardware interfaces
18629 can, in principle, have the same link-local IPv6 address on different
18630 interfaces. Thus, additional information is needed, over and above the IP
18631 address, to distinguish individual interfaces. A convention of using a
18632 percent sign followed by something (often the interface name) has been
18633 adopted in some cases, leading to addresses like this:
18634 </para>
18635 <literallayout class="monospaced">
18636 fe80::202:b3ff:fe03:45c1%eth0
18637 </literallayout>
18638 <para>
18639 To accommodate this usage, a percent sign followed by an arbitrary string is
18640 allowed at the end of an IPv6 address. By default, Exim calls <function>getaddrinfo()</function>
18641 to convert a textual IPv6 address for actual use. This function recognizes the
18642 percent convention in operating systems that support it, and it processes the
18643 address appropriately. Unfortunately, some older libraries have problems with
18644 <function>getaddrinfo()</function>. If
18645 </para>
18646 <literallayout class="monospaced">
18647 IPV6_USE_INET_PTON=yes
18648 </literallayout>
18649 <para>
18650 is set in <filename>Local/Makefile</filename> (or an OS-dependent Makefile) when Exim is built,
18651 Exim uses <emphasis>inet_pton()</emphasis> to convert a textual IPv6 address for actual use,
18652 instead of <function>getaddrinfo()</function>. (Before version 4.14, it always used this
18653 function.) Of course, this means that the additional functionality of
18654 <function>getaddrinfo()</function> &ndash; recognizing scoped addresses &ndash; is lost.
18655 </para>
18656 </section>
18657 <section id="SECID93">
18658 <title>Disabling IPv6</title>
18659 <para>
18660 <indexterm role="concept">
18661 <primary>IPv6</primary>
18662 <secondary>disabling</secondary>
18663 </indexterm>
18664 Sometimes it happens that an Exim binary that was compiled with IPv6 support is
18665 run on a host whose kernel does not support IPv6. The binary will fall back to
18666 using IPv4, but it may waste resources looking up AAAA records, and trying to
18667 connect to IPv6 addresses, causing delays to mail delivery. If you set the
18668 <indexterm role="option">
18669 <primary><option>disable_ipv6</option></primary>
18670 </indexterm>
18671 <option>disable_ipv6</option> option true, even if the Exim binary has IPv6 support, no IPv6
18672 activities take place. AAAA records are never looked up, and any IPv6 addresses
18673 that are listed in <option>local_interfaces</option>, data for the <command>manualroute</command> router,
18674 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
18675 to handle IPv6 literal addresses.
18676 </para>
18677 <para>
18678 On the other hand, when IPv6 is in use, there may be times when you want to
18679 disable it for certain hosts or domains. You can use the <option>dns_ipv4_lookup</option>
18680 option to globally suppress the lookup of AAAA records for specified domains,
18681 and you can use the <option>ignore_target_hosts</option> generic router option to ignore
18682 IPv6 addresses in an individual router.
18683 </para>
18684 </section>
18685 <section id="SECID94">
18686 <title>Examples of starting a listening daemon</title>
18687 <para>
18688 The default case in an IPv6 environment is
18689 </para>
18690 <literallayout class="monospaced">
18691 daemon_smtp_ports = smtp
18692 local_interfaces = &lt;; ::0 ; 0.0.0.0
18693 </literallayout>
18694 <para>
18695 This specifies listening on the smtp port on all IPv6 and IPv4 interfaces.
18696 Either one or two sockets may be used, depending on the characteristics of
18697 the TCP/IP stack. (This is complicated and messy; for more information,
18698 read the comments in the <filename>daemon.c</filename> source file.)
18699 </para>
18700 <para>
18701 To specify listening on ports 25 and 26 on all interfaces:
18702 </para>
18703 <literallayout class="monospaced">
18704 daemon_smtp_ports = 25 : 26
18705 </literallayout>
18706 <para>
18707 (leaving <option>local_interfaces</option> at the default setting) or, more explicitly:
18708 </para>
18709 <literallayout class="monospaced">
18710 local_interfaces = &lt;; ::0.25     ; ::0.26 \
18711                       0.0.0.0.25 ; 0.0.0.0.26
18712 </literallayout>
18713 <para>
18714 To listen on the default port on all IPv4 interfaces, and on port 26 on the
18715 IPv4 loopback address only:
18716 </para>
18717 <literallayout class="monospaced">
18718 local_interfaces = 0.0.0.0 : 127.0.0.1.26
18719 </literallayout>
18720 <para>
18721 To specify listening on the default port on specific interfaces only:
18722 </para>
18723 <literallayout class="monospaced">
18724 local_interfaces = 192.168.34.67 : 192.168.34.67
18725 </literallayout>
18726 <para>
18727 <emphasis role="bold">Warning</emphasis>: Such a setting excludes listening on the loopback interfaces.
18728 </para>
18729 </section>
18730 <section id="SECTreclocipadd">
18731 <title>Recognizing the local host</title>
18732 <para>
18733 The <option>local_interfaces</option> option is also used when Exim needs to determine
18734 whether or not an IP address refers to the local host. That is, the IP
18735 addresses of all the interfaces on which a daemon is listening are always
18736 treated as local.
18737 </para>
18738 <para>
18739 For this usage, port numbers in <option>local_interfaces</option> are ignored. If either of
18740 the items 0.0.0.0 or ::0 are encountered, Exim gets a complete list of
18741 available interfaces from the operating system, and extracts the relevant
18742 (that is, IPv4 or IPv6) addresses to use for checking.
18743 </para>
18744 <para>
18745 Some systems set up large numbers of virtual interfaces in order to provide
18746 many virtual web servers. In this situation, you may want to listen for
18747 email on only a few of the available interfaces, but nevertheless treat all
18748 interfaces as local when routing. You can do this by setting
18749 <option>extra_local_interfaces</option> to a list of IP addresses, possibly including the
18750 <quote>all</quote> wildcard values. These addresses are recognized as local, but are not
18751 used for listening. Consider this example:
18752 </para>
18753 <literallayout class="monospaced">
18754 local_interfaces = &lt;; 127.0.0.1 ; ::1 ; \
18755                       192.168.53.235 ; \
18756                       3ffe:2101:12:1:a00:20ff:fe86:a061
18757
18758 extra_local_interfaces = &lt;; ::0 ; 0.0.0.0
18759 </literallayout>
18760 <para>
18761 The daemon listens on the loopback interfaces and just one IPv4 and one IPv6
18762 address, but all available interface addresses are treated as local when
18763 Exim is routing.
18764 </para>
18765 <para>
18766 In some environments the local host name may be in an MX list, but with an IP
18767 address that is not assigned to any local interface. In other cases it may be
18768 desirable to treat other host names as if they referred to the local host. Both
18769 these cases can be handled by setting the <option>hosts_treat_as_local</option> option.
18770 This contains host names rather than IP addresses. When a host is referenced
18771 during routing, either via an MX record or directly, it is treated as the local
18772 host if its name matches <option>hosts_treat_as_local</option>, or if any of its IP
18773 addresses match <option>local_interfaces</option> or <option>extra_local_interfaces</option>.
18774 </para>
18775 </section>
18776 <section id="SECID95">
18777 <title>Delivering to a remote host</title>
18778 <para>
18779 Delivery to a remote host is handled by the smtp transport. By default, it
18780 allows the system&#x2019;s TCP/IP functions to choose which interface to use (if
18781 there is more than one) when connecting to a remote host. However, the
18782 <option>interface</option> option can be set to specify which interface is used. See the
18783 description of the smtp transport in chapter <xref linkend="CHAPsmtptrans"/> for more
18784 details.
18785 </para>
18786 </section>
18787 </chapter>
18788
18789 <chapter id="CHAPmainconfig">
18790 <title>Main configuration</title>
18791 <para>
18792 <indexterm role="concept" id="IIDconfima" class="startofrange">
18793 <primary>configuration file</primary>
18794 <secondary>main section</secondary>
18795 </indexterm>
18796 <indexterm role="concept" id="IIDmaiconf" class="startofrange">
18797 <primary>main configuration</primary>
18798 </indexterm>
18799 The first part of the run time configuration file contains three types of item:
18800 </para>
18801 <itemizedlist>
18802 <listitem>
18803 <para>
18804 Macro definitions: These lines start with an upper case letter. See section
18805 <xref linkend="SECTmacrodefs"/> for details of macro processing.
18806 </para>
18807 </listitem>
18808 <listitem>
18809 <para>
18810 Named list definitions: These lines start with one of the words <quote>domainlist</quote>,
18811 <quote>hostlist</quote>, <quote>addresslist</quote>, or <quote>localpartlist</quote>. Their use is described in
18812 section <xref linkend="SECTnamedlists"/>.
18813 </para>
18814 </listitem>
18815 <listitem>
18816 <para>
18817 Main configuration settings: Each setting occupies one line of the file
18818 (with possible continuations). If any setting is preceded by the word
18819 <quote>hide</quote>, the <option>-bP</option> command line option displays its value to admin users
18820 only. See section <xref linkend="SECTcos"/> for a description of the syntax of these option
18821 settings.
18822 </para>
18823 </listitem>
18824 </itemizedlist>
18825 <para>
18826 This chapter specifies all the main configuration options, along with their
18827 types and default values. For ease of finding a particular option, they appear
18828 in alphabetical order in section <xref linkend="SECTalomo"/> below. However, because there
18829 are now so many options, they are first listed briefly in functional groups, as
18830 an aid to finding the name of the option you are looking for. Some options are
18831 listed in more than one group.
18832 </para>
18833 <section id="SECID96">
18834 <title>Miscellaneous</title>
18835 <informaltable frame="none">
18836 <tgroup cols="2" colsep="0" rowsep="0">
18837 <colspec colwidth="196pt" align="left"/>
18838 <colspec colwidth="254pt" align="left"/>
18839 <tbody>
18840 <row>
18841 <entry><option>bi_command</option></entry>
18842 <entry>to run for <option>-bi</option> command line option</entry>
18843 </row>
18844 <row>
18845 <entry><option>disable_ipv6</option></entry>
18846 <entry>do no IPv6 processing</entry>
18847 </row>
18848 <row>
18849 <entry><option>keep_malformed</option></entry>
18850 <entry>for broken files &ndash; should not happen</entry>
18851 </row>
18852 <row>
18853 <entry><option>localhost_number</option></entry>
18854 <entry>for unique message ids in clusters</entry>
18855 </row>
18856 <row>
18857 <entry><option>message_body_newlines</option></entry>
18858 <entry>retain newlines in <varname>$message_body</varname></entry>
18859 </row>
18860 <row>
18861 <entry><option>message_body_visible</option></entry>
18862 <entry>how much to show in <varname>$message_body</varname></entry>
18863 </row>
18864 <row>
18865 <entry><option>mua_wrapper</option></entry>
18866 <entry>run in <quote>MUA wrapper</quote> mode</entry>
18867 </row>
18868 <row>
18869 <entry><option>print_topbitchars</option></entry>
18870 <entry>top-bit characters are printing</entry>
18871 </row>
18872 <row>
18873 <entry><option>timezone</option></entry>
18874 <entry>force time zone</entry>
18875 </row>
18876 </tbody>
18877 </tgroup>
18878 </informaltable>
18879 </section>
18880 <section id="SECID97">
18881 <title>Exim parameters</title>
18882 <informaltable frame="none">
18883 <tgroup cols="2" colsep="0" rowsep="0">
18884 <colspec colwidth="196pt" align="left"/>
18885 <colspec colwidth="254pt" align="left"/>
18886 <tbody>
18887 <row>
18888 <entry><option>exim_group</option></entry>
18889 <entry>override compiled-in value</entry>
18890 </row>
18891 <row>
18892 <entry><option>exim_path</option></entry>
18893 <entry>override compiled-in value</entry>
18894 </row>
18895 <row>
18896 <entry><option>exim_user</option></entry>
18897 <entry>override compiled-in value</entry>
18898 </row>
18899 <row>
18900 <entry><option>primary_hostname</option></entry>
18901 <entry>default from <function>uname()</function></entry>
18902 </row>
18903 <row>
18904 <entry><option>split_spool_directory</option></entry>
18905 <entry>use multiple directories</entry>
18906 </row>
18907 <row>
18908 <entry><option>spool_directory</option></entry>
18909 <entry>override compiled-in value</entry>
18910 </row>
18911 </tbody>
18912 </tgroup>
18913 </informaltable>
18914 </section>
18915 <section id="SECID98">
18916 <title>Privilege controls</title>
18917 <informaltable frame="none">
18918 <tgroup cols="2" colsep="0" rowsep="0">
18919 <colspec colwidth="196pt" align="left"/>
18920 <colspec colwidth="254pt" align="left"/>
18921 <tbody>
18922 <row>
18923 <entry><option>admin_groups</option></entry>
18924 <entry>groups that are Exim admin users</entry>
18925 </row>
18926 <row>
18927 <entry><option>deliver_drop_privilege</option></entry>
18928 <entry>drop root for delivery processes</entry>
18929 </row>
18930 <row>
18931 <entry><option>local_from_check</option></entry>
18932 <entry>insert <emphasis>Sender:</emphasis> if necessary</entry>
18933 </row>
18934 <row>
18935 <entry><option>local_from_prefix</option></entry>
18936 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
18937 </row>
18938 <row>
18939 <entry><option>local_from_suffix</option></entry>
18940 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
18941 </row>
18942 <row>
18943 <entry><option>local_sender_retain</option></entry>
18944 <entry>keep <emphasis>Sender:</emphasis> from untrusted user</entry>
18945 </row>
18946 <row>
18947 <entry><option>never_users</option></entry>
18948 <entry>do not run deliveries as these</entry>
18949 </row>
18950 <row>
18951 <entry><option>prod_requires_admin</option></entry>
18952 <entry>forced delivery requires admin user</entry>
18953 </row>
18954 <row>
18955 <entry><option>queue_list_requires_admin</option></entry>
18956 <entry>queue listing requires admin user</entry>
18957 </row>
18958 <row>
18959 <entry><option>trusted_groups</option></entry>
18960 <entry>groups that are trusted</entry>
18961 </row>
18962 <row>
18963 <entry><option>trusted_users</option></entry>
18964 <entry>users that are trusted</entry>
18965 </row>
18966 </tbody>
18967 </tgroup>
18968 </informaltable>
18969 </section>
18970 <section id="SECID99">
18971 <title>Logging</title>
18972 <informaltable frame="none">
18973 <tgroup cols="2" colsep="0" rowsep="0">
18974 <colspec colwidth="196pt" align="left"/>
18975 <colspec colwidth="254pt" align="left"/>
18976 <tbody>
18977 <row>
18978 <entry><option>hosts_connection_nolog</option></entry>
18979 <entry>exemption from connect logging</entry>
18980 </row>
18981 <row>
18982 <entry><option>log_file_path</option></entry>
18983 <entry>override compiled-in value</entry>
18984 </row>
18985 <row>
18986 <entry><option>log_selector</option></entry>
18987 <entry>set/unset optional logging</entry>
18988 </row>
18989 <row>
18990 <entry><option>log_timezone</option></entry>
18991 <entry>add timezone to log lines</entry>
18992 </row>
18993 <row>
18994 <entry><option>message_logs</option></entry>
18995 <entry>create per-message logs</entry>
18996 </row>
18997 <row>
18998 <entry><option>preserve_message_logs</option></entry>
18999 <entry>after message completion</entry>
19000 </row>
19001 <row>
19002 <entry><option>process_log_path</option></entry>
19003 <entry>for SIGUSR1 and <emphasis>exiwhat</emphasis></entry>
19004 </row>
19005 <row>
19006 <entry><option>syslog_duplication</option></entry>
19007 <entry>controls duplicate log lines on syslog</entry>
19008 </row>
19009 <row>
19010 <entry><option>syslog_facility</option></entry>
19011 <entry>set syslog <quote>facility</quote> field</entry>
19012 </row>
19013 <row>
19014 <entry><option>syslog_processname</option></entry>
19015 <entry>set syslog <quote>ident</quote> field</entry>
19016 </row>
19017 <row>
19018 <entry><option>syslog_timestamp</option></entry>
19019 <entry>timestamp syslog lines</entry>
19020 </row>
19021 <row>
19022 <entry><option>write_rejectlog</option></entry>
19023 <entry>control use of message log</entry>
19024 </row>
19025 </tbody>
19026 </tgroup>
19027 </informaltable>
19028 </section>
19029 <section id="SECID100">
19030 <title>Frozen messages</title>
19031 <informaltable frame="none">
19032 <tgroup cols="2" colsep="0" rowsep="0">
19033 <colspec colwidth="196pt" align="left"/>
19034 <colspec colwidth="254pt" align="left"/>
19035 <tbody>
19036 <row>
19037 <entry><option>auto_thaw</option></entry>
19038 <entry>sets time for retrying frozen messages</entry>
19039 </row>
19040 <row>
19041 <entry><option>freeze_tell</option></entry>
19042 <entry>send message when freezing</entry>
19043 </row>
19044 <row>
19045 <entry><option>move_frozen_messages</option></entry>
19046 <entry>to another directory</entry>
19047 </row>
19048 <row>
19049 <entry><option>timeout_frozen_after</option></entry>
19050 <entry>keep frozen messages only so long</entry>
19051 </row>
19052 </tbody>
19053 </tgroup>
19054 </informaltable>
19055 </section>
19056 <section id="SECID101">
19057 <title>Data lookups</title>
19058 <informaltable frame="none">
19059 <tgroup cols="2" colsep="0" rowsep="0">
19060 <colspec colwidth="196pt" align="left"/>
19061 <colspec colwidth="254pt" align="left"/>
19062 <tbody>
19063 <row>
19064 <entry><option>ibase_servers</option></entry>
19065 <entry>InterBase servers</entry>
19066 </row>
19067 <row>
19068 <entry><option>ldap_default_servers</option></entry>
19069 <entry>used if no server in query</entry>
19070 </row>
19071 <row>
19072 <entry><option>ldap_version</option></entry>
19073 <entry>set protocol version</entry>
19074 </row>
19075 <row>
19076 <entry><option>lookup_open_max</option></entry>
19077 <entry>lookup files held open</entry>
19078 </row>
19079 <row>
19080 <entry><option>mysql_servers</option></entry>
19081 <entry>default MySQL servers</entry>
19082 </row>
19083 <row>
19084 <entry><option>oracle_servers</option></entry>
19085 <entry>Oracle servers</entry>
19086 </row>
19087 <row>
19088 <entry><option>pgsql_servers</option></entry>
19089 <entry>default PostgreSQL servers</entry>
19090 </row>
19091 <row>
19092 <entry><option>sqlite_lock_timeout</option></entry>
19093 <entry>as it says</entry>
19094 </row>
19095 </tbody>
19096 </tgroup>
19097 </informaltable>
19098 </section>
19099 <section id="SECID102">
19100 <title>Message ids</title>
19101 <informaltable frame="none">
19102 <tgroup cols="2" colsep="0" rowsep="0">
19103 <colspec colwidth="196pt" align="left"/>
19104 <colspec colwidth="254pt" align="left"/>
19105 <tbody>
19106 <row>
19107 <entry><option>message_id_header_domain</option></entry>
19108 <entry>used to build <emphasis>Message-ID:</emphasis> header</entry>
19109 </row>
19110 <row>
19111 <entry><option>message_id_header_text</option></entry>
19112 <entry>ditto</entry>
19113 </row>
19114 </tbody>
19115 </tgroup>
19116 </informaltable>
19117 </section>
19118 <section id="SECID103">
19119 <title>Embedded Perl Startup</title>
19120 <informaltable frame="none">
19121 <tgroup cols="2" colsep="0" rowsep="0">
19122 <colspec colwidth="196pt" align="left"/>
19123 <colspec colwidth="254pt" align="left"/>
19124 <tbody>
19125 <row>
19126 <entry><option>perl_at_start</option></entry>
19127 <entry>always start the interpreter</entry>
19128 </row>
19129 <row>
19130 <entry><option>perl_startup</option></entry>
19131 <entry>code to obey when starting Perl</entry>
19132 </row>
19133 </tbody>
19134 </tgroup>
19135 </informaltable>
19136 </section>
19137 <section id="SECID104">
19138 <title>Daemon</title>
19139 <informaltable frame="none">
19140 <tgroup cols="2" colsep="0" rowsep="0">
19141 <colspec colwidth="196pt" align="left"/>
19142 <colspec colwidth="254pt" align="left"/>
19143 <tbody>
19144 <row>
19145 <entry><option>daemon_smtp_ports</option></entry>
19146 <entry>default ports</entry>
19147 </row>
19148 <row>
19149 <entry><option>daemon_startup_retries</option></entry>
19150 <entry>number of times to retry</entry>
19151 </row>
19152 <row>
19153 <entry><option>daemon_startup_sleep</option></entry>
19154 <entry>time to sleep between tries</entry>
19155 </row>
19156 <row>
19157 <entry><option>extra_local_interfaces</option></entry>
19158 <entry>not necessarily listened on</entry>
19159 </row>
19160 <row>
19161 <entry><option>local_interfaces</option></entry>
19162 <entry>on which to listen, with optional ports</entry>
19163 </row>
19164 <row>
19165 <entry><option>pid_file_path</option></entry>
19166 <entry>override compiled-in value</entry>
19167 </row>
19168 <row>
19169 <entry><option>queue_run_max</option></entry>
19170 <entry>maximum simultaneous queue runners</entry>
19171 </row>
19172 </tbody>
19173 </tgroup>
19174 </informaltable>
19175 </section>
19176 <section id="SECID105">
19177 <title>Resource control</title>
19178 <informaltable frame="none">
19179 <tgroup cols="2" colsep="0" rowsep="0">
19180 <colspec colwidth="196pt" align="left"/>
19181 <colspec colwidth="254pt" align="left"/>
19182 <tbody>
19183 <row>
19184 <entry><option>check_log_inodes</option></entry>
19185 <entry>before accepting a message</entry>
19186 </row>
19187 <row>
19188 <entry><option>check_log_space</option></entry>
19189 <entry>before accepting a message</entry>
19190 </row>
19191 <row>
19192 <entry><option>check_spool_inodes</option></entry>
19193 <entry>before accepting a message</entry>
19194 </row>
19195 <row>
19196 <entry><option>check_spool_space</option></entry>
19197 <entry>before accepting a message</entry>
19198 </row>
19199 <row>
19200 <entry><option>deliver_queue_load_max</option></entry>
19201 <entry>no queue deliveries if load high</entry>
19202 </row>
19203 <row>
19204 <entry><option>queue_only_load</option></entry>
19205 <entry>queue incoming if load high</entry>
19206 </row>
19207 <row>
19208 <entry><option>queue_only_load_latch</option></entry>
19209 <entry>don&#x2019;t re-evaluate load for each message</entry>
19210 </row>
19211 <row>
19212 <entry><option>queue_run_max</option></entry>
19213 <entry>maximum simultaneous queue runners</entry>
19214 </row>
19215 <row>
19216 <entry><option>remote_max_parallel</option></entry>
19217 <entry>parallel SMTP delivery per message</entry>
19218 </row>
19219 <row>
19220 <entry><option>smtp_accept_max</option></entry>
19221 <entry>simultaneous incoming connections</entry>
19222 </row>
19223 <row>
19224 <entry><option>smtp_accept_max_nonmail</option></entry>
19225 <entry>non-mail commands</entry>
19226 </row>
19227 <row>
19228 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
19229 <entry>hosts to which the limit applies</entry>
19230 </row>
19231 <row>
19232 <entry><option>smtp_accept_max_per_connection</option></entry>
19233 <entry>messages per connection</entry>
19234 </row>
19235 <row>
19236 <entry><option>smtp_accept_max_per_host</option></entry>
19237 <entry>connections from one host</entry>
19238 </row>
19239 <row>
19240 <entry><option>smtp_accept_queue</option></entry>
19241 <entry>queue mail if more connections</entry>
19242 </row>
19243 <row>
19244 <entry><option>smtp_accept_queue_per_connection</option></entry>
19245 <entry>queue if more messages per connection</entry>
19246 </row>
19247 <row>
19248 <entry><option>smtp_accept_reserve</option></entry>
19249 <entry>only reserve hosts if more connections</entry>
19250 </row>
19251 <row>
19252 <entry><option>smtp_check_spool_space</option></entry>
19253 <entry>from SIZE on MAIL command</entry>
19254 </row>
19255 <row>
19256 <entry><option>smtp_connect_backlog</option></entry>
19257 <entry>passed to TCP/IP stack</entry>
19258 </row>
19259 <row>
19260 <entry><option>smtp_load_reserve</option></entry>
19261 <entry>SMTP from reserved hosts if load high</entry>
19262 </row>
19263 <row>
19264 <entry><option>smtp_reserve_hosts</option></entry>
19265 <entry>these are the reserve hosts</entry>
19266 </row>
19267 </tbody>
19268 </tgroup>
19269 </informaltable>
19270 </section>
19271 <section id="SECID106">
19272 <title>Policy controls</title>
19273 <informaltable frame="none">
19274 <tgroup cols="2" colsep="0" rowsep="0">
19275 <colspec colwidth="196pt" align="left"/>
19276 <colspec colwidth="254pt" align="left"/>
19277 <tbody>
19278 <row>
19279 <entry><option>acl_not_smtp</option></entry>
19280 <entry>ACL for non-SMTP messages</entry>
19281 </row>
19282 <row>
19283 <entry><option>acl_not_smtp_mime</option></entry>
19284 <entry>ACL for non-SMTP MIME parts</entry>
19285 </row>
19286 <row>
19287 <entry><option>acl_not_smtp_start</option></entry>
19288 <entry>ACL for start of non-SMTP message</entry>
19289 </row>
19290 <row>
19291 <entry><option>acl_smtp_auth</option></entry>
19292 <entry>ACL for AUTH</entry>
19293 </row>
19294 <row>
19295 <entry><option>acl_smtp_connect</option></entry>
19296 <entry>ACL for connection</entry>
19297 </row>
19298 <row>
19299 <entry><option>acl_smtp_data</option></entry>
19300 <entry>ACL for DATA</entry>
19301 </row>
19302 <row>
19303 <entry><option>acl_smtp_etrn</option></entry>
19304 <entry>ACL for ETRN</entry>
19305 </row>
19306 <row>
19307 <entry><option>acl_smtp_expn</option></entry>
19308 <entry>ACL for EXPN</entry>
19309 </row>
19310 <row>
19311 <entry><option>acl_smtp_helo</option></entry>
19312 <entry>ACL for EHLO or HELO</entry>
19313 </row>
19314 <row>
19315 <entry><option>acl_smtp_mail</option></entry>
19316 <entry>ACL for MAIL</entry>
19317 </row>
19318 <row>
19319 <entry><option>acl_smtp_mailauth</option></entry>
19320 <entry>ACL for AUTH on MAIL command</entry>
19321 </row>
19322 <row>
19323 <entry><option>acl_smtp_mime</option></entry>
19324 <entry>ACL for MIME parts</entry>
19325 </row>
19326 <row>
19327 <entry><option>acl_smtp_predata</option></entry>
19328 <entry>ACL for start of data</entry>
19329 </row>
19330 <row>
19331 <entry><option>acl_smtp_quit</option></entry>
19332 <entry>ACL for QUIT</entry>
19333 </row>
19334 <row>
19335 <entry><option>acl_smtp_rcpt</option></entry>
19336 <entry>ACL for RCPT</entry>
19337 </row>
19338 <row>
19339 <entry><option>acl_smtp_starttls</option></entry>
19340 <entry>ACL for STARTTLS</entry>
19341 </row>
19342 <row>
19343 <entry><option>acl_smtp_vrfy</option></entry>
19344 <entry>ACL for VRFY</entry>
19345 </row>
19346 <row>
19347 <entry><option>av_scanner</option></entry>
19348 <entry>specify virus scanner</entry>
19349 </row>
19350 <row>
19351 <entry><option>check_rfc2047_length</option></entry>
19352 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
19353 </row>
19354 <row>
19355 <entry><option>dns_csa_search_limit</option></entry>
19356 <entry>control CSA parent search depth</entry>
19357 </row>
19358 <row>
19359 <entry><option>dns_csa_use_reverse</option></entry>
19360 <entry>en/disable CSA IP reverse search</entry>
19361 </row>
19362 <row>
19363 <entry><option>header_maxsize</option></entry>
19364 <entry>total size of message header</entry>
19365 </row>
19366 <row>
19367 <entry><option>header_line_maxsize</option></entry>
19368 <entry>individual header line limit</entry>
19369 </row>
19370 <row>
19371 <entry><option>helo_accept_junk_hosts</option></entry>
19372 <entry>allow syntactic junk from these hosts</entry>
19373 </row>
19374 <row>
19375 <entry><option>helo_allow_chars</option></entry>
19376 <entry>allow illegal chars in HELO names</entry>
19377 </row>
19378 <row>
19379 <entry><option>helo_lookup_domains</option></entry>
19380 <entry>lookup hostname for these HELO names</entry>
19381 </row>
19382 <row>
19383 <entry><option>helo_try_verify_hosts</option></entry>
19384 <entry>HELO soft-checked for these hosts</entry>
19385 </row>
19386 <row>
19387 <entry><option>helo_verify_hosts</option></entry>
19388 <entry>HELO hard-checked for these hosts</entry>
19389 </row>
19390 <row>
19391 <entry><option>host_lookup</option></entry>
19392 <entry>host name looked up for these hosts</entry>
19393 </row>
19394 <row>
19395 <entry><option>host_lookup_order</option></entry>
19396 <entry>order of DNS and local name lookups</entry>
19397 </row>
19398 <row>
19399 <entry><option>host_reject_connection</option></entry>
19400 <entry>reject connection from these hosts</entry>
19401 </row>
19402 <row>
19403 <entry><option>hosts_treat_as_local</option></entry>
19404 <entry>useful in some cluster configurations</entry>
19405 </row>
19406 <row>
19407 <entry><option>local_scan_timeout</option></entry>
19408 <entry>timeout for <function>local_scan()</function></entry>
19409 </row>
19410 <row>
19411 <entry><option>message_size_limit</option></entry>
19412 <entry>for all messages</entry>
19413 </row>
19414 <row>
19415 <entry><option>percent_hack_domains</option></entry>
19416 <entry>recognize %-hack for these domains</entry>
19417 </row>
19418 <row>
19419 <entry><option>spamd_address</option></entry>
19420 <entry>set interface to SpamAssassin</entry>
19421 </row>
19422 <row>
19423 <entry><option>strict_acl_vars</option></entry>
19424 <entry>object to unset ACL variables</entry>
19425 </row>
19426 </tbody>
19427 </tgroup>
19428 </informaltable>
19429 </section>
19430 <section id="SECID107">
19431 <title>Callout cache</title>
19432 <informaltable frame="none">
19433 <tgroup cols="2" colsep="0" rowsep="0">
19434 <colspec colwidth="196pt" align="left"/>
19435 <colspec colwidth="254pt" align="left"/>
19436 <tbody>
19437 <row>
19438 <entry><option>callout_domain_negative_expire</option></entry>
19439 <entry>timeout for negative domain cache item</entry>
19440 </row>
19441 <row>
19442 <entry><option>callout_domain_positive_expire</option></entry>
19443 <entry>timeout for positive domain cache item</entry>
19444 </row>
19445 <row>
19446 <entry><option>callout_negative_expire</option></entry>
19447 <entry>timeout for negative address cache item</entry>
19448 </row>
19449 <row>
19450 <entry><option>callout_positive_expire</option></entry>
19451 <entry>timeout for positive address cache item</entry>
19452 </row>
19453 <row>
19454 <entry><option>callout_random_local_part</option></entry>
19455 <entry>string to use for <quote>random</quote> testing</entry>
19456 </row>
19457 </tbody>
19458 </tgroup>
19459 </informaltable>
19460 </section>
19461 <section id="SECID108">
19462 <title>TLS</title>
19463 <informaltable frame="none">
19464 <tgroup cols="2" colsep="0" rowsep="0">
19465 <colspec colwidth="196pt" align="left"/>
19466 <colspec colwidth="254pt" align="left"/>
19467 <tbody>
19468 <row>
19469 <entry><option>gnutls_require_kx</option></entry>
19470 <entry>control GnuTLS key exchanges</entry>
19471 </row>
19472 <row>
19473 <entry><option>gnutls_require_mac</option></entry>
19474 <entry>control GnuTLS MAC algorithms</entry>
19475 </row>
19476 <row>
19477 <entry><option>gnutls_require_protocols</option></entry>
19478 <entry>control GnuTLS protocols</entry>
19479 </row>
19480 <row>
19481 <entry><option>gnutls_compat_mode</option></entry>
19482 <entry>use GnuTLS compatibility mode</entry>
19483 </row>
19484 <row>
19485 <entry><option>tls_advertise_hosts</option></entry>
19486 <entry>advertise TLS to these hosts</entry>
19487 </row>
19488 <row>
19489 <entry><option>tls_certificate</option></entry>
19490 <entry>location of server certificate</entry>
19491 </row>
19492 <row>
19493 <entry><option>tls_crl</option></entry>
19494 <entry>certificate revocation list</entry>
19495 </row>
19496 <row>
19497 <entry><option>tls_dhparam</option></entry>
19498 <entry>DH parameters for server</entry>
19499 </row>
19500 <row>
19501 <entry><option>tls_on_connect_ports</option></entry>
19502 <entry>specify SSMTP (SMTPS) ports</entry>
19503 </row>
19504 <row>
19505 <entry><option>tls_privatekey</option></entry>
19506 <entry>location of server private key</entry>
19507 </row>
19508 <row>
19509 <entry><option>tls_remember_esmtp</option></entry>
19510 <entry>don&#x2019;t reset after starting TLS</entry>
19511 </row>
19512 <row>
19513 <entry><option>tls_require_ciphers</option></entry>
19514 <entry>specify acceptable ciphers</entry>
19515 </row>
19516 <row>
19517 <entry><option>tls_try_verify_hosts</option></entry>
19518 <entry>try to verify client certificate</entry>
19519 </row>
19520 <row>
19521 <entry><option>tls_verify_certificates</option></entry>
19522 <entry>expected client certificates</entry>
19523 </row>
19524 <row>
19525 <entry><option>tls_verify_hosts</option></entry>
19526 <entry>insist on client certificate verify</entry>
19527 </row>
19528 </tbody>
19529 </tgroup>
19530 </informaltable>
19531 </section>
19532 <section id="SECID109">
19533 <title>Local user handling</title>
19534 <informaltable frame="none">
19535 <tgroup cols="2" colsep="0" rowsep="0">
19536 <colspec colwidth="196pt" align="left"/>
19537 <colspec colwidth="254pt" align="left"/>
19538 <tbody>
19539 <row>
19540 <entry><option>finduser_retries</option></entry>
19541 <entry>useful in NIS environments</entry>
19542 </row>
19543 <row>
19544 <entry><option>gecos_name</option></entry>
19545 <entry>used when creating <emphasis>Sender:</emphasis></entry>
19546 </row>
19547 <row>
19548 <entry><option>gecos_pattern</option></entry>
19549 <entry>ditto</entry>
19550 </row>
19551 <row>
19552 <entry><option>max_username_length</option></entry>
19553 <entry>for systems that truncate</entry>
19554 </row>
19555 <row>
19556 <entry><option>unknown_login</option></entry>
19557 <entry>used when no login name found</entry>
19558 </row>
19559 <row>
19560 <entry><option>unknown_username</option></entry>
19561 <entry>ditto</entry>
19562 </row>
19563 <row>
19564 <entry><option>uucp_from_pattern</option></entry>
19565 <entry>for recognizing <quote>From </quote> lines</entry>
19566 </row>
19567 <row>
19568 <entry><option>uucp_from_sender</option></entry>
19569 <entry>ditto</entry>
19570 </row>
19571 </tbody>
19572 </tgroup>
19573 </informaltable>
19574 </section>
19575 <section id="SECID110">
19576 <title>All incoming messages (SMTP and non-SMTP)</title>
19577 <informaltable frame="none">
19578 <tgroup cols="2" colsep="0" rowsep="0">
19579 <colspec colwidth="196pt" align="left"/>
19580 <colspec colwidth="254pt" align="left"/>
19581 <tbody>
19582 <row>
19583 <entry><option>header_maxsize</option></entry>
19584 <entry>total size of message header</entry>
19585 </row>
19586 <row>
19587 <entry><option>header_line_maxsize</option></entry>
19588 <entry>individual header line limit</entry>
19589 </row>
19590 <row>
19591 <entry><option>message_size_limit</option></entry>
19592 <entry>applies to all messages</entry>
19593 </row>
19594 <row>
19595 <entry><option>percent_hack_domains</option></entry>
19596 <entry>recognize %-hack for these domains</entry>
19597 </row>
19598 <row>
19599 <entry><option>received_header_text</option></entry>
19600 <entry>expanded to make <emphasis>Received:</emphasis></entry>
19601 </row>
19602 <row>
19603 <entry><option>received_headers_max</option></entry>
19604 <entry>for mail loop detection</entry>
19605 </row>
19606 <row>
19607 <entry><option>recipients_max</option></entry>
19608 <entry>limit per message</entry>
19609 </row>
19610 <row>
19611 <entry><option>recipients_max_reject</option></entry>
19612 <entry>permanently reject excess recipients</entry>
19613 </row>
19614 </tbody>
19615 </tgroup>
19616 </informaltable>
19617 </section>
19618 <section id="SECID111">
19619 <title>Non-SMTP incoming messages</title>
19620 <informaltable frame="none">
19621 <tgroup cols="2" colsep="0" rowsep="0">
19622 <colspec colwidth="196pt" align="left"/>
19623 <colspec colwidth="254pt" align="left"/>
19624 <tbody>
19625 <row>
19626 <entry><option>receive_timeout</option></entry>
19627 <entry>for non-SMTP messages</entry>
19628 </row>
19629 </tbody>
19630 </tgroup>
19631 </informaltable>
19632 </section>
19633 <section id="SECID112">
19634 <title>Incoming SMTP messages</title>
19635 <para>
19636 See also the <emphasis>Policy controls</emphasis> section above.
19637 </para>
19638 <informaltable frame="none">
19639 <tgroup cols="2" colsep="0" rowsep="0">
19640 <colspec colwidth="196pt" align="left"/>
19641 <colspec colwidth="254pt" align="left"/>
19642 <tbody>
19643 <row>
19644 <entry><option>host_lookup</option></entry>
19645 <entry>host name looked up for these hosts</entry>
19646 </row>
19647 <row>
19648 <entry><option>host_lookup_order</option></entry>
19649 <entry>order of DNS and local name lookups</entry>
19650 </row>
19651 <row>
19652 <entry><option>recipient_unqualified_hosts</option></entry>
19653 <entry>may send unqualified recipients</entry>
19654 </row>
19655 <row>
19656 <entry><option>rfc1413_hosts</option></entry>
19657 <entry>make ident calls to these hosts</entry>
19658 </row>
19659 <row>
19660 <entry><option>rfc1413_query_timeout</option></entry>
19661 <entry>zero disables ident calls</entry>
19662 </row>
19663 <row>
19664 <entry><option>sender_unqualified_hosts</option></entry>
19665 <entry>may send unqualified senders</entry>
19666 </row>
19667 <row>
19668 <entry><option>smtp_accept_keepalive</option></entry>
19669 <entry>some TCP/IP magic</entry>
19670 </row>
19671 <row>
19672 <entry><option>smtp_accept_max</option></entry>
19673 <entry>simultaneous incoming connections</entry>
19674 </row>
19675 <row>
19676 <entry><option>smtp_accept_max_nonmail</option></entry>
19677 <entry>non-mail commands</entry>
19678 </row>
19679 <row>
19680 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
19681 <entry>hosts to which the limit applies</entry>
19682 </row>
19683 <row>
19684 <entry><option>smtp_accept_max_per_connection</option></entry>
19685 <entry>messages per connection</entry>
19686 </row>
19687 <row>
19688 <entry><option>smtp_accept_max_per_host</option></entry>
19689 <entry>connections from one host</entry>
19690 </row>
19691 <row>
19692 <entry><option>smtp_accept_queue</option></entry>
19693 <entry>queue mail if more connections</entry>
19694 </row>
19695 <row>
19696 <entry><option>smtp_accept_queue_per_connection</option></entry>
19697 <entry>queue if more messages per connection</entry>
19698 </row>
19699 <row>
19700 <entry><option>smtp_accept_reserve</option></entry>
19701 <entry>only reserve hosts if more connections</entry>
19702 </row>
19703 <row>
19704 <entry><option>smtp_active_hostname</option></entry>
19705 <entry>host name to use in messages</entry>
19706 </row>
19707 <row>
19708 <entry><option>smtp_banner</option></entry>
19709 <entry>text for welcome banner</entry>
19710 </row>
19711 <row>
19712 <entry><option>smtp_check_spool_space</option></entry>
19713 <entry>from SIZE on MAIL command</entry>
19714 </row>
19715 <row>
19716 <entry><option>smtp_connect_backlog</option></entry>
19717 <entry>passed to TCP/IP stack</entry>
19718 </row>
19719 <row>
19720 <entry><option>smtp_enforce_sync</option></entry>
19721 <entry>of SMTP command/responses</entry>
19722 </row>
19723 <row>
19724 <entry><option>smtp_etrn_command</option></entry>
19725 <entry>what to run for ETRN</entry>
19726 </row>
19727 <row>
19728 <entry><option>smtp_etrn_serialize</option></entry>
19729 <entry>only one at once</entry>
19730 </row>
19731 <row>
19732 <entry><option>smtp_load_reserve</option></entry>
19733 <entry>only reserve hosts if this load</entry>
19734 </row>
19735 <row>
19736 <entry><option>smtp_max_unknown_commands</option></entry>
19737 <entry>before dropping connection</entry>
19738 </row>
19739 <row>
19740 <entry><option>smtp_ratelimit_hosts</option></entry>
19741 <entry>apply ratelimiting to these hosts</entry>
19742 </row>
19743 <row>
19744 <entry><option>smtp_ratelimit_mail</option></entry>
19745 <entry>ratelimit for MAIL commands</entry>
19746 </row>
19747 <row>
19748 <entry><option>smtp_ratelimit_rcpt</option></entry>
19749 <entry>ratelimit for RCPT commands</entry>
19750 </row>
19751 <row>
19752 <entry><option>smtp_receive_timeout</option></entry>
19753 <entry>per command or data line</entry>
19754 </row>
19755 <row>
19756 <entry><option>smtp_reserve_hosts</option></entry>
19757 <entry>these are the reserve hosts</entry>
19758 </row>
19759 <row>
19760 <entry><option>smtp_return_error_details</option></entry>
19761 <entry>give detail on rejections</entry>
19762 </row>
19763 </tbody>
19764 </tgroup>
19765 </informaltable>
19766 </section>
19767 <section id="SECID113">
19768 <title>SMTP extensions</title>
19769 <informaltable frame="none">
19770 <tgroup cols="2" colsep="0" rowsep="0">
19771 <colspec colwidth="196pt" align="left"/>
19772 <colspec colwidth="254pt" align="left"/>
19773 <tbody>
19774 <row>
19775 <entry><option>accept_8bitmime</option></entry>
19776 <entry>advertise 8BITMIME</entry>
19777 </row>
19778 <row>
19779 <entry><option>auth_advertise_hosts</option></entry>
19780 <entry>advertise AUTH to these hosts</entry>
19781 </row>
19782 <row>
19783 <entry><option>ignore_fromline_hosts</option></entry>
19784 <entry>allow <quote>From </quote> from these hosts</entry>
19785 </row>
19786 <row>
19787 <entry><option>ignore_fromline_local</option></entry>
19788 <entry>allow <quote>From </quote> from local SMTP</entry>
19789 </row>
19790 <row>
19791 <entry><option>pipelining_advertise_hosts</option></entry>
19792 <entry>advertise pipelining to these hosts</entry>
19793 </row>
19794 <row>
19795 <entry><option>tls_advertise_hosts</option></entry>
19796 <entry>advertise TLS to these hosts</entry>
19797 </row>
19798 </tbody>
19799 </tgroup>
19800 </informaltable>
19801 </section>
19802 <section id="SECID114">
19803 <title>Processing messages</title>
19804 <informaltable frame="none">
19805 <tgroup cols="2" colsep="0" rowsep="0">
19806 <colspec colwidth="196pt" align="left"/>
19807 <colspec colwidth="254pt" align="left"/>
19808 <tbody>
19809 <row>
19810 <entry><option>allow_domain_literals</option></entry>
19811 <entry>recognize domain literal syntax</entry>
19812 </row>
19813 <row>
19814 <entry><option>allow_mx_to_ip</option></entry>
19815 <entry>allow MX to point to IP address</entry>
19816 </row>
19817 <row>
19818 <entry><option>allow_utf8_domains</option></entry>
19819 <entry>in addresses</entry>
19820 </row>
19821 <row>
19822 <entry><option>check_rfc2047_length</option></entry>
19823 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
19824 </row>
19825 <row>
19826 <entry><option>delivery_date_remove</option></entry>
19827 <entry>from incoming messages</entry>
19828 </row>
19829 <row>
19830 <entry><option>envelope_to_remove</option></entry>
19831 <entry>from incoming messages</entry>
19832 </row>
19833 <row>
19834 <entry><option>extract_addresses_remove_arguments</option></entry>
19835 <entry>affects <option>-t</option> processing</entry>
19836 </row>
19837 <row>
19838 <entry><option>headers_charset</option></entry>
19839 <entry>default for translations</entry>
19840 </row>
19841 <row>
19842 <entry><option>qualify_domain</option></entry>
19843 <entry>default for senders</entry>
19844 </row>
19845 <row>
19846 <entry><option>qualify_recipient</option></entry>
19847 <entry>default for recipients</entry>
19848 </row>
19849 <row>
19850 <entry><option>return_path_remove</option></entry>
19851 <entry>from incoming messages</entry>
19852 </row>
19853 <row>
19854 <entry><option>strip_excess_angle_brackets</option></entry>
19855 <entry>in addresses</entry>
19856 </row>
19857 <row>
19858 <entry><option>strip_trailing_dot</option></entry>
19859 <entry>at end of addresses</entry>
19860 </row>
19861 <row>
19862 <entry><option>untrusted_set_sender</option></entry>
19863 <entry>untrusted can set envelope sender</entry>
19864 </row>
19865 </tbody>
19866 </tgroup>
19867 </informaltable>
19868 </section>
19869 <section id="SECID115">
19870 <title>System filter</title>
19871 <informaltable frame="none">
19872 <tgroup cols="2" colsep="0" rowsep="0">
19873 <colspec colwidth="196pt" align="left"/>
19874 <colspec colwidth="254pt" align="left"/>
19875 <tbody>
19876 <row>
19877 <entry><option>system_filter</option></entry>
19878 <entry>locate system filter</entry>
19879 </row>
19880 <row>
19881 <entry><option>system_filter_directory_transport</option></entry>
19882 <entry>transport for delivery to a directory</entry>
19883 </row>
19884 <row>
19885 <entry><option>system_filter_file_transport</option></entry>
19886 <entry>transport for delivery to a file</entry>
19887 </row>
19888 <row>
19889 <entry><option>system_filter_group</option></entry>
19890 <entry>group for filter running</entry>
19891 </row>
19892 <row>
19893 <entry><option>system_filter_pipe_transport</option></entry>
19894 <entry>transport for delivery to a pipe</entry>
19895 </row>
19896 <row>
19897 <entry><option>system_filter_reply_transport</option></entry>
19898 <entry>transport for autoreply delivery</entry>
19899 </row>
19900 <row>
19901 <entry><option>system_filter_user</option></entry>
19902 <entry>user for filter running</entry>
19903 </row>
19904 </tbody>
19905 </tgroup>
19906 </informaltable>
19907 </section>
19908 <section id="SECID116">
19909 <title>Routing and delivery</title>
19910 <informaltable frame="none">
19911 <tgroup cols="2" colsep="0" rowsep="0">
19912 <colspec colwidth="196pt" align="left"/>
19913 <colspec colwidth="254pt" align="left"/>
19914 <tbody>
19915 <row>
19916 <entry><option>disable_ipv6</option></entry>
19917 <entry>do no IPv6 processing</entry>
19918 </row>
19919 <row>
19920 <entry><option>dns_again_means_nonexist</option></entry>
19921 <entry>for broken domains</entry>
19922 </row>
19923 <row>
19924 <entry><option>dns_check_names_pattern</option></entry>
19925 <entry>pre-DNS syntax check</entry>
19926 </row>
19927 <row>
19928 <entry><option>dns_ipv4_lookup</option></entry>
19929 <entry>only v4 lookup for these domains</entry>
19930 </row>
19931 <row>
19932 <entry><option>dns_retrans</option></entry>
19933 <entry>parameter for resolver</entry>
19934 </row>
19935 <row>
19936 <entry><option>dns_retry</option></entry>
19937 <entry>parameter for resolver</entry>
19938 </row>
19939 <row>
19940 <entry><option>hold_domains</option></entry>
19941 <entry>hold delivery for these domains</entry>
19942 </row>
19943 <row>
19944 <entry><option>local_interfaces</option></entry>
19945 <entry>for routing checks</entry>
19946 </row>
19947 <row>
19948 <entry><option>queue_domains</option></entry>
19949 <entry>no immediate delivery for these</entry>
19950 </row>
19951 <row>
19952 <entry><option>queue_only</option></entry>
19953 <entry>no immediate delivery at all</entry>
19954 </row>
19955 <row>
19956 <entry><option>queue_only_file</option></entry>
19957 <entry>no immediate delivery if file exists</entry>
19958 </row>
19959 <row>
19960 <entry><option>queue_only_load</option></entry>
19961 <entry>no immediate delivery if load is high</entry>
19962 </row>
19963 <row>
19964 <entry><option>queue_only_load_latch</option></entry>
19965 <entry>don&#x2019;t re-evaluate load for each message</entry>
19966 </row>
19967 <row>
19968 <entry><option>queue_only_override</option></entry>
19969 <entry>allow command line to override</entry>
19970 </row>
19971 <row>
19972 <entry><option>queue_run_in_order</option></entry>
19973 <entry>order of arrival</entry>
19974 </row>
19975 <row>
19976 <entry><option>queue_run_max</option></entry>
19977 <entry>of simultaneous queue runners</entry>
19978 </row>
19979 <row>
19980 <entry><option>queue_smtp_domains</option></entry>
19981 <entry>no immediate SMTP delivery for these</entry>
19982 </row>
19983 <row>
19984 <entry><option>remote_max_parallel</option></entry>
19985 <entry>parallel SMTP delivery per message</entry>
19986 </row>
19987 <row>
19988 <entry><option>remote_sort_domains</option></entry>
19989 <entry>order of remote deliveries</entry>
19990 </row>
19991 <row>
19992 <entry><option>retry_data_expire</option></entry>
19993 <entry>timeout for retry data</entry>
19994 </row>
19995 <row>
19996 <entry><option>retry_interval_max</option></entry>
19997 <entry>safety net for retry rules</entry>
19998 </row>
19999 </tbody>
20000 </tgroup>
20001 </informaltable>
20002 </section>
20003 <section id="SECID117">
20004 <title>Bounce and warning messages</title>
20005 <informaltable frame="none">
20006 <tgroup cols="2" colsep="0" rowsep="0">
20007 <colspec colwidth="196pt" align="left"/>
20008 <colspec colwidth="254pt" align="left"/>
20009 <tbody>
20010 <row>
20011 <entry><option>bounce_message_file</option></entry>
20012 <entry>content of bounce</entry>
20013 </row>
20014 <row>
20015 <entry><option>bounce_message_text</option></entry>
20016 <entry>content of bounce</entry>
20017 </row>
20018 <row>
20019 <entry><option>bounce_return_body</option></entry>
20020 <entry>include body if returning message</entry>
20021 </row>
20022 <row>
20023 <entry><option>bounce_return_message</option></entry>
20024 <entry>include original message in bounce</entry>
20025 </row>
20026 <row>
20027 <entry><option>bounce_return_size_limit</option></entry>
20028 <entry>limit on returned message</entry>
20029 </row>
20030 <row>
20031 <entry><option>bounce_sender_authentication</option></entry>
20032 <entry>send authenticated sender with bounce</entry>
20033 </row>
20034 <row>
20035 <entry><option>dsn_from</option></entry>
20036 <entry>set <emphasis>From:</emphasis> contents in bounces</entry>
20037 </row>
20038 <row>
20039 <entry><option>errors_copy</option></entry>
20040 <entry>copy bounce messages</entry>
20041 </row>
20042 <row>
20043 <entry><option>errors_reply_to</option></entry>
20044 <entry><emphasis>Reply-to:</emphasis> in bounces</entry>
20045 </row>
20046 <row>
20047 <entry><option>delay_warning</option></entry>
20048 <entry>time schedule</entry>
20049 </row>
20050 <row>
20051 <entry><option>delay_warning_condition</option></entry>
20052 <entry>condition for warning messages</entry>
20053 </row>
20054 <row>
20055 <entry><option>ignore_bounce_errors_after</option></entry>
20056 <entry>discard undeliverable bounces</entry>
20057 </row>
20058 <row>
20059 <entry><option>smtp_return_error_details</option></entry>
20060 <entry>give detail on rejections</entry>
20061 </row>
20062 <row>
20063 <entry><option>warn_message_file</option></entry>
20064 <entry>content of warning message</entry>
20065 </row>
20066 </tbody>
20067 </tgroup>
20068 </informaltable>
20069 </section>
20070 <section id="SECTalomo">
20071 <title>Alphabetical list of main options</title>
20072 <para>
20073 Those options that undergo string expansion before use are marked with
20074 &dagger;.
20075 </para>
20076 <para>
20077 <indexterm role="option">
20078 <primary><option>accept_8bitmime</option></primary>
20079 </indexterm>
20080 </para>
20081 <informaltable frame="all">
20082 <tgroup cols="4" colsep="0" rowsep="0">
20083 <colspec colwidth="8*" align="left"/>
20084 <colspec colwidth="6*" align="center"/>
20085 <colspec colwidth="6*" align="center"/>
20086 <colspec colwidth="6*" align="right"/>
20087 <tbody>
20088 <row>
20089 <entry><option>accept_8bitmime</option></entry>
20090 <entry>Use: <emphasis>main</emphasis></entry>
20091 <entry>Type: <emphasis>boolean</emphasis></entry>
20092 <entry>Default: <emphasis>false</emphasis></entry>
20093 </row>
20094 </tbody>
20095 </tgroup>
20096 </informaltable>
20097 <para>
20098 <indexterm role="concept">
20099 <primary>8BITMIME</primary>
20100 </indexterm>
20101 <indexterm role="concept">
20102 <primary>8-bit characters</primary>
20103 </indexterm>
20104 This option causes Exim to send 8BITMIME in its response to an SMTP
20105 EHLO command, and to accept the BODY= parameter on MAIL commands.
20106 However, though Exim is 8-bit clean, it is not a protocol converter, and it
20107 takes no steps to do anything special with messages received by this route.
20108 Consequently, this option is turned off by default.
20109 </para>
20110 <para>
20111 <indexterm role="option">
20112 <primary><option>acl_not_smtp</option></primary>
20113 </indexterm>
20114 </para>
20115 <informaltable frame="all">
20116 <tgroup cols="4" colsep="0" rowsep="0">
20117 <colspec colwidth="8*" align="left"/>
20118 <colspec colwidth="6*" align="center"/>
20119 <colspec colwidth="6*" align="center"/>
20120 <colspec colwidth="6*" align="right"/>
20121 <tbody>
20122 <row>
20123 <entry><option>acl_not_smtp</option></entry>
20124 <entry>Use: <emphasis>main</emphasis></entry>
20125 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20126 <entry>Default: <emphasis>unset</emphasis></entry>
20127 </row>
20128 </tbody>
20129 </tgroup>
20130 </informaltable>
20131 <para>
20132 <indexterm role="concept">
20133 <primary>access control lists (ACLs)</primary>
20134 <secondary>for non-SMTP messages</secondary>
20135 </indexterm>
20136 <indexterm role="concept">
20137 <primary>non-SMTP messages</primary>
20138 <secondary>ACLs for</secondary>
20139 </indexterm>
20140 This option defines the ACL that is run when a non-SMTP message has been
20141 read and is on the point of being accepted. See chapter <xref linkend="CHAPACL"/> for
20142 further details.
20143 </para>
20144 <para>
20145 <indexterm role="option">
20146 <primary><option>acl_not_smtp_mime</option></primary>
20147 </indexterm>
20148 </para>
20149 <informaltable frame="all">
20150 <tgroup cols="4" colsep="0" rowsep="0">
20151 <colspec colwidth="8*" align="left"/>
20152 <colspec colwidth="6*" align="center"/>
20153 <colspec colwidth="6*" align="center"/>
20154 <colspec colwidth="6*" align="right"/>
20155 <tbody>
20156 <row>
20157 <entry><option>acl_not_smtp_mime</option></entry>
20158 <entry>Use: <emphasis>main</emphasis></entry>
20159 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20160 <entry>Default: <emphasis>unset</emphasis></entry>
20161 </row>
20162 </tbody>
20163 </tgroup>
20164 </informaltable>
20165 <para>
20166 This option defines the ACL that is run for individual MIME parts of non-SMTP
20167 messages. It operates in exactly the same way as <option>acl_smtp_mime</option> operates for
20168 SMTP messages.
20169 </para>
20170 <para>
20171 <indexterm role="option">
20172 <primary><option>acl_not_smtp_start</option></primary>
20173 </indexterm>
20174 </para>
20175 <informaltable frame="all">
20176 <tgroup cols="4" colsep="0" rowsep="0">
20177 <colspec colwidth="8*" align="left"/>
20178 <colspec colwidth="6*" align="center"/>
20179 <colspec colwidth="6*" align="center"/>
20180 <colspec colwidth="6*" align="right"/>
20181 <tbody>
20182 <row>
20183 <entry><option>acl_not_smtp_start</option></entry>
20184 <entry>Use: <emphasis>main</emphasis></entry>
20185 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20186 <entry>Default: <emphasis>unset</emphasis></entry>
20187 </row>
20188 </tbody>
20189 </tgroup>
20190 </informaltable>
20191 <para>
20192 <indexterm role="concept">
20193 <primary>access control lists (ACLs)</primary>
20194 <secondary>at start of non-SMTP message</secondary>
20195 </indexterm>
20196 <indexterm role="concept">
20197 <primary>non-SMTP messages</primary>
20198 <secondary>ACLs for</secondary>
20199 </indexterm>
20200 This option defines the ACL that is run before Exim starts reading a
20201 non-SMTP message. See chapter <xref linkend="CHAPACL"/> for further details.
20202 </para>
20203 <para>
20204 <indexterm role="option">
20205 <primary><option>acl_smtp_auth</option></primary>
20206 </indexterm>
20207 </para>
20208 <informaltable frame="all">
20209 <tgroup cols="4" colsep="0" rowsep="0">
20210 <colspec colwidth="8*" align="left"/>
20211 <colspec colwidth="6*" align="center"/>
20212 <colspec colwidth="6*" align="center"/>
20213 <colspec colwidth="6*" align="right"/>
20214 <tbody>
20215 <row>
20216 <entry><option>acl_smtp_auth</option></entry>
20217 <entry>Use: <emphasis>main</emphasis></entry>
20218 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20219 <entry>Default: <emphasis>unset</emphasis></entry>
20220 </row>
20221 </tbody>
20222 </tgroup>
20223 </informaltable>
20224 <para>
20225 <indexterm role="concept">
20226 <primary>access control lists (ACLs)</primary>
20227 <secondary>setting up for SMTP commands</secondary>
20228 </indexterm>
20229 <indexterm role="concept">
20230 <primary>AUTH</primary>
20231 <secondary>ACL for</secondary>
20232 </indexterm>
20233 This option defines the ACL that is run when an SMTP AUTH command is
20234 received. See chapter <xref linkend="CHAPACL"/> for further details.
20235 </para>
20236 <para>
20237 <indexterm role="option">
20238 <primary><option>acl_smtp_connect</option></primary>
20239 </indexterm>
20240 </para>
20241 <informaltable frame="all">
20242 <tgroup cols="4" colsep="0" rowsep="0">
20243 <colspec colwidth="8*" align="left"/>
20244 <colspec colwidth="6*" align="center"/>
20245 <colspec colwidth="6*" align="center"/>
20246 <colspec colwidth="6*" align="right"/>
20247 <tbody>
20248 <row>
20249 <entry><option>acl_smtp_connect</option></entry>
20250 <entry>Use: <emphasis>main</emphasis></entry>
20251 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20252 <entry>Default: <emphasis>unset</emphasis></entry>
20253 </row>
20254 </tbody>
20255 </tgroup>
20256 </informaltable>
20257 <para>
20258 <indexterm role="concept">
20259 <primary>access control lists (ACLs)</primary>
20260 <secondary>on SMTP connection</secondary>
20261 </indexterm>
20262 This option defines the ACL that is run when an SMTP connection is received.
20263 See chapter <xref linkend="CHAPACL"/> for further details.
20264 </para>
20265 <para>
20266 <indexterm role="option">
20267 <primary><option>acl_smtp_data</option></primary>
20268 </indexterm>
20269 </para>
20270 <informaltable frame="all">
20271 <tgroup cols="4" colsep="0" rowsep="0">
20272 <colspec colwidth="8*" align="left"/>
20273 <colspec colwidth="6*" align="center"/>
20274 <colspec colwidth="6*" align="center"/>
20275 <colspec colwidth="6*" align="right"/>
20276 <tbody>
20277 <row>
20278 <entry><option>acl_smtp_data</option></entry>
20279 <entry>Use: <emphasis>main</emphasis></entry>
20280 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20281 <entry>Default: <emphasis>unset</emphasis></entry>
20282 </row>
20283 </tbody>
20284 </tgroup>
20285 </informaltable>
20286 <para>
20287 <indexterm role="concept">
20288 <primary>DATA</primary>
20289 <secondary>ACL for</secondary>
20290 </indexterm>
20291 This option defines the ACL that is run after an SMTP DATA command has been
20292 processed and the message itself has been received, but before the final
20293 acknowledgment is sent. See chapter <xref linkend="CHAPACL"/> for further details.
20294 </para>
20295 <para>
20296 <indexterm role="option">
20297 <primary><option>acl_smtp_etrn</option></primary>
20298 </indexterm>
20299 </para>
20300 <informaltable frame="all">
20301 <tgroup cols="4" colsep="0" rowsep="0">
20302 <colspec colwidth="8*" align="left"/>
20303 <colspec colwidth="6*" align="center"/>
20304 <colspec colwidth="6*" align="center"/>
20305 <colspec colwidth="6*" align="right"/>
20306 <tbody>
20307 <row>
20308 <entry><option>acl_smtp_etrn</option></entry>
20309 <entry>Use: <emphasis>main</emphasis></entry>
20310 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20311 <entry>Default: <emphasis>unset</emphasis></entry>
20312 </row>
20313 </tbody>
20314 </tgroup>
20315 </informaltable>
20316 <para>
20317 <indexterm role="concept">
20318 <primary>ETRN</primary>
20319 <secondary>ACL for</secondary>
20320 </indexterm>
20321 This option defines the ACL that is run when an SMTP ETRN command is
20322 received. See chapter <xref linkend="CHAPACL"/> for further details.
20323 </para>
20324 <para>
20325 <indexterm role="option">
20326 <primary><option>acl_smtp_expn</option></primary>
20327 </indexterm>
20328 </para>
20329 <informaltable frame="all">
20330 <tgroup cols="4" colsep="0" rowsep="0">
20331 <colspec colwidth="8*" align="left"/>
20332 <colspec colwidth="6*" align="center"/>
20333 <colspec colwidth="6*" align="center"/>
20334 <colspec colwidth="6*" align="right"/>
20335 <tbody>
20336 <row>
20337 <entry><option>acl_smtp_expn</option></entry>
20338 <entry>Use: <emphasis>main</emphasis></entry>
20339 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20340 <entry>Default: <emphasis>unset</emphasis></entry>
20341 </row>
20342 </tbody>
20343 </tgroup>
20344 </informaltable>
20345 <para>
20346 <indexterm role="concept">
20347 <primary>EXPN</primary>
20348 <secondary>ACL for</secondary>
20349 </indexterm>
20350 This option defines the ACL that is run when an SMTP EXPN command is
20351 received. See chapter <xref linkend="CHAPACL"/> for further details.
20352 </para>
20353 <para>
20354 <indexterm role="option">
20355 <primary><option>acl_smtp_helo</option></primary>
20356 </indexterm>
20357 </para>
20358 <informaltable frame="all">
20359 <tgroup cols="4" colsep="0" rowsep="0">
20360 <colspec colwidth="8*" align="left"/>
20361 <colspec colwidth="6*" align="center"/>
20362 <colspec colwidth="6*" align="center"/>
20363 <colspec colwidth="6*" align="right"/>
20364 <tbody>
20365 <row>
20366 <entry><option>acl_smtp_helo</option></entry>
20367 <entry>Use: <emphasis>main</emphasis></entry>
20368 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20369 <entry>Default: <emphasis>unset</emphasis></entry>
20370 </row>
20371 </tbody>
20372 </tgroup>
20373 </informaltable>
20374 <para>
20375 <indexterm role="concept">
20376 <primary>EHLO</primary>
20377 <secondary>ACL for</secondary>
20378 </indexterm>
20379 <indexterm role="concept">
20380 <primary>HELO</primary>
20381 <secondary>ACL for</secondary>
20382 </indexterm>
20383 This option defines the ACL that is run when an SMTP EHLO or HELO
20384 command is received. See chapter <xref linkend="CHAPACL"/> for further details.
20385 </para>
20386 <para>
20387 <indexterm role="option">
20388 <primary><option>acl_smtp_mail</option></primary>
20389 </indexterm>
20390 </para>
20391 <informaltable frame="all">
20392 <tgroup cols="4" colsep="0" rowsep="0">
20393 <colspec colwidth="8*" align="left"/>
20394 <colspec colwidth="6*" align="center"/>
20395 <colspec colwidth="6*" align="center"/>
20396 <colspec colwidth="6*" align="right"/>
20397 <tbody>
20398 <row>
20399 <entry><option>acl_smtp_mail</option></entry>
20400 <entry>Use: <emphasis>main</emphasis></entry>
20401 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20402 <entry>Default: <emphasis>unset</emphasis></entry>
20403 </row>
20404 </tbody>
20405 </tgroup>
20406 </informaltable>
20407 <para>
20408 <indexterm role="concept">
20409 <primary>MAIL</primary>
20410 <secondary>ACL for</secondary>
20411 </indexterm>
20412 This option defines the ACL that is run when an SMTP MAIL command is
20413 received. See chapter <xref linkend="CHAPACL"/> for further details.
20414 </para>
20415 <para>
20416 <indexterm role="option">
20417 <primary><option>acl_smtp_mailauth</option></primary>
20418 </indexterm>
20419 </para>
20420 <informaltable frame="all">
20421 <tgroup cols="4" colsep="0" rowsep="0">
20422 <colspec colwidth="8*" align="left"/>
20423 <colspec colwidth="6*" align="center"/>
20424 <colspec colwidth="6*" align="center"/>
20425 <colspec colwidth="6*" align="right"/>
20426 <tbody>
20427 <row>
20428 <entry><option>acl_smtp_mailauth</option></entry>
20429 <entry>Use: <emphasis>main</emphasis></entry>
20430 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20431 <entry>Default: <emphasis>unset</emphasis></entry>
20432 </row>
20433 </tbody>
20434 </tgroup>
20435 </informaltable>
20436 <para>
20437 <indexterm role="concept">
20438 <primary>AUTH</primary>
20439 <secondary>on MAIL command</secondary>
20440 </indexterm>
20441 This option defines the ACL that is run when there is an AUTH parameter on
20442 a MAIL command. See chapter <xref linkend="CHAPACL"/> for details of ACLs, and chapter
20443 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
20444 </para>
20445 <para>
20446 <indexterm role="option">
20447 <primary><option>acl_smtp_mime</option></primary>
20448 </indexterm>
20449 </para>
20450 <informaltable frame="all">
20451 <tgroup cols="4" colsep="0" rowsep="0">
20452 <colspec colwidth="8*" align="left"/>
20453 <colspec colwidth="6*" align="center"/>
20454 <colspec colwidth="6*" align="center"/>
20455 <colspec colwidth="6*" align="right"/>
20456 <tbody>
20457 <row>
20458 <entry><option>acl_smtp_mime</option></entry>
20459 <entry>Use: <emphasis>main</emphasis></entry>
20460 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20461 <entry>Default: <emphasis>unset</emphasis></entry>
20462 </row>
20463 </tbody>
20464 </tgroup>
20465 </informaltable>
20466 <para>
20467 <indexterm role="concept">
20468 <primary>MIME content scanning</primary>
20469 <secondary>ACL for</secondary>
20470 </indexterm>
20471 This option is available when Exim is built with the content-scanning
20472 extension. It defines the ACL that is run for each MIME part in a message. See
20473 section <xref linkend="SECTscanmimepart"/> for details.
20474 </para>
20475 <para>
20476 <indexterm role="option">
20477 <primary><option>acl_smtp_predata</option></primary>
20478 </indexterm>
20479 </para>
20480 <informaltable frame="all">
20481 <tgroup cols="4" colsep="0" rowsep="0">
20482 <colspec colwidth="8*" align="left"/>
20483 <colspec colwidth="6*" align="center"/>
20484 <colspec colwidth="6*" align="center"/>
20485 <colspec colwidth="6*" align="right"/>
20486 <tbody>
20487 <row>
20488 <entry><option>acl_smtp_predata</option></entry>
20489 <entry>Use: <emphasis>main</emphasis></entry>
20490 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20491 <entry>Default: <emphasis>unset</emphasis></entry>
20492 </row>
20493 </tbody>
20494 </tgroup>
20495 </informaltable>
20496 <para>
20497 This option defines the ACL that is run when an SMTP DATA command is
20498 received, before the message itself is received. See chapter <xref linkend="CHAPACL"/> for
20499 further details.
20500 </para>
20501 <para>
20502 <indexterm role="option">
20503 <primary><option>acl_smtp_quit</option></primary>
20504 </indexterm>
20505 </para>
20506 <informaltable frame="all">
20507 <tgroup cols="4" colsep="0" rowsep="0">
20508 <colspec colwidth="8*" align="left"/>
20509 <colspec colwidth="6*" align="center"/>
20510 <colspec colwidth="6*" align="center"/>
20511 <colspec colwidth="6*" align="right"/>
20512 <tbody>
20513 <row>
20514 <entry><option>acl_smtp_quit</option></entry>
20515 <entry>Use: <emphasis>main</emphasis></entry>
20516 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20517 <entry>Default: <emphasis>unset</emphasis></entry>
20518 </row>
20519 </tbody>
20520 </tgroup>
20521 </informaltable>
20522 <para>
20523 <indexterm role="concept">
20524 <primary>QUIT, ACL for</primary>
20525 </indexterm>
20526 This option defines the ACL that is run when an SMTP QUIT command is
20527 received. See chapter <xref linkend="CHAPACL"/> for further details.
20528 </para>
20529 <para>
20530 <indexterm role="option">
20531 <primary><option>acl_smtp_rcpt</option></primary>
20532 </indexterm>
20533 </para>
20534 <informaltable frame="all">
20535 <tgroup cols="4" colsep="0" rowsep="0">
20536 <colspec colwidth="8*" align="left"/>
20537 <colspec colwidth="6*" align="center"/>
20538 <colspec colwidth="6*" align="center"/>
20539 <colspec colwidth="6*" align="right"/>
20540 <tbody>
20541 <row>
20542 <entry><option>acl_smtp_rcpt</option></entry>
20543 <entry>Use: <emphasis>main</emphasis></entry>
20544 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20545 <entry>Default: <emphasis>unset</emphasis></entry>
20546 </row>
20547 </tbody>
20548 </tgroup>
20549 </informaltable>
20550 <para>
20551 <indexterm role="concept">
20552 <primary>RCPT</primary>
20553 <secondary>ACL for</secondary>
20554 </indexterm>
20555 This option defines the ACL that is run when an SMTP RCPT command is
20556 received. See chapter <xref linkend="CHAPACL"/> for further details.
20557 </para>
20558 <para>
20559 <indexterm role="option">
20560 <primary><option>acl_smtp_starttls</option></primary>
20561 </indexterm>
20562 </para>
20563 <informaltable frame="all">
20564 <tgroup cols="4" colsep="0" rowsep="0">
20565 <colspec colwidth="8*" align="left"/>
20566 <colspec colwidth="6*" align="center"/>
20567 <colspec colwidth="6*" align="center"/>
20568 <colspec colwidth="6*" align="right"/>
20569 <tbody>
20570 <row>
20571 <entry><option>acl_smtp_starttls</option></entry>
20572 <entry>Use: <emphasis>main</emphasis></entry>
20573 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20574 <entry>Default: <emphasis>unset</emphasis></entry>
20575 </row>
20576 </tbody>
20577 </tgroup>
20578 </informaltable>
20579 <para>
20580 <indexterm role="concept">
20581 <primary>STARTTLS, ACL for</primary>
20582 </indexterm>
20583 This option defines the ACL that is run when an SMTP STARTTLS command is
20584 received. See chapter <xref linkend="CHAPACL"/> for further details.
20585 </para>
20586 <para>
20587 <indexterm role="option">
20588 <primary><option>acl_smtp_vrfy</option></primary>
20589 </indexterm>
20590 </para>
20591 <informaltable frame="all">
20592 <tgroup cols="4" colsep="0" rowsep="0">
20593 <colspec colwidth="8*" align="left"/>
20594 <colspec colwidth="6*" align="center"/>
20595 <colspec colwidth="6*" align="center"/>
20596 <colspec colwidth="6*" align="right"/>
20597 <tbody>
20598 <row>
20599 <entry><option>acl_smtp_vrfy</option></entry>
20600 <entry>Use: <emphasis>main</emphasis></entry>
20601 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20602 <entry>Default: <emphasis>unset</emphasis></entry>
20603 </row>
20604 </tbody>
20605 </tgroup>
20606 </informaltable>
20607 <para>
20608 <indexterm role="concept">
20609 <primary>VRFY</primary>
20610 <secondary>ACL for</secondary>
20611 </indexterm>
20612 This option defines the ACL that is run when an SMTP VRFY command is
20613 received. See chapter <xref linkend="CHAPACL"/> for further details.
20614 </para>
20615 <para>
20616 <indexterm role="option">
20617 <primary><option>admin_groups</option></primary>
20618 </indexterm>
20619 </para>
20620 <informaltable frame="all">
20621 <tgroup cols="4" colsep="0" rowsep="0">
20622 <colspec colwidth="8*" align="left"/>
20623 <colspec colwidth="6*" align="center"/>
20624 <colspec colwidth="6*" align="center"/>
20625 <colspec colwidth="6*" align="right"/>
20626 <tbody>
20627 <row>
20628 <entry><option>admin_groups</option></entry>
20629 <entry>Use: <emphasis>main</emphasis></entry>
20630 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
20631 <entry>Default: <emphasis>unset</emphasis></entry>
20632 </row>
20633 </tbody>
20634 </tgroup>
20635 </informaltable>
20636 <para>
20637 <indexterm role="concept">
20638 <primary>admin user</primary>
20639 </indexterm>
20640 This option is expanded just once, at the start of Exim&#x2019;s processing. If the
20641 current group or any of the supplementary groups of an Exim caller is in this
20642 colon-separated list, the caller has admin privileges. If all your system
20643 programmers are in a specific group, for example, you can give them all Exim
20644 admin privileges by putting that group in <option>admin_groups</option>. However, this does
20645 not permit them to read Exim&#x2019;s spool files (whose group owner is the Exim gid).
20646 To permit this, you have to add individuals to the Exim group.
20647 </para>
20648 <para>
20649 <indexterm role="option">
20650 <primary><option>allow_domain_literals</option></primary>
20651 </indexterm>
20652 </para>
20653 <informaltable frame="all">
20654 <tgroup cols="4" colsep="0" rowsep="0">
20655 <colspec colwidth="8*" align="left"/>
20656 <colspec colwidth="6*" align="center"/>
20657 <colspec colwidth="6*" align="center"/>
20658 <colspec colwidth="6*" align="right"/>
20659 <tbody>
20660 <row>
20661 <entry><option>allow_domain_literals</option></entry>
20662 <entry>Use: <emphasis>main</emphasis></entry>
20663 <entry>Type: <emphasis>boolean</emphasis></entry>
20664 <entry>Default: <emphasis>false</emphasis></entry>
20665 </row>
20666 </tbody>
20667 </tgroup>
20668 </informaltable>
20669 <para>
20670 <indexterm role="concept">
20671 <primary>domain literal</primary>
20672 </indexterm>
20673 If this option is set, the RFC 2822 domain literal format is permitted in
20674 email addresses. The option is not set by default, because the domain literal
20675 format is not normally required these days, and few people know about it. It
20676 has, however, been exploited by mail abusers.
20677 </para>
20678 <para>
20679 Unfortunately, it seems that some DNS black list maintainers are using this
20680 format to report black listing to postmasters. If you want to accept messages
20681 addressed to your hosts by IP address, you need to set
20682 <option>allow_domain_literals</option> true, and also to add <literal>@[]</literal> to the list of local
20683 domains (defined in the named domain list <option>local_domains</option> in the default
20684 configuration). This <quote>magic string</quote> matches the domain literal form of all
20685 the local host&#x2019;s IP addresses.
20686 </para>
20687 <para>
20688 <indexterm role="option">
20689 <primary><option>allow_mx_to_ip</option></primary>
20690 </indexterm>
20691 </para>
20692 <informaltable frame="all">
20693 <tgroup cols="4" colsep="0" rowsep="0">
20694 <colspec colwidth="8*" align="left"/>
20695 <colspec colwidth="6*" align="center"/>
20696 <colspec colwidth="6*" align="center"/>
20697 <colspec colwidth="6*" align="right"/>
20698 <tbody>
20699 <row>
20700 <entry><option>allow_mx_to_ip</option></entry>
20701 <entry>Use: <emphasis>main</emphasis></entry>
20702 <entry>Type: <emphasis>boolean</emphasis></entry>
20703 <entry>Default: <emphasis>false</emphasis></entry>
20704 </row>
20705 </tbody>
20706 </tgroup>
20707 </informaltable>
20708 <para>
20709 <indexterm role="concept">
20710 <primary>MX record</primary>
20711 <secondary>pointing to IP address</secondary>
20712 </indexterm>
20713 It appears that more and more DNS zone administrators are breaking the rules
20714 and putting domain names that look like IP addresses on the right hand side of
20715 MX records. Exim follows the rules and rejects this, giving an error message
20716 that explains the mis-configuration. However, some other MTAs support this
20717 practice, so to avoid <quote>Why can&#x2019;t Exim do this?</quote> complaints,
20718 <option>allow_mx_to_ip</option> exists, in order to enable this heinous activity. It is not
20719 recommended, except when you have no other choice.
20720 </para>
20721 <para>
20722 <indexterm role="option">
20723 <primary><option>allow_utf8_domains</option></primary>
20724 </indexterm>
20725 </para>
20726 <informaltable frame="all">
20727 <tgroup cols="4" colsep="0" rowsep="0">
20728 <colspec colwidth="8*" align="left"/>
20729 <colspec colwidth="6*" align="center"/>
20730 <colspec colwidth="6*" align="center"/>
20731 <colspec colwidth="6*" align="right"/>
20732 <tbody>
20733 <row>
20734 <entry><option>allow_utf8_domains</option></entry>
20735 <entry>Use: <emphasis>main</emphasis></entry>
20736 <entry>Type: <emphasis>boolean</emphasis></entry>
20737 <entry>Default: <emphasis>false</emphasis></entry>
20738 </row>
20739 </tbody>
20740 </tgroup>
20741 </informaltable>
20742 <para>
20743 <indexterm role="concept">
20744 <primary>domain</primary>
20745 <secondary>UTF-8 characters in</secondary>
20746 </indexterm>
20747 <indexterm role="concept">
20748 <primary>UTF-8</primary>
20749 <secondary>in domain name</secondary>
20750 </indexterm>
20751 Lots of discussion is going on about internationalized domain names. One
20752 camp is strongly in favour of just using UTF-8 characters, and it seems
20753 that at least two other MTAs permit this. This option allows Exim users to
20754 experiment if they wish.
20755 </para>
20756 <para>
20757 If it is set true, Exim&#x2019;s domain parsing function allows valid
20758 UTF-8 multicharacters to appear in domain name components, in addition to
20759 letters, digits, and hyphens. However, just setting this option is not
20760 enough; if you want to look up these domain names in the DNS, you must also
20761 adjust the value of <option>dns_check_names_pattern</option> to match the extended form. A
20762 suitable setting is:
20763 </para>
20764 <literallayout class="monospaced">
20765 dns_check_names_pattern = (?i)^(?&gt;(?(1)\.|())[a-z0-9\xc0-\xff]\
20766   (?&gt;[-a-z0-9\x80-\xff]*[a-z0-9\x80-\xbf])?)+$
20767 </literallayout>
20768 <para>
20769 Alternatively, you can just disable this feature by setting
20770 </para>
20771 <literallayout class="monospaced">
20772 dns_check_names_pattern =
20773 </literallayout>
20774 <para>
20775 That is, set the option to an empty string so that no check is done.
20776 </para>
20777 <para>
20778 <indexterm role="option">
20779 <primary><option>auth_advertise_hosts</option></primary>
20780 </indexterm>
20781 </para>
20782 <informaltable frame="all">
20783 <tgroup cols="4" colsep="0" rowsep="0">
20784 <colspec colwidth="8*" align="left"/>
20785 <colspec colwidth="6*" align="center"/>
20786 <colspec colwidth="6*" align="center"/>
20787 <colspec colwidth="6*" align="right"/>
20788 <tbody>
20789 <row>
20790 <entry><option>auth_advertise_hosts</option></entry>
20791 <entry>Use: <emphasis>main</emphasis></entry>
20792 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
20793 <entry>Default: <emphasis>*</emphasis></entry>
20794 </row>
20795 </tbody>
20796 </tgroup>
20797 </informaltable>
20798 <para>
20799 <indexterm role="concept">
20800 <primary>authentication</primary>
20801 <secondary>advertising</secondary>
20802 </indexterm>
20803 <indexterm role="concept">
20804 <primary>AUTH</primary>
20805 <secondary>advertising</secondary>
20806 </indexterm>
20807 If any server authentication mechanisms are configured, Exim advertises them in
20808 response to an EHLO command only if the calling host matches this list.
20809 Otherwise, Exim does not advertise AUTH.
20810 Exim does not accept AUTH commands from clients to which it has not
20811 advertised the availability of AUTH. The advertising of individual
20812 authentication mechanisms can be controlled by the use of the
20813 <option>server_advertise_condition</option> generic authenticator option on the individual
20814 authenticators. See chapter <xref linkend="CHAPSMTPAUTH"/> for further details.
20815 </para>
20816 <para>
20817 Certain mail clients (for example, Netscape) require the user to provide a name
20818 and password for authentication if AUTH is advertised, even though it may
20819 not be needed (the host may accept messages from hosts on its local LAN without
20820 authentication, for example). The <option>auth_advertise_hosts</option> option can be used
20821 to make these clients more friendly by excluding them from the set of hosts to
20822 which Exim advertises AUTH.
20823 </para>
20824 <para>
20825 <indexterm role="concept">
20826 <primary>AUTH</primary>
20827 <secondary>advertising when encrypted</secondary>
20828 </indexterm>
20829 If you want to advertise the availability of AUTH only when the connection
20830 is encrypted using TLS, you can make use of the fact that the value of this
20831 option is expanded, with a setting like this:
20832 </para>
20833 <literallayout class="monospaced">
20834 auth_advertise_hosts = ${if eq{$tls_cipher}{}{}{*}}
20835 </literallayout>
20836 <para>
20837 <indexterm role="variable">
20838 <primary><varname>$tls_cipher</varname></primary>
20839 </indexterm>
20840 If <varname>$tls_cipher</varname> is empty, the session is not encrypted, and the result of
20841 the expansion is empty, thus matching no hosts. Otherwise, the result of the
20842 expansion is *, which matches all hosts.
20843 </para>
20844 <para>
20845 <indexterm role="option">
20846 <primary><option>auto_thaw</option></primary>
20847 </indexterm>
20848 </para>
20849 <informaltable frame="all">
20850 <tgroup cols="4" colsep="0" rowsep="0">
20851 <colspec colwidth="8*" align="left"/>
20852 <colspec colwidth="6*" align="center"/>
20853 <colspec colwidth="6*" align="center"/>
20854 <colspec colwidth="6*" align="right"/>
20855 <tbody>
20856 <row>
20857 <entry><option>auto_thaw</option></entry>
20858 <entry>Use: <emphasis>main</emphasis></entry>
20859 <entry>Type: <emphasis>time</emphasis></entry>
20860 <entry>Default: <emphasis>0s</emphasis></entry>
20861 </row>
20862 </tbody>
20863 </tgroup>
20864 </informaltable>
20865 <para>
20866 <indexterm role="concept">
20867 <primary>thawing messages</primary>
20868 </indexterm>
20869 <indexterm role="concept">
20870 <primary>unfreezing messages</primary>
20871 </indexterm>
20872 If this option is set to a time greater than zero, a queue runner will try a
20873 new delivery attempt on any frozen message, other than a bounce message, if
20874 this much time has passed since it was frozen. This may result in the message
20875 being re-frozen if nothing has changed since the last attempt. It is a way of
20876 saying <quote>keep on trying, even though there are big problems</quote>.
20877 </para>
20878 <para>
20879 <emphasis role="bold">Note</emphasis>: This is an old option, which predates <option>timeout_frozen_after</option> and
20880 <option>ignore_bounce_errors_after</option>. It is retained for compatibility, but it is not
20881 thought to be very useful any more, and its use should probably be avoided.
20882 </para>
20883 <para>
20884 <indexterm role="option">
20885 <primary><option>av_scanner</option></primary>
20886 </indexterm>
20887 </para>
20888 <informaltable frame="all">
20889 <tgroup cols="4" colsep="0" rowsep="0">
20890 <colspec colwidth="8*" align="left"/>
20891 <colspec colwidth="6*" align="center"/>
20892 <colspec colwidth="6*" align="center"/>
20893 <colspec colwidth="6*" align="right"/>
20894 <tbody>
20895 <row>
20896 <entry><option>av_scanner</option></entry>
20897 <entry>Use: <emphasis>main</emphasis></entry>
20898 <entry>Type: <emphasis>string</emphasis></entry>
20899 <entry>Default: <emphasis>see below</emphasis></entry>
20900 </row>
20901 </tbody>
20902 </tgroup>
20903 </informaltable>
20904 <para>
20905 This option is available if Exim is built with the content-scanning extension.
20906 It specifies which anti-virus scanner to use. The default value is:
20907 </para>
20908 <literallayout class="monospaced">
20909 sophie:/var/run/sophie
20910 </literallayout>
20911 <para>
20912 If the value of <option>av_scanner</option> starts with dollar character, it is expanded
20913 before use. See section <xref linkend="SECTscanvirus"/> for further details.
20914 </para>
20915 <para>
20916 <indexterm role="option">
20917 <primary><option>bi_command</option></primary>
20918 </indexterm>
20919 </para>
20920 <informaltable frame="all">
20921 <tgroup cols="4" colsep="0" rowsep="0">
20922 <colspec colwidth="8*" align="left"/>
20923 <colspec colwidth="6*" align="center"/>
20924 <colspec colwidth="6*" align="center"/>
20925 <colspec colwidth="6*" align="right"/>
20926 <tbody>
20927 <row>
20928 <entry><option>bi_command</option></entry>
20929 <entry>Use: <emphasis>main</emphasis></entry>
20930 <entry>Type: <emphasis>string</emphasis></entry>
20931 <entry>Default: <emphasis>unset</emphasis></entry>
20932 </row>
20933 </tbody>
20934 </tgroup>
20935 </informaltable>
20936 <para>
20937 <indexterm role="option">
20938 <primary><option>-bi</option></primary>
20939 </indexterm>
20940 This option supplies the name of a command that is run when Exim is called with
20941 the <option>-bi</option> option (see chapter <xref linkend="CHAPcommandline"/>). The string value is
20942 just the command name, it is not a complete command line. If an argument is
20943 required, it must come from the <option>-oA</option> command line option.
20944 </para>
20945 <para>
20946 <indexterm role="option">
20947 <primary><option>bounce_message_file</option></primary>
20948 </indexterm>
20949 </para>
20950 <informaltable frame="all">
20951 <tgroup cols="4" colsep="0" rowsep="0">
20952 <colspec colwidth="8*" align="left"/>
20953 <colspec colwidth="6*" align="center"/>
20954 <colspec colwidth="6*" align="center"/>
20955 <colspec colwidth="6*" align="right"/>
20956 <tbody>
20957 <row>
20958 <entry><option>bounce_message_file</option></entry>
20959 <entry>Use: <emphasis>main</emphasis></entry>
20960 <entry>Type: <emphasis>string</emphasis></entry>
20961 <entry>Default: <emphasis>unset</emphasis></entry>
20962 </row>
20963 </tbody>
20964 </tgroup>
20965 </informaltable>
20966 <para>
20967 <indexterm role="concept">
20968 <primary>bounce message</primary>
20969 <secondary>customizing</secondary>
20970 </indexterm>
20971 <indexterm role="concept">
20972 <primary>customizing</primary>
20973 <secondary>bounce message</secondary>
20974 </indexterm>
20975 This option defines a template file containing paragraphs of text to be used
20976 for constructing bounce messages.  Details of the file&#x2019;s contents are given in
20977 chapter <xref linkend="CHAPemsgcust"/>. See also <option>warn_message_file</option>.
20978 </para>
20979 <para>
20980 <indexterm role="option">
20981 <primary><option>bounce_message_text</option></primary>
20982 </indexterm>
20983 </para>
20984 <informaltable frame="all">
20985 <tgroup cols="4" colsep="0" rowsep="0">
20986 <colspec colwidth="8*" align="left"/>
20987 <colspec colwidth="6*" align="center"/>
20988 <colspec colwidth="6*" align="center"/>
20989 <colspec colwidth="6*" align="right"/>
20990 <tbody>
20991 <row>
20992 <entry><option>bounce_message_text</option></entry>
20993 <entry>Use: <emphasis>main</emphasis></entry>
20994 <entry>Type: <emphasis>string</emphasis></entry>
20995 <entry>Default: <emphasis>unset</emphasis></entry>
20996 </row>
20997 </tbody>
20998 </tgroup>
20999 </informaltable>
21000 <para>
21001 When this option is set, its contents are included in the default bounce
21002 message immediately after <quote>This message was created automatically by mail
21003 delivery software.</quote> It is not used if <option>bounce_message_file</option> is set.
21004 </para>
21005 <para>
21006 <indexterm role="option">
21007 <primary><option>bounce_return_body</option></primary>
21008 </indexterm>
21009 </para>
21010 <informaltable frame="all">
21011 <tgroup cols="4" colsep="0" rowsep="0">
21012 <colspec colwidth="8*" align="left"/>
21013 <colspec colwidth="6*" align="center"/>
21014 <colspec colwidth="6*" align="center"/>
21015 <colspec colwidth="6*" align="right"/>
21016 <tbody>
21017 <row>
21018 <entry><option>bounce_return_body</option></entry>
21019 <entry>Use: <emphasis>main</emphasis></entry>
21020 <entry>Type: <emphasis>boolean</emphasis></entry>
21021 <entry>Default: <emphasis>true</emphasis></entry>
21022 </row>
21023 </tbody>
21024 </tgroup>
21025 </informaltable>
21026 <para>
21027 <indexterm role="concept">
21028 <primary>bounce message</primary>
21029 <secondary>including body</secondary>
21030 </indexterm>
21031 This option controls whether the body of an incoming message is included in a
21032 bounce message when <option>bounce_return_message</option> is true. The default setting
21033 causes the entire message, both header and body, to be returned (subject to the
21034 value of <option>bounce_return_size_limit</option>). If this option is false, only the
21035 message header is included. In the case of a non-SMTP message containing an
21036 error that is detected during reception, only those header lines preceding the
21037 point at which the error was detected are returned.
21038 <indexterm role="concept">
21039 <primary>bounce message</primary>
21040 <secondary>including original</secondary>
21041 </indexterm>
21042 </para>
21043 <para>
21044 <indexterm role="option">
21045 <primary><option>bounce_return_message</option></primary>
21046 </indexterm>
21047 </para>
21048 <informaltable frame="all">
21049 <tgroup cols="4" colsep="0" rowsep="0">
21050 <colspec colwidth="8*" align="left"/>
21051 <colspec colwidth="6*" align="center"/>
21052 <colspec colwidth="6*" align="center"/>
21053 <colspec colwidth="6*" align="right"/>
21054 <tbody>
21055 <row>
21056 <entry><option>bounce_return_message</option></entry>
21057 <entry>Use: <emphasis>main</emphasis></entry>
21058 <entry>Type: <emphasis>boolean</emphasis></entry>
21059 <entry>Default: <emphasis>true</emphasis></entry>
21060 </row>
21061 </tbody>
21062 </tgroup>
21063 </informaltable>
21064 <para>
21065 If this option is set false, none of the original message is included in
21066 bounce messages generated by Exim. See also <option>bounce_return_size_limit</option> and
21067 <option>bounce_return_body</option>.
21068 </para>
21069 <para>
21070 <indexterm role="option">
21071 <primary><option>bounce_return_size_limit</option></primary>
21072 </indexterm>
21073 </para>
21074 <informaltable frame="all">
21075 <tgroup cols="4" colsep="0" rowsep="0">
21076 <colspec colwidth="8*" align="left"/>
21077 <colspec colwidth="6*" align="center"/>
21078 <colspec colwidth="6*" align="center"/>
21079 <colspec colwidth="6*" align="right"/>
21080 <tbody>
21081 <row>
21082 <entry><option>bounce_return_size_limit</option></entry>
21083 <entry>Use: <emphasis>main</emphasis></entry>
21084 <entry>Type: <emphasis>integer</emphasis></entry>
21085 <entry>Default: <emphasis>100K</emphasis></entry>
21086 </row>
21087 </tbody>
21088 </tgroup>
21089 </informaltable>
21090 <para>
21091 <indexterm role="concept">
21092 <primary>size</primary>
21093 <secondary>of bounce, limit</secondary>
21094 </indexterm>
21095 <indexterm role="concept">
21096 <primary>bounce message</primary>
21097 <secondary>size limit</secondary>
21098 </indexterm>
21099 <indexterm role="concept">
21100 <primary>limit</primary>
21101 <secondary>bounce message size</secondary>
21102 </indexterm>
21103 This option sets a limit in bytes on the size of messages that are returned to
21104 senders as part of bounce messages when <option>bounce_return_message</option> is true. The
21105 limit should be less than the value of the global <option>message_size_limit</option> and of
21106 any <option>message_size_limit</option> settings on transports, to allow for the bounce text
21107 that Exim generates. If this option is set to zero there is no limit.
21108 </para>
21109 <para>
21110 When the body of any message that is to be included in a bounce message is
21111 greater than the limit, it is truncated, and a comment pointing this out is
21112 added at the top. The actual cutoff may be greater than the value given, owing
21113 to the use of buffering for transferring the message in chunks (typically 8K in
21114 size). The idea is to save bandwidth on those undeliverable 15-megabyte
21115 messages.
21116 </para>
21117 <para>
21118 <indexterm role="option">
21119 <primary><option>bounce_sender_authentication</option></primary>
21120 </indexterm>
21121 </para>
21122 <informaltable frame="all">
21123 <tgroup cols="4" colsep="0" rowsep="0">
21124 <colspec colwidth="8*" align="left"/>
21125 <colspec colwidth="6*" align="center"/>
21126 <colspec colwidth="6*" align="center"/>
21127 <colspec colwidth="6*" align="right"/>
21128 <tbody>
21129 <row>
21130 <entry><option>bounce_sender_authentication</option></entry>
21131 <entry>Use: <emphasis>main</emphasis></entry>
21132 <entry>Type: <emphasis>string</emphasis></entry>
21133 <entry>Default: <emphasis>unset</emphasis></entry>
21134 </row>
21135 </tbody>
21136 </tgroup>
21137 </informaltable>
21138 <para>
21139 <indexterm role="concept">
21140 <primary>bounce message</primary>
21141 <secondary>sender authentication</secondary>
21142 </indexterm>
21143 <indexterm role="concept">
21144 <primary>authentication</primary>
21145 <secondary>bounce message</secondary>
21146 </indexterm>
21147 <indexterm role="concept">
21148 <primary>AUTH</primary>
21149 <secondary>on bounce message</secondary>
21150 </indexterm>
21151 This option provides an authenticated sender address that is sent with any
21152 bounce messages generated by Exim that are sent over an authenticated SMTP
21153 connection. A typical setting might be:
21154 </para>
21155 <literallayout class="monospaced">
21156 bounce_sender_authentication = mailer-daemon@my.domain.example
21157 </literallayout>
21158 <para>
21159 which would cause bounce messages to be sent using the SMTP command:
21160 </para>
21161 <literallayout class="monospaced">
21162 MAIL FROM:&lt;&gt; AUTH=mailer-daemon@my.domain.example
21163 </literallayout>
21164 <para>
21165 The value of <option>bounce_sender_authentication</option> must always be a complete email
21166 address.
21167 </para>
21168 <para>
21169 <indexterm role="option">
21170 <primary><option>callout_domain_negative_expire</option></primary>
21171 </indexterm>
21172 </para>
21173 <informaltable frame="all">
21174 <tgroup cols="4" colsep="0" rowsep="0">
21175 <colspec colwidth="8*" align="left"/>
21176 <colspec colwidth="6*" align="center"/>
21177 <colspec colwidth="6*" align="center"/>
21178 <colspec colwidth="6*" align="right"/>
21179 <tbody>
21180 <row>
21181 <entry><option>callout_domain_negative_expire</option></entry>
21182 <entry>Use: <emphasis>main</emphasis></entry>
21183 <entry>Type: <emphasis>time</emphasis></entry>
21184 <entry>Default: <emphasis>3h</emphasis></entry>
21185 </row>
21186 </tbody>
21187 </tgroup>
21188 </informaltable>
21189 <para>
21190 <indexterm role="concept">
21191 <primary>caching</primary>
21192 <secondary>callout timeouts</secondary>
21193 </indexterm>
21194 <indexterm role="concept">
21195 <primary>callout</primary>
21196 <secondary>caching timeouts</secondary>
21197 </indexterm>
21198 This option specifies the expiry time for negative callout cache data for a
21199 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
21200 section <xref linkend="SECTcallvercache"/> for details of the caching.
21201 </para>
21202 <para>
21203 <indexterm role="option">
21204 <primary><option>callout_domain_positive_expire</option></primary>
21205 </indexterm>
21206 </para>
21207 <informaltable frame="all">
21208 <tgroup cols="4" colsep="0" rowsep="0">
21209 <colspec colwidth="8*" align="left"/>
21210 <colspec colwidth="6*" align="center"/>
21211 <colspec colwidth="6*" align="center"/>
21212 <colspec colwidth="6*" align="right"/>
21213 <tbody>
21214 <row>
21215 <entry><option>callout_domain_positive_expire</option></entry>
21216 <entry>Use: <emphasis>main</emphasis></entry>
21217 <entry>Type: <emphasis>time</emphasis></entry>
21218 <entry>Default: <emphasis>7d</emphasis></entry>
21219 </row>
21220 </tbody>
21221 </tgroup>
21222 </informaltable>
21223 <para>
21224 This option specifies the expiry time for positive callout cache data for a
21225 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
21226 section <xref linkend="SECTcallvercache"/> for details of the caching.
21227 </para>
21228 <para>
21229 <indexterm role="option">
21230 <primary><option>callout_negative_expire</option></primary>
21231 </indexterm>
21232 </para>
21233 <informaltable frame="all">
21234 <tgroup cols="4" colsep="0" rowsep="0">
21235 <colspec colwidth="8*" align="left"/>
21236 <colspec colwidth="6*" align="center"/>
21237 <colspec colwidth="6*" align="center"/>
21238 <colspec colwidth="6*" align="right"/>
21239 <tbody>
21240 <row>
21241 <entry><option>callout_negative_expire</option></entry>
21242 <entry>Use: <emphasis>main</emphasis></entry>
21243 <entry>Type: <emphasis>time</emphasis></entry>
21244 <entry>Default: <emphasis>2h</emphasis></entry>
21245 </row>
21246 </tbody>
21247 </tgroup>
21248 </informaltable>
21249 <para>
21250 This option specifies the expiry time for negative callout cache data for an
21251 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
21252 section <xref linkend="SECTcallvercache"/> for details of the caching.
21253 </para>
21254 <para>
21255 <indexterm role="option">
21256 <primary><option>callout_positive_expire</option></primary>
21257 </indexterm>
21258 </para>
21259 <informaltable frame="all">
21260 <tgroup cols="4" colsep="0" rowsep="0">
21261 <colspec colwidth="8*" align="left"/>
21262 <colspec colwidth="6*" align="center"/>
21263 <colspec colwidth="6*" align="center"/>
21264 <colspec colwidth="6*" align="right"/>
21265 <tbody>
21266 <row>
21267 <entry><option>callout_positive_expire</option></entry>
21268 <entry>Use: <emphasis>main</emphasis></entry>
21269 <entry>Type: <emphasis>time</emphasis></entry>
21270 <entry>Default: <emphasis>24h</emphasis></entry>
21271 </row>
21272 </tbody>
21273 </tgroup>
21274 </informaltable>
21275 <para>
21276 This option specifies the expiry time for positive callout cache data for an
21277 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
21278 section <xref linkend="SECTcallvercache"/> for details of the caching.
21279 </para>
21280 <para>
21281 <indexterm role="option">
21282 <primary><option>callout_random_local_part</option></primary>
21283 </indexterm>
21284 </para>
21285 <informaltable frame="all">
21286 <tgroup cols="4" colsep="0" rowsep="0">
21287 <colspec colwidth="8*" align="left"/>
21288 <colspec colwidth="6*" align="center"/>
21289 <colspec colwidth="6*" align="center"/>
21290 <colspec colwidth="6*" align="right"/>
21291 <tbody>
21292 <row>
21293 <entry><option>callout_random_local_part</option></entry>
21294 <entry>Use: <emphasis>main</emphasis></entry>
21295 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21296 <entry>Default: <emphasis>see below</emphasis></entry>
21297 </row>
21298 </tbody>
21299 </tgroup>
21300 </informaltable>
21301 <para>
21302 This option defines the <quote>random</quote> local part that can be used as part of
21303 callout verification. The default value is
21304 </para>
21305 <literallayout class="monospaced">
21306 $primary_host_name-$tod_epoch-testing
21307 </literallayout>
21308 <para>
21309 See section <xref linkend="CALLaddparcall"/> for details of how this value is used.
21310 </para>
21311 <para>
21312 <indexterm role="option">
21313 <primary><option>check_log_inodes</option></primary>
21314 </indexterm>
21315 </para>
21316 <informaltable frame="all">
21317 <tgroup cols="4" colsep="0" rowsep="0">
21318 <colspec colwidth="8*" align="left"/>
21319 <colspec colwidth="6*" align="center"/>
21320 <colspec colwidth="6*" align="center"/>
21321 <colspec colwidth="6*" align="right"/>
21322 <tbody>
21323 <row>
21324 <entry><option>check_log_inodes</option></entry>
21325 <entry>Use: <emphasis>main</emphasis></entry>
21326 <entry>Type: <emphasis>integer</emphasis></entry>
21327 <entry>Default: <emphasis>0</emphasis></entry>
21328 </row>
21329 </tbody>
21330 </tgroup>
21331 </informaltable>
21332 <para>
21333 See <option>check_spool_space</option> below.
21334 </para>
21335 <para>
21336 <indexterm role="option">
21337 <primary><option>check_log_space</option></primary>
21338 </indexterm>
21339 </para>
21340 <informaltable frame="all">
21341 <tgroup cols="4" colsep="0" rowsep="0">
21342 <colspec colwidth="8*" align="left"/>
21343 <colspec colwidth="6*" align="center"/>
21344 <colspec colwidth="6*" align="center"/>
21345 <colspec colwidth="6*" align="right"/>
21346 <tbody>
21347 <row>
21348 <entry><option>check_log_space</option></entry>
21349 <entry>Use: <emphasis>main</emphasis></entry>
21350 <entry>Type: <emphasis>integer</emphasis></entry>
21351 <entry>Default: <emphasis>0</emphasis></entry>
21352 </row>
21353 </tbody>
21354 </tgroup>
21355 </informaltable>
21356 <para>
21357 See <option>check_spool_space</option> below.
21358 </para>
21359 <para>
21360 <indexterm role="option">
21361 <primary><option>check_rfc2047_length</option></primary>
21362 </indexterm>
21363 <indexterm role="concept">
21364 <primary>RFC 2047</primary>
21365 <secondary>disabling length check</secondary>
21366 </indexterm>
21367 <indexterm role="option">
21368 <primary><option>check_rfc2047_length</option></primary>
21369 </indexterm>
21370 </para>
21371 <informaltable frame="all">
21372 <tgroup cols="4" colsep="0" rowsep="0">
21373 <colspec colwidth="8*" align="left"/>
21374 <colspec colwidth="6*" align="center"/>
21375 <colspec colwidth="6*" align="center"/>
21376 <colspec colwidth="6*" align="right"/>
21377 <tbody>
21378 <row>
21379 <entry><option>check_rfc2047_length</option></entry>
21380 <entry>Use: <emphasis>main</emphasis></entry>
21381 <entry>Type: <emphasis>boolean</emphasis></entry>
21382 <entry>Default: <emphasis>true</emphasis></entry>
21383 </row>
21384 </tbody>
21385 </tgroup>
21386 </informaltable>
21387 <para>
21388 RFC 2047 defines a way of encoding non-ASCII characters in headers using a
21389 system of <quote>encoded words</quote>. The RFC specifies a maximum length for an encoded
21390 word; strings to be encoded that exceed this length are supposed to use
21391 multiple encoded words. By default, Exim does not recognize encoded words that
21392 exceed the maximum length. However, it seems that some software, in violation
21393 of the RFC, generates overlong encoded words. If <option>check_rfc2047_length</option> is
21394 set false, Exim recognizes encoded words of any length.
21395 </para>
21396 <para>
21397 <indexterm role="option">
21398 <primary><option>check_spool_inodes</option></primary>
21399 </indexterm>
21400 </para>
21401 <informaltable frame="all">
21402 <tgroup cols="4" colsep="0" rowsep="0">
21403 <colspec colwidth="8*" align="left"/>
21404 <colspec colwidth="6*" align="center"/>
21405 <colspec colwidth="6*" align="center"/>
21406 <colspec colwidth="6*" align="right"/>
21407 <tbody>
21408 <row>
21409 <entry><option>check_spool_inodes</option></entry>
21410 <entry>Use: <emphasis>main</emphasis></entry>
21411 <entry>Type: <emphasis>integer</emphasis></entry>
21412 <entry>Default: <emphasis>0</emphasis></entry>
21413 </row>
21414 </tbody>
21415 </tgroup>
21416 </informaltable>
21417 <para>
21418 See <option>check_spool_space</option> below.
21419 </para>
21420 <para>
21421 <indexterm role="option">
21422 <primary><option>check_spool_space</option></primary>
21423 </indexterm>
21424 </para>
21425 <informaltable frame="all">
21426 <tgroup cols="4" colsep="0" rowsep="0">
21427 <colspec colwidth="8*" align="left"/>
21428 <colspec colwidth="6*" align="center"/>
21429 <colspec colwidth="6*" align="center"/>
21430 <colspec colwidth="6*" align="right"/>
21431 <tbody>
21432 <row>
21433 <entry><option>check_spool_space</option></entry>
21434 <entry>Use: <emphasis>main</emphasis></entry>
21435 <entry>Type: <emphasis>integer</emphasis></entry>
21436 <entry>Default: <emphasis>0</emphasis></entry>
21437 </row>
21438 </tbody>
21439 </tgroup>
21440 </informaltable>
21441 <para>
21442 <indexterm role="concept">
21443 <primary>checking disk space</primary>
21444 </indexterm>
21445 <indexterm role="concept">
21446 <primary>disk space, checking</primary>
21447 </indexterm>
21448 <indexterm role="concept">
21449 <primary>spool directory</primary>
21450 <secondary>checking space</secondary>
21451 </indexterm>
21452 The four <option>check_...</option> options allow for checking of disk resources before a
21453 message is accepted.
21454 </para>
21455 <para>
21456 <indexterm role="variable">
21457 <primary><varname>$log_inodes</varname></primary>
21458 </indexterm>
21459 <indexterm role="variable">
21460 <primary><varname>$log_space</varname></primary>
21461 </indexterm>
21462 <indexterm role="variable">
21463 <primary><varname>$spool_inodes</varname></primary>
21464 </indexterm>
21465 <indexterm role="variable">
21466 <primary><varname>$spool_space</varname></primary>
21467 </indexterm>
21468 When any of these options are set, they apply to all incoming messages. If you
21469 want to apply different checks to different kinds of message, you can do so by
21470 testing the variables <varname>$log_inodes</varname>, <varname>$log_space</varname>, <varname>$spool_inodes</varname>, and
21471 <varname>$spool_space</varname> in an ACL with appropriate additional conditions.
21472 </para>
21473 <para>
21474 <option>check_spool_space</option> and <option>check_spool_inodes</option> check the spool partition if
21475 either value is greater than zero, for example:
21476 </para>
21477 <literallayout class="monospaced">
21478 check_spool_space = 10M
21479 check_spool_inodes = 100
21480 </literallayout>
21481 <para>
21482 The spool partition is the one that contains the directory defined by
21483 SPOOL_DIRECTORY in <filename>Local/Makefile</filename>. It is used for holding messages in
21484 transit.
21485 </para>
21486 <para>
21487 <option>check_log_space</option> and <option>check_log_inodes</option>  check the partition in which log
21488 files are written if either is greater than zero. These should be set only if
21489 <option>log_file_path</option> and <option>spool_directory</option> refer to different partitions.
21490 </para>
21491 <para>
21492 If there is less space or fewer inodes than requested, Exim refuses to accept
21493 incoming mail. In the case of SMTP input this is done by giving a 452 temporary
21494 error response to the MAIL command. If ESMTP is in use and there was a
21495 SIZE parameter on the MAIL command, its value is added to the
21496 <option>check_spool_space</option> value, and the check is performed even if
21497 <option>check_spool_space</option> is zero, unless <option>no_smtp_check_spool_space</option> is set.
21498 </para>
21499 <para>
21500 The values for <option>check_spool_space</option> and <option>check_log_space</option> are held as a
21501 number of kilobytes. If a non-multiple of 1024 is specified, it is rounded up.
21502 </para>
21503 <para>
21504 For non-SMTP input and for batched SMTP input, the test is done at start-up; on
21505 failure a message is written to stderr and Exim exits with a non-zero code, as
21506 it obviously cannot send an error message of any kind.
21507 </para>
21508 <para>
21509 <indexterm role="option">
21510 <primary><option>daemon_smtp_ports</option></primary>
21511 </indexterm>
21512 </para>
21513 <informaltable frame="all">
21514 <tgroup cols="4" colsep="0" rowsep="0">
21515 <colspec colwidth="8*" align="left"/>
21516 <colspec colwidth="6*" align="center"/>
21517 <colspec colwidth="6*" align="center"/>
21518 <colspec colwidth="6*" align="right"/>
21519 <tbody>
21520 <row>
21521 <entry><option>daemon_smtp_ports</option></entry>
21522 <entry>Use: <emphasis>main</emphasis></entry>
21523 <entry>Type: <emphasis>string</emphasis></entry>
21524 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
21525 </row>
21526 </tbody>
21527 </tgroup>
21528 </informaltable>
21529 <para>
21530 <indexterm role="concept">
21531 <primary>port</primary>
21532 <secondary>for daemon</secondary>
21533 </indexterm>
21534 <indexterm role="concept">
21535 <primary>TCP/IP</primary>
21536 <secondary>setting listening ports</secondary>
21537 </indexterm>
21538 This option specifies one or more default SMTP ports on which the Exim daemon
21539 listens. See chapter <xref linkend="CHAPinterfaces"/> for details of how it is used. For
21540 backward compatibility, <option>daemon_smtp_port</option> (singular) is a synonym.
21541 </para>
21542 <para>
21543 <indexterm role="option">
21544 <primary><option>daemon_startup_retries</option></primary>
21545 </indexterm>
21546 </para>
21547 <informaltable frame="all">
21548 <tgroup cols="4" colsep="0" rowsep="0">
21549 <colspec colwidth="8*" align="left"/>
21550 <colspec colwidth="6*" align="center"/>
21551 <colspec colwidth="6*" align="center"/>
21552 <colspec colwidth="6*" align="right"/>
21553 <tbody>
21554 <row>
21555 <entry><option>daemon_startup_retries</option></entry>
21556 <entry>Use: <emphasis>main</emphasis></entry>
21557 <entry>Type: <emphasis>integer</emphasis></entry>
21558 <entry>Default: <emphasis>9</emphasis></entry>
21559 </row>
21560 </tbody>
21561 </tgroup>
21562 </informaltable>
21563 <para>
21564 <indexterm role="concept">
21565 <primary>daemon startup, retrying</primary>
21566 </indexterm>
21567 This option, along with <option>daemon_startup_sleep</option>, controls the retrying done by
21568 the daemon at startup when it cannot immediately bind a listening socket
21569 (typically because the socket is already in use): <option>daemon_startup_retries</option>
21570 defines the number of retries after the first failure, and
21571 <option>daemon_startup_sleep</option> defines the length of time to wait between retries.
21572 </para>
21573 <para>
21574 <indexterm role="option">
21575 <primary><option>daemon_startup_sleep</option></primary>
21576 </indexterm>
21577 </para>
21578 <informaltable frame="all">
21579 <tgroup cols="4" colsep="0" rowsep="0">
21580 <colspec colwidth="8*" align="left"/>
21581 <colspec colwidth="6*" align="center"/>
21582 <colspec colwidth="6*" align="center"/>
21583 <colspec colwidth="6*" align="right"/>
21584 <tbody>
21585 <row>
21586 <entry><option>daemon_startup_sleep</option></entry>
21587 <entry>Use: <emphasis>main</emphasis></entry>
21588 <entry>Type: <emphasis>time</emphasis></entry>
21589 <entry>Default: <emphasis>30s</emphasis></entry>
21590 </row>
21591 </tbody>
21592 </tgroup>
21593 </informaltable>
21594 <para>
21595 See <option>daemon_startup_retries</option>.
21596 </para>
21597 <para>
21598 <indexterm role="option">
21599 <primary><option>delay_warning</option></primary>
21600 </indexterm>
21601 </para>
21602 <informaltable frame="all">
21603 <tgroup cols="4" colsep="0" rowsep="0">
21604 <colspec colwidth="8*" align="left"/>
21605 <colspec colwidth="6*" align="center"/>
21606 <colspec colwidth="6*" align="center"/>
21607 <colspec colwidth="6*" align="right"/>
21608 <tbody>
21609 <row>
21610 <entry><option>delay_warning</option></entry>
21611 <entry>Use: <emphasis>main</emphasis></entry>
21612 <entry>Type: <emphasis>time list</emphasis></entry>
21613 <entry>Default: <emphasis>24h</emphasis></entry>
21614 </row>
21615 </tbody>
21616 </tgroup>
21617 </informaltable>
21618 <para>
21619 <indexterm role="concept">
21620 <primary>warning of delay</primary>
21621 </indexterm>
21622 <indexterm role="concept">
21623 <primary>delay warning, specifying</primary>
21624 </indexterm>
21625 When a message is delayed, Exim sends a warning message to the sender at
21626 intervals specified by this option. The data is a colon-separated list of times
21627 after which to send warning messages. If the value of the option is an empty
21628 string or a zero time, no warnings are sent. Up to 10 times may be given. If a
21629 message has been on the queue for longer than the last time, the last interval
21630 between the times is used to compute subsequent warning times. For example,
21631 with
21632 </para>
21633 <literallayout class="monospaced">
21634 delay_warning = 4h:8h:24h
21635 </literallayout>
21636 <para>
21637 the first message is sent after 4 hours, the second after 8 hours, and
21638 the third one after 24 hours. After that, messages are sent every 16 hours,
21639 because that is the interval between the last two times on the list. If you set
21640 just one time, it specifies the repeat interval. For example, with:
21641 </para>
21642 <literallayout class="monospaced">
21643 delay_warning = 6h
21644 </literallayout>
21645 <para>
21646 messages are repeated every six hours. To stop warnings after a given time, set
21647 a very large time at the end of the list. For example:
21648 </para>
21649 <literallayout class="monospaced">
21650 delay_warning = 2h:12h:99d
21651 </literallayout>
21652 <para>
21653 <indexterm role="option">
21654 <primary><option>delay_warning_condition</option></primary>
21655 </indexterm>
21656 </para>
21657 <informaltable frame="all">
21658 <tgroup cols="4" colsep="0" rowsep="0">
21659 <colspec colwidth="8*" align="left"/>
21660 <colspec colwidth="6*" align="center"/>
21661 <colspec colwidth="6*" align="center"/>
21662 <colspec colwidth="6*" align="right"/>
21663 <tbody>
21664 <row>
21665 <entry><option>delay_warning_condition</option></entry>
21666 <entry>Use: <emphasis>main</emphasis></entry>
21667 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21668 <entry>Default: <emphasis>see below</emphasis></entry>
21669 </row>
21670 </tbody>
21671 </tgroup>
21672 </informaltable>
21673 <para>
21674 <indexterm role="variable">
21675 <primary><varname>$domain</varname></primary>
21676 </indexterm>
21677 The string is expanded at the time a warning message might be sent. If all the
21678 deferred addresses have the same domain, it is set in <varname>$domain</varname> during the
21679 expansion. Otherwise <varname>$domain</varname> is empty. If the result of the expansion is a
21680 forced failure, an empty string, or a string matching any of <quote>0</quote>, <quote>no</quote> or
21681 <quote>false</quote> (the comparison being done caselessly) then the warning message is
21682 not sent. The default is:
21683 </para>
21684 <literallayout class="monospaced">
21685 delay_warning_condition = ${if or {\
21686   { !eq{$h_list-id:$h_list-post:$h_list-subscribe:}{} }\
21687   { match{$h_precedence:}{(?i)bulk|list|junk} }\
21688   { match{$h_auto-submitted:}{(?i)auto-generated|auto-replied} }\
21689   } {no}{yes}}
21690 </literallayout>
21691 <para>
21692 This suppresses the sending of warnings for messages that contain <emphasis>List-ID:</emphasis>,
21693 <emphasis>List-Post:</emphasis>, or <emphasis>List-Subscribe:</emphasis> headers, or have <quote>bulk</quote>, <quote>list</quote> or
21694 <quote>junk</quote> in a <emphasis>Precedence:</emphasis> header, or have <quote>auto-generated</quote> or
21695 <quote>auto-replied</quote> in an <emphasis>Auto-Submitted:</emphasis> header.
21696 </para>
21697 <para>
21698 <indexterm role="option">
21699 <primary><option>deliver_drop_privilege</option></primary>
21700 </indexterm>
21701 </para>
21702 <informaltable frame="all">
21703 <tgroup cols="4" colsep="0" rowsep="0">
21704 <colspec colwidth="8*" align="left"/>
21705 <colspec colwidth="6*" align="center"/>
21706 <colspec colwidth="6*" align="center"/>
21707 <colspec colwidth="6*" align="right"/>
21708 <tbody>
21709 <row>
21710 <entry><option>deliver_drop_privilege</option></entry>
21711 <entry>Use: <emphasis>main</emphasis></entry>
21712 <entry>Type: <emphasis>boolean</emphasis></entry>
21713 <entry>Default: <emphasis>false</emphasis></entry>
21714 </row>
21715 </tbody>
21716 </tgroup>
21717 </informaltable>
21718 <para>
21719 <indexterm role="concept">
21720 <primary>unprivileged delivery</primary>
21721 </indexterm>
21722 <indexterm role="concept">
21723 <primary>delivery</primary>
21724 <secondary>unprivileged</secondary>
21725 </indexterm>
21726 If this option is set true, Exim drops its root privilege at the start of a
21727 delivery process, and runs as the Exim user throughout. This severely restricts
21728 the kinds of local delivery that are possible, but is viable in certain types
21729 of configuration. There is a discussion about the use of root privilege in
21730 chapter <xref linkend="CHAPsecurity"/>.
21731 </para>
21732 <para>
21733 <indexterm role="option">
21734 <primary><option>deliver_queue_load_max</option></primary>
21735 </indexterm>
21736 </para>
21737 <informaltable frame="all">
21738 <tgroup cols="4" colsep="0" rowsep="0">
21739 <colspec colwidth="8*" align="left"/>
21740 <colspec colwidth="6*" align="center"/>
21741 <colspec colwidth="6*" align="center"/>
21742 <colspec colwidth="6*" align="right"/>
21743 <tbody>
21744 <row>
21745 <entry><option>deliver_queue_load_max</option></entry>
21746 <entry>Use: <emphasis>main</emphasis></entry>
21747 <entry>Type: <emphasis>fixed-point</emphasis></entry>
21748 <entry>Default: <emphasis>unset</emphasis></entry>
21749 </row>
21750 </tbody>
21751 </tgroup>
21752 </informaltable>
21753 <para>
21754 <indexterm role="concept">
21755 <primary>load average</primary>
21756 </indexterm>
21757 <indexterm role="concept">
21758 <primary>queue runner</primary>
21759 <secondary>abandoning</secondary>
21760 </indexterm>
21761 When this option is set, a queue run is abandoned if the system load average
21762 becomes greater than the value of the option. The option has no effect on
21763 ancient operating systems on which Exim cannot determine the load average.
21764 See also <option>queue_only_load</option> and <option>smtp_load_reserve</option>.
21765 </para>
21766 <para>
21767 <indexterm role="option">
21768 <primary><option>delivery_date_remove</option></primary>
21769 </indexterm>
21770 </para>
21771 <informaltable frame="all">
21772 <tgroup cols="4" colsep="0" rowsep="0">
21773 <colspec colwidth="8*" align="left"/>
21774 <colspec colwidth="6*" align="center"/>
21775 <colspec colwidth="6*" align="center"/>
21776 <colspec colwidth="6*" align="right"/>
21777 <tbody>
21778 <row>
21779 <entry><option>delivery_date_remove</option></entry>
21780 <entry>Use: <emphasis>main</emphasis></entry>
21781 <entry>Type: <emphasis>boolean</emphasis></entry>
21782 <entry>Default: <emphasis>true</emphasis></entry>
21783 </row>
21784 </tbody>
21785 </tgroup>
21786 </informaltable>
21787 <para>
21788 <indexterm role="concept">
21789 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
21790 </indexterm>
21791 Exim&#x2019;s transports have an option for adding a <emphasis>Delivery-date:</emphasis> header to a
21792 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
21793 handled. <emphasis>Delivery-date:</emphasis> records the actual time of delivery. Such headers
21794 should not be present in incoming messages, and this option causes them to be
21795 removed at the time the message is received, to avoid any problems that might
21796 occur when a delivered message is subsequently sent on to some other recipient.
21797 </para>
21798 <para>
21799 <indexterm role="option">
21800 <primary><option>disable_fsync</option></primary>
21801 </indexterm>
21802 </para>
21803 <informaltable frame="all">
21804 <tgroup cols="4" colsep="0" rowsep="0">
21805 <colspec colwidth="8*" align="left"/>
21806 <colspec colwidth="6*" align="center"/>
21807 <colspec colwidth="6*" align="center"/>
21808 <colspec colwidth="6*" align="right"/>
21809 <tbody>
21810 <row>
21811 <entry><option>disable_fsync</option></entry>
21812 <entry>Use: <emphasis>main</emphasis></entry>
21813 <entry>Type: <emphasis>boolean</emphasis></entry>
21814 <entry>Default: <emphasis>false</emphasis></entry>
21815 </row>
21816 </tbody>
21817 </tgroup>
21818 </informaltable>
21819 <para>
21820 <indexterm role="concept">
21821 <primary><function>fsync()</function>, disabling</primary>
21822 </indexterm>
21823 This option is available only if Exim was built with the compile-time option
21824 ENABLE_DISABLE_FSYNC. When this is not set, a reference to <option>disable_fsync</option> in
21825 a runtime configuration generates an <quote>unknown option</quote> error. You should not
21826 build Exim with ENABLE_DISABLE_FSYNC or set <option>disable_fsync</option> unless you
21827 really, really, really understand what you are doing. <emphasis>No pre-compiled
21828 distributions of Exim should ever make this option available.</emphasis>
21829 </para>
21830 <para>
21831 When <option>disable_fsync</option> is set true, Exim no longer calls <function>fsync()</function> to force
21832 updated files&#x2019; data to be written to disc before continuing. Unexpected events
21833 such as crashes and power outages may cause data to be lost or scrambled.
21834 Here be Dragons. <emphasis role="bold">Beware.</emphasis>
21835 </para>
21836 <para>
21837 <indexterm role="option">
21838 <primary><option>disable_ipv6</option></primary>
21839 </indexterm>
21840 </para>
21841 <informaltable frame="all">
21842 <tgroup cols="4" colsep="0" rowsep="0">
21843 <colspec colwidth="8*" align="left"/>
21844 <colspec colwidth="6*" align="center"/>
21845 <colspec colwidth="6*" align="center"/>
21846 <colspec colwidth="6*" align="right"/>
21847 <tbody>
21848 <row>
21849 <entry><option>disable_ipv6</option></entry>
21850 <entry>Use: <emphasis>main</emphasis></entry>
21851 <entry>Type: <emphasis>boolean</emphasis></entry>
21852 <entry>Default: <emphasis>false</emphasis></entry>
21853 </row>
21854 </tbody>
21855 </tgroup>
21856 </informaltable>
21857 <para>
21858 <indexterm role="concept">
21859 <primary>IPv6</primary>
21860 <secondary>disabling</secondary>
21861 </indexterm>
21862 If this option is set true, even if the Exim binary has IPv6 support, no IPv6
21863 activities take place. AAAA records are never looked up, and any IPv6 addresses
21864 that are listed in <option>local_interfaces</option>, data for the <option>manualroute</option> router,
21865 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
21866 to handle IPv6 literal addresses.
21867 </para>
21868 <para>
21869 <indexterm role="option">
21870 <primary><option>dns_again_means_nonexist</option></primary>
21871 </indexterm>
21872 </para>
21873 <informaltable frame="all">
21874 <tgroup cols="4" colsep="0" rowsep="0">
21875 <colspec colwidth="8*" align="left"/>
21876 <colspec colwidth="6*" align="center"/>
21877 <colspec colwidth="6*" align="center"/>
21878 <colspec colwidth="6*" align="right"/>
21879 <tbody>
21880 <row>
21881 <entry><option>dns_again_means_nonexist</option></entry>
21882 <entry>Use: <emphasis>main</emphasis></entry>
21883 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
21884 <entry>Default: <emphasis>unset</emphasis></entry>
21885 </row>
21886 </tbody>
21887 </tgroup>
21888 </informaltable>
21889 <para>
21890 <indexterm role="concept">
21891 <primary>DNS</primary>
21892 <secondary><quote>try again</quote> response; overriding</secondary>
21893 </indexterm>
21894 DNS lookups give a <quote>try again</quote> response for the DNS errors
21895 <quote>non-authoritative host not found</quote> and <quote>SERVERFAIL</quote>. This can cause Exim to
21896 keep trying to deliver a message, or to give repeated temporary errors to
21897 incoming mail. Sometimes the effect is caused by a badly set up name server and
21898 may persist for a long time. If a domain which exhibits this problem matches
21899 anything in <option>dns_again_means_nonexist</option>, it is treated as if it did not exist.
21900 This option should be used with care. You can make it apply to reverse lookups
21901 by a setting such as this:
21902 </para>
21903 <literallayout class="monospaced">
21904 dns_again_means_nonexist = *.in-addr.arpa
21905 </literallayout>
21906 <para>
21907 This option applies to all DNS lookups that Exim does. It also applies when the
21908 <function>gethostbyname()</function> or <function>getipnodebyname()</function> functions give temporary errors,
21909 since these are most likely to be caused by DNS lookup problems. The
21910 <command>dnslookup</command> router has some options of its own for controlling what happens
21911 when lookups for MX or SRV records give temporary errors. These more specific
21912 options are applied after this global option.
21913 </para>
21914 <para>
21915 <indexterm role="option">
21916 <primary><option>dns_check_names_pattern</option></primary>
21917 </indexterm>
21918 </para>
21919 <informaltable frame="all">
21920 <tgroup cols="4" colsep="0" rowsep="0">
21921 <colspec colwidth="8*" align="left"/>
21922 <colspec colwidth="6*" align="center"/>
21923 <colspec colwidth="6*" align="center"/>
21924 <colspec colwidth="6*" align="right"/>
21925 <tbody>
21926 <row>
21927 <entry><option>dns_check_names_pattern</option></entry>
21928 <entry>Use: <emphasis>main</emphasis></entry>
21929 <entry>Type: <emphasis>string</emphasis></entry>
21930 <entry>Default: <emphasis>see below</emphasis></entry>
21931 </row>
21932 </tbody>
21933 </tgroup>
21934 </informaltable>
21935 <para>
21936 <indexterm role="concept">
21937 <primary>DNS</primary>
21938 <secondary>pre-check of name syntax</secondary>
21939 </indexterm>
21940 When this option is set to a non-empty string, it causes Exim to check domain
21941 names for characters that are not allowed in host names before handing them to
21942 the DNS resolver, because some resolvers give temporary errors for names that
21943 contain unusual characters. If a domain name contains any unwanted characters,
21944 a <quote>not found</quote> result is forced, and the resolver is not called. The check is
21945 done by matching the domain name against a regular expression, which is the
21946 value of this option. The default pattern is
21947 </para>
21948 <literallayout class="monospaced">
21949 dns_check_names_pattern = \
21950   (?i)^(?&gt;(?(1)\.|())[^\W_](?&gt;[a-z0-9/-]*[^\W_])?)+$
21951 </literallayout>
21952 <para>
21953 which permits only letters, digits, slashes, and hyphens in components, but
21954 they must start and end with a letter or digit. Slashes are not, in fact,
21955 permitted in host names, but they are found in certain NS records (which can be
21956 accessed in Exim by using a <option>dnsdb</option> lookup). If you set
21957 <option>allow_utf8_domains</option>, you must modify this pattern, or set the option to an
21958 empty string.
21959 </para>
21960 <para>
21961 <indexterm role="option">
21962 <primary><option>dns_csa_search_limit</option></primary>
21963 </indexterm>
21964 </para>
21965 <informaltable frame="all">
21966 <tgroup cols="4" colsep="0" rowsep="0">
21967 <colspec colwidth="8*" align="left"/>
21968 <colspec colwidth="6*" align="center"/>
21969 <colspec colwidth="6*" align="center"/>
21970 <colspec colwidth="6*" align="right"/>
21971 <tbody>
21972 <row>
21973 <entry><option>dns_csa_search_limit</option></entry>
21974 <entry>Use: <emphasis>main</emphasis></entry>
21975 <entry>Type: <emphasis>integer</emphasis></entry>
21976 <entry>Default: <emphasis>5</emphasis></entry>
21977 </row>
21978 </tbody>
21979 </tgroup>
21980 </informaltable>
21981 <para>
21982 This option controls the depth of parental searching for CSA SRV records in the
21983 DNS, as described in more detail in section <xref linkend="SECTverifyCSA"/>.
21984 </para>
21985 <para>
21986 <indexterm role="option">
21987 <primary><option>dns_csa_use_reverse</option></primary>
21988 </indexterm>
21989 </para>
21990 <informaltable frame="all">
21991 <tgroup cols="4" colsep="0" rowsep="0">
21992 <colspec colwidth="8*" align="left"/>
21993 <colspec colwidth="6*" align="center"/>
21994 <colspec colwidth="6*" align="center"/>
21995 <colspec colwidth="6*" align="right"/>
21996 <tbody>
21997 <row>
21998 <entry><option>dns_csa_use_reverse</option></entry>
21999 <entry>Use: <emphasis>main</emphasis></entry>
22000 <entry>Type: <emphasis>boolean</emphasis></entry>
22001 <entry>Default: <emphasis>true</emphasis></entry>
22002 </row>
22003 </tbody>
22004 </tgroup>
22005 </informaltable>
22006 <para>
22007 This option controls whether or not an IP address, given as a CSA domain, is
22008 reversed and looked up in the reverse DNS, as described in more detail in
22009 section <xref linkend="SECTverifyCSA"/>.
22010 </para>
22011 <para>
22012 <indexterm role="option">
22013 <primary><option>dns_ipv4_lookup</option></primary>
22014 </indexterm>
22015 </para>
22016 <informaltable frame="all">
22017 <tgroup cols="4" colsep="0" rowsep="0">
22018 <colspec colwidth="8*" align="left"/>
22019 <colspec colwidth="6*" align="center"/>
22020 <colspec colwidth="6*" align="center"/>
22021 <colspec colwidth="6*" align="right"/>
22022 <tbody>
22023 <row>
22024 <entry><option>dns_ipv4_lookup</option></entry>
22025 <entry>Use: <emphasis>main</emphasis></entry>
22026 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
22027 <entry>Default: <emphasis>unset</emphasis></entry>
22028 </row>
22029 </tbody>
22030 </tgroup>
22031 </informaltable>
22032 <para>
22033 <indexterm role="concept">
22034 <primary>IPv6</primary>
22035 <secondary>DNS lookup for AAAA records</secondary>
22036 </indexterm>
22037 <indexterm role="concept">
22038 <primary>DNS</primary>
22039 <secondary>IPv6 lookup for AAAA records</secondary>
22040 </indexterm>
22041 When Exim is compiled with IPv6 support and <option>disable_ipv6</option> is not set, it
22042 looks for IPv6 address records (AAAA records) as well as IPv4 address records
22043 (A records) when trying to find IP addresses for hosts, unless the host&#x2019;s
22044 domain matches this list.
22045 </para>
22046 <para>
22047 This is a fudge to help with name servers that give big delays or otherwise do
22048 not work for the AAAA record type. In due course, when the world&#x2019;s name
22049 servers have all been upgraded, there should be no need for this option.
22050 </para>
22051 <para>
22052 <indexterm role="option">
22053 <primary><option>dns_retrans</option></primary>
22054 </indexterm>
22055 </para>
22056 <informaltable frame="all">
22057 <tgroup cols="4" colsep="0" rowsep="0">
22058 <colspec colwidth="8*" align="left"/>
22059 <colspec colwidth="6*" align="center"/>
22060 <colspec colwidth="6*" align="center"/>
22061 <colspec colwidth="6*" align="right"/>
22062 <tbody>
22063 <row>
22064 <entry><option>dns_retrans</option></entry>
22065 <entry>Use: <emphasis>main</emphasis></entry>
22066 <entry>Type: <emphasis>time</emphasis></entry>
22067 <entry>Default: <emphasis>0s</emphasis></entry>
22068 </row>
22069 </tbody>
22070 </tgroup>
22071 </informaltable>
22072 <para>
22073 <indexterm role="concept">
22074 <primary>DNS</primary>
22075 <secondary>resolver options</secondary>
22076 </indexterm>
22077 The options <option>dns_retrans</option> and <option>dns_retry</option> can be used to set the
22078 retransmission and retry parameters for DNS lookups. Values of zero (the
22079 defaults) leave the system default settings unchanged. The first value is the
22080 time between retries, and the second is the number of retries. It isn&#x2019;t
22081 totally clear exactly how these settings affect the total time a DNS lookup may
22082 take. I haven&#x2019;t found any documentation about timeouts on DNS lookups; these
22083 parameter values are available in the external resolver interface structure,
22084 but nowhere does it seem to describe how they are used or what you might want
22085 to set in them.
22086 </para>
22087 <para>
22088 <indexterm role="option">
22089 <primary><option>dns_retry</option></primary>
22090 </indexterm>
22091 </para>
22092 <informaltable frame="all">
22093 <tgroup cols="4" colsep="0" rowsep="0">
22094 <colspec colwidth="8*" align="left"/>
22095 <colspec colwidth="6*" align="center"/>
22096 <colspec colwidth="6*" align="center"/>
22097 <colspec colwidth="6*" align="right"/>
22098 <tbody>
22099 <row>
22100 <entry><option>dns_retry</option></entry>
22101 <entry>Use: <emphasis>main</emphasis></entry>
22102 <entry>Type: <emphasis>integer</emphasis></entry>
22103 <entry>Default: <emphasis>0</emphasis></entry>
22104 </row>
22105 </tbody>
22106 </tgroup>
22107 </informaltable>
22108 <para>
22109 See <option>dns_retrans</option> above.
22110 </para>
22111 <para>
22112 <indexterm role="option">
22113 <primary><option>drop_cr</option></primary>
22114 </indexterm>
22115 </para>
22116 <informaltable frame="all">
22117 <tgroup cols="4" colsep="0" rowsep="0">
22118 <colspec colwidth="8*" align="left"/>
22119 <colspec colwidth="6*" align="center"/>
22120 <colspec colwidth="6*" align="center"/>
22121 <colspec colwidth="6*" align="right"/>
22122 <tbody>
22123 <row>
22124 <entry><option>drop_cr</option></entry>
22125 <entry>Use: <emphasis>main</emphasis></entry>
22126 <entry>Type: <emphasis>boolean</emphasis></entry>
22127 <entry>Default: <emphasis>false</emphasis></entry>
22128 </row>
22129 </tbody>
22130 </tgroup>
22131 </informaltable>
22132 <para>
22133 This is an obsolete option that is now a no-op. It used to affect the way Exim
22134 handled CR and LF characters in incoming messages. What happens now is
22135 described in section <xref linkend="SECTlineendings"/>.
22136 </para>
22137 <para>
22138 <indexterm role="option">
22139 <primary><option>dsn_from</option></primary>
22140 </indexterm>
22141 </para>
22142 <informaltable frame="all">
22143 <tgroup cols="4" colsep="0" rowsep="0">
22144 <colspec colwidth="8*" align="left"/>
22145 <colspec colwidth="6*" align="center"/>
22146 <colspec colwidth="6*" align="center"/>
22147 <colspec colwidth="6*" align="right"/>
22148 <tbody>
22149 <row>
22150 <entry><option>dsn_from</option></entry>
22151 <entry>Use: <emphasis>main</emphasis></entry>
22152 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22153 <entry>Default: <emphasis>see below</emphasis></entry>
22154 </row>
22155 </tbody>
22156 </tgroup>
22157 </informaltable>
22158 <para>
22159 <indexterm role="concept">
22160 <primary><emphasis>From:</emphasis> header line</primary>
22161 <secondary>in bounces</secondary>
22162 </indexterm>
22163 <indexterm role="concept">
22164 <primary>bounce messages</primary>
22165 <secondary><emphasis>From:</emphasis> line, specifying</secondary>
22166 </indexterm>
22167 This option can be used to vary the contents of <emphasis>From:</emphasis> header lines in
22168 bounces and other automatically generated messages (<quote>Delivery Status
22169 Notifications</quote> &ndash; hence the name of the option). The default setting is:
22170 </para>
22171 <literallayout class="monospaced">
22172 dsn_from = Mail Delivery System &lt;Mailer-Daemon@$qualify_domain&gt;
22173 </literallayout>
22174 <para>
22175 The value is expanded every time it is needed. If the expansion fails, a
22176 panic is logged, and the default value is used.
22177 </para>
22178 <para>
22179 <indexterm role="option">
22180 <primary><option>envelope_to_remove</option></primary>
22181 </indexterm>
22182 </para>
22183 <informaltable frame="all">
22184 <tgroup cols="4" colsep="0" rowsep="0">
22185 <colspec colwidth="8*" align="left"/>
22186 <colspec colwidth="6*" align="center"/>
22187 <colspec colwidth="6*" align="center"/>
22188 <colspec colwidth="6*" align="right"/>
22189 <tbody>
22190 <row>
22191 <entry><option>envelope_to_remove</option></entry>
22192 <entry>Use: <emphasis>main</emphasis></entry>
22193 <entry>Type: <emphasis>boolean</emphasis></entry>
22194 <entry>Default: <emphasis>true</emphasis></entry>
22195 </row>
22196 </tbody>
22197 </tgroup>
22198 </informaltable>
22199 <para>
22200 <indexterm role="concept">
22201 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
22202 </indexterm>
22203 Exim&#x2019;s transports have an option for adding an <emphasis>Envelope-to:</emphasis> header to a
22204 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
22205 handled. <emphasis>Envelope-to:</emphasis> records the original recipient address from the
22206 messages&#x2019;s envelope that caused the delivery to happen. Such headers should not
22207 be present in incoming messages, and this option causes them to be removed at
22208 the time the message is received, to avoid any problems that might occur when a
22209 delivered message is subsequently sent on to some other recipient.
22210 </para>
22211 <para>
22212 <indexterm role="option">
22213 <primary><option>errors_copy</option></primary>
22214 </indexterm>
22215 </para>
22216 <informaltable frame="all">
22217 <tgroup cols="4" colsep="0" rowsep="0">
22218 <colspec colwidth="8*" align="left"/>
22219 <colspec colwidth="6*" align="center"/>
22220 <colspec colwidth="6*" align="center"/>
22221 <colspec colwidth="6*" align="right"/>
22222 <tbody>
22223 <row>
22224 <entry><option>errors_copy</option></entry>
22225 <entry>Use: <emphasis>main</emphasis></entry>
22226 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
22227 <entry>Default: <emphasis>unset</emphasis></entry>
22228 </row>
22229 </tbody>
22230 </tgroup>
22231 </informaltable>
22232 <para>
22233 <indexterm role="concept">
22234 <primary>bounce message</primary>
22235 <secondary>copy to other address</secondary>
22236 </indexterm>
22237 <indexterm role="concept">
22238 <primary>copy of bounce message</primary>
22239 </indexterm>
22240 Setting this option causes Exim to send bcc copies of bounce messages that it
22241 generates to other addresses. <emphasis role="bold">Note</emphasis>: This does not apply to bounce messages
22242 coming from elsewhere. The value of the option is a colon-separated list of
22243 items. Each item consists of a pattern, terminated by white space, followed by
22244 a comma-separated list of email addresses. If a pattern contains spaces, it
22245 must be enclosed in double quotes.
22246 </para>
22247 <para>
22248 Each pattern is processed in the same way as a single item in an address list
22249 (see section <xref linkend="SECTaddresslist"/>). When a pattern matches the recipient of
22250 the bounce message, the message is copied to the addresses on the list. The
22251 items are scanned in order, and once a matching one is found, no further items
22252 are examined. For example:
22253 </para>
22254 <literallayout class="monospaced">
22255 errors_copy = spqr@mydomain   postmaster@mydomain.example :\
22256               rqps@mydomain   hostmaster@mydomain.example,\
22257                               postmaster@mydomain.example
22258 </literallayout>
22259 <para>
22260 <indexterm role="variable">
22261 <primary><varname>$domain</varname></primary>
22262 </indexterm>
22263 <indexterm role="variable">
22264 <primary><varname>$local_part</varname></primary>
22265 </indexterm>
22266 The address list is expanded before use. The expansion variables <varname>$local_part</varname>
22267 and <varname>$domain</varname> are set from the original recipient of the error message, and if
22268 there was any wildcard matching in the pattern, the expansion
22269 <indexterm role="concept">
22270 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
22271 <secondary>in <option>errors_copy</option></secondary>
22272 </indexterm>
22273 variables <varname>$0</varname>, <varname>$1</varname>, etc. are set in the normal way.
22274 </para>
22275 <para>
22276 <indexterm role="option">
22277 <primary><option>errors_reply_to</option></primary>
22278 </indexterm>
22279 </para>
22280 <informaltable frame="all">
22281 <tgroup cols="4" colsep="0" rowsep="0">
22282 <colspec colwidth="8*" align="left"/>
22283 <colspec colwidth="6*" align="center"/>
22284 <colspec colwidth="6*" align="center"/>
22285 <colspec colwidth="6*" align="right"/>
22286 <tbody>
22287 <row>
22288 <entry><option>errors_reply_to</option></entry>
22289 <entry>Use: <emphasis>main</emphasis></entry>
22290 <entry>Type: <emphasis>string</emphasis></entry>
22291 <entry>Default: <emphasis>unset</emphasis></entry>
22292 </row>
22293 </tbody>
22294 </tgroup>
22295 </informaltable>
22296 <para>
22297 <indexterm role="concept">
22298 <primary>bounce message</primary>
22299 <secondary><emphasis>Reply-to:</emphasis> in</secondary>
22300 </indexterm>
22301 By default, Exim&#x2019;s bounce and delivery warning messages contain the header line
22302 </para>
22303 <literallayout>
22304 <literal>From: Mail Delivery System &lt;Mailer-Daemon@</literal><emphasis>qualify-domain</emphasis><literal>&gt;</literal>
22305 </literallayout>
22306 <para>
22307 <indexterm role="option">
22308 <primary><option>quota_warn_message</option></primary>
22309 </indexterm>
22310 where <emphasis>qualify-domain</emphasis> is the value of the <option>qualify_domain</option> option.
22311 A warning message that is generated by the <option>quota_warn_message</option> option in an
22312 <command>appendfile</command> transport may contain its own <emphasis>From:</emphasis> header line that
22313 overrides the default.
22314 </para>
22315 <para>
22316 Experience shows that people reply to bounce messages. If the
22317 <option>errors_reply_to</option> option is set, a <emphasis>Reply-To:</emphasis> header is added to bounce
22318 and warning messages. For example:
22319 </para>
22320 <literallayout class="monospaced">
22321 errors_reply_to = postmaster@my.domain.example
22322 </literallayout>
22323 <para>
22324 The value of the option is not expanded. It must specify a valid RFC 2822
22325 address. However, if a warning message that is generated by the
22326 <option>quota_warn_message</option> option in an <command>appendfile</command> transport contain its
22327 own <emphasis>Reply-To:</emphasis> header line, the value of the <option>errors_reply_to</option> option is
22328 not used.
22329 </para>
22330 <para>
22331 <indexterm role="option">
22332 <primary><option>exim_group</option></primary>
22333 </indexterm>
22334 </para>
22335 <informaltable frame="all">
22336 <tgroup cols="4" colsep="0" rowsep="0">
22337 <colspec colwidth="8*" align="left"/>
22338 <colspec colwidth="6*" align="center"/>
22339 <colspec colwidth="6*" align="center"/>
22340 <colspec colwidth="6*" align="right"/>
22341 <tbody>
22342 <row>
22343 <entry><option>exim_group</option></entry>
22344 <entry>Use: <emphasis>main</emphasis></entry>
22345 <entry>Type: <emphasis>string</emphasis></entry>
22346 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
22347 </row>
22348 </tbody>
22349 </tgroup>
22350 </informaltable>
22351 <para>
22352 <indexterm role="concept">
22353 <primary>gid (group id)</primary>
22354 <secondary>Exim&#x2019;s own</secondary>
22355 </indexterm>
22356 <indexterm role="concept">
22357 <primary>Exim group</primary>
22358 </indexterm>
22359 This option changes the gid under which Exim runs when it gives up root
22360 privilege. The default value is compiled into the binary. The value of this
22361 option is used only when <option>exim_user</option> is also set. Unless it consists entirely
22362 of digits, the string is looked up using <function>getgrnam()</function>, and failure causes a
22363 configuration error. See chapter <xref linkend="CHAPsecurity"/> for a discussion of
22364 security issues.
22365 </para>
22366 <para>
22367 <indexterm role="option">
22368 <primary><option>exim_path</option></primary>
22369 </indexterm>
22370 </para>
22371 <informaltable frame="all">
22372 <tgroup cols="4" colsep="0" rowsep="0">
22373 <colspec colwidth="8*" align="left"/>
22374 <colspec colwidth="6*" align="center"/>
22375 <colspec colwidth="6*" align="center"/>
22376 <colspec colwidth="6*" align="right"/>
22377 <tbody>
22378 <row>
22379 <entry><option>exim_path</option></entry>
22380 <entry>Use: <emphasis>main</emphasis></entry>
22381 <entry>Type: <emphasis>string</emphasis></entry>
22382 <entry>Default: <emphasis>see below</emphasis></entry>
22383 </row>
22384 </tbody>
22385 </tgroup>
22386 </informaltable>
22387 <para>
22388 <indexterm role="concept">
22389 <primary>Exim binary, path name</primary>
22390 </indexterm>
22391 This option specifies the path name of the Exim binary, which is used when Exim
22392 needs to re-exec itself. The default is set up to point to the file <emphasis>exim</emphasis> in
22393 the directory configured at compile time by the BIN_DIRECTORY setting. It
22394 is necessary to change <option>exim_path</option> if, exceptionally, Exim is run from some
22395 other place.
22396 <emphasis role="bold">Warning</emphasis>: Do not use a macro to define the value of this option, because
22397 you will break those Exim utilities that scan the configuration file to find
22398 where the binary is. (They then use the <option>-bP</option> option to extract option
22399 settings such as the value of <option>spool_directory</option>.)
22400 </para>
22401 <para>
22402 <indexterm role="option">
22403 <primary><option>exim_user</option></primary>
22404 </indexterm>
22405 </para>
22406 <informaltable frame="all">
22407 <tgroup cols="4" colsep="0" rowsep="0">
22408 <colspec colwidth="8*" align="left"/>
22409 <colspec colwidth="6*" align="center"/>
22410 <colspec colwidth="6*" align="center"/>
22411 <colspec colwidth="6*" align="right"/>
22412 <tbody>
22413 <row>
22414 <entry><option>exim_user</option></entry>
22415 <entry>Use: <emphasis>main</emphasis></entry>
22416 <entry>Type: <emphasis>string</emphasis></entry>
22417 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
22418 </row>
22419 </tbody>
22420 </tgroup>
22421 </informaltable>
22422 <para>
22423 <indexterm role="concept">
22424 <primary>uid (user id)</primary>
22425 <secondary>Exim&#x2019;s own</secondary>
22426 </indexterm>
22427 <indexterm role="concept">
22428 <primary>Exim user</primary>
22429 </indexterm>
22430 This option changes the uid under which Exim runs when it gives up root
22431 privilege. The default value is compiled into the binary. Ownership of the run
22432 time configuration file and the use of the <option>-C</option> and <option>-D</option> command line
22433 options is checked against the values in the binary, not what is set here.
22434 </para>
22435 <para>
22436 Unless it consists entirely of digits, the string is looked up using
22437 <function>getpwnam()</function>, and failure causes a configuration error. If <option>exim_group</option> is
22438 not also supplied, the gid is taken from the result of <function>getpwnam()</function> if it is
22439 used. See chapter <xref linkend="CHAPsecurity"/> for a discussion of security issues.
22440 </para>
22441 <para>
22442 <indexterm role="option">
22443 <primary><option>extra_local_interfaces</option></primary>
22444 </indexterm>
22445 </para>
22446 <informaltable frame="all">
22447 <tgroup cols="4" colsep="0" rowsep="0">
22448 <colspec colwidth="8*" align="left"/>
22449 <colspec colwidth="6*" align="center"/>
22450 <colspec colwidth="6*" align="center"/>
22451 <colspec colwidth="6*" align="right"/>
22452 <tbody>
22453 <row>
22454 <entry><option>extra_local_interfaces</option></entry>
22455 <entry>Use: <emphasis>main</emphasis></entry>
22456 <entry>Type: <emphasis>string list</emphasis></entry>
22457 <entry>Default: <emphasis>unset</emphasis></entry>
22458 </row>
22459 </tbody>
22460 </tgroup>
22461 </informaltable>
22462 <para>
22463 This option defines network interfaces that are to be considered local when
22464 routing, but which are not used for listening by the daemon. See section
22465 <xref linkend="SECTreclocipadd"/> for details.
22466 </para>
22467 <para>
22468 <indexterm role="option">
22469 <primary><option>extract_addresses_remove_arguments</option></primary>
22470 </indexterm>
22471 </para>
22472 <informaltable frame="all">
22473 <tgroup cols="4" colsep="0" rowsep="0">
22474 <colspec colwidth="8*" align="left"/>
22475 <colspec colwidth="6*" align="center"/>
22476 <colspec colwidth="6*" align="center"/>
22477 <colspec colwidth="6*" align="right"/>
22478 <tbody>
22479 <row>
22480 <entry><option>extract_addresses_remove_ &nbsp;&nbsp;arguments</option></entry>
22481 <entry>Use: <emphasis>main</emphasis></entry>
22482 <entry>Type: <emphasis>boolean</emphasis></entry>
22483 <entry>Default: <emphasis>true</emphasis></entry>
22484 </row>
22485 </tbody>
22486 </tgroup>
22487 </informaltable>
22488 <para>
22489 <indexterm role="option">
22490 <primary><option>-t</option></primary>
22491 </indexterm>
22492 <indexterm role="concept">
22493 <primary>command line</primary>
22494 <secondary>addresses with <option>-t</option></secondary>
22495 </indexterm>
22496 <indexterm role="concept">
22497 <primary>Sendmail compatibility</primary>
22498 <secondary><option>-t</option> option</secondary>
22499 </indexterm>
22500 According to some Sendmail documentation (Sun, IRIX, HP-UX), if any addresses
22501 are present on the command line when the <option>-t</option> option is used to build an
22502 envelope from a message&#x2019;s <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis> and <emphasis>Bcc:</emphasis> headers, the command
22503 line addresses are removed from the recipients list. This is also how Smail
22504 behaves. However, other Sendmail documentation (the O&#x2019;Reilly book) states that
22505 command line addresses are added to those obtained from the header lines. When
22506 <option>extract_addresses_remove_arguments</option> is true (the default), Exim subtracts
22507 argument headers. If it is set false, Exim adds rather than removes argument
22508 addresses.
22509 </para>
22510 <para>
22511 <indexterm role="option">
22512 <primary><option>finduser_retries</option></primary>
22513 </indexterm>
22514 </para>
22515 <informaltable frame="all">
22516 <tgroup cols="4" colsep="0" rowsep="0">
22517 <colspec colwidth="8*" align="left"/>
22518 <colspec colwidth="6*" align="center"/>
22519 <colspec colwidth="6*" align="center"/>
22520 <colspec colwidth="6*" align="right"/>
22521 <tbody>
22522 <row>
22523 <entry><option>finduser_retries</option></entry>
22524 <entry>Use: <emphasis>main</emphasis></entry>
22525 <entry>Type: <emphasis>integer</emphasis></entry>
22526 <entry>Default: <emphasis>0</emphasis></entry>
22527 </row>
22528 </tbody>
22529 </tgroup>
22530 </informaltable>
22531 <para>
22532 <indexterm role="concept">
22533 <primary>NIS, retrying user lookups</primary>
22534 </indexterm>
22535 On systems running NIS or other schemes in which user and group information is
22536 distributed from a remote system, there can be times when <function>getpwnam()</function> and
22537 related functions fail, even when given valid data, because things time out.
22538 Unfortunately these failures cannot be distinguished from genuine <quote>not found</quote>
22539 errors. If <option>finduser_retries</option> is set greater than zero, Exim will try that
22540 many extra times to find a user or a group, waiting for one second between
22541 retries.
22542 </para>
22543 <para>
22544 <indexterm role="concept">
22545 <primary><filename>/etc/passwd</filename></primary>
22546 <secondary>multiple reading of</secondary>
22547 </indexterm>
22548 You should not set this option greater than zero if your user information is in
22549 a traditional <filename>/etc/passwd</filename> file, because it will cause Exim needlessly to
22550 search the file multiple times for non-existent users, and also cause delay.
22551 </para>
22552 <para>
22553 <indexterm role="option">
22554 <primary><option>freeze_tell</option></primary>
22555 </indexterm>
22556 </para>
22557 <informaltable frame="all">
22558 <tgroup cols="4" colsep="0" rowsep="0">
22559 <colspec colwidth="8*" align="left"/>
22560 <colspec colwidth="6*" align="center"/>
22561 <colspec colwidth="6*" align="center"/>
22562 <colspec colwidth="6*" align="right"/>
22563 <tbody>
22564 <row>
22565 <entry><option>freeze_tell</option></entry>
22566 <entry>Use: <emphasis>main</emphasis></entry>
22567 <entry>Type: <emphasis>string list, comma separated</emphasis></entry>
22568 <entry>Default: <emphasis>unset</emphasis></entry>
22569 </row>
22570 </tbody>
22571 </tgroup>
22572 </informaltable>
22573 <para>
22574 <indexterm role="concept">
22575 <primary>freezing messages</primary>
22576 <secondary>sending a message when freezing</secondary>
22577 </indexterm>
22578 On encountering certain errors, or when configured to do so in a system filter,
22579 ACL, or special router, Exim freezes a message. This means that no further
22580 delivery attempts take place until an administrator thaws the message, or the
22581 <option>auto_thaw</option>, <option>ignore_bounce_errors_after</option>, or <option>timeout_frozen_after</option>
22582 feature cause it to be processed. If <option>freeze_tell</option> is set, Exim generates a
22583 warning message whenever it freezes something, unless the message it is
22584 freezing is a locally-generated bounce message. (Without this exception there
22585 is the possibility of looping.) The warning message is sent to the addresses
22586 supplied as the comma-separated value of this option. If several of the
22587 message&#x2019;s addresses cause freezing, only a single message is sent. If the
22588 freezing was automatic, the reason(s) for freezing can be found in the message
22589 log. If you configure freezing in a filter or ACL, you must arrange for any
22590 logging that you require.
22591 </para>
22592 <para>
22593 <indexterm role="option">
22594 <primary><option>gecos_name</option></primary>
22595 </indexterm>
22596 </para>
22597 <informaltable frame="all">
22598 <tgroup cols="4" colsep="0" rowsep="0">
22599 <colspec colwidth="8*" align="left"/>
22600 <colspec colwidth="6*" align="center"/>
22601 <colspec colwidth="6*" align="center"/>
22602 <colspec colwidth="6*" align="right"/>
22603 <tbody>
22604 <row>
22605 <entry><option>gecos_name</option></entry>
22606 <entry>Use: <emphasis>main</emphasis></entry>
22607 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22608 <entry>Default: <emphasis>unset</emphasis></entry>
22609 </row>
22610 </tbody>
22611 </tgroup>
22612 </informaltable>
22613 <para>
22614 <indexterm role="concept">
22615 <primary>HP-UX</primary>
22616 </indexterm>
22617 <indexterm role="concept">
22618 <primary><quote>gecos</quote> field, parsing</primary>
22619 </indexterm>
22620 Some operating systems, notably HP-UX, use the <quote>gecos</quote> field in the system
22621 password file to hold other information in addition to users&#x2019; real names. Exim
22622 looks up this field for use when it is creating <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis>
22623 headers. If either <option>gecos_pattern</option> or <option>gecos_name</option> are unset, the contents
22624 of the field are used unchanged, except that, if an ampersand is encountered,
22625 it is replaced by the user&#x2019;s login name with the first character forced to
22626 upper case, since this is a convention that is observed on many systems.
22627 </para>
22628 <para>
22629 When these options are set, <option>gecos_pattern</option> is treated as a regular
22630 expression that is to be applied to the field (again with &amp; replaced by the
22631 login name), and if it matches, <option>gecos_name</option> is expanded and used as the
22632 user&#x2019;s name.
22633 </para>
22634 <para>
22635 <indexterm role="concept">
22636 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
22637 <secondary>in <option>gecos_name</option></secondary>
22638 </indexterm>
22639 Numeric variables such as <varname>$1</varname>, <varname>$2</varname>, etc. can be used in the expansion to
22640 pick up sub-fields that were matched by the pattern. In HP-UX, where the user&#x2019;s
22641 name terminates at the first comma, the following can be used:
22642 </para>
22643 <literallayout class="monospaced">
22644 gecos_pattern = ([^,]*)
22645 gecos_name = $1
22646 </literallayout>
22647 <para>
22648 <indexterm role="option">
22649 <primary><option>gecos_pattern</option></primary>
22650 </indexterm>
22651 </para>
22652 <informaltable frame="all">
22653 <tgroup cols="4" colsep="0" rowsep="0">
22654 <colspec colwidth="8*" align="left"/>
22655 <colspec colwidth="6*" align="center"/>
22656 <colspec colwidth="6*" align="center"/>
22657 <colspec colwidth="6*" align="right"/>
22658 <tbody>
22659 <row>
22660 <entry><option>gecos_pattern</option></entry>
22661 <entry>Use: <emphasis>main</emphasis></entry>
22662 <entry>Type: <emphasis>string</emphasis></entry>
22663 <entry>Default: <emphasis>unset</emphasis></entry>
22664 </row>
22665 </tbody>
22666 </tgroup>
22667 </informaltable>
22668 <para>
22669 See <option>gecos_name</option> above.
22670 </para>
22671 <para>
22672 <indexterm role="option">
22673 <primary><option>gnutls_require_kx</option></primary>
22674 </indexterm>
22675 </para>
22676 <informaltable frame="all">
22677 <tgroup cols="4" colsep="0" rowsep="0">
22678 <colspec colwidth="8*" align="left"/>
22679 <colspec colwidth="6*" align="center"/>
22680 <colspec colwidth="6*" align="center"/>
22681 <colspec colwidth="6*" align="right"/>
22682 <tbody>
22683 <row>
22684 <entry><option>gnutls_require_kx</option></entry>
22685 <entry>Use: <emphasis>main</emphasis></entry>
22686 <entry>Type: <emphasis>string</emphasis></entry>
22687 <entry>Default: <emphasis>unset</emphasis></entry>
22688 </row>
22689 </tbody>
22690 </tgroup>
22691 </informaltable>
22692 <para>
22693 This option controls the key exchange mechanisms when GnuTLS is used in an Exim
22694 server. For details, see section <xref linkend="SECTreqciphgnu"/>.
22695 </para>
22696 <para>
22697 <indexterm role="option">
22698 <primary><option>gnutls_require_mac</option></primary>
22699 </indexterm>
22700 </para>
22701 <informaltable frame="all">
22702 <tgroup cols="4" colsep="0" rowsep="0">
22703 <colspec colwidth="8*" align="left"/>
22704 <colspec colwidth="6*" align="center"/>
22705 <colspec colwidth="6*" align="center"/>
22706 <colspec colwidth="6*" align="right"/>
22707 <tbody>
22708 <row>
22709 <entry><option>gnutls_require_mac</option></entry>
22710 <entry>Use: <emphasis>main</emphasis></entry>
22711 <entry>Type: <emphasis>string</emphasis></entry>
22712 <entry>Default: <emphasis>unset</emphasis></entry>
22713 </row>
22714 </tbody>
22715 </tgroup>
22716 </informaltable>
22717 <para>
22718 This option controls the MAC algorithms when GnuTLS is used in an Exim
22719 server. For details, see section <xref linkend="SECTreqciphgnu"/>.
22720 </para>
22721 <para>
22722 <indexterm role="option">
22723 <primary><option>gnutls_require_protocols</option></primary>
22724 </indexterm>
22725 </para>
22726 <informaltable frame="all">
22727 <tgroup cols="4" colsep="0" rowsep="0">
22728 <colspec colwidth="8*" align="left"/>
22729 <colspec colwidth="6*" align="center"/>
22730 <colspec colwidth="6*" align="center"/>
22731 <colspec colwidth="6*" align="right"/>
22732 <tbody>
22733 <row>
22734 <entry><option>gnutls_require_protocols</option></entry>
22735 <entry>Use: <emphasis>main</emphasis></entry>
22736 <entry>Type: <emphasis>string</emphasis></entry>
22737 <entry>Default: <emphasis>unset</emphasis></entry>
22738 </row>
22739 </tbody>
22740 </tgroup>
22741 </informaltable>
22742 <para>
22743 This option controls the protocols when GnuTLS is used in an Exim
22744 server. For details, see section <xref linkend="SECTreqciphgnu"/>.
22745 </para>
22746 <para>
22747 <indexterm role="option">
22748 <primary><option>gnutls_compat_mode</option></primary>
22749 </indexterm>
22750 </para>
22751 <informaltable frame="all">
22752 <tgroup cols="4" colsep="0" rowsep="0">
22753 <colspec colwidth="8*" align="left"/>
22754 <colspec colwidth="6*" align="center"/>
22755 <colspec colwidth="6*" align="center"/>
22756 <colspec colwidth="6*" align="right"/>
22757 <tbody>
22758 <row>
22759 <entry><option>gnutls_compat_mode</option></entry>
22760 <entry>Use: <emphasis>main</emphasis></entry>
22761 <entry>Type: <emphasis>boolean</emphasis></entry>
22762 <entry>Default: <emphasis>unset</emphasis></entry>
22763 </row>
22764 </tbody>
22765 </tgroup>
22766 </informaltable>
22767 <para>
22768 This option controls whether GnuTLS is used in compatibility mode in an Exim
22769 server. This reduces security slightly, but improves interworking with older
22770 implementations of TLS.
22771 </para>
22772 <para>
22773 <indexterm role="option">
22774 <primary><option>headers_charset</option></primary>
22775 </indexterm>
22776 </para>
22777 <informaltable frame="all">
22778 <tgroup cols="4" colsep="0" rowsep="0">
22779 <colspec colwidth="8*" align="left"/>
22780 <colspec colwidth="6*" align="center"/>
22781 <colspec colwidth="6*" align="center"/>
22782 <colspec colwidth="6*" align="right"/>
22783 <tbody>
22784 <row>
22785 <entry><option>headers_charset</option></entry>
22786 <entry>Use: <emphasis>main</emphasis></entry>
22787 <entry>Type: <emphasis>string</emphasis></entry>
22788 <entry>Default: <emphasis>see below</emphasis></entry>
22789 </row>
22790 </tbody>
22791 </tgroup>
22792 </informaltable>
22793 <para>
22794 This option sets a default character set for translating from encoded MIME
22795 <quote>words</quote> in header lines, when referenced by an <varname>$h_xxx</varname> expansion item. The
22796 default is the value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The
22797 ultimate default is ISO-8859-1. For more details see the description of header
22798 insertions in section <xref linkend="SECTexpansionitems"/>.
22799 </para>
22800 <para>
22801 <indexterm role="option">
22802 <primary><option>header_maxsize</option></primary>
22803 </indexterm>
22804 </para>
22805 <informaltable frame="all">
22806 <tgroup cols="4" colsep="0" rowsep="0">
22807 <colspec colwidth="8*" align="left"/>
22808 <colspec colwidth="6*" align="center"/>
22809 <colspec colwidth="6*" align="center"/>
22810 <colspec colwidth="6*" align="right"/>
22811 <tbody>
22812 <row>
22813 <entry><option>header_maxsize</option></entry>
22814 <entry>Use: <emphasis>main</emphasis></entry>
22815 <entry>Type: <emphasis>integer</emphasis></entry>
22816 <entry>Default: <emphasis>see below</emphasis></entry>
22817 </row>
22818 </tbody>
22819 </tgroup>
22820 </informaltable>
22821 <para>
22822 <indexterm role="concept">
22823 <primary>header section</primary>
22824 <secondary>maximum size of</secondary>
22825 </indexterm>
22826 <indexterm role="concept">
22827 <primary>limit</primary>
22828 <secondary>size of message header section</secondary>
22829 </indexterm>
22830 This option controls the overall maximum size of a message&#x2019;s header
22831 section. The default is the value of HEADER_MAXSIZE in
22832 <filename>Local/Makefile</filename>; the default for that is 1M. Messages with larger header
22833 sections are rejected.
22834 </para>
22835 <para>
22836 <indexterm role="option">
22837 <primary><option>header_line_maxsize</option></primary>
22838 </indexterm>
22839 </para>
22840 <informaltable frame="all">
22841 <tgroup cols="4" colsep="0" rowsep="0">
22842 <colspec colwidth="8*" align="left"/>
22843 <colspec colwidth="6*" align="center"/>
22844 <colspec colwidth="6*" align="center"/>
22845 <colspec colwidth="6*" align="right"/>
22846 <tbody>
22847 <row>
22848 <entry><option>header_line_maxsize</option></entry>
22849 <entry>Use: <emphasis>main</emphasis></entry>
22850 <entry>Type: <emphasis>integer</emphasis></entry>
22851 <entry>Default: <emphasis>0</emphasis></entry>
22852 </row>
22853 </tbody>
22854 </tgroup>
22855 </informaltable>
22856 <para>
22857 <indexterm role="concept">
22858 <primary>header lines</primary>
22859 <secondary>maximum size of</secondary>
22860 </indexterm>
22861 <indexterm role="concept">
22862 <primary>limit</primary>
22863 <secondary>size of one header line</secondary>
22864 </indexterm>
22865 This option limits the length of any individual header line in a message, after
22866 all the continuations have been joined together. Messages with individual
22867 header lines that are longer than the limit are rejected. The default value of
22868 zero means <quote>no limit</quote>.
22869 </para>
22870 <para>
22871 <indexterm role="option">
22872 <primary><option>helo_accept_junk_hosts</option></primary>
22873 </indexterm>
22874 </para>
22875 <informaltable frame="all">
22876 <tgroup cols="4" colsep="0" rowsep="0">
22877 <colspec colwidth="8*" align="left"/>
22878 <colspec colwidth="6*" align="center"/>
22879 <colspec colwidth="6*" align="center"/>
22880 <colspec colwidth="6*" align="right"/>
22881 <tbody>
22882 <row>
22883 <entry><option>helo_accept_junk_hosts</option></entry>
22884 <entry>Use: <emphasis>main</emphasis></entry>
22885 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
22886 <entry>Default: <emphasis>unset</emphasis></entry>
22887 </row>
22888 </tbody>
22889 </tgroup>
22890 </informaltable>
22891 <para>
22892 <indexterm role="concept">
22893 <primary>HELO</primary>
22894 <secondary>accepting junk data</secondary>
22895 </indexterm>
22896 <indexterm role="concept">
22897 <primary>EHLO</primary>
22898 <secondary>accepting junk data</secondary>
22899 </indexterm>
22900 Exim checks the syntax of HELO and EHLO commands for incoming SMTP
22901 mail, and gives an error response for invalid data. Unfortunately, there are
22902 some SMTP clients that send syntactic junk. They can be accommodated by setting
22903 this option. Note that this is a syntax check only. See <option>helo_verify_hosts</option>
22904 if you want to do semantic checking.
22905 See also <option>helo_allow_chars</option> for a way of extending the permitted character
22906 set.
22907 </para>
22908 <para>
22909 <indexterm role="option">
22910 <primary><option>helo_allow_chars</option></primary>
22911 </indexterm>
22912 </para>
22913 <informaltable frame="all">
22914 <tgroup cols="4" colsep="0" rowsep="0">
22915 <colspec colwidth="8*" align="left"/>
22916 <colspec colwidth="6*" align="center"/>
22917 <colspec colwidth="6*" align="center"/>
22918 <colspec colwidth="6*" align="right"/>
22919 <tbody>
22920 <row>
22921 <entry><option>helo_allow_chars</option></entry>
22922 <entry>Use: <emphasis>main</emphasis></entry>
22923 <entry>Type: <emphasis>string</emphasis></entry>
22924 <entry>Default: <emphasis>unset</emphasis></entry>
22925 </row>
22926 </tbody>
22927 </tgroup>
22928 </informaltable>
22929 <para>
22930 <indexterm role="concept">
22931 <primary>HELO</primary>
22932 <secondary>underscores in</secondary>
22933 </indexterm>
22934 <indexterm role="concept">
22935 <primary>EHLO</primary>
22936 <secondary>underscores in</secondary>
22937 </indexterm>
22938 <indexterm role="concept">
22939 <primary>underscore in EHLO/HELO</primary>
22940 </indexterm>
22941 This option can be set to a string of rogue characters that are permitted in
22942 all EHLO and HELO names in addition to the standard letters, digits,
22943 hyphens, and dots. If you really must allow underscores, you can set
22944 </para>
22945 <literallayout class="monospaced">
22946 helo_allow_chars = _
22947 </literallayout>
22948 <para>
22949 Note that the value is one string, not a list.
22950 </para>
22951 <para>
22952 <indexterm role="option">
22953 <primary><option>helo_lookup_domains</option></primary>
22954 </indexterm>
22955 </para>
22956 <informaltable frame="all">
22957 <tgroup cols="4" colsep="0" rowsep="0">
22958 <colspec colwidth="8*" align="left"/>
22959 <colspec colwidth="6*" align="center"/>
22960 <colspec colwidth="6*" align="center"/>
22961 <colspec colwidth="6*" align="right"/>
22962 <tbody>
22963 <row>
22964 <entry><option>helo_lookup_domains</option></entry>
22965 <entry>Use: <emphasis>main</emphasis></entry>
22966 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
22967 <entry>Default: <emphasis><literal>@:@[]</literal></emphasis></entry>
22968 </row>
22969 </tbody>
22970 </tgroup>
22971 </informaltable>
22972 <para>
22973 <indexterm role="concept">
22974 <primary>HELO</primary>
22975 <secondary>forcing reverse lookup</secondary>
22976 </indexterm>
22977 <indexterm role="concept">
22978 <primary>EHLO</primary>
22979 <secondary>forcing reverse lookup</secondary>
22980 </indexterm>
22981 If the domain given by a client in a HELO or EHLO command matches this
22982 list, a reverse lookup is done in order to establish the host&#x2019;s true name. The
22983 default forces a lookup if the client host gives the server&#x2019;s name or any of
22984 its IP addresses (in brackets), something that broken clients have been seen to
22985 do.
22986 </para>
22987 <para>
22988 <indexterm role="option">
22989 <primary><option>helo_try_verify_hosts</option></primary>
22990 </indexterm>
22991 </para>
22992 <informaltable frame="all">
22993 <tgroup cols="4" colsep="0" rowsep="0">
22994 <colspec colwidth="8*" align="left"/>
22995 <colspec colwidth="6*" align="center"/>
22996 <colspec colwidth="6*" align="center"/>
22997 <colspec colwidth="6*" align="right"/>
22998 <tbody>
22999 <row>
23000 <entry><option>helo_try_verify_hosts</option></entry>
23001 <entry>Use: <emphasis>main</emphasis></entry>
23002 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
23003 <entry>Default: <emphasis>unset</emphasis></entry>
23004 </row>
23005 </tbody>
23006 </tgroup>
23007 </informaltable>
23008 <para>
23009 <indexterm role="concept">
23010 <primary>HELO verifying</primary>
23011 <secondary>optional</secondary>
23012 </indexterm>
23013 <indexterm role="concept">
23014 <primary>EHLO</primary>
23015 <secondary>verifying, optional</secondary>
23016 </indexterm>
23017 By default, Exim just checks the syntax of HELO and EHLO commands (see
23018 <option>helo_accept_junk_hosts</option> and <option>helo_allow_chars</option>). However, some sites like
23019 to do more extensive checking of the data supplied by these commands. The ACL
23020 condition <literal>verify = helo</literal> is provided to make this possible.
23021 Formerly, it was necessary also to set this option (<option>helo_try_verify_hosts</option>)
23022 to force the check to occur. From release 4.53 onwards, this is no longer
23023 necessary. If the check has not been done before <literal>verify = helo</literal> is
23024 encountered, it is done at that time. Consequently, this option is obsolete.
23025 Its specification is retained here for backwards compatibility.
23026 </para>
23027 <para>
23028 When an EHLO or HELO command is received, if the calling host matches
23029 <option>helo_try_verify_hosts</option>, Exim checks that the host name given in the HELO or
23030 EHLO command either:
23031 </para>
23032 <itemizedlist>
23033 <listitem>
23034 <para>
23035 is an IP literal matching the calling address of the host, or
23036 </para>
23037 </listitem>
23038 <listitem>
23039 <para>
23040 <indexterm role="concept">
23041 <primary>DNS</primary>
23042 <secondary>reverse lookup</secondary>
23043 </indexterm>
23044 <indexterm role="concept">
23045 <primary>reverse DNS lookup</primary>
23046 </indexterm>
23047 matches the host name that Exim obtains by doing a reverse lookup of the
23048 calling host address, or
23049 </para>
23050 </listitem>
23051 <listitem>
23052 <para>
23053 when looked up using <function>gethostbyname()</function> (or <function>getipnodebyname()</function> when
23054 available) yields the calling host address.
23055 </para>
23056 </listitem>
23057 </itemizedlist>
23058 <para>
23059 However, the EHLO or HELO command is not rejected if any of the checks
23060 fail. Processing continues, but the result of the check is remembered, and can
23061 be detected later in an ACL by the <literal>verify = helo</literal> condition.
23062 </para>
23063 <para>
23064 <indexterm role="option">
23065 <primary><option>helo_verify_hosts</option></primary>
23066 </indexterm>
23067 </para>
23068 <informaltable frame="all">
23069 <tgroup cols="4" colsep="0" rowsep="0">
23070 <colspec colwidth="8*" align="left"/>
23071 <colspec colwidth="6*" align="center"/>
23072 <colspec colwidth="6*" align="center"/>
23073 <colspec colwidth="6*" align="right"/>
23074 <tbody>
23075 <row>
23076 <entry><option>helo_verify_hosts</option></entry>
23077 <entry>Use: <emphasis>main</emphasis></entry>
23078 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
23079 <entry>Default: <emphasis>unset</emphasis></entry>
23080 </row>
23081 </tbody>
23082 </tgroup>
23083 </informaltable>
23084 <para>
23085 <indexterm role="concept">
23086 <primary>HELO verifying</primary>
23087 <secondary>mandatory</secondary>
23088 </indexterm>
23089 <indexterm role="concept">
23090 <primary>EHLO</primary>
23091 <secondary>verifying, mandatory</secondary>
23092 </indexterm>
23093 Like <option>helo_try_verify_hosts</option>, this option is obsolete, and retained only for
23094 backwards compatibility. For hosts that match this option, Exim checks the host
23095 name given in the HELO or EHLO in the same way as for
23096 <option>helo_try_verify_hosts</option>. If the check fails, the HELO or EHLO command is
23097 rejected with a 550 error, and entries are written to the main and reject logs.
23098 If a MAIL command is received before EHLO or HELO, it is rejected with a 503
23099 error.
23100 </para>
23101 <para>
23102 <indexterm role="option">
23103 <primary><option>hold_domains</option></primary>
23104 </indexterm>
23105 </para>
23106 <informaltable frame="all">
23107 <tgroup cols="4" colsep="0" rowsep="0">
23108 <colspec colwidth="8*" align="left"/>
23109 <colspec colwidth="6*" align="center"/>
23110 <colspec colwidth="6*" align="center"/>
23111 <colspec colwidth="6*" align="right"/>
23112 <tbody>
23113 <row>
23114 <entry><option>hold_domains</option></entry>
23115 <entry>Use: <emphasis>main</emphasis></entry>
23116 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
23117 <entry>Default: <emphasis>unset</emphasis></entry>
23118 </row>
23119 </tbody>
23120 </tgroup>
23121 </informaltable>
23122 <para>
23123 <indexterm role="concept">
23124 <primary>domain</primary>
23125 <secondary>delaying delivery</secondary>
23126 </indexterm>
23127 <indexterm role="concept">
23128 <primary>delivery</primary>
23129 <secondary>delaying certain domains</secondary>
23130 </indexterm>
23131 This option allows mail for particular domains to be held on the queue
23132 manually. The option is overridden if a message delivery is forced with the
23133 <option>-M</option>, <option>-qf</option>, <option>-Rf</option> or <option>-Sf</option> options, and also while testing or
23134 verifying addresses using <option>-bt</option> or <option>-bv</option>. Otherwise, if a domain matches an
23135 item in <option>hold_domains</option>, no routing or delivery for that address is done, and
23136 it is deferred every time the message is looked at.
23137 </para>
23138 <para>
23139 This option is intended as a temporary operational measure for delaying the
23140 delivery of mail while some problem is being sorted out, or some new
23141 configuration tested. If you just want to delay the processing of some
23142 domains until a queue run occurs, you should use <option>queue_domains</option> or
23143 <option>queue_smtp_domains</option>, not <option>hold_domains</option>.
23144 </para>
23145 <para>
23146 A setting of <option>hold_domains</option> does not override Exim&#x2019;s code for removing
23147 messages from the queue if they have been there longer than the longest retry
23148 time in any retry rule. If you want to hold messages for longer than the normal
23149 retry times, insert a dummy retry rule with a long retry time.
23150 </para>
23151 <para>
23152 <indexterm role="option">
23153 <primary><option>host_lookup</option></primary>
23154 </indexterm>
23155 </para>
23156 <informaltable frame="all">
23157 <tgroup cols="4" colsep="0" rowsep="0">
23158 <colspec colwidth="8*" align="left"/>
23159 <colspec colwidth="6*" align="center"/>
23160 <colspec colwidth="6*" align="center"/>
23161 <colspec colwidth="6*" align="right"/>
23162 <tbody>
23163 <row>
23164 <entry><option>host_lookup</option></entry>
23165 <entry>Use: <emphasis>main</emphasis></entry>
23166 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
23167 <entry>Default: <emphasis>unset</emphasis></entry>
23168 </row>
23169 </tbody>
23170 </tgroup>
23171 </informaltable>
23172 <para>
23173 <indexterm role="concept">
23174 <primary>host name</primary>
23175 <secondary>lookup, forcing</secondary>
23176 </indexterm>
23177 Exim does not look up the name of a calling host from its IP address unless it
23178 is required to compare against some host list, or the host matches
23179 <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>, or the host matches this
23180 option (which normally contains IP addresses rather than host names). The
23181 default configuration file contains
23182 </para>
23183 <literallayout class="monospaced">
23184 host_lookup = *
23185 </literallayout>
23186 <para>
23187 which causes a lookup to happen for all hosts. If the expense of these lookups
23188 is felt to be too great, the setting can be changed or removed.
23189 </para>
23190 <para>
23191 After a successful reverse lookup, Exim does a forward lookup on the name it
23192 has obtained, to verify that it yields the IP address that it started with. If
23193 this check fails, Exim behaves as if the name lookup failed.
23194 </para>
23195 <para>
23196 <indexterm role="variable">
23197 <primary><varname>$host_lookup_failed</varname></primary>
23198 </indexterm>
23199 <indexterm role="variable">
23200 <primary><varname>$sender_host_name</varname></primary>
23201 </indexterm>
23202 After any kind of failure, the host name (in <varname>$sender_host_name</varname>) remains
23203 unset, and <varname>$host_lookup_failed</varname> is set to the string <quote>1</quote>. See also
23204 <option>dns_again_means_nonexist</option>, <option>helo_lookup_domains</option>, and
23205 <literal>verify = reverse_host_lookup</literal> in ACLs.
23206 </para>
23207 <para>
23208 <indexterm role="option">
23209 <primary><option>host_lookup_order</option></primary>
23210 </indexterm>
23211 </para>
23212 <informaltable frame="all">
23213 <tgroup cols="4" colsep="0" rowsep="0">
23214 <colspec colwidth="8*" align="left"/>
23215 <colspec colwidth="6*" align="center"/>
23216 <colspec colwidth="6*" align="center"/>
23217 <colspec colwidth="6*" align="right"/>
23218 <tbody>
23219 <row>
23220 <entry><option>host_lookup_order</option></entry>
23221 <entry>Use: <emphasis>main</emphasis></entry>
23222 <entry>Type: <emphasis>string list</emphasis></entry>
23223 <entry>Default: <emphasis><literal>bydns:byaddr</literal></emphasis></entry>
23224 </row>
23225 </tbody>
23226 </tgroup>
23227 </informaltable>
23228 <para>
23229 This option specifies the order of different lookup methods when Exim is trying
23230 to find a host name from an IP address. The default is to do a DNS lookup
23231 first, and then to try a local lookup (using <function>gethostbyaddr()</function> or equivalent)
23232 if that fails. You can change the order of these lookups, or omit one entirely,
23233 if you want.
23234 </para>
23235 <para>
23236 <emphasis role="bold">Warning</emphasis>: The <quote>byaddr</quote> method does not always yield aliases when there are
23237 multiple PTR records in the DNS and the IP address is not listed in
23238 <filename>/etc/hosts</filename>. Different operating systems give different results in this
23239 case. That is why the default tries a DNS lookup first.
23240 </para>
23241 <para>
23242 <indexterm role="option">
23243 <primary><option>host_reject_connection</option></primary>
23244 </indexterm>
23245 </para>
23246 <informaltable frame="all">
23247 <tgroup cols="4" colsep="0" rowsep="0">
23248 <colspec colwidth="8*" align="left"/>
23249 <colspec colwidth="6*" align="center"/>
23250 <colspec colwidth="6*" align="center"/>
23251 <colspec colwidth="6*" align="right"/>
23252 <tbody>
23253 <row>
23254 <entry><option>host_reject_connection</option></entry>
23255 <entry>Use: <emphasis>main</emphasis></entry>
23256 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
23257 <entry>Default: <emphasis>unset</emphasis></entry>
23258 </row>
23259 </tbody>
23260 </tgroup>
23261 </informaltable>
23262 <para>
23263 <indexterm role="concept">
23264 <primary>host</primary>
23265 <secondary>rejecting connections from</secondary>
23266 </indexterm>
23267 If this option is set, incoming SMTP calls from the hosts listed are rejected
23268 as soon as the connection is made.
23269 This option is obsolete, and retained only for backward compatibility, because
23270 nowadays the ACL specified by <option>acl_smtp_connect</option> can also reject incoming
23271 connections immediately.
23272 </para>
23273 <para>
23274 The ability to give an immediate rejection (either by this option or using an
23275 ACL) is provided for use in unusual cases. Many hosts will just try again,
23276 sometimes without much delay. Normally, it is better to use an ACL to reject
23277 incoming messages at a later stage, such as after RCPT commands. See
23278 chapter <xref linkend="CHAPACL"/>.
23279 </para>
23280 <para>
23281 <indexterm role="option">
23282 <primary><option>hosts_connection_nolog</option></primary>
23283 </indexterm>
23284 </para>
23285 <informaltable frame="all">
23286 <tgroup cols="4" colsep="0" rowsep="0">
23287 <colspec colwidth="8*" align="left"/>
23288 <colspec colwidth="6*" align="center"/>
23289 <colspec colwidth="6*" align="center"/>
23290 <colspec colwidth="6*" align="right"/>
23291 <tbody>
23292 <row>
23293 <entry><option>hosts_connection_nolog</option></entry>
23294 <entry>Use: <emphasis>main</emphasis></entry>
23295 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
23296 <entry>Default: <emphasis>unset</emphasis></entry>
23297 </row>
23298 </tbody>
23299 </tgroup>
23300 </informaltable>
23301 <para>
23302 <indexterm role="concept">
23303 <primary>host</primary>
23304 <secondary>not logging connections from</secondary>
23305 </indexterm>
23306 This option defines a list of hosts for which connection logging does not
23307 happen, even though the <option>smtp_connection</option> log selector is set. For example,
23308 you might want not to log SMTP connections from local processes, or from
23309 127.0.0.1, or from your local LAN. This option is consulted in the main loop of
23310 the daemon; you should therefore strive to restrict its value to a short inline
23311 list of IP addresses and networks. To disable logging SMTP connections from
23312 local processes, you must create a host list with an empty item. For example:
23313 </para>
23314 <literallayout class="monospaced">
23315 hosts_connection_nolog = :
23316 </literallayout>
23317 <para>
23318 If the <option>smtp_connection</option> log selector is not set, this option has no effect.
23319 </para>
23320 <para>
23321 <indexterm role="option">
23322 <primary><option>hosts_treat_as_local</option></primary>
23323 </indexterm>
23324 </para>
23325 <informaltable frame="all">
23326 <tgroup cols="4" colsep="0" rowsep="0">
23327 <colspec colwidth="8*" align="left"/>
23328 <colspec colwidth="6*" align="center"/>
23329 <colspec colwidth="6*" align="center"/>
23330 <colspec colwidth="6*" align="right"/>
23331 <tbody>
23332 <row>
23333 <entry><option>hosts_treat_as_local</option></entry>
23334 <entry>Use: <emphasis>main</emphasis></entry>
23335 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
23336 <entry>Default: <emphasis>unset</emphasis></entry>
23337 </row>
23338 </tbody>
23339 </tgroup>
23340 </informaltable>
23341 <para>
23342 <indexterm role="concept">
23343 <primary>local host</primary>
23344 <secondary>domains treated as</secondary>
23345 </indexterm>
23346 <indexterm role="concept">
23347 <primary>host</primary>
23348 <secondary>treated as local</secondary>
23349 </indexterm>
23350 If this option is set, any host names that match the domain list are treated as
23351 if they were the local host when Exim is scanning host lists obtained from MX
23352 records
23353 or other sources. Note that the value of this option is a domain list, not a
23354 host list, because it is always used to check host names, not IP addresses.
23355 </para>
23356 <para>
23357 This option also applies when Exim is matching the special items
23358 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal> in a domain list (see
23359 section <xref linkend="SECTdomainlist"/>), and when checking the <option>hosts</option> option in the
23360 <command>smtp</command> transport for the local host (see the <option>allow_localhost</option> option in
23361 that transport). See also <option>local_interfaces</option>, <option>extra_local_interfaces</option>, and
23362 chapter <xref linkend="CHAPinterfaces"/>, which contains a discussion about local network
23363 interfaces and recognizing the local host.
23364 </para>
23365 <para>
23366 <indexterm role="option">
23367 <primary><option>ibase_servers</option></primary>
23368 </indexterm>
23369 </para>
23370 <informaltable frame="all">
23371 <tgroup cols="4" colsep="0" rowsep="0">
23372 <colspec colwidth="8*" align="left"/>
23373 <colspec colwidth="6*" align="center"/>
23374 <colspec colwidth="6*" align="center"/>
23375 <colspec colwidth="6*" align="right"/>
23376 <tbody>
23377 <row>
23378 <entry><option>ibase_servers</option></entry>
23379 <entry>Use: <emphasis>main</emphasis></entry>
23380 <entry>Type: <emphasis>string list</emphasis></entry>
23381 <entry>Default: <emphasis>unset</emphasis></entry>
23382 </row>
23383 </tbody>
23384 </tgroup>
23385 </informaltable>
23386 <para>
23387 <indexterm role="concept">
23388 <primary>InterBase</primary>
23389 <secondary>server list</secondary>
23390 </indexterm>
23391 This option provides a list of InterBase servers and associated connection data,
23392 to be used in conjunction with <command>ibase</command> lookups (see section <xref linkend="SECID72"/>).
23393 The option is available only if Exim has been built with InterBase support.
23394 </para>
23395 <para>
23396 <indexterm role="option">
23397 <primary><option>ignore_bounce_errors_after</option></primary>
23398 </indexterm>
23399 </para>
23400 <informaltable frame="all">
23401 <tgroup cols="4" colsep="0" rowsep="0">
23402 <colspec colwidth="8*" align="left"/>
23403 <colspec colwidth="6*" align="center"/>
23404 <colspec colwidth="6*" align="center"/>
23405 <colspec colwidth="6*" align="right"/>
23406 <tbody>
23407 <row>
23408 <entry><option>ignore_bounce_errors_after</option></entry>
23409 <entry>Use: <emphasis>main</emphasis></entry>
23410 <entry>Type: <emphasis>time</emphasis></entry>
23411 <entry>Default: <emphasis>10w</emphasis></entry>
23412 </row>
23413 </tbody>
23414 </tgroup>
23415 </informaltable>
23416 <para>
23417 <indexterm role="concept">
23418 <primary>bounce message</primary>
23419 <secondary>discarding</secondary>
23420 </indexterm>
23421 <indexterm role="concept">
23422 <primary>discarding bounce message</primary>
23423 </indexterm>
23424 This option affects the processing of bounce messages that cannot be delivered,
23425 that is, those that suffer a permanent delivery failure. (Bounce messages that
23426 suffer temporary delivery failures are of course retried in the usual way.)
23427 </para>
23428 <para>
23429 After a permanent delivery failure, bounce messages are frozen,
23430 because there is no sender to whom they can be returned. When a frozen bounce
23431 message has been on the queue for more than the given time, it is unfrozen at
23432 the next queue run, and a further delivery is attempted. If delivery fails
23433 again, the bounce message is discarded. This makes it possible to keep failed
23434 bounce messages around for a shorter time than the normal maximum retry time
23435 for frozen messages. For example,
23436 </para>
23437 <literallayout class="monospaced">
23438 ignore_bounce_errors_after = 12h
23439 </literallayout>
23440 <para>
23441 retries failed bounce message deliveries after 12 hours, discarding any further
23442 failures. If the value of this option is set to a zero time period, bounce
23443 failures are discarded immediately. Setting a very long time (as in the default
23444 value) has the effect of disabling this option. For ways of automatically
23445 dealing with other kinds of frozen message, see <option>auto_thaw</option> and
23446 <option>timeout_frozen_after</option>.
23447 </para>
23448 <para>
23449 <indexterm role="option">
23450 <primary><option>ignore_fromline_hosts</option></primary>
23451 </indexterm>
23452 </para>
23453 <informaltable frame="all">
23454 <tgroup cols="4" colsep="0" rowsep="0">
23455 <colspec colwidth="8*" align="left"/>
23456 <colspec colwidth="6*" align="center"/>
23457 <colspec colwidth="6*" align="center"/>
23458 <colspec colwidth="6*" align="right"/>
23459 <tbody>
23460 <row>
23461 <entry><option>ignore_fromline_hosts</option></entry>
23462 <entry>Use: <emphasis>main</emphasis></entry>
23463 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
23464 <entry>Default: <emphasis>unset</emphasis></entry>
23465 </row>
23466 </tbody>
23467 </tgroup>
23468 </informaltable>
23469 <para>
23470 <indexterm role="concept">
23471 <primary><quote>From</quote> line</primary>
23472 </indexterm>
23473 <indexterm role="concept">
23474 <primary>UUCP</primary>
23475 <secondary><quote>From</quote> line</secondary>
23476 </indexterm>
23477 Some broken SMTP clients insist on sending a UUCP-like <quote>From&nbsp;</quote> line before
23478 the headers of a message. By default this is treated as the start of the
23479 message&#x2019;s body, which means that any following headers are not recognized as
23480 such. Exim can be made to ignore it by setting <option>ignore_fromline_hosts</option> to
23481 match those hosts that insist on sending it. If the sender is actually a local
23482 process rather than a remote host, and is using <option>-bs</option> to inject the messages,
23483 <option>ignore_fromline_local</option> must be set to achieve this effect.
23484 </para>
23485 <para>
23486 <indexterm role="option">
23487 <primary><option>ignore_fromline_local</option></primary>
23488 </indexterm>
23489 </para>
23490 <informaltable frame="all">
23491 <tgroup cols="4" colsep="0" rowsep="0">
23492 <colspec colwidth="8*" align="left"/>
23493 <colspec colwidth="6*" align="center"/>
23494 <colspec colwidth="6*" align="center"/>
23495 <colspec colwidth="6*" align="right"/>
23496 <tbody>
23497 <row>
23498 <entry><option>ignore_fromline_local</option></entry>
23499 <entry>Use: <emphasis>main</emphasis></entry>
23500 <entry>Type: <emphasis>boolean</emphasis></entry>
23501 <entry>Default: <emphasis>false</emphasis></entry>
23502 </row>
23503 </tbody>
23504 </tgroup>
23505 </informaltable>
23506 <para>
23507 See <option>ignore_fromline_hosts</option> above.
23508 </para>
23509 <para>
23510 <indexterm role="option">
23511 <primary><option>keep_malformed</option></primary>
23512 </indexterm>
23513 </para>
23514 <informaltable frame="all">
23515 <tgroup cols="4" colsep="0" rowsep="0">
23516 <colspec colwidth="8*" align="left"/>
23517 <colspec colwidth="6*" align="center"/>
23518 <colspec colwidth="6*" align="center"/>
23519 <colspec colwidth="6*" align="right"/>
23520 <tbody>
23521 <row>
23522 <entry><option>keep_malformed</option></entry>
23523 <entry>Use: <emphasis>main</emphasis></entry>
23524 <entry>Type: <emphasis>time</emphasis></entry>
23525 <entry>Default: <emphasis>4d</emphasis></entry>
23526 </row>
23527 </tbody>
23528 </tgroup>
23529 </informaltable>
23530 <para>
23531 This option specifies the length of time to keep messages whose spool files
23532 have been corrupted in some way. This should, of course, never happen. At the
23533 next attempt to deliver such a message, it gets removed. The incident is
23534 logged.
23535 </para>
23536 <para>
23537 <indexterm role="option">
23538 <primary><option>ldap_default_servers</option></primary>
23539 </indexterm>
23540 </para>
23541 <informaltable frame="all">
23542 <tgroup cols="4" colsep="0" rowsep="0">
23543 <colspec colwidth="8*" align="left"/>
23544 <colspec colwidth="6*" align="center"/>
23545 <colspec colwidth="6*" align="center"/>
23546 <colspec colwidth="6*" align="right"/>
23547 <tbody>
23548 <row>
23549 <entry><option>ldap_default_servers</option></entry>
23550 <entry>Use: <emphasis>main</emphasis></entry>
23551 <entry>Type: <emphasis>string list</emphasis></entry>
23552 <entry>Default: <emphasis>unset</emphasis></entry>
23553 </row>
23554 </tbody>
23555 </tgroup>
23556 </informaltable>
23557 <para>
23558 <indexterm role="concept">
23559 <primary>LDAP</primary>
23560 <secondary>default servers</secondary>
23561 </indexterm>
23562 This option provides a list of LDAP servers which are tried in turn when an
23563 LDAP query does not contain a server. See section <xref linkend="SECTforldaque"/> for
23564 details of LDAP queries. This option is available only when Exim has been built
23565 with LDAP support.
23566 </para>
23567 <para>
23568 <indexterm role="option">
23569 <primary><option>ldap_version</option></primary>
23570 </indexterm>
23571 </para>
23572 <informaltable frame="all">
23573 <tgroup cols="4" colsep="0" rowsep="0">
23574 <colspec colwidth="8*" align="left"/>
23575 <colspec colwidth="6*" align="center"/>
23576 <colspec colwidth="6*" align="center"/>
23577 <colspec colwidth="6*" align="right"/>
23578 <tbody>
23579 <row>
23580 <entry><option>ldap_version</option></entry>
23581 <entry>Use: <emphasis>main</emphasis></entry>
23582 <entry>Type: <emphasis>integer</emphasis></entry>
23583 <entry>Default: <emphasis>unset</emphasis></entry>
23584 </row>
23585 </tbody>
23586 </tgroup>
23587 </informaltable>
23588 <para>
23589 <indexterm role="concept">
23590 <primary>LDAP</primary>
23591 <secondary>protocol version, forcing</secondary>
23592 </indexterm>
23593 This option can be used to force Exim to set a specific protocol version for
23594 LDAP. If it option is unset, it is shown by the <option>-bP</option> command line option as
23595 -1. When this is the case, the default is 3 if LDAP_VERSION3 is defined in
23596 the LDAP headers; otherwise it is 2. This option is available only when Exim
23597 has been built with LDAP support.
23598 </para>
23599 <para>
23600 <indexterm role="option">
23601 <primary><option>local_from_check</option></primary>
23602 </indexterm>
23603 </para>
23604 <informaltable frame="all">
23605 <tgroup cols="4" colsep="0" rowsep="0">
23606 <colspec colwidth="8*" align="left"/>
23607 <colspec colwidth="6*" align="center"/>
23608 <colspec colwidth="6*" align="center"/>
23609 <colspec colwidth="6*" align="right"/>
23610 <tbody>
23611 <row>
23612 <entry><option>local_from_check</option></entry>
23613 <entry>Use: <emphasis>main</emphasis></entry>
23614 <entry>Type: <emphasis>boolean</emphasis></entry>
23615 <entry>Default: <emphasis>true</emphasis></entry>
23616 </row>
23617 </tbody>
23618 </tgroup>
23619 </informaltable>
23620 <para>
23621 <indexterm role="concept">
23622 <primary><emphasis>Sender:</emphasis> header line</primary>
23623 <secondary>disabling addition of</secondary>
23624 </indexterm>
23625 <indexterm role="concept">
23626 <primary><emphasis>From:</emphasis> header line</primary>
23627 <secondary>disabling checking of</secondary>
23628 </indexterm>
23629 When a message is submitted locally (that is, not over a TCP/IP connection) by
23630 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line, and
23631 checks that the <emphasis>From:</emphasis> header line matches the login of the calling user and
23632 the domain specified by <option>qualify_domain</option>.
23633 </para>
23634 <para>
23635 <emphasis role="bold">Note</emphasis>: An unqualified address (no domain) in the <emphasis>From:</emphasis> header in a
23636 locally submitted message is automatically qualified by Exim, unless the
23637 <option>-bnq</option> command line option is used.
23638 </para>
23639 <para>
23640 You can use <option>local_from_prefix</option> and <option>local_from_suffix</option> to permit affixes
23641 on the local part. If the <emphasis>From:</emphasis> header line does not match, Exim adds a
23642 <emphasis>Sender:</emphasis> header with an address constructed from the calling user&#x2019;s login
23643 and the default qualify domain.
23644 </para>
23645 <para>
23646 If <option>local_from_check</option> is set false, the <emphasis>From:</emphasis> header check is disabled,
23647 and no <emphasis>Sender:</emphasis> header is ever added. If, in addition, you want to retain
23648 <emphasis>Sender:</emphasis> header lines supplied by untrusted users, you must also set
23649 <option>local_sender_retain</option> to be true.
23650 </para>
23651 <para>
23652 <indexterm role="concept">
23653 <primary>envelope sender</primary>
23654 </indexterm>
23655 These options affect only the header lines in the message. The envelope sender
23656 is still forced to be the login id at the qualify domain unless
23657 <option>untrusted_set_sender</option> permits the user to supply an envelope sender.
23658 </para>
23659 <para>
23660 For messages received over TCP/IP, an ACL can specify <quote>submission mode</quote> to
23661 request similar header line checking. See section <xref linkend="SECTthesenhea"/>, which
23662 has more details about <emphasis>Sender:</emphasis> processing.
23663 </para>
23664 <para>
23665 <indexterm role="option">
23666 <primary><option>local_from_prefix</option></primary>
23667 </indexterm>
23668 </para>
23669 <informaltable frame="all">
23670 <tgroup cols="4" colsep="0" rowsep="0">
23671 <colspec colwidth="8*" align="left"/>
23672 <colspec colwidth="6*" align="center"/>
23673 <colspec colwidth="6*" align="center"/>
23674 <colspec colwidth="6*" align="right"/>
23675 <tbody>
23676 <row>
23677 <entry><option>local_from_prefix</option></entry>
23678 <entry>Use: <emphasis>main</emphasis></entry>
23679 <entry>Type: <emphasis>string</emphasis></entry>
23680 <entry>Default: <emphasis>unset</emphasis></entry>
23681 </row>
23682 </tbody>
23683 </tgroup>
23684 </informaltable>
23685 <para>
23686 When Exim checks the <emphasis>From:</emphasis> header line of locally submitted messages for
23687 matching the login id (see <option>local_from_check</option> above), it can be configured to
23688 ignore certain prefixes and suffixes in the local part of the address. This is
23689 done by setting <option>local_from_prefix</option> and/or <option>local_from_suffix</option> to
23690 appropriate lists, in the same form as the <option>local_part_prefix</option> and
23691 <option>local_part_suffix</option> router options (see chapter <xref linkend="CHAProutergeneric"/>). For
23692 example, if
23693 </para>
23694 <literallayout class="monospaced">
23695 local_from_prefix = *-
23696 </literallayout>
23697 <para>
23698 is set, a <emphasis>From:</emphasis> line containing
23699 </para>
23700 <literallayout class="monospaced">
23701 From: anything-user@your.domain.example
23702 </literallayout>
23703 <para>
23704 will not cause a <emphasis>Sender:</emphasis> header to be added if <emphasis>user@your.domain.example</emphasis>
23705 matches the actual sender address that is constructed from the login name and
23706 qualify domain.
23707 </para>
23708 <para>
23709 <indexterm role="option">
23710 <primary><option>local_from_suffix</option></primary>
23711 </indexterm>
23712 </para>
23713 <informaltable frame="all">
23714 <tgroup cols="4" colsep="0" rowsep="0">
23715 <colspec colwidth="8*" align="left"/>
23716 <colspec colwidth="6*" align="center"/>
23717 <colspec colwidth="6*" align="center"/>
23718 <colspec colwidth="6*" align="right"/>
23719 <tbody>
23720 <row>
23721 <entry><option>local_from_suffix</option></entry>
23722 <entry>Use: <emphasis>main</emphasis></entry>
23723 <entry>Type: <emphasis>string</emphasis></entry>
23724 <entry>Default: <emphasis>unset</emphasis></entry>
23725 </row>
23726 </tbody>
23727 </tgroup>
23728 </informaltable>
23729 <para>
23730 See <option>local_from_prefix</option> above.
23731 </para>
23732 <para>
23733 <indexterm role="option">
23734 <primary><option>local_interfaces</option></primary>
23735 </indexterm>
23736 </para>
23737 <informaltable frame="all">
23738 <tgroup cols="4" colsep="0" rowsep="0">
23739 <colspec colwidth="8*" align="left"/>
23740 <colspec colwidth="6*" align="center"/>
23741 <colspec colwidth="6*" align="center"/>
23742 <colspec colwidth="6*" align="right"/>
23743 <tbody>
23744 <row>
23745 <entry><option>local_interfaces</option></entry>
23746 <entry>Use: <emphasis>main</emphasis></entry>
23747 <entry>Type: <emphasis>string list</emphasis></entry>
23748 <entry>Default: <emphasis>see below</emphasis></entry>
23749 </row>
23750 </tbody>
23751 </tgroup>
23752 </informaltable>
23753 <para>
23754 This option controls which network interfaces are used by the daemon for
23755 listening; they are also used to identify the local host when routing. Chapter
23756 <xref linkend="CHAPinterfaces"/> contains a full description of this option and the related
23757 options <option>daemon_smtp_ports</option>, <option>extra_local_interfaces</option>,
23758 <option>hosts_treat_as_local</option>, and <option>tls_on_connect_ports</option>. The default value for
23759 <option>local_interfaces</option> is
23760 </para>
23761 <literallayout class="monospaced">
23762 local_interfaces = 0.0.0.0
23763 </literallayout>
23764 <para>
23765 when Exim is built without IPv6 support; otherwise it is
23766 </para>
23767 <literallayout class="monospaced">
23768 local_interfaces = &lt;; ::0 ; 0.0.0.0
23769 </literallayout>
23770 <para>
23771 <indexterm role="option">
23772 <primary><option>local_scan_timeout</option></primary>
23773 </indexterm>
23774 </para>
23775 <informaltable frame="all">
23776 <tgroup cols="4" colsep="0" rowsep="0">
23777 <colspec colwidth="8*" align="left"/>
23778 <colspec colwidth="6*" align="center"/>
23779 <colspec colwidth="6*" align="center"/>
23780 <colspec colwidth="6*" align="right"/>
23781 <tbody>
23782 <row>
23783 <entry><option>local_scan_timeout</option></entry>
23784 <entry>Use: <emphasis>main</emphasis></entry>
23785 <entry>Type: <emphasis>time</emphasis></entry>
23786 <entry>Default: <emphasis>5m</emphasis></entry>
23787 </row>
23788 </tbody>
23789 </tgroup>
23790 </informaltable>
23791 <para>
23792 <indexterm role="concept">
23793 <primary>timeout</primary>
23794 <secondary>for <function>local_scan()</function> function</secondary>
23795 </indexterm>
23796 <indexterm role="concept">
23797 <primary><function>local_scan()</function> function</primary>
23798 <secondary>timeout</secondary>
23799 </indexterm>
23800 This timeout applies to the <function>local_scan()</function> function (see chapter
23801 <xref linkend="CHAPlocalscan"/>). Zero means <quote>no timeout</quote>. If the timeout is exceeded,
23802 the incoming message is rejected with a temporary error if it is an SMTP
23803 message. For a non-SMTP message, the message is dropped and Exim ends with a
23804 non-zero code. The incident is logged on the main and reject logs.
23805 </para>
23806 <para>
23807 <indexterm role="option">
23808 <primary><option>local_sender_retain</option></primary>
23809 </indexterm>
23810 </para>
23811 <informaltable frame="all">
23812 <tgroup cols="4" colsep="0" rowsep="0">
23813 <colspec colwidth="8*" align="left"/>
23814 <colspec colwidth="6*" align="center"/>
23815 <colspec colwidth="6*" align="center"/>
23816 <colspec colwidth="6*" align="right"/>
23817 <tbody>
23818 <row>
23819 <entry><option>local_sender_retain</option></entry>
23820 <entry>Use: <emphasis>main</emphasis></entry>
23821 <entry>Type: <emphasis>boolean</emphasis></entry>
23822 <entry>Default: <emphasis>false</emphasis></entry>
23823 </row>
23824 </tbody>
23825 </tgroup>
23826 </informaltable>
23827 <para>
23828 <indexterm role="concept">
23829 <primary><emphasis>Sender:</emphasis> header line</primary>
23830 <secondary>retaining from local submission</secondary>
23831 </indexterm>
23832 When a message is submitted locally (that is, not over a TCP/IP connection) by
23833 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line. If you
23834 do not want this to happen, you must set <option>local_sender_retain</option>, and you must
23835 also set <option>local_from_check</option> to be false (Exim will complain if you do not).
23836 See also the ACL modifier <literal>control = suppress_local_fixups</literal>. Section
23837 <xref linkend="SECTthesenhea"/> has more details about <emphasis>Sender:</emphasis> processing.
23838 </para>
23839 <para>
23840 <indexterm role="option">
23841 <primary><option>localhost_number</option></primary>
23842 </indexterm>
23843 </para>
23844 <informaltable frame="all">
23845 <tgroup cols="4" colsep="0" rowsep="0">
23846 <colspec colwidth="8*" align="left"/>
23847 <colspec colwidth="6*" align="center"/>
23848 <colspec colwidth="6*" align="center"/>
23849 <colspec colwidth="6*" align="right"/>
23850 <tbody>
23851 <row>
23852 <entry><option>localhost_number</option></entry>
23853 <entry>Use: <emphasis>main</emphasis></entry>
23854 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23855 <entry>Default: <emphasis>unset</emphasis></entry>
23856 </row>
23857 </tbody>
23858 </tgroup>
23859 </informaltable>
23860 <para>
23861 <indexterm role="concept">
23862 <primary>host</primary>
23863 <secondary>locally unique number for</secondary>
23864 </indexterm>
23865 <indexterm role="concept">
23866 <primary>message ids</primary>
23867 <secondary>with multiple hosts</secondary>
23868 </indexterm>
23869 <indexterm role="variable">
23870 <primary><varname>$localhost_number</varname></primary>
23871 </indexterm>
23872 Exim&#x2019;s message ids are normally unique only within the local host. If
23873 uniqueness among a set of hosts is required, each host must set a different
23874 value for the <option>localhost_number</option> option. The string is expanded immediately
23875 after reading the configuration file (so that a number can be computed from the
23876 host name, for example) and the result of the expansion must be a number in the
23877 range 0&ndash;16 (or 0&ndash;10 on operating systems with case-insensitive file
23878 systems). This is available in subsequent string expansions via the variable
23879 <varname>$localhost_number</varname>. When <option>localhost_number is set</option>, the final two
23880 characters of the message id, instead of just being a fractional part of the
23881 time, are computed from the time and the local host number as described in
23882 section <xref linkend="SECTmessiden"/>.
23883 </para>
23884 <para>
23885 <indexterm role="option">
23886 <primary><option>log_file_path</option></primary>
23887 </indexterm>
23888 </para>
23889 <informaltable frame="all">
23890 <tgroup cols="4" colsep="0" rowsep="0">
23891 <colspec colwidth="8*" align="left"/>
23892 <colspec colwidth="6*" align="center"/>
23893 <colspec colwidth="6*" align="center"/>
23894 <colspec colwidth="6*" align="right"/>
23895 <tbody>
23896 <row>
23897 <entry><option>log_file_path</option></entry>
23898 <entry>Use: <emphasis>main</emphasis></entry>
23899 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
23900 <entry>Default: <emphasis>set at compile time</emphasis></entry>
23901 </row>
23902 </tbody>
23903 </tgroup>
23904 </informaltable>
23905 <para>
23906 <indexterm role="concept">
23907 <primary>log</primary>
23908 <secondary>file path for</secondary>
23909 </indexterm>
23910 This option sets the path which is used to determine the names of Exim&#x2019;s log
23911 files, or indicates that logging is to be to syslog, or both. It is expanded
23912 when Exim is entered, so it can, for example, contain a reference to the host
23913 name. If no specific path is set for the log files at compile or run time, they
23914 are written in a sub-directory called <filename>log</filename> in Exim&#x2019;s spool directory.
23915 Chapter <xref linkend="CHAPlog"/> contains further details about Exim&#x2019;s logging, and
23916 section <xref linkend="SECTwhelogwri"/> describes how the contents of <option>log_file_path</option> are
23917 used. If this string is fixed at your installation (contains no expansion
23918 variables) it is recommended that you do not set this option in the
23919 configuration file, but instead supply the path using LOG_FILE_PATH in
23920 <filename>Local/Makefile</filename> so that it is available to Exim for logging errors detected
23921 early on &ndash; in particular, failure to read the configuration file.
23922 </para>
23923 <para>
23924 <indexterm role="option">
23925 <primary><option>log_selector</option></primary>
23926 </indexterm>
23927 </para>
23928 <informaltable frame="all">
23929 <tgroup cols="4" colsep="0" rowsep="0">
23930 <colspec colwidth="8*" align="left"/>
23931 <colspec colwidth="6*" align="center"/>
23932 <colspec colwidth="6*" align="center"/>
23933 <colspec colwidth="6*" align="right"/>
23934 <tbody>
23935 <row>
23936 <entry><option>log_selector</option></entry>
23937 <entry>Use: <emphasis>main</emphasis></entry>
23938 <entry>Type: <emphasis>string</emphasis></entry>
23939 <entry>Default: <emphasis>unset</emphasis></entry>
23940 </row>
23941 </tbody>
23942 </tgroup>
23943 </informaltable>
23944 <para>
23945 <indexterm role="concept">
23946 <primary>log</primary>
23947 <secondary>selectors</secondary>
23948 </indexterm>
23949 This option can be used to reduce or increase the number of things that Exim
23950 writes to its log files. Its argument is made up of names preceded by plus or
23951 minus characters. For example:
23952 </para>
23953 <literallayout class="monospaced">
23954 log_selector = +arguments -retry_defer
23955 </literallayout>
23956 <para>
23957 A list of possible names and what they control is given in the chapter on
23958 logging, in section <xref linkend="SECTlogselector"/>.
23959 </para>
23960 <para>
23961 <indexterm role="option">
23962 <primary><option>log_timezone</option></primary>
23963 </indexterm>
23964 </para>
23965 <informaltable frame="all">
23966 <tgroup cols="4" colsep="0" rowsep="0">
23967 <colspec colwidth="8*" align="left"/>
23968 <colspec colwidth="6*" align="center"/>
23969 <colspec colwidth="6*" align="center"/>
23970 <colspec colwidth="6*" align="right"/>
23971 <tbody>
23972 <row>
23973 <entry><option>log_timezone</option></entry>
23974 <entry>Use: <emphasis>main</emphasis></entry>
23975 <entry>Type: <emphasis>boolean</emphasis></entry>
23976 <entry>Default: <emphasis>false</emphasis></entry>
23977 </row>
23978 </tbody>
23979 </tgroup>
23980 </informaltable>
23981 <para>
23982 <indexterm role="concept">
23983 <primary>log</primary>
23984 <secondary>timezone for entries</secondary>
23985 </indexterm>
23986 <indexterm role="variable">
23987 <primary><varname>$tod_log</varname></primary>
23988 </indexterm>
23989 <indexterm role="variable">
23990 <primary><varname>$tod_zone</varname></primary>
23991 </indexterm>
23992 By default, the timestamps on log lines are in local time without the
23993 timezone. This means that if your timezone changes twice a year, the timestamps
23994 in log lines are ambiguous for an hour when the clocks go back. One way of
23995 avoiding this problem is to set the timezone to UTC. An alternative is to set
23996 <option>log_timezone</option> true. This turns on the addition of the timezone offset to
23997 timestamps in log lines. Turning on this option can add quite a lot to the size
23998 of log files because each line is extended by 6 characters. Note that the
23999 <varname>$tod_log</varname> variable contains the log timestamp without the zone, but there is
24000 another variable called <varname>$tod_zone</varname> that contains just the timezone offset.
24001 </para>
24002 <para>
24003 <indexterm role="option">
24004 <primary><option>lookup_open_max</option></primary>
24005 </indexterm>
24006 </para>
24007 <informaltable frame="all">
24008 <tgroup cols="4" colsep="0" rowsep="0">
24009 <colspec colwidth="8*" align="left"/>
24010 <colspec colwidth="6*" align="center"/>
24011 <colspec colwidth="6*" align="center"/>
24012 <colspec colwidth="6*" align="right"/>
24013 <tbody>
24014 <row>
24015 <entry><option>lookup_open_max</option></entry>
24016 <entry>Use: <emphasis>main</emphasis></entry>
24017 <entry>Type: <emphasis>integer</emphasis></entry>
24018 <entry>Default: <emphasis>25</emphasis></entry>
24019 </row>
24020 </tbody>
24021 </tgroup>
24022 </informaltable>
24023 <para>
24024 <indexterm role="concept">
24025 <primary>too many open files</primary>
24026 </indexterm>
24027 <indexterm role="concept">
24028 <primary>open files, too many</primary>
24029 </indexterm>
24030 <indexterm role="concept">
24031 <primary>file</primary>
24032 <secondary>too many open</secondary>
24033 </indexterm>
24034 <indexterm role="concept">
24035 <primary>lookup</primary>
24036 <secondary>maximum open files</secondary>
24037 </indexterm>
24038 <indexterm role="concept">
24039 <primary>limit</primary>
24040 <secondary>open files for lookups</secondary>
24041 </indexterm>
24042 This option limits the number of simultaneously open files for single-key
24043 lookups that use regular files (that is, <command>lsearch</command>, <command>dbm</command>, and <command>cdb</command>).
24044 Exim normally keeps these files open during routing, because often the same
24045 file is required several times. If the limit is reached, Exim closes the least
24046 recently used file. Note that if you are using the <emphasis>ndbm</emphasis> library, it
24047 actually opens two files for each logical DBM database, though it still counts
24048 as one for the purposes of <option>lookup_open_max</option>. If you are getting <quote>too many
24049 open files</quote> errors with NDBM, you need to reduce the value of
24050 <option>lookup_open_max</option>.
24051 </para>
24052 <para>
24053 <indexterm role="option">
24054 <primary><option>max_username_length</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>max_username_length</option></entry>
24066 <entry>Use: <emphasis>main</emphasis></entry>
24067 <entry>Type: <emphasis>integer</emphasis></entry>
24068 <entry>Default: <emphasis>0</emphasis></entry>
24069 </row>
24070 </tbody>
24071 </tgroup>
24072 </informaltable>
24073 <para>
24074 <indexterm role="concept">
24075 <primary>length of login name</primary>
24076 </indexterm>
24077 <indexterm role="concept">
24078 <primary>user name</primary>
24079 <secondary>maximum length</secondary>
24080 </indexterm>
24081 <indexterm role="concept">
24082 <primary>limit</primary>
24083 <secondary>user name length</secondary>
24084 </indexterm>
24085 Some operating systems are broken in that they truncate long arguments to
24086 <function>getpwnam()</function> to eight characters, instead of returning <quote>no such user</quote>. If
24087 this option is set greater than zero, any attempt to call <function>getpwnam()</function> with
24088 an argument that is longer behaves as if <function>getpwnam()</function> failed.
24089 </para>
24090 <para>
24091 <indexterm role="option">
24092 <primary><option>message_body_newlines</option></primary>
24093 </indexterm>
24094 </para>
24095 <informaltable frame="all">
24096 <tgroup cols="4" colsep="0" rowsep="0">
24097 <colspec colwidth="8*" align="left"/>
24098 <colspec colwidth="6*" align="center"/>
24099 <colspec colwidth="6*" align="center"/>
24100 <colspec colwidth="6*" align="right"/>
24101 <tbody>
24102 <row>
24103 <entry><option>message_body_newlines</option></entry>
24104 <entry>Use: <emphasis>main</emphasis></entry>
24105 <entry>Type: <emphasis>bool</emphasis></entry>
24106 <entry>Default: <emphasis>false</emphasis></entry>
24107 </row>
24108 </tbody>
24109 </tgroup>
24110 </informaltable>
24111 <para>
24112 <indexterm role="concept">
24113 <primary>message body</primary>
24114 <secondary>newlines in variables</secondary>
24115 </indexterm>
24116 <indexterm role="concept">
24117 <primary>newline</primary>
24118 <secondary>in message body variables</secondary>
24119 </indexterm>
24120 <indexterm role="variable">
24121 <primary><varname>$message_body</varname></primary>
24122 </indexterm>
24123 <indexterm role="variable">
24124 <primary><varname>$message_body_end</varname></primary>
24125 </indexterm>
24126 By default, newlines in the message body are replaced by spaces when setting
24127 the <varname>$message_body</varname> and <varname>$message_body_end</varname> expansion variables. If this
24128 option is set true, this no longer happens.
24129 </para>
24130 <para>
24131 <indexterm role="option">
24132 <primary><option>message_body_visible</option></primary>
24133 </indexterm>
24134 </para>
24135 <informaltable frame="all">
24136 <tgroup cols="4" colsep="0" rowsep="0">
24137 <colspec colwidth="8*" align="left"/>
24138 <colspec colwidth="6*" align="center"/>
24139 <colspec colwidth="6*" align="center"/>
24140 <colspec colwidth="6*" align="right"/>
24141 <tbody>
24142 <row>
24143 <entry><option>message_body_visible</option></entry>
24144 <entry>Use: <emphasis>main</emphasis></entry>
24145 <entry>Type: <emphasis>integer</emphasis></entry>
24146 <entry>Default: <emphasis>500</emphasis></entry>
24147 </row>
24148 </tbody>
24149 </tgroup>
24150 </informaltable>
24151 <para>
24152 <indexterm role="concept">
24153 <primary>body of message</primary>
24154 <secondary>visible size</secondary>
24155 </indexterm>
24156 <indexterm role="concept">
24157 <primary>message body</primary>
24158 <secondary>visible size</secondary>
24159 </indexterm>
24160 <indexterm role="variable">
24161 <primary><varname>$message_body</varname></primary>
24162 </indexterm>
24163 <indexterm role="variable">
24164 <primary><varname>$message_body_end</varname></primary>
24165 </indexterm>
24166 This option specifies how much of a message&#x2019;s body is to be included in the
24167 <varname>$message_body</varname> and <varname>$message_body_end</varname> expansion variables.
24168 </para>
24169 <para>
24170 <indexterm role="option">
24171 <primary><option>message_id_header_domain</option></primary>
24172 </indexterm>
24173 </para>
24174 <informaltable frame="all">
24175 <tgroup cols="4" colsep="0" rowsep="0">
24176 <colspec colwidth="8*" align="left"/>
24177 <colspec colwidth="6*" align="center"/>
24178 <colspec colwidth="6*" align="center"/>
24179 <colspec colwidth="6*" align="right"/>
24180 <tbody>
24181 <row>
24182 <entry><option>message_id_header_domain</option></entry>
24183 <entry>Use: <emphasis>main</emphasis></entry>
24184 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24185 <entry>Default: <emphasis>unset</emphasis></entry>
24186 </row>
24187 </tbody>
24188 </tgroup>
24189 </informaltable>
24190 <para>
24191 <indexterm role="concept">
24192 <primary><emphasis>Message-ID:</emphasis> header line</primary>
24193 </indexterm>
24194 If this option is set, the string is expanded and used as the right hand side
24195 (domain) of the <emphasis>Message-ID:</emphasis> header that Exim creates if a
24196 locally-originated incoming message does not have one. <quote>Locally-originated</quote>
24197 means <quote>not received over TCP/IP.</quote>
24198 Otherwise, the primary host name is used.
24199 Only letters, digits, dot and hyphen are accepted; any other characters are
24200 replaced by hyphens. If the expansion is forced to fail, or if the result is an
24201 empty string, the option is ignored.
24202 </para>
24203 <para>
24204 <indexterm role="option">
24205 <primary><option>message_id_header_text</option></primary>
24206 </indexterm>
24207 </para>
24208 <informaltable frame="all">
24209 <tgroup cols="4" colsep="0" rowsep="0">
24210 <colspec colwidth="8*" align="left"/>
24211 <colspec colwidth="6*" align="center"/>
24212 <colspec colwidth="6*" align="center"/>
24213 <colspec colwidth="6*" align="right"/>
24214 <tbody>
24215 <row>
24216 <entry><option>message_id_header_text</option></entry>
24217 <entry>Use: <emphasis>main</emphasis></entry>
24218 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24219 <entry>Default: <emphasis>unset</emphasis></entry>
24220 </row>
24221 </tbody>
24222 </tgroup>
24223 </informaltable>
24224 <para>
24225 If this variable is set, the string is expanded and used to augment the text of
24226 the <emphasis>Message-id:</emphasis> header that Exim creates if a locally-originated incoming
24227 message does not have one. The text of this header is required by RFC 2822 to
24228 take the form of an address. By default, Exim uses its internal message id as
24229 the local part, and the primary host name as the domain. If this option is set,
24230 it is expanded, and provided the expansion is not forced to fail, and does not
24231 yield an empty string, the result is inserted into the header immediately
24232 before the @, separated from the internal message id by a dot. Any characters
24233 that are illegal in an address are automatically converted into hyphens. This
24234 means that variables such as <varname>$tod_log</varname> can be used, because the spaces and
24235 colons will become hyphens.
24236 </para>
24237 <para>
24238 <indexterm role="option">
24239 <primary><option>message_logs</option></primary>
24240 </indexterm>
24241 </para>
24242 <informaltable frame="all">
24243 <tgroup cols="4" colsep="0" rowsep="0">
24244 <colspec colwidth="8*" align="left"/>
24245 <colspec colwidth="6*" align="center"/>
24246 <colspec colwidth="6*" align="center"/>
24247 <colspec colwidth="6*" align="right"/>
24248 <tbody>
24249 <row>
24250 <entry><option>message_logs</option></entry>
24251 <entry>Use: <emphasis>main</emphasis></entry>
24252 <entry>Type: <emphasis>boolean</emphasis></entry>
24253 <entry>Default: <emphasis>true</emphasis></entry>
24254 </row>
24255 </tbody>
24256 </tgroup>
24257 </informaltable>
24258 <para>
24259 <indexterm role="concept">
24260 <primary>message logs</primary>
24261 <secondary>disabling</secondary>
24262 </indexterm>
24263 <indexterm role="concept">
24264 <primary>log</primary>
24265 <secondary>message log; disabling</secondary>
24266 </indexterm>
24267 If this option is turned off, per-message log files are not created in the
24268 <filename>msglog</filename> spool sub-directory. This reduces the amount of disk I/O required by
24269 Exim, by reducing the number of files involved in handling a message from a
24270 minimum of four (header spool file, body spool file, delivery journal, and
24271 per-message log) to three. The other major I/O activity is Exim&#x2019;s main log,
24272 which is not affected by this option.
24273 </para>
24274 <para>
24275 <indexterm role="option">
24276 <primary><option>message_size_limit</option></primary>
24277 </indexterm>
24278 </para>
24279 <informaltable frame="all">
24280 <tgroup cols="4" colsep="0" rowsep="0">
24281 <colspec colwidth="8*" align="left"/>
24282 <colspec colwidth="6*" align="center"/>
24283 <colspec colwidth="6*" align="center"/>
24284 <colspec colwidth="6*" align="right"/>
24285 <tbody>
24286 <row>
24287 <entry><option>message_size_limit</option></entry>
24288 <entry>Use: <emphasis>main</emphasis></entry>
24289 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24290 <entry>Default: <emphasis>50M</emphasis></entry>
24291 </row>
24292 </tbody>
24293 </tgroup>
24294 </informaltable>
24295 <para>
24296 <indexterm role="concept">
24297 <primary>message</primary>
24298 <secondary>size limit</secondary>
24299 </indexterm>
24300 <indexterm role="concept">
24301 <primary>limit</primary>
24302 <secondary>message size</secondary>
24303 </indexterm>
24304 <indexterm role="concept">
24305 <primary>size</primary>
24306 <secondary>of message, limit</secondary>
24307 </indexterm>
24308 This option limits the maximum size of message that Exim will process. The
24309 value is expanded for each incoming connection so, for example, it can be made
24310 to depend on the IP address of the remote host for messages arriving via
24311 TCP/IP. After expansion, the value must be a sequence of decimal digits,
24312 optionally followed by K or M.
24313 </para>
24314 <para>
24315 <emphasis role="bold">Note</emphasis>: This limit cannot be made to depend on a message&#x2019;s sender or any
24316 other properties of an individual message, because it has to be advertised in
24317 the server&#x2019;s response to EHLO. String expansion failure causes a temporary
24318 error. A value of zero means no limit, but its use is not recommended. See also
24319 <option>bounce_return_size_limit</option>.
24320 </para>
24321 <para>
24322 Incoming SMTP messages are failed with a 552 error if the limit is
24323 exceeded; locally-generated messages either get a stderr message or a delivery
24324 failure message to the sender, depending on the <option>-oe</option> setting. Rejection of
24325 an oversized message is logged in both the main and the reject logs. See also
24326 the generic transport option <option>message_size_limit</option>, which limits the size of
24327 message that an individual transport can process.
24328 </para>
24329 <para>
24330 <indexterm role="option">
24331 <primary><option>move_frozen_messages</option></primary>
24332 </indexterm>
24333 </para>
24334 <informaltable frame="all">
24335 <tgroup cols="4" colsep="0" rowsep="0">
24336 <colspec colwidth="8*" align="left"/>
24337 <colspec colwidth="6*" align="center"/>
24338 <colspec colwidth="6*" align="center"/>
24339 <colspec colwidth="6*" align="right"/>
24340 <tbody>
24341 <row>
24342 <entry><option>move_frozen_messages</option></entry>
24343 <entry>Use: <emphasis>main</emphasis></entry>
24344 <entry>Type: <emphasis>boolean</emphasis></entry>
24345 <entry>Default: <emphasis>false</emphasis></entry>
24346 </row>
24347 </tbody>
24348 </tgroup>
24349 </informaltable>
24350 <para>
24351 <indexterm role="concept">
24352 <primary>frozen messages</primary>
24353 <secondary>moving</secondary>
24354 </indexterm>
24355 This option, which is available only if Exim has been built with the setting
24356 </para>
24357 <literallayout class="monospaced">
24358 SUPPORT_MOVE_FROZEN_MESSAGES=yes
24359 </literallayout>
24360 <para>
24361 in <filename>Local/Makefile</filename>, causes frozen messages and their message logs to be
24362 moved from the <filename>input</filename> and <filename>msglog</filename> directories on the spool to <filename>Finput</filename>
24363 and <filename>Fmsglog</filename>, respectively. There is currently no support in Exim or the
24364 standard utilities for handling such moved messages, and they do not show up in
24365 lists generated by <option>-bp</option> or by the Exim monitor.
24366 </para>
24367 <para>
24368 <indexterm role="option">
24369 <primary><option>mua_wrapper</option></primary>
24370 </indexterm>
24371 </para>
24372 <informaltable frame="all">
24373 <tgroup cols="4" colsep="0" rowsep="0">
24374 <colspec colwidth="8*" align="left"/>
24375 <colspec colwidth="6*" align="center"/>
24376 <colspec colwidth="6*" align="center"/>
24377 <colspec colwidth="6*" align="right"/>
24378 <tbody>
24379 <row>
24380 <entry><option>mua_wrapper</option></entry>
24381 <entry>Use: <emphasis>main</emphasis></entry>
24382 <entry>Type: <emphasis>boolean</emphasis></entry>
24383 <entry>Default: <emphasis>false</emphasis></entry>
24384 </row>
24385 </tbody>
24386 </tgroup>
24387 </informaltable>
24388 <para>
24389 Setting this option true causes Exim to run in a very restrictive mode in which
24390 it passes messages synchronously to a smart host. Chapter <xref linkend="CHAPnonqueueing"/>
24391 contains a full description of this facility.
24392 </para>
24393 <para>
24394 <indexterm role="option">
24395 <primary><option>mysql_servers</option></primary>
24396 </indexterm>
24397 </para>
24398 <informaltable frame="all">
24399 <tgroup cols="4" colsep="0" rowsep="0">
24400 <colspec colwidth="8*" align="left"/>
24401 <colspec colwidth="6*" align="center"/>
24402 <colspec colwidth="6*" align="center"/>
24403 <colspec colwidth="6*" align="right"/>
24404 <tbody>
24405 <row>
24406 <entry><option>mysql_servers</option></entry>
24407 <entry>Use: <emphasis>main</emphasis></entry>
24408 <entry>Type: <emphasis>string list</emphasis></entry>
24409 <entry>Default: <emphasis>unset</emphasis></entry>
24410 </row>
24411 </tbody>
24412 </tgroup>
24413 </informaltable>
24414 <para>
24415 <indexterm role="concept">
24416 <primary>MySQL</primary>
24417 <secondary>server list</secondary>
24418 </indexterm>
24419 This option provides a list of MySQL servers and associated connection data, to
24420 be used in conjunction with <command>mysql</command> lookups (see section <xref linkend="SECID72"/>). The
24421 option is available only if Exim has been built with MySQL support.
24422 </para>
24423 <para>
24424 <indexterm role="option">
24425 <primary><option>never_users</option></primary>
24426 </indexterm>
24427 </para>
24428 <informaltable frame="all">
24429 <tgroup cols="4" colsep="0" rowsep="0">
24430 <colspec colwidth="8*" align="left"/>
24431 <colspec colwidth="6*" align="center"/>
24432 <colspec colwidth="6*" align="center"/>
24433 <colspec colwidth="6*" align="right"/>
24434 <tbody>
24435 <row>
24436 <entry><option>never_users</option></entry>
24437 <entry>Use: <emphasis>main</emphasis></entry>
24438 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
24439 <entry>Default: <emphasis>unset</emphasis></entry>
24440 </row>
24441 </tbody>
24442 </tgroup>
24443 </informaltable>
24444 <para>
24445 This option is expanded just once, at the start of Exim&#x2019;s processing. Local
24446 message deliveries are normally run in processes that are setuid to the
24447 recipient, and remote deliveries are normally run under Exim&#x2019;s own uid and gid.
24448 It is usually desirable to prevent any deliveries from running as root, as a
24449 safety precaution.
24450 </para>
24451 <para>
24452 When Exim is built, an option called FIXED_NEVER_USERS can be set to a
24453 list of users that must not be used for local deliveries. This list is fixed in
24454 the binary and cannot be overridden by the configuration file. By default, it
24455 contains just the single user name <quote>root</quote>. The <option>never_users</option> runtime option
24456 can be used to add more users to the fixed list.
24457 </para>
24458 <para>
24459 If a message is to be delivered as one of the users on the fixed list or the
24460 <option>never_users</option> list, an error occurs, and delivery is deferred. A common
24461 example is
24462 </para>
24463 <literallayout class="monospaced">
24464 never_users = root:daemon:bin
24465 </literallayout>
24466 <para>
24467 Including root is redundant if it is also on the fixed list, but it does no
24468 harm. This option overrides the <option>pipe_as_creator</option> option of the <command>pipe</command>
24469 transport driver.
24470 </para>
24471 <para>
24472 <indexterm role="option">
24473 <primary><option>oracle_servers</option></primary>
24474 </indexterm>
24475 </para>
24476 <informaltable frame="all">
24477 <tgroup cols="4" colsep="0" rowsep="0">
24478 <colspec colwidth="8*" align="left"/>
24479 <colspec colwidth="6*" align="center"/>
24480 <colspec colwidth="6*" align="center"/>
24481 <colspec colwidth="6*" align="right"/>
24482 <tbody>
24483 <row>
24484 <entry><option>oracle_servers</option></entry>
24485 <entry>Use: <emphasis>main</emphasis></entry>
24486 <entry>Type: <emphasis>string list</emphasis></entry>
24487 <entry>Default: <emphasis>unset</emphasis></entry>
24488 </row>
24489 </tbody>
24490 </tgroup>
24491 </informaltable>
24492 <para>
24493 <indexterm role="concept">
24494 <primary>Oracle</primary>
24495 <secondary>server list</secondary>
24496 </indexterm>
24497 This option provides a list of Oracle servers and associated connection data,
24498 to be used in conjunction with <command>oracle</command> lookups (see section <xref linkend="SECID72"/>).
24499 The option is available only if Exim has been built with Oracle support.
24500 </para>
24501 <para>
24502 <indexterm role="option">
24503 <primary><option>percent_hack_domains</option></primary>
24504 </indexterm>
24505 </para>
24506 <informaltable frame="all">
24507 <tgroup cols="4" colsep="0" rowsep="0">
24508 <colspec colwidth="8*" align="left"/>
24509 <colspec colwidth="6*" align="center"/>
24510 <colspec colwidth="6*" align="center"/>
24511 <colspec colwidth="6*" align="right"/>
24512 <tbody>
24513 <row>
24514 <entry><option>percent_hack_domains</option></entry>
24515 <entry>Use: <emphasis>main</emphasis></entry>
24516 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
24517 <entry>Default: <emphasis>unset</emphasis></entry>
24518 </row>
24519 </tbody>
24520 </tgroup>
24521 </informaltable>
24522 <para>
24523 <indexterm role="concept">
24524 <primary><quote>percent hack</quote></primary>
24525 </indexterm>
24526 <indexterm role="concept">
24527 <primary>source routing</primary>
24528 <secondary>in email address</secondary>
24529 </indexterm>
24530 <indexterm role="concept">
24531 <primary>address</primary>
24532 <secondary>source-routed</secondary>
24533 </indexterm>
24534 The <quote>percent hack</quote> is the convention whereby a local part containing a
24535 percent sign is re-interpreted as a new email address, with the percent
24536 replaced by @. This is sometimes called <quote>source routing</quote>, though that term is
24537 also applied to RFC 2822 addresses that begin with an @ character. If this
24538 option is set, Exim implements the percent facility for those domains listed,
24539 but no others. This happens before an incoming SMTP address is tested against
24540 an ACL.
24541 </para>
24542 <para>
24543 <emphasis role="bold">Warning</emphasis>: The <quote>percent hack</quote> has often been abused by people who are
24544 trying to get round relaying restrictions. For this reason, it is best avoided
24545 if at all possible. Unfortunately, a number of less security-conscious MTAs
24546 implement it unconditionally. If you are running Exim on a gateway host, and
24547 routing mail through to internal MTAs without processing the local parts, it is
24548 a good idea to reject recipient addresses with percent characters in their
24549 local parts. Exim&#x2019;s default configuration does this.
24550 </para>
24551 <para>
24552 <indexterm role="option">
24553 <primary><option>perl_at_start</option></primary>
24554 </indexterm>
24555 </para>
24556 <informaltable frame="all">
24557 <tgroup cols="4" colsep="0" rowsep="0">
24558 <colspec colwidth="8*" align="left"/>
24559 <colspec colwidth="6*" align="center"/>
24560 <colspec colwidth="6*" align="center"/>
24561 <colspec colwidth="6*" align="right"/>
24562 <tbody>
24563 <row>
24564 <entry><option>perl_at_start</option></entry>
24565 <entry>Use: <emphasis>main</emphasis></entry>
24566 <entry>Type: <emphasis>boolean</emphasis></entry>
24567 <entry>Default: <emphasis>false</emphasis></entry>
24568 </row>
24569 </tbody>
24570 </tgroup>
24571 </informaltable>
24572 <para>
24573 This option is available only when Exim is built with an embedded Perl
24574 interpreter. See chapter <xref linkend="CHAPperl"/> for details of its use.
24575 </para>
24576 <para>
24577 <indexterm role="option">
24578 <primary><option>perl_startup</option></primary>
24579 </indexterm>
24580 </para>
24581 <informaltable frame="all">
24582 <tgroup cols="4" colsep="0" rowsep="0">
24583 <colspec colwidth="8*" align="left"/>
24584 <colspec colwidth="6*" align="center"/>
24585 <colspec colwidth="6*" align="center"/>
24586 <colspec colwidth="6*" align="right"/>
24587 <tbody>
24588 <row>
24589 <entry><option>perl_startup</option></entry>
24590 <entry>Use: <emphasis>main</emphasis></entry>
24591 <entry>Type: <emphasis>string</emphasis></entry>
24592 <entry>Default: <emphasis>unset</emphasis></entry>
24593 </row>
24594 </tbody>
24595 </tgroup>
24596 </informaltable>
24597 <para>
24598 This option is available only when Exim is built with an embedded Perl
24599 interpreter. See chapter <xref linkend="CHAPperl"/> for details of its use.
24600 </para>
24601 <para>
24602 <indexterm role="option">
24603 <primary><option>pgsql_servers</option></primary>
24604 </indexterm>
24605 </para>
24606 <informaltable frame="all">
24607 <tgroup cols="4" colsep="0" rowsep="0">
24608 <colspec colwidth="8*" align="left"/>
24609 <colspec colwidth="6*" align="center"/>
24610 <colspec colwidth="6*" align="center"/>
24611 <colspec colwidth="6*" align="right"/>
24612 <tbody>
24613 <row>
24614 <entry><option>pgsql_servers</option></entry>
24615 <entry>Use: <emphasis>main</emphasis></entry>
24616 <entry>Type: <emphasis>string list</emphasis></entry>
24617 <entry>Default: <emphasis>unset</emphasis></entry>
24618 </row>
24619 </tbody>
24620 </tgroup>
24621 </informaltable>
24622 <para>
24623 <indexterm role="concept">
24624 <primary>PostgreSQL lookup type</primary>
24625 <secondary>server list</secondary>
24626 </indexterm>
24627 This option provides a list of PostgreSQL servers and associated connection
24628 data, to be used in conjunction with <command>pgsql</command> lookups (see section
24629 <xref linkend="SECID72"/>). The option is available only if Exim has been built with
24630 PostgreSQL support.
24631 </para>
24632 <para>
24633 <indexterm role="option">
24634 <primary><option>pid_file_path</option></primary>
24635 </indexterm>
24636 </para>
24637 <informaltable frame="all">
24638 <tgroup cols="4" colsep="0" rowsep="0">
24639 <colspec colwidth="8*" align="left"/>
24640 <colspec colwidth="6*" align="center"/>
24641 <colspec colwidth="6*" align="center"/>
24642 <colspec colwidth="6*" align="right"/>
24643 <tbody>
24644 <row>
24645 <entry><option>pid_file_path</option></entry>
24646 <entry>Use: <emphasis>main</emphasis></entry>
24647 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24648 <entry>Default: <emphasis>set at compile time</emphasis></entry>
24649 </row>
24650 </tbody>
24651 </tgroup>
24652 </informaltable>
24653 <para>
24654 <indexterm role="concept">
24655 <primary>daemon</primary>
24656 <secondary>pid file path</secondary>
24657 </indexterm>
24658 <indexterm role="concept">
24659 <primary>pid file, path for</primary>
24660 </indexterm>
24661 This option sets the name of the file to which the Exim daemon writes its
24662 process id. The string is expanded, so it can contain, for example, references
24663 to the host name:
24664 </para>
24665 <literallayout class="monospaced">
24666 pid_file_path = /var/log/$primary_hostname/exim.pid
24667 </literallayout>
24668 <para>
24669 If no path is set, the pid is written to the file <filename>exim-daemon.pid</filename> in Exim&#x2019;s
24670 spool directory.
24671 The value set by the option can be overridden by the <option>-oP</option> command line
24672 option. A pid file is not written if a <quote>non-standard</quote> daemon is run by means
24673 of the <option>-oX</option> option, unless a path is explicitly supplied by <option>-oP</option>.
24674 </para>
24675 <para>
24676 <indexterm role="option">
24677 <primary><option>pipelining_advertise_hosts</option></primary>
24678 </indexterm>
24679 </para>
24680 <informaltable frame="all">
24681 <tgroup cols="4" colsep="0" rowsep="0">
24682 <colspec colwidth="8*" align="left"/>
24683 <colspec colwidth="6*" align="center"/>
24684 <colspec colwidth="6*" align="center"/>
24685 <colspec colwidth="6*" align="right"/>
24686 <tbody>
24687 <row>
24688 <entry><option>pipelining_advertise_hosts</option></entry>
24689 <entry>Use: <emphasis>main</emphasis></entry>
24690 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
24691 <entry>Default: <emphasis>*</emphasis></entry>
24692 </row>
24693 </tbody>
24694 </tgroup>
24695 </informaltable>
24696 <para>
24697 <indexterm role="concept">
24698 <primary>PIPELINING</primary>
24699 <secondary>suppressing advertising</secondary>
24700 </indexterm>
24701 This option can be used to suppress the advertisement of the SMTP
24702 PIPELINING extension to specific hosts. See also the <emphasis role="bold">no_pipelining</emphasis>
24703 control in section <xref linkend="SECTcontrols"/>. When PIPELINING is not advertised and
24704 <option>smtp_enforce_sync</option> is true, an Exim server enforces strict synchronization
24705 for each SMTP command and response. When PIPELINING is advertised, Exim assumes
24706 that clients will use it; <quote>out of order</quote> commands that are <quote>expected</quote> do
24707 not count as protocol errors (see <option>smtp_max_synprot_errors</option>).
24708 </para>
24709 <para>
24710 <indexterm role="option">
24711 <primary><option>preserve_message_logs</option></primary>
24712 </indexterm>
24713 </para>
24714 <informaltable frame="all">
24715 <tgroup cols="4" colsep="0" rowsep="0">
24716 <colspec colwidth="8*" align="left"/>
24717 <colspec colwidth="6*" align="center"/>
24718 <colspec colwidth="6*" align="center"/>
24719 <colspec colwidth="6*" align="right"/>
24720 <tbody>
24721 <row>
24722 <entry><option>preserve_message_logs</option></entry>
24723 <entry>Use: <emphasis>main</emphasis></entry>
24724 <entry>Type: <emphasis>boolean</emphasis></entry>
24725 <entry>Default: <emphasis>false</emphasis></entry>
24726 </row>
24727 </tbody>
24728 </tgroup>
24729 </informaltable>
24730 <para>
24731 <indexterm role="concept">
24732 <primary>message logs</primary>
24733 <secondary>preserving</secondary>
24734 </indexterm>
24735 If this option is set, message log files are not deleted when messages are
24736 completed. Instead, they are moved to a sub-directory of the spool directory
24737 called <filename>msglog.OLD</filename>, where they remain available for statistical or debugging
24738 purposes. This is a dangerous option to set on systems with any appreciable
24739 volume of mail. Use with care!
24740 </para>
24741 <para>
24742 <indexterm role="option">
24743 <primary><option>primary_hostname</option></primary>
24744 </indexterm>
24745 </para>
24746 <informaltable frame="all">
24747 <tgroup cols="4" colsep="0" rowsep="0">
24748 <colspec colwidth="8*" align="left"/>
24749 <colspec colwidth="6*" align="center"/>
24750 <colspec colwidth="6*" align="center"/>
24751 <colspec colwidth="6*" align="right"/>
24752 <tbody>
24753 <row>
24754 <entry><option>primary_hostname</option></entry>
24755 <entry>Use: <emphasis>main</emphasis></entry>
24756 <entry>Type: <emphasis>string</emphasis></entry>
24757 <entry>Default: <emphasis>see below</emphasis></entry>
24758 </row>
24759 </tbody>
24760 </tgroup>
24761 </informaltable>
24762 <para>
24763 <indexterm role="concept">
24764 <primary>name</primary>
24765 <secondary>of local host</secondary>
24766 </indexterm>
24767 <indexterm role="concept">
24768 <primary>host</primary>
24769 <secondary>name of local</secondary>
24770 </indexterm>
24771 <indexterm role="concept">
24772 <primary>local host</primary>
24773 <secondary>name of</secondary>
24774 </indexterm>
24775 <indexterm role="variable">
24776 <primary><varname>$primary_hostname</varname></primary>
24777 </indexterm>
24778 This specifies the name of the current host. It is used in the default EHLO or
24779 HELO command for outgoing SMTP messages (changeable via the <option>helo_data</option>
24780 option in the <command>smtp</command> transport), and as the default for <option>qualify_domain</option>.
24781 The value is also used by default in some SMTP response messages from an Exim
24782 server. This can be changed dynamically by setting <option>smtp_active_hostname</option>.
24783 </para>
24784 <para>
24785 If <option>primary_hostname</option> is not set, Exim calls <function>uname()</function> to find the host
24786 name. If this fails, Exim panics and dies. If the name returned by <function>uname()</function>
24787 contains only one component, Exim passes it to <function>gethostbyname()</function> (or
24788 <function>getipnodebyname()</function> when available) in order to obtain the fully qualified
24789 version. The variable <varname>$primary_hostname</varname> contains the host name, whether set
24790 explicitly by this option, or defaulted.
24791 </para>
24792 <para>
24793 <indexterm role="option">
24794 <primary><option>print_topbitchars</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>print_topbitchars</option></entry>
24806 <entry>Use: <emphasis>main</emphasis></entry>
24807 <entry>Type: <emphasis>boolean</emphasis></entry>
24808 <entry>Default: <emphasis>false</emphasis></entry>
24809 </row>
24810 </tbody>
24811 </tgroup>
24812 </informaltable>
24813 <para>
24814 <indexterm role="concept">
24815 <primary>printing characters</primary>
24816 </indexterm>
24817 <indexterm role="concept">
24818 <primary>8-bit characters</primary>
24819 </indexterm>
24820 By default, Exim considers only those characters whose codes lie in the range
24821 32&ndash;126 to be printing characters. In a number of circumstances (for example,
24822 when writing log entries) non-printing characters are converted into escape
24823 sequences, primarily to avoid messing up the layout. If <option>print_topbitchars</option>
24824 is set, code values of 128 and above are also considered to be printing
24825 characters.
24826 </para>
24827 <para>
24828 This option also affects the header syntax checks performed by the
24829 <command>autoreply</command> transport, and whether Exim uses RFC 2047 encoding of
24830 the user&#x2019;s full name when constructing From: and Sender: addresses (as
24831 described in section <xref linkend="SECTconstr"/>). Setting this option can cause
24832 Exim to generate eight bit message headers that do not conform to the
24833 standards.
24834 </para>
24835 <para>
24836 <indexterm role="option">
24837 <primary><option>process_log_path</option></primary>
24838 </indexterm>
24839 </para>
24840 <informaltable frame="all">
24841 <tgroup cols="4" colsep="0" rowsep="0">
24842 <colspec colwidth="8*" align="left"/>
24843 <colspec colwidth="6*" align="center"/>
24844 <colspec colwidth="6*" align="center"/>
24845 <colspec colwidth="6*" align="right"/>
24846 <tbody>
24847 <row>
24848 <entry><option>process_log_path</option></entry>
24849 <entry>Use: <emphasis>main</emphasis></entry>
24850 <entry>Type: <emphasis>string</emphasis></entry>
24851 <entry>Default: <emphasis>unset</emphasis></entry>
24852 </row>
24853 </tbody>
24854 </tgroup>
24855 </informaltable>
24856 <para>
24857 <indexterm role="concept">
24858 <primary>process log path</primary>
24859 </indexterm>
24860 <indexterm role="concept">
24861 <primary>log</primary>
24862 <secondary>process log</secondary>
24863 </indexterm>
24864 <indexterm role="concept">
24865 <primary><emphasis>exiwhat</emphasis></primary>
24866 </indexterm>
24867 This option sets the name of the file to which an Exim process writes its
24868 <quote>process log</quote> when sent a USR1 signal. This is used by the <emphasis>exiwhat</emphasis>
24869 utility script. If this option is unset, the file called <filename>exim-process.info</filename>
24870 in Exim&#x2019;s spool directory is used. The ability to specify the name explicitly
24871 can be useful in environments where two different Exims are running, using
24872 different spool directories.
24873 </para>
24874 <para>
24875 <indexterm role="option">
24876 <primary><option>prod_requires_admin</option></primary>
24877 </indexterm>
24878 </para>
24879 <informaltable frame="all">
24880 <tgroup cols="4" colsep="0" rowsep="0">
24881 <colspec colwidth="8*" align="left"/>
24882 <colspec colwidth="6*" align="center"/>
24883 <colspec colwidth="6*" align="center"/>
24884 <colspec colwidth="6*" align="right"/>
24885 <tbody>
24886 <row>
24887 <entry><option>prod_requires_admin</option></entry>
24888 <entry>Use: <emphasis>main</emphasis></entry>
24889 <entry>Type: <emphasis>boolean</emphasis></entry>
24890 <entry>Default: <emphasis>true</emphasis></entry>
24891 </row>
24892 </tbody>
24893 </tgroup>
24894 </informaltable>
24895 <para>
24896 <indexterm role="option">
24897 <primary><option>-M</option></primary>
24898 </indexterm>
24899 <indexterm role="option">
24900 <primary><option>-R</option></primary>
24901 </indexterm>
24902 <indexterm role="option">
24903 <primary><option>-q</option></primary>
24904 </indexterm>
24905 The <option>-M</option>, <option>-R</option>, and <option>-q</option> command-line options require the caller to be an
24906 admin user unless <option>prod_requires_admin</option> is set false. See also
24907 <option>queue_list_requires_admin</option>.
24908 </para>
24909 <para>
24910 <indexterm role="option">
24911 <primary><option>qualify_domain</option></primary>
24912 </indexterm>
24913 </para>
24914 <informaltable frame="all">
24915 <tgroup cols="4" colsep="0" rowsep="0">
24916 <colspec colwidth="8*" align="left"/>
24917 <colspec colwidth="6*" align="center"/>
24918 <colspec colwidth="6*" align="center"/>
24919 <colspec colwidth="6*" align="right"/>
24920 <tbody>
24921 <row>
24922 <entry><option>qualify_domain</option></entry>
24923 <entry>Use: <emphasis>main</emphasis></entry>
24924 <entry>Type: <emphasis>string</emphasis></entry>
24925 <entry>Default: <emphasis>see below</emphasis></entry>
24926 </row>
24927 </tbody>
24928 </tgroup>
24929 </informaltable>
24930 <para>
24931 <indexterm role="concept">
24932 <primary>domain</primary>
24933 <secondary>for qualifying addresses</secondary>
24934 </indexterm>
24935 <indexterm role="concept">
24936 <primary>address</primary>
24937 <secondary>qualification</secondary>
24938 </indexterm>
24939 This option specifies the domain name that is added to any envelope sender
24940 addresses that do not have a domain qualification. It also applies to
24941 recipient addresses if <option>qualify_recipient</option> is not set. Unqualified addresses
24942 are accepted by default only for locally-generated messages. Qualification is
24943 also applied to addresses in header lines such as <emphasis>From:</emphasis> and <emphasis>To:</emphasis> for
24944 locally-generated messages, unless the <option>-bnq</option> command line option is used.
24945 </para>
24946 <para>
24947 Messages from external sources must always contain fully qualified addresses,
24948 unless the sending host matches <option>sender_unqualified_hosts</option> or
24949 <option>recipient_unqualified_hosts</option> (as appropriate), in which case incoming
24950 addresses are qualified with <option>qualify_domain</option> or <option>qualify_recipient</option> as
24951 necessary. Internally, Exim always works with fully qualified envelope
24952 addresses. If <option>qualify_domain</option> is not set, it defaults to the
24953 <option>primary_hostname</option> value.
24954 </para>
24955 <para>
24956 <indexterm role="option">
24957 <primary><option>qualify_recipient</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>qualify_recipient</option></entry>
24969 <entry>Use: <emphasis>main</emphasis></entry>
24970 <entry>Type: <emphasis>string</emphasis></entry>
24971 <entry>Default: <emphasis>see below</emphasis></entry>
24972 </row>
24973 </tbody>
24974 </tgroup>
24975 </informaltable>
24976 <para>
24977 This option allows you to specify a different domain for qualifying recipient
24978 addresses to the one that is used for senders. See <option>qualify_domain</option> above.
24979 </para>
24980 <para>
24981 <indexterm role="option">
24982 <primary><option>queue_domains</option></primary>
24983 </indexterm>
24984 </para>
24985 <informaltable frame="all">
24986 <tgroup cols="4" colsep="0" rowsep="0">
24987 <colspec colwidth="8*" align="left"/>
24988 <colspec colwidth="6*" align="center"/>
24989 <colspec colwidth="6*" align="center"/>
24990 <colspec colwidth="6*" align="right"/>
24991 <tbody>
24992 <row>
24993 <entry><option>queue_domains</option></entry>
24994 <entry>Use: <emphasis>main</emphasis></entry>
24995 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
24996 <entry>Default: <emphasis>unset</emphasis></entry>
24997 </row>
24998 </tbody>
24999 </tgroup>
25000 </informaltable>
25001 <para>
25002 <indexterm role="concept">
25003 <primary>domain</primary>
25004 <secondary>specifying non-immediate delivery</secondary>
25005 </indexterm>
25006 <indexterm role="concept">
25007 <primary>queueing incoming messages</primary>
25008 </indexterm>
25009 <indexterm role="concept">
25010 <primary>message</primary>
25011 <secondary>queueing certain domains</secondary>
25012 </indexterm>
25013 This option lists domains for which immediate delivery is not required.
25014 A delivery process is started whenever a message is received, but only those
25015 domains that do not match are processed. All other deliveries wait until the
25016 next queue run. See also <option>hold_domains</option> and <option>queue_smtp_domains</option>.
25017 </para>
25018 <para>
25019 <indexterm role="option">
25020 <primary><option>queue_list_requires_admin</option></primary>
25021 </indexterm>
25022 </para>
25023 <informaltable frame="all">
25024 <tgroup cols="4" colsep="0" rowsep="0">
25025 <colspec colwidth="8*" align="left"/>
25026 <colspec colwidth="6*" align="center"/>
25027 <colspec colwidth="6*" align="center"/>
25028 <colspec colwidth="6*" align="right"/>
25029 <tbody>
25030 <row>
25031 <entry><option>queue_list_requires_admin</option></entry>
25032 <entry>Use: <emphasis>main</emphasis></entry>
25033 <entry>Type: <emphasis>boolean</emphasis></entry>
25034 <entry>Default: <emphasis>true</emphasis></entry>
25035 </row>
25036 </tbody>
25037 </tgroup>
25038 </informaltable>
25039 <para>
25040 <indexterm role="option">
25041 <primary><option>-bp</option></primary>
25042 </indexterm>
25043 The <option>-bp</option> command-line option, which lists the messages that are on the
25044 queue, requires the caller to be an admin user unless
25045 <option>queue_list_requires_admin</option> is set false. See also <option>prod_requires_admin</option>.
25046 </para>
25047 <para>
25048 <indexterm role="option">
25049 <primary><option>queue_only</option></primary>
25050 </indexterm>
25051 </para>
25052 <informaltable frame="all">
25053 <tgroup cols="4" colsep="0" rowsep="0">
25054 <colspec colwidth="8*" align="left"/>
25055 <colspec colwidth="6*" align="center"/>
25056 <colspec colwidth="6*" align="center"/>
25057 <colspec colwidth="6*" align="right"/>
25058 <tbody>
25059 <row>
25060 <entry><option>queue_only</option></entry>
25061 <entry>Use: <emphasis>main</emphasis></entry>
25062 <entry>Type: <emphasis>boolean</emphasis></entry>
25063 <entry>Default: <emphasis>false</emphasis></entry>
25064 </row>
25065 </tbody>
25066 </tgroup>
25067 </informaltable>
25068 <para>
25069 <indexterm role="concept">
25070 <primary>queueing incoming messages</primary>
25071 </indexterm>
25072 <indexterm role="concept">
25073 <primary>message</primary>
25074 <secondary>queueing unconditionally</secondary>
25075 </indexterm>
25076 If <option>queue_only</option> is set, a delivery process is not automatically started
25077 whenever a message is received. Instead, the message waits on the queue for the
25078 next queue run. Even if <option>queue_only</option> is false, incoming messages may not get
25079 delivered immediately when certain conditions (such as heavy load) occur.
25080 </para>
25081 <para>
25082 The <option>-odq</option> command line has the same effect as <option>queue_only</option>. The <option>-odb</option>
25083 and <option>-odi</option> command line options override <option>queue_only</option> unless
25084 <option>queue_only_override</option> is set false. See also <option>queue_only_file</option>,
25085 <option>queue_only_load</option>, and <option>smtp_accept_queue</option>.
25086 </para>
25087 <para>
25088 <indexterm role="option">
25089 <primary><option>queue_only_file</option></primary>
25090 </indexterm>
25091 </para>
25092 <informaltable frame="all">
25093 <tgroup cols="4" colsep="0" rowsep="0">
25094 <colspec colwidth="8*" align="left"/>
25095 <colspec colwidth="6*" align="center"/>
25096 <colspec colwidth="6*" align="center"/>
25097 <colspec colwidth="6*" align="right"/>
25098 <tbody>
25099 <row>
25100 <entry><option>queue_only_file</option></entry>
25101 <entry>Use: <emphasis>main</emphasis></entry>
25102 <entry>Type: <emphasis>string</emphasis></entry>
25103 <entry>Default: <emphasis>unset</emphasis></entry>
25104 </row>
25105 </tbody>
25106 </tgroup>
25107 </informaltable>
25108 <para>
25109 <indexterm role="concept">
25110 <primary>queueing incoming messages</primary>
25111 </indexterm>
25112 <indexterm role="concept">
25113 <primary>message</primary>
25114 <secondary>queueing by file existence</secondary>
25115 </indexterm>
25116 This option can be set to a colon-separated list of absolute path names, each
25117 one optionally preceded by <quote>smtp</quote>. When Exim is receiving a message,
25118 it tests for the existence of each listed path using a call to <function>stat()</function>. For
25119 each path that exists, the corresponding queueing option is set.
25120 For paths with no prefix, <option>queue_only</option> is set; for paths prefixed by
25121 <quote>smtp</quote>, <option>queue_smtp_domains</option> is set to match all domains. So, for example,
25122 </para>
25123 <literallayout class="monospaced">
25124 queue_only_file = smtp/some/file
25125 </literallayout>
25126 <para>
25127 causes Exim to behave as if <option>queue_smtp_domains</option> were set to <quote>*</quote> whenever
25128 <filename>/some/file</filename> exists.
25129 </para>
25130 <para>
25131 <indexterm role="option">
25132 <primary><option>queue_only_load</option></primary>
25133 </indexterm>
25134 </para>
25135 <informaltable frame="all">
25136 <tgroup cols="4" colsep="0" rowsep="0">
25137 <colspec colwidth="8*" align="left"/>
25138 <colspec colwidth="6*" align="center"/>
25139 <colspec colwidth="6*" align="center"/>
25140 <colspec colwidth="6*" align="right"/>
25141 <tbody>
25142 <row>
25143 <entry><option>queue_only_load</option></entry>
25144 <entry>Use: <emphasis>main</emphasis></entry>
25145 <entry>Type: <emphasis>fixed-point</emphasis></entry>
25146 <entry>Default: <emphasis>unset</emphasis></entry>
25147 </row>
25148 </tbody>
25149 </tgroup>
25150 </informaltable>
25151 <para>
25152 <indexterm role="concept">
25153 <primary>load average</primary>
25154 </indexterm>
25155 <indexterm role="concept">
25156 <primary>queueing incoming messages</primary>
25157 </indexterm>
25158 <indexterm role="concept">
25159 <primary>message</primary>
25160 <secondary>queueing by load</secondary>
25161 </indexterm>
25162 If the system load average is higher than this value, incoming messages from
25163 all sources are queued, and no automatic deliveries are started. If this
25164 happens during local or remote SMTP input, all subsequent messages received on
25165 the same SMTP connection are queued by default, whatever happens to the load in
25166 the meantime, but this can be changed by setting <option>queue_only_load_latch</option>
25167 false.
25168 </para>
25169 <para>
25170 Deliveries will subsequently be performed by queue runner processes. This
25171 option has no effect on ancient operating systems on which Exim cannot
25172 determine the load average. See also <option>deliver_queue_load_max</option> and
25173 <option>smtp_load_reserve</option>.
25174 </para>
25175 <para>
25176 <indexterm role="option">
25177 <primary><option>queue_only_load_latch</option></primary>
25178 </indexterm>
25179 </para>
25180 <informaltable frame="all">
25181 <tgroup cols="4" colsep="0" rowsep="0">
25182 <colspec colwidth="8*" align="left"/>
25183 <colspec colwidth="6*" align="center"/>
25184 <colspec colwidth="6*" align="center"/>
25185 <colspec colwidth="6*" align="right"/>
25186 <tbody>
25187 <row>
25188 <entry><option>queue_only_load_latch</option></entry>
25189 <entry>Use: <emphasis>main</emphasis></entry>
25190 <entry>Type: <emphasis>boolean</emphasis></entry>
25191 <entry>Default: <emphasis>true</emphasis></entry>
25192 </row>
25193 </tbody>
25194 </tgroup>
25195 </informaltable>
25196 <para>
25197 <indexterm role="concept">
25198 <primary>load average</primary>
25199 <secondary>re-evaluating per message</secondary>
25200 </indexterm>
25201 When this option is true (the default), once one message has been queued
25202 because the load average is higher than the value set by <option>queue_only_load</option>,
25203 all subsequent messages received on the same SMTP connection are also queued.
25204 This is a deliberate choice; even though the load average may fall below the
25205 threshold, it doesn&#x2019;t seem right to deliver later messages on the same
25206 connection when not delivering earlier ones. However, there are special
25207 circumstances such as very long-lived connections from scanning appliances
25208 where this is not the best strategy. In such cases, <option>queue_only_load_latch</option>
25209 should be set false. This causes the value of the load average to be
25210 re-evaluated for each message.
25211 </para>
25212 <para>
25213 <indexterm role="option">
25214 <primary><option>queue_only_override</option></primary>
25215 </indexterm>
25216 </para>
25217 <informaltable frame="all">
25218 <tgroup cols="4" colsep="0" rowsep="0">
25219 <colspec colwidth="8*" align="left"/>
25220 <colspec colwidth="6*" align="center"/>
25221 <colspec colwidth="6*" align="center"/>
25222 <colspec colwidth="6*" align="right"/>
25223 <tbody>
25224 <row>
25225 <entry><option>queue_only_override</option></entry>
25226 <entry>Use: <emphasis>main</emphasis></entry>
25227 <entry>Type: <emphasis>boolean</emphasis></entry>
25228 <entry>Default: <emphasis>true</emphasis></entry>
25229 </row>
25230 </tbody>
25231 </tgroup>
25232 </informaltable>
25233 <para>
25234 <indexterm role="concept">
25235 <primary>queueing incoming messages</primary>
25236 </indexterm>
25237 When this option is true, the <option>-od</option><emphasis>x</emphasis> command line options override the
25238 setting of <option>queue_only</option> or <option>queue_only_file</option> in the configuration file. If
25239 <option>queue_only_override</option> is set false, the <option>-od</option><emphasis>x</emphasis> options cannot be used
25240 to override; they are accepted, but ignored.
25241 </para>
25242 <para>
25243 <indexterm role="option">
25244 <primary><option>queue_run_in_order</option></primary>
25245 </indexterm>
25246 </para>
25247 <informaltable frame="all">
25248 <tgroup cols="4" colsep="0" rowsep="0">
25249 <colspec colwidth="8*" align="left"/>
25250 <colspec colwidth="6*" align="center"/>
25251 <colspec colwidth="6*" align="center"/>
25252 <colspec colwidth="6*" align="right"/>
25253 <tbody>
25254 <row>
25255 <entry><option>queue_run_in_order</option></entry>
25256 <entry>Use: <emphasis>main</emphasis></entry>
25257 <entry>Type: <emphasis>boolean</emphasis></entry>
25258 <entry>Default: <emphasis>false</emphasis></entry>
25259 </row>
25260 </tbody>
25261 </tgroup>
25262 </informaltable>
25263 <para>
25264 <indexterm role="concept">
25265 <primary>queue runner</primary>
25266 <secondary>processing messages in order</secondary>
25267 </indexterm>
25268 If this option is set, queue runs happen in order of message arrival instead of
25269 in an arbitrary order. For this to happen, a complete list of the entire queue
25270 must be set up before the deliveries start. When the queue is all held in a
25271 single directory (the default), a single list is created for both the ordered
25272 and the non-ordered cases. However, if <option>split_spool_directory</option> is set, a
25273 single list is not created when <option>queue_run_in_order</option> is false. In this case,
25274 the sub-directories are processed one at a time (in a random order), and this
25275 avoids setting up one huge list for the whole queue. Thus, setting
25276 <option>queue_run_in_order</option> with <option>split_spool_directory</option> may degrade performance
25277 when the queue is large, because of the extra work in setting up the single,
25278 large list. In most situations, <option>queue_run_in_order</option> should not be set.
25279 </para>
25280 <para>
25281 <indexterm role="option">
25282 <primary><option>queue_run_max</option></primary>
25283 </indexterm>
25284 </para>
25285 <informaltable frame="all">
25286 <tgroup cols="4" colsep="0" rowsep="0">
25287 <colspec colwidth="8*" align="left"/>
25288 <colspec colwidth="6*" align="center"/>
25289 <colspec colwidth="6*" align="center"/>
25290 <colspec colwidth="6*" align="right"/>
25291 <tbody>
25292 <row>
25293 <entry><option>queue_run_max</option></entry>
25294 <entry>Use: <emphasis>main</emphasis></entry>
25295 <entry>Type: <emphasis>integer</emphasis></entry>
25296 <entry>Default: <emphasis>5</emphasis></entry>
25297 </row>
25298 </tbody>
25299 </tgroup>
25300 </informaltable>
25301 <para>
25302 <indexterm role="concept">
25303 <primary>queue runner</primary>
25304 <secondary>maximum number of</secondary>
25305 </indexterm>
25306 This controls the maximum number of queue runner processes that an Exim daemon
25307 can run simultaneously. This does not mean that it starts them all at once,
25308 but rather that if the maximum number are still running when the time comes to
25309 start another one, it refrains from starting another one. This can happen with
25310 very large queues and/or very sluggish deliveries. This option does not,
25311 however, interlock with other processes, so additional queue runners can be
25312 started by other means, or by killing and restarting the daemon.
25313 </para>
25314 <para>
25315 Setting this option to zero does not suppress queue runs; rather, it disables
25316 the limit, allowing any number of simultaneous queue runner processes to be
25317 run. If you do not want queue runs to occur, omit the <option>-q</option><emphasis>xx</emphasis> setting on
25318 the daemon&#x2019;s command line.
25319 </para>
25320 <para>
25321 <indexterm role="option">
25322 <primary><option>queue_smtp_domains</option></primary>
25323 </indexterm>
25324 </para>
25325 <informaltable frame="all">
25326 <tgroup cols="4" colsep="0" rowsep="0">
25327 <colspec colwidth="8*" align="left"/>
25328 <colspec colwidth="6*" align="center"/>
25329 <colspec colwidth="6*" align="center"/>
25330 <colspec colwidth="6*" align="right"/>
25331 <tbody>
25332 <row>
25333 <entry><option>queue_smtp_domains</option></entry>
25334 <entry>Use: <emphasis>main</emphasis></entry>
25335 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
25336 <entry>Default: <emphasis>unset</emphasis></entry>
25337 </row>
25338 </tbody>
25339 </tgroup>
25340 </informaltable>
25341 <para>
25342 <indexterm role="concept">
25343 <primary>queueing incoming messages</primary>
25344 </indexterm>
25345 <indexterm role="concept">
25346 <primary>message</primary>
25347 <secondary>queueing remote deliveries</secondary>
25348 </indexterm>
25349 When this option is set, a delivery process is started whenever a message is
25350 received, routing is performed, and local deliveries take place.
25351 However, if any SMTP deliveries are required for domains that match
25352 <option>queue_smtp_domains</option>, they are not immediately delivered, but instead the
25353 message waits on the queue for the next queue run. Since routing of the message
25354 has taken place, Exim knows to which remote hosts it must be delivered, and so
25355 when the queue run happens, multiple messages for the same host are delivered
25356 over a single SMTP connection. The <option>-odqs</option> command line option causes all
25357 SMTP deliveries to be queued in this way, and is equivalent to setting
25358 <option>queue_smtp_domains</option> to <quote>*</quote>. See also <option>hold_domains</option> and
25359 <option>queue_domains</option>.
25360 </para>
25361 <para>
25362 <indexterm role="option">
25363 <primary><option>receive_timeout</option></primary>
25364 </indexterm>
25365 </para>
25366 <informaltable frame="all">
25367 <tgroup cols="4" colsep="0" rowsep="0">
25368 <colspec colwidth="8*" align="left"/>
25369 <colspec colwidth="6*" align="center"/>
25370 <colspec colwidth="6*" align="center"/>
25371 <colspec colwidth="6*" align="right"/>
25372 <tbody>
25373 <row>
25374 <entry><option>receive_timeout</option></entry>
25375 <entry>Use: <emphasis>main</emphasis></entry>
25376 <entry>Type: <emphasis>time</emphasis></entry>
25377 <entry>Default: <emphasis>0s</emphasis></entry>
25378 </row>
25379 </tbody>
25380 </tgroup>
25381 </informaltable>
25382 <para>
25383 <indexterm role="concept">
25384 <primary>timeout</primary>
25385 <secondary>for non-SMTP input</secondary>
25386 </indexterm>
25387 This option sets the timeout for accepting a non-SMTP message, that is, the
25388 maximum time that Exim waits when reading a message on the standard input. If
25389 the value is zero, it will wait for ever. This setting is overridden by the
25390 <option>-or</option> command line option. The timeout for incoming SMTP messages is
25391 controlled by <option>smtp_receive_timeout</option>.
25392 </para>
25393 <para>
25394 <indexterm role="option">
25395 <primary><option>received_header_text</option></primary>
25396 </indexterm>
25397 </para>
25398 <informaltable frame="all">
25399 <tgroup cols="4" colsep="0" rowsep="0">
25400 <colspec colwidth="8*" align="left"/>
25401 <colspec colwidth="6*" align="center"/>
25402 <colspec colwidth="6*" align="center"/>
25403 <colspec colwidth="6*" align="right"/>
25404 <tbody>
25405 <row>
25406 <entry><option>received_header_text</option></entry>
25407 <entry>Use: <emphasis>main</emphasis></entry>
25408 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25409 <entry>Default: <emphasis>see below</emphasis></entry>
25410 </row>
25411 </tbody>
25412 </tgroup>
25413 </informaltable>
25414 <para>
25415 <indexterm role="concept">
25416 <primary>customizing</primary>
25417 <secondary><emphasis>Received:</emphasis> header</secondary>
25418 </indexterm>
25419 <indexterm role="concept">
25420 <primary><emphasis>Received:</emphasis> header line</primary>
25421 <secondary>customizing</secondary>
25422 </indexterm>
25423 This string defines the contents of the <emphasis>Received:</emphasis> message header that is
25424 added to each message, except for the timestamp, which is automatically added
25425 on at the end (preceded by a semicolon). The string is expanded each time it is
25426 used. If the expansion yields an empty string, no <emphasis>Received:</emphasis> header line is
25427 added to the message. Otherwise, the string should start with the text
25428 <quote>Received:</quote> and conform to the RFC 2822 specification for <emphasis>Received:</emphasis>
25429 header lines. The default setting is:
25430 </para>
25431 <literallayout class="monospaced">
25432 received_header_text = Received: \
25433   ${if def:sender_rcvhost {from $sender_rcvhost\n\t}\
25434   {${if def:sender_ident \
25435   {from ${quote_local_part:$sender_ident} }}\
25436   ${if def:sender_helo_name {(helo=$sender_helo_name)\n\t}}}}\
25437   by $primary_hostname \
25438   ${if def:received_protocol {with $received_protocol}} \
25439   ${if def:tls_cipher {($tls_cipher)\n\t}}\
25440   (Exim $version_number)\n\t\
25441   ${if def:sender_address \
25442   {(envelope-from &lt;$sender_address&gt;)\n\t}}\
25443   id $message_exim_id\
25444   ${if def:received_for {\n\tfor $received_for}}
25445 </literallayout>
25446 <para>
25447 The reference to the TLS cipher is omitted when Exim is built without TLS
25448 support. The use of conditional expansions ensures that this works for both
25449 locally generated messages and messages received from remote hosts, giving
25450 header lines such as the following:
25451 </para>
25452 <literallayout class="monospaced">
25453 Received: from scrooge.carol.example ([192.168.12.25] ident=root)
25454 by marley.carol.example with esmtp (Exim 4.00)
25455 (envelope-from &lt;bob@carol.example&gt;)
25456 id 16IOWa-00019l-00
25457 for chas@dickens.example; Tue, 25 Dec 2001 14:43:44 +0000
25458 Received: by scrooge.carol.example with local (Exim 4.00)
25459 id 16IOWW-000083-00; Tue, 25 Dec 2001 14:43:41 +0000
25460 </literallayout>
25461 <para>
25462 Until the body of the message has been received, the timestamp is the time when
25463 the message started to be received. Once the body has arrived, and all policy
25464 checks have taken place, the timestamp is updated to the time at which the
25465 message was accepted.
25466 </para>
25467 <para>
25468 <indexterm role="option">
25469 <primary><option>received_headers_max</option></primary>
25470 </indexterm>
25471 </para>
25472 <informaltable frame="all">
25473 <tgroup cols="4" colsep="0" rowsep="0">
25474 <colspec colwidth="8*" align="left"/>
25475 <colspec colwidth="6*" align="center"/>
25476 <colspec colwidth="6*" align="center"/>
25477 <colspec colwidth="6*" align="right"/>
25478 <tbody>
25479 <row>
25480 <entry><option>received_headers_max</option></entry>
25481 <entry>Use: <emphasis>main</emphasis></entry>
25482 <entry>Type: <emphasis>integer</emphasis></entry>
25483 <entry>Default: <emphasis>30</emphasis></entry>
25484 </row>
25485 </tbody>
25486 </tgroup>
25487 </informaltable>
25488 <para>
25489 <indexterm role="concept">
25490 <primary>loop</primary>
25491 <secondary>prevention</secondary>
25492 </indexterm>
25493 <indexterm role="concept">
25494 <primary>mail loop prevention</primary>
25495 </indexterm>
25496 <indexterm role="concept">
25497 <primary><emphasis>Received:</emphasis> header line</primary>
25498 <secondary>counting</secondary>
25499 </indexterm>
25500 When a message is to be delivered, the number of <emphasis>Received:</emphasis> headers is
25501 counted, and if it is greater than this parameter, a mail loop is assumed to
25502 have occurred, the delivery is abandoned, and an error message is generated.
25503 This applies to both local and remote deliveries.
25504 </para>
25505 <para>
25506 <indexterm role="option">
25507 <primary><option>recipient_unqualified_hosts</option></primary>
25508 </indexterm>
25509 </para>
25510 <informaltable frame="all">
25511 <tgroup cols="4" colsep="0" rowsep="0">
25512 <colspec colwidth="8*" align="left"/>
25513 <colspec colwidth="6*" align="center"/>
25514 <colspec colwidth="6*" align="center"/>
25515 <colspec colwidth="6*" align="right"/>
25516 <tbody>
25517 <row>
25518 <entry><option>recipient_unqualified_hosts</option></entry>
25519 <entry>Use: <emphasis>main</emphasis></entry>
25520 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
25521 <entry>Default: <emphasis>unset</emphasis></entry>
25522 </row>
25523 </tbody>
25524 </tgroup>
25525 </informaltable>
25526 <para>
25527 <indexterm role="concept">
25528 <primary>unqualified addresses</primary>
25529 </indexterm>
25530 <indexterm role="concept">
25531 <primary>host</primary>
25532 <secondary>unqualified addresses from</secondary>
25533 </indexterm>
25534 This option lists those hosts from which Exim is prepared to accept unqualified
25535 recipient addresses in message envelopes. The addresses are made fully
25536 qualified by the addition of the <option>qualify_recipient</option> value. This option also
25537 affects message header lines. Exim does not reject unqualified recipient
25538 addresses in headers, but it qualifies them only if the message came from a
25539 host that matches <option>recipient_unqualified_hosts</option>,
25540 or if the message was submitted locally (not using TCP/IP), and the <option>-bnq</option>
25541 option was not set.
25542 </para>
25543 <para>
25544 <indexterm role="option">
25545 <primary><option>recipients_max</option></primary>
25546 </indexterm>
25547 </para>
25548 <informaltable frame="all">
25549 <tgroup cols="4" colsep="0" rowsep="0">
25550 <colspec colwidth="8*" align="left"/>
25551 <colspec colwidth="6*" align="center"/>
25552 <colspec colwidth="6*" align="center"/>
25553 <colspec colwidth="6*" align="right"/>
25554 <tbody>
25555 <row>
25556 <entry><option>recipients_max</option></entry>
25557 <entry>Use: <emphasis>main</emphasis></entry>
25558 <entry>Type: <emphasis>integer</emphasis></entry>
25559 <entry>Default: <emphasis>0</emphasis></entry>
25560 </row>
25561 </tbody>
25562 </tgroup>
25563 </informaltable>
25564 <para>
25565 <indexterm role="concept">
25566 <primary>limit</primary>
25567 <secondary>number of recipients</secondary>
25568 </indexterm>
25569 <indexterm role="concept">
25570 <primary>recipient</primary>
25571 <secondary>maximum number</secondary>
25572 </indexterm>
25573 If this option is set greater than zero, it specifies the maximum number of
25574 original recipients for any message. Additional recipients that are generated
25575 by aliasing or forwarding do not count. SMTP messages get a 452 response for
25576 all recipients over the limit; earlier recipients are delivered as normal.
25577 Non-SMTP messages with too many recipients are failed, and no deliveries are
25578 done.
25579 </para>
25580 <para>
25581 <indexterm role="concept">
25582 <primary>RCPT</primary>
25583 <secondary>maximum number of incoming</secondary>
25584 </indexterm>
25585 <emphasis role="bold">Note</emphasis>: The RFCs specify that an SMTP server should accept at least 100
25586 RCPT commands in a single message.
25587 </para>
25588 <para>
25589 <indexterm role="option">
25590 <primary><option>recipients_max_reject</option></primary>
25591 </indexterm>
25592 </para>
25593 <informaltable frame="all">
25594 <tgroup cols="4" colsep="0" rowsep="0">
25595 <colspec colwidth="8*" align="left"/>
25596 <colspec colwidth="6*" align="center"/>
25597 <colspec colwidth="6*" align="center"/>
25598 <colspec colwidth="6*" align="right"/>
25599 <tbody>
25600 <row>
25601 <entry><option>recipients_max_reject</option></entry>
25602 <entry>Use: <emphasis>main</emphasis></entry>
25603 <entry>Type: <emphasis>boolean</emphasis></entry>
25604 <entry>Default: <emphasis>false</emphasis></entry>
25605 </row>
25606 </tbody>
25607 </tgroup>
25608 </informaltable>
25609 <para>
25610 If this option is set true, Exim rejects SMTP messages containing too many
25611 recipients by giving 552 errors to the surplus RCPT commands, and a 554
25612 error to the eventual DATA command. Otherwise (the default) it gives a 452
25613 error to the surplus RCPT commands and accepts the message on behalf of the
25614 initial set of recipients. The remote server should then re-send the message
25615 for the remaining recipients at a later time.
25616 </para>
25617 <para>
25618 <indexterm role="option">
25619 <primary><option>remote_max_parallel</option></primary>
25620 </indexterm>
25621 </para>
25622 <informaltable frame="all">
25623 <tgroup cols="4" colsep="0" rowsep="0">
25624 <colspec colwidth="8*" align="left"/>
25625 <colspec colwidth="6*" align="center"/>
25626 <colspec colwidth="6*" align="center"/>
25627 <colspec colwidth="6*" align="right"/>
25628 <tbody>
25629 <row>
25630 <entry><option>remote_max_parallel</option></entry>
25631 <entry>Use: <emphasis>main</emphasis></entry>
25632 <entry>Type: <emphasis>integer</emphasis></entry>
25633 <entry>Default: <emphasis>2</emphasis></entry>
25634 </row>
25635 </tbody>
25636 </tgroup>
25637 </informaltable>
25638 <para>
25639 <indexterm role="concept">
25640 <primary>delivery</primary>
25641 <secondary>parallelism for remote</secondary>
25642 </indexterm>
25643 This option controls parallel delivery of one message to a number of remote
25644 hosts. If the value is less than 2, parallel delivery is disabled, and Exim
25645 does all the remote deliveries for a message one by one. Otherwise, if a single
25646 message has to be delivered to more than one remote host, or if several copies
25647 have to be sent to the same remote host, up to <option>remote_max_parallel</option>
25648 deliveries are done simultaneously. If more than <option>remote_max_parallel</option>
25649 deliveries are required, the maximum number of processes are started, and as
25650 each one finishes, another is begun. The order of starting processes is the
25651 same as if sequential delivery were being done, and can be controlled by the
25652 <option>remote_sort_domains</option> option. If parallel delivery takes place while running
25653 with debugging turned on, the debugging output from each delivery process is
25654 tagged with its process id.
25655 </para>
25656 <para>
25657 This option controls only the maximum number of parallel deliveries for one
25658 message in one Exim delivery process. Because Exim has no central queue
25659 manager, there is no way of controlling the total number of simultaneous
25660 deliveries if the configuration allows a delivery attempt as soon as a message
25661 is received.
25662 </para>
25663 <para>
25664 <indexterm role="concept">
25665 <primary>number of deliveries</primary>
25666 </indexterm>
25667 <indexterm role="concept">
25668 <primary>delivery</primary>
25669 <secondary>maximum number of</secondary>
25670 </indexterm>
25671 If you want to control the total number of deliveries on the system, you
25672 need to set the <option>queue_only</option> option. This ensures that all incoming messages
25673 are added to the queue without starting a delivery process. Then set up an Exim
25674 daemon to start queue runner processes at appropriate intervals (probably
25675 fairly often, for example, every minute), and limit the total number of queue
25676 runners by setting the <option>queue_run_max</option> parameter. Because each queue runner
25677 delivers only one message at a time, the maximum number of deliveries that can
25678 then take place at once is <option>queue_run_max</option> multiplied by
25679 <option>remote_max_parallel</option>.
25680 </para>
25681 <para>
25682 If it is purely remote deliveries you want to control, use
25683 <option>queue_smtp_domains</option> instead of <option>queue_only</option>. This has the added benefit of
25684 doing the SMTP routing before queueing, so that several messages for the same
25685 host will eventually get delivered down the same connection.
25686 </para>
25687 <para>
25688 <indexterm role="option">
25689 <primary><option>remote_sort_domains</option></primary>
25690 </indexterm>
25691 </para>
25692 <informaltable frame="all">
25693 <tgroup cols="4" colsep="0" rowsep="0">
25694 <colspec colwidth="8*" align="left"/>
25695 <colspec colwidth="6*" align="center"/>
25696 <colspec colwidth="6*" align="center"/>
25697 <colspec colwidth="6*" align="right"/>
25698 <tbody>
25699 <row>
25700 <entry><option>remote_sort_domains</option></entry>
25701 <entry>Use: <emphasis>main</emphasis></entry>
25702 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
25703 <entry>Default: <emphasis>unset</emphasis></entry>
25704 </row>
25705 </tbody>
25706 </tgroup>
25707 </informaltable>
25708 <para>
25709 <indexterm role="concept">
25710 <primary>sorting remote deliveries</primary>
25711 </indexterm>
25712 <indexterm role="concept">
25713 <primary>delivery</primary>
25714 <secondary>sorting remote</secondary>
25715 </indexterm>
25716 When there are a number of remote deliveries for a message, they are sorted by
25717 domain into the order given by this list. For example,
25718 </para>
25719 <literallayout class="monospaced">
25720 remote_sort_domains = *.cam.ac.uk:*.uk
25721 </literallayout>
25722 <para>
25723 would attempt to deliver to all addresses in the <emphasis>cam.ac.uk</emphasis> domain first,
25724 then to those in the <option>uk</option> domain, then to any others.
25725 </para>
25726 <para>
25727 <indexterm role="option">
25728 <primary><option>retry_data_expire</option></primary>
25729 </indexterm>
25730 </para>
25731 <informaltable frame="all">
25732 <tgroup cols="4" colsep="0" rowsep="0">
25733 <colspec colwidth="8*" align="left"/>
25734 <colspec colwidth="6*" align="center"/>
25735 <colspec colwidth="6*" align="center"/>
25736 <colspec colwidth="6*" align="right"/>
25737 <tbody>
25738 <row>
25739 <entry><option>retry_data_expire</option></entry>
25740 <entry>Use: <emphasis>main</emphasis></entry>
25741 <entry>Type: <emphasis>time</emphasis></entry>
25742 <entry>Default: <emphasis>7d</emphasis></entry>
25743 </row>
25744 </tbody>
25745 </tgroup>
25746 </informaltable>
25747 <para>
25748 <indexterm role="concept">
25749 <primary>hints database</primary>
25750 <secondary>data expiry</secondary>
25751 </indexterm>
25752 This option sets a <quote>use before</quote> time on retry information in Exim&#x2019;s hints
25753 database. Any older retry data is ignored. This means that, for example, once a
25754 host has not been tried for 7 days, Exim behaves as if it has no knowledge of
25755 past failures.
25756 </para>
25757 <para>
25758 <indexterm role="option">
25759 <primary><option>retry_interval_max</option></primary>
25760 </indexterm>
25761 </para>
25762 <informaltable frame="all">
25763 <tgroup cols="4" colsep="0" rowsep="0">
25764 <colspec colwidth="8*" align="left"/>
25765 <colspec colwidth="6*" align="center"/>
25766 <colspec colwidth="6*" align="center"/>
25767 <colspec colwidth="6*" align="right"/>
25768 <tbody>
25769 <row>
25770 <entry><option>retry_interval_max</option></entry>
25771 <entry>Use: <emphasis>main</emphasis></entry>
25772 <entry>Type: <emphasis>time</emphasis></entry>
25773 <entry>Default: <emphasis>24h</emphasis></entry>
25774 </row>
25775 </tbody>
25776 </tgroup>
25777 </informaltable>
25778 <para>
25779 <indexterm role="concept">
25780 <primary>retry</primary>
25781 <secondary>limit on interval</secondary>
25782 </indexterm>
25783 <indexterm role="concept">
25784 <primary>limit</primary>
25785 <secondary>on retry interval</secondary>
25786 </indexterm>
25787 Chapter <xref linkend="CHAPretry"/> describes Exim&#x2019;s mechanisms for controlling the
25788 intervals between delivery attempts for messages that cannot be delivered
25789 straight away. This option sets an overall limit to the length of time between
25790 retries. It cannot be set greater than 24 hours; any attempt to do so forces
25791 the default value.
25792 </para>
25793 <para>
25794 <indexterm role="option">
25795 <primary><option>return_path_remove</option></primary>
25796 </indexterm>
25797 </para>
25798 <informaltable frame="all">
25799 <tgroup cols="4" colsep="0" rowsep="0">
25800 <colspec colwidth="8*" align="left"/>
25801 <colspec colwidth="6*" align="center"/>
25802 <colspec colwidth="6*" align="center"/>
25803 <colspec colwidth="6*" align="right"/>
25804 <tbody>
25805 <row>
25806 <entry><option>return_path_remove</option></entry>
25807 <entry>Use: <emphasis>main</emphasis></entry>
25808 <entry>Type: <emphasis>boolean</emphasis></entry>
25809 <entry>Default: <emphasis>true</emphasis></entry>
25810 </row>
25811 </tbody>
25812 </tgroup>
25813 </informaltable>
25814 <para>
25815 <indexterm role="concept">
25816 <primary><emphasis>Return-path:</emphasis> header line</primary>
25817 <secondary>removing</secondary>
25818 </indexterm>
25819 RFC 2821, section 4.4, states that an SMTP server must insert a
25820 <emphasis>Return-path:</emphasis> header line into a message when it makes a <quote>final delivery</quote>.
25821 The <emphasis>Return-path:</emphasis> header preserves the sender address as received in the
25822 MAIL command. This description implies that this header should not be present
25823 in an incoming message. If <option>return_path_remove</option> is true, any existing
25824 <emphasis>Return-path:</emphasis> headers are removed from messages at the time they are
25825 received. Exim&#x2019;s transports have options for adding <emphasis>Return-path:</emphasis> headers at
25826 the time of delivery. They are normally used only for final local deliveries.
25827 </para>
25828 <para>
25829 <indexterm role="option">
25830 <primary><option>return_size_limit</option></primary>
25831 </indexterm>
25832 </para>
25833 <informaltable frame="all">
25834 <tgroup cols="4" colsep="0" rowsep="0">
25835 <colspec colwidth="8*" align="left"/>
25836 <colspec colwidth="6*" align="center"/>
25837 <colspec colwidth="6*" align="center"/>
25838 <colspec colwidth="6*" align="right"/>
25839 <tbody>
25840 <row>
25841 <entry><option>return_size_limit</option></entry>
25842 <entry>Use: <emphasis>main</emphasis></entry>
25843 <entry>Type: <emphasis>integer</emphasis></entry>
25844 <entry>Default: <emphasis>100K</emphasis></entry>
25845 </row>
25846 </tbody>
25847 </tgroup>
25848 </informaltable>
25849 <para>
25850 This option is an obsolete synonym for <option>bounce_return_size_limit</option>.
25851 </para>
25852 <para>
25853 <indexterm role="option">
25854 <primary><option>rfc1413_hosts</option></primary>
25855 </indexterm>
25856 </para>
25857 <informaltable frame="all">
25858 <tgroup cols="4" colsep="0" rowsep="0">
25859 <colspec colwidth="8*" align="left"/>
25860 <colspec colwidth="6*" align="center"/>
25861 <colspec colwidth="6*" align="center"/>
25862 <colspec colwidth="6*" align="right"/>
25863 <tbody>
25864 <row>
25865 <entry><option>rfc1413_hosts</option></entry>
25866 <entry>Use: <emphasis>main</emphasis></entry>
25867 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
25868 <entry>Default: <emphasis>*</emphasis></entry>
25869 </row>
25870 </tbody>
25871 </tgroup>
25872 </informaltable>
25873 <para>
25874 <indexterm role="concept">
25875 <primary>RFC 1413</primary>
25876 </indexterm>
25877 <indexterm role="concept">
25878 <primary>host</primary>
25879 <secondary>for RFC 1413 calls</secondary>
25880 </indexterm>
25881 RFC 1413 identification calls are made to any client host which matches an item
25882 in the list.
25883 </para>
25884 <para>
25885 <indexterm role="option">
25886 <primary><option>rfc1413_query_timeout</option></primary>
25887 </indexterm>
25888 </para>
25889 <informaltable frame="all">
25890 <tgroup cols="4" colsep="0" rowsep="0">
25891 <colspec colwidth="8*" align="left"/>
25892 <colspec colwidth="6*" align="center"/>
25893 <colspec colwidth="6*" align="center"/>
25894 <colspec colwidth="6*" align="right"/>
25895 <tbody>
25896 <row>
25897 <entry><option>rfc1413_query_timeout</option></entry>
25898 <entry>Use: <emphasis>main</emphasis></entry>
25899 <entry>Type: <emphasis>time</emphasis></entry>
25900 <entry>Default: <emphasis>5s</emphasis></entry>
25901 </row>
25902 </tbody>
25903 </tgroup>
25904 </informaltable>
25905 <para>
25906 <indexterm role="concept">
25907 <primary>RFC 1413</primary>
25908 <secondary>query timeout</secondary>
25909 </indexterm>
25910 <indexterm role="concept">
25911 <primary>timeout</primary>
25912 <secondary>for RFC 1413 call</secondary>
25913 </indexterm>
25914 This sets the timeout on RFC 1413 identification calls. If it is set to zero,
25915 no RFC 1413 calls are ever made.
25916 </para>
25917 <para>
25918 <indexterm role="option">
25919 <primary><option>sender_unqualified_hosts</option></primary>
25920 </indexterm>
25921 </para>
25922 <informaltable frame="all">
25923 <tgroup cols="4" colsep="0" rowsep="0">
25924 <colspec colwidth="8*" align="left"/>
25925 <colspec colwidth="6*" align="center"/>
25926 <colspec colwidth="6*" align="center"/>
25927 <colspec colwidth="6*" align="right"/>
25928 <tbody>
25929 <row>
25930 <entry><option>sender_unqualified_hosts</option></entry>
25931 <entry>Use: <emphasis>main</emphasis></entry>
25932 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
25933 <entry>Default: <emphasis>unset</emphasis></entry>
25934 </row>
25935 </tbody>
25936 </tgroup>
25937 </informaltable>
25938 <para>
25939 <indexterm role="concept">
25940 <primary>unqualified addresses</primary>
25941 </indexterm>
25942 <indexterm role="concept">
25943 <primary>host</primary>
25944 <secondary>unqualified addresses from</secondary>
25945 </indexterm>
25946 This option lists those hosts from which Exim is prepared to accept unqualified
25947 sender addresses. The addresses are made fully qualified by the addition of
25948 <option>qualify_domain</option>. This option also affects message header lines. Exim does
25949 not reject unqualified addresses in headers that contain sender addresses, but
25950 it qualifies them only if the message came from a host that matches
25951 <option>sender_unqualified_hosts</option>, or if the message was submitted locally (not
25952 using TCP/IP), and the <option>-bnq</option> option was not set.
25953 </para>
25954 <para>
25955 <indexterm role="option">
25956 <primary><option>smtp_accept_keepalive</option></primary>
25957 </indexterm>
25958 </para>
25959 <informaltable frame="all">
25960 <tgroup cols="4" colsep="0" rowsep="0">
25961 <colspec colwidth="8*" align="left"/>
25962 <colspec colwidth="6*" align="center"/>
25963 <colspec colwidth="6*" align="center"/>
25964 <colspec colwidth="6*" align="right"/>
25965 <tbody>
25966 <row>
25967 <entry><option>smtp_accept_keepalive</option></entry>
25968 <entry>Use: <emphasis>main</emphasis></entry>
25969 <entry>Type: <emphasis>boolean</emphasis></entry>
25970 <entry>Default: <emphasis>true</emphasis></entry>
25971 </row>
25972 </tbody>
25973 </tgroup>
25974 </informaltable>
25975 <para>
25976 <indexterm role="concept">
25977 <primary>keepalive</primary>
25978 <secondary>on incoming connection</secondary>
25979 </indexterm>
25980 This option controls the setting of the SO_KEEPALIVE option on incoming
25981 TCP/IP socket connections. When set, it causes the kernel to probe idle
25982 connections periodically, by sending packets with <quote>old</quote> sequence numbers. The
25983 other end of the connection should send an acknowledgment if the connection is
25984 still okay or a reset if the connection has been aborted. The reason for doing
25985 this is that it has the beneficial effect of freeing up certain types of
25986 connection that can get stuck when the remote host is disconnected without
25987 tidying up the TCP/IP call properly. The keepalive mechanism takes several
25988 hours to detect unreachable hosts.
25989 </para>
25990 <para>
25991 <indexterm role="option">
25992 <primary><option>smtp_accept_max</option></primary>
25993 </indexterm>
25994 </para>
25995 <informaltable frame="all">
25996 <tgroup cols="4" colsep="0" rowsep="0">
25997 <colspec colwidth="8*" align="left"/>
25998 <colspec colwidth="6*" align="center"/>
25999 <colspec colwidth="6*" align="center"/>
26000 <colspec colwidth="6*" align="right"/>
26001 <tbody>
26002 <row>
26003 <entry><option>smtp_accept_max</option></entry>
26004 <entry>Use: <emphasis>main</emphasis></entry>
26005 <entry>Type: <emphasis>integer</emphasis></entry>
26006 <entry>Default: <emphasis>20</emphasis></entry>
26007 </row>
26008 </tbody>
26009 </tgroup>
26010 </informaltable>
26011 <para>
26012 <indexterm role="concept">
26013 <primary>limit</primary>
26014 <secondary>incoming SMTP connections</secondary>
26015 </indexterm>
26016 <indexterm role="concept">
26017 <primary>SMTP</primary>
26018 <secondary>incoming connection count</secondary>
26019 </indexterm>
26020 <indexterm role="concept">
26021 <primary>inetd</primary>
26022 </indexterm>
26023 This option specifies the maximum number of simultaneous incoming SMTP calls
26024 that Exim will accept. It applies only to the listening daemon; there is no
26025 control (in Exim) when incoming SMTP is being handled by <emphasis>inetd</emphasis>. If the
26026 value is set to zero, no limit is applied. However, it is required to be
26027 non-zero if either <option>smtp_accept_max_per_host</option> or <option>smtp_accept_queue</option> is
26028 set. See also <option>smtp_accept_reserve</option> and <option>smtp_load_reserve</option>.
26029 </para>
26030 <para>
26031 A new SMTP connection is immediately rejected if the <option>smtp_accept_max</option> limit
26032 has been reached. If not, Exim first checks <option>smtp_accept_max_per_host</option>. If
26033 that limit has not been reached for the client host, <option>smtp_accept_reserve</option>
26034 and <option>smtp_load_reserve</option> are then checked before accepting the connection.
26035 </para>
26036 <para>
26037 <indexterm role="option">
26038 <primary><option>smtp_accept_max_nonmail</option></primary>
26039 </indexterm>
26040 </para>
26041 <informaltable frame="all">
26042 <tgroup cols="4" colsep="0" rowsep="0">
26043 <colspec colwidth="8*" align="left"/>
26044 <colspec colwidth="6*" align="center"/>
26045 <colspec colwidth="6*" align="center"/>
26046 <colspec colwidth="6*" align="right"/>
26047 <tbody>
26048 <row>
26049 <entry><option>smtp_accept_max_nonmail</option></entry>
26050 <entry>Use: <emphasis>main</emphasis></entry>
26051 <entry>Type: <emphasis>integer</emphasis></entry>
26052 <entry>Default: <emphasis>10</emphasis></entry>
26053 </row>
26054 </tbody>
26055 </tgroup>
26056 </informaltable>
26057 <para>
26058 <indexterm role="concept">
26059 <primary>limit</primary>
26060 <secondary>non-mail SMTP commands</secondary>
26061 </indexterm>
26062 <indexterm role="concept">
26063 <primary>SMTP</primary>
26064 <secondary>limiting non-mail commands</secondary>
26065 </indexterm>
26066 Exim counts the number of <quote>non-mail</quote> commands in an SMTP session, and drops
26067 the connection if there are too many. This option defines <quote>too many</quote>. The
26068 check catches some denial-of-service attacks, repeated failing AUTHs, or a mad
26069 client looping sending EHLO, for example. The check is applied only if the
26070 client host matches <option>smtp_accept_max_nonmail_hosts</option>.
26071 </para>
26072 <para>
26073 When a new message is expected, one occurrence of RSET is not counted. This
26074 allows a client to send one RSET between messages (this is not necessary,
26075 but some clients do it). Exim also allows one uncounted occurrence of HELO
26076 or EHLO, and one occurrence of STARTTLS between messages. After
26077 starting up a TLS session, another EHLO is expected, and so it too is not
26078 counted. The first occurrence of AUTH in a connection, or immediately
26079 following STARTTLS is not counted. Otherwise, all commands other than
26080 MAIL, RCPT, DATA, and QUIT are counted.
26081 </para>
26082 <para>
26083 <indexterm role="option">
26084 <primary><option>smtp_accept_max_nonmail_hosts</option></primary>
26085 </indexterm>
26086 </para>
26087 <informaltable frame="all">
26088 <tgroup cols="4" colsep="0" rowsep="0">
26089 <colspec colwidth="8*" align="left"/>
26090 <colspec colwidth="6*" align="center"/>
26091 <colspec colwidth="6*" align="center"/>
26092 <colspec colwidth="6*" align="right"/>
26093 <tbody>
26094 <row>
26095 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
26096 <entry>Use: <emphasis>main</emphasis></entry>
26097 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26098 <entry>Default: <emphasis>*</emphasis></entry>
26099 </row>
26100 </tbody>
26101 </tgroup>
26102 </informaltable>
26103 <para>
26104 You can control which hosts are subject to the <option>smtp_accept_max_nonmail</option>
26105 check by setting this option. The default value makes it apply to all hosts. By
26106 changing the value, you can exclude any badly-behaved hosts that you have to
26107 live with.
26108 </para>
26109 <para>
26110 <indexterm role="option">
26111 <primary><option>smtp_accept_max_per_connection</option></primary>
26112 </indexterm>
26113 </para>
26114 <informaltable frame="all">
26115 <tgroup cols="4" colsep="0" rowsep="0">
26116 <colspec colwidth="8*" align="left"/>
26117 <colspec colwidth="6*" align="center"/>
26118 <colspec colwidth="6*" align="center"/>
26119 <colspec colwidth="6*" align="right"/>
26120 <tbody>
26121 <row>
26122 <entry><option>smtp_accept_max_per_ &nbsp;&nbsp;connection</option></entry>
26123 <entry>Use: <emphasis>main</emphasis></entry>
26124 <entry>Type: <emphasis>integer</emphasis></entry>
26125 <entry>Default: <emphasis>1000</emphasis></entry>
26126 </row>
26127 </tbody>
26128 </tgroup>
26129 </informaltable>
26130 <para>
26131 <indexterm role="concept">
26132 <primary>SMTP</primary>
26133 <secondary>limiting incoming message count</secondary>
26134 </indexterm>
26135 <indexterm role="concept">
26136 <primary>limit</primary>
26137 <secondary>messages per SMTP connection</secondary>
26138 </indexterm>
26139 The value of this option limits the number of MAIL commands that Exim is
26140 prepared to accept over a single SMTP connection, whether or not each command
26141 results in the transfer of a message. After the limit is reached, a 421
26142 response is given to subsequent MAIL commands. This limit is a safety
26143 precaution against a client that goes mad (incidents of this type have been
26144 seen).
26145 </para>
26146 <para>
26147 <indexterm role="option">
26148 <primary><option>smtp_accept_max_per_host</option></primary>
26149 </indexterm>
26150 </para>
26151 <informaltable frame="all">
26152 <tgroup cols="4" colsep="0" rowsep="0">
26153 <colspec colwidth="8*" align="left"/>
26154 <colspec colwidth="6*" align="center"/>
26155 <colspec colwidth="6*" align="center"/>
26156 <colspec colwidth="6*" align="right"/>
26157 <tbody>
26158 <row>
26159 <entry><option>smtp_accept_max_per_host</option></entry>
26160 <entry>Use: <emphasis>main</emphasis></entry>
26161 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26162 <entry>Default: <emphasis>unset</emphasis></entry>
26163 </row>
26164 </tbody>
26165 </tgroup>
26166 </informaltable>
26167 <para>
26168 <indexterm role="concept">
26169 <primary>limit</primary>
26170 <secondary>SMTP connections from one host</secondary>
26171 </indexterm>
26172 <indexterm role="concept">
26173 <primary>host</primary>
26174 <secondary>limiting SMTP connections from</secondary>
26175 </indexterm>
26176 This option restricts the number of simultaneous IP connections from a single
26177 host (strictly, from a single IP address) to the Exim daemon. The option is
26178 expanded, to enable different limits to be applied to different hosts by
26179 reference to <varname>$sender_host_address</varname>. Once the limit is reached, additional
26180 connection attempts from the same host are rejected with error code 421. This
26181 is entirely independent of <option>smtp_accept_reserve</option>. The option&#x2019;s default value
26182 of zero imposes no limit. If this option is set greater than zero, it is
26183 required that <option>smtp_accept_max</option> be non-zero.
26184 </para>
26185 <para>
26186 <emphasis role="bold">Warning</emphasis>: When setting this option you should not use any expansion
26187 constructions that take an appreciable amount of time. The expansion and test
26188 happen in the main daemon loop, in order to reject additional connections
26189 without forking additional processes (otherwise a denial-of-service attack
26190 could cause a vast number or processes to be created). While the daemon is
26191 doing this processing, it cannot accept any other incoming connections.
26192 </para>
26193 <para>
26194 <indexterm role="option">
26195 <primary><option>smtp_accept_queue</option></primary>
26196 </indexterm>
26197 </para>
26198 <informaltable frame="all">
26199 <tgroup cols="4" colsep="0" rowsep="0">
26200 <colspec colwidth="8*" align="left"/>
26201 <colspec colwidth="6*" align="center"/>
26202 <colspec colwidth="6*" align="center"/>
26203 <colspec colwidth="6*" align="right"/>
26204 <tbody>
26205 <row>
26206 <entry><option>smtp_accept_queue</option></entry>
26207 <entry>Use: <emphasis>main</emphasis></entry>
26208 <entry>Type: <emphasis>integer</emphasis></entry>
26209 <entry>Default: <emphasis>0</emphasis></entry>
26210 </row>
26211 </tbody>
26212 </tgroup>
26213 </informaltable>
26214 <para>
26215 <indexterm role="concept">
26216 <primary>SMTP</primary>
26217 <secondary>incoming connection count</secondary>
26218 </indexterm>
26219 <indexterm role="concept">
26220 <primary>queueing incoming messages</primary>
26221 </indexterm>
26222 <indexterm role="concept">
26223 <primary>message</primary>
26224 <secondary>queueing by SMTP connection count</secondary>
26225 </indexterm>
26226 If the number of simultaneous incoming SMTP connections being handled via the
26227 listening daemon exceeds this value, messages received by SMTP are just placed
26228 on the queue; no delivery processes are started automatically. The count is
26229 fixed at the start of an SMTP connection. It cannot be updated in the
26230 subprocess that receives messages, and so the queueing or not queueing applies
26231 to all messages received in the same connection.
26232 </para>
26233 <para>
26234 A value of zero implies no limit, and clearly any non-zero value is useful only
26235 if it is less than the <option>smtp_accept_max</option> value (unless that is zero). See
26236 also <option>queue_only</option>, <option>queue_only_load</option>, <option>queue_smtp_domains</option>, and the
26237 various <option>-od</option><emphasis>x</emphasis> command line options.
26238 </para>
26239 <para>
26240 <indexterm role="option">
26241 <primary><option>smtp_accept_queue_per_connection</option></primary>
26242 </indexterm>
26243 </para>
26244 <informaltable frame="all">
26245 <tgroup cols="4" colsep="0" rowsep="0">
26246 <colspec colwidth="8*" align="left"/>
26247 <colspec colwidth="6*" align="center"/>
26248 <colspec colwidth="6*" align="center"/>
26249 <colspec colwidth="6*" align="right"/>
26250 <tbody>
26251 <row>
26252 <entry><option>smtp_accept_queue_per_ &nbsp;&nbsp;connection</option></entry>
26253 <entry>Use: <emphasis>main</emphasis></entry>
26254 <entry>Type: <emphasis>integer</emphasis></entry>
26255 <entry>Default: <emphasis>10</emphasis></entry>
26256 </row>
26257 </tbody>
26258 </tgroup>
26259 </informaltable>
26260 <para>
26261 <indexterm role="concept">
26262 <primary>queueing incoming messages</primary>
26263 </indexterm>
26264 <indexterm role="concept">
26265 <primary>message</primary>
26266 <secondary>queueing by message count</secondary>
26267 </indexterm>
26268 This option limits the number of delivery processes that Exim starts
26269 automatically when receiving messages via SMTP, whether via the daemon or by
26270 the use of <option>-bs</option> or <option>-bS</option>. If the value of the option is greater than zero,
26271 and the number of messages received in a single SMTP session exceeds this
26272 number, subsequent messages are placed on the queue, but no delivery processes
26273 are started. This helps to limit the number of Exim processes when a server
26274 restarts after downtime and there is a lot of mail waiting for it on other
26275 systems. On large systems, the default should probably be increased, and on
26276 dial-in client systems it should probably be set to zero (that is, disabled).
26277 </para>
26278 <para>
26279 <indexterm role="option">
26280 <primary><option>smtp_accept_reserve</option></primary>
26281 </indexterm>
26282 </para>
26283 <informaltable frame="all">
26284 <tgroup cols="4" colsep="0" rowsep="0">
26285 <colspec colwidth="8*" align="left"/>
26286 <colspec colwidth="6*" align="center"/>
26287 <colspec colwidth="6*" align="center"/>
26288 <colspec colwidth="6*" align="right"/>
26289 <tbody>
26290 <row>
26291 <entry><option>smtp_accept_reserve</option></entry>
26292 <entry>Use: <emphasis>main</emphasis></entry>
26293 <entry>Type: <emphasis>integer</emphasis></entry>
26294 <entry>Default: <emphasis>0</emphasis></entry>
26295 </row>
26296 </tbody>
26297 </tgroup>
26298 </informaltable>
26299 <para>
26300 <indexterm role="concept">
26301 <primary>SMTP</primary>
26302 <secondary>incoming call count</secondary>
26303 </indexterm>
26304 <indexterm role="concept">
26305 <primary>host</primary>
26306 <secondary>reserved</secondary>
26307 </indexterm>
26308 When <option>smtp_accept_max</option> is set greater than zero, this option specifies a
26309 number of SMTP connections that are reserved for connections from the hosts
26310 that are specified in <option>smtp_reserve_hosts</option>. The value set in
26311 <option>smtp_accept_max</option> includes this reserve pool. The specified hosts are not
26312 restricted to this number of connections; the option specifies a minimum number
26313 of connection slots for them, not a maximum. It is a guarantee that this group
26314 of hosts can always get at least <option>smtp_accept_reserve</option> connections. However,
26315 the limit specified by <option>smtp_accept_max_per_host</option> is still applied to each
26316 individual host.
26317 </para>
26318 <para>
26319 For example, if <option>smtp_accept_max</option> is set to 50 and <option>smtp_accept_reserve</option> is
26320 set to 5, once there are 45 active connections (from any hosts), new
26321 connections are accepted only from hosts listed in <option>smtp_reserve_hosts</option>,
26322 provided the other criteria for acceptance are met.
26323 </para>
26324 <para>
26325 <indexterm role="option">
26326 <primary><option>smtp_active_hostname</option></primary>
26327 </indexterm>
26328 </para>
26329 <informaltable frame="all">
26330 <tgroup cols="4" colsep="0" rowsep="0">
26331 <colspec colwidth="8*" align="left"/>
26332 <colspec colwidth="6*" align="center"/>
26333 <colspec colwidth="6*" align="center"/>
26334 <colspec colwidth="6*" align="right"/>
26335 <tbody>
26336 <row>
26337 <entry><option>smtp_active_hostname</option></entry>
26338 <entry>Use: <emphasis>main</emphasis></entry>
26339 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26340 <entry>Default: <emphasis>unset</emphasis></entry>
26341 </row>
26342 </tbody>
26343 </tgroup>
26344 </informaltable>
26345 <para>
26346 <indexterm role="concept">
26347 <primary>host</primary>
26348 <secondary>name in SMTP responses</secondary>
26349 </indexterm>
26350 <indexterm role="concept">
26351 <primary>SMTP</primary>
26352 <secondary>host name in responses</secondary>
26353 </indexterm>
26354 <indexterm role="variable">
26355 <primary><varname>$primary_hostname</varname></primary>
26356 </indexterm>
26357 This option is provided for multi-homed servers that want to masquerade as
26358 several different hosts. At the start of an incoming SMTP connection, its value
26359 is expanded and used instead of the value of <varname>$primary_hostname</varname> in SMTP
26360 responses. For example, it is used as domain name in the response to an
26361 incoming HELO or EHLO command.
26362 </para>
26363 <para>
26364 <indexterm role="variable">
26365 <primary><varname>$smtp_active_hostname</varname></primary>
26366 </indexterm>
26367 The active hostname is placed in the <varname>$smtp_active_hostname</varname> variable, which
26368 is saved with any messages that are received. It is therefore available for use
26369 in routers and transports when the message is later delivered.
26370 </para>
26371 <para>
26372 If this option is unset, or if its expansion is forced to fail, or if the
26373 expansion results in an empty string, the value of <varname>$primary_hostname</varname> is
26374 used. Other expansion failures cause a message to be written to the main and
26375 panic logs, and the SMTP command receives a temporary error. Typically, the
26376 value of <option>smtp_active_hostname</option> depends on the incoming interface address.
26377 For example:
26378 </para>
26379 <literallayout class="monospaced">
26380 smtp_active_hostname = ${if eq{$received_ip_address}{10.0.0.1}\
26381   {cox.mydomain}{box.mydomain}}
26382 </literallayout>
26383 <para>
26384 Although <varname>$smtp_active_hostname</varname> is primarily concerned with incoming
26385 messages, it is also used as the default for HELO commands in callout
26386 verification if there is no remote transport from which to obtain a
26387 <option>helo_data</option> value.
26388 </para>
26389 <para>
26390 <indexterm role="option">
26391 <primary><option>smtp_banner</option></primary>
26392 </indexterm>
26393 </para>
26394 <informaltable frame="all">
26395 <tgroup cols="4" colsep="0" rowsep="0">
26396 <colspec colwidth="8*" align="left"/>
26397 <colspec colwidth="6*" align="center"/>
26398 <colspec colwidth="6*" align="center"/>
26399 <colspec colwidth="6*" align="right"/>
26400 <tbody>
26401 <row>
26402 <entry><option>smtp_banner</option></entry>
26403 <entry>Use: <emphasis>main</emphasis></entry>
26404 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26405 <entry>Default: <emphasis>see below</emphasis></entry>
26406 </row>
26407 </tbody>
26408 </tgroup>
26409 </informaltable>
26410 <para>
26411 <indexterm role="concept">
26412 <primary>SMTP</primary>
26413 <secondary>welcome banner</secondary>
26414 </indexterm>
26415 <indexterm role="concept">
26416 <primary>banner for SMTP</primary>
26417 </indexterm>
26418 <indexterm role="concept">
26419 <primary>welcome banner for SMTP</primary>
26420 </indexterm>
26421 <indexterm role="concept">
26422 <primary>customizing</primary>
26423 <secondary>SMTP banner</secondary>
26424 </indexterm>
26425 This string, which is expanded every time it is used, is output as the initial
26426 positive response to an SMTP connection. The default setting is:
26427 </para>
26428 <literallayout class="monospaced">
26429 smtp_banner = $smtp_active_hostname ESMTP Exim \
26430   $version_number $tod_full
26431 </literallayout>
26432 <para>
26433 Failure to expand the string causes a panic error. If you want to create a
26434 multiline response to the initial SMTP connection, use <quote>\n</quote> in the string at
26435 appropriate points, but not at the end. Note that the 220 code is not included
26436 in this string. Exim adds it automatically (several times in the case of a
26437 multiline response).
26438 </para>
26439 <para>
26440 <indexterm role="option">
26441 <primary><option>smtp_check_spool_space</option></primary>
26442 </indexterm>
26443 </para>
26444 <informaltable frame="all">
26445 <tgroup cols="4" colsep="0" rowsep="0">
26446 <colspec colwidth="8*" align="left"/>
26447 <colspec colwidth="6*" align="center"/>
26448 <colspec colwidth="6*" align="center"/>
26449 <colspec colwidth="6*" align="right"/>
26450 <tbody>
26451 <row>
26452 <entry><option>smtp_check_spool_space</option></entry>
26453 <entry>Use: <emphasis>main</emphasis></entry>
26454 <entry>Type: <emphasis>boolean</emphasis></entry>
26455 <entry>Default: <emphasis>true</emphasis></entry>
26456 </row>
26457 </tbody>
26458 </tgroup>
26459 </informaltable>
26460 <para>
26461 <indexterm role="concept">
26462 <primary>checking disk space</primary>
26463 </indexterm>
26464 <indexterm role="concept">
26465 <primary>disk space, checking</primary>
26466 </indexterm>
26467 <indexterm role="concept">
26468 <primary>spool directory</primary>
26469 <secondary>checking space</secondary>
26470 </indexterm>
26471 When this option is set, if an incoming SMTP session encounters the SIZE
26472 option on a MAIL command, it checks that there is enough space in the
26473 spool directory&#x2019;s partition to accept a message of that size, while still
26474 leaving free the amount specified by <option>check_spool_space</option> (even if that value
26475 is zero). If there isn&#x2019;t enough space, a temporary error code is returned.
26476 </para>
26477 <para>
26478 <indexterm role="option">
26479 <primary><option>smtp_connect_backlog</option></primary>
26480 </indexterm>
26481 </para>
26482 <informaltable frame="all">
26483 <tgroup cols="4" colsep="0" rowsep="0">
26484 <colspec colwidth="8*" align="left"/>
26485 <colspec colwidth="6*" align="center"/>
26486 <colspec colwidth="6*" align="center"/>
26487 <colspec colwidth="6*" align="right"/>
26488 <tbody>
26489 <row>
26490 <entry><option>smtp_connect_backlog</option></entry>
26491 <entry>Use: <emphasis>main</emphasis></entry>
26492 <entry>Type: <emphasis>integer</emphasis></entry>
26493 <entry>Default: <emphasis>20</emphasis></entry>
26494 </row>
26495 </tbody>
26496 </tgroup>
26497 </informaltable>
26498 <para>
26499 <indexterm role="concept">
26500 <primary>connection backlog</primary>
26501 </indexterm>
26502 <indexterm role="concept">
26503 <primary>SMTP</primary>
26504 <secondary>connection backlog</secondary>
26505 </indexterm>
26506 <indexterm role="concept">
26507 <primary>backlog of connections</primary>
26508 </indexterm>
26509 This option specifies a maximum number of waiting SMTP connections. Exim passes
26510 this value to the TCP/IP system when it sets up its listener. Once this number
26511 of connections are waiting for the daemon&#x2019;s attention, subsequent connection
26512 attempts are refused at the TCP/IP level. At least, that is what the manuals
26513 say; in some circumstances such connection attempts have been observed to time
26514 out instead. For large systems it is probably a good idea to increase the
26515 value (to 50, say). It also gives some protection against denial-of-service
26516 attacks by SYN flooding.
26517 </para>
26518 <para>
26519 <indexterm role="option">
26520 <primary><option>smtp_enforce_sync</option></primary>
26521 </indexterm>
26522 </para>
26523 <informaltable frame="all">
26524 <tgroup cols="4" colsep="0" rowsep="0">
26525 <colspec colwidth="8*" align="left"/>
26526 <colspec colwidth="6*" align="center"/>
26527 <colspec colwidth="6*" align="center"/>
26528 <colspec colwidth="6*" align="right"/>
26529 <tbody>
26530 <row>
26531 <entry><option>smtp_enforce_sync</option></entry>
26532 <entry>Use: <emphasis>main</emphasis></entry>
26533 <entry>Type: <emphasis>boolean</emphasis></entry>
26534 <entry>Default: <emphasis>true</emphasis></entry>
26535 </row>
26536 </tbody>
26537 </tgroup>
26538 </informaltable>
26539 <para>
26540 <indexterm role="concept">
26541 <primary>SMTP</primary>
26542 <secondary>synchronization checking</secondary>
26543 </indexterm>
26544 <indexterm role="concept">
26545 <primary>synchronization checking in SMTP</primary>
26546 </indexterm>
26547 The SMTP protocol specification requires the client to wait for a response from
26548 the server at certain points in the dialogue. Without PIPELINING these
26549 synchronization points are after every command; with PIPELINING they are
26550 fewer, but they still exist.
26551 </para>
26552 <para>
26553 Some spamming sites send out a complete set of SMTP commands without waiting
26554 for any response. Exim protects against this by rejecting a message if the
26555 client has sent further input when it should not have. The error response <quote>554
26556 SMTP synchronization error</quote> is sent, and the connection is dropped. Testing
26557 for this error cannot be perfect because of transmission delays (unexpected
26558 input may be on its way but not yet received when Exim checks). However, it
26559 does detect many instances.
26560 </para>
26561 <para>
26562 The check can be globally disabled by setting <option>smtp_enforce_sync</option> false.
26563 If you want to disable the check selectively (for example, only for certain
26564 hosts), you can do so by an appropriate use of a <option>control</option> modifier in an ACL
26565 (see section <xref linkend="SECTcontrols"/>). See also <option>pipelining_advertise_hosts</option>.
26566 </para>
26567 <para>
26568 <indexterm role="option">
26569 <primary><option>smtp_etrn_command</option></primary>
26570 </indexterm>
26571 </para>
26572 <informaltable frame="all">
26573 <tgroup cols="4" colsep="0" rowsep="0">
26574 <colspec colwidth="8*" align="left"/>
26575 <colspec colwidth="6*" align="center"/>
26576 <colspec colwidth="6*" align="center"/>
26577 <colspec colwidth="6*" align="right"/>
26578 <tbody>
26579 <row>
26580 <entry><option>smtp_etrn_command</option></entry>
26581 <entry>Use: <emphasis>main</emphasis></entry>
26582 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26583 <entry>Default: <emphasis>unset</emphasis></entry>
26584 </row>
26585 </tbody>
26586 </tgroup>
26587 </informaltable>
26588 <para>
26589 <indexterm role="concept">
26590 <primary>ETRN</primary>
26591 <secondary>command to be run</secondary>
26592 </indexterm>
26593 <indexterm role="variable">
26594 <primary><varname>$domain</varname></primary>
26595 </indexterm>
26596 If this option is set, the given command is run whenever an SMTP ETRN
26597 command is received from a host that is permitted to issue such commands (see
26598 chapter <xref linkend="CHAPACL"/>). The string is split up into separate arguments which
26599 are independently expanded. The expansion variable <varname>$domain</varname> is set to the
26600 argument of the ETRN command, and no syntax checking is done on it. For
26601 example:
26602 </para>
26603 <literallayout class="monospaced">
26604 smtp_etrn_command = /etc/etrn_command $domain \
26605                     $sender_host_address
26606 </literallayout>
26607 <para>
26608 A new process is created to run the command, but Exim does not wait for it to
26609 complete. Consequently, its status cannot be checked. If the command cannot be
26610 run, a line is written to the panic log, but the ETRN caller still receives
26611 a 250 success response. Exim is normally running under its own uid when
26612 receiving SMTP, so it is not possible for it to change the uid before running
26613 the command.
26614 </para>
26615 <para>
26616 <indexterm role="option">
26617 <primary><option>smtp_etrn_serialize</option></primary>
26618 </indexterm>
26619 </para>
26620 <informaltable frame="all">
26621 <tgroup cols="4" colsep="0" rowsep="0">
26622 <colspec colwidth="8*" align="left"/>
26623 <colspec colwidth="6*" align="center"/>
26624 <colspec colwidth="6*" align="center"/>
26625 <colspec colwidth="6*" align="right"/>
26626 <tbody>
26627 <row>
26628 <entry><option>smtp_etrn_serialize</option></entry>
26629 <entry>Use: <emphasis>main</emphasis></entry>
26630 <entry>Type: <emphasis>boolean</emphasis></entry>
26631 <entry>Default: <emphasis>true</emphasis></entry>
26632 </row>
26633 </tbody>
26634 </tgroup>
26635 </informaltable>
26636 <para>
26637 <indexterm role="concept">
26638 <primary>ETRN</primary>
26639 <secondary>serializing</secondary>
26640 </indexterm>
26641 When this option is set, it prevents the simultaneous execution of more than
26642 one identical command as a result of ETRN in an SMTP connection. See
26643 section <xref linkend="SECTETRN"/> for details.
26644 </para>
26645 <para>
26646 <indexterm role="option">
26647 <primary><option>smtp_load_reserve</option></primary>
26648 </indexterm>
26649 </para>
26650 <informaltable frame="all">
26651 <tgroup cols="4" colsep="0" rowsep="0">
26652 <colspec colwidth="8*" align="left"/>
26653 <colspec colwidth="6*" align="center"/>
26654 <colspec colwidth="6*" align="center"/>
26655 <colspec colwidth="6*" align="right"/>
26656 <tbody>
26657 <row>
26658 <entry><option>smtp_load_reserve</option></entry>
26659 <entry>Use: <emphasis>main</emphasis></entry>
26660 <entry>Type: <emphasis>fixed-point</emphasis></entry>
26661 <entry>Default: <emphasis>unset</emphasis></entry>
26662 </row>
26663 </tbody>
26664 </tgroup>
26665 </informaltable>
26666 <para>
26667 <indexterm role="concept">
26668 <primary>load average</primary>
26669 </indexterm>
26670 If the system load average ever gets higher than this, incoming SMTP calls are
26671 accepted only from those hosts that match an entry in <option>smtp_reserve_hosts</option>.
26672 If <option>smtp_reserve_hosts</option> is not set, no incoming SMTP calls are accepted when
26673 the load is over the limit. The option has no effect on ancient operating
26674 systems on which Exim cannot determine the load average. See also
26675 <option>deliver_queue_load_max</option> and <option>queue_only_load</option>.
26676 </para>
26677 <para>
26678 <indexterm role="option">
26679 <primary><option>smtp_max_synprot_errors</option></primary>
26680 </indexterm>
26681 </para>
26682 <informaltable frame="all">
26683 <tgroup cols="4" colsep="0" rowsep="0">
26684 <colspec colwidth="8*" align="left"/>
26685 <colspec colwidth="6*" align="center"/>
26686 <colspec colwidth="6*" align="center"/>
26687 <colspec colwidth="6*" align="right"/>
26688 <tbody>
26689 <row>
26690 <entry><option>smtp_max_synprot_errors</option></entry>
26691 <entry>Use: <emphasis>main</emphasis></entry>
26692 <entry>Type: <emphasis>integer</emphasis></entry>
26693 <entry>Default: <emphasis>3</emphasis></entry>
26694 </row>
26695 </tbody>
26696 </tgroup>
26697 </informaltable>
26698 <para>
26699 <indexterm role="concept">
26700 <primary>SMTP</primary>
26701 <secondary>limiting syntax and protocol errors</secondary>
26702 </indexterm>
26703 <indexterm role="concept">
26704 <primary>limit</primary>
26705 <secondary>SMTP syntax and protocol errors</secondary>
26706 </indexterm>
26707 Exim rejects SMTP commands that contain syntax or protocol errors. In
26708 particular, a syntactically invalid email address, as in this command:
26709 </para>
26710 <literallayout class="monospaced">
26711 RCPT TO:&lt;abc xyz@a.b.c&gt;
26712 </literallayout>
26713 <para>
26714 causes immediate rejection of the command, before any other tests are done.
26715 (The ACL cannot be run if there is no valid address to set up for it.) An
26716 example of a protocol error is receiving RCPT before MAIL. If there are
26717 too many syntax or protocol errors in one SMTP session, the connection is
26718 dropped. The limit is set by this option.
26719 </para>
26720 <para>
26721 <indexterm role="concept">
26722 <primary>PIPELINING</primary>
26723 <secondary>expected errors</secondary>
26724 </indexterm>
26725 When the PIPELINING extension to SMTP is in use, some protocol errors are
26726 <quote>expected</quote>, for instance, a RCPT command after a rejected MAIL command.
26727 Exim assumes that PIPELINING will be used if it advertises it (see
26728 <option>pipelining_advertise_hosts</option>), and in this situation, <quote>expected</quote> errors do
26729 not count towards the limit.
26730 </para>
26731 <para>
26732 <indexterm role="option">
26733 <primary><option>smtp_max_unknown_commands</option></primary>
26734 </indexterm>
26735 </para>
26736 <informaltable frame="all">
26737 <tgroup cols="4" colsep="0" rowsep="0">
26738 <colspec colwidth="8*" align="left"/>
26739 <colspec colwidth="6*" align="center"/>
26740 <colspec colwidth="6*" align="center"/>
26741 <colspec colwidth="6*" align="right"/>
26742 <tbody>
26743 <row>
26744 <entry><option>smtp_max_unknown_commands</option></entry>
26745 <entry>Use: <emphasis>main</emphasis></entry>
26746 <entry>Type: <emphasis>integer</emphasis></entry>
26747 <entry>Default: <emphasis>3</emphasis></entry>
26748 </row>
26749 </tbody>
26750 </tgroup>
26751 </informaltable>
26752 <para>
26753 <indexterm role="concept">
26754 <primary>SMTP</primary>
26755 <secondary>limiting unknown commands</secondary>
26756 </indexterm>
26757 <indexterm role="concept">
26758 <primary>limit</primary>
26759 <secondary>unknown SMTP commands</secondary>
26760 </indexterm>
26761 If there are too many unrecognized commands in an incoming SMTP session, an
26762 Exim server drops the connection. This is a defence against some kinds of abuse
26763 that subvert web
26764 clients
26765 into making connections to SMTP ports; in these circumstances, a number of
26766 non-SMTP command lines are sent first.
26767 </para>
26768 <para>
26769 <indexterm role="option">
26770 <primary><option>smtp_ratelimit_hosts</option></primary>
26771 </indexterm>
26772 </para>
26773 <informaltable frame="all">
26774 <tgroup cols="4" colsep="0" rowsep="0">
26775 <colspec colwidth="8*" align="left"/>
26776 <colspec colwidth="6*" align="center"/>
26777 <colspec colwidth="6*" align="center"/>
26778 <colspec colwidth="6*" align="right"/>
26779 <tbody>
26780 <row>
26781 <entry><option>smtp_ratelimit_hosts</option></entry>
26782 <entry>Use: <emphasis>main</emphasis></entry>
26783 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26784 <entry>Default: <emphasis>unset</emphasis></entry>
26785 </row>
26786 </tbody>
26787 </tgroup>
26788 </informaltable>
26789 <para>
26790 <indexterm role="concept">
26791 <primary>SMTP</primary>
26792 <secondary>rate limiting</secondary>
26793 </indexterm>
26794 <indexterm role="concept">
26795 <primary>limit</primary>
26796 <secondary>rate of message arrival</secondary>
26797 </indexterm>
26798 <indexterm role="concept">
26799 <primary>RCPT</primary>
26800 <secondary>rate limiting</secondary>
26801 </indexterm>
26802 Some sites find it helpful to be able to limit the rate at which certain hosts
26803 can send them messages, and the rate at which an individual message can specify
26804 recipients.
26805 </para>
26806 <para>
26807 Exim has two rate-limiting facilities. This section describes the older
26808 facility, which can limit rates within a single connection. The newer
26809 <option>ratelimit</option> ACL condition can limit rates across all connections. See section
26810 <xref linkend="SECTratelimiting"/> for details of the newer facility.
26811 </para>
26812 <para>
26813 When a host matches <option>smtp_ratelimit_hosts</option>, the values of
26814 <option>smtp_ratelimit_mail</option> and <option>smtp_ratelimit_rcpt</option> are used to control the
26815 rate of acceptance of MAIL and RCPT commands in a single SMTP session,
26816 respectively. Each option, if set, must contain a set of four comma-separated
26817 values:
26818 </para>
26819 <itemizedlist>
26820 <listitem>
26821 <para>
26822 A threshold, before which there is no rate limiting.
26823 </para>
26824 </listitem>
26825 <listitem>
26826 <para>
26827 An initial time delay. Unlike other times in Exim, numbers with decimal
26828 fractional parts are allowed here.
26829 </para>
26830 </listitem>
26831 <listitem>
26832 <para>
26833 A factor by which to increase the delay each time.
26834 </para>
26835 </listitem>
26836 <listitem>
26837 <para>
26838 A maximum value for the delay. This should normally be less than 5 minutes,
26839 because after that time, the client is liable to timeout the SMTP command.
26840 </para>
26841 </listitem>
26842 </itemizedlist>
26843 <para>
26844 For example, these settings have been used successfully at the site which
26845 first suggested this feature, for controlling mail from their customers:
26846 </para>
26847 <literallayout class="monospaced">
26848 smtp_ratelimit_mail = 2,0.5s,1.05,4m
26849 smtp_ratelimit_rcpt = 4,0.25s,1.015,4m
26850 </literallayout>
26851 <para>
26852 The first setting specifies delays that are applied to MAIL commands after
26853 two have been received over a single connection. The initial delay is 0.5
26854 seconds, increasing by a factor of 1.05 each time. The second setting applies
26855 delays to RCPT commands when more than four occur in a single message.
26856 </para>
26857 <para>
26858 <indexterm role="option">
26859 <primary><option>smtp_ratelimit_mail</option></primary>
26860 </indexterm>
26861 </para>
26862 <informaltable frame="all">
26863 <tgroup cols="4" colsep="0" rowsep="0">
26864 <colspec colwidth="8*" align="left"/>
26865 <colspec colwidth="6*" align="center"/>
26866 <colspec colwidth="6*" align="center"/>
26867 <colspec colwidth="6*" align="right"/>
26868 <tbody>
26869 <row>
26870 <entry><option>smtp_ratelimit_mail</option></entry>
26871 <entry>Use: <emphasis>main</emphasis></entry>
26872 <entry>Type: <emphasis>string</emphasis></entry>
26873 <entry>Default: <emphasis>unset</emphasis></entry>
26874 </row>
26875 </tbody>
26876 </tgroup>
26877 </informaltable>
26878 <para>
26879 See <option>smtp_ratelimit_hosts</option> above.
26880 </para>
26881 <para>
26882 <indexterm role="option">
26883 <primary><option>smtp_ratelimit_rcpt</option></primary>
26884 </indexterm>
26885 </para>
26886 <informaltable frame="all">
26887 <tgroup cols="4" colsep="0" rowsep="0">
26888 <colspec colwidth="8*" align="left"/>
26889 <colspec colwidth="6*" align="center"/>
26890 <colspec colwidth="6*" align="center"/>
26891 <colspec colwidth="6*" align="right"/>
26892 <tbody>
26893 <row>
26894 <entry><option>smtp_ratelimit_rcpt</option></entry>
26895 <entry>Use: <emphasis>main</emphasis></entry>
26896 <entry>Type: <emphasis>string</emphasis></entry>
26897 <entry>Default: <emphasis>unset</emphasis></entry>
26898 </row>
26899 </tbody>
26900 </tgroup>
26901 </informaltable>
26902 <para>
26903 See <option>smtp_ratelimit_hosts</option> above.
26904 </para>
26905 <para>
26906 <indexterm role="option">
26907 <primary><option>smtp_receive_timeout</option></primary>
26908 </indexterm>
26909 </para>
26910 <informaltable frame="all">
26911 <tgroup cols="4" colsep="0" rowsep="0">
26912 <colspec colwidth="8*" align="left"/>
26913 <colspec colwidth="6*" align="center"/>
26914 <colspec colwidth="6*" align="center"/>
26915 <colspec colwidth="6*" align="right"/>
26916 <tbody>
26917 <row>
26918 <entry><option>smtp_receive_timeout</option></entry>
26919 <entry>Use: <emphasis>main</emphasis></entry>
26920 <entry>Type: <emphasis>time</emphasis></entry>
26921 <entry>Default: <emphasis>5m</emphasis></entry>
26922 </row>
26923 </tbody>
26924 </tgroup>
26925 </informaltable>
26926 <para>
26927 <indexterm role="concept">
26928 <primary>timeout</primary>
26929 <secondary>for SMTP input</secondary>
26930 </indexterm>
26931 <indexterm role="concept">
26932 <primary>SMTP</primary>
26933 <secondary>input timeout</secondary>
26934 </indexterm>
26935 This sets a timeout value for SMTP reception. It applies to all forms of SMTP
26936 input, including batch SMTP. If a line of input (either an SMTP command or a
26937 data line) is not received within this time, the SMTP connection is dropped and
26938 the message is abandoned.
26939 A line is written to the log containing one of the following messages:
26940 </para>
26941 <literallayout class="monospaced">
26942 SMTP command timeout on connection from...
26943 SMTP data timeout on connection from...
26944 </literallayout>
26945 <para>
26946 The former means that Exim was expecting to read an SMTP command; the latter
26947 means that it was in the DATA phase, reading the contents of a message.
26948 </para>
26949 <para>
26950 <indexterm role="option">
26951 <primary><option>-os</option></primary>
26952 </indexterm>
26953 The value set by this option can be overridden by the
26954 <option>-os</option> command-line option. A setting of zero time disables the timeout, but
26955 this should never be used for SMTP over TCP/IP. (It can be useful in some cases
26956 of local input using <option>-bs</option> or <option>-bS</option>.) For non-SMTP input, the reception
26957 timeout is controlled by <option>receive_timeout</option> and <option>-or</option>.
26958 </para>
26959 <para>
26960 <indexterm role="option">
26961 <primary><option>smtp_reserve_hosts</option></primary>
26962 </indexterm>
26963 </para>
26964 <informaltable frame="all">
26965 <tgroup cols="4" colsep="0" rowsep="0">
26966 <colspec colwidth="8*" align="left"/>
26967 <colspec colwidth="6*" align="center"/>
26968 <colspec colwidth="6*" align="center"/>
26969 <colspec colwidth="6*" align="right"/>
26970 <tbody>
26971 <row>
26972 <entry><option>smtp_reserve_hosts</option></entry>
26973 <entry>Use: <emphasis>main</emphasis></entry>
26974 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26975 <entry>Default: <emphasis>unset</emphasis></entry>
26976 </row>
26977 </tbody>
26978 </tgroup>
26979 </informaltable>
26980 <para>
26981 This option defines hosts for which SMTP connections are reserved; see
26982 <option>smtp_accept_reserve</option> and <option>smtp_load_reserve</option> above.
26983 </para>
26984 <para>
26985 <indexterm role="option">
26986 <primary><option>smtp_return_error_details</option></primary>
26987 </indexterm>
26988 </para>
26989 <informaltable frame="all">
26990 <tgroup cols="4" colsep="0" rowsep="0">
26991 <colspec colwidth="8*" align="left"/>
26992 <colspec colwidth="6*" align="center"/>
26993 <colspec colwidth="6*" align="center"/>
26994 <colspec colwidth="6*" align="right"/>
26995 <tbody>
26996 <row>
26997 <entry><option>smtp_return_error_details</option></entry>
26998 <entry>Use: <emphasis>main</emphasis></entry>
26999 <entry>Type: <emphasis>boolean</emphasis></entry>
27000 <entry>Default: <emphasis>false</emphasis></entry>
27001 </row>
27002 </tbody>
27003 </tgroup>
27004 </informaltable>
27005 <para>
27006 <indexterm role="concept">
27007 <primary>SMTP</primary>
27008 <secondary>details policy failures</secondary>
27009 </indexterm>
27010 <indexterm role="concept">
27011 <primary>policy control</primary>
27012 <secondary>rejection, returning details</secondary>
27013 </indexterm>
27014 In the default state, Exim uses bland messages such as
27015 <quote>Administrative prohibition</quote> when it rejects SMTP commands for policy
27016 reasons. Many sysadmins like this because it gives away little information
27017 to spammers. However, some other sysadmins who are applying strict checking
27018 policies want to give out much fuller information about failures. Setting
27019 <option>smtp_return_error_details</option> true causes Exim to be more forthcoming. For
27020 example, instead of <quote>Administrative prohibition</quote>, it might give:
27021 </para>
27022 <literallayout class="monospaced">
27023 550-Rejected after DATA: '&gt;' missing at end of address:
27024 550 failing address in "From" header is: &lt;user@dom.ain
27025 </literallayout>
27026 <para>
27027 <indexterm role="option">
27028 <primary><option>spamd_address</option></primary>
27029 </indexterm>
27030 </para>
27031 <informaltable frame="all">
27032 <tgroup cols="4" colsep="0" rowsep="0">
27033 <colspec colwidth="8*" align="left"/>
27034 <colspec colwidth="6*" align="center"/>
27035 <colspec colwidth="6*" align="center"/>
27036 <colspec colwidth="6*" align="right"/>
27037 <tbody>
27038 <row>
27039 <entry><option>spamd_address</option></entry>
27040 <entry>Use: <emphasis>main</emphasis></entry>
27041 <entry>Type: <emphasis>string</emphasis></entry>
27042 <entry>Default: <emphasis>see below</emphasis></entry>
27043 </row>
27044 </tbody>
27045 </tgroup>
27046 </informaltable>
27047 <para>
27048 This option is available when Exim is compiled with the content-scanning
27049 extension. It specifies how Exim connects to SpamAssassin&#x2019;s <option>spamd</option> daemon.
27050 The default value is
27051 </para>
27052 <literallayout class="monospaced">
27053 127.0.0.1 783
27054 </literallayout>
27055 <para>
27056 See section <xref linkend="SECTscanspamass"/> for more details.
27057 </para>
27058 <para>
27059 <indexterm role="option">
27060 <primary><option>split_spool_directory</option></primary>
27061 </indexterm>
27062 </para>
27063 <informaltable frame="all">
27064 <tgroup cols="4" colsep="0" rowsep="0">
27065 <colspec colwidth="8*" align="left"/>
27066 <colspec colwidth="6*" align="center"/>
27067 <colspec colwidth="6*" align="center"/>
27068 <colspec colwidth="6*" align="right"/>
27069 <tbody>
27070 <row>
27071 <entry><option>split_spool_directory</option></entry>
27072 <entry>Use: <emphasis>main</emphasis></entry>
27073 <entry>Type: <emphasis>boolean</emphasis></entry>
27074 <entry>Default: <emphasis>false</emphasis></entry>
27075 </row>
27076 </tbody>
27077 </tgroup>
27078 </informaltable>
27079 <para>
27080 <indexterm role="concept">
27081 <primary>multiple spool directories</primary>
27082 </indexterm>
27083 <indexterm role="concept">
27084 <primary>spool directory</primary>
27085 <secondary>split</secondary>
27086 </indexterm>
27087 <indexterm role="concept">
27088 <primary>directories, multiple</primary>
27089 </indexterm>
27090 If this option is set, it causes Exim to split its input directory into 62
27091 subdirectories, each with a single alphanumeric character as its name. The
27092 sixth character of the message id is used to allocate messages to
27093 subdirectories; this is the least significant base-62 digit of the time of
27094 arrival of the message.
27095 </para>
27096 <para>
27097 Splitting up the spool in this way may provide better performance on systems
27098 where there are long mail queues, by reducing the number of files in any one
27099 directory. The msglog directory is also split up in a similar way to the input
27100 directory; however, if <option>preserve_message_logs</option> is set, all old msglog files
27101 are still placed in the single directory <filename>msglog.OLD</filename>.
27102 </para>
27103 <para>
27104 It is not necessary to take any special action for existing messages when
27105 changing <option>split_spool_directory</option>. Exim notices messages that are in the
27106 <quote>wrong</quote> place, and continues to process them. If the option is turned off
27107 after a period of being on, the subdirectories will eventually empty and be
27108 automatically deleted.
27109 </para>
27110 <para>
27111 When <option>split_spool_directory</option> is set, the behaviour of queue runner processes
27112 changes. Instead of creating a list of all messages in the queue, and then
27113 trying to deliver each one in turn, it constructs a list of those in one
27114 sub-directory and tries to deliver them, before moving on to the next
27115 sub-directory. The sub-directories are processed in a random order. This
27116 spreads out the scanning of the input directories, and uses less memory. It is
27117 particularly beneficial when there are lots of messages on the queue. However,
27118 if <option>queue_run_in_order</option> is set, none of this new processing happens. The
27119 entire queue has to be scanned and sorted before any deliveries can start.
27120 </para>
27121 <para>
27122 <indexterm role="option">
27123 <primary><option>spool_directory</option></primary>
27124 </indexterm>
27125 </para>
27126 <informaltable frame="all">
27127 <tgroup cols="4" colsep="0" rowsep="0">
27128 <colspec colwidth="8*" align="left"/>
27129 <colspec colwidth="6*" align="center"/>
27130 <colspec colwidth="6*" align="center"/>
27131 <colspec colwidth="6*" align="right"/>
27132 <tbody>
27133 <row>
27134 <entry><option>spool_directory</option></entry>
27135 <entry>Use: <emphasis>main</emphasis></entry>
27136 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27137 <entry>Default: <emphasis>set at compile time</emphasis></entry>
27138 </row>
27139 </tbody>
27140 </tgroup>
27141 </informaltable>
27142 <para>
27143 <indexterm role="concept">
27144 <primary>spool directory</primary>
27145 <secondary>path to</secondary>
27146 </indexterm>
27147 This defines the directory in which Exim keeps its spool, that is, the messages
27148 it is waiting to deliver. The default value is taken from the compile-time
27149 configuration setting, if there is one. If not, this option must be set. The
27150 string is expanded, so it can contain, for example, a reference to
27151 <varname>$primary_hostname</varname>.
27152 </para>
27153 <para>
27154 If the spool directory name is fixed on your installation, it is recommended
27155 that you set it at build time rather than from this option, particularly if the
27156 log files are being written to the spool directory (see <option>log_file_path</option>).
27157 Otherwise log files cannot be used for errors that are detected early on, such
27158 as failures in the configuration file.
27159 </para>
27160 <para>
27161 By using this option to override the compiled-in path, it is possible to run
27162 tests of Exim without using the standard spool.
27163 </para>
27164 <para>
27165 <indexterm role="option">
27166 <primary><option>sqlite_lock_timeout</option></primary>
27167 </indexterm>
27168 </para>
27169 <informaltable frame="all">
27170 <tgroup cols="4" colsep="0" rowsep="0">
27171 <colspec colwidth="8*" align="left"/>
27172 <colspec colwidth="6*" align="center"/>
27173 <colspec colwidth="6*" align="center"/>
27174 <colspec colwidth="6*" align="right"/>
27175 <tbody>
27176 <row>
27177 <entry><option>sqlite_lock_timeout</option></entry>
27178 <entry>Use: <emphasis>main</emphasis></entry>
27179 <entry>Type: <emphasis>time</emphasis></entry>
27180 <entry>Default: <emphasis>5s</emphasis></entry>
27181 </row>
27182 </tbody>
27183 </tgroup>
27184 </informaltable>
27185 <para>
27186 <indexterm role="concept">
27187 <primary>sqlite lookup type</primary>
27188 <secondary>lock timeout</secondary>
27189 </indexterm>
27190 This option controls the timeout that the <command>sqlite</command> lookup uses when trying to
27191 access an SQLite database. See section <xref linkend="SECTsqlite"/> for more details.
27192 </para>
27193 <para>
27194 <indexterm role="option">
27195 <primary><option>strict_acl_vars</option></primary>
27196 </indexterm>
27197 </para>
27198 <informaltable frame="all">
27199 <tgroup cols="4" colsep="0" rowsep="0">
27200 <colspec colwidth="8*" align="left"/>
27201 <colspec colwidth="6*" align="center"/>
27202 <colspec colwidth="6*" align="center"/>
27203 <colspec colwidth="6*" align="right"/>
27204 <tbody>
27205 <row>
27206 <entry><option>strict_acl_vars</option></entry>
27207 <entry>Use: <emphasis>main</emphasis></entry>
27208 <entry>Type: <emphasis>boolean</emphasis></entry>
27209 <entry>Default: <emphasis>false</emphasis></entry>
27210 </row>
27211 </tbody>
27212 </tgroup>
27213 </informaltable>
27214 <para>
27215 <indexterm role="concept">
27216 <primary>access control lists (ACLs)</primary>
27217 <secondary>variables, handling unset</secondary>
27218 </indexterm>
27219 This option controls what happens if a syntactically valid but undefined ACL
27220 variable is referenced. If it is false (the default), an empty string
27221 is substituted; if it is true, an error is generated. See section
27222 <xref linkend="SECTaclvariables"/> for details of ACL variables.
27223 </para>
27224 <para>
27225 <indexterm role="option">
27226 <primary><option>strip_excess_angle_brackets</option></primary>
27227 </indexterm>
27228 </para>
27229 <informaltable frame="all">
27230 <tgroup cols="4" colsep="0" rowsep="0">
27231 <colspec colwidth="8*" align="left"/>
27232 <colspec colwidth="6*" align="center"/>
27233 <colspec colwidth="6*" align="center"/>
27234 <colspec colwidth="6*" align="right"/>
27235 <tbody>
27236 <row>
27237 <entry><option>strip_excess_angle_brackets</option></entry>
27238 <entry>Use: <emphasis>main</emphasis></entry>
27239 <entry>Type: <emphasis>boolean</emphasis></entry>
27240 <entry>Default: <emphasis>false</emphasis></entry>
27241 </row>
27242 </tbody>
27243 </tgroup>
27244 </informaltable>
27245 <para>
27246 <indexterm role="concept">
27247 <primary>angle brackets, excess</primary>
27248 </indexterm>
27249 If this option is set, redundant pairs of angle brackets round <quote>route-addr</quote>
27250 items in addresses are stripped. For example, <emphasis>&lt;&lt;xxx@a.b.c.d&gt;&gt;</emphasis> is
27251 treated as <emphasis>&lt;xxx@a.b.c.d&gt;</emphasis>. If this is in the envelope and the message is
27252 passed on to another MTA, the excess angle brackets are not passed on. If this
27253 option is not set, multiple pairs of angle brackets cause a syntax error.
27254 </para>
27255 <para>
27256 <indexterm role="option">
27257 <primary><option>strip_trailing_dot</option></primary>
27258 </indexterm>
27259 </para>
27260 <informaltable frame="all">
27261 <tgroup cols="4" colsep="0" rowsep="0">
27262 <colspec colwidth="8*" align="left"/>
27263 <colspec colwidth="6*" align="center"/>
27264 <colspec colwidth="6*" align="center"/>
27265 <colspec colwidth="6*" align="right"/>
27266 <tbody>
27267 <row>
27268 <entry><option>strip_trailing_dot</option></entry>
27269 <entry>Use: <emphasis>main</emphasis></entry>
27270 <entry>Type: <emphasis>boolean</emphasis></entry>
27271 <entry>Default: <emphasis>false</emphasis></entry>
27272 </row>
27273 </tbody>
27274 </tgroup>
27275 </informaltable>
27276 <para>
27277 <indexterm role="concept">
27278 <primary>trailing dot on domain</primary>
27279 </indexterm>
27280 <indexterm role="concept">
27281 <primary>dot</primary>
27282 <secondary>trailing on domain</secondary>
27283 </indexterm>
27284 If this option is set, a trailing dot at the end of a domain in an address is
27285 ignored. If this is in the envelope and the message is passed on to another
27286 MTA, the dot is not passed on. If this option is not set, a dot at the end of a
27287 domain causes a syntax error.
27288 However, addresses in header lines are checked only when an ACL requests header
27289 syntax checking.
27290 </para>
27291 <para>
27292 <indexterm role="option">
27293 <primary><option>syslog_duplication</option></primary>
27294 </indexterm>
27295 </para>
27296 <informaltable frame="all">
27297 <tgroup cols="4" colsep="0" rowsep="0">
27298 <colspec colwidth="8*" align="left"/>
27299 <colspec colwidth="6*" align="center"/>
27300 <colspec colwidth="6*" align="center"/>
27301 <colspec colwidth="6*" align="right"/>
27302 <tbody>
27303 <row>
27304 <entry><option>syslog_duplication</option></entry>
27305 <entry>Use: <emphasis>main</emphasis></entry>
27306 <entry>Type: <emphasis>boolean</emphasis></entry>
27307 <entry>Default: <emphasis>true</emphasis></entry>
27308 </row>
27309 </tbody>
27310 </tgroup>
27311 </informaltable>
27312 <para>
27313 <indexterm role="concept">
27314 <primary>syslog</primary>
27315 <secondary>duplicate log lines; suppressing</secondary>
27316 </indexterm>
27317 When Exim is logging to syslog, it writes the log lines for its three
27318 separate logs at different syslog priorities so that they can in principle
27319 be separated on the logging hosts. Some installations do not require this
27320 separation, and in those cases, the duplication of certain log lines is a
27321 nuisance. If <option>syslog_duplication</option> is set false, only one copy of any
27322 particular log line is written to syslog. For lines that normally go to
27323 both the main log and the reject log, the reject log version (possibly
27324 containing message header lines) is written, at LOG_NOTICE priority.
27325 Lines that normally go to both the main and the panic log are written at
27326 the LOG_ALERT priority.
27327 </para>
27328 <para>
27329 <indexterm role="option">
27330 <primary><option>syslog_facility</option></primary>
27331 </indexterm>
27332 </para>
27333 <informaltable frame="all">
27334 <tgroup cols="4" colsep="0" rowsep="0">
27335 <colspec colwidth="8*" align="left"/>
27336 <colspec colwidth="6*" align="center"/>
27337 <colspec colwidth="6*" align="center"/>
27338 <colspec colwidth="6*" align="right"/>
27339 <tbody>
27340 <row>
27341 <entry><option>syslog_facility</option></entry>
27342 <entry>Use: <emphasis>main</emphasis></entry>
27343 <entry>Type: <emphasis>string</emphasis></entry>
27344 <entry>Default: <emphasis>unset</emphasis></entry>
27345 </row>
27346 </tbody>
27347 </tgroup>
27348 </informaltable>
27349 <para>
27350 <indexterm role="concept">
27351 <primary>syslog</primary>
27352 <secondary>facility; setting</secondary>
27353 </indexterm>
27354 This option sets the syslog <quote>facility</quote> name, used when Exim is logging to
27355 syslog. The value must be one of the strings <quote>mail</quote>, <quote>user</quote>, <quote>news</quote>,
27356 <quote>uucp</quote>, <quote>daemon</quote>, or <quote>local<emphasis>x</emphasis></quote> where <emphasis>x</emphasis> is a digit between 0 and 7.
27357 If this option is unset, <quote>mail</quote> is used. See chapter <xref linkend="CHAPlog"/> for
27358 details of Exim&#x2019;s logging.
27359 </para>
27360 <para>
27361 <indexterm role="option">
27362 <primary><option>syslog_processname</option></primary>
27363 </indexterm>
27364 </para>
27365 <informaltable frame="all">
27366 <tgroup cols="4" colsep="0" rowsep="0">
27367 <colspec colwidth="8*" align="left"/>
27368 <colspec colwidth="6*" align="center"/>
27369 <colspec colwidth="6*" align="center"/>
27370 <colspec colwidth="6*" align="right"/>
27371 <tbody>
27372 <row>
27373 <entry><option>syslog_processname</option></entry>
27374 <entry>Use: <emphasis>main</emphasis></entry>
27375 <entry>Type: <emphasis>string</emphasis></entry>
27376 <entry>Default: <emphasis><literal>exim</literal></emphasis></entry>
27377 </row>
27378 </tbody>
27379 </tgroup>
27380 </informaltable>
27381 <para>
27382 <indexterm role="concept">
27383 <primary>syslog</primary>
27384 <secondary>process name; setting</secondary>
27385 </indexterm>
27386 This option sets the syslog <quote>ident</quote> name, used when Exim is logging to
27387 syslog. The value must be no longer than 32 characters. See chapter
27388 <xref linkend="CHAPlog"/> for details of Exim&#x2019;s logging.
27389 </para>
27390 <para>
27391 <indexterm role="option">
27392 <primary><option>syslog_timestamp</option></primary>
27393 </indexterm>
27394 </para>
27395 <informaltable frame="all">
27396 <tgroup cols="4" colsep="0" rowsep="0">
27397 <colspec colwidth="8*" align="left"/>
27398 <colspec colwidth="6*" align="center"/>
27399 <colspec colwidth="6*" align="center"/>
27400 <colspec colwidth="6*" align="right"/>
27401 <tbody>
27402 <row>
27403 <entry><option>syslog_timestamp</option></entry>
27404 <entry>Use: <emphasis>main</emphasis></entry>
27405 <entry>Type: <emphasis>boolean</emphasis></entry>
27406 <entry>Default: <emphasis>true</emphasis></entry>
27407 </row>
27408 </tbody>
27409 </tgroup>
27410 </informaltable>
27411 <para>
27412 <indexterm role="concept">
27413 <primary>syslog</primary>
27414 <secondary>timestamps</secondary>
27415 </indexterm>
27416 If <option>syslog_timestamp</option> is set false, the timestamps on Exim&#x2019;s log lines are
27417 omitted when these lines are sent to syslog. See chapter <xref linkend="CHAPlog"/> for
27418 details of Exim&#x2019;s logging.
27419 </para>
27420 <para>
27421 <indexterm role="option">
27422 <primary><option>system_filter</option></primary>
27423 </indexterm>
27424 </para>
27425 <informaltable frame="all">
27426 <tgroup cols="4" colsep="0" rowsep="0">
27427 <colspec colwidth="8*" align="left"/>
27428 <colspec colwidth="6*" align="center"/>
27429 <colspec colwidth="6*" align="center"/>
27430 <colspec colwidth="6*" align="right"/>
27431 <tbody>
27432 <row>
27433 <entry><option>system_filter</option></entry>
27434 <entry>Use: <emphasis>main</emphasis></entry>
27435 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27436 <entry>Default: <emphasis>unset</emphasis></entry>
27437 </row>
27438 </tbody>
27439 </tgroup>
27440 </informaltable>
27441 <para>
27442 <indexterm role="concept">
27443 <primary>filter</primary>
27444 <secondary>system filter</secondary>
27445 </indexterm>
27446 <indexterm role="concept">
27447 <primary>system filter</primary>
27448 <secondary>specifying</secondary>
27449 </indexterm>
27450 <indexterm role="concept">
27451 <primary>Sieve filter</primary>
27452 <secondary>not available for system filter</secondary>
27453 </indexterm>
27454 This option specifies an Exim filter file that is applied to all messages at
27455 the start of each delivery attempt, before any routing is done. System filters
27456 must be Exim filters; they cannot be Sieve filters. If the system filter
27457 generates any deliveries to files or pipes, or any new mail messages, the
27458 appropriate <option>system_filter_..._transport</option> option(s) must be set, to define
27459 which transports are to be used. Details of this facility are given in chapter
27460 <xref linkend="CHAPsystemfilter"/>.
27461 </para>
27462 <para>
27463 <indexterm role="option">
27464 <primary><option>system_filter_directory_transport</option></primary>
27465 </indexterm>
27466 </para>
27467 <informaltable frame="all">
27468 <tgroup cols="4" colsep="0" rowsep="0">
27469 <colspec colwidth="8*" align="left"/>
27470 <colspec colwidth="6*" align="center"/>
27471 <colspec colwidth="6*" align="center"/>
27472 <colspec colwidth="6*" align="right"/>
27473 <tbody>
27474 <row>
27475 <entry><option>system_filter_directory_transport</option></entry>
27476 <entry>Use: <emphasis>main</emphasis></entry>
27477 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27478 <entry>Default: <emphasis>unset</emphasis></entry>
27479 </row>
27480 </tbody>
27481 </tgroup>
27482 </informaltable>
27483 <para>
27484 <indexterm role="variable">
27485 <primary><varname>$address_file</varname></primary>
27486 </indexterm>
27487 This sets the name of the transport driver that is to be used when the
27488 <option>save</option> command in a system message filter specifies a path ending in <quote>/</quote>,
27489 implying delivery of each message into a separate file in some directory.
27490 During the delivery, the variable <varname>$address_file</varname> contains the path name.
27491 </para>
27492 <para>
27493 <indexterm role="option">
27494 <primary><option>system_filter_file_transport</option></primary>
27495 </indexterm>
27496 </para>
27497 <informaltable frame="all">
27498 <tgroup cols="4" colsep="0" rowsep="0">
27499 <colspec colwidth="8*" align="left"/>
27500 <colspec colwidth="6*" align="center"/>
27501 <colspec colwidth="6*" align="center"/>
27502 <colspec colwidth="6*" align="right"/>
27503 <tbody>
27504 <row>
27505 <entry><option>system_filter_file_transport</option></entry>
27506 <entry>Use: <emphasis>main</emphasis></entry>
27507 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27508 <entry>Default: <emphasis>unset</emphasis></entry>
27509 </row>
27510 </tbody>
27511 </tgroup>
27512 </informaltable>
27513 <para>
27514 <indexterm role="concept">
27515 <primary>file</primary>
27516 <secondary>transport for system filter</secondary>
27517 </indexterm>
27518 This sets the name of the transport driver that is to be used when the <option>save</option>
27519 command in a system message filter specifies a path not ending in <quote>/</quote>. During
27520 the delivery, the variable <varname>$address_file</varname> contains the path name.
27521 </para>
27522 <para>
27523 <indexterm role="option">
27524 <primary><option>system_filter_group</option></primary>
27525 </indexterm>
27526 </para>
27527 <informaltable frame="all">
27528 <tgroup cols="4" colsep="0" rowsep="0">
27529 <colspec colwidth="8*" align="left"/>
27530 <colspec colwidth="6*" align="center"/>
27531 <colspec colwidth="6*" align="center"/>
27532 <colspec colwidth="6*" align="right"/>
27533 <tbody>
27534 <row>
27535 <entry><option>system_filter_group</option></entry>
27536 <entry>Use: <emphasis>main</emphasis></entry>
27537 <entry>Type: <emphasis>string</emphasis></entry>
27538 <entry>Default: <emphasis>unset</emphasis></entry>
27539 </row>
27540 </tbody>
27541 </tgroup>
27542 </informaltable>
27543 <para>
27544 <indexterm role="concept">
27545 <primary>gid (group id)</primary>
27546 <secondary>system filter</secondary>
27547 </indexterm>
27548 This option is used only when <option>system_filter_user</option> is also set. It sets the
27549 gid under which the system filter is run, overriding any gid that is associated
27550 with the user. The value may be numerical or symbolic.
27551 </para>
27552 <para>
27553 <indexterm role="option">
27554 <primary><option>system_filter_pipe_transport</option></primary>
27555 </indexterm>
27556 </para>
27557 <informaltable frame="all">
27558 <tgroup cols="4" colsep="0" rowsep="0">
27559 <colspec colwidth="8*" align="left"/>
27560 <colspec colwidth="6*" align="center"/>
27561 <colspec colwidth="6*" align="center"/>
27562 <colspec colwidth="6*" align="right"/>
27563 <tbody>
27564 <row>
27565 <entry><option>system_filter_pipe_transport</option></entry>
27566 <entry>Use: <emphasis>main</emphasis></entry>
27567 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27568 <entry>Default: <emphasis>unset</emphasis></entry>
27569 </row>
27570 </tbody>
27571 </tgroup>
27572 </informaltable>
27573 <para>
27574 <indexterm role="concept">
27575 <primary><command>pipe</command> transport</primary>
27576 <secondary>for system filter</secondary>
27577 </indexterm>
27578 <indexterm role="variable">
27579 <primary><varname>$address_pipe</varname></primary>
27580 </indexterm>
27581 This specifies the transport driver that is to be used when a <option>pipe</option> command
27582 is used in a system filter. During the delivery, the variable <varname>$address_pipe</varname>
27583 contains the pipe command.
27584 </para>
27585 <para>
27586 <indexterm role="option">
27587 <primary><option>system_filter_reply_transport</option></primary>
27588 </indexterm>
27589 </para>
27590 <informaltable frame="all">
27591 <tgroup cols="4" colsep="0" rowsep="0">
27592 <colspec colwidth="8*" align="left"/>
27593 <colspec colwidth="6*" align="center"/>
27594 <colspec colwidth="6*" align="center"/>
27595 <colspec colwidth="6*" align="right"/>
27596 <tbody>
27597 <row>
27598 <entry><option>system_filter_reply_transport</option></entry>
27599 <entry>Use: <emphasis>main</emphasis></entry>
27600 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27601 <entry>Default: <emphasis>unset</emphasis></entry>
27602 </row>
27603 </tbody>
27604 </tgroup>
27605 </informaltable>
27606 <para>
27607 <indexterm role="concept">
27608 <primary><command>autoreply</command> transport</primary>
27609 <secondary>for system filter</secondary>
27610 </indexterm>
27611 This specifies the transport driver that is to be used when a <option>mail</option> command
27612 is used in a system filter.
27613 </para>
27614 <para>
27615 <indexterm role="option">
27616 <primary><option>system_filter_user</option></primary>
27617 </indexterm>
27618 </para>
27619 <informaltable frame="all">
27620 <tgroup cols="4" colsep="0" rowsep="0">
27621 <colspec colwidth="8*" align="left"/>
27622 <colspec colwidth="6*" align="center"/>
27623 <colspec colwidth="6*" align="center"/>
27624 <colspec colwidth="6*" align="right"/>
27625 <tbody>
27626 <row>
27627 <entry><option>system_filter_user</option></entry>
27628 <entry>Use: <emphasis>main</emphasis></entry>
27629 <entry>Type: <emphasis>string</emphasis></entry>
27630 <entry>Default: <emphasis>unset</emphasis></entry>
27631 </row>
27632 </tbody>
27633 </tgroup>
27634 </informaltable>
27635 <para>
27636 <indexterm role="concept">
27637 <primary>uid (user id)</primary>
27638 <secondary>system filter</secondary>
27639 </indexterm>
27640 If this option is not set, the system filter is run in the main Exim delivery
27641 process, as root. When the option is set, the system filter runs in a separate
27642 process, as the given user. Unless the string consists entirely of digits, it
27643 is looked up in the password data. Failure to find the named user causes a
27644 configuration error. The gid is either taken from the password data, or
27645 specified by <option>system_filter_group</option>. When the uid is specified numerically,
27646 <option>system_filter_group</option> is required to be set.
27647 </para>
27648 <para>
27649 If the system filter generates any pipe, file, or reply deliveries, the uid
27650 under which the filter is run is used when transporting them, unless a
27651 transport option overrides. Normally you should set <option>system_filter_user</option> if
27652 your system filter generates these kinds of delivery.
27653 </para>
27654 <para>
27655 <indexterm role="option">
27656 <primary><option>tcp_nodelay</option></primary>
27657 </indexterm>
27658 </para>
27659 <informaltable frame="all">
27660 <tgroup cols="4" colsep="0" rowsep="0">
27661 <colspec colwidth="8*" align="left"/>
27662 <colspec colwidth="6*" align="center"/>
27663 <colspec colwidth="6*" align="center"/>
27664 <colspec colwidth="6*" align="right"/>
27665 <tbody>
27666 <row>
27667 <entry><option>tcp_nodelay</option></entry>
27668 <entry>Use: <emphasis>main</emphasis></entry>
27669 <entry>Type: <emphasis>boolean</emphasis></entry>
27670 <entry>Default: <emphasis>true</emphasis></entry>
27671 </row>
27672 </tbody>
27673 </tgroup>
27674 </informaltable>
27675 <para>
27676 <indexterm role="concept">
27677 <primary>daemon</primary>
27678 <secondary>TCP_NODELAY on sockets</secondary>
27679 </indexterm>
27680 <indexterm role="concept">
27681 <primary>Nagle algorithm</primary>
27682 </indexterm>
27683 <indexterm role="concept">
27684 <primary>TCP_NODELAY on listening sockets</primary>
27685 </indexterm>
27686 If this option is set false, it stops the Exim daemon setting the
27687 TCP_NODELAY option on its listening sockets. Setting TCP_NODELAY
27688 turns off the <quote>Nagle algorithm</quote>, which is a way of improving network
27689 performance in interactive (character-by-character) situations. Turning it off
27690 should improve Exim&#x2019;s performance a bit, so that is what happens by default.
27691 However, it appears that some broken clients cannot cope, and time out. Hence
27692 this option. It affects only those sockets that are set up for listening by the
27693 daemon. Sockets created by the smtp transport for delivering mail always set
27694 TCP_NODELAY.
27695 </para>
27696 <para>
27697 <indexterm role="option">
27698 <primary><option>timeout_frozen_after</option></primary>
27699 </indexterm>
27700 </para>
27701 <informaltable frame="all">
27702 <tgroup cols="4" colsep="0" rowsep="0">
27703 <colspec colwidth="8*" align="left"/>
27704 <colspec colwidth="6*" align="center"/>
27705 <colspec colwidth="6*" align="center"/>
27706 <colspec colwidth="6*" align="right"/>
27707 <tbody>
27708 <row>
27709 <entry><option>timeout_frozen_after</option></entry>
27710 <entry>Use: <emphasis>main</emphasis></entry>
27711 <entry>Type: <emphasis>time</emphasis></entry>
27712 <entry>Default: <emphasis>0s</emphasis></entry>
27713 </row>
27714 </tbody>
27715 </tgroup>
27716 </informaltable>
27717 <para>
27718 <indexterm role="concept">
27719 <primary>frozen messages</primary>
27720 <secondary>timing out</secondary>
27721 </indexterm>
27722 <indexterm role="concept">
27723 <primary>timeout</primary>
27724 <secondary>frozen messages</secondary>
27725 </indexterm>
27726 If <option>timeout_frozen_after</option> is set to a time greater than zero, a frozen
27727 message of any kind that has been on the queue for longer than the given time
27728 is automatically cancelled at the next queue run. If the frozen message is a
27729 bounce message, it is just discarded; otherwise, a bounce is sent to the
27730 sender, in a similar manner to cancellation by the <option>-Mg</option> command line option.
27731 If you want to timeout frozen bounce messages earlier than other kinds of
27732 frozen message, see <option>ignore_bounce_errors_after</option>.
27733 </para>
27734 <para>
27735 <emphasis role="bold">Note:</emphasis> the default value of zero means no timeouts; with this setting,
27736 frozen messages remain on the queue forever (except for any frozen bounce
27737 messages that are released by <option>ignore_bounce_errors_after</option>).
27738 </para>
27739 <para>
27740 <indexterm role="option">
27741 <primary><option>timezone</option></primary>
27742 </indexterm>
27743 </para>
27744 <informaltable frame="all">
27745 <tgroup cols="4" colsep="0" rowsep="0">
27746 <colspec colwidth="8*" align="left"/>
27747 <colspec colwidth="6*" align="center"/>
27748 <colspec colwidth="6*" align="center"/>
27749 <colspec colwidth="6*" align="right"/>
27750 <tbody>
27751 <row>
27752 <entry><option>timezone</option></entry>
27753 <entry>Use: <emphasis>main</emphasis></entry>
27754 <entry>Type: <emphasis>string</emphasis></entry>
27755 <entry>Default: <emphasis>unset</emphasis></entry>
27756 </row>
27757 </tbody>
27758 </tgroup>
27759 </informaltable>
27760 <para>
27761 <indexterm role="concept">
27762 <primary>timezone, setting</primary>
27763 </indexterm>
27764 The value of <option>timezone</option> is used to set the environment variable TZ while
27765 running Exim (if it is different on entry). This ensures that all timestamps
27766 created by Exim are in the required timezone. If you want all your timestamps
27767 to be in UTC (aka GMT) you should set
27768 </para>
27769 <literallayout class="monospaced">
27770 timezone = UTC
27771 </literallayout>
27772 <para>
27773 The default value is taken from TIMEZONE_DEFAULT in <filename>Local/Makefile</filename>,
27774 or, if that is not set, from the value of the TZ environment variable when Exim
27775 is built. If <option>timezone</option> is set to the empty string, either at build or run
27776 time, any existing TZ variable is removed from the environment when Exim
27777 runs. This is appropriate behaviour for obtaining wall-clock time on some, but
27778 unfortunately not all, operating systems.
27779 </para>
27780 <para>
27781 <indexterm role="option">
27782 <primary><option>tls_advertise_hosts</option></primary>
27783 </indexterm>
27784 </para>
27785 <informaltable frame="all">
27786 <tgroup cols="4" colsep="0" rowsep="0">
27787 <colspec colwidth="8*" align="left"/>
27788 <colspec colwidth="6*" align="center"/>
27789 <colspec colwidth="6*" align="center"/>
27790 <colspec colwidth="6*" align="right"/>
27791 <tbody>
27792 <row>
27793 <entry><option>tls_advertise_hosts</option></entry>
27794 <entry>Use: <emphasis>main</emphasis></entry>
27795 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
27796 <entry>Default: <emphasis>unset</emphasis></entry>
27797 </row>
27798 </tbody>
27799 </tgroup>
27800 </informaltable>
27801 <para>
27802 <indexterm role="concept">
27803 <primary>TLS</primary>
27804 <secondary>advertising</secondary>
27805 </indexterm>
27806 <indexterm role="concept">
27807 <primary>encryption</primary>
27808 <secondary>on SMTP connection</secondary>
27809 </indexterm>
27810 <indexterm role="concept">
27811 <primary>SMTP</primary>
27812 <secondary>encrypted connection</secondary>
27813 </indexterm>
27814 When Exim is built with support for TLS encrypted connections, the availability
27815 of the STARTTLS command to set up an encrypted session is advertised in
27816 response to EHLO only to those client hosts that match this option. See
27817 chapter <xref linkend="CHAPTLS"/> for details of Exim&#x2019;s support for TLS.
27818 </para>
27819 <para>
27820 <indexterm role="option">
27821 <primary><option>tls_certificate</option></primary>
27822 </indexterm>
27823 </para>
27824 <informaltable frame="all">
27825 <tgroup cols="4" colsep="0" rowsep="0">
27826 <colspec colwidth="8*" align="left"/>
27827 <colspec colwidth="6*" align="center"/>
27828 <colspec colwidth="6*" align="center"/>
27829 <colspec colwidth="6*" align="right"/>
27830 <tbody>
27831 <row>
27832 <entry><option>tls_certificate</option></entry>
27833 <entry>Use: <emphasis>main</emphasis></entry>
27834 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27835 <entry>Default: <emphasis>unset</emphasis></entry>
27836 </row>
27837 </tbody>
27838 </tgroup>
27839 </informaltable>
27840 <para>
27841 <indexterm role="concept">
27842 <primary>TLS</primary>
27843 <secondary>server certificate; location of</secondary>
27844 </indexterm>
27845 <indexterm role="concept">
27846 <primary>certificate</primary>
27847 <secondary>server, location of</secondary>
27848 </indexterm>
27849 The value of this option is expanded, and must then be the absolute path to a
27850 file which contains the server&#x2019;s certificates. The server&#x2019;s private key is also
27851 assumed to be in this file if <option>tls_privatekey</option> is unset. See chapter
27852 <xref linkend="CHAPTLS"/> for further details.
27853 </para>
27854 <para>
27855 <emphasis role="bold">Note</emphasis>: The certificates defined by this option are used only when Exim is
27856 receiving incoming messages as a server. If you want to supply certificates for
27857 use when sending messages as a client, you must set the <option>tls_certificate</option>
27858 option in the relevant <command>smtp</command> transport.
27859 </para>
27860 <para>
27861 <indexterm role="option">
27862 <primary><option>tls_crl</option></primary>
27863 </indexterm>
27864 </para>
27865 <informaltable frame="all">
27866 <tgroup cols="4" colsep="0" rowsep="0">
27867 <colspec colwidth="8*" align="left"/>
27868 <colspec colwidth="6*" align="center"/>
27869 <colspec colwidth="6*" align="center"/>
27870 <colspec colwidth="6*" align="right"/>
27871 <tbody>
27872 <row>
27873 <entry><option>tls_crl</option></entry>
27874 <entry>Use: <emphasis>main</emphasis></entry>
27875 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27876 <entry>Default: <emphasis>unset</emphasis></entry>
27877 </row>
27878 </tbody>
27879 </tgroup>
27880 </informaltable>
27881 <para>
27882 <indexterm role="concept">
27883 <primary>TLS</primary>
27884 <secondary>server certificate revocation list</secondary>
27885 </indexterm>
27886 <indexterm role="concept">
27887 <primary>certificate</primary>
27888 <secondary>revocation list for server</secondary>
27889 </indexterm>
27890 This option specifies a certificate revocation list. The expanded value must
27891 be the name of a file that contains a CRL in PEM format.
27892 </para>
27893 <para>
27894 <indexterm role="option">
27895 <primary><option>tls_dhparam</option></primary>
27896 </indexterm>
27897 </para>
27898 <informaltable frame="all">
27899 <tgroup cols="4" colsep="0" rowsep="0">
27900 <colspec colwidth="8*" align="left"/>
27901 <colspec colwidth="6*" align="center"/>
27902 <colspec colwidth="6*" align="center"/>
27903 <colspec colwidth="6*" align="right"/>
27904 <tbody>
27905 <row>
27906 <entry><option>tls_dhparam</option></entry>
27907 <entry>Use: <emphasis>main</emphasis></entry>
27908 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27909 <entry>Default: <emphasis>unset</emphasis></entry>
27910 </row>
27911 </tbody>
27912 </tgroup>
27913 </informaltable>
27914 <para>
27915 <indexterm role="concept">
27916 <primary>TLS</primary>
27917 <secondary>D-H parameters for server</secondary>
27918 </indexterm>
27919 The value of this option is expanded, and must then be the absolute path to
27920 a file which contains the server&#x2019;s DH parameter values.
27921 This is used only for OpenSSL. When Exim is linked with GnuTLS, this option is
27922 ignored. See section <xref linkend="SECTopenvsgnu"/> for further details.
27923 </para>
27924 <para>
27925 <indexterm role="option">
27926 <primary><option>tls_on_connect_ports</option></primary>
27927 </indexterm>
27928 </para>
27929 <informaltable frame="all">
27930 <tgroup cols="4" colsep="0" rowsep="0">
27931 <colspec colwidth="8*" align="left"/>
27932 <colspec colwidth="6*" align="center"/>
27933 <colspec colwidth="6*" align="center"/>
27934 <colspec colwidth="6*" align="right"/>
27935 <tbody>
27936 <row>
27937 <entry><option>tls_on_connect_ports</option></entry>
27938 <entry>Use: <emphasis>main</emphasis></entry>
27939 <entry>Type: <emphasis>string list</emphasis></entry>
27940 <entry>Default: <emphasis>unset</emphasis></entry>
27941 </row>
27942 </tbody>
27943 </tgroup>
27944 </informaltable>
27945 <para>
27946 This option specifies a list of incoming SSMTP (aka SMTPS) ports that should
27947 operate the obsolete SSMTP (SMTPS) protocol, where a TLS session is immediately
27948 set up without waiting for the client to issue a STARTTLS command. For
27949 further details, see section <xref linkend="SECTsupobssmt"/>.
27950 </para>
27951 <para>
27952 <indexterm role="option">
27953 <primary><option>tls_privatekey</option></primary>
27954 </indexterm>
27955 </para>
27956 <informaltable frame="all">
27957 <tgroup cols="4" colsep="0" rowsep="0">
27958 <colspec colwidth="8*" align="left"/>
27959 <colspec colwidth="6*" align="center"/>
27960 <colspec colwidth="6*" align="center"/>
27961 <colspec colwidth="6*" align="right"/>
27962 <tbody>
27963 <row>
27964 <entry><option>tls_privatekey</option></entry>
27965 <entry>Use: <emphasis>main</emphasis></entry>
27966 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27967 <entry>Default: <emphasis>unset</emphasis></entry>
27968 </row>
27969 </tbody>
27970 </tgroup>
27971 </informaltable>
27972 <para>
27973 <indexterm role="concept">
27974 <primary>TLS</primary>
27975 <secondary>server private key; location of</secondary>
27976 </indexterm>
27977 The value of this option is expanded, and must then be the absolute path to a
27978 file which contains the server&#x2019;s private key. If this option is unset, or if
27979 the expansion is forced to fail, or the result is an empty string, the private
27980 key is assumed to be in the same file as the server&#x2019;s certificates. See chapter
27981 <xref linkend="CHAPTLS"/> for further details.
27982 </para>
27983 <para>
27984 <indexterm role="option">
27985 <primary><option>tls_remember_esmtp</option></primary>
27986 </indexterm>
27987 </para>
27988 <informaltable frame="all">
27989 <tgroup cols="4" colsep="0" rowsep="0">
27990 <colspec colwidth="8*" align="left"/>
27991 <colspec colwidth="6*" align="center"/>
27992 <colspec colwidth="6*" align="center"/>
27993 <colspec colwidth="6*" align="right"/>
27994 <tbody>
27995 <row>
27996 <entry><option>tls_remember_esmtp</option></entry>
27997 <entry>Use: <emphasis>main</emphasis></entry>
27998 <entry>Type: <emphasis>boolean</emphasis></entry>
27999 <entry>Default: <emphasis>false</emphasis></entry>
28000 </row>
28001 </tbody>
28002 </tgroup>
28003 </informaltable>
28004 <para>
28005 <indexterm role="concept">
28006 <primary>TLS</primary>
28007 <secondary>esmtp state; remembering</secondary>
28008 </indexterm>
28009 <indexterm role="concept">
28010 <primary>TLS</primary>
28011 <secondary>broken clients</secondary>
28012 </indexterm>
28013 If this option is set true, Exim violates the RFCs by remembering that it is in
28014 <quote>esmtp</quote> state after successfully negotiating a TLS session. This provides
28015 support for broken clients that fail to send a new EHLO after starting a
28016 TLS session.
28017 </para>
28018 <para>
28019 <indexterm role="option">
28020 <primary><option>tls_require_ciphers</option></primary>
28021 </indexterm>
28022 </para>
28023 <informaltable frame="all">
28024 <tgroup cols="4" colsep="0" rowsep="0">
28025 <colspec colwidth="8*" align="left"/>
28026 <colspec colwidth="6*" align="center"/>
28027 <colspec colwidth="6*" align="center"/>
28028 <colspec colwidth="6*" align="right"/>
28029 <tbody>
28030 <row>
28031 <entry><option>tls_require_ciphers</option></entry>
28032 <entry>Use: <emphasis>main</emphasis></entry>
28033 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28034 <entry>Default: <emphasis>unset</emphasis></entry>
28035 </row>
28036 </tbody>
28037 </tgroup>
28038 </informaltable>
28039 <para>
28040 <indexterm role="concept">
28041 <primary>TLS</primary>
28042 <secondary>requiring specific ciphers</secondary>
28043 </indexterm>
28044 <indexterm role="concept">
28045 <primary>cipher</primary>
28046 <secondary>requiring specific</secondary>
28047 </indexterm>
28048 This option controls which ciphers can be used for incoming TLS connections.
28049 The <command>smtp</command> transport has an option of the same name for controlling outgoing
28050 connections. This option is expanded for each connection, so can be varied for
28051 different clients if required. The value of this option must be a list of
28052 permitted cipher suites. The OpenSSL and GnuTLS libraries handle cipher control
28053 in somewhat different ways. If GnuTLS is being used, the client controls the
28054 preference order of the available ciphers. Details are given in sections
28055 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
28056 </para>
28057 <para>
28058 <indexterm role="option">
28059 <primary><option>tls_try_verify_hosts</option></primary>
28060 </indexterm>
28061 </para>
28062 <informaltable frame="all">
28063 <tgroup cols="4" colsep="0" rowsep="0">
28064 <colspec colwidth="8*" align="left"/>
28065 <colspec colwidth="6*" align="center"/>
28066 <colspec colwidth="6*" align="center"/>
28067 <colspec colwidth="6*" align="right"/>
28068 <tbody>
28069 <row>
28070 <entry><option>tls_try_verify_hosts</option></entry>
28071 <entry>Use: <emphasis>main</emphasis></entry>
28072 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28073 <entry>Default: <emphasis>unset</emphasis></entry>
28074 </row>
28075 </tbody>
28076 </tgroup>
28077 </informaltable>
28078 <para>
28079 <indexterm role="concept">
28080 <primary>TLS</primary>
28081 <secondary>client certificate verification</secondary>
28082 </indexterm>
28083 <indexterm role="concept">
28084 <primary>certificate</primary>
28085 <secondary>verification of client</secondary>
28086 </indexterm>
28087 See <option>tls_verify_hosts</option> below.
28088 </para>
28089 <para>
28090 <indexterm role="option">
28091 <primary><option>tls_verify_certificates</option></primary>
28092 </indexterm>
28093 </para>
28094 <informaltable frame="all">
28095 <tgroup cols="4" colsep="0" rowsep="0">
28096 <colspec colwidth="8*" align="left"/>
28097 <colspec colwidth="6*" align="center"/>
28098 <colspec colwidth="6*" align="center"/>
28099 <colspec colwidth="6*" align="right"/>
28100 <tbody>
28101 <row>
28102 <entry><option>tls_verify_certificates</option></entry>
28103 <entry>Use: <emphasis>main</emphasis></entry>
28104 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28105 <entry>Default: <emphasis>unset</emphasis></entry>
28106 </row>
28107 </tbody>
28108 </tgroup>
28109 </informaltable>
28110 <para>
28111 <indexterm role="concept">
28112 <primary>TLS</primary>
28113 <secondary>client certificate verification</secondary>
28114 </indexterm>
28115 <indexterm role="concept">
28116 <primary>certificate</primary>
28117 <secondary>verification of client</secondary>
28118 </indexterm>
28119 The value of this option is expanded, and must then be the absolute path to
28120 a file containing permitted certificates for clients that
28121 match <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option>. Alternatively, if you
28122 are using OpenSSL, you can set <option>tls_verify_certificates</option> to the name of a
28123 directory containing certificate files. This does not work with GnuTLS; the
28124 option must be set to the name of a single file if you are using GnuTLS.
28125 </para>
28126 <para>
28127 <indexterm role="option">
28128 <primary><option>tls_verify_hosts</option></primary>
28129 </indexterm>
28130 </para>
28131 <informaltable frame="all">
28132 <tgroup cols="4" colsep="0" rowsep="0">
28133 <colspec colwidth="8*" align="left"/>
28134 <colspec colwidth="6*" align="center"/>
28135 <colspec colwidth="6*" align="center"/>
28136 <colspec colwidth="6*" align="right"/>
28137 <tbody>
28138 <row>
28139 <entry><option>tls_verify_hosts</option></entry>
28140 <entry>Use: <emphasis>main</emphasis></entry>
28141 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28142 <entry>Default: <emphasis>unset</emphasis></entry>
28143 </row>
28144 </tbody>
28145 </tgroup>
28146 </informaltable>
28147 <para>
28148 <indexterm role="concept">
28149 <primary>TLS</primary>
28150 <secondary>client certificate verification</secondary>
28151 </indexterm>
28152 <indexterm role="concept">
28153 <primary>certificate</primary>
28154 <secondary>verification of client</secondary>
28155 </indexterm>
28156 This option, along with <option>tls_try_verify_hosts</option>, controls the checking of
28157 certificates from clients. The expected certificates are defined by
28158 <option>tls_verify_certificates</option>, which must be set. A configuration error occurs if
28159 either <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> is set and
28160 <option>tls_verify_certificates</option> is not set.
28161 </para>
28162 <para>
28163 Any client that matches <option>tls_verify_hosts</option> is constrained by
28164 <option>tls_verify_certificates</option>. When the client initiates a TLS session, it must
28165 present one of the listed certificates. If it does not, the connection is
28166 aborted. <emphasis role="bold">Warning</emphasis>: Including a host in <option>tls_verify_hosts</option> does not require
28167 the host to use TLS. It can still send SMTP commands through unencrypted
28168 connections. Forcing a client to use TLS has to be done separately using an
28169 ACL to reject inappropriate commands when the connection is not encrypted.
28170 </para>
28171 <para>
28172 A weaker form of checking is provided by <option>tls_try_verify_hosts</option>. If a client
28173 matches this option (but not <option>tls_verify_hosts</option>), Exim requests a
28174 certificate and checks it against <option>tls_verify_certificates</option>, but does not
28175 abort the connection if there is no certificate or if it does not match. This
28176 state can be detected in an ACL, which makes it possible to implement policies
28177 such as <quote>accept for relay only if a verified certificate has been received,
28178 but accept for local delivery if encrypted, even without a verified
28179 certificate</quote>.
28180 </para>
28181 <para>
28182 Client hosts that match neither of these lists are not asked to present
28183 certificates.
28184 </para>
28185 <para>
28186 <indexterm role="option">
28187 <primary><option>trusted_groups</option></primary>
28188 </indexterm>
28189 </para>
28190 <informaltable frame="all">
28191 <tgroup cols="4" colsep="0" rowsep="0">
28192 <colspec colwidth="8*" align="left"/>
28193 <colspec colwidth="6*" align="center"/>
28194 <colspec colwidth="6*" align="center"/>
28195 <colspec colwidth="6*" align="right"/>
28196 <tbody>
28197 <row>
28198 <entry><option>trusted_groups</option></entry>
28199 <entry>Use: <emphasis>main</emphasis></entry>
28200 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
28201 <entry>Default: <emphasis>unset</emphasis></entry>
28202 </row>
28203 </tbody>
28204 </tgroup>
28205 </informaltable>
28206 <para>
28207 <indexterm role="concept">
28208 <primary>trusted groups</primary>
28209 </indexterm>
28210 <indexterm role="concept">
28211 <primary>groups</primary>
28212 <secondary>trusted</secondary>
28213 </indexterm>
28214 This option is expanded just once, at the start of Exim&#x2019;s processing. If this
28215 option is set, any process that is running in one of the listed groups, or
28216 which has one of them as a supplementary group, is trusted. The groups can be
28217 specified numerically or by name. See section <xref linkend="SECTtrustedadmin"/> for
28218 details of what trusted callers are permitted to do. If neither
28219 <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the Exim user
28220 are trusted.
28221 </para>
28222 <para>
28223 <indexterm role="option">
28224 <primary><option>trusted_users</option></primary>
28225 </indexterm>
28226 </para>
28227 <informaltable frame="all">
28228 <tgroup cols="4" colsep="0" rowsep="0">
28229 <colspec colwidth="8*" align="left"/>
28230 <colspec colwidth="6*" align="center"/>
28231 <colspec colwidth="6*" align="center"/>
28232 <colspec colwidth="6*" align="right"/>
28233 <tbody>
28234 <row>
28235 <entry><option>trusted_users</option></entry>
28236 <entry>Use: <emphasis>main</emphasis></entry>
28237 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
28238 <entry>Default: <emphasis>unset</emphasis></entry>
28239 </row>
28240 </tbody>
28241 </tgroup>
28242 </informaltable>
28243 <para>
28244 <indexterm role="concept">
28245 <primary>trusted users</primary>
28246 </indexterm>
28247 <indexterm role="concept">
28248 <primary>user</primary>
28249 <secondary>trusted</secondary>
28250 </indexterm>
28251 This option is expanded just once, at the start of Exim&#x2019;s processing. If this
28252 option is set, any process that is running as one of the listed users is
28253 trusted. The users can be specified numerically or by name. See section
28254 <xref linkend="SECTtrustedadmin"/> for details of what trusted callers are permitted to do.
28255 If neither <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the
28256 Exim user are trusted.
28257 </para>
28258 <para>
28259 <indexterm role="option">
28260 <primary><option>unknown_login</option></primary>
28261 </indexterm>
28262 </para>
28263 <informaltable frame="all">
28264 <tgroup cols="4" colsep="0" rowsep="0">
28265 <colspec colwidth="8*" align="left"/>
28266 <colspec colwidth="6*" align="center"/>
28267 <colspec colwidth="6*" align="center"/>
28268 <colspec colwidth="6*" align="right"/>
28269 <tbody>
28270 <row>
28271 <entry><option>unknown_login</option></entry>
28272 <entry>Use: <emphasis>main</emphasis></entry>
28273 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28274 <entry>Default: <emphasis>unset</emphasis></entry>
28275 </row>
28276 </tbody>
28277 </tgroup>
28278 </informaltable>
28279 <para>
28280 <indexterm role="concept">
28281 <primary>uid (user id)</primary>
28282 <secondary>unknown caller</secondary>
28283 </indexterm>
28284 <indexterm role="variable">
28285 <primary><varname>$caller_uid</varname></primary>
28286 </indexterm>
28287 This is a specialized feature for use in unusual configurations. By default, if
28288 the uid of the caller of Exim cannot be looked up using <function>getpwuid()</function>, Exim
28289 gives up. The <option>unknown_login</option> option can be used to set a login name to be
28290 used in this circumstance. It is expanded, so values like <option>user$caller_uid</option>
28291 can be set. When <option>unknown_login</option> is used, the value of <option>unknown_username</option>
28292 is used for the user&#x2019;s real name (gecos field), unless this has been set by the
28293 <option>-F</option> option.
28294 </para>
28295 <para>
28296 <indexterm role="option">
28297 <primary><option>unknown_username</option></primary>
28298 </indexterm>
28299 </para>
28300 <informaltable frame="all">
28301 <tgroup cols="4" colsep="0" rowsep="0">
28302 <colspec colwidth="8*" align="left"/>
28303 <colspec colwidth="6*" align="center"/>
28304 <colspec colwidth="6*" align="center"/>
28305 <colspec colwidth="6*" align="right"/>
28306 <tbody>
28307 <row>
28308 <entry><option>unknown_username</option></entry>
28309 <entry>Use: <emphasis>main</emphasis></entry>
28310 <entry>Type: <emphasis>string</emphasis></entry>
28311 <entry>Default: <emphasis>unset</emphasis></entry>
28312 </row>
28313 </tbody>
28314 </tgroup>
28315 </informaltable>
28316 <para>
28317 See <option>unknown_login</option>.
28318 </para>
28319 <para>
28320 <indexterm role="option">
28321 <primary><option>untrusted_set_sender</option></primary>
28322 </indexterm>
28323 </para>
28324 <informaltable frame="all">
28325 <tgroup cols="4" colsep="0" rowsep="0">
28326 <colspec colwidth="8*" align="left"/>
28327 <colspec colwidth="6*" align="center"/>
28328 <colspec colwidth="6*" align="center"/>
28329 <colspec colwidth="6*" align="right"/>
28330 <tbody>
28331 <row>
28332 <entry><option>untrusted_set_sender</option></entry>
28333 <entry>Use: <emphasis>main</emphasis></entry>
28334 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
28335 <entry>Default: <emphasis>unset</emphasis></entry>
28336 </row>
28337 </tbody>
28338 </tgroup>
28339 </informaltable>
28340 <para>
28341 <indexterm role="concept">
28342 <primary>trusted users</primary>
28343 </indexterm>
28344 <indexterm role="concept">
28345 <primary>sender</primary>
28346 <secondary>setting by untrusted user</secondary>
28347 </indexterm>
28348 <indexterm role="concept">
28349 <primary>untrusted user setting sender</primary>
28350 </indexterm>
28351 <indexterm role="concept">
28352 <primary>user</primary>
28353 <secondary>untrusted setting sender</secondary>
28354 </indexterm>
28355 <indexterm role="concept">
28356 <primary>envelope sender</primary>
28357 </indexterm>
28358 When an untrusted user submits a message to Exim using the standard input, Exim
28359 normally creates an envelope sender address from the user&#x2019;s login and the
28360 default qualification domain. Data from the <option>-f</option> option (for setting envelope
28361 senders on non-SMTP messages) or the SMTP MAIL command (if <option>-bs</option> or <option>-bS</option>
28362 is used) is ignored.
28363 </para>
28364 <para>
28365 However, untrusted users are permitted to set an empty envelope sender address,
28366 to declare that a message should never generate any bounces. For example:
28367 </para>
28368 <literallayout class="monospaced">
28369 exim -f '&lt;&gt;' user@domain.example
28370 </literallayout>
28371 <para>
28372 <indexterm role="variable">
28373 <primary><varname>$sender_ident</varname></primary>
28374 </indexterm>
28375 The <option>untrusted_set_sender</option> option allows you to permit untrusted users to set
28376 other envelope sender addresses in a controlled way. When it is set, untrusted
28377 users are allowed to set envelope sender addresses that match any of the
28378 patterns in the list. Like all address lists, the string is expanded. The
28379 identity of the user is in <varname>$sender_ident</varname>, so you can, for example, restrict
28380 users to setting senders that start with their login ids
28381 followed by a hyphen
28382 by a setting like this:
28383 </para>
28384 <literallayout class="monospaced">
28385 untrusted_set_sender = ^$sender_ident-
28386 </literallayout>
28387 <para>
28388 If you want to allow untrusted users to set envelope sender addresses without
28389 restriction, you can use
28390 </para>
28391 <literallayout class="monospaced">
28392 untrusted_set_sender = *
28393 </literallayout>
28394 <para>
28395 The <option>untrusted_set_sender</option> option applies to all forms of local input, but
28396 only to the setting of the envelope sender. It does not permit untrusted users
28397 to use the other options which trusted user can use to override message
28398 parameters. Furthermore, it does not stop Exim from removing an existing
28399 <emphasis>Sender:</emphasis> header in the message, or from adding a <emphasis>Sender:</emphasis> header if
28400 necessary. See <option>local_sender_retain</option> and <option>local_from_check</option> for ways of
28401 overriding these actions. The handling of the <emphasis>Sender:</emphasis> header is also
28402 described in section <xref linkend="SECTthesenhea"/>.
28403 </para>
28404 <para>
28405 The log line for a message&#x2019;s arrival shows the envelope sender following
28406 <quote>&lt;=</quote>. For local messages, the user&#x2019;s login always follows, after <quote>U=</quote>. In
28407 <option>-bp</option> displays, and in the Exim monitor, if an untrusted user sets an
28408 envelope sender address, the user&#x2019;s login is shown in parentheses after the
28409 sender address.
28410 </para>
28411 <para>
28412 <indexterm role="option">
28413 <primary><option>uucp_from_pattern</option></primary>
28414 </indexterm>
28415 </para>
28416 <informaltable frame="all">
28417 <tgroup cols="4" colsep="0" rowsep="0">
28418 <colspec colwidth="8*" align="left"/>
28419 <colspec colwidth="6*" align="center"/>
28420 <colspec colwidth="6*" align="center"/>
28421 <colspec colwidth="6*" align="right"/>
28422 <tbody>
28423 <row>
28424 <entry><option>uucp_from_pattern</option></entry>
28425 <entry>Use: <emphasis>main</emphasis></entry>
28426 <entry>Type: <emphasis>string</emphasis></entry>
28427 <entry>Default: <emphasis>see below</emphasis></entry>
28428 </row>
28429 </tbody>
28430 </tgroup>
28431 </informaltable>
28432 <para>
28433 <indexterm role="concept">
28434 <primary><quote>From</quote> line</primary>
28435 </indexterm>
28436 <indexterm role="concept">
28437 <primary>UUCP</primary>
28438 <secondary><quote>From</quote> line</secondary>
28439 </indexterm>
28440 Some applications that pass messages to an MTA via a command line interface use
28441 an initial line starting with <quote>From&nbsp;</quote> to pass the envelope sender. In
28442 particular, this is used by UUCP software. Exim recognizes such a line by means
28443 of a regular expression that is set in <option>uucp_from_pattern</option>. When the pattern
28444 matches, the sender address is constructed by expanding the contents of
28445 <option>uucp_from_sender</option>, provided that the caller of Exim is a trusted user. The
28446 default pattern recognizes lines in the following two forms:
28447 </para>
28448 <literallayout class="monospaced">
28449 From ph10 Fri Jan  5 12:35 GMT 1996
28450 From ph10 Fri, 7 Jan 97 14:00:00 GMT
28451 </literallayout>
28452 <para>
28453 The pattern can be seen by running
28454 </para>
28455 <literallayout class="monospaced">
28456 exim -bP uucp_from_pattern
28457 </literallayout>
28458 <para>
28459 It checks only up to the hours and minutes, and allows for a 2-digit or 4-digit
28460 year in the second case. The first word after <quote>From&nbsp;</quote> is matched in the
28461 regular expression by a parenthesized subpattern. The default value for
28462 <option>uucp_from_sender</option> is <quote>$1</quote>, which therefore just uses this first word
28463 (<quote>ph10</quote> in the example above) as the message&#x2019;s sender. See also
28464 <option>ignore_fromline_hosts</option>.
28465 </para>
28466 <para>
28467 <indexterm role="option">
28468 <primary><option>uucp_from_sender</option></primary>
28469 </indexterm>
28470 </para>
28471 <informaltable frame="all">
28472 <tgroup cols="4" colsep="0" rowsep="0">
28473 <colspec colwidth="8*" align="left"/>
28474 <colspec colwidth="6*" align="center"/>
28475 <colspec colwidth="6*" align="center"/>
28476 <colspec colwidth="6*" align="right"/>
28477 <tbody>
28478 <row>
28479 <entry><option>uucp_from_sender</option></entry>
28480 <entry>Use: <emphasis>main</emphasis></entry>
28481 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28482 <entry>Default: <emphasis><literal>$1</literal></emphasis></entry>
28483 </row>
28484 </tbody>
28485 </tgroup>
28486 </informaltable>
28487 <para>
28488 See <option>uucp_from_pattern</option> above.
28489 </para>
28490 <para>
28491 <indexterm role="option">
28492 <primary><option>warn_message_file</option></primary>
28493 </indexterm>
28494 </para>
28495 <informaltable frame="all">
28496 <tgroup cols="4" colsep="0" rowsep="0">
28497 <colspec colwidth="8*" align="left"/>
28498 <colspec colwidth="6*" align="center"/>
28499 <colspec colwidth="6*" align="center"/>
28500 <colspec colwidth="6*" align="right"/>
28501 <tbody>
28502 <row>
28503 <entry><option>warn_message_file</option></entry>
28504 <entry>Use: <emphasis>main</emphasis></entry>
28505 <entry>Type: <emphasis>string</emphasis></entry>
28506 <entry>Default: <emphasis>unset</emphasis></entry>
28507 </row>
28508 </tbody>
28509 </tgroup>
28510 </informaltable>
28511 <para>
28512 <indexterm role="concept">
28513 <primary>warning of delay</primary>
28514 <secondary>customizing the message</secondary>
28515 </indexterm>
28516 <indexterm role="concept">
28517 <primary>customizing</primary>
28518 <secondary>warning message</secondary>
28519 </indexterm>
28520 This option defines a template file containing paragraphs of text to be used
28521 for constructing the warning message which is sent by Exim when a message has
28522 been on the queue for a specified amount of time, as specified by
28523 <option>delay_warning</option>. Details of the file&#x2019;s contents are given in chapter
28524 <xref linkend="CHAPemsgcust"/>. See also <option>bounce_message_file</option>.
28525 </para>
28526 <para>
28527 <indexterm role="option">
28528 <primary><option>write_rejectlog</option></primary>
28529 </indexterm>
28530 </para>
28531 <informaltable frame="all">
28532 <tgroup cols="4" colsep="0" rowsep="0">
28533 <colspec colwidth="8*" align="left"/>
28534 <colspec colwidth="6*" align="center"/>
28535 <colspec colwidth="6*" align="center"/>
28536 <colspec colwidth="6*" align="right"/>
28537 <tbody>
28538 <row>
28539 <entry><option>write_rejectlog</option></entry>
28540 <entry>Use: <emphasis>main</emphasis></entry>
28541 <entry>Type: <emphasis>boolean</emphasis></entry>
28542 <entry>Default: <emphasis>true</emphasis></entry>
28543 </row>
28544 </tbody>
28545 </tgroup>
28546 </informaltable>
28547 <para>
28548 <indexterm role="concept">
28549 <primary>reject log</primary>
28550 <secondary>disabling</secondary>
28551 </indexterm>
28552 If this option is set false, Exim no longer writes anything to the reject log.
28553 See chapter <xref linkend="CHAPlog"/> for details of what Exim writes to its logs.
28554 <indexterm role="concept" startref="IIDconfima" class="endofrange"/>
28555 <indexterm role="concept" startref="IIDmaiconf" class="endofrange"/>
28556 </para>
28557 </section>
28558 </chapter>
28559
28560 <chapter id="CHAProutergeneric">
28561 <title>Generic options for routers</title>
28562 <para>
28563 <indexterm role="concept" id="IIDgenoprou1" class="startofrange">
28564 <primary>options</primary>
28565 <secondary>generic; for routers</secondary>
28566 </indexterm>
28567 <indexterm role="concept" id="IIDgenoprou2" class="startofrange">
28568 <primary>generic options</primary>
28569 <secondary>router</secondary>
28570 </indexterm>
28571 This chapter describes the generic options that apply to all routers.
28572 Those that are preconditions are marked with &Dagger; in the <quote>use</quote> field.
28573 </para>
28574 <para>
28575 For a general description of how a router operates, see sections
28576 <xref linkend="SECTrunindrou"/> and <xref linkend="SECTrouprecon"/>. The latter specifies the order in
28577 which the preconditions are tested. The order of expansion of the options that
28578 provide data for a transport is: <option>errors_to</option>, <option>headers_add</option>,
28579 <option>headers_remove</option>, <option>transport</option>.
28580 </para>
28581 <para>
28582 <indexterm role="option">
28583 <primary><option>address_data</option></primary>
28584 </indexterm>
28585 </para>
28586 <informaltable frame="all">
28587 <tgroup cols="4" colsep="0" rowsep="0">
28588 <colspec colwidth="8*" align="left"/>
28589 <colspec colwidth="6*" align="center"/>
28590 <colspec colwidth="6*" align="center"/>
28591 <colspec colwidth="6*" align="right"/>
28592 <tbody>
28593 <row>
28594 <entry><option>address_data</option></entry>
28595 <entry>Use: <emphasis>routers</emphasis></entry>
28596 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28597 <entry>Default: <emphasis>unset</emphasis></entry>
28598 </row>
28599 </tbody>
28600 </tgroup>
28601 </informaltable>
28602 <para>
28603 <indexterm role="concept">
28604 <primary>router</primary>
28605 <secondary>data attached to address</secondary>
28606 </indexterm>
28607 The string is expanded just before the router is run, that is, after all the
28608 precondition tests have succeeded. If the expansion is forced to fail, the
28609 router declines, the value of <option>address_data</option> remains unchanged, and the
28610 <option>more</option> option controls what happens next. Other expansion failures cause
28611 delivery of the address to be deferred.
28612 </para>
28613 <para>
28614 <indexterm role="variable">
28615 <primary><varname>$address_data</varname></primary>
28616 </indexterm>
28617 When the expansion succeeds, the value is retained with the address, and can be
28618 accessed using the variable <varname>$address_data</varname> in the current router, subsequent
28619 routers, and the eventual transport.
28620 </para>
28621 <para>
28622 <emphasis role="bold">Warning</emphasis>: If the current or any subsequent router is a <command>redirect</command> router
28623 that runs a user&#x2019;s filter file, the contents of <varname>$address_data</varname> are accessible
28624 in the filter. This is not normally a problem, because such data is usually
28625 either not confidential or it <quote>belongs</quote> to the current user, but if you do
28626 put confidential data into <varname>$address_data</varname> you need to remember this point.
28627 </para>
28628 <para>
28629 Even if the router declines or passes, the value of <varname>$address_data</varname> remains
28630 with the address, though it can be changed by another <option>address_data</option> setting
28631 on a subsequent router. If a router generates child addresses, the value of
28632 <varname>$address_data</varname> propagates to them. This also applies to the special kind of
28633 <quote>child</quote> that is generated by a router with the <option>unseen</option> option.
28634 </para>
28635 <para>
28636 The idea of <option>address_data</option> is that you can use it to look up a lot of data
28637 for the address once, and then pick out parts of the data later. For example,
28638 you could use a single LDAP lookup to return a string of the form
28639 </para>
28640 <literallayout class="monospaced">
28641 uid=1234 gid=5678 mailbox=/mail/xyz forward=/home/xyz/.forward
28642 </literallayout>
28643 <para>
28644 In the transport you could pick out the mailbox by a setting such as
28645 </para>
28646 <literallayout class="monospaced">
28647 file = ${extract{mailbox}{$address_data}}
28648 </literallayout>
28649 <para>
28650 This makes the configuration file less messy, and also reduces the number of
28651 lookups (though Exim does cache lookups).
28652 </para>
28653 <para>
28654 <indexterm role="variable">
28655 <primary><varname>$sender_address_data</varname></primary>
28656 </indexterm>
28657 <indexterm role="variable">
28658 <primary><varname>$address_data</varname></primary>
28659 </indexterm>
28660 The <option>address_data</option> facility is also useful as a means of passing information
28661 from one router to another, and from a router to a transport. In addition, if
28662 <varname>$address_data</varname> is set by a router when verifying a recipient address from an
28663 ACL, it remains available for use in the rest of the ACL statement. After
28664 verifying a sender, the value is transferred to <varname>$sender_address_data</varname>.
28665 </para>
28666 <para>
28667 <indexterm role="option">
28668 <primary><option>address_test</option></primary>
28669 </indexterm>
28670 </para>
28671 <informaltable frame="all">
28672 <tgroup cols="4" colsep="0" rowsep="0">
28673 <colspec colwidth="8*" align="left"/>
28674 <colspec colwidth="6*" align="center"/>
28675 <colspec colwidth="6*" align="center"/>
28676 <colspec colwidth="6*" align="right"/>
28677 <tbody>
28678 <row>
28679 <entry><option>address_test</option></entry>
28680 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
28681 <entry>Type: <emphasis>boolean</emphasis></entry>
28682 <entry>Default: <emphasis>true</emphasis></entry>
28683 </row>
28684 </tbody>
28685 </tgroup>
28686 </informaltable>
28687 <para>
28688 <indexterm role="option">
28689 <primary><option>-bt</option></primary>
28690 </indexterm>
28691 <indexterm role="concept">
28692 <primary>router</primary>
28693 <secondary>skipping when address testing</secondary>
28694 </indexterm>
28695 If this option is set false, the router is skipped when routing is being tested
28696 by means of the <option>-bt</option> command line option. This can be a convenience when
28697 your first router sends messages to an external scanner, because it saves you
28698 having to set the <quote>already scanned</quote> indicator when testing real address
28699 routing.
28700 </para>
28701 <para>
28702 <indexterm role="option">
28703 <primary><option>cannot_route_message</option></primary>
28704 </indexterm>
28705 </para>
28706 <informaltable frame="all">
28707 <tgroup cols="4" colsep="0" rowsep="0">
28708 <colspec colwidth="8*" align="left"/>
28709 <colspec colwidth="6*" align="center"/>
28710 <colspec colwidth="6*" align="center"/>
28711 <colspec colwidth="6*" align="right"/>
28712 <tbody>
28713 <row>
28714 <entry><option>cannot_route_message</option></entry>
28715 <entry>Use: <emphasis>routers</emphasis></entry>
28716 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28717 <entry>Default: <emphasis>unset</emphasis></entry>
28718 </row>
28719 </tbody>
28720 </tgroup>
28721 </informaltable>
28722 <para>
28723 <indexterm role="concept">
28724 <primary>router</primary>
28725 <secondary>customizing <quote>cannot route</quote> message</secondary>
28726 </indexterm>
28727 <indexterm role="concept">
28728 <primary>customizing</primary>
28729 <secondary><quote>cannot route</quote> message</secondary>
28730 </indexterm>
28731 This option specifies a text message that is used when an address cannot be
28732 routed because Exim has run out of routers. The default message is
28733 <quote>Unrouteable address</quote>. This option is useful only on routers that have
28734 <option>more</option> set false, or on the very last router in a configuration, because the
28735 value that is used is taken from the last router that is considered. This
28736 includes a router that is skipped because its preconditions are not met, as
28737 well as a router that declines. For example, using the default configuration,
28738 you could put:
28739 </para>
28740 <literallayout class="monospaced">
28741 cannot_route_message = Remote domain not found in DNS
28742 </literallayout>
28743 <para>
28744 on the first router, which is a <command>dnslookup</command> router with <option>more</option> set false,
28745 and
28746 </para>
28747 <literallayout class="monospaced">
28748 cannot_route_message = Unknown local user
28749 </literallayout>
28750 <para>
28751 on the final router that checks for local users. If string expansion fails for
28752 this option, the default message is used. Unless the expansion failure was
28753 explicitly forced, a message about the failure is written to the main and panic
28754 logs, in addition to the normal message about the routing failure.
28755 </para>
28756 <para>
28757 <indexterm role="option">
28758 <primary><option>caseful_local_part</option></primary>
28759 </indexterm>
28760 </para>
28761 <informaltable frame="all">
28762 <tgroup cols="4" colsep="0" rowsep="0">
28763 <colspec colwidth="8*" align="left"/>
28764 <colspec colwidth="6*" align="center"/>
28765 <colspec colwidth="6*" align="center"/>
28766 <colspec colwidth="6*" align="right"/>
28767 <tbody>
28768 <row>
28769 <entry><option>caseful_local_part</option></entry>
28770 <entry>Use: <emphasis>routers</emphasis></entry>
28771 <entry>Type: <emphasis>boolean</emphasis></entry>
28772 <entry>Default: <emphasis>false</emphasis></entry>
28773 </row>
28774 </tbody>
28775 </tgroup>
28776 </informaltable>
28777 <para>
28778 <indexterm role="concept">
28779 <primary>case of local parts</primary>
28780 </indexterm>
28781 <indexterm role="concept">
28782 <primary>router</primary>
28783 <secondary>case of local parts</secondary>
28784 </indexterm>
28785 By default, routers handle the local parts of addresses in a case-insensitive
28786 manner, though the actual case is preserved for transmission with the message.
28787 If you want the case of letters to be significant in a router, you must set
28788 this option true. For individual router options that contain address or local
28789 part lists (for example, <option>local_parts</option>), case-sensitive matching can be
28790 turned on by <quote>+caseful</quote> as a list item. See section <xref linkend="SECTcasletadd"/> for
28791 more details.
28792 </para>
28793 <para>
28794 <indexterm role="variable">
28795 <primary><varname>$local_part</varname></primary>
28796 </indexterm>
28797 <indexterm role="variable">
28798 <primary><varname>$original_local_part</varname></primary>
28799 </indexterm>
28800 <indexterm role="variable">
28801 <primary><varname>$parent_local_part</varname></primary>
28802 </indexterm>
28803 The value of the <varname>$local_part</varname> variable is forced to lower case while a
28804 router is running unless <option>caseful_local_part</option> is set. When a router assigns
28805 an address to a transport, the value of <varname>$local_part</varname> when the transport runs
28806 is the same as it was in the router. Similarly, when a router generates child
28807 addresses by aliasing or forwarding, the values of <varname>$original_local_part</varname>
28808 and <varname>$parent_local_part</varname> are those that were used by the redirecting router.
28809 </para>
28810 <para>
28811 This option applies to the processing of an address by a router. When a
28812 recipient address is being processed in an ACL, there is a separate <option>control</option>
28813 modifier that can be used to specify case-sensitive processing within the ACL
28814 (see section <xref linkend="SECTcontrols"/>).
28815 </para>
28816 <para>
28817 <indexterm role="option">
28818 <primary><option>check_local_user</option></primary>
28819 </indexterm>
28820 </para>
28821 <informaltable frame="all">
28822 <tgroup cols="4" colsep="0" rowsep="0">
28823 <colspec colwidth="8*" align="left"/>
28824 <colspec colwidth="6*" align="center"/>
28825 <colspec colwidth="6*" align="center"/>
28826 <colspec colwidth="6*" align="right"/>
28827 <tbody>
28828 <row>
28829 <entry><option>check_local_user</option></entry>
28830 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
28831 <entry>Type: <emphasis>boolean</emphasis></entry>
28832 <entry>Default: <emphasis>false</emphasis></entry>
28833 </row>
28834 </tbody>
28835 </tgroup>
28836 </informaltable>
28837 <para>
28838 <indexterm role="concept">
28839 <primary>local user, checking in router</primary>
28840 </indexterm>
28841 <indexterm role="concept">
28842 <primary>router</primary>
28843 <secondary>checking for local user</secondary>
28844 </indexterm>
28845 <indexterm role="concept">
28846 <primary><filename>/etc/passwd</filename></primary>
28847 </indexterm>
28848 <indexterm role="variable">
28849 <primary><varname>$home</varname></primary>
28850 </indexterm>
28851 When this option is true, Exim checks that the local part of the recipient
28852 address (with affixes removed if relevant) is the name of an account on the
28853 local system. The check is done by calling the <function>getpwnam()</function> function rather
28854 than trying to read <filename>/etc/passwd</filename> directly. This means that other methods of
28855 holding password data (such as NIS) are supported. If the local part is a local
28856 user, <varname>$home</varname> is set from the password data, and can be tested in other
28857 preconditions that are evaluated after this one (the order of evaluation is
28858 given in section <xref linkend="SECTrouprecon"/>). However, the value of <varname>$home</varname> can be
28859 overridden by <option>router_home_directory</option>. If the local part is not a local user,
28860 the router is skipped.
28861 </para>
28862 <para>
28863 If you want to check that the local part is either the name of a local user
28864 or matches something else, you cannot combine <option>check_local_user</option> with a
28865 setting of <option>local_parts</option>, because that specifies the logical <emphasis>and</emphasis> of the
28866 two conditions. However, you can use a <command>passwd</command> lookup in a <option>local_parts</option>
28867 setting to achieve this. For example:
28868 </para>
28869 <literallayout class="monospaced">
28870 local_parts = passwd;$local_part : lsearch;/etc/other/users
28871 </literallayout>
28872 <para>
28873 Note, however, that the side effects of <option>check_local_user</option> (such as setting
28874 up a home directory) do not occur when a <command>passwd</command> lookup is used in a
28875 <option>local_parts</option> (or any other) precondition.
28876 </para>
28877 <para>
28878 <indexterm role="option">
28879 <primary><option>condition</option></primary>
28880 </indexterm>
28881 </para>
28882 <informaltable frame="all">
28883 <tgroup cols="4" colsep="0" rowsep="0">
28884 <colspec colwidth="8*" align="left"/>
28885 <colspec colwidth="6*" align="center"/>
28886 <colspec colwidth="6*" align="center"/>
28887 <colspec colwidth="6*" align="right"/>
28888 <tbody>
28889 <row>
28890 <entry><option>condition</option></entry>
28891 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
28892 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28893 <entry>Default: <emphasis>unset</emphasis></entry>
28894 </row>
28895 </tbody>
28896 </tgroup>
28897 </informaltable>
28898 <para>
28899 <indexterm role="concept">
28900 <primary>router</primary>
28901 <secondary>customized precondition</secondary>
28902 </indexterm>
28903 This option specifies a general precondition test that has to succeed for the
28904 router to be called. The <option>condition</option> option is the last precondition to be
28905 evaluated (see section <xref linkend="SECTrouprecon"/>). The string is expanded, and if the
28906 result is a forced failure, or an empty string, or one of the strings <quote>0</quote> or
28907 <quote>no</quote> or <quote>false</quote> (checked without regard to the case of the letters), the
28908 router is skipped, and the address is offered to the next one.
28909 </para>
28910 <para>
28911 If the result is any other value, the router is run (as this is the last
28912 precondition to be evaluated, all the other preconditions must be true).
28913 </para>
28914 <para>
28915 The <option>condition</option> option provides a means of applying custom conditions to the
28916 running of routers. Note that in the case of a simple conditional expansion,
28917 the default expansion values are exactly what is wanted. For example:
28918 </para>
28919 <literallayout class="monospaced">
28920 condition = ${if &gt;{$message_age}{600}}
28921 </literallayout>
28922 <para>
28923 Because of the default behaviour of the string expansion, this is equivalent to
28924 </para>
28925 <literallayout class="monospaced">
28926 condition = ${if &gt;{$message_age}{600}{true}{}}
28927 </literallayout>
28928 <para>
28929 If the expansion fails (other than forced failure) delivery is deferred. Some
28930 of the other precondition options are common special cases that could in fact
28931 be specified using <option>condition</option>.
28932 </para>
28933 <para>
28934 <indexterm role="option">
28935 <primary><option>debug_print</option></primary>
28936 </indexterm>
28937 </para>
28938 <informaltable frame="all">
28939 <tgroup cols="4" colsep="0" rowsep="0">
28940 <colspec colwidth="8*" align="left"/>
28941 <colspec colwidth="6*" align="center"/>
28942 <colspec colwidth="6*" align="center"/>
28943 <colspec colwidth="6*" align="right"/>
28944 <tbody>
28945 <row>
28946 <entry><option>debug_print</option></entry>
28947 <entry>Use: <emphasis>routers</emphasis></entry>
28948 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28949 <entry>Default: <emphasis>unset</emphasis></entry>
28950 </row>
28951 </tbody>
28952 </tgroup>
28953 </informaltable>
28954 <para>
28955 <indexterm role="concept">
28956 <primary>testing</primary>
28957 <secondary>variables in drivers</secondary>
28958 </indexterm>
28959 If this option is set and debugging is enabled (see the <option>-d</option> command line
28960 option), the string is expanded and included in the debugging output.
28961 If expansion of the string fails, the error message is written to the debugging
28962 output, and Exim carries on processing.
28963 This option is provided to help with checking out the values of variables and
28964 so on when debugging router configurations. For example, if a <option>condition</option>
28965 option appears not to be working, <option>debug_print</option> can be used to output the
28966 variables it references. The output happens after checks for <option>domains</option>,
28967 <option>local_parts</option>, and <option>check_local_user</option> but before any other preconditions
28968 are tested. A newline is added to the text if it does not end with one.
28969 </para>
28970 <para>
28971 <indexterm role="option">
28972 <primary><option>disable_logging</option></primary>
28973 </indexterm>
28974 </para>
28975 <informaltable frame="all">
28976 <tgroup cols="4" colsep="0" rowsep="0">
28977 <colspec colwidth="8*" align="left"/>
28978 <colspec colwidth="6*" align="center"/>
28979 <colspec colwidth="6*" align="center"/>
28980 <colspec colwidth="6*" align="right"/>
28981 <tbody>
28982 <row>
28983 <entry><option>disable_logging</option></entry>
28984 <entry>Use: <emphasis>routers</emphasis></entry>
28985 <entry>Type: <emphasis>boolean</emphasis></entry>
28986 <entry>Default: <emphasis>false</emphasis></entry>
28987 </row>
28988 </tbody>
28989 </tgroup>
28990 </informaltable>
28991 <para>
28992 If this option is set true, nothing is logged for any routing errors
28993 or for any deliveries caused by this router. You should not set this option
28994 unless you really, really know what you are doing. See also the generic
28995 transport option of the same name.
28996 </para>
28997 <para>
28998 <indexterm role="option">
28999 <primary><option>domains</option></primary>
29000 </indexterm>
29001 </para>
29002 <informaltable frame="all">
29003 <tgroup cols="4" colsep="0" rowsep="0">
29004 <colspec colwidth="8*" align="left"/>
29005 <colspec colwidth="6*" align="center"/>
29006 <colspec colwidth="6*" align="center"/>
29007 <colspec colwidth="6*" align="right"/>
29008 <tbody>
29009 <row>
29010 <entry><option>domains</option></entry>
29011 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
29012 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
29013 <entry>Default: <emphasis>unset</emphasis></entry>
29014 </row>
29015 </tbody>
29016 </tgroup>
29017 </informaltable>
29018 <para>
29019 <indexterm role="concept">
29020 <primary>router</primary>
29021 <secondary>restricting to specific domains</secondary>
29022 </indexterm>
29023 <indexterm role="variable">
29024 <primary><varname>$domain_data</varname></primary>
29025 </indexterm>
29026 If this option is set, the router is skipped unless the current domain matches
29027 the list. If the match is achieved by means of a file lookup, the data that the
29028 lookup returned for the domain is placed in <varname>$domain_data</varname> for use in string
29029 expansions of the driver&#x2019;s private options. See section <xref linkend="SECTrouprecon"/> for
29030 a list of the order in which preconditions are evaluated.
29031 </para>
29032 <para>
29033 <indexterm role="option">
29034 <primary><option>driver</option></primary>
29035 </indexterm>
29036 </para>
29037 <informaltable frame="all">
29038 <tgroup cols="4" colsep="0" rowsep="0">
29039 <colspec colwidth="8*" align="left"/>
29040 <colspec colwidth="6*" align="center"/>
29041 <colspec colwidth="6*" align="center"/>
29042 <colspec colwidth="6*" align="right"/>
29043 <tbody>
29044 <row>
29045 <entry><option>driver</option></entry>
29046 <entry>Use: <emphasis>routers</emphasis></entry>
29047 <entry>Type: <emphasis>string</emphasis></entry>
29048 <entry>Default: <emphasis>unset</emphasis></entry>
29049 </row>
29050 </tbody>
29051 </tgroup>
29052 </informaltable>
29053 <para>
29054 This option must always be set. It specifies which of the available routers is
29055 to be used.
29056 </para>
29057 <para>
29058 <indexterm role="option">
29059 <primary><option>errors_to</option></primary>
29060 </indexterm>
29061 </para>
29062 <informaltable frame="all">
29063 <tgroup cols="4" colsep="0" rowsep="0">
29064 <colspec colwidth="8*" align="left"/>
29065 <colspec colwidth="6*" align="center"/>
29066 <colspec colwidth="6*" align="center"/>
29067 <colspec colwidth="6*" align="right"/>
29068 <tbody>
29069 <row>
29070 <entry><option>errors_to</option></entry>
29071 <entry>Use: <emphasis>routers</emphasis></entry>
29072 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29073 <entry>Default: <emphasis>unset</emphasis></entry>
29074 </row>
29075 </tbody>
29076 </tgroup>
29077 </informaltable>
29078 <para>
29079 <indexterm role="concept">
29080 <primary>envelope sender</primary>
29081 </indexterm>
29082 <indexterm role="concept">
29083 <primary>router</primary>
29084 <secondary>changing address for errors</secondary>
29085 </indexterm>
29086 If a router successfully handles an address, it may assign the address to a
29087 transport for delivery or it may generate child addresses. In both cases, if
29088 there is a delivery problem during later processing, the resulting bounce
29089 message is sent to the address that results from expanding this string,
29090 provided that the address verifies successfully. The <option>errors_to</option> option is
29091 expanded before <option>headers_add</option>, <option>headers_remove</option>, and <option>transport</option>.
29092 </para>
29093 <para>
29094 The <option>errors_to</option> setting associated with an address can be overridden if it
29095 subsequently passes through other routers that have their own <option>errors_to</option>
29096 settings, or if the message is delivered by a transport with a <option>return_path</option>
29097 setting.
29098 </para>
29099 <para>
29100 If <option>errors_to</option> is unset, or the expansion is forced to fail, or the result of
29101 the expansion fails to verify, the errors address associated with the incoming
29102 address is used. At top level, this is the envelope sender. A non-forced
29103 expansion failure causes delivery to be deferred.
29104 </para>
29105 <para>
29106 If an address for which <option>errors_to</option> has been set ends up being delivered over
29107 SMTP, the envelope sender for that delivery is the <option>errors_to</option> value, so that
29108 any bounces that are generated by other MTAs on the delivery route are also
29109 sent there. You can set <option>errors_to</option> to the empty string by either of these
29110 settings:
29111 </para>
29112 <literallayout class="monospaced">
29113 errors_to =
29114 errors_to = ""
29115 </literallayout>
29116 <para>
29117 An expansion item that yields an empty string has the same effect. If you do
29118 this, a locally detected delivery error for addresses processed by this router
29119 no longer gives rise to a bounce message; the error is discarded. If the
29120 address is delivered to a remote host, the return path is set to <literal>&lt;&gt;</literal>, unless
29121 overridden by the <option>return_path</option> option on the transport.
29122 </para>
29123 <para>
29124 <indexterm role="variable">
29125 <primary><varname>$address_data</varname></primary>
29126 </indexterm>
29127 If for some reason you want to discard local errors, but use a non-empty
29128 MAIL command for remote delivery, you can preserve the original return
29129 path in <varname>$address_data</varname> in the router, and reinstate it in the transport by
29130 setting <option>return_path</option>.
29131 </para>
29132 <para>
29133 The most common use of <option>errors_to</option> is to direct mailing list bounces to the
29134 manager of the list, as described in section <xref linkend="SECTmailinglists"/>, or to
29135 implement VERP (Variable Envelope Return Paths) (see section <xref linkend="SECTverp"/>).
29136 </para>
29137 <para>
29138 <indexterm role="option">
29139 <primary><option>expn</option></primary>
29140 </indexterm>
29141 </para>
29142 <informaltable frame="all">
29143 <tgroup cols="4" colsep="0" rowsep="0">
29144 <colspec colwidth="8*" align="left"/>
29145 <colspec colwidth="6*" align="center"/>
29146 <colspec colwidth="6*" align="center"/>
29147 <colspec colwidth="6*" align="right"/>
29148 <tbody>
29149 <row>
29150 <entry><option>expn</option></entry>
29151 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
29152 <entry>Type: <emphasis>boolean</emphasis></entry>
29153 <entry>Default: <emphasis>true</emphasis></entry>
29154 </row>
29155 </tbody>
29156 </tgroup>
29157 </informaltable>
29158 <para>
29159 <indexterm role="concept">
29160 <primary>address</primary>
29161 <secondary>testing</secondary>
29162 </indexterm>
29163 <indexterm role="concept">
29164 <primary>testing</primary>
29165 <secondary>addresses</secondary>
29166 </indexterm>
29167 <indexterm role="concept">
29168 <primary>EXPN</primary>
29169 <secondary>router skipping</secondary>
29170 </indexterm>
29171 <indexterm role="concept">
29172 <primary>router</primary>
29173 <secondary>skipping for EXPN</secondary>
29174 </indexterm>
29175 If this option is turned off, the router is skipped when testing an address
29176 as a result of processing an SMTP EXPN command. You might, for example,
29177 want to turn it off on a router for users&#x2019; <filename>.forward</filename> files, while leaving it
29178 on for the system alias file.
29179 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
29180 are evaluated.
29181 </para>
29182 <para>
29183 The use of the SMTP EXPN command is controlled by an ACL (see chapter
29184 <xref linkend="CHAPACL"/>). When Exim is running an EXPN command, it is similar to testing
29185 an address with <option>-bt</option>. Compare VRFY, whose counterpart is <option>-bv</option>.
29186 </para>
29187 <para>
29188 <indexterm role="option">
29189 <primary><option>fail_verify</option></primary>
29190 </indexterm>
29191 </para>
29192 <informaltable frame="all">
29193 <tgroup cols="4" colsep="0" rowsep="0">
29194 <colspec colwidth="8*" align="left"/>
29195 <colspec colwidth="6*" align="center"/>
29196 <colspec colwidth="6*" align="center"/>
29197 <colspec colwidth="6*" align="right"/>
29198 <tbody>
29199 <row>
29200 <entry><option>fail_verify</option></entry>
29201 <entry>Use: <emphasis>routers</emphasis></entry>
29202 <entry>Type: <emphasis>boolean</emphasis></entry>
29203 <entry>Default: <emphasis>false</emphasis></entry>
29204 </row>
29205 </tbody>
29206 </tgroup>
29207 </informaltable>
29208 <para>
29209 <indexterm role="concept">
29210 <primary>router</primary>
29211 <secondary>forcing verification failure</secondary>
29212 </indexterm>
29213 Setting this option has the effect of setting both <option>fail_verify_sender</option> and
29214 <option>fail_verify_recipient</option> to the same value.
29215 </para>
29216 <para>
29217 <indexterm role="option">
29218 <primary><option>fail_verify_recipient</option></primary>
29219 </indexterm>
29220 </para>
29221 <informaltable frame="all">
29222 <tgroup cols="4" colsep="0" rowsep="0">
29223 <colspec colwidth="8*" align="left"/>
29224 <colspec colwidth="6*" align="center"/>
29225 <colspec colwidth="6*" align="center"/>
29226 <colspec colwidth="6*" align="right"/>
29227 <tbody>
29228 <row>
29229 <entry><option>fail_verify_recipient</option></entry>
29230 <entry>Use: <emphasis>routers</emphasis></entry>
29231 <entry>Type: <emphasis>boolean</emphasis></entry>
29232 <entry>Default: <emphasis>false</emphasis></entry>
29233 </row>
29234 </tbody>
29235 </tgroup>
29236 </informaltable>
29237 <para>
29238 If this option is true and an address is accepted by this router when
29239 verifying a recipient, verification fails.
29240 </para>
29241 <para>
29242 <indexterm role="option">
29243 <primary><option>fail_verify_sender</option></primary>
29244 </indexterm>
29245 </para>
29246 <informaltable frame="all">
29247 <tgroup cols="4" colsep="0" rowsep="0">
29248 <colspec colwidth="8*" align="left"/>
29249 <colspec colwidth="6*" align="center"/>
29250 <colspec colwidth="6*" align="center"/>
29251 <colspec colwidth="6*" align="right"/>
29252 <tbody>
29253 <row>
29254 <entry><option>fail_verify_sender</option></entry>
29255 <entry>Use: <emphasis>routers</emphasis></entry>
29256 <entry>Type: <emphasis>boolean</emphasis></entry>
29257 <entry>Default: <emphasis>false</emphasis></entry>
29258 </row>
29259 </tbody>
29260 </tgroup>
29261 </informaltable>
29262 <para>
29263 If this option is true and an address is accepted by this router when
29264 verifying a sender, verification fails.
29265 </para>
29266 <para>
29267 <indexterm role="option">
29268 <primary><option>fallback_hosts</option></primary>
29269 </indexterm>
29270 </para>
29271 <informaltable frame="all">
29272 <tgroup cols="4" colsep="0" rowsep="0">
29273 <colspec colwidth="8*" align="left"/>
29274 <colspec colwidth="6*" align="center"/>
29275 <colspec colwidth="6*" align="center"/>
29276 <colspec colwidth="6*" align="right"/>
29277 <tbody>
29278 <row>
29279 <entry><option>fallback_hosts</option></entry>
29280 <entry>Use: <emphasis>routers</emphasis></entry>
29281 <entry>Type: <emphasis>string list</emphasis></entry>
29282 <entry>Default: <emphasis>unset</emphasis></entry>
29283 </row>
29284 </tbody>
29285 </tgroup>
29286 </informaltable>
29287 <para>
29288 <indexterm role="concept">
29289 <primary>router</primary>
29290 <secondary>fallback hosts</secondary>
29291 </indexterm>
29292 <indexterm role="concept">
29293 <primary>fallback</primary>
29294 <secondary>hosts specified on router</secondary>
29295 </indexterm>
29296 String expansion is not applied to this option. The argument must be a
29297 colon-separated list of host names or IP addresses. The list separator can be
29298 changed (see section <xref linkend="SECTlistconstruct"/>), and a port can be specified with
29299 each name or address. In fact, the format of each item is exactly the same as
29300 defined for the list of hosts in a <command>manualroute</command> router (see section
29301 <xref linkend="SECTformatonehostitem"/>).
29302 </para>
29303 <para>
29304 If a router queues an address for a remote transport, this host list is
29305 associated with the address, and used instead of the transport&#x2019;s fallback host
29306 list. If <option>hosts_randomize</option> is set on the transport, the order of the list is
29307 randomized for each use. See the <option>fallback_hosts</option> option of the <command>smtp</command>
29308 transport for further details.
29309 </para>
29310 <para>
29311 <indexterm role="option">
29312 <primary><option>group</option></primary>
29313 </indexterm>
29314 </para>
29315 <informaltable frame="all">
29316 <tgroup cols="4" colsep="0" rowsep="0">
29317 <colspec colwidth="8*" align="left"/>
29318 <colspec colwidth="6*" align="center"/>
29319 <colspec colwidth="6*" align="center"/>
29320 <colspec colwidth="6*" align="right"/>
29321 <tbody>
29322 <row>
29323 <entry><option>group</option></entry>
29324 <entry>Use: <emphasis>routers</emphasis></entry>
29325 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29326 <entry>Default: <emphasis>see below</emphasis></entry>
29327 </row>
29328 </tbody>
29329 </tgroup>
29330 </informaltable>
29331 <para>
29332 <indexterm role="concept">
29333 <primary>gid (group id)</primary>
29334 <secondary>local delivery</secondary>
29335 </indexterm>
29336 <indexterm role="concept">
29337 <primary>local transports</primary>
29338 <secondary>uid and gid</secondary>
29339 </indexterm>
29340 <indexterm role="concept">
29341 <primary>transport</primary>
29342 <secondary>local</secondary>
29343 </indexterm>
29344 <indexterm role="concept">
29345 <primary>router</primary>
29346 <secondary>setting group</secondary>
29347 </indexterm>
29348 When a router queues an address for a transport, and the transport does not
29349 specify a group, the group given here is used when running the delivery
29350 process.
29351 The group may be specified numerically or by name. If expansion fails, the
29352 error is logged and delivery is deferred.
29353 The default is unset, unless <option>check_local_user</option> is set, when the default
29354 is taken from the password information. See also <option>initgroups</option> and <option>user</option>
29355 and the discussion in chapter <xref linkend="CHAPenvironment"/>.
29356 </para>
29357 <para>
29358 <indexterm role="option">
29359 <primary><option>headers_add</option></primary>
29360 </indexterm>
29361 </para>
29362 <informaltable frame="all">
29363 <tgroup cols="4" colsep="0" rowsep="0">
29364 <colspec colwidth="8*" align="left"/>
29365 <colspec colwidth="6*" align="center"/>
29366 <colspec colwidth="6*" align="center"/>
29367 <colspec colwidth="6*" align="right"/>
29368 <tbody>
29369 <row>
29370 <entry><option>headers_add</option></entry>
29371 <entry>Use: <emphasis>routers</emphasis></entry>
29372 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29373 <entry>Default: <emphasis>unset</emphasis></entry>
29374 </row>
29375 </tbody>
29376 </tgroup>
29377 </informaltable>
29378 <para>
29379 <indexterm role="concept">
29380 <primary>header lines</primary>
29381 <secondary>adding</secondary>
29382 </indexterm>
29383 <indexterm role="concept">
29384 <primary>router</primary>
29385 <secondary>adding header lines</secondary>
29386 </indexterm>
29387 This option specifies a string of text that is expanded at routing time, and
29388 associated with any addresses that are accepted by the router. However, this
29389 option has no effect when an address is just being verified. The way in which
29390 the text is used to add header lines at transport time is described in section
29391 <xref linkend="SECTheadersaddrem"/>. New header lines are not actually added until the
29392 message is in the process of being transported. This means that references to
29393 header lines in string expansions in the transport&#x2019;s configuration do not
29394 <quote>see</quote> the added header lines.
29395 </para>
29396 <para>
29397 The <option>headers_add</option> option is expanded after <option>errors_to</option>, but before
29398 <option>headers_remove</option> and <option>transport</option>. If the expanded string is empty, or if
29399 the expansion is forced to fail, the option has no effect. Other expansion
29400 failures are treated as configuration errors.
29401 </para>
29402 <para>
29403 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_add</option> option cannot be used for a <command>redirect</command>
29404 router that has the <option>one_time</option> option set.
29405 </para>
29406 <para>
29407 <indexterm role="concept">
29408 <primary>duplicate addresses</primary>
29409 </indexterm>
29410 <indexterm role="option">
29411 <primary><option>unseen</option></primary>
29412 </indexterm>
29413 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
29414 additions are deleted when the address is passed on to subsequent routers.
29415 For a <option>redirect</option> router, if a generated address is the same as the incoming
29416 address, this can lead to duplicate addresses with different header
29417 modifications. Exim does not do duplicate deliveries (except, in certain
29418 circumstances, to pipes -- see section <xref linkend="SECTdupaddr"/>), but it is undefined
29419 which of the duplicates is discarded, so this ambiguous situation should be
29420 avoided. The <option>repeat_use</option> option of the <option>redirect</option> router may be of help.
29421 </para>
29422 <para>
29423 <indexterm role="option">
29424 <primary><option>headers_remove</option></primary>
29425 </indexterm>
29426 </para>
29427 <informaltable frame="all">
29428 <tgroup cols="4" colsep="0" rowsep="0">
29429 <colspec colwidth="8*" align="left"/>
29430 <colspec colwidth="6*" align="center"/>
29431 <colspec colwidth="6*" align="center"/>
29432 <colspec colwidth="6*" align="right"/>
29433 <tbody>
29434 <row>
29435 <entry><option>headers_remove</option></entry>
29436 <entry>Use: <emphasis>routers</emphasis></entry>
29437 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29438 <entry>Default: <emphasis>unset</emphasis></entry>
29439 </row>
29440 </tbody>
29441 </tgroup>
29442 </informaltable>
29443 <para>
29444 <indexterm role="concept">
29445 <primary>header lines</primary>
29446 <secondary>removing</secondary>
29447 </indexterm>
29448 <indexterm role="concept">
29449 <primary>router</primary>
29450 <secondary>removing header lines</secondary>
29451 </indexterm>
29452 This option specifies a string of text that is expanded at routing time, and
29453 associated with any addresses that are accepted by the router. However, this
29454 option has no effect when an address is just being verified. The way in which
29455 the text is used to remove header lines at transport time is described in
29456 section <xref linkend="SECTheadersaddrem"/>. Header lines are not actually removed until
29457 the message is in the process of being transported. This means that references
29458 to header lines in string expansions in the transport&#x2019;s configuration still
29459 <quote>see</quote> the original header lines.
29460 </para>
29461 <para>
29462 The <option>headers_remove</option> option is expanded after <option>errors_to</option> and
29463 <option>headers_add</option>, but before <option>transport</option>. If the expansion is forced to fail,
29464 the option has no effect. Other expansion failures are treated as configuration
29465 errors.
29466 </para>
29467 <para>
29468 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_remove</option> option cannot be used for a <command>redirect</command>
29469 router that has the <option>one_time</option> option set.
29470 </para>
29471 <para>
29472 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
29473 removal requests are deleted when the address is passed on to subsequent
29474 routers, and this can lead to problems with duplicates -- see the similar
29475 warning for <option>headers_add</option> above.
29476 </para>
29477 <para>
29478 <indexterm role="option">
29479 <primary><option>ignore_target_hosts</option></primary>
29480 </indexterm>
29481 </para>
29482 <informaltable frame="all">
29483 <tgroup cols="4" colsep="0" rowsep="0">
29484 <colspec colwidth="8*" align="left"/>
29485 <colspec colwidth="6*" align="center"/>
29486 <colspec colwidth="6*" align="center"/>
29487 <colspec colwidth="6*" align="right"/>
29488 <tbody>
29489 <row>
29490 <entry><option>ignore_target_hosts</option></entry>
29491 <entry>Use: <emphasis>routers</emphasis></entry>
29492 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
29493 <entry>Default: <emphasis>unset</emphasis></entry>
29494 </row>
29495 </tbody>
29496 </tgroup>
29497 </informaltable>
29498 <para>
29499 <indexterm role="concept">
29500 <primary>IP address</primary>
29501 <secondary>discarding</secondary>
29502 </indexterm>
29503 <indexterm role="concept">
29504 <primary>router</primary>
29505 <secondary>discarding IP addresses</secondary>
29506 </indexterm>
29507 Although this option is a host list, it should normally contain IP address
29508 entries rather than names. If any host that is looked up by the router has an
29509 IP address that matches an item in this list, Exim behaves as if that IP
29510 address did not exist. This option allows you to cope with rogue DNS entries
29511 like
29512 </para>
29513 <literallayout class="monospaced">
29514 remote.domain.example.  A  127.0.0.1
29515 </literallayout>
29516 <para>
29517 by setting
29518 </para>
29519 <literallayout class="monospaced">
29520 ignore_target_hosts = 127.0.0.1
29521 </literallayout>
29522 <para>
29523 on the relevant router. If all the hosts found by a <command>dnslookup</command> router are
29524 discarded in this way, the router declines. In a conventional configuration, an
29525 attempt to mail to such a domain would normally provoke the <quote>unrouteable
29526 domain</quote> error, and an attempt to verify an address in the domain would fail.
29527 Similarly, if <option>ignore_target_hosts</option> is set on an <command>ipliteral</command> router, the
29528 router declines if presented with one of the listed addresses.
29529 </para>
29530 <para>
29531 You can use this option to disable the use of IPv4 or IPv6 for mail delivery by
29532 means of the first or the second of the following settings, respectively:
29533 </para>
29534 <literallayout class="monospaced">
29535 ignore_target_hosts = 0.0.0.0/0
29536 ignore_target_hosts = &lt;; 0::0/0
29537 </literallayout>
29538 <para>
29539 The pattern in the first line matches all IPv4 addresses, whereas the pattern
29540 in the second line matches all IPv6 addresses.
29541 </para>
29542 <para>
29543 This option may also be useful for ignoring link-local and site-local IPv6
29544 addresses. Because, like all host lists, the value of <option>ignore_target_hosts</option>
29545 is expanded before use as a list, it is possible to make it dependent on the
29546 domain that is being routed.
29547 </para>
29548 <para>
29549 <indexterm role="variable">
29550 <primary><varname>$host_address</varname></primary>
29551 </indexterm>
29552 During its expansion, <varname>$host_address</varname> is set to the IP address that is being
29553 checked.
29554 </para>
29555 <para>
29556 <indexterm role="option">
29557 <primary><option>initgroups</option></primary>
29558 </indexterm>
29559 </para>
29560 <informaltable frame="all">
29561 <tgroup cols="4" colsep="0" rowsep="0">
29562 <colspec colwidth="8*" align="left"/>
29563 <colspec colwidth="6*" align="center"/>
29564 <colspec colwidth="6*" align="center"/>
29565 <colspec colwidth="6*" align="right"/>
29566 <tbody>
29567 <row>
29568 <entry><option>initgroups</option></entry>
29569 <entry>Use: <emphasis>routers</emphasis></entry>
29570 <entry>Type: <emphasis>boolean</emphasis></entry>
29571 <entry>Default: <emphasis>false</emphasis></entry>
29572 </row>
29573 </tbody>
29574 </tgroup>
29575 </informaltable>
29576 <para>
29577 <indexterm role="concept">
29578 <primary>additional groups</primary>
29579 </indexterm>
29580 <indexterm role="concept">
29581 <primary>groups</primary>
29582 <secondary>additional</secondary>
29583 </indexterm>
29584 <indexterm role="concept">
29585 <primary>local transports</primary>
29586 <secondary>uid and gid</secondary>
29587 </indexterm>
29588 <indexterm role="concept">
29589 <primary>transport</primary>
29590 <secondary>local</secondary>
29591 </indexterm>
29592 If the router queues an address for a transport, and this option is true, and
29593 the uid supplied by the router is not overridden by the transport, the
29594 <function>initgroups()</function> function is called when running the transport to ensure that
29595 any additional groups associated with the uid are set up. See also <option>group</option>
29596 and <option>user</option> and the discussion in chapter <xref linkend="CHAPenvironment"/>.
29597 </para>
29598 <para>
29599 <indexterm role="option">
29600 <primary><option>local_part_prefix</option></primary>
29601 </indexterm>
29602 </para>
29603 <informaltable frame="all">
29604 <tgroup cols="4" colsep="0" rowsep="0">
29605 <colspec colwidth="8*" align="left"/>
29606 <colspec colwidth="6*" align="center"/>
29607 <colspec colwidth="6*" align="center"/>
29608 <colspec colwidth="6*" align="right"/>
29609 <tbody>
29610 <row>
29611 <entry><option>local_part_prefix</option></entry>
29612 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
29613 <entry>Type: <emphasis>string list</emphasis></entry>
29614 <entry>Default: <emphasis>unset</emphasis></entry>
29615 </row>
29616 </tbody>
29617 </tgroup>
29618 </informaltable>
29619 <para>
29620 <indexterm role="concept">
29621 <primary>router</primary>
29622 <secondary>prefix for local part</secondary>
29623 </indexterm>
29624 <indexterm role="concept">
29625 <primary>prefix</primary>
29626 <secondary>for local part, used in router</secondary>
29627 </indexterm>
29628 If this option is set, the router is skipped unless the local part starts with
29629 one of the given strings, or <option>local_part_prefix_optional</option> is true. See
29630 section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions are
29631 evaluated.
29632 </para>
29633 <para>
29634 The list is scanned from left to right, and the first prefix that matches is
29635 used. A limited form of wildcard is available; if the prefix begins with an
29636 asterisk, it matches the longest possible sequence of arbitrary characters at
29637 the start of the local part. An asterisk should therefore always be followed by
29638 some character that does not occur in normal local parts.
29639 <indexterm role="concept">
29640 <primary>multiple mailboxes</primary>
29641 </indexterm>
29642 <indexterm role="concept">
29643 <primary>mailbox</primary>
29644 <secondary>multiple</secondary>
29645 </indexterm>
29646 Wildcarding can be used to set up multiple user mailboxes, as described in
29647 section <xref linkend="SECTmulbox"/>.
29648 </para>
29649 <para>
29650 <indexterm role="variable">
29651 <primary><varname>$local_part</varname></primary>
29652 </indexterm>
29653 <indexterm role="variable">
29654 <primary><varname>$local_part_prefix</varname></primary>
29655 </indexterm>
29656 During the testing of the <option>local_parts</option> option, and while the router is
29657 running, the prefix is removed from the local part, and is available in the
29658 expansion variable <varname>$local_part_prefix</varname>. When a message is being delivered, if
29659 the router accepts the address, this remains true during subsequent delivery by
29660 a transport. In particular, the local part that is transmitted in the RCPT
29661 command for LMTP, SMTP, and BSMTP deliveries has the prefix removed by default.
29662 This behaviour can be overridden by setting <option>rcpt_include_affixes</option> true on
29663 the relevant transport.
29664 </para>
29665 <para>
29666 When an address is being verified, <option>local_part_prefix</option> affects only the
29667 behaviour of the router. If the callout feature of verification is in use, this
29668 means that the full address, including the prefix, will be used during the
29669 callout.
29670 </para>
29671 <para>
29672 The prefix facility is commonly used to handle local parts of the form
29673 <option>owner-something</option>. Another common use is to support local parts of the form
29674 <option>real-username</option> to bypass a user&#x2019;s <filename>.forward</filename> file &ndash; helpful when trying
29675 to tell a user their forwarding is broken &ndash; by placing a router like this one
29676 immediately before the router that handles <filename>.forward</filename> files:
29677 </para>
29678 <literallayout class="monospaced">
29679 real_localuser:
29680   driver = accept
29681   local_part_prefix = real-
29682   check_local_user
29683   transport = local_delivery
29684 </literallayout>
29685 <para>
29686 For security, it would probably be a good idea to restrict the use of this
29687 router to locally-generated messages, using a condition such as this:
29688 </para>
29689 <literallayout class="monospaced">
29690   condition = ${if match {$sender_host_address}\
29691                          {\N^(|127\.0\.0\.1)$\N}}
29692 </literallayout>
29693 <para>
29694 If both <option>local_part_prefix</option> and <option>local_part_suffix</option> are set for a router,
29695 both conditions must be met if not optional. Care must be taken if wildcards
29696 are used in both a prefix and a suffix on the same router. Different
29697 separator characters must be used to avoid ambiguity.
29698 </para>
29699 <para>
29700 <indexterm role="option">
29701 <primary><option>local_part_prefix_optional</option></primary>
29702 </indexterm>
29703 </para>
29704 <informaltable frame="all">
29705 <tgroup cols="4" colsep="0" rowsep="0">
29706 <colspec colwidth="8*" align="left"/>
29707 <colspec colwidth="6*" align="center"/>
29708 <colspec colwidth="6*" align="center"/>
29709 <colspec colwidth="6*" align="right"/>
29710 <tbody>
29711 <row>
29712 <entry><option>local_part_prefix_optional</option></entry>
29713 <entry>Use: <emphasis>routers</emphasis></entry>
29714 <entry>Type: <emphasis>boolean</emphasis></entry>
29715 <entry>Default: <emphasis>false</emphasis></entry>
29716 </row>
29717 </tbody>
29718 </tgroup>
29719 </informaltable>
29720 <para>
29721 See <option>local_part_prefix</option> above.
29722 </para>
29723 <para>
29724 <indexterm role="option">
29725 <primary><option>local_part_suffix</option></primary>
29726 </indexterm>
29727 </para>
29728 <informaltable frame="all">
29729 <tgroup cols="4" colsep="0" rowsep="0">
29730 <colspec colwidth="8*" align="left"/>
29731 <colspec colwidth="6*" align="center"/>
29732 <colspec colwidth="6*" align="center"/>
29733 <colspec colwidth="6*" align="right"/>
29734 <tbody>
29735 <row>
29736 <entry><option>local_part_suffix</option></entry>
29737 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
29738 <entry>Type: <emphasis>string list</emphasis></entry>
29739 <entry>Default: <emphasis>unset</emphasis></entry>
29740 </row>
29741 </tbody>
29742 </tgroup>
29743 </informaltable>
29744 <para>
29745 <indexterm role="concept">
29746 <primary>router</primary>
29747 <secondary>suffix for local part</secondary>
29748 </indexterm>
29749 <indexterm role="concept">
29750 <primary>suffix for local part</primary>
29751 <secondary>used in router</secondary>
29752 </indexterm>
29753 This option operates in the same way as <option>local_part_prefix</option>, except that the
29754 local part must end (rather than start) with the given string, the
29755 <option>local_part_suffix_optional</option> option determines whether the suffix is
29756 mandatory, and the wildcard * character, if present, must be the last
29757 character of the suffix. This option facility is commonly used to handle local
29758 parts of the form <option>something-request</option> and multiple user mailboxes of the form
29759 <option>username-foo</option>.
29760 </para>
29761 <para>
29762 <indexterm role="option">
29763 <primary><option>local_part_suffix_optional</option></primary>
29764 </indexterm>
29765 </para>
29766 <informaltable frame="all">
29767 <tgroup cols="4" colsep="0" rowsep="0">
29768 <colspec colwidth="8*" align="left"/>
29769 <colspec colwidth="6*" align="center"/>
29770 <colspec colwidth="6*" align="center"/>
29771 <colspec colwidth="6*" align="right"/>
29772 <tbody>
29773 <row>
29774 <entry><option>local_part_suffix_optional</option></entry>
29775 <entry>Use: <emphasis>routers</emphasis></entry>
29776 <entry>Type: <emphasis>boolean</emphasis></entry>
29777 <entry>Default: <emphasis>false</emphasis></entry>
29778 </row>
29779 </tbody>
29780 </tgroup>
29781 </informaltable>
29782 <para>
29783 See <option>local_part_suffix</option> above.
29784 </para>
29785 <para>
29786 <indexterm role="option">
29787 <primary><option>local_parts</option></primary>
29788 </indexterm>
29789 </para>
29790 <informaltable frame="all">
29791 <tgroup cols="4" colsep="0" rowsep="0">
29792 <colspec colwidth="8*" align="left"/>
29793 <colspec colwidth="6*" align="center"/>
29794 <colspec colwidth="6*" align="center"/>
29795 <colspec colwidth="6*" align="right"/>
29796 <tbody>
29797 <row>
29798 <entry><option>local_parts</option></entry>
29799 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
29800 <entry>Type: <emphasis>local part list</emphasis>&dagger;<emphasis></emphasis></entry>
29801 <entry>Default: <emphasis>unset</emphasis></entry>
29802 </row>
29803 </tbody>
29804 </tgroup>
29805 </informaltable>
29806 <para>
29807 <indexterm role="concept">
29808 <primary>router</primary>
29809 <secondary>restricting to specific local parts</secondary>
29810 </indexterm>
29811 <indexterm role="concept">
29812 <primary>local part</primary>
29813 <secondary>checking in router</secondary>
29814 </indexterm>
29815 The router is run only if the local part of the address matches the list.
29816 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
29817 are evaluated, and
29818 section <xref linkend="SECTlocparlis"/> for a discussion of local part lists. Because the
29819 string is expanded, it is possible to make it depend on the domain, for
29820 example:
29821 </para>
29822 <literallayout class="monospaced">
29823 local_parts = dbm;/usr/local/specials/$domain
29824 </literallayout>
29825 <para>
29826 <indexterm role="variable">
29827 <primary><varname>$local_part_data</varname></primary>
29828 </indexterm>
29829 If the match is achieved by a lookup, the data that the lookup returned
29830 for the local part is placed in the variable <varname>$local_part_data</varname> for use in
29831 expansions of the router&#x2019;s private options. You might use this option, for
29832 example, if you have a large number of local virtual domains, and you want to
29833 send all postmaster mail to the same place without having to set up an alias in
29834 each virtual domain:
29835 </para>
29836 <literallayout class="monospaced">
29837 postmaster:
29838   driver = redirect
29839   local_parts = postmaster
29840   data = postmaster@real.domain.example
29841 </literallayout>
29842 <para>
29843 <indexterm role="option">
29844 <primary><option>log_as_local</option></primary>
29845 </indexterm>
29846 </para>
29847 <informaltable frame="all">
29848 <tgroup cols="4" colsep="0" rowsep="0">
29849 <colspec colwidth="8*" align="left"/>
29850 <colspec colwidth="6*" align="center"/>
29851 <colspec colwidth="6*" align="center"/>
29852 <colspec colwidth="6*" align="right"/>
29853 <tbody>
29854 <row>
29855 <entry><option>log_as_local</option></entry>
29856 <entry>Use: <emphasis>routers</emphasis></entry>
29857 <entry>Type: <emphasis>boolean</emphasis></entry>
29858 <entry>Default: <emphasis>see below</emphasis></entry>
29859 </row>
29860 </tbody>
29861 </tgroup>
29862 </informaltable>
29863 <para>
29864 <indexterm role="concept">
29865 <primary>log</primary>
29866 <secondary>delivery line</secondary>
29867 </indexterm>
29868 <indexterm role="concept">
29869 <primary>delivery</primary>
29870 <secondary>log line format</secondary>
29871 </indexterm>
29872 Exim has two logging styles for delivery, the idea being to make local
29873 deliveries stand out more visibly from remote ones. In the <quote>local</quote> style, the
29874 recipient address is given just as the local part, without a domain. The use of
29875 this style is controlled by this option. It defaults to true for the <command>accept</command>
29876 router, and false for all the others. This option applies only when a
29877 router assigns an address to a transport. It has no effect on routers that
29878 redirect addresses.
29879 </para>
29880 <para>
29881 <indexterm role="option">
29882 <primary><option>more</option></primary>
29883 </indexterm>
29884 </para>
29885 <informaltable frame="all">
29886 <tgroup cols="4" colsep="0" rowsep="0">
29887 <colspec colwidth="8*" align="left"/>
29888 <colspec colwidth="6*" align="center"/>
29889 <colspec colwidth="6*" align="center"/>
29890 <colspec colwidth="6*" align="right"/>
29891 <tbody>
29892 <row>
29893 <entry><option>more</option></entry>
29894 <entry>Use: <emphasis>routers</emphasis></entry>
29895 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
29896 <entry>Default: <emphasis>true</emphasis></entry>
29897 </row>
29898 </tbody>
29899 </tgroup>
29900 </informaltable>
29901 <para>
29902 The result of string expansion for this option must be a valid boolean value,
29903 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
29904 result causes an error, and delivery is deferred. If the expansion is forced to
29905 fail, the default value for the option (true) is used. Other failures cause
29906 delivery to be deferred.
29907 </para>
29908 <para>
29909 If this option is set false, and the router declines to handle the address, no
29910 further routers are tried, routing fails, and the address is bounced.
29911 <indexterm role="option">
29912 <primary><option>self</option></primary>
29913 </indexterm>
29914 However, if the router explicitly passes an address to the following router by
29915 means of the setting
29916 </para>
29917 <literallayout class="monospaced">
29918 self = pass
29919 </literallayout>
29920 <para>
29921 or otherwise, the setting of <option>more</option> is ignored. Also, the setting of <option>more</option>
29922 does not affect the behaviour if one of the precondition tests fails. In that
29923 case, the address is always passed to the next router.
29924 </para>
29925 <para>
29926 Note that <option>address_data</option> is not considered to be a precondition. If its
29927 expansion is forced to fail, the router declines, and the value of <option>more</option>
29928 controls what happens next.
29929 </para>
29930 <para>
29931 <indexterm role="option">
29932 <primary><option>pass_on_timeout</option></primary>
29933 </indexterm>
29934 </para>
29935 <informaltable frame="all">
29936 <tgroup cols="4" colsep="0" rowsep="0">
29937 <colspec colwidth="8*" align="left"/>
29938 <colspec colwidth="6*" align="center"/>
29939 <colspec colwidth="6*" align="center"/>
29940 <colspec colwidth="6*" align="right"/>
29941 <tbody>
29942 <row>
29943 <entry><option>pass_on_timeout</option></entry>
29944 <entry>Use: <emphasis>routers</emphasis></entry>
29945 <entry>Type: <emphasis>boolean</emphasis></entry>
29946 <entry>Default: <emphasis>false</emphasis></entry>
29947 </row>
29948 </tbody>
29949 </tgroup>
29950 </informaltable>
29951 <para>
29952 <indexterm role="concept">
29953 <primary>timeout</primary>
29954 <secondary>of router</secondary>
29955 </indexterm>
29956 <indexterm role="concept">
29957 <primary>router</primary>
29958 <secondary>timeout</secondary>
29959 </indexterm>
29960 If a router times out during a host lookup, it normally causes deferral of the
29961 address. If <option>pass_on_timeout</option> is set, the address is passed on to the next
29962 router, overriding <option>no_more</option>. This may be helpful for systems that are
29963 intermittently connected to the Internet, or those that want to pass to a smart
29964 host any messages that cannot immediately be delivered.
29965 </para>
29966 <para>
29967 There are occasional other temporary errors that can occur while doing DNS
29968 lookups. They are treated in the same way as a timeout, and this option
29969 applies to all of them.
29970 </para>
29971 <para>
29972 <indexterm role="option">
29973 <primary><option>pass_router</option></primary>
29974 </indexterm>
29975 </para>
29976 <informaltable frame="all">
29977 <tgroup cols="4" colsep="0" rowsep="0">
29978 <colspec colwidth="8*" align="left"/>
29979 <colspec colwidth="6*" align="center"/>
29980 <colspec colwidth="6*" align="center"/>
29981 <colspec colwidth="6*" align="right"/>
29982 <tbody>
29983 <row>
29984 <entry><option>pass_router</option></entry>
29985 <entry>Use: <emphasis>routers</emphasis></entry>
29986 <entry>Type: <emphasis>string</emphasis></entry>
29987 <entry>Default: <emphasis>unset</emphasis></entry>
29988 </row>
29989 </tbody>
29990 </tgroup>
29991 </informaltable>
29992 <para>
29993 <indexterm role="concept">
29994 <primary>router</primary>
29995 <secondary>go to after <quote>pass</quote></secondary>
29996 </indexterm>
29997 Routers that recognize the generic <option>self</option> option (<command>dnslookup</command>,
29998 <command>ipliteral</command>, and <command>manualroute</command>) are able to return <quote>pass</quote>, forcing
29999 routing to continue, and overriding a false setting of <option>more</option>. When one of
30000 these routers returns <quote>pass</quote>, the address is normally handed on to the next
30001 router in sequence. This can be changed by setting <option>pass_router</option> to the name
30002 of another router. However (unlike <option>redirect_router</option>) the named router must
30003 be below the current router, to avoid loops. Note that this option applies only
30004 to the special case of <quote>pass</quote>. It does not apply when a router returns
30005 <quote>decline</quote> because it cannot handle an address.
30006 </para>
30007 <para>
30008 <indexterm role="option">
30009 <primary><option>redirect_router</option></primary>
30010 </indexterm>
30011 </para>
30012 <informaltable frame="all">
30013 <tgroup cols="4" colsep="0" rowsep="0">
30014 <colspec colwidth="8*" align="left"/>
30015 <colspec colwidth="6*" align="center"/>
30016 <colspec colwidth="6*" align="center"/>
30017 <colspec colwidth="6*" align="right"/>
30018 <tbody>
30019 <row>
30020 <entry><option>redirect_router</option></entry>
30021 <entry>Use: <emphasis>routers</emphasis></entry>
30022 <entry>Type: <emphasis>string</emphasis></entry>
30023 <entry>Default: <emphasis>unset</emphasis></entry>
30024 </row>
30025 </tbody>
30026 </tgroup>
30027 </informaltable>
30028 <para>
30029 <indexterm role="concept">
30030 <primary>router</primary>
30031 <secondary>start at after redirection</secondary>
30032 </indexterm>
30033 Sometimes an administrator knows that it is pointless to reprocess addresses
30034 generated from alias or forward files with the same router again. For
30035 example, if an alias file translates real names into login ids there is no
30036 point searching the alias file a second time, especially if it is a large file.
30037 </para>
30038 <para>
30039 The <option>redirect_router</option> option can be set to the name of any router instance.
30040 It causes the routing of any generated addresses to start at the named router
30041 instead of at the first router. This option has no effect if the router in
30042 which it is set does not generate new addresses.
30043 </para>
30044 <para>
30045 <indexterm role="option">
30046 <primary><option>require_files</option></primary>
30047 </indexterm>
30048 </para>
30049 <informaltable frame="all">
30050 <tgroup cols="4" colsep="0" rowsep="0">
30051 <colspec colwidth="8*" align="left"/>
30052 <colspec colwidth="6*" align="center"/>
30053 <colspec colwidth="6*" align="center"/>
30054 <colspec colwidth="6*" align="right"/>
30055 <tbody>
30056 <row>
30057 <entry><option>require_files</option></entry>
30058 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
30059 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
30060 <entry>Default: <emphasis>unset</emphasis></entry>
30061 </row>
30062 </tbody>
30063 </tgroup>
30064 </informaltable>
30065 <para>
30066 <indexterm role="concept">
30067 <primary>file</primary>
30068 <secondary>requiring for router</secondary>
30069 </indexterm>
30070 <indexterm role="concept">
30071 <primary>router</primary>
30072 <secondary>requiring file existence</secondary>
30073 </indexterm>
30074 This option provides a general mechanism for predicating the running of a
30075 router on the existence or non-existence of certain files or directories.
30076 Before running a router, as one of its precondition tests, Exim works its way
30077 through the <option>require_files</option> list, expanding each item separately.
30078 </para>
30079 <para>
30080 Because the list is split before expansion, any colons in expansion items must
30081 be doubled, or the facility for using a different list separator must be used.
30082 If any expansion is forced to fail, the item is ignored. Other expansion
30083 failures cause routing of the address to be deferred.
30084 </para>
30085 <para>
30086 If any expanded string is empty, it is ignored. Otherwise, except as described
30087 below, each string must be a fully qualified file path, optionally preceded by
30088 <quote>!</quote>. The paths are passed to the <function>stat()</function> function to test for the
30089 existence of the files or directories. The router is skipped if any paths not
30090 preceded by <quote>!</quote> do not exist, or if any paths preceded by <quote>!</quote> do exist.
30091 </para>
30092 <para>
30093 <indexterm role="concept">
30094 <primary>NFS</primary>
30095 </indexterm>
30096 If <function>stat()</function> cannot determine whether a file exists or not, delivery of
30097 the message is deferred. This can happen when NFS-mounted filesystems are
30098 unavailable.
30099 </para>
30100 <para>
30101 This option is checked after the <option>domains</option>, <option>local_parts</option>, and <option>senders</option>
30102 options, so you cannot use it to check for the existence of a file in which to
30103 look up a domain, local part, or sender. (See section <xref linkend="SECTrouprecon"/> for a
30104 full list of the order in which preconditions are evaluated.) However, as
30105 these options are all expanded, you can use the <option>exists</option> expansion condition
30106 to make such tests. The <option>require_files</option> option is intended for checking files
30107 that the router may be going to use internally, or which are needed by a
30108 transport (for example <filename>.procmailrc</filename>).
30109 </para>
30110 <para>
30111 During delivery, the <function>stat()</function> function is run as root, but there is a
30112 facility for some checking of the accessibility of a file by another user.
30113 This is not a proper permissions check, but just a <quote>rough</quote> check that
30114 operates as follows:
30115 </para>
30116 <para>
30117 If an item in a <option>require_files</option> list does not contain any forward slash
30118 characters, it is taken to be the user (and optional group, separated by a
30119 comma) to be checked for subsequent files in the list. If no group is specified
30120 but the user is specified symbolically, the gid associated with the uid is
30121 used. For example:
30122 </para>
30123 <literallayout class="monospaced">
30124 require_files = mail:/some/file
30125 require_files = $local_part:$home/.procmailrc
30126 </literallayout>
30127 <para>
30128 If a user or group name in a <option>require_files</option> list does not exist, the
30129 <option>require_files</option> condition fails.
30130 </para>
30131 <para>
30132 Exim performs the check by scanning along the components of the file path, and
30133 checking the access for the given uid and gid. It checks for <quote>x</quote> access on
30134 directories, and <quote>r</quote> access on the final file. Note that this means that file
30135 access control lists, if the operating system has them, are ignored.
30136 </para>
30137 <para>
30138 <emphasis role="bold">Warning 1</emphasis>: When the router is being run to verify addresses for an
30139 incoming SMTP message, Exim is not running as root, but under its own uid. This
30140 may affect the result of a <option>require_files</option> check. In particular, <function>stat()</function>
30141 may yield the error EACCES (<quote>Permission denied</quote>). This means that the Exim
30142 user is not permitted to read one of the directories on the file&#x2019;s path.
30143 </para>
30144 <para>
30145 <emphasis role="bold">Warning 2</emphasis>: Even when Exim is running as root while delivering a message,
30146 <function>stat()</function> can yield EACCES for a file in an NFS directory that is mounted
30147 without root access. In this case, if a check for access by a particular user
30148 is requested, Exim creates a subprocess that runs as that user, and tries the
30149 check again in that process.
30150 </para>
30151 <para>
30152 The default action for handling an unresolved EACCES is to consider it to
30153 be caused by a configuration error, and routing is deferred because the
30154 existence or non-existence of the file cannot be determined. However, in some
30155 circumstances it may be desirable to treat this condition as if the file did
30156 not exist. If the file name (or the exclamation mark that precedes the file
30157 name for non-existence) is preceded by a plus sign, the EACCES error is treated
30158 as if the file did not exist. For example:
30159 </para>
30160 <literallayout class="monospaced">
30161 require_files = +/some/file
30162 </literallayout>
30163 <para>
30164 If the router is not an essential part of verification (for example, it
30165 handles users&#x2019; <filename>.forward</filename> files), another solution is to set the <option>verify</option>
30166 option false so that the router is skipped when verifying.
30167 </para>
30168 <para>
30169 <indexterm role="option">
30170 <primary><option>retry_use_local_part</option></primary>
30171 </indexterm>
30172 </para>
30173 <informaltable frame="all">
30174 <tgroup cols="4" colsep="0" rowsep="0">
30175 <colspec colwidth="8*" align="left"/>
30176 <colspec colwidth="6*" align="center"/>
30177 <colspec colwidth="6*" align="center"/>
30178 <colspec colwidth="6*" align="right"/>
30179 <tbody>
30180 <row>
30181 <entry><option>retry_use_local_part</option></entry>
30182 <entry>Use: <emphasis>routers</emphasis></entry>
30183 <entry>Type: <emphasis>boolean</emphasis></entry>
30184 <entry>Default: <emphasis>see below</emphasis></entry>
30185 </row>
30186 </tbody>
30187 </tgroup>
30188 </informaltable>
30189 <para>
30190 <indexterm role="concept">
30191 <primary>hints database</primary>
30192 <secondary>retry keys</secondary>
30193 </indexterm>
30194 <indexterm role="concept">
30195 <primary>local part</primary>
30196 <secondary>in retry keys</secondary>
30197 </indexterm>
30198 When a delivery suffers a temporary routing failure, a retry record is created
30199 in Exim&#x2019;s hints database. For addresses whose routing depends only on the
30200 domain, the key for the retry record should not involve the local part, but for
30201 other addresses, both the domain and the local part should be included.
30202 Usually, remote routing is of the former kind, and local routing is of the
30203 latter kind.
30204 </para>
30205 <para>
30206 This option controls whether the local part is used to form the key for retry
30207 hints for addresses that suffer temporary errors while being handled by this
30208 router. The default value is true for any router that has <option>check_local_user</option>
30209 set, and false otherwise. Note that this option does not apply to hints keys
30210 for transport delays; they are controlled by a generic transport option of the
30211 same name.
30212 </para>
30213 <para>
30214 The setting of <option>retry_use_local_part</option> applies only to the router on which it
30215 appears. If the router generates child addresses, they are routed
30216 independently; this setting does not become attached to them.
30217 </para>
30218 <para>
30219 <indexterm role="option">
30220 <primary><option>router_home_directory</option></primary>
30221 </indexterm>
30222 </para>
30223 <informaltable frame="all">
30224 <tgroup cols="4" colsep="0" rowsep="0">
30225 <colspec colwidth="8*" align="left"/>
30226 <colspec colwidth="6*" align="center"/>
30227 <colspec colwidth="6*" align="center"/>
30228 <colspec colwidth="6*" align="right"/>
30229 <tbody>
30230 <row>
30231 <entry><option>router_home_directory</option></entry>
30232 <entry>Use: <emphasis>routers</emphasis></entry>
30233 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30234 <entry>Default: <emphasis>unset</emphasis></entry>
30235 </row>
30236 </tbody>
30237 </tgroup>
30238 </informaltable>
30239 <para>
30240 <indexterm role="concept">
30241 <primary>router</primary>
30242 <secondary>home directory for</secondary>
30243 </indexterm>
30244 <indexterm role="concept">
30245 <primary>home directory</primary>
30246 <secondary>for router</secondary>
30247 </indexterm>
30248 <indexterm role="variable">
30249 <primary><varname>$home</varname></primary>
30250 </indexterm>
30251 This option sets a home directory for use while the router is running. (Compare
30252 <option>transport_home_directory</option>, which sets a home directory for later
30253 transporting.) In particular, if used on a <command>redirect</command> router, this option
30254 sets a value for <varname>$home</varname> while a filter is running. The value is expanded;
30255 forced expansion failure causes the option to be ignored &ndash; other failures
30256 cause the router to defer.
30257 </para>
30258 <para>
30259 Expansion of <option>router_home_directory</option> happens immediately after the
30260 <option>check_local_user</option> test (if configured), before any further expansions take
30261 place.
30262 (See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
30263 are evaluated.)
30264 While the router is running, <option>router_home_directory</option> overrides the value of
30265 <varname>$home</varname> that came from <option>check_local_user</option>.
30266 </para>
30267 <para>
30268 When a router accepts an address and assigns it to a local transport (including
30269 the cases when a <command>redirect</command> router generates a pipe, file, or autoreply
30270 delivery), the home directory setting for the transport is taken from the first
30271 of these values that is set:
30272 </para>
30273 <itemizedlist>
30274 <listitem>
30275 <para>
30276 The <option>home_directory</option> option on the transport;
30277 </para>
30278 </listitem>
30279 <listitem>
30280 <para>
30281 The <option>transport_home_directory</option> option on the router;
30282 </para>
30283 </listitem>
30284 <listitem>
30285 <para>
30286 The password data if <option>check_local_user</option> is set on the router;
30287 </para>
30288 </listitem>
30289 <listitem>
30290 <para>
30291 The <option>router_home_directory</option> option on the router.
30292 </para>
30293 </listitem>
30294 </itemizedlist>
30295 <para>
30296 In other words, <option>router_home_directory</option> overrides the password data for the
30297 router, but not for the transport.
30298 </para>
30299 <para>
30300 <indexterm role="option">
30301 <primary><option>self</option></primary>
30302 </indexterm>
30303 </para>
30304 <informaltable frame="all">
30305 <tgroup cols="4" colsep="0" rowsep="0">
30306 <colspec colwidth="8*" align="left"/>
30307 <colspec colwidth="6*" align="center"/>
30308 <colspec colwidth="6*" align="center"/>
30309 <colspec colwidth="6*" align="right"/>
30310 <tbody>
30311 <row>
30312 <entry><option>self</option></entry>
30313 <entry>Use: <emphasis>routers</emphasis></entry>
30314 <entry>Type: <emphasis>string</emphasis></entry>
30315 <entry>Default: <emphasis>freeze</emphasis></entry>
30316 </row>
30317 </tbody>
30318 </tgroup>
30319 </informaltable>
30320 <para>
30321 <indexterm role="concept">
30322 <primary>MX record</primary>
30323 <secondary>pointing to local host</secondary>
30324 </indexterm>
30325 <indexterm role="concept">
30326 <primary>local host</primary>
30327 <secondary>MX pointing to</secondary>
30328 </indexterm>
30329 This option applies to those routers that use a recipient address to find a
30330 list of remote hosts. Currently, these are the <command>dnslookup</command>, <command>ipliteral</command>,
30331 and <command>manualroute</command> routers.
30332 Certain configurations of the <command>queryprogram</command> router can also specify a list
30333 of remote hosts.
30334 Usually such routers are configured to send the message to a remote host via an
30335 <command>smtp</command> transport. The <option>self</option> option specifies what happens when the first
30336 host on the list turns out to be the local host.
30337 The way in which Exim checks for the local host is described in section
30338 <xref linkend="SECTreclocipadd"/>.
30339 </para>
30340 <para>
30341 Normally this situation indicates either an error in Exim&#x2019;s configuration (for
30342 example, the router should be configured not to process this domain), or an
30343 error in the DNS (for example, the MX should not point to this host). For this
30344 reason, the default action is to log the incident, defer the address, and
30345 freeze the message. The following alternatives are provided for use in special
30346 cases:
30347 </para>
30348 <variablelist>
30349 <varlistentry>
30350 <term><option>defer</option></term>
30351 <listitem>
30352 <para>
30353 Delivery of the message is tried again later, but the message is not frozen.
30354 </para>
30355 </listitem></varlistentry>
30356 <varlistentry>
30357 <term><option>reroute</option>: &lt;<emphasis>domain</emphasis>&gt;</term>
30358 <listitem>
30359 <para>
30360 The domain is changed to the given domain, and the address is passed back to
30361 be reprocessed by the routers. No rewriting of headers takes place. This
30362 behaviour is essentially a redirection.
30363 </para>
30364 </listitem></varlistentry>
30365 <varlistentry>
30366 <term><option>reroute: rewrite:</option> &lt;<emphasis>domain</emphasis>&gt;</term>
30367 <listitem>
30368 <para>
30369 The domain is changed to the given domain, and the address is passed back to be
30370 reprocessed by the routers. Any headers that contain the original domain are
30371 rewritten.
30372 </para>
30373 </listitem></varlistentry>
30374 <varlistentry>
30375 <term><option>pass</option></term>
30376 <listitem>
30377 <para>
30378 <indexterm role="option">
30379 <primary><option>more</option></primary>
30380 </indexterm>
30381 <indexterm role="variable">
30382 <primary><varname>$self_hostname</varname></primary>
30383 </indexterm>
30384 The router passes the address to the next router, or to the router named in the
30385 <option>pass_router</option> option if it is set. This overrides <option>no_more</option>. During
30386 subsequent routing and delivery, the variable <varname>$self_hostname</varname> contains the
30387 name of the local host that the router encountered. This can be used to
30388 distinguish between different cases for hosts with multiple names. The
30389 combination
30390 </para>
30391 <literallayout class="monospaced">
30392 self = pass
30393 no_more
30394 </literallayout>
30395 <para>
30396 ensures that only those addresses that routed to the local host are passed on.
30397 Without <option>no_more</option>, addresses that were declined for other reasons would also
30398 be passed to the next router.
30399 </para>
30400 </listitem></varlistentry>
30401 <varlistentry>
30402 <term><option>fail</option></term>
30403 <listitem>
30404 <para>
30405 Delivery fails and an error report is generated.
30406 </para>
30407 </listitem></varlistentry>
30408 <varlistentry>
30409 <term><option>send</option></term>
30410 <listitem>
30411 <para>
30412 <indexterm role="concept">
30413 <primary>local host</primary>
30414 <secondary>sending to</secondary>
30415 </indexterm>
30416 The anomaly is ignored and the address is queued for the transport. This
30417 setting should be used with extreme caution. For an <command>smtp</command> transport, it
30418 makes sense only in cases where the program that is listening on the SMTP port
30419 is not this version of Exim. That is, it must be some other MTA, or Exim with a
30420 different configuration file that handles the domain in another way.
30421 </para>
30422 </listitem></varlistentry>
30423 </variablelist>
30424 <para>
30425 <indexterm role="option">
30426 <primary><option>senders</option></primary>
30427 </indexterm>
30428 </para>
30429 <informaltable frame="all">
30430 <tgroup cols="4" colsep="0" rowsep="0">
30431 <colspec colwidth="8*" align="left"/>
30432 <colspec colwidth="6*" align="center"/>
30433 <colspec colwidth="6*" align="center"/>
30434 <colspec colwidth="6*" align="right"/>
30435 <tbody>
30436 <row>
30437 <entry><option>senders</option></entry>
30438 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
30439 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
30440 <entry>Default: <emphasis>unset</emphasis></entry>
30441 </row>
30442 </tbody>
30443 </tgroup>
30444 </informaltable>
30445 <para>
30446 <indexterm role="concept">
30447 <primary>router</primary>
30448 <secondary>checking senders</secondary>
30449 </indexterm>
30450 If this option is set, the router is skipped unless the message&#x2019;s sender
30451 address matches something on the list.
30452 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
30453 are evaluated.
30454 </para>
30455 <para>
30456 There are issues concerning verification when the running of routers is
30457 dependent on the sender. When Exim is verifying the address in an <option>errors_to</option>
30458 setting, it sets the sender to the null string. When using the <option>-bt</option> option
30459 to check a configuration file, it is necessary also to use the <option>-f</option> option to
30460 set an appropriate sender. For incoming mail, the sender is unset when
30461 verifying the sender, but is available when verifying any recipients. If the
30462 SMTP VRFY command is enabled, it must be used after MAIL if the sender address
30463 matters.
30464 </para>
30465 <para>
30466 <indexterm role="option">
30467 <primary><option>translate_ip_address</option></primary>
30468 </indexterm>
30469 </para>
30470 <informaltable frame="all">
30471 <tgroup cols="4" colsep="0" rowsep="0">
30472 <colspec colwidth="8*" align="left"/>
30473 <colspec colwidth="6*" align="center"/>
30474 <colspec colwidth="6*" align="center"/>
30475 <colspec colwidth="6*" align="right"/>
30476 <tbody>
30477 <row>
30478 <entry><option>translate_ip_address</option></entry>
30479 <entry>Use: <emphasis>routers</emphasis></entry>
30480 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30481 <entry>Default: <emphasis>unset</emphasis></entry>
30482 </row>
30483 </tbody>
30484 </tgroup>
30485 </informaltable>
30486 <para>
30487 <indexterm role="concept">
30488 <primary>IP address</primary>
30489 <secondary>translating</secondary>
30490 </indexterm>
30491 <indexterm role="concept">
30492 <primary>packet radio</primary>
30493 </indexterm>
30494 <indexterm role="concept">
30495 <primary>router</primary>
30496 <secondary>IP address translation</secondary>
30497 </indexterm>
30498 There exist some rare networking situations (for example, packet radio) where
30499 it is helpful to be able to translate IP addresses generated by normal routing
30500 mechanisms into other IP addresses, thus performing a kind of manual IP
30501 routing. This should be done only if the normal IP routing of the TCP/IP stack
30502 is inadequate or broken. Because this is an extremely uncommon requirement, the
30503 code to support this option is not included in the Exim binary unless
30504 SUPPORT_TRANSLATE_IP_ADDRESS=yes is set in <filename>Local/Makefile</filename>.
30505 </para>
30506 <para>
30507 <indexterm role="variable">
30508 <primary><varname>$host_address</varname></primary>
30509 </indexterm>
30510 The <option>translate_ip_address</option> string is expanded for every IP address generated
30511 by the router, with the generated address set in <varname>$host_address</varname>. If the
30512 expansion is forced to fail, no action is taken.
30513 For any other expansion error, delivery of the message is deferred.
30514 If the result of the expansion is an IP address, that replaces the original
30515 address; otherwise the result is assumed to be a host name &ndash; this is looked
30516 up using <function>gethostbyname()</function> (or <function>getipnodebyname()</function> when available) to
30517 produce one or more replacement IP addresses. For example, to subvert all IP
30518 addresses in some specific networks, this could be added to a router:
30519 </para>
30520 <literallayout class="monospaced">
30521 translate_ip_address = \
30522   ${lookup{${mask:$host_address/26}}lsearch{/some/file}\
30523     {$value}fail}}
30524 </literallayout>
30525 <para>
30526 The file would contain lines like
30527 </para>
30528 <literallayout class="monospaced">
30529 10.2.3.128/26    some.host
30530 10.8.4.34/26     10.44.8.15
30531 </literallayout>
30532 <para>
30533 You should not make use of this facility unless you really understand what you
30534 are doing.
30535 </para>
30536 <para>
30537 <indexterm role="option">
30538 <primary><option>transport</option></primary>
30539 </indexterm>
30540 </para>
30541 <informaltable frame="all">
30542 <tgroup cols="4" colsep="0" rowsep="0">
30543 <colspec colwidth="8*" align="left"/>
30544 <colspec colwidth="6*" align="center"/>
30545 <colspec colwidth="6*" align="center"/>
30546 <colspec colwidth="6*" align="right"/>
30547 <tbody>
30548 <row>
30549 <entry><option>transport</option></entry>
30550 <entry>Use: <emphasis>routers</emphasis></entry>
30551 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30552 <entry>Default: <emphasis>unset</emphasis></entry>
30553 </row>
30554 </tbody>
30555 </tgroup>
30556 </informaltable>
30557 <para>
30558 This option specifies the transport to be used when a router accepts an address
30559 and sets it up for delivery. A transport is never needed if a router is used
30560 only for verification. The value of the option is expanded at routing time,
30561 after the expansion of <option>errors_to</option>, <option>headers_add</option>, and <option>headers_remove</option>,
30562 and result must be the name of one of the configured transports. If it is not,
30563 delivery is deferred.
30564 </para>
30565 <para>
30566 The <option>transport</option> option is not used by the <command>redirect</command> router, but it does
30567 have some private options that set up transports for pipe and file deliveries
30568 (see chapter <xref linkend="CHAPredirect"/>).
30569 </para>
30570 <para>
30571 <indexterm role="option">
30572 <primary><option>transport_current_directory</option></primary>
30573 </indexterm>
30574 </para>
30575 <informaltable frame="all">
30576 <tgroup cols="4" colsep="0" rowsep="0">
30577 <colspec colwidth="8*" align="left"/>
30578 <colspec colwidth="6*" align="center"/>
30579 <colspec colwidth="6*" align="center"/>
30580 <colspec colwidth="6*" align="right"/>
30581 <tbody>
30582 <row>
30583 <entry><option>transport_current_directory</option></entry>
30584 <entry>Use: <emphasis>routers</emphasis></entry>
30585 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30586 <entry>Default: <emphasis>unset</emphasis></entry>
30587 </row>
30588 </tbody>
30589 </tgroup>
30590 </informaltable>
30591 <para>
30592 <indexterm role="concept">
30593 <primary>current directory for local transport</primary>
30594 </indexterm>
30595 This option associates a current directory with any address that is routed
30596 to a local transport. This can happen either because a transport is
30597 explicitly configured for the router, or because it generates a delivery to a
30598 file or a pipe. During the delivery process (that is, at transport time), this
30599 option string is expanded and is set as the current directory, unless
30600 overridden by a setting on the transport.
30601 If the expansion fails for any reason, including forced failure, an error is
30602 logged, and delivery is deferred.
30603 See chapter <xref linkend="CHAPenvironment"/> for details of the local delivery
30604 environment.
30605 </para>
30606 <para>
30607 <indexterm role="option">
30608 <primary><option>transport_home_directory</option></primary>
30609 </indexterm>
30610 </para>
30611 <informaltable frame="all">
30612 <tgroup cols="4" colsep="0" rowsep="0">
30613 <colspec colwidth="8*" align="left"/>
30614 <colspec colwidth="6*" align="center"/>
30615 <colspec colwidth="6*" align="center"/>
30616 <colspec colwidth="6*" align="right"/>
30617 <tbody>
30618 <row>
30619 <entry><option>transport_home_directory</option></entry>
30620 <entry>Use: <emphasis>routers</emphasis></entry>
30621 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30622 <entry>Default: <emphasis>see below</emphasis></entry>
30623 </row>
30624 </tbody>
30625 </tgroup>
30626 </informaltable>
30627 <para>
30628 <indexterm role="concept">
30629 <primary>home directory</primary>
30630 <secondary>for local transport</secondary>
30631 </indexterm>
30632 This option associates a home directory with any address that is routed to a
30633 local transport. This can happen either because a transport is explicitly
30634 configured for the router, or because it generates a delivery to a file or a
30635 pipe. During the delivery process (that is, at transport time), the option
30636 string is expanded and is set as the home directory, unless overridden by a
30637 setting of <option>home_directory</option> on the transport.
30638 If the expansion fails for any reason, including forced failure, an error is
30639 logged, and delivery is deferred.
30640 </para>
30641 <para>
30642 If the transport does not specify a home directory, and
30643 <option>transport_home_directory</option> is not set for the router, the home directory for
30644 the transport is taken from the password data if <option>check_local_user</option> is set for
30645 the router. Otherwise it is taken from <option>router_home_directory</option> if that option
30646 is set; if not, no home directory is set for the transport.
30647 </para>
30648 <para>
30649 See chapter <xref linkend="CHAPenvironment"/> for further details of the local delivery
30650 environment.
30651 </para>
30652 <para>
30653 <indexterm role="option">
30654 <primary><option>unseen</option></primary>
30655 </indexterm>
30656 </para>
30657 <informaltable frame="all">
30658 <tgroup cols="4" colsep="0" rowsep="0">
30659 <colspec colwidth="8*" align="left"/>
30660 <colspec colwidth="6*" align="center"/>
30661 <colspec colwidth="6*" align="center"/>
30662 <colspec colwidth="6*" align="right"/>
30663 <tbody>
30664 <row>
30665 <entry><option>unseen</option></entry>
30666 <entry>Use: <emphasis>routers</emphasis></entry>
30667 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
30668 <entry>Default: <emphasis>false</emphasis></entry>
30669 </row>
30670 </tbody>
30671 </tgroup>
30672 </informaltable>
30673 <para>
30674 <indexterm role="concept">
30675 <primary>router</primary>
30676 <secondary>carrying on after success</secondary>
30677 </indexterm>
30678 The result of string expansion for this option must be a valid boolean value,
30679 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
30680 result causes an error, and delivery is deferred. If the expansion is forced to
30681 fail, the default value for the option (false) is used. Other failures cause
30682 delivery to be deferred.
30683 </para>
30684 <para>
30685 When this option is set true, routing does not cease if the router accepts the
30686 address. Instead, a copy of the incoming address is passed to the next router,
30687 overriding a false setting of <option>more</option>. There is little point in setting
30688 <option>more</option> false if <option>unseen</option> is always true, but it may be useful in cases when
30689 the value of <option>unseen</option> contains expansion items (and therefore, presumably, is
30690 sometimes true and sometimes false).
30691 </para>
30692 <para>
30693 <indexterm role="concept">
30694 <primary>copy of message (<option>unseen</option> option)</primary>
30695 </indexterm>
30696 Setting the <option>unseen</option> option has a similar effect to the <option>unseen</option> command
30697 qualifier in filter files. It can be used to cause copies of messages to be
30698 delivered to some other destination, while also carrying out a normal delivery.
30699 In effect, the current address is made into a <quote>parent</quote> that has two children
30700 &ndash; one that is delivered as specified by this router, and a clone that goes on
30701 to be routed further. For this reason, <option>unseen</option> may not be combined with the
30702 <option>one_time</option> option in a <command>redirect</command> router.
30703 </para>
30704 <para>
30705 <emphasis role="bold">Warning</emphasis>: Header lines added to the address (or specified for removal) by
30706 this router or by previous routers affect the <quote>unseen</quote> copy of the message
30707 only. The clone that continues to be processed by further routers starts with
30708 no added headers and none specified for removal. For a <option>redirect</option> router, if
30709 a generated address is the same as the incoming address, this can lead to
30710 duplicate addresses with different header modifications. Exim does not do
30711 duplicate deliveries (except, in certain circumstances, to pipes -- see section
30712 <xref linkend="SECTdupaddr"/>), but it is undefined which of the duplicates is discarded,
30713 so this ambiguous situation should be avoided. The <option>repeat_use</option> option of the
30714 <option>redirect</option> router may be of help.
30715 </para>
30716 <para>
30717 Unlike the handling of header modifications, any data that was set by the
30718 <option>address_data</option> option in the current or previous routers <emphasis>is</emphasis> passed on to
30719 subsequent routers.
30720 </para>
30721 <para>
30722 <indexterm role="option">
30723 <primary><option>user</option></primary>
30724 </indexterm>
30725 </para>
30726 <informaltable frame="all">
30727 <tgroup cols="4" colsep="0" rowsep="0">
30728 <colspec colwidth="8*" align="left"/>
30729 <colspec colwidth="6*" align="center"/>
30730 <colspec colwidth="6*" align="center"/>
30731 <colspec colwidth="6*" align="right"/>
30732 <tbody>
30733 <row>
30734 <entry><option>user</option></entry>
30735 <entry>Use: <emphasis>routers</emphasis></entry>
30736 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30737 <entry>Default: <emphasis>see below</emphasis></entry>
30738 </row>
30739 </tbody>
30740 </tgroup>
30741 </informaltable>
30742 <para>
30743 <indexterm role="concept">
30744 <primary>uid (user id)</primary>
30745 <secondary>local delivery</secondary>
30746 </indexterm>
30747 <indexterm role="concept">
30748 <primary>local transports</primary>
30749 <secondary>uid and gid</secondary>
30750 </indexterm>
30751 <indexterm role="concept">
30752 <primary>transport</primary>
30753 <secondary>local</secondary>
30754 </indexterm>
30755 <indexterm role="concept">
30756 <primary>router</primary>
30757 <secondary>user for filter processing</secondary>
30758 </indexterm>
30759 <indexterm role="concept">
30760 <primary>filter</primary>
30761 <secondary>user for processing</secondary>
30762 </indexterm>
30763 When a router queues an address for a transport, and the transport does not
30764 specify a user, the user given here is used when running the delivery process.
30765 The user may be specified numerically or by name. If expansion fails, the
30766 error is logged and delivery is deferred.
30767 This user is also used by the <command>redirect</command> router when running a filter file.
30768 The default is unset, except when <option>check_local_user</option> is set. In this case,
30769 the default is taken from the password information. If the user is specified as
30770 a name, and <option>group</option> is not set, the group associated with the user is used.
30771 See also <option>initgroups</option> and <option>group</option> and the discussion in chapter
30772 <xref linkend="CHAPenvironment"/>.
30773 </para>
30774 <para>
30775 <indexterm role="option">
30776 <primary><option>verify</option></primary>
30777 </indexterm>
30778 </para>
30779 <informaltable frame="all">
30780 <tgroup cols="4" colsep="0" rowsep="0">
30781 <colspec colwidth="8*" align="left"/>
30782 <colspec colwidth="6*" align="center"/>
30783 <colspec colwidth="6*" align="center"/>
30784 <colspec colwidth="6*" align="right"/>
30785 <tbody>
30786 <row>
30787 <entry><option>verify</option></entry>
30788 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
30789 <entry>Type: <emphasis>boolean</emphasis></entry>
30790 <entry>Default: <emphasis>true</emphasis></entry>
30791 </row>
30792 </tbody>
30793 </tgroup>
30794 </informaltable>
30795 <para>
30796 Setting this option has the effect of setting <option>verify_sender</option> and
30797 <option>verify_recipient</option> to the same value.
30798 </para>
30799 <para>
30800 <indexterm role="option">
30801 <primary><option>verify_only</option></primary>
30802 </indexterm>
30803 </para>
30804 <informaltable frame="all">
30805 <tgroup cols="4" colsep="0" rowsep="0">
30806 <colspec colwidth="8*" align="left"/>
30807 <colspec colwidth="6*" align="center"/>
30808 <colspec colwidth="6*" align="center"/>
30809 <colspec colwidth="6*" align="right"/>
30810 <tbody>
30811 <row>
30812 <entry><option>verify_only</option></entry>
30813 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
30814 <entry>Type: <emphasis>boolean</emphasis></entry>
30815 <entry>Default: <emphasis>false</emphasis></entry>
30816 </row>
30817 </tbody>
30818 </tgroup>
30819 </informaltable>
30820 <para>
30821 <indexterm role="concept">
30822 <primary>EXPN</primary>
30823 <secondary>with <option>verify_only</option></secondary>
30824 </indexterm>
30825 <indexterm role="option">
30826 <primary><option>-bv</option></primary>
30827 </indexterm>
30828 <indexterm role="concept">
30829 <primary>router</primary>
30830 <secondary>used only when verifying</secondary>
30831 </indexterm>
30832 If this option is set, the router is used only when verifying an address or
30833 testing with the <option>-bv</option> option, not when actually doing a delivery, testing
30834 with the <option>-bt</option> option, or running the SMTP EXPN command. It can be further
30835 restricted to verifying only senders or recipients by means of
30836 <option>verify_sender</option> and <option>verify_recipient</option>.
30837 </para>
30838 <para>
30839 <emphasis role="bold">Warning</emphasis>: When the router is being run to verify addresses for an incoming
30840 SMTP message, Exim is not running as root, but under its own uid. If the router
30841 accesses any files, you need to make sure that they are accessible to the Exim
30842 user or group.
30843 </para>
30844 <para>
30845 <indexterm role="option">
30846 <primary><option>verify_recipient</option></primary>
30847 </indexterm>
30848 </para>
30849 <informaltable frame="all">
30850 <tgroup cols="4" colsep="0" rowsep="0">
30851 <colspec colwidth="8*" align="left"/>
30852 <colspec colwidth="6*" align="center"/>
30853 <colspec colwidth="6*" align="center"/>
30854 <colspec colwidth="6*" align="right"/>
30855 <tbody>
30856 <row>
30857 <entry><option>verify_recipient</option></entry>
30858 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
30859 <entry>Type: <emphasis>boolean</emphasis></entry>
30860 <entry>Default: <emphasis>true</emphasis></entry>
30861 </row>
30862 </tbody>
30863 </tgroup>
30864 </informaltable>
30865 <para>
30866 If this option is false, the router is skipped when verifying recipient
30867 addresses
30868 or testing recipient verification using <option>-bv</option>.
30869 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
30870 are evaluated.
30871 </para>
30872 <para>
30873 <indexterm role="option">
30874 <primary><option>verify_sender</option></primary>
30875 </indexterm>
30876 </para>
30877 <informaltable frame="all">
30878 <tgroup cols="4" colsep="0" rowsep="0">
30879 <colspec colwidth="8*" align="left"/>
30880 <colspec colwidth="6*" align="center"/>
30881 <colspec colwidth="6*" align="center"/>
30882 <colspec colwidth="6*" align="right"/>
30883 <tbody>
30884 <row>
30885 <entry><option>verify_sender</option></entry>
30886 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
30887 <entry>Type: <emphasis>boolean</emphasis></entry>
30888 <entry>Default: <emphasis>true</emphasis></entry>
30889 </row>
30890 </tbody>
30891 </tgroup>
30892 </informaltable>
30893 <para>
30894 If this option is false, the router is skipped when verifying sender addresses
30895 or testing sender verification using <option>-bvs</option>.
30896 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
30897 are evaluated.
30898 <indexterm role="concept" startref="IIDgenoprou1" class="endofrange"/>
30899 <indexterm role="concept" startref="IIDgenoprou2" class="endofrange"/>
30900 </para>
30901 </chapter>
30902
30903 <chapter id="CHID4">
30904 <title>The accept router</title>
30905 <para>
30906 <indexterm role="concept">
30907 <primary><command>accept</command> router</primary>
30908 </indexterm>
30909 <indexterm role="concept">
30910 <primary>routers</primary>
30911 <secondary><command>accept</command></secondary>
30912 </indexterm>
30913 The <command>accept</command> router has no private options of its own. Unless it is being
30914 used purely for verification (see <option>verify_only</option>) a transport is required to
30915 be defined by the generic <option>transport</option> option. If the preconditions that are
30916 specified by generic options are met, the router accepts the address and queues
30917 it for the given transport. The most common use of this router is for setting
30918 up deliveries to local mailboxes. For example:
30919 </para>
30920 <literallayout class="monospaced">
30921 localusers:
30922   driver = accept
30923   domains = mydomain.example
30924   check_local_user
30925   transport = local_delivery
30926 </literallayout>
30927 <para>
30928 The <option>domains</option> condition in this example checks the domain of the address, and
30929 <option>check_local_user</option> checks that the local part is the login of a local user.
30930 When both preconditions are met, the <command>accept</command> router runs, and queues the
30931 address for the <command>local_delivery</command> transport.
30932 </para>
30933 </chapter>
30934
30935 <chapter id="CHAPdnslookup">
30936 <title>The dnslookup router</title>
30937 <para>
30938 <indexterm role="concept" id="IIDdnsrou1" class="startofrange">
30939 <primary><command>dnslookup</command> router</primary>
30940 </indexterm>
30941 <indexterm role="concept" id="IIDdnsrou2" class="startofrange">
30942 <primary>routers</primary>
30943 <secondary><command>dnslookup</command></secondary>
30944 </indexterm>
30945 The <command>dnslookup</command> router looks up the hosts that handle mail for the
30946 recipient&#x2019;s domain in the DNS. A transport must always be set for this router,
30947 unless <option>verify_only</option> is set.
30948 </para>
30949 <para>
30950 If SRV support is configured (see <option>check_srv</option> below), Exim first searches for
30951 SRV records. If none are found, or if SRV support is not configured,
30952 MX records are looked up. If no MX records exist, address records are sought.
30953 However, <option>mx_domains</option> can be set to disable the direct use of address
30954 records.
30955 </para>
30956 <para>
30957 MX records of equal priority are sorted by Exim into a random order. Exim then
30958 looks for address records for the host names obtained from MX or SRV records.
30959 When a host has more than one IP address, they are sorted into a random order,
30960 except that IPv6 addresses are always sorted before IPv4 addresses. If all the
30961 IP addresses found are discarded by a setting of the <option>ignore_target_hosts</option>
30962 generic option, the router declines.
30963 </para>
30964 <para>
30965 Unless they have the highest priority (lowest MX value), MX records that point
30966 to the local host, or to any host name that matches <option>hosts_treat_as_local</option>,
30967 are discarded, together with any other MX records of equal or lower priority.
30968 </para>
30969 <para>
30970 <indexterm role="concept">
30971 <primary>MX record</primary>
30972 <secondary>pointing to local host</secondary>
30973 </indexterm>
30974 <indexterm role="concept">
30975 <primary>local host</primary>
30976 <secondary>MX pointing to</secondary>
30977 </indexterm>
30978 <indexterm role="option">
30979 <primary><option>self</option></primary>
30980 <secondary>in <command>dnslookup</command> router</secondary>
30981 </indexterm>
30982 If the host pointed to by the highest priority MX record, or looked up as an
30983 address record, is the local host, or matches <option>hosts_treat_as_local</option>, what
30984 happens is controlled by the generic <option>self</option> option.
30985 </para>
30986 <section id="SECTprowitdnsloo">
30987 <title>Problems with DNS lookups</title>
30988 <para>
30989 There have been problems with DNS servers when SRV records are looked up.
30990 Some mis-behaving servers return a DNS error or timeout when a non-existent
30991 SRV record is sought. Similar problems have in the past been reported for
30992 MX records. The global <option>dns_again_means_nonexist</option> option can help with this
30993 problem, but it is heavy-handed because it is a global option.
30994 </para>
30995 <para>
30996 For this reason, there are two options, <option>srv_fail_domains</option> and
30997 <option>mx_fail_domains</option>, that control what happens when a DNS lookup in a
30998 <command>dnslookup</command> router results in a DNS failure or a <quote>try again</quote> response. If
30999 an attempt to look up an SRV or MX record causes one of these results, and the
31000 domain matches the relevant list, Exim behaves as if the DNS had responded <quote>no
31001 such record</quote>. In the case of an SRV lookup, this means that the router
31002 proceeds to look for MX records; in the case of an MX lookup, it proceeds to
31003 look for A or AAAA records, unless the domain matches <option>mx_domains</option>, in which
31004 case routing fails.
31005 </para>
31006 </section>
31007 <section id="SECID118">
31008 <title>Private options for dnslookup</title>
31009 <para>
31010 <indexterm role="concept">
31011 <primary>options</primary>
31012 <secondary><command>dnslookup</command> router</secondary>
31013 </indexterm>
31014 The private options for the <command>dnslookup</command> router are as follows:
31015 </para>
31016 <para>
31017 <indexterm role="option">
31018 <primary><option>check_secondary_mx</option></primary>
31019 </indexterm>
31020 </para>
31021 <informaltable frame="all">
31022 <tgroup cols="4" colsep="0" rowsep="0">
31023 <colspec colwidth="8*" align="left"/>
31024 <colspec colwidth="6*" align="center"/>
31025 <colspec colwidth="6*" align="center"/>
31026 <colspec colwidth="6*" align="right"/>
31027 <tbody>
31028 <row>
31029 <entry><option>check_secondary_mx</option></entry>
31030 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31031 <entry>Type: <emphasis>boolean</emphasis></entry>
31032 <entry>Default: <emphasis>false</emphasis></entry>
31033 </row>
31034 </tbody>
31035 </tgroup>
31036 </informaltable>
31037 <para>
31038 <indexterm role="concept">
31039 <primary>MX record</primary>
31040 <secondary>checking for secondary</secondary>
31041 </indexterm>
31042 If this option is set, the router declines unless the local host is found in
31043 (and removed from) the list of hosts obtained by MX lookup. This can be used to
31044 process domains for which the local host is a secondary mail exchanger
31045 differently to other domains. The way in which Exim decides whether a host is
31046 the local host is described in section <xref linkend="SECTreclocipadd"/>.
31047 </para>
31048 <para>
31049 <indexterm role="option">
31050 <primary><option>check_srv</option></primary>
31051 </indexterm>
31052 </para>
31053 <informaltable frame="all">
31054 <tgroup cols="4" colsep="0" rowsep="0">
31055 <colspec colwidth="8*" align="left"/>
31056 <colspec colwidth="6*" align="center"/>
31057 <colspec colwidth="6*" align="center"/>
31058 <colspec colwidth="6*" align="right"/>
31059 <tbody>
31060 <row>
31061 <entry><option>check_srv</option></entry>
31062 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31063 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31064 <entry>Default: <emphasis>unset</emphasis></entry>
31065 </row>
31066 </tbody>
31067 </tgroup>
31068 </informaltable>
31069 <para>
31070 <indexterm role="concept">
31071 <primary>SRV record</primary>
31072 <secondary>enabling use of</secondary>
31073 </indexterm>
31074 The <command>dnslookup</command> router supports the use of SRV records (see RFC 2782) in
31075 addition to MX and address records. The support is disabled by default. To
31076 enable SRV support, set the <option>check_srv</option> option to the name of the service
31077 required. For example,
31078 </para>
31079 <literallayout class="monospaced">
31080 check_srv = smtp
31081 </literallayout>
31082 <para>
31083 looks for SRV records that refer to the normal smtp service. The option is
31084 expanded, so the service name can vary from message to message or address
31085 to address. This might be helpful if SRV records are being used for a
31086 submission service. If the expansion is forced to fail, the <option>check_srv</option>
31087 option is ignored, and the router proceeds to look for MX records in the
31088 normal way.
31089 </para>
31090 <para>
31091 When the expansion succeeds, the router searches first for SRV records for
31092 the given service (it assumes TCP protocol). A single SRV record with a
31093 host name that consists of just a single dot indicates <quote>no such service for
31094 this domain</quote>; if this is encountered, the router declines. If other kinds of
31095 SRV record are found, they are used to construct a host list for delivery
31096 according to the rules of RFC 2782. MX records are not sought in this case.
31097 </para>
31098 <para>
31099 When no SRV records are found, MX records (and address records) are sought in
31100 the traditional way. In other words, SRV records take precedence over MX
31101 records, just as MX records take precedence over address records. Note that
31102 this behaviour is not sanctioned by RFC 2782, though a previous draft RFC
31103 defined it. It is apparently believed that MX records are sufficient for email
31104 and that SRV records should not be used for this purpose. However, SRV records
31105 have an additional <quote>weight</quote> feature which some people might find useful when
31106 trying to split an SMTP load between hosts of different power.
31107 </para>
31108 <para>
31109 See section <xref linkend="SECTprowitdnsloo"/> above for a discussion of Exim&#x2019;s behaviour
31110 when there is a DNS lookup error.
31111 </para>
31112 <para>
31113 <indexterm role="option">
31114 <primary><option>mx_domains</option></primary>
31115 </indexterm>
31116 </para>
31117 <informaltable frame="all">
31118 <tgroup cols="4" colsep="0" rowsep="0">
31119 <colspec colwidth="8*" align="left"/>
31120 <colspec colwidth="6*" align="center"/>
31121 <colspec colwidth="6*" align="center"/>
31122 <colspec colwidth="6*" align="right"/>
31123 <tbody>
31124 <row>
31125 <entry><option>mx_domains</option></entry>
31126 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31127 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
31128 <entry>Default: <emphasis>unset</emphasis></entry>
31129 </row>
31130 </tbody>
31131 </tgroup>
31132 </informaltable>
31133 <para>
31134 <indexterm role="concept">
31135 <primary>MX record</primary>
31136 <secondary>required to exist</secondary>
31137 </indexterm>
31138 <indexterm role="concept">
31139 <primary>SRV record</primary>
31140 <secondary>required to exist</secondary>
31141 </indexterm>
31142 A domain that matches <option>mx_domains</option> is required to have either an MX or an SRV
31143 record in order to be recognized. (The name of this option could be improved.)
31144 For example, if all the mail hosts in <emphasis>fict.example</emphasis> are known to have MX
31145 records, except for those in <emphasis>discworld.fict.example</emphasis>, you could use this
31146 setting:
31147 </para>
31148 <literallayout class="monospaced">
31149 mx_domains = ! *.discworld.fict.example : *.fict.example
31150 </literallayout>
31151 <para>
31152 This specifies that messages addressed to a domain that matches the list but
31153 has no MX record should be bounced immediately instead of being routed using
31154 the address record.
31155 </para>
31156 <para>
31157 <indexterm role="option">
31158 <primary><option>mx_fail_domains</option></primary>
31159 </indexterm>
31160 </para>
31161 <informaltable frame="all">
31162 <tgroup cols="4" colsep="0" rowsep="0">
31163 <colspec colwidth="8*" align="left"/>
31164 <colspec colwidth="6*" align="center"/>
31165 <colspec colwidth="6*" align="center"/>
31166 <colspec colwidth="6*" align="right"/>
31167 <tbody>
31168 <row>
31169 <entry><option>mx_fail_domains</option></entry>
31170 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31171 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
31172 <entry>Default: <emphasis>unset</emphasis></entry>
31173 </row>
31174 </tbody>
31175 </tgroup>
31176 </informaltable>
31177 <para>
31178 If the DNS lookup for MX records for one of the domains in this list causes a
31179 DNS lookup error, Exim behaves as if no MX records were found. See section
31180 <xref linkend="SECTprowitdnsloo"/> for more discussion.
31181 </para>
31182 <para>
31183 <indexterm role="option">
31184 <primary><option>qualify_single</option></primary>
31185 </indexterm>
31186 </para>
31187 <informaltable frame="all">
31188 <tgroup cols="4" colsep="0" rowsep="0">
31189 <colspec colwidth="8*" align="left"/>
31190 <colspec colwidth="6*" align="center"/>
31191 <colspec colwidth="6*" align="center"/>
31192 <colspec colwidth="6*" align="right"/>
31193 <tbody>
31194 <row>
31195 <entry><option>qualify_single</option></entry>
31196 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31197 <entry>Type: <emphasis>boolean</emphasis></entry>
31198 <entry>Default: <emphasis>true</emphasis></entry>
31199 </row>
31200 </tbody>
31201 </tgroup>
31202 </informaltable>
31203 <para>
31204 <indexterm role="concept">
31205 <primary>DNS</primary>
31206 <secondary>resolver options</secondary>
31207 </indexterm>
31208 <indexterm role="concept">
31209 <primary>DNS</primary>
31210 <secondary>qualifying single-component names</secondary>
31211 </indexterm>
31212 When this option is true, the resolver option RES_DEFNAMES is set for DNS
31213 lookups. Typically, but not standardly, this causes the resolver to qualify
31214 single-component names with the default domain. For example, on a machine
31215 called <emphasis>dictionary.ref.example</emphasis>, the domain <emphasis>thesaurus</emphasis> would be changed to
31216 <emphasis>thesaurus.ref.example</emphasis> inside the resolver. For details of what your
31217 resolver actually does, consult your man pages for <emphasis>resolver</emphasis> and
31218 <emphasis>resolv.conf</emphasis>.
31219 </para>
31220 <para>
31221 <indexterm role="option">
31222 <primary><option>rewrite_headers</option></primary>
31223 </indexterm>
31224 </para>
31225 <informaltable frame="all">
31226 <tgroup cols="4" colsep="0" rowsep="0">
31227 <colspec colwidth="8*" align="left"/>
31228 <colspec colwidth="6*" align="center"/>
31229 <colspec colwidth="6*" align="center"/>
31230 <colspec colwidth="6*" align="right"/>
31231 <tbody>
31232 <row>
31233 <entry><option>rewrite_headers</option></entry>
31234 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31235 <entry>Type: <emphasis>boolean</emphasis></entry>
31236 <entry>Default: <emphasis>true</emphasis></entry>
31237 </row>
31238 </tbody>
31239 </tgroup>
31240 </informaltable>
31241 <para>
31242 <indexterm role="concept">
31243 <primary>rewriting</primary>
31244 <secondary>header lines</secondary>
31245 </indexterm>
31246 <indexterm role="concept">
31247 <primary>header lines</primary>
31248 <secondary>rewriting</secondary>
31249 </indexterm>
31250 If the domain name in the address that is being processed is not fully
31251 qualified, it may be expanded to its full form by a DNS lookup. For example, if
31252 an address is specified as <emphasis>dormouse@teaparty</emphasis>, the domain might be
31253 expanded to <emphasis>teaparty.wonderland.fict.example</emphasis>. Domain expansion can also
31254 occur as a result of setting the <option>widen_domains</option> option. If
31255 <option>rewrite_headers</option> is true, all occurrences of the abbreviated domain name in
31256 any <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-to:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>
31257 header lines of the message are rewritten with the full domain name.
31258 </para>
31259 <para>
31260 This option should be turned off only when it is known that no message is
31261 ever going to be sent outside an environment where the abbreviation makes
31262 sense.
31263 </para>
31264 <para>
31265 When an MX record is looked up in the DNS and matches a wildcard record, name
31266 servers normally return a record containing the name that has been looked up,
31267 making it impossible to detect whether a wildcard was present or not. However,
31268 some name servers have recently been seen to return the wildcard entry. If the
31269 name returned by a DNS lookup begins with an asterisk, it is not used for
31270 header rewriting.
31271 </para>
31272 <para>
31273 <indexterm role="option">
31274 <primary><option>same_domain_copy_routing</option></primary>
31275 </indexterm>
31276 </para>
31277 <informaltable frame="all">
31278 <tgroup cols="4" colsep="0" rowsep="0">
31279 <colspec colwidth="8*" align="left"/>
31280 <colspec colwidth="6*" align="center"/>
31281 <colspec colwidth="6*" align="center"/>
31282 <colspec colwidth="6*" align="right"/>
31283 <tbody>
31284 <row>
31285 <entry><option>same_domain_copy_routing</option></entry>
31286 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31287 <entry>Type: <emphasis>boolean</emphasis></entry>
31288 <entry>Default: <emphasis>false</emphasis></entry>
31289 </row>
31290 </tbody>
31291 </tgroup>
31292 </informaltable>
31293 <para>
31294 <indexterm role="concept">
31295 <primary>address</primary>
31296 <secondary>copying routing</secondary>
31297 </indexterm>
31298 Addresses with the same domain are normally routed by the <command>dnslookup</command> router
31299 to the same list of hosts. However, this cannot be presumed, because the router
31300 options and preconditions may refer to the local part of the address. By
31301 default, therefore, Exim routes each address in a message independently. DNS
31302 servers run caches, so repeated DNS lookups are not normally expensive, and in
31303 any case, personal messages rarely have more than a few recipients.
31304 </para>
31305 <para>
31306 If you are running mailing lists with large numbers of subscribers at the same
31307 domain, and you are using a <command>dnslookup</command> router which is independent of the
31308 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
31309 lookups for identical domains in one message. In this case, when <command>dnslookup</command>
31310 routes an address to a remote transport, any other unrouted addresses in the
31311 message that have the same domain are automatically given the same routing
31312 without processing them independently,
31313 provided the following conditions are met:
31314 </para>
31315 <itemizedlist>
31316 <listitem>
31317 <para>
31318 No router that processed the address specified <option>headers_add</option> or
31319 <option>headers_remove</option>.
31320 </para>
31321 </listitem>
31322 <listitem>
31323 <para>
31324 The router did not change the address in any way, for example, by <quote>widening</quote>
31325 the domain.
31326 </para>
31327 </listitem>
31328 </itemizedlist>
31329 <para>
31330 <indexterm role="option">
31331 <primary><option>search_parents</option></primary>
31332 </indexterm>
31333 </para>
31334 <informaltable frame="all">
31335 <tgroup cols="4" colsep="0" rowsep="0">
31336 <colspec colwidth="8*" align="left"/>
31337 <colspec colwidth="6*" align="center"/>
31338 <colspec colwidth="6*" align="center"/>
31339 <colspec colwidth="6*" align="right"/>
31340 <tbody>
31341 <row>
31342 <entry><option>search_parents</option></entry>
31343 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31344 <entry>Type: <emphasis>boolean</emphasis></entry>
31345 <entry>Default: <emphasis>false</emphasis></entry>
31346 </row>
31347 </tbody>
31348 </tgroup>
31349 </informaltable>
31350 <para>
31351 <indexterm role="concept">
31352 <primary>DNS</primary>
31353 <secondary>resolver options</secondary>
31354 </indexterm>
31355 When this option is true, the resolver option RES_DNSRCH is set for DNS
31356 lookups. This is different from the <option>qualify_single</option> option in that it
31357 applies to domains containing dots. Typically, but not standardly, it causes
31358 the resolver to search for the name in the current domain and in parent
31359 domains. For example, on a machine in the <emphasis>fict.example</emphasis> domain, if looking
31360 up <emphasis>teaparty.wonderland</emphasis> failed, the resolver would try
31361 <emphasis>teaparty.wonderland.fict.example</emphasis>. For details of what your resolver
31362 actually does, consult your man pages for <emphasis>resolver</emphasis> and <emphasis>resolv.conf</emphasis>.
31363 </para>
31364 <para>
31365 Setting this option true can cause problems in domains that have a wildcard MX
31366 record, because any domain that does not have its own MX record matches the
31367 local wildcard.
31368 </para>
31369 <para>
31370 <indexterm role="option">
31371 <primary><option>srv_fail_domains</option></primary>
31372 </indexterm>
31373 </para>
31374 <informaltable frame="all">
31375 <tgroup cols="4" colsep="0" rowsep="0">
31376 <colspec colwidth="8*" align="left"/>
31377 <colspec colwidth="6*" align="center"/>
31378 <colspec colwidth="6*" align="center"/>
31379 <colspec colwidth="6*" align="right"/>
31380 <tbody>
31381 <row>
31382 <entry><option>srv_fail_domains</option></entry>
31383 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31384 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
31385 <entry>Default: <emphasis>unset</emphasis></entry>
31386 </row>
31387 </tbody>
31388 </tgroup>
31389 </informaltable>
31390 <para>
31391 If the DNS lookup for SRV records for one of the domains in this list causes a
31392 DNS lookup error, Exim behaves as if no SRV records were found. See section
31393 <xref linkend="SECTprowitdnsloo"/> for more discussion.
31394 </para>
31395 <para>
31396 <indexterm role="option">
31397 <primary><option>widen_domains</option></primary>
31398 </indexterm>
31399 </para>
31400 <informaltable frame="all">
31401 <tgroup cols="4" colsep="0" rowsep="0">
31402 <colspec colwidth="8*" align="left"/>
31403 <colspec colwidth="6*" align="center"/>
31404 <colspec colwidth="6*" align="center"/>
31405 <colspec colwidth="6*" align="right"/>
31406 <tbody>
31407 <row>
31408 <entry><option>widen_domains</option></entry>
31409 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31410 <entry>Type: <emphasis>string list</emphasis></entry>
31411 <entry>Default: <emphasis>unset</emphasis></entry>
31412 </row>
31413 </tbody>
31414 </tgroup>
31415 </informaltable>
31416 <para>
31417 <indexterm role="concept">
31418 <primary>domain</primary>
31419 <secondary>partial; widening</secondary>
31420 </indexterm>
31421 If a DNS lookup fails and this option is set, each of its strings in turn is
31422 added onto the end of the domain, and the lookup is tried again. For example,
31423 if
31424 </para>
31425 <literallayout class="monospaced">
31426 widen_domains = fict.example:ref.example
31427 </literallayout>
31428 <para>
31429 is set and a lookup of <emphasis>klingon.dictionary</emphasis> fails,
31430 <emphasis>klingon.dictionary.fict.example</emphasis> is looked up, and if this fails,
31431 <emphasis>klingon.dictionary.ref.example</emphasis> is tried. Note that the <option>qualify_single</option>
31432 and <option>search_parents</option> options can cause some widening to be undertaken inside
31433 the DNS resolver. <option>widen_domains</option> is not applied to sender addresses
31434 when verifying, unless <option>rewrite_headers</option> is false (not the default).
31435 </para>
31436 </section>
31437 <section id="SECID119">
31438 <title>Effect of qualify_single and search_parents</title>
31439 <para>
31440 When a domain from an envelope recipient is changed by the resolver as a result
31441 of the <option>qualify_single</option> or <option>search_parents</option> options, Exim rewrites the
31442 corresponding address in the message&#x2019;s header lines unless <option>rewrite_headers</option>
31443 is set false. Exim then re-routes the address, using the full domain.
31444 </para>
31445 <para>
31446 These two options affect only the DNS lookup that takes place inside the router
31447 for the domain of the address that is being routed. They do not affect lookups
31448 such as that implied by
31449 </para>
31450 <literallayout class="monospaced">
31451 domains = @mx_any
31452 </literallayout>
31453 <para>
31454 that may happen while processing a router precondition before the router is
31455 entered. No widening ever takes place for these lookups.
31456 <indexterm role="concept" startref="IIDdnsrou1" class="endofrange"/>
31457 <indexterm role="concept" startref="IIDdnsrou2" class="endofrange"/>
31458 </para>
31459 </section>
31460 </chapter>
31461
31462 <chapter id="CHID5">
31463 <title>The ipliteral router</title>
31464 <para>
31465 <indexterm role="concept">
31466 <primary><command>ipliteral</command> router</primary>
31467 </indexterm>
31468 <indexterm role="concept">
31469 <primary>domain literal</primary>
31470 <secondary>routing</secondary>
31471 </indexterm>
31472 <indexterm role="concept">
31473 <primary>routers</primary>
31474 <secondary><command>ipliteral</command></secondary>
31475 </indexterm>
31476 This router has no private options. Unless it is being used purely for
31477 verification (see <option>verify_only</option>) a transport is required to be defined by the
31478 generic <option>transport</option> option. The router accepts the address if its domain part
31479 takes the form of an RFC 2822 domain literal. For example, the <command>ipliteral</command>
31480 router handles the address
31481 </para>
31482 <literallayout class="monospaced">
31483 root@[192.168.1.1]
31484 </literallayout>
31485 <para>
31486 by setting up delivery to the host with that IP address. IPv4 domain literals
31487 consist of an IPv4 address enclosed in square brackets. IPv6 domain literals
31488 are similar, but the address is preceded by <literal>ipv6:</literal>. For example:
31489 </para>
31490 <literallayout class="monospaced">
31491 postmaster@[ipv6:fe80::a00:20ff:fe86:a061.5678]
31492 </literallayout>
31493 <para>
31494 Exim allows <literal>ipv4:</literal> before IPv4 addresses, for consistency, and on the
31495 grounds that sooner or later somebody will try it.
31496 </para>
31497 <para>
31498 <indexterm role="option">
31499 <primary><option>self</option></primary>
31500 <secondary>in <command>ipliteral</command> router</secondary>
31501 </indexterm>
31502 If the IP address matches something in <option>ignore_target_hosts</option>, the router
31503 declines. If an IP literal turns out to refer to the local host, the generic
31504 <option>self</option> option determines what happens.
31505 </para>
31506 <para>
31507 The RFCs require support for domain literals; however, their use is
31508 controversial in today&#x2019;s Internet. If you want to use this router, you must
31509 also set the main configuration option <option>allow_domain_literals</option>. Otherwise,
31510 Exim will not recognize the domain literal syntax in addresses.
31511 </para>
31512 </chapter>
31513
31514 <chapter id="CHID6">
31515 <title>The iplookup router</title>
31516 <para>
31517 <indexterm role="concept">
31518 <primary><command>iplookup</command> router</primary>
31519 </indexterm>
31520 <indexterm role="concept">
31521 <primary>routers</primary>
31522 <secondary><command>iplookup</command></secondary>
31523 </indexterm>
31524 The <command>iplookup</command> router was written to fulfil a specific requirement in
31525 Cambridge University (which in fact no longer exists). For this reason, it is
31526 not included in the binary of Exim by default. If you want to include it, you
31527 must set
31528 </para>
31529 <literallayout class="monospaced">
31530 ROUTER_IPLOOKUP=yes
31531 </literallayout>
31532 <para>
31533 in your <filename>Local/Makefile</filename> configuration file.
31534 </para>
31535 <para>
31536 The <command>iplookup</command> router routes an address by sending it over a TCP or UDP
31537 connection to one or more specific hosts. The host can then return the same or
31538 a different address &ndash; in effect rewriting the recipient address in the
31539 message&#x2019;s envelope. The new address is then passed on to subsequent routers. If
31540 this process fails, the address can be passed on to other routers, or delivery
31541 can be deferred. Since <command>iplookup</command> is just a rewriting router, a transport
31542 must not be specified for it.
31543 </para>
31544 <para>
31545 <indexterm role="concept">
31546 <primary>options</primary>
31547 <secondary><command>iplookup</command> router</secondary>
31548 </indexterm>
31549 <indexterm role="option">
31550 <primary><option>hosts</option></primary>
31551 </indexterm>
31552 </para>
31553 <informaltable frame="all">
31554 <tgroup cols="4" colsep="0" rowsep="0">
31555 <colspec colwidth="8*" align="left"/>
31556 <colspec colwidth="6*" align="center"/>
31557 <colspec colwidth="6*" align="center"/>
31558 <colspec colwidth="6*" align="right"/>
31559 <tbody>
31560 <row>
31561 <entry><option>hosts</option></entry>
31562 <entry>Use: <emphasis>iplookup</emphasis></entry>
31563 <entry>Type: <emphasis>string</emphasis></entry>
31564 <entry>Default: <emphasis>unset</emphasis></entry>
31565 </row>
31566 </tbody>
31567 </tgroup>
31568 </informaltable>
31569 <para>
31570 This option must be supplied. Its value is a colon-separated list of host
31571 names. The hosts are looked up using <function>gethostbyname()</function>
31572 (or <function>getipnodebyname()</function> when available)
31573 and are tried in order until one responds to the query. If none respond, what
31574 happens is controlled by <option>optional</option>.
31575 </para>
31576 <para>
31577 <indexterm role="option">
31578 <primary><option>optional</option></primary>
31579 </indexterm>
31580 </para>
31581 <informaltable frame="all">
31582 <tgroup cols="4" colsep="0" rowsep="0">
31583 <colspec colwidth="8*" align="left"/>
31584 <colspec colwidth="6*" align="center"/>
31585 <colspec colwidth="6*" align="center"/>
31586 <colspec colwidth="6*" align="right"/>
31587 <tbody>
31588 <row>
31589 <entry><option>optional</option></entry>
31590 <entry>Use: <emphasis>iplookup</emphasis></entry>
31591 <entry>Type: <emphasis>boolean</emphasis></entry>
31592 <entry>Default: <emphasis>false</emphasis></entry>
31593 </row>
31594 </tbody>
31595 </tgroup>
31596 </informaltable>
31597 <para>
31598 If <option>optional</option> is true, if no response is obtained from any host, the address
31599 is passed to the next router, overriding <option>no_more</option>. If <option>optional</option> is false,
31600 delivery to the address is deferred.
31601 </para>
31602 <para>
31603 <indexterm role="option">
31604 <primary><option>port</option></primary>
31605 </indexterm>
31606 </para>
31607 <informaltable frame="all">
31608 <tgroup cols="4" colsep="0" rowsep="0">
31609 <colspec colwidth="8*" align="left"/>
31610 <colspec colwidth="6*" align="center"/>
31611 <colspec colwidth="6*" align="center"/>
31612 <colspec colwidth="6*" align="right"/>
31613 <tbody>
31614 <row>
31615 <entry><option>port</option></entry>
31616 <entry>Use: <emphasis>iplookup</emphasis></entry>
31617 <entry>Type: <emphasis>integer</emphasis></entry>
31618 <entry>Default: <emphasis>0</emphasis></entry>
31619 </row>
31620 </tbody>
31621 </tgroup>
31622 </informaltable>
31623 <para>
31624 <indexterm role="concept">
31625 <primary>port</primary>
31626 <secondary><command>iplookup</command> router</secondary>
31627 </indexterm>
31628 This option must be supplied. It specifies the port number for the TCP or UDP
31629 call.
31630 </para>
31631 <para>
31632 <indexterm role="option">
31633 <primary><option>protocol</option></primary>
31634 </indexterm>
31635 </para>
31636 <informaltable frame="all">
31637 <tgroup cols="4" colsep="0" rowsep="0">
31638 <colspec colwidth="8*" align="left"/>
31639 <colspec colwidth="6*" align="center"/>
31640 <colspec colwidth="6*" align="center"/>
31641 <colspec colwidth="6*" align="right"/>
31642 <tbody>
31643 <row>
31644 <entry><option>protocol</option></entry>
31645 <entry>Use: <emphasis>iplookup</emphasis></entry>
31646 <entry>Type: <emphasis>string</emphasis></entry>
31647 <entry>Default: <emphasis>udp</emphasis></entry>
31648 </row>
31649 </tbody>
31650 </tgroup>
31651 </informaltable>
31652 <para>
31653 This option can be set to <quote>udp</quote> or <quote>tcp</quote> to specify which of the two
31654 protocols is to be used.
31655 </para>
31656 <para>
31657 <indexterm role="option">
31658 <primary><option>query</option></primary>
31659 </indexterm>
31660 </para>
31661 <informaltable frame="all">
31662 <tgroup cols="4" colsep="0" rowsep="0">
31663 <colspec colwidth="8*" align="left"/>
31664 <colspec colwidth="6*" align="center"/>
31665 <colspec colwidth="6*" align="center"/>
31666 <colspec colwidth="6*" align="right"/>
31667 <tbody>
31668 <row>
31669 <entry><option>query</option></entry>
31670 <entry>Use: <emphasis>iplookup</emphasis></entry>
31671 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31672 <entry>Default: <emphasis>see below</emphasis></entry>
31673 </row>
31674 </tbody>
31675 </tgroup>
31676 </informaltable>
31677 <para>
31678 This defines the content of the query that is sent to the remote hosts. The
31679 default value is:
31680 </para>
31681 <literallayout class="monospaced">
31682 $local_part@$domain $local_part@$domain
31683 </literallayout>
31684 <para>
31685 The repetition serves as a way of checking that a response is to the correct
31686 query in the default case (see <option>response_pattern</option> below).
31687 </para>
31688 <para>
31689 <indexterm role="option">
31690 <primary><option>reroute</option></primary>
31691 </indexterm>
31692 </para>
31693 <informaltable frame="all">
31694 <tgroup cols="4" colsep="0" rowsep="0">
31695 <colspec colwidth="8*" align="left"/>
31696 <colspec colwidth="6*" align="center"/>
31697 <colspec colwidth="6*" align="center"/>
31698 <colspec colwidth="6*" align="right"/>
31699 <tbody>
31700 <row>
31701 <entry><option>reroute</option></entry>
31702 <entry>Use: <emphasis>iplookup</emphasis></entry>
31703 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31704 <entry>Default: <emphasis>unset</emphasis></entry>
31705 </row>
31706 </tbody>
31707 </tgroup>
31708 </informaltable>
31709 <para>
31710 If this option is not set, the rerouted address is precisely the byte string
31711 returned by the remote host, up to the first white space, if any. If set, the
31712 string is expanded to form the rerouted address. It can include parts matched
31713 in the response by <option>response_pattern</option> by means of numeric variables such as
31714 <varname>$1</varname>, <varname>$2</varname>, etc. The variable <varname>$0</varname> refers to the entire input string,
31715 whether or not a pattern is in use. In all cases, the rerouted address must end
31716 up in the form <emphasis>local_part@domain</emphasis>.
31717 </para>
31718 <para>
31719 <indexterm role="option">
31720 <primary><option>response_pattern</option></primary>
31721 </indexterm>
31722 </para>
31723 <informaltable frame="all">
31724 <tgroup cols="4" colsep="0" rowsep="0">
31725 <colspec colwidth="8*" align="left"/>
31726 <colspec colwidth="6*" align="center"/>
31727 <colspec colwidth="6*" align="center"/>
31728 <colspec colwidth="6*" align="right"/>
31729 <tbody>
31730 <row>
31731 <entry><option>response_pattern</option></entry>
31732 <entry>Use: <emphasis>iplookup</emphasis></entry>
31733 <entry>Type: <emphasis>string</emphasis></entry>
31734 <entry>Default: <emphasis>unset</emphasis></entry>
31735 </row>
31736 </tbody>
31737 </tgroup>
31738 </informaltable>
31739 <para>
31740 This option can be set to a regular expression that is applied to the string
31741 returned from the remote host. If the pattern does not match the response, the
31742 router declines. If <option>response_pattern</option> is not set, no checking of the
31743 response is done, unless the query was defaulted, in which case there is a
31744 check that the text returned after the first white space is the original
31745 address. This checks that the answer that has been received is in response to
31746 the correct question. For example, if the response is just a new domain, the
31747 following could be used:
31748 </para>
31749 <literallayout class="monospaced">
31750 response_pattern = ^([^@]+)$
31751 reroute = $local_part@$1
31752 </literallayout>
31753 <para>
31754 <indexterm role="option">
31755 <primary><option>timeout</option></primary>
31756 </indexterm>
31757 </para>
31758 <informaltable frame="all">
31759 <tgroup cols="4" colsep="0" rowsep="0">
31760 <colspec colwidth="8*" align="left"/>
31761 <colspec colwidth="6*" align="center"/>
31762 <colspec colwidth="6*" align="center"/>
31763 <colspec colwidth="6*" align="right"/>
31764 <tbody>
31765 <row>
31766 <entry><option>timeout</option></entry>
31767 <entry>Use: <emphasis>iplookup</emphasis></entry>
31768 <entry>Type: <emphasis>time</emphasis></entry>
31769 <entry>Default: <emphasis>5s</emphasis></entry>
31770 </row>
31771 </tbody>
31772 </tgroup>
31773 </informaltable>
31774 <para>
31775 This specifies the amount of time to wait for a response from the remote
31776 machine. The same timeout is used for the <function>connect()</function> function for a TCP
31777 call. It does not apply to UDP.
31778 </para>
31779 </chapter>
31780
31781 <chapter id="CHID7">
31782 <title>The manualroute router</title>
31783 <para>
31784 <indexterm role="concept" id="IIDmanrou1" class="startofrange">
31785 <primary><command>manualroute</command> router</primary>
31786 </indexterm>
31787 <indexterm role="concept" id="IIDmanrou2" class="startofrange">
31788 <primary>routers</primary>
31789 <secondary><command>manualroute</command></secondary>
31790 </indexterm>
31791 <indexterm role="concept">
31792 <primary>domain</primary>
31793 <secondary>manually routing</secondary>
31794 </indexterm>
31795 The <command>manualroute</command> router is so-called because it provides a way of manually
31796 routing an address according to its domain. It is mainly used when you want to
31797 route addresses to remote hosts according to your own rules, bypassing the
31798 normal DNS routing that looks up MX records. However, <command>manualroute</command> can also
31799 route to local transports, a facility that may be useful if you want to save
31800 messages for dial-in hosts in local files.
31801 </para>
31802 <para>
31803 The <command>manualroute</command> router compares a list of domain patterns with the domain
31804 it is trying to route. If there is no match, the router declines. Each pattern
31805 has associated with it a list of hosts and some other optional data, which may
31806 include a transport. The combination of a pattern and its data is called a
31807 <quote>routing rule</quote>. For patterns that do not have an associated transport, the
31808 generic <option>transport</option> option must specify a transport, unless the router is
31809 being used purely for verification (see <option>verify_only</option>).
31810 </para>
31811 <para>
31812 <indexterm role="variable">
31813 <primary><varname>$host</varname></primary>
31814 </indexterm>
31815 In the case of verification, matching the domain pattern is sufficient for the
31816 router to accept the address. When actually routing an address for delivery,
31817 an address that matches a domain pattern is queued for the associated
31818 transport. If the transport is not a local one, a host list must be associated
31819 with the pattern; IP addresses are looked up for the hosts, and these are
31820 passed to the transport along with the mail address. For local transports, a
31821 host list is optional. If it is present, it is passed in <varname>$host</varname> as a single
31822 text string.
31823 </para>
31824 <para>
31825 The list of routing rules can be provided as an inline string in
31826 <option>route_list</option>, or the data can be obtained by looking up the domain in a file
31827 or database by setting <option>route_data</option>. Only one of these settings may appear in
31828 any one instance of <command>manualroute</command>. The format of routing rules is described
31829 below, following the list of private options.
31830 </para>
31831 <section id="SECTprioptman">
31832 <title>Private options for manualroute</title>
31833 <para>
31834 <indexterm role="concept">
31835 <primary>options</primary>
31836 <secondary><command>manualroute</command> router</secondary>
31837 </indexterm>
31838 The private options for the <command>manualroute</command> router are as follows:
31839 </para>
31840 <para>
31841 <indexterm role="option">
31842 <primary><option>host_all_ignored</option></primary>
31843 </indexterm>
31844 </para>
31845 <informaltable frame="all">
31846 <tgroup cols="4" colsep="0" rowsep="0">
31847 <colspec colwidth="8*" align="left"/>
31848 <colspec colwidth="6*" align="center"/>
31849 <colspec colwidth="6*" align="center"/>
31850 <colspec colwidth="6*" align="right"/>
31851 <tbody>
31852 <row>
31853 <entry><option>host_all_ignored</option></entry>
31854 <entry>Use: <emphasis>manualroute</emphasis></entry>
31855 <entry>Type: <emphasis>string</emphasis></entry>
31856 <entry>Default: <emphasis>defer</emphasis></entry>
31857 </row>
31858 </tbody>
31859 </tgroup>
31860 </informaltable>
31861 <para>
31862 See <option>host_find_failed</option>.
31863 </para>
31864 <para>
31865 <indexterm role="option">
31866 <primary><option>host_find_failed</option></primary>
31867 </indexterm>
31868 </para>
31869 <informaltable frame="all">
31870 <tgroup cols="4" colsep="0" rowsep="0">
31871 <colspec colwidth="8*" align="left"/>
31872 <colspec colwidth="6*" align="center"/>
31873 <colspec colwidth="6*" align="center"/>
31874 <colspec colwidth="6*" align="right"/>
31875 <tbody>
31876 <row>
31877 <entry><option>host_find_failed</option></entry>
31878 <entry>Use: <emphasis>manualroute</emphasis></entry>
31879 <entry>Type: <emphasis>string</emphasis></entry>
31880 <entry>Default: <emphasis>freeze</emphasis></entry>
31881 </row>
31882 </tbody>
31883 </tgroup>
31884 </informaltable>
31885 <para>
31886 This option controls what happens when <command>manualroute</command> tries to find an IP
31887 address for a host, and the host does not exist. The option can be set to one
31888 of the following values:
31889 </para>
31890 <literallayout class="monospaced">
31891 decline
31892 defer
31893 fail
31894 freeze
31895 ignore
31896 pass
31897 </literallayout>
31898 <para>
31899 The default (<quote>freeze</quote>) assumes that this state is a serious configuration
31900 error. The difference between <quote>pass</quote> and <quote>decline</quote> is that the former
31901 forces the address to be passed to the next router (or the router defined by
31902 <option>pass_router</option>),
31903 <indexterm role="option">
31904 <primary><option>more</option></primary>
31905 </indexterm>
31906 overriding <option>no_more</option>, whereas the latter passes the address to the next
31907 router only if <option>more</option> is true.
31908 </para>
31909 <para>
31910 The value <quote>ignore</quote> causes Exim to completely ignore a host whose IP address
31911 cannot be found. If all the hosts in the list are ignored, the behaviour is
31912 controlled by the <option>host_all_ignored</option> option. This takes the same values
31913 as <option>host_find_failed</option>, except that it cannot be set to <quote>ignore</quote>.
31914 </para>
31915 <para>
31916 The <option>host_find_failed</option> option applies only to a definite <quote>does not exist</quote>
31917 state; if a host lookup gets a temporary error, delivery is deferred unless the
31918 generic <option>pass_on_timeout</option> option is set.
31919 </para>
31920 <para>
31921 <indexterm role="option">
31922 <primary><option>hosts_randomize</option></primary>
31923 </indexterm>
31924 </para>
31925 <informaltable frame="all">
31926 <tgroup cols="4" colsep="0" rowsep="0">
31927 <colspec colwidth="8*" align="left"/>
31928 <colspec colwidth="6*" align="center"/>
31929 <colspec colwidth="6*" align="center"/>
31930 <colspec colwidth="6*" align="right"/>
31931 <tbody>
31932 <row>
31933 <entry><option>hosts_randomize</option></entry>
31934 <entry>Use: <emphasis>manualroute</emphasis></entry>
31935 <entry>Type: <emphasis>boolean</emphasis></entry>
31936 <entry>Default: <emphasis>false</emphasis></entry>
31937 </row>
31938 </tbody>
31939 </tgroup>
31940 </informaltable>
31941 <para>
31942 <indexterm role="concept">
31943 <primary>randomized host list</primary>
31944 </indexterm>
31945 <indexterm role="concept">
31946 <primary>host</primary>
31947 <secondary>list of; randomized</secondary>
31948 </indexterm>
31949 If this option is set, the order of the items in a host list in a routing rule
31950 is randomized each time the list is used, unless an option in the routing rule
31951 overrides (see below). Randomizing the order of a host list can be used to do
31952 crude load sharing. However, if more than one mail address is routed by the
31953 same router to the same host list, the host lists are considered to be the same
31954 (even though they may be randomized into different orders) for the purpose of
31955 deciding whether to batch the deliveries into a single SMTP transaction.
31956 </para>
31957 <para>
31958 When <option>hosts_randomize</option> is true, a host list may be split
31959 into groups whose order is separately randomized. This makes it possible to
31960 set up MX-like behaviour. The boundaries between groups are indicated by an
31961 item that is just <literal>+</literal> in the host list. For example:
31962 </para>
31963 <literallayout class="monospaced">
31964 route_list = * host1:host2:host3:+:host4:host5
31965 </literallayout>
31966 <para>
31967 The order of the first three hosts and the order of the last two hosts is
31968 randomized for each use, but the first three always end up before the last two.
31969 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored. If a
31970 randomized host list is passed to an <command>smtp</command> transport that also has
31971 <option>hosts_randomize set</option>, the list is not re-randomized.
31972 </para>
31973 <para>
31974 <indexterm role="option">
31975 <primary><option>route_data</option></primary>
31976 </indexterm>
31977 </para>
31978 <informaltable frame="all">
31979 <tgroup cols="4" colsep="0" rowsep="0">
31980 <colspec colwidth="8*" align="left"/>
31981 <colspec colwidth="6*" align="center"/>
31982 <colspec colwidth="6*" align="center"/>
31983 <colspec colwidth="6*" align="right"/>
31984 <tbody>
31985 <row>
31986 <entry><option>route_data</option></entry>
31987 <entry>Use: <emphasis>manualroute</emphasis></entry>
31988 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31989 <entry>Default: <emphasis>unset</emphasis></entry>
31990 </row>
31991 </tbody>
31992 </tgroup>
31993 </informaltable>
31994 <para>
31995 If this option is set, it must expand to yield the data part of a routing rule.
31996 Typically, the expansion string includes a lookup based on the domain. For
31997 example:
31998 </para>
31999 <literallayout class="monospaced">
32000 route_data = ${lookup{$domain}dbm{/etc/routes}}
32001 </literallayout>
32002 <para>
32003 If the expansion is forced to fail, or the result is an empty string, the
32004 router declines. Other kinds of expansion failure cause delivery to be
32005 deferred.
32006 </para>
32007 <para>
32008 <indexterm role="option">
32009 <primary><option>route_list</option></primary>
32010 </indexterm>
32011 </para>
32012 <informaltable frame="all">
32013 <tgroup cols="4" colsep="0" rowsep="0">
32014 <colspec colwidth="8*" align="left"/>
32015 <colspec colwidth="6*" align="center"/>
32016 <colspec colwidth="6*" align="center"/>
32017 <colspec colwidth="6*" align="right"/>
32018 <tbody>
32019 <row>
32020 <entry><option>route_list</option></entry>
32021 <entry>Use: <emphasis>manualroute</emphasis></entry>
32022 <entry>Type: <emphasis>string list</emphasis></entry>
32023 <entry>Default: <emphasis>unset</emphasis></entry>
32024 </row>
32025 </tbody>
32026 </tgroup>
32027 </informaltable>
32028 <para>
32029 This string is a list of routing rules, in the form defined below. Note that,
32030 unlike most string lists, the items are separated by semicolons. This is so
32031 that they may contain colon-separated host lists.
32032 </para>
32033 <para>
32034 <indexterm role="option">
32035 <primary><option>same_domain_copy_routing</option></primary>
32036 </indexterm>
32037 </para>
32038 <informaltable frame="all">
32039 <tgroup cols="4" colsep="0" rowsep="0">
32040 <colspec colwidth="8*" align="left"/>
32041 <colspec colwidth="6*" align="center"/>
32042 <colspec colwidth="6*" align="center"/>
32043 <colspec colwidth="6*" align="right"/>
32044 <tbody>
32045 <row>
32046 <entry><option>same_domain_copy_routing</option></entry>
32047 <entry>Use: <emphasis>manualroute</emphasis></entry>
32048 <entry>Type: <emphasis>boolean</emphasis></entry>
32049 <entry>Default: <emphasis>false</emphasis></entry>
32050 </row>
32051 </tbody>
32052 </tgroup>
32053 </informaltable>
32054 <para>
32055 <indexterm role="concept">
32056 <primary>address</primary>
32057 <secondary>copying routing</secondary>
32058 </indexterm>
32059 Addresses with the same domain are normally routed by the <command>manualroute</command>
32060 router to the same list of hosts. However, this cannot be presumed, because the
32061 router options and preconditions may refer to the local part of the address. By
32062 default, therefore, Exim routes each address in a message independently. DNS
32063 servers run caches, so repeated DNS lookups are not normally expensive, and in
32064 any case, personal messages rarely have more than a few recipients.
32065 </para>
32066 <para>
32067 If you are running mailing lists with large numbers of subscribers at the same
32068 domain, and you are using a <command>manualroute</command> router which is independent of the
32069 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
32070 lookups for identical domains in one message. In this case, when
32071 <command>manualroute</command> routes an address to a remote transport, any other unrouted
32072 addresses in the message that have the same domain are automatically given the
32073 same routing without processing them independently. However, this is only done
32074 if <option>headers_add</option> and <option>headers_remove</option> are unset.
32075 </para>
32076 </section>
32077 <section id="SECID120">
32078 <title>Routing rules in route_list</title>
32079 <para>
32080 The value of <option>route_list</option> is a string consisting of a sequence of routing
32081 rules, separated by semicolons. If a semicolon is needed in a rule, it can be
32082 entered as two semicolons. Alternatively, the list separator can be changed as
32083 described (for colon-separated lists) in section <xref linkend="SECTlistconstruct"/>.
32084 Empty rules are ignored. The format of each rule is
32085 </para>
32086 <literallayout>
32087 &lt;<emphasis>domain pattern</emphasis>&gt;  &lt;<emphasis>list of hosts</emphasis>&gt;  &lt;<emphasis>options</emphasis>&gt;
32088 </literallayout>
32089 <para>
32090 The following example contains two rules, each with a simple domain pattern and
32091 no options:
32092 </para>
32093 <literallayout class="monospaced">
32094 route_list = \
32095   dict.ref.example  mail-1.ref.example:mail-2.ref.example ; \
32096   thes.ref.example  mail-3.ref.example:mail-4.ref.example
32097 </literallayout>
32098 <para>
32099 The three parts of a rule are separated by white space. The pattern and the
32100 list of hosts can be enclosed in quotes if necessary, and if they are, the
32101 usual quoting rules apply. Each rule in a <option>route_list</option> must start with a
32102 single domain pattern, which is the only mandatory item in the rule. The
32103 pattern is in the same format as one item in a domain list (see section
32104 <xref linkend="SECTdomainlist"/>),
32105 except that it may not be the name of an interpolated file.
32106 That is, it may be wildcarded, or a regular expression, or a file or database
32107 lookup (with semicolons doubled, because of the use of semicolon as a separator
32108 in a <option>route_list</option>).
32109 </para>
32110 <para>
32111 The rules in <option>route_list</option> are searched in order until one of the patterns
32112 matches the domain that is being routed. The list of hosts and then options are
32113 then used as described below. If there is no match, the router declines. When
32114 <option>route_list</option> is set, <option>route_data</option> must not be set.
32115 </para>
32116 </section>
32117 <section id="SECID121">
32118 <title>Routing rules in route_data</title>
32119 <para>
32120 The use of <option>route_list</option> is convenient when there are only a small number of
32121 routing rules. For larger numbers, it is easier to use a file or database to
32122 hold the routing information, and use the <option>route_data</option> option instead.
32123 The value of <option>route_data</option> is a list of hosts, followed by (optional) options.
32124 Most commonly, <option>route_data</option> is set as a string that contains an
32125 expansion lookup. For example, suppose we place two routing rules in a file
32126 like this:
32127 </para>
32128 <literallayout class="monospaced">
32129 dict.ref.example:  mail-1.ref.example:mail-2.ref.example
32130 thes.ref.example:  mail-3.ref.example:mail-4.ref.example
32131 </literallayout>
32132 <para>
32133 This data can be accessed by setting
32134 </para>
32135 <literallayout class="monospaced">
32136 route_data = ${lookup{$domain}lsearch{/the/file/name}}
32137 </literallayout>
32138 <para>
32139 Failure of the lookup results in an empty string, causing the router to
32140 decline. However, you do not have to use a lookup in <option>route_data</option>. The only
32141 requirement is that the result of expanding the string is a list of hosts,
32142 possibly followed by options, separated by white space. The list of hosts must
32143 be enclosed in quotes if it contains white space.
32144 </para>
32145 </section>
32146 <section id="SECID122">
32147 <title>Format of the list of hosts</title>
32148 <para>
32149 A list of hosts, whether obtained via <option>route_data</option> or <option>route_list</option>, is
32150 always separately expanded before use. If the expansion fails, the router
32151 declines. The result of the expansion must be a colon-separated list of names
32152 and/or IP addresses, optionally also including ports. The format of each item
32153 in the list is described in the next section. The list separator can be changed
32154 as described in section <xref linkend="SECTlistconstruct"/>.
32155 </para>
32156 <para>
32157 If the list of hosts was obtained from a <option>route_list</option> item, the following
32158 variables are set during its expansion:
32159 </para>
32160 <itemizedlist>
32161 <listitem>
32162 <para>
32163 <indexterm role="concept">
32164 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname>  etc)</primary>
32165 <secondary>in <command>manualroute</command> router</secondary>
32166 </indexterm>
32167 If the domain was matched against a regular expression, the numeric variables
32168 <varname>$1</varname>, <varname>$2</varname>, etc. may be set. For example:
32169 </para>
32170 <literallayout class="monospaced">
32171 route_list = ^domain(\d+)   host-$1.text.example
32172 </literallayout>
32173 </listitem>
32174 <listitem>
32175 <para>
32176 <varname>$0</varname> is always set to the entire domain.
32177 </para>
32178 </listitem>
32179 <listitem>
32180 <para>
32181 <varname>$1</varname> is also set when partial matching is done in a file lookup.
32182 </para>
32183 </listitem>
32184 <listitem>
32185 <para>
32186 <indexterm role="variable">
32187 <primary><varname>$value</varname></primary>
32188 </indexterm>
32189 If the pattern that matched the domain was a lookup item, the data that was
32190 looked up is available in the expansion variable <varname>$value</varname>. For example:
32191 </para>
32192 <literallayout class="monospaced">
32193 route_list = lsearch;;/some/file.routes  $value
32194 </literallayout>
32195 </listitem>
32196 </itemizedlist>
32197 <para>
32198 Note the doubling of the semicolon in the pattern that is necessary because
32199 semicolon is the default route list separator.
32200 </para>
32201 </section>
32202 <section id="SECTformatonehostitem">
32203 <title>Format of one host item</title>
32204 <para>
32205 Each item in the list of hosts is either a host name or an IP address,
32206 optionally with an attached port number. When no port is given, an IP address
32207 is not enclosed in brackets. When a port is specified, it overrides the port
32208 specification on the transport. The port is separated from the name or address
32209 by a colon. This leads to some complications:
32210 </para>
32211 <itemizedlist>
32212 <listitem>
32213 <para>
32214 Because colon is the default separator for the list of hosts, either
32215 the colon that specifies a port must be doubled, or the list separator must
32216 be changed. The following two examples have the same effect:
32217 </para>
32218 <literallayout class="monospaced">
32219 route_list = * "host1.tld::1225 : host2.tld::1226"
32220 route_list = * "&lt;+ host1.tld:1225 + host2.tld:1226"
32221 </literallayout>
32222 </listitem>
32223 <listitem>
32224 <para>
32225 When IPv6 addresses are involved, it gets worse, because they contain
32226 colons of their own. To make this case easier, it is permitted to
32227 enclose an IP address (either v4 or v6) in square brackets if a port
32228 number follows. For example:
32229 </para>
32230 <literallayout class="monospaced">
32231 route_list = * "&lt;/ [10.1.1.1]:1225 / [::1]:1226"
32232 </literallayout>
32233 </listitem>
32234 </itemizedlist>
32235 </section>
32236 <section id="SECThostshowused">
32237 <title>How the list of hosts is used</title>
32238 <para>
32239 When an address is routed to an <command>smtp</command> transport by <command>manualroute</command>, each of
32240 the hosts is tried, in the order specified, when carrying out the SMTP
32241 delivery. However, the order can be changed by setting the <option>hosts_randomize</option>
32242 option, either on the router (see section <xref linkend="SECTprioptman"/> above), or on the
32243 transport.
32244 </para>
32245 <para>
32246 Hosts may be listed by name or by IP address. An unadorned name in the list of
32247 hosts is interpreted as a host name. A name that is followed by <literal>/MX</literal> is
32248 interpreted as an indirection to a sublist of hosts obtained by looking up MX
32249 records in the DNS. For example:
32250 </para>
32251 <literallayout class="monospaced">
32252 route_list = *  x.y.z:p.q.r/MX:e.f.g
32253 </literallayout>
32254 <para>
32255 If this feature is used with a port specifier, the port must come last. For
32256 example:
32257 </para>
32258 <literallayout class="monospaced">
32259 route_list = *  dom1.tld/mx::1225
32260 </literallayout>
32261 <para>
32262 If the <option>hosts_randomize</option> option is set, the order of the items in the list is
32263 randomized before any lookups are done. Exim then scans the list; for any name
32264 that is not followed by <literal>/MX</literal> it looks up an IP address. If this turns out to
32265 be an interface on the local host and the item is not the first in the list,
32266 Exim discards it and any subsequent items. If it is the first item, what
32267 happens is controlled by the
32268 <indexterm role="option">
32269 <primary><option>self</option></primary>
32270 <secondary>in <command>manualroute</command> router</secondary>
32271 </indexterm>
32272 <option>self</option> option of the router.
32273 </para>
32274 <para>
32275 A name on the list that is followed by <literal>/MX</literal> is replaced with the list of
32276 hosts obtained by looking up MX records for the name. This is always a DNS
32277 lookup; the <option>bydns</option> and <option>byname</option> options (see section <xref linkend="SECThowoptused"/>
32278 below) are not relevant here. The order of these hosts is determined by the
32279 preference values in the MX records, according to the usual rules. Because
32280 randomizing happens before the MX lookup, it does not affect the order that is
32281 defined by MX preferences.
32282 </para>
32283 <para>
32284 If the local host is present in the sublist obtained from MX records, but is
32285 not the most preferred host in that list, it and any equally or less
32286 preferred hosts are removed before the sublist is inserted into the main list.
32287 </para>
32288 <para>
32289 If the local host is the most preferred host in the MX list, what happens
32290 depends on where in the original list of hosts the <literal>/MX</literal> item appears. If it
32291 is not the first item (that is, there are previous hosts in the main list),
32292 Exim discards this name and any subsequent items in the main list.
32293 </para>
32294 <para>
32295 If the MX item is first in the list of hosts, and the local host is the
32296 most preferred host, what happens is controlled by the <option>self</option> option of the
32297 router.
32298 </para>
32299 <para>
32300 DNS failures when lookup up the MX records are treated in the same way as DNS
32301 failures when looking up IP addresses: <option>pass_on_timeout</option> and
32302 <option>host_find_failed</option> are used when relevant.
32303 </para>
32304 <para>
32305 The generic <option>ignore_target_hosts</option> option applies to all hosts in the list,
32306 whether obtained from an MX lookup or not.
32307 </para>
32308 </section>
32309 <section id="SECThowoptused">
32310 <title>How the options are used</title>
32311 <para>
32312 The options are a sequence of words; in practice no more than three are ever
32313 present. One of the words can be the name of a transport; this overrides the
32314 <option>transport</option> option on the router for this particular routing rule only. The
32315 other words (if present) control randomization of the list of hosts on a
32316 per-rule basis, and how the IP addresses of the hosts are to be found when
32317 routing to a remote transport. These options are as follows:
32318 </para>
32319 <itemizedlist>
32320 <listitem>
32321 <para>
32322 <option>randomize</option>: randomize the order of the hosts in this list, overriding the
32323 setting of <option>hosts_randomize</option> for this routing rule only.
32324 </para>
32325 </listitem>
32326 <listitem>
32327 <para>
32328 <option>no_randomize</option>: do not randomize the order of the hosts in this list,
32329 overriding the setting of <option>hosts_randomize</option> for this routing rule only.
32330 </para>
32331 </listitem>
32332 <listitem>
32333 <para>
32334 <option>byname</option>: use <function>getipnodebyname()</function> (<function>gethostbyname()</function> on older systems) to
32335 find IP addresses. This function may ultimately cause a DNS lookup, but it may
32336 also look in <filename>/etc/hosts</filename> or other sources of information.
32337 </para>
32338 </listitem>
32339 <listitem>
32340 <para>
32341 <option>bydns</option>: look up address records for the hosts directly in the DNS; fail if
32342 no address records are found. If there is a temporary DNS error (such as a
32343 timeout), delivery is deferred.
32344 </para>
32345 </listitem>
32346 </itemizedlist>
32347 <para>
32348 For example:
32349 </para>
32350 <literallayout class="monospaced">
32351 route_list = domain1  host1:host2:host3  randomize bydns;\
32352              domain2  host4:host5
32353 </literallayout>
32354 <para>
32355 If neither <option>byname</option> nor <option>bydns</option> is given, Exim behaves as follows: First, a
32356 DNS lookup is done. If this yields anything other than HOST_NOT_FOUND, that
32357 result is used. Otherwise, Exim goes on to try a call to <function>getipnodebyname()</function>
32358 or <function>gethostbyname()</function>, and the result of the lookup is the result of that
32359 call.
32360 </para>
32361 <para>
32362 <emphasis role="bold">Warning</emphasis>: It has been discovered that on some systems, if a DNS lookup
32363 called via <function>getipnodebyname()</function> times out, HOST_NOT_FOUND is returned
32364 instead of TRY_AGAIN. That is why the default action is to try a DNS
32365 lookup first. Only if that gives a definite <quote>no such host</quote> is the local
32366 function called.
32367 </para>
32368 <para>
32369 If no IP address for a host can be found, what happens is controlled by the
32370 <option>host_find_failed</option> option.
32371 </para>
32372 <para>
32373 <indexterm role="variable">
32374 <primary><varname>$host</varname></primary>
32375 </indexterm>
32376 When an address is routed to a local transport, IP addresses are not looked up.
32377 The host list is passed to the transport in the <varname>$host</varname> variable.
32378 </para>
32379 </section>
32380 <section id="SECID123">
32381 <title>Manualroute examples</title>
32382 <para>
32383 In some of the examples that follow, the presence of the <option>remote_smtp</option>
32384 transport, as defined in the default configuration file, is assumed:
32385 </para>
32386 <itemizedlist>
32387 <listitem>
32388 <para>
32389 <indexterm role="concept">
32390 <primary>smart host</primary>
32391 <secondary>example router</secondary>
32392 </indexterm>
32393 The <command>manualroute</command> router can be used to forward all external mail to a
32394 <emphasis>smart host</emphasis>. If you have set up, in the main part of the configuration, a
32395 named domain list that contains your local domains, for example:
32396 </para>
32397 <literallayout class="monospaced">
32398 domainlist local_domains = my.domain.example
32399 </literallayout>
32400 <para>
32401 You can arrange for all other domains to be routed to a smart host by making
32402 your first router something like this:
32403 </para>
32404 <literallayout class="monospaced">
32405 smart_route:
32406   driver = manualroute
32407   domains = !+local_domains
32408   transport = remote_smtp
32409   route_list = * smarthost.ref.example
32410 </literallayout>
32411 <para>
32412 This causes all non-local addresses to be sent to the single host
32413 <emphasis>smarthost.ref.example</emphasis>. If a colon-separated list of smart hosts is given,
32414 they are tried in order
32415 (but you can use <option>hosts_randomize</option> to vary the order each time).
32416 Another way of configuring the same thing is this:
32417 </para>
32418 <literallayout class="monospaced">
32419 smart_route:
32420   driver = manualroute
32421   transport = remote_smtp
32422   route_list = !+local_domains  smarthost.ref.example
32423 </literallayout>
32424 <para>
32425 There is no difference in behaviour between these two routers as they stand.
32426 However, they behave differently if <option>no_more</option> is added to them. In the first
32427 example, the router is skipped if the domain does not match the <option>domains</option>
32428 precondition; the following router is always tried. If the router runs, it
32429 always matches the domain and so can never decline. Therefore, <option>no_more</option>
32430 would have no effect. In the second case, the router is never skipped; it
32431 always runs. However, if it doesn&#x2019;t match the domain, it declines. In this case
32432 <option>no_more</option> would prevent subsequent routers from running.
32433 </para>
32434 </listitem>
32435 <listitem>
32436 <para>
32437 <indexterm role="concept">
32438 <primary>mail hub example</primary>
32439 </indexterm>
32440 A <emphasis>mail hub</emphasis> is a host which receives mail for a number of domains via MX
32441 records in the DNS and delivers it via its own private routing mechanism. Often
32442 the final destinations are behind a firewall, with the mail hub being the one
32443 machine that can connect to machines both inside and outside the firewall. The
32444 <command>manualroute</command> router is usually used on a mail hub to route incoming messages
32445 to the correct hosts. For a small number of domains, the routing can be inline,
32446 using the <option>route_list</option> option, but for a larger number a file or database
32447 lookup is easier to manage.
32448 </para>
32449 <para>
32450 If the domain names are in fact the names of the machines to which the mail is
32451 to be sent by the mail hub, the configuration can be quite simple. For
32452 example:
32453 </para>
32454 <literallayout class="monospaced">
32455 hub_route:
32456   driver = manualroute
32457   transport = remote_smtp
32458   route_list = *.rhodes.tvs.example  $domain
32459 </literallayout>
32460 <para>
32461 This configuration routes domains that match <literal>*.rhodes.tvs.example</literal> to hosts
32462 whose names are the same as the mail domains. A similar approach can be taken
32463 if the host name can be obtained from the domain name by a string manipulation
32464 that the expansion facilities can handle. Otherwise, a lookup based on the
32465 domain can be used to find the host:
32466 </para>
32467 <literallayout class="monospaced">
32468 through_firewall:
32469   driver = manualroute
32470   transport = remote_smtp
32471   route_data = ${lookup {$domain} cdb {/internal/host/routes}}
32472 </literallayout>
32473 <para>
32474 The result of the lookup must be the name or IP address of the host (or
32475 hosts) to which the address is to be routed. If the lookup fails, the route
32476 data is empty, causing the router to decline. The address then passes to the
32477 next router.
32478 </para>
32479 </listitem>
32480 <listitem>
32481 <para>
32482 <indexterm role="concept">
32483 <primary>batched SMTP output example</primary>
32484 </indexterm>
32485 <indexterm role="concept">
32486 <primary>SMTP</primary>
32487 <secondary>batched outgoing; example</secondary>
32488 </indexterm>
32489 You can use <command>manualroute</command> to deliver messages to pipes or files in batched
32490 SMTP format for onward transportation by some other means. This is one way of
32491 storing mail for a dial-up host when it is not connected. The route list entry
32492 can be as simple as a single domain name in a configuration like this:
32493 </para>
32494 <literallayout class="monospaced">
32495 save_in_file:
32496   driver = manualroute
32497   transport = batchsmtp_appendfile
32498   route_list = saved.domain.example
32499 </literallayout>
32500 <para>
32501 though often a pattern is used to pick up more than one domain. If there are
32502 several domains or groups of domains with different transport requirements,
32503 different transports can be listed in the routing information:
32504 </para>
32505 <literallayout class="monospaced">
32506 save_in_file:
32507   driver = manualroute
32508   route_list = \
32509     *.saved.domain1.example  $domain  batch_appendfile; \
32510     *.saved.domain2.example  \
32511       ${lookup{$domain}dbm{/domain2/hosts}{$value}fail} \
32512       batch_pipe
32513 </literallayout>
32514 <para>
32515 <indexterm role="variable">
32516 <primary><varname>$domain</varname></primary>
32517 </indexterm>
32518 <indexterm role="variable">
32519 <primary><varname>$host</varname></primary>
32520 </indexterm>
32521 The first of these just passes the domain in the <varname>$host</varname> variable, which
32522 doesn&#x2019;t achieve much (since it is also in <varname>$domain</varname>), but the second does a
32523 file lookup to find a value to pass, causing the router to decline to handle
32524 the address if the lookup fails.
32525 </para>
32526 </listitem>
32527 <listitem>
32528 <para>
32529 <indexterm role="concept">
32530 <primary>UUCP</primary>
32531 <secondary>example of router for</secondary>
32532 </indexterm>
32533 Routing mail directly to UUCP software is a specific case of the use of
32534 <command>manualroute</command> in a gateway to another mail environment. This is an example of
32535 one way it can be done:
32536 </para>
32537 <literallayout class="monospaced">
32538 # Transport
32539 uucp:
32540   driver = pipe
32541   user = nobody
32542   command = /usr/local/bin/uux -r - \
32543     ${substr_-5:$host}!rmail ${local_part}
32544   return_fail_output = true
32545
32546 # Router
32547 uucphost:
32548   transport = uucp
32549   driver = manualroute
32550   route_data = \
32551     ${lookup{$domain}lsearch{/usr/local/exim/uucphosts}}
32552 </literallayout>
32553 <para>
32554 The file <filename>/usr/local/exim/uucphosts</filename> contains entries like
32555 </para>
32556 <literallayout class="monospaced">
32557 darksite.ethereal.example:           darksite.UUCP
32558 </literallayout>
32559 <para>
32560 It can be set up more simply without adding and removing <quote>.UUCP</quote> but this way
32561 makes clear the distinction between the domain name
32562 <emphasis>darksite.ethereal.example</emphasis> and the UUCP host name <emphasis>darksite</emphasis>.
32563 </para>
32564 </listitem>
32565 </itemizedlist>
32566 <para>
32567 <indexterm role="concept" startref="IIDmanrou1" class="endofrange"/>
32568 <indexterm role="concept" startref="IIDmanrou2" class="endofrange"/>
32569 </para>
32570 </section>
32571 </chapter>
32572
32573 <chapter id="CHAPdriverlast">
32574 <title>The queryprogram router</title>
32575 <para>
32576 <indexterm role="concept" id="IIDquerou1" class="startofrange">
32577 <primary><command>queryprogram</command> router</primary>
32578 </indexterm>
32579 <indexterm role="concept" id="IIDquerou2" class="startofrange">
32580 <primary>routers</primary>
32581 <secondary><command>queryprogram</command></secondary>
32582 </indexterm>
32583 <indexterm role="concept">
32584 <primary>routing</primary>
32585 <secondary>by external program</secondary>
32586 </indexterm>
32587 The <command>queryprogram</command> router routes an address by running an external command
32588 and acting on its output. This is an expensive way to route, and is intended
32589 mainly for use in lightly-loaded systems, or for performing experiments.
32590 However, if it is possible to use the precondition options (<option>domains</option>,
32591 <option>local_parts</option>, etc) to skip this router for most addresses, it could sensibly
32592 be used in special cases, even on a busy host. There are the following private
32593 options:
32594 <indexterm role="concept">
32595 <primary>options</primary>
32596 <secondary><command>queryprogram</command> router</secondary>
32597 </indexterm>
32598 </para>
32599 <para>
32600 <indexterm role="option">
32601 <primary><option>command</option></primary>
32602 </indexterm>
32603 </para>
32604 <informaltable frame="all">
32605 <tgroup cols="4" colsep="0" rowsep="0">
32606 <colspec colwidth="8*" align="left"/>
32607 <colspec colwidth="6*" align="center"/>
32608 <colspec colwidth="6*" align="center"/>
32609 <colspec colwidth="6*" align="right"/>
32610 <tbody>
32611 <row>
32612 <entry><option>command</option></entry>
32613 <entry>Use: <emphasis>queryprogram</emphasis></entry>
32614 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32615 <entry>Default: <emphasis>unset</emphasis></entry>
32616 </row>
32617 </tbody>
32618 </tgroup>
32619 </informaltable>
32620 <para>
32621 This option must be set. It specifies the command that is to be run. The
32622 command is split up into a command name and arguments, and then each is
32623 expanded separately (exactly as for a <command>pipe</command> transport, described in chapter
32624 <xref linkend="CHAPpipetransport"/>).
32625 </para>
32626 <para>
32627 <indexterm role="option">
32628 <primary><option>command_group</option></primary>
32629 </indexterm>
32630 </para>
32631 <informaltable frame="all">
32632 <tgroup cols="4" colsep="0" rowsep="0">
32633 <colspec colwidth="8*" align="left"/>
32634 <colspec colwidth="6*" align="center"/>
32635 <colspec colwidth="6*" align="center"/>
32636 <colspec colwidth="6*" align="right"/>
32637 <tbody>
32638 <row>
32639 <entry><option>command_group</option></entry>
32640 <entry>Use: <emphasis>queryprogram</emphasis></entry>
32641 <entry>Type: <emphasis>string</emphasis></entry>
32642 <entry>Default: <emphasis>unset</emphasis></entry>
32643 </row>
32644 </tbody>
32645 </tgroup>
32646 </informaltable>
32647 <para>
32648 <indexterm role="concept">
32649 <primary>gid (group id)</primary>
32650 <secondary>in <command>queryprogram</command> router</secondary>
32651 </indexterm>
32652 This option specifies a gid to be set when running the command while routing an
32653 address for deliver. It must be set if <option>command_user</option> specifies a numerical
32654 uid. If it begins with a digit, it is interpreted as the numerical value of the
32655 gid. Otherwise it is looked up using <function>getgrnam()</function>.
32656 </para>
32657 <para>
32658 <indexterm role="option">
32659 <primary><option>command_user</option></primary>
32660 </indexterm>
32661 </para>
32662 <informaltable frame="all">
32663 <tgroup cols="4" colsep="0" rowsep="0">
32664 <colspec colwidth="8*" align="left"/>
32665 <colspec colwidth="6*" align="center"/>
32666 <colspec colwidth="6*" align="center"/>
32667 <colspec colwidth="6*" align="right"/>
32668 <tbody>
32669 <row>
32670 <entry><option>command_user</option></entry>
32671 <entry>Use: <emphasis>queryprogram</emphasis></entry>
32672 <entry>Type: <emphasis>string</emphasis></entry>
32673 <entry>Default: <emphasis>unset</emphasis></entry>
32674 </row>
32675 </tbody>
32676 </tgroup>
32677 </informaltable>
32678 <para>
32679 <indexterm role="concept">
32680 <primary>uid (user id)</primary>
32681 <secondary>for <command>queryprogram</command></secondary>
32682 </indexterm>
32683 This option must be set. It specifies the uid which is set when running the
32684 command while routing an address for delivery. If the value begins with a digit,
32685 it is interpreted as the numerical value of the uid. Otherwise, it is looked up
32686 using <function>getpwnam()</function> to obtain a value for the uid and, if <option>command_group</option> is
32687 not set, a value for the gid also.
32688 </para>
32689 <para>
32690 <emphasis role="bold">Warning:</emphasis> Changing uid and gid is possible only when Exim is running as
32691 root, which it does during a normal delivery in a conventional configuration.
32692 However, when an address is being verified during message reception, Exim is
32693 usually running as the Exim user, not as root. If the <command>queryprogram</command> router
32694 is called from a non-root process, Exim cannot change uid or gid before running
32695 the command. In this circumstance the command runs under the current uid and
32696 gid.
32697 </para>
32698 <para>
32699 <indexterm role="option">
32700 <primary><option>current_directory</option></primary>
32701 </indexterm>
32702 </para>
32703 <informaltable frame="all">
32704 <tgroup cols="4" colsep="0" rowsep="0">
32705 <colspec colwidth="8*" align="left"/>
32706 <colspec colwidth="6*" align="center"/>
32707 <colspec colwidth="6*" align="center"/>
32708 <colspec colwidth="6*" align="right"/>
32709 <tbody>
32710 <row>
32711 <entry><option>current_directory</option></entry>
32712 <entry>Use: <emphasis>queryprogram</emphasis></entry>
32713 <entry>Type: <emphasis>string</emphasis></entry>
32714 <entry>Default: <emphasis>/</emphasis></entry>
32715 </row>
32716 </tbody>
32717 </tgroup>
32718 </informaltable>
32719 <para>
32720 This option specifies an absolute path which is made the current directory
32721 before running the command.
32722 </para>
32723 <para>
32724 <indexterm role="option">
32725 <primary><option>timeout</option></primary>
32726 </indexterm>
32727 </para>
32728 <informaltable frame="all">
32729 <tgroup cols="4" colsep="0" rowsep="0">
32730 <colspec colwidth="8*" align="left"/>
32731 <colspec colwidth="6*" align="center"/>
32732 <colspec colwidth="6*" align="center"/>
32733 <colspec colwidth="6*" align="right"/>
32734 <tbody>
32735 <row>
32736 <entry><option>timeout</option></entry>
32737 <entry>Use: <emphasis>queryprogram</emphasis></entry>
32738 <entry>Type: <emphasis>time</emphasis></entry>
32739 <entry>Default: <emphasis>1h</emphasis></entry>
32740 </row>
32741 </tbody>
32742 </tgroup>
32743 </informaltable>
32744 <para>
32745 If the command does not complete within the timeout period, its process group
32746 is killed and the message is frozen. A value of zero time specifies no
32747 timeout.
32748 </para>
32749 <para>
32750 The standard output of the command is connected to a pipe, which is read when
32751 the command terminates. It should consist of a single line of output,
32752 containing up to five fields, separated by white space. The maximum length of
32753 the line is 1023 characters. Longer lines are silently truncated. The first
32754 field is one of the following words (case-insensitive):
32755 </para>
32756 <itemizedlist>
32757 <listitem>
32758 <para>
32759 <emphasis>Accept</emphasis>: routing succeeded; the remaining fields specify what to do (see
32760 below).
32761 </para>
32762 </listitem>
32763 <listitem>
32764 <para>
32765 <emphasis>Decline</emphasis>: the router declines; pass the address to the next router, unless
32766 <option>no_more</option> is set.
32767 </para>
32768 </listitem>
32769 <listitem>
32770 <para>
32771 <emphasis>Fail</emphasis>: routing failed; do not pass the address to any more routers. Any
32772 subsequent text on the line is an error message. If the router is run as part
32773 of address verification during an incoming SMTP message, the message is
32774 included in the SMTP response.
32775 </para>
32776 </listitem>
32777 <listitem>
32778 <para>
32779 <emphasis>Defer</emphasis>: routing could not be completed at this time; try again later. Any
32780 subsequent text on the line is an error message which is logged. It is not
32781 included in any SMTP response.
32782 </para>
32783 </listitem>
32784 <listitem>
32785 <para>
32786 <emphasis>Freeze</emphasis>: the same as <emphasis>defer</emphasis>, except that the message is frozen.
32787 </para>
32788 </listitem>
32789 <listitem>
32790 <para>
32791 <emphasis>Pass</emphasis>: pass the address to the next router (or the router specified by
32792 <option>pass_router</option>), overriding <option>no_more</option>.
32793 </para>
32794 </listitem>
32795 <listitem>
32796 <para>
32797 <emphasis>Redirect</emphasis>: the message is redirected. The remainder of the line is a list of
32798 new addresses, which are routed independently, starting with the first router,
32799 or the router specified by <option>redirect_router</option>, if set.
32800 </para>
32801 </listitem>
32802 </itemizedlist>
32803 <para>
32804 When the first word is <emphasis>accept</emphasis>, the remainder of the line consists of a
32805 number of keyed data values, as follows (split into two lines here, to fit on
32806 the page):
32807 </para>
32808 <literallayout class="monospaced">
32809 ACCEPT TRANSPORT=&lt;transport&gt; HOSTS=&lt;list of hosts&gt;
32810 LOOKUP=byname|bydns DATA=&lt;text&gt;
32811 </literallayout>
32812 <para>
32813 The data items can be given in any order, and all are optional. If no transport
32814 is included, the transport specified by the generic <option>transport</option> option is
32815 used. The list of hosts and the lookup type are needed only if the transport is
32816 an <command>smtp</command> transport that does not itself supply a list of hosts.
32817 </para>
32818 <para>
32819 The format of the list of hosts is the same as for the <command>manualroute</command> router.
32820 As well as host names and IP addresses with optional port numbers, as described
32821 in section <xref linkend="SECTformatonehostitem"/>, it may contain names followed by
32822 <literal>/MX</literal> to specify sublists of hosts that are obtained by looking up MX records
32823 (see section <xref linkend="SECThostshowused"/>).
32824 </para>
32825 <para>
32826 If the lookup type is not specified, Exim behaves as follows when trying to
32827 find an IP address for each host: First, a DNS lookup is done. If this yields
32828 anything other than HOST_NOT_FOUND, that result is used. Otherwise, Exim
32829 goes on to try a call to <function>getipnodebyname()</function> or <function>gethostbyname()</function>, and the
32830 result of the lookup is the result of that call.
32831 </para>
32832 <para>
32833 <indexterm role="variable">
32834 <primary><varname>$address_data</varname></primary>
32835 </indexterm>
32836 If the DATA field is set, its value is placed in the <varname>$address_data</varname>
32837 variable. For example, this return line
32838 </para>
32839 <literallayout class="monospaced">
32840 accept hosts=x1.y.example:x2.y.example data="rule1"
32841 </literallayout>
32842 <para>
32843 routes the address to the default transport, passing a list of two hosts. When
32844 the transport runs, the string <quote>rule1</quote> is in <varname>$address_data</varname>.
32845 <indexterm role="concept" startref="IIDquerou1" class="endofrange"/>
32846 <indexterm role="concept" startref="IIDquerou2" class="endofrange"/>
32847 </para>
32848 </chapter>
32849
32850 <chapter id="CHAPredirect">
32851 <title>The redirect router</title>
32852 <para>
32853 <indexterm role="concept" id="IIDredrou1" class="startofrange">
32854 <primary><command>redirect</command> router</primary>
32855 </indexterm>
32856 <indexterm role="concept" id="IIDredrou2" class="startofrange">
32857 <primary>routers</primary>
32858 <secondary><command>redirect</command></secondary>
32859 </indexterm>
32860 <indexterm role="concept">
32861 <primary>alias file</primary>
32862 <secondary>in a <command>redirect</command> router</secondary>
32863 </indexterm>
32864 <indexterm role="concept">
32865 <primary>address redirection</primary>
32866 <secondary><command>redirect</command> router</secondary>
32867 </indexterm>
32868 The <command>redirect</command> router handles several kinds of address redirection. Its most
32869 common uses are for resolving local part aliases from a central alias file
32870 (usually called <filename>/etc/aliases</filename>) and for handling users&#x2019; personal <filename>.forward</filename>
32871 files, but it has many other potential uses. The incoming address can be
32872 redirected in several different ways:
32873 </para>
32874 <itemizedlist>
32875 <listitem>
32876 <para>
32877 It can be replaced by one or more new addresses which are themselves routed
32878 independently.
32879 </para>
32880 </listitem>
32881 <listitem>
32882 <para>
32883 It can be routed to be delivered to a given file or directory.
32884 </para>
32885 </listitem>
32886 <listitem>
32887 <para>
32888 It can be routed to be delivered to a specified pipe command.
32889 </para>
32890 </listitem>
32891 <listitem>
32892 <para>
32893 It can cause an automatic reply to be generated.
32894 </para>
32895 </listitem>
32896 <listitem>
32897 <para>
32898 It can be forced to fail, optionally with a custom error message.
32899 </para>
32900 </listitem>
32901 <listitem>
32902 <para>
32903 It can be temporarily deferred, optionally with a custom message.
32904 </para>
32905 </listitem>
32906 <listitem>
32907 <para>
32908 It can be discarded.
32909 </para>
32910 </listitem>
32911 </itemizedlist>
32912 <para>
32913 The generic <option>transport</option> option must not be set for <command>redirect</command> routers.
32914 However, there are some private options which define transports for delivery to
32915 files and pipes, and for generating autoreplies. See the <option>file_transport</option>,
32916 <option>pipe_transport</option> and <option>reply_transport</option> descriptions below.
32917 </para>
32918 <section id="SECID124">
32919 <title>Redirection data</title>
32920 <para>
32921 The router operates by interpreting a text string which it obtains either by
32922 expanding the contents of the <option>data</option> option, or by reading the entire
32923 contents of a file whose name is given in the <option>file</option> option. These two
32924 options are mutually exclusive. The first is commonly used for handling system
32925 aliases, in a configuration like this:
32926 </para>
32927 <literallayout class="monospaced">
32928 system_aliases:
32929   driver = redirect
32930   data = ${lookup{$local_part}lsearch{/etc/aliases}}
32931 </literallayout>
32932 <para>
32933 If the lookup fails, the expanded string in this example is empty. When the
32934 expansion of <option>data</option> results in an empty string, the router declines. A forced
32935 expansion failure also causes the router to decline; other expansion failures
32936 cause delivery to be deferred.
32937 </para>
32938 <para>
32939 A configuration using <option>file</option> is commonly used for handling users&#x2019;
32940 <filename>.forward</filename> files, like this:
32941 </para>
32942 <literallayout class="monospaced">
32943 userforward:
32944   driver = redirect
32945   check_local_user
32946   file = $home/.forward
32947   no_verify
32948 </literallayout>
32949 <para>
32950 If the file does not exist, or causes no action to be taken (for example, it is
32951 empty or consists only of comments), the router declines. <emphasis role="bold">Warning</emphasis>: This
32952 is not the case when the file contains syntactically valid items that happen to
32953 yield empty addresses, for example, items containing only RFC 2822 address
32954 comments.
32955 </para>
32956 </section>
32957 <section id="SECID125">
32958 <title>Forward files and address verification</title>
32959 <para>
32960 <indexterm role="concept">
32961 <primary>address redirection</primary>
32962 <secondary>while verifying</secondary>
32963 </indexterm>
32964 It is usual to set <option>no_verify</option> on <command>redirect</command> routers which handle users&#x2019;
32965 <filename>.forward</filename> files, as in the example above. There are two reasons for this:
32966 </para>
32967 <itemizedlist>
32968 <listitem>
32969 <para>
32970 When Exim is receiving an incoming SMTP message from a remote host, it is
32971 running under the Exim uid, not as root. Exim is unable to change uid to read
32972 the file as the user, and it may not be able to read it as the Exim user. So in
32973 practice the router may not be able to operate.
32974 </para>
32975 </listitem>
32976 <listitem>
32977 <para>
32978 However, even when the router can operate, the existence of a <filename>.forward</filename> file
32979 is unimportant when verifying an address. What should be checked is whether the
32980 local part is a valid user name or not. Cutting out the redirection processing
32981 saves some resources.
32982 </para>
32983 </listitem>
32984 </itemizedlist>
32985 </section>
32986 <section id="SECID126">
32987 <title>Interpreting redirection data</title>
32988 <para>
32989 <indexterm role="concept">
32990 <primary>Sieve filter</primary>
32991 <secondary>specifying in redirection data</secondary>
32992 </indexterm>
32993 <indexterm role="concept">
32994 <primary>filter</primary>
32995 <secondary>specifying in redirection data</secondary>
32996 </indexterm>
32997 The contents of the data string, whether obtained from <option>data</option> or <option>file</option>,
32998 can be interpreted in two different ways:
32999 </para>
33000 <itemizedlist>
33001 <listitem>
33002 <para>
33003 If the <option>allow_filter</option> option is set true, and the data begins with the text
33004 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote>, it is interpreted as a list of
33005 <emphasis>filtering</emphasis> instructions in the form of an Exim or Sieve filter file,
33006 respectively. Details of the syntax and semantics of filter files are described
33007 in a separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>; this
33008 document is intended for use by end users.
33009 </para>
33010 </listitem>
33011 <listitem>
33012 <para>
33013 Otherwise, the data must be a comma-separated list of redirection items, as
33014 described in the next section.
33015 </para>
33016 </listitem>
33017 </itemizedlist>
33018 <para>
33019 When a message is redirected to a file (a <quote>mail folder</quote>), the file name given
33020 in a non-filter redirection list must always be an absolute path. A filter may
33021 generate a relative path &ndash; how this is handled depends on the transport&#x2019;s
33022 configuration. See section <xref linkend="SECTfildiropt"/> for a discussion of this issue
33023 for the <command>appendfile</command> transport.
33024 </para>
33025 </section>
33026 <section id="SECTitenonfilred">
33027 <title>Items in a non-filter redirection list</title>
33028 <para>
33029 <indexterm role="concept">
33030 <primary>address redirection</primary>
33031 <secondary>non-filter list items</secondary>
33032 </indexterm>
33033 When the redirection data is not an Exim or Sieve filter, for example, if it
33034 comes from a conventional alias or forward file, it consists of a list of
33035 addresses, file names, pipe commands, or certain special items (see section
33036 <xref linkend="SECTspecitredli"/> below). The special items can be individually enabled or
33037 disabled by means of options whose names begin with <option>allow_</option> or <option>forbid_</option>,
33038 depending on their default values. The items in the list are separated by
33039 commas or newlines.
33040 If a comma is required in an item, the entire item must be enclosed in double
33041 quotes.
33042 </para>
33043 <para>
33044 Lines starting with a # character are comments, and are ignored, and # may
33045 also appear following a comma, in which case everything between the # and the
33046 next newline character is ignored.
33047 </para>
33048 <para>
33049 If an item is entirely enclosed in double quotes, these are removed. Otherwise
33050 double quotes are retained because some forms of mail address require their use
33051 (but never to enclose the entire address). In the following description,
33052 <quote>item</quote> refers to what remains after any surrounding double quotes have been
33053 removed.
33054 </para>
33055 <para>
33056 <indexterm role="variable">
33057 <primary><varname>$local_part</varname></primary>
33058 </indexterm>
33059 <emphasis role="bold">Warning</emphasis>: If you use an Exim expansion to construct a redirection address,
33060 and the expansion contains a reference to <varname>$local_part</varname>, you should make use
33061 of the <option>quote_local_part</option> expansion operator, in case the local part contains
33062 special characters. For example, to redirect all mail for the domain
33063 <emphasis>obsolete.example</emphasis>, retaining the existing local part, you could use this
33064 setting:
33065 </para>
33066 <literallayout class="monospaced">
33067 data = ${quote_local_part:$local_part}@newdomain.example
33068 </literallayout>
33069 </section>
33070 <section id="SECTredlocmai">
33071 <title>Redirecting to a local mailbox</title>
33072 <para>
33073 <indexterm role="concept">
33074 <primary>routing</primary>
33075 <secondary>loops in</secondary>
33076 </indexterm>
33077 <indexterm role="concept">
33078 <primary>loop</primary>
33079 <secondary>while routing, avoidance of</secondary>
33080 </indexterm>
33081 <indexterm role="concept">
33082 <primary>address redirection</primary>
33083 <secondary>to local mailbox</secondary>
33084 </indexterm>
33085 A redirection item may safely be the same as the address currently under
33086 consideration. This does not cause a routing loop, because a router is
33087 automatically skipped if any ancestor of the address that is being processed
33088 is the same as the current address and was processed by the current router.
33089 Such an address is therefore passed to the following routers, so it is handled
33090 as if there were no redirection. When making this loop-avoidance test, the
33091 complete local part, including any prefix or suffix, is used.
33092 </para>
33093 <para>
33094 <indexterm role="concept">
33095 <primary>address redirection</primary>
33096 <secondary>local part without domain</secondary>
33097 </indexterm>
33098 Specifying the same local part without a domain is a common usage in personal
33099 filter files when the user wants to have messages delivered to the local
33100 mailbox and also forwarded elsewhere. For example, the user whose login is
33101 <emphasis>cleo</emphasis> might have a <filename>.forward</filename> file containing this:
33102 </para>
33103 <literallayout class="monospaced">
33104 cleo, cleopatra@egypt.example
33105 </literallayout>
33106 <para>
33107 <indexterm role="concept">
33108 <primary>backslash in alias file</primary>
33109 </indexterm>
33110 <indexterm role="concept">
33111 <primary>alias file</primary>
33112 <secondary>backslash in</secondary>
33113 </indexterm>
33114 For compatibility with other MTAs, such unqualified local parts may be
33115 preceded by <quote>\</quote>, but this is not a requirement for loop prevention. However,
33116 it does make a difference if more than one domain is being handled
33117 synonymously.
33118 </para>
33119 <para>
33120 If an item begins with <quote>\</quote> and the rest of the item parses as a valid RFC
33121 2822 address that does not include a domain, the item is qualified using the
33122 domain of the incoming address. In the absence of a leading <quote>\</quote>, unqualified
33123 addresses are qualified using the value in <option>qualify_recipient</option>, but you can
33124 force the incoming domain to be used by setting <option>qualify_preserve_domain</option>.
33125 </para>
33126 <para>
33127 Care must be taken if there are alias names for local users.
33128 Consider an MTA handling a single local domain where the system alias file
33129 contains:
33130 </para>
33131 <literallayout class="monospaced">
33132 Sam.Reman: spqr
33133 </literallayout>
33134 <para>
33135 Now suppose that Sam (whose login id is <emphasis>spqr</emphasis>) wants to save copies of
33136 messages in the local mailbox, and also forward copies elsewhere. He creates
33137 this forward file:
33138 </para>
33139 <literallayout class="monospaced">
33140 Sam.Reman, spqr@reme.elsewhere.example
33141 </literallayout>
33142 <para>
33143 With these settings, an incoming message addressed to <emphasis>Sam.Reman</emphasis> fails. The
33144 <command>redirect</command> router for system aliases does not process <emphasis>Sam.Reman</emphasis> the
33145 second time round, because it has previously routed it,
33146 and the following routers presumably cannot handle the alias. The forward file
33147 should really contain
33148 </para>
33149 <literallayout class="monospaced">
33150 spqr, spqr@reme.elsewhere.example
33151 </literallayout>
33152 <para>
33153 but because this is such a common error, the <option>check_ancestor</option> option (see
33154 below) exists to provide a way to get round it. This is normally set on a
33155 <command>redirect</command> router that is handling users&#x2019; <filename>.forward</filename> files.
33156 </para>
33157 </section>
33158 <section id="SECTspecitredli">
33159 <title>Special items in redirection lists</title>
33160 <para>
33161 In addition to addresses, the following types of item may appear in redirection
33162 lists (that is, in non-filter redirection data):
33163 </para>
33164 <itemizedlist>
33165 <listitem>
33166 <para>
33167 <indexterm role="concept">
33168 <primary>pipe</primary>
33169 <secondary>in redirection list</secondary>
33170 </indexterm>
33171 <indexterm role="concept">
33172 <primary>address redirection</primary>
33173 <secondary>to pipe</secondary>
33174 </indexterm>
33175 An item is treated as a pipe command if it begins with <quote>|</quote> and does not parse
33176 as a valid RFC 2822 address that includes a domain. A transport for running the
33177 command must be specified by the <option>pipe_transport</option> option.
33178 Normally, either the router or the transport specifies a user and a group under
33179 which to run the delivery. The default is to use the Exim user and group.
33180 </para>
33181 <para>
33182 Single or double quotes can be used for enclosing the individual arguments of
33183 the pipe command; no interpretation of escapes is done for single quotes. If
33184 the command contains a comma character, it is necessary to put the whole item
33185 in double quotes, for example:
33186 </para>
33187 <literallayout class="monospaced">
33188 "|/some/command ready,steady,go"
33189 </literallayout>
33190 <para>
33191 since items in redirection lists are terminated by commas. Do not, however,
33192 quote just the command. An item such as
33193 </para>
33194 <literallayout class="monospaced">
33195 |"/some/command ready,steady,go"
33196 </literallayout>
33197 <para>
33198 is interpreted as a pipe with a rather strange command name, and no arguments.
33199 </para>
33200 </listitem>
33201 <listitem>
33202 <para>
33203 <indexterm role="concept">
33204 <primary>file</primary>
33205 <secondary>in redirection list</secondary>
33206 </indexterm>
33207 <indexterm role="concept">
33208 <primary>address redirection</primary>
33209 <secondary>to file</secondary>
33210 </indexterm>
33211 An item is interpreted as a path name if it begins with <quote>/</quote> and does not
33212 parse as a valid RFC 2822 address that includes a domain. For example,
33213 </para>
33214 <literallayout class="monospaced">
33215 /home/world/minbari
33216 </literallayout>
33217 <para>
33218 is treated as a file name, but
33219 </para>
33220 <literallayout class="monospaced">
33221 /s=molari/o=babylon/@x400gate.way
33222 </literallayout>
33223 <para>
33224 is treated as an address. For a file name, a transport must be specified using
33225 the <option>file_transport</option> option. However, if the generated path name ends with a
33226 forward slash character, it is interpreted as a directory name rather than a
33227 file name, and <option>directory_transport</option> is used instead.
33228 </para>
33229 <para>
33230 Normally, either the router or the transport specifies a user and a group under
33231 which to run the delivery. The default is to use the Exim user and group.
33232 </para>
33233 <para>
33234 <indexterm role="concept">
33235 <primary><filename>/dev/null</filename></primary>
33236 </indexterm>
33237 However, if a redirection item is the path <filename>/dev/null</filename>, delivery to it is
33238 bypassed at a high level, and the log entry shows <quote>**bypassed**</quote>
33239 instead of a transport name. In this case the user and group are not used.
33240 </para>
33241 </listitem>
33242 <listitem>
33243 <para>
33244 <indexterm role="concept">
33245 <primary>included address list</primary>
33246 </indexterm>
33247 <indexterm role="concept">
33248 <primary>address redirection</primary>
33249 <secondary>included external list</secondary>
33250 </indexterm>
33251 If an item is of the form
33252 </para>
33253 <literallayout class="monospaced">
33254 :include:&lt;path name&gt;
33255 </literallayout>
33256 <para>
33257 a list of further items is taken from the given file and included at that
33258 point. <emphasis role="bold">Note</emphasis>: Such a file can not be a filter file; it is just an
33259 out-of-line addition to the list. The items in the included list are separated
33260 by commas or newlines and are not subject to expansion. If this is the first
33261 item in an alias list in an <command>lsearch</command> file, a colon must be used to terminate
33262 the alias name. This example is incorrect:
33263 </para>
33264 <literallayout class="monospaced">
33265 list1    :include:/opt/lists/list1
33266 </literallayout>
33267 <para>
33268 It must be given as
33269 </para>
33270 <literallayout class="monospaced">
33271 list1:   :include:/opt/lists/list1
33272 </literallayout>
33273 </listitem>
33274 <listitem>
33275 <para>
33276 <indexterm role="concept">
33277 <primary>address redirection</primary>
33278 <secondary>to black hole</secondary>
33279 </indexterm>
33280 Sometimes you want to throw away mail to a particular local part. Making the
33281 <option>data</option> option expand to an empty string does not work, because that causes
33282 the router to decline. Instead, the alias item
33283 <indexterm role="concept">
33284 <primary>black hole</primary>
33285 </indexterm>
33286 <indexterm role="concept">
33287 <primary>abandoning mail</primary>
33288 </indexterm>
33289 <emphasis>:blackhole:</emphasis> can be used. It does what its name implies. No delivery is
33290 done, and no error message is generated. This has the same effect as specifing
33291 <filename>/dev/null</filename> as a destination, but it can be independently disabled.
33292 </para>
33293 <para>
33294 <emphasis role="bold">Warning</emphasis>: If <emphasis>:blackhole:</emphasis> appears anywhere in a redirection list, no
33295 delivery is done for the original local part, even if other redirection items
33296 are present. If you are generating a multi-item list (for example, by reading a
33297 database) and need the ability to provide a no-op item, you must use
33298 <filename>/dev/null</filename>.
33299 </para>
33300 </listitem>
33301 <listitem>
33302 <para>
33303 <indexterm role="concept">
33304 <primary>delivery</primary>
33305 <secondary>forcing failure</secondary>
33306 </indexterm>
33307 <indexterm role="concept">
33308 <primary>delivery</primary>
33309 <secondary>forcing deferral</secondary>
33310 </indexterm>
33311 <indexterm role="concept">
33312 <primary>failing delivery</primary>
33313 <secondary>forcing</secondary>
33314 </indexterm>
33315 <indexterm role="concept">
33316 <primary>deferred delivery, forcing</primary>
33317 </indexterm>
33318 <indexterm role="concept">
33319 <primary>customizing</primary>
33320 <secondary>failure message</secondary>
33321 </indexterm>
33322 An attempt to deliver a particular address can be deferred or forced to fail by
33323 redirection items of the form
33324 </para>
33325 <literallayout class="monospaced">
33326 :defer:
33327 :fail:
33328 </literallayout>
33329 <para>
33330 respectively. When a redirection list contains such an item, it applies
33331 to the entire redirection; any other items in the list are ignored. Any
33332 text following <emphasis>:fail:</emphasis> or <emphasis>:defer:</emphasis> is placed in the error text
33333 associated with the failure. For example, an alias file might contain:
33334 </para>
33335 <literallayout class="monospaced">
33336 X.Employee:  :fail: Gone away, no forwarding address
33337 </literallayout>
33338 <para>
33339 In the case of an address that is being verified from an ACL or as the subject
33340 of a
33341 <indexterm role="concept">
33342 <primary>VRFY</primary>
33343 <secondary>error text, display of</secondary>
33344 </indexterm>
33345 VRFY command, the text is included in the SMTP error response by
33346 default.
33347 <indexterm role="concept">
33348 <primary>EXPN</primary>
33349 <secondary>error text, display of</secondary>
33350 </indexterm>
33351 The text is not included in the response to an EXPN command. In non-SMTP cases
33352 the text is included in the error message that Exim generates.
33353 </para>
33354 <para>
33355 <indexterm role="concept">
33356 <primary>SMTP</primary>
33357 <secondary>error codes</secondary>
33358 </indexterm>
33359 By default, Exim sends a 451 SMTP code for a <emphasis>:defer:</emphasis>, and 550 for
33360 <emphasis>:fail:</emphasis>. However, if the message starts with three digits followed by a
33361 space, optionally followed by an extended code of the form <emphasis>n.n.n</emphasis>, also
33362 followed by a space, and the very first digit is the same as the default error
33363 code, the code from the message is used instead. If the very first digit is
33364 incorrect, a panic error is logged, and the default code is used. You can
33365 suppress the use of the supplied code in a redirect router by setting the
33366 <option>forbid_smtp_code</option> option true. In this case, any SMTP code is quietly
33367 ignored.
33368 </para>
33369 <para>
33370 <indexterm role="variable">
33371 <primary><varname>$acl_verify_message</varname></primary>
33372 </indexterm>
33373 In an ACL, an explicitly provided message overrides the default, but the
33374 default message is available in the variable <varname>$acl_verify_message</varname> and can
33375 therefore be included in a custom message if this is desired.
33376 </para>
33377 <para>
33378 Normally the error text is the rest of the redirection list &ndash; a comma does
33379 not terminate it &ndash; but a newline does act as a terminator. Newlines are not
33380 normally present in alias expansions. In <command>lsearch</command> lookups they are removed
33381 as part of the continuation process, but they may exist in other kinds of
33382 lookup and in <emphasis>:include:</emphasis> files.
33383 </para>
33384 <para>
33385 During routing for message delivery (as opposed to verification), a redirection
33386 containing <emphasis>:fail:</emphasis> causes an immediate failure of the incoming address,
33387 whereas <emphasis>:defer:</emphasis> causes the message to remain on the queue so that a
33388 subsequent delivery attempt can happen at a later time. If an address is
33389 deferred for too long, it will ultimately fail, because the normal retry
33390 rules still apply.
33391 </para>
33392 </listitem>
33393 <listitem>
33394 <para>
33395 <indexterm role="concept">
33396 <primary>alias file</primary>
33397 <secondary>exception to default</secondary>
33398 </indexterm>
33399 Sometimes it is useful to use a single-key search type with a default (see
33400 chapter <xref linkend="CHAPfdlookup"/>) to look up aliases. However, there may be a need
33401 for exceptions to the default. These can be handled by aliasing them to
33402 <emphasis>:unknown:</emphasis>. This differs from <emphasis>:fail:</emphasis> in that it causes the <command>redirect</command>
33403 router to decline, whereas <emphasis>:fail:</emphasis> forces routing to fail. A lookup which
33404 results in an empty redirection list has the same effect.
33405 </para>
33406 </listitem>
33407 </itemizedlist>
33408 </section>
33409 <section id="SECTdupaddr">
33410 <title>Duplicate addresses</title>
33411 <para>
33412 <indexterm role="concept">
33413 <primary>duplicate addresses</primary>
33414 </indexterm>
33415 <indexterm role="concept">
33416 <primary>address duplicate, discarding</primary>
33417 </indexterm>
33418 <indexterm role="concept">
33419 <primary>pipe</primary>
33420 <secondary>duplicated</secondary>
33421 </indexterm>
33422 Exim removes duplicate addresses from the list to which it is delivering, so as
33423 to deliver just one copy to each address. This does not apply to deliveries
33424 routed to pipes by different immediate parent addresses, but an indirect
33425 aliasing scheme of the type
33426 </para>
33427 <literallayout class="monospaced">
33428 pipe:       |/some/command $local_part
33429 localpart1: pipe
33430 localpart2: pipe
33431 </literallayout>
33432 <para>
33433 does not work with a message that is addressed to both local parts, because
33434 when the second is aliased to the intermediate local part <quote>pipe</quote> it gets
33435 discarded as being the same as a previously handled address. However, a scheme
33436 such as
33437 </para>
33438 <literallayout class="monospaced">
33439 localpart1: |/some/command $local_part
33440 localpart2: |/some/command $local_part
33441 </literallayout>
33442 <para>
33443 does result in two different pipe deliveries, because the immediate parents of
33444 the pipes are distinct.
33445 </para>
33446 </section>
33447 <section id="SECID128">
33448 <title>Repeated redirection expansion</title>
33449 <para>
33450 <indexterm role="concept">
33451 <primary>repeated redirection expansion</primary>
33452 </indexterm>
33453 <indexterm role="concept">
33454 <primary>address redirection</primary>
33455 <secondary>repeated for each delivery attempt</secondary>
33456 </indexterm>
33457 When a message cannot be delivered to all of its recipients immediately,
33458 leading to two or more delivery attempts, redirection expansion is carried out
33459 afresh each time for those addresses whose children were not all previously
33460 delivered. If redirection is being used as a mailing list, this can lead to new
33461 members of the list receiving copies of old messages. The <option>one_time</option> option
33462 can be used to avoid this.
33463 </para>
33464 </section>
33465 <section id="SECID129">
33466 <title>Errors in redirection lists</title>
33467 <para>
33468 <indexterm role="concept">
33469 <primary>address redirection</primary>
33470 <secondary>errors</secondary>
33471 </indexterm>
33472 If <option>skip_syntax_errors</option> is set, a malformed address that causes a parsing
33473 error is skipped, and an entry is written to the main log. This may be useful
33474 for mailing lists that are automatically managed. Otherwise, if an error is
33475 detected while generating the list of new addresses, the original address is
33476 deferred. See also <option>syntax_errors_to</option>.
33477 </para>
33478 </section>
33479 <section id="SECID130">
33480 <title>Private options for the redirect router</title>
33481 <para>
33482 <indexterm role="concept">
33483 <primary>options</primary>
33484 <secondary><command>redirect</command> router</secondary>
33485 </indexterm>
33486 The private options for the <command>redirect</command> router are as follows:
33487 </para>
33488 <para>
33489 <indexterm role="option">
33490 <primary><option>allow_defer</option></primary>
33491 </indexterm>
33492 </para>
33493 <informaltable frame="all">
33494 <tgroup cols="4" colsep="0" rowsep="0">
33495 <colspec colwidth="8*" align="left"/>
33496 <colspec colwidth="6*" align="center"/>
33497 <colspec colwidth="6*" align="center"/>
33498 <colspec colwidth="6*" align="right"/>
33499 <tbody>
33500 <row>
33501 <entry><option>allow_defer</option></entry>
33502 <entry>Use: <emphasis>redirect</emphasis></entry>
33503 <entry>Type: <emphasis>boolean</emphasis></entry>
33504 <entry>Default: <emphasis>false</emphasis></entry>
33505 </row>
33506 </tbody>
33507 </tgroup>
33508 </informaltable>
33509 <para>
33510 Setting this option allows the use of <emphasis>:defer:</emphasis> in non-filter redirection
33511 data, or the <option>defer</option> command in an Exim filter file.
33512 </para>
33513 <para>
33514 <indexterm role="option">
33515 <primary><option>allow_fail</option></primary>
33516 </indexterm>
33517 </para>
33518 <informaltable frame="all">
33519 <tgroup cols="4" colsep="0" rowsep="0">
33520 <colspec colwidth="8*" align="left"/>
33521 <colspec colwidth="6*" align="center"/>
33522 <colspec colwidth="6*" align="center"/>
33523 <colspec colwidth="6*" align="right"/>
33524 <tbody>
33525 <row>
33526 <entry><option>allow_fail</option></entry>
33527 <entry>Use: <emphasis>redirect</emphasis></entry>
33528 <entry>Type: <emphasis>boolean</emphasis></entry>
33529 <entry>Default: <emphasis>false</emphasis></entry>
33530 </row>
33531 </tbody>
33532 </tgroup>
33533 </informaltable>
33534 <para>
33535 <indexterm role="concept">
33536 <primary>failing delivery</primary>
33537 <secondary>from filter</secondary>
33538 </indexterm>
33539 If this option is true, the <emphasis>:fail:</emphasis> item can be used in a redirection list,
33540 and the <option>fail</option> command may be used in an Exim filter file.
33541 </para>
33542 <para>
33543 <indexterm role="option">
33544 <primary><option>allow_filter</option></primary>
33545 </indexterm>
33546 </para>
33547 <informaltable frame="all">
33548 <tgroup cols="4" colsep="0" rowsep="0">
33549 <colspec colwidth="8*" align="left"/>
33550 <colspec colwidth="6*" align="center"/>
33551 <colspec colwidth="6*" align="center"/>
33552 <colspec colwidth="6*" align="right"/>
33553 <tbody>
33554 <row>
33555 <entry><option>allow_filter</option></entry>
33556 <entry>Use: <emphasis>redirect</emphasis></entry>
33557 <entry>Type: <emphasis>boolean</emphasis></entry>
33558 <entry>Default: <emphasis>false</emphasis></entry>
33559 </row>
33560 </tbody>
33561 </tgroup>
33562 </informaltable>
33563 <para>
33564 <indexterm role="concept">
33565 <primary>filter</primary>
33566 <secondary>enabling use of</secondary>
33567 </indexterm>
33568 <indexterm role="concept">
33569 <primary>Sieve filter</primary>
33570 <secondary>enabling use of</secondary>
33571 </indexterm>
33572 Setting this option allows Exim to interpret redirection data that starts with
33573 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote> as a set of filtering instructions. There
33574 are some features of Exim filter files that some administrators may wish to
33575 lock out; see the <option>forbid_filter_</option><emphasis>xxx</emphasis> options below.
33576 </para>
33577 <para>
33578 It is also possible to lock out Exim filters or Sieve filters while allowing
33579 the other type; see <option>forbid_exim_filter</option> and <option>forbid_sieve_filter</option>.
33580 </para>
33581 <para>
33582 The filter is run using the uid and gid set by the generic <option>user</option> and
33583 <option>group</option> options. These take their defaults from the password data if
33584 <option>check_local_user</option> is set, so in the normal case of users&#x2019; personal filter
33585 files, the filter is run as the relevant user. When <option>allow_filter</option> is set
33586 true, Exim insists that either <option>check_local_user</option> or <option>user</option> is set.
33587 </para>
33588 <para>
33589 <indexterm role="option">
33590 <primary><option>allow_freeze</option></primary>
33591 </indexterm>
33592 </para>
33593 <informaltable frame="all">
33594 <tgroup cols="4" colsep="0" rowsep="0">
33595 <colspec colwidth="8*" align="left"/>
33596 <colspec colwidth="6*" align="center"/>
33597 <colspec colwidth="6*" align="center"/>
33598 <colspec colwidth="6*" align="right"/>
33599 <tbody>
33600 <row>
33601 <entry><option>allow_freeze</option></entry>
33602 <entry>Use: <emphasis>redirect</emphasis></entry>
33603 <entry>Type: <emphasis>boolean</emphasis></entry>
33604 <entry>Default: <emphasis>false</emphasis></entry>
33605 </row>
33606 </tbody>
33607 </tgroup>
33608 </informaltable>
33609 <para>
33610 <indexterm role="concept">
33611 <primary>freezing messages</primary>
33612 <secondary>allowing in filter</secondary>
33613 </indexterm>
33614 Setting this option allows the use of the <option>freeze</option> command in an Exim filter.
33615 This command is more normally encountered in system filters, and is disabled by
33616 default for redirection filters because it isn&#x2019;t something you usually want to
33617 let ordinary users do.
33618 </para>
33619 <para>
33620 <indexterm role="option">
33621 <primary><option>check_ancestor</option></primary>
33622 </indexterm>
33623 </para>
33624 <informaltable frame="all">
33625 <tgroup cols="4" colsep="0" rowsep="0">
33626 <colspec colwidth="8*" align="left"/>
33627 <colspec colwidth="6*" align="center"/>
33628 <colspec colwidth="6*" align="center"/>
33629 <colspec colwidth="6*" align="right"/>
33630 <tbody>
33631 <row>
33632 <entry><option>check_ancestor</option></entry>
33633 <entry>Use: <emphasis>redirect</emphasis></entry>
33634 <entry>Type: <emphasis>boolean</emphasis></entry>
33635 <entry>Default: <emphasis>false</emphasis></entry>
33636 </row>
33637 </tbody>
33638 </tgroup>
33639 </informaltable>
33640 <para>
33641 This option is concerned with handling generated addresses that are the same
33642 as some address in the list of redirection ancestors of the current address.
33643 Although it is turned off by default in the code, it is set in the default
33644 configuration file for handling users&#x2019; <filename>.forward</filename> files. It is recommended
33645 for this use of the <command>redirect</command> router.
33646 </para>
33647 <para>
33648 When <option>check_ancestor</option> is set, if a generated address (including the domain)
33649 is the same as any ancestor of the current address, it is replaced by a copy of
33650 the current address. This helps in the case where local part A is aliased to B,
33651 and B has a <filename>.forward</filename> file pointing back to A. For example, within a single
33652 domain, the local part <quote>Joe.Bloggs</quote> is aliased to <quote>jb</quote> and
33653 <filename>&nbsp;jb/.forward</filename> contains:
33654 </para>
33655 <literallayout class="monospaced">
33656 \Joe.Bloggs, &lt;other item(s)&gt;
33657 </literallayout>
33658 <para>
33659 Without the <option>check_ancestor</option> setting, either local part (<quote>jb</quote> or
33660 <quote>joe.bloggs</quote>) gets processed once by each router and so ends up as it was
33661 originally. If <quote>jb</quote> is the real mailbox name, mail to <quote>jb</quote> gets delivered
33662 (having been turned into <quote>joe.bloggs</quote> by the <filename>.forward</filename> file and back to
33663 <quote>jb</quote> by the alias), but mail to <quote>joe.bloggs</quote> fails. Setting
33664 <option>check_ancestor</option> on the <command>redirect</command> router that handles the <filename>.forward</filename>
33665 file prevents it from turning <quote>jb</quote> back into <quote>joe.bloggs</quote> when that was the
33666 original address. See also the <option>repeat_use</option> option below.
33667 </para>
33668 <para>
33669 <indexterm role="option">
33670 <primary><option>check_group</option></primary>
33671 </indexterm>
33672 </para>
33673 <informaltable frame="all">
33674 <tgroup cols="4" colsep="0" rowsep="0">
33675 <colspec colwidth="8*" align="left"/>
33676 <colspec colwidth="6*" align="center"/>
33677 <colspec colwidth="6*" align="center"/>
33678 <colspec colwidth="6*" align="right"/>
33679 <tbody>
33680 <row>
33681 <entry><option>check_group</option></entry>
33682 <entry>Use: <emphasis>redirect</emphasis></entry>
33683 <entry>Type: <emphasis>boolean</emphasis></entry>
33684 <entry>Default: <emphasis>see below</emphasis></entry>
33685 </row>
33686 </tbody>
33687 </tgroup>
33688 </informaltable>
33689 <para>
33690 When the <option>file</option> option is used, the group owner of the file is checked only
33691 when this option is set. The permitted groups are those listed in the
33692 <option>owngroups</option> option, together with the user&#x2019;s default group if
33693 <option>check_local_user</option> is set. If the file has the wrong group, routing is
33694 deferred. The default setting for this option is true if <option>check_local_user</option>
33695 is set and the <option>modemask</option> option permits the group write bit, or if the
33696 <option>owngroups</option> option is set. Otherwise it is false, and no group check occurs.
33697 </para>
33698 <para>
33699 <indexterm role="option">
33700 <primary><option>check_owner</option></primary>
33701 </indexterm>
33702 </para>
33703 <informaltable frame="all">
33704 <tgroup cols="4" colsep="0" rowsep="0">
33705 <colspec colwidth="8*" align="left"/>
33706 <colspec colwidth="6*" align="center"/>
33707 <colspec colwidth="6*" align="center"/>
33708 <colspec colwidth="6*" align="right"/>
33709 <tbody>
33710 <row>
33711 <entry><option>check_owner</option></entry>
33712 <entry>Use: <emphasis>redirect</emphasis></entry>
33713 <entry>Type: <emphasis>boolean</emphasis></entry>
33714 <entry>Default: <emphasis>see below</emphasis></entry>
33715 </row>
33716 </tbody>
33717 </tgroup>
33718 </informaltable>
33719 <para>
33720 When the <option>file</option> option is used, the owner of the file is checked only when
33721 this option is set. If <option>check_local_user</option> is set, the local user is
33722 permitted; otherwise the owner must be one of those listed in the <option>owners</option>
33723 option. The default value for this option is true if <option>check_local_user</option> or
33724 <option>owners</option> is set. Otherwise the default is false, and no owner check occurs.
33725 </para>
33726 <para>
33727 <indexterm role="option">
33728 <primary><option>data</option></primary>
33729 </indexterm>
33730 </para>
33731 <informaltable frame="all">
33732 <tgroup cols="4" colsep="0" rowsep="0">
33733 <colspec colwidth="8*" align="left"/>
33734 <colspec colwidth="6*" align="center"/>
33735 <colspec colwidth="6*" align="center"/>
33736 <colspec colwidth="6*" align="right"/>
33737 <tbody>
33738 <row>
33739 <entry><option>data</option></entry>
33740 <entry>Use: <emphasis>redirect</emphasis></entry>
33741 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33742 <entry>Default: <emphasis>unset</emphasis></entry>
33743 </row>
33744 </tbody>
33745 </tgroup>
33746 </informaltable>
33747 <para>
33748 This option is mutually exclusive with <option>file</option>. One or other of them must be
33749 set, but not both. The contents of <option>data</option> are expanded, and then used as the
33750 list of forwarding items, or as a set of filtering instructions. If the
33751 expansion is forced to fail, or the result is an empty string or a string that
33752 has no effect (consists entirely of comments), the router declines.
33753 </para>
33754 <para>
33755 When filtering instructions are used, the string must begin with <quote>#Exim
33756 filter</quote>, and all comments in the string, including this initial one, must be
33757 terminated with newline characters. For example:
33758 </para>
33759 <literallayout class="monospaced">
33760 data = #Exim filter\n\
33761        if $h_to: contains Exim then save $home/mail/exim endif
33762 </literallayout>
33763 <para>
33764 If you are reading the data from a database where newlines cannot be included,
33765 you can use the <varname>${sg}</varname> expansion item to turn the escape string of your
33766 choice into a newline.
33767 </para>
33768 <para>
33769 <indexterm role="option">
33770 <primary><option>directory_transport</option></primary>
33771 </indexterm>
33772 </para>
33773 <informaltable frame="all">
33774 <tgroup cols="4" colsep="0" rowsep="0">
33775 <colspec colwidth="8*" align="left"/>
33776 <colspec colwidth="6*" align="center"/>
33777 <colspec colwidth="6*" align="center"/>
33778 <colspec colwidth="6*" align="right"/>
33779 <tbody>
33780 <row>
33781 <entry><option>directory_transport</option></entry>
33782 <entry>Use: <emphasis>redirect</emphasis></entry>
33783 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33784 <entry>Default: <emphasis>unset</emphasis></entry>
33785 </row>
33786 </tbody>
33787 </tgroup>
33788 </informaltable>
33789 <para>
33790 A <command>redirect</command> router sets up a direct delivery to a directory when a path name
33791 ending with a slash is specified as a new <quote>address</quote>. The transport used is
33792 specified by this option, which, after expansion, must be the name of a
33793 configured transport. This should normally be an <command>appendfile</command> transport.
33794 </para>
33795 <para>
33796 <indexterm role="option">
33797 <primary><option>file</option></primary>
33798 </indexterm>
33799 </para>
33800 <informaltable frame="all">
33801 <tgroup cols="4" colsep="0" rowsep="0">
33802 <colspec colwidth="8*" align="left"/>
33803 <colspec colwidth="6*" align="center"/>
33804 <colspec colwidth="6*" align="center"/>
33805 <colspec colwidth="6*" align="right"/>
33806 <tbody>
33807 <row>
33808 <entry><option>file</option></entry>
33809 <entry>Use: <emphasis>redirect</emphasis></entry>
33810 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33811 <entry>Default: <emphasis>unset</emphasis></entry>
33812 </row>
33813 </tbody>
33814 </tgroup>
33815 </informaltable>
33816 <para>
33817 This option specifies the name of a file that contains the redirection data. It
33818 is mutually exclusive with the <option>data</option> option. The string is expanded before
33819 use; if the expansion is forced to fail, the router declines. Other expansion
33820 failures cause delivery to be deferred. The result of a successful expansion
33821 must be an absolute path. The entire file is read and used as the redirection
33822 data. If the data is an empty string or a string that has no effect (consists
33823 entirely of comments), the router declines.
33824 </para>
33825 <para>
33826 <indexterm role="concept">
33827 <primary>NFS</primary>
33828 <secondary>checking for file existence</secondary>
33829 </indexterm>
33830 If the attempt to open the file fails with a <quote>does not exist</quote> error, Exim
33831 runs a check on the containing directory,
33832 unless <option>ignore_enotdir</option> is true (see below).
33833 If the directory does not appear to exist, delivery is deferred. This can
33834 happen when users&#x2019; <filename>.forward</filename> files are in NFS-mounted directories, and there
33835 is a mount problem. If the containing directory does exist, but the file does
33836 not, the router declines.
33837 </para>
33838 <para>
33839 <indexterm role="option">
33840 <primary><option>file_transport</option></primary>
33841 </indexterm>
33842 </para>
33843 <informaltable frame="all">
33844 <tgroup cols="4" colsep="0" rowsep="0">
33845 <colspec colwidth="8*" align="left"/>
33846 <colspec colwidth="6*" align="center"/>
33847 <colspec colwidth="6*" align="center"/>
33848 <colspec colwidth="6*" align="right"/>
33849 <tbody>
33850 <row>
33851 <entry><option>file_transport</option></entry>
33852 <entry>Use: <emphasis>redirect</emphasis></entry>
33853 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33854 <entry>Default: <emphasis>unset</emphasis></entry>
33855 </row>
33856 </tbody>
33857 </tgroup>
33858 </informaltable>
33859 <para>
33860 <indexterm role="variable">
33861 <primary><varname>$address_file</varname></primary>
33862 </indexterm>
33863 A <command>redirect</command> router sets up a direct delivery to a file when a path name not
33864 ending in a slash is specified as a new <quote>address</quote>. The transport used is
33865 specified by this option, which, after expansion, must be the name of a
33866 configured transport. This should normally be an <command>appendfile</command> transport. When
33867 it is running, the file name is in <varname>$address_file</varname>.
33868 </para>
33869 <para>
33870 <indexterm role="option">
33871 <primary><option>filter_prepend_home</option></primary>
33872 </indexterm>
33873 </para>
33874 <informaltable frame="all">
33875 <tgroup cols="4" colsep="0" rowsep="0">
33876 <colspec colwidth="8*" align="left"/>
33877 <colspec colwidth="6*" align="center"/>
33878 <colspec colwidth="6*" align="center"/>
33879 <colspec colwidth="6*" align="right"/>
33880 <tbody>
33881 <row>
33882 <entry><option>filter_prepend_home</option></entry>
33883 <entry>Use: <emphasis>redirect</emphasis></entry>
33884 <entry>Type: <emphasis>boolean</emphasis></entry>
33885 <entry>Default: <emphasis>true</emphasis></entry>
33886 </row>
33887 </tbody>
33888 </tgroup>
33889 </informaltable>
33890 <para>
33891 When this option is true, if a <command>save</command> command in an Exim filter specifies a
33892 relative path, and <varname>$home</varname> is defined, it is automatically prepended to the
33893 relative path. If this option is set false, this action does not happen. The
33894 relative path is then passed to the transport unmodified.
33895 </para>
33896 <para>
33897 <indexterm role="option">
33898 <primary><option>forbid_blackhole</option></primary>
33899 </indexterm>
33900 </para>
33901 <informaltable frame="all">
33902 <tgroup cols="4" colsep="0" rowsep="0">
33903 <colspec colwidth="8*" align="left"/>
33904 <colspec colwidth="6*" align="center"/>
33905 <colspec colwidth="6*" align="center"/>
33906 <colspec colwidth="6*" align="right"/>
33907 <tbody>
33908 <row>
33909 <entry><option>forbid_blackhole</option></entry>
33910 <entry>Use: <emphasis>redirect</emphasis></entry>
33911 <entry>Type: <emphasis>boolean</emphasis></entry>
33912 <entry>Default: <emphasis>false</emphasis></entry>
33913 </row>
33914 </tbody>
33915 </tgroup>
33916 </informaltable>
33917 <para>
33918 If this option is true, the <emphasis>:blackhole:</emphasis> item may not appear in a
33919 redirection list.
33920 </para>
33921 <para>
33922 <indexterm role="option">
33923 <primary><option>forbid_exim_filter</option></primary>
33924 </indexterm>
33925 </para>
33926 <informaltable frame="all">
33927 <tgroup cols="4" colsep="0" rowsep="0">
33928 <colspec colwidth="8*" align="left"/>
33929 <colspec colwidth="6*" align="center"/>
33930 <colspec colwidth="6*" align="center"/>
33931 <colspec colwidth="6*" align="right"/>
33932 <tbody>
33933 <row>
33934 <entry><option>forbid_exim_filter</option></entry>
33935 <entry>Use: <emphasis>redirect</emphasis></entry>
33936 <entry>Type: <emphasis>boolean</emphasis></entry>
33937 <entry>Default: <emphasis>false</emphasis></entry>
33938 </row>
33939 </tbody>
33940 </tgroup>
33941 </informaltable>
33942 <para>
33943 If this option is set true, only Sieve filters are permitted when
33944 <option>allow_filter</option> is true.
33945 </para>
33946 <para>
33947 <indexterm role="option">
33948 <primary><option>forbid_file</option></primary>
33949 </indexterm>
33950 </para>
33951 <informaltable frame="all">
33952 <tgroup cols="4" colsep="0" rowsep="0">
33953 <colspec colwidth="8*" align="left"/>
33954 <colspec colwidth="6*" align="center"/>
33955 <colspec colwidth="6*" align="center"/>
33956 <colspec colwidth="6*" align="right"/>
33957 <tbody>
33958 <row>
33959 <entry><option>forbid_file</option></entry>
33960 <entry>Use: <emphasis>redirect</emphasis></entry>
33961 <entry>Type: <emphasis>boolean</emphasis></entry>
33962 <entry>Default: <emphasis>false</emphasis></entry>
33963 </row>
33964 </tbody>
33965 </tgroup>
33966 </informaltable>
33967 <para>
33968 <indexterm role="concept">
33969 <primary>delivery</primary>
33970 <secondary>to file; forbidding</secondary>
33971 </indexterm>
33972 <indexterm role="concept">
33973 <primary>Sieve filter</primary>
33974 <secondary>forbidding delivery to a file</secondary>
33975 </indexterm>
33976 <indexterm role="concept">
33977 <primary>Sieve filter</primary>
33978 <secondary><quote>keep</quote> facility; disabling</secondary>
33979 </indexterm>
33980 If this option is true, this router may not generate a new address that
33981 specifies delivery to a local file or directory, either from a filter or from a
33982 conventional forward file. This option is forced to be true if <option>one_time</option> is
33983 set. It applies to Sieve filters as well as to Exim filters, but if true, it
33984 locks out the Sieve&#x2019;s <quote>keep</quote> facility.
33985 </para>
33986 <para>
33987 <indexterm role="option">
33988 <primary><option>forbid_filter_dlfunc</option></primary>
33989 </indexterm>
33990 </para>
33991 <informaltable frame="all">
33992 <tgroup cols="4" colsep="0" rowsep="0">
33993 <colspec colwidth="8*" align="left"/>
33994 <colspec colwidth="6*" align="center"/>
33995 <colspec colwidth="6*" align="center"/>
33996 <colspec colwidth="6*" align="right"/>
33997 <tbody>
33998 <row>
33999 <entry><option>forbid_filter_dlfunc</option></entry>
34000 <entry>Use: <emphasis>redirect</emphasis></entry>
34001 <entry>Type: <emphasis>boolean</emphasis></entry>
34002 <entry>Default: <emphasis>false</emphasis></entry>
34003 </row>
34004 </tbody>
34005 </tgroup>
34006 </informaltable>
34007 <para>
34008 <indexterm role="concept">
34009 <primary>filter</primary>
34010 <secondary>locking out certain features</secondary>
34011 </indexterm>
34012 If this option is true, string expansions in Exim filters are not allowed to
34013 make use of the <option>dlfunc</option> expansion facility to run dynamically loaded
34014 functions.
34015 </para>
34016 <para>
34017 <indexterm role="option">
34018 <primary><option>forbid_filter_existstest</option></primary>
34019 </indexterm>
34020 </para>
34021 <informaltable frame="all">
34022 <tgroup cols="4" colsep="0" rowsep="0">
34023 <colspec colwidth="8*" align="left"/>
34024 <colspec colwidth="6*" align="center"/>
34025 <colspec colwidth="6*" align="center"/>
34026 <colspec colwidth="6*" align="right"/>
34027 <tbody>
34028 <row>
34029 <entry><option>forbid_filter_existstest</option></entry>
34030 <entry>Use: <emphasis>redirect</emphasis></entry>
34031 <entry>Type: <emphasis>boolean</emphasis></entry>
34032 <entry>Default: <emphasis>false</emphasis></entry>
34033 </row>
34034 </tbody>
34035 </tgroup>
34036 </informaltable>
34037 <para>
34038 <indexterm role="concept">
34039 <primary>expansion</primary>
34040 <secondary>statting a file</secondary>
34041 </indexterm>
34042 If this option is true, string expansions in Exim filters are not allowed to
34043 make use of the <option>exists</option> condition or the <option>stat</option> expansion item.
34044 </para>
34045 <para>
34046 <indexterm role="option">
34047 <primary><option>forbid_filter_logwrite</option></primary>
34048 </indexterm>
34049 </para>
34050 <informaltable frame="all">
34051 <tgroup cols="4" colsep="0" rowsep="0">
34052 <colspec colwidth="8*" align="left"/>
34053 <colspec colwidth="6*" align="center"/>
34054 <colspec colwidth="6*" align="center"/>
34055 <colspec colwidth="6*" align="right"/>
34056 <tbody>
34057 <row>
34058 <entry><option>forbid_filter_logwrite</option></entry>
34059 <entry>Use: <emphasis>redirect</emphasis></entry>
34060 <entry>Type: <emphasis>boolean</emphasis></entry>
34061 <entry>Default: <emphasis>false</emphasis></entry>
34062 </row>
34063 </tbody>
34064 </tgroup>
34065 </informaltable>
34066 <para>
34067 If this option is true, use of the logging facility in Exim filters is not
34068 permitted. Logging is in any case available only if the filter is being run
34069 under some unprivileged uid (which is normally the case for ordinary users&#x2019;
34070 <filename>.forward</filename> files).
34071 </para>
34072 <para>
34073 <indexterm role="option">
34074 <primary><option>forbid_filter_lookup</option></primary>
34075 </indexterm>
34076 </para>
34077 <informaltable frame="all">
34078 <tgroup cols="4" colsep="0" rowsep="0">
34079 <colspec colwidth="8*" align="left"/>
34080 <colspec colwidth="6*" align="center"/>
34081 <colspec colwidth="6*" align="center"/>
34082 <colspec colwidth="6*" align="right"/>
34083 <tbody>
34084 <row>
34085 <entry><option>forbid_filter_lookup</option></entry>
34086 <entry>Use: <emphasis>redirect</emphasis></entry>
34087 <entry>Type: <emphasis>boolean</emphasis></entry>
34088 <entry>Default: <emphasis>false</emphasis></entry>
34089 </row>
34090 </tbody>
34091 </tgroup>
34092 </informaltable>
34093 <para>
34094 If this option is true, string expansions in Exim filter files are not allowed
34095 to make use of <option>lookup</option> items.
34096 </para>
34097 <para>
34098 <indexterm role="option">
34099 <primary><option>forbid_filter_perl</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>forbid_filter_perl</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 This option has an effect only if Exim is built with embedded Perl support. If
34120 it is true, string expansions in Exim filter files are not allowed to make use
34121 of the embedded Perl support.
34122 </para>
34123 <para>
34124 <indexterm role="option">
34125 <primary><option>forbid_filter_readfile</option></primary>
34126 </indexterm>
34127 </para>
34128 <informaltable frame="all">
34129 <tgroup cols="4" colsep="0" rowsep="0">
34130 <colspec colwidth="8*" align="left"/>
34131 <colspec colwidth="6*" align="center"/>
34132 <colspec colwidth="6*" align="center"/>
34133 <colspec colwidth="6*" align="right"/>
34134 <tbody>
34135 <row>
34136 <entry><option>forbid_filter_readfile</option></entry>
34137 <entry>Use: <emphasis>redirect</emphasis></entry>
34138 <entry>Type: <emphasis>boolean</emphasis></entry>
34139 <entry>Default: <emphasis>false</emphasis></entry>
34140 </row>
34141 </tbody>
34142 </tgroup>
34143 </informaltable>
34144 <para>
34145 If this option is true, string expansions in Exim filter files are not allowed
34146 to make use of <option>readfile</option> items.
34147 </para>
34148 <para>
34149 <indexterm role="option">
34150 <primary><option>forbid_filter_readsocket</option></primary>
34151 </indexterm>
34152 </para>
34153 <informaltable frame="all">
34154 <tgroup cols="4" colsep="0" rowsep="0">
34155 <colspec colwidth="8*" align="left"/>
34156 <colspec colwidth="6*" align="center"/>
34157 <colspec colwidth="6*" align="center"/>
34158 <colspec colwidth="6*" align="right"/>
34159 <tbody>
34160 <row>
34161 <entry><option>forbid_filter_readsocket</option></entry>
34162 <entry>Use: <emphasis>redirect</emphasis></entry>
34163 <entry>Type: <emphasis>boolean</emphasis></entry>
34164 <entry>Default: <emphasis>false</emphasis></entry>
34165 </row>
34166 </tbody>
34167 </tgroup>
34168 </informaltable>
34169 <para>
34170 If this option is true, string expansions in Exim filter files are not allowed
34171 to make use of <option>readsocket</option> items.
34172 </para>
34173 <para>
34174 <indexterm role="option">
34175 <primary><option>forbid_filter_reply</option></primary>
34176 </indexterm>
34177 </para>
34178 <informaltable frame="all">
34179 <tgroup cols="4" colsep="0" rowsep="0">
34180 <colspec colwidth="8*" align="left"/>
34181 <colspec colwidth="6*" align="center"/>
34182 <colspec colwidth="6*" align="center"/>
34183 <colspec colwidth="6*" align="right"/>
34184 <tbody>
34185 <row>
34186 <entry><option>forbid_filter_reply</option></entry>
34187 <entry>Use: <emphasis>redirect</emphasis></entry>
34188 <entry>Type: <emphasis>boolean</emphasis></entry>
34189 <entry>Default: <emphasis>false</emphasis></entry>
34190 </row>
34191 </tbody>
34192 </tgroup>
34193 </informaltable>
34194 <para>
34195 If this option is true, this router may not generate an automatic reply
34196 message. Automatic replies can be generated only from Exim or Sieve filter
34197 files, not from traditional forward files. This option is forced to be true if
34198 <option>one_time</option> is set.
34199 </para>
34200 <para>
34201 <indexterm role="option">
34202 <primary><option>forbid_filter_run</option></primary>
34203 </indexterm>
34204 </para>
34205 <informaltable frame="all">
34206 <tgroup cols="4" colsep="0" rowsep="0">
34207 <colspec colwidth="8*" align="left"/>
34208 <colspec colwidth="6*" align="center"/>
34209 <colspec colwidth="6*" align="center"/>
34210 <colspec colwidth="6*" align="right"/>
34211 <tbody>
34212 <row>
34213 <entry><option>forbid_filter_run</option></entry>
34214 <entry>Use: <emphasis>redirect</emphasis></entry>
34215 <entry>Type: <emphasis>boolean</emphasis></entry>
34216 <entry>Default: <emphasis>false</emphasis></entry>
34217 </row>
34218 </tbody>
34219 </tgroup>
34220 </informaltable>
34221 <para>
34222 If this option is true, string expansions in Exim filter files are not allowed
34223 to make use of <option>run</option> items.
34224 </para>
34225 <para>
34226 <indexterm role="option">
34227 <primary><option>forbid_include</option></primary>
34228 </indexterm>
34229 </para>
34230 <informaltable frame="all">
34231 <tgroup cols="4" colsep="0" rowsep="0">
34232 <colspec colwidth="8*" align="left"/>
34233 <colspec colwidth="6*" align="center"/>
34234 <colspec colwidth="6*" align="center"/>
34235 <colspec colwidth="6*" align="right"/>
34236 <tbody>
34237 <row>
34238 <entry><option>forbid_include</option></entry>
34239 <entry>Use: <emphasis>redirect</emphasis></entry>
34240 <entry>Type: <emphasis>boolean</emphasis></entry>
34241 <entry>Default: <emphasis>false</emphasis></entry>
34242 </row>
34243 </tbody>
34244 </tgroup>
34245 </informaltable>
34246 <para>
34247 If this option is true, items of the form
34248 </para>
34249 <literallayout class="monospaced">
34250 :include:&lt;path name&gt;
34251 </literallayout>
34252 <para>
34253 are not permitted in non-filter redirection lists.
34254 </para>
34255 <para>
34256 <indexterm role="option">
34257 <primary><option>forbid_pipe</option></primary>
34258 </indexterm>
34259 </para>
34260 <informaltable frame="all">
34261 <tgroup cols="4" colsep="0" rowsep="0">
34262 <colspec colwidth="8*" align="left"/>
34263 <colspec colwidth="6*" align="center"/>
34264 <colspec colwidth="6*" align="center"/>
34265 <colspec colwidth="6*" align="right"/>
34266 <tbody>
34267 <row>
34268 <entry><option>forbid_pipe</option></entry>
34269 <entry>Use: <emphasis>redirect</emphasis></entry>
34270 <entry>Type: <emphasis>boolean</emphasis></entry>
34271 <entry>Default: <emphasis>false</emphasis></entry>
34272 </row>
34273 </tbody>
34274 </tgroup>
34275 </informaltable>
34276 <para>
34277 <indexterm role="concept">
34278 <primary>delivery</primary>
34279 <secondary>to pipe; forbidding</secondary>
34280 </indexterm>
34281 If this option is true, this router may not generate a new address which
34282 specifies delivery to a pipe, either from an Exim filter or from a conventional
34283 forward file. This option is forced to be true if <option>one_time</option> is set.
34284 </para>
34285 <para>
34286 <indexterm role="option">
34287 <primary><option>forbid_sieve_filter</option></primary>
34288 </indexterm>
34289 </para>
34290 <informaltable frame="all">
34291 <tgroup cols="4" colsep="0" rowsep="0">
34292 <colspec colwidth="8*" align="left"/>
34293 <colspec colwidth="6*" align="center"/>
34294 <colspec colwidth="6*" align="center"/>
34295 <colspec colwidth="6*" align="right"/>
34296 <tbody>
34297 <row>
34298 <entry><option>forbid_sieve_filter</option></entry>
34299 <entry>Use: <emphasis>redirect</emphasis></entry>
34300 <entry>Type: <emphasis>boolean</emphasis></entry>
34301 <entry>Default: <emphasis>false</emphasis></entry>
34302 </row>
34303 </tbody>
34304 </tgroup>
34305 </informaltable>
34306 <para>
34307 If this option is set true, only Exim filters are permitted when
34308 <option>allow_filter</option> is true.
34309 </para>
34310 <para>
34311 <indexterm role="concept">
34312 <primary>SMTP</primary>
34313 <secondary>error codes</secondary>
34314 </indexterm>
34315 <indexterm role="option">
34316 <primary><option>forbid_smtp_code</option></primary>
34317 </indexterm>
34318 </para>
34319 <informaltable frame="all">
34320 <tgroup cols="4" colsep="0" rowsep="0">
34321 <colspec colwidth="8*" align="left"/>
34322 <colspec colwidth="6*" align="center"/>
34323 <colspec colwidth="6*" align="center"/>
34324 <colspec colwidth="6*" align="right"/>
34325 <tbody>
34326 <row>
34327 <entry><option>forbid_smtp_code</option></entry>
34328 <entry>Use: <emphasis>redirect</emphasis></entry>
34329 <entry>Type: <emphasis>boolean</emphasis></entry>
34330 <entry>Default: <emphasis>false</emphasis></entry>
34331 </row>
34332 </tbody>
34333 </tgroup>
34334 </informaltable>
34335 <para>
34336 If this option is set true, any SMTP error codes that are present at the start
34337 of messages specified for <literal>:defer:</literal> or <literal>:fail:</literal> are quietly ignored, and
34338 the default codes (451 and 550, respectively) are always used.
34339 </para>
34340 <para>
34341 <indexterm role="option">
34342 <primary><option>hide_child_in_errmsg</option></primary>
34343 </indexterm>
34344 </para>
34345 <informaltable frame="all">
34346 <tgroup cols="4" colsep="0" rowsep="0">
34347 <colspec colwidth="8*" align="left"/>
34348 <colspec colwidth="6*" align="center"/>
34349 <colspec colwidth="6*" align="center"/>
34350 <colspec colwidth="6*" align="right"/>
34351 <tbody>
34352 <row>
34353 <entry><option>hide_child_in_errmsg</option></entry>
34354 <entry>Use: <emphasis>redirect</emphasis></entry>
34355 <entry>Type: <emphasis>boolean</emphasis></entry>
34356 <entry>Default: <emphasis>false</emphasis></entry>
34357 </row>
34358 </tbody>
34359 </tgroup>
34360 </informaltable>
34361 <para>
34362 <indexterm role="concept">
34363 <primary>bounce message</primary>
34364 <secondary>redirection details; suppressing</secondary>
34365 </indexterm>
34366 If this option is true, it prevents Exim from quoting a child address if it
34367 generates a bounce or delay message for it. Instead it says <quote>an address
34368 generated from &lt;<emphasis>the top level address</emphasis>&gt;</quote>. Of course, this applies only to
34369 bounces generated locally. If a message is forwarded to another host, <emphasis>its</emphasis>
34370 bounce may well quote the generated address.
34371 </para>
34372 <para>
34373 <indexterm role="option">
34374 <primary><option>ignore_eacces</option></primary>
34375 </indexterm>
34376 </para>
34377 <informaltable frame="all">
34378 <tgroup cols="4" colsep="0" rowsep="0">
34379 <colspec colwidth="8*" align="left"/>
34380 <colspec colwidth="6*" align="center"/>
34381 <colspec colwidth="6*" align="center"/>
34382 <colspec colwidth="6*" align="right"/>
34383 <tbody>
34384 <row>
34385 <entry><option>ignore_eacces</option></entry>
34386 <entry>Use: <emphasis>redirect</emphasis></entry>
34387 <entry>Type: <emphasis>boolean</emphasis></entry>
34388 <entry>Default: <emphasis>false</emphasis></entry>
34389 </row>
34390 </tbody>
34391 </tgroup>
34392 </informaltable>
34393 <para>
34394 <indexterm role="concept">
34395 <primary>EACCES</primary>
34396 </indexterm>
34397 If this option is set and an attempt to open a redirection file yields the
34398 EACCES error (permission denied), the <command>redirect</command> router behaves as if the
34399 file did not exist.
34400 </para>
34401 <para>
34402 <indexterm role="option">
34403 <primary><option>ignore_enotdir</option></primary>
34404 </indexterm>
34405 </para>
34406 <informaltable frame="all">
34407 <tgroup cols="4" colsep="0" rowsep="0">
34408 <colspec colwidth="8*" align="left"/>
34409 <colspec colwidth="6*" align="center"/>
34410 <colspec colwidth="6*" align="center"/>
34411 <colspec colwidth="6*" align="right"/>
34412 <tbody>
34413 <row>
34414 <entry><option>ignore_enotdir</option></entry>
34415 <entry>Use: <emphasis>redirect</emphasis></entry>
34416 <entry>Type: <emphasis>boolean</emphasis></entry>
34417 <entry>Default: <emphasis>false</emphasis></entry>
34418 </row>
34419 </tbody>
34420 </tgroup>
34421 </informaltable>
34422 <para>
34423 <indexterm role="concept">
34424 <primary>ENOTDIR</primary>
34425 </indexterm>
34426 If this option is set and an attempt to open a redirection file yields the
34427 ENOTDIR error (something on the path is not a directory), the <command>redirect</command>
34428 router behaves as if the file did not exist.
34429 </para>
34430 <para>
34431 Setting <option>ignore_enotdir</option> has another effect as well: When a <command>redirect</command>
34432 router that has the <option>file</option> option set discovers that the file does not exist
34433 (the ENOENT error), it tries to <function>stat()</function> the parent directory, as a check
34434 against unmounted NFS directories. If the parent can not be statted, delivery
34435 is deferred. However, it seems wrong to do this check when <option>ignore_enotdir</option>
34436 is set, because that option tells Exim to ignore <quote>something on the path is not
34437 a directory</quote> (the ENOTDIR error). This is a confusing area, because it seems
34438 that some operating systems give ENOENT where others give ENOTDIR.
34439 </para>
34440 <para>
34441 <indexterm role="option">
34442 <primary><option>include_directory</option></primary>
34443 </indexterm>
34444 </para>
34445 <informaltable frame="all">
34446 <tgroup cols="4" colsep="0" rowsep="0">
34447 <colspec colwidth="8*" align="left"/>
34448 <colspec colwidth="6*" align="center"/>
34449 <colspec colwidth="6*" align="center"/>
34450 <colspec colwidth="6*" align="right"/>
34451 <tbody>
34452 <row>
34453 <entry><option>include_directory</option></entry>
34454 <entry>Use: <emphasis>redirect</emphasis></entry>
34455 <entry>Type: <emphasis>string</emphasis></entry>
34456 <entry>Default: <emphasis>unset</emphasis></entry>
34457 </row>
34458 </tbody>
34459 </tgroup>
34460 </informaltable>
34461 <para>
34462 If this option is set, the path names of any <emphasis>:include:</emphasis> items in a
34463 redirection list must start with this directory.
34464 </para>
34465 <para>
34466 <indexterm role="option">
34467 <primary><option>modemask</option></primary>
34468 </indexterm>
34469 </para>
34470 <informaltable frame="all">
34471 <tgroup cols="4" colsep="0" rowsep="0">
34472 <colspec colwidth="8*" align="left"/>
34473 <colspec colwidth="6*" align="center"/>
34474 <colspec colwidth="6*" align="center"/>
34475 <colspec colwidth="6*" align="right"/>
34476 <tbody>
34477 <row>
34478 <entry><option>modemask</option></entry>
34479 <entry>Use: <emphasis>redirect</emphasis></entry>
34480 <entry>Type: <emphasis>octal integer</emphasis></entry>
34481 <entry>Default: <emphasis>022</emphasis></entry>
34482 </row>
34483 </tbody>
34484 </tgroup>
34485 </informaltable>
34486 <para>
34487 This specifies mode bits which must not be set for a file specified by the
34488 <option>file</option> option. If any of the forbidden bits are set, delivery is deferred.
34489 </para>
34490 <para>
34491 <indexterm role="option">
34492 <primary><option>one_time</option></primary>
34493 </indexterm>
34494 </para>
34495 <informaltable frame="all">
34496 <tgroup cols="4" colsep="0" rowsep="0">
34497 <colspec colwidth="8*" align="left"/>
34498 <colspec colwidth="6*" align="center"/>
34499 <colspec colwidth="6*" align="center"/>
34500 <colspec colwidth="6*" align="right"/>
34501 <tbody>
34502 <row>
34503 <entry><option>one_time</option></entry>
34504 <entry>Use: <emphasis>redirect</emphasis></entry>
34505 <entry>Type: <emphasis>boolean</emphasis></entry>
34506 <entry>Default: <emphasis>false</emphasis></entry>
34507 </row>
34508 </tbody>
34509 </tgroup>
34510 </informaltable>
34511 <para>
34512 <indexterm role="concept">
34513 <primary>one-time aliasing/forwarding expansion</primary>
34514 </indexterm>
34515 <indexterm role="concept">
34516 <primary>alias file</primary>
34517 <secondary>one-time expansion</secondary>
34518 </indexterm>
34519 <indexterm role="concept">
34520 <primary>forward file</primary>
34521 <secondary>one-time expansion</secondary>
34522 </indexterm>
34523 <indexterm role="concept">
34524 <primary>mailing lists</primary>
34525 <secondary>one-time expansion</secondary>
34526 </indexterm>
34527 <indexterm role="concept">
34528 <primary>address redirection</primary>
34529 <secondary>one-time expansion</secondary>
34530 </indexterm>
34531 Sometimes the fact that Exim re-evaluates aliases and reprocesses redirection
34532 files each time it tries to deliver a message causes a problem when one or more
34533 of the generated addresses fails be delivered at the first attempt. The problem
34534 is not one of duplicate delivery &ndash; Exim is clever enough to handle that &ndash;
34535 but of what happens when the redirection list changes during the time that the
34536 message is on Exim&#x2019;s queue. This is particularly true in the case of mailing
34537 lists, where new subscribers might receive copies of messages that were posted
34538 before they subscribed.
34539 </para>
34540 <para>
34541 If <option>one_time</option> is set and any addresses generated by the router fail to
34542 deliver at the first attempt, the failing addresses are added to the message as
34543 <quote>top level</quote> addresses, and the parent address that generated them is marked
34544 <quote>delivered</quote>. Thus, redirection does not happen again at the next delivery
34545 attempt.
34546 </para>
34547 <para>
34548 <emphasis role="bold">Warning 1</emphasis>: Any header line addition or removal that is specified by this
34549 router would be lost if delivery did not succeed at the first attempt. For this
34550 reason, the <option>headers_add</option> and <option>headers_remove</option> generic options are not
34551 permitted when <option>one_time</option> is set.
34552 </para>
34553 <para>
34554 <emphasis role="bold">Warning 2</emphasis>: To ensure that the router generates only addresses (as opposed
34555 to pipe or file deliveries or auto-replies) <option>forbid_file</option>, <option>forbid_pipe</option>,
34556 and <option>forbid_filter_reply</option> are forced to be true when <option>one_time</option> is set.
34557 </para>
34558 <para>
34559 <emphasis role="bold">Warning 3</emphasis>: The <option>unseen</option> generic router option may not be set with
34560 <option>one_time</option>.
34561 </para>
34562 <para>
34563 The original top-level address is remembered with each of the generated
34564 addresses, and is output in any log messages. However, any intermediate parent
34565 addresses are not recorded. This makes a difference to the log only if
34566 <option>all_parents</option> log selector is set. It is expected that <option>one_time</option> will
34567 typically be used for mailing lists, where there is normally just one level of
34568 expansion.
34569 </para>
34570 <para>
34571 <indexterm role="option">
34572 <primary><option>owners</option></primary>
34573 </indexterm>
34574 </para>
34575 <informaltable frame="all">
34576 <tgroup cols="4" colsep="0" rowsep="0">
34577 <colspec colwidth="8*" align="left"/>
34578 <colspec colwidth="6*" align="center"/>
34579 <colspec colwidth="6*" align="center"/>
34580 <colspec colwidth="6*" align="right"/>
34581 <tbody>
34582 <row>
34583 <entry><option>owners</option></entry>
34584 <entry>Use: <emphasis>redirect</emphasis></entry>
34585 <entry>Type: <emphasis>string list</emphasis></entry>
34586 <entry>Default: <emphasis>unset</emphasis></entry>
34587 </row>
34588 </tbody>
34589 </tgroup>
34590 </informaltable>
34591 <para>
34592 <indexterm role="concept">
34593 <primary>ownership</primary>
34594 <secondary>alias file</secondary>
34595 </indexterm>
34596 <indexterm role="concept">
34597 <primary>ownership</primary>
34598 <secondary>forward file</secondary>
34599 </indexterm>
34600 <indexterm role="concept">
34601 <primary>alias file</primary>
34602 <secondary>ownership</secondary>
34603 </indexterm>
34604 <indexterm role="concept">
34605 <primary>forward file</primary>
34606 <secondary>ownership</secondary>
34607 </indexterm>
34608 This specifies a list of permitted owners for the file specified by <option>file</option>.
34609 This list is in addition to the local user when <option>check_local_user</option> is set.
34610 See <option>check_owner</option> above.
34611 </para>
34612 <para>
34613 <indexterm role="option">
34614 <primary><option>owngroups</option></primary>
34615 </indexterm>
34616 </para>
34617 <informaltable frame="all">
34618 <tgroup cols="4" colsep="0" rowsep="0">
34619 <colspec colwidth="8*" align="left"/>
34620 <colspec colwidth="6*" align="center"/>
34621 <colspec colwidth="6*" align="center"/>
34622 <colspec colwidth="6*" align="right"/>
34623 <tbody>
34624 <row>
34625 <entry><option>owngroups</option></entry>
34626 <entry>Use: <emphasis>redirect</emphasis></entry>
34627 <entry>Type: <emphasis>string list</emphasis></entry>
34628 <entry>Default: <emphasis>unset</emphasis></entry>
34629 </row>
34630 </tbody>
34631 </tgroup>
34632 </informaltable>
34633 <para>
34634 This specifies a list of permitted groups for the file specified by <option>file</option>.
34635 The list is in addition to the local user&#x2019;s primary group when
34636 <option>check_local_user</option> is set. See <option>check_group</option> above.
34637 </para>
34638 <para>
34639 <indexterm role="option">
34640 <primary><option>pipe_transport</option></primary>
34641 </indexterm>
34642 </para>
34643 <informaltable frame="all">
34644 <tgroup cols="4" colsep="0" rowsep="0">
34645 <colspec colwidth="8*" align="left"/>
34646 <colspec colwidth="6*" align="center"/>
34647 <colspec colwidth="6*" align="center"/>
34648 <colspec colwidth="6*" align="right"/>
34649 <tbody>
34650 <row>
34651 <entry><option>pipe_transport</option></entry>
34652 <entry>Use: <emphasis>redirect</emphasis></entry>
34653 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34654 <entry>Default: <emphasis>unset</emphasis></entry>
34655 </row>
34656 </tbody>
34657 </tgroup>
34658 </informaltable>
34659 <para>
34660 <indexterm role="variable">
34661 <primary><varname>$address_pipe</varname></primary>
34662 </indexterm>
34663 A <command>redirect</command> router sets up a direct delivery to a pipe when a string
34664 starting with a vertical bar character is specified as a new <quote>address</quote>. The
34665 transport used is specified by this option, which, after expansion, must be the
34666 name of a configured transport. This should normally be a <command>pipe</command> transport.
34667 When the transport is run, the pipe command is in <varname>$address_pipe</varname>.
34668 </para>
34669 <para>
34670 <indexterm role="option">
34671 <primary><option>qualify_domain</option></primary>
34672 </indexterm>
34673 </para>
34674 <informaltable frame="all">
34675 <tgroup cols="4" colsep="0" rowsep="0">
34676 <colspec colwidth="8*" align="left"/>
34677 <colspec colwidth="6*" align="center"/>
34678 <colspec colwidth="6*" align="center"/>
34679 <colspec colwidth="6*" align="right"/>
34680 <tbody>
34681 <row>
34682 <entry><option>qualify_domain</option></entry>
34683 <entry>Use: <emphasis>redirect</emphasis></entry>
34684 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34685 <entry>Default: <emphasis>unset</emphasis></entry>
34686 </row>
34687 </tbody>
34688 </tgroup>
34689 </informaltable>
34690 <para>
34691 <indexterm role="variable">
34692 <primary><varname>$qualify_recipient</varname></primary>
34693 </indexterm>
34694 If this option is set, and an unqualified address (one without a domain) is
34695 generated, and that address would normally be qualified by the global setting
34696 in <option>qualify_recipient</option>, it is instead qualified with the domain specified by
34697 expanding this string. If the expansion fails, the router declines. If you want
34698 to revert to the default, you can have the expansion generate
34699 <varname>$qualify_recipient</varname>.
34700 </para>
34701 <para>
34702 This option applies to all unqualified addresses generated by Exim filters,
34703 but for traditional <filename>.forward</filename> files, it applies only to addresses that are
34704 not preceded by a backslash. Sieve filters cannot generate unqualified
34705 addresses.
34706 </para>
34707 <para>
34708 <indexterm role="option">
34709 <primary><option>qualify_preserve_domain</option></primary>
34710 </indexterm>
34711 </para>
34712 <informaltable frame="all">
34713 <tgroup cols="4" colsep="0" rowsep="0">
34714 <colspec colwidth="8*" align="left"/>
34715 <colspec colwidth="6*" align="center"/>
34716 <colspec colwidth="6*" align="center"/>
34717 <colspec colwidth="6*" align="right"/>
34718 <tbody>
34719 <row>
34720 <entry><option>qualify_preserve_domain</option></entry>
34721 <entry>Use: <emphasis>redirect</emphasis></entry>
34722 <entry>Type: <emphasis>boolean</emphasis></entry>
34723 <entry>Default: <emphasis>false</emphasis></entry>
34724 </row>
34725 </tbody>
34726 </tgroup>
34727 </informaltable>
34728 <para>
34729 <indexterm role="concept">
34730 <primary>domain</primary>
34731 <secondary>in redirection; preserving</secondary>
34732 </indexterm>
34733 <indexterm role="concept">
34734 <primary>preserving domain in redirection</primary>
34735 </indexterm>
34736 <indexterm role="concept">
34737 <primary>address redirection</primary>
34738 <secondary>domain; preserving</secondary>
34739 </indexterm>
34740 If this option is set, the router&#x2019;s local <option>qualify_domain</option> option must not be
34741 set (a configuration error occurs if it is). If an unqualified address (one
34742 without a domain) is generated, it is qualified with the domain of the parent
34743 address (the immediately preceding ancestor) instead of the global
34744 <option>qualify_recipient</option> value. In the case of a traditional <filename>.forward</filename> file,
34745 this applies whether or not the address is preceded by a backslash.
34746 </para>
34747 <para>
34748 <indexterm role="option">
34749 <primary><option>repeat_use</option></primary>
34750 </indexterm>
34751 </para>
34752 <informaltable frame="all">
34753 <tgroup cols="4" colsep="0" rowsep="0">
34754 <colspec colwidth="8*" align="left"/>
34755 <colspec colwidth="6*" align="center"/>
34756 <colspec colwidth="6*" align="center"/>
34757 <colspec colwidth="6*" align="right"/>
34758 <tbody>
34759 <row>
34760 <entry><option>repeat_use</option></entry>
34761 <entry>Use: <emphasis>redirect</emphasis></entry>
34762 <entry>Type: <emphasis>boolean</emphasis></entry>
34763 <entry>Default: <emphasis>true</emphasis></entry>
34764 </row>
34765 </tbody>
34766 </tgroup>
34767 </informaltable>
34768 <para>
34769 If this option is set false, the router is skipped for a child address that has
34770 any ancestor that was routed by this router. This test happens before any of
34771 the other preconditions are tested. Exim&#x2019;s default anti-looping rules skip
34772 only when the ancestor is the same as the current address. See also
34773 <option>check_ancestor</option> above and the generic <option>redirect_router</option> option.
34774 </para>
34775 <para>
34776 <indexterm role="option">
34777 <primary><option>reply_transport</option></primary>
34778 </indexterm>
34779 </para>
34780 <informaltable frame="all">
34781 <tgroup cols="4" colsep="0" rowsep="0">
34782 <colspec colwidth="8*" align="left"/>
34783 <colspec colwidth="6*" align="center"/>
34784 <colspec colwidth="6*" align="center"/>
34785 <colspec colwidth="6*" align="right"/>
34786 <tbody>
34787 <row>
34788 <entry><option>reply_transport</option></entry>
34789 <entry>Use: <emphasis>redirect</emphasis></entry>
34790 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34791 <entry>Default: <emphasis>unset</emphasis></entry>
34792 </row>
34793 </tbody>
34794 </tgroup>
34795 </informaltable>
34796 <para>
34797 A <command>redirect</command> router sets up an automatic reply when a <option>mail</option> or
34798 <option>vacation</option> command is used in a filter file. The transport used is specified
34799 by this option, which, after expansion, must be the name of a configured
34800 transport. This should normally be an <command>autoreply</command> transport. Other transports
34801 are unlikely to do anything sensible or useful.
34802 </para>
34803 <para>
34804 <indexterm role="option">
34805 <primary><option>rewrite</option></primary>
34806 </indexterm>
34807 </para>
34808 <informaltable frame="all">
34809 <tgroup cols="4" colsep="0" rowsep="0">
34810 <colspec colwidth="8*" align="left"/>
34811 <colspec colwidth="6*" align="center"/>
34812 <colspec colwidth="6*" align="center"/>
34813 <colspec colwidth="6*" align="right"/>
34814 <tbody>
34815 <row>
34816 <entry><option>rewrite</option></entry>
34817 <entry>Use: <emphasis>redirect</emphasis></entry>
34818 <entry>Type: <emphasis>boolean</emphasis></entry>
34819 <entry>Default: <emphasis>true</emphasis></entry>
34820 </row>
34821 </tbody>
34822 </tgroup>
34823 </informaltable>
34824 <para>
34825 <indexterm role="concept">
34826 <primary>address redirection</primary>
34827 <secondary>disabling rewriting</secondary>
34828 </indexterm>
34829 If this option is set false, addresses generated by the router are not
34830 subject to address rewriting. Otherwise, they are treated like new addresses
34831 and are rewritten according to the global rewriting rules.
34832 </para>
34833 <para>
34834 <indexterm role="option">
34835 <primary><option>sieve_subaddress</option></primary>
34836 </indexterm>
34837 </para>
34838 <informaltable frame="all">
34839 <tgroup cols="4" colsep="0" rowsep="0">
34840 <colspec colwidth="8*" align="left"/>
34841 <colspec colwidth="6*" align="center"/>
34842 <colspec colwidth="6*" align="center"/>
34843 <colspec colwidth="6*" align="right"/>
34844 <tbody>
34845 <row>
34846 <entry><option>sieve_subaddress</option></entry>
34847 <entry>Use: <emphasis>redirect</emphasis></entry>
34848 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34849 <entry>Default: <emphasis>unset</emphasis></entry>
34850 </row>
34851 </tbody>
34852 </tgroup>
34853 </informaltable>
34854 <para>
34855 The value of this option is passed to a Sieve filter to specify the
34856 :subaddress part of an address.
34857 </para>
34858 <para>
34859 <indexterm role="option">
34860 <primary><option>sieve_useraddress</option></primary>
34861 </indexterm>
34862 </para>
34863 <informaltable frame="all">
34864 <tgroup cols="4" colsep="0" rowsep="0">
34865 <colspec colwidth="8*" align="left"/>
34866 <colspec colwidth="6*" align="center"/>
34867 <colspec colwidth="6*" align="center"/>
34868 <colspec colwidth="6*" align="right"/>
34869 <tbody>
34870 <row>
34871 <entry><option>sieve_useraddress</option></entry>
34872 <entry>Use: <emphasis>redirect</emphasis></entry>
34873 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34874 <entry>Default: <emphasis>unset</emphasis></entry>
34875 </row>
34876 </tbody>
34877 </tgroup>
34878 </informaltable>
34879 <para>
34880 The value of this option is passed to a Sieve filter to specify the :user part
34881 of an address. However, if it is unset, the entire original local part
34882 (including any prefix or suffix) is used for :user.
34883 </para>
34884 <para>
34885 <indexterm role="option">
34886 <primary><option>sieve_vacation_directory</option></primary>
34887 </indexterm>
34888 </para>
34889 <informaltable frame="all">
34890 <tgroup cols="4" colsep="0" rowsep="0">
34891 <colspec colwidth="8*" align="left"/>
34892 <colspec colwidth="6*" align="center"/>
34893 <colspec colwidth="6*" align="center"/>
34894 <colspec colwidth="6*" align="right"/>
34895 <tbody>
34896 <row>
34897 <entry><option>sieve_vacation_directory</option></entry>
34898 <entry>Use: <emphasis>redirect</emphasis></entry>
34899 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34900 <entry>Default: <emphasis>unset</emphasis></entry>
34901 </row>
34902 </tbody>
34903 </tgroup>
34904 </informaltable>
34905 <para>
34906 <indexterm role="concept">
34907 <primary>Sieve filter</primary>
34908 <secondary>vacation directory</secondary>
34909 </indexterm>
34910 To enable the <quote>vacation</quote> extension for Sieve filters, you must set
34911 <option>sieve_vacation_directory</option> to the directory where vacation databases are held
34912 (do not put anything else in that directory), and ensure that the
34913 <option>reply_transport</option> option refers to an <command>autoreply</command> transport. Each user
34914 needs their own directory; Exim will create it if necessary.
34915 </para>
34916 <para>
34917 <indexterm role="option">
34918 <primary><option>skip_syntax_errors</option></primary>
34919 </indexterm>
34920 </para>
34921 <informaltable frame="all">
34922 <tgroup cols="4" colsep="0" rowsep="0">
34923 <colspec colwidth="8*" align="left"/>
34924 <colspec colwidth="6*" align="center"/>
34925 <colspec colwidth="6*" align="center"/>
34926 <colspec colwidth="6*" align="right"/>
34927 <tbody>
34928 <row>
34929 <entry><option>skip_syntax_errors</option></entry>
34930 <entry>Use: <emphasis>redirect</emphasis></entry>
34931 <entry>Type: <emphasis>boolean</emphasis></entry>
34932 <entry>Default: <emphasis>false</emphasis></entry>
34933 </row>
34934 </tbody>
34935 </tgroup>
34936 </informaltable>
34937 <para>
34938 <indexterm role="concept">
34939 <primary>forward file</primary>
34940 <secondary>broken</secondary>
34941 </indexterm>
34942 <indexterm role="concept">
34943 <primary>address redirection</primary>
34944 <secondary>broken files</secondary>
34945 </indexterm>
34946 <indexterm role="concept">
34947 <primary>alias file</primary>
34948 <secondary>broken</secondary>
34949 </indexterm>
34950 <indexterm role="concept">
34951 <primary>broken alias or forward files</primary>
34952 </indexterm>
34953 <indexterm role="concept">
34954 <primary>ignoring faulty addresses</primary>
34955 </indexterm>
34956 <indexterm role="concept">
34957 <primary>skipping faulty addresses</primary>
34958 </indexterm>
34959 <indexterm role="concept">
34960 <primary>error</primary>
34961 <secondary>skipping bad syntax</secondary>
34962 </indexterm>
34963 If <option>skip_syntax_errors</option> is set, syntactically malformed addresses in
34964 non-filter redirection data are skipped, and each failing address is logged. If
34965 <option>syntax_errors_to</option> is set, a message is sent to the address it defines,
34966 giving details of the failures. If <option>syntax_errors_text</option> is set, its contents
34967 are expanded and placed at the head of the error message generated by
34968 <option>syntax_errors_to</option>. Usually it is appropriate to set <option>syntax_errors_to</option> to
34969 be the same address as the generic <option>errors_to</option> option. The
34970 <option>skip_syntax_errors</option> option is often used when handling mailing lists.
34971 </para>
34972 <para>
34973 If all the addresses in a redirection list are skipped because of syntax
34974 errors, the router declines to handle the original address, and it is passed to
34975 the following routers.
34976 </para>
34977 <para>
34978 If <option>skip_syntax_errors</option> is set when an Exim filter is interpreted, any syntax
34979 error in the filter causes filtering to be abandoned without any action being
34980 taken. The incident is logged, and the router declines to handle the address,
34981 so it is passed to the following routers.
34982 </para>
34983 <para>
34984 <indexterm role="concept">
34985 <primary>Sieve filter</primary>
34986 <secondary>syntax errors in</secondary>
34987 </indexterm>
34988 Syntax errors in a Sieve filter file cause the <quote>keep</quote> action to occur. This
34989 action is specified by RFC 3028. The values of <option>skip_syntax_errors</option>,
34990 <option>syntax_errors_to</option>, and <option>syntax_errors_text</option> are not used.
34991 </para>
34992 <para>
34993 <option>skip_syntax_errors</option> can be used to specify that errors in users&#x2019; forward
34994 lists or filter files should not prevent delivery. The <option>syntax_errors_to</option>
34995 option, used with an address that does not get redirected, can be used to
34996 notify users of these errors, by means of a router like this:
34997 </para>
34998 <literallayout class="monospaced">
34999 userforward:
35000   driver = redirect
35001   allow_filter
35002   check_local_user
35003   file = $home/.forward
35004   file_transport = address_file
35005   pipe_transport = address_pipe
35006   reply_transport = address_reply
35007   no_verify
35008   skip_syntax_errors
35009   syntax_errors_to = real-$local_part@$domain
35010   syntax_errors_text = \
35011    This is an automatically generated message. An error has\n\
35012    been found in your .forward file. Details of the error are\n\
35013    reported below. While this error persists, you will receive\n\
35014    a copy of this message for every message that is addressed\n\
35015    to you. If your .forward file is a filter file, or if it is\n\
35016    a non-filter file containing no valid forwarding addresses,\n\
35017    a copy of each incoming message will be put in your normal\n\
35018    mailbox. If a non-filter file contains at least one valid\n\
35019    forwarding address, forwarding to the valid addresses will\n\
35020    happen, and those will be the only deliveries that occur.
35021 </literallayout>
35022 <para>
35023 You also need a router to ensure that local addresses that are prefixed by
35024 <literal>real-</literal> are recognized, but not forwarded or filtered. For example, you could
35025 put this immediately before the <command>userforward</command> router:
35026 </para>
35027 <literallayout class="monospaced">
35028 real_localuser:
35029   driver = accept
35030   check_local_user
35031   local_part_prefix = real-
35032   transport = local_delivery
35033 </literallayout>
35034 <para>
35035 For security, it would probably be a good idea to restrict the use of this
35036 router to locally-generated messages, using a condition such as this:
35037 </para>
35038 <literallayout class="monospaced">
35039   condition = ${if match {$sender_host_address}\
35040                          {\N^(|127\.0\.0\.1)$\N}}
35041 </literallayout>
35042 <para>
35043 <indexterm role="option">
35044 <primary><option>syntax_errors_text</option></primary>
35045 </indexterm>
35046 </para>
35047 <informaltable frame="all">
35048 <tgroup cols="4" colsep="0" rowsep="0">
35049 <colspec colwidth="8*" align="left"/>
35050 <colspec colwidth="6*" align="center"/>
35051 <colspec colwidth="6*" align="center"/>
35052 <colspec colwidth="6*" align="right"/>
35053 <tbody>
35054 <row>
35055 <entry><option>syntax_errors_text</option></entry>
35056 <entry>Use: <emphasis>redirect</emphasis></entry>
35057 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35058 <entry>Default: <emphasis>unset</emphasis></entry>
35059 </row>
35060 </tbody>
35061 </tgroup>
35062 </informaltable>
35063 <para>
35064 See <option>skip_syntax_errors</option> above.
35065 </para>
35066 <para>
35067 <indexterm role="option">
35068 <primary><option>syntax_errors_to</option></primary>
35069 </indexterm>
35070 </para>
35071 <informaltable frame="all">
35072 <tgroup cols="4" colsep="0" rowsep="0">
35073 <colspec colwidth="8*" align="left"/>
35074 <colspec colwidth="6*" align="center"/>
35075 <colspec colwidth="6*" align="center"/>
35076 <colspec colwidth="6*" align="right"/>
35077 <tbody>
35078 <row>
35079 <entry><option>syntax_errors_to</option></entry>
35080 <entry>Use: <emphasis>redirect</emphasis></entry>
35081 <entry>Type: <emphasis>string</emphasis></entry>
35082 <entry>Default: <emphasis>unset</emphasis></entry>
35083 </row>
35084 </tbody>
35085 </tgroup>
35086 </informaltable>
35087 <para>
35088 See <option>skip_syntax_errors</option> above.
35089 <indexterm role="concept" startref="IIDredrou1" class="endofrange"/>
35090 <indexterm role="concept" startref="IIDredrou2" class="endofrange"/>
35091 </para>
35092 </section>
35093 </chapter>
35094
35095 <chapter id="CHAPenvironment">
35096 <title>Environment for running local transports</title>
35097 <titleabbrev>Environment for local transports</titleabbrev>
35098 <para>
35099 <indexterm role="concept" id="IIDenvlotra1" class="startofrange">
35100 <primary>local transports</primary>
35101 <secondary>environment for</secondary>
35102 </indexterm>
35103 <indexterm role="concept" id="IIDenvlotra2" class="startofrange">
35104 <primary>environment for local transports</primary>
35105 </indexterm>
35106 <indexterm role="concept" id="IIDenvlotra3" class="startofrange">
35107 <primary>transport</primary>
35108 <secondary>local; environment for</secondary>
35109 </indexterm>
35110 Local transports handle deliveries to files and pipes. (The <command>autoreply</command>
35111 transport can be thought of as similar to a pipe.) Exim always runs transports
35112 in subprocesses, under specified uids and gids. Typical deliveries to local
35113 mailboxes run under the uid and gid of the local user.
35114 </para>
35115 <para>
35116 Exim also sets a specific current directory while running the transport; for
35117 some transports a home directory setting is also relevant. The <command>pipe</command>
35118 transport is the only one that sets up environment variables; see section
35119 <xref linkend="SECTpipeenv"/> for details.
35120 </para>
35121 <para>
35122 The values used for the uid, gid, and the directories may come from several
35123 different places. In many cases, the router that handles the address associates
35124 settings with that address as a result of its <option>check_local_user</option>, <option>group</option>,
35125 or <option>user</option> options. However, values may also be given in the transport&#x2019;s own
35126 configuration, and these override anything that comes from the router.
35127 </para>
35128 <section id="SECID131">
35129 <title>Concurrent deliveries</title>
35130 <para>
35131 <indexterm role="concept">
35132 <primary>concurrent deliveries</primary>
35133 </indexterm>
35134 <indexterm role="concept">
35135 <primary>simultaneous deliveries</primary>
35136 </indexterm>
35137 If two different messages for the same local recipient arrive more or less
35138 simultaneously, the two delivery processes are likely to run concurrently. When
35139 the <command>appendfile</command> transport is used to write to a file, Exim applies locking
35140 rules to stop concurrent processes from writing to the same file at the same
35141 time.
35142 </para>
35143 <para>
35144 However, when you use a <command>pipe</command> transport, it is up to you to arrange any
35145 locking that is needed. Here is a silly example:
35146 </para>
35147 <literallayout class="monospaced">
35148 my_transport:
35149   driver = pipe
35150   command = /bin/sh -c 'cat &gt;&gt;/some/file'
35151 </literallayout>
35152 <para>
35153 This is supposed to write the message at the end of the file. However, if two
35154 messages arrive at the same time, the file will be scrambled. You can use the
35155 <option>exim_lock</option> utility program (see section <xref linkend="SECTmailboxmaint"/>) to lock a
35156 file using the same algorithm that Exim itself uses.
35157 </para>
35158 </section>
35159 <section id="SECTenvuidgid">
35160 <title>Uids and gids</title>
35161 <para>
35162 <indexterm role="concept">
35163 <primary>local transports</primary>
35164 <secondary>uid and gid</secondary>
35165 </indexterm>
35166 <indexterm role="concept">
35167 <primary>transport</primary>
35168 <secondary>local; uid and gid</secondary>
35169 </indexterm>
35170 All transports have the options <option>group</option> and <option>user</option>. If <option>group</option> is set, it
35171 overrides any group that the router set in the address, even if <option>user</option> is not
35172 set for the transport. This makes it possible, for example, to run local mail
35173 delivery under the uid of the recipient (set by the router), but in a special
35174 group (set by the transport). For example:
35175 </para>
35176 <literallayout class="monospaced">
35177 # Routers ...
35178 # User/group are set by check_local_user in this router
35179 local_users:
35180   driver = accept
35181   check_local_user
35182   transport = group_delivery
35183
35184 # Transports ...
35185 # This transport overrides the group
35186 group_delivery:
35187   driver = appendfile
35188   file = /var/spool/mail/$local_part
35189   group = mail
35190 </literallayout>
35191 <para>
35192 If <option>user</option> is set for a transport, its value overrides what is set in the
35193 address by the router. If <option>user</option> is non-numeric and <option>group</option> is not set, the
35194 gid associated with the user is used. If <option>user</option> is numeric, <option>group</option> must be
35195 set.
35196 </para>
35197 <para>
35198 <indexterm role="option">
35199 <primary><option>initgroups</option></primary>
35200 </indexterm>
35201 When the uid is taken from the transport&#x2019;s configuration, the <function>initgroups()</function>
35202 function is called for the groups associated with that uid if the
35203 <option>initgroups</option> option is set for the transport. When the uid is not specified
35204 by the transport, but is associated with the address by a router, the option
35205 for calling <function>initgroups()</function> is taken from the router configuration.
35206 </para>
35207 <para>
35208 <indexterm role="concept">
35209 <primary><command>pipe</command> transport</primary>
35210 <secondary>uid for</secondary>
35211 </indexterm>
35212 The <command>pipe</command> transport contains the special option <option>pipe_as_creator</option>. If this
35213 is set and <option>user</option> is not set, the uid of the process that called Exim to
35214 receive the message is used, and if <option>group</option> is not set, the corresponding
35215 original gid is also used.
35216 </para>
35217 <para>
35218 This is the detailed preference order for obtaining a gid; the first of the
35219 following that is set is used:
35220 </para>
35221 <itemizedlist>
35222 <listitem>
35223 <para>
35224 A <option>group</option> setting of the transport;
35225 </para>
35226 </listitem>
35227 <listitem>
35228 <para>
35229 A <option>group</option> setting of the router;
35230 </para>
35231 </listitem>
35232 <listitem>
35233 <para>
35234 A gid associated with a user setting of the router, either as a result of
35235 <option>check_local_user</option> or an explicit non-numeric <option>user</option> setting;
35236 </para>
35237 </listitem>
35238 <listitem>
35239 <para>
35240 The group associated with a non-numeric <option>user</option> setting of the transport;
35241 </para>
35242 </listitem>
35243 <listitem>
35244 <para>
35245 In a <command>pipe</command> transport, the creator&#x2019;s gid if <option>deliver_as_creator</option> is set and
35246 the uid is the creator&#x2019;s uid;
35247 </para>
35248 </listitem>
35249 <listitem>
35250 <para>
35251 The Exim gid if the Exim uid is being used as a default.
35252 </para>
35253 </listitem>
35254 </itemizedlist>
35255 <para>
35256 If, for example, the user is specified numerically on the router and there are
35257 no group settings, no gid is available. In this situation, an error occurs.
35258 This is different for the uid, for which there always is an ultimate default.
35259 The first of the following that is set is used:
35260 </para>
35261 <itemizedlist>
35262 <listitem>
35263 <para>
35264 A <option>user</option> setting of the transport;
35265 </para>
35266 </listitem>
35267 <listitem>
35268 <para>
35269 In a <command>pipe</command> transport, the creator&#x2019;s uid if <option>deliver_as_creator</option> is set;
35270 </para>
35271 </listitem>
35272 <listitem>
35273 <para>
35274 A <option>user</option> setting of the router;
35275 </para>
35276 </listitem>
35277 <listitem>
35278 <para>
35279 A <option>check_local_user</option> setting of the router;
35280 </para>
35281 </listitem>
35282 <listitem>
35283 <para>
35284 The Exim uid.
35285 </para>
35286 </listitem>
35287 </itemizedlist>
35288 <para>
35289 Of course, an error will still occur if the uid that is chosen is on the
35290 <option>never_users</option> list.
35291 </para>
35292 </section>
35293 <section id="SECID132">
35294 <title>Current and home directories</title>
35295 <para>
35296 <indexterm role="concept">
35297 <primary>current directory for local transport</primary>
35298 </indexterm>
35299 <indexterm role="concept">
35300 <primary>home directory</primary>
35301 <secondary>for local transport</secondary>
35302 </indexterm>
35303 <indexterm role="concept">
35304 <primary>transport</primary>
35305 <secondary>local; home directory for</secondary>
35306 </indexterm>
35307 <indexterm role="concept">
35308 <primary>transport</primary>
35309 <secondary>local; current directory for</secondary>
35310 </indexterm>
35311 Routers may set current and home directories for local transports by means of
35312 the <option>transport_current_directory</option> and <option>transport_home_directory</option> options.
35313 However, if the transport&#x2019;s <option>current_directory</option> or <option>home_directory</option> options
35314 are set, they override the router&#x2019;s values. In detail, the home directory
35315 for a local transport is taken from the first of these values that is set:
35316 </para>
35317 <itemizedlist>
35318 <listitem>
35319 <para>
35320 The <option>home_directory</option> option on the transport;
35321 </para>
35322 </listitem>
35323 <listitem>
35324 <para>
35325 The <option>transport_home_directory</option> option on the router;
35326 </para>
35327 </listitem>
35328 <listitem>
35329 <para>
35330 The password data if <option>check_local_user</option> is set on the router;
35331 </para>
35332 </listitem>
35333 <listitem>
35334 <para>
35335 The <option>router_home_directory</option> option on the router.
35336 </para>
35337 </listitem>
35338 </itemizedlist>
35339 <para>
35340 The current directory is taken from the first of these values that is set:
35341 </para>
35342 <itemizedlist>
35343 <listitem>
35344 <para>
35345 The <option>current_directory</option> option on the transport;
35346 </para>
35347 </listitem>
35348 <listitem>
35349 <para>
35350 The <option>transport_current_directory</option> option on the router.
35351 </para>
35352 </listitem>
35353 </itemizedlist>
35354 <para>
35355 If neither the router nor the transport sets a current directory, Exim uses the
35356 value of the home directory, if it is set. Otherwise it sets the current
35357 directory to <filename>/</filename> before running a local transport.
35358 </para>
35359 </section>
35360 <section id="SECID133">
35361 <title>Expansion variables derived from the address</title>
35362 <para>
35363 <indexterm role="variable">
35364 <primary><varname>$domain</varname></primary>
35365 </indexterm>
35366 <indexterm role="variable">
35367 <primary><varname>$local_part</varname></primary>
35368 </indexterm>
35369 <indexterm role="variable">
35370 <primary><varname>$original_domain</varname></primary>
35371 </indexterm>
35372 Normally a local delivery is handling a single address, and in that case the
35373 variables such as <varname>$domain</varname> and <varname>$local_part</varname> are set during local
35374 deliveries. However, in some circumstances more than one address may be handled
35375 at once (for example, while writing batch SMTP for onward transmission by some
35376 other means). In this case, the variables associated with the local part are
35377 never set, <varname>$domain</varname> is set only if all the addresses have the same domain,
35378 and <varname>$original_domain</varname> is never set.
35379 <indexterm role="concept" startref="IIDenvlotra1" class="endofrange"/>
35380 <indexterm role="concept" startref="IIDenvlotra2" class="endofrange"/>
35381 <indexterm role="concept" startref="IIDenvlotra3" class="endofrange"/>
35382 </para>
35383 </section>
35384 </chapter>
35385
35386 <chapter id="CHAPtransportgeneric">
35387 <title>Generic options for transports</title>
35388 <para>
35389 <indexterm role="concept" id="IIDgenoptra1" class="startofrange">
35390 <primary>generic options</primary>
35391 <secondary>transport</secondary>
35392 </indexterm>
35393 <indexterm role="concept" id="IIDgenoptra2" class="startofrange">
35394 <primary>options</primary>
35395 <secondary>generic; for transports</secondary>
35396 </indexterm>
35397 <indexterm role="concept" id="IIDgenoptra3" class="startofrange">
35398 <primary>transport</primary>
35399 <secondary>generic options for</secondary>
35400 </indexterm>
35401 The following generic options apply to all transports:
35402 </para>
35403 <para>
35404 <indexterm role="option">
35405 <primary><option>body_only</option></primary>
35406 </indexterm>
35407 </para>
35408 <informaltable frame="all">
35409 <tgroup cols="4" colsep="0" rowsep="0">
35410 <colspec colwidth="8*" align="left"/>
35411 <colspec colwidth="6*" align="center"/>
35412 <colspec colwidth="6*" align="center"/>
35413 <colspec colwidth="6*" align="right"/>
35414 <tbody>
35415 <row>
35416 <entry><option>body_only</option></entry>
35417 <entry>Use: <emphasis>transports</emphasis></entry>
35418 <entry>Type: <emphasis>boolean</emphasis></entry>
35419 <entry>Default: <emphasis>false</emphasis></entry>
35420 </row>
35421 </tbody>
35422 </tgroup>
35423 </informaltable>
35424 <para>
35425 <indexterm role="concept">
35426 <primary>transport</primary>
35427 <secondary>body only</secondary>
35428 </indexterm>
35429 <indexterm role="concept">
35430 <primary>message</primary>
35431 <secondary>transporting body only</secondary>
35432 </indexterm>
35433 <indexterm role="concept">
35434 <primary>body of message</primary>
35435 <secondary>transporting</secondary>
35436 </indexterm>
35437 If this option is set, the message&#x2019;s headers are not transported. It is
35438 mutually exclusive with <option>headers_only</option>. If it is used with the <command>appendfile</command>
35439 or <command>pipe</command> transports, the settings of <option>message_prefix</option> and
35440 <option>message_suffix</option> should be checked, because this option does not
35441 automatically suppress them.
35442 </para>
35443 <para>
35444 <indexterm role="option">
35445 <primary><option>current_directory</option></primary>
35446 </indexterm>
35447 </para>
35448 <informaltable frame="all">
35449 <tgroup cols="4" colsep="0" rowsep="0">
35450 <colspec colwidth="8*" align="left"/>
35451 <colspec colwidth="6*" align="center"/>
35452 <colspec colwidth="6*" align="center"/>
35453 <colspec colwidth="6*" align="right"/>
35454 <tbody>
35455 <row>
35456 <entry><option>current_directory</option></entry>
35457 <entry>Use: <emphasis>transports</emphasis></entry>
35458 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35459 <entry>Default: <emphasis>unset</emphasis></entry>
35460 </row>
35461 </tbody>
35462 </tgroup>
35463 </informaltable>
35464 <para>
35465 <indexterm role="concept">
35466 <primary>transport</primary>
35467 <secondary>current directory for</secondary>
35468 </indexterm>
35469 This specifies the current directory that is to be set while running the
35470 transport, overriding any value that may have been set by the router.
35471 If the expansion fails for any reason, including forced failure, an error is
35472 logged, and delivery is deferred.
35473 </para>
35474 <para>
35475 <indexterm role="option">
35476 <primary><option>disable_logging</option></primary>
35477 </indexterm>
35478 </para>
35479 <informaltable frame="all">
35480 <tgroup cols="4" colsep="0" rowsep="0">
35481 <colspec colwidth="8*" align="left"/>
35482 <colspec colwidth="6*" align="center"/>
35483 <colspec colwidth="6*" align="center"/>
35484 <colspec colwidth="6*" align="right"/>
35485 <tbody>
35486 <row>
35487 <entry><option>disable_logging</option></entry>
35488 <entry>Use: <emphasis>transports</emphasis></entry>
35489 <entry>Type: <emphasis>boolean</emphasis></entry>
35490 <entry>Default: <emphasis>false</emphasis></entry>
35491 </row>
35492 </tbody>
35493 </tgroup>
35494 </informaltable>
35495 <para>
35496 If this option is set true, nothing is logged for any
35497 deliveries by the transport or for any
35498 transport errors. You should not set this option unless you really, really know
35499 what you are doing.
35500 </para>
35501 <para>
35502 <indexterm role="option">
35503 <primary><option>debug_print</option></primary>
35504 </indexterm>
35505 </para>
35506 <informaltable frame="all">
35507 <tgroup cols="4" colsep="0" rowsep="0">
35508 <colspec colwidth="8*" align="left"/>
35509 <colspec colwidth="6*" align="center"/>
35510 <colspec colwidth="6*" align="center"/>
35511 <colspec colwidth="6*" align="right"/>
35512 <tbody>
35513 <row>
35514 <entry><option>debug_print</option></entry>
35515 <entry>Use: <emphasis>transports</emphasis></entry>
35516 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35517 <entry>Default: <emphasis>unset</emphasis></entry>
35518 </row>
35519 </tbody>
35520 </tgroup>
35521 </informaltable>
35522 <para>
35523 <indexterm role="concept">
35524 <primary>testing</primary>
35525 <secondary>variables in drivers</secondary>
35526 </indexterm>
35527 If this option is set and debugging is enabled (see the <option>-d</option> command line
35528 option), the string is expanded and included in the debugging output when the
35529 transport is run.
35530 If expansion of the string fails, the error message is written to the debugging
35531 output, and Exim carries on processing.
35532 This facility is provided to help with checking out the values of variables and
35533 so on when debugging driver configurations. For example, if a <option>headers_add</option>
35534 option is not working properly, <option>debug_print</option> could be used to output the
35535 variables it references. A newline is added to the text if it does not end with
35536 one.
35537 </para>
35538 <para>
35539 <indexterm role="option">
35540 <primary><option>delivery_date_add</option></primary>
35541 </indexterm>
35542 </para>
35543 <informaltable frame="all">
35544 <tgroup cols="4" colsep="0" rowsep="0">
35545 <colspec colwidth="8*" align="left"/>
35546 <colspec colwidth="6*" align="center"/>
35547 <colspec colwidth="6*" align="center"/>
35548 <colspec colwidth="6*" align="right"/>
35549 <tbody>
35550 <row>
35551 <entry><option>delivery_date_add</option></entry>
35552 <entry>Use: <emphasis>transports</emphasis></entry>
35553 <entry>Type: <emphasis>boolean</emphasis></entry>
35554 <entry>Default: <emphasis>false</emphasis></entry>
35555 </row>
35556 </tbody>
35557 </tgroup>
35558 </informaltable>
35559 <para>
35560 <indexterm role="concept">
35561 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
35562 </indexterm>
35563 If this option is true, a <emphasis>Delivery-date:</emphasis> header is added to the message.
35564 This gives the actual time the delivery was made. As this is not a standard
35565 header, Exim has a configuration option (<option>delivery_date_remove</option>) which
35566 requests its removal from incoming messages, so that delivered messages can
35567 safely be resent to other recipients.
35568 </para>
35569 <para>
35570 <indexterm role="option">
35571 <primary><option>driver</option></primary>
35572 </indexterm>
35573 </para>
35574 <informaltable frame="all">
35575 <tgroup cols="4" colsep="0" rowsep="0">
35576 <colspec colwidth="8*" align="left"/>
35577 <colspec colwidth="6*" align="center"/>
35578 <colspec colwidth="6*" align="center"/>
35579 <colspec colwidth="6*" align="right"/>
35580 <tbody>
35581 <row>
35582 <entry><option>driver</option></entry>
35583 <entry>Use: <emphasis>transports</emphasis></entry>
35584 <entry>Type: <emphasis>string</emphasis></entry>
35585 <entry>Default: <emphasis>unset</emphasis></entry>
35586 </row>
35587 </tbody>
35588 </tgroup>
35589 </informaltable>
35590 <para>
35591 This specifies which of the available transport drivers is to be used.
35592 There is no default, and this option must be set for every transport.
35593 </para>
35594 <para>
35595 <indexterm role="option">
35596 <primary><option>envelope_to_add</option></primary>
35597 </indexterm>
35598 </para>
35599 <informaltable frame="all">
35600 <tgroup cols="4" colsep="0" rowsep="0">
35601 <colspec colwidth="8*" align="left"/>
35602 <colspec colwidth="6*" align="center"/>
35603 <colspec colwidth="6*" align="center"/>
35604 <colspec colwidth="6*" align="right"/>
35605 <tbody>
35606 <row>
35607 <entry><option>envelope_to_add</option></entry>
35608 <entry>Use: <emphasis>transports</emphasis></entry>
35609 <entry>Type: <emphasis>boolean</emphasis></entry>
35610 <entry>Default: <emphasis>false</emphasis></entry>
35611 </row>
35612 </tbody>
35613 </tgroup>
35614 </informaltable>
35615 <para>
35616 <indexterm role="concept">
35617 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
35618 </indexterm>
35619 If this option is true, an <emphasis>Envelope-to:</emphasis> header is added to the message.
35620 This gives the original address(es) in the incoming envelope that caused this
35621 delivery to happen. More than one address may be present if the transport is
35622 configured to handle several addresses at once, or if more than one original
35623 address was redirected to the same final address. As this is not a standard
35624 header, Exim has a configuration option (<option>envelope_to_remove</option>) which requests
35625 its removal from incoming messages, so that delivered messages can safely be
35626 resent to other recipients.
35627 </para>
35628 <para>
35629 <indexterm role="option">
35630 <primary><option>group</option></primary>
35631 </indexterm>
35632 </para>
35633 <informaltable frame="all">
35634 <tgroup cols="4" colsep="0" rowsep="0">
35635 <colspec colwidth="8*" align="left"/>
35636 <colspec colwidth="6*" align="center"/>
35637 <colspec colwidth="6*" align="center"/>
35638 <colspec colwidth="6*" align="right"/>
35639 <tbody>
35640 <row>
35641 <entry><option>group</option></entry>
35642 <entry>Use: <emphasis>transports</emphasis></entry>
35643 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35644 <entry>Default: <emphasis>Exim group</emphasis></entry>
35645 </row>
35646 </tbody>
35647 </tgroup>
35648 </informaltable>
35649 <para>
35650 <indexterm role="concept">
35651 <primary>transport</primary>
35652 <secondary>group; specifying</secondary>
35653 </indexterm>
35654 This option specifies a gid for running the transport process, overriding any
35655 value that the router supplies, and also overriding any value associated with
35656 <option>user</option> (see below).
35657 </para>
35658 <para>
35659 <indexterm role="option">
35660 <primary><option>headers_add</option></primary>
35661 </indexterm>
35662 </para>
35663 <informaltable frame="all">
35664 <tgroup cols="4" colsep="0" rowsep="0">
35665 <colspec colwidth="8*" align="left"/>
35666 <colspec colwidth="6*" align="center"/>
35667 <colspec colwidth="6*" align="center"/>
35668 <colspec colwidth="6*" align="right"/>
35669 <tbody>
35670 <row>
35671 <entry><option>headers_add</option></entry>
35672 <entry>Use: <emphasis>transports</emphasis></entry>
35673 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35674 <entry>Default: <emphasis>unset</emphasis></entry>
35675 </row>
35676 </tbody>
35677 </tgroup>
35678 </informaltable>
35679 <para>
35680 <indexterm role="concept">
35681 <primary>header lines</primary>
35682 <secondary>adding in transport</secondary>
35683 </indexterm>
35684 <indexterm role="concept">
35685 <primary>transport</primary>
35686 <secondary>header lines; adding</secondary>
35687 </indexterm>
35688 This option specifies a string of text that is expanded and added to the header
35689 portion of a message as it is transported, as described in section
35690 <xref linkend="SECTheadersaddrem"/>. Additional header lines can also be specified by
35691 routers. If the result of the expansion is an empty string, or if the expansion
35692 is forced to fail, no action is taken. Other expansion failures are treated as
35693 errors and cause the delivery to be deferred.
35694 </para>
35695 <para>
35696 <indexterm role="option">
35697 <primary><option>headers_only</option></primary>
35698 </indexterm>
35699 </para>
35700 <informaltable frame="all">
35701 <tgroup cols="4" colsep="0" rowsep="0">
35702 <colspec colwidth="8*" align="left"/>
35703 <colspec colwidth="6*" align="center"/>
35704 <colspec colwidth="6*" align="center"/>
35705 <colspec colwidth="6*" align="right"/>
35706 <tbody>
35707 <row>
35708 <entry><option>headers_only</option></entry>
35709 <entry>Use: <emphasis>transports</emphasis></entry>
35710 <entry>Type: <emphasis>boolean</emphasis></entry>
35711 <entry>Default: <emphasis>false</emphasis></entry>
35712 </row>
35713 </tbody>
35714 </tgroup>
35715 </informaltable>
35716 <para>
35717 <indexterm role="concept">
35718 <primary>transport</primary>
35719 <secondary>header lines only</secondary>
35720 </indexterm>
35721 <indexterm role="concept">
35722 <primary>message</primary>
35723 <secondary>transporting headers only</secondary>
35724 </indexterm>
35725 <indexterm role="concept">
35726 <primary>header lines</primary>
35727 <secondary>transporting</secondary>
35728 </indexterm>
35729 If this option is set, the message&#x2019;s body is not transported. It is mutually
35730 exclusive with <option>body_only</option>. If it is used with the <command>appendfile</command> or <command>pipe</command>
35731 transports, the settings of <option>message_prefix</option> and <option>message_suffix</option> should be
35732 checked, since this option does not automatically suppress them.
35733 </para>
35734 <para>
35735 <indexterm role="option">
35736 <primary><option>headers_remove</option></primary>
35737 </indexterm>
35738 </para>
35739 <informaltable frame="all">
35740 <tgroup cols="4" colsep="0" rowsep="0">
35741 <colspec colwidth="8*" align="left"/>
35742 <colspec colwidth="6*" align="center"/>
35743 <colspec colwidth="6*" align="center"/>
35744 <colspec colwidth="6*" align="right"/>
35745 <tbody>
35746 <row>
35747 <entry><option>headers_remove</option></entry>
35748 <entry>Use: <emphasis>transports</emphasis></entry>
35749 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35750 <entry>Default: <emphasis>unset</emphasis></entry>
35751 </row>
35752 </tbody>
35753 </tgroup>
35754 </informaltable>
35755 <para>
35756 <indexterm role="concept">
35757 <primary>header lines</primary>
35758 <secondary>removing</secondary>
35759 </indexterm>
35760 <indexterm role="concept">
35761 <primary>transport</primary>
35762 <secondary>header lines; removing</secondary>
35763 </indexterm>
35764 This option specifies a string that is expanded into a list of header names;
35765 these headers are omitted from the message as it is transported, as described
35766 in section <xref linkend="SECTheadersaddrem"/>. Header removal can also be specified by
35767 routers. If the result of the expansion is an empty string, or if the expansion
35768 is forced to fail, no action is taken. Other expansion failures are treated as
35769 errors and cause the delivery to be deferred.
35770 </para>
35771 <para>
35772 <indexterm role="option">
35773 <primary><option>headers_rewrite</option></primary>
35774 </indexterm>
35775 </para>
35776 <informaltable frame="all">
35777 <tgroup cols="4" colsep="0" rowsep="0">
35778 <colspec colwidth="8*" align="left"/>
35779 <colspec colwidth="6*" align="center"/>
35780 <colspec colwidth="6*" align="center"/>
35781 <colspec colwidth="6*" align="right"/>
35782 <tbody>
35783 <row>
35784 <entry><option>headers_rewrite</option></entry>
35785 <entry>Use: <emphasis>transports</emphasis></entry>
35786 <entry>Type: <emphasis>string</emphasis></entry>
35787 <entry>Default: <emphasis>unset</emphasis></entry>
35788 </row>
35789 </tbody>
35790 </tgroup>
35791 </informaltable>
35792 <para>
35793 <indexterm role="concept">
35794 <primary>transport</primary>
35795 <secondary>header lines; rewriting</secondary>
35796 </indexterm>
35797 <indexterm role="concept">
35798 <primary>rewriting</primary>
35799 <secondary>at transport time</secondary>
35800 </indexterm>
35801 This option allows addresses in header lines to be rewritten at transport time,
35802 that is, as the message is being copied to its destination. The contents of the
35803 option are a colon-separated list of rewriting rules. Each rule is in exactly
35804 the same form as one of the general rewriting rules that are applied when a
35805 message is received. These are described in chapter <xref linkend="CHAPrewrite"/>. For
35806 example,
35807 </para>
35808 <literallayout class="monospaced">
35809 headers_rewrite = a@b c@d f : \
35810                   x@y w@z
35811 </literallayout>
35812 <para>
35813 changes <emphasis>a@b</emphasis> into <emphasis>c@d</emphasis> in <emphasis>From:</emphasis> header lines, and <emphasis>x@y</emphasis> into
35814 <emphasis>w@z</emphasis> in all address-bearing header lines. The rules are applied to the
35815 header lines just before they are written out at transport time, so they affect
35816 only those copies of the message that pass through the transport. However, only
35817 the message&#x2019;s original header lines, and any that were added by a system
35818 filter, are rewritten. If a router or transport adds header lines, they are not
35819 affected by this option. These rewriting rules are <emphasis>not</emphasis> applied to the
35820 envelope. You can change the return path using <option>return_path</option>, but you cannot
35821 change envelope recipients at this time.
35822 </para>
35823 <para>
35824 <indexterm role="option">
35825 <primary><option>home_directory</option></primary>
35826 </indexterm>
35827 </para>
35828 <informaltable frame="all">
35829 <tgroup cols="4" colsep="0" rowsep="0">
35830 <colspec colwidth="8*" align="left"/>
35831 <colspec colwidth="6*" align="center"/>
35832 <colspec colwidth="6*" align="center"/>
35833 <colspec colwidth="6*" align="right"/>
35834 <tbody>
35835 <row>
35836 <entry><option>home_directory</option></entry>
35837 <entry>Use: <emphasis>transports</emphasis></entry>
35838 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35839 <entry>Default: <emphasis>unset</emphasis></entry>
35840 </row>
35841 </tbody>
35842 </tgroup>
35843 </informaltable>
35844 <para>
35845 <indexterm role="concept">
35846 <primary>transport</primary>
35847 <secondary>home directory for</secondary>
35848 </indexterm>
35849 <indexterm role="variable">
35850 <primary><varname>$home</varname></primary>
35851 </indexterm>
35852 This option specifies a home directory setting for a local transport,
35853 overriding any value that may be set by the router. The home directory is
35854 placed in <varname>$home</varname> while expanding the transport&#x2019;s private options. It is also
35855 used as the current directory if no current directory is set by the
35856 <option>current_directory</option> option on the transport or the
35857 <option>transport_current_directory</option> option on the router. If the expansion fails
35858 for any reason, including forced failure, an error is logged, and delivery is
35859 deferred.
35860 </para>
35861 <para>
35862 <indexterm role="option">
35863 <primary><option>initgroups</option></primary>
35864 </indexterm>
35865 </para>
35866 <informaltable frame="all">
35867 <tgroup cols="4" colsep="0" rowsep="0">
35868 <colspec colwidth="8*" align="left"/>
35869 <colspec colwidth="6*" align="center"/>
35870 <colspec colwidth="6*" align="center"/>
35871 <colspec colwidth="6*" align="right"/>
35872 <tbody>
35873 <row>
35874 <entry><option>initgroups</option></entry>
35875 <entry>Use: <emphasis>transports</emphasis></entry>
35876 <entry>Type: <emphasis>boolean</emphasis></entry>
35877 <entry>Default: <emphasis>false</emphasis></entry>
35878 </row>
35879 </tbody>
35880 </tgroup>
35881 </informaltable>
35882 <para>
35883 <indexterm role="concept">
35884 <primary>additional groups</primary>
35885 </indexterm>
35886 <indexterm role="concept">
35887 <primary>groups</primary>
35888 <secondary>additional</secondary>
35889 </indexterm>
35890 <indexterm role="concept">
35891 <primary>transport</primary>
35892 <secondary>group; additional</secondary>
35893 </indexterm>
35894 If this option is true and the uid for the delivery process is provided by the
35895 transport, the <function>initgroups()</function> function is called when running the transport
35896 to ensure that any additional groups associated with the uid are set up.
35897 </para>
35898 <para>
35899 <indexterm role="option">
35900 <primary><option>message_size_limit</option></primary>
35901 </indexterm>
35902 </para>
35903 <informaltable frame="all">
35904 <tgroup cols="4" colsep="0" rowsep="0">
35905 <colspec colwidth="8*" align="left"/>
35906 <colspec colwidth="6*" align="center"/>
35907 <colspec colwidth="6*" align="center"/>
35908 <colspec colwidth="6*" align="right"/>
35909 <tbody>
35910 <row>
35911 <entry><option>message_size_limit</option></entry>
35912 <entry>Use: <emphasis>transports</emphasis></entry>
35913 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35914 <entry>Default: <emphasis>0</emphasis></entry>
35915 </row>
35916 </tbody>
35917 </tgroup>
35918 </informaltable>
35919 <para>
35920 <indexterm role="concept">
35921 <primary>limit</primary>
35922 <secondary>message size per transport</secondary>
35923 </indexterm>
35924 <indexterm role="concept">
35925 <primary>size</primary>
35926 <secondary>of message, limit</secondary>
35927 </indexterm>
35928 <indexterm role="concept">
35929 <primary>transport</primary>
35930 <secondary>message size; limiting</secondary>
35931 </indexterm>
35932 This option controls the size of messages passed through the transport. It is
35933 expanded before use; the result of the expansion must be a sequence of decimal
35934 digits, optionally followed by K or M. If the expansion fails for any reason,
35935 including forced failure, or if the result is not of the required form,
35936 delivery is deferred. If the value is greater than zero and the size of a
35937 message exceeds this limit, the address is failed. If there is any chance that
35938 the resulting bounce message could be routed to the same transport, you should
35939 ensure that <option>return_size_limit</option> is less than the transport&#x2019;s
35940 <option>message_size_limit</option>, as otherwise the bounce message will fail to get
35941 delivered.
35942 </para>
35943 <para>
35944 <indexterm role="option">
35945 <primary><option>rcpt_include_affixes</option></primary>
35946 </indexterm>
35947 </para>
35948 <informaltable frame="all">
35949 <tgroup cols="4" colsep="0" rowsep="0">
35950 <colspec colwidth="8*" align="left"/>
35951 <colspec colwidth="6*" align="center"/>
35952 <colspec colwidth="6*" align="center"/>
35953 <colspec colwidth="6*" align="right"/>
35954 <tbody>
35955 <row>
35956 <entry><option>rcpt_include_affixes</option></entry>
35957 <entry>Use: <emphasis>transports</emphasis></entry>
35958 <entry>Type: <emphasis>boolean</emphasis></entry>
35959 <entry>Default: <emphasis>false</emphasis></entry>
35960 </row>
35961 </tbody>
35962 </tgroup>
35963 </informaltable>
35964 <para>
35965 <indexterm role="concept">
35966 <primary>prefix</primary>
35967 <secondary>for local part, including in envelope</secondary>
35968 </indexterm>
35969 <indexterm role="concept">
35970 <primary>suffix for local part</primary>
35971 <secondary>including in envelope</secondary>
35972 </indexterm>
35973 <indexterm role="concept">
35974 <primary>local part</primary>
35975 <secondary>prefix</secondary>
35976 </indexterm>
35977 <indexterm role="concept">
35978 <primary>local part</primary>
35979 <secondary>suffix</secondary>
35980 </indexterm>
35981 When this option is false (the default), and an address that has had any
35982 affixes (prefixes or suffixes) removed from the local part is delivered by any
35983 form of SMTP or LMTP, the affixes are not included. For example, if a router
35984 that contains
35985 </para>
35986 <literallayout class="monospaced">
35987 local_part_prefix = *-
35988 </literallayout>
35989 <para>
35990 routes the address <emphasis>abc-xyz@some.domain</emphasis> to an SMTP transport, the envelope
35991 is delivered with
35992 </para>
35993 <literallayout class="monospaced">
35994 RCPT TO:&lt;xyz@some.domain&gt;
35995 </literallayout>
35996 <para>
35997 This is also the case when an ACL-time callout is being used to verify a
35998 recipient address. However, if <option>rcpt_include_affixes</option> is set true, the
35999 whole local part is included in the RCPT command. This option applies to BSMTP
36000 deliveries by the <command>appendfile</command> and <command>pipe</command> transports as well as to the
36001 <command>lmtp</command> and <command>smtp</command> transports.
36002 </para>
36003 <para>
36004 <indexterm role="option">
36005 <primary><option>retry_use_local_part</option></primary>
36006 </indexterm>
36007 </para>
36008 <informaltable frame="all">
36009 <tgroup cols="4" colsep="0" rowsep="0">
36010 <colspec colwidth="8*" align="left"/>
36011 <colspec colwidth="6*" align="center"/>
36012 <colspec colwidth="6*" align="center"/>
36013 <colspec colwidth="6*" align="right"/>
36014 <tbody>
36015 <row>
36016 <entry><option>retry_use_local_part</option></entry>
36017 <entry>Use: <emphasis>transports</emphasis></entry>
36018 <entry>Type: <emphasis>boolean</emphasis></entry>
36019 <entry>Default: <emphasis>see below</emphasis></entry>
36020 </row>
36021 </tbody>
36022 </tgroup>
36023 </informaltable>
36024 <para>
36025 <indexterm role="concept">
36026 <primary>hints database</primary>
36027 <secondary>retry keys</secondary>
36028 </indexterm>
36029 When a delivery suffers a temporary failure, a retry record is created
36030 in Exim&#x2019;s hints database. For remote deliveries, the key for the retry record
36031 is based on the name and/or IP address of the failing remote host. For local
36032 deliveries, the key is normally the entire address, including both the local
36033 part and the domain. This is suitable for most common cases of local delivery
36034 temporary failure &ndash; for example, exceeding a mailbox quota should delay only
36035 deliveries to that mailbox, not to the whole domain.
36036 </para>
36037 <para>
36038 However, in some special cases you may want to treat a temporary local delivery
36039 as a failure associated with the domain, and not with a particular local part.
36040 (For example, if you are storing all mail for some domain in files.) You can do
36041 this by setting <option>retry_use_local_part</option> false.
36042 </para>
36043 <para>
36044 For all the local transports, its default value is true. For remote transports,
36045 the default value is false for tidiness, but changing the value has no effect
36046 on a remote transport in the current implementation.
36047 </para>
36048 <para>
36049 <indexterm role="option">
36050 <primary><option>return_path</option></primary>
36051 </indexterm>
36052 </para>
36053 <informaltable frame="all">
36054 <tgroup cols="4" colsep="0" rowsep="0">
36055 <colspec colwidth="8*" align="left"/>
36056 <colspec colwidth="6*" align="center"/>
36057 <colspec colwidth="6*" align="center"/>
36058 <colspec colwidth="6*" align="right"/>
36059 <tbody>
36060 <row>
36061 <entry><option>return_path</option></entry>
36062 <entry>Use: <emphasis>transports</emphasis></entry>
36063 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36064 <entry>Default: <emphasis>unset</emphasis></entry>
36065 </row>
36066 </tbody>
36067 </tgroup>
36068 </informaltable>
36069 <para>
36070 <indexterm role="concept">
36071 <primary>envelope sender</primary>
36072 </indexterm>
36073 <indexterm role="concept">
36074 <primary>transport</primary>
36075 <secondary>return path; changing</secondary>
36076 </indexterm>
36077 <indexterm role="concept">
36078 <primary>return path</primary>
36079 <secondary>changing in transport</secondary>
36080 </indexterm>
36081 If this option is set, the string is expanded at transport time and replaces
36082 the existing return path (envelope sender) value in the copy of the message
36083 that is being delivered. An empty return path is permitted. This feature is
36084 designed for remote deliveries, where the value of this option is used in the
36085 SMTP MAIL command. If you set <option>return_path</option> for a local transport, the
36086 only effect is to change the address that is placed in the <emphasis>Return-path:</emphasis>
36087 header line, if one is added to the message (see the next option).
36088 </para>
36089 <para>
36090 <emphasis role="bold">Note:</emphasis> A changed return path is not logged unless you add
36091 <option>return_path_on_delivery</option> to the log selector.
36092 </para>
36093 <para>
36094 <indexterm role="variable">
36095 <primary><varname>$return_path</varname></primary>
36096 </indexterm>
36097 The expansion can refer to the existing value via <varname>$return_path</varname>. This is
36098 either the message&#x2019;s envelope sender, or an address set by the
36099 <option>errors_to</option> option on a router. If the expansion is forced to fail, no
36100 replacement occurs; if it fails for another reason, delivery is deferred. This
36101 option can be used to support VERP (Variable Envelope Return Paths) &ndash; see
36102 section <xref linkend="SECTverp"/>.
36103 </para>
36104 <para>
36105 <emphasis role="bold">Note</emphasis>: If a delivery error is detected locally, including the case when a
36106 remote server rejects a message at SMTP time, the bounce message is not sent to
36107 the value of this option. It is sent to the previously set errors address.
36108 This defaults to the incoming sender address, but can be changed by setting
36109 <option>errors_to</option> in a router.
36110 </para>
36111 <para>
36112 <indexterm role="option">
36113 <primary><option>return_path_add</option></primary>
36114 </indexterm>
36115 </para>
36116 <informaltable frame="all">
36117 <tgroup cols="4" colsep="0" rowsep="0">
36118 <colspec colwidth="8*" align="left"/>
36119 <colspec colwidth="6*" align="center"/>
36120 <colspec colwidth="6*" align="center"/>
36121 <colspec colwidth="6*" align="right"/>
36122 <tbody>
36123 <row>
36124 <entry><option>return_path_add</option></entry>
36125 <entry>Use: <emphasis>transports</emphasis></entry>
36126 <entry>Type: <emphasis>boolean</emphasis></entry>
36127 <entry>Default: <emphasis>false</emphasis></entry>
36128 </row>
36129 </tbody>
36130 </tgroup>
36131 </informaltable>
36132 <para>
36133 <indexterm role="concept">
36134 <primary><emphasis>Return-path:</emphasis> header line</primary>
36135 </indexterm>
36136 If this option is true, a <emphasis>Return-path:</emphasis> header is added to the message.
36137 Although the return path is normally available in the prefix line of BSD
36138 mailboxes, this is commonly not displayed by MUAs, and so the user does not
36139 have easy access to it.
36140 </para>
36141 <para>
36142 RFC 2821 states that the <emphasis>Return-path:</emphasis> header is added to a message <quote>when
36143 the delivery SMTP server makes the final delivery</quote>. This implies that this
36144 header should not be present in incoming messages. Exim has a configuration
36145 option, <option>return_path_remove</option>, which requests removal of this header from
36146 incoming messages, so that delivered messages can safely be resent to other
36147 recipients.
36148 </para>
36149 <para>
36150 <indexterm role="option">
36151 <primary><option>shadow_condition</option></primary>
36152 </indexterm>
36153 </para>
36154 <informaltable frame="all">
36155 <tgroup cols="4" colsep="0" rowsep="0">
36156 <colspec colwidth="8*" align="left"/>
36157 <colspec colwidth="6*" align="center"/>
36158 <colspec colwidth="6*" align="center"/>
36159 <colspec colwidth="6*" align="right"/>
36160 <tbody>
36161 <row>
36162 <entry><option>shadow_condition</option></entry>
36163 <entry>Use: <emphasis>transports</emphasis></entry>
36164 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36165 <entry>Default: <emphasis>unset</emphasis></entry>
36166 </row>
36167 </tbody>
36168 </tgroup>
36169 </informaltable>
36170 <para>
36171 See <option>shadow_transport</option> below.
36172 </para>
36173 <para>
36174 <indexterm role="option">
36175 <primary><option>shadow_transport</option></primary>
36176 </indexterm>
36177 </para>
36178 <informaltable frame="all">
36179 <tgroup cols="4" colsep="0" rowsep="0">
36180 <colspec colwidth="8*" align="left"/>
36181 <colspec colwidth="6*" align="center"/>
36182 <colspec colwidth="6*" align="center"/>
36183 <colspec colwidth="6*" align="right"/>
36184 <tbody>
36185 <row>
36186 <entry><option>shadow_transport</option></entry>
36187 <entry>Use: <emphasis>transports</emphasis></entry>
36188 <entry>Type: <emphasis>string</emphasis></entry>
36189 <entry>Default: <emphasis>unset</emphasis></entry>
36190 </row>
36191 </tbody>
36192 </tgroup>
36193 </informaltable>
36194 <para>
36195 <indexterm role="concept">
36196 <primary>shadow transport</primary>
36197 </indexterm>
36198 <indexterm role="concept">
36199 <primary>transport</primary>
36200 <secondary>shadow</secondary>
36201 </indexterm>
36202 A local transport may set the <option>shadow_transport</option> option to the name of
36203 another local transport. Shadow remote transports are not supported.
36204 </para>
36205 <para>
36206 Whenever a delivery to the main transport succeeds, and either
36207 <option>shadow_condition</option> is unset, or its expansion does not result in the empty
36208 string or one of the strings <quote>0</quote> or <quote>no</quote> or <quote>false</quote>, the message is also
36209 passed to the shadow transport, with the same delivery address or addresses. If
36210 expansion fails, no action is taken except that non-forced expansion failures
36211 cause a log line to be written.
36212 </para>
36213 <para>
36214 The result of the shadow transport is discarded and does not affect the
36215 subsequent processing of the message. Only a single level of shadowing is
36216 provided; the <option>shadow_transport</option> option is ignored on any transport when it
36217 is running as a shadow. Options concerned with output from pipes are also
36218 ignored. The log line for the successful delivery has an item added on the end,
36219 of the form
36220 </para>
36221 <literallayout class="monospaced">
36222 ST=&lt;shadow transport name&gt;
36223 </literallayout>
36224 <para>
36225 If the shadow transport did not succeed, the error message is put in
36226 parentheses afterwards. Shadow transports can be used for a number of different
36227 purposes, including keeping more detailed log information than Exim normally
36228 provides, and implementing automatic acknowledgment policies based on message
36229 headers that some sites insist on.
36230 </para>
36231 <para>
36232 <indexterm role="option">
36233 <primary><option>transport_filter</option></primary>
36234 </indexterm>
36235 </para>
36236 <informaltable frame="all">
36237 <tgroup cols="4" colsep="0" rowsep="0">
36238 <colspec colwidth="8*" align="left"/>
36239 <colspec colwidth="6*" align="center"/>
36240 <colspec colwidth="6*" align="center"/>
36241 <colspec colwidth="6*" align="right"/>
36242 <tbody>
36243 <row>
36244 <entry><option>transport_filter</option></entry>
36245 <entry>Use: <emphasis>transports</emphasis></entry>
36246 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36247 <entry>Default: <emphasis>unset</emphasis></entry>
36248 </row>
36249 </tbody>
36250 </tgroup>
36251 </informaltable>
36252 <para>
36253 <indexterm role="concept">
36254 <primary>transport</primary>
36255 <secondary>filter</secondary>
36256 </indexterm>
36257 <indexterm role="concept">
36258 <primary>filter</primary>
36259 <secondary>transport filter</secondary>
36260 </indexterm>
36261 This option sets up a filtering (in the Unix shell sense) process for messages
36262 at transport time. It should not be confused with mail filtering as set up by
36263 individual users or via a system filter.
36264 </para>
36265 <para>
36266 When the message is about to be written out, the command specified by
36267 <option>transport_filter</option> is started up in a separate, parallel process, and
36268 the entire message, including the header lines, is passed to it on its standard
36269 input (this in fact is done from a third process, to avoid deadlock). The
36270 command must be specified as an absolute path.
36271 </para>
36272 <para>
36273 The lines of the message that are written to the transport filter are
36274 terminated by newline (<quote>\n</quote>). The message is passed to the filter before any
36275 SMTP-specific processing, such as turning <quote>\n</quote> into <quote>\r\n</quote> and escaping
36276 lines beginning with a dot, and also before any processing implied by the
36277 settings of <option>check_string</option> and <option>escape_string</option> in the <command>appendfile</command> or
36278 <command>pipe</command> transports.
36279 </para>
36280 <para>
36281 The standard error for the filter process is set to the same destination as its
36282 standard output; this is read and written to the message&#x2019;s ultimate
36283 destination. The process that writes the message to the filter, the
36284 filter itself, and the original process that reads the result and delivers it
36285 are all run in parallel, like a shell pipeline.
36286 </para>
36287 <para>
36288 The filter can perform any transformations it likes, but of course should take
36289 care not to break RFC 2822 syntax. Exim does not check the result, except to
36290 test for a final newline when SMTP is in use. All messages transmitted over
36291 SMTP must end with a newline, so Exim supplies one if it is missing.
36292 </para>
36293 <para>
36294 <indexterm role="concept">
36295 <primary>content scanning</primary>
36296 <secondary>per user</secondary>
36297 </indexterm>
36298 A transport filter can be used to provide content-scanning on a per-user basis
36299 at delivery time if the only required effect of the scan is to modify the
36300 message. For example, a content scan could insert a new header line containing
36301 a spam score. This could be interpreted by a filter in the user&#x2019;s MUA. It is
36302 not possible to discard a message at this stage.
36303 </para>
36304 <para>
36305 <indexterm role="concept">
36306 <primary>SMTP</primary>
36307 <secondary>SIZE</secondary>
36308 </indexterm>
36309 A problem might arise if the filter increases the size of a message that is
36310 being sent down an SMTP connection. If the receiving SMTP server has indicated
36311 support for the SIZE parameter, Exim will have sent the size of the message
36312 at the start of the SMTP session. If what is actually sent is substantially
36313 more, the server might reject the message. This can be worked round by setting
36314 the <option>size_addition</option> option on the <command>smtp</command> transport, either to allow for
36315 additions to the message, or to disable the use of SIZE altogether.
36316 </para>
36317 <para>
36318 <indexterm role="variable">
36319 <primary><varname>$pipe_addresses</varname></primary>
36320 </indexterm>
36321 The value of the <option>transport_filter</option> option is the command string for starting
36322 the filter, which is run directly from Exim, not under a shell. The string is
36323 parsed by Exim in the same way as a command string for the <command>pipe</command> transport:
36324 Exim breaks it up into arguments and then expands each argument separately (see
36325 section <xref linkend="SECThowcommandrun"/>). Any kind of expansion failure causes delivery
36326 to be deferred. The special argument <varname>$pipe_addresses</varname> is replaced by a number
36327 of arguments, one for each address that applies to this delivery. (This isn&#x2019;t
36328 an ideal name for this feature here, but as it was already implemented for the
36329 <command>pipe</command> transport, it seemed sensible not to change it.)
36330 </para>
36331 <para>
36332 <indexterm role="variable">
36333 <primary><varname>$host</varname></primary>
36334 </indexterm>
36335 <indexterm role="variable">
36336 <primary><varname>$host_address</varname></primary>
36337 </indexterm>
36338 The expansion variables <varname>$host</varname> and <varname>$host_address</varname> are available when the
36339 transport is a remote one. They contain the name and IP address of the host to
36340 which the message is being sent. For example:
36341 </para>
36342 <literallayout class="monospaced">
36343 transport_filter = /some/directory/transport-filter.pl \
36344   $host $host_address $sender_address $pipe_addresses
36345 </literallayout>
36346 <para>
36347 Two problems arise if you want to use more complicated expansion items to
36348 generate transport filter commands, both of which due to the fact that the
36349 command is split up <emphasis>before</emphasis> expansion.
36350 </para>
36351 <itemizedlist>
36352 <listitem>
36353 <para>
36354 If an expansion item contains white space, you must quote it, so that it is all
36355 part of the same command item. If the entire option setting is one such
36356 expansion item, you have to take care what kind of quoting you use. For
36357 example:
36358 </para>
36359 <literallayout class="monospaced">
36360 transport_filter = '/bin/cmd${if eq{$host}{a.b.c}{1}{2}}'
36361 </literallayout>
36362 <para>
36363 This runs the command <command>/bin/cmd1</command> if the host name is <emphasis>a.b.c</emphasis>, and
36364 <command>/bin/cmd2</command> otherwise. If double quotes had been used, they would have been
36365 stripped by Exim when it read the option&#x2019;s value. When the value is used, if
36366 the single quotes were missing, the line would be split into two items,
36367 <literal>/bin/cmd${if</literal> and <literal>eq{$host}{a.b.c}{1}{2}</literal>, and an error would occur when
36368 Exim tried to expand the first one.
36369 </para>
36370 </listitem>
36371 <listitem>
36372 <para>
36373 Except for the special case of <varname>$pipe_addresses</varname> that is mentioned above, an
36374 expansion cannot generate multiple arguments, or a command name followed by
36375 arguments. Consider this example:
36376 </para>
36377 <literallayout class="monospaced">
36378 transport_filter = ${lookup{$host}lsearch{/a/file}\
36379                     {$value}{/bin/cat}}
36380 </literallayout>
36381 <para>
36382 The result of the lookup is interpreted as the name of the command, even
36383 if it contains white space. The simplest way round this is to use a shell:
36384 </para>
36385 <literallayout class="monospaced">
36386 transport_filter = /bin/sh -c ${lookup{$host}lsearch{/a/file}\
36387                                {$value}{/bin/cat}}
36388 </literallayout>
36389 </listitem>
36390 </itemizedlist>
36391 <para>
36392 The filter process is run under the same uid and gid as the normal delivery.
36393 For remote deliveries this is the Exim uid/gid by default. The command should
36394 normally yield a zero return code. Transport filters are not supposed to fail.
36395 A non-zero code is taken to mean that the transport filter encountered some
36396 serious problem. Delivery of the message is deferred; the message remains on
36397 the queue and is tried again later. It is not possible to cause a message to be
36398 bounced from a transport filter.
36399 </para>
36400 <para>
36401 If a transport filter is set on an autoreply transport, the original message is
36402 passed through the filter as it is being copied into the newly generated
36403 message, which happens if the <option>return_message</option> option is set.
36404 </para>
36405 <para>
36406 <indexterm role="option">
36407 <primary><option>transport_filter_timeout</option></primary>
36408 </indexterm>
36409 </para>
36410 <informaltable frame="all">
36411 <tgroup cols="4" colsep="0" rowsep="0">
36412 <colspec colwidth="8*" align="left"/>
36413 <colspec colwidth="6*" align="center"/>
36414 <colspec colwidth="6*" align="center"/>
36415 <colspec colwidth="6*" align="right"/>
36416 <tbody>
36417 <row>
36418 <entry><option>transport_filter_timeout</option></entry>
36419 <entry>Use: <emphasis>transports</emphasis></entry>
36420 <entry>Type: <emphasis>time</emphasis></entry>
36421 <entry>Default: <emphasis>5m</emphasis></entry>
36422 </row>
36423 </tbody>
36424 </tgroup>
36425 </informaltable>
36426 <para>
36427 <indexterm role="concept">
36428 <primary>transport</primary>
36429 <secondary>filter, timeout</secondary>
36430 </indexterm>
36431 When Exim is reading the output of a transport filter, it a applies a timeout
36432 that can be set by this option. Exceeding the timeout is normally treated as a
36433 temporary delivery failure. However, if a transport filter is used with a
36434 <command>pipe</command> transport, a timeout in the transport filter is treated in the same
36435 way as a timeout in the pipe command itself. By default, a timeout is a hard
36436 error, but if the <command>pipe</command> transport&#x2019;s <option>timeout_defer</option> option is set true, it
36437 becomes a temporary error.
36438 </para>
36439 <para>
36440 <indexterm role="option">
36441 <primary><option>user</option></primary>
36442 </indexterm>
36443 </para>
36444 <informaltable frame="all">
36445 <tgroup cols="4" colsep="0" rowsep="0">
36446 <colspec colwidth="8*" align="left"/>
36447 <colspec colwidth="6*" align="center"/>
36448 <colspec colwidth="6*" align="center"/>
36449 <colspec colwidth="6*" align="right"/>
36450 <tbody>
36451 <row>
36452 <entry><option>user</option></entry>
36453 <entry>Use: <emphasis>transports</emphasis></entry>
36454 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36455 <entry>Default: <emphasis>Exim user</emphasis></entry>
36456 </row>
36457 </tbody>
36458 </tgroup>
36459 </informaltable>
36460 <para>
36461 <indexterm role="concept">
36462 <primary>uid (user id)</primary>
36463 <secondary>local delivery</secondary>
36464 </indexterm>
36465 <indexterm role="concept">
36466 <primary>transport</primary>
36467 <secondary>user, specifying</secondary>
36468 </indexterm>
36469 This option specifies the user under whose uid the delivery process is to be
36470 run, overriding any uid that may have been set by the router. If the user is
36471 given as a name, the uid is looked up from the password data, and the
36472 associated group is taken as the value of the gid to be used if the <option>group</option>
36473 option is not set.
36474 </para>
36475 <para>
36476 For deliveries that use local transports, a user and group are normally
36477 specified explicitly or implicitly (for example, as a result of
36478 <option>check_local_user</option>) by the router or transport.
36479 </para>
36480 <para>
36481 <indexterm role="concept">
36482 <primary>hints database</primary>
36483 <secondary>access by remote transport</secondary>
36484 </indexterm>
36485 For remote transports, you should leave this option unset unless you really are
36486 sure you know what you are doing. When a remote transport is running, it needs
36487 to be able to access Exim&#x2019;s hints databases, because each host may have its own
36488 retry data.
36489 <indexterm role="concept" startref="IIDgenoptra1" class="endofrange"/>
36490 <indexterm role="concept" startref="IIDgenoptra2" class="endofrange"/>
36491 <indexterm role="concept" startref="IIDgenoptra3" class="endofrange"/>
36492 </para>
36493 </chapter>
36494
36495 <chapter id="CHAPbatching">
36496 <title>Address batching in local transports</title>
36497 <titleabbrev>Address batching</titleabbrev>
36498 <para>
36499 <indexterm role="concept">
36500 <primary>transport</primary>
36501 <secondary>local; address batching in</secondary>
36502 </indexterm>
36503 The only remote transport (<command>smtp</command>) is normally configured to handle more than
36504 one address at a time, so that when several addresses are routed to the same
36505 remote host, just one copy of the message is sent. Local transports, however,
36506 normally handle one address at a time. That is, a separate instance of the
36507 transport is run for each address that is routed to the transport. A separate
36508 copy of the message is delivered each time.
36509 </para>
36510 <para>
36511 <indexterm role="concept">
36512 <primary>batched local delivery</primary>
36513 </indexterm>
36514 <indexterm role="option">
36515 <primary><option>batch_max</option></primary>
36516 </indexterm>
36517 <indexterm role="option">
36518 <primary><option>batch_id</option></primary>
36519 </indexterm>
36520 In special cases, it may be desirable to handle several addresses at once in a
36521 local transport, for example:
36522 </para>
36523 <itemizedlist>
36524 <listitem>
36525 <para>
36526 In an <command>appendfile</command> transport, when storing messages in files for later
36527 delivery by some other means, a single copy of the message with multiple
36528 recipients saves space.
36529 </para>
36530 </listitem>
36531 <listitem>
36532 <para>
36533 In an <command>lmtp</command> transport, when delivering over <quote>local SMTP</quote> to some process,
36534 a single copy saves time, and is the normal way LMTP is expected to work.
36535 </para>
36536 </listitem>
36537 <listitem>
36538 <para>
36539 In a <command>pipe</command> transport, when passing the message
36540 to a scanner program or
36541 to some other delivery mechanism such as UUCP, multiple recipients may be
36542 acceptable.
36543 </para>
36544 </listitem>
36545 </itemizedlist>
36546 <para>
36547 These three local transports all have the same options for controlling multiple
36548 (<quote>batched</quote>) deliveries, namely <option>batch_max</option> and <option>batch_id</option>. To save
36549 repeating the information for each transport, these options are described here.
36550 </para>
36551 <para>
36552 The <option>batch_max</option> option specifies the maximum number of addresses that can be
36553 delivered together in a single run of the transport. Its default value is one
36554 (no batching). When more than one address is routed to a transport that has a
36555 <option>batch_max</option> value greater than one, the addresses are delivered in a batch
36556 (that is, in a single run of the transport with multiple recipients), subject
36557 to certain conditions:
36558 </para>
36559 <itemizedlist>
36560 <listitem>
36561 <para>
36562 <indexterm role="variable">
36563 <primary><varname>$local_part</varname></primary>
36564 </indexterm>
36565 If any of the transport&#x2019;s options contain a reference to <varname>$local_part</varname>, no
36566 batching is possible.
36567 </para>
36568 </listitem>
36569 <listitem>
36570 <para>
36571 <indexterm role="variable">
36572 <primary><varname>$domain</varname></primary>
36573 </indexterm>
36574 If any of the transport&#x2019;s options contain a reference to <varname>$domain</varname>, only
36575 addresses with the same domain are batched.
36576 </para>
36577 </listitem>
36578 <listitem>
36579 <para>
36580 <indexterm role="concept">
36581 <primary>customizing</primary>
36582 <secondary>batching condition</secondary>
36583 </indexterm>
36584 If <option>batch_id</option> is set, it is expanded for each address, and only those
36585 addresses with the same expanded value are batched. This allows you to specify
36586 customized batching conditions. Failure of the expansion for any reason,
36587 including forced failure, disables batching, but it does not stop the delivery
36588 from taking place.
36589 </para>
36590 </listitem>
36591 <listitem>
36592 <para>
36593 Batched addresses must also have the same errors address (where to send
36594 delivery errors), the same header additions and removals, the same user and
36595 group for the transport, and if a host list is present, the first host must
36596 be the same.
36597 </para>
36598 </listitem>
36599 </itemizedlist>
36600 <para>
36601 In the case of the <command>appendfile</command> and <command>pipe</command> transports, batching applies
36602 both when the file or pipe command is specified in the transport, and when it
36603 is specified by a <command>redirect</command> router, but all the batched addresses must of
36604 course be routed to the same file or pipe command. These two transports have an
36605 option called <option>use_bsmtp</option>, which causes them to deliver the message in
36606 <quote>batched SMTP</quote> format, with the envelope represented as SMTP commands. The
36607 <option>check_string</option> and <option>escape_string</option> options are forced to the values
36608 </para>
36609 <literallayout class="monospaced">
36610 check_string = "."
36611 escape_string = ".."
36612 </literallayout>
36613 <para>
36614 when batched SMTP is in use. A full description of the batch SMTP mechanism is
36615 given in section <xref linkend="SECTbatchSMTP"/>. The <command>lmtp</command> transport does not have a
36616 <option>use_bsmtp</option> option, because it always delivers using the SMTP protocol.
36617 </para>
36618 <para>
36619 <indexterm role="concept">
36620 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
36621 </indexterm>
36622 If the generic <option>envelope_to_add</option> option is set for a batching transport, the
36623 <emphasis>Envelope-to:</emphasis> header that is added to the message contains all the addresses
36624 that are being processed together. If you are using a batching <command>appendfile</command>
36625 transport without <option>use_bsmtp</option>, the only way to preserve the recipient
36626 addresses is to set the <option>envelope_to_add</option> option.
36627 </para>
36628 <para>
36629 <indexterm role="concept">
36630 <primary><command>pipe</command> transport</primary>
36631 <secondary>with multiple addresses</secondary>
36632 </indexterm>
36633 <indexterm role="variable">
36634 <primary><varname>$pipe_addresses</varname></primary>
36635 </indexterm>
36636 If you are using a <command>pipe</command> transport without BSMTP, and setting the
36637 transport&#x2019;s <option>command</option> option, you can include <varname>$pipe_addresses</varname> as part of
36638 the command. This is not a true variable; it is a bit of magic that causes each
36639 of the recipient addresses to be inserted into the command as a separate
36640 argument. This provides a way of accessing all the addresses that are being
36641 delivered in the batch. <emphasis role="bold">Note:</emphasis> This is not possible for pipe commands that
36642 are specified by a <command>redirect</command> router.
36643 </para>
36644 </chapter>
36645
36646 <chapter id="CHAPappendfile">
36647 <title>The appendfile transport</title>
36648 <para>
36649 <indexterm role="concept" id="IIDapptra1" class="startofrange">
36650 <primary><command>appendfile</command> transport</primary>
36651 </indexterm>
36652 <indexterm role="concept" id="IIDapptra2" class="startofrange">
36653 <primary>transports</primary>
36654 <secondary><command>appendfile</command></secondary>
36655 </indexterm>
36656 <indexterm role="concept">
36657 <primary>directory creation</primary>
36658 </indexterm>
36659 <indexterm role="concept">
36660 <primary>creating directories</primary>
36661 </indexterm>
36662 The <command>appendfile</command> transport delivers a message by appending it to an existing
36663 file, or by creating an entirely new file in a specified directory. Single
36664 files to which messages are appended can be in the traditional Unix mailbox
36665 format, or optionally in the MBX format supported by the Pine MUA and
36666 University of Washington IMAP daemon, <emphasis>inter alia</emphasis>. When each message is
36667 being delivered as a separate file, <quote>maildir</quote> format can optionally be used
36668 to give added protection against failures that happen part-way through the
36669 delivery. A third form of separate-file delivery known as <quote>mailstore</quote> is also
36670 supported. For all file formats, Exim attempts to create as many levels of
36671 directory as necessary, provided that <option>create_directory</option> is set.
36672 </para>
36673 <para>
36674 The code for the optional formats is not included in the Exim binary by
36675 default. It is necessary to set SUPPORT_MBX, SUPPORT_MAILDIR and/or
36676 SUPPORT_MAILSTORE in <filename>Local/Makefile</filename> to have the appropriate code
36677 included.
36678 </para>
36679 <para>
36680 <indexterm role="concept">
36681 <primary>quota</primary>
36682 <secondary>system</secondary>
36683 </indexterm>
36684 Exim recognizes system quota errors, and generates an appropriate message. Exim
36685 also supports its own quota control within the transport, for use when the
36686 system facility is unavailable or cannot be used for some reason.
36687 </para>
36688 <para>
36689 If there is an error while appending to a file (for example, quota exceeded or
36690 partition filled), Exim attempts to reset the file&#x2019;s length and last
36691 modification time back to what they were before. If there is an error while
36692 creating an entirely new file, the new file is removed.
36693 </para>
36694 <para>
36695 Before appending to a file, a number of security checks are made, and the
36696 file is locked. A detailed description is given below, after the list of
36697 private options.
36698 </para>
36699 <para>
36700 The <command>appendfile</command> transport is most commonly used for local deliveries to
36701 users&#x2019; mailboxes. However, it can also be used as a pseudo-remote transport for
36702 putting messages into files for remote delivery by some means other than Exim.
36703 <quote>Batch SMTP</quote> format is often used in this case (see the <option>use_bsmtp</option>
36704 option).
36705 </para>
36706 <section id="SECTfildiropt">
36707 <title>The file and directory options</title>
36708 <para>
36709 The <option>file</option> option specifies a single file, to which the message is appended;
36710 the <option>directory</option> option specifies a directory, in which a new file containing
36711 the message is created. Only one of these two options can be set, and for
36712 normal deliveries to mailboxes, one of them <emphasis>must</emphasis> be set.
36713 </para>
36714 <para>
36715 <indexterm role="variable">
36716 <primary><varname>$address_file</varname></primary>
36717 </indexterm>
36718 <indexterm role="variable">
36719 <primary><varname>$local_part</varname></primary>
36720 </indexterm>
36721 However, <command>appendfile</command> is also used for delivering messages to files or
36722 directories whose names (or parts of names) are obtained from alias,
36723 forwarding, or filtering operations (for example, a <option>save</option> command in a
36724 user&#x2019;s Exim filter). When such a transport is running, <varname>$local_part</varname> contains
36725 the local part that was aliased or forwarded, and <varname>$address_file</varname> contains the
36726 name (or partial name) of the file or directory generated by the redirection
36727 operation. There are two cases:
36728 </para>
36729 <itemizedlist>
36730 <listitem>
36731 <para>
36732 If neither <option>file</option> nor <option>directory</option> is set, the redirection operation
36733 must specify an absolute path (one that begins with <literal>/</literal>). This is the most
36734 common case when users with local accounts use filtering to sort mail into
36735 different folders. See for example, the <command>address_file</command> transport in the
36736 default configuration. If the path ends with a slash, it is assumed to be the
36737 name of a directory. A delivery to a directory can also be forced by setting
36738 <option>maildir_format</option> or <option>mailstore_format</option>.
36739 </para>
36740 </listitem>
36741 <listitem>
36742 <para>
36743 If <option>file</option> or <option>directory</option> is set for a delivery from a redirection, it is
36744 used to determine the file or directory name for the delivery. Normally, the
36745 contents of <varname>$address_file</varname> are used in some way in the string expansion.
36746 </para>
36747 </listitem>
36748 </itemizedlist>
36749 <para>
36750 <indexterm role="concept">
36751 <primary>Sieve filter</primary>
36752 <secondary>configuring <command>appendfile</command></secondary>
36753 </indexterm>
36754 <indexterm role="concept">
36755 <primary>Sieve filter</primary>
36756 <secondary>relative mailbox path handling</secondary>
36757 </indexterm>
36758 As an example of the second case, consider an environment where users do not
36759 have home directories. They may be permitted to use Exim filter commands of the
36760 form:
36761 </para>
36762 <literallayout class="monospaced">
36763 save folder23
36764 </literallayout>
36765 <para>
36766 or Sieve filter commands of the form:
36767 </para>
36768 <literallayout class="monospaced">
36769 require "fileinto";
36770 fileinto "folder23";
36771 </literallayout>
36772 <para>
36773 In this situation, the expansion of <option>file</option> or <option>directory</option> in the transport
36774 must transform the relative path into an appropriate absolute file name. In the
36775 case of Sieve filters, the name <emphasis>inbox</emphasis> must be handled. It is the name that
36776 is used as a result of a <quote>keep</quote> action in the filter. This example shows one
36777 way of handling this requirement:
36778 </para>
36779 <literallayout class="monospaced">
36780 file = ${if eq{$address_file}{inbox} \
36781             {/var/mail/$local_part} \
36782             {${if eq{${substr_0_1:$address_file}}{/} \
36783                   {$address_file} \
36784                   {$home/mail/$address_file} \
36785             }} \
36786        }
36787 </literallayout>
36788 <para>
36789 With this setting of <option>file</option>, <emphasis>inbox</emphasis> refers to the standard mailbox
36790 location, absolute paths are used without change, and other folders are in the
36791 <filename>mail</filename> directory within the home directory.
36792 </para>
36793 <para>
36794 <emphasis role="bold">Note 1</emphasis>: While processing an Exim filter, a relative path such as
36795 <filename>folder23</filename> is turned into an absolute path if a home directory is known to
36796 the router. In particular, this is the case if <option>check_local_user</option> is set. If
36797 you want to prevent this happening at routing time, you can set
36798 <option>router_home_directory</option> empty. This forces the router to pass the relative
36799 path to the transport.
36800 </para>
36801 <para>
36802 <emphasis role="bold">Note 2</emphasis>: An absolute path in <varname>$address_file</varname> is not treated specially;
36803 the <option>file</option> or <option>directory</option> option is still used if it is set.
36804 </para>
36805 </section>
36806 <section id="SECID134">
36807 <title>Private options for appendfile</title>
36808 <para>
36809 <indexterm role="concept">
36810 <primary>options</primary>
36811 <secondary><command>appendfile</command> transport</secondary>
36812 </indexterm>
36813 </para>
36814 <para>
36815 <indexterm role="option">
36816 <primary><option>allow_fifo</option></primary>
36817 </indexterm>
36818 </para>
36819 <informaltable frame="all">
36820 <tgroup cols="4" colsep="0" rowsep="0">
36821 <colspec colwidth="8*" align="left"/>
36822 <colspec colwidth="6*" align="center"/>
36823 <colspec colwidth="6*" align="center"/>
36824 <colspec colwidth="6*" align="right"/>
36825 <tbody>
36826 <row>
36827 <entry><option>allow_fifo</option></entry>
36828 <entry>Use: <emphasis>appendfile</emphasis></entry>
36829 <entry>Type: <emphasis>boolean</emphasis></entry>
36830 <entry>Default: <emphasis>false</emphasis></entry>
36831 </row>
36832 </tbody>
36833 </tgroup>
36834 </informaltable>
36835 <para>
36836 <indexterm role="concept">
36837 <primary>fifo (named pipe)</primary>
36838 </indexterm>
36839 <indexterm role="concept">
36840 <primary>named pipe (fifo)</primary>
36841 </indexterm>
36842 <indexterm role="concept">
36843 <primary>pipe</primary>
36844 <secondary>named (fifo)</secondary>
36845 </indexterm>
36846 Setting this option permits delivery to named pipes (FIFOs) as well as to
36847 regular files. If no process is reading the named pipe at delivery time, the
36848 delivery is deferred.
36849 </para>
36850 <para>
36851 <indexterm role="option">
36852 <primary><option>allow_symlink</option></primary>
36853 </indexterm>
36854 </para>
36855 <informaltable frame="all">
36856 <tgroup cols="4" colsep="0" rowsep="0">
36857 <colspec colwidth="8*" align="left"/>
36858 <colspec colwidth="6*" align="center"/>
36859 <colspec colwidth="6*" align="center"/>
36860 <colspec colwidth="6*" align="right"/>
36861 <tbody>
36862 <row>
36863 <entry><option>allow_symlink</option></entry>
36864 <entry>Use: <emphasis>appendfile</emphasis></entry>
36865 <entry>Type: <emphasis>boolean</emphasis></entry>
36866 <entry>Default: <emphasis>false</emphasis></entry>
36867 </row>
36868 </tbody>
36869 </tgroup>
36870 </informaltable>
36871 <para>
36872 <indexterm role="concept">
36873 <primary>symbolic link</primary>
36874 <secondary>to mailbox</secondary>
36875 </indexterm>
36876 <indexterm role="concept">
36877 <primary>mailbox</primary>
36878 <secondary>symbolic link</secondary>
36879 </indexterm>
36880 By default, <command>appendfile</command> will not deliver if the path name for the file is
36881 that of a symbolic link. Setting this option relaxes that constraint, but there
36882 are security issues involved in the use of symbolic links. Be sure you know
36883 what you are doing if you set this. Details of exactly what this option affects
36884 are included in the discussion which follows this list of options.
36885 </para>
36886 <para>
36887 <indexterm role="option">
36888 <primary><option>batch_id</option></primary>
36889 </indexterm>
36890 </para>
36891 <informaltable frame="all">
36892 <tgroup cols="4" colsep="0" rowsep="0">
36893 <colspec colwidth="8*" align="left"/>
36894 <colspec colwidth="6*" align="center"/>
36895 <colspec colwidth="6*" align="center"/>
36896 <colspec colwidth="6*" align="right"/>
36897 <tbody>
36898 <row>
36899 <entry><option>batch_id</option></entry>
36900 <entry>Use: <emphasis>appendfile</emphasis></entry>
36901 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36902 <entry>Default: <emphasis>unset</emphasis></entry>
36903 </row>
36904 </tbody>
36905 </tgroup>
36906 </informaltable>
36907 <para>
36908 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
36909 However, batching is automatically disabled for <command>appendfile</command> deliveries that
36910 happen as a result of forwarding or aliasing or other redirection directly to a
36911 file.
36912 </para>
36913 <para>
36914 <indexterm role="option">
36915 <primary><option>batch_max</option></primary>
36916 </indexterm>
36917 </para>
36918 <informaltable frame="all">
36919 <tgroup cols="4" colsep="0" rowsep="0">
36920 <colspec colwidth="8*" align="left"/>
36921 <colspec colwidth="6*" align="center"/>
36922 <colspec colwidth="6*" align="center"/>
36923 <colspec colwidth="6*" align="right"/>
36924 <tbody>
36925 <row>
36926 <entry><option>batch_max</option></entry>
36927 <entry>Use: <emphasis>appendfile</emphasis></entry>
36928 <entry>Type: <emphasis>integer</emphasis></entry>
36929 <entry>Default: <emphasis>1</emphasis></entry>
36930 </row>
36931 </tbody>
36932 </tgroup>
36933 </informaltable>
36934 <para>
36935 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
36936 </para>
36937 <para>
36938 <indexterm role="option">
36939 <primary><option>check_group</option></primary>
36940 </indexterm>
36941 </para>
36942 <informaltable frame="all">
36943 <tgroup cols="4" colsep="0" rowsep="0">
36944 <colspec colwidth="8*" align="left"/>
36945 <colspec colwidth="6*" align="center"/>
36946 <colspec colwidth="6*" align="center"/>
36947 <colspec colwidth="6*" align="right"/>
36948 <tbody>
36949 <row>
36950 <entry><option>check_group</option></entry>
36951 <entry>Use: <emphasis>appendfile</emphasis></entry>
36952 <entry>Type: <emphasis>boolean</emphasis></entry>
36953 <entry>Default: <emphasis>false</emphasis></entry>
36954 </row>
36955 </tbody>
36956 </tgroup>
36957 </informaltable>
36958 <para>
36959 When this option is set, the group owner of the file defined by the <option>file</option>
36960 option is checked to see that it is the same as the group under which the
36961 delivery process is running. The default setting is false because the default
36962 file mode is 0600, which means that the group is irrelevant.
36963 </para>
36964 <para>
36965 <indexterm role="option">
36966 <primary><option>check_owner</option></primary>
36967 </indexterm>
36968 </para>
36969 <informaltable frame="all">
36970 <tgroup cols="4" colsep="0" rowsep="0">
36971 <colspec colwidth="8*" align="left"/>
36972 <colspec colwidth="6*" align="center"/>
36973 <colspec colwidth="6*" align="center"/>
36974 <colspec colwidth="6*" align="right"/>
36975 <tbody>
36976 <row>
36977 <entry><option>check_owner</option></entry>
36978 <entry>Use: <emphasis>appendfile</emphasis></entry>
36979 <entry>Type: <emphasis>boolean</emphasis></entry>
36980 <entry>Default: <emphasis>true</emphasis></entry>
36981 </row>
36982 </tbody>
36983 </tgroup>
36984 </informaltable>
36985 <para>
36986 When this option is set, the owner of the file defined by the <option>file</option> option
36987 is checked to ensure that it is the same as the user under which the delivery
36988 process is running.
36989 </para>
36990 <para>
36991 <indexterm role="option">
36992 <primary><option>check_string</option></primary>
36993 </indexterm>
36994 </para>
36995 <informaltable frame="all">
36996 <tgroup cols="4" colsep="0" rowsep="0">
36997 <colspec colwidth="8*" align="left"/>
36998 <colspec colwidth="6*" align="center"/>
36999 <colspec colwidth="6*" align="center"/>
37000 <colspec colwidth="6*" align="right"/>
37001 <tbody>
37002 <row>
37003 <entry><option>check_string</option></entry>
37004 <entry>Use: <emphasis>appendfile</emphasis></entry>
37005 <entry>Type: <emphasis>string</emphasis></entry>
37006 <entry>Default: <emphasis>see below</emphasis></entry>
37007 </row>
37008 </tbody>
37009 </tgroup>
37010 </informaltable>
37011 <para>
37012 <indexterm role="concept">
37013 <primary><quote>From</quote> line</primary>
37014 </indexterm>
37015 As <command>appendfile</command> writes the message, the start of each line is tested for
37016 matching <option>check_string</option>, and if it does, the initial matching characters are
37017 replaced by the contents of <option>escape_string</option>. The value of <option>check_string</option> is
37018 a literal string, not a regular expression, and the case of any letters it
37019 contains is significant.
37020 </para>
37021 <para>
37022 If <option>use_bsmtp</option> is set the values of <option>check_string</option> and <option>escape_string</option>
37023 are forced to <quote>.</quote> and <quote>..</quote> respectively, and any settings in the
37024 configuration are ignored. Otherwise, they default to <quote>From&nbsp;</quote> and
37025 <quote>&gt;From&nbsp;</quote> when the <option>file</option> option is set, and unset when any of the
37026 <option>directory</option>, <option>maildir</option>, or <option>mailstore</option> options are set.
37027 </para>
37028 <para>
37029 The default settings, along with <option>message_prefix</option> and <option>message_suffix</option>, are
37030 suitable for traditional <quote>BSD</quote> mailboxes, where a line beginning with
37031 <quote>From&nbsp;</quote> indicates the start of a new message. All four options need changing
37032 if another format is used. For example, to deliver to mailboxes in MMDF format:
37033 <indexterm role="concept">
37034 <primary>MMDF format mailbox</primary>
37035 </indexterm>
37036 <indexterm role="concept">
37037 <primary>mailbox</primary>
37038 <secondary>MMDF format</secondary>
37039 </indexterm>
37040 </para>
37041 <literallayout class="monospaced">
37042 check_string = "\1\1\1\1\n"
37043 escape_string = "\1\1\1\1 \n"
37044 message_prefix = "\1\1\1\1\n"
37045 message_suffix = "\1\1\1\1\n"
37046 </literallayout>
37047 <para>
37048 <indexterm role="option">
37049 <primary><option>create_directory</option></primary>
37050 </indexterm>
37051 </para>
37052 <informaltable frame="all">
37053 <tgroup cols="4" colsep="0" rowsep="0">
37054 <colspec colwidth="8*" align="left"/>
37055 <colspec colwidth="6*" align="center"/>
37056 <colspec colwidth="6*" align="center"/>
37057 <colspec colwidth="6*" align="right"/>
37058 <tbody>
37059 <row>
37060 <entry><option>create_directory</option></entry>
37061 <entry>Use: <emphasis>appendfile</emphasis></entry>
37062 <entry>Type: <emphasis>boolean</emphasis></entry>
37063 <entry>Default: <emphasis>true</emphasis></entry>
37064 </row>
37065 </tbody>
37066 </tgroup>
37067 </informaltable>
37068 <para>
37069 <indexterm role="concept">
37070 <primary>directory creation</primary>
37071 </indexterm>
37072 When this option is true, Exim attempts to create any missing superior
37073 directories for the file that it is about to write. A created directory&#x2019;s mode
37074 is given by the <option>directory_mode</option> option.
37075 </para>
37076 <para>
37077 The group ownership of a newly created directory is highly dependent on the
37078 operating system (and possibly the file system) that is being used. For
37079 example, in Solaris, if the parent directory has the setgid bit set, its group
37080 is propagated to the child; if not, the currently set group is used. However,
37081 in FreeBSD, the parent&#x2019;s group is always used.
37082 </para>
37083 <para>
37084 <indexterm role="option">
37085 <primary><option>create_file</option></primary>
37086 </indexterm>
37087 </para>
37088 <informaltable frame="all">
37089 <tgroup cols="4" colsep="0" rowsep="0">
37090 <colspec colwidth="8*" align="left"/>
37091 <colspec colwidth="6*" align="center"/>
37092 <colspec colwidth="6*" align="center"/>
37093 <colspec colwidth="6*" align="right"/>
37094 <tbody>
37095 <row>
37096 <entry><option>create_file</option></entry>
37097 <entry>Use: <emphasis>appendfile</emphasis></entry>
37098 <entry>Type: <emphasis>string</emphasis></entry>
37099 <entry>Default: <emphasis>anywhere</emphasis></entry>
37100 </row>
37101 </tbody>
37102 </tgroup>
37103 </informaltable>
37104 <para>
37105 This option constrains the location of files and directories that are created
37106 by this transport. It applies to files defined by the <option>file</option> option and
37107 directories defined by the <option>directory</option> option. In the case of maildir
37108 delivery, it applies to the top level directory, not the maildir directories
37109 beneath.
37110 </para>
37111 <para>
37112 The option must be set to one of the words <quote>anywhere</quote>, <quote>inhome</quote>, or
37113 <quote>belowhome</quote>. In the second and third cases, a home directory must have been
37114 set for the transport. This option is not useful when an explicit file name is
37115 given for normal mailbox deliveries. It is intended for the case when file
37116 names are generated from users&#x2019; <filename>.forward</filename> files. These are usually handled
37117 by an <command>appendfile</command> transport called <option>address_file</option>. See also
37118 <option>file_must_exist</option>.
37119 </para>
37120 <para>
37121 <indexterm role="option">
37122 <primary><option>directory</option></primary>
37123 </indexterm>
37124 </para>
37125 <informaltable frame="all">
37126 <tgroup cols="4" colsep="0" rowsep="0">
37127 <colspec colwidth="8*" align="left"/>
37128 <colspec colwidth="6*" align="center"/>
37129 <colspec colwidth="6*" align="center"/>
37130 <colspec colwidth="6*" align="right"/>
37131 <tbody>
37132 <row>
37133 <entry><option>directory</option></entry>
37134 <entry>Use: <emphasis>appendfile</emphasis></entry>
37135 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37136 <entry>Default: <emphasis>unset</emphasis></entry>
37137 </row>
37138 </tbody>
37139 </tgroup>
37140 </informaltable>
37141 <para>
37142 This option is mutually exclusive with the <option>file</option> option, but one of <option>file</option>
37143 or <option>directory</option> must be set, unless the delivery is the direct result of a
37144 redirection (see section <xref linkend="SECTfildiropt"/>).
37145 </para>
37146 <para>
37147 When <option>directory</option> is set, the string is expanded, and the message is delivered
37148 into a new file or files in or below the given directory, instead of being
37149 appended to a single mailbox file. A number of different formats are provided
37150 (see <option>maildir_format</option> and <option>mailstore_format</option>), and see section
37151 <xref linkend="SECTopdir"/> for further details of this form of delivery.
37152 </para>
37153 <para>
37154 <indexterm role="option">
37155 <primary><option>directory_file</option></primary>
37156 </indexterm>
37157 </para>
37158 <informaltable frame="all">
37159 <tgroup cols="4" colsep="0" rowsep="0">
37160 <colspec colwidth="8*" align="left"/>
37161 <colspec colwidth="6*" align="center"/>
37162 <colspec colwidth="6*" align="center"/>
37163 <colspec colwidth="6*" align="right"/>
37164 <tbody>
37165 <row>
37166 <entry><option>directory_file</option></entry>
37167 <entry>Use: <emphasis>appendfile</emphasis></entry>
37168 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37169 <entry>Default: <emphasis>see below</emphasis></entry>
37170 </row>
37171 </tbody>
37172 </tgroup>
37173 </informaltable>
37174 <para>
37175 <indexterm role="concept">
37176 <primary>base62</primary>
37177 </indexterm>
37178 <indexterm role="variable">
37179 <primary><varname>$inode</varname></primary>
37180 </indexterm>
37181 When <option>directory</option> is set, but neither <option>maildir_format</option> nor
37182 <option>mailstore_format</option> is set, <command>appendfile</command> delivers each message into a file
37183 whose name is obtained by expanding this string. The default value is:
37184 </para>
37185 <literallayout class="monospaced">
37186 q${base62:$tod_epoch}-$inode
37187 </literallayout>
37188 <para>
37189 This generates a unique name from the current time, in base 62 form, and the
37190 inode of the file. The variable <varname>$inode</varname> is available only when expanding this
37191 option.
37192 </para>
37193 <para>
37194 <indexterm role="option">
37195 <primary><option>directory_mode</option></primary>
37196 </indexterm>
37197 </para>
37198 <informaltable frame="all">
37199 <tgroup cols="4" colsep="0" rowsep="0">
37200 <colspec colwidth="8*" align="left"/>
37201 <colspec colwidth="6*" align="center"/>
37202 <colspec colwidth="6*" align="center"/>
37203 <colspec colwidth="6*" align="right"/>
37204 <tbody>
37205 <row>
37206 <entry><option>directory_mode</option></entry>
37207 <entry>Use: <emphasis>appendfile</emphasis></entry>
37208 <entry>Type: <emphasis>octal integer</emphasis></entry>
37209 <entry>Default: <emphasis>0700</emphasis></entry>
37210 </row>
37211 </tbody>
37212 </tgroup>
37213 </informaltable>
37214 <para>
37215 If <command>appendfile</command> creates any directories as a result of the
37216 <option>create_directory</option> option, their mode is specified by this option.
37217 </para>
37218 <para>
37219 <indexterm role="option">
37220 <primary><option>escape_string</option></primary>
37221 </indexterm>
37222 </para>
37223 <informaltable frame="all">
37224 <tgroup cols="4" colsep="0" rowsep="0">
37225 <colspec colwidth="8*" align="left"/>
37226 <colspec colwidth="6*" align="center"/>
37227 <colspec colwidth="6*" align="center"/>
37228 <colspec colwidth="6*" align="right"/>
37229 <tbody>
37230 <row>
37231 <entry><option>escape_string</option></entry>
37232 <entry>Use: <emphasis>appendfile</emphasis></entry>
37233 <entry>Type: <emphasis>string</emphasis></entry>
37234 <entry>Default: <emphasis>see description</emphasis></entry>
37235 </row>
37236 </tbody>
37237 </tgroup>
37238 </informaltable>
37239 <para>
37240 See <option>check_string</option> above.
37241 </para>
37242 <para>
37243 <indexterm role="option">
37244 <primary><option>file</option></primary>
37245 </indexterm>
37246 </para>
37247 <informaltable frame="all">
37248 <tgroup cols="4" colsep="0" rowsep="0">
37249 <colspec colwidth="8*" align="left"/>
37250 <colspec colwidth="6*" align="center"/>
37251 <colspec colwidth="6*" align="center"/>
37252 <colspec colwidth="6*" align="right"/>
37253 <tbody>
37254 <row>
37255 <entry><option>file</option></entry>
37256 <entry>Use: <emphasis>appendfile</emphasis></entry>
37257 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37258 <entry>Default: <emphasis>unset</emphasis></entry>
37259 </row>
37260 </tbody>
37261 </tgroup>
37262 </informaltable>
37263 <para>
37264 This option is mutually exclusive with the <option>directory</option> option, but one of
37265 <option>file</option> or <option>directory</option> must be set, unless the delivery is the direct result
37266 of a redirection (see section <xref linkend="SECTfildiropt"/>). The <option>file</option> option
37267 specifies a single file, to which the message is appended. One or more of
37268 <option>use_fcntl_lock</option>, <option>use_flock_lock</option>, or <option>use_lockfile</option> must be set with
37269 <option>file</option>.
37270 </para>
37271 <para>
37272 <indexterm role="concept">
37273 <primary>NFS</primary>
37274 <secondary>lock file</secondary>
37275 </indexterm>
37276 <indexterm role="concept">
37277 <primary>locking files</primary>
37278 </indexterm>
37279 <indexterm role="concept">
37280 <primary>lock files</primary>
37281 </indexterm>
37282 If you are using more than one host to deliver over NFS into the same
37283 mailboxes, you should always use lock files.
37284 </para>
37285 <para>
37286 The string value is expanded for each delivery, and must yield an absolute
37287 path. The most common settings of this option are variations on one of these
37288 examples:
37289 </para>
37290 <literallayout class="monospaced">
37291 file = /var/spool/mail/$local_part
37292 file = /home/$local_part/inbox
37293 file = $home/inbox
37294 </literallayout>
37295 <para>
37296 <indexterm role="concept">
37297 <primary><quote>sticky</quote> bit</primary>
37298 </indexterm>
37299 In the first example, all deliveries are done into the same directory. If Exim
37300 is configured to use lock files (see <option>use_lockfile</option> below) it must be able to
37301 create a file in the directory, so the <quote>sticky</quote> bit must be turned on for
37302 deliveries to be possible, or alternatively the <option>group</option> option can be used to
37303 run the delivery under a group id which has write access to the directory.
37304 </para>
37305 <para>
37306 <indexterm role="option">
37307 <primary><option>file_format</option></primary>
37308 </indexterm>
37309 </para>
37310 <informaltable frame="all">
37311 <tgroup cols="4" colsep="0" rowsep="0">
37312 <colspec colwidth="8*" align="left"/>
37313 <colspec colwidth="6*" align="center"/>
37314 <colspec colwidth="6*" align="center"/>
37315 <colspec colwidth="6*" align="right"/>
37316 <tbody>
37317 <row>
37318 <entry><option>file_format</option></entry>
37319 <entry>Use: <emphasis>appendfile</emphasis></entry>
37320 <entry>Type: <emphasis>string</emphasis></entry>
37321 <entry>Default: <emphasis>unset</emphasis></entry>
37322 </row>
37323 </tbody>
37324 </tgroup>
37325 </informaltable>
37326 <para>
37327 <indexterm role="concept">
37328 <primary>file</primary>
37329 <secondary>mailbox; checking existing format</secondary>
37330 </indexterm>
37331 This option requests the transport to check the format of an existing file
37332 before adding to it. The check consists of matching a specific string at the
37333 start of the file. The value of the option consists of an even number of
37334 colon-separated strings. The first of each pair is the test string, and the
37335 second is the name of a transport. If the transport associated with a matched
37336 string is not the current transport, control is passed over to the other
37337 transport. For example, suppose the standard <command>local_delivery</command> transport has
37338 this added to it:
37339 </para>
37340 <literallayout class="monospaced">
37341 file_format = "From       : local_delivery :\
37342                \1\1\1\1\n : local_mmdf_delivery"
37343 </literallayout>
37344 <para>
37345 Mailboxes that begin with <quote>From</quote> are still handled by this transport, but if
37346 a mailbox begins with four binary ones followed by a newline, control is passed
37347 to a transport called <option>local_mmdf_delivery</option>, which presumably is configured
37348 to do the delivery in MMDF format. If a mailbox does not exist or is empty, it
37349 is assumed to match the current transport. If the start of a mailbox doesn&#x2019;t
37350 match any string, or if the transport named for a given string is not defined,
37351 delivery is deferred.
37352 </para>
37353 <para>
37354 <indexterm role="option">
37355 <primary><option>file_must_exist</option></primary>
37356 </indexterm>
37357 </para>
37358 <informaltable frame="all">
37359 <tgroup cols="4" colsep="0" rowsep="0">
37360 <colspec colwidth="8*" align="left"/>
37361 <colspec colwidth="6*" align="center"/>
37362 <colspec colwidth="6*" align="center"/>
37363 <colspec colwidth="6*" align="right"/>
37364 <tbody>
37365 <row>
37366 <entry><option>file_must_exist</option></entry>
37367 <entry>Use: <emphasis>appendfile</emphasis></entry>
37368 <entry>Type: <emphasis>boolean</emphasis></entry>
37369 <entry>Default: <emphasis>false</emphasis></entry>
37370 </row>
37371 </tbody>
37372 </tgroup>
37373 </informaltable>
37374 <para>
37375 If this option is true, the file specified by the <option>file</option> option must exist.
37376 A temporary error occurs if it does not, causing delivery to be deferred.
37377 If this option is false, the file is created if it does not exist.
37378 </para>
37379 <para>
37380 <indexterm role="option">
37381 <primary><option>lock_fcntl_timeout</option></primary>
37382 </indexterm>
37383 </para>
37384 <informaltable frame="all">
37385 <tgroup cols="4" colsep="0" rowsep="0">
37386 <colspec colwidth="8*" align="left"/>
37387 <colspec colwidth="6*" align="center"/>
37388 <colspec colwidth="6*" align="center"/>
37389 <colspec colwidth="6*" align="right"/>
37390 <tbody>
37391 <row>
37392 <entry><option>lock_fcntl_timeout</option></entry>
37393 <entry>Use: <emphasis>appendfile</emphasis></entry>
37394 <entry>Type: <emphasis>time</emphasis></entry>
37395 <entry>Default: <emphasis>0s</emphasis></entry>
37396 </row>
37397 </tbody>
37398 </tgroup>
37399 </informaltable>
37400 <para>
37401 <indexterm role="concept">
37402 <primary>timeout</primary>
37403 <secondary>mailbox locking</secondary>
37404 </indexterm>
37405 <indexterm role="concept">
37406 <primary>mailbox</primary>
37407 <secondary>locking, blocking and non-blocking</secondary>
37408 </indexterm>
37409 <indexterm role="concept">
37410 <primary>locking files</primary>
37411 </indexterm>
37412 By default, the <command>appendfile</command> transport uses non-blocking calls to <function>fcntl()</function>
37413 when locking an open mailbox file. If the call fails, the delivery process
37414 sleeps for <option>lock_interval</option> and tries again, up to <option>lock_retries</option> times.
37415 Non-blocking calls are used so that the file is not kept open during the wait
37416 for the lock; the reason for this is to make it as safe as possible for
37417 deliveries over NFS in the case when processes might be accessing an NFS
37418 mailbox without using a lock file. This should not be done, but
37419 misunderstandings and hence misconfigurations are not unknown.
37420 </para>
37421 <para>
37422 On a busy system, however, the performance of a non-blocking lock approach is
37423 not as good as using a blocking lock with a timeout. In this case, the waiting
37424 is done inside the system call, and Exim&#x2019;s delivery process acquires the lock
37425 and can proceed as soon as the previous lock holder releases it.
37426 </para>
37427 <para>
37428 If <option>lock_fcntl_timeout</option> is set to a non-zero time, blocking locks, with that
37429 timeout, are used. There may still be some retrying: the maximum number of
37430 retries is
37431 </para>
37432 <literallayout class="monospaced">
37433 (lock_retries * lock_interval) / lock_fcntl_timeout
37434 </literallayout>
37435 <para>
37436 rounded up to the next whole number. In other words, the total time during
37437 which <command>appendfile</command> is trying to get a lock is roughly the same, unless
37438 <option>lock_fcntl_timeout</option> is set very large.
37439 </para>
37440 <para>
37441 You should consider setting this option if you are getting a lot of delayed
37442 local deliveries because of errors of the form
37443 </para>
37444 <literallayout class="monospaced">
37445 failed to lock mailbox /some/file (fcntl)
37446 </literallayout>
37447 <para>
37448 <indexterm role="option">
37449 <primary><option>lock_flock_timeout</option></primary>
37450 </indexterm>
37451 </para>
37452 <informaltable frame="all">
37453 <tgroup cols="4" colsep="0" rowsep="0">
37454 <colspec colwidth="8*" align="left"/>
37455 <colspec colwidth="6*" align="center"/>
37456 <colspec colwidth="6*" align="center"/>
37457 <colspec colwidth="6*" align="right"/>
37458 <tbody>
37459 <row>
37460 <entry><option>lock_flock_timeout</option></entry>
37461 <entry>Use: <emphasis>appendfile</emphasis></entry>
37462 <entry>Type: <emphasis>time</emphasis></entry>
37463 <entry>Default: <emphasis>0s</emphasis></entry>
37464 </row>
37465 </tbody>
37466 </tgroup>
37467 </informaltable>
37468 <para>
37469 This timeout applies to file locking when using <function>flock()</function> (see
37470 <option>use_flock</option>); the timeout operates in a similar manner to
37471 <option>lock_fcntl_timeout</option>.
37472 </para>
37473 <para>
37474 <indexterm role="option">
37475 <primary><option>lock_interval</option></primary>
37476 </indexterm>
37477 </para>
37478 <informaltable frame="all">
37479 <tgroup cols="4" colsep="0" rowsep="0">
37480 <colspec colwidth="8*" align="left"/>
37481 <colspec colwidth="6*" align="center"/>
37482 <colspec colwidth="6*" align="center"/>
37483 <colspec colwidth="6*" align="right"/>
37484 <tbody>
37485 <row>
37486 <entry><option>lock_interval</option></entry>
37487 <entry>Use: <emphasis>appendfile</emphasis></entry>
37488 <entry>Type: <emphasis>time</emphasis></entry>
37489 <entry>Default: <emphasis>3s</emphasis></entry>
37490 </row>
37491 </tbody>
37492 </tgroup>
37493 </informaltable>
37494 <para>
37495 This specifies the time to wait between attempts to lock the file. See below
37496 for details of locking.
37497 </para>
37498 <para>
37499 <indexterm role="option">
37500 <primary><option>lock_retries</option></primary>
37501 </indexterm>
37502 </para>
37503 <informaltable frame="all">
37504 <tgroup cols="4" colsep="0" rowsep="0">
37505 <colspec colwidth="8*" align="left"/>
37506 <colspec colwidth="6*" align="center"/>
37507 <colspec colwidth="6*" align="center"/>
37508 <colspec colwidth="6*" align="right"/>
37509 <tbody>
37510 <row>
37511 <entry><option>lock_retries</option></entry>
37512 <entry>Use: <emphasis>appendfile</emphasis></entry>
37513 <entry>Type: <emphasis>integer</emphasis></entry>
37514 <entry>Default: <emphasis>10</emphasis></entry>
37515 </row>
37516 </tbody>
37517 </tgroup>
37518 </informaltable>
37519 <para>
37520 This specifies the maximum number of attempts to lock the file. A value of zero
37521 is treated as 1. See below for details of locking.
37522 </para>
37523 <para>
37524 <indexterm role="option">
37525 <primary><option>lockfile_mode</option></primary>
37526 </indexterm>
37527 </para>
37528 <informaltable frame="all">
37529 <tgroup cols="4" colsep="0" rowsep="0">
37530 <colspec colwidth="8*" align="left"/>
37531 <colspec colwidth="6*" align="center"/>
37532 <colspec colwidth="6*" align="center"/>
37533 <colspec colwidth="6*" align="right"/>
37534 <tbody>
37535 <row>
37536 <entry><option>lockfile_mode</option></entry>
37537 <entry>Use: <emphasis>appendfile</emphasis></entry>
37538 <entry>Type: <emphasis>octal integer</emphasis></entry>
37539 <entry>Default: <emphasis>0600</emphasis></entry>
37540 </row>
37541 </tbody>
37542 </tgroup>
37543 </informaltable>
37544 <para>
37545 This specifies the mode of the created lock file, when a lock file is being
37546 used (see <option>use_lockfile</option> and <option>use_mbx_lock</option>).
37547 </para>
37548 <para>
37549 <indexterm role="option">
37550 <primary><option>lockfile_timeout</option></primary>
37551 </indexterm>
37552 </para>
37553 <informaltable frame="all">
37554 <tgroup cols="4" colsep="0" rowsep="0">
37555 <colspec colwidth="8*" align="left"/>
37556 <colspec colwidth="6*" align="center"/>
37557 <colspec colwidth="6*" align="center"/>
37558 <colspec colwidth="6*" align="right"/>
37559 <tbody>
37560 <row>
37561 <entry><option>lockfile_timeout</option></entry>
37562 <entry>Use: <emphasis>appendfile</emphasis></entry>
37563 <entry>Type: <emphasis>time</emphasis></entry>
37564 <entry>Default: <emphasis>30m</emphasis></entry>
37565 </row>
37566 </tbody>
37567 </tgroup>
37568 </informaltable>
37569 <para>
37570 <indexterm role="concept">
37571 <primary>timeout</primary>
37572 <secondary>mailbox locking</secondary>
37573 </indexterm>
37574 When a lock file is being used (see <option>use_lockfile</option>), if a lock file already
37575 exists and is older than this value, it is assumed to have been left behind by
37576 accident, and Exim attempts to remove it.
37577 </para>
37578 <para>
37579 <indexterm role="option">
37580 <primary><option>mailbox_filecount</option></primary>
37581 </indexterm>
37582 </para>
37583 <informaltable frame="all">
37584 <tgroup cols="4" colsep="0" rowsep="0">
37585 <colspec colwidth="8*" align="left"/>
37586 <colspec colwidth="6*" align="center"/>
37587 <colspec colwidth="6*" align="center"/>
37588 <colspec colwidth="6*" align="right"/>
37589 <tbody>
37590 <row>
37591 <entry><option>mailbox_filecount</option></entry>
37592 <entry>Use: <emphasis>appendfile</emphasis></entry>
37593 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37594 <entry>Default: <emphasis>unset</emphasis></entry>
37595 </row>
37596 </tbody>
37597 </tgroup>
37598 </informaltable>
37599 <para>
37600 <indexterm role="concept">
37601 <primary>mailbox</primary>
37602 <secondary>specifying size of</secondary>
37603 </indexterm>
37604 <indexterm role="concept">
37605 <primary>size</primary>
37606 <secondary>of mailbox</secondary>
37607 </indexterm>
37608 If this option is set, it is expanded, and the result is taken as the current
37609 number of files in the mailbox. It must be a decimal number, optionally
37610 followed by K or M. This provides a way of obtaining this information from an
37611 external source that maintains the data.
37612 </para>
37613 <para>
37614 <indexterm role="option">
37615 <primary><option>mailbox_size</option></primary>
37616 </indexterm>
37617 </para>
37618 <informaltable frame="all">
37619 <tgroup cols="4" colsep="0" rowsep="0">
37620 <colspec colwidth="8*" align="left"/>
37621 <colspec colwidth="6*" align="center"/>
37622 <colspec colwidth="6*" align="center"/>
37623 <colspec colwidth="6*" align="right"/>
37624 <tbody>
37625 <row>
37626 <entry><option>mailbox_size</option></entry>
37627 <entry>Use: <emphasis>appendfile</emphasis></entry>
37628 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37629 <entry>Default: <emphasis>unset</emphasis></entry>
37630 </row>
37631 </tbody>
37632 </tgroup>
37633 </informaltable>
37634 <para>
37635 <indexterm role="concept">
37636 <primary>mailbox</primary>
37637 <secondary>specifying size of</secondary>
37638 </indexterm>
37639 <indexterm role="concept">
37640 <primary>size</primary>
37641 <secondary>of mailbox</secondary>
37642 </indexterm>
37643 If this option is set, it is expanded, and the result is taken as the current
37644 size the mailbox. It must be a decimal number, optionally followed by K or M.
37645 This provides a way of obtaining this information from an external source that
37646 maintains the data. This is likely to be helpful for maildir deliveries where
37647 it is computationally expensive to compute the size of a mailbox.
37648 </para>
37649 <para>
37650 <indexterm role="option">
37651 <primary><option>maildir_format</option></primary>
37652 </indexterm>
37653 </para>
37654 <informaltable frame="all">
37655 <tgroup cols="4" colsep="0" rowsep="0">
37656 <colspec colwidth="8*" align="left"/>
37657 <colspec colwidth="6*" align="center"/>
37658 <colspec colwidth="6*" align="center"/>
37659 <colspec colwidth="6*" align="right"/>
37660 <tbody>
37661 <row>
37662 <entry><option>maildir_format</option></entry>
37663 <entry>Use: <emphasis>appendfile</emphasis></entry>
37664 <entry>Type: <emphasis>boolean</emphasis></entry>
37665 <entry>Default: <emphasis>false</emphasis></entry>
37666 </row>
37667 </tbody>
37668 </tgroup>
37669 </informaltable>
37670 <para>
37671 <indexterm role="concept">
37672 <primary>maildir format</primary>
37673 <secondary>specifying</secondary>
37674 </indexterm>
37675 If this option is set with the <option>directory</option> option, the delivery is into a new
37676 file, in the <quote>maildir</quote> format that is used by other mail software. When the
37677 transport is activated directly from a <command>redirect</command> router (for example, the
37678 <command>address_file</command> transport in the default configuration), setting
37679 <option>maildir_format</option> causes the path received from the router to be treated as a
37680 directory, whether or not it ends with <literal>/</literal>. This option is available only if
37681 SUPPORT_MAILDIR is present in <filename>Local/Makefile</filename>. See section
37682 <xref linkend="SECTmaildirdelivery"/> below for further details.
37683 </para>
37684 <para>
37685 <indexterm role="option">
37686 <primary><option>maildir_quota_directory_regex</option></primary>
37687 </indexterm>
37688 </para>
37689 <informaltable frame="all">
37690 <tgroup cols="4" colsep="0" rowsep="0">
37691 <colspec colwidth="8*" align="left"/>
37692 <colspec colwidth="6*" align="center"/>
37693 <colspec colwidth="6*" align="center"/>
37694 <colspec colwidth="6*" align="right"/>
37695 <tbody>
37696 <row>
37697 <entry><option>maildir_quota_directory_regex</option></entry>
37698 <entry>Use: <emphasis>appendfile</emphasis></entry>
37699 <entry>Type: <emphasis>string</emphasis></entry>
37700 <entry>Default: <emphasis>See below</emphasis></entry>
37701 </row>
37702 </tbody>
37703 </tgroup>
37704 </informaltable>
37705 <para>
37706 <indexterm role="concept">
37707 <primary>maildir format</primary>
37708 <secondary>quota; directories included in</secondary>
37709 </indexterm>
37710 <indexterm role="concept">
37711 <primary>quota</primary>
37712 <secondary>maildir; directories included in</secondary>
37713 </indexterm>
37714 This option is relevant only when <option>maildir_use_size_file</option> is set. It defines
37715 a regular expression for specifying directories, relative to the quota
37716 directory (see <option>quota_directory</option>), that should be included in the quota
37717 calculation. The default value is:
37718 </para>
37719 <literallayout class="monospaced">
37720 maildir_quota_directory_regex = ^(?:cur|new|\..*)$
37721 </literallayout>
37722 <para>
37723 This includes the <filename>cur</filename> and <filename>new</filename> directories, and any maildir++ folders
37724 (directories whose names begin with a dot). If you want to exclude the
37725 <filename>Trash</filename>
37726 folder from the count (as some sites do), you need to change this setting to
37727 </para>
37728 <literallayout class="monospaced">
37729 maildir_quota_directory_regex = ^(?:cur|new|\.(?!Trash).*)$
37730 </literallayout>
37731 <para>
37732 This uses a negative lookahead in the regular expression to exclude the
37733 directory whose name is <filename>.Trash</filename>. When a directory is excluded from quota
37734 calculations, quota processing is bypassed for any messages that are delivered
37735 directly into that directory.
37736 </para>
37737 <para>
37738 <indexterm role="option">
37739 <primary><option>maildir_retries</option></primary>
37740 </indexterm>
37741 </para>
37742 <informaltable frame="all">
37743 <tgroup cols="4" colsep="0" rowsep="0">
37744 <colspec colwidth="8*" align="left"/>
37745 <colspec colwidth="6*" align="center"/>
37746 <colspec colwidth="6*" align="center"/>
37747 <colspec colwidth="6*" align="right"/>
37748 <tbody>
37749 <row>
37750 <entry><option>maildir_retries</option></entry>
37751 <entry>Use: <emphasis>appendfile</emphasis></entry>
37752 <entry>Type: <emphasis>integer</emphasis></entry>
37753 <entry>Default: <emphasis>10</emphasis></entry>
37754 </row>
37755 </tbody>
37756 </tgroup>
37757 </informaltable>
37758 <para>
37759 This option specifies the number of times to retry when writing a file in
37760 <quote>maildir</quote> format. See section <xref linkend="SECTmaildirdelivery"/> below.
37761 </para>
37762 <para>
37763 <indexterm role="option">
37764 <primary><option>maildir_tag</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>maildir_tag</option></entry>
37776 <entry>Use: <emphasis>appendfile</emphasis></entry>
37777 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37778 <entry>Default: <emphasis>unset</emphasis></entry>
37779 </row>
37780 </tbody>
37781 </tgroup>
37782 </informaltable>
37783 <para>
37784 This option applies only to deliveries in maildir format, and is described in
37785 section <xref linkend="SECTmaildirdelivery"/> below.
37786 </para>
37787 <para>
37788 <indexterm role="option">
37789 <primary><option>maildir_use_size_file</option></primary>
37790 </indexterm>
37791 </para>
37792 <informaltable frame="all">
37793 <tgroup cols="4" colsep="0" rowsep="0">
37794 <colspec colwidth="8*" align="left"/>
37795 <colspec colwidth="6*" align="center"/>
37796 <colspec colwidth="6*" align="center"/>
37797 <colspec colwidth="6*" align="right"/>
37798 <tbody>
37799 <row>
37800 <entry><option>maildir_use_size_file</option></entry>
37801 <entry>Use: <emphasis>appendfile</emphasis></entry>
37802 <entry>Type: <emphasis>boolean</emphasis></entry>
37803 <entry>Default: <emphasis>false</emphasis></entry>
37804 </row>
37805 </tbody>
37806 </tgroup>
37807 </informaltable>
37808 <para>
37809 <indexterm role="concept">
37810 <primary>maildir format</primary>
37811 <secondary><filename>maildirsize</filename> file</secondary>
37812 </indexterm>
37813 Setting this option true enables support for <filename>maildirsize</filename> files. Exim
37814 creates a <filename>maildirsize</filename> file in a maildir if one does not exist, taking the
37815 quota from the <option>quota</option> option of the transport. If <option>quota</option> is unset, the
37816 value is zero. See <option>maildir_quota_directory_regex</option> above and section
37817 <xref linkend="SECTmaildirdelivery"/> below for further details.
37818 </para>
37819 <para>
37820 <indexterm role="option">
37821 <primary><option>maildirfolder_create_regex</option></primary>
37822 </indexterm>
37823 </para>
37824 <informaltable frame="all">
37825 <tgroup cols="4" colsep="0" rowsep="0">
37826 <colspec colwidth="8*" align="left"/>
37827 <colspec colwidth="6*" align="center"/>
37828 <colspec colwidth="6*" align="center"/>
37829 <colspec colwidth="6*" align="right"/>
37830 <tbody>
37831 <row>
37832 <entry><option>maildirfolder_create_regex</option></entry>
37833 <entry>Use: <emphasis>appendfile</emphasis></entry>
37834 <entry>Type: <emphasis>string</emphasis></entry>
37835 <entry>Default: <emphasis>unset</emphasis></entry>
37836 </row>
37837 </tbody>
37838 </tgroup>
37839 </informaltable>
37840 <para>
37841 <indexterm role="concept">
37842 <primary>maildir format</primary>
37843 <secondary><filename>maildirfolder</filename> file</secondary>
37844 </indexterm>
37845 <indexterm role="concept">
37846 <primary><filename>maildirfolder</filename>, creating</primary>
37847 </indexterm>
37848 The value of this option is a regular expression. If it is unset, it has no
37849 effect. Otherwise, before a maildir delivery takes place, the pattern is
37850 matched against the name of the maildir directory, that is, the directory
37851 containing the <filename>new</filename> and <filename>tmp</filename> subdirectories that will be used for the
37852 delivery. If there is a match, Exim checks for the existence of a file called
37853 <filename>maildirfolder</filename> in the directory, and creates it if it does not exist.
37854 See section <xref linkend="SECTmaildirdelivery"/> for more details.
37855 </para>
37856 <para>
37857 <indexterm role="option">
37858 <primary><option>mailstore_format</option></primary>
37859 </indexterm>
37860 </para>
37861 <informaltable frame="all">
37862 <tgroup cols="4" colsep="0" rowsep="0">
37863 <colspec colwidth="8*" align="left"/>
37864 <colspec colwidth="6*" align="center"/>
37865 <colspec colwidth="6*" align="center"/>
37866 <colspec colwidth="6*" align="right"/>
37867 <tbody>
37868 <row>
37869 <entry><option>mailstore_format</option></entry>
37870 <entry>Use: <emphasis>appendfile</emphasis></entry>
37871 <entry>Type: <emphasis>boolean</emphasis></entry>
37872 <entry>Default: <emphasis>false</emphasis></entry>
37873 </row>
37874 </tbody>
37875 </tgroup>
37876 </informaltable>
37877 <para>
37878 <indexterm role="concept">
37879 <primary>mailstore format</primary>
37880 <secondary>specifying</secondary>
37881 </indexterm>
37882 If this option is set with the <option>directory</option> option, the delivery is into two
37883 new files in  <quote>mailstore</quote> format. The option is available only if
37884 SUPPORT_MAILSTORE is present in <filename>Local/Makefile</filename>. See section <xref linkend="SECTopdir"/>
37885 below for further details.
37886 </para>
37887 <para>
37888 <indexterm role="option">
37889 <primary><option>mailstore_prefix</option></primary>
37890 </indexterm>
37891 </para>
37892 <informaltable frame="all">
37893 <tgroup cols="4" colsep="0" rowsep="0">
37894 <colspec colwidth="8*" align="left"/>
37895 <colspec colwidth="6*" align="center"/>
37896 <colspec colwidth="6*" align="center"/>
37897 <colspec colwidth="6*" align="right"/>
37898 <tbody>
37899 <row>
37900 <entry><option>mailstore_prefix</option></entry>
37901 <entry>Use: <emphasis>appendfile</emphasis></entry>
37902 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37903 <entry>Default: <emphasis>unset</emphasis></entry>
37904 </row>
37905 </tbody>
37906 </tgroup>
37907 </informaltable>
37908 <para>
37909 This option applies only to deliveries in mailstore format, and is described in
37910 section <xref linkend="SECTopdir"/> below.
37911 </para>
37912 <para>
37913 <indexterm role="option">
37914 <primary><option>mailstore_suffix</option></primary>
37915 </indexterm>
37916 </para>
37917 <informaltable frame="all">
37918 <tgroup cols="4" colsep="0" rowsep="0">
37919 <colspec colwidth="8*" align="left"/>
37920 <colspec colwidth="6*" align="center"/>
37921 <colspec colwidth="6*" align="center"/>
37922 <colspec colwidth="6*" align="right"/>
37923 <tbody>
37924 <row>
37925 <entry><option>mailstore_suffix</option></entry>
37926 <entry>Use: <emphasis>appendfile</emphasis></entry>
37927 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37928 <entry>Default: <emphasis>unset</emphasis></entry>
37929 </row>
37930 </tbody>
37931 </tgroup>
37932 </informaltable>
37933 <para>
37934 This option applies only to deliveries in mailstore format, and is described in
37935 section <xref linkend="SECTopdir"/> below.
37936 </para>
37937 <para>
37938 <indexterm role="option">
37939 <primary><option>mbx_format</option></primary>
37940 </indexterm>
37941 </para>
37942 <informaltable frame="all">
37943 <tgroup cols="4" colsep="0" rowsep="0">
37944 <colspec colwidth="8*" align="left"/>
37945 <colspec colwidth="6*" align="center"/>
37946 <colspec colwidth="6*" align="center"/>
37947 <colspec colwidth="6*" align="right"/>
37948 <tbody>
37949 <row>
37950 <entry><option>mbx_format</option></entry>
37951 <entry>Use: <emphasis>appendfile</emphasis></entry>
37952 <entry>Type: <emphasis>boolean</emphasis></entry>
37953 <entry>Default: <emphasis>false</emphasis></entry>
37954 </row>
37955 </tbody>
37956 </tgroup>
37957 </informaltable>
37958 <para>
37959 <indexterm role="concept">
37960 <primary>locking files</primary>
37961 </indexterm>
37962 <indexterm role="concept">
37963 <primary>file</primary>
37964 <secondary>locking</secondary>
37965 </indexterm>
37966 <indexterm role="concept">
37967 <primary>file</primary>
37968 <secondary>MBX format</secondary>
37969 </indexterm>
37970 <indexterm role="concept">
37971 <primary>MBX format, specifying</primary>
37972 </indexterm>
37973 This option is available only if Exim has been compiled with SUPPORT_MBX
37974 set in <filename>Local/Makefile</filename>. If <option>mbx_format</option> is set with the <option>file</option> option,
37975 the message is appended to the mailbox file in MBX format instead of
37976 traditional Unix format. This format is supported by Pine4 and its associated
37977 IMAP and POP daemons, by means of the <emphasis>c-client</emphasis> library that they all use.
37978 </para>
37979 <para>
37980 <emphasis role="bold">Note</emphasis>: The <option>message_prefix</option> and <option>message_suffix</option> options are not
37981 automatically changed by the use of <option>mbx_format</option>. They should normally be set
37982 empty when using MBX format, so this option almost always appears in this
37983 combination:
37984 </para>
37985 <literallayout class="monospaced">
37986 mbx_format = true
37987 message_prefix =
37988 message_suffix =
37989 </literallayout>
37990 <para>
37991 If none of the locking options are mentioned in the configuration,
37992 <option>use_mbx_lock</option> is assumed and the other locking options default to false. It
37993 is possible to specify the other kinds of locking with <option>mbx_format</option>, but
37994 <option>use_fcntl_lock</option> and <option>use_mbx_lock</option> are mutually exclusive. MBX locking
37995 interworks with <emphasis>c-client</emphasis>, providing for shared access to the mailbox. It
37996 should not be used if any program that does not use this form of locking is
37997 going to access the mailbox, nor should it be used if the mailbox file is NFS
37998 mounted, because it works only when the mailbox is accessed from a single host.
37999 </para>
38000 <para>
38001 If you set <option>use_fcntl_lock</option> with an MBX-format mailbox, you cannot use
38002 the standard version of <emphasis>c-client</emphasis>, because as long as it has a mailbox open
38003 (this means for the whole of a Pine or IMAP session), Exim will not be able to
38004 append messages to it.
38005 </para>
38006 <para>
38007 <indexterm role="option">
38008 <primary><option>message_prefix</option></primary>
38009 </indexterm>
38010 </para>
38011 <informaltable frame="all">
38012 <tgroup cols="4" colsep="0" rowsep="0">
38013 <colspec colwidth="8*" align="left"/>
38014 <colspec colwidth="6*" align="center"/>
38015 <colspec colwidth="6*" align="center"/>
38016 <colspec colwidth="6*" align="right"/>
38017 <tbody>
38018 <row>
38019 <entry><option>message_prefix</option></entry>
38020 <entry>Use: <emphasis>appendfile</emphasis></entry>
38021 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38022 <entry>Default: <emphasis>see below</emphasis></entry>
38023 </row>
38024 </tbody>
38025 </tgroup>
38026 </informaltable>
38027 <para>
38028 <indexterm role="concept">
38029 <primary><quote>From</quote> line</primary>
38030 </indexterm>
38031 The string specified here is expanded and output at the start of every message.
38032 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
38033 in which case it is:
38034 </para>
38035 <literallayout class="monospaced">
38036 message_prefix = "From ${if def:return_path{$return_path}\
38037   {MAILER-DAEMON}} $tod_bsdinbox\n"
38038 </literallayout>
38039 <para>
38040 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
38041 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_prefix</option>.
38042 </para>
38043 <para>
38044 <indexterm role="option">
38045 <primary><option>message_suffix</option></primary>
38046 </indexterm>
38047 </para>
38048 <informaltable frame="all">
38049 <tgroup cols="4" colsep="0" rowsep="0">
38050 <colspec colwidth="8*" align="left"/>
38051 <colspec colwidth="6*" align="center"/>
38052 <colspec colwidth="6*" align="center"/>
38053 <colspec colwidth="6*" align="right"/>
38054 <tbody>
38055 <row>
38056 <entry><option>message_suffix</option></entry>
38057 <entry>Use: <emphasis>appendfile</emphasis></entry>
38058 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38059 <entry>Default: <emphasis>see below</emphasis></entry>
38060 </row>
38061 </tbody>
38062 </tgroup>
38063 </informaltable>
38064 <para>
38065 The string specified here is expanded and output at the end of every message.
38066 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
38067 in which case it is a single newline character. The suffix can be suppressed by
38068 setting
38069 </para>
38070 <literallayout class="monospaced">
38071 message_suffix =
38072 </literallayout>
38073 <para>
38074 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
38075 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_suffix</option>.
38076 </para>
38077 <para>
38078 <indexterm role="option">
38079 <primary><option>mode</option></primary>
38080 </indexterm>
38081 </para>
38082 <informaltable frame="all">
38083 <tgroup cols="4" colsep="0" rowsep="0">
38084 <colspec colwidth="8*" align="left"/>
38085 <colspec colwidth="6*" align="center"/>
38086 <colspec colwidth="6*" align="center"/>
38087 <colspec colwidth="6*" align="right"/>
38088 <tbody>
38089 <row>
38090 <entry><option>mode</option></entry>
38091 <entry>Use: <emphasis>appendfile</emphasis></entry>
38092 <entry>Type: <emphasis>octal integer</emphasis></entry>
38093 <entry>Default: <emphasis>0600</emphasis></entry>
38094 </row>
38095 </tbody>
38096 </tgroup>
38097 </informaltable>
38098 <para>
38099 If the output file is created, it is given this mode. If it already exists and
38100 has wider permissions, they are reduced to this mode. If it has narrower
38101 permissions, an error occurs unless <option>mode_fail_narrower</option> is false. However,
38102 if the delivery is the result of a <option>save</option> command in a filter file specifying
38103 a particular mode, the mode of the output file is always forced to take that
38104 value, and this option is ignored.
38105 </para>
38106 <para>
38107 <indexterm role="option">
38108 <primary><option>mode_fail_narrower</option></primary>
38109 </indexterm>
38110 </para>
38111 <informaltable frame="all">
38112 <tgroup cols="4" colsep="0" rowsep="0">
38113 <colspec colwidth="8*" align="left"/>
38114 <colspec colwidth="6*" align="center"/>
38115 <colspec colwidth="6*" align="center"/>
38116 <colspec colwidth="6*" align="right"/>
38117 <tbody>
38118 <row>
38119 <entry><option>mode_fail_narrower</option></entry>
38120 <entry>Use: <emphasis>appendfile</emphasis></entry>
38121 <entry>Type: <emphasis>boolean</emphasis></entry>
38122 <entry>Default: <emphasis>true</emphasis></entry>
38123 </row>
38124 </tbody>
38125 </tgroup>
38126 </informaltable>
38127 <para>
38128 This option applies in the case when an existing mailbox file has a narrower
38129 mode than that specified by the <option>mode</option> option. If <option>mode_fail_narrower</option> is
38130 true, the delivery is deferred (<quote>mailbox has the wrong mode</quote>); otherwise Exim
38131 continues with the delivery attempt, using the existing mode of the file.
38132 </para>
38133 <para>
38134 <indexterm role="option">
38135 <primary><option>notify_comsat</option></primary>
38136 </indexterm>
38137 </para>
38138 <informaltable frame="all">
38139 <tgroup cols="4" colsep="0" rowsep="0">
38140 <colspec colwidth="8*" align="left"/>
38141 <colspec colwidth="6*" align="center"/>
38142 <colspec colwidth="6*" align="center"/>
38143 <colspec colwidth="6*" align="right"/>
38144 <tbody>
38145 <row>
38146 <entry><option>notify_comsat</option></entry>
38147 <entry>Use: <emphasis>appendfile</emphasis></entry>
38148 <entry>Type: <emphasis>boolean</emphasis></entry>
38149 <entry>Default: <emphasis>false</emphasis></entry>
38150 </row>
38151 </tbody>
38152 </tgroup>
38153 </informaltable>
38154 <para>
38155 If this option is true, the <emphasis>comsat</emphasis> daemon is notified after every
38156 successful delivery to a user mailbox. This is the daemon that notifies logged
38157 on users about incoming mail.
38158 </para>
38159 <para>
38160 <indexterm role="option">
38161 <primary><option>quota</option></primary>
38162 </indexterm>
38163 </para>
38164 <informaltable frame="all">
38165 <tgroup cols="4" colsep="0" rowsep="0">
38166 <colspec colwidth="8*" align="left"/>
38167 <colspec colwidth="6*" align="center"/>
38168 <colspec colwidth="6*" align="center"/>
38169 <colspec colwidth="6*" align="right"/>
38170 <tbody>
38171 <row>
38172 <entry><option>quota</option></entry>
38173 <entry>Use: <emphasis>appendfile</emphasis></entry>
38174 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38175 <entry>Default: <emphasis>unset</emphasis></entry>
38176 </row>
38177 </tbody>
38178 </tgroup>
38179 </informaltable>
38180 <para>
38181 <indexterm role="concept">
38182 <primary>quota</primary>
38183 <secondary>imposed by Exim</secondary>
38184 </indexterm>
38185 This option imposes a limit on the size of the file to which Exim is appending,
38186 or to the total space used in the directory tree when the <option>directory</option> option
38187 is set. In the latter case, computation of the space used is expensive, because
38188 all the files in the directory (and any sub-directories) have to be
38189 individually inspected and their sizes summed. (See <option>quota_size_regex</option> and
38190 <option>maildir_use_size_file</option> for ways to avoid this in environments where users
38191 have no shell access to their mailboxes).
38192 </para>
38193 <para>
38194 As there is no interlock against two simultaneous deliveries into a
38195 multi-file mailbox, it is possible for the quota to be overrun in this case.
38196 For single-file mailboxes, of course, an interlock is a necessity.
38197 </para>
38198 <para>
38199 A file&#x2019;s size is taken as its <emphasis>used</emphasis> value. Because of blocking effects, this
38200 may be a lot less than the actual amount of disk space allocated to the file.
38201 If the sizes of a number of files are being added up, the rounding effect can
38202 become quite noticeable, especially on systems that have large block sizes.
38203 Nevertheless, it seems best to stick to the <emphasis>used</emphasis> figure, because this is
38204 the obvious value which users understand most easily.
38205 </para>
38206 <para>
38207 The value of the option is expanded, and must then be a numerical value
38208 (decimal point allowed), optionally followed by one of the letters K, M, or G,
38209 for kilobytes, megabytes, or gigabytes. If Exim is running on a system with
38210 large file support (Linux and FreeBSD have this), mailboxes larger than 2G can
38211 be handled.
38212 </para>
38213 <para>
38214 <emphasis role="bold">Note</emphasis>: A value of zero is interpreted as <quote>no quota</quote>.
38215 </para>
38216 <para>
38217 The expansion happens while Exim is running as root, before it changes uid for
38218 the delivery. This means that files that are inaccessible to the end user can
38219 be used to hold quota values that are looked up in the expansion. When delivery
38220 fails because this quota is exceeded, the handling of the error is as for
38221 system quota failures.
38222 </para>
38223 <para>
38224 By default, Exim&#x2019;s quota checking mimics system quotas, and restricts the
38225 mailbox to the specified maximum size, though the value is not accurate to the
38226 last byte, owing to separator lines and additional headers that may get added
38227 during message delivery. When a mailbox is nearly full, large messages may get
38228 refused even though small ones are accepted, because the size of the current
38229 message is added to the quota when the check is made. This behaviour can be
38230 changed by setting <option>quota_is_inclusive</option> false. When this is done, the check
38231 for exceeding the quota does not include the current message. Thus, deliveries
38232 continue until the quota has been exceeded; thereafter, no further messages are
38233 delivered. See also <option>quota_warn_threshold</option>.
38234 </para>
38235 <para>
38236 <indexterm role="option">
38237 <primary><option>quota_directory</option></primary>
38238 </indexterm>
38239 </para>
38240 <informaltable frame="all">
38241 <tgroup cols="4" colsep="0" rowsep="0">
38242 <colspec colwidth="8*" align="left"/>
38243 <colspec colwidth="6*" align="center"/>
38244 <colspec colwidth="6*" align="center"/>
38245 <colspec colwidth="6*" align="right"/>
38246 <tbody>
38247 <row>
38248 <entry><option>quota_directory</option></entry>
38249 <entry>Use: <emphasis>appendfile</emphasis></entry>
38250 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38251 <entry>Default: <emphasis>unset</emphasis></entry>
38252 </row>
38253 </tbody>
38254 </tgroup>
38255 </informaltable>
38256 <para>
38257 This option defines the directory to check for quota purposes when delivering
38258 into individual files. The default is the delivery directory, or, if a file
38259 called <filename>maildirfolder</filename> exists in a maildir directory, the parent of the
38260 delivery directory.
38261 </para>
38262 <para>
38263 <indexterm role="option">
38264 <primary><option>quota_filecount</option></primary>
38265 </indexterm>
38266 </para>
38267 <informaltable frame="all">
38268 <tgroup cols="4" colsep="0" rowsep="0">
38269 <colspec colwidth="8*" align="left"/>
38270 <colspec colwidth="6*" align="center"/>
38271 <colspec colwidth="6*" align="center"/>
38272 <colspec colwidth="6*" align="right"/>
38273 <tbody>
38274 <row>
38275 <entry><option>quota_filecount</option></entry>
38276 <entry>Use: <emphasis>appendfile</emphasis></entry>
38277 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38278 <entry>Default: <emphasis>0</emphasis></entry>
38279 </row>
38280 </tbody>
38281 </tgroup>
38282 </informaltable>
38283 <para>
38284 This option applies when the <option>directory</option> option is set. It limits the total
38285 number of files in the directory (compare the inode limit in system quotas). It
38286 can only be used if <option>quota</option> is also set. The value is expanded; an expansion
38287 failure causes delivery to be deferred. A value of zero is interpreted as
38288 <quote>no quota</quote>.
38289 </para>
38290 <para>
38291 <indexterm role="option">
38292 <primary><option>quota_is_inclusive</option></primary>
38293 </indexterm>
38294 </para>
38295 <informaltable frame="all">
38296 <tgroup cols="4" colsep="0" rowsep="0">
38297 <colspec colwidth="8*" align="left"/>
38298 <colspec colwidth="6*" align="center"/>
38299 <colspec colwidth="6*" align="center"/>
38300 <colspec colwidth="6*" align="right"/>
38301 <tbody>
38302 <row>
38303 <entry><option>quota_is_inclusive</option></entry>
38304 <entry>Use: <emphasis>appendfile</emphasis></entry>
38305 <entry>Type: <emphasis>boolean</emphasis></entry>
38306 <entry>Default: <emphasis>true</emphasis></entry>
38307 </row>
38308 </tbody>
38309 </tgroup>
38310 </informaltable>
38311 <para>
38312 See <option>quota</option> above.
38313 </para>
38314 <para>
38315 <indexterm role="option">
38316 <primary><option>quota_size_regex</option></primary>
38317 </indexterm>
38318 </para>
38319 <informaltable frame="all">
38320 <tgroup cols="4" colsep="0" rowsep="0">
38321 <colspec colwidth="8*" align="left"/>
38322 <colspec colwidth="6*" align="center"/>
38323 <colspec colwidth="6*" align="center"/>
38324 <colspec colwidth="6*" align="right"/>
38325 <tbody>
38326 <row>
38327 <entry><option>quota_size_regex</option></entry>
38328 <entry>Use: <emphasis>appendfile</emphasis></entry>
38329 <entry>Type: <emphasis>string</emphasis></entry>
38330 <entry>Default: <emphasis>unset</emphasis></entry>
38331 </row>
38332 </tbody>
38333 </tgroup>
38334 </informaltable>
38335 <para>
38336 This option applies when one of the delivery modes that writes a separate file
38337 for each message is being used. When Exim wants to find the size of one of
38338 these files in order to test the quota, it first checks <option>quota_size_regex</option>.
38339 If this is set to a regular expression that matches the file name, and it
38340 captures one string, that string is interpreted as a representation of the
38341 file&#x2019;s size. The value of <option>quota_size_regex</option> is not expanded.
38342 </para>
38343 <para>
38344 This feature is useful only when users have no shell access to their mailboxes
38345 &ndash; otherwise they could defeat the quota simply by renaming the files. This
38346 facility can be used with maildir deliveries, by setting <option>maildir_tag</option> to add
38347 the file length to the file name. For example:
38348 </para>
38349 <literallayout class="monospaced">
38350 maildir_tag = ,S=$message_size
38351 quota_size_regex = ,S=(\d+)
38352 </literallayout>
38353 <para>
38354 An alternative to <varname>$message_size</varname> is <varname>$message_linecount</varname>, which contains the
38355 number of lines in the message.
38356 </para>
38357 <para>
38358 The regular expression should not assume that the length is at the end of the
38359 file name (even though <option>maildir_tag</option> puts it there) because maildir MUAs
38360 sometimes add other information onto the ends of message file names.
38361 </para>
38362 <para>
38363 <indexterm role="option">
38364 <primary><option>quota_warn_message</option></primary>
38365 </indexterm>
38366 </para>
38367 <informaltable frame="all">
38368 <tgroup cols="4" colsep="0" rowsep="0">
38369 <colspec colwidth="8*" align="left"/>
38370 <colspec colwidth="6*" align="center"/>
38371 <colspec colwidth="6*" align="center"/>
38372 <colspec colwidth="6*" align="right"/>
38373 <tbody>
38374 <row>
38375 <entry><option>quota_warn_message</option></entry>
38376 <entry>Use: <emphasis>appendfile</emphasis></entry>
38377 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38378 <entry>Default: <emphasis>see below</emphasis></entry>
38379 </row>
38380 </tbody>
38381 </tgroup>
38382 </informaltable>
38383 <para>
38384 See below for the use of this option. If it is not set when
38385 <option>quota_warn_threshold</option> is set, it defaults to
38386 </para>
38387 <literallayout class="monospaced">
38388 quota_warn_message = "\
38389   To: $local_part@$domain\n\
38390   Subject: Your mailbox\n\n\
38391   This message is automatically created \
38392   by mail delivery software.\n\n\
38393   The size of your mailbox has exceeded \
38394   a warning threshold that is\n\
38395   set by the system administrator.\n"
38396 </literallayout>
38397 <para>
38398 <indexterm role="option">
38399 <primary><option>quota_warn_threshold</option></primary>
38400 </indexterm>
38401 </para>
38402 <informaltable frame="all">
38403 <tgroup cols="4" colsep="0" rowsep="0">
38404 <colspec colwidth="8*" align="left"/>
38405 <colspec colwidth="6*" align="center"/>
38406 <colspec colwidth="6*" align="center"/>
38407 <colspec colwidth="6*" align="right"/>
38408 <tbody>
38409 <row>
38410 <entry><option>quota_warn_threshold</option></entry>
38411 <entry>Use: <emphasis>appendfile</emphasis></entry>
38412 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38413 <entry>Default: <emphasis>0</emphasis></entry>
38414 </row>
38415 </tbody>
38416 </tgroup>
38417 </informaltable>
38418 <para>
38419 <indexterm role="concept">
38420 <primary>quota</primary>
38421 <secondary>warning threshold</secondary>
38422 </indexterm>
38423 <indexterm role="concept">
38424 <primary>mailbox</primary>
38425 <secondary>size warning</secondary>
38426 </indexterm>
38427 <indexterm role="concept">
38428 <primary>size</primary>
38429 <secondary>of mailbox</secondary>
38430 </indexterm>
38431 This option is expanded in the same way as <option>quota</option> (see above). If the
38432 resulting value is greater than zero, and delivery of the message causes the
38433 size of the file or total space in the directory tree to cross the given
38434 threshold, a warning message is sent. If <option>quota</option> is also set, the threshold
38435 may be specified as a percentage of it by following the value with a percent
38436 sign. For example:
38437 </para>
38438 <literallayout class="monospaced">
38439 quota = 10M
38440 quota_warn_threshold = 75%
38441 </literallayout>
38442 <para>
38443 If <option>quota</option> is not set, a setting of <option>quota_warn_threshold</option> that ends with a
38444 percent sign is ignored.
38445 </para>
38446 <para>
38447 The warning message itself is specified by the <option>quota_warn_message</option> option,
38448 and it must start with a <emphasis>To:</emphasis> header line containing the recipient(s) of the
38449 warning message. These do not necessarily have to include the recipient(s) of
38450 the original message. A <emphasis>Subject:</emphasis> line should also normally be supplied. You
38451 can include any other header lines that you want. If you do not include a
38452 <emphasis>From:</emphasis> line, the default is:
38453 </para>
38454 <literallayout class="monospaced">
38455 From: Mail Delivery System &lt;mailer-daemon@$qualify_domain_sender&gt;
38456 </literallayout>
38457 <para>
38458 <indexterm role="option">
38459 <primary><option>errors_reply_to</option></primary>
38460 </indexterm>
38461 If you supply a <emphasis>Reply-To:</emphasis> line, it overrides the global <option>errors_reply_to</option>
38462 option.
38463 </para>
38464 <para>
38465 The <option>quota</option> option does not have to be set in order to use this option; they
38466 are independent of one another except when the threshold is specified as a
38467 percentage.
38468 </para>
38469 <para>
38470 <indexterm role="option">
38471 <primary><option>use_bsmtp</option></primary>
38472 </indexterm>
38473 </para>
38474 <informaltable frame="all">
38475 <tgroup cols="4" colsep="0" rowsep="0">
38476 <colspec colwidth="8*" align="left"/>
38477 <colspec colwidth="6*" align="center"/>
38478 <colspec colwidth="6*" align="center"/>
38479 <colspec colwidth="6*" align="right"/>
38480 <tbody>
38481 <row>
38482 <entry><option>use_bsmtp</option></entry>
38483 <entry>Use: <emphasis>appendfile</emphasis></entry>
38484 <entry>Type: <emphasis>boolean</emphasis></entry>
38485 <entry>Default: <emphasis>false</emphasis></entry>
38486 </row>
38487 </tbody>
38488 </tgroup>
38489 </informaltable>
38490 <para>
38491 <indexterm role="concept">
38492 <primary>envelope sender</primary>
38493 </indexterm>
38494 If this option is set true, <command>appendfile</command> writes messages in <quote>batch SMTP</quote>
38495 format, with the envelope sender and recipient(s) included as SMTP commands. If
38496 you want to include a leading HELO command with such messages, you can do
38497 so by setting the <option>message_prefix</option> option. See section <xref linkend="SECTbatchSMTP"/>
38498 for details of batch SMTP.
38499 </para>
38500 <para>
38501 <indexterm role="option">
38502 <primary><option>use_crlf</option></primary>
38503 </indexterm>
38504 </para>
38505 <informaltable frame="all">
38506 <tgroup cols="4" colsep="0" rowsep="0">
38507 <colspec colwidth="8*" align="left"/>
38508 <colspec colwidth="6*" align="center"/>
38509 <colspec colwidth="6*" align="center"/>
38510 <colspec colwidth="6*" align="right"/>
38511 <tbody>
38512 <row>
38513 <entry><option>use_crlf</option></entry>
38514 <entry>Use: <emphasis>appendfile</emphasis></entry>
38515 <entry>Type: <emphasis>boolean</emphasis></entry>
38516 <entry>Default: <emphasis>false</emphasis></entry>
38517 </row>
38518 </tbody>
38519 </tgroup>
38520 </informaltable>
38521 <para>
38522 <indexterm role="concept">
38523 <primary>carriage return</primary>
38524 </indexterm>
38525 <indexterm role="concept">
38526 <primary>linefeed</primary>
38527 </indexterm>
38528 This option causes lines to be terminated with the two-character CRLF sequence
38529 (carriage return, linefeed) instead of just a linefeed character. In the case
38530 of batched SMTP, the byte sequence written to the file is then an exact image
38531 of what would be sent down a real SMTP connection.
38532 </para>
38533 <para>
38534 <emphasis role="bold">Note:</emphasis> The contents of the <option>message_prefix</option> and <option>message_suffix</option> options
38535 (which are used to supply the traditional <quote>From&nbsp;</quote> and blank line separators
38536 in Berkeley-style mailboxes) are written verbatim, so must contain their own
38537 carriage return characters if these are needed. In cases where these options
38538 have non-empty defaults, the values end with a single linefeed, so they must be
38539 changed to end with <literal>\r\n</literal> if <option>use_crlf</option> is set.
38540 </para>
38541 <para>
38542 <indexterm role="option">
38543 <primary><option>use_fcntl_lock</option></primary>
38544 </indexterm>
38545 </para>
38546 <informaltable frame="all">
38547 <tgroup cols="4" colsep="0" rowsep="0">
38548 <colspec colwidth="8*" align="left"/>
38549 <colspec colwidth="6*" align="center"/>
38550 <colspec colwidth="6*" align="center"/>
38551 <colspec colwidth="6*" align="right"/>
38552 <tbody>
38553 <row>
38554 <entry><option>use_fcntl_lock</option></entry>
38555 <entry>Use: <emphasis>appendfile</emphasis></entry>
38556 <entry>Type: <emphasis>boolean</emphasis></entry>
38557 <entry>Default: <emphasis>see below</emphasis></entry>
38558 </row>
38559 </tbody>
38560 </tgroup>
38561 </informaltable>
38562 <para>
38563 This option controls the use of the <function>fcntl()</function> function to lock a file for
38564 exclusive use when a message is being appended. It is set by default unless
38565 <option>use_flock_lock</option> is set. Otherwise, it should be turned off only if you know
38566 that all your MUAs use lock file locking. When both <option>use_fcntl_lock</option> and
38567 <option>use_flock_lock</option> are unset, <option>use_lockfile</option> must be set.
38568 </para>
38569 <para>
38570 <indexterm role="option">
38571 <primary><option>use_flock_lock</option></primary>
38572 </indexterm>
38573 </para>
38574 <informaltable frame="all">
38575 <tgroup cols="4" colsep="0" rowsep="0">
38576 <colspec colwidth="8*" align="left"/>
38577 <colspec colwidth="6*" align="center"/>
38578 <colspec colwidth="6*" align="center"/>
38579 <colspec colwidth="6*" align="right"/>
38580 <tbody>
38581 <row>
38582 <entry><option>use_flock_lock</option></entry>
38583 <entry>Use: <emphasis>appendfile</emphasis></entry>
38584 <entry>Type: <emphasis>boolean</emphasis></entry>
38585 <entry>Default: <emphasis>false</emphasis></entry>
38586 </row>
38587 </tbody>
38588 </tgroup>
38589 </informaltable>
38590 <para>
38591 This option is provided to support the use of <function>flock()</function> for file locking, for
38592 the few situations where it is needed. Most modern operating systems support
38593 <function>fcntl()</function> and <function>lockf()</function> locking, and these two functions interwork with
38594 each other. Exim uses <function>fcntl()</function> locking by default.
38595 </para>
38596 <para>
38597 This option is required only if you are using an operating system where
38598 <function>flock()</function> is used by programs that access mailboxes (typically MUAs), and
38599 where <function>flock()</function> does not correctly interwork with <function>fcntl()</function>. You can use
38600 both <function>fcntl()</function> and <function>flock()</function> locking simultaneously if you want.
38601 </para>
38602 <para>
38603 <indexterm role="concept">
38604 <primary>Solaris</primary>
38605 <secondary><function>flock()</function> support</secondary>
38606 </indexterm>
38607 Not all operating systems provide <function>flock()</function>. Some versions of Solaris do not
38608 have it (and some, I think, provide a not quite right version built on top of
38609 <function>lockf()</function>). If the OS does not have <function>flock()</function>, Exim will be built without
38610 the ability to use it, and any attempt to do so will cause a configuration
38611 error.
38612 </para>
38613 <para>
38614 <emphasis role="bold">Warning</emphasis>: <function>flock()</function> locks do not work on NFS files (unless <function>flock()</function>
38615 is just being mapped onto <function>fcntl()</function> by the OS).
38616 </para>
38617 <para>
38618 <indexterm role="option">
38619 <primary><option>use_lockfile</option></primary>
38620 </indexterm>
38621 </para>
38622 <informaltable frame="all">
38623 <tgroup cols="4" colsep="0" rowsep="0">
38624 <colspec colwidth="8*" align="left"/>
38625 <colspec colwidth="6*" align="center"/>
38626 <colspec colwidth="6*" align="center"/>
38627 <colspec colwidth="6*" align="right"/>
38628 <tbody>
38629 <row>
38630 <entry><option>use_lockfile</option></entry>
38631 <entry>Use: <emphasis>appendfile</emphasis></entry>
38632 <entry>Type: <emphasis>boolean</emphasis></entry>
38633 <entry>Default: <emphasis>see below</emphasis></entry>
38634 </row>
38635 </tbody>
38636 </tgroup>
38637 </informaltable>
38638 <para>
38639 If this option is turned off, Exim does not attempt to create a lock file when
38640 appending to a mailbox file. In this situation, the only locking is by
38641 <function>fcntl()</function>. You should only turn <option>use_lockfile</option> off if you are absolutely
38642 sure that every MUA that is ever going to look at your users&#x2019; mailboxes uses
38643 <function>fcntl()</function> rather than a lock file, and even then only when you are not
38644 delivering over NFS from more than one host.
38645 </para>
38646 <para>
38647 <indexterm role="concept">
38648 <primary>NFS</primary>
38649 <secondary>lock file</secondary>
38650 </indexterm>
38651 In order to append to an NFS file safely from more than one host, it is
38652 necessary to take out a lock <emphasis>before</emphasis> opening the file, and the lock file
38653 achieves this. Otherwise, even with <function>fcntl()</function> locking, there is a risk of
38654 file corruption.
38655 </para>
38656 <para>
38657 The <option>use_lockfile</option> option is set by default unless <option>use_mbx_lock</option> is set.
38658 It is not possible to turn both <option>use_lockfile</option> and <option>use_fcntl_lock</option> off,
38659 except when <option>mbx_format</option> is set.
38660 </para>
38661 <para>
38662 <indexterm role="option">
38663 <primary><option>use_mbx_lock</option></primary>
38664 </indexterm>
38665 </para>
38666 <informaltable frame="all">
38667 <tgroup cols="4" colsep="0" rowsep="0">
38668 <colspec colwidth="8*" align="left"/>
38669 <colspec colwidth="6*" align="center"/>
38670 <colspec colwidth="6*" align="center"/>
38671 <colspec colwidth="6*" align="right"/>
38672 <tbody>
38673 <row>
38674 <entry><option>use_mbx_lock</option></entry>
38675 <entry>Use: <emphasis>appendfile</emphasis></entry>
38676 <entry>Type: <emphasis>boolean</emphasis></entry>
38677 <entry>Default: <emphasis>see below</emphasis></entry>
38678 </row>
38679 </tbody>
38680 </tgroup>
38681 </informaltable>
38682 <para>
38683 This option is available only if Exim has been compiled with SUPPORT_MBX
38684 set in <filename>Local/Makefile</filename>. Setting the option specifies that special MBX
38685 locking rules be used. It is set by default if <option>mbx_format</option> is set and none
38686 of the locking options are mentioned in the configuration. The locking rules
38687 are the same as are used by the <emphasis>c-client</emphasis> library that underlies Pine and
38688 the IMAP4 and POP daemons that come with it (see the discussion below). The
38689 rules allow for shared access to the mailbox. However, this kind of locking
38690 does not work when the mailbox is NFS mounted.
38691 </para>
38692 <para>
38693 You can set <option>use_mbx_lock</option> with either (or both) of <option>use_fcntl_lock</option> and
38694 <option>use_flock_lock</option> to control what kind of locking is used in implementing the
38695 MBX locking rules. The default is to use <function>fcntl()</function> if <option>use_mbx_lock</option> is set
38696 without <option>use_fcntl_lock</option> or <option>use_flock_lock</option>.
38697 </para>
38698 </section>
38699 <section id="SECTopappend">
38700 <title>Operational details for appending</title>
38701 <para>
38702 <indexterm role="concept">
38703 <primary>appending to a file</primary>
38704 </indexterm>
38705 <indexterm role="concept">
38706 <primary>file</primary>
38707 <secondary>appending</secondary>
38708 </indexterm>
38709 Before appending to a file, the following preparations are made:
38710 </para>
38711 <itemizedlist>
38712 <listitem>
38713 <para>
38714 If the name of the file is <filename>/dev/null</filename>, no action is taken, and a success
38715 return is given.
38716 </para>
38717 </listitem>
38718 <listitem>
38719 <para>
38720 <indexterm role="concept">
38721 <primary>directory creation</primary>
38722 </indexterm>
38723 If any directories on the file&#x2019;s path are missing, Exim creates them if the
38724 <option>create_directory</option> option is set. A created directory&#x2019;s mode is given by the
38725 <option>directory_mode</option> option.
38726 </para>
38727 </listitem>
38728 <listitem>
38729 <para>
38730 If <option>file_format</option> is set, the format of an existing file is checked. If this
38731 indicates that a different transport should be used, control is passed to that
38732 transport.
38733 </para>
38734 </listitem>
38735 <listitem>
38736 <para>
38737 <indexterm role="concept">
38738 <primary>file</primary>
38739 <secondary>locking</secondary>
38740 </indexterm>
38741 <indexterm role="concept">
38742 <primary>locking files</primary>
38743 </indexterm>
38744 <indexterm role="concept">
38745 <primary>NFS</primary>
38746 <secondary>lock file</secondary>
38747 </indexterm>
38748 If <option>use_lockfile</option> is set, a lock file is built in a way that will work
38749 reliably over NFS, as follows:
38750 </para>
38751 <orderedlist numeration="arabic">
38752 <listitem>
38753 <para>
38754 Create a <quote>hitching post</quote> file whose name is that of the lock file with the
38755 current time, primary host name, and process id added, by opening for writing
38756 as a new file. If this fails with an access error, delivery is deferred.
38757 </para>
38758 </listitem>
38759 <listitem>
38760 <para>
38761 Close the hitching post file, and hard link it to the lock file name.
38762 </para>
38763 </listitem>
38764 <listitem>
38765 <para>
38766 If the call to <function>link()</function> succeeds, creation of the lock file has succeeded.
38767 Unlink the hitching post name.
38768 </para>
38769 </listitem>
38770 <listitem>
38771 <para>
38772 Otherwise, use <function>stat()</function> to get information about the hitching post file, and
38773 then unlink hitching post name. If the number of links is exactly two, creation
38774 of the lock file succeeded but something (for example, an NFS server crash and
38775 restart) caused this fact not to be communicated to the <function>link()</function> call.
38776 </para>
38777 </listitem>
38778 <listitem>
38779 <para>
38780 If creation of the lock file failed, wait for <option>lock_interval</option> and try again,
38781 up to <option>lock_retries</option> times. However, since any program that writes to a
38782 mailbox should complete its task very quickly, it is reasonable to time out old
38783 lock files that are normally the result of user agent and system crashes. If an
38784 existing lock file is older than <option>lockfile_timeout</option> Exim attempts to unlink
38785 it before trying again.
38786 </para>
38787 </listitem>
38788 </orderedlist>
38789 </listitem>
38790 <listitem>
38791 <para>
38792 A call is made to <function>lstat()</function> to discover whether the main file exists, and if
38793 so, what its characteristics are. If <function>lstat()</function> fails for any reason other
38794 than non-existence, delivery is deferred.
38795 </para>
38796 </listitem>
38797 <listitem>
38798 <para>
38799 <indexterm role="concept">
38800 <primary>symbolic link</primary>
38801 <secondary>to mailbox</secondary>
38802 </indexterm>
38803 <indexterm role="concept">
38804 <primary>mailbox</primary>
38805 <secondary>symbolic link</secondary>
38806 </indexterm>
38807 If the file does exist and is a symbolic link, delivery is deferred, unless the
38808 <option>allow_symlink</option> option is set, in which case the ownership of the link is
38809 checked, and then <function>stat()</function> is called to find out about the real file, which
38810 is then subjected to the checks below. The check on the top-level link
38811 ownership prevents one user creating a link for another&#x2019;s mailbox in a sticky
38812 directory, though allowing symbolic links in this case is definitely not a good
38813 idea. If there is a chain of symbolic links, the intermediate ones are not
38814 checked.
38815 </para>
38816 </listitem>
38817 <listitem>
38818 <para>
38819 If the file already exists but is not a regular file, or if the file&#x2019;s owner
38820 and group (if the group is being checked &ndash; see <option>check_group</option> above) are
38821 different from the user and group under which the delivery is running,
38822 delivery is deferred.
38823 </para>
38824 </listitem>
38825 <listitem>
38826 <para>
38827 If the file&#x2019;s permissions are more generous than specified, they are reduced.
38828 If they are insufficient, delivery is deferred, unless <option>mode_fail_narrower</option>
38829 is set false, in which case the delivery is tried using the existing
38830 permissions.
38831 </para>
38832 </listitem>
38833 <listitem>
38834 <para>
38835 The file&#x2019;s inode number is saved, and the file is then opened for appending.
38836 If this fails because the file has vanished, <command>appendfile</command> behaves as if it
38837 hadn&#x2019;t existed (see below). For any other failures, delivery is deferred.
38838 </para>
38839 </listitem>
38840 <listitem>
38841 <para>
38842 If the file is opened successfully, check that the inode number hasn&#x2019;t
38843 changed, that it is still a regular file, and that the owner and permissions
38844 have not changed. If anything is wrong, defer delivery and freeze the message.
38845 </para>
38846 </listitem>
38847 <listitem>
38848 <para>
38849 If the file did not exist originally, defer delivery if the <option>file_must_exist</option>
38850 option is set. Otherwise, check that the file is being created in a permitted
38851 directory if the <option>create_file</option> option is set (deferring on failure), and then
38852 open for writing as a new file, with the O_EXCL and O_CREAT options,
38853 except when dealing with a symbolic link (the <option>allow_symlink</option> option must be
38854 set). In this case, which can happen if the link points to a non-existent file,
38855 the file is opened for writing using O_CREAT but not O_EXCL, because
38856 that prevents link following.
38857 </para>
38858 </listitem>
38859 <listitem>
38860 <para>
38861 <indexterm role="concept">
38862 <primary>loop</primary>
38863 <secondary>while file testing</secondary>
38864 </indexterm>
38865 If opening fails because the file exists, obey the tests given above for
38866 existing files. However, to avoid looping in a situation where the file is
38867 being continuously created and destroyed, the exists/not-exists loop is broken
38868 after 10 repetitions, and the message is then frozen.
38869 </para>
38870 </listitem>
38871 <listitem>
38872 <para>
38873 If opening fails with any other error, defer delivery.
38874 </para>
38875 </listitem>
38876 <listitem>
38877 <para>
38878 <indexterm role="concept">
38879 <primary>file</primary>
38880 <secondary>locking</secondary>
38881 </indexterm>
38882 <indexterm role="concept">
38883 <primary>locking files</primary>
38884 </indexterm>
38885 Once the file is open, unless both <option>use_fcntl_lock</option> and <option>use_flock_lock</option>
38886 are false, it is locked using <function>fcntl()</function> or <function>flock()</function> or both. If
38887 <option>use_mbx_lock</option> is false, an exclusive lock is requested in each case.
38888 However, if <option>use_mbx_lock</option> is true, Exim takes out a shared lock on the open
38889 file, and an exclusive lock on the file whose name is
38890 </para>
38891 <literallayout class="monospaced">
38892 /tmp/.&lt;device-number&gt;.&lt;inode-number&gt;
38893 </literallayout>
38894 <para>
38895 using the device and inode numbers of the open mailbox file, in accordance with
38896 the MBX locking rules. This file is created with a mode that is specified by
38897 the <option>lockfile_mode</option> option.
38898 </para>
38899 <para>
38900 If Exim fails to lock the file, there are two possible courses of action,
38901 depending on the value of the locking timeout. This is obtained from
38902 <option>lock_fcntl_timeout</option> or <option>lock_flock_timeout</option>, as appropriate.
38903 </para>
38904 <para>
38905 If the timeout value is zero, the file is closed, Exim waits for
38906 <option>lock_interval</option>, and then goes back and re-opens the file as above and tries
38907 to lock it again. This happens up to <option>lock_retries</option> times, after which the
38908 delivery is deferred.
38909 </para>
38910 <para>
38911 If the timeout has a value greater than zero, blocking calls to <function>fcntl()</function> or
38912 <function>flock()</function> are used (with the given timeout), so there has already been some
38913 waiting involved by the time locking fails. Nevertheless, Exim does not give up
38914 immediately. It retries up to
38915 </para>
38916 <literallayout class="monospaced">
38917 (lock_retries * lock_interval) / &lt;timeout&gt;
38918 </literallayout>
38919 <para>
38920 times (rounded up).
38921 </para>
38922 </listitem>
38923 </itemizedlist>
38924 <para>
38925 At the end of delivery, Exim closes the file (which releases the <function>fcntl()</function>
38926 and/or <function>flock()</function> locks) and then deletes the lock file if one was created.
38927 </para>
38928 </section>
38929 <section id="SECTopdir">
38930 <title>Operational details for delivery to a new file</title>
38931 <para>
38932 <indexterm role="concept">
38933 <primary>delivery</primary>
38934 <secondary>to single file</secondary>
38935 </indexterm>
38936 <indexterm role="concept">
38937 <primary><quote>From</quote> line</primary>
38938 </indexterm>
38939 When the <option>directory</option> option is set instead of <option>file</option>, each message is
38940 delivered into a newly-created file or set of files. When <command>appendfile</command> is
38941 activated directly from a <command>redirect</command> router, neither <option>file</option> nor
38942 <option>directory</option> is normally set, because the path for delivery is supplied by the
38943 router. (See for example, the <command>address_file</command> transport in the default
38944 configuration.) In this case, delivery is to a new file if either the path name
38945 ends in <literal>/</literal>, or the <option>maildir_format</option> or <option>mailstore_format</option> option is set.
38946 </para>
38947 <para>
38948 No locking is required while writing the message to a new file, so the various
38949 locking options of the transport are ignored. The <quote>From</quote> line that by default
38950 separates messages in a single file is not normally needed, nor is the escaping
38951 of message lines that start with <quote>From</quote>, and there is no need to ensure a
38952 newline at the end of each message. Consequently, the default values for
38953 <option>check_string</option>, <option>message_prefix</option>, and <option>message_suffix</option> are all unset when
38954 any of <option>directory</option>, <option>maildir_format</option>, or <option>mailstore_format</option> is set.
38955 </para>
38956 <para>
38957 If Exim is required to check a <option>quota</option> setting, it adds up the sizes of all
38958 the files in the delivery directory by default. However, you can specify a
38959 different directory by setting <option>quota_directory</option>. Also, for maildir
38960 deliveries (see below) the <filename>maildirfolder</filename> convention is honoured.
38961 </para>
38962 <para>
38963 <indexterm role="concept">
38964 <primary>maildir format</primary>
38965 </indexterm>
38966 <indexterm role="concept">
38967 <primary>mailstore format</primary>
38968 </indexterm>
38969 There are three different ways in which delivery to individual files can be
38970 done, controlled by the settings of the <option>maildir_format</option> and
38971 <option>mailstore_format</option> options. Note that code to support maildir or mailstore
38972 formats is not included in the binary unless SUPPORT_MAILDIR or
38973 SUPPORT_MAILSTORE, respectively, is set in <filename>Local/Makefile</filename>.
38974 </para>
38975 <para>
38976 <indexterm role="concept">
38977 <primary>directory creation</primary>
38978 </indexterm>
38979 In all three cases an attempt is made to create the directory and any necessary
38980 sub-directories if they do not exist, provided that the <option>create_directory</option>
38981 option is set (the default). The location of a created directory can be
38982 constrained by setting <option>create_file</option>. A created directory&#x2019;s mode is given by
38983 the <option>directory_mode</option> option. If creation fails, or if the
38984 <option>create_directory</option> option is not set when creation is required, delivery is
38985 deferred.
38986 </para>
38987 </section>
38988 <section id="SECTmaildirdelivery">
38989 <title>Maildir delivery</title>
38990 <para>
38991 <indexterm role="concept">
38992 <primary>maildir format</primary>
38993 <secondary>description of</secondary>
38994 </indexterm>
38995 If the <option>maildir_format</option> option is true, Exim delivers each message by writing
38996 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
38997 directory that is defined by the <option>directory</option> option (the <quote>delivery
38998 directory</quote>). If the delivery is successful, the file is renamed into the
38999 <filename>new</filename> subdirectory.
39000 </para>
39001 <para>
39002 In the file name, &lt;<emphasis>stime</emphasis>&gt; is the current time of day in seconds, and
39003 &lt;<emphasis>mtime</emphasis>&gt; is the microsecond fraction of the time. After a maildir delivery,
39004 Exim checks that the time-of-day clock has moved on by at least one microsecond
39005 before terminating the delivery process. This guarantees uniqueness for the
39006 file name. However, as a precaution, Exim calls <function>stat()</function> for the file before
39007 opening it. If any response other than ENOENT (does not exist) is given,
39008 Exim waits 2 seconds and tries again, up to <option>maildir_retries</option> times.
39009 </para>
39010 <para>
39011 Before Exim carries out a maildir delivery, it ensures that subdirectories
39012 called <filename>new</filename>, <filename>cur</filename>, and <filename>tmp</filename> exist in the delivery directory. If they
39013 do not exist, Exim tries to create them and any superior directories in their
39014 path, subject to the <option>create_directory</option> and <option>create_file</option> options. If the
39015 <option>maildirfolder_create_regex</option> option is set, and the regular expression it
39016 contains matches the delivery directory, Exim also ensures that a file called
39017 <filename>maildirfolder</filename> exists in the delivery directory. If a missing directory or
39018 <filename>maildirfolder</filename> file cannot be created, delivery is deferred.
39019 </para>
39020 <para>
39021 These features make it possible to use Exim to create all the necessary files
39022 and directories in a maildir mailbox, including subdirectories for maildir++
39023 folders. Consider this example:
39024 </para>
39025 <literallayout class="monospaced">
39026 maildir_format = true
39027 directory = /var/mail/$local_part\
39028            ${if eq{$local_part_suffix}{}{}\
39029            {/.${substr_1:$local_part_suffix}}}
39030 maildirfolder_create_regex = /\.[^/]+$
39031 </literallayout>
39032 <para>
39033 If <varname>$local_part_suffix</varname> is empty (there was no suffix for the local part),
39034 delivery is into a toplevel maildir with a name like <filename>/var/mail/pimbo</filename> (for
39035 the user called <emphasis>pimbo</emphasis>). The pattern in <option>maildirfolder_create_regex</option> does
39036 not match this name, so Exim will not look for or create the file
39037 <filename>/var/mail/pimbo/maildirfolder</filename>, though it will create
39038 <filename>/var/mail/pimbo/{cur,new,tmp}</filename> if necessary.
39039 </para>
39040 <para>
39041 However, if <varname>$local_part_suffix</varname> contains <literal>-eximusers</literal> (for example),
39042 delivery is into the maildir++ folder <filename>/var/mail/pimbo/.eximusers</filename>, which
39043 does match <option>maildirfolder_create_regex</option>. In this case, Exim will create
39044 <filename>/var/mail/pimbo/.eximusers/maildirfolder</filename> as well as the three maildir
39045 directories <filename>/var/mail/pimbo/.eximusers/{cur,new,tmp}</filename>.
39046 </para>
39047 <para>
39048 <emphasis role="bold">Warning:</emphasis> Take care when setting <option>maildirfolder_create_regex</option> that it does
39049 not inadvertently match the toplevel maildir directory, because a
39050 <filename>maildirfolder</filename> file at top level would completely break quota calculations.
39051 </para>
39052 <para>
39053 <indexterm role="concept">
39054 <primary>quota</primary>
39055 <secondary>in maildir delivery</secondary>
39056 </indexterm>
39057 <indexterm role="concept">
39058 <primary>maildir++</primary>
39059 </indexterm>
39060 If Exim is required to check a <option>quota</option> setting before a maildir delivery, and
39061 <option>quota_directory</option> is not set, it looks for a file called <filename>maildirfolder</filename> in
39062 the maildir directory (alongside <filename>new</filename>, <filename>cur</filename>, <filename>tmp</filename>). If this exists,
39063 Exim assumes the directory is a maildir++ folder directory, which is one level
39064 down from the user&#x2019;s top level mailbox directory. This causes it to start at
39065 the parent directory instead of the current directory when calculating the
39066 amount of space used.
39067 </para>
39068 <para>
39069 One problem with delivering into a multi-file mailbox is that it is
39070 computationally expensive to compute the size of the mailbox for quota
39071 checking. Various approaches have been taken to reduce the amount of work
39072 needed. The next two sections describe two of them. A third alternative is to
39073 use some external process for maintaining the size data, and use the expansion
39074 of the <option>mailbox_size</option> option as a way of importing it into Exim.
39075 </para>
39076 </section>
39077 <section id="SECID135">
39078 <title>Using tags to record message sizes</title>
39079 <para>
39080 If <option>maildir_tag</option> is set, the string is expanded for each delivery.
39081 When the maildir file is renamed into the <filename>new</filename> sub-directory, the
39082 tag is added to its name. However, if adding the tag takes the length of the
39083 name to the point where the test <function>stat()</function> call fails with ENAMETOOLONG,
39084 the tag is dropped and the maildir file is created with no tag.
39085 </para>
39086 <para>
39087 <indexterm role="variable">
39088 <primary><varname>$message_size</varname></primary>
39089 </indexterm>
39090 Tags can be used to encode the size of files in their names; see
39091 <option>quota_size_regex</option> above for an example. The expansion of <option>maildir_tag</option>
39092 happens after the message has been written. The value of the <varname>$message_size</varname>
39093 variable is set to the number of bytes actually written. If the expansion is
39094 forced to fail, the tag is ignored, but a non-forced failure causes delivery to
39095 be deferred. The expanded tag may contain any printing characters except <quote>/</quote>.
39096 Non-printing characters in the string are ignored; if the resulting string is
39097 empty, it is ignored. If it starts with an alphanumeric character, a leading
39098 colon is inserted.
39099 </para>
39100 </section>
39101 <section id="SECID136">
39102 <title>Using a maildirsize file</title>
39103 <para>
39104 <indexterm role="concept">
39105 <primary>quota</primary>
39106 <secondary>in maildir delivery</secondary>
39107 </indexterm>
39108 <indexterm role="concept">
39109 <primary>maildir format</primary>
39110 <secondary><filename>maildirsize</filename> file</secondary>
39111 </indexterm>
39112 If <option>maildir_use_size_file</option> is true, Exim implements the maildir++ rules for
39113 storing quota and message size information in a file called <filename>maildirsize</filename>
39114 within the toplevel maildir directory. If this file does not exist, Exim
39115 creates it, setting the quota from the <option>quota</option> option of the transport. If
39116 the maildir directory itself does not exist, it is created before any attempt
39117 to write a <filename>maildirsize</filename> file.
39118 </para>
39119 <para>
39120 The <filename>maildirsize</filename> file is used to hold information about the sizes of
39121 messages in the maildir, thus speeding up quota calculations. The quota value
39122 in the file is just a cache; if the quota is changed in the transport, the new
39123 value overrides the cached value when the next message is delivered. The cache
39124 is maintained for the benefit of other programs that access the maildir and
39125 need to know the quota.
39126 </para>
39127 <para>
39128 If the <option>quota</option> option in the transport is unset or zero, the <filename>maildirsize</filename>
39129 file is maintained (with a zero quota setting), but no quota is imposed.
39130 </para>
39131 <para>
39132 A regular expression is available for controlling which directories in the
39133 maildir participate in quota calculations when a <filename>maildirsizefile</filename> is in use.
39134 See the description of the <option>maildir_quota_directory_regex</option> option above for
39135 details.
39136 </para>
39137 </section>
39138 <section id="SECID137">
39139 <title>Mailstore delivery</title>
39140 <para>
39141 <indexterm role="concept">
39142 <primary>mailstore format</primary>
39143 <secondary>description of</secondary>
39144 </indexterm>
39145 If the <option>mailstore_format</option> option is true, each message is written as two
39146 files in the given directory. A unique base name is constructed from the
39147 message id and the current delivery process, and the files that are written use
39148 this base name plus the suffixes <filename>.env</filename> and <filename>.msg</filename>. The <filename>.env</filename> file
39149 contains the message&#x2019;s envelope, and the <filename>.msg</filename> file contains the message
39150 itself. The base name is placed in the variable <varname>$mailstore_basename</varname>.
39151 </para>
39152 <para>
39153 During delivery, the envelope is first written to a file with the suffix
39154 <filename>.tmp</filename>. The <filename>.msg</filename> file is then written, and when it is complete, the
39155 <filename>.tmp</filename> file is renamed as the <filename>.env</filename> file. Programs that access messages in
39156 mailstore format should wait for the presence of both a <filename>.msg</filename> and a <filename>.env</filename>
39157 file before accessing either of them. An alternative approach is to wait for
39158 the absence of a <filename>.tmp</filename> file.
39159 </para>
39160 <para>
39161 The envelope file starts with any text defined by the <option>mailstore_prefix</option>
39162 option, expanded and terminated by a newline if there isn&#x2019;t one. Then follows
39163 the sender address on one line, then all the recipient addresses, one per line.
39164 There can be more than one recipient only if the <option>batch_max</option> option is set
39165 greater than one. Finally, <option>mailstore_suffix</option> is expanded and the result
39166 appended to the file, followed by a newline if it does not end with one.
39167 </para>
39168 <para>
39169 If expansion of <option>mailstore_prefix</option> or <option>mailstore_suffix</option> ends with a forced
39170 failure, it is ignored. Other expansion errors are treated as serious
39171 configuration errors, and delivery is deferred. The variable
39172 <varname>$mailstore_basename</varname> is available for use during these expansions.
39173 </para>
39174 </section>
39175 <section id="SECID138">
39176 <title>Non-special new file delivery</title>
39177 <para>
39178 If neither <option>maildir_format</option> nor <option>mailstore_format</option> is set, a single new
39179 file is created directly in the named directory. For example, when delivering
39180 messages into files in batched SMTP format for later delivery to some host (see
39181 section <xref linkend="SECTbatchSMTP"/>), a setting such as
39182 </para>
39183 <literallayout class="monospaced">
39184 directory = /var/bsmtp/$host
39185 </literallayout>
39186 <para>
39187 might be used. A message is written to a file with a temporary name, which is
39188 then renamed when the delivery is complete. The final name is obtained by
39189 expanding the contents of the <option>directory_file</option> option.
39190 <indexterm role="concept" startref="IIDapptra1" class="endofrange"/>
39191 <indexterm role="concept" startref="IIDapptra2" class="endofrange"/>
39192 </para>
39193 </section>
39194 </chapter>
39195
39196 <chapter id="CHID8">
39197 <title>The autoreply transport</title>
39198 <para>
39199 <indexterm role="concept" id="IIDauttra1" class="startofrange">
39200 <primary>transports</primary>
39201 <secondary><command>autoreply</command></secondary>
39202 </indexterm>
39203 <indexterm role="concept" id="IIDauttra2" class="startofrange">
39204 <primary><command>autoreply</command> transport</primary>
39205 </indexterm>
39206 The <command>autoreply</command> transport is not a true transport in that it does not cause
39207 the message to be transmitted. Instead, it generates a new mail message as an
39208 automatic reply to the incoming message. <emphasis>References:</emphasis> and
39209 <emphasis>Auto-Submitted:</emphasis> header lines are included. These are constructed according
39210 to the rules in RFCs 2822 and 3834, respectively.
39211 </para>
39212 <para>
39213 If the router that passes the message to this transport does not have the
39214 <option>unseen</option> option set, the original message (for the current recipient) is not
39215 delivered anywhere. However, when the <option>unseen</option> option is set on the router
39216 that passes the message to this transport, routing of the address continues, so
39217 another router can set up a normal message delivery.
39218 </para>
39219 <para>
39220 The <command>autoreply</command> transport is usually run as the result of mail filtering, a
39221 <quote>vacation</quote> message being the standard example. However, it can also be run
39222 directly from a router like any other transport. To reduce the possibility of
39223 message cascades, messages created by the <command>autoreply</command> transport always have
39224 empty envelope sender addresses, like bounce messages.
39225 </para>
39226 <para>
39227 The parameters of the message to be sent can be specified in the configuration
39228 by options described below. However, these are used only when the address
39229 passed to the transport does not contain its own reply information. When the
39230 transport is run as a consequence of a
39231 <option>mail</option>
39232 or <option>vacation</option> command in a filter file, the parameters of the message are
39233 supplied by the filter, and passed with the address. The transport&#x2019;s options
39234 that define the message are then ignored (so they are not usually set in this
39235 case). The message is specified entirely by the filter or by the transport; it
39236 is never built from a mixture of options. However, the <option>file_optional</option>,
39237 <option>mode</option>, and <option>return_message</option> options apply in all cases.
39238 </para>
39239 <para>
39240 <command>Autoreply</command> is implemented as a local transport. When used as a result of a
39241 command in a user&#x2019;s filter file, <command>autoreply</command> normally runs under the uid and
39242 gid of the user, and with appropriate current and home directories (see chapter
39243 <xref linkend="CHAPenvironment"/>).
39244 </para>
39245 <para>
39246 There is a subtle difference between routing a message to a <command>pipe</command> transport
39247 that generates some text to be returned to the sender, and routing it to an
39248 <command>autoreply</command> transport. This difference is noticeable only if more than one
39249 address from the same message is so handled. In the case of a pipe, the
39250 separate outputs from the different addresses are gathered up and returned to
39251 the sender in a single message, whereas if <command>autoreply</command> is used, a separate
39252 message is generated for each address that is passed to it.
39253 </para>
39254 <para>
39255 Non-printing characters are not permitted in the header lines generated for the
39256 message that <command>autoreply</command> creates, with the exception of newlines that are
39257 immediately followed by white space. If any non-printing characters are found,
39258 the transport defers.
39259 Whether characters with the top bit set count as printing characters or not is
39260 controlled by the <option>print_topbitchars</option> global option.
39261 </para>
39262 <para>
39263 If any of the generic options for manipulating headers (for example,
39264 <option>headers_add</option>) are set on an <command>autoreply</command> transport, they apply to the copy
39265 of the original message that is included in the generated message when
39266 <option>return_message</option> is set. They do not apply to the generated message itself.
39267 </para>
39268 <para>
39269 <indexterm role="variable">
39270 <primary><varname>$sender_address</varname></primary>
39271 </indexterm>
39272 If the <command>autoreply</command> transport receives return code 2 from Exim when it submits
39273 the message, indicating that there were no recipients, it does not treat this
39274 as an error. This means that autoreplies sent to <varname>$sender_address</varname> when this
39275 is empty (because the incoming message is a bounce message) do not cause
39276 problems. They are just discarded.
39277 </para>
39278 <section id="SECID139">
39279 <title>Private options for autoreply</title>
39280 <para>
39281 <indexterm role="concept">
39282 <primary>options</primary>
39283 <secondary><command>autoreply</command> transport</secondary>
39284 </indexterm>
39285 </para>
39286 <para>
39287 <indexterm role="option">
39288 <primary><option>bcc</option></primary>
39289 </indexterm>
39290 </para>
39291 <informaltable frame="all">
39292 <tgroup cols="4" colsep="0" rowsep="0">
39293 <colspec colwidth="8*" align="left"/>
39294 <colspec colwidth="6*" align="center"/>
39295 <colspec colwidth="6*" align="center"/>
39296 <colspec colwidth="6*" align="right"/>
39297 <tbody>
39298 <row>
39299 <entry><option>bcc</option></entry>
39300 <entry>Use: <emphasis>autoreply</emphasis></entry>
39301 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39302 <entry>Default: <emphasis>unset</emphasis></entry>
39303 </row>
39304 </tbody>
39305 </tgroup>
39306 </informaltable>
39307 <para>
39308 This specifies the addresses that are to receive <quote>blind carbon copies</quote> of the
39309 message when the message is specified by the transport.
39310 </para>
39311 <para>
39312 <indexterm role="option">
39313 <primary><option>cc</option></primary>
39314 </indexterm>
39315 </para>
39316 <informaltable frame="all">
39317 <tgroup cols="4" colsep="0" rowsep="0">
39318 <colspec colwidth="8*" align="left"/>
39319 <colspec colwidth="6*" align="center"/>
39320 <colspec colwidth="6*" align="center"/>
39321 <colspec colwidth="6*" align="right"/>
39322 <tbody>
39323 <row>
39324 <entry><option>cc</option></entry>
39325 <entry>Use: <emphasis>autoreply</emphasis></entry>
39326 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39327 <entry>Default: <emphasis>unset</emphasis></entry>
39328 </row>
39329 </tbody>
39330 </tgroup>
39331 </informaltable>
39332 <para>
39333 This specifies recipients of the message and the contents of the <emphasis>Cc:</emphasis> header
39334 when the message is specified by the transport.
39335 </para>
39336 <para>
39337 <indexterm role="option">
39338 <primary><option>file</option></primary>
39339 </indexterm>
39340 </para>
39341 <informaltable frame="all">
39342 <tgroup cols="4" colsep="0" rowsep="0">
39343 <colspec colwidth="8*" align="left"/>
39344 <colspec colwidth="6*" align="center"/>
39345 <colspec colwidth="6*" align="center"/>
39346 <colspec colwidth="6*" align="right"/>
39347 <tbody>
39348 <row>
39349 <entry><option>file</option></entry>
39350 <entry>Use: <emphasis>autoreply</emphasis></entry>
39351 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39352 <entry>Default: <emphasis>unset</emphasis></entry>
39353 </row>
39354 </tbody>
39355 </tgroup>
39356 </informaltable>
39357 <para>
39358 The contents of the file are sent as the body of the message when the message
39359 is specified by the transport. If both <option>file</option> and <option>text</option> are set, the text
39360 string comes first.
39361 </para>
39362 <para>
39363 <indexterm role="option">
39364 <primary><option>file_expand</option></primary>
39365 </indexterm>
39366 </para>
39367 <informaltable frame="all">
39368 <tgroup cols="4" colsep="0" rowsep="0">
39369 <colspec colwidth="8*" align="left"/>
39370 <colspec colwidth="6*" align="center"/>
39371 <colspec colwidth="6*" align="center"/>
39372 <colspec colwidth="6*" align="right"/>
39373 <tbody>
39374 <row>
39375 <entry><option>file_expand</option></entry>
39376 <entry>Use: <emphasis>autoreply</emphasis></entry>
39377 <entry>Type: <emphasis>boolean</emphasis></entry>
39378 <entry>Default: <emphasis>false</emphasis></entry>
39379 </row>
39380 </tbody>
39381 </tgroup>
39382 </informaltable>
39383 <para>
39384 If this is set, the contents of the file named by the <option>file</option> option are
39385 subjected to string expansion as they are added to the message.
39386 </para>
39387 <para>
39388 <indexterm role="option">
39389 <primary><option>file_optional</option></primary>
39390 </indexterm>
39391 </para>
39392 <informaltable frame="all">
39393 <tgroup cols="4" colsep="0" rowsep="0">
39394 <colspec colwidth="8*" align="left"/>
39395 <colspec colwidth="6*" align="center"/>
39396 <colspec colwidth="6*" align="center"/>
39397 <colspec colwidth="6*" align="right"/>
39398 <tbody>
39399 <row>
39400 <entry><option>file_optional</option></entry>
39401 <entry>Use: <emphasis>autoreply</emphasis></entry>
39402 <entry>Type: <emphasis>boolean</emphasis></entry>
39403 <entry>Default: <emphasis>false</emphasis></entry>
39404 </row>
39405 </tbody>
39406 </tgroup>
39407 </informaltable>
39408 <para>
39409 If this option is true, no error is generated if the file named by the <option>file</option>
39410 option or passed with the address does not exist or cannot be read.
39411 </para>
39412 <para>
39413 <indexterm role="option">
39414 <primary><option>from</option></primary>
39415 </indexterm>
39416 </para>
39417 <informaltable frame="all">
39418 <tgroup cols="4" colsep="0" rowsep="0">
39419 <colspec colwidth="8*" align="left"/>
39420 <colspec colwidth="6*" align="center"/>
39421 <colspec colwidth="6*" align="center"/>
39422 <colspec colwidth="6*" align="right"/>
39423 <tbody>
39424 <row>
39425 <entry><option>from</option></entry>
39426 <entry>Use: <emphasis>autoreply</emphasis></entry>
39427 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39428 <entry>Default: <emphasis>unset</emphasis></entry>
39429 </row>
39430 </tbody>
39431 </tgroup>
39432 </informaltable>
39433 <para>
39434 This specifies the contents of the <emphasis>From:</emphasis> header when the message is
39435 specified by the transport.
39436 </para>
39437 <para>
39438 <indexterm role="option">
39439 <primary><option>headers</option></primary>
39440 </indexterm>
39441 </para>
39442 <informaltable frame="all">
39443 <tgroup cols="4" colsep="0" rowsep="0">
39444 <colspec colwidth="8*" align="left"/>
39445 <colspec colwidth="6*" align="center"/>
39446 <colspec colwidth="6*" align="center"/>
39447 <colspec colwidth="6*" align="right"/>
39448 <tbody>
39449 <row>
39450 <entry><option>headers</option></entry>
39451 <entry>Use: <emphasis>autoreply</emphasis></entry>
39452 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39453 <entry>Default: <emphasis>unset</emphasis></entry>
39454 </row>
39455 </tbody>
39456 </tgroup>
39457 </informaltable>
39458 <para>
39459 This specifies additional RFC 2822 headers that are to be added to the message
39460 when the message is specified by the transport. Several can be given by using
39461 <quote>\n</quote> to separate them. There is no check on the format.
39462 </para>
39463 <para>
39464 <indexterm role="option">
39465 <primary><option>log</option></primary>
39466 </indexterm>
39467 </para>
39468 <informaltable frame="all">
39469 <tgroup cols="4" colsep="0" rowsep="0">
39470 <colspec colwidth="8*" align="left"/>
39471 <colspec colwidth="6*" align="center"/>
39472 <colspec colwidth="6*" align="center"/>
39473 <colspec colwidth="6*" align="right"/>
39474 <tbody>
39475 <row>
39476 <entry><option>log</option></entry>
39477 <entry>Use: <emphasis>autoreply</emphasis></entry>
39478 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39479 <entry>Default: <emphasis>unset</emphasis></entry>
39480 </row>
39481 </tbody>
39482 </tgroup>
39483 </informaltable>
39484 <para>
39485 This option names a file in which a record of every message sent is logged when
39486 the message is specified by the transport.
39487 </para>
39488 <para>
39489 <indexterm role="option">
39490 <primary><option>mode</option></primary>
39491 </indexterm>
39492 </para>
39493 <informaltable frame="all">
39494 <tgroup cols="4" colsep="0" rowsep="0">
39495 <colspec colwidth="8*" align="left"/>
39496 <colspec colwidth="6*" align="center"/>
39497 <colspec colwidth="6*" align="center"/>
39498 <colspec colwidth="6*" align="right"/>
39499 <tbody>
39500 <row>
39501 <entry><option>mode</option></entry>
39502 <entry>Use: <emphasis>autoreply</emphasis></entry>
39503 <entry>Type: <emphasis>octal integer</emphasis></entry>
39504 <entry>Default: <emphasis>0600</emphasis></entry>
39505 </row>
39506 </tbody>
39507 </tgroup>
39508 </informaltable>
39509 <para>
39510 If either the log file or the <quote>once</quote> file has to be created, this mode is
39511 used.
39512 </para>
39513 <para>
39514 <indexterm role="option">
39515 <primary><option>never_mail</option></primary>
39516 </indexterm>
39517 </para>
39518 <informaltable frame="all">
39519 <tgroup cols="4" colsep="0" rowsep="0">
39520 <colspec colwidth="8*" align="left"/>
39521 <colspec colwidth="6*" align="center"/>
39522 <colspec colwidth="6*" align="center"/>
39523 <colspec colwidth="6*" align="right"/>
39524 <tbody>
39525 <row>
39526 <entry><option>never_mail</option></entry>
39527 <entry>Use: <emphasis>autoreply</emphasis></entry>
39528 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
39529 <entry>Default: <emphasis>unset</emphasis></entry>
39530 </row>
39531 </tbody>
39532 </tgroup>
39533 </informaltable>
39534 <para>
39535 If any run of the transport creates a message with a recipient that matches any
39536 item in the list, that recipient is quietly discarded. If all recipients are
39537 discarded, no message is created. This applies both when the recipients are
39538 generated by a filter and when they are specified in the transport.
39539 </para>
39540 <para>
39541 <indexterm role="option">
39542 <primary><option>once</option></primary>
39543 </indexterm>
39544 </para>
39545 <informaltable frame="all">
39546 <tgroup cols="4" colsep="0" rowsep="0">
39547 <colspec colwidth="8*" align="left"/>
39548 <colspec colwidth="6*" align="center"/>
39549 <colspec colwidth="6*" align="center"/>
39550 <colspec colwidth="6*" align="right"/>
39551 <tbody>
39552 <row>
39553 <entry><option>once</option></entry>
39554 <entry>Use: <emphasis>autoreply</emphasis></entry>
39555 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39556 <entry>Default: <emphasis>unset</emphasis></entry>
39557 </row>
39558 </tbody>
39559 </tgroup>
39560 </informaltable>
39561 <para>
39562 This option names a file or DBM database in which a record of each <emphasis>To:</emphasis>
39563 recipient is kept when the message is specified by the transport. <emphasis role="bold">Note</emphasis>:
39564 This does not apply to <emphasis>Cc:</emphasis> or <emphasis>Bcc:</emphasis> recipients.
39565 </para>
39566 <para>
39567 If <option>once</option> is unset, or is set to an empty string, the message is always sent.
39568 By default, if <option>once</option> is set to a non-empty file name, the message
39569 is not sent if a potential recipient is already listed in the database.
39570 However, if the <option>once_repeat</option> option specifies a time greater than zero, the
39571 message is sent if that much time has elapsed since a message was last sent to
39572 this recipient. A setting of zero time for <option>once_repeat</option> (the default)
39573 prevents a message from being sent a second time &ndash; in this case, zero means
39574 infinity.
39575 </para>
39576 <para>
39577 If <option>once_file_size</option> is zero, a DBM database is used to remember recipients,
39578 and it is allowed to grow as large as necessary. If <option>once_file_size</option> is set
39579 greater than zero, it changes the way Exim implements the <option>once</option> option.
39580 Instead of using a DBM file to record every recipient it sends to, it uses a
39581 regular file, whose size will never get larger than the given value.
39582 </para>
39583 <para>
39584 In the file, Exim keeps a linear list of recipient addresses and the times at
39585 which they were sent messages. If the file is full when a new address needs to
39586 be added, the oldest address is dropped. If <option>once_repeat</option> is not set, this
39587 means that a given recipient may receive multiple messages, but at
39588 unpredictable intervals that depend on the rate of turnover of addresses in the
39589 file. If <option>once_repeat</option> is set, it specifies a maximum time between repeats.
39590 </para>
39591 <para>
39592 <indexterm role="option">
39593 <primary><option>once_file_size</option></primary>
39594 </indexterm>
39595 </para>
39596 <informaltable frame="all">
39597 <tgroup cols="4" colsep="0" rowsep="0">
39598 <colspec colwidth="8*" align="left"/>
39599 <colspec colwidth="6*" align="center"/>
39600 <colspec colwidth="6*" align="center"/>
39601 <colspec colwidth="6*" align="right"/>
39602 <tbody>
39603 <row>
39604 <entry><option>once_file_size</option></entry>
39605 <entry>Use: <emphasis>autoreply</emphasis></entry>
39606 <entry>Type: <emphasis>integer</emphasis></entry>
39607 <entry>Default: <emphasis>0</emphasis></entry>
39608 </row>
39609 </tbody>
39610 </tgroup>
39611 </informaltable>
39612 <para>
39613 See <option>once</option> above.
39614 </para>
39615 <para>
39616 <indexterm role="option">
39617 <primary><option>once_repeat</option></primary>
39618 </indexterm>
39619 </para>
39620 <informaltable frame="all">
39621 <tgroup cols="4" colsep="0" rowsep="0">
39622 <colspec colwidth="8*" align="left"/>
39623 <colspec colwidth="6*" align="center"/>
39624 <colspec colwidth="6*" align="center"/>
39625 <colspec colwidth="6*" align="right"/>
39626 <tbody>
39627 <row>
39628 <entry><option>once_repeat</option></entry>
39629 <entry>Use: <emphasis>autoreply</emphasis></entry>
39630 <entry>Type: <emphasis>time</emphasis>&dagger;<emphasis></emphasis></entry>
39631 <entry>Default: <emphasis>0s</emphasis></entry>
39632 </row>
39633 </tbody>
39634 </tgroup>
39635 </informaltable>
39636 <para>
39637 See <option>once</option> above.
39638 After expansion, the value of this option must be a valid time value.
39639 </para>
39640 <para>
39641 <indexterm role="option">
39642 <primary><option>reply_to</option></primary>
39643 </indexterm>
39644 </para>
39645 <informaltable frame="all">
39646 <tgroup cols="4" colsep="0" rowsep="0">
39647 <colspec colwidth="8*" align="left"/>
39648 <colspec colwidth="6*" align="center"/>
39649 <colspec colwidth="6*" align="center"/>
39650 <colspec colwidth="6*" align="right"/>
39651 <tbody>
39652 <row>
39653 <entry><option>reply_to</option></entry>
39654 <entry>Use: <emphasis>autoreply</emphasis></entry>
39655 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39656 <entry>Default: <emphasis>unset</emphasis></entry>
39657 </row>
39658 </tbody>
39659 </tgroup>
39660 </informaltable>
39661 <para>
39662 This specifies the contents of the <emphasis>Reply-To:</emphasis> header when the message is
39663 specified by the transport.
39664 </para>
39665 <para>
39666 <indexterm role="option">
39667 <primary><option>return_message</option></primary>
39668 </indexterm>
39669 </para>
39670 <informaltable frame="all">
39671 <tgroup cols="4" colsep="0" rowsep="0">
39672 <colspec colwidth="8*" align="left"/>
39673 <colspec colwidth="6*" align="center"/>
39674 <colspec colwidth="6*" align="center"/>
39675 <colspec colwidth="6*" align="right"/>
39676 <tbody>
39677 <row>
39678 <entry><option>return_message</option></entry>
39679 <entry>Use: <emphasis>autoreply</emphasis></entry>
39680 <entry>Type: <emphasis>boolean</emphasis></entry>
39681 <entry>Default: <emphasis>false</emphasis></entry>
39682 </row>
39683 </tbody>
39684 </tgroup>
39685 </informaltable>
39686 <para>
39687 If this is set, a copy of the original message is returned with the new
39688 message, subject to the maximum size set in the <option>return_size_limit</option> global
39689 configuration option.
39690 </para>
39691 <para>
39692 <indexterm role="option">
39693 <primary><option>subject</option></primary>
39694 </indexterm>
39695 </para>
39696 <informaltable frame="all">
39697 <tgroup cols="4" colsep="0" rowsep="0">
39698 <colspec colwidth="8*" align="left"/>
39699 <colspec colwidth="6*" align="center"/>
39700 <colspec colwidth="6*" align="center"/>
39701 <colspec colwidth="6*" align="right"/>
39702 <tbody>
39703 <row>
39704 <entry><option>subject</option></entry>
39705 <entry>Use: <emphasis>autoreply</emphasis></entry>
39706 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39707 <entry>Default: <emphasis>unset</emphasis></entry>
39708 </row>
39709 </tbody>
39710 </tgroup>
39711 </informaltable>
39712 <para>
39713 This specifies the contents of the <emphasis>Subject:</emphasis> header when the message is
39714 specified by the transport. It is tempting to quote the original subject in
39715 automatic responses. For example:
39716 </para>
39717 <literallayout class="monospaced">
39718 subject = Re: $h_subject:
39719 </literallayout>
39720 <para>
39721 There is a danger in doing this, however. It may allow a third party to
39722 subscribe your users to an opt-in mailing list, provided that the list accepts
39723 bounce messages as subscription confirmations. Well-managed lists require a
39724 non-bounce message to confirm a subscription, so the danger is relatively
39725 small.
39726 </para>
39727 <para>
39728 <indexterm role="option">
39729 <primary><option>text</option></primary>
39730 </indexterm>
39731 </para>
39732 <informaltable frame="all">
39733 <tgroup cols="4" colsep="0" rowsep="0">
39734 <colspec colwidth="8*" align="left"/>
39735 <colspec colwidth="6*" align="center"/>
39736 <colspec colwidth="6*" align="center"/>
39737 <colspec colwidth="6*" align="right"/>
39738 <tbody>
39739 <row>
39740 <entry><option>text</option></entry>
39741 <entry>Use: <emphasis>autoreply</emphasis></entry>
39742 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39743 <entry>Default: <emphasis>unset</emphasis></entry>
39744 </row>
39745 </tbody>
39746 </tgroup>
39747 </informaltable>
39748 <para>
39749 This specifies a single string to be used as the body of the message when the
39750 message is specified by the transport. If both <option>text</option> and <option>file</option> are set,
39751 the text comes first.
39752 </para>
39753 <para>
39754 <indexterm role="option">
39755 <primary><option>to</option></primary>
39756 </indexterm>
39757 </para>
39758 <informaltable frame="all">
39759 <tgroup cols="4" colsep="0" rowsep="0">
39760 <colspec colwidth="8*" align="left"/>
39761 <colspec colwidth="6*" align="center"/>
39762 <colspec colwidth="6*" align="center"/>
39763 <colspec colwidth="6*" align="right"/>
39764 <tbody>
39765 <row>
39766 <entry><option>to</option></entry>
39767 <entry>Use: <emphasis>autoreply</emphasis></entry>
39768 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39769 <entry>Default: <emphasis>unset</emphasis></entry>
39770 </row>
39771 </tbody>
39772 </tgroup>
39773 </informaltable>
39774 <para>
39775 This specifies recipients of the message and the contents of the <emphasis>To:</emphasis> header
39776 when the message is specified by the transport.
39777 <indexterm role="concept" startref="IIDauttra1" class="endofrange"/>
39778 <indexterm role="concept" startref="IIDauttra2" class="endofrange"/>
39779 </para>
39780 </section>
39781 </chapter>
39782
39783 <chapter id="CHAPLMTP">
39784 <title>The lmtp transport</title>
39785 <para>
39786 <indexterm role="concept">
39787 <primary>transports</primary>
39788 <secondary><command>lmtp</command></secondary>
39789 </indexterm>
39790 <indexterm role="concept">
39791 <primary><command>lmtp</command> transport</primary>
39792 </indexterm>
39793 <indexterm role="concept">
39794 <primary>LMTP</primary>
39795 <secondary>over a pipe</secondary>
39796 </indexterm>
39797 <indexterm role="concept">
39798 <primary>LMTP</primary>
39799 <secondary>over a socket</secondary>
39800 </indexterm>
39801 The <command>lmtp</command> transport runs the LMTP protocol (RFC 2033) over a pipe to a
39802 specified command
39803 or by interacting with a Unix domain socket.
39804 This transport is something of a cross between the <command>pipe</command> and <command>smtp</command>
39805 transports. Exim also has support for using LMTP over TCP/IP; this is
39806 implemented as an option for the <command>smtp</command> transport. Because LMTP is expected
39807 to be of minority interest, the default build-time configure in <filename>src/EDITME</filename>
39808 has it commented out. You need to ensure that
39809 </para>
39810 <literallayout class="monospaced">
39811 TRANSPORT_LMTP=yes
39812 </literallayout>
39813 <para>
39814 <indexterm role="concept">
39815 <primary>options</primary>
39816 <secondary><command>lmtp</command> transport</secondary>
39817 </indexterm>
39818 is present in your <filename>Local/Makefile</filename> in order to have the <command>lmtp</command> transport
39819 included in the Exim binary. The private options of the <command>lmtp</command> transport are
39820 as follows:
39821 </para>
39822 <para>
39823 <indexterm role="option">
39824 <primary><option>batch_id</option></primary>
39825 </indexterm>
39826 </para>
39827 <informaltable frame="all">
39828 <tgroup cols="4" colsep="0" rowsep="0">
39829 <colspec colwidth="8*" align="left"/>
39830 <colspec colwidth="6*" align="center"/>
39831 <colspec colwidth="6*" align="center"/>
39832 <colspec colwidth="6*" align="right"/>
39833 <tbody>
39834 <row>
39835 <entry><option>batch_id</option></entry>
39836 <entry>Use: <emphasis>lmtp</emphasis></entry>
39837 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39838 <entry>Default: <emphasis>unset</emphasis></entry>
39839 </row>
39840 </tbody>
39841 </tgroup>
39842 </informaltable>
39843 <para>
39844 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
39845 </para>
39846 <para>
39847 <indexterm role="option">
39848 <primary><option>batch_max</option></primary>
39849 </indexterm>
39850 </para>
39851 <informaltable frame="all">
39852 <tgroup cols="4" colsep="0" rowsep="0">
39853 <colspec colwidth="8*" align="left"/>
39854 <colspec colwidth="6*" align="center"/>
39855 <colspec colwidth="6*" align="center"/>
39856 <colspec colwidth="6*" align="right"/>
39857 <tbody>
39858 <row>
39859 <entry><option>batch_max</option></entry>
39860 <entry>Use: <emphasis>lmtp</emphasis></entry>
39861 <entry>Type: <emphasis>integer</emphasis></entry>
39862 <entry>Default: <emphasis>1</emphasis></entry>
39863 </row>
39864 </tbody>
39865 </tgroup>
39866 </informaltable>
39867 <para>
39868 This limits the number of addresses that can be handled in a single delivery.
39869 Most LMTP servers can handle several addresses at once, so it is normally a
39870 good idea to increase this value. See the description of local delivery
39871 batching in chapter <xref linkend="CHAPbatching"/>.
39872 </para>
39873 <para>
39874 <indexterm role="option">
39875 <primary><option>command</option></primary>
39876 </indexterm>
39877 </para>
39878 <informaltable frame="all">
39879 <tgroup cols="4" colsep="0" rowsep="0">
39880 <colspec colwidth="8*" align="left"/>
39881 <colspec colwidth="6*" align="center"/>
39882 <colspec colwidth="6*" align="center"/>
39883 <colspec colwidth="6*" align="right"/>
39884 <tbody>
39885 <row>
39886 <entry><option>command</option></entry>
39887 <entry>Use: <emphasis>lmtp</emphasis></entry>
39888 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39889 <entry>Default: <emphasis>unset</emphasis></entry>
39890 </row>
39891 </tbody>
39892 </tgroup>
39893 </informaltable>
39894 <para>
39895 This option must be set if <option>socket</option> is not set. The string is a command which
39896 is run in a separate process. It is split up into a command name and list of
39897 arguments, each of which is separately expanded (so expansion cannot change the
39898 number of arguments). The command is run directly, not via a shell. The message
39899 is passed to the new process using the standard input and output to operate the
39900 LMTP protocol.
39901 </para>
39902 <para>
39903 <indexterm role="option">
39904 <primary><option>ignore_quota</option></primary>
39905 </indexterm>
39906 </para>
39907 <informaltable frame="all">
39908 <tgroup cols="4" colsep="0" rowsep="0">
39909 <colspec colwidth="8*" align="left"/>
39910 <colspec colwidth="6*" align="center"/>
39911 <colspec colwidth="6*" align="center"/>
39912 <colspec colwidth="6*" align="right"/>
39913 <tbody>
39914 <row>
39915 <entry><option>ignore_quota</option></entry>
39916 <entry>Use: <emphasis>lmtp</emphasis></entry>
39917 <entry>Type: <emphasis>boolean</emphasis></entry>
39918 <entry>Default: <emphasis>false</emphasis></entry>
39919 </row>
39920 </tbody>
39921 </tgroup>
39922 </informaltable>
39923 <para>
39924 <indexterm role="concept">
39925 <primary>LMTP</primary>
39926 <secondary>ignoring quota errors</secondary>
39927 </indexterm>
39928 If this option is set true, the string <literal>IGNOREQUOTA</literal> is added to RCPT
39929 commands, provided that the LMTP server has advertised support for IGNOREQUOTA
39930 in its response to the LHLO command.
39931 </para>
39932 <para>
39933 <indexterm role="option">
39934 <primary><option>socket</option></primary>
39935 </indexterm>
39936 </para>
39937 <informaltable frame="all">
39938 <tgroup cols="4" colsep="0" rowsep="0">
39939 <colspec colwidth="8*" align="left"/>
39940 <colspec colwidth="6*" align="center"/>
39941 <colspec colwidth="6*" align="center"/>
39942 <colspec colwidth="6*" align="right"/>
39943 <tbody>
39944 <row>
39945 <entry><option>socket</option></entry>
39946 <entry>Use: <emphasis>lmtp</emphasis></entry>
39947 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39948 <entry>Default: <emphasis>unset</emphasis></entry>
39949 </row>
39950 </tbody>
39951 </tgroup>
39952 </informaltable>
39953 <para>
39954 This option must be set if <option>command</option> is not set. The result of expansion must
39955 be the name of a Unix domain socket. The transport connects to the socket and
39956 delivers the message to it using the LMTP protocol.
39957 </para>
39958 <para>
39959 <indexterm role="option">
39960 <primary><option>timeout</option></primary>
39961 </indexterm>
39962 </para>
39963 <informaltable frame="all">
39964 <tgroup cols="4" colsep="0" rowsep="0">
39965 <colspec colwidth="8*" align="left"/>
39966 <colspec colwidth="6*" align="center"/>
39967 <colspec colwidth="6*" align="center"/>
39968 <colspec colwidth="6*" align="right"/>
39969 <tbody>
39970 <row>
39971 <entry><option>timeout</option></entry>
39972 <entry>Use: <emphasis>lmtp</emphasis></entry>
39973 <entry>Type: <emphasis>time</emphasis></entry>
39974 <entry>Default: <emphasis>5m</emphasis></entry>
39975 </row>
39976 </tbody>
39977 </tgroup>
39978 </informaltable>
39979 <para>
39980 The transport is aborted if the created process or Unix domain socket does not
39981 respond to LMTP commands or message input within this timeout. Delivery
39982 is deferred, and will be tried again later. Here is an example of a typical
39983 LMTP transport:
39984 </para>
39985 <literallayout class="monospaced">
39986 lmtp:
39987   driver = lmtp
39988   command = /some/local/lmtp/delivery/program
39989   batch_max = 20
39990   user = exim
39991 </literallayout>
39992 <para>
39993 This delivers up to 20 addresses at a time, in a mixture of domains if
39994 necessary, running as the user <emphasis>exim</emphasis>.
39995 </para>
39996 </chapter>
39997
39998 <chapter id="CHAPpipetransport">
39999 <title>The pipe transport</title>
40000 <para>
40001 <indexterm role="concept" id="IIDpiptra1" class="startofrange">
40002 <primary>transports</primary>
40003 <secondary><command>pipe</command></secondary>
40004 </indexterm>
40005 <indexterm role="concept" id="IIDpiptra2" class="startofrange">
40006 <primary><command>pipe</command> transport</primary>
40007 </indexterm>
40008 The <command>pipe</command> transport is used to deliver messages via a pipe to a command
40009 running in another process. One example is the use of <command>pipe</command> as a
40010 pseudo-remote transport for passing messages to some other delivery mechanism
40011 (such as UUCP). Another is the use by individual users to automatically process
40012 their incoming messages. The <command>pipe</command> transport can be used in one of the
40013 following ways:
40014 </para>
40015 <itemizedlist>
40016 <listitem>
40017 <para>
40018 <indexterm role="variable">
40019 <primary><varname>$local_part</varname></primary>
40020 </indexterm>
40021 A router routes one address to a transport in the normal way, and the
40022 transport is configured as a <command>pipe</command> transport. In this case, <varname>$local_part</varname>
40023 contains the local part of the address (as usual), and the command that is run
40024 is specified by the <option>command</option> option on the transport.
40025 </para>
40026 </listitem>
40027 <listitem>
40028 <para>
40029 <indexterm role="variable">
40030 <primary><varname>$pipe_addresses</varname></primary>
40031 </indexterm>
40032 If the <option>batch_max</option> option is set greater than 1 (the default is 1), the
40033 transport can handle more than one address in a single run. In this case, when
40034 more than one address is routed to the transport, <varname>$local_part</varname> is not set
40035 (because it is not unique). However, the pseudo-variable <varname>$pipe_addresses</varname>
40036 (described in section <xref linkend="SECThowcommandrun"/> below) contains all the addresses
40037 that are routed to the transport.
40038 </para>
40039 </listitem>
40040 <listitem>
40041 <para>
40042 <indexterm role="variable">
40043 <primary><varname>$address_pipe</varname></primary>
40044 </indexterm>
40045 A router redirects an address directly to a pipe command (for example, from an
40046 alias or forward file). In this case, <varname>$address_pipe</varname> contains the text of the
40047 pipe command, and the <option>command</option> option on the transport is ignored. If only
40048 one address is being transported (<option>batch_max</option> is not greater than one, or
40049 only one address was redirected to this pipe command), <varname>$local_part</varname> contains
40050 the local part that was redirected.
40051 </para>
40052 </listitem>
40053 </itemizedlist>
40054 <para>
40055 The <command>pipe</command> transport is a non-interactive delivery method. Exim can also
40056 deliver messages over pipes using the LMTP interactive protocol. This is
40057 implemented by the <command>lmtp</command> transport.
40058 </para>
40059 <para>
40060 In the case when <command>pipe</command> is run as a consequence of an entry in a local user&#x2019;s
40061 <filename>.forward</filename> file, the command runs under the uid and gid of that user. In
40062 other cases, the uid and gid have to be specified explicitly, either on the
40063 transport or on the router that handles the address. Current and <quote>home</quote>
40064 directories are also controllable. See chapter <xref linkend="CHAPenvironment"/> for
40065 details of the local delivery environment and chapter <xref linkend="CHAPbatching"/>
40066 for a discussion of local delivery batching.
40067 </para>
40068 <section id="SECID140">
40069 <title>Concurrent delivery</title>
40070 <para>
40071 If two messages arrive at almost the same time, and both are routed to a pipe
40072 delivery, the two pipe transports may be run concurrently. You must ensure that
40073 any pipe commands you set up are robust against this happening. If the commands
40074 write to a file, the <option>exim_lock</option> utility might be of use.
40075 </para>
40076 </section>
40077 <section id="SECID141">
40078 <title>Returned status and data</title>
40079 <para>
40080 <indexterm role="concept">
40081 <primary><command>pipe</command> transport</primary>
40082 <secondary>returned data</secondary>
40083 </indexterm>
40084 If the command exits with a non-zero return code, the delivery is deemed to
40085 have failed, unless either the <option>ignore_status</option> option is set (in which case
40086 the return code is treated as zero), or the return code is one of those listed
40087 in the <option>temp_errors</option> option, which are interpreted as meaning <quote>try again
40088 later</quote>. In this case, delivery is deferred. Details of a permanent failure are
40089 logged, but are not included in the bounce message, which merely contains
40090 <quote>local delivery failed</quote>.
40091 </para>
40092 <para>
40093 If the return code is greater than 128 and the command being run is a shell
40094 script, it normally means that the script was terminated by a signal whose
40095 value is the return code minus 128.
40096 </para>
40097 <para>
40098 If Exim is unable to run the command (that is, if <function>execve()</function> fails), the
40099 return code is set to 127. This is the value that a shell returns if it is
40100 asked to run a non-existent command. The wording for the log line suggests that
40101 a non-existent command may be the problem.
40102 </para>
40103 <para>
40104 The <option>return_output</option> option can affect the result of a pipe delivery. If it is
40105 set and the command produces any output on its standard output or standard
40106 error streams, the command is considered to have failed, even if it gave a zero
40107 return code or if <option>ignore_status</option> is set. The output from the command is
40108 included as part of the bounce message. The <option>return_fail_output</option> option is
40109 similar, except that output is returned only when the command exits with a
40110 failure return code, that is, a value other than zero or a code that matches
40111 <option>temp_errors</option>.
40112 </para>
40113 </section>
40114 <section id="SECThowcommandrun">
40115 <title>How the command is run</title>
40116 <para>
40117 <indexterm role="concept">
40118 <primary><command>pipe</command> transport</primary>
40119 <secondary>path for command</secondary>
40120 </indexterm>
40121 The command line is (by default) broken down into a command name and arguments
40122 by the <command>pipe</command> transport itself. The <option>allow_commands</option> and
40123 <option>restrict_to_path</option> options can be used to restrict the commands that may be
40124 run.
40125 </para>
40126 <para>
40127 <indexterm role="concept">
40128 <primary>quoting</primary>
40129 <secondary>in pipe command</secondary>
40130 </indexterm>
40131 Unquoted arguments are delimited by white space. If an argument appears in
40132 double quotes, backslash is interpreted as an escape character in the usual
40133 way. If an argument appears in single quotes, no escaping is done.
40134 </para>
40135 <para>
40136 String expansion is applied to the command line except when it comes from a
40137 traditional <filename>.forward</filename> file (commands from a filter file are expanded). The
40138 expansion is applied to each argument in turn rather than to the whole line.
40139 For this reason, any string expansion item that contains white space must be
40140 quoted so as to be contained within a single argument. A setting such as
40141 </para>
40142 <literallayout class="monospaced">
40143 command = /some/path ${if eq{$local_part}{postmaster}{xx}{yy}}
40144 </literallayout>
40145 <para>
40146 will not work, because the expansion item gets split between several
40147 arguments. You have to write
40148 </para>
40149 <literallayout class="monospaced">
40150 command = /some/path "${if eq{$local_part}{postmaster}{xx}{yy}}"
40151 </literallayout>
40152 <para>
40153 to ensure that it is all in one argument. The expansion is done in this way,
40154 argument by argument, so that the number of arguments cannot be changed as a
40155 result of expansion, and quotes or backslashes in inserted variables do not
40156 interact with external quoting. However, this leads to problems if you want to
40157 generate multiple arguments (or the command name plus arguments) from a single
40158 expansion. In this situation, the simplest solution is to use a shell. For
40159 example:
40160 </para>
40161 <literallayout class="monospaced">
40162 command = /bin/sh -c ${lookup{$local_part}lsearch{/some/file}}
40163 </literallayout>
40164 <para>
40165 <indexterm role="concept">
40166 <primary>transport</primary>
40167 <secondary>filter</secondary>
40168 </indexterm>
40169 <indexterm role="concept">
40170 <primary>filter</primary>
40171 <secondary>transport filter</secondary>
40172 </indexterm>
40173 <indexterm role="variable">
40174 <primary><varname>$pipe_addresses</varname></primary>
40175 </indexterm>
40176 Special handling takes place when an argument consists of precisely the text
40177 <literal>$pipe_addresses</literal>. This is not a general expansion variable; the only
40178 place this string is recognized is when it appears as an argument for a pipe or
40179 transport filter command. It causes each address that is being handled to be
40180 inserted in the argument list at that point <emphasis>as a separate argument</emphasis>. This
40181 avoids any problems with spaces or shell metacharacters, and is of use when a
40182 <command>pipe</command> transport is handling groups of addresses in a batch.
40183 </para>
40184 <para>
40185 After splitting up into arguments and expansion, the resulting command is run
40186 in a subprocess directly from the transport, <emphasis>not</emphasis> under a shell. The
40187 message that is being delivered is supplied on the standard input, and the
40188 standard output and standard error are both connected to a single pipe that is
40189 read by Exim. The <option>max_output</option> option controls how much output the command
40190 may produce, and the <option>return_output</option> and <option>return_fail_output</option> options
40191 control what is done with it.
40192 </para>
40193 <para>
40194 Not running the command under a shell (by default) lessens the security risks
40195 in cases when a command from a user&#x2019;s filter file is built out of data that was
40196 taken from an incoming message. If a shell is required, it can of course be
40197 explicitly specified as the command to be run. However, there are circumstances
40198 where existing commands (for example, in <filename>.forward</filename> files) expect to be run
40199 under a shell and cannot easily be modified. To allow for these cases, there is
40200 an option called <option>use_shell</option>, which changes the way the <command>pipe</command> transport
40201 works. Instead of breaking up the command line as just described, it expands it
40202 as a single string and passes the result to <filename>/bin/sh</filename>. The
40203 <option>restrict_to_path</option> option and the <varname>$pipe_addresses</varname> facility cannot be used
40204 with <option>use_shell</option>, and the whole mechanism is inherently less secure.
40205 </para>
40206 </section>
40207 <section id="SECTpipeenv">
40208 <title>Environment variables</title>
40209 <para>
40210 <indexterm role="concept">
40211 <primary><command>pipe</command> transport</primary>
40212 <secondary>environment for command</secondary>
40213 </indexterm>
40214 <indexterm role="concept">
40215 <primary>environment for pipe transport</primary>
40216 </indexterm>
40217 The environment variables listed below are set up when the command is invoked.
40218 This list is a compromise for maximum compatibility with other MTAs. Note that
40219 the <option>environment</option> option can be used to add additional variables to this
40220 environment.
40221 </para>
40222 <literallayout>
40223 <literal>DOMAIN            </literal>   the domain of the address
40224 <literal>HOME              </literal>   the home directory, if set
40225 <literal>HOST              </literal>   the host name when called from a router (see below)
40226 <literal>LOCAL_PART        </literal>   see below
40227 <literal>LOCAL_PART_PREFIX </literal>   see below
40228 <literal>LOCAL_PART_SUFFIX </literal>   see below
40229 <literal>LOGNAME           </literal>   see below
40230 <literal>MESSAGE_ID        </literal>   Exim&#x2019;s local ID for the message
40231 <literal>PATH              </literal>   as specified by the <option>path</option> option below
40232 <literal>QUALIFY_DOMAIN    </literal>   the sender qualification domain
40233 <literal>RECIPIENT         </literal>   the complete recipient address
40234 <literal>SENDER            </literal>   the sender of the message (empty if a bounce)
40235 <literal>SHELL             </literal>   <literal>/bin/sh</literal>
40236 <literal>TZ                </literal>   the value of the <option>timezone</option> option, if set
40237 <literal>USER              </literal>   see below
40238 </literallayout>
40239 <para>
40240 When a <command>pipe</command> transport is called directly from (for example) an <command>accept</command>
40241 router, LOCAL_PART is set to the local part of the address. When it is
40242 called as a result of a forward or alias expansion, LOCAL_PART is set to
40243 the local part of the address that was expanded. In both cases, any affixes are
40244 removed from the local part, and made available in LOCAL_PART_PREFIX and
40245 LOCAL_PART_SUFFIX, respectively. LOGNAME and USER are set to the
40246 same value as LOCAL_PART for compatibility with other MTAs.
40247 </para>
40248 <para>
40249 <indexterm role="concept">
40250 <primary>HOST</primary>
40251 </indexterm>
40252 HOST is set only when a <command>pipe</command> transport is called from a router that
40253 associates hosts with an address, typically when using <command>pipe</command> as a
40254 pseudo-remote transport. HOST is set to the first host name specified by
40255 the router.
40256 </para>
40257 <para>
40258 <indexterm role="concept">
40259 <primary>HOME</primary>
40260 </indexterm>
40261 If the transport&#x2019;s generic <option>home_directory</option> option is set, its value is used
40262 for the HOME environment variable. Otherwise, a home directory may be set
40263 by the router&#x2019;s <option>transport_home_directory</option> option, which defaults to the
40264 user&#x2019;s home directory if <option>check_local_user</option> is set.
40265 </para>
40266 </section>
40267 <section id="SECID142">
40268 <title>Private options for pipe</title>
40269 <para>
40270 <indexterm role="concept">
40271 <primary>options</primary>
40272 <secondary><command>pipe</command> transport</secondary>
40273 </indexterm>
40274 </para>
40275 <para>
40276 <indexterm role="option">
40277 <primary><option>allow_commands</option></primary>
40278 </indexterm>
40279 </para>
40280 <informaltable frame="all">
40281 <tgroup cols="4" colsep="0" rowsep="0">
40282 <colspec colwidth="8*" align="left"/>
40283 <colspec colwidth="6*" align="center"/>
40284 <colspec colwidth="6*" align="center"/>
40285 <colspec colwidth="6*" align="right"/>
40286 <tbody>
40287 <row>
40288 <entry><option>allow_commands</option></entry>
40289 <entry>Use: <emphasis>pipe</emphasis></entry>
40290 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
40291 <entry>Default: <emphasis>unset</emphasis></entry>
40292 </row>
40293 </tbody>
40294 </tgroup>
40295 </informaltable>
40296 <para>
40297 <indexterm role="concept">
40298 <primary><command>pipe</command> transport</primary>
40299 <secondary>permitted commands</secondary>
40300 </indexterm>
40301 The string is expanded, and is then interpreted as a colon-separated list of
40302 permitted commands. If <option>restrict_to_path</option> is not set, the only commands
40303 permitted are those in the <option>allow_commands</option> list. They need not be absolute
40304 paths; the <option>path</option> option is still used for relative paths. If
40305 <option>restrict_to_path</option> is set with <option>allow_commands</option>, the command must either be
40306 in the <option>allow_commands</option> list, or a name without any slashes that is found on
40307 the path. In other words, if neither <option>allow_commands</option> nor
40308 <option>restrict_to_path</option> is set, there is no restriction on the command, but
40309 otherwise only commands that are permitted by one or the other are allowed. For
40310 example, if
40311 </para>
40312 <literallayout class="monospaced">
40313 allow_commands = /usr/bin/vacation
40314 </literallayout>
40315 <para>
40316 and <option>restrict_to_path</option> is not set, the only permitted command is
40317 <filename>/usr/bin/vacation</filename>. The <option>allow_commands</option> option may not be set if
40318 <option>use_shell</option> is set.
40319 </para>
40320 <para>
40321 <indexterm role="option">
40322 <primary><option>batch_id</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>batch_id</option></entry>
40334 <entry>Use: <emphasis>pipe</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 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
40343 </para>
40344 <para>
40345 <indexterm role="option">
40346 <primary><option>batch_max</option></primary>
40347 </indexterm>
40348 </para>
40349 <informaltable frame="all">
40350 <tgroup cols="4" colsep="0" rowsep="0">
40351 <colspec colwidth="8*" align="left"/>
40352 <colspec colwidth="6*" align="center"/>
40353 <colspec colwidth="6*" align="center"/>
40354 <colspec colwidth="6*" align="right"/>
40355 <tbody>
40356 <row>
40357 <entry><option>batch_max</option></entry>
40358 <entry>Use: <emphasis>pipe</emphasis></entry>
40359 <entry>Type: <emphasis>integer</emphasis></entry>
40360 <entry>Default: <emphasis>1</emphasis></entry>
40361 </row>
40362 </tbody>
40363 </tgroup>
40364 </informaltable>
40365 <para>
40366 This limits the number of addresses that can be handled in a single delivery.
40367 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
40368 </para>
40369 <para>
40370 <indexterm role="option">
40371 <primary><option>check_string</option></primary>
40372 </indexterm>
40373 </para>
40374 <informaltable frame="all">
40375 <tgroup cols="4" colsep="0" rowsep="0">
40376 <colspec colwidth="8*" align="left"/>
40377 <colspec colwidth="6*" align="center"/>
40378 <colspec colwidth="6*" align="center"/>
40379 <colspec colwidth="6*" align="right"/>
40380 <tbody>
40381 <row>
40382 <entry><option>check_string</option></entry>
40383 <entry>Use: <emphasis>pipe</emphasis></entry>
40384 <entry>Type: <emphasis>string</emphasis></entry>
40385 <entry>Default: <emphasis>unset</emphasis></entry>
40386 </row>
40387 </tbody>
40388 </tgroup>
40389 </informaltable>
40390 <para>
40391 As <command>pipe</command> writes the message, the start of each line is tested for matching
40392 <option>check_string</option>, and if it does, the initial matching characters are replaced
40393 by the contents of <option>escape_string</option>, provided both are set. The value of
40394 <option>check_string</option> is a literal string, not a regular expression, and the case of
40395 any letters it contains is significant. When <option>use_bsmtp</option> is set, the contents
40396 of <option>check_string</option> and <option>escape_string</option> are forced to values that implement
40397 the SMTP escaping protocol. Any settings made in the configuration file are
40398 ignored.
40399 </para>
40400 <para>
40401 <indexterm role="option">
40402 <primary><option>command</option></primary>
40403 </indexterm>
40404 </para>
40405 <informaltable frame="all">
40406 <tgroup cols="4" colsep="0" rowsep="0">
40407 <colspec colwidth="8*" align="left"/>
40408 <colspec colwidth="6*" align="center"/>
40409 <colspec colwidth="6*" align="center"/>
40410 <colspec colwidth="6*" align="right"/>
40411 <tbody>
40412 <row>
40413 <entry><option>command</option></entry>
40414 <entry>Use: <emphasis>pipe</emphasis></entry>
40415 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40416 <entry>Default: <emphasis>unset</emphasis></entry>
40417 </row>
40418 </tbody>
40419 </tgroup>
40420 </informaltable>
40421 <para>
40422 This option need not be set when <command>pipe</command> is being used to deliver to pipes
40423 obtained directly from address redirections. In other cases, the option must be
40424 set, to provide a command to be run. It need not yield an absolute path (see
40425 the <option>path</option> option below). The command is split up into separate arguments by
40426 Exim, and each argument is separately expanded, as described in section
40427 <xref linkend="SECThowcommandrun"/> above.
40428 </para>
40429 <para>
40430 <indexterm role="option">
40431 <primary><option>environment</option></primary>
40432 </indexterm>
40433 </para>
40434 <informaltable frame="all">
40435 <tgroup cols="4" colsep="0" rowsep="0">
40436 <colspec colwidth="8*" align="left"/>
40437 <colspec colwidth="6*" align="center"/>
40438 <colspec colwidth="6*" align="center"/>
40439 <colspec colwidth="6*" align="right"/>
40440 <tbody>
40441 <row>
40442 <entry><option>environment</option></entry>
40443 <entry>Use: <emphasis>pipe</emphasis></entry>
40444 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40445 <entry>Default: <emphasis>unset</emphasis></entry>
40446 </row>
40447 </tbody>
40448 </tgroup>
40449 </informaltable>
40450 <para>
40451 <indexterm role="concept">
40452 <primary><command>pipe</command> transport</primary>
40453 <secondary>environment for command</secondary>
40454 </indexterm>
40455 <indexterm role="concept">
40456 <primary>environment for <command>pipe</command> transport</primary>
40457 </indexterm>
40458 This option is used to add additional variables to the environment in which the
40459 command runs (see section <xref linkend="SECTpipeenv"/> for the default list). Its value is
40460 a string which is expanded, and then interpreted as a colon-separated list of
40461 environment settings of the form &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt;.
40462 </para>
40463 <para>
40464 <indexterm role="option">
40465 <primary><option>escape_string</option></primary>
40466 </indexterm>
40467 </para>
40468 <informaltable frame="all">
40469 <tgroup cols="4" colsep="0" rowsep="0">
40470 <colspec colwidth="8*" align="left"/>
40471 <colspec colwidth="6*" align="center"/>
40472 <colspec colwidth="6*" align="center"/>
40473 <colspec colwidth="6*" align="right"/>
40474 <tbody>
40475 <row>
40476 <entry><option>escape_string</option></entry>
40477 <entry>Use: <emphasis>pipe</emphasis></entry>
40478 <entry>Type: <emphasis>string</emphasis></entry>
40479 <entry>Default: <emphasis>unset</emphasis></entry>
40480 </row>
40481 </tbody>
40482 </tgroup>
40483 </informaltable>
40484 <para>
40485 See <option>check_string</option> above.
40486 </para>
40487 <para>
40488 <indexterm role="option">
40489 <primary><option>freeze_exec_fail</option></primary>
40490 </indexterm>
40491 </para>
40492 <informaltable frame="all">
40493 <tgroup cols="4" colsep="0" rowsep="0">
40494 <colspec colwidth="8*" align="left"/>
40495 <colspec colwidth="6*" align="center"/>
40496 <colspec colwidth="6*" align="center"/>
40497 <colspec colwidth="6*" align="right"/>
40498 <tbody>
40499 <row>
40500 <entry><option>freeze_exec_fail</option></entry>
40501 <entry>Use: <emphasis>pipe</emphasis></entry>
40502 <entry>Type: <emphasis>boolean</emphasis></entry>
40503 <entry>Default: <emphasis>false</emphasis></entry>
40504 </row>
40505 </tbody>
40506 </tgroup>
40507 </informaltable>
40508 <para>
40509 <indexterm role="concept">
40510 <primary>exec failure</primary>
40511 </indexterm>
40512 <indexterm role="concept">
40513 <primary>failure of exec</primary>
40514 </indexterm>
40515 <indexterm role="concept">
40516 <primary><command>pipe</command> transport</primary>
40517 <secondary>failure of exec</secondary>
40518 </indexterm>
40519 Failure to exec the command in a pipe transport is by default treated like
40520 any other failure while running the command. However, if <option>freeze_exec_fail</option>
40521 is set, failure to exec is treated specially, and causes the message to be
40522 frozen, whatever the setting of <option>ignore_status</option>.
40523 </para>
40524 <para>
40525 <indexterm role="option">
40526 <primary><option>ignore_status</option></primary>
40527 </indexterm>
40528 </para>
40529 <informaltable frame="all">
40530 <tgroup cols="4" colsep="0" rowsep="0">
40531 <colspec colwidth="8*" align="left"/>
40532 <colspec colwidth="6*" align="center"/>
40533 <colspec colwidth="6*" align="center"/>
40534 <colspec colwidth="6*" align="right"/>
40535 <tbody>
40536 <row>
40537 <entry><option>ignore_status</option></entry>
40538 <entry>Use: <emphasis>pipe</emphasis></entry>
40539 <entry>Type: <emphasis>boolean</emphasis></entry>
40540 <entry>Default: <emphasis>false</emphasis></entry>
40541 </row>
40542 </tbody>
40543 </tgroup>
40544 </informaltable>
40545 <para>
40546 If this option is true, the status returned by the subprocess that is set up to
40547 run the command is ignored, and Exim behaves as if zero had been returned.
40548 Otherwise, a non-zero status or termination by signal causes an error return
40549 from the transport unless the status value is one of those listed in
40550 <option>temp_errors</option>; these cause the delivery to be deferred and tried again later.
40551 </para>
40552 <para>
40553 <emphasis role="bold">Note</emphasis>: This option does not apply to timeouts, which do not return a status.
40554 See the <option>timeout_defer</option> option for how timeouts are handled.
40555 </para>
40556 <para>
40557 <indexterm role="option">
40558 <primary><option>log_defer_output</option></primary>
40559 </indexterm>
40560 </para>
40561 <informaltable frame="all">
40562 <tgroup cols="4" colsep="0" rowsep="0">
40563 <colspec colwidth="8*" align="left"/>
40564 <colspec colwidth="6*" align="center"/>
40565 <colspec colwidth="6*" align="center"/>
40566 <colspec colwidth="6*" align="right"/>
40567 <tbody>
40568 <row>
40569 <entry><option>log_defer_output</option></entry>
40570 <entry>Use: <emphasis>pipe</emphasis></entry>
40571 <entry>Type: <emphasis>boolean</emphasis></entry>
40572 <entry>Default: <emphasis>false</emphasis></entry>
40573 </row>
40574 </tbody>
40575 </tgroup>
40576 </informaltable>
40577 <para>
40578 <indexterm role="concept">
40579 <primary><command>pipe</command> transport</primary>
40580 <secondary>logging output</secondary>
40581 </indexterm>
40582 If this option is set, and the status returned by the command is
40583 one of the codes listed in <option>temp_errors</option> (that is, delivery was deferred),
40584 and any output was produced, the first line of it is written to the main log.
40585 </para>
40586 <para>
40587 <indexterm role="option">
40588 <primary><option>log_fail_output</option></primary>
40589 </indexterm>
40590 </para>
40591 <informaltable frame="all">
40592 <tgroup cols="4" colsep="0" rowsep="0">
40593 <colspec colwidth="8*" align="left"/>
40594 <colspec colwidth="6*" align="center"/>
40595 <colspec colwidth="6*" align="center"/>
40596 <colspec colwidth="6*" align="right"/>
40597 <tbody>
40598 <row>
40599 <entry><option>log_fail_output</option></entry>
40600 <entry>Use: <emphasis>pipe</emphasis></entry>
40601 <entry>Type: <emphasis>boolean</emphasis></entry>
40602 <entry>Default: <emphasis>false</emphasis></entry>
40603 </row>
40604 </tbody>
40605 </tgroup>
40606 </informaltable>
40607 <para>
40608 If this option is set, and the command returns any output, and also ends with a
40609 return code that is neither zero nor one of the return codes listed in
40610 <option>temp_errors</option> (that is, the delivery failed), the first line of output is
40611 written to the main log. This option and <option>log_output</option> are mutually exclusive.
40612 Only one of them may be set.
40613 </para>
40614 <para>
40615 <indexterm role="option">
40616 <primary><option>log_output</option></primary>
40617 </indexterm>
40618 </para>
40619 <informaltable frame="all">
40620 <tgroup cols="4" colsep="0" rowsep="0">
40621 <colspec colwidth="8*" align="left"/>
40622 <colspec colwidth="6*" align="center"/>
40623 <colspec colwidth="6*" align="center"/>
40624 <colspec colwidth="6*" align="right"/>
40625 <tbody>
40626 <row>
40627 <entry><option>log_output</option></entry>
40628 <entry>Use: <emphasis>pipe</emphasis></entry>
40629 <entry>Type: <emphasis>boolean</emphasis></entry>
40630 <entry>Default: <emphasis>false</emphasis></entry>
40631 </row>
40632 </tbody>
40633 </tgroup>
40634 </informaltable>
40635 <para>
40636 If this option is set and the command returns any output, the first line of
40637 output is written to the main log, whatever the return code. This option and
40638 <option>log_fail_output</option> are mutually exclusive. Only one of them may be set.
40639 </para>
40640 <para>
40641 <indexterm role="option">
40642 <primary><option>max_output</option></primary>
40643 </indexterm>
40644 </para>
40645 <informaltable frame="all">
40646 <tgroup cols="4" colsep="0" rowsep="0">
40647 <colspec colwidth="8*" align="left"/>
40648 <colspec colwidth="6*" align="center"/>
40649 <colspec colwidth="6*" align="center"/>
40650 <colspec colwidth="6*" align="right"/>
40651 <tbody>
40652 <row>
40653 <entry><option>max_output</option></entry>
40654 <entry>Use: <emphasis>pipe</emphasis></entry>
40655 <entry>Type: <emphasis>integer</emphasis></entry>
40656 <entry>Default: <emphasis>20K</emphasis></entry>
40657 </row>
40658 </tbody>
40659 </tgroup>
40660 </informaltable>
40661 <para>
40662 This specifies the maximum amount of output that the command may produce on its
40663 standard output and standard error file combined. If the limit is exceeded, the
40664 process running the command is killed. This is intended as a safety measure to
40665 catch runaway processes. The limit is applied independently of the settings of
40666 the options that control what is done with such output (for example,
40667 <option>return_output</option>). Because of buffering effects, the amount of output may
40668 exceed the limit by a small amount before Exim notices.
40669 </para>
40670 <para>
40671 <indexterm role="option">
40672 <primary><option>message_prefix</option></primary>
40673 </indexterm>
40674 </para>
40675 <informaltable frame="all">
40676 <tgroup cols="4" colsep="0" rowsep="0">
40677 <colspec colwidth="8*" align="left"/>
40678 <colspec colwidth="6*" align="center"/>
40679 <colspec colwidth="6*" align="center"/>
40680 <colspec colwidth="6*" align="right"/>
40681 <tbody>
40682 <row>
40683 <entry><option>message_prefix</option></entry>
40684 <entry>Use: <emphasis>pipe</emphasis></entry>
40685 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40686 <entry>Default: <emphasis>see below</emphasis></entry>
40687 </row>
40688 </tbody>
40689 </tgroup>
40690 </informaltable>
40691 <para>
40692 The string specified here is expanded and output at the start of every message.
40693 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is
40694 </para>
40695 <literallayout class="monospaced">
40696 message_prefix = \
40697   From ${if def:return_path{$return_path}{MAILER-DAEMON}}\
40698   ${tod_bsdinbox}\n
40699 </literallayout>
40700 <para>
40701 <indexterm role="concept">
40702 <primary>Cyrus</primary>
40703 </indexterm>
40704 <indexterm role="concept">
40705 <primary><option>tmail</option></primary>
40706 </indexterm>
40707 <indexterm role="concept">
40708 <primary><quote>From</quote> line</primary>
40709 </indexterm>
40710 This is required by the commonly used <filename>/usr/bin/vacation</filename> program.
40711 However, it must <emphasis>not</emphasis> be present if delivery is to the Cyrus IMAP server,
40712 or to the <option>tmail</option> local delivery agent. The prefix can be suppressed by
40713 setting
40714 </para>
40715 <literallayout class="monospaced">
40716 message_prefix =
40717 </literallayout>
40718 <para>
40719 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
40720 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_prefix</option>.
40721 </para>
40722 <para>
40723 <indexterm role="option">
40724 <primary><option>message_suffix</option></primary>
40725 </indexterm>
40726 </para>
40727 <informaltable frame="all">
40728 <tgroup cols="4" colsep="0" rowsep="0">
40729 <colspec colwidth="8*" align="left"/>
40730 <colspec colwidth="6*" align="center"/>
40731 <colspec colwidth="6*" align="center"/>
40732 <colspec colwidth="6*" align="right"/>
40733 <tbody>
40734 <row>
40735 <entry><option>message_suffix</option></entry>
40736 <entry>Use: <emphasis>pipe</emphasis></entry>
40737 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40738 <entry>Default: <emphasis>see below</emphasis></entry>
40739 </row>
40740 </tbody>
40741 </tgroup>
40742 </informaltable>
40743 <para>
40744 The string specified here is expanded and output at the end of every message.
40745 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is a single newline.
40746 The suffix can be suppressed by setting
40747 </para>
40748 <literallayout class="monospaced">
40749 message_suffix =
40750 </literallayout>
40751 <para>
40752 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
40753 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_suffix</option>.
40754 </para>
40755 <para>
40756 <indexterm role="option">
40757 <primary><option>path</option></primary>
40758 </indexterm>
40759 </para>
40760 <informaltable frame="all">
40761 <tgroup cols="4" colsep="0" rowsep="0">
40762 <colspec colwidth="8*" align="left"/>
40763 <colspec colwidth="6*" align="center"/>
40764 <colspec colwidth="6*" align="center"/>
40765 <colspec colwidth="6*" align="right"/>
40766 <tbody>
40767 <row>
40768 <entry><option>path</option></entry>
40769 <entry>Use: <emphasis>pipe</emphasis></entry>
40770 <entry>Type: <emphasis>string</emphasis></entry>
40771 <entry>Default: <emphasis>see below</emphasis></entry>
40772 </row>
40773 </tbody>
40774 </tgroup>
40775 </informaltable>
40776 <para>
40777 This option specifies the string that is set up in the PATH environment
40778 variable of the subprocess. The default is:
40779 </para>
40780 <literallayout class="monospaced">
40781 /bin:/usr/bin
40782 </literallayout>
40783 <para>
40784 If the <option>command</option> option does not yield an absolute path name, the command is
40785 sought in the PATH directories, in the usual way. <emphasis role="bold">Warning</emphasis>: This does not
40786 apply to a command specified as a transport filter.
40787 </para>
40788 <para>
40789 <indexterm role="option">
40790 <primary><option>pipe_as_creator</option></primary>
40791 </indexterm>
40792 </para>
40793 <informaltable frame="all">
40794 <tgroup cols="4" colsep="0" rowsep="0">
40795 <colspec colwidth="8*" align="left"/>
40796 <colspec colwidth="6*" align="center"/>
40797 <colspec colwidth="6*" align="center"/>
40798 <colspec colwidth="6*" align="right"/>
40799 <tbody>
40800 <row>
40801 <entry><option>pipe_as_creator</option></entry>
40802 <entry>Use: <emphasis>pipe</emphasis></entry>
40803 <entry>Type: <emphasis>boolean</emphasis></entry>
40804 <entry>Default: <emphasis>false</emphasis></entry>
40805 </row>
40806 </tbody>
40807 </tgroup>
40808 </informaltable>
40809 <para>
40810 <indexterm role="concept">
40811 <primary>uid (user id)</primary>
40812 <secondary>local delivery</secondary>
40813 </indexterm>
40814 If the generic <option>user</option> option is not set and this option is true, the delivery
40815 process is run under the uid that was in force when Exim was originally called
40816 to accept the message. If the group id is not otherwise set (via the generic
40817 <option>group</option> option), the gid that was in force when Exim was originally called to
40818 accept the message is used.
40819 </para>
40820 <para>
40821 <indexterm role="option">
40822 <primary><option>restrict_to_path</option></primary>
40823 </indexterm>
40824 </para>
40825 <informaltable frame="all">
40826 <tgroup cols="4" colsep="0" rowsep="0">
40827 <colspec colwidth="8*" align="left"/>
40828 <colspec colwidth="6*" align="center"/>
40829 <colspec colwidth="6*" align="center"/>
40830 <colspec colwidth="6*" align="right"/>
40831 <tbody>
40832 <row>
40833 <entry><option>restrict_to_path</option></entry>
40834 <entry>Use: <emphasis>pipe</emphasis></entry>
40835 <entry>Type: <emphasis>boolean</emphasis></entry>
40836 <entry>Default: <emphasis>false</emphasis></entry>
40837 </row>
40838 </tbody>
40839 </tgroup>
40840 </informaltable>
40841 <para>
40842 When this option is set, any command name not listed in <option>allow_commands</option> must
40843 contain no slashes. The command is searched for only in the directories listed
40844 in the <option>path</option> option. This option is intended for use in the case when a pipe
40845 command has been generated from a user&#x2019;s <filename>.forward</filename> file. This is usually
40846 handled by a <command>pipe</command> transport called <option>address_pipe</option>.
40847 </para>
40848 <para>
40849 <indexterm role="option">
40850 <primary><option>return_fail_output</option></primary>
40851 </indexterm>
40852 </para>
40853 <informaltable frame="all">
40854 <tgroup cols="4" colsep="0" rowsep="0">
40855 <colspec colwidth="8*" align="left"/>
40856 <colspec colwidth="6*" align="center"/>
40857 <colspec colwidth="6*" align="center"/>
40858 <colspec colwidth="6*" align="right"/>
40859 <tbody>
40860 <row>
40861 <entry><option>return_fail_output</option></entry>
40862 <entry>Use: <emphasis>pipe</emphasis></entry>
40863 <entry>Type: <emphasis>boolean</emphasis></entry>
40864 <entry>Default: <emphasis>false</emphasis></entry>
40865 </row>
40866 </tbody>
40867 </tgroup>
40868 </informaltable>
40869 <para>
40870 If this option is true, and the command produced any output and ended with a
40871 return code other than zero or one of the codes listed in <option>temp_errors</option> (that
40872 is, the delivery failed), the output is returned in the bounce message.
40873 However, if the message has a null sender (that is, it is itself a bounce
40874 message), output from the command is discarded. This option and
40875 <option>return_output</option> are mutually exclusive. Only one of them may be set.
40876 </para>
40877 <para>
40878 <indexterm role="option">
40879 <primary><option>return_output</option></primary>
40880 </indexterm>
40881 </para>
40882 <informaltable frame="all">
40883 <tgroup cols="4" colsep="0" rowsep="0">
40884 <colspec colwidth="8*" align="left"/>
40885 <colspec colwidth="6*" align="center"/>
40886 <colspec colwidth="6*" align="center"/>
40887 <colspec colwidth="6*" align="right"/>
40888 <tbody>
40889 <row>
40890 <entry><option>return_output</option></entry>
40891 <entry>Use: <emphasis>pipe</emphasis></entry>
40892 <entry>Type: <emphasis>boolean</emphasis></entry>
40893 <entry>Default: <emphasis>false</emphasis></entry>
40894 </row>
40895 </tbody>
40896 </tgroup>
40897 </informaltable>
40898 <para>
40899 If this option is true, and the command produced any output, the delivery is
40900 deemed to have failed whatever the return code from the command, and the output
40901 is returned in the bounce message. Otherwise, the output is just discarded.
40902 However, if the message has a null sender (that is, it is a bounce message),
40903 output from the command is always discarded, whatever the setting of this
40904 option. This option and <option>return_fail_output</option> are mutually exclusive. Only one
40905 of them may be set.
40906 </para>
40907 <para>
40908 <indexterm role="option">
40909 <primary><option>temp_errors</option></primary>
40910 </indexterm>
40911 </para>
40912 <informaltable frame="all">
40913 <tgroup cols="4" colsep="0" rowsep="0">
40914 <colspec colwidth="8*" align="left"/>
40915 <colspec colwidth="6*" align="center"/>
40916 <colspec colwidth="6*" align="center"/>
40917 <colspec colwidth="6*" align="right"/>
40918 <tbody>
40919 <row>
40920 <entry><option>temp_errors</option></entry>
40921 <entry>Use: <emphasis>pipe</emphasis></entry>
40922 <entry>Type: <emphasis>string list</emphasis></entry>
40923 <entry>Default: <emphasis>see below</emphasis></entry>
40924 </row>
40925 </tbody>
40926 </tgroup>
40927 </informaltable>
40928 <para>
40929 <indexterm role="concept">
40930 <primary><command>pipe</command> transport</primary>
40931 <secondary>temporary failure</secondary>
40932 </indexterm>
40933 This option contains either a colon-separated list of numbers, or a single
40934 asterisk. If <option>ignore_status</option> is false
40935 and <option>return_output</option> is not set,
40936 and the command exits with a non-zero return code, the failure is treated as
40937 temporary and the delivery is deferred if the return code matches one of the
40938 numbers, or if the setting is a single asterisk. Otherwise, non-zero return
40939 codes are treated as permanent errors. The default setting contains the codes
40940 defined by EX_TEMPFAIL and EX_CANTCREAT in <filename>sysexits.h</filename>. If Exim is
40941 compiled on a system that does not define these macros, it assumes values of 75
40942 and 73, respectively.
40943 </para>
40944 <para>
40945 <indexterm role="option">
40946 <primary><option>timeout</option></primary>
40947 </indexterm>
40948 </para>
40949 <informaltable frame="all">
40950 <tgroup cols="4" colsep="0" rowsep="0">
40951 <colspec colwidth="8*" align="left"/>
40952 <colspec colwidth="6*" align="center"/>
40953 <colspec colwidth="6*" align="center"/>
40954 <colspec colwidth="6*" align="right"/>
40955 <tbody>
40956 <row>
40957 <entry><option>timeout</option></entry>
40958 <entry>Use: <emphasis>pipe</emphasis></entry>
40959 <entry>Type: <emphasis>time</emphasis></entry>
40960 <entry>Default: <emphasis>1h</emphasis></entry>
40961 </row>
40962 </tbody>
40963 </tgroup>
40964 </informaltable>
40965 <para>
40966 If the command fails to complete within this time, it is killed. This normally
40967 causes the delivery to fail (but see <option>timeout_defer</option>). A zero time interval
40968 specifies no timeout. In order to ensure that any subprocesses created by the
40969 command are also killed, Exim makes the initial process a process group leader,
40970 and kills the whole process group on a timeout. However, this can be defeated
40971 if one of the processes starts a new process group.
40972 </para>
40973 <para>
40974 <indexterm role="option">
40975 <primary><option>timeout_defer</option></primary>
40976 </indexterm>
40977 </para>
40978 <informaltable frame="all">
40979 <tgroup cols="4" colsep="0" rowsep="0">
40980 <colspec colwidth="8*" align="left"/>
40981 <colspec colwidth="6*" align="center"/>
40982 <colspec colwidth="6*" align="center"/>
40983 <colspec colwidth="6*" align="right"/>
40984 <tbody>
40985 <row>
40986 <entry><option>timeout_defer</option></entry>
40987 <entry>Use: <emphasis>pipe</emphasis></entry>
40988 <entry>Type: <emphasis>boolean</emphasis></entry>
40989 <entry>Default: <emphasis>false</emphasis></entry>
40990 </row>
40991 </tbody>
40992 </tgroup>
40993 </informaltable>
40994 <para>
40995 A timeout in a <command>pipe</command> transport, either in the command that the transport
40996 runs, or in a transport filter that is associated with it, is by default
40997 treated as a hard error, and the delivery fails. However, if <option>timeout_defer</option>
40998 is set true, both kinds of timeout become temporary errors, causing the
40999 delivery to be deferred.
41000 </para>
41001 <para>
41002 <indexterm role="option">
41003 <primary><option>umask</option></primary>
41004 </indexterm>
41005 </para>
41006 <informaltable frame="all">
41007 <tgroup cols="4" colsep="0" rowsep="0">
41008 <colspec colwidth="8*" align="left"/>
41009 <colspec colwidth="6*" align="center"/>
41010 <colspec colwidth="6*" align="center"/>
41011 <colspec colwidth="6*" align="right"/>
41012 <tbody>
41013 <row>
41014 <entry><option>umask</option></entry>
41015 <entry>Use: <emphasis>pipe</emphasis></entry>
41016 <entry>Type: <emphasis>octal integer</emphasis></entry>
41017 <entry>Default: <emphasis>022</emphasis></entry>
41018 </row>
41019 </tbody>
41020 </tgroup>
41021 </informaltable>
41022 <para>
41023 This specifies the umask setting for the subprocess that runs the command.
41024 </para>
41025 <para>
41026 <indexterm role="option">
41027 <primary><option>use_bsmtp</option></primary>
41028 </indexterm>
41029 </para>
41030 <informaltable frame="all">
41031 <tgroup cols="4" colsep="0" rowsep="0">
41032 <colspec colwidth="8*" align="left"/>
41033 <colspec colwidth="6*" align="center"/>
41034 <colspec colwidth="6*" align="center"/>
41035 <colspec colwidth="6*" align="right"/>
41036 <tbody>
41037 <row>
41038 <entry><option>use_bsmtp</option></entry>
41039 <entry>Use: <emphasis>pipe</emphasis></entry>
41040 <entry>Type: <emphasis>boolean</emphasis></entry>
41041 <entry>Default: <emphasis>false</emphasis></entry>
41042 </row>
41043 </tbody>
41044 </tgroup>
41045 </informaltable>
41046 <para>
41047 <indexterm role="concept">
41048 <primary>envelope sender</primary>
41049 </indexterm>
41050 If this option is set true, the <command>pipe</command> transport writes messages in <quote>batch
41051 SMTP</quote> format, with the envelope sender and recipient(s) included as SMTP
41052 commands. If you want to include a leading HELO command with such messages,
41053 you can do so by setting the <option>message_prefix</option> option. See section
41054 <xref linkend="SECTbatchSMTP"/> for details of batch SMTP.
41055 </para>
41056 <para>
41057 <indexterm role="option">
41058 <primary><option>use_classresources</option></primary>
41059 </indexterm>
41060 </para>
41061 <informaltable frame="all">
41062 <tgroup cols="4" colsep="0" rowsep="0">
41063 <colspec colwidth="8*" align="left"/>
41064 <colspec colwidth="6*" align="center"/>
41065 <colspec colwidth="6*" align="center"/>
41066 <colspec colwidth="6*" align="right"/>
41067 <tbody>
41068 <row>
41069 <entry><option>use_classresources</option></entry>
41070 <entry>Use: <emphasis>pipe</emphasis></entry>
41071 <entry>Type: <emphasis>boolean</emphasis></entry>
41072 <entry>Default: <emphasis>false</emphasis></entry>
41073 </row>
41074 </tbody>
41075 </tgroup>
41076 </informaltable>
41077 <para>
41078 <indexterm role="concept">
41079 <primary>class resources (BSD)</primary>
41080 </indexterm>
41081 This option is available only when Exim is running on FreeBSD, NetBSD, or
41082 BSD/OS. If it is set true, the <function>setclassresources()</function> function is used to set
41083 resource limits when a <command>pipe</command> transport is run to perform a delivery. The
41084 limits for the uid under which the pipe is to run are obtained from the login
41085 class database.
41086 </para>
41087 <para>
41088 <indexterm role="option">
41089 <primary><option>use_crlf</option></primary>
41090 </indexterm>
41091 </para>
41092 <informaltable frame="all">
41093 <tgroup cols="4" colsep="0" rowsep="0">
41094 <colspec colwidth="8*" align="left"/>
41095 <colspec colwidth="6*" align="center"/>
41096 <colspec colwidth="6*" align="center"/>
41097 <colspec colwidth="6*" align="right"/>
41098 <tbody>
41099 <row>
41100 <entry><option>use_crlf</option></entry>
41101 <entry>Use: <emphasis>pipe</emphasis></entry>
41102 <entry>Type: <emphasis>boolean</emphasis></entry>
41103 <entry>Default: <emphasis>false</emphasis></entry>
41104 </row>
41105 </tbody>
41106 </tgroup>
41107 </informaltable>
41108 <para>
41109 <indexterm role="concept">
41110 <primary>carriage return</primary>
41111 </indexterm>
41112 <indexterm role="concept">
41113 <primary>linefeed</primary>
41114 </indexterm>
41115 This option causes lines to be terminated with the two-character CRLF sequence
41116 (carriage return, linefeed) instead of just a linefeed character. In the case
41117 of batched SMTP, the byte sequence written to the pipe is then an exact image
41118 of what would be sent down a real SMTP connection.
41119 </para>
41120 <para>
41121 The contents of the <option>message_prefix</option> and <option>message_suffix</option> options are
41122 written verbatim, so must contain their own carriage return characters if these
41123 are needed. When <option>use_bsmtp</option> is not set, the default values for both
41124 <option>message_prefix</option> and <option>message_suffix</option> end with a single linefeed, so their
41125 values must be changed to end with <literal>\r\n</literal> if <option>use_crlf</option> is set.
41126 </para>
41127 <para>
41128 <indexterm role="option">
41129 <primary><option>use_shell</option></primary>
41130 </indexterm>
41131 </para>
41132 <informaltable frame="all">
41133 <tgroup cols="4" colsep="0" rowsep="0">
41134 <colspec colwidth="8*" align="left"/>
41135 <colspec colwidth="6*" align="center"/>
41136 <colspec colwidth="6*" align="center"/>
41137 <colspec colwidth="6*" align="right"/>
41138 <tbody>
41139 <row>
41140 <entry><option>use_shell</option></entry>
41141 <entry>Use: <emphasis>pipe</emphasis></entry>
41142 <entry>Type: <emphasis>boolean</emphasis></entry>
41143 <entry>Default: <emphasis>false</emphasis></entry>
41144 </row>
41145 </tbody>
41146 </tgroup>
41147 </informaltable>
41148 <para>
41149 <indexterm role="variable">
41150 <primary><varname>$pipe_addresses</varname></primary>
41151 </indexterm>
41152 If this option is set, it causes the command to be passed to <filename>/bin/sh</filename>
41153 instead of being run directly from the transport, as described in section
41154 <xref linkend="SECThowcommandrun"/>. This is less secure, but is needed in some situations
41155 where the command is expected to be run under a shell and cannot easily be
41156 modified. The <option>allow_commands</option> and <option>restrict_to_path</option> options, and the
41157 <literal>$pipe_addresses</literal> facility are incompatible with <option>use_shell</option>. The
41158 command is expanded as a single string, and handed to <filename>/bin/sh</filename> as data for
41159 its <option>-c</option> option.
41160 </para>
41161 </section>
41162 <section id="SECID143">
41163 <title>Using an external local delivery agent</title>
41164 <para>
41165 <indexterm role="concept">
41166 <primary>local delivery</primary>
41167 <secondary>using an external agent</secondary>
41168 </indexterm>
41169 <indexterm role="concept">
41170 <primary><emphasis>procmail</emphasis></primary>
41171 </indexterm>
41172 <indexterm role="concept">
41173 <primary>external local delivery</primary>
41174 </indexterm>
41175 <indexterm role="concept">
41176 <primary>delivery</primary>
41177 <secondary><emphasis>procmail</emphasis></secondary>
41178 </indexterm>
41179 <indexterm role="concept">
41180 <primary>delivery</primary>
41181 <secondary>by external agent</secondary>
41182 </indexterm>
41183 The <command>pipe</command> transport can be used to pass all messages that require local
41184 delivery to a separate local delivery agent such as <option>procmail</option>. When doing
41185 this, care must be taken to ensure that the pipe is run under an appropriate
41186 uid and gid. In some configurations one wants this to be a uid that is trusted
41187 by the delivery agent to supply the correct sender of the message. It may be
41188 necessary to recompile or reconfigure the delivery agent so that it trusts an
41189 appropriate user. The following is an example transport and router
41190 configuration for <option>procmail</option>:
41191 </para>
41192 <literallayout class="monospaced">
41193 # transport
41194 procmail_pipe:
41195   driver = pipe
41196   command = /usr/local/bin/procmail -d $local_part
41197   return_path_add
41198   delivery_date_add
41199   envelope_to_add
41200   check_string = "From "
41201   escape_string = "&gt;From "
41202   umask = 077
41203   user = $local_part
41204   group = mail
41205
41206 # router
41207 procmail:
41208   driver = accept
41209   check_local_user
41210   transport = procmail_pipe
41211 </literallayout>
41212 <para>
41213 In this example, the pipe is run as the local user, but with the group set to
41214 <emphasis>mail</emphasis>. An alternative is to run the pipe as a specific user such as <emphasis>mail</emphasis>
41215 or <emphasis>exim</emphasis>, but in this case you must arrange for <option>procmail</option> to trust that
41216 user to supply a correct sender address. If you do not specify either a
41217 <option>group</option> or a <option>user</option> option, the pipe command is run as the local user. The
41218 home directory is the user&#x2019;s home directory by default.
41219 </para>
41220 <para>
41221 <emphasis role="bold">Note</emphasis>: The command that the pipe transport runs does <emphasis>not</emphasis> begin with
41222 </para>
41223 <literallayout class="monospaced">
41224 IFS=" "
41225 </literallayout>
41226 <para>
41227 as shown in some <option>procmail</option> documentation, because Exim does not by default
41228 use a shell to run pipe commands.
41229 </para>
41230 <para>
41231 <indexterm role="concept">
41232 <primary>Cyrus</primary>
41233 </indexterm>
41234 The next example shows a transport and a router for a system where local
41235 deliveries are handled by the Cyrus IMAP server.
41236 </para>
41237 <literallayout class="monospaced">
41238 # transport
41239 local_delivery_cyrus:
41240   driver = pipe
41241   command = /usr/cyrus/bin/deliver \
41242             -m ${substr_1:$local_part_suffix} -- $local_part
41243   user = cyrus
41244   group = mail
41245   return_output
41246   log_output
41247   message_prefix =
41248   message_suffix =
41249
41250 # router
41251 local_user_cyrus:
41252   driver = accept
41253   check_local_user
41254   local_part_suffix = .*
41255   transport = local_delivery_cyrus
41256 </literallayout>
41257 <para>
41258 Note the unsetting of <option>message_prefix</option> and <option>message_suffix</option>, and the use of
41259 <option>return_output</option> to cause any text written by Cyrus to be returned to the
41260 sender.
41261 <indexterm role="concept" startref="IIDpiptra1" class="endofrange"/>
41262 <indexterm role="concept" startref="IIDpiptra2" class="endofrange"/>
41263 </para>
41264 </section>
41265 </chapter>
41266
41267 <chapter id="CHAPsmtptrans">
41268 <title>The smtp transport</title>
41269 <para>
41270 <indexterm role="concept" id="IIDsmttra1" class="startofrange">
41271 <primary>transports</primary>
41272 <secondary><command>smtp</command></secondary>
41273 </indexterm>
41274 <indexterm role="concept" id="IIDsmttra2" class="startofrange">
41275 <primary><command>smtp</command> transport</primary>
41276 </indexterm>
41277 The <command>smtp</command> transport delivers messages over TCP/IP connections using the SMTP
41278 or LMTP protocol. The list of hosts to try can either be taken from the address
41279 that is being processed (having been set up by the router), or specified
41280 explicitly for the transport. Timeout and retry processing (see chapter
41281 <xref linkend="CHAPretry"/>) is applied to each IP address independently.
41282 </para>
41283 <section id="SECID144">
41284 <title>Multiple messages on a single connection</title>
41285 <para>
41286 The sending of multiple messages over a single TCP/IP connection can arise in
41287 two ways:
41288 </para>
41289 <itemizedlist>
41290 <listitem>
41291 <para>
41292 If a message contains more than <option>max_rcpt</option> (see below) addresses that are
41293 routed to the same host, more than one copy of the message has to be sent to
41294 that host. In this situation, multiple copies may be sent in a single run of
41295 the <command>smtp</command> transport over a single TCP/IP connection. (What Exim actually
41296 does when it has too many addresses to send in one message also depends on the
41297 value of the global <option>remote_max_parallel</option> option. Details are given in
41298 section <xref linkend="SECToutSMTPTCP"/>.)
41299 </para>
41300 </listitem>
41301 <listitem>
41302 <para>
41303 <indexterm role="concept">
41304 <primary>hints database</primary>
41305 <secondary>remembering routing</secondary>
41306 </indexterm>
41307 When a message has been successfully delivered over a TCP/IP connection, Exim
41308 looks in its hints database to see if there are any other messages awaiting a
41309 connection to the same host. If there are, a new delivery process is started
41310 for one of them, and the current TCP/IP connection is passed on to it. The new
41311 process may in turn send multiple copies and possibly create yet another
41312 process.
41313 </para>
41314 </listitem>
41315 </itemizedlist>
41316 <para>
41317 For each copy sent over the same TCP/IP connection, a sequence counter is
41318 incremented, and if it ever gets to the value of <option>connection_max_messages</option>,
41319 no further messages are sent over that connection.
41320 </para>
41321 </section>
41322 <section id="SECID145">
41323 <title>Use of the $host and $host_address variables</title>
41324 <para>
41325 <indexterm role="variable">
41326 <primary><varname>$host</varname></primary>
41327 </indexterm>
41328 <indexterm role="variable">
41329 <primary><varname>$host_address</varname></primary>
41330 </indexterm>
41331 At the start of a run of the <command>smtp</command> transport, the values of <varname>$host</varname> and
41332 <varname>$host_address</varname> are the name and IP address of the first host on the host list
41333 passed by the router. However, when the transport is about to connect to a
41334 specific host, and while it is connected to that host, <varname>$host</varname> and
41335 <varname>$host_address</varname> are set to the values for that host. These are the values
41336 that are in force when the <option>helo_data</option>, <option>hosts_try_auth</option>, <option>interface</option>,
41337 <option>serialize_hosts</option>, and the various TLS options are expanded.
41338 </para>
41339 </section>
41340 <section id="usecippeer">
41341 <title>Use of $tls_cipher and $tls_peerdn</title>
41342 <para>
41343 <indexterm role="variable">
41344 <primary><varname>$tls_cipher</varname></primary>
41345 </indexterm>
41346 <indexterm role="variable">
41347 <primary><varname>$tls_peerdn</varname></primary>
41348 </indexterm>
41349 At the start of a run of the <command>smtp</command> transport, the values of <varname>$tls_cipher</varname>
41350 and <varname>$tls_peerdn</varname> are the values that were set when the message was received.
41351 These are the values that are used for options that are expanded before any
41352 SMTP connections are made. Just before each connection is made, these two
41353 variables are emptied. If TLS is subsequently started, they are set to the
41354 appropriate values for the outgoing connection, and these are the values that
41355 are in force when any authenticators are run and when the
41356 <option>authenticated_sender</option> option is expanded.
41357 </para>
41358 </section>
41359 <section id="SECID146">
41360 <title>Private options for smtp</title>
41361 <para>
41362 <indexterm role="concept">
41363 <primary>options</primary>
41364 <secondary><command>smtp</command> transport</secondary>
41365 </indexterm>
41366 The private options of the <command>smtp</command> transport are as follows:
41367 </para>
41368 <para>
41369 <indexterm role="option">
41370 <primary><option>address_retry_include_sender</option></primary>
41371 </indexterm>
41372 </para>
41373 <informaltable frame="all">
41374 <tgroup cols="4" colsep="0" rowsep="0">
41375 <colspec colwidth="8*" align="left"/>
41376 <colspec colwidth="6*" align="center"/>
41377 <colspec colwidth="6*" align="center"/>
41378 <colspec colwidth="6*" align="right"/>
41379 <tbody>
41380 <row>
41381 <entry><option>address_retry_include_sender</option></entry>
41382 <entry>Use: <emphasis>smtp</emphasis></entry>
41383 <entry>Type: <emphasis>boolean</emphasis></entry>
41384 <entry>Default: <emphasis>true</emphasis></entry>
41385 </row>
41386 </tbody>
41387 </tgroup>
41388 </informaltable>
41389 <para>
41390 <indexterm role="concept">
41391 <primary>4<emphasis>xx</emphasis> responses</primary>
41392 <secondary>retrying after</secondary>
41393 </indexterm>
41394 When an address is delayed because of a 4<emphasis>xx</emphasis> response to a RCPT command, it
41395 is the combination of sender and recipient that is delayed in subsequent queue
41396 runs until the retry time is reached. You can delay the recipient without
41397 reference to the sender (which is what earlier versions of Exim did), by
41398 setting <option>address_retry_include_sender</option> false. However, this can lead to
41399 problems with servers that regularly issue 4<emphasis>xx</emphasis> responses to RCPT commands.
41400 </para>
41401 <para>
41402 <indexterm role="option">
41403 <primary><option>allow_localhost</option></primary>
41404 </indexterm>
41405 </para>
41406 <informaltable frame="all">
41407 <tgroup cols="4" colsep="0" rowsep="0">
41408 <colspec colwidth="8*" align="left"/>
41409 <colspec colwidth="6*" align="center"/>
41410 <colspec colwidth="6*" align="center"/>
41411 <colspec colwidth="6*" align="right"/>
41412 <tbody>
41413 <row>
41414 <entry><option>allow_localhost</option></entry>
41415 <entry>Use: <emphasis>smtp</emphasis></entry>
41416 <entry>Type: <emphasis>boolean</emphasis></entry>
41417 <entry>Default: <emphasis>false</emphasis></entry>
41418 </row>
41419 </tbody>
41420 </tgroup>
41421 </informaltable>
41422 <para>
41423 <indexterm role="concept">
41424 <primary>local host</primary>
41425 <secondary>sending to</secondary>
41426 </indexterm>
41427 <indexterm role="concept">
41428 <primary>fallback</primary>
41429 <secondary>hosts specified on transport</secondary>
41430 </indexterm>
41431 When a host specified in <option>hosts</option> or <option>fallback_hosts</option> (see below) turns out
41432 to be the local host, or is listed in <option>hosts_treat_as_local</option>, delivery is
41433 deferred by default. However, if <option>allow_localhost</option> is set, Exim goes on to do
41434 the delivery anyway. This should be used only in special cases when the
41435 configuration ensures that no looping will result (for example, a differently
41436 configured Exim is listening on the port to which the message is sent).
41437 </para>
41438 <para>
41439 <indexterm role="option">
41440 <primary><option>authenticated_sender</option></primary>
41441 </indexterm>
41442 </para>
41443 <informaltable frame="all">
41444 <tgroup cols="4" colsep="0" rowsep="0">
41445 <colspec colwidth="8*" align="left"/>
41446 <colspec colwidth="6*" align="center"/>
41447 <colspec colwidth="6*" align="center"/>
41448 <colspec colwidth="6*" align="right"/>
41449 <tbody>
41450 <row>
41451 <entry><option>authenticated_sender</option></entry>
41452 <entry>Use: <emphasis>smtp</emphasis></entry>
41453 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41454 <entry>Default: <emphasis>unset</emphasis></entry>
41455 </row>
41456 </tbody>
41457 </tgroup>
41458 </informaltable>
41459 <para>
41460 <indexterm role="concept">
41461 <primary>Cyrus</primary>
41462 </indexterm>
41463 When Exim has authenticated as a client, or if <option>authenticated_sender_force</option>
41464 is true, this option sets a value for the AUTH= item on outgoing MAIL commands,
41465 overriding any existing authenticated sender value. If the string expansion is
41466 forced to fail, the option is ignored. Other expansion failures cause delivery
41467 to be deferred. If the result of expansion is an empty string, that is also
41468 ignored.
41469 </para>
41470 <para>
41471 The expansion happens after the outgoing connection has been made and TLS
41472 started, if required. This means that the <varname>$host</varname>, <varname>$host_address</varname>,
41473 <varname>$tls_cipher</varname>, and <varname>$tls_peerdn</varname> variables are set according to the
41474 particular connection.
41475 </para>
41476 <para>
41477 If the SMTP session is not authenticated, the expansion of
41478 <option>authenticated_sender</option> still happens (and can cause the delivery to be
41479 deferred if it fails), but no AUTH= item is added to MAIL commands
41480 unless <option>authenticated_sender_force</option> is true.
41481 </para>
41482 <para>
41483 This option allows you to use the <command>smtp</command> transport in LMTP mode to
41484 deliver mail to Cyrus IMAP and provide the proper local part as the
41485 <quote>authenticated sender</quote>, via a setting such as:
41486 </para>
41487 <literallayout class="monospaced">
41488 authenticated_sender = $local_part
41489 </literallayout>
41490 <para>
41491 This removes the need for IMAP subfolders to be assigned special ACLs to
41492 allow direct delivery to those subfolders.
41493 </para>
41494 <para>
41495 Because of expected uses such as that just described for Cyrus (when no
41496 domain is involved), there is no checking on the syntax of the provided
41497 value.
41498 </para>
41499 <para>
41500 <indexterm role="option">
41501 <primary><option>authenticated_sender_force</option></primary>
41502 </indexterm>
41503 </para>
41504 <informaltable frame="all">
41505 <tgroup cols="4" colsep="0" rowsep="0">
41506 <colspec colwidth="8*" align="left"/>
41507 <colspec colwidth="6*" align="center"/>
41508 <colspec colwidth="6*" align="center"/>
41509 <colspec colwidth="6*" align="right"/>
41510 <tbody>
41511 <row>
41512 <entry><option>authenticated_sender_force</option></entry>
41513 <entry>Use: <emphasis>smtp</emphasis></entry>
41514 <entry>Type: <emphasis>boolean</emphasis></entry>
41515 <entry>Default: <emphasis>false</emphasis></entry>
41516 </row>
41517 </tbody>
41518 </tgroup>
41519 </informaltable>
41520 <para>
41521 If this option is set true, the <option>authenticated_sender</option> option&#x2019;s value
41522 is used for the AUTH= item on outgoing MAIL commands, even if Exim has not
41523 authenticated as a client.
41524 </para>
41525 <para>
41526 <indexterm role="option">
41527 <primary><option>command_timeout</option></primary>
41528 </indexterm>
41529 </para>
41530 <informaltable frame="all">
41531 <tgroup cols="4" colsep="0" rowsep="0">
41532 <colspec colwidth="8*" align="left"/>
41533 <colspec colwidth="6*" align="center"/>
41534 <colspec colwidth="6*" align="center"/>
41535 <colspec colwidth="6*" align="right"/>
41536 <tbody>
41537 <row>
41538 <entry><option>command_timeout</option></entry>
41539 <entry>Use: <emphasis>smtp</emphasis></entry>
41540 <entry>Type: <emphasis>time</emphasis></entry>
41541 <entry>Default: <emphasis>5m</emphasis></entry>
41542 </row>
41543 </tbody>
41544 </tgroup>
41545 </informaltable>
41546 <para>
41547 This sets a timeout for receiving a response to an SMTP command that has been
41548 sent out. It is also used when waiting for the initial banner line from the
41549 remote host. Its value must not be zero.
41550 </para>
41551 <para>
41552 <indexterm role="option">
41553 <primary><option>connect_timeout</option></primary>
41554 </indexterm>
41555 </para>
41556 <informaltable frame="all">
41557 <tgroup cols="4" colsep="0" rowsep="0">
41558 <colspec colwidth="8*" align="left"/>
41559 <colspec colwidth="6*" align="center"/>
41560 <colspec colwidth="6*" align="center"/>
41561 <colspec colwidth="6*" align="right"/>
41562 <tbody>
41563 <row>
41564 <entry><option>connect_timeout</option></entry>
41565 <entry>Use: <emphasis>smtp</emphasis></entry>
41566 <entry>Type: <emphasis>time</emphasis></entry>
41567 <entry>Default: <emphasis>5m</emphasis></entry>
41568 </row>
41569 </tbody>
41570 </tgroup>
41571 </informaltable>
41572 <para>
41573 This sets a timeout for the <function>connect()</function> function, which sets up a TCP/IP call
41574 to a remote host. A setting of zero allows the system timeout (typically
41575 several minutes) to act. To have any effect, the value of this option must be
41576 less than the system timeout. However, it has been observed that on some
41577 systems there is no system timeout, which is why the default value for this
41578 option is 5 minutes, a value recommended by RFC 1123.
41579 </para>
41580 <para>
41581 <indexterm role="option">
41582 <primary><option>connection_max_messages</option></primary>
41583 </indexterm>
41584 </para>
41585 <informaltable frame="all">
41586 <tgroup cols="4" colsep="0" rowsep="0">
41587 <colspec colwidth="8*" align="left"/>
41588 <colspec colwidth="6*" align="center"/>
41589 <colspec colwidth="6*" align="center"/>
41590 <colspec colwidth="6*" align="right"/>
41591 <tbody>
41592 <row>
41593 <entry><option>connection_max_messages</option></entry>
41594 <entry>Use: <emphasis>smtp</emphasis></entry>
41595 <entry>Type: <emphasis>integer</emphasis></entry>
41596 <entry>Default: <emphasis>500</emphasis></entry>
41597 </row>
41598 </tbody>
41599 </tgroup>
41600 </informaltable>
41601 <para>
41602 <indexterm role="concept">
41603 <primary>SMTP</primary>
41604 <secondary>passed connection</secondary>
41605 </indexterm>
41606 <indexterm role="concept">
41607 <primary>SMTP</primary>
41608 <secondary>multiple deliveries</secondary>
41609 </indexterm>
41610 <indexterm role="concept">
41611 <primary>multiple SMTP deliveries</primary>
41612 </indexterm>
41613 This controls the maximum number of separate message deliveries that are sent
41614 over a single TCP/IP connection. If the value is zero, there is no limit.
41615 For testing purposes, this value can be overridden by the <option>-oB</option> command line
41616 option.
41617 </para>
41618 <para>
41619 <indexterm role="option">
41620 <primary><option>data_timeout</option></primary>
41621 </indexterm>
41622 </para>
41623 <informaltable frame="all">
41624 <tgroup cols="4" colsep="0" rowsep="0">
41625 <colspec colwidth="8*" align="left"/>
41626 <colspec colwidth="6*" align="center"/>
41627 <colspec colwidth="6*" align="center"/>
41628 <colspec colwidth="6*" align="right"/>
41629 <tbody>
41630 <row>
41631 <entry><option>data_timeout</option></entry>
41632 <entry>Use: <emphasis>smtp</emphasis></entry>
41633 <entry>Type: <emphasis>time</emphasis></entry>
41634 <entry>Default: <emphasis>5m</emphasis></entry>
41635 </row>
41636 </tbody>
41637 </tgroup>
41638 </informaltable>
41639 <para>
41640 This sets a timeout for the transmission of each block in the data portion of
41641 the message. As a result, the overall timeout for a message depends on the size
41642 of the message. Its value must not be zero. See also <option>final_timeout</option>.
41643 </para>
41644 <para>
41645 <indexterm role="option">
41646 <primary><option>delay_after_cutoff</option></primary>
41647 </indexterm>
41648 </para>
41649 <informaltable frame="all">
41650 <tgroup cols="4" colsep="0" rowsep="0">
41651 <colspec colwidth="8*" align="left"/>
41652 <colspec colwidth="6*" align="center"/>
41653 <colspec colwidth="6*" align="center"/>
41654 <colspec colwidth="6*" align="right"/>
41655 <tbody>
41656 <row>
41657 <entry><option>delay_after_cutoff</option></entry>
41658 <entry>Use: <emphasis>smtp</emphasis></entry>
41659 <entry>Type: <emphasis>boolean</emphasis></entry>
41660 <entry>Default: <emphasis>true</emphasis></entry>
41661 </row>
41662 </tbody>
41663 </tgroup>
41664 </informaltable>
41665 <para>
41666 This option controls what happens when all remote IP addresses for a given
41667 domain have been inaccessible for so long that they have passed their retry
41668 cutoff times.
41669 </para>
41670 <para>
41671 In the default state, if the next retry time has not been reached for any of
41672 them, the address is bounced without trying any deliveries. In other words,
41673 Exim delays retrying an IP address after the final cutoff time until a new
41674 retry time is reached, and can therefore bounce an address without ever trying
41675 a delivery, when machines have been down for a long time. Some people are
41676 unhappy at this prospect, so...
41677 </para>
41678 <para>
41679 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
41680 addresses are past their final cutoff time, Exim tries to deliver to those
41681 IP addresses that have not been tried since the message arrived. If there are
41682 none, of if they all fail, the address is bounced. In other words, it does not
41683 delay when a new message arrives, but immediately tries those expired IP
41684 addresses that haven&#x2019;t been tried since the message arrived. If there is a
41685 continuous stream of messages for the dead hosts, unsetting
41686 <option>delay_after_cutoff</option> means that there will be many more attempts to deliver
41687 to them.
41688 </para>
41689 <para>
41690 <indexterm role="option">
41691 <primary><option>dns_qualify_single</option></primary>
41692 </indexterm>
41693 </para>
41694 <informaltable frame="all">
41695 <tgroup cols="4" colsep="0" rowsep="0">
41696 <colspec colwidth="8*" align="left"/>
41697 <colspec colwidth="6*" align="center"/>
41698 <colspec colwidth="6*" align="center"/>
41699 <colspec colwidth="6*" align="right"/>
41700 <tbody>
41701 <row>
41702 <entry><option>dns_qualify_single</option></entry>
41703 <entry>Use: <emphasis>smtp</emphasis></entry>
41704 <entry>Type: <emphasis>boolean</emphasis></entry>
41705 <entry>Default: <emphasis>true</emphasis></entry>
41706 </row>
41707 </tbody>
41708 </tgroup>
41709 </informaltable>
41710 <para>
41711 If the <option>hosts</option> or <option>fallback_hosts</option> option is being used,
41712 and the <option>gethostbyname</option> option is false,
41713 the RES_DEFNAMES resolver option is set. See the <option>qualify_single</option> option
41714 in chapter <xref linkend="CHAPdnslookup"/> for more details.
41715 </para>
41716 <para>
41717 <indexterm role="option">
41718 <primary><option>dns_search_parents</option></primary>
41719 </indexterm>
41720 </para>
41721 <informaltable frame="all">
41722 <tgroup cols="4" colsep="0" rowsep="0">
41723 <colspec colwidth="8*" align="left"/>
41724 <colspec colwidth="6*" align="center"/>
41725 <colspec colwidth="6*" align="center"/>
41726 <colspec colwidth="6*" align="right"/>
41727 <tbody>
41728 <row>
41729 <entry><option>dns_search_parents</option></entry>
41730 <entry>Use: <emphasis>smtp</emphasis></entry>
41731 <entry>Type: <emphasis>boolean</emphasis></entry>
41732 <entry>Default: <emphasis>false</emphasis></entry>
41733 </row>
41734 </tbody>
41735 </tgroup>
41736 </informaltable>
41737 <para>
41738 If the <option>hosts</option> or <option>fallback_hosts</option> option is being used, and the
41739 <option>gethostbyname</option> option is false, the RES_DNSRCH resolver option is set.
41740 See the <option>search_parents</option> option in chapter <xref linkend="CHAPdnslookup"/> for more
41741 details.
41742 </para>
41743 <para>
41744 <indexterm role="option">
41745 <primary><option>fallback_hosts</option></primary>
41746 </indexterm>
41747 </para>
41748 <informaltable frame="all">
41749 <tgroup cols="4" colsep="0" rowsep="0">
41750 <colspec colwidth="8*" align="left"/>
41751 <colspec colwidth="6*" align="center"/>
41752 <colspec colwidth="6*" align="center"/>
41753 <colspec colwidth="6*" align="right"/>
41754 <tbody>
41755 <row>
41756 <entry><option>fallback_hosts</option></entry>
41757 <entry>Use: <emphasis>smtp</emphasis></entry>
41758 <entry>Type: <emphasis>string list</emphasis></entry>
41759 <entry>Default: <emphasis>unset</emphasis></entry>
41760 </row>
41761 </tbody>
41762 </tgroup>
41763 </informaltable>
41764 <para>
41765 <indexterm role="concept">
41766 <primary>fallback</primary>
41767 <secondary>hosts specified on transport</secondary>
41768 </indexterm>
41769 String expansion is not applied to this option. The argument must be a
41770 colon-separated list of host names or IP addresses, optionally also including
41771 port numbers, though the separator can be changed, as described in section
41772 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
41773 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
41774 in section <xref linkend="SECTformatonehostitem"/>.
41775 </para>
41776 <para>
41777 Fallback hosts can also be specified on routers, which associate them with the
41778 addresses they process. As for the <option>hosts</option> option without <option>hosts_override</option>,
41779 <option>fallback_hosts</option> specified on the transport is used only if the address does
41780 not have its own associated fallback host list. Unlike <option>hosts</option>, a setting of
41781 <option>fallback_hosts</option> on an address is not overridden by <option>hosts_override</option>.
41782 However, <option>hosts_randomize</option> does apply to fallback host lists.
41783 </para>
41784 <para>
41785 If Exim is unable to deliver to any of the hosts for a particular address, and
41786 the errors are not permanent rejections, the address is put on a separate
41787 transport queue with its host list replaced by the fallback hosts, unless the
41788 address was routed via MX records and the current host was in the original MX
41789 list. In that situation, the fallback host list is not used.
41790 </para>
41791 <para>
41792 Once normal deliveries are complete, the fallback queue is delivered by
41793 re-running the same transports with the new host lists. If several failing
41794 addresses have the same fallback hosts (and <option>max_rcpt</option> permits it), a single
41795 copy of the message is sent.
41796 </para>
41797 <para>
41798 The resolution of the host names on the fallback list is controlled by the
41799 <option>gethostbyname</option> option, as for the <option>hosts</option> option. Fallback hosts apply
41800 both to cases when the host list comes with the address and when it is taken
41801 from <option>hosts</option>. This option provides a <quote>use a smart host only if delivery
41802 fails</quote> facility.
41803 </para>
41804 <para>
41805 <indexterm role="option">
41806 <primary><option>final_timeout</option></primary>
41807 </indexterm>
41808 </para>
41809 <informaltable frame="all">
41810 <tgroup cols="4" colsep="0" rowsep="0">
41811 <colspec colwidth="8*" align="left"/>
41812 <colspec colwidth="6*" align="center"/>
41813 <colspec colwidth="6*" align="center"/>
41814 <colspec colwidth="6*" align="right"/>
41815 <tbody>
41816 <row>
41817 <entry><option>final_timeout</option></entry>
41818 <entry>Use: <emphasis>smtp</emphasis></entry>
41819 <entry>Type: <emphasis>time</emphasis></entry>
41820 <entry>Default: <emphasis>10m</emphasis></entry>
41821 </row>
41822 </tbody>
41823 </tgroup>
41824 </informaltable>
41825 <para>
41826 This is the timeout that applies while waiting for the response to the final
41827 line containing just <quote>.</quote> that terminates a message. Its value must not be
41828 zero.
41829 </para>
41830 <para>
41831 <indexterm role="option">
41832 <primary><option>gethostbyname</option></primary>
41833 </indexterm>
41834 </para>
41835 <informaltable frame="all">
41836 <tgroup cols="4" colsep="0" rowsep="0">
41837 <colspec colwidth="8*" align="left"/>
41838 <colspec colwidth="6*" align="center"/>
41839 <colspec colwidth="6*" align="center"/>
41840 <colspec colwidth="6*" align="right"/>
41841 <tbody>
41842 <row>
41843 <entry><option>gethostbyname</option></entry>
41844 <entry>Use: <emphasis>smtp</emphasis></entry>
41845 <entry>Type: <emphasis>boolean</emphasis></entry>
41846 <entry>Default: <emphasis>false</emphasis></entry>
41847 </row>
41848 </tbody>
41849 </tgroup>
41850 </informaltable>
41851 <para>
41852 If this option is true when the <option>hosts</option> and/or <option>fallback_hosts</option> options are
41853 being used, names are looked up using <function>gethostbyname()</function>
41854 (or <function>getipnodebyname()</function> when available)
41855 instead of using the DNS. Of course, that function may in fact use the DNS, but
41856 it may also consult other sources of information such as <filename>/etc/hosts</filename>.
41857 </para>
41858 <para>
41859 <indexterm role="option">
41860 <primary><option>gnutls_require_kx</option></primary>
41861 </indexterm>
41862 </para>
41863 <informaltable frame="all">
41864 <tgroup cols="4" colsep="0" rowsep="0">
41865 <colspec colwidth="8*" align="left"/>
41866 <colspec colwidth="6*" align="center"/>
41867 <colspec colwidth="6*" align="center"/>
41868 <colspec colwidth="6*" align="right"/>
41869 <tbody>
41870 <row>
41871 <entry><option>gnutls_require_kx</option></entry>
41872 <entry>Use: <emphasis>smtp</emphasis></entry>
41873 <entry>Type: <emphasis>string</emphasis></entry>
41874 <entry>Default: <emphasis>unset</emphasis></entry>
41875 </row>
41876 </tbody>
41877 </tgroup>
41878 </informaltable>
41879 <para>
41880 This option controls the key exchange mechanisms when GnuTLS is used in an Exim
41881 client. For details, see section <xref linkend="SECTreqciphgnu"/>.
41882 </para>
41883 <para>
41884 <indexterm role="option">
41885 <primary><option>gnutls_require_mac</option></primary>
41886 </indexterm>
41887 </para>
41888 <informaltable frame="all">
41889 <tgroup cols="4" colsep="0" rowsep="0">
41890 <colspec colwidth="8*" align="left"/>
41891 <colspec colwidth="6*" align="center"/>
41892 <colspec colwidth="6*" align="center"/>
41893 <colspec colwidth="6*" align="right"/>
41894 <tbody>
41895 <row>
41896 <entry><option>gnutls_require_mac</option></entry>
41897 <entry>Use: <emphasis>smtp</emphasis></entry>
41898 <entry>Type: <emphasis>string</emphasis></entry>
41899 <entry>Default: <emphasis>unset</emphasis></entry>
41900 </row>
41901 </tbody>
41902 </tgroup>
41903 </informaltable>
41904 <para>
41905 This option controls the MAC algorithms when GnuTLS is used in an Exim
41906 client. For details, see section <xref linkend="SECTreqciphgnu"/>.
41907 </para>
41908 <para>
41909 <indexterm role="option">
41910 <primary><option>gnutls_require_protocols</option></primary>
41911 </indexterm>
41912 </para>
41913 <informaltable frame="all">
41914 <tgroup cols="4" colsep="0" rowsep="0">
41915 <colspec colwidth="8*" align="left"/>
41916 <colspec colwidth="6*" align="center"/>
41917 <colspec colwidth="6*" align="center"/>
41918 <colspec colwidth="6*" align="right"/>
41919 <tbody>
41920 <row>
41921 <entry><option>gnutls_require_protocols</option></entry>
41922 <entry>Use: <emphasis>smtp</emphasis></entry>
41923 <entry>Type: <emphasis>string</emphasis></entry>
41924 <entry>Default: <emphasis>unset</emphasis></entry>
41925 </row>
41926 </tbody>
41927 </tgroup>
41928 </informaltable>
41929 <para>
41930 This option controls the protocols when GnuTLS is used in an Exim
41931 client. For details, see section <xref linkend="SECTreqciphgnu"/>.
41932 </para>
41933 <para>
41934 <indexterm role="option">
41935 <primary><option>gnutls_compat_mode</option></primary>
41936 </indexterm>
41937 </para>
41938 <informaltable frame="all">
41939 <tgroup cols="4" colsep="0" rowsep="0">
41940 <colspec colwidth="8*" align="left"/>
41941 <colspec colwidth="6*" align="center"/>
41942 <colspec colwidth="6*" align="center"/>
41943 <colspec colwidth="6*" align="right"/>
41944 <tbody>
41945 <row>
41946 <entry><option>gnutls_compat_mode</option></entry>
41947 <entry>Use: <emphasis>smtp</emphasis></entry>
41948 <entry>Type: <emphasis>boolean</emphasis></entry>
41949 <entry>Default: <emphasis>unset</emphasis></entry>
41950 </row>
41951 </tbody>
41952 </tgroup>
41953 </informaltable>
41954 <para>
41955 This option controls whether GnuTLS is used in compatibility mode in an Exim
41956 server. This reduces security slightly, but improves interworking with older
41957 implementations of TLS.
41958 </para>
41959 <para>
41960 <indexterm role="option">
41961 <primary><option>helo_data</option></primary>
41962 </indexterm>
41963 </para>
41964 <informaltable frame="all">
41965 <tgroup cols="4" colsep="0" rowsep="0">
41966 <colspec colwidth="8*" align="left"/>
41967 <colspec colwidth="6*" align="center"/>
41968 <colspec colwidth="6*" align="center"/>
41969 <colspec colwidth="6*" align="right"/>
41970 <tbody>
41971 <row>
41972 <entry><option>helo_data</option></entry>
41973 <entry>Use: <emphasis>smtp</emphasis></entry>
41974 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41975 <entry>Default: <emphasis>see below</emphasis></entry>
41976 </row>
41977 </tbody>
41978 </tgroup>
41979 </informaltable>
41980 <para>
41981 <indexterm role="concept">
41982 <primary>HELO</primary>
41983 <secondary>argument, setting</secondary>
41984 </indexterm>
41985 <indexterm role="concept">
41986 <primary>EHLO</primary>
41987 <secondary>argument, setting</secondary>
41988 </indexterm>
41989 <indexterm role="concept">
41990 <primary>LHLO argument setting</primary>
41991 </indexterm>
41992 The value of this option is expanded after a connection to a another host has
41993 been set up. The result is used as the argument for the EHLO, HELO, or LHLO
41994 command that starts the outgoing SMTP or LMTP session. The default value of the
41995 option is:
41996 </para>
41997 <literallayout class="monospaced">
41998 $primary_hostname
41999 </literallayout>
42000 <para>
42001 During the expansion, the variables <varname>$host</varname> and <varname>$host_address</varname> are set to
42002 the identity of the remote host, and the variables <varname>$sending_ip_address</varname> and
42003 <varname>$sending_port</varname> are set to the local IP address and port number that are being
42004 used. These variables can be used to generate different values for different
42005 servers or different local IP addresses. For example, if you want the string
42006 that is used for <option>helo_data</option> to be obtained by a DNS lookup of the outgoing
42007 interface address, you could use this:
42008 </para>
42009 <literallayout class="monospaced">
42010 helo_data = ${lookup dnsdb{ptr=$sending_ip_address}{$value}\
42011   {$primary_hostname}}
42012 </literallayout>
42013 <para>
42014 The use of <option>helo_data</option> applies both to sending messages and when doing
42015 callouts.
42016 </para>
42017 <para>
42018 <indexterm role="option">
42019 <primary><option>hosts</option></primary>
42020 </indexterm>
42021 </para>
42022 <informaltable frame="all">
42023 <tgroup cols="4" colsep="0" rowsep="0">
42024 <colspec colwidth="8*" align="left"/>
42025 <colspec colwidth="6*" align="center"/>
42026 <colspec colwidth="6*" align="center"/>
42027 <colspec colwidth="6*" align="right"/>
42028 <tbody>
42029 <row>
42030 <entry><option>hosts</option></entry>
42031 <entry>Use: <emphasis>smtp</emphasis></entry>
42032 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
42033 <entry>Default: <emphasis>unset</emphasis></entry>
42034 </row>
42035 </tbody>
42036 </tgroup>
42037 </informaltable>
42038 <para>
42039 Hosts are associated with an address by a router such as <command>dnslookup</command>, which
42040 finds the hosts by looking up the address domain in the DNS, or by
42041 <command>manualroute</command>, which has lists of hosts in its configuration. However,
42042 email addresses can be passed to the <command>smtp</command> transport by any router, and not
42043 all of them can provide an associated list of hosts.
42044 </para>
42045 <para>
42046 The <option>hosts</option> option specifies a list of hosts to be used if the address being
42047 processed does not have any hosts associated with it. The hosts specified by
42048 <option>hosts</option> are also used, whether or not the address has its own hosts, if
42049 <option>hosts_override</option> is set.
42050 </para>
42051 <para>
42052 The string is first expanded, before being interpreted as a colon-separated
42053 list of host names or IP addresses, possibly including port numbers. The
42054 separator may be changed to something other than colon, as described in section
42055 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
42056 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
42057 in section <xref linkend="SECTformatonehostitem"/>. However, note that the <literal>/MX</literal> facility
42058 of the <command>manualroute</command> router is not available here.
42059 </para>
42060 <para>
42061 If the expansion fails, delivery is deferred. Unless the failure was caused by
42062 the inability to complete a lookup, the error is logged to the panic log as
42063 well as the main log. Host names are looked up either by searching directly for
42064 address records in the DNS or by calling <function>gethostbyname()</function> (or
42065 <function>getipnodebyname()</function> when available), depending on the setting of the
42066 <option>gethostbyname</option> option. When Exim is compiled with IPv6 support, if a host
42067 that is looked up in the DNS has both IPv4 and IPv6 addresses, both types of
42068 address are used.
42069 </para>
42070 <para>
42071 During delivery, the hosts are tried in order, subject to their retry status,
42072 unless <option>hosts_randomize</option> is set.
42073 </para>
42074 <para>
42075 <indexterm role="option">
42076 <primary><option>hosts_avoid_esmtp</option></primary>
42077 </indexterm>
42078 </para>
42079 <informaltable frame="all">
42080 <tgroup cols="4" colsep="0" rowsep="0">
42081 <colspec colwidth="8*" align="left"/>
42082 <colspec colwidth="6*" align="center"/>
42083 <colspec colwidth="6*" align="center"/>
42084 <colspec colwidth="6*" align="right"/>
42085 <tbody>
42086 <row>
42087 <entry><option>hosts_avoid_esmtp</option></entry>
42088 <entry>Use: <emphasis>smtp</emphasis></entry>
42089 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
42090 <entry>Default: <emphasis>unset</emphasis></entry>
42091 </row>
42092 </tbody>
42093 </tgroup>
42094 </informaltable>
42095 <para>
42096 <indexterm role="concept">
42097 <primary>ESMTP, avoiding use of</primary>
42098 </indexterm>
42099 <indexterm role="concept">
42100 <primary>HELO</primary>
42101 <secondary>forcing use of</secondary>
42102 </indexterm>
42103 <indexterm role="concept">
42104 <primary>EHLO</primary>
42105 <secondary>avoiding use of</secondary>
42106 </indexterm>
42107 <indexterm role="concept">
42108 <primary>PIPELINING</primary>
42109 <secondary>avoiding the use of</secondary>
42110 </indexterm>
42111 This option is for use with broken hosts that announce ESMTP facilities (for
42112 example, PIPELINING) and then fail to implement them properly. When a host
42113 matches <option>hosts_avoid_esmtp</option>, Exim sends HELO rather than EHLO at the
42114 start of the SMTP session. This means that it cannot use any of the ESMTP
42115 facilities such as AUTH, PIPELINING, SIZE, and STARTTLS.
42116 </para>
42117 <para>
42118 <indexterm role="option">
42119 <primary><option>hosts_avoid_pipelining</option></primary>
42120 </indexterm>
42121 </para>
42122 <informaltable frame="all">
42123 <tgroup cols="4" colsep="0" rowsep="0">
42124 <colspec colwidth="8*" align="left"/>
42125 <colspec colwidth="6*" align="center"/>
42126 <colspec colwidth="6*" align="center"/>
42127 <colspec colwidth="6*" align="right"/>
42128 <tbody>
42129 <row>
42130 <entry><option>hosts_avoid_pipelining</option></entry>
42131 <entry>Use: <emphasis>smtp</emphasis></entry>
42132 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
42133 <entry>Default: <emphasis>unset</emphasis></entry>
42134 </row>
42135 </tbody>
42136 </tgroup>
42137 </informaltable>
42138 <para>
42139 <indexterm role="concept">
42140 <primary>PIPELINING</primary>
42141 <secondary>avoiding the use of</secondary>
42142 </indexterm>
42143 Exim will not use the SMTP PIPELINING extension when delivering to any host
42144 that matches this list, even if the server host advertises PIPELINING support.
42145 </para>
42146 <para>
42147 <indexterm role="option">
42148 <primary><option>hosts_avoid_tls</option></primary>
42149 </indexterm>
42150 </para>
42151 <informaltable frame="all">
42152 <tgroup cols="4" colsep="0" rowsep="0">
42153 <colspec colwidth="8*" align="left"/>
42154 <colspec colwidth="6*" align="center"/>
42155 <colspec colwidth="6*" align="center"/>
42156 <colspec colwidth="6*" align="right"/>
42157 <tbody>
42158 <row>
42159 <entry><option>hosts_avoid_tls</option></entry>
42160 <entry>Use: <emphasis>smtp</emphasis></entry>
42161 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
42162 <entry>Default: <emphasis>unset</emphasis></entry>
42163 </row>
42164 </tbody>
42165 </tgroup>
42166 </informaltable>
42167 <para>
42168 <indexterm role="concept">
42169 <primary>TLS</primary>
42170 <secondary>avoiding for certain hosts</secondary>
42171 </indexterm>
42172 Exim will not try to start a TLS session when delivering to any host that
42173 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
42174 </para>
42175 <para>
42176 <indexterm role="option">
42177 <primary><option>hosts_max_try</option></primary>
42178 </indexterm>
42179 </para>
42180 <informaltable frame="all">
42181 <tgroup cols="4" colsep="0" rowsep="0">
42182 <colspec colwidth="8*" align="left"/>
42183 <colspec colwidth="6*" align="center"/>
42184 <colspec colwidth="6*" align="center"/>
42185 <colspec colwidth="6*" align="right"/>
42186 <tbody>
42187 <row>
42188 <entry><option>hosts_max_try</option></entry>
42189 <entry>Use: <emphasis>smtp</emphasis></entry>
42190 <entry>Type: <emphasis>integer</emphasis></entry>
42191 <entry>Default: <emphasis>5</emphasis></entry>
42192 </row>
42193 </tbody>
42194 </tgroup>
42195 </informaltable>
42196 <para>
42197 <indexterm role="concept">
42198 <primary>host</primary>
42199 <secondary>maximum number to try</secondary>
42200 </indexterm>
42201 <indexterm role="concept">
42202 <primary>limit</primary>
42203 <secondary>number of hosts tried</secondary>
42204 </indexterm>
42205 <indexterm role="concept">
42206 <primary>limit</primary>
42207 <secondary>number of MX tried</secondary>
42208 </indexterm>
42209 <indexterm role="concept">
42210 <primary>MX record</primary>
42211 <secondary>maximum tried</secondary>
42212 </indexterm>
42213 This option limits the number of IP addresses that are tried for any one
42214 delivery in cases where there are temporary delivery errors. Section
42215 <xref linkend="SECTvalhosmax"/> describes in detail how the value of this option is used.
42216 </para>
42217 <para>
42218 <indexterm role="option">
42219 <primary><option>hosts_max_try_hardlimit</option></primary>
42220 </indexterm>
42221 </para>
42222 <informaltable frame="all">
42223 <tgroup cols="4" colsep="0" rowsep="0">
42224 <colspec colwidth="8*" align="left"/>
42225 <colspec colwidth="6*" align="center"/>
42226 <colspec colwidth="6*" align="center"/>
42227 <colspec colwidth="6*" align="right"/>
42228 <tbody>
42229 <row>
42230 <entry><option>hosts_max_try_hardlimit</option></entry>
42231 <entry>Use: <emphasis>smtp</emphasis></entry>
42232 <entry>Type: <emphasis>integer</emphasis></entry>
42233 <entry>Default: <emphasis>50</emphasis></entry>
42234 </row>
42235 </tbody>
42236 </tgroup>
42237 </informaltable>
42238 <para>
42239 This is an additional check on the maximum number of IP addresses that Exim
42240 tries for any one delivery. Section <xref linkend="SECTvalhosmax"/> describes its use and
42241 why it exists.
42242 </para>
42243 <para>
42244 <indexterm role="option">
42245 <primary><option>hosts_nopass_tls</option></primary>
42246 </indexterm>
42247 </para>
42248 <informaltable frame="all">
42249 <tgroup cols="4" colsep="0" rowsep="0">
42250 <colspec colwidth="8*" align="left"/>
42251 <colspec colwidth="6*" align="center"/>
42252 <colspec colwidth="6*" align="center"/>
42253 <colspec colwidth="6*" align="right"/>
42254 <tbody>
42255 <row>
42256 <entry><option>hosts_nopass_tls</option></entry>
42257 <entry>Use: <emphasis>smtp</emphasis></entry>
42258 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
42259 <entry>Default: <emphasis>unset</emphasis></entry>
42260 </row>
42261 </tbody>
42262 </tgroup>
42263 </informaltable>
42264 <para>
42265 <indexterm role="concept">
42266 <primary>TLS</primary>
42267 <secondary>passing connection</secondary>
42268 </indexterm>
42269 <indexterm role="concept">
42270 <primary>multiple SMTP deliveries</primary>
42271 </indexterm>
42272 <indexterm role="concept">
42273 <primary>TLS</primary>
42274 <secondary>multiple message deliveries</secondary>
42275 </indexterm>
42276 For any host that matches this list, a connection on which a TLS session has
42277 been started will not be passed to a new delivery process for sending another
42278 message on the same connection. See section <xref linkend="SECTmulmessam"/> for an
42279 explanation of when this might be needed.
42280 </para>
42281 <para>
42282 <indexterm role="option">
42283 <primary><option>hosts_override</option></primary>
42284 </indexterm>
42285 </para>
42286 <informaltable frame="all">
42287 <tgroup cols="4" colsep="0" rowsep="0">
42288 <colspec colwidth="8*" align="left"/>
42289 <colspec colwidth="6*" align="center"/>
42290 <colspec colwidth="6*" align="center"/>
42291 <colspec colwidth="6*" align="right"/>
42292 <tbody>
42293 <row>
42294 <entry><option>hosts_override</option></entry>
42295 <entry>Use: <emphasis>smtp</emphasis></entry>
42296 <entry>Type: <emphasis>boolean</emphasis></entry>
42297 <entry>Default: <emphasis>false</emphasis></entry>
42298 </row>
42299 </tbody>
42300 </tgroup>
42301 </informaltable>
42302 <para>
42303 If this option is set and the <option>hosts</option> option is also set, any hosts that are
42304 attached to the address are ignored, and instead the hosts specified by the
42305 <option>hosts</option> option are always used. This option does not apply to
42306 <option>fallback_hosts</option>.
42307 </para>
42308 <para>
42309 <indexterm role="option">
42310 <primary><option>hosts_randomize</option></primary>
42311 </indexterm>
42312 </para>
42313 <informaltable frame="all">
42314 <tgroup cols="4" colsep="0" rowsep="0">
42315 <colspec colwidth="8*" align="left"/>
42316 <colspec colwidth="6*" align="center"/>
42317 <colspec colwidth="6*" align="center"/>
42318 <colspec colwidth="6*" align="right"/>
42319 <tbody>
42320 <row>
42321 <entry><option>hosts_randomize</option></entry>
42322 <entry>Use: <emphasis>smtp</emphasis></entry>
42323 <entry>Type: <emphasis>boolean</emphasis></entry>
42324 <entry>Default: <emphasis>false</emphasis></entry>
42325 </row>
42326 </tbody>
42327 </tgroup>
42328 </informaltable>
42329 <para>
42330 <indexterm role="concept">
42331 <primary>randomized host list</primary>
42332 </indexterm>
42333 <indexterm role="concept">
42334 <primary>host</primary>
42335 <secondary>list of; randomized</secondary>
42336 </indexterm>
42337 <indexterm role="concept">
42338 <primary>fallback</primary>
42339 <secondary>randomized hosts</secondary>
42340 </indexterm>
42341 If this option is set, and either the list of hosts is taken from the
42342 <option>hosts</option> or the <option>fallback_hosts</option> option, or the hosts supplied by the router
42343 were not obtained from MX records (this includes fallback hosts from the
42344 router), and were not randomized by the router, the order of trying the hosts
42345 is randomized each time the transport runs. Randomizing the order of a host
42346 list can be used to do crude load sharing.
42347 </para>
42348 <para>
42349 When <option>hosts_randomize</option> is true, a host list may be split into groups whose
42350 order is separately randomized. This makes it possible to set up MX-like
42351 behaviour. The boundaries between groups are indicated by an item that is just
42352 <literal>+</literal> in the host list. For example:
42353 </para>
42354 <literallayout class="monospaced">
42355 hosts = host1:host2:host3:+:host4:host5
42356 </literallayout>
42357 <para>
42358 The order of the first three hosts and the order of the last two hosts is
42359 randomized for each use, but the first three always end up before the last two.
42360 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored.
42361 </para>
42362 <para>
42363 <indexterm role="option">
42364 <primary><option>hosts_require_auth</option></primary>
42365 </indexterm>
42366 </para>
42367 <informaltable frame="all">
42368 <tgroup cols="4" colsep="0" rowsep="0">
42369 <colspec colwidth="8*" align="left"/>
42370 <colspec colwidth="6*" align="center"/>
42371 <colspec colwidth="6*" align="center"/>
42372 <colspec colwidth="6*" align="right"/>
42373 <tbody>
42374 <row>
42375 <entry><option>hosts_require_auth</option></entry>
42376 <entry>Use: <emphasis>smtp</emphasis></entry>
42377 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
42378 <entry>Default: <emphasis>unset</emphasis></entry>
42379 </row>
42380 </tbody>
42381 </tgroup>
42382 </informaltable>
42383 <para>
42384 <indexterm role="concept">
42385 <primary>authentication</primary>
42386 <secondary>required by client</secondary>
42387 </indexterm>
42388 This option provides a list of servers for which authentication must succeed
42389 before Exim will try to transfer a message. If authentication fails for
42390 servers which are not in this list, Exim tries to send unauthenticated. If
42391 authentication fails for one of these servers, delivery is deferred. This
42392 temporary error is detectable in the retry rules, so it can be turned into a
42393 hard failure if required. See also <option>hosts_try_auth</option>, and chapter
42394 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
42395 </para>
42396 <para>
42397 <indexterm role="option">
42398 <primary><option>hosts_require_tls</option></primary>
42399 </indexterm>
42400 </para>
42401 <informaltable frame="all">
42402 <tgroup cols="4" colsep="0" rowsep="0">
42403 <colspec colwidth="8*" align="left"/>
42404 <colspec colwidth="6*" align="center"/>
42405 <colspec colwidth="6*" align="center"/>
42406 <colspec colwidth="6*" align="right"/>
42407 <tbody>
42408 <row>
42409 <entry><option>hosts_require_tls</option></entry>
42410 <entry>Use: <emphasis>smtp</emphasis></entry>
42411 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
42412 <entry>Default: <emphasis>unset</emphasis></entry>
42413 </row>
42414 </tbody>
42415 </tgroup>
42416 </informaltable>
42417 <para>
42418 <indexterm role="concept">
42419 <primary>TLS</primary>
42420 <secondary>requiring for certain servers</secondary>
42421 </indexterm>
42422 Exim will insist on using a TLS session when delivering to any host that
42423 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
42424 <emphasis role="bold">Note</emphasis>: This option affects outgoing mail only. To insist on TLS for
42425 incoming messages, use an appropriate ACL.
42426 </para>
42427 <para>
42428 <indexterm role="option">
42429 <primary><option>hosts_try_auth</option></primary>
42430 </indexterm>
42431 </para>
42432 <informaltable frame="all">
42433 <tgroup cols="4" colsep="0" rowsep="0">
42434 <colspec colwidth="8*" align="left"/>
42435 <colspec colwidth="6*" align="center"/>
42436 <colspec colwidth="6*" align="center"/>
42437 <colspec colwidth="6*" align="right"/>
42438 <tbody>
42439 <row>
42440 <entry><option>hosts_try_auth</option></entry>
42441 <entry>Use: <emphasis>smtp</emphasis></entry>
42442 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
42443 <entry>Default: <emphasis>unset</emphasis></entry>
42444 </row>
42445 </tbody>
42446 </tgroup>
42447 </informaltable>
42448 <para>
42449 <indexterm role="concept">
42450 <primary>authentication</primary>
42451 <secondary>optional in client</secondary>
42452 </indexterm>
42453 This option provides a list of servers to which, provided they announce
42454 authentication support, Exim will attempt to authenticate as a client when it
42455 connects. If authentication fails, Exim will try to transfer the message
42456 unauthenticated. See also <option>hosts_require_auth</option>, and chapter
42457 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
42458 </para>
42459 <para>
42460 <indexterm role="option">
42461 <primary><option>interface</option></primary>
42462 </indexterm>
42463 </para>
42464 <informaltable frame="all">
42465 <tgroup cols="4" colsep="0" rowsep="0">
42466 <colspec colwidth="8*" align="left"/>
42467 <colspec colwidth="6*" align="center"/>
42468 <colspec colwidth="6*" align="center"/>
42469 <colspec colwidth="6*" align="right"/>
42470 <tbody>
42471 <row>
42472 <entry><option>interface</option></entry>
42473 <entry>Use: <emphasis>smtp</emphasis></entry>
42474 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
42475 <entry>Default: <emphasis>unset</emphasis></entry>
42476 </row>
42477 </tbody>
42478 </tgroup>
42479 </informaltable>
42480 <para>
42481 <indexterm role="concept">
42482 <primary>bind IP address</primary>
42483 </indexterm>
42484 <indexterm role="concept">
42485 <primary>IP address</primary>
42486 <secondary>binding</secondary>
42487 </indexterm>
42488 <indexterm role="variable">
42489 <primary><varname>$host</varname></primary>
42490 </indexterm>
42491 <indexterm role="variable">
42492 <primary><varname>$host_address</varname></primary>
42493 </indexterm>
42494 This option specifies which interface to bind to when making an outgoing SMTP
42495 call. The value is an IP address, not an interface name such as
42496 <literal>eth0</literal>. Do not confuse this with the interface address that was used when a
42497 message was received, which is in <varname>$received_ip_address</varname>, formerly known as
42498 <varname>$interface_address</varname>. The name was changed to minimize confusion with the
42499 outgoing interface address. There is no variable that contains an outgoing
42500 interface address because, unless it is set by this option, its value is
42501 unknown.
42502 </para>
42503 <para>
42504 During the expansion of the <option>interface</option> option the variables <varname>$host</varname> and
42505 <varname>$host_address</varname> refer to the host to which a connection is about to be made
42506 during the expansion of the string. Forced expansion failure, or an empty
42507 string result causes the option to be ignored. Otherwise, after expansion, the
42508 string must be a list of IP addresses, colon-separated by default, but the
42509 separator can be changed in the usual way. For example:
42510 </para>
42511 <literallayout class="monospaced">
42512 interface = &lt;; 192.168.123.123 ; 3ffe:ffff:836f::fe86:a061
42513 </literallayout>
42514 <para>
42515 The first interface of the correct type (IPv4 or IPv6) is used for the outgoing
42516 connection. If none of them are the correct type, the option is ignored. If
42517 <option>interface</option> is not set, or is ignored, the system&#x2019;s IP functions choose which
42518 interface to use if the host has more than one.
42519 </para>
42520 <para>
42521 <indexterm role="option">
42522 <primary><option>keepalive</option></primary>
42523 </indexterm>
42524 </para>
42525 <informaltable frame="all">
42526 <tgroup cols="4" colsep="0" rowsep="0">
42527 <colspec colwidth="8*" align="left"/>
42528 <colspec colwidth="6*" align="center"/>
42529 <colspec colwidth="6*" align="center"/>
42530 <colspec colwidth="6*" align="right"/>
42531 <tbody>
42532 <row>
42533 <entry><option>keepalive</option></entry>
42534 <entry>Use: <emphasis>smtp</emphasis></entry>
42535 <entry>Type: <emphasis>boolean</emphasis></entry>
42536 <entry>Default: <emphasis>true</emphasis></entry>
42537 </row>
42538 </tbody>
42539 </tgroup>
42540 </informaltable>
42541 <para>
42542 <indexterm role="concept">
42543 <primary>keepalive</primary>
42544 <secondary>on outgoing connection</secondary>
42545 </indexterm>
42546 This option controls the setting of SO_KEEPALIVE on outgoing TCP/IP socket
42547 connections. When set, it causes the kernel to probe idle connections
42548 periodically, by sending packets with <quote>old</quote> sequence numbers. The other end
42549 of the connection should send a acknowledgment if the connection is still okay
42550 or a reset if the connection has been aborted. The reason for doing this is
42551 that it has the beneficial effect of freeing up certain types of connection
42552 that can get stuck when the remote host is disconnected without tidying up the
42553 TCP/IP call properly. The keepalive mechanism takes several hours to detect
42554 unreachable hosts.
42555 </para>
42556 <para>
42557 <indexterm role="option">
42558 <primary><option>lmtp_ignore_quota</option></primary>
42559 </indexterm>
42560 </para>
42561 <informaltable frame="all">
42562 <tgroup cols="4" colsep="0" rowsep="0">
42563 <colspec colwidth="8*" align="left"/>
42564 <colspec colwidth="6*" align="center"/>
42565 <colspec colwidth="6*" align="center"/>
42566 <colspec colwidth="6*" align="right"/>
42567 <tbody>
42568 <row>
42569 <entry><option>lmtp_ignore_quota</option></entry>
42570 <entry>Use: <emphasis>smtp</emphasis></entry>
42571 <entry>Type: <emphasis>boolean</emphasis></entry>
42572 <entry>Default: <emphasis>false</emphasis></entry>
42573 </row>
42574 </tbody>
42575 </tgroup>
42576 </informaltable>
42577 <para>
42578 <indexterm role="concept">
42579 <primary>LMTP</primary>
42580 <secondary>ignoring quota errors</secondary>
42581 </indexterm>
42582 If this option is set true when the <option>protocol</option> option is set to <quote>lmtp</quote>, the
42583 string <literal>IGNOREQUOTA</literal> is added to RCPT commands, provided that the LMTP server
42584 has advertised support for IGNOREQUOTA in its response to the LHLO command.
42585 </para>
42586 <para>
42587 <indexterm role="option">
42588 <primary><option>max_rcpt</option></primary>
42589 </indexterm>
42590 </para>
42591 <informaltable frame="all">
42592 <tgroup cols="4" colsep="0" rowsep="0">
42593 <colspec colwidth="8*" align="left"/>
42594 <colspec colwidth="6*" align="center"/>
42595 <colspec colwidth="6*" align="center"/>
42596 <colspec colwidth="6*" align="right"/>
42597 <tbody>
42598 <row>
42599 <entry><option>max_rcpt</option></entry>
42600 <entry>Use: <emphasis>smtp</emphasis></entry>
42601 <entry>Type: <emphasis>integer</emphasis></entry>
42602 <entry>Default: <emphasis>100</emphasis></entry>
42603 </row>
42604 </tbody>
42605 </tgroup>
42606 </informaltable>
42607 <para>
42608 <indexterm role="concept">
42609 <primary>RCPT</primary>
42610 <secondary>maximum number of outgoing</secondary>
42611 </indexterm>
42612 This option limits the number of RCPT commands that are sent in a single
42613 SMTP message transaction. Each set of addresses is treated independently, and
42614 so can cause parallel connections to the same host if <option>remote_max_parallel</option>
42615 permits this.
42616 </para>
42617 <para>
42618 <indexterm role="option">
42619 <primary><option>multi_domain</option></primary>
42620 </indexterm>
42621 </para>
42622 <informaltable frame="all">
42623 <tgroup cols="4" colsep="0" rowsep="0">
42624 <colspec colwidth="8*" align="left"/>
42625 <colspec colwidth="6*" align="center"/>
42626 <colspec colwidth="6*" align="center"/>
42627 <colspec colwidth="6*" align="right"/>
42628 <tbody>
42629 <row>
42630 <entry><option>multi_domain</option></entry>
42631 <entry>Use: <emphasis>smtp</emphasis></entry>
42632 <entry>Type: <emphasis>boolean</emphasis></entry>
42633 <entry>Default: <emphasis>true</emphasis></entry>
42634 </row>
42635 </tbody>
42636 </tgroup>
42637 </informaltable>
42638 <para>
42639 <indexterm role="variable">
42640 <primary><varname>$domain</varname></primary>
42641 </indexterm>
42642 When this option is set, the <command>smtp</command> transport can handle a number of
42643 addresses containing a mixture of different domains provided they all resolve
42644 to the same list of hosts. Turning the option off restricts the transport to
42645 handling only one domain at a time. This is useful if you want to use
42646 <varname>$domain</varname> in an expansion for the transport, because it is set only when there
42647 is a single domain involved in a remote delivery.
42648 </para>
42649 <para>
42650 <indexterm role="option">
42651 <primary><option>port</option></primary>
42652 </indexterm>
42653 </para>
42654 <informaltable frame="all">
42655 <tgroup cols="4" colsep="0" rowsep="0">
42656 <colspec colwidth="8*" align="left"/>
42657 <colspec colwidth="6*" align="center"/>
42658 <colspec colwidth="6*" align="center"/>
42659 <colspec colwidth="6*" align="right"/>
42660 <tbody>
42661 <row>
42662 <entry><option>port</option></entry>
42663 <entry>Use: <emphasis>smtp</emphasis></entry>
42664 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42665 <entry>Default: <emphasis>see below</emphasis></entry>
42666 </row>
42667 </tbody>
42668 </tgroup>
42669 </informaltable>
42670 <para>
42671 <indexterm role="concept">
42672 <primary>port</primary>
42673 <secondary>sending TCP/IP</secondary>
42674 </indexterm>
42675 <indexterm role="concept">
42676 <primary>TCP/IP</primary>
42677 <secondary>setting outgoing port</secondary>
42678 </indexterm>
42679 This option specifies the TCP/IP port on the server to which Exim connects.
42680 <emphasis role="bold">Note:</emphasis> Do not confuse this with the port that was used when a message was
42681 received, which is in <varname>$received_port</varname>, formerly known as <varname>$interface_port</varname>.
42682 The name was changed to minimize confusion with the outgoing port. There is no
42683 variable that contains an outgoing port.
42684 </para>
42685 <para>
42686 If the value of this option begins with a digit it is taken as a port number;
42687 otherwise it is looked up using <function>getservbyname()</function>. The default value is
42688 normally <quote>smtp</quote>, but if <option>protocol</option> is set to <quote>lmtp</quote>, the default is
42689 <quote>lmtp</quote>. If the expansion fails, or if a port number cannot be found, delivery
42690 is deferred.
42691 </para>
42692 <para>
42693 <indexterm role="option">
42694 <primary><option>protocol</option></primary>
42695 </indexterm>
42696 </para>
42697 <informaltable frame="all">
42698 <tgroup cols="4" colsep="0" rowsep="0">
42699 <colspec colwidth="8*" align="left"/>
42700 <colspec colwidth="6*" align="center"/>
42701 <colspec colwidth="6*" align="center"/>
42702 <colspec colwidth="6*" align="right"/>
42703 <tbody>
42704 <row>
42705 <entry><option>protocol</option></entry>
42706 <entry>Use: <emphasis>smtp</emphasis></entry>
42707 <entry>Type: <emphasis>string</emphasis></entry>
42708 <entry>Default: <emphasis>smtp</emphasis></entry>
42709 </row>
42710 </tbody>
42711 </tgroup>
42712 </informaltable>
42713 <para>
42714 <indexterm role="concept">
42715 <primary>LMTP</primary>
42716 <secondary>over TCP/IP</secondary>
42717 </indexterm>
42718 If this option is set to <quote>lmtp</quote> instead of <quote>smtp</quote>, the default value for
42719 the <option>port</option> option changes to <quote>lmtp</quote>, and the transport operates the LMTP
42720 protocol (RFC 2033) instead of SMTP. This protocol is sometimes used for local
42721 deliveries into closed message stores. Exim also has support for running LMTP
42722 over a pipe to a local process &ndash; see chapter <xref linkend="CHAPLMTP"/>.
42723 </para>
42724 <para>
42725 <indexterm role="option">
42726 <primary><option>retry_include_ip_address</option></primary>
42727 </indexterm>
42728 </para>
42729 <informaltable frame="all">
42730 <tgroup cols="4" colsep="0" rowsep="0">
42731 <colspec colwidth="8*" align="left"/>
42732 <colspec colwidth="6*" align="center"/>
42733 <colspec colwidth="6*" align="center"/>
42734 <colspec colwidth="6*" align="right"/>
42735 <tbody>
42736 <row>
42737 <entry><option>retry_include_ip_address</option></entry>
42738 <entry>Use: <emphasis>smtp</emphasis></entry>
42739 <entry>Type: <emphasis>boolean</emphasis></entry>
42740 <entry>Default: <emphasis>true</emphasis></entry>
42741 </row>
42742 </tbody>
42743 </tgroup>
42744 </informaltable>
42745 <para>
42746 Exim normally includes both the host name and the IP address in the key it
42747 constructs for indexing retry data after a temporary delivery failure. This
42748 means that when one of several IP addresses for a host is failing, it gets
42749 tried periodically (controlled by the retry rules), but use of the other IP
42750 addresses is not affected.
42751 </para>
42752 <para>
42753 However, in some dialup environments hosts are assigned a different IP address
42754 each time they connect. In this situation the use of the IP address as part of
42755 the retry key leads to undesirable behaviour. Setting this option false causes
42756 Exim to use only the host name. This should normally be done on a separate
42757 instance of the <command>smtp</command> transport, set up specially to handle the dialup
42758 hosts.
42759 </para>
42760 <para>
42761 <indexterm role="option">
42762 <primary><option>serialize_hosts</option></primary>
42763 </indexterm>
42764 </para>
42765 <informaltable frame="all">
42766 <tgroup cols="4" colsep="0" rowsep="0">
42767 <colspec colwidth="8*" align="left"/>
42768 <colspec colwidth="6*" align="center"/>
42769 <colspec colwidth="6*" align="center"/>
42770 <colspec colwidth="6*" align="right"/>
42771 <tbody>
42772 <row>
42773 <entry><option>serialize_hosts</option></entry>
42774 <entry>Use: <emphasis>smtp</emphasis></entry>
42775 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
42776 <entry>Default: <emphasis>unset</emphasis></entry>
42777 </row>
42778 </tbody>
42779 </tgroup>
42780 </informaltable>
42781 <para>
42782 <indexterm role="concept">
42783 <primary>serializing connections</primary>
42784 </indexterm>
42785 <indexterm role="concept">
42786 <primary>host</primary>
42787 <secondary>serializing connections</secondary>
42788 </indexterm>
42789 Because Exim operates in a distributed manner, if several messages for the same
42790 host arrive at around the same time, more than one simultaneous connection to
42791 the remote host can occur. This is not usually a problem except when there is a
42792 slow link between the hosts. In that situation it may be helpful to restrict
42793 Exim to one connection at a time. This can be done by setting
42794 <option>serialize_hosts</option> to match the relevant hosts.
42795 </para>
42796 <para>
42797 <indexterm role="concept">
42798 <primary>hints database</primary>
42799 <secondary>serializing deliveries to a host</secondary>
42800 </indexterm>
42801 Exim implements serialization by means of a hints database in which a record is
42802 written whenever a process connects to one of the restricted hosts. The record
42803 is deleted when the connection is completed. Obviously there is scope for
42804 records to get left lying around if there is a system or program crash. To
42805 guard against this, Exim ignores any records that are more than six hours old.
42806 </para>
42807 <para>
42808 If you set up this kind of serialization, you should also arrange to delete the
42809 relevant hints database whenever your system reboots. The names of the files
42810 start with <filename>misc</filename> and they are kept in the <filename>spool/db</filename> directory. There
42811 may be one or two files, depending on the type of DBM in use. The same files
42812 are used for ETRN serialization.
42813 </para>
42814 <para>
42815 <indexterm role="option">
42816 <primary><option>size_addition</option></primary>
42817 </indexterm>
42818 </para>
42819 <informaltable frame="all">
42820 <tgroup cols="4" colsep="0" rowsep="0">
42821 <colspec colwidth="8*" align="left"/>
42822 <colspec colwidth="6*" align="center"/>
42823 <colspec colwidth="6*" align="center"/>
42824 <colspec colwidth="6*" align="right"/>
42825 <tbody>
42826 <row>
42827 <entry><option>size_addition</option></entry>
42828 <entry>Use: <emphasis>smtp</emphasis></entry>
42829 <entry>Type: <emphasis>integer</emphasis></entry>
42830 <entry>Default: <emphasis>1024</emphasis></entry>
42831 </row>
42832 </tbody>
42833 </tgroup>
42834 </informaltable>
42835 <para>
42836 <indexterm role="concept">
42837 <primary>SMTP</primary>
42838 <secondary>SIZE</secondary>
42839 </indexterm>
42840 <indexterm role="concept">
42841 <primary>message</primary>
42842 <secondary>size issue for transport filter</secondary>
42843 </indexterm>
42844 <indexterm role="concept">
42845 <primary>size</primary>
42846 <secondary>of message</secondary>
42847 </indexterm>
42848 <indexterm role="concept">
42849 <primary>transport</primary>
42850 <secondary>filter</secondary>
42851 </indexterm>
42852 <indexterm role="concept">
42853 <primary>filter</primary>
42854 <secondary>transport filter</secondary>
42855 </indexterm>
42856 If a remote SMTP server indicates that it supports the SIZE option of the
42857 MAIL command, Exim uses this to pass over the message size at the start of
42858 an SMTP transaction. It adds the value of <option>size_addition</option> to the value it
42859 sends, to allow for headers and other text that may be added during delivery by
42860 configuration options or in a transport filter. It may be necessary to increase
42861 this if a lot of text is added to messages.
42862 </para>
42863 <para>
42864 Alternatively, if the value of <option>size_addition</option> is set negative, it disables
42865 the use of the SIZE option altogether.
42866 </para>
42867 <para>
42868 <indexterm role="option">
42869 <primary><option>tls_certificate</option></primary>
42870 </indexterm>
42871 </para>
42872 <informaltable frame="all">
42873 <tgroup cols="4" colsep="0" rowsep="0">
42874 <colspec colwidth="8*" align="left"/>
42875 <colspec colwidth="6*" align="center"/>
42876 <colspec colwidth="6*" align="center"/>
42877 <colspec colwidth="6*" align="right"/>
42878 <tbody>
42879 <row>
42880 <entry><option>tls_certificate</option></entry>
42881 <entry>Use: <emphasis>smtp</emphasis></entry>
42882 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42883 <entry>Default: <emphasis>unset</emphasis></entry>
42884 </row>
42885 </tbody>
42886 </tgroup>
42887 </informaltable>
42888 <para>
42889 <indexterm role="concept">
42890 <primary>TLS</primary>
42891 <secondary>client certificate, location of</secondary>
42892 </indexterm>
42893 <indexterm role="concept">
42894 <primary>certificate</primary>
42895 <secondary>client, location of</secondary>
42896 </indexterm>
42897 <indexterm role="variable">
42898 <primary><varname>$host</varname></primary>
42899 </indexterm>
42900 <indexterm role="variable">
42901 <primary><varname>$host_address</varname></primary>
42902 </indexterm>
42903 The value of this option must be the absolute path to a file which contains the
42904 client&#x2019;s certificate, for possible use when sending a message over an encrypted
42905 connection. The values of <varname>$host</varname> and <varname>$host_address</varname> are set to the name and
42906 address of the server during the expansion. See chapter <xref linkend="CHAPTLS"/> for
42907 details of TLS.
42908 </para>
42909 <para>
42910 <emphasis role="bold">Note</emphasis>: This option must be set if you want Exim to be able to use a TLS
42911 certificate when sending messages as a client. The global option of the same
42912 name specifies the certificate for Exim as a server; it is not automatically
42913 assumed that the same certificate should be used when Exim is operating as a
42914 client.
42915 </para>
42916 <para>
42917 <indexterm role="option">
42918 <primary><option>tls_crl</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>tls_crl</option></entry>
42930 <entry>Use: <emphasis>smtp</emphasis></entry>
42931 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42932 <entry>Default: <emphasis>unset</emphasis></entry>
42933 </row>
42934 </tbody>
42935 </tgroup>
42936 </informaltable>
42937 <para>
42938 <indexterm role="concept">
42939 <primary>TLS</primary>
42940 <secondary>client certificate revocation list</secondary>
42941 </indexterm>
42942 <indexterm role="concept">
42943 <primary>certificate</primary>
42944 <secondary>revocation list for client</secondary>
42945 </indexterm>
42946 This option specifies a certificate revocation list. The expanded value must
42947 be the name of a file that contains a CRL in PEM format.
42948 </para>
42949 <para>
42950 <indexterm role="option">
42951 <primary><option>tls_privatekey</option></primary>
42952 </indexterm>
42953 </para>
42954 <informaltable frame="all">
42955 <tgroup cols="4" colsep="0" rowsep="0">
42956 <colspec colwidth="8*" align="left"/>
42957 <colspec colwidth="6*" align="center"/>
42958 <colspec colwidth="6*" align="center"/>
42959 <colspec colwidth="6*" align="right"/>
42960 <tbody>
42961 <row>
42962 <entry><option>tls_privatekey</option></entry>
42963 <entry>Use: <emphasis>smtp</emphasis></entry>
42964 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42965 <entry>Default: <emphasis>unset</emphasis></entry>
42966 </row>
42967 </tbody>
42968 </tgroup>
42969 </informaltable>
42970 <para>
42971 <indexterm role="concept">
42972 <primary>TLS</primary>
42973 <secondary>client private key, location of</secondary>
42974 </indexterm>
42975 <indexterm role="variable">
42976 <primary><varname>$host</varname></primary>
42977 </indexterm>
42978 <indexterm role="variable">
42979 <primary><varname>$host_address</varname></primary>
42980 </indexterm>
42981 The value of this option must be the absolute path to a file which contains the
42982 client&#x2019;s private key. This is used when sending a message over an encrypted
42983 connection using a client certificate. The values of <varname>$host</varname> and
42984 <varname>$host_address</varname> are set to the name and address of the server during the
42985 expansion. If this option is unset, or the expansion is forced to fail, or the
42986 result is an empty string, the private key is assumed to be in the same file as
42987 the certificate. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
42988 </para>
42989 <para>
42990 <indexterm role="option">
42991 <primary><option>tls_require_ciphers</option></primary>
42992 </indexterm>
42993 </para>
42994 <informaltable frame="all">
42995 <tgroup cols="4" colsep="0" rowsep="0">
42996 <colspec colwidth="8*" align="left"/>
42997 <colspec colwidth="6*" align="center"/>
42998 <colspec colwidth="6*" align="center"/>
42999 <colspec colwidth="6*" align="right"/>
43000 <tbody>
43001 <row>
43002 <entry><option>tls_require_ciphers</option></entry>
43003 <entry>Use: <emphasis>smtp</emphasis></entry>
43004 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43005 <entry>Default: <emphasis>unset</emphasis></entry>
43006 </row>
43007 </tbody>
43008 </tgroup>
43009 </informaltable>
43010 <para>
43011 <indexterm role="concept">
43012 <primary>TLS</primary>
43013 <secondary>requiring specific ciphers</secondary>
43014 </indexterm>
43015 <indexterm role="concept">
43016 <primary>cipher</primary>
43017 <secondary>requiring specific</secondary>
43018 </indexterm>
43019 <indexterm role="variable">
43020 <primary><varname>$host</varname></primary>
43021 </indexterm>
43022 <indexterm role="variable">
43023 <primary><varname>$host_address</varname></primary>
43024 </indexterm>
43025 The value of this option must be a list of permitted cipher suites, for use
43026 when setting up an outgoing encrypted connection. (There is a global option of
43027 the same name for controlling incoming connections.) The values of <varname>$host</varname> and
43028 <varname>$host_address</varname> are set to the name and address of the server during the
43029 expansion. See chapter <xref linkend="CHAPTLS"/> for details of TLS; note that this option
43030 is used in different ways by OpenSSL and GnuTLS (see sections
43031 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>). For GnuTLS, the order of the
43032 ciphers is a preference order.
43033 </para>
43034 <para>
43035 <indexterm role="option">
43036 <primary><option>tls_tempfail_tryclear</option></primary>
43037 </indexterm>
43038 </para>
43039 <informaltable frame="all">
43040 <tgroup cols="4" colsep="0" rowsep="0">
43041 <colspec colwidth="8*" align="left"/>
43042 <colspec colwidth="6*" align="center"/>
43043 <colspec colwidth="6*" align="center"/>
43044 <colspec colwidth="6*" align="right"/>
43045 <tbody>
43046 <row>
43047 <entry><option>tls_tempfail_tryclear</option></entry>
43048 <entry>Use: <emphasis>smtp</emphasis></entry>
43049 <entry>Type: <emphasis>boolean</emphasis></entry>
43050 <entry>Default: <emphasis>true</emphasis></entry>
43051 </row>
43052 </tbody>
43053 </tgroup>
43054 </informaltable>
43055 <para>
43056 <indexterm role="concept">
43057 <primary>4<emphasis>xx</emphasis> responses</primary>
43058 <secondary>to STARTTLS</secondary>
43059 </indexterm>
43060 When the server host is not in <option>hosts_require_tls</option>, and there is a problem in
43061 setting up a TLS session, this option determines whether or not Exim should try
43062 to deliver the message unencrypted. If it is set false, delivery to the
43063 current host is deferred; if there are other hosts, they are tried. If this
43064 option is set true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis>
43065 response to STARTTLS. Also, if STARTTLS is accepted, but the subsequent
43066 TLS negotiation fails, Exim closes the current connection (because it is in an
43067 unknown state), opens a new one to the same host, and then tries the delivery
43068 in clear.
43069 </para>
43070 <para>
43071 <indexterm role="option">
43072 <primary><option>tls_verify_certificates</option></primary>
43073 </indexterm>
43074 </para>
43075 <informaltable frame="all">
43076 <tgroup cols="4" colsep="0" rowsep="0">
43077 <colspec colwidth="8*" align="left"/>
43078 <colspec colwidth="6*" align="center"/>
43079 <colspec colwidth="6*" align="center"/>
43080 <colspec colwidth="6*" align="right"/>
43081 <tbody>
43082 <row>
43083 <entry><option>tls_verify_certificates</option></entry>
43084 <entry>Use: <emphasis>smtp</emphasis></entry>
43085 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43086 <entry>Default: <emphasis>unset</emphasis></entry>
43087 </row>
43088 </tbody>
43089 </tgroup>
43090 </informaltable>
43091 <para>
43092 <indexterm role="concept">
43093 <primary>TLS</primary>
43094 <secondary>server certificate verification</secondary>
43095 </indexterm>
43096 <indexterm role="concept">
43097 <primary>certificate</primary>
43098 <secondary>verification of server</secondary>
43099 </indexterm>
43100 <indexterm role="variable">
43101 <primary><varname>$host</varname></primary>
43102 </indexterm>
43103 <indexterm role="variable">
43104 <primary><varname>$host_address</varname></primary>
43105 </indexterm>
43106 The value of this option must be the absolute path to a file containing
43107 permitted server certificates, for use when setting up an encrypted connection.
43108 Alternatively, if you are using OpenSSL, you can set
43109 <option>tls_verify_certificates</option> to the name of a directory containing certificate
43110 files. This does not work with GnuTLS; the option must be set to the name of a
43111 single file if you are using GnuTLS. The values of <varname>$host</varname> and
43112 <varname>$host_address</varname> are set to the name and address of the server during the
43113 expansion of this option. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
43114 </para>
43115 </section>
43116 <section id="SECTvalhosmax">
43117 <title>How the limits for the number of hosts to try are used</title>
43118 <para>
43119 <indexterm role="concept">
43120 <primary>host</primary>
43121 <secondary>maximum number to try</secondary>
43122 </indexterm>
43123 <indexterm role="concept">
43124 <primary>limit</primary>
43125 <secondary>hosts; maximum number tried</secondary>
43126 </indexterm>
43127 There are two options that are concerned with the number of hosts that are
43128 tried when an SMTP delivery takes place. They are <option>hosts_max_try</option> and
43129 <option>hosts_max_try_hardlimit</option>.
43130 </para>
43131 <para>
43132 The <option>hosts_max_try</option> option limits the number of hosts that are tried
43133 for a single delivery. However, despite the term <quote>host</quote> in its name, the
43134 option actually applies to each IP address independently. In other words, a
43135 multihomed host is treated as several independent hosts, just as it is for
43136 retrying.
43137 </para>
43138 <para>
43139 Many of the larger ISPs have multiple MX records which often point to
43140 multihomed hosts. As a result, a list of a dozen or more IP addresses may be
43141 created as a result of routing one of these domains.
43142 </para>
43143 <para>
43144 Trying every single IP address on such a long list does not seem sensible; if
43145 several at the top of the list fail, it is reasonable to assume there is some
43146 problem that is likely to affect all of them. Roughly speaking, the value of
43147 <option>hosts_max_try</option> is the maximum number that are tried before deferring the
43148 delivery. However, the logic cannot be quite that simple.
43149 </para>
43150 <para>
43151 Firstly, IP addresses that are skipped because their retry times have not
43152 arrived do not count, and in addition, addresses that are past their retry
43153 limits are also not counted, even when they are tried. This means that when
43154 some IP addresses are past their retry limits, more than the value of
43155 <option>hosts_max_retry</option> may be tried. The reason for this behaviour is to ensure
43156 that all IP addresses are considered before timing out an email address (but
43157 see below for an exception).
43158 </para>
43159 <para>
43160 Secondly, when the <option>hosts_max_try</option> limit is reached, Exim looks down the host
43161 list to see if there is a subsequent host with a different (higher valued) MX.
43162 If there is, that host is considered next, and the current IP address is used
43163 but not counted. This behaviour helps in the case of a domain with a retry rule
43164 that hardly ever delays any hosts, as is now explained:
43165 </para>
43166 <para>
43167 Consider the case of a long list of hosts with one MX value, and a few with a
43168 higher MX value. If <option>hosts_max_try</option> is small (the default is 5) only a few
43169 hosts at the top of the list are tried at first. With the default retry rule,
43170 which specifies increasing retry times, the higher MX hosts are eventually
43171 tried when those at the top of the list are skipped because they have not
43172 reached their retry times.
43173 </para>
43174 <para>
43175 However, it is common practice to put a fixed short retry time on domains for
43176 large ISPs, on the grounds that their servers are rarely down for very long.
43177 Unfortunately, these are exactly the domains that tend to resolve to long lists
43178 of hosts. The short retry time means that the lowest MX hosts are tried every
43179 time. The attempts may be in a different order because of random sorting, but
43180 without the special MX check, the higher MX hosts would never be tried until
43181 all the lower MX hosts had timed out (which might be several days), because
43182 there are always some lower MX hosts that have reached their retry times. With
43183 the special check, Exim considers at least one IP address from each MX value at
43184 every delivery attempt, even if the <option>hosts_max_try</option> limit has already been
43185 reached.
43186 </para>
43187 <para>
43188 The above logic means that <option>hosts_max_try</option> is not a hard limit, and in
43189 particular, Exim normally eventually tries all the IP addresses before timing
43190 out an email address. When <option>hosts_max_try</option> was implemented, this seemed a
43191 reasonable thing to do. Recently, however, some lunatic DNS configurations have
43192 been set up with hundreds of IP addresses for some domains. It can
43193 take a very long time indeed for an address to time out in these cases.
43194 </para>
43195 <para>
43196 The <option>hosts_max_try_hardlimit</option> option was added to help with this problem.
43197 Exim never tries more than this number of IP addresses; if it hits this limit
43198 and they are all timed out, the email address is bounced, even though not all
43199 possible IP addresses have been tried.
43200 <indexterm role="concept" startref="IIDsmttra1" class="endofrange"/>
43201 <indexterm role="concept" startref="IIDsmttra2" class="endofrange"/>
43202 </para>
43203 </section>
43204 </chapter>
43205
43206 <chapter id="CHAPrewrite">
43207 <title>Address rewriting</title>
43208 <para>
43209 <indexterm role="concept" id="IIDaddrew" class="startofrange">
43210 <primary>rewriting</primary>
43211 <secondary>addresses</secondary>
43212 </indexterm>
43213 There are some circumstances in which Exim automatically rewrites domains in
43214 addresses. The two most common are when an address is given without a domain
43215 (referred to as an <quote>unqualified address</quote>) or when an address contains an
43216 abbreviated domain that is expanded by DNS lookup.
43217 </para>
43218 <para>
43219 Unqualified envelope addresses are accepted only for locally submitted
43220 messages, or for messages that are received from hosts matching
43221 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
43222 appropriate. Unqualified addresses in header lines are qualified if they are in
43223 locally submitted messages, or messages from hosts that are permitted to send
43224 unqualified envelope addresses. Otherwise, unqualified addresses in header
43225 lines are neither qualified nor rewritten.
43226 </para>
43227 <para>
43228 One situation in which Exim does <emphasis>not</emphasis> automatically rewrite a domain is
43229 when it is the name of a CNAME record in the DNS. The older RFCs suggest that
43230 such a domain should be rewritten using the <quote>canonical</quote> name, and some MTAs
43231 do this. The new RFCs do not contain this suggestion.
43232 </para>
43233 <section id="SECID147">
43234 <title>Explicitly configured address rewriting</title>
43235 <para>
43236 This chapter describes the rewriting rules that can be used in the
43237 main rewrite section of the configuration file, and also in the generic
43238 <option>headers_rewrite</option> option that can be set on any transport.
43239 </para>
43240 <para>
43241 Some people believe that configured address rewriting is a Mortal Sin.
43242 Others believe that life is not possible without it. Exim provides the
43243 facility; you do not have to use it.
43244 </para>
43245 <para>
43246 The main rewriting rules that appear in the <quote>rewrite</quote> section of the
43247 configuration file are applied to addresses in incoming messages, both envelope
43248 addresses and addresses in header lines. Each rule specifies the types of
43249 address to which it applies.
43250 </para>
43251 <para>
43252 Whether or not addresses in header lines are rewritten depends on the origin of
43253 the headers and the type of rewriting. Global rewriting, that is, rewriting
43254 rules from the rewrite section of the configuration file, is applied only to
43255 those headers that were received with the message. Header lines that are added
43256 by ACLs or by a system filter or by individual routers or transports (which
43257 are specific to individual recipient addresses) are not rewritten by the global
43258 rules.
43259 </para>
43260 <para>
43261 Rewriting at transport time, by means of the <option>headers_rewrite</option> option,
43262 applies all headers except those added by routers and transports. That is, as
43263 well as the headers that were received with the message, it also applies to
43264 headers that were added by an ACL or a system filter.
43265 </para>
43266 <para>
43267 In general, rewriting addresses from your own system or domain has some
43268 legitimacy. Rewriting other addresses should be done only with great care and
43269 in special circumstances. The author of Exim believes that rewriting should be
43270 used sparingly, and mainly for <quote>regularizing</quote> addresses in your own domains.
43271 Although it can sometimes be used as a routing tool, this is very strongly
43272 discouraged.
43273 </para>
43274 <para>
43275 There are two commonly encountered circumstances where rewriting is used, as
43276 illustrated by these examples:
43277 </para>
43278 <itemizedlist>
43279 <listitem>
43280 <para>
43281 The company whose domain is <emphasis>hitch.fict.example</emphasis> has a number of hosts that
43282 exchange mail with each other behind a firewall, but there is only a single
43283 gateway to the outer world. The gateway rewrites <emphasis>*.hitch.fict.example</emphasis> as
43284 <emphasis>hitch.fict.example</emphasis> when sending mail off-site.
43285 </para>
43286 </listitem>
43287 <listitem>
43288 <para>
43289 A host rewrites the local parts of its own users so that, for example,
43290 <emphasis>fp42@hitch.fict.example</emphasis> becomes <emphasis>Ford.Prefect@hitch.fict.example</emphasis>.
43291 </para>
43292 </listitem>
43293 </itemizedlist>
43294 </section>
43295 <section id="SECID148">
43296 <title>When does rewriting happen?</title>
43297 <para>
43298 <indexterm role="concept">
43299 <primary>rewriting</primary>
43300 <secondary>timing of</secondary>
43301 </indexterm>
43302 <indexterm role="concept">
43303 <primary>access control lists (ACLs)</primary>
43304 <secondary>rewriting addresses in</secondary>
43305 </indexterm>
43306 Configured address rewriting can take place at several different stages of a
43307 message&#x2019;s processing.
43308 </para>
43309 <para>
43310 <indexterm role="variable">
43311 <primary><varname>$sender_address</varname></primary>
43312 </indexterm>
43313 At the start of an ACL for MAIL, the sender address may have been rewritten
43314 by a special SMTP-time rewrite rule (see section <xref linkend="SECTrewriteS"/>), but no
43315 ordinary rewrite rules have yet been applied. If, however, the sender address
43316 is verified in the ACL, it is rewritten before verification, and remains
43317 rewritten thereafter. The subsequent value of <varname>$sender_address</varname> is the
43318 rewritten address. This also applies if sender verification happens in a
43319 RCPT ACL. Otherwise, when the sender address is not verified, it is
43320 rewritten as soon as a message&#x2019;s header lines have been received.
43321 </para>
43322 <para>
43323 <indexterm role="variable">
43324 <primary><varname>$domain</varname></primary>
43325 </indexterm>
43326 <indexterm role="variable">
43327 <primary><varname>$local_part</varname></primary>
43328 </indexterm>
43329 Similarly, at the start of an ACL for RCPT, the current recipient&#x2019;s address
43330 may have been rewritten by a special SMTP-time rewrite rule, but no ordinary
43331 rewrite rules have yet been applied to it. However, the behaviour is different
43332 from the sender address when a recipient is verified. The address is rewritten
43333 for the verification, but the rewriting is not remembered at this stage. The
43334 value of <varname>$local_part</varname> and <varname>$domain</varname> after verification are always the same
43335 as they were before (that is, they contain the unrewritten &ndash; except for
43336 SMTP-time rewriting &ndash; address).
43337 </para>
43338 <para>
43339 As soon as a message&#x2019;s header lines have been received, all the envelope
43340 recipient addresses are permanently rewritten, and rewriting is also applied to
43341 the addresses in the header lines (if configured). This happens before adding
43342 any header lines that were specified in MAIL or RCPT ACLs, and
43343 <indexterm role="concept">
43344 <primary><function>local_scan()</function> function</primary>
43345 <secondary>address rewriting; timing of</secondary>
43346 </indexterm>
43347 before the DATA ACL and <function>local_scan()</function> functions are run.
43348 </para>
43349 <para>
43350 When an address is being routed, either for delivery or for verification,
43351 rewriting is applied immediately to child addresses that are generated by
43352 redirection, unless <option>no_rewrite</option> is set on the router.
43353 </para>
43354 <para>
43355 <indexterm role="concept">
43356 <primary>envelope sender</primary>
43357 <secondary>rewriting at transport time</secondary>
43358 </indexterm>
43359 <indexterm role="concept">
43360 <primary>rewriting</primary>
43361 <secondary>at transport time</secondary>
43362 </indexterm>
43363 <indexterm role="concept">
43364 <primary>header lines</primary>
43365 <secondary>rewriting at transport time</secondary>
43366 </indexterm>
43367 At transport time, additional rewriting of addresses in header lines can be
43368 specified by setting the generic <option>headers_rewrite</option> option on a transport.
43369 This option contains rules that are identical in form to those in the rewrite
43370 section of the configuration file. They are applied to the original message
43371 header lines and any that were added by ACLs or a system filter. They are not
43372 applied to header lines that are added by routers or the transport.
43373 </para>
43374 <para>
43375 The outgoing envelope sender can be rewritten by means of the <option>return_path</option>
43376 transport option. However, it is not possible to rewrite envelope recipients at
43377 transport time.
43378 </para>
43379 </section>
43380 <section id="SECID149">
43381 <title>Testing the rewriting rules that apply on input</title>
43382 <para>
43383 <indexterm role="concept">
43384 <primary>rewriting</primary>
43385 <secondary>testing</secondary>
43386 </indexterm>
43387 <indexterm role="concept">
43388 <primary>testing</primary>
43389 <secondary>rewriting</secondary>
43390 </indexterm>
43391 Exim&#x2019;s input rewriting configuration appears in a part of the run time
43392 configuration file headed by <quote>begin rewrite</quote>. It can be tested by the
43393 <option>-brw</option> command line option. This takes an address (which can be a full RFC
43394 2822 address) as its argument. The output is a list of how the address would be
43395 transformed by the rewriting rules for each of the different places it might
43396 appear in an incoming message, that is, for each different header and for the
43397 envelope sender and recipient fields. For example,
43398 </para>
43399 <literallayout class="monospaced">
43400 exim -brw ph10@exim.workshop.example
43401 </literallayout>
43402 <para>
43403 might produce the output
43404 </para>
43405 <literallayout class="monospaced">
43406 sender: Philip.Hazel@exim.workshop.example
43407 from: Philip.Hazel@exim.workshop.example
43408 to: ph10@exim.workshop.example
43409 cc: ph10@exim.workshop.example
43410 bcc: ph10@exim.workshop.example
43411 reply-to: Philip.Hazel@exim.workshop.example
43412 env-from: Philip.Hazel@exim.workshop.example
43413 env-to: ph10@exim.workshop.example
43414 </literallayout>
43415 <para>
43416 which shows that rewriting has been set up for that address when used in any of
43417 the source fields, but not when it appears as a recipient address. At the
43418 present time, there is no equivalent way of testing rewriting rules that are
43419 set for a particular transport.
43420 </para>
43421 </section>
43422 <section id="SECID150">
43423 <title>Rewriting rules</title>
43424 <para>
43425 <indexterm role="concept">
43426 <primary>rewriting</primary>
43427 <secondary>rules</secondary>
43428 </indexterm>
43429 The rewrite section of the configuration file consists of lines of rewriting
43430 rules in the form
43431 </para>
43432 <literallayout>
43433 &lt;<emphasis>source pattern</emphasis>&gt;  &lt;<emphasis>replacement</emphasis>&gt;  &lt;<emphasis>flags</emphasis>&gt;
43434 </literallayout>
43435 <para>
43436 Rewriting rules that are specified for the <option>headers_rewrite</option> generic
43437 transport option are given as a colon-separated list. Each item in the list
43438 takes the same form as a line in the main rewriting configuration (except that
43439 any colons must be doubled, of course).
43440 </para>
43441 <para>
43442 The formats of source patterns and replacement strings are described below.
43443 Each is terminated by white space, unless enclosed in double quotes, in which
43444 case normal quoting conventions apply inside the quotes. The flags are single
43445 characters which may appear in any order. Spaces and tabs between them are
43446 ignored.
43447 </para>
43448 <para>
43449 For each address that could potentially be rewritten, the rules are scanned in
43450 order, and replacements for the address from earlier rules can themselves be
43451 replaced by later rules (but see the <quote>q</quote> and <quote>R</quote> flags).
43452 </para>
43453 <para>
43454 The order in which addresses are rewritten is undefined, may change between
43455 releases, and must not be relied on, with one exception: when a message is
43456 received, the envelope sender is always rewritten first, before any header
43457 lines are rewritten. For example, the replacement string for a rewrite of an
43458 address in <emphasis>To:</emphasis> must not assume that the message&#x2019;s address in <emphasis>From:</emphasis> has
43459 (or has not) already been rewritten. However, a rewrite of <emphasis>From:</emphasis> may assume
43460 that the envelope sender has already been rewritten.
43461 </para>
43462 <para>
43463 <indexterm role="variable">
43464 <primary><varname>$domain</varname></primary>
43465 </indexterm>
43466 <indexterm role="variable">
43467 <primary><varname>$local_part</varname></primary>
43468 </indexterm>
43469 The variables <varname>$local_part</varname> and <varname>$domain</varname> can be used in the replacement
43470 string to refer to the address that is being rewritten. Note that lookup-driven
43471 rewriting can be done by a rule of the form
43472 </para>
43473 <literallayout class="monospaced">
43474 *@*   ${lookup ...
43475 </literallayout>
43476 <para>
43477 where the lookup key uses <varname>$1</varname> and <varname>$2</varname> or <varname>$local_part</varname> and <varname>$domain</varname> to
43478 refer to the address that is being rewritten.
43479 </para>
43480 </section>
43481 <section id="SECID151">
43482 <title>Rewriting patterns</title>
43483 <para>
43484 <indexterm role="concept">
43485 <primary>rewriting</primary>
43486 <secondary>patterns</secondary>
43487 </indexterm>
43488 <indexterm role="concept">
43489 <primary>address list</primary>
43490 <secondary>in a rewriting pattern</secondary>
43491 </indexterm>
43492 The source pattern in a rewriting rule is any item which may appear in an
43493 address list (see section <xref linkend="SECTaddresslist"/>). It is in fact processed as a
43494 single-item address list, which means that it is expanded before being tested
43495 against the address. As always, if you use a regular expression as a pattern,
43496 you must take care to escape dollar and backslash characters, or use the <literal>\N</literal>
43497 facility to suppress string expansion within the regular expression.
43498 </para>
43499 <para>
43500 Domains in patterns should be given in lower case. Local parts in patterns are
43501 case-sensitive. If you want to do case-insensitive matching of local parts, you
43502 can use a regular expression that starts with <literal>^(?i)</literal>.
43503 </para>
43504 <para>
43505 <indexterm role="concept">
43506 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
43507 <secondary>in rewriting rules</secondary>
43508 </indexterm>
43509 After matching, the numerical variables <varname>$1</varname>, <varname>$2</varname>, etc. may be set,
43510 depending on the type of match which occurred. These can be used in the
43511 replacement string to insert portions of the incoming address. <varname>$0</varname> always
43512 refers to the complete incoming address. When a regular expression is used, the
43513 numerical variables are set from its capturing subexpressions. For other types
43514 of pattern they are set as follows:
43515 </para>
43516 <itemizedlist>
43517 <listitem>
43518 <para>
43519 If a local part or domain starts with an asterisk, the numerical variables
43520 refer to the character strings matched by asterisks, with <varname>$1</varname> associated with
43521 the first asterisk, and <varname>$2</varname> with the second, if present. For example, if the
43522 pattern
43523 </para>
43524 <literallayout class="monospaced">
43525 *queen@*.fict.example
43526 </literallayout>
43527 <para>
43528 is matched against the address <emphasis>hearts-queen@wonderland.fict.example</emphasis> then
43529 </para>
43530 <literallayout class="monospaced">
43531 $0 = hearts-queen@wonderland.fict.example
43532 $1 = hearts-
43533 $2 = wonderland
43534 </literallayout>
43535 <para>
43536 Note that if the local part does not start with an asterisk, but the domain
43537 does, it is <varname>$1</varname> that contains the wild part of the domain.
43538 </para>
43539 </listitem>
43540 <listitem>
43541 <para>
43542 If the domain part of the pattern is a partial lookup, the wild and fixed parts
43543 of the domain are placed in the next available numerical variables. Suppose,
43544 for example, that the address <emphasis>foo@bar.baz.example</emphasis> is processed by a
43545 rewriting rule of the form
43546 </para>
43547 <literallayout>
43548 <literal>*@partial-dbm;/some/dbm/file</literal>    &lt;<emphasis>replacement string</emphasis>&gt;
43549 </literallayout>
43550 <para>
43551 and the key in the file that matches the domain is <literal>*.baz.example</literal>. Then
43552 </para>
43553 <literallayout class="monospaced">
43554 $1 = foo
43555 $2 = bar
43556 $3 = baz.example
43557 </literallayout>
43558 <para>
43559 If the address <emphasis>foo@baz.example</emphasis> is looked up, this matches the same
43560 wildcard file entry, and in this case <varname>$2</varname> is set to the empty string, but
43561 <varname>$3</varname> is still set to <emphasis>baz.example</emphasis>. If a non-wild key is matched in a
43562 partial lookup, <varname>$2</varname> is again set to the empty string and <varname>$3</varname> is set to the
43563 whole domain. For non-partial domain lookups, no numerical variables are set.
43564 </para>
43565 </listitem>
43566 </itemizedlist>
43567 </section>
43568 <section id="SECID152">
43569 <title>Rewriting replacements</title>
43570 <para>
43571 <indexterm role="concept">
43572 <primary>rewriting</primary>
43573 <secondary>replacements</secondary>
43574 </indexterm>
43575 If the replacement string for a rule is a single asterisk, addresses that
43576 match the pattern and the flags are <emphasis>not</emphasis> rewritten, and no subsequent
43577 rewriting rules are scanned. For example,
43578 </para>
43579 <literallayout class="monospaced">
43580 hatta@lookingglass.fict.example  *  f
43581 </literallayout>
43582 <para>
43583 specifies that <emphasis>hatta@lookingglass.fict.example</emphasis> is never to be rewritten in
43584 <emphasis>From:</emphasis> headers.
43585 </para>
43586 <para>
43587 <indexterm role="variable">
43588 <primary><varname>$domain</varname></primary>
43589 </indexterm>
43590 <indexterm role="variable">
43591 <primary><varname>$local_part</varname></primary>
43592 </indexterm>
43593 If the replacement string is not a single asterisk, it is expanded, and must
43594 yield a fully qualified address. Within the expansion, the variables
43595 <varname>$local_part</varname> and <varname>$domain</varname> refer to the address that is being rewritten.
43596 Any letters they contain retain their original case &ndash; they are not lower
43597 cased. The numerical variables are set up according to the type of pattern that
43598 matched the address, as described above. If the expansion is forced to fail by
43599 the presence of <quote>fail</quote> in a conditional or lookup item, rewriting by the
43600 current rule is abandoned, but subsequent rules may take effect. Any other
43601 expansion failure causes the entire rewriting operation to be abandoned, and an
43602 entry written to the panic log.
43603 </para>
43604 </section>
43605 <section id="SECID153">
43606 <title>Rewriting flags</title>
43607 <para>
43608 There are three different kinds of flag that may appear on rewriting rules:
43609 </para>
43610 <itemizedlist>
43611 <listitem>
43612 <para>
43613 Flags that specify which headers and envelope addresses to rewrite: E, F, T, b,
43614 c, f, h, r, s, t.
43615 </para>
43616 </listitem>
43617 <listitem>
43618 <para>
43619 A flag that specifies rewriting at SMTP time: S.
43620 </para>
43621 </listitem>
43622 <listitem>
43623 <para>
43624 Flags that control the rewriting process: Q, q, R, w.
43625 </para>
43626 </listitem>
43627 </itemizedlist>
43628 <para>
43629 For rules that are part of the <option>headers_rewrite</option> generic transport option,
43630 E, F, T, and S are not permitted.
43631 </para>
43632 </section>
43633 <section id="SECID154">
43634 <title>Flags specifying which headers and envelope addresses to rewrite</title>
43635 <para>
43636 <indexterm role="concept">
43637 <primary>rewriting</primary>
43638 <secondary>flags</secondary>
43639 </indexterm>
43640 If none of the following flag letters, nor the <quote>S</quote> flag (see section
43641 <xref linkend="SECTrewriteS"/>) are present, a main rewriting rule applies to all headers
43642 and to both the sender and recipient fields of the envelope, whereas a
43643 transport-time rewriting rule just applies to all headers. Otherwise, the
43644 rewriting rule is skipped unless the relevant addresses are being processed.
43645 </para>
43646 <literallayout>
43647 <literal>E</literal>       rewrite all envelope fields
43648 <literal>F</literal>       rewrite the envelope From field
43649 <literal>T</literal>       rewrite the envelope To field
43650 <literal>b</literal>       rewrite the <emphasis>Bcc:</emphasis> header
43651 <literal>c</literal>       rewrite the <emphasis>Cc:</emphasis> header
43652 <literal>f</literal>       rewrite the <emphasis>From:</emphasis> header
43653 <literal>h</literal>       rewrite all headers
43654 <literal>r</literal>       rewrite the <emphasis>Reply-To:</emphasis> header
43655 <literal>s</literal>       rewrite the <emphasis>Sender:</emphasis> header
43656 <literal>t</literal>       rewrite the <emphasis>To:</emphasis> header
43657 </literallayout>
43658 <para>
43659 "All headers" means all of the headers listed above that can be selected
43660 individually, plus their <emphasis>Resent-</emphasis> versions. It does not include
43661 other headers such as <emphasis>Subject:</emphasis> etc.
43662 </para>
43663 <para>
43664 You should be particularly careful about rewriting <emphasis>Sender:</emphasis> headers, and
43665 restrict this to special known cases in your own domains.
43666 </para>
43667 </section>
43668 <section id="SECTrewriteS">
43669 <title>The SMTP-time rewriting flag</title>
43670 <para>
43671 <indexterm role="concept">
43672 <primary>SMTP</primary>
43673 <secondary>rewriting malformed addresses</secondary>
43674 </indexterm>
43675 <indexterm role="concept">
43676 <primary>RCPT</primary>
43677 <secondary>rewriting argument of</secondary>
43678 </indexterm>
43679 <indexterm role="concept">
43680 <primary>MAIL</primary>
43681 <secondary>rewriting argument of</secondary>
43682 </indexterm>
43683 The rewrite flag <quote>S</quote> specifies a rewrite of incoming envelope addresses at
43684 SMTP time, as soon as an address is received in a MAIL or RCPT command, and
43685 before any other processing; even before syntax checking. The pattern is
43686 required to be a regular expression, and it is matched against the whole of the
43687 data for the command, including any surrounding angle brackets.
43688 </para>
43689 <para>
43690 <indexterm role="variable">
43691 <primary><varname>$domain</varname></primary>
43692 </indexterm>
43693 <indexterm role="variable">
43694 <primary><varname>$local_part</varname></primary>
43695 </indexterm>
43696 This form of rewrite rule allows for the handling of addresses that are not
43697 compliant with RFCs 2821 and 2822 (for example, <quote>bang paths</quote> in batched SMTP
43698 input). Because the input is not required to be a syntactically valid address,
43699 the variables <varname>$local_part</varname> and <varname>$domain</varname> are not available during the
43700 expansion of the replacement string. The result of rewriting replaces the
43701 original address in the MAIL or RCPT command.
43702 </para>
43703 </section>
43704 <section id="SECID155">
43705 <title>Flags controlling the rewriting process</title>
43706 <para>
43707 There are four flags which control the way the rewriting process works. These
43708 take effect only when a rule is invoked, that is, when the address is of the
43709 correct type (matches the flags) and matches the pattern:
43710 </para>
43711 <itemizedlist>
43712 <listitem>
43713 <para>
43714 If the <quote>Q</quote> flag is set on a rule, the rewritten address is permitted to be an
43715 unqualified local part. It is qualified with <option>qualify_recipient</option>. In the
43716 absence of <quote>Q</quote> the rewritten address must always include a domain.
43717 </para>
43718 </listitem>
43719 <listitem>
43720 <para>
43721 If the <quote>q</quote> flag is set on a rule, no further rewriting rules are considered,
43722 even if no rewriting actually takes place because of a <quote>fail</quote> in the
43723 expansion. The <quote>q</quote> flag is not effective if the address is of the wrong type
43724 (does not match the flags) or does not match the pattern.
43725 </para>
43726 </listitem>
43727 <listitem>
43728 <para>
43729 The <quote>R</quote> flag causes a successful rewriting rule to be re-applied to the new
43730 address, up to ten times. It can be combined with the <quote>q</quote> flag, to stop
43731 rewriting once it fails to match (after at least one successful rewrite).
43732 </para>
43733 </listitem>
43734 <listitem>
43735 <para>
43736 <indexterm role="concept">
43737 <primary>rewriting</primary>
43738 <secondary>whole addresses</secondary>
43739 </indexterm>
43740 When an address in a header is rewritten, the rewriting normally applies only
43741 to the working part of the address, with any comments and RFC 2822 <quote>phrase</quote>
43742 left unchanged. For example, rewriting might change
43743 </para>
43744 <literallayout class="monospaced">
43745 From: Ford Prefect &lt;fp42@restaurant.hitch.fict.example&gt;
43746 </literallayout>
43747 <para>
43748 into
43749 </para>
43750 <literallayout class="monospaced">
43751 From: Ford Prefect &lt;prefectf@hitch.fict.example&gt;
43752 </literallayout>
43753 <para>
43754 <indexterm role="concept">
43755 <primary>RFC 2047</primary>
43756 </indexterm>
43757 Sometimes there is a need to replace the whole address item, and this can be
43758 done by adding the flag letter <quote>w</quote> to a rule. If this is set on a rule that
43759 causes an address in a header line to be rewritten, the entire address is
43760 replaced, not just the working part. The replacement must be a complete RFC
43761 2822 address, including the angle brackets if necessary. If text outside angle
43762 brackets contains a character whose value is greater than 126 or less than 32
43763 (except for tab), the text is encoded according to RFC 2047. The character set
43764 is taken from <option>headers_charset</option>, which defaults to ISO-8859-1.
43765 </para>
43766 <para>
43767 When the <quote>w</quote> flag is set on a rule that causes an envelope address to be
43768 rewritten, all but the working part of the replacement address is discarded.
43769 </para>
43770 </listitem>
43771 </itemizedlist>
43772 </section>
43773 <section id="SECID156">
43774 <title>Rewriting examples</title>
43775 <para>
43776 Here is an example of the two common rewriting paradigms:
43777 </para>
43778 <literallayout class="monospaced">
43779 *@*.hitch.fict.example  $1@hitch.fict.example
43780 *@hitch.fict.example    ${lookup{$1}dbm{/etc/realnames}\
43781                      {$value}fail}@hitch.fict.example bctfrF
43782 </literallayout>
43783 <para>
43784 Note the use of <quote>fail</quote> in the lookup expansion in the second rule, forcing
43785 the string expansion to fail if the lookup does not succeed. In this context it
43786 has the effect of leaving the original address unchanged, but Exim goes on to
43787 consider subsequent rewriting rules, if any, because the <quote>q</quote> flag is not
43788 present in that rule. An alternative to <quote>fail</quote> would be to supply <varname>$1</varname>
43789 explicitly, which would cause the rewritten address to be the same as before,
43790 at the cost of a small bit of processing. Not supplying either of these is an
43791 error, since the rewritten address would then contain no local part.
43792 </para>
43793 <para>
43794 The first example above replaces the domain with a superior, more general
43795 domain. This may not be desirable for certain local parts. If the rule
43796 </para>
43797 <literallayout class="monospaced">
43798 root@*.hitch.fict.example  *
43799 </literallayout>
43800 <para>
43801 were inserted before the first rule, rewriting would be suppressed for the
43802 local part <emphasis>root</emphasis> at any domain ending in <emphasis>hitch.fict.example</emphasis>.
43803 </para>
43804 <para>
43805 Rewriting can be made conditional on a number of tests, by making use of
43806 <varname>${if</varname> in the expansion item. For example, to apply a rewriting rule only to
43807 messages that originate outside the local host:
43808 </para>
43809 <literallayout class="monospaced">
43810 *@*.hitch.fict.example  "${if !eq {$sender_host_address}{}\
43811                          {$1@hitch.fict.example}fail}"
43812 </literallayout>
43813 <para>
43814 The replacement string is quoted in this example because it contains white
43815 space.
43816 </para>
43817 <para>
43818 <indexterm role="concept">
43819 <primary>rewriting</primary>
43820 <secondary>bang paths</secondary>
43821 </indexterm>
43822 <indexterm role="concept">
43823 <primary>bang paths</primary>
43824 <secondary>rewriting</secondary>
43825 </indexterm>
43826 Exim does not handle addresses in the form of <quote>bang paths</quote>. If it sees such
43827 an address it treats it as an unqualified local part which it qualifies with
43828 the local qualification domain (if the source of the message is local or if the
43829 remote host is permitted to send unqualified addresses). Rewriting can
43830 sometimes be used to handle simple bang paths with a fixed number of
43831 components. For example, the rule
43832 </para>
43833 <literallayout class="monospaced">
43834 \N^([^!]+)!(.*)@your.domain.example$\N   $2@$1
43835 </literallayout>
43836 <para>
43837 rewrites a two-component bang path <emphasis>host.name!user</emphasis> as the domain address
43838 <emphasis>user@host.name</emphasis>. However, there is a security implication in using this as
43839 a global rewriting rule for envelope addresses. It can provide a backdoor
43840 method for using your system as a relay, because the incoming addresses appear
43841 to be local. If the bang path addresses are received via SMTP, it is safer to
43842 use the <quote>S</quote> flag to rewrite them as they are received, so that relay checking
43843 can be done on the rewritten addresses.
43844 <indexterm role="concept" startref="IIDaddrew" class="endofrange"/>
43845 </para>
43846 </section>
43847 </chapter>
43848
43849 <chapter id="CHAPretry">
43850 <title>Retry configuration</title>
43851 <para>
43852 <indexterm role="concept" id="IIDretconf1" class="startofrange">
43853 <primary>retry</primary>
43854 <secondary>configuration, description of</secondary>
43855 </indexterm>
43856 <indexterm role="concept" id="IIDregconf2" class="startofrange">
43857 <primary>configuration file</primary>
43858 <secondary>retry section</secondary>
43859 </indexterm>
43860 The <quote>retry</quote> section of the runtime configuration file contains a list of
43861 retry rules that control how often Exim tries to deliver messages that cannot
43862 be delivered at the first attempt. If there are no retry rules (the section is
43863 empty or not present), there are no retries. In this situation, temporary
43864 errors are treated as permanent. The default configuration contains a single,
43865 general-purpose retry rule (see section <xref linkend="SECID57"/>). The <option>-brt</option> command
43866 line option can be used to test which retry rule will be used for a given
43867 address, domain and error.
43868 </para>
43869 <para>
43870 The most common cause of retries is temporary failure to deliver to a remote
43871 host because the host is down, or inaccessible because of a network problem.
43872 Exim&#x2019;s retry processing in this case is applied on a per-host (strictly, per IP
43873 address) basis, not on a per-message basis. Thus, if one message has recently
43874 been delayed, delivery of a new message to the same host is not immediately
43875 tried, but waits for the host&#x2019;s retry time to arrive. If the <option>retry_defer</option>
43876 log selector is set, the message
43877 <indexterm role="concept">
43878 <primary>retry</primary>
43879 <secondary>time not reached</secondary>
43880 </indexterm>
43881 <quote>retry time not reached</quote> is written to the main log whenever a delivery is
43882 skipped for this reason. Section <xref linkend="SECToutSMTPerr"/> contains more details of
43883 the handling of errors during remote deliveries.
43884 </para>
43885 <para>
43886 Retry processing applies to routing as well as to delivering, except as covered
43887 in the next paragraph. The retry rules do not distinguish between these
43888 actions. It is not possible, for example, to specify different behaviour for
43889 failures to route the domain <emphasis>snark.fict.example</emphasis> and failures to deliver to
43890 the host <emphasis>snark.fict.example</emphasis>. I didn&#x2019;t think anyone would ever need this
43891 added complication, so did not implement it. However, although they share the
43892 same retry rule, the actual retry times for routing and transporting a given
43893 domain are maintained independently.
43894 </para>
43895 <para>
43896 When a delivery is not part of a queue run (typically an immediate delivery on
43897 receipt of a message), the routers are always run, and local deliveries are
43898 always attempted, even if retry times are set for them. This makes for better
43899 behaviour if one particular message is causing problems (for example, causing
43900 quota overflow, or provoking an error in a filter file). If such a delivery
43901 suffers a temporary failure, the retry data is updated as normal, and
43902 subsequent delivery attempts from queue runs occur only when the retry time for
43903 the local address is reached.
43904 </para>
43905 <section id="SECID157">
43906 <title>Changing retry rules</title>
43907 <para>
43908 If you change the retry rules in your configuration, you should consider
43909 whether or not to delete the retry data that is stored in Exim&#x2019;s spool area in
43910 files with names like <filename>db/retry</filename>. Deleting any of Exim&#x2019;s hints files is
43911 always safe; that is why they are called <quote>hints</quote>.
43912 </para>
43913 <para>
43914 The hints retry data contains suggested retry times based on the previous
43915 rules. In the case of a long-running problem with a remote host, it might
43916 record the fact that the host has timed out. If your new rules increase the
43917 timeout time for such a host, you should definitely remove the old retry data
43918 and let Exim recreate it, based on the new rules. Otherwise Exim might bounce
43919 messages that it should now be retaining.
43920 </para>
43921 </section>
43922 <section id="SECID158">
43923 <title>Format of retry rules</title>
43924 <para>
43925 <indexterm role="concept">
43926 <primary>retry</primary>
43927 <secondary>rules</secondary>
43928 </indexterm>
43929 Each retry rule occupies one line and consists of three or four parts,
43930 separated by white space: a pattern, an error name, an optional list of sender
43931 addresses, and a list of retry parameters. The pattern and sender lists must be
43932 enclosed in double quotes if they contain white space. The rules are searched
43933 in order until one is found where the pattern, error name, and sender list (if
43934 present) match the failing host or address, the error that occurred, and the
43935 message&#x2019;s sender, respectively.
43936 </para>
43937 <para>
43938 The pattern is any single item that may appear in an address list (see section
43939 <xref linkend="SECTaddresslist"/>). It is in fact processed as a one-item address list,
43940 which means that it is expanded before being tested against the address that
43941 has been delayed. A negated address list item is permitted. Address
43942 list processing treats a plain domain name as if it were preceded by <quote>*@</quote>,
43943 which makes it possible for many retry rules to start with just a domain. For
43944 example,
43945 </para>
43946 <literallayout class="monospaced">
43947 lookingglass.fict.example        *  F,24h,30m;
43948 </literallayout>
43949 <para>
43950 provides a rule for any address in the <emphasis>lookingglass.fict.example</emphasis> domain,
43951 whereas
43952 </para>
43953 <literallayout class="monospaced">
43954 alice@lookingglass.fict.example  *  F,24h,30m;
43955 </literallayout>
43956 <para>
43957 applies only to temporary failures involving the local part <option>alice</option>.
43958 In practice, almost all rules start with a domain name pattern without a local
43959 part.
43960 </para>
43961 <para>
43962 <indexterm role="concept">
43963 <primary>regular expressions</primary>
43964 <secondary>in retry rules</secondary>
43965 </indexterm>
43966 <emphasis role="bold">Warning</emphasis>: If you use a regular expression in a routing rule pattern, it
43967 must match a complete address, not just a domain, because that is how regular
43968 expressions work in address lists.
43969 </para>
43970 <literallayout>
43971 <literal>^\Nxyz\d+\.abc\.example$\N        *  G,1h,10m,2</literal>     <option>Wrong</option>
43972 <literal>^\N[^@]+@xyz\d+\.abc\.example$\N  *  G,1h,10m,2</literal>     <option>Right</option>
43973 </literallayout>
43974 </section>
43975 <section id="SECID159">
43976 <title>Choosing which retry rule to use for address errors</title>
43977 <para>
43978 When Exim is looking for a retry rule after a routing attempt has failed (for
43979 example, after a DNS timeout), each line in the retry configuration is tested
43980 against the complete address only if <option>retry_use_local_part</option> is set for the
43981 router. Otherwise, only the domain is used, except when matching against a
43982 regular expression, when the local part of the address is replaced with <quote>*</quote>.
43983 A domain on its own can match a domain pattern, or a pattern that starts with
43984 <quote>*@</quote>. By default, <option>retry_use_local_part</option> is true for routers where
43985 <option>check_local_user</option> is true, and false for other routers.
43986 </para>
43987 <para>
43988 Similarly, when Exim is looking for a retry rule after a local delivery has
43989 failed (for example, after a mailbox full error), each line in the retry
43990 configuration is tested against the complete address only if
43991 <option>retry_use_local_part</option> is set for the transport (it defaults true for all
43992 local transports).
43993 </para>
43994 <para>
43995 <indexterm role="concept">
43996 <primary>4<emphasis>xx</emphasis> responses</primary>
43997 <secondary>retry rules for</secondary>
43998 </indexterm>
43999 However, when Exim is looking for a retry rule after a remote delivery attempt
44000 suffers an address error (a 4<emphasis>xx</emphasis> SMTP response for a recipient address), the
44001 whole address is always used as the key when searching the retry rules. The
44002 rule that is found is used to create a retry time for the combination of the
44003 failing address and the message&#x2019;s sender. It is the combination of sender and
44004 recipient that is delayed in subsequent queue runs until its retry time is
44005 reached. You can delay the recipient without regard to the sender by setting
44006 <option>address_retry_include_sender</option> false in the <command>smtp</command> transport but this can
44007 lead to problems with servers that regularly issue 4<emphasis>xx</emphasis> responses to RCPT
44008 commands.
44009 </para>
44010 </section>
44011 <section id="SECID160">
44012 <title>Choosing which retry rule to use for host and message errors</title>
44013 <para>
44014 For a temporary error that is not related to an individual address (for
44015 example, a connection timeout), each line in the retry configuration is checked
44016 twice. First, the name of the remote host is used as a domain name (preceded by
44017 <quote>*@</quote> when matching a regular expression). If this does not match the line,
44018 the domain from the email address is tried in a similar fashion. For example,
44019 suppose the MX records for <emphasis>a.b.c.example</emphasis> are
44020 </para>
44021 <literallayout class="monospaced">
44022 a.b.c.example  MX  5  x.y.z.example
44023                MX  6  p.q.r.example
44024                MX  7  m.n.o.example
44025 </literallayout>
44026 <para>
44027 and the retry rules are
44028 </para>
44029 <literallayout class="monospaced">
44030 p.q.r.example    *      F,24h,30m;
44031 a.b.c.example    *      F,4d,45m;
44032 </literallayout>
44033 <para>
44034 and a delivery to the host <emphasis>x.y.z.example</emphasis> suffers a connection failure. The
44035 first rule matches neither the host nor the domain, so Exim looks at the second
44036 rule. This does not match the host, but it does match the domain, so it is used
44037 to calculate the retry time for the host <emphasis>x.y.z.example</emphasis>. Meanwhile, Exim
44038 tries to deliver to <emphasis>p.q.r.example</emphasis>. If this also suffers a host error, the
44039 first retry rule is used, because it matches the host.
44040 </para>
44041 <para>
44042 In other words, temporary failures to deliver to host <emphasis>p.q.r.example</emphasis> use the
44043 first rule to determine retry times, but for all the other hosts for the domain
44044 <emphasis>a.b.c.example</emphasis>, the second rule is used. The second rule is also used if
44045 routing to <emphasis>a.b.c.example</emphasis> suffers a temporary failure.
44046 </para>
44047 <para>
44048 <emphasis role="bold">Note</emphasis>: The host name is used when matching the patterns, not its IP address.
44049 However, if a message is routed directly to an IP address without the use of a
44050 host name, for example, if a <command>manualroute</command> router contains a setting such as:
44051 </para>
44052 <literallayout class="monospaced">
44053 route_list = *.a.example  192.168.34.23
44054 </literallayout>
44055 <para>
44056 then the <quote>host name</quote> that is used when searching for a retry rule is the
44057 textual form of the IP address.
44058 </para>
44059 </section>
44060 <section id="SECID161">
44061 <title>Retry rules for specific errors</title>
44062 <para>
44063 <indexterm role="concept">
44064 <primary>retry</primary>
44065 <secondary>specific errors; specifying</secondary>
44066 </indexterm>
44067 The second field in a retry rule is the name of a particular error, or an
44068 asterisk, which matches any error. The errors that can be tested for are:
44069 </para>
44070 <variablelist>
44071 <varlistentry>
44072 <term><option>auth_failed</option></term>
44073 <listitem>
44074 <para>
44075 Authentication failed when trying to send to a host in the
44076 <option>hosts_require_auth</option> list in an <command>smtp</command> transport.
44077 </para>
44078 </listitem></varlistentry>
44079 <varlistentry>
44080 <term><option>data_4xx</option></term>
44081 <listitem>
44082 <para>
44083 A 4<emphasis>xx</emphasis> error was received for an outgoing DATA command, either immediately
44084 after the command, or after sending the message&#x2019;s data.
44085 </para>
44086 </listitem></varlistentry>
44087 <varlistentry>
44088 <term><option>mail_4xx</option></term>
44089 <listitem>
44090 <para>
44091 A 4<emphasis>xx</emphasis> error was received for an outgoing MAIL command.
44092 </para>
44093 </listitem></varlistentry>
44094 <varlistentry>
44095 <term><option>rcpt_4xx</option></term>
44096 <listitem>
44097 <para>
44098 A 4<emphasis>xx</emphasis> error was received for an outgoing RCPT command.
44099 </para>
44100 </listitem></varlistentry>
44101 </variablelist>
44102 <para>
44103 For the three 4<emphasis>xx</emphasis> errors, either the first or both of the x&#x2019;s can be given
44104 as specific digits, for example: <literal>mail_45x</literal> or <literal>rcpt_436</literal>. For example, to
44105 recognize 452 errors given to RCPT commands for addresses in a certain domain,
44106 and have retries every ten minutes with a one-hour timeout, you could set up a
44107 retry rule of this form:
44108 </para>
44109 <literallayout class="monospaced">
44110 the.domain.name  rcpt_452   F,1h,10m
44111 </literallayout>
44112 <para>
44113 These errors apply to both outgoing SMTP (the <command>smtp</command> transport) and outgoing
44114 LMTP (either the <command>lmtp</command> transport, or the <command>smtp</command> transport in LMTP mode).
44115 </para>
44116 <variablelist>
44117 <varlistentry>
44118 <term><option>lost_connection</option></term>
44119 <listitem>
44120 <para>
44121 A server unexpectedly closed the SMTP connection. There may, of course,
44122 legitimate reasons for this (host died, network died), but if it repeats a lot
44123 for the same host, it indicates something odd.
44124 </para>
44125 </listitem></varlistentry>
44126 <varlistentry>
44127 <term><option>refused_MX</option></term>
44128 <listitem>
44129 <para>
44130 A connection to a host obtained from an MX record was refused.
44131 </para>
44132 </listitem></varlistentry>
44133 <varlistentry>
44134 <term><option>refused_A</option></term>
44135 <listitem>
44136 <para>
44137 A connection to a host not obtained from an MX record was refused.
44138 </para>
44139 </listitem></varlistentry>
44140 <varlistentry>
44141 <term><option>refused</option></term>
44142 <listitem>
44143 <para>
44144 A connection was refused.
44145 </para>
44146 </listitem></varlistentry>
44147 <varlistentry>
44148 <term><option>timeout_connect_MX</option></term>
44149 <listitem>
44150 <para>
44151 A connection attempt to a host obtained from an MX record timed out.
44152 </para>
44153 </listitem></varlistentry>
44154 <varlistentry>
44155 <term><option>timeout_connect_A</option></term>
44156 <listitem>
44157 <para>
44158 A connection attempt to a host not obtained from an MX record timed out.
44159 </para>
44160 </listitem></varlistentry>
44161 <varlistentry>
44162 <term><option>timeout_connect</option></term>
44163 <listitem>
44164 <para>
44165 A connection attempt timed out.
44166 </para>
44167 </listitem></varlistentry>
44168 <varlistentry>
44169 <term><option>timeout_MX</option></term>
44170 <listitem>
44171 <para>
44172 There was a timeout while connecting or during an SMTP session with a host
44173 obtained from an MX record.
44174 </para>
44175 </listitem></varlistentry>
44176 <varlistentry>
44177 <term><option>timeout_A</option></term>
44178 <listitem>
44179 <para>
44180 There was a timeout while connecting or during an SMTP session with a host not
44181 obtained from an MX record.
44182 </para>
44183 </listitem></varlistentry>
44184 <varlistentry>
44185 <term><option>timeout</option></term>
44186 <listitem>
44187 <para>
44188 There was a timeout while connecting or during an SMTP session.
44189 </para>
44190 </listitem></varlistentry>
44191 <varlistentry>
44192 <term><option>tls_required</option></term>
44193 <listitem>
44194 <para>
44195 The server was required to use TLS (it matched <option>hosts_require_tls</option> in the
44196 <command>smtp</command> transport), but either did not offer TLS, or it responded with 4<emphasis>xx</emphasis>
44197 to STARTTLS, or there was a problem setting up the TLS connection.
44198 </para>
44199 </listitem></varlistentry>
44200 <varlistentry>
44201 <term><option>quota</option></term>
44202 <listitem>
44203 <para>
44204 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
44205 transport.
44206 </para>
44207 </listitem></varlistentry>
44208 <varlistentry>
44209 <term><option>quota_</option>&lt;<emphasis>time</emphasis>&gt;</term>
44210 <listitem>
44211 <para>
44212 <indexterm role="concept">
44213 <primary>quota</primary>
44214 <secondary>error testing in retry rule</secondary>
44215 </indexterm>
44216 <indexterm role="concept">
44217 <primary>retry</primary>
44218 <secondary>quota error testing</secondary>
44219 </indexterm>
44220 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
44221 transport, and the mailbox has not been accessed for &lt;<emphasis>time</emphasis>&gt;. For example,
44222 <emphasis>quota_4d</emphasis> applies to a quota error when the mailbox has not been accessed
44223 for four days.
44224 </para>
44225 </listitem></varlistentry>
44226 </variablelist>
44227 <para>
44228 <indexterm role="concept">
44229 <primary>mailbox</primary>
44230 <secondary>time of last read</secondary>
44231 </indexterm>
44232 The idea of <option>quota_</option>&lt;<emphasis>time</emphasis>&gt; is to make it possible to have shorter
44233 timeouts when the mailbox is full and is not being read by its owner. Ideally,
44234 it should be based on the last time that the user accessed the mailbox.
44235 However, it is not always possible to determine this. Exim uses the following
44236 heuristic rules:
44237 </para>
44238 <itemizedlist>
44239 <listitem>
44240 <para>
44241 If the mailbox is a single file, the time of last access (the <quote>atime</quote>) is
44242 used. As no new messages are being delivered (because the mailbox is over
44243 quota), Exim does not access the file, so this is the time of last user access.
44244 </para>
44245 </listitem>
44246 <listitem>
44247 <para>
44248 <indexterm role="concept">
44249 <primary>maildir format</primary>
44250 <secondary>time of last read</secondary>
44251 </indexterm>
44252 For a maildir delivery, the time of last modification of the <filename>new</filename>
44253 subdirectory is used. As the mailbox is over quota, no new files are created in
44254 the <filename>new</filename> subdirectory, because no new messages are being delivered. Any
44255 change to the <filename>new</filename> subdirectory is therefore assumed to be the result of an
44256 MUA moving a new message to the <filename>cur</filename> directory when it is first read. The
44257 time that is used is therefore the last time that the user read a new message.
44258 </para>
44259 </listitem>
44260 <listitem>
44261 <para>
44262 For other kinds of multi-file mailbox, the time of last access cannot be
44263 obtained, so a retry rule that uses this type of error field is never matched.
44264 </para>
44265 </listitem>
44266 </itemizedlist>
44267 <para>
44268 The quota errors apply both to system-enforced quotas and to Exim&#x2019;s own quota
44269 mechanism in the <command>appendfile</command> transport. The <emphasis>quota</emphasis> error also applies
44270 when a local delivery is deferred because a partition is full (the ENOSPC
44271 error).
44272 </para>
44273 </section>
44274 <section id="SECID162">
44275 <title>Retry rules for specified senders</title>
44276 <para>
44277 <indexterm role="concept">
44278 <primary>retry</primary>
44279 <secondary>rules; sender-specific</secondary>
44280 </indexterm>
44281 You can specify retry rules that apply only when the failing message has a
44282 specific sender. In particular, this can be used to define retry rules that
44283 apply only to bounce messages. The third item in a retry rule can be of this
44284 form:
44285 </para>
44286 <literallayout>
44287 <literal>senders=</literal>&lt;<emphasis>address list</emphasis>&gt;
44288 </literallayout>
44289 <para>
44290 The retry timings themselves are then the fourth item. For example:
44291 </para>
44292 <literallayout class="monospaced">
44293 *   rcpt_4xx   senders=:   F,1h,30m
44294 </literallayout>
44295 <para>
44296 matches recipient 4<emphasis>xx</emphasis> errors for bounce messages sent to any address at any
44297 host. If the address list contains white space, it must be enclosed in quotes.
44298 For example:
44299 </para>
44300 <literallayout class="monospaced">
44301 a.domain  rcpt_452  senders="xb.dom : yc.dom"  G,8h,10m,1.5
44302 </literallayout>
44303 <para>
44304 <emphasis role="bold">Warning</emphasis>: This facility can be unhelpful if it is used for host errors
44305 (which do not depend on the recipient). The reason is that the sender is used
44306 only to match the retry rule. Once the rule has been found for a host error,
44307 its contents are used to set a retry time for the host, and this will apply to
44308 all messages, not just those with specific senders.
44309 </para>
44310 <para>
44311 When testing retry rules using <option>-brt</option>, you can supply a sender using the
44312 <option>-f</option> command line option, like this:
44313 </para>
44314 <literallayout class="monospaced">
44315 exim -f "" -brt user@dom.ain
44316 </literallayout>
44317 <para>
44318 If you do not set <option>-f</option> with <option>-brt</option>, a retry rule that contains a senders
44319 list is never matched.
44320 </para>
44321 </section>
44322 <section id="SECID163">
44323 <title>Retry parameters</title>
44324 <para>
44325 <indexterm role="concept">
44326 <primary>retry</primary>
44327 <secondary>parameters in rules</secondary>
44328 </indexterm>
44329 The third (or fourth, if a senders list is present) field in a retry rule is a
44330 sequence of retry parameter sets, separated by semicolons. Each set consists of
44331 </para>
44332 <literallayout>
44333 &lt;<emphasis>letter</emphasis>&gt;,&lt;<emphasis>cutoff time</emphasis>&gt;,&lt;<emphasis>arguments</emphasis>&gt;
44334 </literallayout>
44335 <para>
44336 The letter identifies the algorithm for computing a new retry time; the cutoff
44337 time is the time beyond which this algorithm no longer applies, and the
44338 arguments vary the algorithm&#x2019;s action. The cutoff time is measured from the
44339 time that the first failure for the domain (combined with the local part if
44340 relevant) was detected, not from the time the message was received.
44341 </para>
44342 <para>
44343 <indexterm role="concept">
44344 <primary>retry</primary>
44345 <secondary>algorithms</secondary>
44346 </indexterm>
44347 <indexterm role="concept">
44348 <primary>retry</primary>
44349 <secondary>fixed intervals</secondary>
44350 </indexterm>
44351 <indexterm role="concept">
44352 <primary>retry</primary>
44353 <secondary>increasing intervals</secondary>
44354 </indexterm>
44355 <indexterm role="concept">
44356 <primary>retry</primary>
44357 <secondary>random intervals</secondary>
44358 </indexterm>
44359 The available algorithms are:
44360 </para>
44361 <itemizedlist>
44362 <listitem>
44363 <para>
44364 <emphasis>F</emphasis>: retry at fixed intervals. There is a single time parameter specifying
44365 the interval.
44366 </para>
44367 </listitem>
44368 <listitem>
44369 <para>
44370 <emphasis>G</emphasis>: retry at geometrically increasing intervals. The first argument
44371 specifies a starting value for the interval, and the second a multiplier, which
44372 is used to increase the size of the interval at each retry.
44373 </para>
44374 </listitem>
44375 <listitem>
44376 <para>
44377 <emphasis>H</emphasis>: retry at randomized intervals. The arguments are as for <emphasis>G</emphasis>. For each
44378 retry, the previous interval is multiplied by the factor in order to get a
44379 maximum for the next interval. The minimum interval is the first argument of
44380 the parameter, and an actual interval is chosen randomly between them. Such a
44381 rule has been found to be helpful in cluster configurations when all the
44382 members of the cluster restart at once, and may therefore synchronize their
44383 queue processing times.
44384 </para>
44385 </listitem>
44386 </itemizedlist>
44387 <para>
44388 When computing the next retry time, the algorithm definitions are scanned in
44389 order until one whose cutoff time has not yet passed is reached. This is then
44390 used to compute a new retry time that is later than the current time. In the
44391 case of fixed interval retries, this simply means adding the interval to the
44392 current time. For geometrically increasing intervals, retry intervals are
44393 computed from the rule&#x2019;s parameters until one that is greater than the previous
44394 interval is found. The main configuration variable
44395 <indexterm role="concept">
44396 <primary>limit</primary>
44397 <secondary>retry interval</secondary>
44398 </indexterm>
44399 <indexterm role="concept">
44400 <primary>retry</primary>
44401 <secondary>interval, maximum</secondary>
44402 </indexterm>
44403 <indexterm role="option">
44404 <primary><option>retry_interval_max</option></primary>
44405 </indexterm>
44406 <option>retry_interval_max</option> limits the maximum interval between retries. It
44407 cannot be set greater than <literal>24h</literal>, which is its default value.
44408 </para>
44409 <para>
44410 A single remote domain may have a number of hosts associated with it, and each
44411 host may have more than one IP address. Retry algorithms are selected on the
44412 basis of the domain name, but are applied to each IP address independently. If,
44413 for example, a host has two IP addresses and one is unusable, Exim will
44414 generate retry times for it and will not try to use it until its next retry
44415 time comes. Thus the good IP address is likely to be tried first most of the
44416 time.
44417 </para>
44418 <para>
44419 <indexterm role="concept">
44420 <primary>hints database</primary>
44421 <secondary>use for retrying</secondary>
44422 </indexterm>
44423 Retry times are hints rather than promises. Exim does not make any attempt to
44424 run deliveries exactly at the computed times. Instead, a queue runner process
44425 starts delivery processes for delayed messages periodically, and these attempt
44426 new deliveries only for those addresses that have passed their next retry time.
44427 If a new message arrives for a deferred address, an immediate delivery attempt
44428 occurs only if the address has passed its retry time. In the absence of new
44429 messages, the minimum time between retries is the interval between queue runner
44430 processes. There is not much point in setting retry times of five minutes if
44431 your queue runners happen only once an hour, unless there are a significant
44432 number of incoming messages (which might be the case on a system that is
44433 sending everything to a smart host, for example).
44434 </para>
44435 <para>
44436 The data in the retry hints database can be inspected by using the
44437 <emphasis>exim_dumpdb</emphasis> or <emphasis>exim_fixdb</emphasis> utility programs (see chapter
44438 <xref linkend="CHAPutils"/>). The latter utility can also be used to change the data. The
44439 <emphasis>exinext</emphasis> utility script can be used to find out what the next retry times
44440 are for the hosts associated with a particular mail domain, and also for local
44441 deliveries that have been deferred.
44442 </para>
44443 </section>
44444 <section id="SECID164">
44445 <title>Retry rule examples</title>
44446 <para>
44447 Here are some example retry rules:
44448 </para>
44449 <literallayout class="monospaced">
44450 alice@wonderland.fict.example quota_5d  F,7d,3h
44451 wonderland.fict.example       quota_5d
44452 wonderland.fict.example       *         F,1h,15m; G,2d,1h,2;
44453 lookingglass.fict.example     *         F,24h,30m;
44454 *                 refused_A   F,2h,20m;
44455 *                 *           F,2h,15m; G,16h,1h,1.5; F,5d,8h
44456 </literallayout>
44457 <para>
44458 The first rule sets up special handling for mail to
44459 <emphasis>alice@wonderland.fict.example</emphasis> when there is an over-quota error and the
44460 mailbox has not been read for at least 5 days. Retries continue every three
44461 hours for 7 days. The second rule handles over-quota errors for all other local
44462 parts at <emphasis>wonderland.fict.example</emphasis>; the absence of a local part has the same
44463 effect as supplying <quote>*@</quote>. As no retry algorithms are supplied, messages that
44464 fail are bounced immediately if the mailbox has not been read for at least 5
44465 days.
44466 </para>
44467 <para>
44468 The third rule handles all other errors at <emphasis>wonderland.fict.example</emphasis>; retries
44469 happen every 15 minutes for an hour, then with geometrically increasing
44470 intervals until two days have passed since a delivery first failed. After the
44471 first hour there is a delay of one hour, then two hours, then four hours, and
44472 so on (this is a rather extreme example).
44473 </para>
44474 <para>
44475 The fourth rule controls retries for the domain <emphasis>lookingglass.fict.example</emphasis>.
44476 They happen every 30 minutes for 24 hours only. The remaining two rules handle
44477 all other domains, with special action for connection refusal from hosts that
44478 were not obtained from an MX record.
44479 </para>
44480 <para>
44481 The final rule in a retry configuration should always have asterisks in the
44482 first two fields so as to provide a general catch-all for any addresses that do
44483 not have their own special handling. This example tries every 15 minutes for 2
44484 hours, then with intervals starting at one hour and increasing by a factor of
44485 1.5 up to 16 hours, then every 8 hours up to 5 days.
44486 </para>
44487 </section>
44488 <section id="SECID165">
44489 <title>Timeout of retry data</title>
44490 <para>
44491 <indexterm role="concept">
44492 <primary>timeout</primary>
44493 <secondary>of retry data</secondary>
44494 </indexterm>
44495 <indexterm role="option">
44496 <primary><option>retry_data_expire</option></primary>
44497 </indexterm>
44498 <indexterm role="concept">
44499 <primary>hints database</primary>
44500 <secondary>data expiry</secondary>
44501 </indexterm>
44502 <indexterm role="concept">
44503 <primary>retry</primary>
44504 <secondary>timeout of data</secondary>
44505 </indexterm>
44506 Exim timestamps the data that it writes to its retry hints database. When it
44507 consults the data during a delivery it ignores any that is older than the value
44508 set in <option>retry_data_expire</option> (default 7 days). If, for example, a host hasn&#x2019;t
44509 been tried for 7 days, Exim will try to deliver to it immediately a message
44510 arrives, and if that fails, it will calculate a retry time as if it were
44511 failing for the first time.
44512 </para>
44513 <para>
44514 This improves the behaviour for messages routed to rarely-used hosts such as MX
44515 backups. If such a host was down at one time, and happens to be down again when
44516 Exim tries a month later, using the old retry data would imply that it had been
44517 down all the time, which is not a justified assumption.
44518 </para>
44519 <para>
44520 If a host really is permanently dead, this behaviour causes a burst of retries
44521 every now and again, but only if messages routed to it are rare. If there is a
44522 message at least once every 7 days the retry data never expires.
44523 </para>
44524 </section>
44525 <section id="SECID166">
44526 <title>Long-term failures</title>
44527 <para>
44528 <indexterm role="concept">
44529 <primary>delivery failure, long-term</primary>
44530 </indexterm>
44531 <indexterm role="concept">
44532 <primary>retry</primary>
44533 <secondary>after long-term failure</secondary>
44534 </indexterm>
44535 Special processing happens when an email address has been failing for so long
44536 that the cutoff time for the last algorithm is reached. For example, using the
44537 default retry rule:
44538 </para>
44539 <literallayout class="monospaced">
44540 * * F,2h,15m; G,16h,1h,1.5; F,4d,6h
44541 </literallayout>
44542 <para>
44543 the cutoff time is four days. Reaching the retry cutoff is independent of how
44544 long any specific message has been failing; it is the length of continuous
44545 failure for the recipient address that counts.
44546 </para>
44547 <para>
44548 When the cutoff time is reached for a local delivery, or for all the IP
44549 addresses associated with a remote delivery, a subsequent delivery failure
44550 causes Exim to give up on the address, and a bounce message is generated.
44551 In order to cater for new messages that use the failing address, a next retry
44552 time is still computed from the final algorithm, and is used as follows:
44553 </para>
44554 <para>
44555 For local deliveries, one delivery attempt is always made for any subsequent
44556 messages. If this delivery fails, the address fails immediately. The
44557 post-cutoff retry time is not used.
44558 </para>
44559 <para>
44560 If the delivery is remote, there are two possibilities, controlled by the
44561 <indexterm role="option">
44562 <primary><option>delay_after_cutoff</option></primary>
44563 </indexterm>
44564 <option>delay_after_cutoff</option> option of the <command>smtp</command> transport. The option is true by
44565 default. Until the post-cutoff retry time for one of the IP addresses is
44566 reached, the failing email address is bounced immediately, without a delivery
44567 attempt taking place. After that time, one new delivery attempt is made to
44568 those IP addresses that are past their retry times, and if that still fails,
44569 the address is bounced and new retry times are computed.
44570 </para>
44571 <para>
44572 In other words, when all the hosts for a given email address have been failing
44573 for a long time, Exim bounces rather then defers until one of the hosts&#x2019; retry
44574 times is reached. Then it tries once, and bounces if that attempt fails. This
44575 behaviour ensures that few resources are wasted in repeatedly trying to deliver
44576 to a broken destination, but if the host does recover, Exim will eventually
44577 notice.
44578 </para>
44579 <para>
44580 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
44581 addresses are past their final cutoff time, Exim tries to deliver to those IP
44582 addresses that have not been tried since the message arrived. If there are
44583 no suitable IP addresses, or if they all fail, the address is bounced. In other
44584 words, it does not delay when a new message arrives, but tries the expired
44585 addresses immediately, unless they have been tried since the message arrived.
44586 If there is a continuous stream of messages for the failing domains, setting
44587 <option>delay_after_cutoff</option> false means that there will be many more attempts to
44588 deliver to permanently failing IP addresses than when <option>delay_after_cutoff</option> is
44589 true.
44590 </para>
44591 </section>
44592 <section id="SECID167">
44593 <title>Deliveries that work intermittently</title>
44594 <para>
44595 <indexterm role="concept">
44596 <primary>retry</primary>
44597 <secondary>intermittently working deliveries</secondary>
44598 </indexterm>
44599 Some additional logic is needed to cope with cases where a host is
44600 intermittently available, or when a message has some attribute that prevents
44601 its delivery when others to the same address get through. In this situation,
44602 because some messages are successfully delivered, the <quote>retry clock</quote> for the
44603 host or address keeps getting reset by the successful deliveries, and so
44604 failing messages remain on the queue for ever because the cutoff time is never
44605 reached.
44606 </para>
44607 <para>
44608 Two exceptional actions are applied to prevent this happening. The first
44609 applies to errors that are related to a message rather than a remote host.
44610 Section <xref linkend="SECToutSMTPerr"/> has a discussion of the different kinds of error;
44611 examples of message-related errors are 4<emphasis>xx</emphasis> responses to MAIL or DATA
44612 commands, and quota failures. For this type of error, if a message&#x2019;s arrival
44613 time is earlier than the <quote>first failed</quote> time for the error, the earlier time
44614 is used when scanning the retry rules to decide when to try next and when to
44615 time out the address.
44616 </para>
44617 <para>
44618 The exceptional second action applies in all cases. If a message has been on
44619 the queue for longer than the cutoff time of any applicable retry rule for a
44620 given address, a delivery is attempted for that address, even if it is not yet
44621 time, and if this delivery fails, the address is timed out. A new retry time is
44622 not computed in this case, so that other messages for the same address are
44623 considered immediately.
44624 <indexterm role="concept" startref="IIDretconf1" class="endofrange"/>
44625 <indexterm role="concept" startref="IIDregconf2" class="endofrange"/>
44626 </para>
44627 </section>
44628 </chapter>
44629
44630 <chapter id="CHAPSMTPAUTH">
44631 <title>SMTP authentication</title>
44632 <para>
44633 <indexterm role="concept" id="IIDauthconf1" class="startofrange">
44634 <primary>SMTP</primary>
44635 <secondary>authentication configuration</secondary>
44636 </indexterm>
44637 <indexterm role="concept" id="IIDauthconf2" class="startofrange">
44638 <primary>authentication</primary>
44639 </indexterm>
44640 The <quote>authenticators</quote> section of Exim&#x2019;s run time configuration is concerned
44641 with SMTP authentication. This facility is an extension to the SMTP protocol,
44642 described in RFC 2554, which allows a client SMTP host to authenticate itself
44643 to a server. This is a common way for a server to recognize clients that are
44644 permitted to use it as a relay. SMTP authentication is not of relevance to the
44645 transfer of mail between servers that have no managerial connection with each
44646 other.
44647 </para>
44648 <para>
44649 <indexterm role="concept">
44650 <primary>AUTH</primary>
44651 <secondary>description of</secondary>
44652 </indexterm>
44653 Very briefly, the way SMTP authentication works is as follows:
44654 </para>
44655 <itemizedlist>
44656 <listitem>
44657 <para>
44658 The server advertises a number of authentication <emphasis>mechanisms</emphasis> in response to
44659 the client&#x2019;s EHLO command.
44660 </para>
44661 </listitem>
44662 <listitem>
44663 <para>
44664 The client issues an AUTH command, naming a specific mechanism. The command
44665 may, optionally, contain some authentication data.
44666 </para>
44667 </listitem>
44668 <listitem>
44669 <para>
44670 The server may issue one or more <emphasis>challenges</emphasis>, to which the client must send
44671 appropriate responses. In simple authentication mechanisms, the challenges are
44672 just prompts for user names and passwords. The server does not have to issue
44673 any challenges &ndash; in some mechanisms the relevant data may all be transmitted
44674 with the AUTH command.
44675 </para>
44676 </listitem>
44677 <listitem>
44678 <para>
44679 The server either accepts or denies authentication.
44680 </para>
44681 </listitem>
44682 <listitem>
44683 <para>
44684 If authentication succeeds, the client may optionally make use of the AUTH
44685 option on the MAIL command to pass an authenticated sender in subsequent
44686 mail transactions. Authentication lasts for the remainder of the SMTP
44687 connection.
44688 </para>
44689 </listitem>
44690 <listitem>
44691 <para>
44692 If authentication fails, the client may give up, or it may try a different
44693 authentication mechanism, or it may try transferring mail over the
44694 unauthenticated connection.
44695 </para>
44696 </listitem>
44697 </itemizedlist>
44698 <para>
44699 If you are setting up a client, and want to know which authentication
44700 mechanisms the server supports, you can use Telnet to connect to port 25 (the
44701 SMTP port) on the server, and issue an EHLO command. The response to this
44702 includes the list of supported mechanisms. For example:
44703 </para>
44704 <literallayout>
44705 <literal>$ </literal><emphasis role="bold"><literal>telnet server.example 25</literal></emphasis>
44706 <literal>Trying 192.168.34.25...</literal>
44707 <literal>Connected to server.example.</literal>
44708 <literal>Escape character is &#x0027;^]&#x0027;.</literal>
44709 <literal>220 server.example ESMTP Exim 4.20 ...</literal>
44710 <emphasis role="bold"><literal>ehlo client.example</literal></emphasis>
44711 <literal>250-server.example Hello client.example [10.8.4.5]</literal>
44712 <literal>250-SIZE 52428800</literal>
44713 <literal>250-PIPELINING</literal>
44714 <literal>250-AUTH PLAIN</literal>
44715 <literal>250 HELP</literal>
44716 </literallayout>
44717 <para>
44718 The second-last line of this example output shows that the server supports
44719 authentication using the PLAIN mechanism. In Exim, the different authentication
44720 mechanisms are configured by specifying <emphasis>authenticator</emphasis> drivers. Like the
44721 routers and transports, which authenticators are included in the binary is
44722 controlled by build-time definitions. The following are currently available,
44723 included by setting
44724 </para>
44725 <literallayout class="monospaced">
44726 AUTH_CRAM_MD5=yes
44727 AUTH_CYRUS_SASL=yes
44728 AUTH_PLAINTEXT=yes
44729 AUTH_SPA=yes
44730 </literallayout>
44731 <para>
44732 in <filename>Local/Makefile</filename>, respectively. The first of these supports the CRAM-MD5
44733 authentication mechanism (RFC 2195), and the second provides an interface to
44734 the Cyrus SASL authentication library. The third can be configured to support
44735 the PLAIN authentication mechanism (RFC 2595) or the LOGIN mechanism, which is
44736 not formally documented, but used by several MUAs. The fourth authenticator
44737 supports Microsoft&#x2019;s <emphasis>Secure Password Authentication</emphasis> mechanism.
44738 </para>
44739 <para>
44740 The authenticators are configured using the same syntax as other drivers (see
44741 section <xref linkend="SECTfordricon"/>). If no authenticators are required, no
44742 authentication section need be present in the configuration file. Each
44743 authenticator can in principle have both server and client functions. When Exim
44744 is receiving SMTP mail, it is acting as a server; when it is sending out
44745 messages over SMTP, it is acting as a client. Authenticator configuration
44746 options are provided for use in both these circumstances.
44747 </para>
44748 <para>
44749 To make it clear which options apply to which situation, the prefixes
44750 <option>server_</option> and <option>client_</option> are used on option names that are specific to
44751 either the server or the client function, respectively. Server and client
44752 functions are disabled if none of their options are set. If an authenticator is
44753 to be used for both server and client functions, a single definition, using
44754 both sets of options, is required. For example:
44755 </para>
44756 <literallayout class="monospaced">
44757 cram:
44758   driver = cram_md5
44759   public_name = CRAM-MD5
44760   server_secret = ${if eq{$auth1}{ph10}{secret1}fail}
44761   client_name = ph10
44762   client_secret = secret2
44763 </literallayout>
44764 <para>
44765 The <option>server_</option> option is used when Exim is acting as a server, and the
44766 <option>client_</option> options when it is acting as a client.
44767 </para>
44768 <para>
44769 Descriptions of the individual authenticators are given in subsequent chapters.
44770 The remainder of this chapter covers the generic options for the
44771 authenticators, followed by general discussion of the way authentication works
44772 in Exim.
44773 </para>
44774 <section id="SECID168">
44775 <title>Generic options for authenticators</title>
44776 <para>
44777 <indexterm role="concept">
44778 <primary>authentication</primary>
44779 <secondary>generic options</secondary>
44780 </indexterm>
44781 <indexterm role="concept">
44782 <primary>options</primary>
44783 <secondary>generic; for authenticators</secondary>
44784 </indexterm>
44785 </para>
44786 <para>
44787 <indexterm role="option">
44788 <primary><option>client_condition</option></primary>
44789 </indexterm>
44790 </para>
44791 <informaltable frame="all">
44792 <tgroup cols="4" colsep="0" rowsep="0">
44793 <colspec colwidth="8*" align="left"/>
44794 <colspec colwidth="6*" align="center"/>
44795 <colspec colwidth="6*" align="center"/>
44796 <colspec colwidth="6*" align="right"/>
44797 <tbody>
44798 <row>
44799 <entry><option>client_condition</option></entry>
44800 <entry>Use: <emphasis>authenticators</emphasis></entry>
44801 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44802 <entry>Default: <emphasis>unset</emphasis></entry>
44803 </row>
44804 </tbody>
44805 </tgroup>
44806 </informaltable>
44807 <para>
44808 When Exim is authenticating as a client, it skips any authenticator whose
44809 <option>client_condition</option> expansion yields <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>. This can be
44810 used, for example, to skip plain text authenticators when the connection is not
44811 encrypted by a setting such as:
44812 </para>
44813 <literallayout class="monospaced">
44814 client_condition = ${if !eq{$tls_cipher}{}}
44815 </literallayout>
44816 <para>
44817 (Older documentation incorrectly states that <varname>$tls_cipher</varname> contains the cipher
44818 used for incoming messages. In fact, during SMTP delivery, it contains the
44819 cipher used for the delivery.)
44820 </para>
44821 <para>
44822 <indexterm role="option">
44823 <primary><option>driver</option></primary>
44824 </indexterm>
44825 </para>
44826 <informaltable frame="all">
44827 <tgroup cols="4" colsep="0" rowsep="0">
44828 <colspec colwidth="8*" align="left"/>
44829 <colspec colwidth="6*" align="center"/>
44830 <colspec colwidth="6*" align="center"/>
44831 <colspec colwidth="6*" align="right"/>
44832 <tbody>
44833 <row>
44834 <entry><option>driver</option></entry>
44835 <entry>Use: <emphasis>authenticators</emphasis></entry>
44836 <entry>Type: <emphasis>string</emphasis></entry>
44837 <entry>Default: <emphasis>unset</emphasis></entry>
44838 </row>
44839 </tbody>
44840 </tgroup>
44841 </informaltable>
44842 <para>
44843 This option must always be set. It specifies which of the available
44844 authenticators is to be used.
44845 </para>
44846 <para>
44847 <indexterm role="option">
44848 <primary><option>public_name</option></primary>
44849 </indexterm>
44850 </para>
44851 <informaltable frame="all">
44852 <tgroup cols="4" colsep="0" rowsep="0">
44853 <colspec colwidth="8*" align="left"/>
44854 <colspec colwidth="6*" align="center"/>
44855 <colspec colwidth="6*" align="center"/>
44856 <colspec colwidth="6*" align="right"/>
44857 <tbody>
44858 <row>
44859 <entry><option>public_name</option></entry>
44860 <entry>Use: <emphasis>authenticators</emphasis></entry>
44861 <entry>Type: <emphasis>string</emphasis></entry>
44862 <entry>Default: <emphasis>unset</emphasis></entry>
44863 </row>
44864 </tbody>
44865 </tgroup>
44866 </informaltable>
44867 <para>
44868 This option specifies the name of the authentication mechanism that the driver
44869 implements, and by which it is known to the outside world. These names should
44870 contain only upper case letters, digits, underscores, and hyphens (RFC 2222),
44871 but Exim in fact matches them caselessly. If <option>public_name</option> is not set, it
44872 defaults to the driver&#x2019;s instance name.
44873 </para>
44874 <para>
44875 <indexterm role="option">
44876 <primary><option>server_advertise_condition</option></primary>
44877 </indexterm>
44878 </para>
44879 <informaltable frame="all">
44880 <tgroup cols="4" colsep="0" rowsep="0">
44881 <colspec colwidth="8*" align="left"/>
44882 <colspec colwidth="6*" align="center"/>
44883 <colspec colwidth="6*" align="center"/>
44884 <colspec colwidth="6*" align="right"/>
44885 <tbody>
44886 <row>
44887 <entry><option>server_advertise_condition</option></entry>
44888 <entry>Use: <emphasis>authenticators</emphasis></entry>
44889 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44890 <entry>Default: <emphasis>unset</emphasis></entry>
44891 </row>
44892 </tbody>
44893 </tgroup>
44894 </informaltable>
44895 <para>
44896 When a server is about to advertise an authentication mechanism, the condition
44897 is expanded. If it yields the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the
44898 mechanism is not advertised.
44899 If the expansion fails, the mechanism is not advertised. If the failure was not
44900 forced, and was not caused by a lookup defer, the incident is logged.
44901 See section <xref linkend="SECTauthexiser"/> below for further discussion.
44902 </para>
44903 <para>
44904 <indexterm role="option">
44905 <primary><option>server_condition</option></primary>
44906 </indexterm>
44907 </para>
44908 <informaltable frame="all">
44909 <tgroup cols="4" colsep="0" rowsep="0">
44910 <colspec colwidth="8*" align="left"/>
44911 <colspec colwidth="6*" align="center"/>
44912 <colspec colwidth="6*" align="center"/>
44913 <colspec colwidth="6*" align="right"/>
44914 <tbody>
44915 <row>
44916 <entry><option>server_condition</option></entry>
44917 <entry>Use: <emphasis>authenticators</emphasis></entry>
44918 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44919 <entry>Default: <emphasis>unset</emphasis></entry>
44920 </row>
44921 </tbody>
44922 </tgroup>
44923 </informaltable>
44924 <para>
44925 This option must be set for a <option>plaintext</option> server authenticator, where it
44926 is used directly to control authentication. See section <xref linkend="SECTplainserver"/>
44927 for details.
44928 </para>
44929 <para>
44930 For the other authenticators, <option>server_condition</option> can be used as an additional
44931 authentication or authorization mechanism that is applied after the other
44932 authenticator conditions succeed. If it is set, it is expanded when the
44933 authenticator would otherwise return a success code. If the expansion is forced
44934 to fail, authentication fails. Any other expansion failure causes a temporary
44935 error code to be returned. If the result of a successful expansion is an empty
44936 string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
44937 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds. For any
44938 other result, a temporary error code is returned, with the expanded string as
44939 the error text.
44940 </para>
44941 <para>
44942 <indexterm role="option">
44943 <primary><option>server_debug_print</option></primary>
44944 </indexterm>
44945 </para>
44946 <informaltable frame="all">
44947 <tgroup cols="4" colsep="0" rowsep="0">
44948 <colspec colwidth="8*" align="left"/>
44949 <colspec colwidth="6*" align="center"/>
44950 <colspec colwidth="6*" align="center"/>
44951 <colspec colwidth="6*" align="right"/>
44952 <tbody>
44953 <row>
44954 <entry><option>server_debug_print</option></entry>
44955 <entry>Use: <emphasis>authenticators</emphasis></entry>
44956 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44957 <entry>Default: <emphasis>unset</emphasis></entry>
44958 </row>
44959 </tbody>
44960 </tgroup>
44961 </informaltable>
44962 <para>
44963 If this option is set and authentication debugging is enabled (see the <option>-d</option>
44964 command line option), the string is expanded and included in the debugging
44965 output when the authenticator is run as a server. This can help with checking
44966 out the values of variables.
44967 If expansion of the string fails, the error message is written to the debugging
44968 output, and Exim carries on processing.
44969 </para>
44970 <para>
44971 <indexterm role="option">
44972 <primary><option>server_set_id</option></primary>
44973 </indexterm>
44974 </para>
44975 <informaltable frame="all">
44976 <tgroup cols="4" colsep="0" rowsep="0">
44977 <colspec colwidth="8*" align="left"/>
44978 <colspec colwidth="6*" align="center"/>
44979 <colspec colwidth="6*" align="center"/>
44980 <colspec colwidth="6*" align="right"/>
44981 <tbody>
44982 <row>
44983 <entry><option>server_set_id</option></entry>
44984 <entry>Use: <emphasis>authenticators</emphasis></entry>
44985 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44986 <entry>Default: <emphasis>unset</emphasis></entry>
44987 </row>
44988 </tbody>
44989 </tgroup>
44990 </informaltable>
44991 <para>
44992 <indexterm role="variable">
44993 <primary><varname>$authenticated_id</varname></primary>
44994 </indexterm>
44995 When an Exim server successfully authenticates a client, this string is
44996 expanded using data from the authentication, and preserved for any incoming
44997 messages in the variable <varname>$authenticated_id</varname>. It is also included in the log
44998 lines for incoming messages. For example, a user/password authenticator
44999 configuration might preserve the user name that was used to authenticate, and
45000 refer to it subsequently during delivery of the message.
45001 If expansion fails, the option is ignored.
45002 </para>
45003 <para>
45004 <indexterm role="option">
45005 <primary><option>server_mail_auth_condition</option></primary>
45006 </indexterm>
45007 </para>
45008 <informaltable frame="all">
45009 <tgroup cols="4" colsep="0" rowsep="0">
45010 <colspec colwidth="8*" align="left"/>
45011 <colspec colwidth="6*" align="center"/>
45012 <colspec colwidth="6*" align="center"/>
45013 <colspec colwidth="6*" align="right"/>
45014 <tbody>
45015 <row>
45016 <entry><option>server_mail_auth_condition</option></entry>
45017 <entry>Use: <emphasis>authenticators</emphasis></entry>
45018 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45019 <entry>Default: <emphasis>unset</emphasis></entry>
45020 </row>
45021 </tbody>
45022 </tgroup>
45023 </informaltable>
45024 <para>
45025 This option allows a server to discard authenticated sender addresses supplied
45026 as part of MAIL commands in SMTP connections that are authenticated by the
45027 driver on which <option>server_mail_auth_condition</option> is set. The option is not used
45028 as part of the authentication process; instead its (unexpanded) value is
45029 remembered for later use.
45030 How it is used is described in the following section.
45031 </para>
45032 </section>
45033 <section id="SECTauthparamail">
45034 <title>The AUTH parameter on MAIL commands</title>
45035 <para>
45036 <indexterm role="concept">
45037 <primary>authentication</primary>
45038 <secondary>sender; authenticated</secondary>
45039 </indexterm>
45040 <indexterm role="concept">
45041 <primary>AUTH</primary>
45042 <secondary>on MAIL command</secondary>
45043 </indexterm>
45044 When a client supplied an AUTH= item on a MAIL command, Exim applies
45045 the following checks before accepting it as the authenticated sender of the
45046 message:
45047 </para>
45048 <itemizedlist>
45049 <listitem>
45050 <para>
45051 If the connection is not using extended SMTP (that is, HELO was used rather
45052 than EHLO), the use of AUTH= is a syntax error.
45053 </para>
45054 </listitem>
45055 <listitem>
45056 <para>
45057 If the value of the AUTH= parameter is <quote>&lt;&gt;</quote>, it is ignored.
45058 </para>
45059 </listitem>
45060 <listitem>
45061 <para>
45062 <indexterm role="variable">
45063 <primary><varname>$authenticated_sender</varname></primary>
45064 </indexterm>
45065 If <option>acl_smtp_mailauth</option> is defined, the ACL it specifies is run. While it is
45066 running, the value of <varname>$authenticated_sender</varname> is set to the value obtained
45067 from the AUTH= parameter. If the ACL does not yield <quote>accept</quote>, the value of
45068 <varname>$authenticated_sender</varname> is deleted. The <option>acl_smtp_mailauth</option> ACL may not
45069 return <quote>drop</quote> or <quote>discard</quote>. If it defers, a temporary error code (451) is
45070 given for the MAIL command.
45071 </para>
45072 </listitem>
45073 <listitem>
45074 <para>
45075 If <option>acl_smtp_mailauth</option> is not defined, the value of the AUTH= parameter
45076 is accepted and placed in <varname>$authenticated_sender</varname> only if the client has
45077 authenticated.
45078 </para>
45079 </listitem>
45080 <listitem>
45081 <para>
45082 If the AUTH= value was accepted by either of the two previous rules, and
45083 the client has authenticated, and the authenticator has a setting for the
45084 <option>server_mail_auth_condition</option>, the condition is checked at this point. The
45085 valued that was saved from the authenticator is expanded. If the expansion
45086 fails, or yields an empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the value of
45087 <varname>$authenticated_sender</varname> is deleted. If the expansion yields any other value,
45088 the value of <varname>$authenticated_sender</varname> is retained and passed on with the
45089 message.
45090 </para>
45091 </listitem>
45092 </itemizedlist>
45093 <para>
45094 When <varname>$authenticated_sender</varname> is set for a message, it is passed on to other
45095 hosts to which Exim authenticates as a client. Do not confuse this value with
45096 <varname>$authenticated_id</varname>, which is a string obtained from the authentication
45097 process, and which is not usually a complete email address.
45098 </para>
45099 <para>
45100 <indexterm role="variable">
45101 <primary><varname>$sender_address</varname></primary>
45102 </indexterm>
45103 Whenever an AUTH= value is ignored, the incident is logged. The ACL for
45104 MAIL, if defined, is run after AUTH= is accepted or ignored. It can
45105 therefore make use of <varname>$authenticated_sender</varname>. The converse is not true: the
45106 value of <varname>$sender_address</varname> is not yet set up when the <option>acl_smtp_mailauth</option>
45107 ACL is run.
45108 </para>
45109 </section>
45110 <section id="SECTauthexiser">
45111 <title>Authentication on an Exim server</title>
45112 <para>
45113 <indexterm role="concept">
45114 <primary>authentication</primary>
45115 <secondary>on an Exim server</secondary>
45116 </indexterm>
45117 When Exim receives an EHLO command, it advertises the public names of those
45118 authenticators that are configured as servers, subject to the following
45119 conditions:
45120 </para>
45121 <itemizedlist>
45122 <listitem>
45123 <para>
45124 The client host must match <option>auth_advertise_hosts</option> (default *).
45125 </para>
45126 </listitem>
45127 <listitem>
45128 <para>
45129 It the <option>server_advertise_condition</option> option is set, its expansion must not
45130 yield the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>.
45131 </para>
45132 </listitem>
45133 </itemizedlist>
45134 <para>
45135 The order in which the authenticators are defined controls the order in which
45136 the mechanisms are advertised.
45137 </para>
45138 <para>
45139 Some mail clients (for example, some versions of Netscape) require the user to
45140 provide a name and password for authentication whenever AUTH is advertised,
45141 even though authentication may not in fact be needed (for example, Exim may be
45142 set up to allow unconditional relaying from the client by an IP address check).
45143 You can make such clients more friendly by not advertising AUTH to them.
45144 For example, if clients on the 10.9.8.0/24 network are permitted (by the ACL
45145 that runs for RCPT) to relay without authentication, you should set
45146 </para>
45147 <literallayout class="monospaced">
45148 auth_advertise_hosts = ! 10.9.8.0/24
45149 </literallayout>
45150 <para>
45151 so that no authentication mechanisms are advertised to them.
45152 </para>
45153 <para>
45154 The <option>server_advertise_condition</option> controls the advertisement of individual
45155 authentication mechanisms. For example, it can be used to restrict the
45156 advertisement of a particular mechanism to encrypted connections, by a setting
45157 such as:
45158 </para>
45159 <literallayout class="monospaced">
45160 server_advertise_condition = ${if eq{$tls_cipher}{}{no}{yes}}
45161 </literallayout>
45162 <para>
45163 <indexterm role="variable">
45164 <primary><varname>$tls_cipher</varname></primary>
45165 </indexterm>
45166 If the session is encrypted, <varname>$tls_cipher</varname> is not empty, and so the expansion
45167 yields <quote>yes</quote>, which allows the advertisement to happen.
45168 </para>
45169 <para>
45170 When an Exim server receives an AUTH command from a client, it rejects it
45171 immediately if AUTH was not advertised in response to an earlier EHLO
45172 command. This is the case if
45173 </para>
45174 <itemizedlist>
45175 <listitem>
45176 <para>
45177 The client host does not match <option>auth_advertise_hosts</option>; or
45178 </para>
45179 </listitem>
45180 <listitem>
45181 <para>
45182 No authenticators are configured with server options; or
45183 </para>
45184 </listitem>
45185 <listitem>
45186 <para>
45187 Expansion of <option>server_advertise_condition</option> blocked the advertising of all the
45188 server authenticators.
45189 </para>
45190 </listitem>
45191 </itemizedlist>
45192 <para>
45193 Otherwise, Exim runs the ACL specified by <option>acl_smtp_auth</option> in order
45194 to decide whether to accept the command. If <option>acl_smtp_auth</option> is not set,
45195 AUTH is accepted from any client host.
45196 </para>
45197 <para>
45198 If AUTH is not rejected by the ACL, Exim searches its configuration for a
45199 server authentication mechanism that was advertised in response to EHLO and
45200 that matches the one named in the AUTH command. If it finds one, it runs
45201 the appropriate authentication protocol, and authentication either succeeds or
45202 fails. If there is no matching advertised mechanism, the AUTH command is
45203 rejected with a 504 error.
45204 </para>
45205 <para>
45206 <indexterm role="variable">
45207 <primary><varname>$received_protocol</varname></primary>
45208 </indexterm>
45209 <indexterm role="variable">
45210 <primary><varname>$sender_host_authenticated</varname></primary>
45211 </indexterm>
45212 When a message is received from an authenticated host, the value of
45213 <varname>$received_protocol</varname> is set to <quote>esmtpa</quote> or <quote>esmtpsa</quote> instead of <quote>esmtp</quote>
45214 or <quote>esmtps</quote>, and <varname>$sender_host_authenticated</varname> contains the name (not the
45215 public name) of the authenticator driver that successfully authenticated the
45216 client from which the message was received. This variable is empty if there was
45217 no successful authentication.
45218 </para>
45219 </section>
45220 <section id="SECID169">
45221 <title>Testing server authentication</title>
45222 <para>
45223 <indexterm role="concept">
45224 <primary>authentication</primary>
45225 <secondary>testing a server</secondary>
45226 </indexterm>
45227 <indexterm role="concept">
45228 <primary>AUTH</primary>
45229 <secondary>testing a server</secondary>
45230 </indexterm>
45231 <indexterm role="concept">
45232 <primary>base64 encoding</primary>
45233 <secondary>creating authentication test data</secondary>
45234 </indexterm>
45235 Exim&#x2019;s <option>-bh</option> option can be useful for testing server authentication
45236 configurations. The data for the AUTH command has to be sent using base64
45237 encoding. A quick way to produce such data for testing is the following Perl
45238 script:
45239 </para>
45240 <literallayout class="monospaced">
45241 use MIME::Base64;
45242 printf ("%s", encode_base64(eval "\"$ARGV[0]\""));
45243 </literallayout>
45244 <para>
45245 <indexterm role="concept">
45246 <primary>binary zero</primary>
45247 <secondary>in authentication data</secondary>
45248 </indexterm>
45249 This interprets its argument as a Perl string, and then encodes it. The
45250 interpretation as a Perl string allows binary zeros, which are required for
45251 some kinds of authentication, to be included in the data. For example, a
45252 command line to run this script on such data might be
45253 </para>
45254 <literallayout class="monospaced">
45255 encode '\0user\0password'
45256 </literallayout>
45257 <para>
45258 Note the use of single quotes to prevent the shell interpreting the
45259 backslashes, so that they can be interpreted by Perl to specify characters
45260 whose code value is zero.
45261 </para>
45262 <para>
45263 <emphasis role="bold">Warning 1</emphasis>: If either of the user or password strings starts with an octal
45264 digit, you must use three zeros instead of one after the leading backslash. If
45265 you do not, the octal digit that starts your string will be incorrectly
45266 interpreted as part of the code for the first character.
45267 </para>
45268 <para>
45269 <emphasis role="bold">Warning 2</emphasis>: If there are characters in the strings that Perl interprets
45270 specially, you must use a Perl escape to prevent them being misinterpreted. For
45271 example, a command such as
45272 </para>
45273 <literallayout class="monospaced">
45274 encode '\0user@domain.com\0pas$$word'
45275 </literallayout>
45276 <para>
45277 gives an incorrect answer because of the unescaped <quote>@</quote> and <quote>$</quote> characters.
45278 </para>
45279 <para>
45280 If you have the <option>mimencode</option> command installed, another way to do produce
45281 base64-encoded strings is to run the command
45282 </para>
45283 <literallayout class="monospaced">
45284 echo -e -n `\0user\0password' | mimencode
45285 </literallayout>
45286 <para>
45287 The <option>-e</option> option of <option>echo</option> enables the interpretation of backslash escapes
45288 in the argument, and the <option>-n</option> option specifies no newline at the end of its
45289 output. However, not all versions of <option>echo</option> recognize these options, so you
45290 should check your version before relying on this suggestion.
45291 </para>
45292 </section>
45293 <section id="SECID170">
45294 <title>Authentication by an Exim client</title>
45295 <para>
45296 <indexterm role="concept">
45297 <primary>authentication</primary>
45298 <secondary>on an Exim client</secondary>
45299 </indexterm>
45300 The <command>smtp</command> transport has two options called <option>hosts_require_auth</option> and
45301 <option>hosts_try_auth</option>. When the <command>smtp</command> transport connects to a server that
45302 announces support for authentication, and the host matches an entry in either
45303 of these options, Exim (as a client) tries to authenticate as follows:
45304 </para>
45305 <itemizedlist>
45306 <listitem>
45307 <para>
45308 For each authenticator that is configured as a client, in the order in which
45309 they are defined in the configuration, it searches the authentication
45310 mechanisms announced by the server for one whose name matches the public name
45311 of the authenticator.
45312 </para>
45313 </listitem>
45314 <listitem>
45315 <para>
45316 <indexterm role="variable">
45317 <primary><varname>$host</varname></primary>
45318 </indexterm>
45319 <indexterm role="variable">
45320 <primary><varname>$host_address</varname></primary>
45321 </indexterm>
45322 When it finds one that matches, it runs the authenticator&#x2019;s client code. The
45323 variables <varname>$host</varname> and <varname>$host_address</varname> are available for any string expansions
45324 that the client might do. They are set to the server&#x2019;s name and IP address. If
45325 any expansion is forced to fail, the authentication attempt is abandoned, and
45326 Exim moves on to the next authenticator. Otherwise an expansion failure causes
45327 delivery to be deferred.
45328 </para>
45329 </listitem>
45330 <listitem>
45331 <para>
45332 If the result of the authentication attempt is a temporary error or a timeout,
45333 Exim abandons trying to send the message to the host for the moment. It will
45334 try again later. If there are any backup hosts available, they are tried in the
45335 usual way.
45336 </para>
45337 </listitem>
45338 <listitem>
45339 <para>
45340 If the response to authentication is a permanent error (5<emphasis>xx</emphasis> code), Exim
45341 carries on searching the list of authenticators and tries another one if
45342 possible. If all authentication attempts give permanent errors, or if there are
45343 no attempts because no mechanisms match (or option expansions force failure),
45344 what happens depends on whether the host matches <option>hosts_require_auth</option> or
45345 <option>hosts_try_auth</option>. In the first case, a temporary error is generated, and
45346 delivery is deferred. The error can be detected in the retry rules, and thereby
45347 turned into a permanent error if you wish. In the second case, Exim tries to
45348 deliver the message unauthenticated.
45349 </para>
45350 </listitem>
45351 </itemizedlist>
45352 <para>
45353 <indexterm role="concept">
45354 <primary>AUTH</primary>
45355 <secondary>on MAIL command</secondary>
45356 </indexterm>
45357 When Exim has authenticated itself to a remote server, it adds the AUTH
45358 parameter to the MAIL commands it sends, if it has an authenticated sender for
45359 the message. If the message came from a remote host, the authenticated sender
45360 is the one that was receiving on an incoming MAIL command, provided that the
45361 incoming connection was authenticated and the <option>server_mail_auth</option> condition
45362 allowed the authenticated sender to be retained. If a local process calls Exim
45363 to send a message, the sender address that is built from the login name and
45364 <option>qualify_domain</option> is treated as authenticated. However, if the
45365 <option>authenticated_sender</option> option is set on the <command>smtp</command> transport, it overrides
45366 the authenticated sender that was received with the message.
45367 <indexterm role="concept" startref="IIDauthconf1" class="endofrange"/>
45368 <indexterm role="concept" startref="IIDauthconf2" class="endofrange"/>
45369 </para>
45370 </section>
45371 </chapter>
45372
45373 <chapter id="CHAPplaintext">
45374 <title>The plaintext authenticator</title>
45375 <para>
45376 <indexterm role="concept" id="IIDplaiauth1" class="startofrange">
45377 <primary><command>plaintext</command> authenticator</primary>
45378 </indexterm>
45379 <indexterm role="concept" id="IIDplaiauth2" class="startofrange">
45380 <primary>authenticators</primary>
45381 <secondary><command>plaintext</command></secondary>
45382 </indexterm>
45383 The <command>plaintext</command> authenticator can be configured to support the PLAIN and
45384 LOGIN authentication mechanisms, both of which transfer authentication data as
45385 plain (unencrypted) text (though base64 encoded). The use of plain text is a
45386 security risk; you are strongly advised to insist on the use of SMTP encryption
45387 (see chapter <xref linkend="CHAPTLS"/>) if you use the PLAIN or LOGIN mechanisms. If you do
45388 use unencrypted plain text, you should not use the same passwords for SMTP
45389 connections as you do for login accounts.
45390 </para>
45391 <section id="SECID171">
45392 <title>Plaintext options</title>
45393 <para>
45394 <indexterm role="concept">
45395 <primary>options</primary>
45396 <secondary><command>plaintext</command> authenticator (server)</secondary>
45397 </indexterm>
45398 When configured as a server, <command>plaintext</command> uses the following options:
45399 </para>
45400 <para>
45401 <indexterm role="option">
45402 <primary><option>server_condition</option></primary>
45403 </indexterm>
45404 </para>
45405 <informaltable frame="all">
45406 <tgroup cols="4" colsep="0" rowsep="0">
45407 <colspec colwidth="8*" align="left"/>
45408 <colspec colwidth="6*" align="center"/>
45409 <colspec colwidth="6*" align="center"/>
45410 <colspec colwidth="6*" align="right"/>
45411 <tbody>
45412 <row>
45413 <entry><option>server_condition</option></entry>
45414 <entry>Use: <emphasis>authenticators</emphasis></entry>
45415 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45416 <entry>Default: <emphasis>unset</emphasis></entry>
45417 </row>
45418 </tbody>
45419 </tgroup>
45420 </informaltable>
45421 <para>
45422 This is actually a global authentication option, but it must be set in order to
45423 configure the <command>plaintext</command> driver as a server. Its use is described below.
45424 </para>
45425 <para>
45426 <indexterm role="option">
45427 <primary><option>server_prompts</option></primary>
45428 </indexterm>
45429 </para>
45430 <informaltable frame="all">
45431 <tgroup cols="4" colsep="0" rowsep="0">
45432 <colspec colwidth="8*" align="left"/>
45433 <colspec colwidth="6*" align="center"/>
45434 <colspec colwidth="6*" align="center"/>
45435 <colspec colwidth="6*" align="right"/>
45436 <tbody>
45437 <row>
45438 <entry><option>server_prompts</option></entry>
45439 <entry>Use: <emphasis>plaintext</emphasis></entry>
45440 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45441 <entry>Default: <emphasis>unset</emphasis></entry>
45442 </row>
45443 </tbody>
45444 </tgroup>
45445 </informaltable>
45446 <para>
45447 The contents of this option, after expansion, must be a colon-separated list of
45448 prompt strings. If expansion fails, a temporary authentication rejection is
45449 given.
45450 </para>
45451 </section>
45452 <section id="SECTplainserver">
45453 <title>Using plaintext in a server</title>
45454 <para>
45455 <indexterm role="concept">
45456 <primary>AUTH</primary>
45457 <secondary>in <command>plaintext</command> authenticator</secondary>
45458 </indexterm>
45459 <indexterm role="concept">
45460 <primary>binary zero</primary>
45461 <secondary>in <command>plaintext</command> authenticator</secondary>
45462 </indexterm>
45463 <indexterm role="concept">
45464 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
45465 <secondary>in <command>plaintext</command> authenticator</secondary>
45466 </indexterm>
45467 <indexterm role="variable">
45468 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
45469 </indexterm>
45470 <indexterm role="concept">
45471 <primary>base64 encoding</primary>
45472 <secondary>in <command>plaintext</command> authenticator</secondary>
45473 </indexterm>
45474 </para>
45475 <para>
45476 When running as a server, <command>plaintext</command> performs the authentication test by
45477 expanding a string. The data sent by the client with the AUTH command, or in
45478 response to subsequent prompts, is base64 encoded, and so may contain any byte
45479 values when decoded. If any data is supplied with the command, it is treated as
45480 a list of strings, separated by NULs (binary zeros), the first three of which
45481 are placed in the expansion variables <varname>$auth1</varname>, <varname>$auth2</varname>, and <varname>$auth3</varname>
45482 (neither LOGIN nor PLAIN uses more than three strings).
45483 </para>
45484 <para>
45485 For compatibility with previous releases of Exim, the values are also placed in
45486 the expansion variables <varname>$1</varname>, <varname>$2</varname>, and <varname>$3</varname>. However, the use of these
45487 variables for this purpose is now deprecated, as it can lead to confusion in
45488 string expansions that also use them for other things.
45489 </para>
45490 <para>
45491 If there are more strings in <option>server_prompts</option> than the number of strings
45492 supplied with the AUTH command, the remaining prompts are used to obtain more
45493 data. Each response from the client may be a list of NUL-separated strings.
45494 </para>
45495 <para>
45496 <indexterm role="variable">
45497 <primary><varname>$authenticated_id</varname></primary>
45498 </indexterm>
45499 Once a sufficient number of data strings have been received,
45500 <option>server_condition</option> is expanded. If the expansion is forced to fail,
45501 authentication fails. Any other expansion failure causes a temporary error code
45502 to be returned. If the result of a successful expansion is an empty string,
45503 <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
45504 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds and the
45505 generic <option>server_set_id</option> option is expanded and saved in <varname>$authenticated_id</varname>.
45506 For any other result, a temporary error code is returned, with the expanded
45507 string as the error text.
45508 </para>
45509 <para>
45510 <emphasis role="bold">Warning</emphasis>: If you use a lookup in the expansion to find the user&#x2019;s
45511 password, be sure to make the authentication fail if the user is unknown.
45512 There are good and bad examples at the end of the next section.
45513 </para>
45514 </section>
45515 <section id="SECID172">
45516 <title>The PLAIN authentication mechanism</title>
45517 <para>
45518 <indexterm role="concept">
45519 <primary>PLAIN authentication mechanism</primary>
45520 </indexterm>
45521 <indexterm role="concept">
45522 <primary>authentication</primary>
45523 <secondary>PLAIN mechanism</secondary>
45524 </indexterm>
45525 <indexterm role="concept">
45526 <primary>binary zero</primary>
45527 <secondary>in <command>plaintext</command> authenticator</secondary>
45528 </indexterm>
45529 The PLAIN authentication mechanism (RFC 2595) specifies that three strings be
45530 sent as one item of data (that is, one combined string containing two NUL
45531 separators). The data is sent either as part of the AUTH command, or
45532 subsequently in response to an empty prompt from the server.
45533 </para>
45534 <para>
45535 The second and third strings are a user name and a corresponding password.
45536 Using a single fixed user name and password as an example, this could be
45537 configured as follows:
45538 </para>
45539 <literallayout class="monospaced">
45540 fixed_plain:
45541   driver = plaintext
45542   public_name = PLAIN
45543   server_prompts = :
45544   server_condition = \
45545     ${if and {{eq{$auth2}{username}}{eq{$auth3}{mysecret}}}}
45546   server_set_id = $auth2
45547 </literallayout>
45548 <para>
45549 Note that the default result strings from <option>if</option> (<quote>true</quote> or an empty string)
45550 are exactly what we want here, so they need not be specified. Obviously, if the
45551 password contains expansion-significant characters such as dollar, backslash,
45552 or closing brace, they have to be escaped.
45553 </para>
45554 <para>
45555 The <option>server_prompts</option> setting specifies a single, empty prompt (empty items at
45556 the end of a string list are ignored). If all the data comes as part of the
45557 AUTH command, as is commonly the case, the prompt is not used. This
45558 authenticator is advertised in the response to EHLO as
45559 </para>
45560 <literallayout class="monospaced">
45561 250-AUTH PLAIN
45562 </literallayout>
45563 <para>
45564 and a client host can authenticate itself by sending the command
45565 </para>
45566 <literallayout class="monospaced">
45567 AUTH PLAIN AHVzZXJuYW1lAG15c2VjcmV0
45568 </literallayout>
45569 <para>
45570 As this contains three strings (more than the number of prompts), no further
45571 data is required from the client. Alternatively, the client may just send
45572 </para>
45573 <literallayout class="monospaced">
45574 AUTH PLAIN
45575 </literallayout>
45576 <para>
45577 to initiate authentication, in which case the server replies with an empty
45578 prompt. The client must respond with the combined data string.
45579 </para>
45580 <para>
45581 The data string is base64 encoded, as required by the RFC. This example,
45582 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;
45583 represents a zero byte. This is split up into three strings, the first of which
45584 is empty. The <option>server_condition</option> option in the authenticator checks that the
45585 second two are <literal>username</literal> and <literal>mysecret</literal> respectively.
45586 </para>
45587 <para>
45588 Having just one fixed user name and password, as in this example, is not very
45589 realistic, though for a small organization with only a handful of
45590 authenticating clients it could make sense.
45591 </para>
45592 <para>
45593 A more sophisticated instance of this authenticator could use the user name in
45594 <varname>$auth2</varname> to look up a password in a file or database, and maybe do an encrypted
45595 comparison (see <option>crypteq</option> in chapter <xref linkend="CHAPexpand"/>). Here is a example of
45596 this approach, where the passwords are looked up in a DBM file. <emphasis role="bold">Warning</emphasis>:
45597 This is an incorrect example:
45598 </para>
45599 <literallayout class="monospaced">
45600 server_condition = \
45601   ${if eq{$auth3}{${lookup{$auth2}dbm{/etc/authpwd}}}}
45602 </literallayout>
45603 <para>
45604 The expansion uses the user name (<varname>$auth2</varname>) as the key to look up a password,
45605 which it then compares to the supplied password (<varname>$auth3</varname>). Why is this example
45606 incorrect? It works fine for existing users, but consider what happens if a
45607 non-existent user name is given. The lookup fails, but as no success/failure
45608 strings are given for the lookup, it yields an empty string. Thus, to defeat
45609 the authentication, all a client has to do is to supply a non-existent user
45610 name and an empty password. The correct way of writing this test is:
45611 </para>
45612 <literallayout class="monospaced">
45613 server_condition = ${lookup{$auth2}dbm{/etc/authpwd}\
45614   {${if eq{$value}{$auth3}}} {false}}
45615 </literallayout>
45616 <para>
45617 In this case, if the lookup succeeds, the result is checked; if the lookup
45618 fails, <quote>false</quote> is returned and authentication fails. If <option>crypteq</option> is being
45619 used instead of <option>eq</option>, the first example is in fact safe, because <option>crypteq</option>
45620 always fails if its second argument is empty. However, the second way of
45621 writing the test makes the logic clearer.
45622 </para>
45623 </section>
45624 <section id="SECID173">
45625 <title>The LOGIN authentication mechanism</title>
45626 <para>
45627 <indexterm role="concept">
45628 <primary>LOGIN authentication mechanism</primary>
45629 </indexterm>
45630 <indexterm role="concept">
45631 <primary>authentication</primary>
45632 <secondary>LOGIN mechanism</secondary>
45633 </indexterm>
45634 The LOGIN authentication mechanism is not documented in any RFC, but is in use
45635 in a number of programs. No data is sent with the AUTH command. Instead, a
45636 user name and password are supplied separately, in response to prompts. The
45637 plaintext authenticator can be configured to support this as in this example:
45638 </para>
45639 <literallayout class="monospaced">
45640 fixed_login:
45641   driver = plaintext
45642   public_name = LOGIN
45643   server_prompts = User Name : Password
45644   server_condition = \
45645     ${if and {{eq{$auth1}{username}}{eq{$auth2}{mysecret}}}}
45646   server_set_id = $auth1
45647 </literallayout>
45648 <para>
45649 Because of the way plaintext operates, this authenticator accepts data supplied
45650 with the AUTH command (in contravention of the specification of LOGIN), but
45651 if the client does not supply it (as is the case for LOGIN clients), the prompt
45652 strings are used to obtain two data items.
45653 </para>
45654 <para>
45655 Some clients are very particular about the precise text of the prompts. For
45656 example, Outlook Express is reported to recognize only <quote>Username:</quote> and
45657 <quote>Password:</quote>. Here is an example of a LOGIN authenticator that uses those
45658 strings. It uses the <option>ldapauth</option> expansion condition to check the user
45659 name and password by binding to an LDAP server:
45660 </para>
45661 <literallayout class="monospaced">
45662 login:
45663   driver = plaintext
45664   public_name = LOGIN
45665   server_prompts = Username:: : Password::
45666   server_condition = ${if and{{
45667     !eq{}{$auth1} }{ \
45668     ldapauth{user="cn=${quote_ldap_dn:$auth1},ou=people,o=example.org" \
45669              pass=${quote:$auth2} \
45670              ldap://ldap.example.org/} }} }
45671   server_set_id = uid=$auth1,ou=people,o=example.org
45672 </literallayout>
45673 <para>
45674 We have to check that the username is not empty before using it, because LDAP
45675 does not permit empty DN components. We must also use the <option>quote_ldap_dn</option>
45676 operator to correctly quote the DN for authentication. However, the basic
45677 <option>quote</option> operator, rather than any of the LDAP quoting operators, is the
45678 correct one to use for the password, because quoting is needed only to make
45679 the password conform to the Exim syntax. At the LDAP level, the password is an
45680 uninterpreted string.
45681 </para>
45682 </section>
45683 <section id="SECID174">
45684 <title>Support for different kinds of authentication</title>
45685 <para>
45686 A number of string expansion features are provided for the purpose of
45687 interfacing to different ways of user authentication. These include checking
45688 traditionally encrypted passwords from <filename>/etc/passwd</filename> (or equivalent), PAM,
45689 Radius, <option>ldapauth</option>, <emphasis>pwcheck</emphasis>, and <emphasis>saslauthd</emphasis>. For details see section
45690 <xref linkend="SECTexpcond"/>.
45691 </para>
45692 </section>
45693 <section id="SECID175">
45694 <title>Using plaintext in a client</title>
45695 <para>
45696 <indexterm role="concept">
45697 <primary>options</primary>
45698 <secondary><command>plaintext</command> authenticator (client)</secondary>
45699 </indexterm>
45700 The <command>plaintext</command> authenticator has two client options:
45701 </para>
45702 <para>
45703 <indexterm role="option">
45704 <primary><option>client_ignore_invalid_base64</option></primary>
45705 </indexterm>
45706 </para>
45707 <informaltable frame="all">
45708 <tgroup cols="4" colsep="0" rowsep="0">
45709 <colspec colwidth="8*" align="left"/>
45710 <colspec colwidth="6*" align="center"/>
45711 <colspec colwidth="6*" align="center"/>
45712 <colspec colwidth="6*" align="right"/>
45713 <tbody>
45714 <row>
45715 <entry><option>client_ignore_invalid_base64</option></entry>
45716 <entry>Use: <emphasis>plaintext</emphasis></entry>
45717 <entry>Type: <emphasis>boolean</emphasis></entry>
45718 <entry>Default: <emphasis>false</emphasis></entry>
45719 </row>
45720 </tbody>
45721 </tgroup>
45722 </informaltable>
45723 <para>
45724 If the client receives a server prompt that is not a valid base64 string,
45725 authentication is abandoned by default. However, if this option is set true,
45726 the error in the challenge is ignored and the client sends the response as
45727 usual.
45728 </para>
45729 <para>
45730 <indexterm role="option">
45731 <primary><option>client_send</option></primary>
45732 </indexterm>
45733 </para>
45734 <informaltable frame="all">
45735 <tgroup cols="4" colsep="0" rowsep="0">
45736 <colspec colwidth="8*" align="left"/>
45737 <colspec colwidth="6*" align="center"/>
45738 <colspec colwidth="6*" align="center"/>
45739 <colspec colwidth="6*" align="right"/>
45740 <tbody>
45741 <row>
45742 <entry><option>client_send</option></entry>
45743 <entry>Use: <emphasis>plaintext</emphasis></entry>
45744 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45745 <entry>Default: <emphasis>unset</emphasis></entry>
45746 </row>
45747 </tbody>
45748 </tgroup>
45749 </informaltable>
45750 <para>
45751 The string is a colon-separated list of authentication data strings. Each
45752 string is independently expanded before being sent to the server. The first
45753 string is sent with the AUTH command; any more strings are sent in response
45754 to prompts from the server. Before each string is expanded, the value of the
45755 most recent prompt is placed in the next <varname>$auth</varname>&lt;<emphasis>n</emphasis>&gt; variable, starting
45756 with <varname>$auth1</varname> for the first prompt. Up to three prompts are stored in this
45757 way. Thus, the prompt that is received in response to sending the first string
45758 (with the AUTH command) can be used in the expansion of the second string, and
45759 so on. If an invalid base64 string is received when
45760 <option>client_ignore_invalid_base64</option> is set, an empty string is put in the
45761 <varname>$auth</varname>&lt;<emphasis>n</emphasis>&gt; variable.
45762 </para>
45763 <para>
45764 <emphasis role="bold">Note</emphasis>: You cannot use expansion to create multiple strings, because
45765 splitting takes priority and happens first.
45766 </para>
45767 <para>
45768 Because the PLAIN authentication mechanism requires NUL (binary zero) bytes in
45769 the data, further processing is applied to each string before it is sent. If
45770 there are any single circumflex characters in the string, they are converted to
45771 NULs. Should an actual circumflex be required as data, it must be doubled in
45772 the string.
45773 </para>
45774 <para>
45775 This is an example of a client configuration that implements the PLAIN
45776 authentication mechanism with a fixed user name and password:
45777 </para>
45778 <literallayout class="monospaced">
45779 fixed_plain:
45780   driver = plaintext
45781   public_name = PLAIN
45782   client_send = ^username^mysecret
45783 </literallayout>
45784 <para>
45785 The lack of colons means that the entire text is sent with the AUTH
45786 command, with the circumflex characters converted to NULs. A similar example
45787 that uses the LOGIN mechanism is:
45788 </para>
45789 <literallayout class="monospaced">
45790 fixed_login:
45791   driver = plaintext
45792   public_name = LOGIN
45793   client_send = : username : mysecret
45794 </literallayout>
45795 <para>
45796 The initial colon means that the first string is empty, so no data is sent with
45797 the AUTH command itself. The remaining strings are sent in response to
45798 prompts.
45799 <indexterm role="concept" startref="IIDplaiauth1" class="endofrange"/>
45800 <indexterm role="concept" startref="IIDplaiauth2" class="endofrange"/>
45801 </para>
45802 </section>
45803 </chapter>
45804
45805 <chapter id="CHID9">
45806 <title>The cram_md5 authenticator</title>
45807 <para>
45808 <indexterm role="concept" id="IIDcramauth1" class="startofrange">
45809 <primary><command>cram_md5</command> authenticator</primary>
45810 </indexterm>
45811 <indexterm role="concept" id="IIDcramauth2" class="startofrange">
45812 <primary>authenticators</primary>
45813 <secondary><command>cram_md5</command></secondary>
45814 </indexterm>
45815 <indexterm role="concept">
45816 <primary>CRAM-MD5 authentication mechanism</primary>
45817 </indexterm>
45818 <indexterm role="concept">
45819 <primary>authentication</primary>
45820 <secondary>CRAM-MD5 mechanism</secondary>
45821 </indexterm>
45822 The CRAM-MD5 authentication mechanism is described in RFC 2195. The server
45823 sends a challenge string to the client, and the response consists of a user
45824 name and the CRAM-MD5 digest of the challenge string combined with a secret
45825 string (password) which is known to both server and client. Thus, the secret
45826 is not sent over the network as plain text, which makes this authenticator more
45827 secure than <command>plaintext</command>. However, the downside is that the secret has to be
45828 available in plain text at either end.
45829 </para>
45830 <section id="SECID176">
45831 <title>Using cram_md5 as a server</title>
45832 <para>
45833 <indexterm role="concept">
45834 <primary>options</primary>
45835 <secondary><command>cram_md5</command> authenticator (server)</secondary>
45836 </indexterm>
45837 This authenticator has one server option, which must be set to configure the
45838 authenticator as a server:
45839 </para>
45840 <para>
45841 <indexterm role="option">
45842 <primary><option>server_secret</option></primary>
45843 </indexterm>
45844 </para>
45845 <informaltable frame="all">
45846 <tgroup cols="4" colsep="0" rowsep="0">
45847 <colspec colwidth="8*" align="left"/>
45848 <colspec colwidth="6*" align="center"/>
45849 <colspec colwidth="6*" align="center"/>
45850 <colspec colwidth="6*" align="right"/>
45851 <tbody>
45852 <row>
45853 <entry><option>server_secret</option></entry>
45854 <entry>Use: <emphasis>cram_md5</emphasis></entry>
45855 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45856 <entry>Default: <emphasis>unset</emphasis></entry>
45857 </row>
45858 </tbody>
45859 </tgroup>
45860 </informaltable>
45861 <para>
45862 <indexterm role="concept">
45863 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
45864 <secondary>in <command>cram_md5</command> authenticator</secondary>
45865 </indexterm>
45866 When the server receives the client&#x2019;s response, the user name is placed in
45867 the expansion variable <varname>$auth1</varname>, and <option>server_secret</option> is expanded to
45868 obtain the password for that user. The server then computes the CRAM-MD5 digest
45869 that the client should have sent, and checks that it received the correct
45870 string. If the expansion of <option>server_secret</option> is forced to fail, authentication
45871 fails. If the expansion fails for some other reason, a temporary error code is
45872 returned to the client.
45873 </para>
45874 <para>
45875 For compatibility with previous releases of Exim, the user name is also placed
45876 in <varname>$1</varname>. However, the use of this variables for this purpose is now
45877 deprecated, as it can lead to confusion in string expansions that also use
45878 numeric variables for other things.
45879 </para>
45880 <para>
45881 For example, the following authenticator checks that the user name given by the
45882 client is <quote>ph10</quote>, and if so, uses <quote>secret</quote> as the password. For any other
45883 user name, authentication fails.
45884 </para>
45885 <literallayout class="monospaced">
45886 fixed_cram:
45887   driver = cram_md5
45888   public_name = CRAM-MD5
45889   server_secret = ${if eq{$auth1}{ph10}{secret}fail}
45890   server_set_id = $auth1
45891 </literallayout>
45892 <para>
45893 <indexterm role="variable">
45894 <primary><varname>$authenticated_id</varname></primary>
45895 </indexterm>
45896 If authentication succeeds, the setting of <option>server_set_id</option> preserves the user
45897 name in <varname>$authenticated_id</varname>. A more typical configuration might look up the
45898 secret string in a file, using the user name as the key. For example:
45899 </para>
45900 <literallayout class="monospaced">
45901 lookup_cram:
45902   driver = cram_md5
45903   public_name = CRAM-MD5
45904   server_secret = ${lookup{$auth1}lsearch{/etc/authpwd}\
45905                   {$value}fail}
45906   server_set_id = $auth1
45907 </literallayout>
45908 <para>
45909 Note that this expansion explicitly forces failure if the lookup fails
45910 because <varname>$auth1</varname> contains an unknown user name.
45911 </para>
45912 </section>
45913 <section id="SECID177">
45914 <title>Using cram_md5 as a client</title>
45915 <para>
45916 <indexterm role="concept">
45917 <primary>options</primary>
45918 <secondary><command>cram_md5</command> authenticator (client)</secondary>
45919 </indexterm>
45920 When used as a client, the <command>cram_md5</command> authenticator has two options:
45921 </para>
45922 <para>
45923 <indexterm role="option">
45924 <primary><option>client_name</option></primary>
45925 </indexterm>
45926 </para>
45927 <informaltable frame="all">
45928 <tgroup cols="4" colsep="0" rowsep="0">
45929 <colspec colwidth="8*" align="left"/>
45930 <colspec colwidth="6*" align="center"/>
45931 <colspec colwidth="6*" align="center"/>
45932 <colspec colwidth="6*" align="right"/>
45933 <tbody>
45934 <row>
45935 <entry><option>client_name</option></entry>
45936 <entry>Use: <emphasis>cram_md5</emphasis></entry>
45937 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45938 <entry>Default: <emphasis>the primary host name</emphasis></entry>
45939 </row>
45940 </tbody>
45941 </tgroup>
45942 </informaltable>
45943 <para>
45944 This string is expanded, and the result used as the user name data when
45945 computing the response to the server&#x2019;s challenge.
45946 </para>
45947 <para>
45948 <indexterm role="option">
45949 <primary><option>client_secret</option></primary>
45950 </indexterm>
45951 </para>
45952 <informaltable frame="all">
45953 <tgroup cols="4" colsep="0" rowsep="0">
45954 <colspec colwidth="8*" align="left"/>
45955 <colspec colwidth="6*" align="center"/>
45956 <colspec colwidth="6*" align="center"/>
45957 <colspec colwidth="6*" align="right"/>
45958 <tbody>
45959 <row>
45960 <entry><option>client_secret</option></entry>
45961 <entry>Use: <emphasis>cram_md5</emphasis></entry>
45962 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45963 <entry>Default: <emphasis>unset</emphasis></entry>
45964 </row>
45965 </tbody>
45966 </tgroup>
45967 </informaltable>
45968 <para>
45969 This option must be set for the authenticator to work as a client. Its value is
45970 expanded and the result used as the secret string when computing the response.
45971 </para>
45972 <para>
45973 <indexterm role="variable">
45974 <primary><varname>$host</varname></primary>
45975 </indexterm>
45976 <indexterm role="variable">
45977 <primary><varname>$host_address</varname></primary>
45978 </indexterm>
45979 Different user names and secrets can be used for different servers by referring
45980 to <varname>$host</varname> or <varname>$host_address</varname> in the options. Forced failure of either
45981 expansion string is treated as an indication that this authenticator is not
45982 prepared to handle this case. Exim moves on to the next configured client
45983 authenticator. Any other expansion failure causes Exim to give up trying to
45984 send the message to the current server.
45985 </para>
45986 <para>
45987 A simple example configuration of a <command>cram_md5</command> authenticator, using fixed
45988 strings, is:
45989 </para>
45990 <literallayout class="monospaced">
45991 fixed_cram:
45992   driver = cram_md5
45993   public_name = CRAM-MD5
45994   client_name = ph10
45995   client_secret = secret
45996 </literallayout>
45997 <para>
45998 <indexterm role="concept" startref="IIDcramauth1" class="endofrange"/>
45999 <indexterm role="concept" startref="IIDcramauth2" class="endofrange"/>
46000 </para>
46001 </section>
46002 </chapter>
46003
46004 <chapter id="CHID10">
46005 <title>The cyrus_sasl authenticator</title>
46006 <para>
46007 <indexterm role="concept" id="IIDcyrauth1" class="startofrange">
46008 <primary><command>cyrus_sasl</command> authenticator</primary>
46009 </indexterm>
46010 <indexterm role="concept" id="IIDcyrauth2" class="startofrange">
46011 <primary>authenticators</primary>
46012 <secondary><command>cyrus_sasl</command></secondary>
46013 </indexterm>
46014 <indexterm role="concept">
46015 <primary>Cyrus</primary>
46016 <secondary>SASL library</secondary>
46017 </indexterm>
46018 <indexterm role="concept">
46019 <primary>Kerberos</primary>
46020 </indexterm>
46021 The code for this authenticator was provided by Matthew Byng-Maddick of A L
46022 Digital Ltd (<emphasis role="bold"><ulink url="http://www.aldigital.co.uk">http://www.aldigital.co.uk</ulink></emphasis>).
46023 </para>
46024 <para>
46025 The <command>cyrus_sasl</command> authenticator provides server support for the Cyrus SASL
46026 library implementation of the RFC 2222 (<quote>Simple Authentication and Security
46027 Layer</quote>). This library supports a number of authentication mechanisms,
46028 including PLAIN and LOGIN, but also several others that Exim does not support
46029 directly. In particular, there is support for Kerberos authentication.
46030 </para>
46031 <para>
46032 The <command>cyrus_sasl</command> authenticator provides a gatewaying mechanism directly to
46033 the Cyrus interface, so if your Cyrus library can do, for example, CRAM-MD5,
46034 then so can the <command>cyrus_sasl</command> authenticator. By default it uses the public
46035 name of the driver to determine which mechanism to support.
46036 </para>
46037 <para>
46038 Where access to some kind of secret file is required, for example in GSSAPI
46039 or CRAM-MD5, it is worth noting that the authenticator runs as the Exim
46040 user, and that the Cyrus SASL library has no way of escalating privileges
46041 by default. You may also find you need to set environment variables,
46042 depending on the driver you are using.
46043 </para>
46044 <para>
46045 The application name provided by Exim is <quote>exim</quote>, so various SASL options may
46046 be set in <filename>exim.conf</filename> in your SASL directory. If you are using GSSAPI for
46047 Kerberos, note that because of limitations in the GSSAPI interface,
46048 changing the server keytab might need to be communicated down to the Kerberos
46049 layer independently. The mechanism for doing so is dependent upon the Kerberos
46050 implementation. For example, for Heimdal, the environment variable KRB5_KTNAME
46051 may be set to point to an alternative keytab file. Exim will pass this
46052 variable through from its own inherited environment when started as root or the
46053 Exim user. The keytab file needs to be readable by the Exim user.
46054 </para>
46055 <section id="SECID178">
46056 <title>Using cyrus_sasl as a server</title>
46057 <para>
46058 The <command>cyrus_sasl</command> authenticator has four private options. It puts the username
46059 (on a successful authentication) into <varname>$auth1</varname>. For compatibility with
46060 previous releases of Exim, the username is also placed in <varname>$1</varname>. However, the
46061 use of this variable for this purpose is now deprecated, as it can lead to
46062 confusion in string expansions that also use numeric variables for other
46063 things.
46064 </para>
46065 <para>
46066 <indexterm role="option">
46067 <primary><option>server_hostname</option></primary>
46068 </indexterm>
46069 </para>
46070 <informaltable frame="all">
46071 <tgroup cols="4" colsep="0" rowsep="0">
46072 <colspec colwidth="8*" align="left"/>
46073 <colspec colwidth="6*" align="center"/>
46074 <colspec colwidth="6*" align="center"/>
46075 <colspec colwidth="6*" align="right"/>
46076 <tbody>
46077 <row>
46078 <entry><option>server_hostname</option></entry>
46079 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
46080 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46081 <entry>Default: <emphasis>see below</emphasis></entry>
46082 </row>
46083 </tbody>
46084 </tgroup>
46085 </informaltable>
46086 <para>
46087 This option selects the hostname that is used when communicating with the
46088 library. The default value is <literal>$primary_hostname</literal>. It is up to the underlying
46089 SASL plug-in what it does with this data.
46090 </para>
46091 <para>
46092 <indexterm role="option">
46093 <primary><option>server_mech</option></primary>
46094 </indexterm>
46095 </para>
46096 <informaltable frame="all">
46097 <tgroup cols="4" colsep="0" rowsep="0">
46098 <colspec colwidth="8*" align="left"/>
46099 <colspec colwidth="6*" align="center"/>
46100 <colspec colwidth="6*" align="center"/>
46101 <colspec colwidth="6*" align="right"/>
46102 <tbody>
46103 <row>
46104 <entry><option>server_mech</option></entry>
46105 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
46106 <entry>Type: <emphasis>string</emphasis></entry>
46107 <entry>Default: <emphasis>see below</emphasis></entry>
46108 </row>
46109 </tbody>
46110 </tgroup>
46111 </informaltable>
46112 <para>
46113 This option selects the authentication mechanism this driver should use. The
46114 default is the value of the generic <option>public_name</option> option. This option allows
46115 you to use a different underlying mechanism from the advertised name. For
46116 example:
46117 </para>
46118 <literallayout class="monospaced">
46119 sasl:
46120   driver = cyrus_sasl
46121   public_name = X-ANYTHING
46122   server_mech = CRAM-MD5
46123   server_set_id = $auth1
46124 </literallayout>
46125 <para>
46126 <indexterm role="option">
46127 <primary><option>server_realm</option></primary>
46128 </indexterm>
46129 </para>
46130 <informaltable frame="all">
46131 <tgroup cols="4" colsep="0" rowsep="0">
46132 <colspec colwidth="8*" align="left"/>
46133 <colspec colwidth="6*" align="center"/>
46134 <colspec colwidth="6*" align="center"/>
46135 <colspec colwidth="6*" align="right"/>
46136 <tbody>
46137 <row>
46138 <entry><option>server_realm</option></entry>
46139 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
46140 <entry>Type: <emphasis>string</emphasis></entry>
46141 <entry>Default: <emphasis>unset</emphasis></entry>
46142 </row>
46143 </tbody>
46144 </tgroup>
46145 </informaltable>
46146 <para>
46147 This specifies the SASL realm that the server claims to be in.
46148 </para>
46149 <para>
46150 <indexterm role="option">
46151 <primary><option>server_service</option></primary>
46152 </indexterm>
46153 </para>
46154 <informaltable frame="all">
46155 <tgroup cols="4" colsep="0" rowsep="0">
46156 <colspec colwidth="8*" align="left"/>
46157 <colspec colwidth="6*" align="center"/>
46158 <colspec colwidth="6*" align="center"/>
46159 <colspec colwidth="6*" align="right"/>
46160 <tbody>
46161 <row>
46162 <entry><option>server_service</option></entry>
46163 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
46164 <entry>Type: <emphasis>string</emphasis></entry>
46165 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
46166 </row>
46167 </tbody>
46168 </tgroup>
46169 </informaltable>
46170 <para>
46171 This is the SASL service that the server claims to implement.
46172 </para>
46173 <para>
46174 For straightforward cases, you do not need to set any of the authenticator&#x2019;s
46175 private options. All you need to do is to specify an appropriate mechanism as
46176 the public name. Thus, if you have a SASL library that supports CRAM-MD5 and
46177 PLAIN, you could have two authenticators as follows:
46178 </para>
46179 <literallayout class="monospaced">
46180 sasl_cram_md5:
46181   driver = cyrus_sasl
46182   public_name = CRAM-MD5
46183   server_set_id = $auth1
46184
46185 sasl_plain:
46186   driver = cyrus_sasl
46187   public_name = PLAIN
46188   server_set_id = $auth2
46189 </literallayout>
46190 <para>
46191 Cyrus SASL does implement the LOGIN authentication method, even though it is
46192 not a standard method. It is disabled by default in the source distribution,
46193 but it is present in many binary distributions.
46194 <indexterm role="concept" startref="IIDcyrauth1" class="endofrange"/>
46195 <indexterm role="concept" startref="IIDcyrauth2" class="endofrange"/>
46196 </para>
46197 </section>
46198 </chapter>
46199
46200 <chapter id="CHAPdovecot">
46201 <title>The dovecot authenticator</title>
46202 <para>
46203 <indexterm role="concept" id="IIDdcotauth1" class="startofrange">
46204 <primary><command>dovecot</command> authenticator</primary>
46205 </indexterm>
46206 <indexterm role="concept" id="IIDdcotauth2" class="startofrange">
46207 <primary>authenticators</primary>
46208 <secondary><command>dovecot</command></secondary>
46209 </indexterm>
46210 This authenticator is an interface to the authentication facility of the
46211 Dovecot POP/IMAP server, which can support a number of authentication methods.
46212 If you are using Dovecot to authenticate POP/IMAP clients, it might be helpful
46213 to use the same mechanisms for SMTP authentication. This is a server
46214 authenticator only. There is only one option:
46215 </para>
46216 <para>
46217 <indexterm role="option">
46218 <primary><option>server_socket</option></primary>
46219 </indexterm>
46220 </para>
46221 <informaltable frame="all">
46222 <tgroup cols="4" colsep="0" rowsep="0">
46223 <colspec colwidth="8*" align="left"/>
46224 <colspec colwidth="6*" align="center"/>
46225 <colspec colwidth="6*" align="center"/>
46226 <colspec colwidth="6*" align="right"/>
46227 <tbody>
46228 <row>
46229 <entry><option>server_socket</option></entry>
46230 <entry>Use: <emphasis>dovecot</emphasis></entry>
46231 <entry>Type: <emphasis>string</emphasis></entry>
46232 <entry>Default: <emphasis>unset</emphasis></entry>
46233 </row>
46234 </tbody>
46235 </tgroup>
46236 </informaltable>
46237 <para>
46238 This option must specify the socket that is the interface to Dovecot
46239 authentication. The <option>public_name</option> option must specify an authentication
46240 mechanism that Dovecot is configured to support. You can have several
46241 authenticators for different mechanisms. For example:
46242 </para>
46243 <literallayout class="monospaced">
46244 dovecot_plain:
46245   driver = dovecot
46246   public_name = PLAIN
46247   server_socket = /var/run/dovecot/auth-client
46248   server_set_id = $auth2
46249
46250 dovecot_ntlm:
46251   driver = dovecot
46252   public_name = NTLM
46253   server_socket = /var/run/dovecot/auth-client
46254   server_set_id = $auth1
46255 </literallayout>
46256 <para>
46257 If the SMTP connection is encrypted, or if <varname>$sender_host_address</varname> is equal to
46258 <varname>$received_ip_address</varname> (that is, the connection is local), the <quote>secured</quote>
46259 option is passed in the Dovecot authentication command. If, for a TLS
46260 connection, a client certificate has been verified, the <quote>valid-client-cert</quote>
46261 option is passed. When authentication succeeds, the identity of the user
46262 who authenticated is placed in <varname>$auth1</varname>.
46263 <indexterm role="concept" startref="IIDdcotauth1" class="endofrange"/>
46264 <indexterm role="concept" startref="IIDdcotauth2" class="endofrange"/>
46265 </para>
46266 </chapter>
46267
46268 <chapter id="CHAPspa">
46269 <title>The spa authenticator</title>
46270 <para>
46271 <indexterm role="concept" id="IIDspaauth1" class="startofrange">
46272 <primary><command>spa</command> authenticator</primary>
46273 </indexterm>
46274 <indexterm role="concept" id="IIDspaauth2" class="startofrange">
46275 <primary>authenticators</primary>
46276 <secondary><command>spa</command></secondary>
46277 </indexterm>
46278 <indexterm role="concept">
46279 <primary>authentication</primary>
46280 <secondary>Microsoft Secure Password</secondary>
46281 </indexterm>
46282 <indexterm role="concept">
46283 <primary>authentication</primary>
46284 <secondary>NTLM</secondary>
46285 </indexterm>
46286 <indexterm role="concept">
46287 <primary>Microsoft Secure Password Authentication</primary>
46288 </indexterm>
46289 <indexterm role="concept">
46290 <primary>NTLM authentication</primary>
46291 </indexterm>
46292 The <command>spa</command> authenticator provides client support for Microsoft&#x2019;s <emphasis>Secure
46293 Password Authentication</emphasis> mechanism,
46294 which is also sometimes known as NTLM (NT LanMan). The code for client side of
46295 this authenticator was contributed by Marc Prud&#x2019;hommeaux, and much of it is
46296 taken from the Samba project (<emphasis role="bold"><ulink url="http://www.samba.org">http://www.samba.org</ulink></emphasis>). The code for the
46297 server side was subsequently contributed by Tom Kistner. The mechanism works as
46298 follows:
46299 </para>
46300 <itemizedlist>
46301 <listitem>
46302 <para>
46303 After the AUTH command has been accepted, the client sends an SPA
46304 authentication request based on the user name and optional domain.
46305 </para>
46306 </listitem>
46307 <listitem>
46308 <para>
46309 The server sends back a challenge.
46310 </para>
46311 </listitem>
46312 <listitem>
46313 <para>
46314 The client builds a challenge response which makes use of the user&#x2019;s password
46315 and sends it to the server, which then accepts or rejects it.
46316 </para>
46317 </listitem>
46318 </itemizedlist>
46319 <para>
46320 Encryption is used to protect the password in transit.
46321 </para>
46322 <section id="SECID179">
46323 <title>Using spa as a server</title>
46324 <para>
46325 <indexterm role="concept">
46326 <primary>options</primary>
46327 <secondary><command>spa</command> authenticator (server)</secondary>
46328 </indexterm>
46329 The <command>spa</command> authenticator has just one server option:
46330 </para>
46331 <para>
46332 <indexterm role="option">
46333 <primary><option>server_password</option></primary>
46334 </indexterm>
46335 </para>
46336 <informaltable frame="all">
46337 <tgroup cols="4" colsep="0" rowsep="0">
46338 <colspec colwidth="8*" align="left"/>
46339 <colspec colwidth="6*" align="center"/>
46340 <colspec colwidth="6*" align="center"/>
46341 <colspec colwidth="6*" align="right"/>
46342 <tbody>
46343 <row>
46344 <entry><option>server_password</option></entry>
46345 <entry>Use: <emphasis>spa</emphasis></entry>
46346 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46347 <entry>Default: <emphasis>unset</emphasis></entry>
46348 </row>
46349 </tbody>
46350 </tgroup>
46351 </informaltable>
46352 <para>
46353 <indexterm role="concept">
46354 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
46355 <secondary>in <command>spa</command> authenticator</secondary>
46356 </indexterm>
46357 This option is expanded, and the result must be the cleartext password for the
46358 authenticating user, whose name is at this point in <varname>$auth1</varname>. For
46359 compatibility with previous releases of Exim, the user name is also placed in
46360 <varname>$1</varname>. However, the use of this variable for this purpose is now deprecated, as
46361 it can lead to confusion in string expansions that also use numeric variables
46362 for other things. For example:
46363 </para>
46364 <literallayout class="monospaced">
46365 spa:
46366   driver = spa
46367   public_name = NTLM
46368   server_password = \
46369     ${lookup{$auth1}lsearch{/etc/exim/spa_clearpass}{$value}fail}
46370 </literallayout>
46371 <para>
46372 If the expansion is forced to fail, authentication fails. Any other expansion
46373 failure causes a temporary error code to be returned.
46374 </para>
46375 </section>
46376 <section id="SECID180">
46377 <title>Using spa as a client</title>
46378 <para>
46379 <indexterm role="concept">
46380 <primary>options</primary>
46381 <secondary><command>spa</command> authenticator (client)</secondary>
46382 </indexterm>
46383 The <command>spa</command> authenticator has the following client options:
46384 </para>
46385 <para>
46386 <indexterm role="option">
46387 <primary><option>client_domain</option></primary>
46388 </indexterm>
46389 </para>
46390 <informaltable frame="all">
46391 <tgroup cols="4" colsep="0" rowsep="0">
46392 <colspec colwidth="8*" align="left"/>
46393 <colspec colwidth="6*" align="center"/>
46394 <colspec colwidth="6*" align="center"/>
46395 <colspec colwidth="6*" align="right"/>
46396 <tbody>
46397 <row>
46398 <entry><option>client_domain</option></entry>
46399 <entry>Use: <emphasis>spa</emphasis></entry>
46400 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46401 <entry>Default: <emphasis>unset</emphasis></entry>
46402 </row>
46403 </tbody>
46404 </tgroup>
46405 </informaltable>
46406 <para>
46407 This option specifies an optional domain for the authentication.
46408 </para>
46409 <para>
46410 <indexterm role="option">
46411 <primary><option>client_password</option></primary>
46412 </indexterm>
46413 </para>
46414 <informaltable frame="all">
46415 <tgroup cols="4" colsep="0" rowsep="0">
46416 <colspec colwidth="8*" align="left"/>
46417 <colspec colwidth="6*" align="center"/>
46418 <colspec colwidth="6*" align="center"/>
46419 <colspec colwidth="6*" align="right"/>
46420 <tbody>
46421 <row>
46422 <entry><option>client_password</option></entry>
46423 <entry>Use: <emphasis>spa</emphasis></entry>
46424 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46425 <entry>Default: <emphasis>unset</emphasis></entry>
46426 </row>
46427 </tbody>
46428 </tgroup>
46429 </informaltable>
46430 <para>
46431 This option specifies the user&#x2019;s password, and must be set.
46432 </para>
46433 <para>
46434 <indexterm role="option">
46435 <primary><option>client_username</option></primary>
46436 </indexterm>
46437 </para>
46438 <informaltable frame="all">
46439 <tgroup cols="4" colsep="0" rowsep="0">
46440 <colspec colwidth="8*" align="left"/>
46441 <colspec colwidth="6*" align="center"/>
46442 <colspec colwidth="6*" align="center"/>
46443 <colspec colwidth="6*" align="right"/>
46444 <tbody>
46445 <row>
46446 <entry><option>client_username</option></entry>
46447 <entry>Use: <emphasis>spa</emphasis></entry>
46448 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46449 <entry>Default: <emphasis>unset</emphasis></entry>
46450 </row>
46451 </tbody>
46452 </tgroup>
46453 </informaltable>
46454 <para>
46455 This option specifies the user name, and must be set. Here is an example of a
46456 configuration of this authenticator for use with the mail servers at
46457 <emphasis>msn.com</emphasis>:
46458 </para>
46459 <literallayout class="monospaced">
46460 msn:
46461   driver = spa
46462   public_name = MSN
46463   client_username = msn/msn_username
46464   client_password = msn_plaintext_password
46465   client_domain = DOMAIN_OR_UNSET
46466 </literallayout>
46467 <para>
46468 <indexterm role="concept" startref="IIDspaauth1" class="endofrange"/>
46469 <indexterm role="concept" startref="IIDspaauth2" class="endofrange"/>
46470 </para>
46471 </section>
46472 </chapter>
46473
46474 <chapter id="CHAPTLS">
46475 <title>Encrypted SMTP connections using TLS/SSL</title>
46476 <titleabbrev>Encrypted SMTP connections</titleabbrev>
46477 <para>
46478 <indexterm role="concept" id="IIDencsmtp1" class="startofrange">
46479 <primary>encryption</primary>
46480 <secondary>on SMTP connection</secondary>
46481 </indexterm>
46482 <indexterm role="concept" id="IIDencsmtp2" class="startofrange">
46483 <primary>SMTP</primary>
46484 <secondary>encryption</secondary>
46485 </indexterm>
46486 <indexterm role="concept">
46487 <primary>TLS</primary>
46488 <secondary>on SMTP connection</secondary>
46489 </indexterm>
46490 <indexterm role="concept">
46491 <primary>OpenSSL</primary>
46492 </indexterm>
46493 <indexterm role="concept">
46494 <primary>GnuTLS</primary>
46495 </indexterm>
46496 Support for TLS (Transport Layer Security), formerly known as SSL (Secure
46497 Sockets Layer), is implemented by making use of the OpenSSL library or the
46498 GnuTLS library (Exim requires GnuTLS release 1.0 or later). There is no
46499 cryptographic code in the Exim distribution itself for implementing TLS. In
46500 order to use this feature you must install OpenSSL or GnuTLS, and then build a
46501 version of Exim that includes TLS support (see section <xref linkend="SECTinctlsssl"/>).
46502 You also need to understand the basic concepts of encryption at a managerial
46503 level, and in particular, the way that public keys, private keys, and
46504 certificates are used.
46505 </para>
46506 <para>
46507 RFC 3207 defines how SMTP connections can make use of encryption. Once a
46508 connection is established, the client issues a STARTTLS command. If the
46509 server accepts this, the client and the server negotiate an encryption
46510 mechanism. If the negotiation succeeds, the data that subsequently passes
46511 between them is encrypted.
46512 </para>
46513 <para>
46514 Exim&#x2019;s ACLs can detect whether the current SMTP session is encrypted or not,
46515 and if so, what cipher suite is in use, whether the client supplied a
46516 certificate, and whether or not that certificate was verified. This makes it
46517 possible for an Exim server to deny or accept certain commands based on the
46518 encryption state.
46519 </para>
46520 <para>
46521 <emphasis role="bold">Warning</emphasis>: Certain types of firewall and certain anti-virus products can
46522 disrupt TLS connections. You need to turn off SMTP scanning for these products
46523 in order to get TLS to work.
46524 </para>
46525 <section id="SECID284">
46526 <title>Support for the legacy <quote>ssmtp</quote> (aka <quote>smtps</quote>) protocol</title>
46527 <para>
46528 <indexterm role="concept">
46529 <primary>ssmtp protocol</primary>
46530 </indexterm>
46531 <indexterm role="concept">
46532 <primary>smtps protocol</primary>
46533 </indexterm>
46534 <indexterm role="concept">
46535 <primary>SMTP</primary>
46536 <secondary>ssmtp protocol</secondary>
46537 </indexterm>
46538 <indexterm role="concept">
46539 <primary>SMTP</primary>
46540 <secondary>smtps protocol</secondary>
46541 </indexterm>
46542 Early implementations of encrypted SMTP used a different TCP port from normal
46543 SMTP, and expected an encryption negotiation to start immediately, instead of
46544 waiting for a STARTTLS command from the client using the standard SMTP
46545 port. The protocol was called <quote>ssmtp</quote> or <quote>smtps</quote>, and port 465 was
46546 allocated for this purpose.
46547 </para>
46548 <para>
46549 This approach was abandoned when encrypted SMTP was standardized, but there are
46550 still some legacy clients that use it. Exim supports these clients by means of
46551 the <option>tls_on_connect_ports</option> global option. Its value must be a list of port
46552 numbers; the most common use is expected to be:
46553 </para>
46554 <literallayout class="monospaced">
46555 tls_on_connect_ports = 465
46556 </literallayout>
46557 <para>
46558 The port numbers specified by this option apply to all SMTP connections, both
46559 via the daemon and via <emphasis>inetd</emphasis>. You still need to specify all the ports that
46560 the daemon uses (by setting <option>daemon_smtp_ports</option> or <option>local_interfaces</option> or
46561 the <option>-oX</option> command line option) because <option>tls_on_connect_ports</option> does not add
46562 an extra port &ndash; rather, it specifies different behaviour on a port that is
46563 defined elsewhere.
46564 </para>
46565 <para>
46566 There is also a <option>-tls-on-connect</option> command line option. This overrides
46567 <option>tls_on_connect_ports</option>; it forces the legacy behaviour for all ports.
46568 </para>
46569 </section>
46570 <section id="SECTopenvsgnu">
46571 <title>OpenSSL vs GnuTLS</title>
46572 <para>
46573 <indexterm role="concept">
46574 <primary>TLS</primary>
46575 <secondary>OpenSSL <emphasis>vs</emphasis> GnuTLS</secondary>
46576 </indexterm>
46577 The first TLS support in Exim was implemented using OpenSSL. Support for GnuTLS
46578 followed later, when the first versions of GnuTLS were released. To build Exim
46579 to use GnuTLS, you need to set
46580 </para>
46581 <literallayout class="monospaced">
46582 USE_GNUTLS=yes
46583 </literallayout>
46584 <para>
46585 in Local/Makefile, in addition to
46586 </para>
46587 <literallayout class="monospaced">
46588 SUPPORT_TLS=yes
46589 </literallayout>
46590 <para>
46591 You must also set TLS_LIBS and TLS_INCLUDE appropriately, so that the
46592 include files and libraries for GnuTLS can be found.
46593 </para>
46594 <para>
46595 There are some differences in usage when using GnuTLS instead of OpenSSL:
46596 </para>
46597 <itemizedlist>
46598 <listitem>
46599 <para>
46600 The <option>tls_verify_certificates</option> option must contain the name of a file, not the
46601 name of a directory (for OpenSSL it can be either).
46602 </para>
46603 </listitem>
46604 <listitem>
46605 <para>
46606 The <option>tls_dhparam</option> option is ignored, because early versions of GnuTLS had no
46607 facility for varying its Diffie-Hellman parameters. I understand that this has
46608 changed, but Exim has not been updated to provide this facility.
46609 </para>
46610 </listitem>
46611 <listitem>
46612 <para>
46613 <indexterm role="variable">
46614 <primary><varname>$tls_peerdn</varname></primary>
46615 </indexterm>
46616 Distinguished Name (DN) strings reported by the OpenSSL library use a slash for
46617 separating fields; GnuTLS uses commas, in accordance with RFC 2253. This
46618 affects the value of the <varname>$tls_peerdn</varname> variable.
46619 </para>
46620 </listitem>
46621 <listitem>
46622 <para>
46623 OpenSSL identifies cipher suites using hyphens as separators, for example:
46624 DES-CBC3-SHA. GnuTLS uses underscores, for example: RSA_ARCFOUR_SHA. What is
46625 more, OpenSSL complains if underscores are present in a cipher list. To make
46626 life simpler, Exim changes underscores to hyphens for OpenSSL and hyphens to
46627 underscores for GnuTLS when processing lists of cipher suites in the
46628 <option>tls_require_ciphers</option> options (the global option and the <command>smtp</command> transport
46629 option).
46630 </para>
46631 </listitem>
46632 <listitem>
46633 <para>
46634 The <option>tls_require_ciphers</option> options operate differently, as described in the
46635 sections <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
46636 </para>
46637 </listitem>
46638 </itemizedlist>
46639 </section>
46640 <section id="SECID181">
46641 <title>GnuTLS parameter computation</title>
46642 <para>
46643 GnuTLS uses D-H parameters that may take a substantial amount of time
46644 to compute. It is unreasonable to re-compute them for every TLS session.
46645 Therefore, Exim keeps this data in a file in its spool directory, called
46646 <filename>gnutls-params</filename>. The file is owned by the Exim user and is readable only by
46647 its owner. Every Exim process that start up GnuTLS reads the D-H
46648 parameters from this file. If the file does not exist, the first Exim process
46649 that needs it computes the data and writes it to a temporary file which is
46650 renamed once it is complete. It does not matter if several Exim processes do
46651 this simultaneously (apart from wasting a few resources). Once a file is in
46652 place, new Exim processes immediately start using it.
46653 </para>
46654 <para>
46655 For maximum security, the parameters that are stored in this file should be
46656 recalculated periodically, the frequency depending on your paranoia level.
46657 Arranging this is easy in principle; just delete the file when you want new
46658 values to be computed. However, there may be a problem. The calculation of new
46659 parameters needs random numbers, and these are obtained from <filename>/dev/random</filename>.
46660 If the system is not very active, <filename>/dev/random</filename> may delay returning data
46661 until enough randomness (entropy) is available. This may cause Exim to hang for
46662 a substantial amount of time, causing timeouts on incoming connections.
46663 </para>
46664 <para>
46665 The solution is to generate the parameters externally to Exim. They are stored
46666 in <filename>gnutls-params</filename> in PEM format, which means that they can be generated
46667 externally using the <command>certtool</command> command that is part of GnuTLS.
46668 </para>
46669 <para>
46670 To replace the parameters with new ones, instead of deleting the file
46671 and letting Exim re-create it, you can generate new parameters using
46672 <command>certtool</command> and, when this has been done, replace Exim&#x2019;s cache file by
46673 renaming. The relevant commands are something like this:
46674 </para>
46675 <literallayout class="monospaced">
46676 # rm -f new-params
46677 # touch new-params
46678 # chown exim:exim new-params
46679 # chmod 0400 new-params
46680 # certtool --generate-privkey --bits 512 &gt;new-params
46681 # echo "" &gt;&gt;new-params
46682 # certtool --generate-dh-params --bits 1024 &gt;&gt; new-params
46683 # mv new-params gnutls-params
46684 </literallayout>
46685 <para>
46686 If Exim never has to generate the parameters itself, the possibility of
46687 stalling is removed.
46688 </para>
46689 </section>
46690 <section id="SECTreqciphssl">
46691 <title>Requiring specific ciphers in OpenSSL</title>
46692 <para>
46693 <indexterm role="concept">
46694 <primary>TLS</primary>
46695 <secondary>requiring specific ciphers (OpenSSL)</secondary>
46696 </indexterm>
46697 <indexterm role="option">
46698 <primary><option>tls_require_ciphers</option></primary>
46699 <secondary>OpenSSL</secondary>
46700 </indexterm>
46701 There is a function in the OpenSSL library that can be passed a list of cipher
46702 suites before the cipher negotiation takes place. This specifies which ciphers
46703 are acceptable. The list is colon separated and may contain names like
46704 DES-CBC3-SHA. Exim passes the expanded value of <option>tls_require_ciphers</option>
46705 directly to this function call. The following quotation from the OpenSSL
46706 documentation specifies what forms of item are allowed in the cipher string:
46707 </para>
46708 <itemizedlist>
46709 <listitem>
46710 <para>
46711 It can consist of a single cipher suite such as RC4-SHA.
46712 </para>
46713 </listitem>
46714 <listitem>
46715 <para>
46716 It can represent a list of cipher suites containing a certain algorithm,
46717 or cipher suites of a certain type. For example SHA1 represents all
46718 ciphers suites using the digest algorithm SHA1 and SSLv3 represents all
46719 SSL v3 algorithms.
46720 </para>
46721 </listitem>
46722 <listitem>
46723 <para>
46724 Lists of cipher suites can be combined in a single cipher string using
46725 the + character. This is used as a logical and operation. For example
46726 SHA1+DES represents all cipher suites containing the SHA1 and the DES
46727 algorithms.
46728 </para>
46729 </listitem>
46730 </itemizedlist>
46731 <para>
46732 Each cipher string can be optionally preceded by one of the characters <literal>!</literal>,
46733 <literal>-</literal> or <literal>+</literal>.
46734 </para>
46735 <itemizedlist>
46736 <listitem>
46737 <para>
46738 If <literal>!</literal> is used, the ciphers are permanently deleted from the list. The
46739 ciphers deleted can never reappear in the list even if they are explicitly
46740 stated.
46741 </para>
46742 </listitem>
46743 <listitem>
46744 <para>
46745 If <literal>-</literal> is used, the ciphers are deleted from the list, but some or all
46746 of the ciphers can be added again by later options.
46747 </para>
46748 </listitem>
46749 <listitem>
46750 <para>
46751 If <literal>+</literal> is used, the ciphers are moved to the end of the list. This
46752 option does not add any new ciphers; it just moves matching existing ones.
46753 </para>
46754 </listitem>
46755 </itemizedlist>
46756 <para>
46757 If none of these characters is present, the string is interpreted as
46758 a list of ciphers to be appended to the current preference list. If the list
46759 includes any ciphers already present they will be ignored: that is, they will
46760 not be moved to the end of the list.
46761 </para>
46762 </section>
46763 <section id="SECTreqciphgnu">
46764 <title>Requiring specific ciphers or other parameters in GnuTLS</title>
46765 <para>
46766 <indexterm role="concept">
46767 <primary>GnuTLS</primary>
46768 <secondary>specifying parameters for</secondary>
46769 </indexterm>
46770 <indexterm role="concept">
46771 <primary>TLS</primary>
46772 <secondary>specifying ciphers (GnuTLS)</secondary>
46773 </indexterm>
46774 <indexterm role="concept">
46775 <primary>TLS</primary>
46776 <secondary>specifying key exchange methods (GnuTLS)</secondary>
46777 </indexterm>
46778 <indexterm role="concept">
46779 <primary>TLS</primary>
46780 <secondary>specifying MAC algorithms (GnuTLS)</secondary>
46781 </indexterm>
46782 <indexterm role="concept">
46783 <primary>TLS</primary>
46784 <secondary>specifying protocols (GnuTLS)</secondary>
46785 </indexterm>
46786 <indexterm role="option">
46787 <primary><option>tls_require_ciphers</option></primary>
46788 <secondary>GnuTLS</secondary>
46789 </indexterm>
46790 The GnuTLS library allows the caller to specify separate lists of permitted key
46791 exchange methods, main cipher algorithms, MAC algorithms, and protocols.
46792 Unfortunately, these lists are numerical, and the library does not have a
46793 function for turning names into numbers. Consequently, lists of recognized
46794 names have to be built into the application. The permitted key exchange
46795 methods, ciphers, and MAC algorithms may be used in any combination to form a
46796 cipher suite. This is unlike OpenSSL, where complete cipher suite names are
46797 passed to its control function.
46798 </para>
46799 <para>
46800 For compatibility with OpenSSL, the <option>tls_require_ciphers</option> option can be set
46801 to complete cipher suite names such as RSA_ARCFOUR_SHA, but for GnuTLS this
46802 option controls only the cipher algorithms. Exim searches each item in the
46803 list for the name of an available algorithm. For example, if the list
46804 contains RSA_AES_SHA, then AES is recognized, and the behaviour is exactly
46805 the same as if just AES were given.
46806 </para>
46807 <para>
46808 <indexterm role="option">
46809 <primary><option>gnutls_require_kx</option></primary>
46810 </indexterm>
46811 <indexterm role="option">
46812 <primary><option>gnutls_require_mac</option></primary>
46813 </indexterm>
46814 <indexterm role="option">
46815 <primary><option>gnutls_require_protocols</option></primary>
46816 </indexterm>
46817 There are additional options called <option>gnutls_require_kx</option>,
46818 <option>gnutls_require_mac</option>, and <option>gnutls_require_protocols</option> that can be used to
46819 restrict the key exchange methods, MAC algorithms, and protocols, respectively.
46820 These options are ignored if OpenSSL is in use.
46821 </para>
46822 <para>
46823 All four options are available as global options, controlling how Exim
46824 behaves as a server, and also as options of the <command>smtp</command> transport, controlling
46825 how Exim behaves as a client. All the values are string expanded. After
46826 expansion, the values must be colon-separated lists, though the separator
46827 can be changed in the usual way.
46828 </para>
46829 <para>
46830 Each of the four lists starts out with a default set of algorithms. If the
46831 first item in a list does <emphasis>not</emphasis> start with an exclamation mark, all the
46832 default items are deleted. In this case, only those that are explicitly
46833 specified can be used. If the first item in a list <emphasis>does</emphasis> start with an
46834 exclamation mark, the defaults are left on the list.
46835 </para>
46836 <para>
46837 Then, any item that starts with an exclamation mark causes the relevant
46838 entry to be removed from the list, and any item that does not start with an
46839 exclamation mark causes a new entry to be added to the list. Unrecognized
46840 items in the list are ignored. Thus:
46841 </para>
46842 <literallayout class="monospaced">
46843 tls_require_ciphers = !ARCFOUR
46844 </literallayout>
46845 <para>
46846 allows all the defaults except ARCFOUR, whereas
46847 </para>
46848 <literallayout class="monospaced">
46849 tls_require_ciphers = AES : 3DES
46850 </literallayout>
46851 <para>
46852 allows only cipher suites that use AES or 3DES.
46853 </para>
46854 <para>
46855 For <option>tls_require_ciphers</option> the recognized names are AES_256, AES_128, AES
46856 (both of the preceding), 3DES, ARCFOUR_128, ARCFOUR_40, and ARCFOUR (both of
46857 the preceding). The default list does not contain all of these; it just has
46858 AES_256, AES_128, 3DES, and ARCFOUR_128.
46859 </para>
46860 <para>
46861 For <option>gnutls_require_kx</option>, the recognized names are DHE_RSA, RSA (which
46862 includes DHE_RSA), DHE_DSS, and DHE (which includes both DHE_RSA and
46863 DHE_DSS). The default list contains RSA, DHE_DSS, DHE_RSA.
46864 </para>
46865 <para>
46866 For <option>gnutls_require_mac</option>, the recognized names are SHA (synonym SHA1), and
46867 MD5. The default list contains SHA, MD5.
46868 </para>
46869 <para>
46870 For <option>gnutls_require_protocols</option>, the recognized names are TLS1 and SSL3.
46871 The default list contains TLS1, SSL3.
46872 </para>
46873 <para>
46874 In a server, the order of items in these lists is unimportant. The server
46875 advertises the availability of all the relevant cipher suites. However, in a
46876 client, the order in the <option>tls_require_ciphers</option> list specifies a preference
46877 order for the cipher algorithms. The first one in the client&#x2019;s list that is
46878 also advertised by the server is tried first. The default order is as listed
46879 above.
46880 </para>
46881 </section>
46882 <section id="SECID182">
46883 <title>Configuring an Exim server to use TLS</title>
46884 <para>
46885 <indexterm role="concept">
46886 <primary>TLS</primary>
46887 <secondary>configuring an Exim server</secondary>
46888 </indexterm>
46889 When Exim has been built with TLS support, it advertises the availability of
46890 the STARTTLS command to client hosts that match <option>tls_advertise_hosts</option>,
46891 but not to any others. The default value of this option is unset, which means
46892 that STARTTLS is not advertised at all. This default is chosen because you
46893 need to set some other options in order to make TLS available, and also it is
46894 sensible for systems that want to use TLS only as a client.
46895 </para>
46896 <para>
46897 If a client issues a STARTTLS command and there is some configuration
46898 problem in the server, the command is rejected with a 454 error. If the client
46899 persists in trying to issue SMTP commands, all except QUIT are rejected
46900 with the error
46901 </para>
46902 <literallayout class="monospaced">
46903 554 Security failure
46904 </literallayout>
46905 <para>
46906 If a STARTTLS command is issued within an existing TLS session, it is
46907 rejected with a 554 error code.
46908 </para>
46909 <para>
46910 To enable TLS operations on a server, you must set <option>tls_advertise_hosts</option> to
46911 match some hosts. You can, of course, set it to * to match all hosts.
46912 However, this is not all you need to do. TLS sessions to a server won&#x2019;t work
46913 without some further configuration at the server end.
46914 </para>
46915 <para>
46916 It is rumoured that all existing clients that support TLS/SSL use RSA
46917 encryption. To make this work you need to set, in the server,
46918 </para>
46919 <literallayout class="monospaced">
46920 tls_certificate = /some/file/name
46921 tls_privatekey = /some/file/name
46922 </literallayout>
46923 <para>
46924 These options are, in fact, expanded strings, so you can make them depend on
46925 the identity of the client that is connected if you wish. The first file
46926 contains the server&#x2019;s X509 certificate, and the second contains the private key
46927 that goes with it. These files need to be readable by the Exim user, and must
46928 always be given as full path names. They can be the same file if both the
46929 certificate and the key are contained within it. If <option>tls_privatekey</option> is not
46930 set, or if its expansion is forced to fail or results in an empty string, this
46931 is assumed to be the case. The certificate file may also contain intermediate
46932 certificates that need to be sent to the client to enable it to authenticate
46933 the server&#x2019;s certificate.
46934 </para>
46935 <para>
46936 If you do not understand about certificates and keys, please try to find a
46937 source of this background information, which is not Exim-specific. (There are a
46938 few comments below in section <xref linkend="SECTcerandall"/>.)
46939 </para>
46940 <para>
46941 <emphasis role="bold">Note</emphasis>: These options do not apply when Exim is operating as a client &ndash;
46942 they apply only in the case of a server. If you need to use a certificate in an
46943 Exim client, you must set the options of the same names in an <command>smtp</command>
46944 transport.
46945 </para>
46946 <para>
46947 With just these options, an Exim server will be able to use TLS. It does not
46948 require the client to have a certificate (but see below for how to insist on
46949 this). There is one other option that may be needed in other situations. If
46950 </para>
46951 <literallayout class="monospaced">
46952 tls_dhparam = /some/file/name
46953 </literallayout>
46954 <para>
46955 is set, the SSL library is initialized for the use of Diffie-Hellman ciphers
46956 with the parameters contained in the file. This increases the set of cipher
46957 suites that the server supports. See the command
46958 </para>
46959 <literallayout class="monospaced">
46960 openssl dhparam
46961 </literallayout>
46962 <para>
46963 for a way of generating this data. At present, <option>tls_dhparam</option> is used only
46964 when Exim is linked with OpenSSL. It is ignored if GnuTLS is being used.
46965 </para>
46966 <para>
46967 The strings supplied for these three options are expanded every time a client
46968 host connects. It is therefore possible to use different certificates and keys
46969 for different hosts, if you so wish, by making use of the client&#x2019;s IP address
46970 in <varname>$sender_host_address</varname> to control the expansion. If a string expansion is
46971 forced to fail, Exim behaves as if the option is not set.
46972 </para>
46973 <para>
46974 <indexterm role="concept">
46975 <primary>cipher</primary>
46976 <secondary>logging</secondary>
46977 </indexterm>
46978 <indexterm role="concept">
46979 <primary>log</primary>
46980 <secondary>TLS cipher</secondary>
46981 </indexterm>
46982 <indexterm role="variable">
46983 <primary><varname>$tls_cipher</varname></primary>
46984 </indexterm>
46985 The variable <varname>$tls_cipher</varname> is set to the cipher suite that was negotiated for
46986 an incoming TLS connection. It is included in the <emphasis>Received:</emphasis> header of an
46987 incoming message (by default &ndash; you can, of course, change this), and it is
46988 also included in the log line that records a message&#x2019;s arrival, keyed by
46989 <quote>X=</quote>, unless the <option>tls_cipher</option> log selector is turned off. The <option>encrypted</option>
46990 condition can be used to test for specific cipher suites in ACLs.
46991 (For outgoing SMTP deliveries, <varname>$tls_cipher</varname> is reset &ndash; see section
46992 <xref linkend="SECID185"/>.)
46993 </para>
46994 <para>
46995 Once TLS has been established, the ACLs that run for subsequent SMTP commands
46996 can check the name of the cipher suite and vary their actions accordingly. The
46997 cipher suite names vary, depending on which TLS library is being used. For
46998 example, OpenSSL uses the name DES-CBC3-SHA for the cipher suite which in other
46999 contexts is known as TLS_RSA_WITH_3DES_EDE_CBC_SHA. Check the OpenSSL or GnuTLS
47000 documentation for more details.
47001 </para>
47002 </section>
47003 <section id="SECID183">
47004 <title>Requesting and verifying client certificates</title>
47005 <para>
47006 <indexterm role="concept">
47007 <primary>certificate</primary>
47008 <secondary>verification of client</secondary>
47009 </indexterm>
47010 <indexterm role="concept">
47011 <primary>TLS</primary>
47012 <secondary>client certificate verification</secondary>
47013 </indexterm>
47014 If you want an Exim server to request a certificate when negotiating a TLS
47015 session with a client, you must set either <option>tls_verify_hosts</option> or
47016 <option>tls_try_verify_hosts</option>. You can, of course, set either of them to * to
47017 apply to all TLS connections. For any host that matches one of these options,
47018 Exim requests a certificate as part of the setup of the TLS session. The
47019 contents of the certificate are verified by comparing it with a list of
47020 expected certificates. These must be available in a file or,
47021 for OpenSSL only (not GnuTLS), a directory, identified by
47022 <option>tls_verify_certificates</option>.
47023 </para>
47024 <para>
47025 A file can contain multiple certificates, concatenated end to end. If a
47026 directory is used
47027 (OpenSSL only),
47028 each certificate must be in a separate file, with a name (or a symbolic link)
47029 of the form &lt;<emphasis>hash</emphasis>&gt;.0, where &lt;<emphasis>hash</emphasis>&gt; is a hash value constructed from the
47030 certificate. You can compute the relevant hash by running the command
47031 </para>
47032 <literallayout class="monospaced">
47033 openssl x509 -hash -noout -in /cert/file
47034 </literallayout>
47035 <para>
47036 where <filename>/cert/file</filename> contains a single certificate.
47037 </para>
47038 <para>
47039 The difference between <option>tls_verify_hosts</option> and <option>tls_try_verify_hosts</option> is
47040 what happens if the client does not supply a certificate, or if the certificate
47041 does not match any of the certificates in the collection named by
47042 <option>tls_verify_certificates</option>. If the client matches <option>tls_verify_hosts</option>, the
47043 attempt to set up a TLS session is aborted, and the incoming connection is
47044 dropped. If the client matches <option>tls_try_verify_hosts</option>, the (encrypted) SMTP
47045 session continues. ACLs that run for subsequent SMTP commands can detect the
47046 fact that no certificate was verified, and vary their actions accordingly. For
47047 example, you can insist on a certificate before accepting a message for
47048 relaying, but not when the message is destined for local delivery.
47049 </para>
47050 <para>
47051 <indexterm role="variable">
47052 <primary><varname>$tls_peerdn</varname></primary>
47053 </indexterm>
47054 When a client supplies a certificate (whether it verifies or not), the value of
47055 the Distinguished Name of the certificate is made available in the variable
47056 <varname>$tls_peerdn</varname> during subsequent processing of the message.
47057 </para>
47058 <para>
47059 <indexterm role="concept">
47060 <primary>log</primary>
47061 <secondary>distinguished name</secondary>
47062 </indexterm>
47063 Because it is often a long text string, it is not included in the log line or
47064 <emphasis>Received:</emphasis> header by default. You can arrange for it to be logged, keyed by
47065 <quote>DN=</quote>, by setting the <option>tls_peerdn</option> log selector, and you can use
47066 <option>received_header_text</option> to change the <emphasis>Received:</emphasis> header. When no
47067 certificate is supplied, <varname>$tls_peerdn</varname> is empty.
47068 </para>
47069 </section>
47070 <section id="SECID184">
47071 <title>Revoked certificates</title>
47072 <para>
47073 <indexterm role="concept">
47074 <primary>TLS</primary>
47075 <secondary>revoked certificates</secondary>
47076 </indexterm>
47077 <indexterm role="concept">
47078 <primary>revocation list</primary>
47079 </indexterm>
47080 <indexterm role="concept">
47081 <primary>certificate</primary>
47082 <secondary>revocation list</secondary>
47083 </indexterm>
47084 Certificate issuing authorities issue Certificate Revocation Lists (CRLs) when
47085 certificates are revoked. If you have such a list, you can pass it to an Exim
47086 server using the global option called <option>tls_crl</option> and to an Exim client using
47087 an identically named option for the <command>smtp</command> transport. In each case, the value
47088 of the option is expanded and must then be the name of a file that contains a
47089 CRL in PEM format.
47090 </para>
47091 </section>
47092 <section id="SECID185">
47093 <title>Configuring an Exim client to use TLS</title>
47094 <para>
47095 <indexterm role="concept">
47096 <primary>cipher</primary>
47097 <secondary>logging</secondary>
47098 </indexterm>
47099 <indexterm role="concept">
47100 <primary>log</primary>
47101 <secondary>TLS cipher</secondary>
47102 </indexterm>
47103 <indexterm role="concept">
47104 <primary>log</primary>
47105 <secondary>distinguished name</secondary>
47106 </indexterm>
47107 <indexterm role="concept">
47108 <primary>TLS</primary>
47109 <secondary>configuring an Exim client</secondary>
47110 </indexterm>
47111 The <option>tls_cipher</option> and <option>tls_peerdn</option> log selectors apply to outgoing SMTP
47112 deliveries as well as to incoming, the latter one causing logging of the
47113 server certificate&#x2019;s DN. The remaining client configuration for TLS is all
47114 within the <command>smtp</command> transport.
47115 </para>
47116 <para>
47117 It is not necessary to set any options to have TLS work in the <command>smtp</command>
47118 transport. If Exim is built with TLS support, and TLS is advertised by a
47119 server, the <command>smtp</command> transport always tries to start a TLS session. However,
47120 this can be prevented by setting <option>hosts_avoid_tls</option> (an option of the
47121 transport) to a list of server hosts for which TLS should not be used.
47122 </para>
47123 <para>
47124 If you do not want Exim to attempt to send messages unencrypted when an attempt
47125 to set up an encrypted connection fails in any way, you can set
47126 <option>hosts_require_tls</option> to a list of hosts for which encryption is mandatory. For
47127 those hosts, delivery is always deferred if an encrypted connection cannot be
47128 set up. If there are any other hosts for the address, they are tried in the
47129 usual way.
47130 </para>
47131 <para>
47132 When the server host is not in <option>hosts_require_tls</option>, Exim may try to deliver
47133 the message unencrypted. It always does this if the response to STARTTLS is
47134 a 5<emphasis>xx</emphasis> code. For a temporary error code, or for a failure to negotiate a TLS
47135 session after a success response code, what happens is controlled by the
47136 <option>tls_tempfail_tryclear</option> option of the <command>smtp</command> transport. If it is false,
47137 delivery to this host is deferred, and other hosts (if available) are tried. If
47138 it is true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis> response to
47139 STARTTLS, and if STARTTLS is accepted, but the subsequent TLS
47140 negotiation fails, Exim closes the current connection (because it is in an
47141 unknown state), opens a new one to the same host, and then tries the delivery
47142 unencrypted.
47143 </para>
47144 <para>
47145 The <option>tls_certificate</option> and <option>tls_privatekey</option> options of the <command>smtp</command>
47146 transport provide the client with a certificate, which is passed to the server
47147 if it requests it. If the server is Exim, it will request a certificate only if
47148 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> matches the client.
47149 </para>
47150 <para>
47151 If the <option>tls_verify_certificates</option> option is set on the <command>smtp</command> transport, it
47152 must name a file or,
47153 for OpenSSL only (not GnuTLS), a directory, that contains a collection of
47154 expected server certificates. The client verifies the server&#x2019;s certificate
47155 against this collection, taking into account any revoked certificates that are
47156 in the list defined by <option>tls_crl</option>.
47157 </para>
47158 <para>
47159 If
47160 <option>tls_require_ciphers</option> is set on the <command>smtp</command> transport, it must contain a
47161 list of permitted cipher suites. If either of these checks fails, delivery to
47162 the current host is abandoned, and the <command>smtp</command> transport tries to deliver to
47163 alternative hosts, if any.
47164 </para>
47165 <para>
47166  <emphasis role="bold">Note</emphasis>:
47167 These options must be set in the <command>smtp</command> transport for Exim to use TLS when it
47168 is operating as a client. Exim does not assume that a server certificate (set
47169 by the global options of the same name) should also be used when operating as a
47170 client.
47171 </para>
47172 <para>
47173 <indexterm role="variable">
47174 <primary><varname>$host</varname></primary>
47175 </indexterm>
47176 <indexterm role="variable">
47177 <primary><varname>$host_address</varname></primary>
47178 </indexterm>
47179 All the TLS options in the <command>smtp</command> transport are expanded before use, with
47180 <varname>$host</varname> and <varname>$host_address</varname> containing the name and address of the server to
47181 which the client is connected. Forced failure of an expansion causes Exim to
47182 behave as if the relevant option were unset.
47183 </para>
47184 <para>
47185 <indexterm role="variable">
47186 <primary><varname>$tls_cipher</varname></primary>
47187 </indexterm>
47188 <indexterm role="variable">
47189 <primary><varname>$tls_peerdn</varname></primary>
47190 </indexterm>
47191 Before an SMTP connection is established, the <varname>$tls_cipher</varname> and <varname>$tls_peerdn</varname>
47192 variables are emptied. (Until the first connection, they contain the values
47193 that were set when the message was received.) If STARTTLS is subsequently
47194 successfully obeyed, these variables are set to the relevant values for the
47195 outgoing connection.
47196 </para>
47197 </section>
47198 <section id="SECTmulmessam">
47199 <title>Multiple messages on the same encrypted TCP/IP connection</title>
47200 <para>
47201 <indexterm role="concept">
47202 <primary>multiple SMTP deliveries with TLS</primary>
47203 </indexterm>
47204 <indexterm role="concept">
47205 <primary>TLS</primary>
47206 <secondary>multiple message deliveries</secondary>
47207 </indexterm>
47208 Exim sends multiple messages down the same TCP/IP connection by starting up
47209 an entirely new delivery process for each message, passing the socket from
47210 one process to the next. This implementation does not fit well with the use
47211 of TLS, because there is quite a lot of state information associated with a TLS
47212 connection, not just a socket identification. Passing all the state information
47213 to a new process is not feasible. Consequently, Exim shuts down an existing TLS
47214 session before passing the socket to a new process. The new process may then
47215 try to start a new TLS session, and if successful, may try to re-authenticate
47216 if AUTH is in use, before sending the next message.
47217 </para>
47218 <para>
47219 The RFC is not clear as to whether or not an SMTP session continues in clear
47220 after TLS has been shut down, or whether TLS may be restarted again later, as
47221 just described. However, if the server is Exim, this shutdown and
47222 reinitialization works. It is not known which (if any) other servers operate
47223 successfully if the client closes a TLS session and continues with unencrypted
47224 SMTP, but there are certainly some that do not work. For such servers, Exim
47225 should not pass the socket to another process, because the failure of the
47226 subsequent attempt to use it would cause Exim to record a temporary host error,
47227 and delay other deliveries to that host.
47228 </para>
47229 <para>
47230 To test for this case, Exim sends an EHLO command to the server after
47231 closing down the TLS session. If this fails in any way, the connection is
47232 closed instead of being passed to a new delivery process, but no retry
47233 information is recorded.
47234 </para>
47235 <para>
47236 There is also a manual override; you can set <option>hosts_nopass_tls</option> on the
47237 <command>smtp</command> transport to match those hosts for which Exim should not pass
47238 connections to new processes if TLS has been used.
47239 </para>
47240 </section>
47241 <section id="SECTcerandall">
47242 <title>Certificates and all that</title>
47243 <para>
47244 <indexterm role="concept">
47245 <primary>certificate</primary>
47246 <secondary>references to discussion</secondary>
47247 </indexterm>
47248 In order to understand fully how TLS works, you need to know about
47249 certificates, certificate signing, and certificate authorities. This is not the
47250 place to give a tutorial, especially as I do not know very much about it
47251 myself. Some helpful introduction can be found in the FAQ for the SSL addition
47252 to Apache, currently at
47253 </para>
47254 <literallayout>
47255 <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>
47256 </literallayout>
47257 <para>
47258 Other parts of the <emphasis>modssl</emphasis> documentation are also helpful, and have
47259 links to further files.
47260 Eric Rescorla&#x2019;s book, <emphasis>SSL and TLS</emphasis>, published by Addison-Wesley (ISBN
47261 0-201-61598-3), contains both introductory and more in-depth descriptions.
47262 Some sample programs taken from the book are available from
47263 </para>
47264 <literallayout>
47265 <emphasis role="bold"><ulink url="http://www.rtfm.com/openssl-examples/">http://www.rtfm.com/openssl-examples/</ulink></emphasis>
47266 </literallayout>
47267 </section>
47268 <section id="SECID186">
47269 <title>Certificate chains</title>
47270 <para>
47271 The file named by <option>tls_certificate</option> may contain more than one
47272 certificate. This is useful in the case where the certificate that is being
47273 sent is validated by an intermediate certificate which the other end does
47274 not have. Multiple certificates must be in the correct order in the file.
47275 First the host&#x2019;s certificate itself, then the first intermediate
47276 certificate to validate the issuer of the host certificate, then the next
47277 intermediate certificate to validate the issuer of the first intermediate
47278 certificate, and so on, until finally (optionally) the root certificate.
47279 The root certificate must already be trusted by the recipient for
47280 validation to succeed, of course, but if it&#x2019;s not preinstalled, sending the
47281 root certificate along with the rest makes it available for the user to
47282 install if the receiving end is a client MUA that can interact with a user.
47283 </para>
47284 </section>
47285 <section id="SECID187">
47286 <title>Self-signed certificates</title>
47287 <para>
47288 <indexterm role="concept">
47289 <primary>certificate</primary>
47290 <secondary>self-signed</secondary>
47291 </indexterm>
47292 You can create a self-signed certificate using the <emphasis>req</emphasis> command provided
47293 with OpenSSL, like this:
47294 </para>
47295 <literallayout class="monospaced">
47296 openssl req -x509 -newkey rsa:1024 -keyout file1 -out file2 \
47297             -days 9999 -nodes
47298 </literallayout>
47299 <para>
47300 <filename>file1</filename> and <filename>file2</filename> can be the same file; the key and the certificate are
47301 delimited and so can be identified independently. The <option>-days</option> option
47302 specifies a period for which the certificate is valid. The <option>-nodes</option> option is
47303 important: if you do not set it, the key is encrypted with a passphrase
47304 that you are prompted for, and any use that is made of the key causes more
47305 prompting for the passphrase. This is not helpful if you are going to use
47306 this certificate and key in an MTA, where prompting is not possible.
47307 </para>
47308 <para>
47309 A self-signed certificate made in this way is sufficient for testing, and
47310 may be adequate for all your requirements if you are mainly interested in
47311 encrypting transfers, and not in secure identification.
47312 </para>
47313 <para>
47314 However, many clients require that the certificate presented by the server be a
47315 user (also called <quote>leaf</quote> or <quote>site</quote>) certificate, and not a self-signed
47316 certificate. In this situation, the self-signed certificate described above
47317 must be installed on the client host as a trusted root <emphasis>certification
47318 authority</emphasis> (CA), and the certificate used by Exim must be a user certificate
47319 signed with that self-signed certificate.
47320 </para>
47321 <para>
47322 For information on creating self-signed CA certificates and using them to sign
47323 user certificates, see the <emphasis>General implementation overview</emphasis> chapter of the
47324 Open-source PKI book, available online at
47325 <emphasis role="bold"><ulink url="http://ospkibook.sourceforge.net/">http://ospkibook.sourceforge.net/</ulink></emphasis>.
47326 <indexterm role="concept" startref="IIDencsmtp1" class="endofrange"/>
47327 <indexterm role="concept" startref="IIDencsmtp2" class="endofrange"/>
47328 </para>
47329 </section>
47330 </chapter>
47331
47332 <chapter id="CHAPACL">
47333 <title>Access control lists</title>
47334 <para>
47335 <indexterm role="concept" id="IIDacl" class="startofrange">
47336 <primary>access control lists (ACLs)</primary>
47337 <secondary>description</secondary>
47338 </indexterm>
47339 <indexterm role="concept">
47340 <primary>control of incoming mail</primary>
47341 </indexterm>
47342 <indexterm role="concept">
47343 <primary>message</primary>
47344 <secondary>controlling incoming</secondary>
47345 </indexterm>
47346 <indexterm role="concept">
47347 <primary>policy control</primary>
47348 <secondary>access control lists</secondary>
47349 </indexterm>
47350 Access Control Lists (ACLs) are defined in a separate section of the run time
47351 configuration file, headed by <quote>begin acl</quote>. Each ACL definition starts with a
47352 name, terminated by a colon. Here is a complete ACL section that contains just
47353 one very small ACL:
47354 </para>
47355 <literallayout class="monospaced">
47356 begin acl
47357 small_acl:
47358   accept   hosts = one.host.only
47359 </literallayout>
47360 <para>
47361 You can have as many lists as you like in the ACL section, and the order in
47362 which they appear does not matter. The lists are self-terminating.
47363 </para>
47364 <para>
47365 The majority of ACLs are used to control Exim&#x2019;s behaviour when it receives
47366 certain SMTP commands. This applies both to incoming TCP/IP connections, and
47367 when a local process submits a message using SMTP by specifying the <option>-bs</option>
47368 option. The most common use is for controlling which recipients are accepted
47369 in incoming messages. In addition, you can define an ACL that is used to check
47370 local non-SMTP messages. The default configuration file contains an example of
47371 a realistic ACL for checking RCPT commands. This is discussed in chapter
47372 <xref linkend="CHAPdefconfil"/>.
47373 </para>
47374 <section id="SECID188">
47375 <title>Testing ACLs</title>
47376 <para>
47377 The <option>-bh</option> command line option provides a way of testing your ACL
47378 configuration locally by running a fake SMTP session with which you interact.
47379 The host <emphasis>relay-test.mail-abuse.org</emphasis> provides a service for checking your
47380 relaying configuration (see section <xref linkend="SECTcheralcon"/> for more details).
47381 </para>
47382 </section>
47383 <section id="SECID189">
47384 <title>Specifying when ACLs are used</title>
47385 <para>
47386 <indexterm role="concept">
47387 <primary>access control lists (ACLs)</primary>
47388 <secondary>options for specifying</secondary>
47389 </indexterm>
47390 In order to cause an ACL to be used, you have to name it in one of the relevant
47391 options in the main part of the configuration. These options are:
47392 <indexterm role="concept">
47393 <primary>AUTH</primary>
47394 <secondary>ACL for</secondary>
47395 </indexterm>
47396 <indexterm role="concept">
47397 <primary>DATA</primary>
47398 <secondary>ACLs for</secondary>
47399 </indexterm>
47400 <indexterm role="concept">
47401 <primary>ETRN</primary>
47402 <secondary>ACL for</secondary>
47403 </indexterm>
47404 <indexterm role="concept">
47405 <primary>EXPN</primary>
47406 <secondary>ACL for</secondary>
47407 </indexterm>
47408 <indexterm role="concept">
47409 <primary>HELO</primary>
47410 <secondary>ACL for</secondary>
47411 </indexterm>
47412 <indexterm role="concept">
47413 <primary>EHLO</primary>
47414 <secondary>ACL for</secondary>
47415 </indexterm>
47416 <indexterm role="concept">
47417 <primary>MAIL</primary>
47418 <secondary>ACL for</secondary>
47419 </indexterm>
47420 <indexterm role="concept">
47421 <primary>QUIT, ACL for</primary>
47422 </indexterm>
47423 <indexterm role="concept">
47424 <primary>RCPT</primary>
47425 <secondary>ACL for</secondary>
47426 </indexterm>
47427 <indexterm role="concept">
47428 <primary>STARTTLS, ACL for</primary>
47429 </indexterm>
47430 <indexterm role="concept">
47431 <primary>VRFY</primary>
47432 <secondary>ACL for</secondary>
47433 </indexterm>
47434 <indexterm role="concept">
47435 <primary>SMTP</primary>
47436 <secondary>connection, ACL for</secondary>
47437 </indexterm>
47438 <indexterm role="concept">
47439 <primary>non-SMTP messages</primary>
47440 <secondary>ACLs for</secondary>
47441 </indexterm>
47442 <indexterm role="concept">
47443 <primary>MIME content scanning</primary>
47444 <secondary>ACL for</secondary>
47445 </indexterm>
47446 </para>
47447 <informaltable frame="none">
47448 <tgroup cols="2" colsep="0" rowsep="0">
47449 <colspec colwidth="140pt" align="left"/>
47450 <colspec colwidth="254pt" align="left"/>
47451 <tbody>
47452 <row>
47453 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp</option></entry>
47454 <entry>ACL for non-SMTP messages</entry>
47455 </row>
47456 <row>
47457 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp_mime</option></entry>
47458 <entry>ACL for non-SMTP MIME parts</entry>
47459 </row>
47460 <row>
47461 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp_start</option></entry>
47462 <entry>ACL at start of non-SMTP message</entry>
47463 </row>
47464 <row>
47465 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_auth</option></entry>
47466 <entry>ACL for AUTH</entry>
47467 </row>
47468 <row>
47469 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_connect</option></entry>
47470 <entry>ACL for start of SMTP connection</entry>
47471 </row>
47472 <row>
47473 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_data</option></entry>
47474 <entry>ACL after DATA is complete</entry>
47475 </row>
47476 <row>
47477 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_etrn</option></entry>
47478 <entry>ACL for ETRN</entry>
47479 </row>
47480 <row>
47481 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_expn</option></entry>
47482 <entry>ACL for EXPN</entry>
47483 </row>
47484 <row>
47485 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_helo</option></entry>
47486 <entry>ACL for HELO or EHLO</entry>
47487 </row>
47488 <row>
47489 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mail</option></entry>
47490 <entry>ACL for MAIL</entry>
47491 </row>
47492 <row>
47493 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mailauth</option></entry>
47494 <entry>ACL for the AUTH parameter of MAIL</entry>
47495 </row>
47496 <row>
47497 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mime</option></entry>
47498 <entry>ACL for content-scanning MIME parts</entry>
47499 </row>
47500 <row>
47501 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_notquit</option></entry>
47502 <entry>ACL for non-QUIT terminations</entry>
47503 </row>
47504 <row>
47505 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_predata</option></entry>
47506 <entry>ACL at start of DATA command</entry>
47507 </row>
47508 <row>
47509 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_quit</option></entry>
47510 <entry>ACL for QUIT</entry>
47511 </row>
47512 <row>
47513 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_rcpt</option></entry>
47514 <entry>ACL for RCPT</entry>
47515 </row>
47516 <row>
47517 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_starttls</option></entry>
47518 <entry>ACL for STARTTLS</entry>
47519 </row>
47520 <row>
47521 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_vrfy</option></entry>
47522 <entry>ACL for VRFY</entry>
47523 </row>
47524 </tbody>
47525 </tgroup>
47526 </informaltable>
47527 <para>
47528 For example, if you set
47529 </para>
47530 <literallayout class="monospaced">
47531 acl_smtp_rcpt = small_acl
47532 </literallayout>
47533 <para>
47534 the little ACL defined above is used whenever Exim receives a RCPT command
47535 in an SMTP dialogue. The majority of policy tests on incoming messages can be
47536 done when RCPT commands arrive. A rejection of RCPT should cause the
47537 sending MTA to give up on the recipient address contained in the RCPT
47538 command, whereas rejection at other times may cause the client MTA to keep on
47539 trying to deliver the message. It is therefore recommended that you do as much
47540 testing as possible at RCPT time.
47541 </para>
47542 </section>
47543 <section id="SECID190">
47544 <title>The non-SMTP ACLs</title>
47545 <para>
47546 <indexterm role="concept">
47547 <primary>non-SMTP messages</primary>
47548 <secondary>ACLs for</secondary>
47549 </indexterm>
47550 The non-SMTP ACLs apply to all non-interactive incoming messages, that is, they
47551 apply to batched SMTP as well as to non-SMTP messages. (Batched SMTP is not
47552 really SMTP.) Many of the ACL conditions (for example, host tests, and tests on
47553 the state of the SMTP connection such as encryption and authentication) are not
47554 relevant and are forbidden in these ACLs. However, the sender and recipients
47555 are known, so the <option>senders</option> and <option>sender_domains</option> conditions and the
47556 <varname>$sender_address</varname> and <varname>$recipients</varname> variables can be used. Variables such as
47557 <varname>$authenticated_sender</varname> are also available. You can specify added header lines
47558 in any of these ACLs.
47559 </para>
47560 <para>
47561 The <option>acl_not_smtp_start</option> ACL is run right at the start of receiving a
47562 non-SMTP message, before any of the message has been read. (This is the
47563 analogue of the <option>acl_smtp_predata</option> ACL for SMTP input.) In the case of
47564 batched SMTP input, it runs after the DATA command has been reached. The
47565 result of this ACL is ignored; it cannot be used to reject a message. If you
47566 really need to, you could set a value in an ACL variable here and reject based
47567 on that in the <option>acl_not_smtp</option> ACL. However, this ACL can be used to set
47568 controls, and in particular, it can be used to set
47569 </para>
47570 <literallayout class="monospaced">
47571 control = suppress_local_fixups
47572 </literallayout>
47573 <para>
47574 This cannot be used in the other non-SMTP ACLs because by the time they are
47575 run, it is too late.
47576 </para>
47577 <para>
47578 The <option>acl_not_smtp_mime</option> ACL is available only when Exim is compiled with the
47579 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
47580 </para>
47581 <para>
47582 The <option>acl_not_smtp</option> ACL is run just before the <function>local_scan()</function> function. Any
47583 kind of rejection is treated as permanent, because there is no way of sending a
47584 temporary error for these kinds of message.
47585 </para>
47586 </section>
47587 <section id="SECID191">
47588 <title>The SMTP connect ACL</title>
47589 <para>
47590 <indexterm role="concept">
47591 <primary>SMTP</primary>
47592 <secondary>connection, ACL for</secondary>
47593 </indexterm>
47594 <indexterm role="option">
47595 <primary><option>smtp_banner</option></primary>
47596 </indexterm>
47597 The ACL test specified by <option>acl_smtp_connect</option> happens at the start of an SMTP
47598 session, after the test specified by <option>host_reject_connection</option> (which is now
47599 an anomaly) and any TCP Wrappers testing (if configured). If the connection is
47600 accepted by an <option>accept</option> verb that has a <option>message</option> modifier, the contents of
47601 the message override the banner message that is otherwise specified by the
47602 <option>smtp_banner</option> option.
47603 </para>
47604 </section>
47605 <section id="SECID192">
47606 <title>The EHLO/HELO ACL</title>
47607 <para>
47608 <indexterm role="concept">
47609 <primary>EHLO</primary>
47610 <secondary>ACL for</secondary>
47611 </indexterm>
47612 <indexterm role="concept">
47613 <primary>HELO</primary>
47614 <secondary>ACL for</secondary>
47615 </indexterm>
47616 The ACL test specified by <option>acl_smtp_helo</option> happens when the client issues an
47617 EHLO or HELO command, after the tests specified by <option>helo_accept_junk_hosts</option>,
47618 <option>helo_allow_chars</option>, <option>helo_verify_hosts</option>, and <option>helo_try_verify_hosts</option>.
47619 Note that a client may issue more than one EHLO or HELO command in an SMTP
47620 session, and indeed is required to issue a new EHLO or HELO after successfully
47621 setting up encryption following a STARTTLS command.
47622 </para>
47623 <para>
47624 If the command is accepted by an <option>accept</option> verb that has a <option>message</option>
47625 modifier, the message may not contain more than one line (it will be truncated
47626 at the first newline and a panic logged if it does). Such a message cannot
47627 affect the EHLO options that are listed on the second and subsequent lines of
47628 an EHLO response.
47629 </para>
47630 </section>
47631 <section id="SECID193">
47632 <title>The DATA ACLs</title>
47633 <para>
47634 <indexterm role="concept">
47635 <primary>DATA</primary>
47636 <secondary>ACLs for</secondary>
47637 </indexterm>
47638 Two ACLs are associated with the DATA command, because it is two-stage
47639 command, with two responses being sent to the client.
47640 When the DATA command is received, the ACL defined by <option>acl_smtp_predata</option>
47641 is obeyed. This gives you control after all the RCPT commands, but before
47642 the message itself is received. It offers the opportunity to give a negative
47643 response to the DATA command before the data is transmitted. Header lines
47644 added by MAIL or RCPT ACLs are not visible at this time, but any that
47645 are defined here are visible when the <option>acl_smtp_data</option> ACL is run.
47646 </para>
47647 <para>
47648 You cannot test the contents of the message, for example, to verify addresses
47649 in the headers, at RCPT time or when the DATA command is received. Such
47650 tests have to appear in the ACL that is run after the message itself has been
47651 received, before the final response to the DATA command is sent. This is
47652 the ACL specified by <option>acl_smtp_data</option>, which is the second ACL that is
47653 associated with the DATA command.
47654 </para>
47655 <para>
47656 For both of these ACLs, it is not possible to reject individual recipients. An
47657 error response rejects the entire message. Unfortunately, it is known that some
47658 MTAs do not treat hard (5<emphasis>xx</emphasis>) responses to the DATA command (either
47659 before or after the data) correctly &ndash; they keep the message on their queues
47660 and try again later, but that is their problem, though it does waste some of
47661 your resources.
47662 </para>
47663 </section>
47664 <section id="SECID194">
47665 <title>The SMTP MIME ACL</title>
47666 <para>
47667 The <option>acl_smtp_mime</option> option is available only when Exim is compiled with the
47668 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
47669 </para>
47670 </section>
47671 <section id="SECTQUITACL">
47672 <title>The QUIT ACL</title>
47673 <para>
47674 <indexterm role="concept">
47675 <primary>QUIT, ACL for</primary>
47676 </indexterm>
47677 The ACL for the SMTP QUIT command is anomalous, in that the outcome of the ACL
47678 does not affect the response code to QUIT, which is always 221. Thus, the ACL
47679 does not in fact control any access. For this reason, the only verbs that are
47680 permitted are <option>accept</option> and <option>warn</option>.
47681 </para>
47682 <para>
47683 This ACL can be used for tasks such as custom logging at the end of an SMTP
47684 session. For example, you can use ACL variables in other ACLs to count
47685 messages, recipients, etc., and log the totals at QUIT time using one or
47686 more <option>logwrite</option> modifiers on a <option>warn</option> verb.
47687 </para>
47688 <para>
47689 <emphasis role="bold">Warning</emphasis>: Only the <varname>$acl_c</varname><emphasis>x</emphasis> variables can be used for this, because
47690 the <varname>$acl_m</varname><emphasis>x</emphasis> variables are reset at the end of each incoming message.
47691 </para>
47692 <para>
47693 You do not need to have a final <option>accept</option>, but if you do, you can use a
47694 <option>message</option> modifier to specify custom text that is sent as part of the 221
47695 response to QUIT.
47696 </para>
47697 <para>
47698 This ACL is run only for a <quote>normal</quote> QUIT. For certain kinds of disastrous
47699 failure (for example, failure to open a log file, or when Exim is bombing out
47700 because it has detected an unrecoverable error), all SMTP commands from the
47701 client are given temporary error responses until QUIT is received or the
47702 connection is closed. In these special cases, the QUIT ACL does not run.
47703 </para>
47704 </section>
47705 <section id="SECTNOTQUITACL">
47706 <title>The not-QUIT ACL</title>
47707 <para>
47708 <indexterm role="variable">
47709 <primary><varname>$acl_smtp_notquit</varname></primary>
47710 </indexterm>
47711 The not-QUIT ACL, specified by <option>acl_smtp_notquit</option>, is run in most cases when
47712 an SMTP session ends without sending QUIT. However, when Exim itself is is bad
47713 trouble, such as being unable to write to its log files, this ACL is not run,
47714 because it might try to do things (such as write to log files) that make the
47715 situation even worse.
47716 </para>
47717 <para>
47718 Like the QUIT ACL, this ACL is provided to make it possible to do customized
47719 logging or to gather statistics, and its outcome is ignored. The <option>delay</option>
47720 modifier is forbidden in this ACL, and the only permitted verbs are <option>accept</option>
47721 and <option>warn</option>.
47722 </para>
47723 <para>
47724 <indexterm role="variable">
47725 <primary><varname>$smtp_notquit_reason</varname></primary>
47726 </indexterm>
47727 When the not-QUIT ACL is running, the variable <varname>$smtp_notquit_reason</varname> is set
47728 to a string that indicates the reason for the termination of the SMTP
47729 connection. The possible values are:
47730 </para>
47731 <informaltable frame="none">
47732 <tgroup cols="2" colsep="0" rowsep="0">
47733 <colspec colwidth="196pt" align="left"/>
47734 <colspec colwidth="254pt" align="left"/>
47735 <tbody>
47736 <row>
47737 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>acl-drop</literal></entry>
47738 <entry>Another ACL issued a <option>drop</option> command</entry>
47739 </row>
47740 <row>
47741 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>bad-commands</literal></entry>
47742 <entry>Too many unknown or non-mail commands</entry>
47743 </row>
47744 <row>
47745 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>command-timeout</literal></entry>
47746 <entry>Timeout while reading SMTP commands</entry>
47747 </row>
47748 <row>
47749 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>connection-lost</literal></entry>
47750 <entry>The SMTP connection has been lost</entry>
47751 </row>
47752 <row>
47753 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>data-timeout</literal></entry>
47754 <entry>Timeout while reading message data</entry>
47755 </row>
47756 <row>
47757 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>local-scan-error</literal></entry>
47758 <entry>The <function>local_scan()</function> function crashed</entry>
47759 </row>
47760 <row>
47761 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>local-scan-timeout</literal></entry>
47762 <entry>The <function>local_scan()</function> function timed out</entry>
47763 </row>
47764 <row>
47765 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>signal-exit</literal></entry>
47766 <entry>SIGTERM or SIGINT</entry>
47767 </row>
47768 <row>
47769 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>synchronization-error</literal></entry>
47770 <entry>SMTP synchronization error</entry>
47771 </row>
47772 <row>
47773 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>tls-failed</literal></entry>
47774 <entry>TLS failed to start</entry>
47775 </row>
47776 </tbody>
47777 </tgroup>
47778 </informaltable>
47779 <para>
47780 In most cases when an SMTP connection is closed without having received QUIT,
47781 Exim sends an SMTP response message before actually closing the connection.
47782 With the exception of the <literal>acl-drop</literal> case, the default message can be
47783 overridden by the <option>message</option> modifier in the not-QUIT ACL. In the case of a
47784 <option>drop</option> verb in another ACL, it is the message from the other ACL that is
47785 used.
47786 </para>
47787 </section>
47788 <section id="SECID195">
47789 <title>Finding an ACL to use</title>
47790 <para>
47791 <indexterm role="concept">
47792 <primary>access control lists (ACLs)</primary>
47793 <secondary>finding which to use</secondary>
47794 </indexterm>
47795 The value of an <option>acl_smtp_</option><emphasis>xxx</emphasis> option is expanded before use, so
47796 you can use different ACLs in different circumstances. For example,
47797 </para>
47798 <literallayout class="monospaced">
47799 acl_smtp_rcpt = ${if ={25}{$interface_port} \
47800                      {acl_check_rcpt} {acl_check_rcpt_submit} }
47801 </literallayout>
47802 <para>
47803 In the default configuration file there are some example settings for
47804 providing an RFC 4409 message submission service on port 587 and a
47805 non-standard <quote>smtps</quote> service on port 465. You can use a string
47806 expansion like this to choose an ACL for MUAs on these ports which is
47807 more appropriate for this purpose than the default ACL on port 25.
47808 </para>
47809 <para>
47810 The expanded string does not have to be the name of an ACL in the
47811 configuration file; there are other possibilities. Having expanded the
47812 string, Exim searches for an ACL as follows:
47813 </para>
47814 <itemizedlist>
47815 <listitem>
47816 <para>
47817 If the string begins with a slash, Exim uses it as a file name, and reads its
47818 contents as an ACL. The lines are processed in the same way as lines in the
47819 Exim configuration file. In particular, continuation lines are supported, blank
47820 lines are ignored, as are lines whose first non-whitespace character is <quote>#</quote>.
47821 If the file does not exist or cannot be read, an error occurs (typically
47822 causing a temporary failure of whatever caused the ACL to be run). For example:
47823 </para>
47824 <literallayout class="monospaced">
47825 acl_smtp_data = /etc/acls/\
47826   ${lookup{$sender_host_address}lsearch\
47827   {/etc/acllist}{$value}{default}}
47828 </literallayout>
47829 <para>
47830 This looks up an ACL file to use on the basis of the host&#x2019;s IP address, falling
47831 back to a default if the lookup fails. If an ACL is successfully read from a
47832 file, it is retained in memory for the duration of the Exim process, so that it
47833 can be re-used without having to re-read the file.
47834 </para>
47835 </listitem>
47836 <listitem>
47837 <para>
47838 If the string does not start with a slash, and does not contain any spaces,
47839 Exim searches the ACL section of the configuration for an ACL whose name
47840 matches the string.
47841 </para>
47842 </listitem>
47843 <listitem>
47844 <para>
47845 If no named ACL is found, or if the string contains spaces, Exim parses
47846 the string as an inline ACL. This can save typing in cases where you just
47847 want to have something like
47848 </para>
47849 <literallayout class="monospaced">
47850 acl_smtp_vrfy = accept
47851 </literallayout>
47852 <para>
47853 in order to allow free use of the VRFY command. Such a string may contain
47854 newlines; it is processed in the same way as an ACL that is read from a file.
47855 </para>
47856 </listitem>
47857 </itemizedlist>
47858 </section>
47859 <section id="SECID196">
47860 <title>ACL return codes</title>
47861 <para>
47862 <indexterm role="concept">
47863 <primary>access control lists (ACLs)</primary>
47864 <secondary>return codes</secondary>
47865 </indexterm>
47866 Except for the QUIT ACL, which does not affect the SMTP return code (see
47867 section <xref linkend="SECTQUITACL"/> above), the result of running an ACL is either
47868 <quote>accept</quote> or <quote>deny</quote>, or, if some test cannot be completed (for example, if a
47869 database is down), <quote>defer</quote>. These results cause 2<emphasis>xx</emphasis>, 5<emphasis>xx</emphasis>, and 4<emphasis>xx</emphasis>
47870 return codes, respectively, to be used in the SMTP dialogue. A fourth return,
47871 <quote>error</quote>, occurs when there is an error such as invalid syntax in the ACL.
47872 This also causes a 4<emphasis>xx</emphasis> return code.
47873 </para>
47874 <para>
47875 For the non-SMTP ACL, <quote>defer</quote> and <quote>error</quote> are treated in the same way as
47876 <quote>deny</quote>, because there is no mechanism for passing temporary errors to the
47877 submitters of non-SMTP messages.
47878 </para>
47879 <para>
47880 ACLs that are relevant to message reception may also return <quote>discard</quote>. This
47881 has the effect of <quote>accept</quote>, but causes either the entire message or an
47882 individual recipient address to be discarded. In other words, it is a
47883 blackholing facility. Use it with care.
47884 </para>
47885 <para>
47886 If the ACL for MAIL returns <quote>discard</quote>, all recipients are discarded, and no
47887 ACL is run for subsequent RCPT commands. The effect of <quote>discard</quote> in a
47888 RCPT ACL is to discard just the one recipient address. If there are no
47889 recipients left when the message&#x2019;s data is received, the DATA ACL is not
47890 run. A <quote>discard</quote> return from the DATA or the non-SMTP ACL discards all the
47891 remaining recipients. The <quote>discard</quote> return is not permitted for the
47892 <option>acl_smtp_predata</option> ACL.
47893 </para>
47894 <para>
47895 <indexterm role="concept">
47896 <primary><function>local_scan()</function> function</primary>
47897 <secondary>when all recipients discarded</secondary>
47898 </indexterm>
47899 The <function>local_scan()</function> function is always run, even if there are no remaining
47900 recipients; it may create new recipients.
47901 </para>
47902 </section>
47903 <section id="SECID197">
47904 <title>Unset ACL options</title>
47905 <para>
47906 <indexterm role="concept">
47907 <primary>access control lists (ACLs)</primary>
47908 <secondary>unset options</secondary>
47909 </indexterm>
47910 The default actions when any of the <option>acl_</option><emphasis>xxx</emphasis> options are unset are not
47911 all the same. <emphasis role="bold">Note</emphasis>: These defaults apply only when the relevant ACL is
47912 not defined at all. For any defined ACL, the default action when control
47913 reaches the end of the ACL statements is <quote>deny</quote>.
47914 </para>
47915 <para>
47916 For <option>acl_smtp_quit</option> and <option>acl_not_smtp_start</option> there is no default because
47917 these two are ACLs that are used only for their side effects. They cannot be
47918 used to accept or reject anything.
47919 </para>
47920 <para>
47921 For <option>acl_not_smtp</option>, <option>acl_smtp_auth</option>, <option>acl_smtp_connect</option>,
47922 <option>acl_smtp_data</option>, <option>acl_smtp_helo</option>, <option>acl_smtp_mail</option>, <option>acl_smtp_mailauth</option>,
47923 <option>acl_smtp_mime</option>, <option>acl_smtp_predata</option>, and <option>acl_smtp_starttls</option>, the action
47924 when the ACL is not defined is <quote>accept</quote>.
47925 </para>
47926 <para>
47927 For the others (<option>acl_smtp_etrn</option>, <option>acl_smtp_expn</option>, <option>acl_smtp_rcpt</option>, and
47928 <option>acl_smtp_vrfy</option>), the action when the ACL is not defined is <quote>deny</quote>.
47929 This means that <option>acl_smtp_rcpt</option> must be defined in order to receive any
47930 messages over an SMTP connection. For an example, see the ACL in the default
47931 configuration file.
47932 </para>
47933 </section>
47934 <section id="SECID198">
47935 <title>Data for message ACLs</title>
47936 <para>
47937 <indexterm role="concept">
47938 <primary>access control lists (ACLs)</primary>
47939 <secondary>data for message ACL</secondary>
47940 </indexterm>
47941 <indexterm role="variable">
47942 <primary><varname>$domain</varname></primary>
47943 </indexterm>
47944 <indexterm role="variable">
47945 <primary><varname>$local_part</varname></primary>
47946 </indexterm>
47947 <indexterm role="variable">
47948 <primary><varname>$sender_address</varname></primary>
47949 </indexterm>
47950 <indexterm role="variable">
47951 <primary><varname>$sender_host_address</varname></primary>
47952 </indexterm>
47953 <indexterm role="variable">
47954 <primary><varname>$smtp_command</varname></primary>
47955 </indexterm>
47956 When a MAIL or RCPT ACL, or either of the DATA ACLs, is running, the variables
47957 that contain information about the host and the message&#x2019;s sender (for example,
47958 <varname>$sender_host_address</varname> and <varname>$sender_address</varname>) are set, and can be used in ACL
47959 statements. In the case of RCPT (but not MAIL or DATA), <varname>$domain</varname> and
47960 <varname>$local_part</varname> are set from the argument address. The entire SMTP command
47961 is available in <varname>$smtp_command</varname>.
47962 </para>
47963 <para>
47964 When an ACL for the AUTH parameter of MAIL is running, the variables that
47965 contain information about the host are set, but <varname>$sender_address</varname> is not yet
47966 set. Section <xref linkend="SECTauthparamail"/> contains a discussion of this parameter and
47967 how it is used.
47968 </para>
47969 <para>
47970 <indexterm role="variable">
47971 <primary><varname>$message_size</varname></primary>
47972 </indexterm>
47973 The <varname>$message_size</varname> variable is set to the value of the SIZE parameter on
47974 the MAIL command at MAIL, RCPT and pre-data time, or to -1 if
47975 that parameter is not given. The value is updated to the true message size by
47976 the time the final DATA ACL is run (after the message data has been
47977 received).
47978 </para>
47979 <para>
47980 <indexterm role="variable">
47981 <primary><varname>$rcpt_count</varname></primary>
47982 </indexterm>
47983 <indexterm role="variable">
47984 <primary><varname>$recipients_count</varname></primary>
47985 </indexterm>
47986 The <varname>$rcpt_count</varname> variable increases by one for each RCPT command received.
47987 The <varname>$recipients_count</varname> variable increases by one each time a RCPT command is
47988 accepted, so while an ACL for RCPT is being processed, it contains the number
47989 of previously accepted recipients. At DATA time (for both the DATA ACLs),
47990 <varname>$rcpt_count</varname> contains the total number of RCPT commands, and
47991 <varname>$recipients_count</varname> contains the total number of accepted recipients.
47992 </para>
47993 </section>
47994 <section id="SECTdatfornon">
47995 <title>Data for non-message ACLs</title>
47996 <para>
47997 <indexterm role="concept">
47998 <primary>access control lists (ACLs)</primary>
47999 <secondary>data for non-message ACL</secondary>
48000 </indexterm>
48001 <indexterm role="variable">
48002 <primary><varname>$smtp_command_argument</varname></primary>
48003 </indexterm>
48004 <indexterm role="variable">
48005 <primary><varname>$smtp_command</varname></primary>
48006 </indexterm>
48007 When an ACL is being run for AUTH, EHLO, ETRN, EXPN, HELO, STARTTLS, or VRFY,
48008 the remainder of the SMTP command line is placed in <varname>$smtp_command_argument</varname>,
48009 and the entire SMTP command is available in <varname>$smtp_command</varname>.
48010 These variables can be tested using a <option>condition</option> condition. For example,
48011 here is an ACL for use with AUTH, which insists that either the session is
48012 encrypted, or the CRAM-MD5 authentication method is used. In other words, it
48013 does not permit authentication methods that use cleartext passwords on
48014 unencrypted connections.
48015 </para>
48016 <literallayout class="monospaced">
48017 acl_check_auth:
48018   accept encrypted = *
48019   accept condition = ${if eq{${uc:$smtp_command_argument}}\
48020                      {CRAM-MD5}}
48021   deny   message   = TLS encryption or CRAM-MD5 required
48022 </literallayout>
48023 <para>
48024 (Another way of applying this restriction is to arrange for the authenticators
48025 that use cleartext passwords not to be advertised when the connection is not
48026 encrypted. You can use the generic <option>server_advertise_condition</option> authenticator
48027 option to do this.)
48028 </para>
48029 </section>
48030 <section id="SECID199">
48031 <title>Format of an ACL</title>
48032 <para>
48033 <indexterm role="concept">
48034 <primary>access control lists (ACLs)</primary>
48035 <secondary>format of</secondary>
48036 </indexterm>
48037 <indexterm role="concept">
48038 <primary>access control lists (ACLs)</primary>
48039 <secondary>verbs, definition of</secondary>
48040 </indexterm>
48041 An individual ACL consists of a number of statements. Each statement starts
48042 with a verb, optionally followed by a number of conditions and <quote>modifiers</quote>.
48043 Modifiers can change the way the verb operates, define error and log messages,
48044 set variables, insert delays, and vary the processing of accepted messages.
48045 </para>
48046 <para>
48047 If all the conditions are met, the verb is obeyed. The same condition may be
48048 used (with different arguments) more than once in the same statement. This
48049 provides a means of specifying an <quote>and</quote> conjunction between conditions. For
48050 example:
48051 </para>
48052 <literallayout class="monospaced">
48053 deny  dnslists = list1.example
48054 dnslists = list2.example
48055 </literallayout>
48056 <para>
48057 If there are no conditions, the verb is always obeyed. Exim stops evaluating
48058 the conditions and modifiers when it reaches a condition that fails. What
48059 happens then depends on the verb (and in one case, on a special modifier). Not
48060 all the conditions make sense at every testing point. For example, you cannot
48061 test a sender address in the ACL that is run for a VRFY command.
48062 </para>
48063 </section>
48064 <section id="SECID200">
48065 <title>ACL verbs</title>
48066 <para>
48067 The ACL verbs are as follows:
48068 </para>
48069 <itemizedlist>
48070 <listitem>
48071 <para>
48072 <indexterm role="concept">
48073 <primary><option>accept</option> ACL verb</primary>
48074 </indexterm>
48075 <option>accept</option>: If all the conditions are met, the ACL returns <quote>accept</quote>. If any
48076 of the conditions are not met, what happens depends on whether <option>endpass</option>
48077 appears among the conditions (for syntax see below). If the failing condition
48078 is before <option>endpass</option>, control is passed to the next ACL statement; if it is
48079 after <option>endpass</option>, the ACL returns <quote>deny</quote>. Consider this statement, used to
48080 check a RCPT command:
48081 </para>
48082 <literallayout class="monospaced">
48083 accept domains = +local_domains
48084 endpass
48085 verify = recipient
48086 </literallayout>
48087 <para>
48088 If the recipient domain does not match the <option>domains</option> condition, control
48089 passes to the next statement. If it does match, the recipient is verified, and
48090 the command is accepted if verification succeeds. However, if verification
48091 fails, the ACL yields <quote>deny</quote>, because the failing condition is after
48092 <option>endpass</option>.
48093 </para>
48094 <para>
48095 The <option>endpass</option> feature has turned out to be confusing to many people, so its
48096 use is not recommended nowadays. It is always possible to rewrite an ACL so
48097 that <option>endpass</option> is not needed, and it is no longer used in the default
48098 configuration.
48099 </para>
48100 <para>
48101 <indexterm role="concept">
48102 <primary><option>message</option> ACL modifier</primary>
48103 <secondary>with <option>accept</option></secondary>
48104 </indexterm>
48105 If a <option>message</option> modifier appears on an <option>accept</option> statement, its action
48106 depends on whether or not <option>endpass</option> is present. In the absence of <option>endpass</option>
48107 (when an <option>accept</option> verb either accepts or passes control to the next
48108 statement), <option>message</option> can be used to vary the message that is sent when an
48109 SMTP command is accepted. For example, in a RCPT ACL you could have:
48110 </para>
48111 <literallayout>
48112 <literal>accept  </literal>&lt;<emphasis>some conditions</emphasis>&gt;
48113 <literal>        message = OK, I will allow you through today</literal>
48114 </literallayout>
48115 <para>
48116 You can specify an SMTP response code, optionally followed by an <quote>extended
48117 response code</quote> at the start of the message, but the first digit must be the
48118 same as would be sent by default, which is 2 for an <option>accept</option> verb.
48119 </para>
48120 <para>
48121 If <option>endpass</option> is present in an <option>accept</option> statement, <option>message</option> specifies
48122 an error message that is used when access is denied. This behaviour is retained
48123 for backward compatibility, but current <quote>best practice</quote> is to avoid the use
48124 of <option>endpass</option>.
48125 </para>
48126 </listitem>
48127 <listitem>
48128 <para>
48129 <indexterm role="concept">
48130 <primary><option>defer</option> ACL verb</primary>
48131 </indexterm>
48132 <option>defer</option>: If all the conditions are true, the ACL returns <quote>defer</quote> which, in
48133 an SMTP session, causes a 4<emphasis>xx</emphasis> response to be given. For a non-SMTP ACL,
48134 <option>defer</option> is the same as <option>deny</option>, because there is no way of sending a
48135 temporary error. For a RCPT command, <option>defer</option> is much the same as using a
48136 <command>redirect</command> router and <literal>:defer:</literal> while verifying, but the <option>defer</option> verb can
48137 be used in any ACL, and even for a recipient it might be a simpler approach.
48138 </para>
48139 </listitem>
48140 <listitem>
48141 <para>
48142 <indexterm role="concept">
48143 <primary><option>deny</option> ACL verb</primary>
48144 </indexterm>
48145 <option>deny</option>: If all the conditions are met, the ACL returns <quote>deny</quote>. If any of
48146 the conditions are not met, control is passed to the next ACL statement. For
48147 example,
48148 </para>
48149 <literallayout class="monospaced">
48150 deny dnslists = blackholes.mail-abuse.org
48151 </literallayout>
48152 <para>
48153 rejects commands from hosts that are on a DNS black list.
48154 </para>
48155 </listitem>
48156 <listitem>
48157 <para>
48158 <indexterm role="concept">
48159 <primary><option>discard</option> ACL verb</primary>
48160 </indexterm>
48161 <option>discard</option>: This verb behaves like <option>accept</option>, except that it returns
48162 <quote>discard</quote> from the ACL instead of <quote>accept</quote>. It is permitted only on ACLs
48163 that are concerned with receiving messages. When all the conditions are true,
48164 the sending entity receives a <quote>success</quote> response. However, <option>discard</option> causes
48165 recipients to be discarded. If it is used in an ACL for RCPT, just the one
48166 recipient is discarded; if used for MAIL, DATA or in the non-SMTP ACL, all the
48167 message&#x2019;s recipients are discarded. Recipients that are discarded before DATA
48168 do not appear in the log line when the <option>received_recipients</option> log selector is set.
48169 </para>
48170 <para>
48171 If the <option>log_message</option> modifier is set when <option>discard</option> operates,
48172 its contents are added to the line that is automatically written to the log.
48173 The <option>message</option> modifier operates exactly as it does for <option>accept</option>.
48174 </para>
48175 </listitem>
48176 <listitem>
48177 <para>
48178 <indexterm role="concept">
48179 <primary><option>drop</option> ACL verb</primary>
48180 </indexterm>
48181 <option>drop</option>: This verb behaves like <option>deny</option>, except that an SMTP connection is
48182 forcibly closed after the 5<emphasis>xx</emphasis> error message has been sent. For example:
48183 </para>
48184 <literallayout class="monospaced">
48185 drop   message   = I don't take more than 20 RCPTs
48186        condition = ${if &gt; {$rcpt_count}{20}}
48187 </literallayout>
48188 <para>
48189 There is no difference between <option>deny</option> and <option>drop</option> for the connect-time ACL.
48190 The connection is always dropped after sending a 550 response.
48191 </para>
48192 </listitem>
48193 <listitem>
48194 <para>
48195 <indexterm role="concept">
48196 <primary><option>require</option> ACL verb</primary>
48197 </indexterm>
48198 <option>require</option>: If all the conditions are met, control is passed to the next ACL
48199 statement. If any of the conditions are not met, the ACL returns <quote>deny</quote>. For
48200 example, when checking a RCPT command,
48201 </para>
48202 <literallayout class="monospaced">
48203 require message = Sender did not verify
48204         verify  = sender
48205 </literallayout>
48206 <para>
48207 passes control to subsequent statements only if the message&#x2019;s sender can be
48208 verified. Otherwise, it rejects the command. Note the positioning of the
48209 <option>message</option> modifier, before the <option>verify</option> condition. The reason for this is
48210 discussed in section <xref linkend="SECTcondmodproc"/>.
48211 </para>
48212 </listitem>
48213 <listitem>
48214 <para>
48215 <indexterm role="concept">
48216 <primary><option>warn</option> ACL verb</primary>
48217 </indexterm>
48218 <option>warn</option>: If all the conditions are true, a line specified by the
48219 <option>log_message</option> modifier is written to Exim&#x2019;s main log. Control always passes
48220 to the next ACL statement. If any condition is false, the log line is not
48221 written. If an identical log line is requested several times in the same
48222 message, only one copy is actually written to the log. If you want to force
48223 duplicates to be written, use the <option>logwrite</option> modifier instead.
48224 </para>
48225 <para>
48226 If <option>log_message</option> is not present, a <option>warn</option> verb just checks its conditions
48227 and obeys any <quote>immediate</quote> modifiers (such as <option>control</option>, <option>set</option>,
48228 <option>logwrite</option>, and <option>add_header</option>) that appear before the first failing
48229 condition. There is more about adding header lines in section
48230 <xref linkend="SECTaddheadacl"/>.
48231 </para>
48232 <para>
48233 If any condition on a <option>warn</option> statement cannot be completed (that is, there is
48234 some sort of defer), the log line specified by <option>log_message</option> is not written.
48235 This does not include the case of a forced failure from a lookup, which
48236 is considered to be a successful completion. After a defer, no further
48237 conditions or modifiers in the <option>warn</option> statement are processed. The incident
48238 is logged, and the ACL continues to be processed, from the next statement
48239 onwards.
48240 </para>
48241 <para>
48242 <indexterm role="variable">
48243 <primary><varname>$acl_verify_message</varname></primary>
48244 </indexterm>
48245 When one of the <option>warn</option> conditions is an address verification that fails, the
48246 text of the verification failure message is in <varname>$acl_verify_message</varname>. If you
48247 want this logged, you must set it up explicitly. For example:
48248 </para>
48249 <literallayout class="monospaced">
48250 warn   !verify = sender
48251        log_message = sender verify failed: $acl_verify_message
48252 </literallayout>
48253 </listitem>
48254 </itemizedlist>
48255 <para>
48256 At the end of each ACL there is an implicit unconditional <option>deny</option>.
48257 </para>
48258 <para>
48259 As you can see from the examples above, the conditions and modifiers are
48260 written one to a line, with the first one on the same line as the verb, and
48261 subsequent ones on following lines. If you have a very long condition, you can
48262 continue it onto several physical lines by the usual backslash continuation
48263 mechanism. It is conventional to align the conditions vertically.
48264 </para>
48265 </section>
48266 <section id="SECTaclvariables">
48267 <title>ACL variables</title>
48268 <para>
48269 <indexterm role="concept">
48270 <primary>access control lists (ACLs)</primary>
48271 <secondary>variables</secondary>
48272 </indexterm>
48273 There are some special variables that can be set during ACL processing. They
48274 can be used to pass information between different ACLs, different invocations
48275 of the same ACL in the same SMTP connection, and between ACLs and the routers,
48276 transports, and filters that are used to deliver a message. The names of these
48277 variables must begin with <varname>$acl_c</varname> or <varname>$acl_m</varname>, followed either by a digit or
48278 an underscore, but the remainder of the name can be any sequence of
48279 alphanumeric characters and underscores that you choose. There is no limit on
48280 the number of ACL variables. The two sets act as follows:
48281 </para>
48282 <itemizedlist>
48283 <listitem>
48284 <para>
48285 The values of those variables whose names begin with <varname>$acl_c</varname> persist
48286 throughout an SMTP connection. They are never reset. Thus, a value that is set
48287 while receiving one message is still available when receiving the next message
48288 on the same SMTP connection.
48289 </para>
48290 </listitem>
48291 <listitem>
48292 <para>
48293 The values of those variables whose names begin with <varname>$acl_m</varname> persist only
48294 while a message is being received. They are reset afterwards. They are also
48295 reset by MAIL, RSET, EHLO, HELO, and after starting up a TLS session.
48296 </para>
48297 </listitem>
48298 </itemizedlist>
48299 <para>
48300 When a message is accepted, the current values of all the ACL variables are
48301 preserved with the message and are subsequently made available at delivery
48302 time. The ACL variables are set by a modifier called <option>set</option>. For example:
48303 </para>
48304 <literallayout class="monospaced">
48305 accept hosts = whatever
48306        set acl_m4 = some value
48307 accept authenticated = *
48308        set acl_c_auth = yes
48309 </literallayout>
48310 <para>
48311 <emphasis role="bold">Note</emphasis>: A leading dollar sign is not used when naming a variable that is to
48312 be set. If you want to set a variable without taking any action, you can use a
48313 <option>warn</option> verb without any other modifiers or conditions.
48314 </para>
48315 <para>
48316 <indexterm role="option">
48317 <primary><option>strict_acl_vars</option></primary>
48318 </indexterm>
48319 What happens if a syntactically valid but undefined ACL variable is
48320 referenced depends on the setting of the <option>strict_acl_vars</option> option. If it is
48321 false (the default), an empty string is substituted; if it is true, an
48322 error is generated.
48323 </para>
48324 <para>
48325 Versions of Exim before 4.64 have a limited set of numbered variables, but
48326 their names are compatible, so there is no problem with upgrading.
48327 </para>
48328 </section>
48329 <section id="SECTcondmodproc">
48330 <title>Condition and modifier processing</title>
48331 <para>
48332 <indexterm role="concept">
48333 <primary>access control lists (ACLs)</primary>
48334 <secondary>conditions; processing</secondary>
48335 </indexterm>
48336 <indexterm role="concept">
48337 <primary>access control lists (ACLs)</primary>
48338 <secondary>modifiers; processing</secondary>
48339 </indexterm>
48340 An exclamation mark preceding a condition negates its result. For example:
48341 </para>
48342 <literallayout class="monospaced">
48343 deny   domains = *.dom.example
48344       !verify  = recipient
48345 </literallayout>
48346 <para>
48347 causes the ACL to return <quote>deny</quote> if the recipient domain ends in
48348 <emphasis>dom.example</emphasis> and the recipient address cannot be verified. Sometimes
48349 negation can be used on the right-hand side of a condition. For example, these
48350 two statements are equivalent:
48351 </para>
48352 <literallayout class="monospaced">
48353 deny  hosts = !192.168.3.4
48354 deny !hosts =  192.168.3.4
48355 </literallayout>
48356 <para>
48357 However, for many conditions (<option>verify</option> being a good example), only left-hand
48358 side negation of the whole condition is possible.
48359 </para>
48360 <para>
48361 The arguments of conditions and modifiers are expanded. A forced failure
48362 of an expansion causes a condition to be ignored, that is, it behaves as if the
48363 condition is true. Consider these two statements:
48364 </para>
48365 <literallayout class="monospaced">
48366 accept  senders = ${lookup{$host_name}lsearch\
48367                   {/some/file}{$value}fail}
48368 accept  senders = ${lookup{$host_name}lsearch\
48369                   {/some/file}{$value}{}}
48370 </literallayout>
48371 <para>
48372 Each attempts to look up a list of acceptable senders. If the lookup succeeds,
48373 the returned list is searched, but if the lookup fails the behaviour is
48374 different in the two cases. The <option>fail</option> in the first statement causes the
48375 condition to be ignored, leaving no further conditions. The <option>accept</option> verb
48376 therefore succeeds. The second statement, however, generates an empty list when
48377 the lookup fails. No sender can match an empty list, so the condition fails,
48378 and therefore the <option>accept</option> also fails.
48379 </para>
48380 <para>
48381 ACL modifiers appear mixed in with conditions in ACL statements. Some of them
48382 specify actions that are taken as the conditions for a statement are checked;
48383 others specify text for messages that are used when access is denied or a
48384 warning is generated. The <option>control</option> modifier affects the way an incoming
48385 message is handled.
48386 </para>
48387 <para>
48388 The positioning of the modifiers in an ACL statement important, because the
48389 processing of a verb ceases as soon as its outcome is known. Only those
48390 modifiers that have already been encountered will take effect. For example,
48391 consider this use of the <option>message</option> modifier:
48392 </para>
48393 <literallayout class="monospaced">
48394 require message = Can't verify sender
48395         verify  = sender
48396         message = Can't verify recipient
48397         verify  = recipient
48398         message = This message cannot be used
48399 </literallayout>
48400 <para>
48401 If sender verification fails, Exim knows that the result of the statement is
48402 <quote>deny</quote>, so it goes no further. The first <option>message</option> modifier has been seen,
48403 so its text is used as the error message. If sender verification succeeds, but
48404 recipient verification fails, the second message is used. If recipient
48405 verification succeeds, the third message becomes <quote>current</quote>, but is never used
48406 because there are no more conditions to cause failure.
48407 </para>
48408 <para>
48409 For the <option>deny</option> verb, on the other hand, it is always the last <option>message</option>
48410 modifier that is used, because all the conditions must be true for rejection to
48411 happen. Specifying more than one <option>message</option> modifier does not make sense, and
48412 the message can even be specified after all the conditions. For example:
48413 </para>
48414 <literallayout class="monospaced">
48415 deny   hosts = ...
48416       !senders = *@my.domain.example
48417        message = Invalid sender from client host
48418 </literallayout>
48419 <para>
48420 The <quote>deny</quote> result does not happen until the end of the statement is reached,
48421 by which time Exim has set up the message.
48422 </para>
48423 </section>
48424 <section id="SECTACLmodi">
48425 <title>ACL modifiers</title>
48426 <para>
48427 <indexterm role="concept">
48428 <primary>access control lists (ACLs)</primary>
48429 <secondary>modifiers; list of</secondary>
48430 </indexterm>
48431 The ACL modifiers are as follows:
48432 </para>
48433 <variablelist>
48434 <varlistentry>
48435 <term><emphasis role="bold">add_header</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
48436 <listitem>
48437 <para>
48438 This modifier specifies one or more header lines that are to be added to an
48439 incoming message, assuming, of course, that the message is ultimately
48440 accepted. For details, see section <xref linkend="SECTaddheadacl"/>.
48441 </para>
48442 </listitem></varlistentry>
48443 <varlistentry>
48444 <term><emphasis role="bold">continue</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
48445 <listitem>
48446 <para>
48447 <indexterm role="concept">
48448 <primary><option>continue</option> ACL modifier</primary>
48449 </indexterm>
48450 <indexterm role="concept">
48451 <primary>database</primary>
48452 <secondary>updating in ACL</secondary>
48453 </indexterm>
48454 This modifier does nothing of itself, and processing of the ACL always
48455 continues with the next condition or modifier. The value of <option>continue</option> is in
48456 the side effects of expanding its argument. Typically this could be used to
48457 update a database. It is really just a syntactic tidiness, to avoid having to
48458 write rather ugly lines like this:
48459 </para>
48460 <literallayout>
48461 <literal>condition = ${if eq{0}{</literal>&lt;<emphasis>some expansion</emphasis>&gt;<literal>}{true}{true}}</literal>
48462 </literallayout>
48463 <para>
48464 Instead, all you need is
48465 </para>
48466 <literallayout>
48467 <literal>continue = </literal>&lt;<emphasis>some expansion</emphasis>&gt;
48468 </literallayout>
48469 </listitem></varlistentry>
48470 <varlistentry>
48471 <term><emphasis role="bold">control</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
48472 <listitem>
48473 <para>
48474 <indexterm role="concept">
48475 <primary><option>control</option> ACL modifier</primary>
48476 </indexterm>
48477 This modifier affects the subsequent processing of the SMTP connection or of an
48478 incoming message that is accepted. The effect of the first type of control
48479 lasts for the duration of the connection, whereas the effect of the second type
48480 lasts only until the current message has been received. The message-specific
48481 controls always apply to the whole message, not to individual recipients,
48482 even if the <option>control</option> modifier appears in a RCPT ACL.
48483 </para>
48484 <para>
48485 As there are now quite a few controls that can be applied, they are described
48486 separately in section <xref linkend="SECTcontrols"/>. The <option>control</option> modifier can be used
48487 in several different ways. For example:
48488 </para>
48489 <itemizedlist>
48490 <listitem>
48491 <para>
48492 It can be at the end of an <option>accept</option> statement:
48493 </para>
48494 <literallayout class="monospaced">
48495     accept  ...some conditions
48496             control = queue_only
48497 </literallayout>
48498 <para>
48499 In this case, the control is applied when this statement yields <quote>accept</quote>, in
48500 other words, when the conditions are all true.
48501 </para>
48502 </listitem>
48503 <listitem>
48504 <para>
48505 It can be in the middle of an <option>accept</option> statement:
48506 </para>
48507 <literallayout class="monospaced">
48508     accept  ...some conditions...
48509             control = queue_only
48510             ...some more conditions...
48511 </literallayout>
48512 <para>
48513 If the first set of conditions are true, the control is applied, even if the
48514 statement does not accept because one of the second set of conditions is false.
48515 In this case, some subsequent statement must yield <quote>accept</quote> for the control
48516 to be relevant.
48517 </para>
48518 </listitem>
48519 <listitem>
48520 <para>
48521 It can be used with <option>warn</option> to apply the control, leaving the
48522 decision about accepting or denying to a subsequent verb. For
48523 example:
48524 </para>
48525 <literallayout class="monospaced">
48526     warn    ...some conditions...
48527             control = freeze
48528     accept  ...
48529 </literallayout>
48530 <para>
48531 This example of <option>warn</option> does not contain <option>message</option>, <option>log_message</option>, or
48532 <option>logwrite</option>, so it does not add anything to the message and does not write a
48533 log entry.
48534 </para>
48535 </listitem>
48536 <listitem>
48537 <para>
48538 If you want to apply a control unconditionally, you can use it with a
48539 <option>require</option> verb. For example:
48540 </para>
48541 <literallayout class="monospaced">
48542     require  control = no_multiline_responses
48543 </literallayout>
48544 </listitem>
48545 </itemizedlist>
48546 </listitem></varlistentry>
48547 <varlistentry>
48548 <term><emphasis role="bold">delay</emphasis>&nbsp;=&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
48549 <listitem>
48550 <para>
48551 <indexterm role="concept">
48552 <primary><option>delay</option> ACL modifier</primary>
48553 </indexterm>
48554 <indexterm role="option">
48555 <primary><option>-bh</option></primary>
48556 </indexterm>
48557 This modifier may appear in any ACL. It causes Exim to wait for the time
48558 interval before proceeding. However, when testing Exim using the <option>-bh</option>
48559 option, the delay is not actually imposed (an appropriate message is output
48560 instead). The time is given in the usual Exim notation, and the delay happens
48561 as soon as the modifier is processed. In an SMTP session, pending output is
48562 flushed before the delay is imposed.
48563 </para>
48564 <para>
48565 Like <option>control</option>, <option>delay</option> can be used with <option>accept</option> or <option>deny</option>, for
48566 example:
48567 </para>
48568 <literallayout class="monospaced">
48569 deny    ...some conditions...
48570         delay = 30s
48571 </literallayout>
48572 <para>
48573 The delay happens if all the conditions are true, before the statement returns
48574 <quote>deny</quote>. Compare this with:
48575 </para>
48576 <literallayout class="monospaced">
48577 deny    delay = 30s
48578         ...some conditions...
48579 </literallayout>
48580 <para>
48581 which waits for 30s before processing the conditions. The <option>delay</option> modifier
48582 can also be used with <option>warn</option> and together with <option>control</option>:
48583 </para>
48584 <literallayout class="monospaced">
48585 warn    ...some conditions...
48586         delay = 2m
48587         control = freeze
48588 accept  ...
48589 </literallayout>
48590 <para>
48591 If <option>delay</option> is encountered when the SMTP PIPELINING extension is in use,
48592 responses to several commands are no longer buffered and sent in one packet (as
48593 they would normally be) because all output is flushed before imposing the
48594 delay. This optimization is disabled so that a number of small delays do not
48595 appear to the client as one large aggregated delay that might provoke an
48596 unwanted timeout. You can, however, disable output flushing for <option>delay</option> by
48597 using a <option>control</option> modifier to set <option>no_delay_flush</option>.
48598 </para>
48599 </listitem></varlistentry>
48600 <varlistentry>
48601 <term><emphasis role="bold">endpass</emphasis></term>
48602 <listitem>
48603 <para>
48604 <indexterm role="concept">
48605 <primary><option>endpass</option> ACL modifier</primary>
48606 </indexterm>
48607 This modifier, which has no argument, is recognized only in <option>accept</option> and
48608 <option>discard</option> statements. It marks the boundary between the conditions whose
48609 failure causes control to pass to the next statement, and the conditions whose
48610 failure causes the ACL to return <quote>deny</quote>. This concept has proved to be
48611 confusing to some people, so the use of <option>endpass</option> is no longer recommended as
48612 <quote>best practice</quote>. See the description of <option>accept</option> above for more details.
48613 </para>
48614 </listitem></varlistentry>
48615 <varlistentry>
48616 <term><emphasis role="bold">log_message</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
48617 <listitem>
48618 <para>
48619 <indexterm role="concept">
48620 <primary><option>log_message</option> ACL modifier</primary>
48621 </indexterm>
48622 This modifier sets up a message that is used as part of the log message if the
48623 ACL denies access or a <option>warn</option> statement&#x2019;s conditions are true. For example:
48624 </para>
48625 <literallayout class="monospaced">
48626 require log_message = wrong cipher suite $tls_cipher
48627         encrypted   = DES-CBC3-SHA
48628 </literallayout>
48629 <para>
48630 <option>log_message</option> is also used when recipients are discarded by <option>discard</option>. For
48631 example:
48632 </para>
48633 <literallayout>
48634 <literal>discard </literal>&lt;<emphasis>some conditions</emphasis>&gt;
48635 <literal>        log_message = Discarded $local_part@$domain because...</literal>
48636 </literallayout>
48637 <para>
48638 When access is denied, <option>log_message</option> adds to any underlying error message
48639 that may exist because of a condition failure. For example, while verifying a
48640 recipient address, a <emphasis>:fail:</emphasis> redirection might have already set up a
48641 message.
48642 </para>
48643 <para>
48644 The message may be defined before the conditions to which it applies, because
48645 the string expansion does not happen until Exim decides that access is to be
48646 denied. This means that any variables that are set by the condition are
48647 available for inclusion in the message. For example, the <varname>$dnslist_</varname>&lt;<emphasis>xxx</emphasis>&gt;
48648 variables are set after a DNS black list lookup succeeds. If the expansion of
48649 <option>log_message</option> fails, or if the result is an empty string, the modifier is
48650 ignored.
48651 </para>
48652 <para>
48653 <indexterm role="variable">
48654 <primary><varname>$acl_verify_message</varname></primary>
48655 </indexterm>
48656 If you want to use a <option>warn</option> statement to log the result of an address
48657 verification, you can use <varname>$acl_verify_message</varname> to include the verification
48658 error message.
48659 </para>
48660 <para>
48661 If <option>log_message</option> is used with a <option>warn</option> statement, <quote>Warning:</quote> is added to
48662 the start of the logged message. If the same warning log message is requested
48663 more than once while receiving  a single email message, only one copy is
48664 actually logged. If you want to log multiple copies, use <option>logwrite</option> instead
48665 of <option>log_message</option>. In the absence of <option>log_message</option> and <option>logwrite</option>, nothing
48666 is logged for a successful <option>warn</option> statement.
48667 </para>
48668 <para>
48669 If <option>log_message</option> is not present and there is no underlying error message (for
48670 example, from the failure of address verification), but <option>message</option> is present,
48671 the <option>message</option> text is used for logging rejections. However, if any text for
48672 logging contains newlines, only the first line is logged. In the absence of
48673 both <option>log_message</option> and <option>message</option>, a default built-in message is used for
48674 logging rejections.
48675 </para>
48676 </listitem></varlistentry>
48677 <varlistentry>
48678 <term><emphasis role="bold">log_reject_target</emphasis>&nbsp;=&nbsp;&lt;<emphasis>log name list</emphasis>&gt;</term>
48679 <listitem>
48680 <para>
48681 <indexterm role="concept">
48682 <primary><option>log_reject_target</option> ACL modifier</primary>
48683 </indexterm>
48684 <indexterm role="concept">
48685 <primary>logging in ACL</primary>
48686 <secondary>specifying which log</secondary>
48687 </indexterm>
48688 This modifier makes it possible to specify which logs are used for messages
48689 about ACL rejections. Its argument is a colon-separated list of words that can
48690 be <quote>main</quote>, <quote>reject</quote>, or <quote>panic</quote>. The default is <literal>main:reject</literal>. The list
48691 may be empty, in which case a rejection is not logged at all. For example, this
48692 ACL fragment writes no logging information when access is denied:
48693 </para>
48694 <literallayout>
48695 <literal>deny </literal>&lt;<emphasis>some conditions</emphasis>&gt;
48696 <literal>     log_reject_target =</literal>
48697 </literallayout>
48698 <para>
48699 This modifier can be used in SMTP and non-SMTP ACLs. It applies to both
48700 permanent and temporary rejections. Its effect lasts for the rest of the
48701 current ACL.
48702 </para>
48703 </listitem></varlistentry>
48704 <varlistentry>
48705 <term><emphasis role="bold">logwrite</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
48706 <listitem>
48707 <para>
48708 <indexterm role="concept">
48709 <primary><option>logwrite</option> ACL modifier</primary>
48710 </indexterm>
48711 <indexterm role="concept">
48712 <primary>logging in ACL</primary>
48713 <secondary>immediate</secondary>
48714 </indexterm>
48715 This modifier writes a message to a log file as soon as it is encountered when
48716 processing an ACL. (Compare <option>log_message</option>, which, except in the case of
48717 <option>warn</option> and <option>discard</option>, is used only if the ACL statement denies
48718 access.) The <option>logwrite</option> modifier can be used to log special incidents in
48719 ACLs. For example:
48720 </para>
48721 <literallayout>
48722 <literal>accept </literal>&lt;<emphasis>some special conditions</emphasis>&gt;
48723 <literal>       control  = freeze</literal>
48724 <literal>       logwrite = froze message because ...</literal>
48725 </literallayout>
48726 <para>
48727 By default, the message is written to the main log. However, it may begin
48728 with a colon, followed by a comma-separated list of log names, and then
48729 another colon, to specify exactly which logs are to be written. For
48730 example:
48731 </para>
48732 <literallayout class="monospaced">
48733 logwrite = :main,reject: text for main and reject logs
48734 logwrite = :panic: text for panic log only
48735 </literallayout>
48736 </listitem></varlistentry>
48737 <varlistentry>
48738 <term><emphasis role="bold">message</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
48739 <listitem>
48740 <para>
48741 <indexterm role="concept">
48742 <primary><option>message</option> ACL modifier</primary>
48743 </indexterm>
48744 This modifier sets up a text string that is expanded and used as a response
48745 message when an ACL statement terminates the ACL with an <quote>accept</quote>, <quote>deny</quote>,
48746 or <quote>defer</quote> response. (In the case of the <option>accept</option> and <option>discard</option> verbs,
48747 there is some complication if <option>endpass</option> is involved; see the description of
48748 <option>accept</option> for details.)
48749 </para>
48750 <para>
48751 The expansion of the message happens at the time Exim decides that the ACL is
48752 to end, not at the time it processes <option>message</option>. If the expansion fails, or
48753 generates an empty string, the modifier is ignored. Here is an example where
48754 <option>message</option> must be specified first, because the ACL ends with a rejection if
48755 the <option>hosts</option> condition fails:
48756 </para>
48757 <literallayout class="monospaced">
48758 require  message = Host not recognized
48759          hosts = 10.0.0.0/8
48760 </literallayout>
48761 <para>
48762 (Once a condition has failed, no further conditions or modifiers are
48763 processed.)
48764 </para>
48765 <para>
48766 <indexterm role="concept">
48767 <primary>SMTP</primary>
48768 <secondary>error codes</secondary>
48769 </indexterm>
48770 <indexterm role="option">
48771 <primary><option>smtp_banner</option></primary>
48772 </indexterm>
48773 For ACLs that are triggered by SMTP commands, the message is returned as part
48774 of the SMTP response. The use of <option>message</option> with <option>accept</option> (or <option>discard</option>)
48775 is meaningful only for SMTP, as no message is returned when a non-SMTP message
48776 is accepted. In the case of the connect ACL, accepting with a message modifier
48777 overrides the value of <option>smtp_banner</option>. For the EHLO/HELO ACL, a customized
48778 accept message may not contain more than one line (otherwise it will be
48779 truncated at the first newline and a panic logged), and it cannot affect the
48780 EHLO options.
48781 </para>
48782 <para>
48783 When SMTP is involved, the message may begin with an overriding response code,
48784 consisting of three digits optionally followed by an <quote>extended response code</quote>
48785 of the form <emphasis>n.n.n</emphasis>, each code being followed by a space. For example:
48786 </para>
48787 <literallayout class="monospaced">
48788 deny  message = 599 1.2.3 Host not welcome
48789       hosts = 192.168.34.0/24
48790 </literallayout>
48791 <para>
48792 The first digit of the supplied response code must be the same as would be sent
48793 by default. A panic occurs if it is not. Exim uses a 550 code when it denies
48794 access, but for the predata ACL, note that the default success code is 354, not
48795 2<emphasis>xx</emphasis>.
48796 </para>
48797 <para>
48798 Notwithstanding the previous paragraph, for the QUIT ACL, unlike the others,
48799 the message modifier cannot override the 221 response code.
48800 </para>
48801 <para>
48802 The text in a <option>message</option> modifier is literal; any quotes are taken as
48803 literals, but because the string is expanded, backslash escapes are processed
48804 anyway. If the message contains newlines, this gives rise to a multi-line SMTP
48805 response.
48806 </para>
48807 <para>
48808 <indexterm role="variable">
48809 <primary><varname>$acl_verify_message</varname></primary>
48810 </indexterm>
48811 If <option>message</option> is used on a statement that verifies an address, the message
48812 specified overrides any message that is generated by the verification process.
48813 However, the original message is available in the variable
48814 <varname>$acl_verify_message</varname>, so you can incorporate it into your message if you
48815 wish. In particular, if you want the text from <option>:fail:</option> items in <command>redirect</command>
48816 routers to be passed back as part of the SMTP response, you should either not
48817 use a <option>message</option> modifier, or make use of <varname>$acl_verify_message</varname>.
48818 </para>
48819 <para>
48820 For compatibility with previous releases of Exim, a <option>message</option> modifier that
48821 is used with a <option>warn</option> verb behaves in a similar way to the <option>add_header</option>
48822 modifier, but this usage is now deprecated. However, <option>message</option> acts only when
48823 all the conditions are true, wherever it appears in an ACL command, whereas
48824 <option>add_header</option> acts as soon as it is encountered. If <option>message</option> is used with
48825 <option>warn</option> in an ACL that is not concerned with receiving a message, it has no
48826 effect.
48827 </para>
48828 </listitem></varlistentry>
48829 <varlistentry>
48830 <term><emphasis role="bold">set</emphasis>&nbsp;&lt;<emphasis>acl_name</emphasis>&gt;&nbsp;=&nbsp;&lt;<emphasis>value</emphasis>&gt;</term>
48831 <listitem>
48832 <para>
48833 <indexterm role="concept">
48834 <primary><option>set</option> ACL modifier</primary>
48835 </indexterm>
48836 This modifier puts a value into one of the ACL variables (see section
48837 <xref linkend="SECTaclvariables"/>).
48838 </para>
48839 </listitem></varlistentry>
48840 </variablelist>
48841 </section>
48842 <section id="SECTcontrols">
48843 <title>Use of the control modifier</title>
48844 <para>
48845 <indexterm role="concept">
48846 <primary><option>control</option> ACL modifier</primary>
48847 </indexterm>
48848 The <option>control</option> modifier supports the following settings:
48849 </para>
48850 <variablelist>
48851 <varlistentry>
48852 <term><emphasis role="bold">control&nbsp;=&nbsp;allow_auth_unadvertised</emphasis></term>
48853 <listitem>
48854 <para>
48855 This modifier allows a client host to use the SMTP AUTH command even when it
48856 has not been advertised in response to EHLO. Furthermore, because there are
48857 apparently some really broken clients that do this, Exim will accept AUTH after
48858 HELO (rather than EHLO) when this control is set. It should be used only if you
48859 really need it, and you should limit its use to those broken clients that do
48860 not work without it. For example:
48861 </para>
48862 <literallayout class="monospaced">
48863 warn hosts   = 192.168.34.25
48864      control = allow_auth_unadvertised
48865 </literallayout>
48866 <para>
48867 Normally, when an Exim server receives an AUTH command, it checks the name of
48868 the authentication mechanism that is given in the command to ensure that it
48869 matches an advertised mechanism. When this control is set, the check that a
48870 mechanism has been advertised is bypassed. Any configured mechanism can be used
48871 by the client. This control is permitted only in the connection and HELO ACLs.
48872 </para>
48873 </listitem></varlistentry>
48874 <varlistentry>
48875 <term><emphasis role="bold">control&nbsp;=&nbsp;caseful_local_part</emphasis></term>
48876 <term><emphasis role="bold">control&nbsp;=&nbsp;caselower_local_part</emphasis></term>
48877 <listitem>
48878 <para>
48879 <indexterm role="concept">
48880 <primary>access control lists (ACLs)</primary>
48881 <secondary>case of local part in</secondary>
48882 </indexterm>
48883 <indexterm role="concept">
48884 <primary>case of local parts</primary>
48885 </indexterm>
48886 <indexterm role="variable">
48887 <primary><varname>$local_part</varname></primary>
48888 </indexterm>
48889 These two controls are permitted only in the ACL specified by <option>acl_smtp_rcpt</option>
48890 (that is, during RCPT processing). By default, the contents of <varname>$local_part</varname>
48891 are lower cased before ACL processing. If <quote>caseful_local_part</quote> is specified,
48892 any uppercase letters in the original local part are restored in <varname>$local_part</varname>
48893 for the rest of the ACL, or until a control that sets <quote>caselower_local_part</quote>
48894 is encountered.
48895 </para>
48896 <para>
48897 These controls affect only the current recipient. Moreover, they apply only to
48898 local part handling that takes place directly in the ACL (for example, as a key
48899 in lookups). If a test to verify the recipient is obeyed, the case-related
48900 handling of the local part during the verification is controlled by the router
48901 configuration (see the <option>caseful_local_part</option> generic router option).
48902 </para>
48903 <para>
48904 This facility could be used, for example, to add a spam score to local parts
48905 containing upper case letters. For example, using <varname>$acl_m4</varname> to accumulate the
48906 spam score:
48907 </para>
48908 <literallayout class="monospaced">
48909 warn  control = caseful_local_part
48910       set acl_m4 = ${eval:\
48911                      $acl_m4 + \
48912                      ${if match{$local_part}{[A-Z]}{1}{0}}\
48913                     }
48914       control = caselower_local_part
48915 </literallayout>
48916 <para>
48917 Notice that we put back the lower cased version afterwards, assuming that
48918 is what is wanted for subsequent tests.
48919 </para>
48920 </listitem></varlistentry>
48921 <varlistentry>
48922 <term><emphasis role="bold">control&nbsp;=&nbsp;enforce_sync</emphasis></term>
48923 <term><emphasis role="bold">control&nbsp;=&nbsp;no_enforce_sync</emphasis></term>
48924 <listitem>
48925 <para>
48926 <indexterm role="concept">
48927 <primary>SMTP</primary>
48928 <secondary>synchronization checking</secondary>
48929 </indexterm>
48930 <indexterm role="concept">
48931 <primary>synchronization checking in SMTP</primary>
48932 </indexterm>
48933 These controls make it possible to be selective about when SMTP synchronization
48934 is enforced. The global option <option>smtp_enforce_sync</option> specifies the initial
48935 state of the switch (it is true by default). See the description of this option
48936 in chapter <xref linkend="CHAPmainconfig"/> for details of SMTP synchronization checking.
48937 </para>
48938 <para>
48939 The effect of these two controls lasts for the remainder of the SMTP
48940 connection. They can appear in any ACL except the one for the non-SMTP
48941 messages. The most straightforward place to put them is in the ACL defined by
48942 <option>acl_smtp_connect</option>, which is run at the start of an incoming SMTP connection,
48943 before the first synchronization check. The expected use is to turn off the
48944 synchronization checks for badly-behaved hosts that you nevertheless need to
48945 work with.
48946 </para>
48947 </listitem></varlistentry>
48948 <varlistentry>
48949 <term><emphasis role="bold">control&nbsp;=&nbsp;fakedefer/</emphasis>&lt;<emphasis>message</emphasis>&gt;</term>
48950 <listitem>
48951 <para>
48952 <indexterm role="concept">
48953 <primary>fake defer</primary>
48954 </indexterm>
48955 <indexterm role="concept">
48956 <primary>defer, fake</primary>
48957 </indexterm>
48958 This control works in exactly the same way as <option>fakereject</option> (described below)
48959 except that it causes an SMTP 450 response after the message data instead of a
48960 550 response. You must take care when using <option>fakedefer</option> because it causes the
48961 messages to be duplicated when the sender retries. Therefore, you should not
48962 use <option>fakedefer</option> if the message is to be delivered normally.
48963 </para>
48964 </listitem></varlistentry>
48965 <varlistentry>
48966 <term><emphasis role="bold">control&nbsp;=&nbsp;fakereject/</emphasis>&lt;<emphasis>message</emphasis>&gt;</term>
48967 <listitem>
48968 <para>
48969 <indexterm role="concept">
48970 <primary>fake rejection</primary>
48971 </indexterm>
48972 <indexterm role="concept">
48973 <primary>rejection, fake</primary>
48974 </indexterm>
48975 This control is permitted only for the MAIL, RCPT, and DATA ACLs, in other
48976 words, only when an SMTP message is being received. If Exim accepts the
48977 message, instead the final 250 response, a 550 rejection message is sent.
48978 However, Exim proceeds to deliver the message as normal. The control applies
48979 only to the current message, not to any subsequent ones that may be received in
48980 the same SMTP connection.
48981 </para>
48982 <para>
48983 The text for the 550 response is taken from the <option>control</option> modifier. If no
48984 message is supplied, the following is used:
48985 </para>
48986 <literallayout class="monospaced">
48987 550-Your message has been rejected but is being
48988 550-kept for evaluation.
48989 550-If it was a legitimate message, it may still be
48990 550 delivered to the target recipient(s).
48991 </literallayout>
48992 <para>
48993 This facility should be used with extreme caution.
48994 </para>
48995 </listitem></varlistentry>
48996 <varlistentry>
48997 <term><emphasis role="bold">control&nbsp;=&nbsp;freeze</emphasis></term>
48998 <listitem>
48999 <para>
49000 <indexterm role="concept">
49001 <primary>frozen messages</primary>
49002 <secondary>forcing in ACL</secondary>
49003 </indexterm>
49004 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
49005 other words, only when a message is being received. If the message is accepted,
49006 it is placed on Exim&#x2019;s queue and frozen. The control applies only to the
49007 current message, not to any subsequent ones that may be received in the same
49008 SMTP connection.
49009 </para>
49010 <para>
49011 This modifier can optionally be followed by <literal>/no_tell</literal>. If the global option
49012 <option>freeze_tell</option> is set, it is ignored for the current message (that is, nobody
49013 is told about the freezing), provided all the <emphasis role="bold">control=freeze</emphasis> modifiers that
49014 are obeyed for the current message have the <literal>/no_tell</literal> option.
49015 </para>
49016 </listitem></varlistentry>
49017 <varlistentry>
49018 <term><emphasis role="bold">control&nbsp;=&nbsp;no_delay_flush</emphasis></term>
49019 <listitem>
49020 <para>
49021 <indexterm role="concept">
49022 <primary>SMTP</primary>
49023 <secondary>output flushing, disabling for delay</secondary>
49024 </indexterm>
49025 Exim normally flushes SMTP output before implementing a delay in an ACL, to
49026 avoid unexpected timeouts in clients when the SMTP PIPELINING extension is in
49027 use. This control, as long as it is encountered before the <option>delay</option> modifier,
49028 disables such output flushing.
49029 </para>
49030 </listitem></varlistentry>
49031 <varlistentry>
49032 <term><emphasis role="bold">control&nbsp;=&nbsp;no_callout_flush</emphasis></term>
49033 <listitem>
49034 <para>
49035 <indexterm role="concept">
49036 <primary>SMTP</primary>
49037 <secondary>output flushing, disabling for callout</secondary>
49038 </indexterm>
49039 Exim normally flushes SMTP output before performing a callout in an ACL, to
49040 avoid unexpected timeouts in clients when the SMTP PIPELINING extension is in
49041 use. This control, as long as it is encountered before the <option>verify</option> condition
49042 that causes the callout, disables such output flushing.
49043 </para>
49044 </listitem></varlistentry>
49045 <varlistentry>
49046 <term><emphasis role="bold">control&nbsp;=&nbsp;no_mbox_unspool</emphasis></term>
49047 <listitem>
49048 <para>
49049 This control is available when Exim is compiled with the content scanning
49050 extension. Content scanning may require a copy of the current message, or parts
49051 of it, to be written in <quote>mbox format</quote> to a spool file, for passing to a virus
49052 or spam scanner. Normally, such copies are deleted when they are no longer
49053 needed. If this control is set, the copies are not deleted. The control applies
49054 only to the current message, not to any subsequent ones that may be received in
49055 the same SMTP connection. It is provided for debugging purposes and is unlikely
49056 to be useful in production.
49057 </para>
49058 </listitem></varlistentry>
49059 <varlistentry>
49060 <term><emphasis role="bold">control&nbsp;=&nbsp;no_multiline_responses</emphasis></term>
49061 <listitem>
49062 <para>
49063 <indexterm role="concept">
49064 <primary>multiline responses, suppressing</primary>
49065 </indexterm>
49066 This control is permitted for any ACL except the one for non-SMTP messages.
49067 It seems that there are broken clients in use that cannot handle multiline
49068 SMTP responses, despite the fact that RFC 821 defined them over 20 years ago.
49069 </para>
49070 <para>
49071 If this control is set, multiline SMTP responses from ACL rejections are
49072 suppressed. One way of doing this would have been to put out these responses as
49073 one long line. However, RFC 2821 specifies a maximum of 512 bytes per response
49074 (<quote>use multiline responses for more</quote> it says &ndash; ha!), and some of the
49075 responses might get close to that. So this facility, which is after all only a
49076 sop to broken clients, is implemented by doing two very easy things:
49077 </para>
49078 <itemizedlist>
49079 <listitem>
49080 <para>
49081 Extra information that is normally output as part of a rejection caused by
49082 sender verification failure is omitted. Only the final line (typically <quote>sender
49083 verification failed</quote>) is sent.
49084 </para>
49085 </listitem>
49086 <listitem>
49087 <para>
49088 If a <option>message</option> modifier supplies a multiline response, only the first
49089 line is output.
49090 </para>
49091 </listitem>
49092 </itemizedlist>
49093 <para>
49094 The setting of the switch can, of course, be made conditional on the
49095 calling host. Its effect lasts until the end of the SMTP connection.
49096 </para>
49097 </listitem></varlistentry>
49098 <varlistentry>
49099 <term><emphasis role="bold">control&nbsp;=&nbsp;no_pipelining</emphasis></term>
49100 <listitem>
49101 <para>
49102 <indexterm role="concept">
49103 <primary>PIPELINING</primary>
49104 <secondary>suppressing advertising</secondary>
49105 </indexterm>
49106 This control turns off the advertising of the PIPELINING extension to SMTP in
49107 the current session. To be useful, it must be obeyed before Exim sends its
49108 response to an EHLO command. Therefore, it should normally appear in an ACL
49109 controlled by <option>acl_smtp_connect</option> or <option>acl_smtp_helo</option>. See also
49110 <option>pipelining_advertise_hosts</option>.
49111 </para>
49112 </listitem></varlistentry>
49113 <varlistentry>
49114 <term><emphasis role="bold">control&nbsp;=&nbsp;queue_only</emphasis></term>
49115 <listitem>
49116 <para>
49117 <indexterm role="option">
49118 <primary><option>queue_only</option></primary>
49119 </indexterm>
49120 <indexterm role="concept">
49121 <primary>queueing incoming messages</primary>
49122 </indexterm>
49123 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
49124 other words, only when a message is being received. If the message is accepted,
49125 it is placed on Exim&#x2019;s queue and left there for delivery by a subsequent queue
49126 runner. No immediate delivery process is started. In other words, it has the
49127 effect as the <option>queue_only</option> global option. However, the control applies only
49128 to the current message, not to any subsequent ones that may be received in the
49129 same SMTP connection.
49130 </para>
49131 </listitem></varlistentry>
49132 <varlistentry>
49133 <term><emphasis role="bold">control&nbsp;=&nbsp;submission/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
49134 <listitem>
49135 <para>
49136 <indexterm role="concept">
49137 <primary>message</primary>
49138 <secondary>submission</secondary>
49139 </indexterm>
49140 <indexterm role="concept">
49141 <primary>submission mode</primary>
49142 </indexterm>
49143 This control is permitted only for the MAIL, RCPT, and start of data ACLs (the
49144 latter is the one defined by <option>acl_smtp_predata</option>). Setting it tells Exim that
49145 the current message is a submission from a local MUA. In this case, Exim
49146 operates in <quote>submission mode</quote>, and applies certain fixups to the message if
49147 necessary. For example, it adds a <emphasis>Date:</emphasis> header line if one is not present.
49148 This control is not permitted in the <option>acl_smtp_data</option> ACL, because that is too
49149 late (the message has already been created).
49150 </para>
49151 <para>
49152 Chapter <xref linkend="CHAPmsgproc"/> describes the processing that Exim applies to
49153 messages. Section <xref linkend="SECTsubmodnon"/> covers the processing that happens in
49154 submission mode; the available options for this control are described there.
49155 The control applies only to the current message, not to any subsequent ones
49156 that may be received in the same SMTP connection.
49157 </para>
49158 </listitem></varlistentry>
49159 <varlistentry>
49160 <term><emphasis role="bold">control&nbsp;=&nbsp;suppress_local_fixups</emphasis></term>
49161 <listitem>
49162 <para>
49163 <indexterm role="concept">
49164 <primary>submission fixups, suppressing</primary>
49165 </indexterm>
49166 This control applies to locally submitted (non TCP/IP) messages, and is the
49167 complement of <literal>control = submission</literal>. It disables the fixups that are
49168 normally applied to locally-submitted messages. Specifically:
49169 </para>
49170 <itemizedlist>
49171 <listitem>
49172 <para>
49173 Any <emphasis>Sender:</emphasis> header line is left alone (in this respect, it is a
49174 dynamic version of <option>local_sender_retain</option>).
49175 </para>
49176 </listitem>
49177 <listitem>
49178 <para>
49179 No <emphasis>Message-ID:</emphasis>, <emphasis>From:</emphasis>, or <emphasis>Date:</emphasis> header lines are added.
49180 </para>
49181 </listitem>
49182 <listitem>
49183 <para>
49184 There is no check that <emphasis>From:</emphasis> corresponds to the actual sender.
49185 </para>
49186 </listitem>
49187 </itemizedlist>
49188 <para>
49189 This control may be useful when a remotely-originated message is accepted,
49190 passed to some scanning program, and then re-submitted for delivery. It can be
49191 used only in the <option>acl_smtp_mail</option>, <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>,
49192 and <option>acl_not_smtp_start</option> ACLs, because it has to be set before the message&#x2019;s
49193 data is read.
49194 </para>
49195 <para>
49196 <emphasis role="bold">Note:</emphasis> This control applies only to the current message, not to any others
49197 that are being submitted at the same time using <option>-bs</option> or <option>-bS</option>.
49198 </para>
49199 </listitem></varlistentry>
49200 </variablelist>
49201 </section>
49202 <section id="SECTsummesfix">
49203 <title>Summary of message fixup control</title>
49204 <para>
49205 All four possibilities for message fixups can be specified:
49206 </para>
49207 <itemizedlist>
49208 <listitem>
49209 <para>
49210 Locally submitted, fixups applied: the default.
49211 </para>
49212 </listitem>
49213 <listitem>
49214 <para>
49215 Locally submitted, no fixups applied: use
49216 <literal>control = suppress_local_fixups</literal>.
49217 </para>
49218 </listitem>
49219 <listitem>
49220 <para>
49221 Remotely submitted, no fixups applied: the default.
49222 </para>
49223 </listitem>
49224 <listitem>
49225 <para>
49226 Remotely submitted, fixups applied: use <literal>control = submission</literal>.
49227 </para>
49228 </listitem>
49229 </itemizedlist>
49230 </section>
49231 <section id="SECTaddheadacl">
49232 <title>Adding header lines in ACLs</title>
49233 <para>
49234 <indexterm role="concept">
49235 <primary>header lines</primary>
49236 <secondary>adding in an ACL</secondary>
49237 </indexterm>
49238 <indexterm role="concept">
49239 <primary>header lines</primary>
49240 <secondary>position of added lines</secondary>
49241 </indexterm>
49242 <indexterm role="concept">
49243 <primary><option>message</option> ACL modifier</primary>
49244 </indexterm>
49245 The <option>add_header</option> modifier can be used to add one or more extra header lines
49246 to an incoming message, as in this example:
49247 </para>
49248 <literallayout class="monospaced">
49249 warn dnslists = sbl.spamhaus.org : \
49250                 dialup.mail-abuse.org
49251      add_header = X-blacklisted-at: $dnslist_domain
49252 </literallayout>
49253 <para>
49254 The <option>add_header</option> modifier is permitted in the MAIL, RCPT, PREDATA, DATA,
49255 MIME, and non-SMTP ACLs (in other words, those that are concerned with
49256 receiving a message). The message must ultimately be accepted for
49257 <option>add_header</option> to have any significant effect. You can use <option>add_header</option> with
49258 any ACL verb, including <option>deny</option> (though this is potentially useful only in a
49259 RCPT ACL).
49260 </para>
49261 <para>
49262 If the data for the <option>add_header</option> modifier contains one or more newlines that
49263 are not followed by a space or a tab, it is assumed to contain multiple header
49264 lines. Each one is checked for valid syntax; <literal>X-ACL-Warn:</literal> is added to the
49265 front of any line that is not a valid header line.
49266 </para>
49267 <para>
49268 Added header lines are accumulated during the MAIL, RCPT, and predata ACLs.
49269 They are added to the message before processing the DATA and MIME ACLs.
49270 However, if an identical header line is requested more than once, only one copy
49271 is actually added to the message. Further header lines may be accumulated
49272 during the DATA and MIME ACLs, after which they are added to the message, again
49273 with duplicates suppressed. Thus, it is possible to add two identical header
49274 lines to an SMTP message, but only if one is added before DATA and one after.
49275 In the case of non-SMTP messages, new headers are accumulated during the
49276 non-SMTP ACLs, and are added to the message after all the ACLs have run. If a
49277 message is rejected after DATA or by the non-SMTP ACL, all added header lines
49278 are included in the entry that is written to the reject log.
49279 </para>
49280 <para>
49281 <indexterm role="concept">
49282 <primary>header lines</primary>
49283 <secondary>added; visibility of</secondary>
49284 </indexterm>
49285 Header lines are not visible in string expansions until they are added to the
49286 message. It follows that header lines defined in the MAIL, RCPT, and predata
49287 ACLs are not visible until the DATA ACL and MIME ACLs are run. Similarly,
49288 header lines that are added by the DATA or MIME ACLs are not visible in those
49289 ACLs. Because of this restriction, you cannot use header lines as a way of
49290 passing data between (for example) the MAIL and RCPT ACLs. If you want to do
49291 this, you can use ACL variables, as described in section
49292 <xref linkend="SECTaclvariables"/>.
49293 </para>
49294 <para>
49295 The <option>add_header</option> modifier acts immediately it is encountered during the
49296 processing of an ACL. Notice the difference between these two cases:
49297 </para>
49298 <literallayout>
49299 <literal>accept add_header = ADDED: some text</literal>
49300 <literal>       </literal>&lt;<emphasis>some condition</emphasis>&gt;
49301
49302 <literal>accept </literal>&lt;<emphasis>some condition</emphasis>&gt;
49303 <literal>       add_header = ADDED: some text</literal>
49304 </literallayout>
49305 <para>
49306 In the first case, the header line is always added, whether or not the
49307 condition is true. In the second case, the header line is added only if the
49308 condition is true. Multiple occurrences of <option>add_header</option> may occur in the same
49309 ACL statement. All those that are encountered before a condition fails are
49310 honoured.
49311 </para>
49312 <para>
49313 <indexterm role="concept">
49314 <primary><option>warn</option> ACL verb</primary>
49315 </indexterm>
49316 For compatibility with previous versions of Exim, a <option>message</option> modifier for a
49317 <option>warn</option> verb acts in the same way as <option>add_header</option>, except that it takes
49318 effect only if all the conditions are true, even if it appears before some of
49319 them. Furthermore, only the last occurrence of <option>message</option> is honoured. This
49320 usage of <option>message</option> is now deprecated. If both <option>add_header</option> and <option>message</option>
49321 are present on a <option>warn</option> verb, both are processed according to their
49322 specifications.
49323 </para>
49324 <para>
49325 By default, new header lines are added to a message at the end of the existing
49326 header lines. However, you can specify that any particular header line should
49327 be added right at the start (before all the <emphasis>Received:</emphasis> lines), immediately
49328 after the first block of <emphasis>Received:</emphasis> lines, or immediately before any line
49329 that is not a <emphasis>Received:</emphasis> or <emphasis>Resent-something:</emphasis> header.
49330 </para>
49331 <para>
49332 This is done by specifying <quote>:at_start:</quote>, <quote>:after_received:</quote>, or
49333 <quote>:at_start_rfc:</quote> (or, for completeness, <quote>:at_end:</quote>) before the text of the
49334 header line, respectively. (Header text cannot start with a colon, as there has
49335 to be a header name first.) For example:
49336 </para>
49337 <literallayout class="monospaced">
49338 warn add_header = \
49339        :after_received:X-My-Header: something or other...
49340 </literallayout>
49341 <para>
49342 If more than one header line is supplied in a single <option>add_header</option> modifier,
49343 each one is treated independently and can therefore be placed differently. If
49344 you add more than one line at the start, or after the Received: block, they end
49345 up in reverse order.
49346 </para>
49347 <para>
49348 <emphasis role="bold">Warning</emphasis>: This facility currently applies only to header lines that are
49349 added in an ACL. It does NOT work for header lines that are added in a
49350 system filter or in a router or transport.
49351 </para>
49352 </section>
49353 <section id="SECTaclconditions">
49354 <title>ACL conditions</title>
49355 <para>
49356 <indexterm role="concept">
49357 <primary>access control lists (ACLs)</primary>
49358 <secondary>conditions; list of</secondary>
49359 </indexterm>
49360 Some of conditions listed in this section are available only when Exim is
49361 compiled with the content-scanning extension. They are included here briefly
49362 for completeness. More detailed descriptions can be found in the discussion on
49363 content scanning in chapter <xref linkend="CHAPexiscan"/>.
49364 </para>
49365 <para>
49366 Not all conditions are relevant in all circumstances. For example, testing
49367 senders and recipients does not make sense in an ACL that is being run as the
49368 result of the arrival of an ETRN command, and checks on message headers can be
49369 done only in the ACLs specified by <option>acl_smtp_data</option> and <option>acl_not_smtp</option>. You
49370 can use the same condition (with different parameters) more than once in the
49371 same ACL statement. This provides a way of specifying an <quote>and</quote> conjunction.
49372 The conditions are as follows:
49373 </para>
49374 <variablelist>
49375 <varlistentry>
49376 <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>
49377 <listitem>
49378 <para>
49379 <indexterm role="concept">
49380 <primary>access control lists (ACLs)</primary>
49381 <secondary>nested</secondary>
49382 </indexterm>
49383 <indexterm role="concept">
49384 <primary>access control lists (ACLs)</primary>
49385 <secondary>indirect</secondary>
49386 </indexterm>
49387 <indexterm role="concept">
49388 <primary><option>acl</option> ACL condition</primary>
49389 </indexterm>
49390 The possible values of the argument are the same as for the
49391 <option>acl_smtp_</option><emphasis>xxx</emphasis> options. The named or inline ACL is run. If it returns
49392 <quote>accept</quote> the condition is true; if it returns <quote>deny</quote> the condition is
49393 false. If it returns <quote>defer</quote>, the current ACL returns <quote>defer</quote> unless the
49394 condition is on a <option>warn</option> verb. In that case, a <quote>defer</quote> return makes the
49395 condition false. This means that further processing of the <option>warn</option> verb
49396 ceases, but processing of the ACL continues.
49397 </para>
49398 <para>
49399 If the nested <option>acl</option> returns <quote>drop</quote> and the outer condition denies access,
49400 the connection is dropped. If it returns <quote>discard</quote>, the verb must be
49401 <option>accept</option> or <option>discard</option>, and the action is taken immediately &ndash; no further
49402 conditions are tested.
49403 </para>
49404 <para>
49405 ACLs may be nested up to 20 deep; the limit exists purely to catch runaway
49406 loops. This condition allows you to use different ACLs in different
49407 circumstances. For example, different ACLs can be used to handle RCPT commands
49408 for different local users or different local domains.
49409 </para>
49410 </listitem></varlistentry>
49411 <varlistentry>
49412 <term><emphasis role="bold">authenticated&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string&nbsp;list</emphasis>&gt;</term>
49413 <listitem>
49414 <para>
49415 <indexterm role="concept">
49416 <primary><option>authenticated</option> ACL condition</primary>
49417 </indexterm>
49418 <indexterm role="concept">
49419 <primary>authentication</primary>
49420 <secondary>ACL checking</secondary>
49421 </indexterm>
49422 <indexterm role="concept">
49423 <primary>access control lists (ACLs)</primary>
49424 <secondary>testing for authentication</secondary>
49425 </indexterm>
49426 If the SMTP connection is not authenticated, the condition is false. Otherwise,
49427 the name of the authenticator is tested against the list. To test for
49428 authentication by any authenticator, you can set
49429 </para>
49430 <literallayout class="monospaced">
49431 authenticated = *
49432 </literallayout>
49433 </listitem></varlistentry>
49434 <varlistentry>
49435 <term><emphasis role="bold">condition&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string</emphasis>&gt;</term>
49436 <listitem>
49437 <para>
49438 <indexterm role="concept">
49439 <primary><option>condition</option> ACL condition</primary>
49440 </indexterm>
49441 <indexterm role="concept">
49442 <primary>customizing</primary>
49443 <secondary>ACL condition</secondary>
49444 </indexterm>
49445 <indexterm role="concept">
49446 <primary>access control lists (ACLs)</primary>
49447 <secondary>customized test</secondary>
49448 </indexterm>
49449 <indexterm role="concept">
49450 <primary>access control lists (ACLs)</primary>
49451 <secondary>testing, customized</secondary>
49452 </indexterm>
49453 This feature allows you to make up custom conditions. If the result of
49454 expanding the string is an empty string, the number zero, or one of the strings
49455 <quote>no</quote> or <quote>false</quote>, the condition is false. If the result is any non-zero
49456 number, or one of the strings <quote>yes</quote> or <quote>true</quote>, the condition is true. For
49457 any other value, some error is assumed to have occurred, and the ACL returns
49458 <quote>defer</quote>. However, if the expansion is forced to fail, the condition is
49459 ignored. The effect is to treat it as true, whether it is positive or
49460 negative.
49461 </para>
49462 </listitem></varlistentry>
49463 <varlistentry>
49464 <term><emphasis role="bold">decode&nbsp;=&nbsp;</emphasis>&lt;<emphasis>location</emphasis>&gt;</term>
49465 <listitem>
49466 <para>
49467 <indexterm role="concept">
49468 <primary><option>decode</option> ACL condition</primary>
49469 </indexterm>
49470 This condition is available only when Exim is compiled with the
49471 content-scanning extension, and it is allowed only in the ACL defined by
49472 <option>acl_smtp_mime</option>. It causes the current MIME part to be decoded into a file.
49473 If all goes well, the condition is true. It is false only if there are
49474 problems such as a syntax error or a memory shortage. For more details, see
49475 chapter <xref linkend="CHAPexiscan"/>.
49476 </para>
49477 </listitem></varlistentry>
49478 <varlistentry>
49479 <term><emphasis role="bold">demime&nbsp;=&nbsp;</emphasis>&lt;<emphasis>extension&nbsp;list</emphasis>&gt;</term>
49480 <listitem>
49481 <para>
49482 <indexterm role="concept">
49483 <primary><option>demime</option> ACL condition</primary>
49484 </indexterm>
49485 This condition is available only when Exim is compiled with the
49486 content-scanning extension. Its use is described in section
49487 <xref linkend="SECTdemimecond"/>.
49488 </para>
49489 </listitem></varlistentry>
49490 <varlistentry>
49491 <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>
49492 <listitem>
49493 <para>
49494 <indexterm role="concept">
49495 <primary><option>dnslists</option> ACL condition</primary>
49496 </indexterm>
49497 <indexterm role="concept">
49498 <primary>DNS list</primary>
49499 <secondary>in ACL</secondary>
49500 </indexterm>
49501 <indexterm role="concept">
49502 <primary>black list (DNS)</primary>
49503 </indexterm>
49504 <indexterm role="concept">
49505 <primary>access control lists (ACLs)</primary>
49506 <secondary>testing a DNS list</secondary>
49507 </indexterm>
49508 This condition checks for entries in DNS black lists. These are also known as
49509 <quote>RBL lists</quote>, after the original Realtime Blackhole List, but note that the
49510 use of the lists at <emphasis>mail-abuse.org</emphasis> now carries a charge. There are too many
49511 different variants of this condition to describe briefly here. See sections
49512 <xref linkend="SECTmorednslists"/>&ndash;<xref linkend="SECTmorednslistslast"/> for details.
49513 </para>
49514 </listitem></varlistentry>
49515 <varlistentry>
49516 <term><emphasis role="bold">domains&nbsp;=&nbsp;</emphasis>&lt;<emphasis>domain&nbsp;list</emphasis>&gt;</term>
49517 <listitem>
49518 <para>
49519 <indexterm role="concept">
49520 <primary><option>domains</option> ACL condition</primary>
49521 </indexterm>
49522 <indexterm role="concept">
49523 <primary>domain</primary>
49524 <secondary>ACL checking</secondary>
49525 </indexterm>
49526 <indexterm role="concept">
49527 <primary>access control lists (ACLs)</primary>
49528 <secondary>testing a recipient domain</secondary>
49529 </indexterm>
49530 <indexterm role="variable">
49531 <primary><varname>$domain_data</varname></primary>
49532 </indexterm>
49533 This condition is relevant only after a RCPT command. It checks that the domain
49534 of the recipient address is in the domain list. If percent-hack processing is
49535 enabled, it is done before this test is done. If the check succeeds with a
49536 lookup, the result of the lookup is placed in <varname>$domain_data</varname> until the next
49537 <option>domains</option> test.
49538 </para>
49539 <para>
49540 <emphasis role="bold">Note carefully</emphasis> (because many people seem to fall foul of this): you cannot
49541 use <option>domains</option> in a DATA ACL.
49542 </para>
49543 </listitem></varlistentry>
49544 <varlistentry>
49545 <term><emphasis role="bold">encrypted&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string&nbsp;list</emphasis>&gt;</term>
49546 <listitem>
49547 <para>
49548 <indexterm role="concept">
49549 <primary><option>encrypted</option> ACL condition</primary>
49550 </indexterm>
49551 <indexterm role="concept">
49552 <primary>encryption</primary>
49553 <secondary>checking in an ACL</secondary>
49554 </indexterm>
49555 <indexterm role="concept">
49556 <primary>access control lists (ACLs)</primary>
49557 <secondary>testing for encryption</secondary>
49558 </indexterm>
49559 If the SMTP connection is not encrypted, the condition is false. Otherwise, the
49560 name of the cipher suite in use is tested against the list. To test for
49561 encryption without testing for any specific cipher suite(s), set
49562 </para>
49563 <literallayout class="monospaced">
49564 encrypted = *
49565 </literallayout>
49566 </listitem></varlistentry>
49567 <varlistentry>
49568 <term><emphasis role="bold">hosts&nbsp;=&nbsp;</emphasis>&lt;<emphasis>&nbsp;host&nbsp;list</emphasis>&gt;</term>
49569 <listitem>
49570 <para>
49571 <indexterm role="concept">
49572 <primary><option>hosts</option> ACL condition</primary>
49573 </indexterm>
49574 <indexterm role="concept">
49575 <primary>host</primary>
49576 <secondary>ACL checking</secondary>
49577 </indexterm>
49578 <indexterm role="concept">
49579 <primary>access control lists (ACLs)</primary>
49580 <secondary>testing the client host</secondary>
49581 </indexterm>
49582 This condition tests that the calling host matches the host list. If you have
49583 name lookups or wildcarded host names and IP addresses in the same host list,
49584 you should normally put the IP addresses first. For example, you could have:
49585 </para>
49586 <literallayout class="monospaced">
49587 accept hosts = 10.9.8.7 : dbm;/etc/friendly/hosts
49588 </literallayout>
49589 <para>
49590 The lookup in this example uses the host name for its key. This is implied by
49591 the lookup type <quote>dbm</quote>. (For a host address lookup you would use <quote>net-dbm</quote>
49592 and it wouldn&#x2019;t matter which way round you had these two items.)
49593 </para>
49594 <para>
49595 The reason for the problem with host names lies in the left-to-right way that
49596 Exim processes lists. It can test IP addresses without doing any DNS lookups,
49597 but when it reaches an item that requires a host name, it fails if it cannot
49598 find a host name to compare with the pattern. If the above list is given in the
49599 opposite order, the <option>accept</option> statement fails for a host whose name cannot be
49600 found, even if its IP address is 10.9.8.7.
49601 </para>
49602 <para>
49603 If you really do want to do the name check first, and still recognize the IP
49604 address even if the name lookup fails, you can rewrite the ACL like this:
49605 </para>
49606 <literallayout class="monospaced">
49607 accept hosts = dbm;/etc/friendly/hosts
49608 accept hosts = 10.9.8.7
49609 </literallayout>
49610 <para>
49611 The default action on failing to find the host name is to assume that the host
49612 is not in the list, so the first <option>accept</option> statement fails. The second
49613 statement can then check the IP address.
49614 </para>
49615 <para>
49616 <indexterm role="variable">
49617 <primary><varname>$host_data</varname></primary>
49618 </indexterm>
49619 If a <option>hosts</option> condition is satisfied by means of a lookup, the result
49620 of the lookup is made available in the <varname>$host_data</varname> variable. This
49621 allows you, for example, to set up a statement like this:
49622 </para>
49623 <literallayout class="monospaced">
49624 deny  hosts = net-lsearch;/some/file
49625 message = $host_data
49626 </literallayout>
49627 <para>
49628 which gives a custom error message for each denied host.
49629 </para>
49630 </listitem></varlistentry>
49631 <varlistentry>
49632 <term><emphasis role="bold">local_parts&nbsp;=&nbsp;</emphasis>&lt;<emphasis>local&nbsp;part&nbsp;list</emphasis>&gt;</term>
49633 <listitem>
49634 <para>
49635 <indexterm role="concept">
49636 <primary><option>local_parts</option> ACL condition</primary>
49637 </indexterm>
49638 <indexterm role="concept">
49639 <primary>local part</primary>
49640 <secondary>ACL checking</secondary>
49641 </indexterm>
49642 <indexterm role="concept">
49643 <primary>access control lists (ACLs)</primary>
49644 <secondary>testing a local part</secondary>
49645 </indexterm>
49646 <indexterm role="variable">
49647 <primary><varname>$local_part_data</varname></primary>
49648 </indexterm>
49649 This condition is relevant only after a RCPT command. It checks that the local
49650 part of the recipient address is in the list. If percent-hack processing is
49651 enabled, it is done before this test. If the check succeeds with a lookup, the
49652 result of the lookup is placed in <varname>$local_part_data</varname>, which remains set until
49653 the next <option>local_parts</option> test.
49654 </para>
49655 </listitem></varlistentry>
49656 <varlistentry>
49657 <term><emphasis role="bold">malware&nbsp;=&nbsp;</emphasis>&lt;<emphasis>option</emphasis>&gt;</term>
49658 <listitem>
49659 <para>
49660 <indexterm role="concept">
49661 <primary><option>malware</option> ACL condition</primary>
49662 </indexterm>
49663 <indexterm role="concept">
49664 <primary>access control lists (ACLs)</primary>
49665 <secondary>virus scanning</secondary>
49666 </indexterm>
49667 <indexterm role="concept">
49668 <primary>access control lists (ACLs)</primary>
49669 <secondary>scanning for viruses</secondary>
49670 </indexterm>
49671 This condition is available only when Exim is compiled with the
49672 content-scanning extension. It causes the incoming message to be scanned for
49673 viruses. For details, see chapter <xref linkend="CHAPexiscan"/>.
49674 </para>
49675 </listitem></varlistentry>
49676 <varlistentry>
49677 <term><emphasis role="bold">mime_regex&nbsp;=&nbsp;</emphasis>&lt;<emphasis>list&nbsp;of&nbsp;regular&nbsp;expressions</emphasis>&gt;</term>
49678 <listitem>
49679 <para>
49680 <indexterm role="concept">
49681 <primary><option>mime_regex</option> ACL condition</primary>
49682 </indexterm>
49683 <indexterm role="concept">
49684 <primary>access control lists (ACLs)</primary>
49685 <secondary>testing by regex matching</secondary>
49686 </indexterm>
49687 This condition is available only when Exim is compiled with the
49688 content-scanning extension, and it is allowed only in the ACL defined by
49689 <option>acl_smtp_mime</option>. It causes the current MIME part to be scanned for a match
49690 with any of the regular expressions. For details, see chapter
49691 <xref linkend="CHAPexiscan"/>.
49692 </para>
49693 </listitem></varlistentry>
49694 <varlistentry>
49695 <term><emphasis role="bold">ratelimit&nbsp;=&nbsp;</emphasis>&lt;<emphasis>parameters</emphasis>&gt;</term>
49696 <listitem>
49697 <para>
49698 <indexterm role="concept">
49699 <primary>rate limiting</primary>
49700 </indexterm>
49701 This condition can be used to limit the rate at which a user or host submits
49702 messages. Details are given in section <xref linkend="SECTratelimiting"/>.
49703 </para>
49704 </listitem></varlistentry>
49705 <varlistentry>
49706 <term><emphasis role="bold">recipients&nbsp;=&nbsp;</emphasis>&lt;<emphasis>address&nbsp;list</emphasis>&gt;</term>
49707 <listitem>
49708 <para>
49709 <indexterm role="concept">
49710 <primary><option>recipients</option> ACL condition</primary>
49711 </indexterm>
49712 <indexterm role="concept">
49713 <primary>recipient</primary>
49714 <secondary>ACL checking</secondary>
49715 </indexterm>
49716 <indexterm role="concept">
49717 <primary>access control lists (ACLs)</primary>
49718 <secondary>testing a recipient</secondary>
49719 </indexterm>
49720 This condition is relevant only after a RCPT command. It checks the entire
49721 recipient address against a list of recipients.
49722 </para>
49723 </listitem></varlistentry>
49724 <varlistentry>
49725 <term><emphasis role="bold">regex&nbsp;=&nbsp;</emphasis>&lt;<emphasis>list&nbsp;of&nbsp;regular&nbsp;expressions</emphasis>&gt;</term>
49726 <listitem>
49727 <para>
49728 <indexterm role="concept">
49729 <primary><option>regex</option> ACL condition</primary>
49730 </indexterm>
49731 <indexterm role="concept">
49732 <primary>access control lists (ACLs)</primary>
49733 <secondary>testing by regex matching</secondary>
49734 </indexterm>
49735 This condition is available only when Exim is compiled with the
49736 content-scanning extension, and is available only in the DATA, MIME, and
49737 non-SMTP ACLs. It causes the incoming message to be scanned for a match with
49738 any of the regular expressions. For details, see chapter <xref linkend="CHAPexiscan"/>.
49739 </para>
49740 </listitem></varlistentry>
49741 <varlistentry>
49742 <term><emphasis role="bold">sender_domains&nbsp;=&nbsp;</emphasis>&lt;<emphasis>domain&nbsp;list</emphasis>&gt;</term>
49743 <listitem>
49744 <para>
49745 <indexterm role="concept">
49746 <primary><option>sender_domains</option> ACL condition</primary>
49747 </indexterm>
49748 <indexterm role="concept">
49749 <primary>sender</primary>
49750 <secondary>ACL checking</secondary>
49751 </indexterm>
49752 <indexterm role="concept">
49753 <primary>access control lists (ACLs)</primary>
49754 <secondary>testing a sender domain</secondary>
49755 </indexterm>
49756 <indexterm role="variable">
49757 <primary><varname>$domain</varname></primary>
49758 </indexterm>
49759 <indexterm role="variable">
49760 <primary><varname>$sender_address_domain</varname></primary>
49761 </indexterm>
49762 This condition tests the domain of the sender of the message against the given
49763 domain list. <emphasis role="bold">Note</emphasis>: The domain of the sender address is in
49764 <varname>$sender_address_domain</varname>. It is <emphasis>not</emphasis> put in <varname>$domain</varname> during the testing
49765 of this condition. This is an exception to the general rule for testing domain
49766 lists. It is done this way so that, if this condition is used in an ACL for a
49767 RCPT command, the recipient&#x2019;s domain (which is in <varname>$domain</varname>) can be used to
49768 influence the sender checking.
49769 </para>
49770 <para>
49771 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
49772 relaying, because sender addresses are easily, and commonly, forged.
49773 </para>
49774 </listitem></varlistentry>
49775 <varlistentry>
49776 <term><emphasis role="bold">senders&nbsp;=&nbsp;</emphasis>&lt;<emphasis>address&nbsp;list</emphasis>&gt;</term>
49777 <listitem>
49778 <para>
49779 <indexterm role="concept">
49780 <primary><option>senders</option> ACL condition</primary>
49781 </indexterm>
49782 <indexterm role="concept">
49783 <primary>sender</primary>
49784 <secondary>ACL checking</secondary>
49785 </indexterm>
49786 <indexterm role="concept">
49787 <primary>access control lists (ACLs)</primary>
49788 <secondary>testing a sender</secondary>
49789 </indexterm>
49790 This condition tests the sender of the message against the given list. To test
49791 for a bounce message, which has an empty sender, set
49792 </para>
49793 <literallayout class="monospaced">
49794 senders = :
49795 </literallayout>
49796 <para>
49797 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
49798 relaying, because sender addresses are easily, and commonly, forged.
49799 </para>
49800 </listitem></varlistentry>
49801 <varlistentry>
49802 <term><emphasis role="bold">spam&nbsp;=&nbsp;</emphasis>&lt;<emphasis>username</emphasis>&gt;</term>
49803 <listitem>
49804 <para>
49805 <indexterm role="concept">
49806 <primary><option>spam</option> ACL condition</primary>
49807 </indexterm>
49808 <indexterm role="concept">
49809 <primary>access control lists (ACLs)</primary>
49810 <secondary>scanning for spam</secondary>
49811 </indexterm>
49812 This condition is available only when Exim is compiled with the
49813 content-scanning extension. It causes the incoming message to be scanned by
49814 SpamAssassin. For details, see chapter <xref linkend="CHAPexiscan"/>.
49815 </para>
49816 </listitem></varlistentry>
49817 <varlistentry>
49818 <term><emphasis role="bold">verify&nbsp;=&nbsp;certificate</emphasis></term>
49819 <listitem>
49820 <para>
49821 <indexterm role="concept">
49822 <primary><option>verify</option> ACL condition</primary>
49823 </indexterm>
49824 <indexterm role="concept">
49825 <primary>TLS</primary>
49826 <secondary>client certificate verification</secondary>
49827 </indexterm>
49828 <indexterm role="concept">
49829 <primary>certificate</primary>
49830 <secondary>verification of client</secondary>
49831 </indexterm>
49832 <indexterm role="concept">
49833 <primary>access control lists (ACLs)</primary>
49834 <secondary>certificate verification</secondary>
49835 </indexterm>
49836 <indexterm role="concept">
49837 <primary>access control lists (ACLs)</primary>
49838 <secondary>testing a TLS certificate</secondary>
49839 </indexterm>
49840 This condition is true in an SMTP session if the session is encrypted, and a
49841 certificate was received from the client, and the certificate was verified. The
49842 server requests a certificate only if the client matches <option>tls_verify_hosts</option>
49843 or <option>tls_try_verify_hosts</option> (see chapter <xref linkend="CHAPTLS"/>).
49844 </para>
49845 </listitem></varlistentry>
49846 <varlistentry>
49847 <term><emphasis role="bold">verify&nbsp;=&nbsp;csa</emphasis></term>
49848 <listitem>
49849 <para>
49850 <indexterm role="concept">
49851 <primary>CSA verification</primary>
49852 </indexterm>
49853 This condition checks whether the sending host (the client) is authorized to
49854 send email. Details of how this works are given in section
49855 <xref linkend="SECTverifyCSA"/>.
49856 </para>
49857 </listitem></varlistentry>
49858 <varlistentry>
49859 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_sender/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
49860 <listitem>
49861 <para>
49862 <indexterm role="concept">
49863 <primary><option>verify</option> ACL condition</primary>
49864 </indexterm>
49865 <indexterm role="concept">
49866 <primary>access control lists (ACLs)</primary>
49867 <secondary>verifying sender in the header</secondary>
49868 </indexterm>
49869 <indexterm role="concept">
49870 <primary>header lines</primary>
49871 <secondary>verifying the sender in</secondary>
49872 </indexterm>
49873 <indexterm role="concept">
49874 <primary>sender</primary>
49875 <secondary>verifying in header</secondary>
49876 </indexterm>
49877 <indexterm role="concept">
49878 <primary>verifying</primary>
49879 <secondary>sender in header</secondary>
49880 </indexterm>
49881 This condition is relevant only in an ACL that is run after a message has been
49882 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
49883 <option>acl_not_smtp</option>. It checks that there is a verifiable address in at least one
49884 of the <emphasis>Sender:</emphasis>, <emphasis>Reply-To:</emphasis>, or <emphasis>From:</emphasis> header lines. Such an address
49885 is loosely thought of as a <quote>sender</quote> address (hence the name of the test).
49886 However, an address that appears in one of these headers need not be an address
49887 that accepts bounce messages; only sender addresses in envelopes are required
49888 to accept bounces. Therefore, if you use the callout option on this check, you
49889 might want to arrange for a non-empty address in the MAIL command.
49890 </para>
49891 <para>
49892 Details of address verification and the options are given later, starting at
49893 section <xref linkend="SECTaddressverification"/> (callouts are described in section
49894 <xref linkend="SECTcallver"/>). You can combine this condition with the <option>senders</option>
49895 condition to restrict it to bounce messages only:
49896 </para>
49897 <literallayout class="monospaced">
49898 deny    senders = :
49899         message = A valid sender header is required for bounces
49900        !verify  = header_sender
49901 </literallayout>
49902 </listitem></varlistentry>
49903 <varlistentry>
49904 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_syntax</emphasis></term>
49905 <listitem>
49906 <para>
49907 <indexterm role="concept">
49908 <primary><option>verify</option> ACL condition</primary>
49909 </indexterm>
49910 <indexterm role="concept">
49911 <primary>access control lists (ACLs)</primary>
49912 <secondary>verifying header syntax</secondary>
49913 </indexterm>
49914 <indexterm role="concept">
49915 <primary>header lines</primary>
49916 <secondary>verifying syntax</secondary>
49917 </indexterm>
49918 <indexterm role="concept">
49919 <primary>verifying</primary>
49920 <secondary>header syntax</secondary>
49921 </indexterm>
49922 This condition is relevant only in an ACL that is run after a message has been
49923 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
49924 <option>acl_not_smtp</option>. It checks the syntax of all header lines that can contain
49925 lists of addresses (<emphasis>Sender:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>,
49926 and <emphasis>Bcc:</emphasis>). Unqualified addresses (local parts without domains) are
49927 permitted only in locally generated messages and from hosts that match
49928 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
49929 appropriate.
49930 </para>
49931 <para>
49932 Note that this condition is a syntax check only. However, a common spamming
49933 ploy used to be to send syntactically invalid headers such as
49934 </para>
49935 <literallayout class="monospaced">
49936 To: @
49937 </literallayout>
49938 <para>
49939 and this condition can be used to reject such messages, though they are not as
49940 common as they used to be.
49941 </para>
49942 </listitem></varlistentry>
49943 <varlistentry>
49944 <term><emphasis role="bold">verify&nbsp;=&nbsp;helo</emphasis></term>
49945 <listitem>
49946 <para>
49947 <indexterm role="concept">
49948 <primary><option>verify</option> ACL condition</primary>
49949 </indexterm>
49950 <indexterm role="concept">
49951 <primary>access control lists (ACLs)</primary>
49952 <secondary>verifying HELO/EHLO</secondary>
49953 </indexterm>
49954 <indexterm role="concept">
49955 <primary>HELO</primary>
49956 <secondary>verifying</secondary>
49957 </indexterm>
49958 <indexterm role="concept">
49959 <primary>EHLO</primary>
49960 <secondary>verifying</secondary>
49961 </indexterm>
49962 <indexterm role="concept">
49963 <primary>verifying</primary>
49964 <secondary>EHLO</secondary>
49965 </indexterm>
49966 <indexterm role="concept">
49967 <primary>verifying</primary>
49968 <secondary>HELO</secondary>
49969 </indexterm>
49970 This condition is true if a HELO or EHLO command has been received from the
49971 client host, and its contents have been verified. If there has been no previous
49972 attempt to verify the HELO/EHLO contents, it is carried out when this
49973 condition is encountered. See the description of the <option>helo_verify_hosts</option> and
49974 <option>helo_try_verify_hosts</option> options for details of how to request verification
49975 independently of this condition.
49976 </para>
49977 <para>
49978 For SMTP input that does not come over TCP/IP (the <option>-bs</option> command line
49979 option), this condition is always true.
49980 </para>
49981 </listitem></varlistentry>
49982 <varlistentry>
49983 <term><emphasis role="bold">verify&nbsp;=&nbsp;not_blind</emphasis></term>
49984 <listitem>
49985 <para>
49986 <indexterm role="concept">
49987 <primary>verifying</primary>
49988 <secondary>not blind</secondary>
49989 </indexterm>
49990 <indexterm role="concept">
49991 <primary>bcc recipients, verifying none</primary>
49992 </indexterm>
49993 This condition checks that there are no blind (bcc) recipients in the message.
49994 Every envelope recipient must appear either in a <emphasis>To:</emphasis> header line or in a
49995 <emphasis>Cc:</emphasis> header line for this condition to be true. Local parts are checked
49996 case-sensitively; domains are checked case-insensitively. If <emphasis>Resent-To:</emphasis> or
49997 <emphasis>Resent-Cc:</emphasis> header lines exist, they are also checked. This condition can be
49998 used only in a DATA or non-SMTP ACL.
49999 </para>
50000 <para>
50001 There are, of course, many legitimate messages that make use of blind (bcc)
50002 recipients. This check should not be used on its own for blocking messages.
50003 </para>
50004 </listitem></varlistentry>
50005 <varlistentry>
50006 <term><emphasis role="bold">verify&nbsp;=&nbsp;recipient/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
50007 <listitem>
50008 <para>
50009 <indexterm role="concept">
50010 <primary><option>verify</option> ACL condition</primary>
50011 </indexterm>
50012 <indexterm role="concept">
50013 <primary>access control lists (ACLs)</primary>
50014 <secondary>verifying recipient</secondary>
50015 </indexterm>
50016 <indexterm role="concept">
50017 <primary>recipient</primary>
50018 <secondary>verifying</secondary>
50019 </indexterm>
50020 <indexterm role="concept">
50021 <primary>verifying</primary>
50022 <secondary>recipient</secondary>
50023 </indexterm>
50024 <indexterm role="variable">
50025 <primary><varname>$address_data</varname></primary>
50026 </indexterm>
50027 This condition is relevant only after a RCPT command. It verifies the current
50028 recipient. Details of address verification are given later, starting at section
50029 <xref linkend="SECTaddressverification"/>. After a recipient has been verified, the value
50030 of <varname>$address_data</varname> is the last value that was set while routing the address.
50031 This applies even if the verification fails. When an address that is being
50032 verified is redirected to a single address, verification continues with the new
50033 address, and in that case, the subsequent value of <varname>$address_data</varname> is the
50034 value for the child address.
50035 </para>
50036 </listitem></varlistentry>
50037 <varlistentry>
50038 <term><emphasis role="bold">verify&nbsp;=&nbsp;reverse_host_lookup</emphasis></term>
50039 <listitem>
50040 <para>
50041 <indexterm role="concept">
50042 <primary><option>verify</option> ACL condition</primary>
50043 </indexterm>
50044 <indexterm role="concept">
50045 <primary>access control lists (ACLs)</primary>
50046 <secondary>verifying host reverse lookup</secondary>
50047 </indexterm>
50048 <indexterm role="concept">
50049 <primary>host</primary>
50050 <secondary>verifying reverse lookup</secondary>
50051 </indexterm>
50052 This condition ensures that a verified host name has been looked up from the IP
50053 address of the client host. (This may have happened already if the host name
50054 was needed for checking a host list, or if the host matched <option>host_lookup</option>.)
50055 Verification ensures that the host name obtained from a reverse DNS lookup, or
50056 one of its aliases, does, when it is itself looked up in the DNS, yield the
50057 original IP address.
50058 </para>
50059 <para>
50060 If this condition is used for a locally generated message (that is, when there
50061 is no client host involved), it always succeeds.
50062 </para>
50063 </listitem></varlistentry>
50064 <varlistentry>
50065 <term><emphasis role="bold">verify&nbsp;=&nbsp;sender/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
50066 <listitem>
50067 <para>
50068 <indexterm role="concept">
50069 <primary><option>verify</option> ACL condition</primary>
50070 </indexterm>
50071 <indexterm role="concept">
50072 <primary>access control lists (ACLs)</primary>
50073 <secondary>verifying sender</secondary>
50074 </indexterm>
50075 <indexterm role="concept">
50076 <primary>sender</primary>
50077 <secondary>verifying</secondary>
50078 </indexterm>
50079 <indexterm role="concept">
50080 <primary>verifying</primary>
50081 <secondary>sender</secondary>
50082 </indexterm>
50083 This condition is relevant only after a MAIL or RCPT command, or after a
50084 message has been received (the <option>acl_smtp_data</option> or <option>acl_not_smtp</option> ACLs). If
50085 the message&#x2019;s sender is empty (that is, this is a bounce message), the
50086 condition is true. Otherwise, the sender address is verified.
50087 </para>
50088 <para>
50089 <indexterm role="variable">
50090 <primary><varname>$address_data</varname></primary>
50091 </indexterm>
50092 <indexterm role="variable">
50093 <primary><varname>$sender_address_data</varname></primary>
50094 </indexterm>
50095 If there is data in the <varname>$address_data</varname> variable at the end of routing, its
50096 value is placed in <varname>$sender_address_data</varname> at the end of verification. This
50097 value can be used in subsequent conditions and modifiers in the same ACL
50098 statement. It does not persist after the end of the current statement. If you
50099 want to preserve the value for longer, you can save it in an ACL variable.
50100 </para>
50101 <para>
50102 Details of verification are given later, starting at section
50103 <xref linkend="SECTaddressverification"/>. Exim caches the result of sender verification,
50104 to avoid doing it more than once per message.
50105 </para>
50106 </listitem></varlistentry>
50107 <varlistentry>
50108 <term><emphasis role="bold">verify&nbsp;=&nbsp;sender=</emphasis>&lt;<emphasis>address</emphasis>&gt;<emphasis role="bold">/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
50109 <listitem>
50110 <para>
50111 <indexterm role="concept">
50112 <primary><option>verify</option> ACL condition</primary>
50113 </indexterm>
50114 This is a variation of the previous option, in which a modified address is
50115 verified as a sender.
50116 </para>
50117 </listitem></varlistentry>
50118 </variablelist>
50119 </section>
50120 <section id="SECTmorednslists">
50121 <title>Using DNS lists</title>
50122 <para>
50123 <indexterm role="concept">
50124 <primary>DNS list</primary>
50125 <secondary>in ACL</secondary>
50126 </indexterm>
50127 <indexterm role="concept">
50128 <primary>black list (DNS)</primary>
50129 </indexterm>
50130 <indexterm role="concept">
50131 <primary>access control lists (ACLs)</primary>
50132 <secondary>testing a DNS list</secondary>
50133 </indexterm>
50134 In its simplest form, the <option>dnslists</option> condition tests whether the calling host
50135 is on at least one of a number of DNS lists by looking up the inverted IP
50136 address in one or more DNS domains. (Note that DNS list domains are not mail
50137 domains, so the <literal>+</literal> syntax for named lists doesn&#x2019;t work - it is used for
50138 special options instead.) For example, if the calling host&#x2019;s IP
50139 address is 192.168.62.43, and the ACL statement is
50140 </para>
50141 <literallayout class="monospaced">
50142 deny dnslists = blackholes.mail-abuse.org : \
50143                 dialups.mail-abuse.org
50144 </literallayout>
50145 <para>
50146 the following records are looked up:
50147 </para>
50148 <literallayout class="monospaced">
50149 43.62.168.192.blackholes.mail-abuse.org
50150 43.62.168.192.dialups.mail-abuse.org
50151 </literallayout>
50152 <para>
50153 As soon as Exim finds an existing DNS record, processing of the list stops.
50154 Thus, multiple entries on the list provide an <quote>or</quote> conjunction. If you want
50155 to test that a host is on more than one list (an <quote>and</quote> conjunction), you can
50156 use two separate conditions:
50157 </para>
50158 <literallayout class="monospaced">
50159 deny dnslists = blackholes.mail-abuse.org
50160      dnslists = dialups.mail-abuse.org
50161 </literallayout>
50162 <para>
50163 If a DNS lookup times out or otherwise fails to give a decisive answer, Exim
50164 behaves as if the host does not match the list item, that is, as if the DNS
50165 record does not exist. If there are further items in the DNS list, they are
50166 processed.
50167 </para>
50168 <para>
50169 This is usually the required action when <option>dnslists</option> is used with <option>deny</option>
50170 (which is the most common usage), because it prevents a DNS failure from
50171 blocking mail. However, you can change this behaviour by putting one of the
50172 following special items in the list:
50173 </para>
50174 <literallayout>
50175 <literal>+include_unknown </literal>   behave as if the item is on the list
50176 <literal>+exclude_unknown </literal>   behave as if the item is not on the list (default)
50177 <literal>+defer_unknown   </literal>   give a temporary error
50178 </literallayout>
50179 <para>
50180 <indexterm role="concept">
50181 <primary><literal>+include_unknown</literal></primary>
50182 </indexterm>
50183 <indexterm role="concept">
50184 <primary><literal>+exclude_unknown</literal></primary>
50185 </indexterm>
50186 <indexterm role="concept">
50187 <primary><literal>+defer_unknown</literal></primary>
50188 </indexterm>
50189 Each of these applies to any subsequent items on the list. For example:
50190 </para>
50191 <literallayout class="monospaced">
50192 deny dnslists = +defer_unknown : foo.bar.example
50193 </literallayout>
50194 <para>
50195 Testing the list of domains stops as soon as a match is found. If you want to
50196 warn for one list and block for another, you can use two different statements:
50197 </para>
50198 <literallayout class="monospaced">
50199 deny  dnslists = blackholes.mail-abuse.org
50200 warn  message  = X-Warn: sending host is on dialups list
50201       dnslists = dialups.mail-abuse.org
50202 </literallayout>
50203 <para>
50204 DNS list lookups are cached by Exim for the duration of the SMTP session,
50205 so a lookup based on the IP address is done at most once for any incoming
50206 connection. Exim does not share information between multiple incoming
50207 connections (but your local name server cache should be active).
50208 </para>
50209 </section>
50210 <section id="SECID201">
50211 <title>Specifying the IP address for a DNS list lookup</title>
50212 <para>
50213 <indexterm role="concept">
50214 <primary>DNS list</primary>
50215 <secondary>keyed by explicit IP address</secondary>
50216 </indexterm>
50217 By default, the IP address that is used in a DNS list lookup is the IP address
50218 of the calling host. However, you can specify another IP address by listing it
50219 after the domain name, introduced by a slash. For example:
50220 </para>
50221 <literallayout class="monospaced">
50222 deny dnslists = black.list.tld/192.168.1.2
50223 </literallayout>
50224 <para>
50225 This feature is not very helpful with explicit IP addresses; it is intended for
50226 use with IP addresses that are looked up, for example, the IP addresses of the
50227 MX hosts or nameservers of an email sender address. For an example, see section
50228 <xref linkend="SECTmulkeyfor"/> below.
50229 </para>
50230 </section>
50231 <section id="SECID202">
50232 <title>DNS lists keyed on domain names</title>
50233 <para>
50234 <indexterm role="concept">
50235 <primary>DNS list</primary>
50236 <secondary>keyed by domain name</secondary>
50237 </indexterm>
50238 There are some lists that are keyed on domain names rather than inverted IP
50239 addresses (see for example the <emphasis>domain based zones</emphasis> link at
50240 <emphasis role="bold"><ulink url="http://www.rfc-ignorant.org/">http://www.rfc-ignorant.org/</ulink></emphasis>). No reversing of components is used
50241 with these lists. You can change the name that is looked up in a DNS list by
50242 listing it after the domain name, introduced by a slash. For example,
50243 </para>
50244 <literallayout class="monospaced">
50245 deny  message  = Sender's domain is listed at $dnslist_domain
50246       dnslists = dsn.rfc-ignorant.org/$sender_address_domain
50247 </literallayout>
50248 <para>
50249 This particular example is useful only in ACLs that are obeyed after the
50250 RCPT or DATA commands, when a sender address is available. If (for
50251 example) the message&#x2019;s sender is <emphasis>user@tld.example</emphasis> the name that is looked
50252 up by this example is
50253 </para>
50254 <literallayout class="monospaced">
50255 tld.example.dsn.rfc-ignorant.org
50256 </literallayout>
50257 <para>
50258 A single <option>dnslists</option> condition can contain entries for both names and IP
50259 addresses. For example:
50260 </para>
50261 <literallayout class="monospaced">
50262 deny dnslists = sbl.spamhaus.org : \
50263                 dsn.rfc-ignorant.org/$sender_address_domain
50264 </literallayout>
50265 <para>
50266 The first item checks the sending host&#x2019;s IP address; the second checks a domain
50267 name. The whole condition is true if either of the DNS lookups succeeds.
50268 </para>
50269 </section>
50270 <section id="SECTmulkeyfor">
50271 <title>Multiple explicit keys for a DNS list</title>
50272 <para>
50273 <indexterm role="concept">
50274 <primary>DNS list</primary>
50275 <secondary>multiple keys for</secondary>
50276 </indexterm>
50277 The syntax described above for looking up explicitly-defined values (either
50278 names or IP addresses) in a DNS blacklist is a simplification. After the domain
50279 name for the DNS list, what follows the slash can in fact be a list of items.
50280 As with all lists in Exim, the default separator is a colon. However, because
50281 this is a sublist within the list of DNS blacklist domains, it is necessary
50282 either to double the separators like this:
50283 </para>
50284 <literallayout class="monospaced">
50285 dnslists = black.list.tld/name.1::name.2
50286 </literallayout>
50287 <para>
50288 or to change the separator character, like this:
50289 </para>
50290 <literallayout class="monospaced">
50291 dnslists = black.list.tld/&lt;;name.1;name.2
50292 </literallayout>
50293 <para>
50294 If an item in the list is an IP address, it is inverted before the DNS
50295 blacklist domain is appended. If it is not an IP address, no inversion
50296 occurs. Consider this condition:
50297 </para>
50298 <literallayout class="monospaced">
50299 dnslists = black.list.tld/&lt;;192.168.1.2;a.domain
50300 </literallayout>
50301 <para>
50302 The DNS lookups that occur are:
50303 </para>
50304 <literallayout class="monospaced">
50305 2.1.168.192.black.list.tld
50306 a.domain.black.list.tld
50307 </literallayout>
50308 <para>
50309 Once a DNS record has been found (that matches a specific IP return
50310 address, if specified &ndash; see section <xref linkend="SECTaddmatcon"/>), no further lookups
50311 are done. If there is a temporary DNS error, the rest of the sublist of domains
50312 or IP addresses is tried. A temporary error for the whole dnslists item occurs
50313 only if no other DNS lookup in this sublist succeeds. In other words, a
50314 successful lookup for any of the items in the sublist overrides a temporary
50315 error for a previous item.
50316 </para>
50317 <para>
50318 The ability to supply a list of items after the slash is in some sense just a
50319 syntactic convenience. These two examples have the same effect:
50320 </para>
50321 <literallayout class="monospaced">
50322 dnslists = black.list.tld/a.domain : black.list.tld/b.domain
50323 dnslists = black.list.tld/a.domain::b.domain
50324 </literallayout>
50325 <para>
50326 However, when the data for the list is obtained from a lookup, the second form
50327 is usually much more convenient. Consider this example:
50328 </para>
50329 <literallayout class="monospaced">
50330 deny message  = The mail servers for the domain \
50331                 $sender_address_domain \
50332                 are listed at $dnslist_domain ($dnslist_value); \
50333                 see $dnslist_text.
50334      dnslists = sbl.spamhaus.org/&lt;|${lookup dnsdb {&gt;|a=&lt;|\
50335                                    ${lookup dnsdb {&gt;|mxh=\
50336                                    $sender_address_domain} }} }
50337 </literallayout>
50338 <para>
50339 Note the use of <literal>&gt;|</literal> in the dnsdb lookup to specify the separator for
50340 multiple DNS records. The inner dnsdb lookup produces a list of MX hosts
50341 and the outer dnsdb lookup finds the IP addresses for these hosts. The result
50342 of expanding the condition might be something like this:
50343 </para>
50344 <literallayout class="monospaced">
50345 dnslists = sbl.spahmaus.org/&lt;|192.168.2.3|192.168.5.6|...
50346 </literallayout>
50347 <para>
50348 Thus, this example checks whether or not the IP addresses of the sender
50349 domain&#x2019;s mail servers are on the Spamhaus black list.
50350 </para>
50351 <para>
50352 The key that was used for a successful DNS list lookup is put into the variable
50353 <varname>$dnslist_matched</varname> (see section <xref linkend="SECID204"/>).
50354 </para>
50355 </section>
50356 <section id="SECID203">
50357 <title>Data returned by DNS lists</title>
50358 <para>
50359 <indexterm role="concept">
50360 <primary>DNS list</primary>
50361 <secondary>data returned from</secondary>
50362 </indexterm>
50363 DNS lists are constructed using address records in the DNS. The original RBL
50364 just used the address 127.0.0.1 on the right hand side of each record, but the
50365 RBL+ list and some other lists use a number of values with different meanings.
50366 The values used on the RBL+ list are:
50367 </para>
50368 <literallayout>
50369 127.1.0.1  RBL
50370 127.1.0.2  DUL
50371 127.1.0.3  DUL and RBL
50372 127.1.0.4  RSS
50373 127.1.0.5  RSS and RBL
50374 127.1.0.6  RSS and DUL
50375 127.1.0.7  RSS and DUL and RBL
50376 </literallayout>
50377 <para>
50378 Section <xref linkend="SECTaddmatcon"/> below describes how you can distinguish between
50379 different values. Some DNS lists may return more than one address record;
50380 see section <xref linkend="SECThanmuldnsrec"/> for details of how they are checked.
50381 </para>
50382 </section>
50383 <section id="SECID204">
50384 <title>Variables set from DNS lists</title>
50385 <para>
50386 <indexterm role="concept">
50387 <primary>expansion</primary>
50388 <secondary>variables, set from DNS list</secondary>
50389 </indexterm>
50390 <indexterm role="concept">
50391 <primary>DNS list</primary>
50392 <secondary>variables set from</secondary>
50393 </indexterm>
50394 <indexterm role="variable">
50395 <primary><varname>$dnslist_domain</varname></primary>
50396 </indexterm>
50397 <indexterm role="variable">
50398 <primary><varname>$dnslist_matched</varname></primary>
50399 </indexterm>
50400 <indexterm role="variable">
50401 <primary><varname>$dnslist_text</varname></primary>
50402 </indexterm>
50403 <indexterm role="variable">
50404 <primary><varname>$dnslist_value</varname></primary>
50405 </indexterm>
50406 When an entry is found in a DNS list, the variable <varname>$dnslist_domain</varname> contains
50407 the name of the overall domain that matched (for example,
50408 <literal>spamhaus.example</literal>), <varname>$dnslist_matched</varname> contains the key within that domain
50409 (for example, <literal>192.168.5.3</literal>), and <varname>$dnslist_value</varname> contains the data from
50410 the DNS record. When the key is an IP address, it is not reversed in
50411 <varname>$dnslist_matched</varname> (though it is, of course, in the actual lookup). In simple
50412 cases, for example:
50413 </para>
50414 <literallayout class="monospaced">
50415 deny dnslists = spamhaus.example
50416 </literallayout>
50417 <para>
50418 the key is also available in another variable (in this case,
50419 <varname>$sender_host_address</varname>). In more complicated cases, however, this is not true.
50420 For example, using a data lookup (as described in section <xref linkend="SECTmulkeyfor"/>)
50421 might generate a dnslists lookup like this:
50422 </para>
50423 <literallayout class="monospaced">
50424 deny dnslists = spamhaus.example/&lt;|192.168.1.2|192.168.6.7|...
50425 </literallayout>
50426 <para>
50427 If this condition succeeds, the value in <varname>$dnslist_matched</varname> might be
50428 <literal>192.168.6.7</literal> (for example).
50429 </para>
50430 <para>
50431 If more than one address record is returned by the DNS lookup, all the IP
50432 addresses are included in <varname>$dnslist_value</varname>, separated by commas and spaces.
50433 The variable <varname>$dnslist_text</varname> contains the contents of any associated TXT
50434 record. For lists such as RBL+ the TXT record for a merged entry is often not
50435 very meaningful. See section <xref linkend="SECTmordetinf"/> for a way of obtaining more
50436 information.
50437 </para>
50438 <para>
50439 You can use the DNS list variables in <option>message</option> or <option>log_message</option> modifiers
50440 &ndash; although these appear before the condition in the ACL, they are not
50441 expanded until after it has failed. For example:
50442 </para>
50443 <literallayout class="monospaced">
50444 deny    hosts = !+local_networks
50445         message = $sender_host_address is listed \
50446                   at $dnslist_domain
50447         dnslists = rbl-plus.mail-abuse.example
50448 </literallayout>
50449 </section>
50450 <section id="SECTaddmatcon">
50451 <title>Additional matching conditions for DNS lists</title>
50452 <para>
50453 <indexterm role="concept">
50454 <primary>DNS list</primary>
50455 <secondary>matching specific returned data</secondary>
50456 </indexterm>
50457 You can add an equals sign and an IP address after a <option>dnslists</option> domain name
50458 in order to restrict its action to DNS records with a matching right hand side.
50459 For example,
50460 </para>
50461 <literallayout class="monospaced">
50462 deny dnslists = rblplus.mail-abuse.org=127.0.0.2
50463 </literallayout>
50464 <para>
50465 rejects only those hosts that yield 127.0.0.2. Without this additional data,
50466 any address record is considered to be a match. For the moment, we assume
50467 that the DNS lookup returns just one record. Section <xref linkend="SECThanmuldnsrec"/>
50468 describes how multiple records are handled.
50469 </para>
50470 <para>
50471 More than one IP address may be given for checking, using a comma as a
50472 separator. These are alternatives &ndash; if any one of them matches, the
50473 <option>dnslists</option> condition is true. For example:
50474 </para>
50475 <literallayout class="monospaced">
50476 deny  dnslists = a.b.c=127.0.0.2,127.0.0.3
50477 </literallayout>
50478 <para>
50479 If you want to specify a constraining address list and also specify names or IP
50480 addresses to be looked up, the constraining address list must be specified
50481 first. For example:
50482 </para>
50483 <literallayout class="monospaced">
50484 deny dnslists = dsn.rfc-ignorant.org\
50485                 =127.0.0.2/$sender_address_domain
50486 </literallayout>
50487 <para>
50488 If the character <literal>&amp;</literal> is used instead of <literal>=</literal>, the comparison for each
50489 listed IP address is done by a bitwise <quote>and</quote> instead of by an equality test.
50490 In other words, the listed addresses are used as bit masks. The comparison is
50491 true if all the bits in the mask are present in the address that is being
50492 tested. For example:
50493 </para>
50494 <literallayout class="monospaced">
50495 dnslists = a.b.c&amp;0.0.0.3
50496 </literallayout>
50497 <para>
50498 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
50499 want to test whether one bit or another bit is present (as opposed to both
50500 being present), you must use multiple values. For example:
50501 </para>
50502 <literallayout class="monospaced">
50503 dnslists = a.b.c&amp;0.0.0.1,0.0.0.2
50504 </literallayout>
50505 <para>
50506 matches if the final component of the address is an odd number or two times
50507 an odd number.
50508 </para>
50509 </section>
50510 <section id="SECID205">
50511 <title>Negated DNS matching conditions</title>
50512 <para>
50513 You can supply a negative list of IP addresses as part of a <option>dnslists</option>
50514 condition. Whereas
50515 </para>
50516 <literallayout class="monospaced">
50517 deny  dnslists = a.b.c=127.0.0.2,127.0.0.3
50518 </literallayout>
50519 <para>
50520 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
50521 IP address yielded by the list is either 127.0.0.2 or 127.0.0.3</quote>,
50522 </para>
50523 <literallayout class="monospaced">
50524 deny  dnslists = a.b.c!=127.0.0.2,127.0.0.3
50525 </literallayout>
50526 <para>
50527 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
50528 IP address yielded by the list is not 127.0.0.2 and not 127.0.0.3</quote>. In other
50529 words, the result of the test is inverted if an exclamation mark appears before
50530 the <literal>=</literal> (or the <literal>&amp;</literal>) sign.
50531 </para>
50532 <para>
50533 <emphasis role="bold">Note</emphasis>: This kind of negation is not the same as negation in a domain,
50534 host, or address list (which is why the syntax is different).
50535 </para>
50536 <para>
50537 If you are using just one list, the negation syntax does not gain you much. The
50538 previous example is precisely equivalent to
50539 </para>
50540 <literallayout class="monospaced">
50541 deny  dnslists = a.b.c
50542      !dnslists = a.b.c=127.0.0.2,127.0.0.3
50543 </literallayout>
50544 <para>
50545 However, if you are using multiple lists, the negation syntax is clearer.
50546 Consider this example:
50547 </para>
50548 <literallayout class="monospaced">
50549 deny  dnslists = sbl.spamhaus.org : \
50550                  list.dsbl.org : \
50551                  dnsbl.njabl.org!=127.0.0.3 : \
50552                  relays.ordb.org
50553 </literallayout>
50554 <para>
50555 Using only positive lists, this would have to be:
50556 </para>
50557 <literallayout class="monospaced">
50558 deny  dnslists = sbl.spamhaus.org : \
50559                  list.dsbl.org
50560 deny  dnslists = dnsbl.njabl.org
50561      !dnslists = dnsbl.njabl.org=127.0.0.3
50562 deny  dnslists = relays.ordb.org
50563 </literallayout>
50564 <para>
50565 which is less clear, and harder to maintain.
50566 </para>
50567 </section>
50568 <section id="SECThanmuldnsrec">
50569 <title>Handling multiple DNS records from a DNS list</title>
50570 <para>
50571 A DNS lookup for a <option>dnslists</option> condition may return more than one DNS record,
50572 thereby providing more than one IP address. When an item in a <option>dnslists</option> list
50573 is followed by <literal>=</literal> or <literal>&amp;</literal> and a list of IP addresses, in order to restrict
50574 the match to specific results from the DNS lookup, there are two ways in which
50575 the checking can be handled. For example, consider the condition:
50576 </para>
50577 <literallayout class="monospaced">
50578 dnslists = a.b.c=127.0.0.1
50579 </literallayout>
50580 <para>
50581 What happens if the DNS lookup for the incoming IP address yields both
50582 127.0.0.1 and 127.0.0.2 by means of two separate DNS records? Is the
50583 condition true because at least one given value was found, or is it false
50584 because at least one of the found values was not listed? And how does this
50585 affect negated conditions? Both possibilities are provided for with the help of
50586 additional separators <literal>==</literal> and <literal>=&amp;</literal>.
50587 </para>
50588 <itemizedlist>
50589 <listitem>
50590 <para>
50591 If <literal>=</literal> or <literal>&amp;</literal> is used, the condition is true if any one of the looked up
50592 IP addresses matches one of the listed addresses. For the example above, the
50593 condition is true because 127.0.0.1 matches.
50594 </para>
50595 </listitem>
50596 <listitem>
50597 <para>
50598 If <literal>==</literal> or <literal>=&amp;</literal> is used, the condition is true only if every one of the
50599 looked up IP addresses matches one of the listed addresses. If the condition is
50600 changed to:
50601 </para>
50602 <literallayout class="monospaced">
50603 dnslists = a.b.c==127.0.0.1
50604 </literallayout>
50605 <para>
50606 and the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
50607 false because 127.0.0.2 is not listed. You would need to have:
50608 </para>
50609 <literallayout class="monospaced">
50610 dnslists = a.b.c==127.0.0.1,127.0.0.2
50611 </literallayout>
50612 <para>
50613 for the condition to be true.
50614 </para>
50615 </listitem>
50616 </itemizedlist>
50617 <para>
50618 When <literal>!</literal> is used to negate IP address matching, it inverts the result, giving
50619 the precise opposite of the behaviour above. Thus:
50620 </para>
50621 <itemizedlist>
50622 <listitem>
50623 <para>
50624 If <literal>!=</literal> or <literal>!&amp;</literal> is used, the condition is true if none of the looked up IP
50625 addresses matches one of the listed addresses. Consider:
50626 </para>
50627 <literallayout class="monospaced">
50628 dnslists = a.b.c!&amp;0.0.0.1
50629 </literallayout>
50630 <para>
50631 If the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
50632 false because 127.0.0.1 matches.
50633 </para>
50634 </listitem>
50635 <listitem>
50636 <para>
50637 If <literal>!==</literal> or <literal>!=&amp;</literal> is used, the condition is true there is at least one
50638 looked up IP address that does not match. Consider:
50639 </para>
50640 <literallayout class="monospaced">
50641 dnslists = a.b.c!=&amp;0.0.0.1
50642 </literallayout>
50643 <para>
50644 If the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
50645 true, because 127.0.0.2 does not match. You would need to have:
50646 </para>
50647 <literallayout class="monospaced">
50648 dnslists = a.b.c!=&amp;0.0.0.1,0.0.0.2
50649 </literallayout>
50650 <para>
50651 for the condition to be false.
50652 </para>
50653 </listitem>
50654 </itemizedlist>
50655 <para>
50656 When the DNS lookup yields only a single IP address, there is no difference
50657 between <literal>=</literal> and <literal>==</literal> and between <literal>&amp;</literal> and <literal>=&amp;</literal>.
50658 </para>
50659 </section>
50660 <section id="SECTmordetinf">
50661 <title>Detailed information from merged DNS lists</title>
50662 <para>
50663 <indexterm role="concept">
50664 <primary>DNS list</primary>
50665 <secondary>information from merged</secondary>
50666 </indexterm>
50667 When the facility for restricting the matching IP values in a DNS list is used,
50668 the text from the TXT record that is set in <varname>$dnslist_text</varname> may not reflect
50669 the true reason for rejection. This happens when lists are merged and the IP
50670 address in the A record is used to distinguish them; unfortunately there is
50671 only one TXT record. One way round this is not to use merged lists, but that
50672 can be inefficient because it requires multiple DNS lookups where one would do
50673 in the vast majority of cases when the host of interest is not on any of the
50674 lists.
50675 </para>
50676 <para>
50677 A less inefficient way of solving this problem is available. If
50678 two domain names, comma-separated, are given, the second is used first to
50679 do an initial check, making use of any IP value restrictions that are set.
50680 If there is a match, the first domain is used, without any IP value
50681 restrictions, to get the TXT record. As a byproduct of this, there is also
50682 a check that the IP being tested is indeed on the first list. The first
50683 domain is the one that is put in <varname>$dnslist_domain</varname>. For example:
50684 </para>
50685 <literallayout class="monospaced">
50686 reject message  = \
50687          rejected because $sender_host_address is blacklisted \
50688          at $dnslist_domain\n$dnslist_text
50689        dnslists = \
50690          sbl.spamhaus.org,sbl-xbl.spamhaus.org=127.0.0.2 : \
50691          dul.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.10
50692 </literallayout>
50693 <para>
50694 For the first blacklist item, this starts by doing a lookup in
50695 <emphasis>sbl-xbl.spamhaus.org</emphasis> and testing for a 127.0.0.2 return. If there is a
50696 match, it then looks in <emphasis>sbl.spamhaus.org</emphasis>, without checking the return
50697 value, and as long as something is found, it looks for the corresponding TXT
50698 record. If there is no match in <emphasis>sbl-xbl.spamhaus.org</emphasis>, nothing more is done.
50699 The second blacklist item is processed similarly.
50700 </para>
50701 <para>
50702 If you are interested in more than one merged list, the same list must be
50703 given several times, but because the results of the DNS lookups are cached,
50704 the DNS calls themselves are not repeated. For example:
50705 </para>
50706 <literallayout class="monospaced">
50707 reject dnslists = \
50708          http.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.2 : \
50709          socks.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.3 : \
50710          misc.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.4 : \
50711          dul.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.10
50712 </literallayout>
50713 <para>
50714 In this case there is one lookup in <emphasis>dnsbl.sorbs.net</emphasis>, and if none of the IP
50715 values matches (or if no record is found), this is the only lookup that is
50716 done. Only if there is a match is one of the more specific lists consulted.
50717 </para>
50718 </section>
50719 <section id="SECTmorednslistslast">
50720 <title>DNS lists and IPv6</title>
50721 <para>
50722 <indexterm role="concept">
50723 <primary>IPv6</primary>
50724 <secondary>DNS black lists</secondary>
50725 </indexterm>
50726 <indexterm role="concept">
50727 <primary>DNS list</primary>
50728 <secondary>IPv6 usage</secondary>
50729 </indexterm>
50730 If Exim is asked to do a dnslist lookup for an IPv6 address, it inverts it
50731 nibble by nibble. For example, if the calling host&#x2019;s IP address is
50732 3ffe:ffff:836f:0a00:000a:0800:200a:c031, Exim might look up
50733 </para>
50734 <literallayout class="monospaced">
50735 1.3.0.c.a.0.0.2.0.0.8.0.a.0.0.0.0.0.a.0.f.6.3.8.
50736   f.f.f.f.e.f.f.3.blackholes.mail-abuse.org
50737 </literallayout>
50738 <para>
50739 (split over two lines here to fit on the page). Unfortunately, some of the DNS
50740 lists contain wildcard records, intended for IPv4, that interact badly with
50741 IPv6. For example, the DNS entry
50742 </para>
50743 <literallayout class="monospaced">
50744 *.3.some.list.example.    A    127.0.0.1
50745 </literallayout>
50746 <para>
50747 is probably intended to put the entire 3.0.0.0/8 IPv4 network on the list.
50748 Unfortunately, it also matches the entire 3::/4 IPv6 network.
50749 </para>
50750 <para>
50751 You can exclude IPv6 addresses from DNS lookups by making use of a suitable
50752 <option>condition</option> condition, as in this example:
50753 </para>
50754 <literallayout class="monospaced">
50755 deny   condition = ${if isip4{$sender_host_address}}
50756        dnslists  = some.list.example
50757 </literallayout>
50758 </section>
50759 <section id="SECTratelimiting">
50760 <title>Rate limiting incoming messages</title>
50761 <para>
50762 <indexterm role="concept">
50763 <primary>rate limiting</primary>
50764 <secondary>client sending</secondary>
50765 </indexterm>
50766 <indexterm role="concept">
50767 <primary>limiting client sending rates</primary>
50768 </indexterm>
50769 <indexterm role="option">
50770 <primary><option>smtp_ratelimit_*</option></primary>
50771 </indexterm>
50772 The <option>ratelimit</option> ACL condition can be used to measure and control the rate at
50773 which clients can send email. This is more powerful than the
50774 <option>smtp_ratelimit_*</option> options, because those options control the rate of
50775 commands in a single SMTP session only, whereas the <option>ratelimit</option> condition
50776 works across all connections (concurrent and sequential) from the same client
50777 host. The syntax of the <option>ratelimit</option> condition is:
50778 </para>
50779 <literallayout>
50780 <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;
50781 </literallayout>
50782 <para>
50783 If the average client sending rate is less than <emphasis>m</emphasis> messages per time
50784 period <emphasis>p</emphasis> then the condition is false; otherwise it is true.
50785 </para>
50786 <para>
50787 As a side-effect, the <option>ratelimit</option> condition sets the expansion variable
50788 <varname>$sender_rate</varname> to the client&#x2019;s computed rate, <varname>$sender_rate_limit</varname> to the
50789 configured value of <emphasis>m</emphasis>, and <varname>$sender_rate_period</varname> to the configured value
50790 of <emphasis>p</emphasis>.
50791 </para>
50792 <para>
50793 The parameter <emphasis>p</emphasis> is the smoothing time constant, in the form of an Exim
50794 time interval, for example, <literal>8h</literal> for eight hours. A larger time constant
50795 means that it takes Exim longer to forget a client&#x2019;s past behaviour. The
50796 parameter <emphasis>m</emphasis> is the maximum number of messages that a client is permitted to
50797 send in each time interval. It also specifies the number of messages permitted
50798 in a fast burst. By increasing both <emphasis>m</emphasis> and <emphasis>p</emphasis> but keeping <emphasis>m/p</emphasis>
50799 constant, you can allow a client to send more messages in a burst without
50800 changing its long-term sending rate limit. Conversely, if <emphasis>m</emphasis> and <emphasis>p</emphasis> are
50801 both small, messages must be sent at an even rate.
50802 </para>
50803 <para>
50804 There is a script in <filename>util/ratelimit.pl</filename> which extracts sending rates from
50805 log files, to assist with choosing appropriate settings for <emphasis>m</emphasis> and <emphasis>p</emphasis>
50806 when deploying the <option>ratelimit</option> ACL condition. The script prints usage
50807 instructions when it is run with no arguments.
50808 </para>
50809 <para>
50810 The key is used to look up the data for calculating the client&#x2019;s average
50811 sending rate. This data is stored in Exim&#x2019;s spool directory, alongside the
50812 retry and other hints databases. The default key is <varname>$sender_host_address</varname>,
50813 which means Exim computes the sending rate of each client host IP address.
50814 By changing the key you can change how Exim identifies clients for the purpose
50815 of ratelimiting. For example, to limit the sending rate of each authenticated
50816 user, independent of the computer they are sending from, set the key to
50817 <varname>$authenticated_id</varname>. You must ensure that the lookup key is meaningful; for
50818 example, <varname>$authenticated_id</varname> is only meaningful if the client has
50819 authenticated (which you can check with the <option>authenticated</option> ACL condition).
50820 </para>
50821 <para>
50822 The lookup key does not have to identify clients: If you want to limit the
50823 rate at which a recipient receives messages, you can use the key
50824 <literal>$local_part@$domain</literal> with the <option>per_rcpt</option> option (see below) in a RCPT
50825 ACL.
50826 </para>
50827 <para>
50828 Internally, Exim appends the smoothing constant <emphasis>p</emphasis> and the options onto the
50829 lookup key because they alter the meaning of the stored data. This is not true
50830 for the limit <emphasis>m</emphasis>, so you can alter the configured maximum rate and Exim will
50831 still remember clients&#x2019; past behaviour, but if you alter the other ratelimit
50832 parameters Exim forgets past behaviour.
50833 </para>
50834 <para>
50835 Each <option>ratelimit</option> condition can have up to three options. One option
50836 specifies what Exim measures the rate of, and the second specifies how Exim
50837 handles excessively fast clients. The third option can be <literal>noupdate</literal>, to
50838 disable updating of the ratelimiting database (see section <xref linkend="rearatdat"/>).
50839 The options are separated by a slash, like the other parameters. They may
50840 appear in any order.
50841 </para>
50842 </section>
50843 <section id="ratoptmea">
50844 <title>Ratelimit options for what is being measured</title>
50845 <para>
50846 The <option>per_conn</option> option limits the client&#x2019;s connection rate.
50847 </para>
50848 <para>
50849 The <option>per_mail</option> option limits the client&#x2019;s rate of sending messages. This is
50850 the default if none of the <option>per_*</option> options is specified.
50851 </para>
50852 <para>
50853 The <option>per_byte</option> option limits the sender&#x2019;s email bandwidth. Note that it is
50854 best to use this option in the DATA ACL; if it is used in an earlier ACL it
50855 relies on the SIZE parameter specified by the client in its MAIL command,
50856 which may be inaccurate or completely missing. You can follow the limit <emphasis>m</emphasis>
50857 in the configuration with K, M, or G to specify limits in kilobytes,
50858 megabytes, or gigabytes, respectively.
50859 </para>
50860 <para>
50861 The <option>per_rcpt</option> option causes Exim to limit the rate at which
50862 recipients are accepted. To be effective, it would need to be used in
50863 either the <option>acl_smtp_rcpt</option> or the <option>acl_not_smtp</option> ACL. In the
50864 <option>acl_smtp_rcpt</option> ACL, the number of recipients is incremented by one.
50865 In the case of a locally submitted message in the <option>acl_not_smtp</option> ACL,
50866 the number of recipients is incremented by the <option>$recipients_count</option>
50867 for the entire message. Note that in either case the rate limiting
50868 engine will see a message with many recipients as a large high-speed
50869 burst.
50870 </para>
50871 <para>
50872 The <option>per_cmd</option> option causes Exim to recompute the rate every time the
50873 condition is processed. This can be used to limit the SMTP command rate.
50874 This command is essentially an alias of <option>per_rcpt</option> to make it clear
50875 that the effect is to limit the rate at which individual commands,
50876 rather than recipients, are accepted.
50877 </para>
50878 </section>
50879 <section id="ratophanfas">
50880 <title>Ratelimit options for handling fast clients</title>
50881 <para>
50882 If a client&#x2019;s average rate is greater than the maximum, the rate limiting
50883 engine can react in two possible ways, depending on the presence of the
50884 <option>strict</option> or <option>leaky</option> options. This is independent of the other
50885 counter-measures (such as rejecting the message) that may be specified by the
50886 rest of the ACL. The default mode is leaky, which avoids a sender&#x2019;s
50887 over-aggressive retry rate preventing it from getting any email through.
50888 </para>
50889 <para>
50890 The <option>strict</option> option means that the client&#x2019;s recorded rate is always
50891 updated. The effect of this is that Exim measures the client&#x2019;s average rate
50892 of attempts to send email, which can be much higher than the maximum it is
50893 actually allowed. If the client is over the limit it may be subjected to
50894 counter-measures by the ACL until it slows down below the maximum rate. If
50895 the client stops attempting to send email for the time specified in the <emphasis>p</emphasis>
50896 parameter then its computed rate will decay exponentially to 37% of its peak
50897 value. You can work out the time (the number of smoothing periods) that a
50898 client is subjected to counter-measures after an over-limit burst with this
50899 formula:
50900 </para>
50901 <literallayout class="monospaced">
50902         ln(peakrate/maxrate)
50903 </literallayout>
50904 <para>
50905 The <option>leaky</option> (default) option means that the client&#x2019;s recorded rate is not
50906 updated if it is above the limit. The effect of this is that Exim measures the
50907 client&#x2019;s average rate of successfully sent email, which cannot be greater than
50908 the maximum allowed. If the client is over the limit it may suffer some
50909 counter-measures (as specified in the ACL), but it will still be able to send
50910 email at the configured maximum rate, whatever the rate of its attempts. This
50911 is generally the better choice if you have clients that retry automatically.
50912 </para>
50913 </section>
50914 <section id="useratlim">
50915 <title>Using rate limiting</title>
50916 <para>
50917 Exim&#x2019;s other ACL facilities are used to define what counter-measures are taken
50918 when the rate limit is exceeded. This might be anything from logging a warning
50919 (for example, while measuring existing sending rates in order to define
50920 policy), through time delays to slow down fast senders, up to rejecting the
50921 message. For example:
50922 </para>
50923 <literallayout class="monospaced">
50924 # Log all senders' rates
50925 warn ratelimit = 0 / 1h / strict
50926      log_message = Sender rate $sender_rate / $sender_rate_period
50927
50928 # Slow down fast senders; note the need to truncate $sender_rate
50929 # at the decimal point.
50930 warn ratelimit = 100 / 1h / per_rcpt / strict
50931      delay     = ${eval: ${sg{$sender_rate}{[.].*}{}} - \
50932                    $sender_rate_limit }s
50933
50934 # Keep authenticated users under control
50935 deny authenticated = *
50936      ratelimit = 100 / 1d / strict / $authenticated_id
50937
50938 # System-wide rate limit
50939 defer message = Sorry, too busy. Try again later.
50940      ratelimit = 10 / 1s / $primary_hostname
50941
50942 # Restrict incoming rate from each host, with a default
50943 # set using a macro and special cases looked up in a table.
50944 defer message = Sender rate exceeds $sender_rate_limit \
50945                messages per $sender_rate_period
50946      ratelimit = ${lookup {$sender_host_address} \
50947                    cdb {DB/ratelimits.cdb} \
50948                    {$value} {RATELIMIT} }
50949 </literallayout>
50950 <para>
50951 <emphasis role="bold">Warning</emphasis>: If you have a busy server with a lot of <option>ratelimit</option> tests,
50952 especially with the <option>per_rcpt</option> option, you may suffer from a performance
50953 bottleneck caused by locking on the ratelimit hints database. Apart from
50954 making your ACLs less complicated, you can reduce the problem by using a
50955 RAM disk for Exim&#x2019;s hints directory (usually <filename>/var/spool/exim/db/</filename>). However
50956 this means that Exim will lose its hints data after a reboot (including retry
50957 hints, the callout cache, and ratelimit data).
50958 </para>
50959 </section>
50960 <section id="rearatdat">
50961 <title>Reading ratelimit data without updating</title>
50962 <para>
50963 <indexterm role="concept">
50964 <primary>rate limitint</primary>
50965 <secondary>reading data without updating</secondary>
50966 </indexterm>
50967 If the <option>noupdate</option> option is present on a <option>ratelimit</option> ACL condition, Exim
50968 computes the rate and checks the limit as normal, but it does not update the
50969 saved data. This means that, in relevant ACLs, it is possible to lookup the
50970 existence of a specified (or auto-generated) ratelimit key without incrementing
50971 the ratelimit counter for that key. In order for this to be useful, another ACL
50972 entry must set the rate for the same key (otherwise it will always be zero).
50973 For example:
50974 </para>
50975 <literallayout class="monospaced">
50976 acl_check_connect:
50977   deny ratelimit = 100 / 5m / strict / per_cmd / noupdate
50978        log_message = RATE: $sender_rate/$sender_rate_period \
50979                      (max $sender_rate_limit)
50980 </literallayout>
50981 <literallayout>
50982 <emphasis>... some other logic and tests...</emphasis>
50983 </literallayout>
50984 <literallayout class="monospaced">
50985 acl_check_mail:
50986   warn ratelimit = 100 / 5m / strict / per_cmd
50987        condition = ${if le{$sender_rate}{$sender_rate_limit}}
50988        logwrite  = RATE UPDATE: $sender_rate/$sender_rate_period \
50989                      (max $sender_rate_limit)
50990 </literallayout>
50991 <para>
50992 In this example, the rate is tested and used to deny access (when it is too
50993 high) in the connect ACL, but the actual computation of the remembered rate
50994 happens later, on a per-command basis, in another ACL.
50995 </para>
50996 </section>
50997 <section id="SECTaddressverification">
50998 <title>Address verification</title>
50999 <para>
51000 <indexterm role="concept">
51001 <primary>verifying address</primary>
51002 <secondary>options for</secondary>
51003 </indexterm>
51004 <indexterm role="concept">
51005 <primary>policy control</primary>
51006 <secondary>address verification</secondary>
51007 </indexterm>
51008 Several of the <option>verify</option> conditions described in section
51009 <xref linkend="SECTaclconditions"/> cause addresses to be verified. Section
51010 <xref linkend="SECTsenaddver"/> discusses the reporting of sender verification failures.
51011 The verification conditions can be followed by options that modify the
51012 verification process. The options are separated from the keyword and from each
51013 other by slashes, and some of them contain parameters. For example:
51014 </para>
51015 <literallayout class="monospaced">
51016 verify = sender/callout
51017 verify = recipient/defer_ok/callout=10s,defer_ok
51018 </literallayout>
51019 <para>
51020 The first stage of address verification, which always happens, is to run the
51021 address through the routers, in <quote>verify mode</quote>. Routers can detect the
51022 difference between verification and routing for delivery, and their actions can
51023 be varied by a number of generic options such as <option>verify</option> and <option>verify_only</option>
51024 (see chapter <xref linkend="CHAProutergeneric"/>). If routing fails, verification fails.
51025 The available options are as follows:
51026 </para>
51027 <itemizedlist>
51028 <listitem>
51029 <para>
51030 If the <option>callout</option> option is specified, successful routing to one or more
51031 remote hosts is followed by a <quote>callout</quote> to those hosts as an additional
51032 check. Callouts and their sub-options are discussed in the next section.
51033 </para>
51034 </listitem>
51035 <listitem>
51036 <para>
51037 If there is a defer error while doing verification routing, the ACL
51038 normally returns <quote>defer</quote>. However, if you include <option>defer_ok</option> in the
51039 options, the condition is forced to be true instead. Note that this is a main
51040 verification option as well as a suboption for callouts.
51041 </para>
51042 </listitem>
51043 <listitem>
51044 <para>
51045 The <option>no_details</option> option is covered in section <xref linkend="SECTsenaddver"/>, which
51046 discusses the reporting of sender address verification failures.
51047 </para>
51048 </listitem>
51049 <listitem>
51050 <para>
51051 The <option>success_on_redirect</option> option causes verification always to succeed
51052 immediately after a successful redirection. By default, if a redirection
51053 generates just one address, that address is also verified. See further
51054 discussion in section <xref linkend="SECTredirwhilveri"/>.
51055 </para>
51056 </listitem>
51057 </itemizedlist>
51058 <para>
51059 <indexterm role="concept">
51060 <primary>verifying address</primary>
51061 <secondary>differentiating failures</secondary>
51062 </indexterm>
51063 <indexterm role="variable">
51064 <primary><varname>$recipient_verify_failure</varname></primary>
51065 </indexterm>
51066 <indexterm role="variable">
51067 <primary><varname>$sender_verify_failure</varname></primary>
51068 </indexterm>
51069 <indexterm role="variable">
51070 <primary><varname>$acl_verify_message</varname></primary>
51071 </indexterm>
51072 After an address verification failure, <varname>$acl_verify_message</varname> contains the
51073 error message that is associated with the failure. It can be preserved by
51074 coding like this:
51075 </para>
51076 <literallayout class="monospaced">
51077 warn  !verify = sender
51078        set acl_m0 = $acl_verify_message
51079 </literallayout>
51080 <para>
51081 If you are writing your own custom rejection message or log message when
51082 denying access, you can use this variable to include information about the
51083 verification failure.
51084 </para>
51085 <para>
51086 In addition, <varname>$sender_verify_failure</varname> or <varname>$recipient_verify_failure</varname> (as
51087 appropriate) contains one of the following words:
51088 </para>
51089 <itemizedlist>
51090 <listitem>
51091 <para>
51092 <option>qualify</option>: The address was unqualified (no domain), and the message
51093 was neither local nor came from an exempted host.
51094 </para>
51095 </listitem>
51096 <listitem>
51097 <para>
51098 <option>route</option>: Routing failed.
51099 </para>
51100 </listitem>
51101 <listitem>
51102 <para>
51103 <option>mail</option>: Routing succeeded, and a callout was attempted; rejection
51104 occurred at or before the MAIL command (that is, on initial
51105 connection, HELO, or MAIL).
51106 </para>
51107 </listitem>
51108 <listitem>
51109 <para>
51110 <option>recipient</option>: The RCPT command in a callout was rejected.
51111 </para>
51112 </listitem>
51113 <listitem>
51114 <para>
51115 <option>postmaster</option>: The postmaster check in a callout was rejected.
51116 </para>
51117 </listitem>
51118 </itemizedlist>
51119 <para>
51120 The main use of these variables is expected to be to distinguish between
51121 rejections of MAIL and rejections of RCPT in callouts.
51122 </para>
51123 </section>
51124 <section id="SECTcallver">
51125 <title>Callout verification</title>
51126 <para>
51127 <indexterm role="concept">
51128 <primary>verifying address</primary>
51129 <secondary>by callout</secondary>
51130 </indexterm>
51131 <indexterm role="concept">
51132 <primary>callout</primary>
51133 <secondary>verification</secondary>
51134 </indexterm>
51135 <indexterm role="concept">
51136 <primary>SMTP</primary>
51137 <secondary>callout verification</secondary>
51138 </indexterm>
51139 For non-local addresses, routing verifies the domain, but is unable to do any
51140 checking of the local part. There are situations where some means of verifying
51141 the local part is desirable. One way this can be done is to make an SMTP
51142 <emphasis>callback</emphasis> to a delivery host for the sender address or a <emphasis>callforward</emphasis> to
51143 a subsequent host for a recipient address, to see if the host accepts the
51144 address. We use the term <emphasis>callout</emphasis> to cover both cases. Note that for a
51145 sender address, the callback is not to the client host that is trying to
51146 deliver the message, but to one of the hosts that accepts incoming mail for the
51147 sender&#x2019;s domain.
51148 </para>
51149 <para>
51150 Exim does not do callouts by default. If you want them to happen, you must
51151 request them by setting appropriate options on the <option>verify</option> condition, as
51152 described below. This facility should be used with care, because it can add a
51153 lot of resource usage to the cost of verifying an address. However, Exim does
51154 cache the results of callouts, which helps to reduce the cost. Details of
51155 caching are in section <xref linkend="SECTcallvercache"/>.
51156 </para>
51157 <para>
51158 Recipient callouts are usually used only between hosts that are controlled by
51159 the same administration. For example, a corporate gateway host could use
51160 callouts to check for valid recipients on an internal mailserver. A successful
51161 callout does not guarantee that a real delivery to the address would succeed;
51162 on the other hand, a failing callout does guarantee that a delivery would fail.
51163 </para>
51164 <para>
51165 If the <option>callout</option> option is present on a condition that verifies an address, a
51166 second stage of verification occurs if the address is successfully routed to
51167 one or more remote hosts. The usual case is routing by a <command>dnslookup</command> or a
51168 <command>manualroute</command> router, where the router specifies the hosts. However, if a
51169 router that does not set up hosts routes to an <command>smtp</command> transport with a
51170 <option>hosts</option> setting, the transport&#x2019;s hosts are used. If an <command>smtp</command> transport has
51171 <option>hosts_override</option> set, its hosts are always used, whether or not the router
51172 supplies a host list.
51173 </para>
51174 <para>
51175 The port that is used is taken from the transport, if it is specified and is a
51176 remote transport. (For routers that do verification only, no transport need be
51177 specified.) Otherwise, the default SMTP port is used. If a remote transport
51178 specifies an outgoing interface, this is used; otherwise the interface is not
51179 specified. Likewise, the text that is used for the HELO command is taken from
51180 the transport&#x2019;s <option>helo_data</option> option; if there is no transport, the value of
51181 <varname>$smtp_active_hostname</varname> is used.
51182 </para>
51183 <para>
51184 For a sender callout check, Exim makes SMTP connections to the remote hosts, to
51185 test whether a bounce message could be delivered to the sender address. The
51186 following SMTP commands are sent:
51187 </para>
51188 <literallayout>
51189 <literal>HELO </literal>&lt;<emphasis>local host name</emphasis>&gt;
51190 <literal>MAIL FROM:&lt;&gt;</literal>
51191 <literal>RCPT TO:</literal>&lt;<emphasis>the address to be tested</emphasis>&gt;
51192 <literal>QUIT</literal>
51193 </literallayout>
51194 <para>
51195 LHLO is used instead of HELO if the transport&#x2019;s <option>protocol</option> option is
51196 set to <quote>lmtp</quote>.
51197 </para>
51198 <para>
51199 A recipient callout check is similar. By default, it also uses an empty address
51200 for the sender. This default is chosen because most hosts do not make use of
51201 the sender address when verifying a recipient. Using the same address means
51202 that a single cache entry can be used for each recipient. Some sites, however,
51203 do make use of the sender address when verifying. These are catered for by the
51204 <option>use_sender</option> and <option>use_postmaster</option> options, described in the next section.
51205 </para>
51206 <para>
51207 If the response to the RCPT command is a 2<emphasis>xx</emphasis> code, the verification
51208 succeeds. If it is 5<emphasis>xx</emphasis>, the verification fails. For any other condition,
51209 Exim tries the next host, if any. If there is a problem with all the remote
51210 hosts, the ACL yields <quote>defer</quote>, unless the <option>defer_ok</option> parameter of the
51211 <option>callout</option> option is given, in which case the condition is forced to succeed.
51212 </para>
51213 <para>
51214 <indexterm role="concept">
51215 <primary>SMTP</primary>
51216 <secondary>output flushing, disabling for callout</secondary>
51217 </indexterm>
51218 A callout may take a little time. For this reason, Exim normally flushes SMTP
51219 output before performing a callout in an ACL, to avoid unexpected timeouts in
51220 clients when the SMTP PIPELINING extension is in use. The flushing can be
51221 disabled by using a <option>control</option> modifier to set <option>no_callout_flush</option>.
51222 </para>
51223 </section>
51224 <section id="CALLaddparcall">
51225 <title>Additional parameters for callouts</title>
51226 <para>
51227 <indexterm role="concept">
51228 <primary>callout</primary>
51229 <secondary>additional parameters for</secondary>
51230 </indexterm>
51231 The <option>callout</option> option can be followed by an equals sign and a number of
51232 optional parameters, separated by commas. For example:
51233 </para>
51234 <literallayout class="monospaced">
51235 verify = recipient/callout=10s,defer_ok
51236 </literallayout>
51237 <para>
51238 The old syntax, which had <option>callout_defer_ok</option> and <option>check_postmaster</option> as
51239 separate verify options, is retained for backwards compatibility, but is now
51240 deprecated. The additional parameters for <option>callout</option> are as follows:
51241 </para>
51242 <variablelist>
51243 <varlistentry>
51244 <term>&lt;<emphasis>a&nbsp;time&nbsp;interval</emphasis>&gt;</term>
51245 <listitem>
51246 <para>
51247 <indexterm role="concept">
51248 <primary>callout</primary>
51249 <secondary>timeout, specifying</secondary>
51250 </indexterm>
51251 This specifies the timeout that applies for the callout attempt to each host.
51252 For example:
51253 </para>
51254 <literallayout class="monospaced">
51255 verify = sender/callout=5s
51256 </literallayout>
51257 <para>
51258 The default is 30 seconds. The timeout is used for each response from the
51259 remote host. It is also used for the initial connection, unless overridden by
51260 the <option>connect</option> parameter.
51261 </para>
51262 </listitem></varlistentry>
51263 <varlistentry>
51264 <term><emphasis role="bold">connect&nbsp;=&nbsp;</emphasis>&lt;<emphasis>time&nbsp;interval</emphasis>&gt;</term>
51265 <listitem>
51266 <para>
51267 <indexterm role="concept">
51268 <primary>callout</primary>
51269 <secondary>connection timeout, specifying</secondary>
51270 </indexterm>
51271 This parameter makes it possible to set a different (usually smaller) timeout
51272 for making the SMTP connection. For example:
51273 </para>
51274 <literallayout class="monospaced">
51275 verify = sender/callout=5s,connect=1s
51276 </literallayout>
51277 <para>
51278 If not specified, this timeout defaults to the general timeout value.
51279 </para>
51280 </listitem></varlistentry>
51281 <varlistentry>
51282 <term><emphasis role="bold">defer_ok</emphasis></term>
51283 <listitem>
51284 <para>
51285 <indexterm role="concept">
51286 <primary>callout</primary>
51287 <secondary>defer, action on</secondary>
51288 </indexterm>
51289 When this parameter is present, failure to contact any host, or any other kind
51290 of temporary error, is treated as success by the ACL. However, the cache is not
51291 updated in this circumstance.
51292 </para>
51293 </listitem></varlistentry>
51294 <varlistentry>
51295 <term><emphasis role="bold">fullpostmaster</emphasis></term>
51296 <listitem>
51297 <para>
51298 <indexterm role="concept">
51299 <primary>callout</primary>
51300 <secondary>full postmaster check</secondary>
51301 </indexterm>
51302 This operates like the <option>postmaster</option> option (see below), but if the check for
51303 <emphasis>postmaster@domain</emphasis> fails, it tries just <emphasis>postmaster</emphasis>, without a domain, in
51304 accordance with the specification in RFC 2821. The RFC states that the
51305 unqualified address <emphasis>postmaster</emphasis> should be accepted.
51306 </para>
51307 </listitem></varlistentry>
51308 <varlistentry>
51309 <term><emphasis role="bold">mailfrom&nbsp;=&nbsp;</emphasis>&lt;<emphasis>email&nbsp;address</emphasis>&gt;</term>
51310 <listitem>
51311 <para>
51312 <indexterm role="concept">
51313 <primary>callout</primary>
51314 <secondary>sender when verifying header</secondary>
51315 </indexterm>
51316 When verifying addresses in header lines using the <option>header_sender</option>
51317 verification option, Exim behaves by default as if the addresses are envelope
51318 sender addresses from a message. Callout verification therefore tests to see
51319 whether a bounce message could be delivered, by using an empty address in the
51320 MAIL command. However, it is arguable that these addresses might never be used
51321 as envelope senders, and could therefore justifiably reject bounce messages
51322 (empty senders). The <option>mailfrom</option> callout parameter allows you to specify what
51323 address to use in the MAIL command. For example:
51324 </para>
51325 <literallayout class="monospaced">
51326 require  verify = header_sender/callout=mailfrom=abcd@x.y.z
51327 </literallayout>
51328 <para>
51329 This parameter is available only for the <option>header_sender</option> verification option.
51330 </para>
51331 </listitem></varlistentry>
51332 <varlistentry>
51333 <term><emphasis role="bold">maxwait&nbsp;=&nbsp;</emphasis>&lt;<emphasis>time&nbsp;interval</emphasis>&gt;</term>
51334 <listitem>
51335 <para>
51336 <indexterm role="concept">
51337 <primary>callout</primary>
51338 <secondary>overall timeout, specifying</secondary>
51339 </indexterm>
51340 This parameter sets an overall timeout for performing a callout verification.
51341 For example:
51342 </para>
51343 <literallayout class="monospaced">
51344 verify = sender/callout=5s,maxwait=30s
51345 </literallayout>
51346 <para>
51347 This timeout defaults to four times the callout timeout for individual SMTP
51348 commands. The overall timeout applies when there is more than one host that can
51349 be tried. The timeout is checked before trying the next host. This prevents
51350 very long delays if there are a large number of hosts and all are timing out
51351 (for example, when network connections are timing out).
51352 </para>
51353 </listitem></varlistentry>
51354 <varlistentry>
51355 <term><emphasis role="bold">no_cache</emphasis></term>
51356 <listitem>
51357 <para>
51358 <indexterm role="concept">
51359 <primary>callout</primary>
51360 <secondary>cache, suppressing</secondary>
51361 </indexterm>
51362 <indexterm role="concept">
51363 <primary>caching callout, suppressing</primary>
51364 </indexterm>
51365 When this parameter is given, the callout cache is neither read nor updated.
51366 </para>
51367 </listitem></varlistentry>
51368 <varlistentry>
51369 <term><emphasis role="bold">postmaster</emphasis></term>
51370 <listitem>
51371 <para>
51372 <indexterm role="concept">
51373 <primary>callout</primary>
51374 <secondary>postmaster; checking</secondary>
51375 </indexterm>
51376 When this parameter is set, a successful callout check is followed by a similar
51377 check for the local part <emphasis>postmaster</emphasis> at the same domain. If this address is
51378 rejected, the callout fails (but see <option>fullpostmaster</option> above). The result of
51379 the postmaster check is recorded in a cache record; if it is a failure, this is
51380 used to fail subsequent callouts for the domain without a connection being
51381 made, until the cache record expires.
51382 </para>
51383 </listitem></varlistentry>
51384 <varlistentry>
51385 <term><emphasis role="bold">postmaster_mailfrom&nbsp;=&nbsp;</emphasis>&lt;<emphasis>email&nbsp;address</emphasis>&gt;</term>
51386 <listitem>
51387 <para>
51388 The postmaster check uses an empty sender in the MAIL command by default.
51389 You can use this parameter to do a postmaster check using a different address.
51390 For example:
51391 </para>
51392 <literallayout class="monospaced">
51393 require  verify = sender/callout=postmaster_mailfrom=abc@x.y.z
51394 </literallayout>
51395 <para>
51396 If both <option>postmaster</option> and <option>postmaster_mailfrom</option> are present, the rightmost
51397 one overrides. The <option>postmaster</option> parameter is equivalent to this example:
51398 </para>
51399 <literallayout class="monospaced">
51400 require  verify = sender/callout=postmaster_mailfrom=
51401 </literallayout>
51402 <para>
51403 <emphasis role="bold">Warning</emphasis>: The caching arrangements for postmaster checking do not take
51404 account of the sender address. It is assumed that either the empty address or
51405 a fixed non-empty address will be used. All that Exim remembers is that the
51406 postmaster check for the domain succeeded or failed.
51407 </para>
51408 </listitem></varlistentry>
51409 <varlistentry>
51410 <term><emphasis role="bold">random</emphasis></term>
51411 <listitem>
51412 <para>
51413 <indexterm role="concept">
51414 <primary>callout</primary>
51415 <secondary><quote>random</quote> check</secondary>
51416 </indexterm>
51417 When this parameter is set, before doing the normal callout check, Exim does a
51418 check for a <quote>random</quote> local part at the same domain. The local part is not
51419 really random &ndash; it is defined by the expansion of the option
51420 <option>callout_random_local_part</option>, which defaults to
51421 </para>
51422 <literallayout class="monospaced">
51423 $primary_host_name-$tod_epoch-testing
51424 </literallayout>
51425 <para>
51426 The idea here is to try to determine whether the remote host accepts all local
51427 parts without checking. If it does, there is no point in doing callouts for
51428 specific local parts. If the <quote>random</quote> check succeeds, the result is saved in
51429 a cache record, and used to force the current and subsequent callout checks to
51430 succeed without a connection being made, until the cache record expires.
51431 </para>
51432 </listitem></varlistentry>
51433 <varlistentry>
51434 <term><emphasis role="bold">use_postmaster</emphasis></term>
51435 <listitem>
51436 <para>
51437 <indexterm role="concept">
51438 <primary>callout</primary>
51439 <secondary>sender for recipient check</secondary>
51440 </indexterm>
51441 This parameter applies to recipient callouts only. For example:
51442 </para>
51443 <literallayout class="monospaced">
51444 deny  !verify = recipient/callout=use_postmaster
51445 </literallayout>
51446 <para>
51447 <indexterm role="variable">
51448 <primary><varname>$qualify_domain</varname></primary>
51449 </indexterm>
51450 It causes a non-empty postmaster address to be used in the MAIL command when
51451 performing the callout for the recipient, and also for a <quote>random</quote> check if
51452 that is configured. The local part of the address is <literal>postmaster</literal> and the
51453 domain is the contents of <varname>$qualify_domain</varname>.
51454 </para>
51455 </listitem></varlistentry>
51456 <varlistentry>
51457 <term><emphasis role="bold">use_sender</emphasis></term>
51458 <listitem>
51459 <para>
51460 This option applies to recipient callouts only. For example:
51461 </para>
51462 <literallayout class="monospaced">
51463 require  verify = recipient/callout=use_sender
51464 </literallayout>
51465 <para>
51466 It causes the message&#x2019;s actual sender address to be used in the MAIL
51467 command when performing the callout, instead of an empty address. There is no
51468 need to use this option unless you know that the called hosts make use of the
51469 sender when checking recipients. If used indiscriminately, it reduces the
51470 usefulness of callout caching.
51471 </para>
51472 </listitem></varlistentry>
51473 </variablelist>
51474 <para>
51475 If you use any of the parameters that set a non-empty sender for the MAIL
51476 command (<option>mailfrom</option>, <option>postmaster_mailfrom</option>, <option>use_postmaster</option>, or
51477 <option>use_sender</option>), you should think about possible loops. Recipient checking is
51478 usually done between two hosts that are under the same management, and the host
51479 that receives the callouts is not normally configured to do callouts itself.
51480 Therefore, it is normally safe to use <option>use_postmaster</option> or <option>use_sender</option> in
51481 these circumstances.
51482 </para>
51483 <para>
51484 However, if you use a non-empty sender address for a callout to an arbitrary
51485 host, there is the likelihood that the remote host will itself initiate a
51486 callout check back to your host. As it is checking what appears to be a message
51487 sender, it is likely to use an empty address in MAIL, thus avoiding a
51488 callout loop. However, to be on the safe side it would be best to set up your
51489 own ACLs so that they do not do sender verification checks when the recipient
51490 is the address you use for header sender or postmaster callout checking.
51491 </para>
51492 <para>
51493 Another issue to think about when using non-empty senders for callouts is
51494 caching. When you set <option>mailfrom</option> or <option>use_sender</option>, the cache record is keyed
51495 by the sender/recipient combination; thus, for any given recipient, many more
51496 actual callouts are performed than when an empty sender or postmaster is used.
51497 </para>
51498 </section>
51499 <section id="SECTcallvercache">
51500 <title>Callout caching</title>
51501 <para>
51502 <indexterm role="concept">
51503 <primary>hints database</primary>
51504 <secondary>callout cache</secondary>
51505 </indexterm>
51506 <indexterm role="concept">
51507 <primary>callout</primary>
51508 <secondary>cache, description of</secondary>
51509 </indexterm>
51510 <indexterm role="concept">
51511 <primary>caching</primary>
51512 <secondary>callout</secondary>
51513 </indexterm>
51514 Exim caches the results of callouts in order to reduce the amount of resources
51515 used, unless you specify the <option>no_cache</option> parameter with the <option>callout</option>
51516 option. A hints database called <quote>callout</quote> is used for the cache. Two
51517 different record types are used: one records the result of a callout check for
51518 a specific address, and the other records information that applies to the
51519 entire domain (for example, that it accepts the local part <emphasis>postmaster</emphasis>).
51520 </para>
51521 <para>
51522 When an original callout fails, a detailed SMTP error message is given about
51523 the failure. However, for subsequent failures use the cache data, this message
51524 is not available.
51525 </para>
51526 <para>
51527 The expiry times for negative and positive address cache records are
51528 independent, and can be set by the global options <option>callout_negative_expire</option>
51529 (default 2h) and <option>callout_positive_expire</option> (default 24h), respectively.
51530 </para>
51531 <para>
51532 If a host gives a negative response to an SMTP connection, or rejects any
51533 commands up to and including
51534 </para>
51535 <literallayout class="monospaced">
51536 MAIL FROM:&lt;&gt;
51537 </literallayout>
51538 <para>
51539 (but not including the MAIL command with a non-empty address),
51540 any callout attempt is bound to fail. Exim remembers such failures in a
51541 domain cache record, which it uses to fail callouts for the domain without
51542 making new connections, until the domain record times out. There are two
51543 separate expiry times for domain cache records:
51544 <option>callout_domain_negative_expire</option> (default 3h) and
51545 <option>callout_domain_positive_expire</option> (default 7d).
51546 </para>
51547 <para>
51548 Domain records expire when the negative expiry time is reached if callouts
51549 cannot be made for the domain, or if the postmaster check failed.
51550 Otherwise, they expire when the positive expiry time is reached. This
51551 ensures that, for example, a host that stops accepting <quote>random</quote> local parts
51552 will eventually be noticed.
51553 </para>
51554 <para>
51555 The callout caching mechanism is based on the domain of the address that is
51556 being tested. If the domain routes to several hosts, it is assumed that their
51557 behaviour will be the same.
51558 </para>
51559 </section>
51560 <section id="SECTsenaddver">
51561 <title>Sender address verification reporting</title>
51562 <para>
51563 <indexterm role="concept">
51564 <primary>verifying</primary>
51565 <secondary>suppressing error details</secondary>
51566 </indexterm>
51567 See section <xref linkend="SECTaddressverification"/> for a general discussion of
51568 verification. When sender verification fails in an ACL, the details of the
51569 failure are given as additional output lines before the 550 response to the
51570 relevant SMTP command (RCPT or DATA). For example, if sender callout is in use,
51571 you might see:
51572 </para>
51573 <literallayout class="monospaced">
51574 MAIL FROM:&lt;xyz@abc.example&gt;
51575 250 OK
51576 RCPT TO:&lt;pqr@def.example&gt;
51577 550-Verification failed for &lt;xyz@abc.example&gt;
51578 550-Called:   192.168.34.43
51579 550-Sent:     RCPT TO:&lt;xyz@abc.example&gt;
51580 550-Response: 550 Unknown local part xyz in &lt;xyz@abc.example&gt;
51581 550 Sender verification failed
51582 </literallayout>
51583 <para>
51584 If more than one RCPT command fails in the same way, the details are given
51585 only for the first of them. However, some administrators do not want to send
51586 out this much information. You can suppress the details by adding
51587 <literal>/no_details</literal> to the ACL statement that requests sender verification. For
51588 example:
51589 </para>
51590 <literallayout class="monospaced">
51591 verify = sender/no_details
51592 </literallayout>
51593 </section>
51594 <section id="SECTredirwhilveri">
51595 <title>Redirection while verifying</title>
51596 <para>
51597 <indexterm role="concept">
51598 <primary>verifying</primary>
51599 <secondary>redirection while</secondary>
51600 </indexterm>
51601 <indexterm role="concept">
51602 <primary>address redirection</primary>
51603 <secondary>while verifying</secondary>
51604 </indexterm>
51605 A dilemma arises when a local address is redirected by aliasing or forwarding
51606 during verification: should the generated addresses themselves be verified,
51607 or should the successful expansion of the original address be enough to verify
51608 it? By default, Exim takes the following pragmatic approach:
51609 </para>
51610 <itemizedlist>
51611 <listitem>
51612 <para>
51613 When an incoming address is redirected to just one child address, verification
51614 continues with the child address, and if that fails to verify, the original
51615 verification also fails.
51616 </para>
51617 </listitem>
51618 <listitem>
51619 <para>
51620 When an incoming address is redirected to more than one child address,
51621 verification does not continue. A success result is returned.
51622 </para>
51623 </listitem>
51624 </itemizedlist>
51625 <para>
51626 This seems the most reasonable behaviour for the common use of aliasing as a
51627 way of redirecting different local parts to the same mailbox. It means, for
51628 example, that a pair of alias entries of the form
51629 </para>
51630 <literallayout class="monospaced">
51631 A.Wol:   aw123
51632 aw123:   :fail: Gone away, no forwarding address
51633 </literallayout>
51634 <para>
51635 work as expected, with both local parts causing verification failure. When a
51636 redirection generates more than one address, the behaviour is more like a
51637 mailing list, where the existence of the alias itself is sufficient for
51638 verification to succeed.
51639 </para>
51640 <para>
51641 It is possible, however, to change the default behaviour so that all successful
51642 redirections count as successful verifications, however many new addresses are
51643 generated. This is specified by the <option>success_on_redirect</option> verification
51644 option. For example:
51645 </para>
51646 <literallayout class="monospaced">
51647 require verify = recipient/success_on_redirect/callout=10s
51648 </literallayout>
51649 <para>
51650 In this example, verification succeeds if a router generates a new address, and
51651 the callout does not occur, because no address was routed to a remote host.
51652 </para>
51653 <para>
51654 When verification is being tested via the <option>-bv</option> option, the treatment of
51655 redirections is as just described, unless the <option>-v</option> or any debugging option is
51656 also specified. In that case, full verification is done for every generated
51657 address and a report is output for each of them.
51658 </para>
51659 </section>
51660 <section id="SECTverifyCSA">
51661 <title>Client SMTP authorization (CSA)</title>
51662 <para>
51663 <indexterm role="concept">
51664 <primary>CSA</primary>
51665 <secondary>verifying</secondary>
51666 </indexterm>
51667 Client SMTP Authorization is a system that allows a site to advertise
51668 which machines are and are not permitted to send email. This is done by placing
51669 special SRV records in the DNS; these are looked up using the client&#x2019;s HELO
51670 domain. At the time of writing, CSA is still an Internet Draft. Client SMTP
51671 Authorization checks in Exim are performed by the ACL condition:
51672 </para>
51673 <literallayout class="monospaced">
51674 verify = csa
51675 </literallayout>
51676 <para>
51677 This fails if the client is not authorized. If there is a DNS problem, or if no
51678 valid CSA SRV record is found, or if the client is authorized, the condition
51679 succeeds. These three cases can be distinguished using the expansion variable
51680 <varname>$csa_status</varname>, which can take one of the values <quote>fail</quote>, <quote>defer</quote>,
51681 <quote>unknown</quote>, or <quote>ok</quote>. The condition does not itself defer because that would
51682 be likely to cause problems for legitimate email.
51683 </para>
51684 <para>
51685 The error messages produced by the CSA code include slightly more
51686 detail. If <varname>$csa_status</varname> is <quote>defer</quote>, this may be because of problems
51687 looking up the CSA SRV record, or problems looking up the CSA target
51688 address record. There are four reasons for <varname>$csa_status</varname> being <quote>fail</quote>:
51689 </para>
51690 <itemizedlist>
51691 <listitem>
51692 <para>
51693 The client&#x2019;s host name is explicitly not authorized.
51694 </para>
51695 </listitem>
51696 <listitem>
51697 <para>
51698 The client&#x2019;s IP address does not match any of the CSA target IP addresses.
51699 </para>
51700 </listitem>
51701 <listitem>
51702 <para>
51703 The client&#x2019;s host name is authorized but it has no valid target IP addresses
51704 (for example, the target&#x2019;s addresses are IPv6 and the client is using IPv4).
51705 </para>
51706 </listitem>
51707 <listitem>
51708 <para>
51709 The client&#x2019;s host name has no CSA SRV record but a parent domain has asserted
51710 that all subdomains must be explicitly authorized.
51711 </para>
51712 </listitem>
51713 </itemizedlist>
51714 <para>
51715 The <option>csa</option> verification condition can take an argument which is the domain to
51716 use for the DNS query. The default is:
51717 </para>
51718 <literallayout class="monospaced">
51719 verify = csa/$sender_helo_name
51720 </literallayout>
51721 <para>
51722 This implementation includes an extension to CSA. If the query domain
51723 is an address literal such as [192.0.2.95], or if it is a bare IP
51724 address, Exim searches for CSA SRV records in the reverse DNS as if
51725 the HELO domain was (for example) <emphasis>95.2.0.192.in-addr.arpa</emphasis>. Therefore it is
51726 meaningful to say:
51727 </para>
51728 <literallayout class="monospaced">
51729 verify = csa/$sender_host_address
51730 </literallayout>
51731 <para>
51732 In fact, this is the check that Exim performs if the client does not say HELO.
51733 This extension can be turned off by setting the main configuration option
51734 <option>dns_csa_use_reverse</option> to be false.
51735 </para>
51736 <para>
51737 If a CSA SRV record is not found for the domain itself, a search
51738 is performed through its parent domains for a record which might be
51739 making assertions about subdomains. The maximum depth of this search is limited
51740 using the main configuration option <option>dns_csa_search_limit</option>, which is 5 by
51741 default. Exim does not look for CSA SRV records in a top level domain, so the
51742 default settings handle HELO domains as long as seven
51743 (<emphasis>hostname.five.four.three.two.one.com</emphasis>). This encompasses the vast majority
51744 of legitimate HELO domains.
51745 </para>
51746 <para>
51747 The <emphasis>dnsdb</emphasis> lookup also has support for CSA. Although <emphasis>dnsdb</emphasis> also supports
51748 direct SRV lookups, this is not sufficient because of the extra parent domain
51749 search behaviour of CSA, and (as with PTR lookups) <emphasis>dnsdb</emphasis> also turns IP
51750 addresses into lookups in the reverse DNS space. The result of a successful
51751 lookup such as:
51752 </para>
51753 <literallayout class="monospaced">
51754 ${lookup dnsdb {csa=$sender_helo_name}}
51755 </literallayout>
51756 <para>
51757 has two space-separated fields: an authorization code and a target host name.
51758 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
51759 authorization required but absent, or <quote>?</quote> for unknown.
51760 </para>
51761 </section>
51762 <section id="SECTverifyPRVS">
51763 <title>Bounce address tag validation</title>
51764 <para>
51765 <indexterm role="concept">
51766 <primary>BATV, verifying</primary>
51767 </indexterm>
51768 Bounce address tag validation (BATV) is a scheme whereby the envelope senders
51769 of outgoing messages have a cryptographic, timestamped <quote>tag</quote> added to them.
51770 Genuine incoming bounce messages should therefore always be addressed to
51771 recipients that have a valid tag. This scheme is a way of detecting unwanted
51772 bounce messages caused by sender address forgeries (often called <quote>collateral
51773 spam</quote>), because the recipients of such messages do not include valid tags.
51774 </para>
51775 <para>
51776 There are two expansion items to help with the implementation of the BATV
51777 <quote>prvs</quote> (private signature) scheme in an Exim configuration. This scheme signs
51778 the original envelope sender address by using a simple key to add a hash of the
51779 address and some time-based randomizing information. The <option>prvs</option> expansion
51780 item creates a signed address, and the <option>prvscheck</option> expansion item checks one.
51781 The syntax of these expansion items is described in section
51782 <xref linkend="SECTexpansionitems"/>.
51783 </para>
51784 <para>
51785 As an example, suppose the secret per-address keys are stored in an MySQL
51786 database. A query to look up the key for an address could be defined as a macro
51787 like this:
51788 </para>
51789 <literallayout class="monospaced">
51790 PRVSCHECK_SQL = ${lookup mysql{SELECT secret FROM batv_prvs \
51791                 WHERE sender='${quote_mysql:$prvscheck_address}'\
51792                 }{$value}}
51793 </literallayout>
51794 <para>
51795 Suppose also that the senders who make use of BATV are defined by an address
51796 list called <option>batv_senders</option>. Then, in the ACL for RCPT commands, you could
51797 use this:
51798 </para>
51799 <literallayout class="monospaced">
51800 # Bounces: drop unsigned addresses for BATV senders
51801 deny message = This address does not send an unsigned reverse path
51802      senders = :
51803      recipients = +batv_senders
51804
51805 # Bounces: In case of prvs-signed address, check signature.
51806 deny message = Invalid reverse path signature.
51807      senders = :
51808      condition  = ${prvscheck {$local_part@$domain}\
51809                   {PRVSCHECK_SQL}{1}}
51810      !condition = $prvscheck_result
51811 </literallayout>
51812 <para>
51813 The first statement rejects recipients for bounce messages that are addressed
51814 to plain BATV sender addresses, because it is known that BATV senders do not
51815 send out messages with plain sender addresses. The second statement rejects
51816 recipients that are prvs-signed, but with invalid signatures (either because
51817 the key is wrong, or the signature has timed out).
51818 </para>
51819 <para>
51820 A non-prvs-signed address is not rejected by the second statement, because the
51821 <option>prvscheck</option> expansion yields an empty string if its first argument is not a
51822 prvs-signed address, thus causing the <option>condition</option> condition to be false. If
51823 the first argument is a syntactically valid prvs-signed address, the yield is
51824 the third string (in this case <quote>1</quote>), whether or not the cryptographic and
51825 timeout checks succeed. The <varname>$prvscheck_result</varname> variable contains the result
51826 of the checks (empty for failure, <quote>1</quote> for success).
51827 </para>
51828 <para>
51829 There is one more issue you must consider when implementing prvs-signing:
51830 you have to ensure that the routers accept prvs-signed addresses and
51831 deliver them correctly. The easiest way to handle this is to use a <command>redirect</command>
51832 router to remove the signature with a configuration along these lines:
51833 </para>
51834 <literallayout class="monospaced">
51835 batv_redirect:
51836   driver = redirect
51837   data = ${prvscheck {$local_part@$domain}{PRVSCHECK_SQL}}
51838 </literallayout>
51839 <para>
51840 This works because, if the third argument of <option>prvscheck</option> is empty, the result
51841 of the expansion of a prvs-signed address is the decoded value of the original
51842 address. This router should probably be the first of your routers that handles
51843 local addresses.
51844 </para>
51845 <para>
51846 To create BATV-signed addresses in the first place, a transport of this form
51847 can be used:
51848 </para>
51849 <literallayout class="monospaced">
51850 external_smtp_batv:
51851   driver = smtp
51852   return_path = ${prvs {$return_path} \
51853                        {${lookup mysql{SELECT \
51854                        secret FROM batv_prvs WHERE \
51855                        sender='${quote_mysql:$sender_address}'} \
51856                        {$value}fail}}}
51857 </literallayout>
51858 <para>
51859 If no key can be found for the existing return path, no signing takes place.
51860 </para>
51861 </section>
51862 <section id="SECTrelaycontrol">
51863 <title>Using an ACL to control relaying</title>
51864 <para>
51865 <indexterm role="concept">
51866 <primary>access control lists (ACLs)</primary>
51867 <secondary>relay control</secondary>
51868 </indexterm>
51869 <indexterm role="concept">
51870 <primary>relaying</primary>
51871 <secondary>control by ACL</secondary>
51872 </indexterm>
51873 <indexterm role="concept">
51874 <primary>policy control</primary>
51875 <secondary>relay control</secondary>
51876 </indexterm>
51877 An MTA is said to <emphasis>relay</emphasis> a message if it receives it from some host and
51878 delivers it directly to another host as a result of a remote address contained
51879 within it. Redirecting a local address via an alias or forward file and then
51880 passing the message on to another host is not relaying,
51881 <indexterm role="concept">
51882 <primary><quote>percent hack</quote></primary>
51883 </indexterm>
51884 but a redirection as a result of the <quote>percent hack</quote> is.
51885 </para>
51886 <para>
51887 Two kinds of relaying exist, which are termed <quote>incoming</quote> and <quote>outgoing</quote>.
51888 A host which is acting as a gateway or an MX backup is concerned with incoming
51889 relaying from arbitrary hosts to a specific set of domains. On the other hand,
51890 a host which is acting as a smart host for a number of clients is concerned
51891 with outgoing relaying from those clients to the Internet at large. Often the
51892 same host is fulfilling both functions,
51893 but in principle these two kinds of relaying are entirely independent. What is
51894 not wanted is the transmission of mail from arbitrary remote hosts through your
51895 system to arbitrary domains.
51896 </para>
51897 <para>
51898 You can implement relay control by means of suitable statements in the ACL that
51899 runs for each RCPT command. For convenience, it is often easiest to use
51900 Exim&#x2019;s named list facility to define the domains and hosts involved. For
51901 example, suppose you want to do the following:
51902 </para>
51903 <itemizedlist>
51904 <listitem>
51905 <para>
51906 Deliver a number of domains to mailboxes on the local host (or process them
51907 locally in some other way). Let&#x2019;s say these are <emphasis>my.dom1.example</emphasis> and
51908 <emphasis>my.dom2.example</emphasis>.
51909 </para>
51910 </listitem>
51911 <listitem>
51912 <para>
51913 Relay mail for a number of other domains for which you are the secondary MX.
51914 These might be <emphasis>friend1.example</emphasis> and <emphasis>friend2.example</emphasis>.
51915 </para>
51916 </listitem>
51917 <listitem>
51918 <para>
51919 Relay mail from the hosts on your local LAN, to whatever domains are involved.
51920 Suppose your LAN is 192.168.45.0/24.
51921 </para>
51922 </listitem>
51923 </itemizedlist>
51924 <para>
51925 In the main part of the configuration, you put the following definitions:
51926 </para>
51927 <literallayout class="monospaced">
51928 domainlist local_domains = my.dom1.example : my.dom2.example
51929 domainlist relay_domains = friend1.example : friend2.example
51930 hostlist   relay_hosts   = 192.168.45.0/24
51931 </literallayout>
51932 <para>
51933 Now you can use these definitions in the ACL that is run for every RCPT
51934 command:
51935 </para>
51936 <literallayout class="monospaced">
51937 acl_check_rcpt:
51938   accept domains = +local_domains : +relay_domains
51939   accept hosts   = +relay_hosts
51940 </literallayout>
51941 <para>
51942 The first statement accepts any RCPT command that contains an address in
51943 the local or relay domains. For any other domain, control passes to the second
51944 statement, which accepts the command only if it comes from one of the relay
51945 hosts. In practice, you will probably want to make your ACL more sophisticated
51946 than this, for example, by including sender and recipient verification. The
51947 default configuration includes a more comprehensive example, which is described
51948 in chapter <xref linkend="CHAPdefconfil"/>.
51949 </para>
51950 </section>
51951 <section id="SECTcheralcon">
51952 <title>Checking a relay configuration</title>
51953 <para>
51954 <indexterm role="concept">
51955 <primary>relaying</primary>
51956 <secondary>checking control of</secondary>
51957 </indexterm>
51958 You can check the relay characteristics of your configuration in the same way
51959 that you can test any ACL behaviour for an incoming SMTP connection, by using
51960 the <option>-bh</option> option to run a fake SMTP session with which you interact.
51961 </para>
51962 <para>
51963 For specifically testing for unwanted relaying, the host
51964 <emphasis>relay-test.mail-abuse.org</emphasis> provides a useful service. If you telnet to this
51965 host from the host on which Exim is running, using the normal telnet port, you
51966 will see a normal telnet connection message and then quite a long delay. Be
51967 patient. The remote host is making an SMTP connection back to your host, and
51968 trying a number of common probes to test for open relay vulnerability. The
51969 results of the tests will eventually appear on your terminal.
51970 <indexterm role="concept" startref="IIDacl" class="endofrange"/>
51971 </para>
51972 </section>
51973 </chapter>
51974
51975 <chapter id="CHAPexiscan">
51976 <title>Content scanning at ACL time</title>
51977 <para>
51978 <indexterm role="concept" id="IIDcosca" class="startofrange">
51979 <primary>content scanning</primary>
51980 <secondary>at ACL time</secondary>
51981 </indexterm>
51982 The extension of Exim to include content scanning at ACL time, formerly known
51983 as <quote>exiscan</quote>, was originally implemented as a patch by Tom Kistner. The code
51984 was integrated into the main source for Exim release 4.50, and Tom continues to
51985 maintain it. Most of the wording of this chapter is taken from Tom&#x2019;s
51986 specification.
51987 </para>
51988 <para>
51989 It is also possible to scan the content of messages at other times. The
51990 <function>local_scan()</function> function (see chapter <xref linkend="CHAPlocalscan"/>) allows for content
51991 scanning after all the ACLs have run. A transport filter can be used to scan
51992 messages at delivery time (see the <option>transport_filter</option> option, described in
51993 chapter <xref linkend="CHAPtransportgeneric"/>).
51994 </para>
51995 <para>
51996 If you want to include the ACL-time content-scanning features when you compile
51997 Exim, you need to arrange for WITH_CONTENT_SCAN to be defined in your
51998 <filename>Local/Makefile</filename>. When you do that, the Exim binary is built with:
51999 </para>
52000 <itemizedlist>
52001 <listitem>
52002 <para>
52003 Two additional ACLs (<option>acl_smtp_mime</option> and <option>acl_not_smtp_mime</option>) that are run
52004 for all MIME parts for SMTP and non-SMTP messages, respectively.
52005 </para>
52006 </listitem>
52007 <listitem>
52008 <para>
52009 Additional ACL conditions and modifiers: <option>decode</option>, <option>malware</option>,
52010 <option>mime_regex</option>, <option>regex</option>, and <option>spam</option>. These can be used in the ACL that is
52011 run at the end of message reception (the <option>acl_smtp_data</option> ACL).
52012 </para>
52013 </listitem>
52014 <listitem>
52015 <para>
52016 An additional control feature (<quote>no_mbox_unspool</quote>) that saves spooled copies
52017 of messages, or parts of messages, for debugging purposes.
52018 </para>
52019 </listitem>
52020 <listitem>
52021 <para>
52022 Additional expansion variables that are set in the new ACL and by the new
52023 conditions.
52024 </para>
52025 </listitem>
52026 <listitem>
52027 <para>
52028 Two new main configuration options: <option>av_scanner</option> and <option>spamd_address</option>.
52029 </para>
52030 </listitem>
52031 </itemizedlist>
52032 <para>
52033 There is another content-scanning configuration option for <filename>Local/Makefile</filename>,
52034 called WITH_OLD_DEMIME. If this is set, the old, deprecated <option>demime</option> ACL
52035 condition is compiled, in addition to all the other content-scanning features.
52036 </para>
52037 <para>
52038 Content-scanning is continually evolving, and new features are still being
52039 added. While such features are still unstable and liable to incompatible
52040 changes, they are made available in Exim by setting options whose names begin
52041 EXPERIMENTAL_ in <filename>Local/Makefile</filename>. Such features are not documented in
52042 this manual. You can find out about them by reading the file called
52043 <filename>doc/experimental.txt</filename>.
52044 </para>
52045 <para>
52046 All the content-scanning facilities work on a MBOX copy of the message that is
52047 temporarily created in a file called:
52048 </para>
52049 <literallayout>
52050 &lt;<emphasis>spool_directory</emphasis>&gt;<literal>/scan/</literal>&lt;<emphasis>message_id</emphasis>&gt;/&lt;<emphasis>message_id</emphasis>&gt;<literal>.eml</literal>
52051 </literallayout>
52052 <para>
52053 The <filename>.eml</filename> extension is a friendly hint to virus scanners that they can
52054 expect an MBOX-like structure inside that file. The file is created when the
52055 first content scanning facility is called. Subsequent calls to content
52056 scanning conditions open the same file again. The directory is recursively
52057 removed when the <option>acl_smtp_data</option> ACL has finished running, unless
52058 </para>
52059 <literallayout class="monospaced">
52060 control = no_mbox_unspool
52061 </literallayout>
52062 <para>
52063 has been encountered. When the MIME ACL decodes files, they are put into the
52064 same directory by default.
52065 </para>
52066 <section id="SECTscanvirus">
52067 <title>Scanning for viruses</title>
52068 <para>
52069 <indexterm role="concept">
52070 <primary>virus scanning</primary>
52071 </indexterm>
52072 <indexterm role="concept">
52073 <primary>content scanning</primary>
52074 <secondary>for viruses</secondary>
52075 </indexterm>
52076 <indexterm role="concept">
52077 <primary>content scanning</primary>
52078 <secondary>the <option>malware</option> condition</secondary>
52079 </indexterm>
52080 The <option>malware</option> ACL condition lets you connect virus scanner software to Exim.
52081 It supports a <quote>generic</quote> interface to scanners called via the shell, and
52082 specialized interfaces for <quote>daemon</quote> type virus scanners, which are resident
52083 in memory and thus are much faster.
52084 </para>
52085 <para>
52086 <indexterm role="option">
52087 <primary><option>av_scanner</option></primary>
52088 </indexterm>
52089 You can set the <option>av_scanner</option> option in first part of the Exim configuration
52090 file to specify which scanner to use, together with any additional options that
52091 are needed. The basic syntax is as follows:
52092 </para>
52093 <literallayout>
52094 <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>
52095 </literallayout>
52096 <para>
52097 If you do not set <option>av_scanner</option>, it defaults to
52098 </para>
52099 <literallayout class="monospaced">
52100 av_scanner = sophie:/var/run/sophie
52101 </literallayout>
52102 <para>
52103 If the value of <option>av_scanner</option> starts with dollar character, it is expanded
52104 before use. The following scanner types are supported in this release:
52105 </para>
52106 <variablelist>
52107 <varlistentry>
52108 <term><option>aveserver</option></term>
52109 <listitem>
52110 <para>
52111 <indexterm role="concept">
52112 <primary>virus scanners</primary>
52113 <secondary>Kaspersky</secondary>
52114 </indexterm>
52115 This is the scanner daemon of Kaspersky Version 5. You can get a trial version
52116 at <emphasis role="bold"><ulink url="http://www.kaspersky.com">http://www.kaspersky.com</ulink></emphasis>. This scanner type takes one option,
52117 which is the path to the daemon&#x2019;s UNIX socket. The default is shown in this
52118 example:
52119 </para>
52120 <literallayout class="monospaced">
52121 av_scanner = aveserver:/var/run/aveserver
52122 </literallayout>
52123 </listitem></varlistentry>
52124 <varlistentry>
52125 <term><option>clamd</option></term>
52126 <listitem>
52127 <para>
52128 <indexterm role="concept">
52129 <primary>virus scanners</primary>
52130 <secondary>clamd</secondary>
52131 </indexterm>
52132 This daemon-type scanner is GPL and free. You can get it at
52133 <emphasis role="bold"><ulink url="http://www.clamav.net/">http://www.clamav.net/</ulink></emphasis>. Some older versions of clamd do not seem to
52134 unpack MIME containers, so it used to be recommended to unpack MIME attachments
52135 in the MIME ACL. This no longer believed to be necessary. One option is
52136 required: either the path and name of a UNIX socket file, or a hostname or IP
52137 number, and a port, separated by space, as in the second of these examples:
52138 </para>
52139 <literallayout class="monospaced">
52140 av_scanner = clamd:/opt/clamd/socket
52141 av_scanner = clamd:192.168.2.100 1234
52142 </literallayout>
52143 <para>
52144 If the option is unset, the default is <filename>/tmp/clamd</filename>. Thanks to David Saez for
52145 contributing the code for this scanner.
52146 </para>
52147 </listitem></varlistentry>
52148 <varlistentry>
52149 <term><option>cmdline</option></term>
52150 <listitem>
52151 <para>
52152 <indexterm role="concept">
52153 <primary>virus scanners</primary>
52154 <secondary>command line interface</secondary>
52155 </indexterm>
52156 This is the keyword for the generic command line scanner interface. It can be
52157 used to attach virus scanners that are invoked from the shell. This scanner
52158 type takes 3 mandatory options:
52159 </para>
52160 <orderedlist numeration="arabic">
52161 <listitem>
52162 <para>
52163 The full path and name of the scanner binary, with all command line options,
52164 and a placeholder (<literal>%s</literal>) for the directory to scan.
52165 </para>
52166 </listitem>
52167 <listitem>
52168 <para>
52169 A regular expression to match against the STDOUT and STDERR output of the
52170 virus scanner. If the expression matches, a virus was found. You must make
52171 absolutely sure that this expression matches on <quote>virus found</quote>. This is called
52172 the <quote>trigger</quote> expression.
52173 </para>
52174 </listitem>
52175 <listitem>
52176 <para>
52177 Another regular expression, containing exactly one pair of parentheses, to
52178 match the name of the virus found in the scanners output. This is called the
52179 <quote>name</quote> expression.
52180 </para>
52181 </listitem>
52182 </orderedlist>
52183 <para>
52184 For example, Sophos Sweep reports a virus on a line like this:
52185 </para>
52186 <literallayout class="monospaced">
52187 Virus 'W32/Magistr-B' found in file ./those.bat
52188 </literallayout>
52189 <para>
52190 For the trigger expression, we can match the phrase <quote>found in file</quote>. For the
52191 name expression, we want to extract the W32/Magistr-B string, so we can match
52192 for the single quotes left and right of it. Altogether, this makes the
52193 configuration setting:
52194 </para>
52195 <literallayout class="monospaced">
52196 av_scanner = cmdline:\
52197              /path/to/sweep -ss -all -rec -archive %s:\
52198              found in file:'(.+)'
52199 </literallayout>
52200 </listitem></varlistentry>
52201 <varlistentry>
52202 <term><option>drweb</option></term>
52203 <listitem>
52204 <para>
52205 <indexterm role="concept">
52206 <primary>virus scanners</primary>
52207 <secondary>DrWeb</secondary>
52208 </indexterm>
52209 The DrWeb daemon scanner (<emphasis role="bold"><ulink url="http://www.sald.com/">http://www.sald.com/</ulink></emphasis>) interface takes one
52210 argument, either a full path to a UNIX socket, or an IP address and port
52211 separated by white space, as in these examples:
52212 </para>
52213 <literallayout class="monospaced">
52214 av_scanner = drweb:/var/run/drwebd.sock
52215 av_scanner = drweb:192.168.2.20 31337
52216 </literallayout>
52217 <para>
52218 If you omit the argument, the default path <filename>/usr/local/drweb/run/drwebd.sock</filename>
52219 is used. Thanks to Alex Miller for contributing the code for this scanner.
52220 </para>
52221 </listitem></varlistentry>
52222 <varlistentry>
52223 <term><option>fsecure</option></term>
52224 <listitem>
52225 <para>
52226 <indexterm role="concept">
52227 <primary>virus scanners</primary>
52228 <secondary>F-Secure</secondary>
52229 </indexterm>
52230 The F-Secure daemon scanner (<emphasis role="bold"><ulink url="http://www.f-secure.com">http://www.f-secure.com</ulink></emphasis>) takes one
52231 argument which is the path to a UNIX socket. For example:
52232 </para>
52233 <literallayout class="monospaced">
52234 av_scanner = fsecure:/path/to/.fsav
52235 </literallayout>
52236 <para>
52237 If no argument is given, the default is <filename>/var/run/.fsav</filename>. Thanks to Johan
52238 Thelmen for contributing the code for this scanner.
52239 </para>
52240 </listitem></varlistentry>
52241 <varlistentry>
52242 <term><option>kavdaemon</option></term>
52243 <listitem>
52244 <para>
52245 <indexterm role="concept">
52246 <primary>virus scanners</primary>
52247 <secondary>Kaspersky</secondary>
52248 </indexterm>
52249 This is the scanner daemon of Kaspersky Version 4. This version of the
52250 Kaspersky scanner is outdated. Please upgrade (see <option>aveserver</option> above). This
52251 scanner type takes one option, which is the path to the daemon&#x2019;s UNIX socket.
52252 For example:
52253 </para>
52254 <literallayout class="monospaced">
52255 av_scanner = kavdaemon:/opt/AVP/AvpCtl
52256 </literallayout>
52257 <para>
52258 The default path is <filename>/var/run/AvpCtl</filename>.
52259 </para>
52260 </listitem></varlistentry>
52261 <varlistentry>
52262 <term><option>mksd</option></term>
52263 <listitem>
52264 <para>
52265 <indexterm role="concept">
52266 <primary>virus scanners</primary>
52267 <secondary>mksd</secondary>
52268 </indexterm>
52269 This is a daemon type scanner that is aimed mainly at Polish users, though some
52270 parts of documentation are now available in English. You can get it at
52271 <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
52272 the maximum number of processes used simultaneously to scan the attachments,
52273 provided that the demime facility is employed and also provided that mksd has
52274 been run with at least the same number of child processes. For example:
52275 </para>
52276 <literallayout class="monospaced">
52277 av_scanner = mksd:2
52278 </literallayout>
52279 <para>
52280 You can safely omit this option (the default value is 1).
52281 </para>
52282 </listitem></varlistentry>
52283 <varlistentry>
52284 <term><option>sophie</option></term>
52285 <listitem>
52286 <para>
52287 <indexterm role="concept">
52288 <primary>virus scanners</primary>
52289 <secondary>Sophos and Sophie</secondary>
52290 </indexterm>
52291 Sophie is a daemon that uses Sophos&#x2019; <option>libsavi</option> library to scan for viruses.
52292 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
52293 for this scanner type is the path to the UNIX socket that Sophie uses for
52294 client communication. For example:
52295 </para>
52296 <literallayout class="monospaced">
52297 av_scanner = sophie:/tmp/sophie
52298 </literallayout>
52299 <para>
52300 The default path is <filename>/var/run/sophie</filename>, so if you are using this, you can omit
52301 the option.
52302 </para>
52303 </listitem></varlistentry>
52304 </variablelist>
52305 <para>
52306 When <option>av_scanner</option> is correctly set, you can use the <option>malware</option> condition in
52307 the DATA ACL. <emphasis role="bold">Note</emphasis>: You cannot use the <option>malware</option> condition in the MIME
52308 ACL.
52309 </para>
52310 <para>
52311 The <option>av_scanner</option> option is expanded each time <option>malware</option> is called. This
52312 makes it possible to use different scanners. See further below for an example.
52313 The <option>malware</option> condition caches its results, so when you use it multiple times
52314 for the same message, the actual scanning process is only carried out once.
52315 However, using expandable items in <option>av_scanner</option> disables this caching, in
52316 which case each use of the <option>malware</option> condition causes a new scan of the
52317 message.
52318 </para>
52319 <para>
52320 The <option>malware</option> condition takes a right-hand argument that is expanded before
52321 use. It can then be one of
52322 </para>
52323 <itemizedlist>
52324 <listitem>
52325 <para>
52326 <quote>true</quote>, <quote>*</quote>, or <quote>1</quote>, in which case the message is scanned for viruses.
52327 The condition succeeds if a virus was found, and fail otherwise. This is the
52328 recommended usage.
52329 </para>
52330 </listitem>
52331 <listitem>
52332 <para>
52333 <quote>false</quote> or <quote>0</quote> or an empty string, in which case no scanning is done and
52334 the condition fails immediately.
52335 </para>
52336 </listitem>
52337 <listitem>
52338 <para>
52339 A regular expression, in which case the message is scanned for viruses. The
52340 condition succeeds if a virus is found and its name matches the regular
52341 expression. This allows you to take special actions on certain types of virus.
52342 </para>
52343 </listitem>
52344 </itemizedlist>
52345 <para>
52346 You can append <literal>/defer_ok</literal> to the <option>malware</option> condition to accept messages
52347 even if there is a problem with the virus scanner. Otherwise, such a problem
52348 causes the ACL to defer.
52349 </para>
52350 <para>
52351 <indexterm role="variable">
52352 <primary><varname>$malware_name</varname></primary>
52353 </indexterm>
52354 When a virus is found, the condition sets up an expansion variable called
52355 <varname>$malware_name</varname> that contains the name of the virus. You can use it in a
52356 <option>message</option> modifier that specifies the error returned to the sender, and/or in
52357 logging data.
52358 </para>
52359 <para>
52360 If your virus scanner cannot unpack MIME and TNEF containers itself, you should
52361 use the <option>demime</option> condition (see section <xref linkend="SECTdemimecond"/>) before the
52362 <option>malware</option> condition.
52363 </para>
52364 <para>
52365 Here is a very simple scanning example:
52366 </para>
52367 <literallayout class="monospaced">
52368 deny message = This message contains malware ($malware_name)
52369      demime = *
52370      malware = *
52371 </literallayout>
52372 <para>
52373 The next example accepts messages when there is a problem with the scanner:
52374 </para>
52375 <literallayout class="monospaced">
52376 deny message = This message contains malware ($malware_name)
52377      demime = *
52378      malware = */defer_ok
52379 </literallayout>
52380 <para>
52381 The next example shows how to use an ACL variable to scan with both sophie and
52382 aveserver. It assumes you have set:
52383 </para>
52384 <literallayout class="monospaced">
52385 av_scanner = $acl_m0
52386 </literallayout>
52387 <para>
52388 in the main Exim configuration.
52389 </para>
52390 <literallayout class="monospaced">
52391 deny message = This message contains malware ($malware_name)
52392      set acl_m0 = sophie
52393      malware = *
52394
52395 deny message = This message contains malware ($malware_name)
52396      set acl_m0 = aveserver
52397      malware = *
52398 </literallayout>
52399 </section>
52400 <section id="SECTscanspamass">
52401 <title>Scanning with SpamAssassin</title>
52402 <para>
52403 <indexterm role="concept">
52404 <primary>content scanning</primary>
52405 <secondary>for spam</secondary>
52406 </indexterm>
52407 <indexterm role="concept">
52408 <primary>spam scanning</primary>
52409 </indexterm>
52410 <indexterm role="concept">
52411 <primary>SpamAssassin</primary>
52412 </indexterm>
52413 The <option>spam</option> ACL condition calls SpamAssassin&#x2019;s <option>spamd</option> daemon to get a spam
52414 score and a report for the message. You can get SpamAssassin at
52415 <emphasis role="bold"><ulink url="http://www.spamassassin.org">http://www.spamassassin.org</ulink></emphasis>, or, if you have a working Perl
52416 installation, you can use CPAN by running:
52417 </para>
52418 <literallayout class="monospaced">
52419 perl -MCPAN -e 'install Mail::SpamAssassin'
52420 </literallayout>
52421 <para>
52422 SpamAssassin has its own set of configuration files. Please review its
52423 documentation to see how you can tweak it. The default installation should work
52424 nicely, however.
52425 </para>
52426 <para>
52427 <indexterm role="option">
52428 <primary><option>spamd_address</option></primary>
52429 </indexterm>
52430 After having installed and configured SpamAssassin, start the <option>spamd</option> daemon.
52431 By default, it listens on 127.0.0.1, TCP port 783. If you use another host or
52432 port for <option>spamd</option>, you must set the <option>spamd_address</option> option in the global
52433 part of the Exim configuration as follows (example):
52434 </para>
52435 <literallayout class="monospaced">
52436 spamd_address = 192.168.99.45 387
52437 </literallayout>
52438 <para>
52439 You do not need to set this option if you use the default. As of version 2.60,
52440 <option>spamd</option> also supports communication over UNIX sockets. If you want to use
52441 these, supply <option>spamd_address</option> with an absolute file name instead of a
52442 address/port pair:
52443 </para>
52444 <literallayout class="monospaced">
52445 spamd_address = /var/run/spamd_socket
52446 </literallayout>
52447 <para>
52448 You can have multiple <option>spamd</option> servers to improve scalability. These can
52449 reside on other hardware reachable over the network. To specify multiple
52450 <option>spamd</option> servers, put multiple address/port pairs in the <option>spamd_address</option>
52451 option, separated with colons:
52452 </para>
52453 <literallayout class="monospaced">
52454 spamd_address = 192.168.2.10 783 : \
52455                 192.168.2.11 783 : \
52456                 192.168.2.12 783
52457 </literallayout>
52458 <para>
52459 Up to 32 <option>spamd</option> servers are supported. The servers are queried in a random
52460 fashion. When a server fails to respond to the connection attempt, all other
52461 servers are tried until one succeeds. If no server responds, the <option>spam</option>
52462 condition defers.
52463 </para>
52464 <para>
52465 <emphasis role="bold">Warning</emphasis>: It is not possible to use the UNIX socket connection method with
52466 multiple <option>spamd</option> servers.
52467 </para>
52468 <para>
52469 The <option>spamd_address</option> variable is expanded before use if it starts with
52470 a dollar sign. In this case, the expansion may return a string that is
52471 used as the list so that multiple spamd servers can be the result of an
52472 expansion.
52473 </para>
52474 </section>
52475 <section id="SECID206">
52476 <title>Calling SpamAssassin from an Exim ACL</title>
52477 <para>
52478 Here is a simple example of the use of the <option>spam</option> condition in a DATA ACL:
52479 </para>
52480 <literallayout class="monospaced">
52481 deny message = This message was classified as SPAM
52482      spam = joe
52483 </literallayout>
52484 <para>
52485 The right-hand side of the <option>spam</option> condition specifies a name. This is
52486 relevant if you have set up multiple SpamAssassin profiles. If you do not want
52487 to scan using a specific profile, but rather use the SpamAssassin system-wide
52488 default profile, you can scan for an unknown name, or simply use <quote>nobody</quote>.
52489 However, you must put something on the right-hand side.
52490 </para>
52491 <para>
52492 The name allows you to use per-domain or per-user antispam profiles in
52493 principle, but this is not straightforward in practice, because a message may
52494 have multiple recipients, not necessarily all in the same domain. Because the
52495 <option>spam</option> condition has to be called from a DATA ACL in order to be able to
52496 read the contents of the message, the variables <varname>$local_part</varname> and <varname>$domain</varname>
52497 are not set.
52498 </para>
52499 <para>
52500 The right-hand side of the <option>spam</option> condition is expanded before being used, so
52501 you can put lookups or conditions there. When the right-hand side evaluates to
52502 <quote>0</quote> or <quote>false</quote>, no scanning is done and the condition fails immediately.
52503 </para>
52504 <para>
52505 Scanning with SpamAssassin uses a lot of resources. If you scan every message,
52506 large ones may cause significant performance degradation. As most spam messages
52507 are quite small, it is recommended that you do not scan the big ones. For
52508 example:
52509 </para>
52510 <literallayout class="monospaced">
52511 deny message = This message was classified as SPAM
52512      condition = ${if &lt; {$message_size}{10K}}
52513      spam = nobody
52514 </literallayout>
52515 <para>
52516 The <option>spam</option> condition returns true if the threshold specified in the user&#x2019;s
52517 SpamAssassin profile has been matched or exceeded. If you want to use the
52518 <option>spam</option> condition for its side effects (see the variables below), you can make
52519 it always return <quote>true</quote> by appending <literal>:true</literal> to the username.
52520 </para>
52521 <para>
52522 <indexterm role="concept">
52523 <primary>spam scanning</primary>
52524 <secondary>returned variables</secondary>
52525 </indexterm>
52526 When the <option>spam</option> condition is run, it sets up a number of expansion
52527 variables. With the exception of <varname>$spam_score_int</varname>, these are usable only
52528 within ACLs; their values are not retained with the message and so cannot be
52529 used at delivery time.
52530 </para>
52531 <variablelist>
52532 <varlistentry>
52533 <term><varname>$spam_score</varname></term>
52534 <listitem>
52535 <para>
52536 The spam score of the message, for example <quote>3.4</quote> or <quote>30.5</quote>. This is useful
52537 for inclusion in log or reject messages.
52538 </para>
52539 </listitem></varlistentry>
52540 <varlistentry>
52541 <term><varname>$spam_score_int</varname></term>
52542 <listitem>
52543 <para>
52544 The spam score of the message, multiplied by ten, as an integer value. For
52545 example <quote>34</quote> or <quote>305</quote>. It may appear to disagree with <varname>$spam_score</varname>
52546 because <varname>$spam_score</varname> is rounded and <varname>$spam_score_int</varname> is truncated.
52547 The integer value is useful for numeric comparisons in
52548 conditions. This variable is special; its value is saved with the message, and
52549 written to Exim&#x2019;s spool file. This means that it can be used during the whole
52550 life of the message on your Exim system, in particular, in routers or
52551 transports during the later delivery phase.
52552 </para>
52553 </listitem></varlistentry>
52554 <varlistentry>
52555 <term><varname>$spam_bar</varname></term>
52556 <listitem>
52557 <para>
52558 A string consisting of a number of <quote>+</quote> or <quote>-</quote> characters, representing the
52559 integer part of the spam score value. A spam score of 4.4 would have a
52560 <varname>$spam_bar</varname> value of <quote>++++</quote>. This is useful for inclusion in warning
52561 headers, since MUAs can match on such strings.
52562 </para>
52563 </listitem></varlistentry>
52564 <varlistentry>
52565 <term><varname>$spam_report</varname></term>
52566 <listitem>
52567 <para>
52568 A multiline text table, containing the full SpamAssassin report for the
52569 message. Useful for inclusion in headers or reject messages.
52570 </para>
52571 </listitem></varlistentry>
52572 </variablelist>
52573 <para>
52574 The <option>spam</option> condition caches its results unless expansion in
52575 spamd_address was used. If you call it again with the same user name, it
52576 does not scan again, but rather returns the same values as before.
52577 </para>
52578 <para>
52579 The <option>spam</option> condition returns DEFER if there is any error while running
52580 the message through SpamAssassin or if the expansion of spamd_address
52581 failed. If you want to treat DEFER as FAIL (to pass on to the next ACL
52582 statement block), append <literal>/defer_ok</literal> to the right-hand side of the
52583 spam condition, like this:
52584 </para>
52585 <literallayout class="monospaced">
52586 deny message = This message was classified as SPAM
52587      spam    = joe/defer_ok
52588 </literallayout>
52589 <para>
52590 This causes messages to be accepted even if there is a problem with <option>spamd</option>.
52591 </para>
52592 <para>
52593 Here is a longer, commented example of the use of the <option>spam</option>
52594 condition:
52595 </para>
52596 <literallayout class="monospaced">
52597 # put headers in all messages (no matter if spam or not)
52598 warn  spam = nobody:true
52599       add_header = X-Spam-Score: $spam_score ($spam_bar)
52600       add_header = X-Spam-Report: $spam_report
52601
52602 # add second subject line with *SPAM* marker when message
52603 # is over threshold
52604 warn  spam = nobody
52605       add_header = Subject: *SPAM* $h_Subject:
52606
52607 # reject spam at high scores (&gt; 12)
52608 deny  message = This message scored $spam_score spam points.
52609       spam = nobody:true
52610       condition = ${if &gt;{$spam_score_int}{120}{1}{0}}
52611 </literallayout>
52612 </section>
52613 <section id="SECTscanmimepart">
52614 <title>Scanning MIME parts</title>
52615 <para>
52616 <indexterm role="concept">
52617 <primary>content scanning</primary>
52618 <secondary>MIME parts</secondary>
52619 </indexterm>
52620 <indexterm role="concept">
52621 <primary>MIME content scanning</primary>
52622 </indexterm>
52623 <indexterm role="option">
52624 <primary><option>acl_smtp_mime</option></primary>
52625 </indexterm>
52626 <indexterm role="option">
52627 <primary><option>acl_not_smtp_mime</option></primary>
52628 </indexterm>
52629 The <option>acl_smtp_mime</option> global option specifies an ACL that is called once for
52630 each MIME part of an SMTP message, including multipart types, in the sequence
52631 of their position in the message. Similarly, the <option>acl_not_smtp_mime</option> option
52632 specifies an ACL that is used for the MIME parts of non-SMTP messages. These
52633 options may both refer to the same ACL if you want the same processing in both
52634 cases.
52635 </para>
52636 <para>
52637 These ACLs are called (possibly many times) just before the <option>acl_smtp_data</option>
52638 ACL in the case of an SMTP message, or just before the <option>acl_not_smtp</option> ACL in
52639 the case of a non-SMTP message. However, a MIME ACL is called only if the
52640 message contains a <emphasis>Content-Type:</emphasis> header line. When a call to a MIME
52641 ACL does not yield <quote>accept</quote>, ACL processing is aborted and the appropriate
52642 result code is sent to the client. In the case of an SMTP message, the
52643 <option>acl_smtp_data</option> ACL is not called when this happens.
52644 </para>
52645 <para>
52646 You cannot use the <option>malware</option> or <option>spam</option> conditions in a MIME ACL; these can
52647 only be used in the DATA or non-SMTP ACLs. However, you can use the <option>regex</option>
52648 condition to match against the raw MIME part. You can also use the
52649 <option>mime_regex</option> condition to match against the decoded MIME part (see section
52650 <xref linkend="SECTscanregex"/>).
52651 </para>
52652 <para>
52653 At the start of a MIME ACL, a number of variables are set from the header
52654 information for the relevant MIME part. These are described below. The contents
52655 of the MIME part are not by default decoded into a disk file except for MIME
52656 parts whose content-type is <quote>message/rfc822</quote>. If you want to decode a MIME
52657 part into a disk file, you can use the <option>decode</option> condition. The general
52658 syntax is:
52659 </para>
52660 <literallayout>
52661 <literal>decode = [/</literal>&lt;<emphasis>path</emphasis>&gt;<literal>/]</literal>&lt;<emphasis>filename</emphasis>&gt;
52662 </literallayout>
52663 <para>
52664 The right hand side is expanded before use. After expansion,
52665 the value can be:
52666 </para>
52667 <orderedlist numeration="arabic">
52668 <listitem>
52669 <para>
52670 <quote>0</quote> or <quote>false</quote>, in which case no decoding is done.
52671 </para>
52672 </listitem>
52673 <listitem>
52674 <para>
52675 The string <quote>default</quote>. In that case, the file is put in the temporary
52676 <quote>default</quote> directory &lt;<emphasis>spool_directory</emphasis>&gt;<filename>/scan/</filename>&lt;<emphasis>message_id</emphasis>&gt;<filename>/</filename> with
52677 a sequential file name consisting of the message id and a sequence number. The
52678 full path and name is available in <varname>$mime_decoded_filename</varname> after decoding.
52679 </para>
52680 </listitem>
52681 <listitem>
52682 <para>
52683 A full path name starting with a slash. If the full name is an existing
52684 directory, it is used as a replacement for the default directory. The filename
52685 is then sequentially assigned. If the path does not exist, it is used as
52686 the full path and file name.
52687 </para>
52688 </listitem>
52689 <listitem>
52690 <para>
52691 If the string does not start with a slash, it is used as the
52692 filename, and the default path is then used.
52693 </para>
52694 </listitem>
52695 </orderedlist>
52696 <para>
52697 The <option>decode</option> condition normally succeeds. It is only false for syntax
52698 errors or unusual circumstances such as memory shortages. You can easily decode
52699 a file with its original, proposed filename using
52700 </para>
52701 <literallayout class="monospaced">
52702 decode = $mime_filename
52703 </literallayout>
52704 <para>
52705 However, you should keep in mind that <varname>$mime_filename</varname> might contain
52706 anything. If you place files outside of the default path, they are not
52707 automatically unlinked.
52708 </para>
52709 <para>
52710 For RFC822 attachments (these are messages attached to messages, with a
52711 content-type of <quote>message/rfc822</quote>), the ACL is called again in the same manner
52712 as for the primary message, only that the <varname>$mime_is_rfc822</varname> expansion
52713 variable is set (see below). Attached messages are always decoded to disk
52714 before being checked, and the files are unlinked once the check is done.
52715 </para>
52716 <para>
52717 The MIME ACL supports the <option>regex</option> and <option>mime_regex</option> conditions. These can be
52718 used to match regular expressions against raw and decoded MIME parts,
52719 respectively. They are described in section <xref linkend="SECTscanregex"/>.
52720 </para>
52721 <para>
52722 <indexterm role="concept">
52723 <primary>MIME content scanning</primary>
52724 <secondary>returned variables</secondary>
52725 </indexterm>
52726 The following list describes all expansion variables that are
52727 available in the MIME ACL:
52728 </para>
52729 <variablelist>
52730 <varlistentry>
52731 <term><varname>$mime_boundary</varname></term>
52732 <listitem>
52733 <para>
52734 If the current part is a multipart (see <varname>$mime_is_multipart</varname>) below, it should
52735 have a boundary string, which is stored in this variable. If the current part
52736 has no boundary parameter in the <emphasis>Content-Type:</emphasis> header, this variable
52737 contains the empty string.
52738 </para>
52739 </listitem></varlistentry>
52740 <varlistentry>
52741 <term><varname>$mime_charset</varname></term>
52742 <listitem>
52743 <para>
52744 This variable contains the character set identifier, if one was found in the
52745 <emphasis>Content-Type:</emphasis> header. Examples for charset identifiers are:
52746 </para>
52747 <literallayout class="monospaced">
52748 us-ascii
52749 gb2312 (Chinese)
52750 iso-8859-1
52751 </literallayout>
52752 <para>
52753 Please note that this value is not normalized, so you should do matches
52754 case-insensitively.
52755 </para>
52756 </listitem></varlistentry>
52757 <varlistentry>
52758 <term><varname>$mime_content_description</varname></term>
52759 <listitem>
52760 <para>
52761 This variable contains the normalized content of the <emphasis>Content-Description:</emphasis>
52762 header. It can contain a human-readable description of the parts content. Some
52763 implementations repeat the filename for attachments here, but they are usually
52764 only used for display purposes.
52765 </para>
52766 </listitem></varlistentry>
52767 <varlistentry>
52768 <term><varname>$mime_content_disposition</varname></term>
52769 <listitem>
52770 <para>
52771 This variable contains the normalized content of the <emphasis>Content-Disposition:</emphasis>
52772 header. You can expect strings like <quote>attachment</quote> or <quote>inline</quote> here.
52773 </para>
52774 </listitem></varlistentry>
52775 <varlistentry>
52776 <term><varname>$mime_content_id</varname></term>
52777 <listitem>
52778 <para>
52779 This variable contains the normalized content of the <emphasis>Content-ID:</emphasis> header.
52780 This is a unique ID that can be used to reference a part from another part.
52781 </para>
52782 </listitem></varlistentry>
52783 <varlistentry>
52784 <term><varname>$mime_content_size</varname></term>
52785 <listitem>
52786 <para>
52787 This variable is set only after the <option>decode</option> modifier (see above) has been
52788 successfully run. It contains the size of the decoded part in kilobytes. The
52789 size is always rounded up to full kilobytes, so only a completely empty part
52790 has a <varname>$mime_content_size</varname> of zero.
52791 </para>
52792 </listitem></varlistentry>
52793 <varlistentry>
52794 <term><varname>$mime_content_transfer_encoding</varname></term>
52795 <listitem>
52796 <para>
52797 This variable contains the normalized content of the
52798 <emphasis>Content-transfer-encoding:</emphasis> header. This is a symbolic name for an encoding
52799 type. Typical values are <quote>base64</quote> and <quote>quoted-printable</quote>.
52800 </para>
52801 </listitem></varlistentry>
52802 <varlistentry>
52803 <term><varname>$mime_content_type</varname></term>
52804 <listitem>
52805 <para>
52806 If the MIME part has a <emphasis>Content-Type:</emphasis> header, this variable contains its
52807 value, lowercased, and without any options (like <quote>name</quote> or <quote>charset</quote>). Here
52808 are some examples of popular MIME types, as they may appear in this variable:
52809 </para>
52810 <literallayout class="monospaced">
52811 text/plain
52812 text/html
52813 application/octet-stream
52814 image/jpeg
52815 audio/midi
52816 </literallayout>
52817 <para>
52818 If the MIME part has no <emphasis>Content-Type:</emphasis> header, this variable contains the
52819 empty string.
52820 </para>
52821 </listitem></varlistentry>
52822 <varlistentry>
52823 <term><varname>$mime_decoded_filename</varname></term>
52824 <listitem>
52825 <para>
52826 This variable is set only after the <option>decode</option> modifier (see above) has been
52827 successfully run. It contains the full path and file name of the file
52828 containing the decoded data.
52829 </para>
52830 </listitem></varlistentry>
52831 </variablelist>
52832 <para>
52833 <indexterm role="concept">
52834 <primary>RFC 2047</primary>
52835 </indexterm>
52836 </para>
52837 <variablelist>
52838 <varlistentry>
52839 <term><varname>$mime_filename</varname></term>
52840 <listitem>
52841 <para>
52842 This is perhaps the most important of the MIME variables. It contains a
52843 proposed filename for an attachment, if one was found in either the
52844 <emphasis>Content-Type:</emphasis> or <emphasis>Content-Disposition:</emphasis> headers. The filename will be
52845 RFC2047 decoded, but no additional sanity checks are done. If no filename was
52846 found, this variable contains the empty string.
52847 </para>
52848 </listitem></varlistentry>
52849 <varlistentry>
52850 <term><varname>$mime_is_coverletter</varname></term>
52851 <listitem>
52852 <para>
52853 This variable attempts to differentiate the <quote>cover letter</quote> of an e-mail from
52854 attached data. It can be used to clamp down on flashy or unnecessarily encoded
52855 content in the cover letter, while not restricting attachments at all.
52856 </para>
52857 <para>
52858 The variable contains 1 (true) for a MIME part believed to be part of the
52859 cover letter, and 0 (false) for an attachment. At present, the algorithm is as
52860 follows:
52861 </para>
52862 <orderedlist numeration="arabic">
52863 <listitem>
52864 <para>
52865 The outermost MIME part of a message is always a cover letter.
52866 </para>
52867 </listitem>
52868 <listitem>
52869 <para>
52870 If a multipart/alternative or multipart/related MIME part is a cover letter,
52871 so are all MIME subparts within that multipart.
52872 </para>
52873 </listitem>
52874 <listitem>
52875 <para>
52876 If any other multipart is a cover letter, the first subpart is a cover letter,
52877 and the rest are attachments.
52878 </para>
52879 </listitem>
52880 <listitem>
52881 <para>
52882 All parts contained within an attachment multipart are attachments.
52883 </para>
52884 </listitem>
52885 </orderedlist>
52886 <para>
52887 As an example, the following will ban <quote>HTML mail</quote> (including that sent with
52888 alternative plain text), while allowing HTML files to be attached. HTML
52889 coverletter mail attached to non-HMTL coverletter mail will also be allowed:
52890 </para>
52891 <literallayout class="monospaced">
52892 deny message = HTML mail is not accepted here
52893 !condition = $mime_is_rfc822
52894 condition = $mime_is_coverletter
52895 condition = ${if eq{$mime_content_type}{text/html}{1}{0}}
52896 </literallayout>
52897 </listitem></varlistentry>
52898 <varlistentry>
52899 <term><varname>$mime_is_multipart</varname></term>
52900 <listitem>
52901 <para>
52902 This variable has the value 1 (true) when the current part has the main type
52903 <quote>multipart</quote>, for example <quote>multipart/alternative</quote> or <quote>multipart/mixed</quote>.
52904 Since multipart entities only serve as containers for other parts, you may not
52905 want to carry out specific actions on them.
52906 </para>
52907 </listitem></varlistentry>
52908 <varlistentry>
52909 <term><varname>$mime_is_rfc822</varname></term>
52910 <listitem>
52911 <para>
52912 This variable has the value 1 (true) if the current part is not a part of the
52913 checked message itself, but part of an attached message. Attached message
52914 decoding is fully recursive.
52915 </para>
52916 </listitem></varlistentry>
52917 <varlistentry>
52918 <term><varname>$mime_part_count</varname></term>
52919 <listitem>
52920 <para>
52921 This variable is a counter that is raised for each processed MIME part. It
52922 starts at zero for the very first part (which is usually a multipart). The
52923 counter is per-message, so it is reset when processing RFC822 attachments (see
52924 <varname>$mime_is_rfc822</varname>). The counter stays set after <option>acl_smtp_mime</option> is
52925 complete, so you can use it in the DATA ACL to determine the number of MIME
52926 parts of a message. For non-MIME messages, this variable contains the value -1.
52927 </para>
52928 </listitem></varlistentry>
52929 </variablelist>
52930 </section>
52931 <section id="SECTscanregex">
52932 <title>Scanning with regular expressions</title>
52933 <para>
52934 <indexterm role="concept">
52935 <primary>content scanning</primary>
52936 <secondary>with regular expressions</secondary>
52937 </indexterm>
52938 <indexterm role="concept">
52939 <primary>regular expressions</primary>
52940 <secondary>content scanning with</secondary>
52941 </indexterm>
52942 You can specify your own custom regular expression matches on the full body of
52943 the message, or on individual MIME parts.
52944 </para>
52945 <para>
52946 The <option>regex</option> condition takes one or more regular expressions as arguments and
52947 matches them against the full message (when called in the DATA ACL) or a raw
52948 MIME part (when called in the MIME ACL). The <option>regex</option> condition matches
52949 linewise, with a maximum line length of 32K characters. That means you cannot
52950 have multiline matches with the <option>regex</option> condition.
52951 </para>
52952 <para>
52953 The <option>mime_regex</option> condition can be called only in the MIME ACL. It matches up
52954 to 32K of decoded content (the whole content at once, not linewise). If the
52955 part has not been decoded with the <option>decode</option> modifier earlier in the ACL, it
52956 is decoded automatically when <option>mime_regex</option> is executed (using default path
52957 and filename values). If the decoded data is larger than  32K, only the first
52958 32K characters are checked.
52959 </para>
52960 <para>
52961 The regular expressions are passed as a colon-separated list. To include a
52962 literal colon, you must double it. Since the whole right-hand side string is
52963 expanded before being used, you must also escape dollar signs and backslashes
52964 with more backslashes, or use the <literal>\N</literal> facility to disable expansion.
52965 Here is a simple example that contains two regular expressions:
52966 </para>
52967 <literallayout class="monospaced">
52968 deny message = contains blacklisted regex ($regex_match_string)
52969      regex = [Mm]ortgage : URGENT BUSINESS PROPOSAL
52970 </literallayout>
52971 <para>
52972 The conditions returns true if any one of the regular expressions matches. The
52973 <varname>$regex_match_string</varname> expansion variable is then set up and contains the
52974 matching regular expression.
52975 </para>
52976 <para>
52977 <emphasis role="bold">Warning</emphasis>: With large messages, these conditions can be fairly
52978 CPU-intensive.
52979 </para>
52980 </section>
52981 <section id="SECTdemimecond">
52982 <title>The demime condition</title>
52983 <para>
52984 <indexterm role="concept">
52985 <primary>content scanning</primary>
52986 <secondary>MIME checking</secondary>
52987 </indexterm>
52988 <indexterm role="concept">
52989 <primary>MIME content scanning</primary>
52990 </indexterm>
52991 The <option>demime</option> ACL condition provides MIME unpacking, sanity checking and file
52992 extension blocking. It is usable only in the DATA and non-SMTP ACLs. The
52993 <option>demime</option> condition uses a simpler interface to MIME decoding than the MIME
52994 ACL functionality, but provides no additional facilities. Please note that this
52995 condition is deprecated and kept only for backward compatibility. You must set
52996 the WITH_OLD_DEMIME option in <filename>Local/Makefile</filename> at build time to be able to
52997 use the <option>demime</option> condition.
52998 </para>
52999 <para>
53000 The <option>demime</option> condition unpacks MIME containers in the message. It detects
53001 errors in MIME containers and can match file extensions found in the message
53002 against a list. Using this facility produces files containing the unpacked MIME
53003 parts of the message in the temporary scan directory. If you do antivirus
53004 scanning, it is recommended that you use the <option>demime</option> condition before the
53005 antivirus (<option>malware</option>) condition.
53006 </para>
53007 <para>
53008 On the right-hand side of the <option>demime</option> condition you can pass a
53009 colon-separated list of file extensions that it should match against. For
53010 example:
53011 </para>
53012 <literallayout class="monospaced">
53013 deny message = Found blacklisted file attachment
53014      demime  = vbs:com:bat:pif:prf:lnk
53015 </literallayout>
53016 <para>
53017 If one of the file extensions is found, the condition is true, otherwise it is
53018 false. If there is a temporary error while demimeing (for example, <quote>disk
53019 full</quote>), the condition defers, and the message is temporarily rejected (unless
53020 the condition is on a <option>warn</option> verb).
53021 </para>
53022 <para>
53023 The right-hand side is expanded before being treated as a list, so you can have
53024 conditions and lookups there. If it expands to an empty string, <quote>false</quote>, or
53025 zero (<quote>0</quote>), no demimeing is done and the condition is false.
53026 </para>
53027 <para>
53028 The <option>demime</option> condition set the following variables:
53029 </para>
53030 <variablelist>
53031 <varlistentry>
53032 <term><varname>$demime_errorlevel</varname></term>
53033 <listitem>
53034 <para>
53035 <indexterm role="variable">
53036 <primary><varname>$demime_errorlevel</varname></primary>
53037 </indexterm>
53038 When an error is detected in a MIME container, this variable contains the
53039 severity of the error, as an integer number. The higher the value, the more
53040 severe the error (the current maximum value is 3). If this variable is unset or
53041 zero, no error occurred.
53042 </para>
53043 </listitem></varlistentry>
53044 <varlistentry>
53045 <term><varname>$demime_reason</varname></term>
53046 <listitem>
53047 <para>
53048 <indexterm role="variable">
53049 <primary><varname>$demime_reason</varname></primary>
53050 </indexterm>
53051 When <varname>$demime_errorlevel</varname> is greater than zero, this variable contains a
53052 human-readable text string describing the MIME error that occurred.
53053 </para>
53054 </listitem></varlistentry>
53055 </variablelist>
53056 <variablelist>
53057 <varlistentry>
53058 <term><varname>$found_extension</varname></term>
53059 <listitem>
53060 <para>
53061 <indexterm role="variable">
53062 <primary><varname>$found_extension</varname></primary>
53063 </indexterm>
53064 When the <option>demime</option> condition is true, this variable contains the file
53065 extension it found.
53066 </para>
53067 </listitem></varlistentry>
53068 </variablelist>
53069 <para>
53070 Both <varname>$demime_errorlevel</varname> and <varname>$demime_reason</varname> are set by the first call of
53071 the <option>demime</option> condition, and are not changed on subsequent calls.
53072 </para>
53073 <para>
53074 If you do not want to check for file extensions, but rather use the <option>demime</option>
53075 condition for unpacking or error checking purposes, pass <quote>*</quote> as the
53076 right-hand side value. Here is a more elaborate example of how to use this
53077 facility:
53078 </para>
53079 <literallayout class="monospaced">
53080 # Reject messages with serious MIME container errors
53081 deny  message = Found MIME error ($demime_reason).
53082       demime = *
53083       condition = ${if &gt;{$demime_errorlevel}{2}{1}{0}}
53084
53085 # Reject known virus spreading file extensions.
53086 # Accepting these is pretty much braindead.
53087 deny  message = contains $found_extension file (blacklisted).
53088       demime  = com:vbs:bat:pif:scr
53089
53090 # Freeze .exe and .doc files. Postmaster can
53091 # examine them and eventually thaw them.
53092 deny  log_message = Another $found_extension file.
53093       demime = exe:doc
53094       control = freeze
53095 </literallayout>
53096 <para>
53097 <indexterm role="concept" startref="IIDcosca" class="endofrange"/>
53098 </para>
53099 </section>
53100 </chapter>
53101
53102 <chapter id="CHAPlocalscan">
53103 <title>Adding a local scan function to Exim</title>
53104 <titleabbrev>Local scan function</titleabbrev>
53105 <para>
53106 <indexterm role="concept" id="IIDlosca" class="startofrange">
53107 <primary><function>local_scan()</function> function</primary>
53108 <secondary>description of</secondary>
53109 </indexterm>
53110 <indexterm role="concept">
53111 <primary>customizing</primary>
53112 <secondary>input scan using C function</secondary>
53113 </indexterm>
53114 <indexterm role="concept">
53115 <primary>policy control</primary>
53116 <secondary>by local scan function</secondary>
53117 </indexterm>
53118 In these days of email worms, viruses, and ever-increasing spam, some sites
53119 want to apply a lot of checking to messages before accepting them.
53120 </para>
53121 <para>
53122 The content scanning extension (chapter <xref linkend="CHAPexiscan"/>) has facilities for
53123 passing messages to external virus and spam scanning software. You can also do
53124 a certain amount in Exim itself through string expansions and the <option>condition</option>
53125 condition in the ACL that runs after the SMTP DATA command or the ACL for
53126 non-SMTP messages (see chapter <xref linkend="CHAPACL"/>), but this has its limitations.
53127 </para>
53128 <para>
53129 To allow for further customization to a site&#x2019;s own requirements, there is the
53130 possibility of linking Exim with a private message scanning function, written
53131 in C. If you want to run code that is written in something other than C, you
53132 can of course use a little C stub to call it.
53133 </para>
53134 <para>
53135 The local scan function is run once for every incoming message, at the point
53136 when Exim is just about to accept the message.
53137 It can therefore be used to control non-SMTP messages from local processes as
53138 well as messages arriving via SMTP.
53139 </para>
53140 <para>
53141 Exim applies a timeout to calls of the local scan function, and there is an
53142 option called <option>local_scan_timeout</option> for setting it. The default is 5 minutes.
53143 Zero means <quote>no timeout</quote>.
53144 Exim also sets up signal handlers for SIGSEGV, SIGILL, SIGFPE, and SIGBUS
53145 before calling the local scan function, so that the most common types of crash
53146 are caught. If the timeout is exceeded or one of those signals is caught, the
53147 incoming message is rejected with a temporary error if it is an SMTP message.
53148 For a non-SMTP message, the message is dropped and Exim ends with a non-zero
53149 code. The incident is logged on the main and reject logs.
53150 </para>
53151 <section id="SECID207">
53152 <title>Building Exim to use a local scan function</title>
53153 <para>
53154 <indexterm role="concept">
53155 <primary><function>local_scan()</function> function</primary>
53156 <secondary>building Exim to use</secondary>
53157 </indexterm>
53158 To make use of the local scan function feature, you must tell Exim where your
53159 function is before building Exim, by setting LOCAL_SCAN_SOURCE in your
53160 <filename>Local/Makefile</filename>. A recommended place to put it is in the <filename>Local</filename>
53161 directory, so you might set
53162 </para>
53163 <literallayout class="monospaced">
53164 LOCAL_SCAN_SOURCE=Local/local_scan.c
53165 </literallayout>
53166 <para>
53167 for example. The function must be called <function>local_scan()</function>. It is called by
53168 Exim after it has received a message, when the success return code is about to
53169 be sent. This is after all the ACLs have been run. The return code from your
53170 function controls whether the message is actually accepted or not. There is a
53171 commented template function (that just accepts the message) in the file
53172 _src/local_scan.c_.
53173 </para>
53174 <para>
53175 If you want to make use of Exim&#x2019;s run time configuration file to set options
53176 for your <function>local_scan()</function> function, you must also set
53177 </para>
53178 <literallayout class="monospaced">
53179 LOCAL_SCAN_HAS_OPTIONS=yes
53180 </literallayout>
53181 <para>
53182 in <filename>Local/Makefile</filename> (see section <xref linkend="SECTconoptloc"/> below).
53183 </para>
53184 </section>
53185 <section id="SECTapiforloc">
53186 <title>API for local_scan()</title>
53187 <para>
53188 <indexterm role="concept">
53189 <primary><function>local_scan()</function> function</primary>
53190 <secondary>API description</secondary>
53191 </indexterm>
53192 You must include this line near the start of your code:
53193 </para>
53194 <literallayout class="monospaced">
53195 #include "local_scan.h"
53196 </literallayout>
53197 <para>
53198 This header file defines a number of variables and other values, and the
53199 prototype for the function itself. Exim is coded to use unsigned char values
53200 almost exclusively, and one of the things this header defines is a shorthand
53201 for <literal>unsigned char</literal> called <literal>uschar</literal>.
53202 It also contains the following macro definitions, to simplify casting character
53203 strings and pointers to character strings:
53204 </para>
53205 <literallayout class="monospaced">
53206 #define CS   (char *)
53207 #define CCS  (const char *)
53208 #define CSS  (char **)
53209 #define US   (unsigned char *)
53210 #define CUS  (const unsigned char *)
53211 #define USS  (unsigned char **)
53212 </literallayout>
53213 <para>
53214 The function prototype for <function>local_scan()</function> is:
53215 </para>
53216 <literallayout class="monospaced">
53217 extern int local_scan(int fd, uschar **return_text);
53218 </literallayout>
53219 <para>
53220 The arguments are as follows:
53221 </para>
53222 <itemizedlist>
53223 <listitem>
53224 <para>
53225 <option>fd</option> is a file descriptor for the file that contains the body of the message
53226 (the -D file). The file is open for reading and writing, but updating it is not
53227 recommended. <emphasis role="bold">Warning</emphasis>: You must <emphasis>not</emphasis> close this file descriptor.
53228 </para>
53229 <para>
53230 The descriptor is positioned at character 19 of the file, which is the first
53231 character of the body itself, because the first 19 characters are the message
53232 id followed by <literal>-D</literal> and a newline. If you rewind the file, you should use the
53233 macro SPOOL_DATA_START_OFFSET to reset to the start of the data, just in
53234 case this changes in some future version.
53235 </para>
53236 </listitem>
53237 <listitem>
53238 <para>
53239 <option>return_text</option> is an address which you can use to return a pointer to a text
53240 string at the end of the function. The value it points to on entry is NULL.
53241 </para>
53242 </listitem>
53243 </itemizedlist>
53244 <para>
53245 The function must return an <option>int</option> value which is one of the following macros:
53246 </para>
53247 <variablelist>
53248 <varlistentry>
53249 <term><literal>LOCAL_SCAN_ACCEPT</literal></term>
53250 <listitem>
53251 <para>
53252 <indexterm role="variable">
53253 <primary><varname>$local_scan_data</varname></primary>
53254 </indexterm>
53255 The message is accepted. If you pass back a string of text, it is saved with
53256 the message, and made available in the variable <varname>$local_scan_data</varname>. No
53257 newlines are permitted (if there are any, they are turned into spaces) and the
53258 maximum length of text is 1000 characters.
53259 </para>
53260 </listitem></varlistentry>
53261 <varlistentry>
53262 <term><literal>LOCAL_SCAN_ACCEPT_FREEZE</literal></term>
53263 <listitem>
53264 <para>
53265 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
53266 queued without immediate delivery, and is frozen.
53267 </para>
53268 </listitem></varlistentry>
53269 <varlistentry>
53270 <term><literal>LOCAL_SCAN_ACCEPT_QUEUE</literal></term>
53271 <listitem>
53272 <para>
53273 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
53274 queued without immediate delivery.
53275 </para>
53276 </listitem></varlistentry>
53277 <varlistentry>
53278 <term><literal>LOCAL_SCAN_REJECT</literal></term>
53279 <listitem>
53280 <para>
53281 The message is rejected; the returned text is used as an error message which is
53282 passed back to the sender and which is also logged. Newlines are permitted &ndash;
53283 they cause a multiline response for SMTP rejections, but are converted to
53284 <literal>\n</literal> in log lines. If no message is given, <quote>Administrative prohibition</quote> is
53285 used.
53286 </para>
53287 </listitem></varlistentry>
53288 <varlistentry>
53289 <term><literal>LOCAL_SCAN_TEMPREJECT</literal></term>
53290 <listitem>
53291 <para>
53292 The message is temporarily rejected; the returned text is used as an error
53293 message as for LOCAL_SCAN_REJECT. If no message is given, <quote>Temporary local
53294 problem</quote> is used.
53295 </para>
53296 </listitem></varlistentry>
53297 <varlistentry>
53298 <term><literal>LOCAL_SCAN_REJECT_NOLOGHDR</literal></term>
53299 <listitem>
53300 <para>
53301 This behaves as LOCAL_SCAN_REJECT, except that the header of the rejected
53302 message is not written to the reject log. It has the effect of unsetting the
53303 <option>rejected_header</option> log selector for just this rejection. If
53304 <option>rejected_header</option> is already unset (see the discussion of the
53305 <option>log_selection</option> option in section <xref linkend="SECTlogselector"/>), this code is the
53306 same as LOCAL_SCAN_REJECT.
53307 </para>
53308 </listitem></varlistentry>
53309 <varlistentry>
53310 <term><literal>LOCAL_SCAN_TEMPREJECT_NOLOGHDR</literal></term>
53311 <listitem>
53312 <para>
53313 This code is a variation of LOCAL_SCAN_TEMPREJECT in the same way that
53314 LOCAL_SCAN_REJECT_NOLOGHDR is a variation of LOCAL_SCAN_REJECT.
53315 </para>
53316 </listitem></varlistentry>
53317 </variablelist>
53318 <para>
53319 If the message is not being received by interactive SMTP, rejections are
53320 reported by writing to <option>stderr</option> or by sending an email, as configured by the
53321 <option>-oe</option> command line options.
53322 </para>
53323 </section>
53324 <section id="SECTconoptloc">
53325 <title>Configuration options for local_scan()</title>
53326 <para>
53327 <indexterm role="concept">
53328 <primary><function>local_scan()</function> function</primary>
53329 <secondary>configuration options</secondary>
53330 </indexterm>
53331 It is possible to have option settings in the main configuration file
53332 that set values in static variables in the <function>local_scan()</function> module. If you
53333 want to do this, you must have the line
53334 </para>
53335 <literallayout class="monospaced">
53336 LOCAL_SCAN_HAS_OPTIONS=yes
53337 </literallayout>
53338 <para>
53339 in your <filename>Local/Makefile</filename> when you build Exim. (This line is in
53340 <filename>OS/Makefile-Default</filename>, commented out). Then, in the <function>local_scan()</function> source
53341 file, you must define static variables to hold the option values, and a table
53342 to define them.
53343 </para>
53344 <para>
53345 The table must be a vector called <option>local_scan_options</option>, of type
53346 <literal>optionlist</literal>. Each entry is a triplet, consisting of a name, an option type,
53347 and a pointer to the variable that holds the value. The entries must appear in
53348 alphabetical order. Following <option>local_scan_options</option> you must also define a
53349 variable called <option>local_scan_options_count</option> that contains the number of
53350 entries in the table. Here is a short example, showing two kinds of option:
53351 </para>
53352 <literallayout class="monospaced">
53353 static int my_integer_option = 42;
53354 static uschar *my_string_option = US"a default string";
53355
53356 optionlist local_scan_options[] = {
53357   { "my_integer", opt_int,       &amp;my_integer_option },
53358   { "my_string",  opt_stringptr, &amp;my_string_option }
53359 };
53360
53361 int local_scan_options_count =
53362   sizeof(local_scan_options)/sizeof(optionlist);
53363 </literallayout>
53364 <para>
53365 The values of the variables can now be changed from Exim&#x2019;s runtime
53366 configuration file by including a local scan section as in this example:
53367 </para>
53368 <literallayout class="monospaced">
53369 begin local_scan
53370 my_integer = 99
53371 my_string = some string of text...
53372 </literallayout>
53373 <para>
53374 The available types of option data are as follows:
53375 </para>
53376 <variablelist>
53377 <varlistentry>
53378 <term><emphasis role="bold">opt_bool</emphasis></term>
53379 <listitem>
53380 <para>
53381 This specifies a boolean (true/false) option. The address should point to a
53382 variable of type <literal>BOOL</literal>, which will be set to TRUE or FALSE, which are macros
53383 that are defined as <quote>1</quote> and <quote>0</quote>, respectively. If you want to detect
53384 whether such a variable has been set at all, you can initialize it to
53385 TRUE_UNSET. (BOOL variables are integers underneath, so can hold more than two
53386 values.)
53387 </para>
53388 </listitem></varlistentry>
53389 <varlistentry>
53390 <term><emphasis role="bold">opt_fixed</emphasis></term>
53391 <listitem>
53392 <para>
53393 This specifies a fixed point number, such as is used for load averages.
53394 The address should point to a variable of type <literal>int</literal>. The value is stored
53395 multiplied by 1000, so, for example, 1.4142 is truncated and stored as 1414.
53396 </para>
53397 </listitem></varlistentry>
53398 <varlistentry>
53399 <term><emphasis role="bold">opt_int</emphasis></term>
53400 <listitem>
53401 <para>
53402 This specifies an integer; the address should point to a variable of type
53403 <literal>int</literal>. The value may be specified in any of the integer formats accepted by
53404 Exim.
53405 </para>
53406 </listitem></varlistentry>
53407 <varlistentry>
53408 <term><emphasis role="bold">opt_mkint</emphasis></term>
53409 <listitem>
53410 <para>
53411 This is the same as <option>opt_int</option>, except that when such a value is output in a
53412 <option>-bP</option> listing, if it is an exact number of kilobytes or megabytes, it is
53413 printed with the suffix K or M.
53414 </para>
53415 </listitem></varlistentry>
53416 <varlistentry>
53417 <term><emphasis role="bold">opt_octint</emphasis></term>
53418 <listitem>
53419 <para>
53420 This also specifies an integer, but the value is always interpreted as an
53421 octal integer, whether or not it starts with the digit zero, and it is
53422 always output in octal.
53423 </para>
53424 </listitem></varlistentry>
53425 <varlistentry>
53426 <term><emphasis role="bold">opt_stringptr</emphasis></term>
53427 <listitem>
53428 <para>
53429 This specifies a string value; the address must be a pointer to a
53430 variable that points to a string (for example, of type <literal>uschar *</literal>).
53431 </para>
53432 </listitem></varlistentry>
53433 <varlistentry>
53434 <term><emphasis role="bold">opt_time</emphasis></term>
53435 <listitem>
53436 <para>
53437 This specifies a time interval value. The address must point to a variable of
53438 type <literal>int</literal>. The value that is placed there is a number of seconds.
53439 </para>
53440 </listitem></varlistentry>
53441 </variablelist>
53442 <para>
53443 If the <option>-bP</option> command line option is followed by <literal>local_scan</literal>, Exim prints
53444 out the values of all the <function>local_scan()</function> options.
53445 </para>
53446 </section>
53447 <section id="SECID208">
53448 <title>Available Exim variables</title>
53449 <para>
53450 <indexterm role="concept">
53451 <primary><function>local_scan()</function> function</primary>
53452 <secondary>available Exim variables</secondary>
53453 </indexterm>
53454 The header <filename>local_scan.h</filename> gives you access to a number of C variables. These
53455 are the only ones that are guaranteed to be maintained from release to release.
53456 Note, however, that you can obtain the value of any Exim expansion variable,
53457 including <varname>$recipients</varname>, by calling <emphasis>expand_string()</emphasis>. The exported
53458 C variables are as follows:
53459 </para>
53460 <variablelist>
53461 <varlistentry>
53462 <term><emphasis role="bold">int&nbsp;body_linecount</emphasis></term>
53463 <listitem>
53464 <para>
53465 This variable contains the number of lines in the message&#x2019;s body.
53466 </para>
53467 </listitem></varlistentry>
53468 <varlistentry>
53469 <term><emphasis role="bold">int&nbsp;body_zerocount</emphasis></term>
53470 <listitem>
53471 <para>
53472 This variable contains the number of binary zero bytes in the message&#x2019;s body.
53473 </para>
53474 </listitem></varlistentry>
53475 <varlistentry>
53476 <term><emphasis role="bold">unsigned&nbsp;int&nbsp;debug_selector</emphasis></term>
53477 <listitem>
53478 <para>
53479 This variable is set to zero when no debugging is taking place. Otherwise, it
53480 is a bitmap of debugging selectors. Two bits are identified for use in
53481 <function>local_scan()</function>; they are defined as macros:
53482 </para>
53483 <itemizedlist>
53484 <listitem>
53485 <para>
53486 The <literal>D_v</literal> bit is set when <option>-v</option> was present on the command line. This is a
53487 testing option that is not privileged &ndash; any caller may set it. All the
53488 other selector bits can be set only by admin users.
53489 </para>
53490 </listitem>
53491 <listitem>
53492 <para>
53493 The <literal>D_local_scan</literal> bit is provided for use by <function>local_scan()</function>; it is set
53494 by the <literal>+local_scan</literal> debug selector. It is not included in the default set
53495 of debugging bits.
53496 </para>
53497 </listitem>
53498 </itemizedlist>
53499 <para>
53500 Thus, to write to the debugging output only when <literal>+local_scan</literal> has been
53501 selected, you should use code like this:
53502 </para>
53503 <literallayout class="monospaced">
53504 if ((debug_selector &amp; D_local_scan) != 0)
53505   debug_printf("xxx", ...);
53506 </literallayout>
53507 </listitem></varlistentry>
53508 <varlistentry>
53509 <term><emphasis role="bold">uschar&nbsp;*expand_string_message</emphasis></term>
53510 <listitem>
53511 <para>
53512 After a failing call to <emphasis>expand_string()</emphasis> (returned value NULL), the
53513 variable <option>expand_string_message</option> contains the error message, zero-terminated.
53514 </para>
53515 </listitem></varlistentry>
53516 <varlistentry>
53517 <term><emphasis role="bold">header_line&nbsp;*header_list</emphasis></term>
53518 <listitem>
53519 <para>
53520 A pointer to a chain of header lines. The <option>header_line</option> structure is
53521 discussed below.
53522 </para>
53523 </listitem></varlistentry>
53524 <varlistentry>
53525 <term><emphasis role="bold">header_line&nbsp;*header_last</emphasis></term>
53526 <listitem>
53527 <para>
53528 A pointer to the last of the header lines.
53529 </para>
53530 </listitem></varlistentry>
53531 <varlistentry>
53532 <term><emphasis role="bold">uschar&nbsp;*headers_charset</emphasis></term>
53533 <listitem>
53534 <para>
53535 The value of the <option>headers_charset</option> configuration option.
53536 </para>
53537 </listitem></varlistentry>
53538 <varlistentry>
53539 <term><emphasis role="bold">BOOL&nbsp;host_checking</emphasis></term>
53540 <listitem>
53541 <para>
53542 This variable is TRUE during a host checking session that is initiated by the
53543 <option>-bh</option> command line option.
53544 </para>
53545 </listitem></varlistentry>
53546 <varlistentry>
53547 <term><emphasis role="bold">uschar&nbsp;*interface_address</emphasis></term>
53548 <listitem>
53549 <para>
53550 The IP address of the interface that received the message, as a string. This
53551 is NULL for locally submitted messages.
53552 </para>
53553 </listitem></varlistentry>
53554 <varlistentry>
53555 <term><emphasis role="bold">int&nbsp;interface_port</emphasis></term>
53556 <listitem>
53557 <para>
53558 The port on which this message was received. When testing with the <option>-bh</option>
53559 command line option, the value of this variable is -1 unless a port has been
53560 specified via the <option>-oMi</option> option.
53561 </para>
53562 </listitem></varlistentry>
53563 <varlistentry>
53564 <term><emphasis role="bold">uschar&nbsp;*message_id</emphasis></term>
53565 <listitem>
53566 <para>
53567 This variable contains Exim&#x2019;s message id for the incoming message (the value of
53568 <varname>$message_exim_id</varname>) as a zero-terminated string.
53569 </para>
53570 </listitem></varlistentry>
53571 <varlistentry>
53572 <term><emphasis role="bold">uschar&nbsp;*received_protocol</emphasis></term>
53573 <listitem>
53574 <para>
53575 The name of the protocol by which the message was received.
53576 </para>
53577 </listitem></varlistentry>
53578 <varlistentry>
53579 <term><emphasis role="bold">int&nbsp;recipients_count</emphasis></term>
53580 <listitem>
53581 <para>
53582 The number of accepted recipients.
53583 </para>
53584 </listitem></varlistentry>
53585 <varlistentry>
53586 <term><emphasis role="bold">recipient_item&nbsp;*recipients_list</emphasis></term>
53587 <listitem>
53588 <para>
53589 <indexterm role="concept">
53590 <primary>recipient</primary>
53591 <secondary>adding in local scan</secondary>
53592 </indexterm>
53593 <indexterm role="concept">
53594 <primary>recipient</primary>
53595 <secondary>removing in local scan</secondary>
53596 </indexterm>
53597 The list of accepted recipients, held in a vector of length
53598 <option>recipients_count</option>. The <option>recipient_item</option> structure is discussed below. You
53599 can add additional recipients by calling <emphasis>receive_add_recipient()</emphasis> (see
53600 below). You can delete recipients by removing them from the vector and
53601 adjusting the value in <option>recipients_count</option>. In particular, by setting
53602 <option>recipients_count</option> to zero you remove all recipients. If you then return the
53603 value <literal>LOCAL_SCAN_ACCEPT</literal>, the message is accepted, but immediately
53604 blackholed. To replace the recipients, you can set <option>recipients_count</option> to zero
53605 and then call <emphasis>receive_add_recipient()</emphasis> as often as needed.
53606 </para>
53607 </listitem></varlistentry>
53608 <varlistentry>
53609 <term><emphasis role="bold">uschar&nbsp;*sender_address</emphasis></term>
53610 <listitem>
53611 <para>
53612 The envelope sender address. For bounce messages this is the empty string.
53613 </para>
53614 </listitem></varlistentry>
53615 <varlistentry>
53616 <term><emphasis role="bold">uschar&nbsp;*sender_host_address</emphasis></term>
53617 <listitem>
53618 <para>
53619 The IP address of the sending host, as a string. This is NULL for
53620 locally-submitted messages.
53621 </para>
53622 </listitem></varlistentry>
53623 <varlistentry>
53624 <term><emphasis role="bold">uschar&nbsp;*sender_host_authenticated</emphasis></term>
53625 <listitem>
53626 <para>
53627 The name of the authentication mechanism that was used, or NULL if the message
53628 was not received over an authenticated SMTP connection.
53629 </para>
53630 </listitem></varlistentry>
53631 <varlistentry>
53632 <term><emphasis role="bold">uschar&nbsp;*sender_host_name</emphasis></term>
53633 <listitem>
53634 <para>
53635 The name of the sending host, if known.
53636 </para>
53637 </listitem></varlistentry>
53638 <varlistentry>
53639 <term><emphasis role="bold">int&nbsp;sender_host_port</emphasis></term>
53640 <listitem>
53641 <para>
53642 The port on the sending host.
53643 </para>
53644 </listitem></varlistentry>
53645 <varlistentry>
53646 <term><emphasis role="bold">BOOL&nbsp;smtp_input</emphasis></term>
53647 <listitem>
53648 <para>
53649 This variable is TRUE for all SMTP input, including BSMTP.
53650 </para>
53651 </listitem></varlistentry>
53652 <varlistentry>
53653 <term><emphasis role="bold">BOOL&nbsp;smtp_batched_input</emphasis></term>
53654 <listitem>
53655 <para>
53656 This variable is TRUE for BSMTP input.
53657 </para>
53658 </listitem></varlistentry>
53659 <varlistentry>
53660 <term><emphasis role="bold">int&nbsp;store_pool</emphasis></term>
53661 <listitem>
53662 <para>
53663 The contents of this variable control which pool of memory is used for new
53664 requests. See section <xref linkend="SECTmemhanloc"/> for details.
53665 </para>
53666 </listitem></varlistentry>
53667 </variablelist>
53668 </section>
53669 <section id="SECID209">
53670 <title>Structure of header lines</title>
53671 <para>
53672 The <option>header_line</option> structure contains the members listed below.
53673 You can add additional header lines by calling the <emphasis>header_add()</emphasis> function
53674 (see below). You can cause header lines to be ignored (deleted) by setting
53675 their type to *.
53676 </para>
53677 <variablelist>
53678 <varlistentry>
53679 <term><emphasis role="bold">struct&nbsp;header_line&nbsp;*next</emphasis></term>
53680 <listitem>
53681 <para>
53682 A pointer to the next header line, or NULL for the last line.
53683 </para>
53684 </listitem></varlistentry>
53685 <varlistentry>
53686 <term><emphasis role="bold">int&nbsp;type</emphasis></term>
53687 <listitem>
53688 <para>
53689 A code identifying certain headers that Exim recognizes. The codes are printing
53690 characters, and are documented in chapter <xref linkend="CHAPspool"/> of this manual.
53691 Notice in particular that any header line whose type is * is not transmitted
53692 with the message. This flagging is used for header lines that have been
53693 rewritten, or are to be removed (for example, <emphasis>Envelope-sender:</emphasis> header
53694 lines.) Effectively, * means <quote>deleted</quote>.
53695 </para>
53696 </listitem></varlistentry>
53697 <varlistentry>
53698 <term><emphasis role="bold">int&nbsp;slen</emphasis></term>
53699 <listitem>
53700 <para>
53701 The number of characters in the header line, including the terminating and any
53702 internal newlines.
53703 </para>
53704 </listitem></varlistentry>
53705 <varlistentry>
53706 <term><emphasis role="bold">uschar&nbsp;*text</emphasis></term>
53707 <listitem>
53708 <para>
53709 A pointer to the text of the header. It always ends with a newline, followed by
53710 a zero byte. Internal newlines are preserved.
53711 </para>
53712 </listitem></varlistentry>
53713 </variablelist>
53714 </section>
53715 <section id="SECID210">
53716 <title>Structure of recipient items</title>
53717 <para>
53718 The <option>recipient_item</option> structure contains these members:
53719 </para>
53720 <variablelist>
53721 <varlistentry>
53722 <term><emphasis role="bold">uschar&nbsp;*address</emphasis></term>
53723 <listitem>
53724 <para>
53725 This is a pointer to the recipient address as it was received.
53726 </para>
53727 </listitem></varlistentry>
53728 <varlistentry>
53729 <term><emphasis role="bold">int&nbsp;pno</emphasis></term>
53730 <listitem>
53731 <para>
53732 This is used in later Exim processing when top level addresses are created by
53733 the <option>one_time</option> option. It is not relevant at the time <function>local_scan()</function> is run
53734 and must always contain -1 at this stage.
53735 </para>
53736 </listitem></varlistentry>
53737 <varlistentry>
53738 <term><emphasis role="bold">uschar&nbsp;*errors_to</emphasis></term>
53739 <listitem>
53740 <para>
53741 If this value is not NULL, bounce messages caused by failing to deliver to the
53742 recipient are sent to the address it contains. In other words, it overrides the
53743 envelope sender for this one recipient. (Compare the <option>errors_to</option> generic
53744 router option.) If a <function>local_scan()</function> function sets an <option>errors_to</option> field to
53745 an unqualified address, Exim qualifies it using the domain from
53746 <option>qualify_recipient</option>. When <function>local_scan()</function> is called, the <option>errors_to</option> field
53747 is NULL for all recipients.
53748 </para>
53749 </listitem></varlistentry>
53750 </variablelist>
53751 </section>
53752 <section id="SECID211">
53753 <title>Available Exim functions</title>
53754 <para>
53755 <indexterm role="concept">
53756 <primary><function>local_scan()</function> function</primary>
53757 <secondary>available Exim functions</secondary>
53758 </indexterm>
53759 The header <filename>local_scan.h</filename> gives you access to a number of Exim functions.
53760 These are the only ones that are guaranteed to be maintained from release to
53761 release:
53762 </para>
53763 <variablelist>
53764 <varlistentry>
53765 <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>
53766 <listitem>
53767 <para>
53768 This function creates a child process that runs the command specified by
53769 <option>argv</option>. The environment for the process is specified by <option>envp</option>, which can
53770 be NULL if no environment variables are to be passed. A new umask is supplied
53771 for the process in <option>newumask</option>.
53772 </para>
53773 <para>
53774 Pipes to the standard input and output of the new process are set up
53775 and returned to the caller via the <option>infdptr</option> and <option>outfdptr</option> arguments. The
53776 standard error is cloned to the standard output. If there are any file
53777 descriptors <quote>in the way</quote> in the new process, they are closed. If the final
53778 argument is TRUE, the new process is made into a process group leader.
53779 </para>
53780 <para>
53781 The function returns the pid of the new process, or -1 if things go wrong.
53782 </para>
53783 </listitem></varlistentry>
53784 <varlistentry>
53785 <term><emphasis role="bold">int&nbsp;child_close(pid_t&nbsp;pid,&nbsp;int&nbsp;timeout)</emphasis></term>
53786 <listitem>
53787 <para>
53788 This function waits for a child process to terminate, or for a timeout (in
53789 seconds) to expire. A timeout value of zero means wait as long as it takes. The
53790 return value is as follows:
53791 </para>
53792 <itemizedlist>
53793 <listitem>
53794 <para>
53795 &gt;= 0
53796 </para>
53797 <para>
53798 The process terminated by a normal exit and the value is the process
53799 ending status.
53800 </para>
53801 </listitem>
53802 <listitem>
53803 <para>
53804 &lt; 0 and &gt; &ndash;256
53805 </para>
53806 <para>
53807 The process was terminated by a signal and the value is the negation of the
53808 signal number.
53809 </para>
53810 </listitem>
53811 <listitem>
53812 <para>
53813 &ndash;256
53814 </para>
53815 <para>
53816 The process timed out.
53817 </para>
53818 </listitem>
53819 <listitem>
53820 <para>
53821 &ndash;257
53822 </para>
53823 <para>
53824 The was some other error in wait(); <option>errno</option> is still set.
53825 </para>
53826 </listitem>
53827 </itemizedlist>
53828 </listitem></varlistentry>
53829 <varlistentry>
53830 <term><emphasis role="bold">pid_t&nbsp;child_open_exim(int&nbsp;*fd)</emphasis></term>
53831 <listitem>
53832 <para>
53833 This function provide you with a means of submitting a new message to
53834 Exim. (Of course, you can also call <filename>/usr/sbin/sendmail</filename> yourself if you
53835 want, but this packages it all up for you.) The function creates a pipe,
53836 forks a subprocess that is running
53837 </para>
53838 <literallayout class="monospaced">
53839 exim -t -oem -oi -f &lt;&gt;
53840 </literallayout>
53841 <para>
53842 and returns to you (via the <literal>int *</literal> argument) a file descriptor for the pipe
53843 that is connected to the standard input. The yield of the function is the PID
53844 of the subprocess. You can then write a message to the file descriptor, with
53845 recipients in <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and/or <emphasis>Bcc:</emphasis> header lines.
53846 </para>
53847 <para>
53848 When you have finished, call <emphasis>child_close()</emphasis> to wait for the process to
53849 finish and to collect its ending status. A timeout value of zero is usually
53850 fine in this circumstance. Unless you have made a mistake with the recipient
53851 addresses, you should get a return code of zero.
53852 </para>
53853 </listitem></varlistentry>
53854 <varlistentry>
53855 <term><emphasis role="bold">pid_t&nbsp;child_open_exim2(int&nbsp;*fd,&nbsp;uschar&nbsp;*sender,&nbsp;uschar&nbsp;*sender_authentication)</emphasis></term>
53856 <listitem>
53857 <para>
53858 This function is a more sophisticated version of <emphasis>child_open()</emphasis>. The command
53859 that it runs is:
53860 </para>
53861 <literallayout>
53862 <literal>exim -t -oem -oi -f </literal><emphasis>sender</emphasis><literal> -oMas </literal><emphasis>sender_authentication</emphasis>
53863 </literallayout>
53864 <para>
53865 The third argument may be NULL, in which case the <option>-oMas</option> option is omitted.
53866 </para>
53867 </listitem></varlistentry>
53868 <varlistentry>
53869 <term><emphasis role="bold">void&nbsp;debug_printf(char&nbsp;*,&nbsp;...)</emphasis></term>
53870 <listitem>
53871 <para>
53872 This is Exim&#x2019;s debugging function, with arguments as for <emphasis>(printf()</emphasis>. The
53873 output is written to the standard error stream. If no debugging is selected,
53874 calls to <emphasis>debug_printf()</emphasis> have no effect. Normally, you should make calls
53875 conditional on the <literal>local_scan</literal> debug selector by coding like this:
53876 </para>
53877 <literallayout class="monospaced">
53878 if ((debug_selector &amp; D_local_scan) != 0)
53879   debug_printf("xxx", ...);
53880 </literallayout>
53881 </listitem></varlistentry>
53882 <varlistentry>
53883 <term><emphasis role="bold">uschar&nbsp;*expand_string(uschar&nbsp;*string)</emphasis></term>
53884 <listitem>
53885 <para>
53886 This is an interface to Exim&#x2019;s string expansion code. The return value is the
53887 expanded string, or NULL if there was an expansion failure.
53888 The C variable <option>expand_string_message</option> contains an error message after an
53889 expansion failure. If expansion does not change the string, the return value is
53890 the pointer to the input string. Otherwise, the return value points to a new
53891 block of memory that was obtained by a call to <emphasis>store_get()</emphasis>. See section
53892 <xref linkend="SECTmemhanloc"/> below for a discussion of memory handling.
53893 </para>
53894 </listitem></varlistentry>
53895 <varlistentry>
53896 <term><emphasis role="bold">void&nbsp;header_add(int&nbsp;type,&nbsp;char&nbsp;*format,&nbsp;...)</emphasis></term>
53897 <listitem>
53898 <para>
53899 This function allows you to an add additional header line at the end of the
53900 existing ones. The first argument is the type, and should normally be a space
53901 character. The second argument is a format string and any number of
53902 substitution arguments as for <function>sprintf()</function>. You may include internal newlines
53903 if you want, and you must ensure that the string ends with a newline.
53904 </para>
53905 </listitem></varlistentry>
53906 <varlistentry>
53907 <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>
53908 <listitem>
53909 <para>
53910 This function adds a new header line at a specified point in the header
53911 chain. The header itself is specified as for <emphasis>header_add()</emphasis>.
53912 </para>
53913 <para>
53914 If <option>name</option> is NULL, the new header is added at the end of the chain if
53915 <option>after</option> is true, or at the start if <option>after</option> is false. If <option>name</option> is not
53916 NULL, the header lines are searched for the first non-deleted header that
53917 matches the name. If one is found, the new header is added before it if
53918 <option>after</option> is false. If <option>after</option> is true, the new header is added after the
53919 found header and any adjacent subsequent ones with the same name (even if
53920 marked <quote>deleted</quote>). If no matching non-deleted header is found, the <option>topnot</option>
53921 option controls where the header is added. If it is true, addition is at the
53922 top; otherwise at the bottom. Thus, to add a header after all the <emphasis>Received:</emphasis>
53923 headers, or at the top if there are no <emphasis>Received:</emphasis> headers, you could use
53924 </para>
53925 <literallayout class="monospaced">
53926 header_add_at_position(TRUE, US"Received", TRUE,
53927   ' ', "X-xxx: ...");
53928 </literallayout>
53929 <para>
53930 Normally, there is always at least one non-deleted <emphasis>Received:</emphasis> header, but
53931 there may not be if <option>received_header_text</option> expands to an empty string.
53932 </para>
53933 </listitem></varlistentry>
53934 <varlistentry>
53935 <term><emphasis role="bold">void&nbsp;header_remove(int&nbsp;occurrence,&nbsp;uschar&nbsp;*name)</emphasis></term>
53936 <listitem>
53937 <para>
53938 This function removes header lines. If <option>occurrence</option> is zero or negative, all
53939 occurrences of the header are removed. If occurrence is greater than zero, that
53940 particular instance of the header is removed. If no header(s) can be found that
53941 match the specification, the function does nothing.
53942 </para>
53943 </listitem></varlistentry>
53944 <varlistentry>
53945 <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>
53946 <listitem>
53947 <para>
53948 This function tests whether the given header has the given name. It is not just
53949 a string comparison, because white space is permitted between the name and the
53950 colon. If the <option>notdel</option> argument is true, a false return is forced for all
53951 <quote>deleted</quote> headers; otherwise they are not treated specially. For example:
53952 </para>
53953 <literallayout class="monospaced">
53954 if (header_testname(h, US"X-Spam", 6, TRUE)) ...
53955 </literallayout>
53956 </listitem></varlistentry>
53957 <varlistentry>
53958 <term><emphasis role="bold">uschar&nbsp;*lss_b64encode(uschar&nbsp;*cleartext,&nbsp;int&nbsp;length)</emphasis></term>
53959 <listitem>
53960 <para>
53961 <indexterm role="concept">
53962 <primary>base64 encoding</primary>
53963 <secondary>functions for <function>local_scan()</function> use</secondary>
53964 </indexterm>
53965 This function base64-encodes a string, which is passed by address and length.
53966 The text may contain bytes of any value, including zero. The result is passed
53967 back in dynamic memory that is obtained by calling <emphasis>store_get()</emphasis>. It is
53968 zero-terminated.
53969 </para>
53970 </listitem></varlistentry>
53971 <varlistentry>
53972 <term><emphasis role="bold">int&nbsp;lss_b64decode(uschar&nbsp;*codetext,&nbsp;uschar&nbsp;**cleartext)</emphasis></term>
53973 <listitem>
53974 <para>
53975 This function decodes a base64-encoded string. Its arguments are a
53976 zero-terminated base64-encoded string and the address of a variable that is set
53977 to point to the result, which is in dynamic memory. The length of the decoded
53978 string is the yield of the function. If the input is invalid base64 data, the
53979 yield is -1. A zero byte is added to the end of the output string to make it
53980 easy to interpret as a C string (assuming it contains no zeros of its own). The
53981 added zero byte is not included in the returned count.
53982 </para>
53983 </listitem></varlistentry>
53984 <varlistentry>
53985 <term><emphasis role="bold">int&nbsp;lss_match_domain(uschar&nbsp;*domain,&nbsp;uschar&nbsp;*list)</emphasis></term>
53986 <listitem>
53987 <para>
53988 This function checks for a match in a domain list. Domains are always
53989 matched caselessly. The return value is one of the following:
53990 </para>
53991 <literallayout>
53992 <literal>OK     </literal> match succeeded
53993 <literal>FAIL   </literal> match failed
53994 <literal>DEFER  </literal> match deferred
53995 </literallayout>
53996 <para>
53997 DEFER is usually caused by some kind of lookup defer, such as the
53998 inability to contact a database.
53999 </para>
54000 </listitem></varlistentry>
54001 <varlistentry>
54002 <term><emphasis role="bold">int&nbsp;lss_match_local_part(uschar&nbsp;*localpart,&nbsp;uschar&nbsp;*list,&nbsp;BOOL&nbsp;caseless)</emphasis></term>
54003 <listitem>
54004 <para>
54005 This function checks for a match in a local part list. The third argument
54006 controls case-sensitivity. The return values are as for
54007 <emphasis>lss_match_domain()</emphasis>.
54008 </para>
54009 </listitem></varlistentry>
54010 <varlistentry>
54011 <term><emphasis role="bold">int&nbsp;lss_match_address(uschar&nbsp;*address,&nbsp;uschar&nbsp;*list,&nbsp;BOOL&nbsp;caseless)</emphasis></term>
54012 <listitem>
54013 <para>
54014 This function checks for a match in an address list. The third argument
54015 controls the case-sensitivity of the local part match. The domain is always
54016 matched caselessly. The return values are as for <emphasis>lss_match_domain()</emphasis>.
54017 </para>
54018 </listitem></varlistentry>
54019 <varlistentry>
54020 <term><emphasis role="bold">int&nbsp;lss_match_host(uschar&nbsp;*host_name,&nbsp;uschar&nbsp;*host_address,&nbsp;uschar&nbsp;*list)</emphasis></term>
54021 <listitem>
54022 <para>
54023 This function checks for a match in a host list. The most common usage is
54024 expected to be
54025 </para>
54026 <literallayout class="monospaced">
54027 lss_match_host(sender_host_name, sender_host_address, ...)
54028 </literallayout>
54029 <para>
54030 <indexterm role="variable">
54031 <primary><varname>$sender_host_address</varname></primary>
54032 </indexterm>
54033 An empty address field matches an empty item in the host list. If the host name
54034 is NULL, the name corresponding to <varname>$sender_host_address</varname> is automatically
54035 looked up if a host name is required to match an item in the list. The return
54036 values are as for <emphasis>lss_match_domain()</emphasis>, but in addition, <emphasis>lss_match_host()</emphasis>
54037 returns ERROR in the case when it had to look up a host name, but the lookup
54038 failed.
54039 </para>
54040 </listitem></varlistentry>
54041 <varlistentry>
54042 <term><emphasis role="bold">void&nbsp;log_write(unsigned&nbsp;int&nbsp;selector,&nbsp;int&nbsp;which,&nbsp;char&nbsp;*format,&nbsp;...)</emphasis></term>
54043 <listitem>
54044 <para>
54045 This function writes to Exim&#x2019;s log files. The first argument should be zero (it
54046 is concerned with <option>log_selector</option>). The second argument can be <literal>LOG_MAIN</literal> or
54047 <literal>LOG_REJECT</literal> or <literal>LOG_PANIC</literal> or the inclusive <quote>or</quote> of any combination of
54048 them. It specifies to which log or logs the message is written. The remaining
54049 arguments are a format and relevant insertion arguments. The string should not
54050 contain any newlines, not even at the end.
54051 </para>
54052 </listitem></varlistentry>
54053 <varlistentry>
54054 <term><emphasis role="bold">void&nbsp;receive_add_recipient(uschar&nbsp;*address,&nbsp;int&nbsp;pno)</emphasis></term>
54055 <listitem>
54056 <para>
54057 This function adds an additional recipient to the message. The first argument
54058 is the recipient address. If it is unqualified (has no domain), it is qualified
54059 with the <option>qualify_recipient</option> domain. The second argument must always be -1.
54060 </para>
54061 <para>
54062 This function does not allow you to specify a private <option>errors_to</option> address (as
54063 described with the structure of <option>recipient_item</option> above), because it pre-dates
54064 the addition of that field to the structure. However, it is easy to add such a
54065 value afterwards. For example:
54066 </para>
54067 <literallayout class="monospaced">
54068  receive_add_recipient(US"monitor@mydom.example", -1);
54069  recipients_list[recipients_count-1].errors_to =
54070    US"postmaster@mydom.example";
54071 </literallayout>
54072 </listitem></varlistentry>
54073 <varlistentry>
54074 <term><emphasis role="bold">BOOL&nbsp;receive_remove_recipient(uschar&nbsp;*recipient)</emphasis></term>
54075 <listitem>
54076 <para>
54077 This is a convenience function to remove a named recipient from the list of
54078 recipients. It returns true if a recipient was removed, and false if no
54079 matching recipient could be found. The argument must be a complete email
54080 address.
54081 </para>
54082 </listitem></varlistentry>
54083 </variablelist>
54084 <para>
54085 <indexterm role="concept">
54086 <primary>RFC 2047</primary>
54087 </indexterm>
54088 </para>
54089 <variablelist>
54090 <varlistentry>
54091 <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>
54092 <listitem>
54093 <para>
54094 This function decodes strings that are encoded according to RFC 2047. Typically
54095 these are the contents of header lines. First, each <quote>encoded word</quote> is decoded
54096 from the Q or B encoding into a byte-string. Then, if provided with the name of
54097 a charset encoding, and if the <function>iconv()</function> function is available, an attempt is
54098 made  to translate the result to the named character set. If this fails, the
54099 binary string is returned with an error message.
54100 </para>
54101 <para>
54102 The first argument is the string to be decoded. If <option>lencheck</option> is TRUE, the
54103 maximum MIME word length is enforced. The third argument is the target
54104 encoding, or NULL if no translation is wanted.
54105 </para>
54106 <para>
54107 <indexterm role="concept">
54108 <primary>binary zero</primary>
54109 <secondary>in RFC 2047 decoding</secondary>
54110 </indexterm>
54111 <indexterm role="concept">
54112 <primary>RFC 2047</primary>
54113 <secondary>binary zero in</secondary>
54114 </indexterm>
54115 If a binary zero is encountered in the decoded string, it is replaced by the
54116 contents of the <option>zeroval</option> argument. For use with Exim headers, the value must
54117 not be 0 because header lines are handled as zero-terminated strings.
54118 </para>
54119 <para>
54120 The function returns the result of processing the string, zero-terminated; if
54121 <option>lenptr</option> is not NULL, the length of the result is set in the variable to
54122 which it points. When <option>zeroval</option> is 0, <option>lenptr</option> should not be NULL.
54123 </para>
54124 <para>
54125 If an error is encountered, the function returns NULL and uses the <option>error</option>
54126 argument to return an error message. The variable pointed to by <option>error</option> is
54127 set to NULL if there is no error; it may be set non-NULL even when the function
54128 returns a non-NULL value if decoding was successful, but there was a problem
54129 with translation.
54130 </para>
54131 </listitem></varlistentry>
54132 <varlistentry>
54133 <term><emphasis role="bold">int&nbsp;smtp_fflush(void)</emphasis></term>
54134 <listitem>
54135 <para>
54136 This function is used in conjunction with <emphasis>smtp_printf()</emphasis>, as described
54137 below.
54138 </para>
54139 </listitem></varlistentry>
54140 <varlistentry>
54141 <term><emphasis role="bold">void&nbsp;smtp_printf(char&nbsp;*,&nbsp;...)</emphasis></term>
54142 <listitem>
54143 <para>
54144 The arguments of this function are like <function>printf()</function>; it writes to the SMTP
54145 output stream. You should use this function only when there is an SMTP output
54146 stream, that is, when the incoming message is being received via interactive
54147 SMTP. This is the case when <option>smtp_input</option> is TRUE and <option>smtp_batched_input</option>
54148 is FALSE. If you want to test for an incoming message from another host (as
54149 opposed to a local process that used the <option>-bs</option> command line option), you can
54150 test the value of <option>sender_host_address</option>, which is non-NULL when a remote host
54151 is involved.
54152 </para>
54153 <para>
54154 If an SMTP TLS connection is established, <emphasis>smtp_printf()</emphasis> uses the TLS
54155 output function, so it can be used for all forms of SMTP connection.
54156 </para>
54157 <para>
54158 Strings that are written by <emphasis>smtp_printf()</emphasis> from within <function>local_scan()</function>
54159 must start with an appropriate response code: 550 if you are going to return
54160 LOCAL_SCAN_REJECT, 451 if you are going to return
54161 LOCAL_SCAN_TEMPREJECT, and 250 otherwise. Because you are writing the
54162 initial lines of a multi-line response, the code must be followed by a hyphen
54163 to indicate that the line is not the final response line. You must also ensure
54164 that the lines you write terminate with CRLF. For example:
54165 </para>
54166 <literallayout class="monospaced">
54167 smtp_printf("550-this is some extra info\r\n");
54168 return LOCAL_SCAN_REJECT;
54169 </literallayout>
54170 <para>
54171 Note that you can also create multi-line responses by including newlines in
54172 the data returned via the <option>return_text</option> argument. The added value of using
54173 <emphasis>smtp_printf()</emphasis> is that, for instance, you could introduce delays between
54174 multiple output lines.
54175 </para>
54176 <para>
54177 The <emphasis>smtp_printf()</emphasis> function does not return any error indication, because it
54178 does not automatically flush pending output, and therefore does not test
54179 the state of the stream. (In the main code of Exim, flushing and error
54180 detection is done when Exim is ready for the next SMTP input command.) If
54181 you want to flush the output and check for an error (for example, the
54182 dropping of a TCP/IP connection), you can call <emphasis>smtp_fflush()</emphasis>, which has no
54183 arguments. It flushes the output stream, and returns a non-zero value if there
54184 is an error.
54185 </para>
54186 </listitem></varlistentry>
54187 <varlistentry>
54188 <term><emphasis role="bold">void&nbsp;*store_get(int)</emphasis></term>
54189 <listitem>
54190 <para>
54191 This function accesses Exim&#x2019;s internal store (memory) manager. It gets a new
54192 chunk of memory whose size is given by the argument. Exim bombs out if it ever
54193 runs out of memory. See the next section for a discussion of memory handling.
54194 </para>
54195 </listitem></varlistentry>
54196 <varlistentry>
54197 <term><emphasis role="bold">void&nbsp;*store_get_perm(int)</emphasis></term>
54198 <listitem>
54199 <para>
54200 This function is like <emphasis>store_get()</emphasis>, but it always gets memory from the
54201 permanent pool. See the next section for a discussion of memory handling.
54202 </para>
54203 </listitem></varlistentry>
54204 <varlistentry>
54205 <term><emphasis role="bold">uschar&nbsp;*string_copy(uschar&nbsp;*string)</emphasis></term>
54206 <listitem>
54207 <para>
54208 See below.
54209 </para>
54210 </listitem></varlistentry>
54211 <varlistentry>
54212 <term><emphasis role="bold">uschar&nbsp;*string_copyn(uschar&nbsp;*string,&nbsp;int&nbsp;length)</emphasis></term>
54213 <listitem>
54214 <para>
54215 See below.
54216 </para>
54217 </listitem></varlistentry>
54218 <varlistentry>
54219 <term><emphasis role="bold">uschar&nbsp;*string_sprintf(char&nbsp;*format,&nbsp;...)</emphasis></term>
54220 <listitem>
54221 <para>
54222 These three functions create strings using Exim&#x2019;s dynamic memory facilities.
54223 The first makes a copy of an entire string. The second copies up to a maximum
54224 number of characters, indicated by the second argument. The third uses a format
54225 and insertion arguments to create a new string. In each case, the result is a
54226 pointer to a new string in the current memory pool. See the next section for
54227 more discussion.
54228 </para>
54229 </listitem></varlistentry>
54230 </variablelist>
54231 </section>
54232 <section id="SECTmemhanloc">
54233 <title>More about Exim&#x2019;s memory handling</title>
54234 <para>
54235 <indexterm role="concept">
54236 <primary><function>local_scan()</function> function</primary>
54237 <secondary>memory handling</secondary>
54238 </indexterm>
54239 No function is provided for freeing memory, because that is never needed.
54240 The dynamic memory that Exim uses when receiving a message is automatically
54241 recycled if another message is received by the same process (this applies only
54242 to incoming SMTP connections &ndash; other input methods can supply only one
54243 message at a time). After receiving the last message, a reception process
54244 terminates.
54245 </para>
54246 <para>
54247 Because it is recycled, the normal dynamic memory cannot be used for holding
54248 data that must be preserved over a number of incoming messages on the same SMTP
54249 connection. However, Exim in fact uses two pools of dynamic memory; the second
54250 one is not recycled, and can be used for this purpose.
54251 </para>
54252 <para>
54253 If you want to allocate memory that remains available for subsequent messages
54254 in the same SMTP connection, you should set
54255 </para>
54256 <literallayout class="monospaced">
54257 store_pool = POOL_PERM
54258 </literallayout>
54259 <para>
54260 before calling the function that does the allocation. There is no need to
54261 restore the value if you do not need to; however, if you do want to revert to
54262 the normal pool, you can either restore the previous value of <option>store_pool</option> or
54263 set it explicitly to POOL_MAIN.
54264 </para>
54265 <para>
54266 The pool setting applies to all functions that get dynamic memory, including
54267 <emphasis>expand_string()</emphasis>, <emphasis>store_get()</emphasis>, and the <emphasis>string_xxx()</emphasis> functions.
54268 There is also a convenience function called <emphasis>store_get_perm()</emphasis> that gets a
54269 block of memory from the permanent pool while preserving the value of
54270 <option>store_pool</option>.
54271 <indexterm role="concept" startref="IIDlosca" class="endofrange"/>
54272 </para>
54273 </section>
54274 </chapter>
54275
54276 <chapter id="CHAPsystemfilter">
54277 <title>System-wide message filtering</title>
54278 <para>
54279 <indexterm role="concept" id="IIDsysfil1" class="startofrange">
54280 <primary>filter</primary>
54281 <secondary>system filter</secondary>
54282 </indexterm>
54283 <indexterm role="concept" id="IIDsysfil2" class="startofrange">
54284 <primary>filtering all mail</primary>
54285 </indexterm>
54286 <indexterm role="concept" id="IIDsysfil3" class="startofrange">
54287 <primary>system filter</primary>
54288 </indexterm>
54289 The previous chapters (on ACLs and the local scan function) describe checks
54290 that can be applied to messages before they are accepted by a host. There is
54291 also a mechanism for checking messages once they have been received, but before
54292 they are delivered. This is called the <emphasis>system filter</emphasis>.
54293 </para>
54294 <para>
54295 The system filter operates in a similar manner to users&#x2019; filter files, but it
54296 is run just once per message (however many recipients the message has).
54297 It should not normally be used as a substitute for routing, because <option>deliver</option>
54298 commands in a system router provide new envelope recipient addresses.
54299 The system filter must be an Exim filter. It cannot be a Sieve filter.
54300 </para>
54301 <para>
54302 The system filter is run at the start of a delivery attempt, before any routing
54303 is done. If a message fails to be completely delivered at the first attempt,
54304 the system filter is run again at the start of every retry.
54305 If you want your filter to do something only once per message, you can make use
54306 of the <option>first_delivery</option> condition in an <option>if</option> command in the filter to
54307 prevent it happening on retries.
54308 </para>
54309 <para>
54310 <indexterm role="variable">
54311 <primary><varname>$domain</varname></primary>
54312 </indexterm>
54313 <indexterm role="variable">
54314 <primary><varname>$local_part</varname></primary>
54315 </indexterm>
54316 <emphasis role="bold">Warning</emphasis>: Because the system filter runs just once, variables that are
54317 specific to individual recipient addresses, such as <varname>$local_part</varname> and
54318 <varname>$domain</varname>, are not set, and the <quote>personal</quote> condition is not meaningful. If
54319 you want to run a centrally-specified filter for each recipient address
54320 independently, you can do so by setting up a suitable <command>redirect</command> router, as
54321 described in section <xref linkend="SECTperaddfil"/> below.
54322 </para>
54323 <section id="SECID212">
54324 <title>Specifying a system filter</title>
54325 <para>
54326 <indexterm role="concept">
54327 <primary>uid (user id)</primary>
54328 <secondary>system filter</secondary>
54329 </indexterm>
54330 <indexterm role="concept">
54331 <primary>gid (group id)</primary>
54332 <secondary>system filter</secondary>
54333 </indexterm>
54334 The name of the file that contains the system filter must be specified by
54335 setting <option>system_filter</option>. If you want the filter to run under a uid and gid
54336 other than root, you must also set <option>system_filter_user</option> and
54337 <option>system_filter_group</option> as appropriate. For example:
54338 </para>
54339 <literallayout class="monospaced">
54340 system_filter = /etc/mail/exim.filter
54341 system_filter_user = exim
54342 </literallayout>
54343 <para>
54344 If a system filter generates any deliveries directly to files or pipes (via the
54345 <option>save</option> or <option>pipe</option> commands), transports to handle these deliveries must be
54346 specified by setting <option>system_filter_file_transport</option> and
54347 <option>system_filter_pipe_transport</option>, respectively. Similarly,
54348 <option>system_filter_reply_transport</option> must be set to handle any messages generated
54349 by the <option>reply</option> command.
54350 </para>
54351 </section>
54352 <section id="SECID213">
54353 <title>Testing a system filter</title>
54354 <para>
54355 You can run simple tests of a system filter in the same way as for a user
54356 filter, but you should use <option>-bF</option> rather than <option>-bf</option>, so that features that
54357 are permitted only in system filters are recognized.
54358 </para>
54359 <para>
54360 If you want to test the combined effect of a system filter and a user filter,
54361 you can use both <option>-bF</option> and <option>-bf</option> on the same command line.
54362 </para>
54363 </section>
54364 <section id="SECID214">
54365 <title>Contents of a system filter</title>
54366 <para>
54367 The language used to specify system filters is the same as for users&#x2019; filter
54368 files. It is described in the separate end-user document <emphasis>Exim&#x2019;s interface to
54369 mail filtering</emphasis>. However, there are some additional features that are
54370 available only in system filters; these are described in subsequent sections.
54371 If they are encountered in a user&#x2019;s filter file or when testing with <option>-bf</option>,
54372 they cause errors.
54373 </para>
54374 <para>
54375 <indexterm role="concept">
54376 <primary>frozen messages</primary>
54377 <secondary>manual thaw; testing in filter</secondary>
54378 </indexterm>
54379 There are two special conditions which, though available in users&#x2019; filter
54380 files, are designed for use in system filters. The condition <option>first_delivery</option>
54381 is true only for the first attempt at delivering a message, and
54382 <option>manually_thawed</option> is true only if the message has been frozen, and
54383 subsequently thawed by an admin user. An explicit forced delivery counts as a
54384 manual thaw, but thawing as a result of the <option>auto_thaw</option> setting does not.
54385 </para>
54386 <para>
54387 <emphasis role="bold">Warning</emphasis>: If a system filter uses the <option>first_delivery</option> condition to
54388 specify an <quote>unseen</quote> (non-significant) delivery, and that delivery does not
54389 succeed, it will not be tried again.
54390 If you want Exim to retry an unseen delivery until it succeeds, you should
54391 arrange to set it up every time the filter runs.
54392 </para>
54393 <para>
54394 When a system filter finishes running, the values of the variables <varname>$n0</varname> &ndash;
54395 <varname>$n9</varname> are copied into <varname>$sn0</varname> &ndash; <varname>$sn9</varname> and are thereby made available to
54396 users&#x2019; filter files. Thus a system filter can, for example, set up <quote>scores</quote>
54397 to which users&#x2019; filter files can refer.
54398 </para>
54399 </section>
54400 <section id="SECID215">
54401 <title>Additional variable for system filters</title>
54402 <para>
54403 <indexterm role="variable">
54404 <primary><varname>$recipients</varname></primary>
54405 </indexterm>
54406 The expansion variable <varname>$recipients</varname>, containing a list of all the recipients
54407 of the message (separated by commas and white space), is available in system
54408 filters. It is not available in users&#x2019; filters for privacy reasons.
54409 </para>
54410 </section>
54411 <section id="SECID216">
54412 <title>Defer, freeze, and fail commands for system filters</title>
54413 <para>
54414 <indexterm role="concept">
54415 <primary>freezing messages</primary>
54416 </indexterm>
54417 <indexterm role="concept">
54418 <primary>message</primary>
54419 <secondary>freezing</secondary>
54420 </indexterm>
54421 <indexterm role="concept">
54422 <primary>message</primary>
54423 <secondary>forced failure</secondary>
54424 </indexterm>
54425 <indexterm role="concept">
54426 <primary><option>fail</option></primary>
54427 <secondary>in system filter</secondary>
54428 </indexterm>
54429 <indexterm role="concept">
54430 <primary><option>freeze</option> in system filter</primary>
54431 </indexterm>
54432 <indexterm role="concept">
54433 <primary><option>defer</option> in system filter</primary>
54434 </indexterm>
54435 There are three extra commands (<option>defer</option>, <option>freeze</option> and <option>fail</option>) which are
54436 always available in system filters, but are not normally enabled in users&#x2019;
54437 filters. (See the <option>allow_defer</option>, <option>allow_freeze</option> and <option>allow_fail</option> options
54438 for the <command>redirect</command> router.) These commands can optionally be followed by the
54439 word <option>text</option> and a string containing an error message, for example:
54440 </para>
54441 <literallayout class="monospaced">
54442 fail text "this message looks like spam to me"
54443 </literallayout>
54444 <para>
54445 The keyword <option>text</option> is optional if the next character is a double quote.
54446 </para>
54447 <para>
54448 The <option>defer</option> command defers delivery of the original recipients of the
54449 message. The <option>fail</option> command causes all the original recipients to be failed,
54450 and a bounce message to be created. The <option>freeze</option> command suspends all
54451 delivery attempts for the original recipients. In all cases, any new deliveries
54452 that are specified by the filter are attempted as normal after the filter has
54453 run.
54454 </para>
54455 <para>
54456 The <option>freeze</option> command is ignored if the message has been manually unfrozen and
54457 not manually frozen since. This means that automatic freezing by a system
54458 filter can be used as a way of checking out suspicious messages. If a message
54459 is found to be all right, manually unfreezing it allows it to be delivered.
54460 </para>
54461 <para>
54462 <indexterm role="concept">
54463 <primary>log</primary>
54464 <secondary><option>fail</option> command log line</secondary>
54465 </indexterm>
54466 <indexterm role="concept">
54467 <primary><option>fail</option></primary>
54468 <secondary>log line; reducing</secondary>
54469 </indexterm>
54470 The text given with a fail command is used as part of the bounce message as
54471 well as being written to the log. If the message is quite long, this can fill
54472 up a lot of log space when such failures are common. To reduce the size of the
54473 log message, Exim interprets the text in a special way if it starts with the
54474 two characters <literal>&lt;&lt;</literal> and contains <literal>&gt;&gt;</literal> later. The text between these two
54475 strings is written to the log, and the rest of the text is used in the bounce
54476 message. For example:
54477 </para>
54478 <literallayout class="monospaced">
54479 fail "&lt;&lt;filter test 1&gt;&gt;Your message is rejected \
54480      because it contains attachments that we are \
54481      not prepared to receive."
54482 </literallayout>
54483 <para>
54484 <indexterm role="concept">
54485 <primary>loop</primary>
54486 <secondary>caused by <option>fail</option></secondary>
54487 </indexterm>
54488 Take great care with the <option>fail</option> command when basing the decision to fail on
54489 the contents of the message, because the bounce message will of course include
54490 the contents of the original message and will therefore trigger the <option>fail</option>
54491 command again (causing a mail loop) unless steps are taken to prevent this.
54492 Testing the <option>error_message</option> condition is one way to prevent this. You could
54493 use, for example
54494 </para>
54495 <literallayout class="monospaced">
54496 if $message_body contains "this is spam" and not error_message
54497 then fail text "spam is not wanted here" endif
54498 </literallayout>
54499 <para>
54500 though of course that might let through unwanted bounce messages. The
54501 alternative is clever checking of the body and/or headers to detect bounces
54502 generated by the filter.
54503 </para>
54504 <para>
54505 The interpretation of a system filter file ceases after a
54506 <option>defer</option>,
54507 <option>freeze</option>, or <option>fail</option> command is obeyed. However, any deliveries that were
54508 set up earlier in the filter file are honoured, so you can use a sequence such
54509 as
54510 </para>
54511 <literallayout class="monospaced">
54512 mail ...
54513 freeze
54514 </literallayout>
54515 <para>
54516 to send a specified message when the system filter is freezing (or deferring or
54517 failing) a message. The normal deliveries for the message do not, of course,
54518 take place.
54519 </para>
54520 </section>
54521 <section id="SECTaddremheasys">
54522 <title>Adding and removing headers in a system filter</title>
54523 <para>
54524 <indexterm role="concept">
54525 <primary>header lines</primary>
54526 <secondary>adding; in system filter</secondary>
54527 </indexterm>
54528 <indexterm role="concept">
54529 <primary>header lines</primary>
54530 <secondary>removing; in system filter</secondary>
54531 </indexterm>
54532 <indexterm role="concept">
54533 <primary>filter</primary>
54534 <secondary>header lines; adding/removing</secondary>
54535 </indexterm>
54536 Two filter commands that are available only in system filters are:
54537 </para>
54538 <literallayout class="monospaced">
54539 headers add &lt;string&gt;
54540 headers remove &lt;string&gt;
54541 </literallayout>
54542 <para>
54543 The argument for the <option>headers add</option> is a string that is expanded and then
54544 added to the end of the message&#x2019;s headers. It is the responsibility of the
54545 filter maintainer to make sure it conforms to RFC 2822 syntax. Leading white
54546 space is ignored, and if the string is otherwise empty, or if the expansion is
54547 forced to fail, the command has no effect.
54548 </para>
54549 <para>
54550 You can use <quote>\n</quote> within the string, followed by white space, to specify
54551 continued header lines. More than one header may be added in one command by
54552 including <quote>\n</quote> within the string without any following white space. For
54553 example:
54554 </para>
54555 <literallayout class="monospaced">
54556 headers add "X-header-1: ....\n  \
54557              continuation of X-header-1 ...\n\
54558              X-header-2: ...."
54559 </literallayout>
54560 <para>
54561 Note that the header line continuation white space after the first newline must
54562 be placed before the backslash that continues the input string, because white
54563 space after input continuations is ignored.
54564 </para>
54565 <para>
54566 The argument for <option>headers remove</option> is a colon-separated list of header names.
54567 This command applies only to those headers that are stored with the message;
54568 those that are added at delivery time (such as <emphasis>Envelope-To:</emphasis> and
54569 <emphasis>Return-Path:</emphasis>) cannot be removed by this means. If there is more than one
54570 header with the same name, they are all removed.
54571 </para>
54572 <para>
54573 The <option>headers</option> command in a system filter makes an immediate change to the set
54574 of header lines that was received with the message (with possible additions
54575 from ACL processing). Subsequent commands in the system filter operate on the
54576 modified set, which also forms the basis for subsequent message delivery.
54577 Unless further modified during routing or transporting, this set of headers is
54578 used for all recipients of the message.
54579 </para>
54580 <para>
54581 During routing and transporting, the variables that refer to the contents of
54582 header lines refer only to those lines that are in this set. Thus, header lines
54583 that are added by a system filter are visible to users&#x2019; filter files and to all
54584 routers and transports. This contrasts with the manipulation of header lines by
54585 routers and transports, which is not immediate, but which instead is saved up
54586 until the message is actually being written (see section
54587 <xref linkend="SECTheadersaddrem"/>).
54588 </para>
54589 <para>
54590 If the message is not delivered at the first attempt, header lines that were
54591 added by the system filter are stored with the message, and so are still
54592 present at the next delivery attempt. Header lines that were removed are still
54593 present, but marked <quote>deleted</quote> so that they are not transported with the
54594 message. For this reason, it is usual to make the <option>headers</option> command
54595 conditional on <option>first_delivery</option> so that the set of header lines is not
54596 modified more than once.
54597 </para>
54598 <para>
54599 Because header modification in a system filter acts immediately, you have to
54600 use an indirect approach if you want to modify the contents of a header line.
54601 For example:
54602 </para>
54603 <literallayout class="monospaced">
54604 headers add "Old-Subject: $h_subject:"
54605 headers remove "Subject"
54606 headers add "Subject: new subject (was: $h_old-subject:)"
54607 headers remove "Old-Subject"
54608 </literallayout>
54609 </section>
54610 <section id="SECID217">
54611 <title>Setting an errors address in a system filter</title>
54612 <para>
54613 <indexterm role="concept">
54614 <primary>envelope sender</primary>
54615 </indexterm>
54616 In a system filter, if a <option>deliver</option> command is followed by
54617 </para>
54618 <literallayout class="monospaced">
54619 errors_to &lt;some address&gt;
54620 </literallayout>
54621 <para>
54622 in order to change the envelope sender (and hence the error reporting) for that
54623 delivery, any address may be specified. (In a user filter, only the current
54624 user&#x2019;s address can be set.) For example, if some mail is being monitored, you
54625 might use
54626 </para>
54627 <literallayout class="monospaced">
54628 unseen deliver monitor@spying.example errors_to root@local.example
54629 </literallayout>
54630 <para>
54631 to take a copy which would not be sent back to the normal error reporting
54632 address if its delivery failed.
54633 </para>
54634 </section>
54635 <section id="SECTperaddfil">
54636 <title>Per-address filtering</title>
54637 <para>
54638 <indexterm role="variable">
54639 <primary><varname>$domain</varname></primary>
54640 </indexterm>
54641 <indexterm role="variable">
54642 <primary><varname>$local_part</varname></primary>
54643 </indexterm>
54644 In contrast to the system filter, which is run just once per message for each
54645 delivery attempt, it is also possible to set up a system-wide filtering
54646 operation that runs once for each recipient address. In this case, variables
54647 such as <varname>$local_part</varname> and <varname>$domain</varname> can be used, and indeed, the choice of
54648 filter file could be made dependent on them. This is an example of a router
54649 which implements such a filter:
54650 </para>
54651 <literallayout class="monospaced">
54652 central_filter:
54653   check_local_user
54654   driver = redirect
54655   domains = +local_domains
54656   file = /central/filters/$local_part
54657   no_verify
54658   allow_filter
54659   allow_freeze
54660 </literallayout>
54661 <para>
54662 The filter is run in a separate process under its own uid. Therefore, either
54663 <option>check_local_user</option> must be set (as above), in which case the filter is run as
54664 the local user, or the <option>user</option> option must be used to specify which user to
54665 use. If both are set, <option>user</option> overrides.
54666 </para>
54667 <para>
54668 Care should be taken to ensure that none of the commands in the filter file
54669 specify a significant delivery if the message is to go on to be delivered to
54670 its intended recipient. The router will not then claim to have dealt with the
54671 address, so it will be passed on to subsequent routers to be delivered in the
54672 normal way.
54673 <indexterm role="concept" startref="IIDsysfil1" class="endofrange"/>
54674 <indexterm role="concept" startref="IIDsysfil2" class="endofrange"/>
54675 <indexterm role="concept" startref="IIDsysfil3" class="endofrange"/>
54676 </para>
54677 </section>
54678 </chapter>
54679
54680 <chapter id="CHAPmsgproc">
54681 <title>Message processing</title>
54682 <para>
54683 <indexterm role="concept" id="IIDmesproc" class="startofrange">
54684 <primary>message</primary>
54685 <secondary>general processing</secondary>
54686 </indexterm>
54687 Exim performs various transformations on the sender and recipient addresses of
54688 all messages that it handles, and also on the messages&#x2019; header lines. Some of
54689 these are optional and configurable, while others always take place. All of
54690 this processing, except rewriting as a result of routing, and the addition or
54691 removal of header lines while delivering, happens when a message is received,
54692 before it is placed on Exim&#x2019;s queue.
54693 </para>
54694 <para>
54695 Some of the automatic processing takes place by default only for
54696 <quote>locally-originated</quote> messages. This adjective is used to describe messages
54697 that are not received over TCP/IP, but instead are passed to an Exim process on
54698 its standard input. This includes the interactive <quote>local SMTP</quote> case that is
54699 set up by the <option>-bs</option> command line option.
54700 </para>
54701 <para>
54702 <emphasis role="bold">Note</emphasis>: Messages received over TCP/IP on the loopback interface (127.0.0.1
54703 or ::1) are not considered to be locally-originated. Exim does not treat the
54704 loopback interface specially in any way.
54705 </para>
54706 <para>
54707 If you want the loopback interface to be treated specially, you must ensure
54708 that there are appropriate entries in your ACLs.
54709 </para>
54710 <section id="SECTsubmodnon">
54711 <title>Submission mode for non-local messages</title>
54712 <para>
54713 <indexterm role="concept">
54714 <primary>message</primary>
54715 <secondary>submission</secondary>
54716 </indexterm>
54717 <indexterm role="concept">
54718 <primary>submission mode</primary>
54719 </indexterm>
54720 Processing that happens automatically for locally-originated messages (unless
54721 <option>suppress_local_fixups</option> is set) can also be requested for messages that are
54722 received over TCP/IP. The term <quote>submission mode</quote> is used to describe this
54723 state. Submission mode is set by the modifier
54724 </para>
54725 <literallayout class="monospaced">
54726 control = submission
54727 </literallayout>
54728 <para>
54729 in a MAIL, RCPT, or pre-data ACL for an incoming message (see sections
54730 <xref linkend="SECTACLmodi"/> and <xref linkend="SECTcontrols"/>). This makes Exim treat the message as
54731 a local submission, and is normally used when the source of the message is
54732 known to be an MUA running on a client host (as opposed to an MTA). For
54733 example, to set submission mode for messages originating on the IPv4 loopback
54734 interface, you could include the following in the MAIL ACL:
54735 </para>
54736 <literallayout class="monospaced">
54737 warn  hosts = 127.0.0.1
54738       control = submission
54739 </literallayout>
54740 <para>
54741 <indexterm role="concept">
54742 <primary><option>sender_retain</option> submission option</primary>
54743 </indexterm>
54744 There are some options that can be used when setting submission mode. A slash
54745 is used to separate options. For example:
54746 </para>
54747 <literallayout class="monospaced">
54748 control = submission/sender_retain
54749 </literallayout>
54750 <para>
54751 Specifying <option>sender_retain</option> has the effect of setting <option>local_sender_retain</option>
54752 true and <option>local_from_check</option> false for the current incoming message. The first
54753 of these allows an existing <emphasis>Sender:</emphasis> header in the message to remain, and
54754 the second suppresses the check to ensure that <emphasis>From:</emphasis> matches the
54755 authenticated sender. With this setting, Exim still fixes up messages by adding
54756 <emphasis>Date:</emphasis> and <emphasis>Message-ID:</emphasis> header lines if they are missing, but makes no
54757 attempt to check sender authenticity in header lines.
54758 </para>
54759 <para>
54760 When <option>sender_retain</option> is not set, a submission mode setting may specify a
54761 domain to be used when generating a <emphasis>From:</emphasis> or <emphasis>Sender:</emphasis> header line. For
54762 example:
54763 </para>
54764 <literallayout class="monospaced">
54765 control = submission/domain=some.domain
54766 </literallayout>
54767 <para>
54768 The domain may be empty. How this value is used is described in sections
54769 <xref linkend="SECTthefrohea"/> and <xref linkend="SECTthesenhea"/>. There is also a <option>name</option> option
54770 that allows you to specify the user&#x2019;s full name for inclusion in a created
54771 <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis> header line. For example:
54772 </para>
54773 <literallayout class="monospaced">
54774 accept authenticated = *
54775        control = submission/domain=wonderland.example/\
54776                             name=${lookup {$authenticated_id} \
54777                                    lsearch {/etc/exim/namelist}}
54778 </literallayout>
54779 <para>
54780 Because the name may contain any characters, including slashes, the <option>name</option>
54781 option must be given last. The remainder of the string is used as the name. For
54782 the example above, if <filename>/etc/exim/namelist</filename> contains:
54783 </para>
54784 <literallayout class="monospaced">
54785 bigegg:  Humpty Dumpty
54786 </literallayout>
54787 <para>
54788 then when the sender has authenticated as <emphasis>bigegg</emphasis>, the generated <emphasis>Sender:</emphasis>
54789 line would be:
54790 </para>
54791 <literallayout class="monospaced">
54792 Sender: Humpty Dumpty &lt;bigegg@wonderland.example&gt;
54793 </literallayout>
54794 <para>
54795 <indexterm role="concept">
54796 <primary>return path</primary>
54797 <secondary>in submission mode</secondary>
54798 </indexterm>
54799 By default, submission mode forces the return path to the same address as is
54800 used to create the <emphasis>Sender:</emphasis> header. However, if <option>sender_retain</option> is
54801 specified, the return path is also left unchanged.
54802 </para>
54803 <para>
54804 <emphasis role="bold">Note</emphasis>: The changes caused by submission mode take effect after the predata
54805 ACL. This means that any sender checks performed before the fix-ups use the
54806 untrusted sender address specified by the user, not the trusted sender address
54807 specified by submission mode. Although this might be slightly unexpected, it
54808 does mean that you can configure ACL checks to spot that a user is trying to
54809 spoof another&#x2019;s address.
54810 </para>
54811 </section>
54812 <section id="SECTlineendings">
54813 <title>Line endings</title>
54814 <para>
54815 <indexterm role="concept">
54816 <primary>line endings</primary>
54817 </indexterm>
54818 <indexterm role="concept">
54819 <primary>carriage return</primary>
54820 </indexterm>
54821 <indexterm role="concept">
54822 <primary>linefeed</primary>
54823 </indexterm>
54824 RFC 2821 specifies that CRLF (two characters: carriage-return, followed by
54825 linefeed) is the line ending for messages transmitted over the Internet using
54826 SMTP over TCP/IP. However, within individual operating systems, different
54827 conventions are used. For example, Unix-like systems use just LF, but others
54828 use CRLF or just CR.
54829 </para>
54830 <para>
54831 Exim was designed for Unix-like systems, and internally, it stores messages
54832 using the system&#x2019;s convention of a single LF as a line terminator. When
54833 receiving a message, all line endings are translated to this standard format.
54834 Originally, it was thought that programs that passed messages directly to an
54835 MTA within an operating system would use that system&#x2019;s convention. Experience
54836 has shown that this is not the case; for example, there are Unix applications
54837 that use CRLF in this circumstance. For this reason, and for compatibility with
54838 other MTAs, the way Exim handles line endings for all messages is now as
54839 follows:
54840 </para>
54841 <itemizedlist>
54842 <listitem>
54843 <para>
54844 LF not preceded by CR is treated as a line ending.
54845 </para>
54846 </listitem>
54847 <listitem>
54848 <para>
54849 CR is treated as a line ending; if it is immediately followed by LF, the LF
54850 is ignored.
54851 </para>
54852 </listitem>
54853 <listitem>
54854 <para>
54855 The sequence <quote>CR, dot, CR</quote> does not terminate an incoming SMTP message,
54856 nor a local message in the state where a line containing only a dot is a
54857 terminator.
54858 </para>
54859 </listitem>
54860 <listitem>
54861 <para>
54862 If a bare CR is encountered within a header line, an extra space is added after
54863 the line terminator so as not to end the header line. The reasoning behind this
54864 is that bare CRs in header lines are most likely either to be mistakes, or
54865 people trying to play silly games.
54866 </para>
54867 </listitem>
54868 <listitem>
54869 <para>
54870 If the first header line received in a message ends with CRLF, a subsequent
54871 bare LF in a header line is treated in the same way as a bare CR in a header
54872 line.
54873 </para>
54874 </listitem>
54875 </itemizedlist>
54876 </section>
54877 <section id="SECID218">
54878 <title>Unqualified addresses</title>
54879 <para>
54880 <indexterm role="concept">
54881 <primary>unqualified addresses</primary>
54882 </indexterm>
54883 <indexterm role="concept">
54884 <primary>address</primary>
54885 <secondary>qualification</secondary>
54886 </indexterm>
54887 By default, Exim expects every envelope address it receives from an external
54888 host to be fully qualified. Unqualified addresses cause negative responses to
54889 SMTP commands. However, because SMTP is used as a means of transporting
54890 messages from MUAs running on personal workstations, there is sometimes a
54891 requirement to accept unqualified addresses from specific hosts or IP networks.
54892 </para>
54893 <para>
54894 Exim has two options that separately control which hosts may send unqualified
54895 sender or recipient addresses in SMTP commands, namely
54896 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>. In both
54897 cases, if an unqualified address is accepted, it is qualified by adding the
54898 value of <option>qualify_domain</option> or <option>qualify_recipient</option>, as appropriate.
54899 </para>
54900 <para>
54901 <indexterm role="option">
54902 <primary><option>qualify_domain</option></primary>
54903 </indexterm>
54904 <indexterm role="option">
54905 <primary><option>qualify_recipient</option></primary>
54906 </indexterm>
54907 Unqualified addresses in header lines are automatically qualified for messages
54908 that are locally originated, unless the <option>-bnq</option> option is given on the command
54909 line. For messages received over SMTP, unqualified addresses in header lines
54910 are qualified only if unqualified addresses are permitted in SMTP commands. In
54911 other words, such qualification is also controlled by
54912 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>,
54913 </para>
54914 </section>
54915 <section id="SECID219">
54916 <title>The UUCP From line</title>
54917 <para>
54918 <indexterm role="concept">
54919 <primary><quote>From</quote> line</primary>
54920 </indexterm>
54921 <indexterm role="concept">
54922 <primary>UUCP</primary>
54923 <secondary><quote>From</quote> line</secondary>
54924 </indexterm>
54925 <indexterm role="concept">
54926 <primary>sender</primary>
54927 <secondary>address</secondary>
54928 </indexterm>
54929 <indexterm role="option">
54930 <primary><option>uucp_from_pattern</option></primary>
54931 </indexterm>
54932 <indexterm role="option">
54933 <primary><option>uucp_from_sender</option></primary>
54934 </indexterm>
54935 <indexterm role="concept">
54936 <primary>envelope sender</primary>
54937 </indexterm>
54938 <indexterm role="concept">
54939 <primary>Sendmail compatibility</primary>
54940 <secondary><quote>From</quote> line</secondary>
54941 </indexterm>
54942 Messages that have come from UUCP (and some other applications) often begin
54943 with a line containing the envelope sender and a timestamp, following the word
54944 <quote>From</quote>. Examples of two common formats are:
54945 </para>
54946 <literallayout class="monospaced">
54947 From a.oakley@berlin.mus Fri Jan  5 12:35 GMT 1996
54948 From f.butler@berlin.mus Fri, 7 Jan 97 14:00:00 GMT
54949 </literallayout>
54950 <para>
54951 This line precedes the RFC 2822 header lines. For compatibility with Sendmail,
54952 Exim recognizes such lines at the start of messages that are submitted to it
54953 via the command line (that is, on the standard input). It does not recognize
54954 such lines in incoming SMTP messages, unless the sending host matches
54955 <option>ignore_fromline_hosts</option> or the <option>-bs</option> option was used for a local message
54956 and <option>ignore_fromline_local</option> is set. The recognition is controlled by a
54957 regular expression that is defined by the <option>uucp_from_pattern</option> option, whose
54958 default value matches the two common cases shown above and puts the address
54959 that follows <quote>From</quote> into <varname>$1</varname>.
54960 </para>
54961 <para>
54962 <indexterm role="concept">
54963 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
54964 <secondary>in <quote>From </quote> line handling</secondary>
54965 </indexterm>
54966 When the caller of Exim for a non-SMTP message that contains a <quote>From</quote> line is
54967 a trusted user, the message&#x2019;s sender address is constructed by expanding the
54968 contents of <option>uucp_sender_address</option>, whose default value is <quote>$1</quote>. This is
54969 then parsed as an RFC 2822 address. If there is no domain, the local part is
54970 qualified with <option>qualify_domain</option> unless it is the empty string. However, if
54971 the command line <option>-f</option> option is used, it overrides the <quote>From</quote> line.
54972 </para>
54973 <para>
54974 If the caller of Exim is not trusted, the <quote>From</quote> line is recognized, but the
54975 sender address is not changed. This is also the case for incoming SMTP messages
54976 that are permitted to contain <quote>From</quote> lines.
54977 </para>
54978 <para>
54979 Only one <quote>From</quote> line is recognized. If there is more than one, the second is
54980 treated as a data line that starts the body of the message, as it is not valid
54981 as a header line. This also happens if a <quote>From</quote> line is present in an
54982 incoming SMTP message from a source that is not permitted to send them.
54983 </para>
54984 </section>
54985 <section id="SECID220">
54986 <title>Resent- header lines</title>
54987 <para>
54988 <indexterm role="concept">
54989 <primary><option>Resent-</option> header lines</primary>
54990 </indexterm>
54991 RFC 2822 makes provision for sets of header lines starting with the string
54992 <literal>Resent-</literal> to be added to a message when it is resent by the original
54993 recipient to somebody else. These headers are <emphasis>Resent-Date:</emphasis>,
54994 <emphasis>Resent-From:</emphasis>, <emphasis>Resent-Sender:</emphasis>, <emphasis>Resent-To:</emphasis>, <emphasis>Resent-Cc:</emphasis>,
54995 <emphasis>Resent-Bcc:</emphasis> and <emphasis>Resent-Message-ID:</emphasis>. The RFC says:
54996 </para>
54997 <blockquote>
54998 <para>
54999 <emphasis>Resent fields are strictly informational. They MUST NOT be used in the normal
55000 processing of replies or other such automatic actions on messages.</emphasis>
55001 </para>
55002 </blockquote>
55003 <para>
55004 This leaves things a bit vague as far as other processing actions such as
55005 address rewriting are concerned. Exim treats <option>Resent-</option> header lines as
55006 follows:
55007 </para>
55008 <itemizedlist>
55009 <listitem>
55010 <para>
55011 A <emphasis>Resent-From:</emphasis> line that just contains the login id of the submitting user
55012 is automatically rewritten in the same way as <emphasis>From:</emphasis> (see below).
55013 </para>
55014 </listitem>
55015 <listitem>
55016 <para>
55017 If there&#x2019;s a rewriting rule for a particular header line, it is also applied to
55018 <option>Resent-</option> header lines of the same type. For example, a rule that rewrites
55019 <emphasis>From:</emphasis> also rewrites <emphasis>Resent-From:</emphasis>.
55020 </para>
55021 </listitem>
55022 <listitem>
55023 <para>
55024 For local messages, if <emphasis>Sender:</emphasis> is removed on input, <emphasis>Resent-Sender:</emphasis> is
55025 also removed.
55026 </para>
55027 </listitem>
55028 <listitem>
55029 <para>
55030 For a locally-submitted message,
55031 if there are any <option>Resent-</option> header lines but no <emphasis>Resent-Date:</emphasis>,
55032 <emphasis>Resent-From:</emphasis>, or <emphasis>Resent-Message-Id:</emphasis>, they are added as necessary. It is
55033 the contents of <emphasis>Resent-Message-Id:</emphasis> (rather than <emphasis>Message-Id:</emphasis>) which are
55034 included in log lines in this case.
55035 </para>
55036 </listitem>
55037 <listitem>
55038 <para>
55039 The logic for adding <emphasis>Sender:</emphasis> is duplicated for <emphasis>Resent-Sender:</emphasis> when any
55040 <option>Resent-</option> header lines are present.
55041 </para>
55042 </listitem>
55043 </itemizedlist>
55044 </section>
55045 <section id="SECID221">
55046 <title>The Auto-Submitted: header line</title>
55047 <para>
55048 Whenever Exim generates an autoreply, a bounce, or a delay warning message, it
55049 includes the header line:
55050 </para>
55051 <literallayout class="monospaced">
55052 Auto-Submitted: auto-replied
55053 </literallayout>
55054 </section>
55055 <section id="SECID222">
55056 <title>The Bcc: header line</title>
55057 <para>
55058 <indexterm role="concept">
55059 <primary><emphasis>Bcc:</emphasis> header line</primary>
55060 </indexterm>
55061 If Exim is called with the <option>-t</option> option, to take recipient addresses from a
55062 message&#x2019;s header, it removes any <emphasis>Bcc:</emphasis> header line that may exist (after
55063 extracting its addresses). If <option>-t</option> is not present on the command line, any
55064 existing <emphasis>Bcc:</emphasis> is not removed.
55065 </para>
55066 </section>
55067 <section id="SECID223">
55068 <title>The Date: header line</title>
55069 <para>
55070 <indexterm role="concept">
55071 <primary><emphasis>Date:</emphasis> header line</primary>
55072 </indexterm>
55073 If a locally-generated or submission-mode message has no <emphasis>Date:</emphasis> header line,
55074 Exim adds one, using the current date and time, unless the
55075 <option>suppress_local_fixups</option> control has been specified.
55076 </para>
55077 </section>
55078 <section id="SECID224">
55079 <title>The Delivery-date: header line</title>
55080 <para>
55081 <indexterm role="concept">
55082 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
55083 </indexterm>
55084 <indexterm role="option">
55085 <primary><option>delivery_date_remove</option></primary>
55086 </indexterm>
55087 <emphasis>Delivery-date:</emphasis> header lines are not part of the standard RFC 2822 header
55088 set. Exim can be configured to add them to the final delivery of messages. (See
55089 the generic <option>delivery_date_add</option> transport option.) They should not be present
55090 in messages in transit. If the <option>delivery_date_remove</option> configuration option is
55091 set (the default), Exim removes <emphasis>Delivery-date:</emphasis> header lines from incoming
55092 messages.
55093 </para>
55094 </section>
55095 <section id="SECID225">
55096 <title>The Envelope-to: header line</title>
55097 <para>
55098 <indexterm role="concept">
55099 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
55100 </indexterm>
55101 <indexterm role="option">
55102 <primary><option>envelope_to_remove</option></primary>
55103 </indexterm>
55104 <emphasis>Envelope-to:</emphasis> header lines are not part of the standard RFC 2822 header set.
55105 Exim can be configured to add them to the final delivery of messages. (See the
55106 generic <option>envelope_to_add</option> transport option.) They should not be present in
55107 messages in transit. If the <option>envelope_to_remove</option> configuration option is set
55108 (the default), Exim removes <emphasis>Envelope-to:</emphasis> header lines from incoming
55109 messages.
55110 </para>
55111 </section>
55112 <section id="SECTthefrohea">
55113 <title>The From: header line</title>
55114 <para>
55115 <indexterm role="concept">
55116 <primary><emphasis>From:</emphasis> header line</primary>
55117 </indexterm>
55118 <indexterm role="concept">
55119 <primary>Sendmail compatibility</primary>
55120 <secondary><quote>From</quote> line</secondary>
55121 </indexterm>
55122 <indexterm role="concept">
55123 <primary>message</primary>
55124 <secondary>submission</secondary>
55125 </indexterm>
55126 <indexterm role="concept">
55127 <primary>submission mode</primary>
55128 </indexterm>
55129 If a submission-mode message does not contain a <emphasis>From:</emphasis> header line, Exim
55130 adds one if either of the following conditions is true:
55131 </para>
55132 <itemizedlist>
55133 <listitem>
55134 <para>
55135 The envelope sender address is not empty (that is, this is not a bounce
55136 message). The added header line copies the envelope sender address.
55137 </para>
55138 </listitem>
55139 <listitem>
55140 <para>
55141 <indexterm role="variable">
55142 <primary><varname>$authenticated_id</varname></primary>
55143 </indexterm>
55144 The SMTP session is authenticated and <varname>$authenticated_id</varname> is not empty.
55145 </para>
55146 <orderedlist numeration="arabic">
55147 <listitem>
55148 <para>
55149 <indexterm role="variable">
55150 <primary><varname>$qualify_domain</varname></primary>
55151 </indexterm>
55152 If no domain is specified by the submission control, the local part is
55153 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
55154 </para>
55155 </listitem>
55156 <listitem>
55157 <para>
55158 If a non-empty domain is specified by the submission control, the local
55159 part is <varname>$authenticated_id</varname>, and the domain is the specified domain.
55160 </para>
55161 </listitem>
55162 <listitem>
55163 <para>
55164 If an empty domain is specified by the submission control,
55165 <varname>$authenticated_id</varname> is assumed to be the complete address.
55166 </para>
55167 </listitem>
55168 </orderedlist>
55169 </listitem>
55170 </itemizedlist>
55171 <para>
55172 A non-empty envelope sender takes precedence.
55173 </para>
55174 <para>
55175 If a locally-generated incoming message does not contain a <emphasis>From:</emphasis> header
55176 line, and the <option>suppress_local_fixups</option> control is not set, Exim adds one
55177 containing the sender&#x2019;s address. The calling user&#x2019;s login name and full name
55178 are used to construct the address, as described in section <xref linkend="SECTconstr"/>.
55179 They are obtained from the password data by calling <function>getpwuid()</function> (but see the
55180 <option>unknown_login</option> configuration option). The address is qualified with
55181 <option>qualify_domain</option>.
55182 </para>
55183 <para>
55184 For compatibility with Sendmail, if an incoming, non-SMTP message has a
55185 <emphasis>From:</emphasis> header line containing just the unqualified login name of the calling
55186 user, this is replaced by an address containing the user&#x2019;s login name and full
55187 name as described in section <xref linkend="SECTconstr"/>.
55188 </para>
55189 </section>
55190 <section id="SECID226">
55191 <title>The Message-ID: header line</title>
55192 <para>
55193 <indexterm role="concept">
55194 <primary><emphasis>Message-ID:</emphasis> header line</primary>
55195 </indexterm>
55196 <indexterm role="concept">
55197 <primary>message</primary>
55198 <secondary>submission</secondary>
55199 </indexterm>
55200 <indexterm role="option">
55201 <primary><option>message_id_header_text</option></primary>
55202 </indexterm>
55203 If a locally-generated or submission-mode incoming message does not contain a
55204 <emphasis>Message-ID:</emphasis> or <emphasis>Resent-Message-ID:</emphasis> header line, and the
55205 <option>suppress_local_fixups</option> control is not set, Exim adds a suitable header line
55206 to the message. If there are any <emphasis>Resent-:</emphasis> headers in the message, it
55207 creates <emphasis>Resent-Message-ID:</emphasis>. The id is constructed from Exim&#x2019;s internal
55208 message id, preceded by the letter E to ensure it starts with a letter, and
55209 followed by @ and the primary host name. Additional information can be included
55210 in this header line by setting the <option>message_id_header_text</option> and/or
55211 <option>message_id_header_domain</option> options.
55212 </para>
55213 </section>
55214 <section id="SECID227">
55215 <title>The Received: header line</title>
55216 <para>
55217 <indexterm role="concept">
55218 <primary><emphasis>Received:</emphasis> header line</primary>
55219 </indexterm>
55220 A <emphasis>Received:</emphasis> header line is added at the start of every message. The
55221 contents are defined by the <option>received_header_text</option> configuration option, and
55222 Exim automatically adds a semicolon and a timestamp to the configured string.
55223 </para>
55224 <para>
55225 The <emphasis>Received:</emphasis> header is generated as soon as the message&#x2019;s header lines
55226 have been received. At this stage, the timestamp in the <emphasis>Received:</emphasis> header
55227 line is the time that the message started to be received. This is the value
55228 that is seen by the DATA ACL and by the <function>local_scan()</function> function.
55229 </para>
55230 <para>
55231 Once a message is accepted, the timestamp in the <emphasis>Received:</emphasis> header line is
55232 changed to the time of acceptance, which is (apart from a small delay while the
55233 -H spool file is written) the earliest time at which delivery could start.
55234 </para>
55235 </section>
55236 <section id="SECID228">
55237 <title>The References: header line</title>
55238 <para>
55239 <indexterm role="concept">
55240 <primary><emphasis>References:</emphasis> header line</primary>
55241 </indexterm>
55242 Messages created by the <command>autoreply</command> transport include a <emphasis>References:</emphasis>
55243 header line. This is constructed according to the rules that are described in
55244 section 3.64 of RFC 2822 (which states that replies should contain such a
55245 header line), and section 3.14 of RFC 3834 (which states that automatic
55246 responses are not different in this respect). However, because some mail
55247 processing software does not cope well with very long header lines, no more
55248 than 12 message IDs are copied from the <emphasis>References:</emphasis> header line in the
55249 incoming message. If there are more than 12, the first one and then the final
55250 11 are copied, before adding the message ID of the incoming message.
55251 </para>
55252 </section>
55253 <section id="SECID229">
55254 <title>The Return-path: header line</title>
55255 <para>
55256 <indexterm role="concept">
55257 <primary><emphasis>Return-path:</emphasis> header line</primary>
55258 </indexterm>
55259 <indexterm role="option">
55260 <primary><option>return_path_remove</option></primary>
55261 </indexterm>
55262 <emphasis>Return-path:</emphasis> header lines are defined as something an MTA may insert when
55263 it does the final delivery of messages. (See the generic <option>return_path_add</option>
55264 transport option.) Therefore, they should not be present in messages in
55265 transit. If the <option>return_path_remove</option> configuration option is set (the
55266 default), Exim removes <emphasis>Return-path:</emphasis> header lines from incoming messages.
55267 </para>
55268 </section>
55269 <section id="SECTthesenhea">
55270 <title>The Sender: header line</title>
55271 <para>
55272 <indexterm role="concept">
55273 <primary><emphasis>Sender:</emphasis> header line</primary>
55274 </indexterm>
55275 <indexterm role="concept">
55276 <primary>message</primary>
55277 <secondary>submission</secondary>
55278 </indexterm>
55279 For a locally-originated message from an untrusted user, Exim may remove an
55280 existing <emphasis>Sender:</emphasis> header line, and it may add a new one. You can modify
55281 these actions by setting the <option>local_sender_retain</option> option true, the
55282 <option>local_from_check</option> option false, or by using the <option>suppress_local_fixups</option>
55283 control setting.
55284 </para>
55285 <para>
55286 When a local message is received from an untrusted user and
55287 <option>local_from_check</option> is true (the default), and the <option>suppress_local_fixups</option>
55288 control has not been set, a check is made to see if the address given in the
55289 <emphasis>From:</emphasis> header line is the correct (local) sender of the message. The address
55290 that is expected has the login name as the local part and the value of
55291 <option>qualify_domain</option> as the domain. Prefixes and suffixes for the local part can
55292 be permitted by setting <option>local_from_prefix</option> and <option>local_from_suffix</option>
55293 appropriately. If <emphasis>From:</emphasis> does not contain the correct sender, a <emphasis>Sender:</emphasis>
55294 line is added to the message.
55295 </para>
55296 <para>
55297 If you set <option>local_from_check</option> false, this checking does not occur. However,
55298 the removal of an existing <emphasis>Sender:</emphasis> line still happens, unless you also set
55299 <option>local_sender_retain</option> to be true. It is not possible to set both of these
55300 options true at the same time.
55301 </para>
55302 <para>
55303 <indexterm role="concept">
55304 <primary>submission mode</primary>
55305 </indexterm>
55306 By default, no processing of <emphasis>Sender:</emphasis> header lines is done for messages
55307 received over TCP/IP or for messages submitted by trusted users. However, when
55308 a message is received over TCP/IP in submission mode, and <option>sender_retain</option> is
55309 not specified on the submission control, the following processing takes place:
55310 </para>
55311 <para>
55312 <indexterm role="variable">
55313 <primary><varname>$authenticated_id</varname></primary>
55314 </indexterm>
55315 First, any existing <emphasis>Sender:</emphasis> lines are removed. Then, if the SMTP session is
55316 authenticated, and <varname>$authenticated_id</varname> is not empty, a sender address is
55317 created as follows:
55318 </para>
55319 <itemizedlist>
55320 <listitem>
55321 <para>
55322 <indexterm role="variable">
55323 <primary><varname>$qualify_domain</varname></primary>
55324 </indexterm>
55325 If no domain is specified by the submission control, the local part is
55326 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
55327 </para>
55328 </listitem>
55329 <listitem>
55330 <para>
55331 If a non-empty domain is specified by the submission control, the local part
55332 is <varname>$authenticated_id</varname>, and the domain is the specified domain.
55333 </para>
55334 </listitem>
55335 <listitem>
55336 <para>
55337 If an empty domain is specified by the submission control,
55338 <varname>$authenticated_id</varname> is assumed to be the complete address.
55339 </para>
55340 </listitem>
55341 </itemizedlist>
55342 <para>
55343 This address is compared with the address in the <emphasis>From:</emphasis> header line. If they
55344 are different, a <emphasis>Sender:</emphasis> header line containing the created address is
55345 added. Prefixes and suffixes for the local part in <emphasis>From:</emphasis> can be permitted
55346 by setting <option>local_from_prefix</option> and <option>local_from_suffix</option> appropriately.
55347 </para>
55348 <para>
55349 <indexterm role="concept">
55350 <primary>return path</primary>
55351 <secondary>created from <emphasis>Sender:</emphasis></secondary>
55352 </indexterm>
55353 <emphasis role="bold">Note</emphasis>: Whenever a <emphasis>Sender:</emphasis> header line is created, the return path for
55354 the message (the envelope sender address) is changed to be the same address,
55355 except in the case of submission mode when <option>sender_retain</option> is specified.
55356 </para>
55357 </section>
55358 <section id="SECTheadersaddrem">
55359 <title>Adding and removing header lines in routers and transports</title>
55360 <para>
55361 <indexterm role="concept">
55362 <primary>header lines</primary>
55363 <secondary>adding; in router or transport</secondary>
55364 </indexterm>
55365 <indexterm role="concept">
55366 <primary>header lines</primary>
55367 <secondary>removing; in router or transport</secondary>
55368 </indexterm>
55369 When a message is delivered, the addition and removal of header lines can be
55370 specified in a system filter, or on any of the routers and transports that
55371 process the message. Section <xref linkend="SECTaddremheasys"/> contains details about
55372 modifying headers in a system filter. Header lines can also be added in an ACL
55373 as a message is received (see section <xref linkend="SECTaddheadacl"/>).
55374 </para>
55375 <para>
55376 In contrast to what happens in a system filter, header modifications that are
55377 specified on routers and transports apply only to the particular recipient
55378 addresses that are being processed by those routers and transports. These
55379 changes do not actually take place until a copy of the message is being
55380 transported. Therefore, they do not affect the basic set of header lines, and
55381 they do not affect the values of the variables that refer to header lines.
55382 </para>
55383 <para>
55384 <emphasis role="bold">Note</emphasis>: In particular, this means that any expansions in the configuration of
55385 the transport cannot refer to the modified header lines, because such
55386 expansions all occur before the message is actually transported.
55387 </para>
55388 <para>
55389 For both routers and transports, the result of expanding a <option>headers_add</option>
55390 option must be in the form of one or more RFC 2822 header lines, separated by
55391 newlines (coded as <quote>\n</quote>). For example:
55392 </para>
55393 <literallayout class="monospaced">
55394 headers_add = X-added-header: added by $primary_hostname\n\
55395               X-added-second: another added header line
55396 </literallayout>
55397 <para>
55398 Exim does not check the syntax of these added header lines.
55399 </para>
55400 <para>
55401 The result of expanding <option>headers_remove</option> must consist of a colon-separated
55402 list of header names. This is confusing, because header names themselves are
55403 often terminated by colons. In this case, the colons are the list separators,
55404 not part of the names. For example:
55405 </para>
55406 <literallayout class="monospaced">
55407 headers_remove = return-receipt-to:acknowledge-to
55408 </literallayout>
55409 <para>
55410 When <option>headers_add</option> or <option>headers_remove</option> is specified on a router, its value
55411 is expanded at routing time, and then associated with all addresses that are
55412 accepted by that router, and also with any new addresses that it generates. If
55413 an address passes through several routers as a result of aliasing or
55414 forwarding, the changes are cumulative.
55415 </para>
55416 <para>
55417 <indexterm role="option">
55418 <primary><option>unseen</option></primary>
55419 </indexterm>
55420 However, this does not apply to multiple routers that result from the use of
55421 the <option>unseen</option> option. Any header modifications that were specified by the
55422 <quote>unseen</quote> router or its predecessors apply only to the <quote>unseen</quote> delivery.
55423 </para>
55424 <para>
55425 Addresses that end up with different <option>headers_add</option> or <option>headers_remove</option>
55426 settings cannot be delivered together in a batch, so a transport is always
55427 dealing with a set of addresses that have the same header-processing
55428 requirements.
55429 </para>
55430 <para>
55431 The transport starts by writing the original set of header lines that arrived
55432 with the message, possibly modified by the system filter. As it writes out
55433 these lines, it consults the list of header names that were attached to the
55434 recipient address(es) by <option>headers_remove</option> options in routers, and it also
55435 consults the transport&#x2019;s own <option>headers_remove</option> option. Header lines whose
55436 names are on either of these lists are not written out. If there are multiple
55437 instances of any listed header, they are all skipped.
55438 </para>
55439 <para>
55440 After the remaining original header lines have been written, new header
55441 lines that were specified by routers&#x2019; <option>headers_add</option> options are written, in
55442 the order in which they were attached to the address. These are followed by any
55443 header lines specified by the transport&#x2019;s <option>headers_add</option> option.
55444 </para>
55445 <para>
55446 This way of handling header line modifications in routers and transports has
55447 the following consequences:
55448 </para>
55449 <itemizedlist>
55450 <listitem>
55451 <para>
55452 The original set of header lines, possibly modified by the system filter,
55453 remains <quote>visible</quote>, in the sense that the <varname>$header_</varname><emphasis>xxx</emphasis> variables refer
55454 to it, at all times.
55455 </para>
55456 </listitem>
55457 <listitem>
55458 <para>
55459 Header lines that are added by a router&#x2019;s
55460 <option>headers_add</option> option are not accessible by means of the <varname>$header_</varname><emphasis>xxx</emphasis>
55461 expansion syntax in subsequent routers or the transport.
55462 </para>
55463 </listitem>
55464 <listitem>
55465 <para>
55466 Conversely, header lines that are specified for removal by <option>headers_remove</option>
55467 in a router remain visible to subsequent routers and the transport.
55468 </para>
55469 </listitem>
55470 <listitem>
55471 <para>
55472 Headers added to an address by <option>headers_add</option> in a router cannot be removed by
55473 a later router or by a transport.
55474 </para>
55475 </listitem>
55476 <listitem>
55477 <para>
55478 An added header can refer to the contents of an original header that is to be
55479 removed, even it has the same name as the added header. For example:
55480 </para>
55481 <literallayout class="monospaced">
55482 headers_remove = subject
55483 headers_add = Subject: new subject (was: $h_subject:)
55484 </literallayout>
55485 </listitem>
55486 </itemizedlist>
55487 <para>
55488 <emphasis role="bold">Warning</emphasis>: The <option>headers_add</option> and <option>headers_remove</option> options cannot be used
55489 for a <command>redirect</command> router that has the <option>one_time</option> option set.
55490 </para>
55491 </section>
55492 <section id="SECTconstr">
55493 <title>Constructed addresses</title>
55494 <para>
55495 <indexterm role="concept">
55496 <primary>address</primary>
55497 <secondary>constructed</secondary>
55498 </indexterm>
55499 <indexterm role="concept">
55500 <primary>constructed address</primary>
55501 </indexterm>
55502 When Exim constructs a sender address for a locally-generated message, it uses
55503 the form
55504 </para>
55505 <literallayout>
55506 &lt;<emphasis>user name</emphasis>&gt;&nbsp;&nbsp;&lt;<emphasis>login</emphasis><literal>@</literal><emphasis>qualify_domain</emphasis>&gt;
55507 </literallayout>
55508 <para>
55509 For example:
55510 </para>
55511 <literallayout class="monospaced">
55512 Zaphod Beeblebrox &lt;zaphod@end.univ.example&gt;
55513 </literallayout>
55514 <para>
55515 The user name is obtained from the <option>-F</option> command line option if set, or
55516 otherwise by looking up the calling user by <function>getpwuid()</function> and extracting the
55517 <quote>gecos</quote> field from the password entry. If the <quote>gecos</quote> field contains an
55518 ampersand character, this is replaced by the login name with the first letter
55519 upper cased, as is conventional in a number of operating systems. See the
55520 <option>gecos_name</option> option for a way to tailor the handling of the <quote>gecos</quote> field.
55521 The <option>unknown_username</option> option can be used to specify user names in cases when
55522 there is no password file entry.
55523 </para>
55524 <para>
55525 <indexterm role="concept">
55526 <primary>RFC 2047</primary>
55527 </indexterm>
55528 In all cases, the user name is made to conform to RFC 2822 by quoting all or
55529 parts of it if necessary. In addition, if it contains any non-printing
55530 characters, it is encoded as described in RFC 2047, which defines a way of
55531 including non-ASCII characters in header lines. The value of the
55532 <option>headers_charset</option> option specifies the name of the encoding that is used (the
55533 characters are assumed to be in this encoding). The setting of
55534 <option>print_topbitchars</option> controls whether characters with the top bit set (that
55535 is, with codes greater than 127) count as printing characters or not.
55536 </para>
55537 </section>
55538 <section id="SECID230">
55539 <title>Case of local parts</title>
55540 <para>
55541 <indexterm role="concept">
55542 <primary>case of local parts</primary>
55543 </indexterm>
55544 <indexterm role="concept">
55545 <primary>local part</primary>
55546 <secondary>case of</secondary>
55547 </indexterm>
55548 RFC 2822 states that the case of letters in the local parts of addresses cannot
55549 be assumed to be non-significant. Exim preserves the case of local parts of
55550 addresses, but by default it uses a lower-cased form when it is routing,
55551 because on most Unix systems, usernames are in lower case and case-insensitive
55552 routing is required. However, any particular router can be made to use the
55553 original case for local parts by setting the <option>caseful_local_part</option> generic
55554 router option.
55555 </para>
55556 <para>
55557 <indexterm role="concept">
55558 <primary>mixed-case login names</primary>
55559 </indexterm>
55560 If you must have mixed-case user names on your system, the best way to proceed,
55561 assuming you want case-independent handling of incoming email, is to set up
55562 your first router to convert incoming local parts in your domains to the
55563 correct case by means of a file lookup. For example:
55564 </para>
55565 <literallayout class="monospaced">
55566 correct_case:
55567   driver = redirect
55568   domains = +local_domains
55569   data = ${lookup{$local_part}cdb\
55570               {/etc/usercased.cdb}{$value}fail}\
55571               @$domain
55572 </literallayout>
55573 <para>
55574 For this router, the local part is forced to lower case by the default action
55575 (<option>caseful_local_part</option> is not set). The lower-cased local part is used to look
55576 up a new local part in the correct case. If you then set <option>caseful_local_part</option>
55577 on any subsequent routers which process your domains, they will operate on
55578 local parts with the correct case in a case-sensitive manner.
55579 </para>
55580 </section>
55581 <section id="SECID231">
55582 <title>Dots in local parts</title>
55583 <para>
55584 <indexterm role="concept">
55585 <primary>dot</primary>
55586 <secondary>in local part</secondary>
55587 </indexterm>
55588 <indexterm role="concept">
55589 <primary>local part</primary>
55590 <secondary>dots in</secondary>
55591 </indexterm>
55592 RFC 2822 forbids empty components in local parts. That is, an unquoted local
55593 part may not begin or end with a dot, nor have two consecutive dots in the
55594 middle. However, it seems that many MTAs do not enforce this, so Exim permits
55595 empty components for compatibility.
55596 </para>
55597 </section>
55598 <section id="SECID232">
55599 <title>Rewriting addresses</title>
55600 <para>
55601 <indexterm role="concept">
55602 <primary>rewriting</primary>
55603 <secondary>addresses</secondary>
55604 </indexterm>
55605 Rewriting of sender and recipient addresses, and addresses in headers, can
55606 happen automatically, or as the result of configuration options, as described
55607 in chapter <xref linkend="CHAPrewrite"/>. The headers that may be affected by this are
55608 <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>.
55609 </para>
55610 <para>
55611 Automatic rewriting includes qualification, as mentioned above. The other case
55612 in which it can happen is when an incomplete non-local domain is given. The
55613 routing process may cause this to be expanded into the full domain name. For
55614 example, a header such as
55615 </para>
55616 <literallayout class="monospaced">
55617 To: hare@teaparty
55618 </literallayout>
55619 <para>
55620 might get rewritten as
55621 </para>
55622 <literallayout class="monospaced">
55623 To: hare@teaparty.wonderland.fict.example
55624 </literallayout>
55625 <para>
55626 Rewriting as a result of routing is the one kind of message processing that
55627 does not happen at input time, as it cannot be done until the address has
55628 been routed.
55629 </para>
55630 <para>
55631 Strictly, one should not do <emphasis>any</emphasis> deliveries of a message until all its
55632 addresses have been routed, in case any of the headers get changed as a
55633 result of routing. However, doing this in practice would hold up many
55634 deliveries for unreasonable amounts of time, just because one address could not
55635 immediately be routed. Exim therefore does not delay other deliveries when
55636 routing of one or more addresses is deferred.
55637 <indexterm role="concept" startref="IIDmesproc" class="endofrange"/>
55638 </para>
55639 </section>
55640 </chapter>
55641
55642 <chapter id="CHAPSMTP">
55643 <title>SMTP processing</title>
55644 <para>
55645 <indexterm role="concept" id="IIDsmtpproc1" class="startofrange">
55646 <primary>SMTP</primary>
55647 <secondary>processing details</secondary>
55648 </indexterm>
55649 <indexterm role="concept" id="IIDsmtpproc2" class="startofrange">
55650 <primary>LMTP</primary>
55651 <secondary>processing details</secondary>
55652 </indexterm>
55653 Exim supports a number of different ways of using the SMTP protocol, and its
55654 LMTP variant, which is an interactive protocol for transferring messages into a
55655 closed mail store application. This chapter contains details of how SMTP is
55656 processed. For incoming mail, the following are available:
55657 </para>
55658 <itemizedlist>
55659 <listitem>
55660 <para>
55661 SMTP over TCP/IP (Exim daemon or <emphasis>inetd</emphasis>);
55662 </para>
55663 </listitem>
55664 <listitem>
55665 <para>
55666 SMTP over the standard input and output (the <option>-bs</option> option);
55667 </para>
55668 </listitem>
55669 <listitem>
55670 <para>
55671 Batched SMTP on the standard input (the <option>-bS</option> option).
55672 </para>
55673 </listitem>
55674 </itemizedlist>
55675 <para>
55676 For mail delivery, the following are available:
55677 </para>
55678 <itemizedlist>
55679 <listitem>
55680 <para>
55681 SMTP over TCP/IP (the <command>smtp</command> transport);
55682 </para>
55683 </listitem>
55684 <listitem>
55685 <para>
55686 LMTP over TCP/IP (the <command>smtp</command> transport with the <option>protocol</option> option set to
55687 <quote>lmtp</quote>);
55688 </para>
55689 </listitem>
55690 <listitem>
55691 <para>
55692 LMTP over a pipe to a process running in the local host (the <command>lmtp</command>
55693 transport);
55694 </para>
55695 </listitem>
55696 <listitem>
55697 <para>
55698 Batched SMTP to a file or pipe (the <command>appendfile</command> and <command>pipe</command> transports with
55699 the <option>use_bsmtp</option> option set).
55700 </para>
55701 </listitem>
55702 </itemizedlist>
55703 <para>
55704 <emphasis>Batched SMTP</emphasis> is the name for a process in which batches of messages are
55705 stored in or read from files (or pipes), in a format in which SMTP commands are
55706 used to contain the envelope information.
55707 </para>
55708 <section id="SECToutSMTPTCP">
55709 <title>Outgoing SMTP and LMTP over TCP/IP</title>
55710 <para>
55711 <indexterm role="concept">
55712 <primary>SMTP</primary>
55713 <secondary>outgoing over TCP/IP</secondary>
55714 </indexterm>
55715 <indexterm role="concept">
55716 <primary>outgoing SMTP over TCP/IP</primary>
55717 </indexterm>
55718 <indexterm role="concept">
55719 <primary>LMTP</primary>
55720 <secondary>over TCP/IP</secondary>
55721 </indexterm>
55722 <indexterm role="concept">
55723 <primary>outgoing LMTP over TCP/IP</primary>
55724 </indexterm>
55725 <indexterm role="concept">
55726 <primary>EHLO</primary>
55727 </indexterm>
55728 <indexterm role="concept">
55729 <primary>HELO</primary>
55730 </indexterm>
55731 <indexterm role="concept">
55732 <primary>SIZE option on MAIL command</primary>
55733 </indexterm>
55734 Outgoing SMTP and LMTP over TCP/IP is implemented by the <command>smtp</command> transport.
55735 The <option>protocol</option> option selects which protocol is to be used, but the actual
55736 processing is the same in both cases.
55737 </para>
55738 <para>
55739 If, in response to its EHLO command, Exim is told that the SIZE
55740 parameter is supported, it adds SIZE=&lt;<emphasis>n</emphasis>&gt; to each subsequent MAIL
55741 command. The value of &lt;<emphasis>n</emphasis>&gt; is the message size plus the value of the
55742 <option>size_addition</option> option (default 1024) to allow for additions to the message
55743 such as per-transport header lines, or changes made in a
55744 <indexterm role="concept">
55745 <primary>transport</primary>
55746 <secondary>filter</secondary>
55747 </indexterm>
55748 <indexterm role="concept">
55749 <primary>filter</primary>
55750 <secondary>transport filter</secondary>
55751 </indexterm>
55752 transport filter. If <option>size_addition</option> is set negative, the use of SIZE is
55753 suppressed.
55754 </para>
55755 <para>
55756 If the remote server advertises support for PIPELINING, Exim uses the
55757 pipelining extension to SMTP (RFC 2197) to reduce the number of TCP/IP packets
55758 required for the transaction.
55759 </para>
55760 <para>
55761 If the remote server advertises support for the STARTTLS command, and Exim
55762 was built to support TLS encryption, it tries to start a TLS session unless the
55763 server matches <option>hosts_avoid_tls</option>. See chapter <xref linkend="CHAPTLS"/> for more details.
55764 </para>
55765 <para>
55766 If the remote server advertises support for the AUTH command, Exim scans
55767 the authenticators configuration for any suitable client settings, as described
55768 in chapter <xref linkend="CHAPSMTPAUTH"/>.
55769 </para>
55770 <para>
55771 <indexterm role="concept">
55772 <primary>carriage return</primary>
55773 </indexterm>
55774 <indexterm role="concept">
55775 <primary>linefeed</primary>
55776 </indexterm>
55777 Responses from the remote host are supposed to be terminated by CR followed by
55778 LF. However, there are known to be hosts that do not send CR characters, so in
55779 order to be able to interwork with such hosts, Exim treats LF on its own as a
55780 line terminator.
55781 </para>
55782 <para>
55783 If a message contains a number of different addresses, all those with the same
55784 characteristics (for example, the same envelope sender) that resolve to the
55785 same set of hosts, in the same order, are sent in a single SMTP transaction,
55786 even if they are for different domains, unless there are more than the setting
55787 of the <option>max_rcpt</option>s option in the <command>smtp</command> transport allows, in which case
55788 they are split into groups containing no more than <option>max_rcpt</option>s addresses
55789 each. If <option>remote_max_parallel</option> is greater than one, such groups may be sent
55790 in parallel sessions. The order of hosts with identical MX values is not
55791 significant when checking whether addresses can be batched in this way.
55792 </para>
55793 <para>
55794 When the <command>smtp</command> transport suffers a temporary failure that is not
55795 message-related, Exim updates its transport-specific database, which contains
55796 records indexed by host name that remember which messages are waiting for each
55797 particular host. It also updates the retry database with new retry times.
55798 </para>
55799 <para>
55800 <indexterm role="concept">
55801 <primary>hints database</primary>
55802 <secondary>retry keys</secondary>
55803 </indexterm>
55804 Exim&#x2019;s retry hints are based on host name plus IP address, so if one address of
55805 a multi-homed host is broken, it will soon be skipped most of the time.
55806 See the next section for more detail about error handling.
55807 </para>
55808 <para>
55809 <indexterm role="concept">
55810 <primary>SMTP</primary>
55811 <secondary>passed connection</secondary>
55812 </indexterm>
55813 <indexterm role="concept">
55814 <primary>SMTP</primary>
55815 <secondary>batching over TCP/IP</secondary>
55816 </indexterm>
55817 When a message is successfully delivered over a TCP/IP SMTP connection, Exim
55818 looks in the hints database for the transport to see if there are any queued
55819 messages waiting for the host to which it is connected. If it finds one, it
55820 creates a new Exim process using the <option>-MC</option> option (which can only be used by
55821 a process running as root or the Exim user) and passes the TCP/IP socket to it
55822 so that it can deliver another message using the same socket. The new process
55823 does only those deliveries that are routed to the connected host, and may in
55824 turn pass the socket on to a third process, and so on.
55825 </para>
55826 <para>
55827 The <option>connection_max_messages</option> option of the <command>smtp</command> transport can be used to
55828 limit the number of messages sent down a single TCP/IP connection.
55829 </para>
55830 <para>
55831 <indexterm role="concept">
55832 <primary>asterisk</primary>
55833 <secondary>after IP address</secondary>
55834 </indexterm>
55835 The second and subsequent messages delivered down an existing connection are
55836 identified in the main log by the addition of an asterisk after the closing
55837 square bracket of the IP address.
55838 </para>
55839 </section>
55840 <section id="SECToutSMTPerr">
55841 <title>Errors in outgoing SMTP</title>
55842 <para>
55843 <indexterm role="concept">
55844 <primary>error</primary>
55845 <secondary>in outgoing SMTP</secondary>
55846 </indexterm>
55847 <indexterm role="concept">
55848 <primary>SMTP</primary>
55849 <secondary>errors in outgoing</secondary>
55850 </indexterm>
55851 <indexterm role="concept">
55852 <primary>host</primary>
55853 <secondary>error</secondary>
55854 </indexterm>
55855 Three different kinds of error are recognized for outgoing SMTP: host errors,
55856 message errors, and recipient errors.
55857 </para>
55858 <variablelist>
55859 <varlistentry>
55860 <term><emphasis role="bold">Host errors</emphasis></term>
55861 <listitem>
55862 <para>
55863 A host error is not associated with a particular message or with a
55864 particular recipient of a message. The host errors are:
55865 </para>
55866 <itemizedlist>
55867 <listitem>
55868 <para>
55869 Connection refused or timed out,
55870 </para>
55871 </listitem>
55872 <listitem>
55873 <para>
55874 Any error response code on connection,
55875 </para>
55876 </listitem>
55877 <listitem>
55878 <para>
55879 Any error response code to EHLO or HELO,
55880 </para>
55881 </listitem>
55882 <listitem>
55883 <para>
55884 Loss of connection at any time, except after <quote>.</quote>,
55885 </para>
55886 </listitem>
55887 <listitem>
55888 <para>
55889 I/O errors at any time,
55890 </para>
55891 </listitem>
55892 <listitem>
55893 <para>
55894 Timeouts during the session, other than in response to MAIL, RCPT or
55895 the <quote>.</quote> at the end of the data.
55896 </para>
55897 </listitem>
55898 </itemizedlist>
55899 <para>
55900 For a host error, a permanent error response on connection, or in response to
55901 EHLO, causes all addresses routed to the host to be failed. Any other host
55902 error causes all addresses to be deferred, and retry data to be created for the
55903 host. It is not tried again, for any message, until its retry time arrives. If
55904 the current set of addresses are not all delivered in this run (to some
55905 alternative host), the message is added to the list of those waiting for this
55906 host, so if it is still undelivered when a subsequent successful delivery is
55907 made to the host, it will be sent down the same SMTP connection.
55908 </para>
55909 </listitem></varlistentry>
55910 <varlistentry>
55911 <term><emphasis role="bold">Message errors</emphasis></term>
55912 <listitem>
55913 <para>
55914 <indexterm role="concept">
55915 <primary>message</primary>
55916 <secondary>error</secondary>
55917 </indexterm>
55918 A message error is associated with a particular message when sent to a
55919 particular host, but not with a particular recipient of the message. The
55920 message errors are:
55921 </para>
55922 <itemizedlist>
55923 <listitem>
55924 <para>
55925 Any error response code to MAIL, DATA, or the <quote>.</quote> that terminates
55926 the data,
55927 </para>
55928 </listitem>
55929 <listitem>
55930 <para>
55931 Timeout after MAIL,
55932 </para>
55933 </listitem>
55934 <listitem>
55935 <para>
55936 Timeout or loss of connection after the <quote>.</quote> that terminates the data. A
55937 timeout after the DATA command itself is treated as a host error, as is loss of
55938 connection at any other time.
55939 </para>
55940 </listitem>
55941 </itemizedlist>
55942 <para>
55943 For a message error, a permanent error response (5<emphasis>xx</emphasis>) causes all addresses
55944 to be failed, and a delivery error report to be returned to the sender. A
55945 temporary error response (4<emphasis>xx</emphasis>), or one of the timeouts, causes all
55946 addresses to be deferred. Retry data is not created for the host, but instead,
55947 a retry record for the combination of host plus message id is created. The
55948 message is not added to the list of those waiting for this host. This ensures
55949 that the failing message will not be sent to this host again until the retry
55950 time arrives. However, other messages that are routed to the host are not
55951 affected, so if it is some property of the message that is causing the error,
55952 it will not stop the delivery of other mail.
55953 </para>
55954 <para>
55955 If the remote host specified support for the SIZE parameter in its response
55956 to EHLO, Exim adds SIZE=<emphasis>nnn</emphasis> to the MAIL command, so an
55957 over-large message will cause a message error because the error arrives as a
55958 response to MAIL.
55959 </para>
55960 </listitem></varlistentry>
55961 <varlistentry>
55962 <term><emphasis role="bold">Recipient errors</emphasis></term>
55963 <listitem>
55964 <para>
55965 <indexterm role="concept">
55966 <primary>recipient</primary>
55967 <secondary>error</secondary>
55968 </indexterm>
55969 A recipient error is associated with a particular recipient of a message. The
55970 recipient errors are:
55971 </para>
55972 <itemizedlist>
55973 <listitem>
55974 <para>
55975 Any error response to RCPT,
55976 </para>
55977 </listitem>
55978 <listitem>
55979 <para>
55980 Timeout after RCPT.
55981 </para>
55982 </listitem>
55983 </itemizedlist>
55984 <para>
55985 For a recipient error, a permanent error response (5<emphasis>xx</emphasis>) causes the
55986 recipient address to be failed, and a bounce message to be returned to the
55987 sender. A temporary error response (4<emphasis>xx</emphasis>) or a timeout causes the failing
55988 address to be deferred, and routing retry data to be created for it. This is
55989 used to delay processing of the address in subsequent queue runs, until its
55990 routing retry time arrives. This applies to all messages, but because it
55991 operates only in queue runs, one attempt will be made to deliver a new message
55992 to the failing address before the delay starts to operate. This ensures that,
55993 if the failure is really related to the message rather than the recipient
55994 (<quote>message too big for this recipient</quote> is a possible example), other messages
55995 have a chance of getting delivered. If a delivery to the address does succeed,
55996 the retry information gets cleared, so all stuck messages get tried again, and
55997 the retry clock is reset.
55998 </para>
55999 <para>
56000 The message is not added to the list of those waiting for this host. Use of the
56001 host for other messages is unaffected, and except in the case of a timeout,
56002 other recipients are processed independently, and may be successfully delivered
56003 in the current SMTP session. After a timeout it is of course impossible to
56004 proceed with the session, so all addresses get deferred. However, those other
56005 than the one that failed do not suffer any subsequent retry delays. Therefore,
56006 if one recipient is causing trouble, the others have a chance of getting
56007 through when a subsequent delivery attempt occurs before the failing
56008 recipient&#x2019;s retry time.
56009 </para>
56010 </listitem></varlistentry>
56011 </variablelist>
56012 <para>
56013 In all cases, if there are other hosts (or IP addresses) available for the
56014 current set of addresses (for example, from multiple MX records), they are
56015 tried in this run for any undelivered addresses, subject of course to their
56016 own retry data. In other words, recipient error retry data does not take effect
56017 until the next delivery attempt.
56018 </para>
56019 <para>
56020 Some hosts have been observed to give temporary error responses to every
56021 MAIL command at certain times (<quote>insufficient space</quote> has been seen). It
56022 would be nice if such circumstances could be recognized, and defer data for the
56023 host itself created, but this is not possible within the current Exim design.
56024 What actually happens is that retry data for every (host, message) combination
56025 is created.
56026 </para>
56027 <para>
56028 The reason that timeouts after MAIL and RCPT are treated specially is that
56029 these can sometimes arise as a result of the remote host&#x2019;s verification
56030 procedures. Exim makes this assumption, and treats them as if a temporary error
56031 response had been received. A timeout after <quote>.</quote> is treated specially because
56032 it is known that some broken implementations fail to recognize the end of the
56033 message if the last character of the last line is a binary zero. Thus, it is
56034 helpful to treat this case as a message error.
56035 </para>
56036 <para>
56037 Timeouts at other times are treated as host errors, assuming a problem with the
56038 host, or the connection to it. If a timeout after MAIL, RCPT,
56039 or <quote>.</quote> is really a connection problem, the assumption is that at the next try
56040 the timeout is likely to occur at some other point in the dialogue, causing it
56041 then to be treated as a host error.
56042 </para>
56043 <para>
56044 There is experimental evidence that some MTAs drop the connection after the
56045 terminating <quote>.</quote> if they do not like the contents of the message for some
56046 reason, in contravention of the RFC, which indicates that a 5<emphasis>xx</emphasis> response
56047 should be given. That is why Exim treats this case as a message rather than a
56048 host error, in order not to delay other messages to the same host.
56049 </para>
56050 </section>
56051 <section id="SECID233">
56052 <title>Incoming SMTP messages over TCP/IP</title>
56053 <para>
56054 <indexterm role="concept">
56055 <primary>SMTP</primary>
56056 <secondary>incoming over TCP/IP</secondary>
56057 </indexterm>
56058 <indexterm role="concept">
56059 <primary>incoming SMTP over TCP/IP</primary>
56060 </indexterm>
56061 <indexterm role="concept">
56062 <primary>inetd</primary>
56063 </indexterm>
56064 <indexterm role="concept">
56065 <primary>daemon</primary>
56066 </indexterm>
56067 Incoming SMTP messages can be accepted in one of two ways: by running a
56068 listening daemon, or by using <emphasis>inetd</emphasis>. In the latter case, the entry in
56069 <filename>/etc/inetd.conf</filename> should be like this:
56070 </para>
56071 <literallayout class="monospaced">
56072 smtp stream tcp nowait exim /opt/exim/bin/exim in.exim -bs
56073 </literallayout>
56074 <para>
56075 Exim distinguishes between this case and the case of a locally running user
56076 agent using the <option>-bs</option> option by checking whether or not the standard input is
56077 a socket. When it is, either the port must be privileged (less than 1024), or
56078 the caller must be root or the Exim user. If any other user passes a socket
56079 with an unprivileged port number, Exim prints a message on the standard error
56080 stream and exits with an error code.
56081 </para>
56082 <para>
56083 By default, Exim does not make a log entry when a remote host connects or
56084 disconnects (either via the daemon or <emphasis>inetd</emphasis>), unless the disconnection is
56085 unexpected. It can be made to write such log entries by setting the
56086 <option>smtp_connection</option> log selector.
56087 </para>
56088 <para>
56089 <indexterm role="concept">
56090 <primary>carriage return</primary>
56091 </indexterm>
56092 <indexterm role="concept">
56093 <primary>linefeed</primary>
56094 </indexterm>
56095 Commands from the remote host are supposed to be terminated by CR followed by
56096 LF. However, there are known to be hosts that do not send CR characters. In
56097 order to be able to interwork with such hosts, Exim treats LF on its own as a
56098 line terminator.
56099 Furthermore, because common code is used for receiving messages from all
56100 sources, a CR on its own is also interpreted as a line terminator. However, the
56101 sequence <quote>CR, dot, CR</quote> does not terminate incoming SMTP data.
56102 </para>
56103 <para>
56104 <indexterm role="concept">
56105 <primary>EHLO</primary>
56106 <secondary>invalid data</secondary>
56107 </indexterm>
56108 <indexterm role="concept">
56109 <primary>HELO</primary>
56110 <secondary>invalid data</secondary>
56111 </indexterm>
56112 One area that sometimes gives rise to problems concerns the EHLO or
56113 HELO commands. Some clients send syntactically invalid versions of these
56114 commands, which Exim rejects by default. (This is nothing to do with verifying
56115 the data that is sent, so <option>helo_verify_hosts</option> is not relevant.) You can tell
56116 Exim not to apply a syntax check by setting <option>helo_accept_junk_hosts</option> to
56117 match the broken hosts that send invalid commands.
56118 </para>
56119 <para>
56120 <indexterm role="concept">
56121 <primary>SIZE option on MAIL command</primary>
56122 </indexterm>
56123 <indexterm role="concept">
56124 <primary>MAIL</primary>
56125 <secondary>SIZE option</secondary>
56126 </indexterm>
56127 The amount of disk space available is checked whenever SIZE is received on
56128 a MAIL command, independently of whether <option>message_size_limit</option> or
56129 <option>check_spool_space</option> is configured, unless <option>smtp_check_spool_space</option> is set
56130 false. A temporary error is given if there is not enough space. If
56131 <option>check_spool_space</option> is set, the check is for that amount of space plus the
56132 value given with SIZE, that is, it checks that the addition of the incoming
56133 message will not reduce the space below the threshold.
56134 </para>
56135 <para>
56136 When a message is successfully received, Exim includes the local message id in
56137 its response to the final <quote>.</quote> that terminates the data. If the remote host
56138 logs this text it can help with tracing what has happened to a message.
56139 </para>
56140 <para>
56141 The Exim daemon can limit the number of simultaneous incoming connections it is
56142 prepared to handle (see the <option>smtp_accept_max</option> option). It can also limit the
56143 number of simultaneous incoming connections from a single remote host (see the
56144 <option>smtp_accept_max_per_host</option> option). Additional connection attempts are
56145 rejected using the SMTP temporary error code 421.
56146 </para>
56147 <para>
56148 The Exim daemon does not rely on the SIGCHLD signal to detect when a
56149 subprocess has finished, as this can get lost at busy times. Instead, it looks
56150 for completed subprocesses every time it wakes up. Provided there are other
56151 things happening (new incoming calls, starts of queue runs), completed
56152 processes will be noticed and tidied away. On very quiet systems you may
56153 sometimes see a <quote>defunct</quote> Exim process hanging about. This is not a problem;
56154 it will be noticed when the daemon next wakes up.
56155 </para>
56156 <para>
56157 When running as a daemon, Exim can reserve some SMTP slots for specific hosts,
56158 and can also be set up to reject SMTP calls from non-reserved hosts at times of
56159 high system load &ndash; for details see the <option>smtp_accept_reserve</option>,
56160 <option>smtp_load_reserve</option>, and <option>smtp_reserve_hosts</option> options. The load check
56161 applies in both the daemon and <emphasis>inetd</emphasis> cases.
56162 </para>
56163 <para>
56164 Exim normally starts a delivery process for each message received, though this
56165 can be varied by means of the <option>-odq</option> command line option and the
56166 <option>queue_only</option>, <option>queue_only_file</option>, and <option>queue_only_load</option> options. The
56167 number of simultaneously running delivery processes started in this way from
56168 SMTP input can be limited by the <option>smtp_accept_queue</option> and
56169 <option>smtp_accept_queue_per_connection</option> options. When either limit is reached,
56170 subsequently received messages are just put on the input queue without starting
56171 a delivery process.
56172 </para>
56173 <para>
56174 The controls that involve counts of incoming SMTP calls (<option>smtp_accept_max</option>,
56175 <option>smtp_accept_queue</option>, <option>smtp_accept_reserve</option>) are not available when Exim is
56176 started up from the <emphasis>inetd</emphasis> daemon, because in that case each connection is
56177 handled by an entirely independent Exim process. Control by load average is,
56178 however, available with <emphasis>inetd</emphasis>.
56179 </para>
56180 <para>
56181 Exim can be configured to verify addresses in incoming SMTP commands as they
56182 are received. See chapter <xref linkend="CHAPACL"/> for details. It can also be configured
56183 to rewrite addresses at this time &ndash; before any syntax checking is done. See
56184 section <xref linkend="SECTrewriteS"/>.
56185 </para>
56186 <para>
56187 Exim can also be configured to limit the rate at which a client host submits
56188 MAIL and RCPT commands in a single SMTP session. See the
56189 <option>smtp_ratelimit_hosts</option> option.
56190 </para>
56191 </section>
56192 <section id="SECID234">
56193 <title>Unrecognized SMTP commands</title>
56194 <para>
56195 <indexterm role="concept">
56196 <primary>SMTP</primary>
56197 <secondary>unrecognized commands</secondary>
56198 </indexterm>
56199 If Exim receives more than <option>smtp_max_unknown_commands</option> unrecognized SMTP
56200 commands during a single SMTP connection, it drops the connection after sending
56201 the error response to the last command. The default value for
56202 <option>smtp_max_unknown_commands</option> is 3. This is a defence against some kinds of
56203 abuse that subvert web servers into making connections to SMTP ports; in these
56204 circumstances, a number of non-SMTP lines are sent first.
56205 </para>
56206 </section>
56207 <section id="SECID235">
56208 <title>Syntax and protocol errors in SMTP commands</title>
56209 <para>
56210 <indexterm role="concept">
56211 <primary>SMTP</primary>
56212 <secondary>syntax errors</secondary>
56213 </indexterm>
56214 <indexterm role="concept">
56215 <primary>SMTP</primary>
56216 <secondary>protocol errors</secondary>
56217 </indexterm>
56218 A syntax error is detected if an SMTP command is recognized, but there is
56219 something syntactically wrong with its data, for example, a malformed email
56220 address in a RCPT command. Protocol errors include invalid command
56221 sequencing such as RCPT before MAIL. If Exim receives more than
56222 <option>smtp_max_synprot_errors</option> such commands during a single SMTP connection, it
56223 drops the connection after sending the error response to the last command. The
56224 default value for <option>smtp_max_synprot_errors</option> is 3. This is a defence against
56225 broken clients that loop sending bad commands (yes, it has been seen).
56226 </para>
56227 </section>
56228 <section id="SECID236">
56229 <title>Use of non-mail SMTP commands</title>
56230 <para>
56231 <indexterm role="concept">
56232 <primary>SMTP</primary>
56233 <secondary>non-mail commands</secondary>
56234 </indexterm>
56235 The <quote>non-mail</quote> SMTP commands are those other than MAIL, RCPT, and
56236 DATA. Exim counts such commands, and drops the connection if there are too
56237 many of them in a single SMTP session. This action catches some
56238 denial-of-service attempts and things like repeated failing AUTHs, or a mad
56239 client looping sending EHLO. The global option <option>smtp_accept_max_nonmail</option>
56240 defines what <quote>too many</quote> means. Its default value is 10.
56241 </para>
56242 <para>
56243 When a new message is expected, one occurrence of RSET is not counted. This
56244 allows a client to send one RSET between messages (this is not necessary,
56245 but some clients do it). Exim also allows one uncounted occurrence of HELO
56246 or EHLO, and one occurrence of STARTTLS between messages. After
56247 starting up a TLS session, another EHLO is expected, and so it too is not
56248 counted.
56249 </para>
56250 <para>
56251 The first occurrence of AUTH in a connection, or immediately following
56252 STARTTLS is also not counted. Otherwise, all commands other than MAIL,
56253 RCPT, DATA, and QUIT are counted.
56254 </para>
56255 <para>
56256 You can control which hosts are subject to the limit set by
56257 <option>smtp_accept_max_nonmail</option> by setting
56258 <option>smtp_accept_max_nonmail_hosts</option>. The default value is <literal>*</literal>, which makes
56259 the limit apply to all hosts. This option means that you can exclude any
56260 specific badly-behaved hosts that you have to live with.
56261 </para>
56262 </section>
56263 <section id="SECID237">
56264 <title>The VRFY and EXPN commands</title>
56265 <para>
56266 When Exim receives a VRFY or EXPN command on a TCP/IP connection, it
56267 runs the ACL specified by <option>acl_smtp_vrfy</option> or <option>acl_smtp_expn</option> (as
56268 appropriate) in order to decide whether the command should be accepted or not.
56269 If no ACL is defined, the command is rejected.
56270 </para>
56271 <para>
56272 <indexterm role="concept">
56273 <primary>VRFY</primary>
56274 <secondary>processing</secondary>
56275 </indexterm>
56276 When VRFY is accepted, it runs exactly the same code as when Exim is
56277 called with the <option>-bv</option> option.
56278 </para>
56279 <para>
56280 <indexterm role="concept">
56281 <primary>EXPN</primary>
56282 <secondary>processing</secondary>
56283 </indexterm>
56284 When EXPN is accepted, a single-level expansion of the address is done.
56285 EXPN is treated as an <quote>address test</quote> (similar to the <option>-bt</option> option) rather
56286 than a verification (the <option>-bv</option> option). If an unqualified local part is given
56287 as the argument to EXPN, it is qualified with <option>qualify_domain</option>. Rejections
56288 of VRFY and EXPN commands are logged on the main and reject logs, and
56289 VRFY verification failures are logged on the main log for consistency with
56290 RCPT failures.
56291 </para>
56292 </section>
56293 <section id="SECTETRN">
56294 <title>The ETRN command</title>
56295 <para>
56296 <indexterm role="concept">
56297 <primary>ETRN</primary>
56298 <secondary>processing</secondary>
56299 </indexterm>
56300 RFC 1985 describes an SMTP command called ETRN that is designed to
56301 overcome the security problems of the TURN command (which has fallen into
56302 disuse). When Exim receives an ETRN command on a TCP/IP connection, it runs
56303 the ACL specified by <option>acl_smtp_etrn</option> in order to decide whether the command
56304 should be accepted or not. If no ACL is defined, the command is rejected.
56305 </para>
56306 <para>
56307 The ETRN command is concerned with <quote>releasing</quote> messages that are awaiting
56308 delivery to certain hosts. As Exim does not organize its message queue by host,
56309 the only form of ETRN that is supported by default is the one where the
56310 text starts with the <quote>#</quote> prefix, in which case the remainder of the text is
56311 specific to the SMTP server. A valid ETRN command causes a run of Exim with
56312 the <option>-R</option> option to happen, with the remainder of the ETRN text as its
56313 argument. For example,
56314 </para>
56315 <literallayout class="monospaced">
56316 ETRN #brigadoon
56317 </literallayout>
56318 <para>
56319 runs the command
56320 </para>
56321 <literallayout class="monospaced">
56322 exim -R brigadoon
56323 </literallayout>
56324 <para>
56325 which causes a delivery attempt on all messages with undelivered addresses
56326 containing the text <quote>brigadoon</quote>. When <option>smtp_etrn_serialize</option> is set (the
56327 default), Exim prevents the simultaneous execution of more than one queue run
56328 for the same argument string as a result of an ETRN command. This stops
56329 a misbehaving client from starting more than one queue runner at once.
56330 </para>
56331 <para>
56332 <indexterm role="concept">
56333 <primary>hints database</primary>
56334 <secondary>ETRN serialization</secondary>
56335 </indexterm>
56336 Exim implements the serialization by means of a hints database in which a
56337 record is written whenever a process is started by ETRN, and deleted when
56338 the process completes. However, Exim does not keep the SMTP session waiting for
56339 the ETRN process to complete. Once ETRN is accepted, the client is sent
56340 a <quote>success</quote> return code. Obviously there is scope for hints records to get
56341 left lying around if there is a system or program crash. To guard against this,
56342 Exim ignores any records that are more than six hours old.
56343 </para>
56344 <para>
56345 <indexterm role="option">
56346 <primary><option>smtp_etrn_command</option></primary>
56347 </indexterm>
56348 For more control over what ETRN does, the <option>smtp_etrn_command</option> option can
56349 used. This specifies a command that is run whenever ETRN is received,
56350 whatever the form of its argument. For
56351 example:
56352 </para>
56353 <literallayout class="monospaced">
56354 smtp_etrn_command = /etc/etrn_command $domain \
56355                     $sender_host_address
56356 </literallayout>
56357 <para>
56358 <indexterm role="variable">
56359 <primary><varname>$domain</varname></primary>
56360 </indexterm>
56361 The string is split up into arguments which are independently expanded. The
56362 expansion variable <varname>$domain</varname> is set to the argument of the ETRN command,
56363 and no syntax checking is done on the contents of this argument. Exim does not
56364 wait for the command to complete, so its status code is not checked. Exim runs
56365 under its own uid and gid when receiving incoming SMTP, so it is not possible
56366 for it to change them before running the command.
56367 </para>
56368 </section>
56369 <section id="SECID238">
56370 <title>Incoming local SMTP</title>
56371 <para>
56372 <indexterm role="concept">
56373 <primary>SMTP</primary>
56374 <secondary>local incoming</secondary>
56375 </indexterm>
56376 Some user agents use SMTP to pass messages to their local MTA using the
56377 standard input and output, as opposed to passing the envelope on the command
56378 line and writing the message to the standard input. This is supported by the
56379 <option>-bs</option> option. This form of SMTP is handled in the same way as incoming
56380 messages over TCP/IP (including the use of ACLs), except that the envelope
56381 sender given in a MAIL command is ignored unless the caller is trusted. In
56382 an ACL you can detect this form of SMTP input by testing for an empty host
56383 identification. It is common to have this as the first line in the ACL that
56384 runs for RCPT commands:
56385 </para>
56386 <literallayout class="monospaced">
56387 accept hosts = :
56388 </literallayout>
56389 <para>
56390 This accepts SMTP messages from local processes without doing any other tests.
56391 </para>
56392 </section>
56393 <section id="SECTbatchSMTP">
56394 <title>Outgoing batched SMTP</title>
56395 <para>
56396 <indexterm role="concept">
56397 <primary>SMTP</primary>
56398 <secondary>batched outgoing</secondary>
56399 </indexterm>
56400 <indexterm role="concept">
56401 <primary>batched SMTP output</primary>
56402 </indexterm>
56403 Both the <command>appendfile</command> and <command>pipe</command> transports can be used for handling
56404 batched SMTP. Each has an option called <option>use_bsmtp</option> which causes messages to
56405 be output in BSMTP format. No SMTP responses are possible for this form of
56406 delivery. All it is doing is using SMTP commands as a way of transmitting the
56407 envelope along with the message.
56408 </para>
56409 <para>
56410 The message is written to the file or pipe preceded by the SMTP commands
56411 MAIL and RCPT, and followed by a line containing a single dot. Lines in
56412 the message that start with a dot have an extra dot added. The SMTP command
56413 HELO is not normally used. If it is required, the <option>message_prefix</option> option
56414 can be used to specify it.
56415 </para>
56416 <para>
56417 Because <command>appendfile</command> and <command>pipe</command> are both local transports, they accept only
56418 one recipient address at a time by default. However, you can arrange for them
56419 to handle several addresses at once by setting the <option>batch_max</option> option. When
56420 this is done for BSMTP, messages may contain multiple RCPT commands. See
56421 chapter <xref linkend="CHAPbatching"/> for more details.
56422 </para>
56423 <para>
56424 <indexterm role="variable">
56425 <primary><varname>$host</varname></primary>
56426 </indexterm>
56427 When one or more addresses are routed to a BSMTP transport by a router that
56428 sets up a host list, the name of the first host on the list is available to the
56429 transport in the variable <varname>$host</varname>. Here is an example of such a transport and
56430 router:
56431 </para>
56432 <literallayout class="monospaced">
56433 begin routers
56434 route_append:
56435   driver = manualroute
56436   transport = smtp_appendfile
56437   route_list = domain.example  batch.host.example
56438
56439 begin transports
56440 smtp_appendfile:
56441   driver = appendfile
56442   directory = /var/bsmtp/$host
56443   batch_max = 1000
56444   use_bsmtp
56445   user = exim
56446 </literallayout>
56447 <para>
56448 This causes messages addressed to <emphasis>domain.example</emphasis> to be written in BSMTP
56449 format to <filename>/var/bsmtp/batch.host.example</filename>, with only a single copy of each
56450 message (unless there are more than 1000 recipients).
56451 </para>
56452 </section>
56453 <section id="SECTincomingbatchedSMTP">
56454 <title>Incoming batched SMTP</title>
56455 <para>
56456 <indexterm role="concept">
56457 <primary>SMTP</primary>
56458 <secondary>batched incoming</secondary>
56459 </indexterm>
56460 <indexterm role="concept">
56461 <primary>batched SMTP input</primary>
56462 </indexterm>
56463 The <option>-bS</option> command line option causes Exim to accept one or more messages by
56464 reading SMTP on the standard input, but to generate no responses. If the caller
56465 is trusted, the senders in the MAIL commands are believed; otherwise the
56466 sender is always the caller of Exim. Unqualified senders and receivers are not
56467 rejected (there seems little point) but instead just get qualified. HELO
56468 and EHLO act as RSET; VRFY, EXPN, ETRN and  HELP, act
56469 as NOOP; QUIT quits.
56470 </para>
56471 <para>
56472 No policy checking is done for BSMTP input. That is, no ACL is run at anytime.
56473 In this respect it is like non-SMTP local input.
56474 </para>
56475 <para>
56476 If an error is detected while reading a message, including a missing <quote>.</quote> at
56477 the end, Exim gives up immediately. It writes details of the error to the
56478 standard output in a stylized way that the calling program should be able to
56479 make some use of automatically, for example:
56480 </para>
56481 <literallayout class="monospaced">
56482 554 Unexpected end of file
56483 Transaction started in line 10
56484 Error detected in line 14
56485 </literallayout>
56486 <para>
56487 It writes a more verbose version, for human consumption, to the standard error
56488 file, for example:
56489 </para>
56490 <literallayout class="monospaced">
56491 An error was detected while processing a file of BSMTP input.
56492 The error message was:
56493
56494 501 '&gt;' missing at end of address
56495
56496 The SMTP transaction started in line 10.
56497 The error was detected in line 12.
56498 The SMTP command at fault was:
56499
56500 rcpt to:&lt;malformed@in.com.plete
56501
56502 1 previous message was successfully processed.
56503 The rest of the batch was abandoned.
56504 </literallayout>
56505 <para>
56506 The return code from Exim is zero only if there were no errors. It is 1 if some
56507 messages were accepted before an error was detected, and 2 if no messages were
56508 accepted.
56509 <indexterm role="concept" startref="IIDsmtpproc1" class="endofrange"/>
56510 <indexterm role="concept" startref="IIDsmtpproc2" class="endofrange"/>
56511 </para>
56512 </section>
56513 </chapter>
56514
56515 <chapter id="CHAPemsgcust">
56516 <title>Customizing bounce and warning messages</title>
56517 <titleabbrev>Customizing messages</titleabbrev>
56518 <para>
56519 When a message fails to be delivered, or remains on the queue for more than a
56520 configured amount of time, Exim sends a message to the original sender, or
56521 to an alternative configured address. The text of these messages is built into
56522 the code of Exim, but it is possible to change it, either by adding a single
56523 string, or by replacing each of the paragraphs by text supplied in a file.
56524 </para>
56525 <para>
56526 The <emphasis>From:</emphasis> and <emphasis>To:</emphasis> header lines are automatically generated; you can
56527 cause a <emphasis>Reply-To:</emphasis> line to be added by setting the <option>errors_reply_to</option>
56528 option. Exim also adds the line
56529 </para>
56530 <literallayout class="monospaced">
56531 Auto-Submitted: auto-generated
56532 </literallayout>
56533 <para>
56534 to all warning and bounce messages,
56535 </para>
56536 <section id="SECID239">
56537 <title>Customizing bounce messages</title>
56538 <para>
56539 <indexterm role="concept">
56540 <primary>customizing</primary>
56541 <secondary>bounce message</secondary>
56542 </indexterm>
56543 <indexterm role="concept">
56544 <primary>bounce message</primary>
56545 <secondary>customizing</secondary>
56546 </indexterm>
56547 If <option>bounce_message_text</option> is set, its contents are included in the default
56548 message immediately after <quote>This message was created automatically by mail
56549 delivery software.</quote> The string is not expanded. It is not used if
56550 <option>bounce_message_file</option> is set.
56551 </para>
56552 <para>
56553 When <option>bounce_message_file</option> is set, it must point to a template file for
56554 constructing error messages. The file consists of a series of text items,
56555 separated by lines consisting of exactly four asterisks. If the file cannot be
56556 opened, default text is used and a message is written to the main and panic
56557 logs. If any text item in the file is empty, default text is used for that
56558 item.
56559 </para>
56560 <para>
56561 <indexterm role="variable">
56562 <primary><varname>$bounce_recipient</varname></primary>
56563 </indexterm>
56564 <indexterm role="variable">
56565 <primary><varname>$bounce_return_size_limit</varname></primary>
56566 </indexterm>
56567 Each item of text that is read from the file is expanded, and there are two
56568 expansion variables which can be of use here: <varname>$bounce_recipient</varname> is set to
56569 the recipient of an error message while it is being created, and
56570 <varname>$bounce_return_size_limit</varname> contains the value of the <option>return_size_limit</option>
56571 option, rounded to a whole number.
56572 </para>
56573 <para>
56574 The items must appear in the file in the following order:
56575 </para>
56576 <itemizedlist>
56577 <listitem>
56578 <para>
56579 The first item is included in the headers, and should include at least a
56580 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
56581 </para>
56582 </listitem>
56583 <listitem>
56584 <para>
56585 The second item forms the start of the error message. After it, Exim lists the
56586 failing addresses with their error messages.
56587 </para>
56588 </listitem>
56589 <listitem>
56590 <para>
56591 The third item is used to introduce any text from pipe transports that is to be
56592 returned to the sender. It is omitted if there is no such text.
56593 </para>
56594 </listitem>
56595 <listitem>
56596 <para>
56597 The fourth item is used to introduce the copy of the message that is returned
56598 as part of the error report.
56599 </para>
56600 </listitem>
56601 <listitem>
56602 <para>
56603 The fifth item is added after the fourth one if the returned message is
56604 truncated because it is bigger than <option>return_size_limit</option>.
56605 </para>
56606 </listitem>
56607 <listitem>
56608 <para>
56609 The sixth item is added after the copy of the original message.
56610 </para>
56611 </listitem>
56612 </itemizedlist>
56613 <para>
56614 The default state (<option>bounce_message_file</option> unset) is equivalent to the
56615 following file, in which the sixth item is empty. The <emphasis>Subject:</emphasis> and some
56616 other lines have been split in order to fit them on the page:
56617 </para>
56618 <literallayout class="monospaced">
56619 Subject: Mail delivery failed
56620   ${if eq{$sender_address}{$bounce_recipient}
56621   {: returning message to sender}}
56622 ****
56623 This message was created automatically by mail delivery software.
56624
56625 A message ${if eq{$sender_address}{$bounce_recipient}
56626   {that you sent }{sent by
56627
56628 &lt;$sender_address&gt;
56629
56630 }}could not be delivered to all of its recipients.
56631 This is a permanent error. The following address(es) failed:
56632 ****
56633 The following text was generated during the delivery attempt(s):
56634 ****
56635 ------ This is a copy of the message, including all the headers.
56636   ------
56637 ****
56638 ------ The body of the message is $message_size characters long;
56639   only the first
56640 ------ $bounce_return_size_limit or so are included here.
56641 ****
56642 </literallayout>
56643 </section>
56644 <section id="SECTcustwarn">
56645 <title>Customizing warning messages</title>
56646 <para>
56647 <indexterm role="concept">
56648 <primary>customizing</primary>
56649 <secondary>warning message</secondary>
56650 </indexterm>
56651 <indexterm role="concept">
56652 <primary>warning of delay</primary>
56653 <secondary>customizing the message</secondary>
56654 </indexterm>
56655 The option <option>warn_message_file</option> can be pointed at a template file for use when
56656 warnings about message delays are created. In this case there are only three
56657 text sections:
56658 </para>
56659 <itemizedlist>
56660 <listitem>
56661 <para>
56662 The first item is included in the headers, and should include at least a
56663 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
56664 </para>
56665 </listitem>
56666 <listitem>
56667 <para>
56668 The second item forms the start of the warning message. After it, Exim lists
56669 the delayed addresses.
56670 </para>
56671 </listitem>
56672 <listitem>
56673 <para>
56674 The third item then ends the message.
56675 </para>
56676 </listitem>
56677 </itemizedlist>
56678 <para>
56679 The default state is equivalent to the following file, except that some lines
56680 have been split here, in order to fit them on the page:
56681 </para>
56682 <literallayout class="monospaced">
56683 Subject: Warning: message $message_exim_id delayed
56684   $warn_message_delay
56685 ****
56686 This message was created automatically by mail delivery software.
56687
56688 A message ${if eq{$sender_address}{$warn_message_recipients}
56689 {that you sent }{sent by
56690
56691 &lt;$sender_address&gt;
56692
56693 }}has not been delivered to all of its recipients after
56694 more than $warn_message_delay on the queue on $primary_hostname.
56695
56696 The message identifier is:     $message_exim_id
56697 The subject of the message is: $h_subject
56698 The date of the message is:    $h_date
56699
56700 The following address(es) have not yet been delivered:
56701 ****
56702 No action is required on your part. Delivery attempts will
56703 continue for some time, and this warning may be repeated at
56704 intervals if the message remains undelivered. Eventually the
56705 mail delivery software will give up, and when that happens,
56706 the message will be returned to you.
56707 </literallayout>
56708 <para>
56709 <indexterm role="variable">
56710 <primary><varname>$warn_message_delay</varname></primary>
56711 </indexterm>
56712 <indexterm role="variable">
56713 <primary><varname>$warn_message_recipients</varname></primary>
56714 </indexterm>
56715 However, in the default state the subject and date lines are omitted if no
56716 appropriate headers exist. During the expansion of this file,
56717 <varname>$warn_message_delay</varname> is set to the delay time in one of the forms <quote>&lt;<emphasis>n</emphasis>&gt;
56718 minutes</quote> or <quote>&lt;<emphasis>n</emphasis>&gt; hours</quote>, and <varname>$warn_message_recipients</varname> contains a list
56719 of recipients for the warning message. There may be more than one if there are
56720 multiple addresses with different <option>errors_to</option> settings on the routers that
56721 handled them.
56722 </para>
56723 </section>
56724 </chapter>
56725
56726 <chapter id="CHAPcomconreq">
56727 <title>Some common configuration settings</title>
56728 <para>
56729 This chapter discusses some configuration settings that seem to be fairly
56730 common. More examples and discussion can be found in the Exim book.
56731 </para>
56732 <section id="SECID240">
56733 <title>Sending mail to a smart host</title>
56734 <para>
56735 <indexterm role="concept">
56736 <primary>smart host</primary>
56737 <secondary>example router</secondary>
56738 </indexterm>
56739 If you want to send all mail for non-local domains to a <quote>smart host</quote>, you
56740 should replace the default <command>dnslookup</command> router with a router which does the
56741 routing explicitly:
56742 </para>
56743 <literallayout class="monospaced">
56744 send_to_smart_host:
56745   driver = manualroute
56746   route_list = !+local_domains smart.host.name
56747   transport = remote_smtp
56748 </literallayout>
56749 <para>
56750 You can use the smart host&#x2019;s IP address instead of the name if you wish.
56751 If you are using Exim only to submit messages to a smart host, and not for
56752 receiving incoming messages, you can arrange for it to do the submission
56753 synchronously by setting the <option>mua_wrapper</option> option (see chapter
56754 <xref linkend="CHAPnonqueueing"/>).
56755 </para>
56756 </section>
56757 <section id="SECTmailinglists">
56758 <title>Using Exim to handle mailing lists</title>
56759 <para>
56760 <indexterm role="concept">
56761 <primary>mailing lists</primary>
56762 </indexterm>
56763 Exim can be used to run simple mailing lists, but for large and/or complicated
56764 requirements, the use of additional specialized mailing list software such as
56765 Majordomo or Mailman is recommended.
56766 </para>
56767 <para>
56768 The <command>redirect</command> router can be used to handle mailing lists where each list
56769 is maintained in a separate file, which can therefore be managed by an
56770 independent manager. The <option>domains</option> router option can be used to run these
56771 lists in a separate domain from normal mail. For example:
56772 </para>
56773 <literallayout class="monospaced">
56774 lists:
56775   driver = redirect
56776   domains = lists.example
56777   file = /usr/lists/$local_part
56778   forbid_pipe
56779   forbid_file
56780   errors_to = $local_part-request@lists.example
56781   no_more
56782 </literallayout>
56783 <para>
56784 This router is skipped for domains other than <emphasis>lists.example</emphasis>. For addresses
56785 in that domain, it looks for a file that matches the local part. If there is no
56786 such file, the router declines, but because <option>no_more</option> is set, no subsequent
56787 routers are tried, and so the whole delivery fails.
56788 </para>
56789 <para>
56790 The <option>forbid_pipe</option> and <option>forbid_file</option> options prevent a local part from being
56791 expanded into a file name or a pipe delivery, which is usually inappropriate in
56792 a mailing list.
56793 </para>
56794 <para>
56795 <indexterm role="option">
56796 <primary><option>errors_to</option></primary>
56797 </indexterm>
56798 The <option>errors_to</option> option specifies that any delivery errors caused by addresses
56799 taken from a mailing list are to be sent to the given address rather than the
56800 original sender of the message. However, before acting on this, Exim verifies
56801 the error address, and ignores it if verification fails.
56802 </para>
56803 <para>
56804 For example, using the configuration above, mail sent to
56805 <emphasis>dicts@lists.example</emphasis> is passed on to those addresses contained in
56806 <filename>/usr/lists/dicts</filename>, with error reports directed to
56807 <emphasis>dicts-request@lists.example</emphasis>, provided that this address can be verified.
56808 There could be a file called <filename>/usr/lists/dicts-request</filename> containing
56809 the address(es) of this particular list&#x2019;s manager(s), but other approaches,
56810 such as setting up an earlier router (possibly using the <option>local_part_prefix</option>
56811 or <option>local_part_suffix</option> options) to handle addresses of the form
56812 <option>owner-</option><emphasis>xxx</emphasis> or <option>xxx-</option><emphasis>request</emphasis>, are also possible.
56813 </para>
56814 </section>
56815 <section id="SECID241">
56816 <title>Syntax errors in mailing lists</title>
56817 <para>
56818 <indexterm role="concept">
56819 <primary>mailing lists</primary>
56820 <secondary>syntax errors in</secondary>
56821 </indexterm>
56822 If an entry in redirection data contains a syntax error, Exim normally defers
56823 delivery of the original address. That means that a syntax error in a mailing
56824 list holds up all deliveries to the list. This may not be appropriate when a
56825 list is being maintained automatically from data supplied by users, and the
56826 addresses are not rigorously checked.
56827 </para>
56828 <para>
56829 If the <option>skip_syntax_errors</option> option is set, the <command>redirect</command> router just skips
56830 entries that fail to parse, noting the incident in the log. If in addition
56831 <option>syntax_errors_to</option> is set to a verifiable address, a message is sent to it
56832 whenever a broken address is skipped. It is usually appropriate to set
56833 <option>syntax_errors_to</option> to the same address as <option>errors_to</option>.
56834 </para>
56835 </section>
56836 <section id="SECID242">
56837 <title>Re-expansion of mailing lists</title>
56838 <para>
56839 <indexterm role="concept">
56840 <primary>mailing lists</primary>
56841 <secondary>re-expansion of</secondary>
56842 </indexterm>
56843 Exim remembers every individual address to which a message has been delivered,
56844 in order to avoid duplication, but it normally stores only the original
56845 recipient addresses with a message. If all the deliveries to a mailing list
56846 cannot be done at the first attempt, the mailing list is re-expanded when the
56847 delivery is next tried. This means that alterations to the list are taken into
56848 account at each delivery attempt, so addresses that have been added to
56849 the list since the message arrived will therefore receive a copy of the
56850 message, even though it pre-dates their subscription.
56851 </para>
56852 <para>
56853 If this behaviour is felt to be undesirable, the <option>one_time</option> option can be set
56854 on the <command>redirect</command> router. If this is done, any addresses generated by the
56855 router that fail to deliver at the first attempt are added to the message as
56856 <quote>top level</quote> addresses, and the parent address that generated them is marked
56857 <quote>delivered</quote>. Thus, expansion of the mailing list does not happen again at the
56858 subsequent delivery attempts. The disadvantage of this is that if any of the
56859 failing addresses are incorrect, correcting them in the file has no effect on
56860 pre-existing messages.
56861 </para>
56862 <para>
56863 The original top-level address is remembered with each of the generated
56864 addresses, and is output in any log messages. However, any intermediate parent
56865 addresses are not recorded. This makes a difference to the log only if the
56866 <option>all_parents</option> selector is set, but for mailing lists there is normally only
56867 one level of expansion anyway.
56868 </para>
56869 </section>
56870 <section id="SECID243">
56871 <title>Closed mailing lists</title>
56872 <para>
56873 <indexterm role="concept">
56874 <primary>mailing lists</primary>
56875 <secondary>closed</secondary>
56876 </indexterm>
56877 The examples so far have assumed open mailing lists, to which anybody may
56878 send mail. It is also possible to set up closed lists, where mail is accepted
56879 from specified senders only. This is done by making use of the generic
56880 <option>senders</option> option to restrict the router that handles the list.
56881 </para>
56882 <para>
56883 The following example uses the same file as a list of recipients and as a list
56884 of permitted senders. It requires three routers:
56885 </para>
56886 <literallayout class="monospaced">
56887 lists_request:
56888   driver = redirect
56889   domains = lists.example
56890   local_part_suffix = -request
56891   file = /usr/lists/$local_part$local_part_suffix
56892   no_more
56893
56894 lists_post:
56895   driver = redirect
56896   domains = lists.example
56897   senders = ${if exists {/usr/lists/$local_part}\
56898              {lsearch;/usr/lists/$local_part}{*}}
56899   file = /usr/lists/$local_part
56900   forbid_pipe
56901   forbid_file
56902   errors_to = $local_part-request@lists.example
56903   no_more
56904
56905 lists_closed:
56906   driver = redirect
56907   domains = lists.example
56908   allow_fail
56909   data = :fail: $local_part@lists.example is a closed mailing list
56910 </literallayout>
56911 <para>
56912 All three routers have the same <option>domains</option> setting, so for any other domains,
56913 they are all skipped. The first router runs only if the local part ends in
56914 <option>-request</option>. It handles messages to the list manager(s) by means of an open
56915 mailing list.
56916 </para>
56917 <para>
56918 The second router runs only if the <option>senders</option> precondition is satisfied. It
56919 checks for the existence of a list that corresponds to the local part, and then
56920 checks that the sender is on the list by means of a linear search. It is
56921 necessary to check for the existence of the file before trying to search it,
56922 because otherwise Exim thinks there is a configuration error. If the file does
56923 not exist, the expansion of <option>senders</option> is *, which matches all senders. This
56924 means that the router runs, but because there is no list, declines, and
56925 <option>no_more</option> ensures that no further routers are run. The address fails with an
56926 <quote>unrouteable address</quote> error.
56927 </para>
56928 <para>
56929 The third router runs only if the second router is skipped, which happens when
56930 a mailing list exists, but the sender is not on it. This router forcibly fails
56931 the address, giving a suitable error message.
56932 </para>
56933 </section>
56934 <section id="SECTverp">
56935 <title>Variable Envelope Return Paths (VERP)</title>
56936 <para>
56937 <indexterm role="concept">
56938 <primary>VERP</primary>
56939 </indexterm>
56940 <indexterm role="concept">
56941 <primary>Variable Envelope Return Paths</primary>
56942 </indexterm>
56943 <indexterm role="concept">
56944 <primary>envelope sender</primary>
56945 </indexterm>
56946 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;
56947 are a way of helping mailing list administrators discover which subscription
56948 address is the cause of a particular delivery failure. The idea is to encode
56949 the original recipient address in the outgoing envelope sender address, so that
56950 if the message is forwarded by another host and then subsequently bounces, the
56951 original recipient can be extracted from the recipient address of the bounce.
56952 </para>
56953 <para>
56954 <indexterm role="option">
56955 <primary><option>errors_to</option></primary>
56956 </indexterm>
56957 <indexterm role="option">
56958 <primary><option>return_path</option></primary>
56959 </indexterm>
56960 Envelope sender addresses can be modified by Exim using two different
56961 facilities: the <option>errors_to</option> option on a router (as shown in previous mailing
56962 list examples), or the <option>return_path</option> option on a transport. The second of
56963 these is effective only if the message is successfully delivered to another
56964 host; it is not used for errors detected on the local host (see the description
56965 of <option>return_path</option> in chapter <xref linkend="CHAPtransportgeneric"/>). Here is an example
56966 of the use of <option>return_path</option> to implement VERP on an <command>smtp</command> transport:
56967 </para>
56968 <literallayout class="monospaced">
56969 verp_smtp:
56970   driver = smtp
56971   max_rcpt = 1
56972   return_path = \
56973     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
56974       {$1-request+$local_part=$domain@your.dom.example}fail}
56975 </literallayout>
56976 <para>
56977 This has the effect of rewriting the return path (envelope sender) on outgoing
56978 SMTP messages, if the local part of the original return path ends in
56979 <quote>-request</quote>, and the domain is <emphasis>your.dom.example</emphasis>. The rewriting inserts the
56980 local part and domain of the recipient into the return path. Suppose, for
56981 example, that a message whose return path has been set to
56982 <emphasis>somelist-request@your.dom.example</emphasis> is sent to
56983 <emphasis>subscriber@other.dom.example</emphasis>. In the transport, the return path is
56984 rewritten as
56985 </para>
56986 <literallayout class="monospaced">
56987 somelist-request+subscriber=other.dom.example@your.dom.example
56988 </literallayout>
56989 <para>
56990 <indexterm role="variable">
56991 <primary><varname>$local_part</varname></primary>
56992 </indexterm>
56993 For this to work, you must tell Exim to send multiple copies of messages that
56994 have more than one recipient, so that each copy has just one recipient. This is
56995 achieved by setting <option>max_rcpt</option> to 1. Without this, a single copy of a message
56996 might be sent to several different recipients in the same domain, in which case
56997 <varname>$local_part</varname> is not available in the transport, because it is not unique.
56998 </para>
56999 <para>
57000 Unless your host is doing nothing but mailing list deliveries, you should
57001 probably use a separate transport for the VERP deliveries, so as not to use
57002 extra resources in making one-per-recipient copies for other deliveries. This
57003 can easily be done by expanding the <option>transport</option> option in the router:
57004 </para>
57005 <literallayout class="monospaced">
57006 dnslookup:
57007   driver = dnslookup
57008   domains = ! +local_domains
57009   transport = \
57010     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
57011       {verp_smtp}{remote_smtp}}
57012   no_more
57013 </literallayout>
57014 <para>
57015 If you want to change the return path using <option>errors_to</option> in a router instead
57016 of using <option>return_path</option> in the transport, you need to set <option>errors_to</option> on all
57017 routers that handle mailing list addresses. This will ensure that all delivery
57018 errors, including those detected on the local host, are sent to the VERP
57019 address.
57020 </para>
57021 <para>
57022 On a host that does no local deliveries and has no manual routing, only the
57023 <command>dnslookup</command> router needs to be changed. A special transport is not needed for
57024 SMTP deliveries. Every mailing list recipient has its own return path value,
57025 and so Exim must hand them to the transport one at a time. Here is an example
57026 of a <command>dnslookup</command> router that implements VERP:
57027 </para>
57028 <literallayout class="monospaced">
57029 verp_dnslookup:
57030   driver = dnslookup
57031   domains = ! +local_domains
57032   transport = remote_smtp
57033   errors_to = \
57034     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}}
57035      {$1-request+$local_part=$domain@your.dom.example}fail}
57036   no_more
57037 </literallayout>
57038 <para>
57039 Before you start sending out messages with VERPed return paths, you must also
57040 configure Exim to accept the bounce messages that come back to those paths.
57041 Typically this is done by setting a <option>local_part_suffix</option> option for a
57042 router, and using this to route the messages to wherever you want to handle
57043 them.
57044 </para>
57045 <para>
57046 The overhead incurred in using VERP depends very much on the size of the
57047 message, the number of recipient addresses that resolve to the same remote
57048 host, and the speed of the connection over which the message is being sent. If
57049 a lot of addresses resolve to the same host and the connection is slow, sending
57050 a separate copy of the message for each address may take substantially longer
57051 than sending a single copy with many recipients (for which VERP cannot be
57052 used).
57053 </para>
57054 </section>
57055 <section id="SECTvirtualdomains">
57056 <title>Virtual domains</title>
57057 <para>
57058 <indexterm role="concept">
57059 <primary>virtual domains</primary>
57060 </indexterm>
57061 <indexterm role="concept">
57062 <primary>domain</primary>
57063 <secondary>virtual</secondary>
57064 </indexterm>
57065 The phrase <emphasis>virtual domain</emphasis> is unfortunately used with two rather different
57066 meanings:
57067 </para>
57068 <itemizedlist>
57069 <listitem>
57070 <para>
57071 A domain for which there are no real mailboxes; all valid local parts are
57072 aliases for other email addresses. Common examples are organizational
57073 top-level domains and <quote>vanity</quote> domains.
57074 </para>
57075 </listitem>
57076 <listitem>
57077 <para>
57078 One of a number of independent domains that are all handled by the same host,
57079 with mailboxes on that host, but where the mailbox owners do not necessarily
57080 have login accounts on that host.
57081 </para>
57082 </listitem>
57083 </itemizedlist>
57084 <para>
57085 The first usage is probably more common, and does seem more <quote>virtual</quote> than
57086 the second. This kind of domain can be handled in Exim with a straightforward
57087 aliasing router. One approach is to create a separate alias file for each
57088 virtual domain. Exim can test for the existence of the alias file to determine
57089 whether the domain exists. The <command>dsearch</command> lookup type is useful here, leading
57090 to a router of this form:
57091 </para>
57092 <literallayout class="monospaced">
57093 virtual:
57094   driver = redirect
57095   domains = dsearch;/etc/mail/virtual
57096   data = ${lookup{$local_part}lsearch{/etc/mail/virtual/$domain}}
57097   no_more
57098 </literallayout>
57099 <para>
57100 The <option>domains</option> option specifies that the router is to be skipped, unless there
57101 is a file in the <filename>/etc/mail/virtual</filename> directory whose name is the same as the
57102 domain that is being processed. When the router runs, it looks up the local
57103 part in the file to find a new address (or list of addresses). The <option>no_more</option>
57104 setting ensures that if the lookup fails (leading to <option>data</option> being an empty
57105 string), Exim gives up on the address without trying any subsequent routers.
57106 </para>
57107 <para>
57108 This one router can handle all the virtual domains because the alias file names
57109 follow a fixed pattern. Permissions can be arranged so that appropriate people
57110 can edit the different alias files. A successful aliasing operation results in
57111 a new envelope recipient address, which is then routed from scratch.
57112 </para>
57113 <para>
57114 The other kind of <quote>virtual</quote> domain can also be handled in a straightforward
57115 way. One approach is to create a file for each domain containing a list of
57116 valid local parts, and use it in a router like this:
57117 </para>
57118 <literallayout class="monospaced">
57119 my_domains:
57120   driver = accept
57121   domains = dsearch;/etc/mail/domains
57122   local_parts = lsearch;/etc/mail/domains/$domain
57123   transport = my_mailboxes
57124 </literallayout>
57125 <para>
57126 The address is accepted if there is a file for the domain, and the local part
57127 can be found in the file. The <option>domains</option> option is used to check for the
57128 file&#x2019;s existence because <option>domains</option> is tested before the <option>local_parts</option>
57129 option (see section <xref linkend="SECTrouprecon"/>). You cannot use <option>require_files</option>,
57130 because that option is tested after <option>local_parts</option>. The transport is as
57131 follows:
57132 </para>
57133 <literallayout class="monospaced">
57134 my_mailboxes:
57135   driver = appendfile
57136   file = /var/mail/$domain/$local_part
57137   user = mail
57138 </literallayout>
57139 <para>
57140 This uses a directory of mailboxes for each domain. The <option>user</option> setting is
57141 required, to specify which uid is to be used for writing to the mailboxes.
57142 </para>
57143 <para>
57144 The configuration shown here is just one example of how you might support this
57145 requirement. There are many other ways this kind of configuration can be set
57146 up, for example, by using a database instead of separate files to hold all the
57147 information about the domains.
57148 </para>
57149 </section>
57150 <section id="SECTmulbox">
57151 <title>Multiple user mailboxes</title>
57152 <para>
57153 <indexterm role="concept">
57154 <primary>multiple mailboxes</primary>
57155 </indexterm>
57156 <indexterm role="concept">
57157 <primary>mailbox</primary>
57158 <secondary>multiple</secondary>
57159 </indexterm>
57160 <indexterm role="concept">
57161 <primary>local part</primary>
57162 <secondary>prefix</secondary>
57163 </indexterm>
57164 <indexterm role="concept">
57165 <primary>local part</primary>
57166 <secondary>suffix</secondary>
57167 </indexterm>
57168 Heavy email users often want to operate with multiple mailboxes, into which
57169 incoming mail is automatically sorted. A popular way of handling this is to
57170 allow users to use multiple sender addresses, so that replies can easily be
57171 identified. Users are permitted to add prefixes or suffixes to their local
57172 parts for this purpose. The wildcard facility of the generic router options
57173 <option>local_part_prefix</option> and <option>local_part_suffix</option> can be used for this. For
57174 example, consider this router:
57175 </para>
57176 <literallayout class="monospaced">
57177 userforward:
57178   driver = redirect
57179   check_local_user
57180   file = $home/.forward
57181   local_part_suffix = -*
57182   local_part_suffix_optional
57183   allow_filter
57184 </literallayout>
57185 <para>
57186 <indexterm role="variable">
57187 <primary><varname>$local_part_suffix</varname></primary>
57188 </indexterm>
57189 It runs a user&#x2019;s <filename>.forward</filename> file for all local parts of the form
57190 <emphasis>username-*</emphasis>. Within the filter file the user can distinguish different
57191 cases by testing the variable <varname>$local_part_suffix</varname>. For example:
57192 </para>
57193 <literallayout class="monospaced">
57194 if $local_part_suffix contains -special then
57195 save /home/$local_part/Mail/special
57196 endif
57197 </literallayout>
57198 <para>
57199 If the filter file does not exist, or does not deal with such addresses, they
57200 fall through to subsequent routers, and, assuming no subsequent use of the
57201 <option>local_part_suffix</option> option is made, they presumably fail. Thus, users have
57202 control over which suffixes are valid.
57203 </para>
57204 <para>
57205 Alternatively, a suffix can be used to trigger the use of a different
57206 <filename>.forward</filename> file &ndash; which is the way a similar facility is implemented in
57207 another MTA:
57208 </para>
57209 <literallayout class="monospaced">
57210 userforward:
57211   driver = redirect
57212   check_local_user
57213   file = $home/.forward$local_part_suffix
57214   local_part_suffix = -*
57215   local_part_suffix_optional
57216   allow_filter
57217 </literallayout>
57218 <para>
57219 If there is no suffix, <filename>.forward</filename> is used; if the suffix is <emphasis>-special</emphasis>, for
57220 example, <filename>.forward-special</filename> is used. Once again, if the appropriate file
57221 does not exist, or does not deal with the address, it is passed on to
57222 subsequent routers, which could, if required, look for an unqualified
57223 <filename>.forward</filename> file to use as a default.
57224 </para>
57225 </section>
57226 <section id="SECID244">
57227 <title>Simplified vacation processing</title>
57228 <para>
57229 <indexterm role="concept">
57230 <primary>vacation processing</primary>
57231 </indexterm>
57232 The traditional way of running the <emphasis>vacation</emphasis> program is for a user to set up
57233 a pipe command in a <filename>.forward</filename> file
57234 (see section <xref linkend="SECTspecitredli"/> for syntax details).
57235 This is prone to error by inexperienced users. There are two features of Exim
57236 that can be used to make this process simpler for users:
57237 </para>
57238 <itemizedlist>
57239 <listitem>
57240 <para>
57241 A local part prefix such as <quote>vacation-</quote> can be specified on a router which
57242 can cause the message to be delivered directly to the <emphasis>vacation</emphasis> program, or
57243 alternatively can use Exim&#x2019;s <command>autoreply</command> transport. The contents of a user&#x2019;s
57244 <filename>.forward</filename> file are then much simpler. For example:
57245 </para>
57246 <literallayout class="monospaced">
57247 spqr, vacation-spqr
57248 </literallayout>
57249 </listitem>
57250 <listitem>
57251 <para>
57252 The <option>require_files</option> generic router option can be used to trigger a
57253 vacation delivery by checking for the existence of a certain file in the
57254 user&#x2019;s home directory. The <option>unseen</option> generic option should also be used, to
57255 ensure that the original delivery also proceeds. In this case, all the user has
57256 to do is to create a file called, say, <filename>.vacation</filename>, containing a vacation
57257 message.
57258 </para>
57259 </listitem>
57260 </itemizedlist>
57261 <para>
57262 Another advantage of both these methods is that they both work even when the
57263 use of arbitrary pipes by users is locked out.
57264 </para>
57265 </section>
57266 <section id="SECID245">
57267 <title>Taking copies of mail</title>
57268 <para>
57269 <indexterm role="concept">
57270 <primary>message</primary>
57271 <secondary>copying every</secondary>
57272 </indexterm>
57273 Some installations have policies that require archive copies of all messages to
57274 be made. A single copy of each message can easily be taken by an appropriate
57275 command in a system filter, which could, for example, use a different file for
57276 each day&#x2019;s messages.
57277 </para>
57278 <para>
57279 There is also a shadow transport mechanism that can be used to take copies of
57280 messages that are successfully delivered by local transports, one copy per
57281 delivery. This could be used, <emphasis>inter alia</emphasis>, to implement automatic
57282 notification of delivery by sites that insist on doing such things.
57283 </para>
57284 </section>
57285 <section id="SECID246">
57286 <title>Intermittently connected hosts</title>
57287 <para>
57288 <indexterm role="concept">
57289 <primary>intermittently connected hosts</primary>
57290 </indexterm>
57291 It has become quite common (because it is cheaper) for hosts to connect to the
57292 Internet periodically rather than remain connected all the time. The normal
57293 arrangement is that mail for such hosts accumulates on a system that is
57294 permanently connected.
57295 </para>
57296 <para>
57297 Exim was designed for use on permanently connected hosts, and so it is not
57298 particularly well-suited to use in an intermittently connected environment.
57299 Nevertheless there are some features that can be used.
57300 </para>
57301 </section>
57302 <section id="SECID247">
57303 <title>Exim on the upstream server host</title>
57304 <para>
57305 It is tempting to arrange for incoming mail for the intermittently connected
57306 host to remain on Exim&#x2019;s queue until the client connects. However, this
57307 approach does not scale very well. Two different kinds of waiting message are
57308 being mixed up in the same queue &ndash; those that cannot be delivered because of
57309 some temporary problem, and those that are waiting for their destination host
57310 to connect. This makes it hard to manage the queue, as well as wasting
57311 resources, because each queue runner scans the entire queue.
57312 </para>
57313 <para>
57314 A better approach is to separate off those messages that are waiting for an
57315 intermittently connected host. This can be done by delivering these messages
57316 into local files in batch SMTP, <quote>mailstore</quote>, or other envelope-preserving
57317 format, from where they are transmitted by other software when their
57318 destination connects. This makes it easy to collect all the mail for one host
57319 in a single directory, and to apply local timeout rules on a per-message basis
57320 if required.
57321 </para>
57322 <para>
57323 On a very small scale, leaving the mail on Exim&#x2019;s queue can be made to work. If
57324 you are doing this, you should configure Exim with a long retry period for the
57325 intermittent host. For example:
57326 </para>
57327 <literallayout class="monospaced">
57328 cheshire.wonderland.fict.example    *   F,5d,24h
57329 </literallayout>
57330 <para>
57331 This stops a lot of failed delivery attempts from occurring, but Exim remembers
57332 which messages it has queued up for that host. Once the intermittent host comes
57333 online, forcing delivery of one message (either by using the <option>-M</option> or <option>-R</option>
57334 options, or by using the ETRN SMTP command (see section <xref linkend="SECTETRN"/>)
57335 causes all the queued up messages to be delivered, often down a single SMTP
57336 connection. While the host remains connected, any new messages get delivered
57337 immediately.
57338 </para>
57339 <para>
57340 If the connecting hosts do not have fixed IP addresses, that is, if a host is
57341 issued with a different IP address each time it connects, Exim&#x2019;s retry
57342 mechanisms on the holding host get confused, because the IP address is normally
57343 used as part of the key string for holding retry information. This can be
57344 avoided by unsetting <option>retry_include_ip_address</option> on the <command>smtp</command> transport.
57345 Since this has disadvantages for permanently connected hosts, it is best to
57346 arrange a separate transport for the intermittently connected ones.
57347 </para>
57348 </section>
57349 <section id="SECID248">
57350 <title>Exim on the intermittently connected client host</title>
57351 <para>
57352 The value of <option>smtp_accept_queue_per_connection</option> should probably be
57353 increased, or even set to zero (that is, disabled) on the intermittently
57354 connected host, so that all incoming messages down a single connection get
57355 delivered immediately.
57356 </para>
57357 <para>
57358 <indexterm role="concept">
57359 <primary>SMTP</primary>
57360 <secondary>passed connection</secondary>
57361 </indexterm>
57362 <indexterm role="concept">
57363 <primary>SMTP</primary>
57364 <secondary>multiple deliveries</secondary>
57365 </indexterm>
57366 <indexterm role="concept">
57367 <primary>multiple SMTP deliveries</primary>
57368 </indexterm>
57369 Mail waiting to be sent from an intermittently connected host will probably
57370 not have been routed, because without a connection DNS lookups are not
57371 possible. This means that if a normal queue run is done at connection time,
57372 each message is likely to be sent in a separate SMTP session. This can be
57373 avoided by starting the queue run with a command line option beginning with
57374 <option>-qq</option> instead of <option>-q</option>. In this case, the queue is scanned twice. In the
57375 first pass, routing is done but no deliveries take place. The second pass is a
57376 normal queue run; since all the messages have been previously routed, those
57377 destined for the same host are likely to get sent as multiple deliveries in a
57378 single SMTP connection.
57379 </para>
57380 </section>
57381 </chapter>
57382
57383 <chapter id="CHAPnonqueueing">
57384 <title>Using Exim as a non-queueing client</title>
57385 <titleabbrev>Exim as a non-queueing client</titleabbrev>
57386 <para>
57387 <indexterm role="concept">
57388 <primary>client, non-queueing</primary>
57389 </indexterm>
57390 <indexterm role="concept">
57391 <primary>smart host</primary>
57392 <secondary>suppressing queueing</secondary>
57393 </indexterm>
57394 On a personal computer, it is a common requirement for all
57395 email to be sent to a <quote>smart host</quote>. There are plenty of MUAs that can be
57396 configured to operate that way, for all the popular operating systems.
57397 However, there are some MUAs for Unix-like systems that cannot be so
57398 configured: they submit messages using the command line interface of
57399 <filename>/usr/sbin/sendmail</filename>. Furthermore, utility programs such as <emphasis>cron</emphasis> submit
57400 messages this way.
57401 </para>
57402 <para>
57403 If the personal computer runs continuously, there is no problem, because it can
57404 run a conventional MTA that handles delivery to the smart host, and deal with
57405 any delays via its queueing mechanism. However, if the computer does not run
57406 continuously or runs different operating systems at different times, queueing
57407 email is not desirable.
57408 </para>
57409 <para>
57410 There is therefore a requirement for something that can provide the
57411 <filename>/usr/sbin/sendmail</filename> interface but deliver messages to a smart host without
57412 any queueing or retrying facilities. Furthermore, the delivery to the smart
57413 host should be synchronous, so that if it fails, the sending MUA is immediately
57414 informed. In other words, we want something that extends an MUA that submits
57415 to a local MTA via the command line so that it behaves like one that submits
57416 to a remote smart host using TCP/SMTP.
57417 </para>
57418 <para>
57419 There are a number of applications (for example, there is one called <emphasis>ssmtp</emphasis>)
57420 that do this job. However, people have found them to be lacking in various
57421 ways. For instance, you might want to allow aliasing and forwarding to be done
57422 before sending a message to the smart host.
57423 </para>
57424 <para>
57425 Exim already had the necessary infrastructure for doing this job. Just a few
57426 tweaks were needed to make it behave as required, though it is somewhat of an
57427 overkill to use a fully-featured MTA for this purpose.
57428 </para>
57429 <para>
57430 <indexterm role="option">
57431 <primary><option>mua_wrapper</option></primary>
57432 </indexterm>
57433 There is a Boolean global option called <option>mua_wrapper</option>, defaulting false.
57434 Setting <option>mua_wrapper</option> true causes Exim to run in a special mode where it
57435 assumes that it is being used to <quote>wrap</quote> a command-line MUA in the manner
57436 just described. As well as setting <option>mua_wrapper</option>, you also need to provide a
57437 compatible router and transport configuration. Typically there will be just one
57438 router and one transport, sending everything to a smart host.
57439 </para>
57440 <para>
57441 When run in MUA wrapping mode, the behaviour of Exim changes in the
57442 following ways:
57443 </para>
57444 <itemizedlist>
57445 <listitem>
57446 <para>
57447 A daemon cannot be run, nor will Exim accept incoming messages from <emphasis>inetd</emphasis>.
57448 In other words, the only way to submit messages is via the command line.
57449 </para>
57450 </listitem>
57451 <listitem>
57452 <para>
57453 Each message is synchronously delivered as soon as it is received (<option>-odi</option> is
57454 assumed). All queueing options (<option>queue_only</option>, <option>queue_smtp_domains</option>,
57455 <option>control</option> in an ACL, etc.) are quietly ignored. The Exim reception process
57456 does not finish until the delivery attempt is complete. If the delivery is
57457 successful, a zero return code is given.
57458 </para>
57459 </listitem>
57460 <listitem>
57461 <para>
57462 Address redirection is permitted, but the final routing for all addresses must
57463 be to the same remote transport, and to the same list of hosts. Furthermore,
57464 the return address (envelope sender) must be the same for all recipients, as
57465 must any added or deleted header lines. In other words, it must be possible to
57466 deliver the message in a single SMTP transaction, however many recipients there
57467 are.
57468 </para>
57469 </listitem>
57470 <listitem>
57471 <para>
57472 If these conditions are not met, or if routing any address results in a
57473 failure or defer status, or if Exim is unable to deliver all the recipients
57474 successfully to one of the smart hosts, delivery of the entire message fails.
57475 </para>
57476 </listitem>
57477 <listitem>
57478 <para>
57479 Because no queueing is allowed, all failures are treated as permanent; there
57480 is no distinction between 4<emphasis>xx</emphasis> and 5<emphasis>xx</emphasis> SMTP response codes from the
57481 smart host. Furthermore, because only a single yes/no response can be given to
57482 the caller, it is not possible to deliver to some recipients and not others. If
57483 there is an error (temporary or permanent) for any recipient, all are failed.
57484 </para>
57485 </listitem>
57486 <listitem>
57487 <para>
57488 If more than one smart host is listed, Exim will try another host after a
57489 connection failure or a timeout, in the normal way. However, if this kind of
57490 failure happens for all the hosts, the delivery fails.
57491 </para>
57492 </listitem>
57493 <listitem>
57494 <para>
57495 When delivery fails, an error message is written to the standard error stream
57496 (as well as to Exim&#x2019;s log), and Exim exits to the caller with a return code
57497 value 1. The message is expunged from Exim&#x2019;s spool files. No bounce messages
57498 are ever generated.
57499 </para>
57500 </listitem>
57501 <listitem>
57502 <para>
57503 No retry data is maintained, and any retry rules are ignored.
57504 </para>
57505 </listitem>
57506 <listitem>
57507 <para>
57508 A number of Exim options are overridden: <option>deliver_drop_privilege</option> is forced
57509 true, <option>max_rcpt</option> in the <command>smtp</command> transport is forced to <quote>unlimited</quote>,
57510 <option>remote_max_parallel</option> is forced to one, and fallback hosts are ignored.
57511 </para>
57512 </listitem>
57513 </itemizedlist>
57514 <para>
57515 The overall effect is that Exim makes a single synchronous attempt to deliver
57516 the message, failing if there is any kind of problem. Because no local
57517 deliveries are done and no daemon can be run, Exim does not need root
57518 privilege. It should be possible to run it setuid to <emphasis>exim</emphasis> instead of setuid
57519 to <emphasis>root</emphasis>. See section <xref linkend="SECTrunexiwitpri"/> for a general discussion about
57520 the advantages and disadvantages of running without root privilege.
57521 </para>
57522 </chapter>
57523
57524 <chapter id="CHAPlog">
57525 <title>Log files</title>
57526 <para>
57527 <indexterm role="concept" id="IIDloggen" class="startofrange">
57528 <primary>log</primary>
57529 <secondary>general description</secondary>
57530 </indexterm>
57531 <indexterm role="concept">
57532 <primary>log</primary>
57533 <secondary>types of</secondary>
57534 </indexterm>
57535 Exim writes three different logs, referred to as the main log, the reject log,
57536 and the panic log:
57537 </para>
57538 <itemizedlist>
57539 <listitem>
57540 <para>
57541 <indexterm role="concept">
57542 <primary>main log</primary>
57543 </indexterm>
57544 The main log records the arrival of each message and each delivery in a single
57545 line in each case. The format is as compact as possible, in an attempt to keep
57546 down the size of log files. Two-character flag sequences make it easy to pick
57547 out these lines. A number of other events are recorded in the main log. Some of
57548 them are optional, in which case the <option>log_selector</option> option controls whether
57549 they are included or not. A Perl script called <emphasis>eximstats</emphasis>, which does simple
57550 analysis of main log files, is provided in the Exim distribution (see section
57551 <xref linkend="SECTmailstat"/>).
57552 </para>
57553 </listitem>
57554 <listitem>
57555 <para>
57556 <indexterm role="concept">
57557 <primary>reject log</primary>
57558 </indexterm>
57559 The reject log records information from messages that are rejected as a result
57560 of a configuration option (that is, for policy reasons).
57561 The first line of each rejection is a copy of the line that is also written to
57562 the main log. Then, if the message&#x2019;s header has been read at the time the log
57563 is written, its contents are written to this log. Only the original header
57564 lines are available; header lines added by ACLs are not logged. You can use the
57565 reject log to check that your policy controls are working correctly; on a busy
57566 host this may be easier than scanning the main log for rejection messages. You
57567 can suppress the writing of the reject log by setting <option>write_rejectlog</option>
57568 false.
57569 </para>
57570 </listitem>
57571 <listitem>
57572 <para>
57573 <indexterm role="concept">
57574 <primary>panic log</primary>
57575 </indexterm>
57576 <indexterm role="concept">
57577 <primary>system log</primary>
57578 </indexterm>
57579 When certain serious errors occur, Exim writes entries to its panic log. If the
57580 error is sufficiently disastrous, Exim bombs out afterwards. Panic log entries
57581 are usually written to the main log as well, but can get lost amid the mass of
57582 other entries. The panic log should be empty under normal circumstances. It is
57583 therefore a good idea to check it (or to have a <emphasis>cron</emphasis> script check it)
57584 regularly, in order to become aware of any problems. When Exim cannot open its
57585 panic log, it tries as a last resort to write to the system log (syslog). This
57586 is opened with LOG_PID+LOG_CONS and the facility code of LOG_MAIL. The
57587 message itself is written at priority LOG_CRIT.
57588 </para>
57589 </listitem>
57590 </itemizedlist>
57591 <para>
57592 Every log line starts with a timestamp, in the format shown in the following
57593 example. Note that many of the examples shown in this chapter are line-wrapped.
57594 In the log file, this would be all on one line:
57595 </para>
57596 <literallayout class="monospaced">
57597 2001-09-16 16:09:47 SMTP connection from [127.0.0.1] closed
57598   by QUIT
57599 </literallayout>
57600 <para>
57601 By default, the timestamps are in the local timezone. There are two
57602 ways of changing this:
57603 </para>
57604 <itemizedlist>
57605 <listitem>
57606 <para>
57607 You can set the <option>timezone</option> option to a different time zone; in particular, if
57608 you set
57609 </para>
57610 <literallayout class="monospaced">
57611 timezone = UTC
57612 </literallayout>
57613 <para>
57614 the timestamps will be in UTC (aka GMT).
57615 </para>
57616 </listitem>
57617 <listitem>
57618 <para>
57619 If you set <option>log_timezone</option> true, the time zone is added to the timestamp, for
57620 example:
57621 </para>
57622 <literallayout class="monospaced">
57623 2003-04-25 11:17:07 +0100 Start queue run: pid=12762
57624 </literallayout>
57625 </listitem>
57626 </itemizedlist>
57627 <para>
57628 <indexterm role="concept">
57629 <primary>log</primary>
57630 <secondary>process ids in</secondary>
57631 </indexterm>
57632 <indexterm role="concept">
57633 <primary>pid (process id)</primary>
57634 <secondary>in log lines</secondary>
57635 </indexterm>
57636 Exim does not include its process id in log lines by default, but you can
57637 request that it does so by specifying the <literal>pid</literal> log selector (see section
57638 <xref linkend="SECTlogselector"/>). When this is set, the process id is output, in square
57639 brackets, immediately after the time and date.
57640 </para>
57641 <section id="SECTwhelogwri">
57642 <title>Where the logs are written</title>
57643 <para>
57644 <indexterm role="concept">
57645 <primary>log</primary>
57646 <secondary>destination</secondary>
57647 </indexterm>
57648 <indexterm role="concept">
57649 <primary>log</primary>
57650 <secondary>to file</secondary>
57651 </indexterm>
57652 <indexterm role="concept">
57653 <primary>log</primary>
57654 <secondary>to syslog</secondary>
57655 </indexterm>
57656 <indexterm role="concept">
57657 <primary>syslog</primary>
57658 </indexterm>
57659 The logs may be written to local files, or to syslog, or both. However, it
57660 should be noted that many syslog implementations use UDP as a transport, and
57661 are therefore unreliable in the sense that messages are not guaranteed to
57662 arrive at the loghost, nor is the ordering of messages necessarily maintained.
57663 It has also been reported that on large log files (tens of megabytes) you may
57664 need to tweak syslog to prevent it syncing the file with each write &ndash; on
57665 Linux this has been seen to make syslog take 90% plus of CPU time.
57666 </para>
57667 <para>
57668 The destination for Exim&#x2019;s logs is configured by setting LOG_FILE_PATH in
57669 <filename>Local/Makefile</filename> or by setting <option>log_file_path</option> in the run time
57670 configuration. This latter string is expanded, so it can contain, for example,
57671 references to the host name:
57672 </para>
57673 <literallayout class="monospaced">
57674 log_file_path = /var/log/$primary_hostname/exim_%slog
57675 </literallayout>
57676 <para>
57677 It is generally advisable, however, to set the string in <filename>Local/Makefile</filename>
57678 rather than at run time, because then the setting is available right from the
57679 start of Exim&#x2019;s execution. Otherwise, if there&#x2019;s something it wants to log
57680 before it has read the configuration file (for example, an error in the
57681 configuration file) it will not use the path you want, and may not be able to
57682 log at all.
57683 </para>
57684 <para>
57685 The value of LOG_FILE_PATH or <option>log_file_path</option> is a colon-separated
57686 list, currently limited to at most two items. This is one option where the
57687 facility for changing a list separator may not be used. The list must always be
57688 colon-separated. If an item in the list is <quote>syslog</quote> then syslog is used;
57689 otherwise the item must either be an absolute path, containing <literal>%s</literal> at the
57690 point where <quote>main</quote>, <quote>reject</quote>, or <quote>panic</quote> is to be inserted, or be empty,
57691 implying the use of a default path.
57692 </para>
57693 <para>
57694 When Exim encounters an empty item in the list, it searches the list defined by
57695 LOG_FILE_PATH, and uses the first item it finds that is neither empty nor
57696 <quote>syslog</quote>. This means that an empty item in <option>log_file_path</option> can be used to
57697 mean <quote>use the path specified at build time</quote>. It no such item exists, log
57698 files are written in the <filename>log</filename> subdirectory of the spool directory. This is
57699 equivalent to the setting:
57700 </para>
57701 <literallayout class="monospaced">
57702 log_file_path = $spool_directory/log/%slog
57703 </literallayout>
57704 <para>
57705 If you do not specify anything at build time or run time, that is where the
57706 logs are written.
57707 </para>
57708 <para>
57709 A log file path may also contain <literal>%D</literal> if datestamped log file names are in
57710 use &ndash; see section <xref linkend="SECTdatlogfil"/> below.
57711 </para>
57712 <para>
57713 Here are some examples of possible settings:
57714 </para>
57715 <literallayout>
57716 <literal>LOG_FILE_PATH=syslog                    </literal> syslog only
57717 <literal>LOG_FILE_PATH=:syslog                   </literal> syslog and default path
57718 <literal>LOG_FILE_PATH=syslog : /usr/log/exim_%s </literal> syslog and specified path
57719 <literal>LOG_FILE_PATH=/usr/log/exim_%s          </literal> specified path only
57720 </literallayout>
57721 <para>
57722 If there are more than two paths in the list, the first is used and a panic
57723 error is logged.
57724 </para>
57725 </section>
57726 <section id="SECID285">
57727 <title>Logging to local files that are periodically <quote>cycled</quote></title>
57728 <para>
57729 <indexterm role="concept">
57730 <primary>log</primary>
57731 <secondary>cycling local files</secondary>
57732 </indexterm>
57733 <indexterm role="concept">
57734 <primary>cycling logs</primary>
57735 </indexterm>
57736 <indexterm role="concept">
57737 <primary><emphasis>exicyclog</emphasis></primary>
57738 </indexterm>
57739 <indexterm role="concept">
57740 <primary>log</primary>
57741 <secondary>local files; writing to</secondary>
57742 </indexterm>
57743 Some operating systems provide centralized and standardized methods for cycling
57744 log files. For those that do not, a utility script called <emphasis>exicyclog</emphasis> is
57745 provided (see section <xref linkend="SECTcyclogfil"/>). This renames and compresses the
57746 main and reject logs each time it is called. The maximum number of old logs to
57747 keep can be set. It is suggested this script is run as a daily <emphasis>cron</emphasis> job.
57748 </para>
57749 <para>
57750 An Exim delivery process opens the main log when it first needs to write to it,
57751 and it keeps the file open in case subsequent entries are required &ndash; for
57752 example, if a number of different deliveries are being done for the same
57753 message. However, remote SMTP deliveries can take a long time, and this means
57754 that the file may be kept open long after it is renamed if <emphasis>exicyclog</emphasis> or
57755 something similar is being used to rename log files on a regular basis. To
57756 ensure that a switch of log files is noticed as soon as possible, Exim calls
57757 <function>stat()</function> on the main log&#x2019;s name before reusing an open file, and if the file
57758 does not exist, or its inode has changed, the old file is closed and Exim
57759 tries to open the main log from scratch. Thus, an old log file may remain open
57760 for quite some time, but no Exim processes should write to it once it has been
57761 renamed.
57762 </para>
57763 </section>
57764 <section id="SECTdatlogfil">
57765 <title>Datestamped log files</title>
57766 <para>
57767 <indexterm role="concept">
57768 <primary>log</primary>
57769 <secondary>datestamped files</secondary>
57770 </indexterm>
57771 Instead of cycling the main and reject log files by renaming them
57772 periodically, some sites like to use files whose names contain a datestamp,
57773 for example, <filename>mainlog-20031225</filename>. The datestamp is in the form <filename>yyyymmdd</filename>.
57774 Exim has support for this way of working. It is enabled by setting the
57775 <option>log_file_path</option> option to a path that includes <literal>%D</literal> at the point where the
57776 datestamp is required. For example:
57777 </para>
57778 <literallayout class="monospaced">
57779 log_file_path = /var/spool/exim/log/%slog-%D
57780 log_file_path = /var/log/exim-%s-%D.log
57781 log_file_path = /var/spool/exim/log/%D-%slog
57782 </literallayout>
57783 <para>
57784 As before, <literal>%s</literal> is replaced by <quote>main</quote> or <quote>reject</quote>; the following are
57785 examples of names generated by the above examples:
57786 </para>
57787 <literallayout class="monospaced">
57788 /var/spool/exim/log/mainlog-20021225
57789 /var/log/exim-reject-20021225.log
57790 /var/spool/exim/log/20021225-mainlog
57791 </literallayout>
57792 <para>
57793 When this form of log file is specified, Exim automatically switches to new
57794 files at midnight. It does not make any attempt to compress old logs; you
57795 will need to write your own script if you require this. You should not
57796 run <emphasis>exicyclog</emphasis> with this form of logging.
57797 </para>
57798 <para>
57799 The location of the panic log is also determined by <option>log_file_path</option>, but it
57800 is not datestamped, because rotation of the panic log does not make sense.
57801 When generating the name of the panic log, <literal>%D</literal> is removed from the string.
57802 In addition, if it immediately follows a slash, a following non-alphanumeric
57803 character is removed; otherwise a preceding non-alphanumeric character is
57804 removed. Thus, the three examples above would give these panic log names:
57805 </para>
57806 <literallayout class="monospaced">
57807 /var/spool/exim/log/paniclog
57808 /var/log/exim-panic.log
57809 /var/spool/exim/log/paniclog
57810 </literallayout>
57811 </section>
57812 <section id="SECID249">
57813 <title>Logging to syslog</title>
57814 <para>
57815 <indexterm role="concept">
57816 <primary>log</primary>
57817 <secondary>syslog; writing to</secondary>
57818 </indexterm>
57819 The use of syslog does not change what Exim logs or the format of its messages,
57820 except in one respect. If <option>syslog_timestamp</option> is set false, the timestamps on
57821 Exim&#x2019;s log lines are omitted when these lines are sent to syslog. Apart from
57822 that, the same strings are written to syslog as to log files. The syslog
57823 <quote>facility</quote> is set to LOG_MAIL, and the program name to <quote>exim</quote>
57824 by default, but you can change these by setting the <option>syslog_facility</option> and
57825 <option>syslog_processname</option> options, respectively. If Exim was compiled with
57826 SYSLOG_LOG_PID set in <filename>Local/Makefile</filename> (this is the default in
57827 <filename>src/EDITME</filename>), then, on systems that permit it (all except ULTRIX), the
57828 LOG_PID flag is set so that the <function>syslog()</function> call adds the pid as well as
57829 the time and host name to each line.
57830 The three log streams are mapped onto syslog priorities as follows:
57831 </para>
57832 <itemizedlist>
57833 <listitem>
57834 <para>
57835 <emphasis>mainlog</emphasis> is mapped to LOG_INFO
57836 </para>
57837 </listitem>
57838 <listitem>
57839 <para>
57840 <emphasis>rejectlog</emphasis> is mapped to LOG_NOTICE
57841 </para>
57842 </listitem>
57843 <listitem>
57844 <para>
57845 <emphasis>paniclog</emphasis> is mapped to LOG_ALERT
57846 </para>
57847 </listitem>
57848 </itemizedlist>
57849 <para>
57850 Many log lines are written to both <emphasis>mainlog</emphasis> and <emphasis>rejectlog</emphasis>, and some are
57851 written to both <emphasis>mainlog</emphasis> and <emphasis>paniclog</emphasis>, so there will be duplicates if
57852 these are routed by syslog to the same place. You can suppress this duplication
57853 by setting <option>syslog_duplication</option> false.
57854 </para>
57855 <para>
57856 Exim&#x2019;s log lines can sometimes be very long, and some of its <emphasis>rejectlog</emphasis>
57857 entries contain multiple lines when headers are included. To cope with both
57858 these cases, entries written to syslog are split into separate <function>syslog()</function>
57859 calls at each internal newline, and also after a maximum of
57860 870 data characters. (This allows for a total syslog line length of 1024, when
57861 additions such as timestamps are added.) If you are running a syslog
57862 replacement that can handle lines longer than the 1024 characters allowed by
57863 RFC 3164, you should set
57864 </para>
57865 <literallayout class="monospaced">
57866 SYSLOG_LONG_LINES=yes
57867 </literallayout>
57868 <para>
57869 in <filename>Local/Makefile</filename> before building Exim. That stops Exim from splitting long
57870 lines, but it still splits at internal newlines in <emphasis>reject</emphasis> log entries.
57871 </para>
57872 <para>
57873 To make it easy to re-assemble split lines later, each component of a split
57874 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;]
57875 where &lt;<emphasis>n</emphasis>&gt; is the component number and &lt;<emphasis>m</emphasis>&gt; is the total number of
57876 components in the entry. The / delimiter is used when the line was split
57877 because it was too long; if it was split because of an internal newline, the \
57878 delimiter is used. For example, supposing the length limit to be 50 instead of
57879 870, the following would be the result of a typical rejection message to
57880 <emphasis>mainlog</emphasis> (LOG_INFO), each line in addition being preceded by the time, host
57881 name, and pid as added by syslog:
57882 </para>
57883 <literallayout class="monospaced">
57884 [1/5] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected from
57885 [2/5]  [127.0.0.1] (ph10): syntax error in 'From' header
57886 [3/5]  when scanning for sender: missing or malformed lo
57887 [4/5] cal part in "&lt;&gt;" (envelope sender is &lt;ph10@cam.exa
57888 [5/5] mple&gt;)
57889 </literallayout>
57890 <para>
57891 The same error might cause the following lines to be written to <quote>rejectlog</quote>
57892 (LOG_NOTICE):
57893 </para>
57894 <literallayout class="monospaced">
57895 [1/18] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected fro
57896 [2/18] m [127.0.0.1] (ph10): syntax error in 'From' head
57897 [3/18] er when scanning for sender: missing or malformed
57898 [4/18]  local part in "&lt;&gt;" (envelope sender is &lt;ph10@cam
57899 [5\18] .example&gt;)
57900 [6\18] Recipients: ph10@some.domain.cam.example
57901 [7\18] P Received: from [127.0.0.1] (ident=ph10)
57902 [8\18]        by xxxxx.cam.example with smtp (Exim 4.00)
57903 [9\18]        id 16RdAL-0006pc-00
57904 [10/18]        for ph10@cam.example; Mon, 16 Sep 2002 16:
57905 [11\18] 09:43 +0100
57906 [12\18] F From: &lt;&gt;
57907 [13\18]   Subject: this is a test header
57908 [18\18]   X-something: this is another header
57909 [15/18] I Message-Id: &lt;E16RdAL-0006pc-00@xxxxx.cam.examp
57910 [16\18] le&gt;
57911 [17\18] B Bcc:
57912 [18/18]   Date: Mon, 16 Sep 2002 16:09:43 +0100
57913 </literallayout>
57914 <para>
57915 Log lines that are neither too long nor contain newlines are written to syslog
57916 without modification.
57917 </para>
57918 <para>
57919 If only syslog is being used, the Exim monitor is unable to provide a log tail
57920 display, unless syslog is routing <emphasis>mainlog</emphasis> to a file on the local host and
57921 the environment variable EXIMON_LOG_FILE_PATH is set to tell the monitor
57922 where it is.
57923 </para>
57924 </section>
57925 <section id="SECID250">
57926 <title>Log line flags</title>
57927 <para>
57928 One line is written to the main log for each message received, and for each
57929 successful, unsuccessful, and delayed delivery. These lines can readily be
57930 picked out by the distinctive two-character flags that immediately follow the
57931 timestamp. The flags are:
57932 </para>
57933 <literallayout>
57934 <literal>&lt;=</literal>     message arrival
57935 <literal>=&gt;</literal>     normal message delivery
57936 <literal>-&gt;</literal>     additional address in same delivery
57937 <literal>*&gt;</literal>     delivery suppressed by <option>-N</option>
57938 <literal>**</literal>     delivery failed; address bounced
57939 <literal>==</literal>     delivery deferred; temporary problem
57940 </literallayout>
57941 </section>
57942 <section id="SECID251">
57943 <title>Logging message reception</title>
57944 <para>
57945 <indexterm role="concept">
57946 <primary>log</primary>
57947 <secondary>reception line</secondary>
57948 </indexterm>
57949 The format of the single-line entry in the main log that is written for every
57950 message received is shown in the basic example below, which is split over
57951 several lines in order to fit it on the page:
57952 </para>
57953 <literallayout class="monospaced">
57954 2002-10-31 08:57:53 16ZCW1-0005MB-00 &lt;= kryten@dwarf.fict.example
57955   H=mailer.fict.example [192.168.123.123] U=exim
57956   P=smtp S=5678 id=&lt;incoming message id&gt;
57957 </literallayout>
57958 <para>
57959 The address immediately following <quote>&lt;=</quote> is the envelope sender address. A
57960 bounce message is shown with the sender address <quote>&lt;&gt;</quote>, and if it is locally
57961 generated, this is followed by an item of the form
57962 </para>
57963 <literallayout class="monospaced">
57964 R=&lt;message id&gt;
57965 </literallayout>
57966 <para>
57967 which is a reference to the message that caused the bounce to be sent.
57968 </para>
57969 <para>
57970 <indexterm role="concept">
57971 <primary>HELO</primary>
57972 </indexterm>
57973 <indexterm role="concept">
57974 <primary>EHLO</primary>
57975 </indexterm>
57976 For messages from other hosts, the H and U fields identify the remote host and
57977 record the RFC 1413 identity of the user that sent the message, if one was
57978 received. The number given in square brackets is the IP address of the sending
57979 host. If there is a single, unparenthesized  host name in the H field, as
57980 above, it has been verified to correspond to the IP address (see the
57981 <option>host_lookup</option> option). If the name is in parentheses, it was the name quoted
57982 by the remote host in the SMTP HELO or EHLO command, and has not been
57983 verified. If verification yields a different name to that given for HELO or
57984 EHLO, the verified name appears first, followed by the HELO or EHLO
57985 name in parentheses.
57986 </para>
57987 <para>
57988 Misconfigured hosts (and mail forgers) sometimes put an IP address, with or
57989 without brackets, in the HELO or EHLO command, leading to entries in
57990 the log containing text like these examples:
57991 </para>
57992 <literallayout class="monospaced">
57993 H=(10.21.32.43) [192.168.8.34]
57994 H=([10.21.32.43]) [192.168.8.34]
57995 </literallayout>
57996 <para>
57997 This can be confusing. Only the final address in square brackets can be relied
57998 on.
57999 </para>
58000 <para>
58001 For locally generated messages (that is, messages not received over TCP/IP),
58002 the H field is omitted, and the U field contains the login name of the caller
58003 of Exim.
58004 </para>
58005 <para>
58006 <indexterm role="concept">
58007 <primary>authentication</primary>
58008 <secondary>logging</secondary>
58009 </indexterm>
58010 <indexterm role="concept">
58011 <primary>AUTH</primary>
58012 <secondary>logging</secondary>
58013 </indexterm>
58014 For all messages, the P field specifies the protocol used to receive the
58015 message. This is the value that is stored in <varname>$received_protocol</varname>. In the case
58016 of incoming SMTP messages, the value indicates whether or not any SMTP
58017 extensions (ESMTP), encryption, or authentication were used. If the SMTP
58018 session was encrypted, there is an additional X field that records the cipher
58019 suite that was used.
58020 </para>
58021 <para>
58022 The protocol is set to <quote>esmtpsa</quote> or <quote>esmtpa</quote> for messages received from
58023 hosts that have authenticated themselves using the SMTP AUTH command. The first
58024 value is used when the SMTP connection was encrypted (<quote>secure</quote>). In this case
58025 there is an additional item A= followed by the name of the authenticator that
58026 was used. If an authenticated identification was set up by the authenticator&#x2019;s
58027 <option>server_set_id</option> option, this is logged too, separated by a colon from the
58028 authenticator name.
58029 </para>
58030 <para>
58031 <indexterm role="concept">
58032 <primary>size</primary>
58033 <secondary>of message</secondary>
58034 </indexterm>
58035 The id field records the existing message id, if present. The size of the
58036 received message is given by the S field. When the message is delivered,
58037 headers may be removed or added, so that the size of delivered copies of the
58038 message may not correspond with this value (and indeed may be different to each
58039 other).
58040 </para>
58041 <para>
58042 The <option>log_selector</option> option can be used to request the logging of additional
58043 data when a message is received. See section <xref linkend="SECTlogselector"/> below.
58044 </para>
58045 </section>
58046 <section id="SECID252">
58047 <title>Logging deliveries</title>
58048 <para>
58049 <indexterm role="concept">
58050 <primary>log</primary>
58051 <secondary>delivery line</secondary>
58052 </indexterm>
58053 The format of the single-line entry in the main log that is written for every
58054 delivery is shown in one of the examples below, for local and remote
58055 deliveries, respectively. Each example has been split into two lines in order
58056 to fit it on the page:
58057 </para>
58058 <literallayout class="monospaced">
58059 2002-10-31 08:59:13 16ZCW1-0005MB-00 =&gt; marv
58060   &lt;marv@hitch.fict.example&gt; R=localuser T=local_delivery
58061 2002-10-31 09:00:10 16ZCW1-0005MB-00 =&gt;
58062   monk@holistic.fict.example R=dnslookup T=remote_smtp
58063   H=holistic.fict.example [192.168.234.234]
58064 </literallayout>
58065 <para>
58066 For ordinary local deliveries, the original address is given in angle brackets
58067 after the final delivery address, which might be a pipe or a file. If
58068 intermediate address(es) exist between the original and the final address, the
58069 last of these is given in parentheses after the final address. The R and T
58070 fields record the router and transport that were used to process the address.
58071 </para>
58072 <para>
58073 If a shadow transport was run after a successful local delivery, the log line
58074 for the successful delivery has an item added on the end, of the form
58075 </para>
58076 <literallayout>
58077 <literal>ST=&lt;</literal><emphasis>shadow transport name</emphasis><literal>&gt;</literal>
58078 </literallayout>
58079 <para>
58080 If the shadow transport did not succeed, the error message is put in
58081 parentheses afterwards.
58082 </para>
58083 <para>
58084 <indexterm role="concept">
58085 <primary>asterisk</primary>
58086 <secondary>after IP address</secondary>
58087 </indexterm>
58088 When more than one address is included in a single delivery (for example, two
58089 SMTP RCPT commands in one transaction) the second and subsequent addresses are
58090 flagged with <literal>-&gt;</literal> instead of <literal>=&gt;</literal>. When two or more messages are delivered
58091 down a single SMTP connection, an asterisk follows the IP address in the log
58092 lines for the second and subsequent messages.
58093 </para>
58094 <para>
58095 The generation of a reply message by a filter file gets logged as a
58096 <quote>delivery</quote> to the addressee, preceded by <quote>&gt;</quote>.
58097 </para>
58098 <para>
58099 The <option>log_selector</option> option can be used to request the logging of additional
58100 data when a message is delivered. See section <xref linkend="SECTlogselector"/> below.
58101 </para>
58102 </section>
58103 <section id="SECID253">
58104 <title>Discarded deliveries</title>
58105 <para>
58106 <indexterm role="concept">
58107 <primary>discarded messages</primary>
58108 </indexterm>
58109 <indexterm role="concept">
58110 <primary>message</primary>
58111 <secondary>discarded</secondary>
58112 </indexterm>
58113 <indexterm role="concept">
58114 <primary>delivery</primary>
58115 <secondary>discarded; logging</secondary>
58116 </indexterm>
58117 When a message is discarded as a result of the command <quote>seen finish</quote> being
58118 obeyed in a filter file which generates no deliveries, a log entry of the form
58119 </para>
58120 <literallayout class="monospaced">
58121 2002-12-10 00:50:49 16auJc-0001UB-00 =&gt; discarded
58122   &lt;low.club@bridge.example&gt; R=userforward
58123 </literallayout>
58124 <para>
58125 is written, to record why no deliveries are logged. When a message is discarded
58126 because it is aliased to <quote>:blackhole:</quote> the log line is like this:
58127 </para>
58128 <literallayout class="monospaced">
58129 1999-03-02 09:44:33 10HmaX-0005vi-00 =&gt; :blackhole:
58130   &lt;hole@nowhere.example&gt; R=blackhole_router
58131 </literallayout>
58132 </section>
58133 <section id="SECID254">
58134 <title>Deferred deliveries</title>
58135 <para>
58136 When a delivery is deferred, a line of the following form is logged:
58137 </para>
58138 <literallayout class="monospaced">
58139 2002-12-19 16:20:23 16aiQz-0002Q5-00 == marvin@endrest.example
58140   R=dnslookup T=smtp defer (146): Connection refused
58141 </literallayout>
58142 <para>
58143 In the case of remote deliveries, the error is the one that was given for the
58144 last IP address that was tried. Details of individual SMTP failures are also
58145 written to the log, so the above line would be preceded by something like
58146 </para>
58147 <literallayout class="monospaced">
58148 2002-12-19 16:20:23 16aiQz-0002Q5-00 Failed to connect to
58149   mail1.endrest.example [192.168.239.239]: Connection refused
58150 </literallayout>
58151 <para>
58152 When a deferred address is skipped because its retry time has not been reached,
58153 a message is written to the log, but this can be suppressed by setting an
58154 appropriate value in <option>log_selector</option>.
58155 </para>
58156 </section>
58157 <section id="SECID255">
58158 <title>Delivery failures</title>
58159 <para>
58160 <indexterm role="concept">
58161 <primary>delivery</primary>
58162 <secondary>failure; logging</secondary>
58163 </indexterm>
58164 If a delivery fails because an address cannot be routed, a line of the
58165 following form is logged:
58166 </para>
58167 <literallayout class="monospaced">
58168 1995-12-19 16:20:23 0tRiQz-0002Q5-00 ** jim@trek99.example
58169   &lt;jim@trek99.example&gt;: unknown mail domain
58170 </literallayout>
58171 <para>
58172 If a delivery fails at transport time, the router and transport are shown, and
58173 the response from the remote host is included, as in this example:
58174 </para>
58175 <literallayout class="monospaced">
58176 2002-07-11 07:14:17 17SXDU-000189-00 ** ace400@pb.example
58177   R=dnslookup T=remote_smtp: SMTP error from remote mailer
58178   after pipelined RCPT TO:&lt;ace400@pb.example&gt;: host
58179   pbmail3.py.example [192.168.63.111]: 553 5.3.0
58180   &lt;ace400@pb.example&gt;...Addressee unknown
58181 </literallayout>
58182 <para>
58183 The word <quote>pipelined</quote> indicates that the SMTP PIPELINING extension was being
58184 used. See <option>hosts_avoid_esmtp</option> in the <command>smtp</command> transport for a way of
58185 disabling PIPELINING. The log lines for all forms of delivery failure are
58186 flagged with <literal>**</literal>.
58187 </para>
58188 </section>
58189 <section id="SECID256">
58190 <title>Fake deliveries</title>
58191 <para>
58192 <indexterm role="concept">
58193 <primary>delivery</primary>
58194 <secondary>fake; logging</secondary>
58195 </indexterm>
58196 If a delivery does not actually take place because the <option>-N</option> option has been
58197 used to suppress it, a normal delivery line is written to the log, except that
58198 <quote>=&gt;</quote> is replaced by <quote>*&gt;</quote>.
58199 </para>
58200 </section>
58201 <section id="SECID257">
58202 <title>Completion</title>
58203 <para>
58204 A line of the form
58205 </para>
58206 <literallayout class="monospaced">
58207 2002-10-31 09:00:11 16ZCW1-0005MB-00 Completed
58208 </literallayout>
58209 <para>
58210 is written to the main log when a message is about to be removed from the spool
58211 at the end of its processing.
58212 </para>
58213 </section>
58214 <section id="SECID258">
58215 <title>Summary of Fields in Log Lines</title>
58216 <para>
58217 <indexterm role="concept">
58218 <primary>log</primary>
58219 <secondary>summary of fields</secondary>
58220 </indexterm>
58221 A summary of the field identifiers that are used in log lines is shown in
58222 the following table:
58223 </para>
58224 <literallayout>
58225 <literal>A   </literal>        authenticator name (and optional id)
58226 <literal>C   </literal>        SMTP confirmation on delivery
58227 <literal>    </literal>        command list for <quote>no mail in SMTP session</quote>
58228 <literal>CV  </literal>        certificate verification status
58229 <literal>D   </literal>        duration of <quote>no mail in SMTP session</quote>
58230 <literal>DN  </literal>        distinguished name from peer certificate
58231 <literal>DT  </literal>        on <literal>=&gt;</literal> lines: time taken for a delivery
58232 <literal>F   </literal>        sender address (on delivery lines)
58233 <literal>H   </literal>        host name and IP address
58234 <literal>I   </literal>        local interface used
58235 <literal>id  </literal>        message id for incoming message
58236 <literal>P   </literal>        on <literal>&lt;=</literal> lines: protocol used
58237 <literal>    </literal>        on <literal>=&gt;</literal> and <literal>**</literal> lines: return path
58238 <literal>QT  </literal>        on <literal>=&gt;</literal> lines: time spent on queue so far
58239 <literal>    </literal>        on <quote>Completed</quote> lines: time spent on queue
58240 <literal>R   </literal>        on <literal>&lt;=</literal> lines: reference for local bounce
58241 <literal>    </literal>        on <literal>=&gt;</literal>  <literal>**</literal> and <literal>==</literal> lines: router name
58242 <literal>S   </literal>        size of message
58243 <literal>ST  </literal>        shadow transport name
58244 <literal>T   </literal>        on <literal>&lt;=</literal> lines: message subject (topic)
58245 <literal>    </literal>        on <literal>=&gt;</literal> <literal>**</literal> and <literal>==</literal> lines: transport name
58246 <literal>U   </literal>        local user or RFC 1413 identity
58247 <literal>X   </literal>        TLS cipher suite
58248 </literallayout>
58249 </section>
58250 <section id="SECID259">
58251 <title>Other log entries</title>
58252 <para>
58253 Various other types of log entry are written from time to time. Most should be
58254 self-explanatory. Among the more common are:
58255 </para>
58256 <itemizedlist>
58257 <listitem>
58258 <para>
58259 <indexterm role="concept">
58260 <primary>retry</primary>
58261 <secondary>time not reached</secondary>
58262 </indexterm>
58263 <emphasis>retry time not reached</emphasis>&nbsp;&nbsp;An address previously suffered a temporary error
58264 during routing or local delivery, and the time to retry has not yet arrived.
58265 This message is not written to an individual message log file unless it happens
58266 during the first delivery attempt.
58267 </para>
58268 </listitem>
58269 <listitem>
58270 <para>
58271 <emphasis>retry time not reached for any host</emphasis>&nbsp;&nbsp;An address previously suffered
58272 temporary errors during remote delivery, and the retry time has not yet arrived
58273 for any of the hosts to which it is routed.
58274 </para>
58275 </listitem>
58276 <listitem>
58277 <para>
58278 <indexterm role="concept">
58279 <primary>spool directory</primary>
58280 <secondary>file locked</secondary>
58281 </indexterm>
58282 <emphasis>spool file locked</emphasis>&nbsp;&nbsp;An attempt to deliver a message cannot proceed because
58283 some other Exim process is already working on the message. This can be quite
58284 common if queue running processes are started at frequent intervals. The
58285 <emphasis>exiwhat</emphasis> utility script can be used to find out what Exim processes are
58286 doing.
58287 </para>
58288 </listitem>
58289 <listitem>
58290 <para>
58291 <indexterm role="concept">
58292 <primary>error</primary>
58293 <secondary>ignored</secondary>
58294 </indexterm>
58295 <emphasis>error ignored</emphasis>&nbsp;&nbsp;There are several circumstances that give rise to this
58296 message:
58297 </para>
58298 <orderedlist numeration="arabic">
58299 <listitem>
58300 <para>
58301 Exim failed to deliver a bounce message whose age was greater than
58302 <option>ignore_bounce_errors_after</option>. The bounce was discarded.
58303 </para>
58304 </listitem>
58305 <listitem>
58306 <para>
58307 A filter file set up a delivery using the <quote>noerror</quote> option, and the delivery
58308 failed. The delivery was discarded.
58309 </para>
58310 </listitem>
58311 <listitem>
58312 <para>
58313 A delivery set up by a router configured with
58314 </para>
58315 <literallayout class="monospaced">
58316     errors_to = &lt;&gt;
58317 </literallayout>
58318 <para>
58319 failed. The delivery was discarded.
58320 </para>
58321 </listitem>
58322 </orderedlist>
58323 </listitem>
58324 </itemizedlist>
58325 </section>
58326 <section id="SECTlogselector">
58327 <title>Reducing or increasing what is logged</title>
58328 <para>
58329 <indexterm role="concept">
58330 <primary>log</primary>
58331 <secondary>selectors</secondary>
58332 </indexterm>
58333 By setting the <option>log_selector</option> global option, you can disable some of Exim&#x2019;s
58334 default logging, or you can request additional logging. The value of
58335 <option>log_selector</option> is made up of names preceded by plus or minus characters. For
58336 example:
58337 </para>
58338 <literallayout class="monospaced">
58339 log_selector = +arguments -retry_defer
58340 </literallayout>
58341 <para>
58342 The list of optional log items is in the following table, with the default
58343 selection marked by asterisks:
58344 </para>
58345 <literallayout>
58346 <literal>*acl_warn_skipped           </literal>  skipped <option>warn</option> statement in ACL
58347 <literal> address_rewrite            </literal>  address rewriting
58348 <literal> all_parents                </literal>  all parents in =&gt; lines
58349 <literal> arguments                  </literal>  command line arguments
58350 <literal>*connection_reject          </literal>  connection rejections
58351 <literal>*delay_delivery             </literal>  immediate delivery delayed
58352 <literal> deliver_time               </literal>  time taken to perform delivery
58353 <literal> delivery_size              </literal>  add <literal>S=</literal><emphasis>nnn</emphasis> to =&gt; lines
58354 <literal>*dnslist_defer              </literal>  defers of DNS list (aka RBL) lookups
58355 <literal>*etrn                       </literal>  ETRN commands
58356 <literal>*host_lookup_failed         </literal>  as it says
58357 <literal> ident_timeout              </literal>  timeout for ident connection
58358 <literal> incoming_interface         </literal>  incoming interface on &lt;= lines
58359 <literal> incoming_port              </literal>  incoming port on &lt;= lines
58360 <literal>*lost_incoming_connection   </literal>  as it says (includes timeouts)
58361 <literal> outgoing_port              </literal>  add remote port to =&gt; lines
58362 <literal>*queue_run                  </literal>  start and end queue runs
58363 <literal> queue_time                 </literal>  time on queue for one recipient
58364 <literal> queue_time_overall         </literal>  time on queue for whole message
58365 <literal> pid                        </literal>  Exim process id
58366 <literal> received_recipients        </literal>  recipients on &lt;= lines
58367 <literal> received_sender            </literal>  sender on &lt;= lines
58368 <literal>*rejected_header            </literal>  header contents on reject log
58369 <literal>*retry_defer                </literal>  <quote>retry time not reached</quote>
58370 <literal> return_path_on_delivery    </literal>  put return path on =&gt; and ** lines
58371 <literal> sender_on_delivery         </literal>  add sender to =&gt; lines
58372 <literal>*sender_verify_fail         </literal>  sender verification failures
58373 <literal>*size_reject                </literal>  rejection because too big
58374 <literal>*skip_delivery              </literal>  delivery skipped in a queue run
58375 <literal> smtp_confirmation          </literal>  SMTP confirmation on =&gt; lines
58376 <literal> smtp_connection            </literal>  SMTP connections
58377 <literal> smtp_incomplete_transaction</literal>  incomplete SMTP transactions
58378 <literal> smtp_no_mail               </literal>  session with no MAIL commands
58379 <literal> smtp_protocol_error        </literal>  SMTP protocol errors
58380 <literal> smtp_syntax_error          </literal>  SMTP syntax errors
58381 <literal> subject                    </literal>  contents of <emphasis>Subject:</emphasis> on &lt;= lines
58382 <literal> tls_certificate_verified   </literal>  certificate verification status
58383 <literal>*tls_cipher                 </literal>  TLS cipher suite on &lt;= and =&gt; lines
58384 <literal> tls_peerdn                 </literal>  TLS peer DN on &lt;= and =&gt; lines
58385 <literal> unknown_in_list            </literal>  DNS lookup failed in list match
58386
58387 <literal> all                        </literal>  all of the above
58388 </literallayout>
58389 <para>
58390 More details on each of these items follows:
58391 </para>
58392 <itemizedlist>
58393 <listitem>
58394 <para>
58395 <indexterm role="concept">
58396 <primary><option>warn</option> ACL verb</primary>
58397 <secondary>log when skipping</secondary>
58398 </indexterm>
58399 <option>acl_warn_skipped</option>: When an ACL <option>warn</option> statement is skipped because one of
58400 its conditions cannot be evaluated, a log line to this effect is written if
58401 this log selector is set.
58402 </para>
58403 </listitem>
58404 <listitem>
58405 <para>
58406 <indexterm role="concept">
58407 <primary>log</primary>
58408 <secondary>rewriting</secondary>
58409 </indexterm>
58410 <indexterm role="concept">
58411 <primary>rewriting</primary>
58412 <secondary>logging</secondary>
58413 </indexterm>
58414 <option>address_rewrite</option>: This applies both to global rewrites and per-transport
58415 rewrites, but not to rewrites in filters run as an unprivileged user (because
58416 such users cannot access the log).
58417 </para>
58418 </listitem>
58419 <listitem>
58420 <para>
58421 <indexterm role="concept">
58422 <primary>log</primary>
58423 <secondary>full parentage</secondary>
58424 </indexterm>
58425 <option>all_parents</option>: Normally only the original and final addresses are logged on
58426 delivery lines; with this selector, intermediate parents are given in
58427 parentheses between them.
58428 </para>
58429 </listitem>
58430 <listitem>
58431 <para>
58432 <indexterm role="concept">
58433 <primary>log</primary>
58434 <secondary>Exim arguments</secondary>
58435 </indexterm>
58436 <indexterm role="concept">
58437 <primary>Exim arguments, logging</primary>
58438 </indexterm>
58439 <option>arguments</option>: This causes Exim to write the arguments with which it was called
58440 to the main log, preceded by the current working directory. This is a debugging
58441 feature, added to make it easier to find out how certain MUAs call
58442 <filename>/usr/sbin/sendmail</filename>. The logging does not happen if Exim has given up root
58443 privilege because it was called with the <option>-C</option> or <option>-D</option> options. Arguments
58444 that are empty or that contain white space are quoted. Non-printing characters
58445 are shown as escape sequences. This facility cannot log unrecognized arguments,
58446 because the arguments are checked before the configuration file is read. The
58447 only way to log such cases is to interpose a script such as <filename>util/logargs.sh</filename>
58448 between the caller and Exim.
58449 </para>
58450 </listitem>
58451 <listitem>
58452 <para>
58453 <indexterm role="concept">
58454 <primary>log</primary>
58455 <secondary>connection rejections</secondary>
58456 </indexterm>
58457 <option>connection_reject</option>: A log entry is written whenever an incoming SMTP
58458 connection is rejected, for whatever reason.
58459 </para>
58460 </listitem>
58461 <listitem>
58462 <para>
58463 <indexterm role="concept">
58464 <primary>log</primary>
58465 <secondary>delayed delivery</secondary>
58466 </indexterm>
58467 <indexterm role="concept">
58468 <primary>delayed delivery, logging</primary>
58469 </indexterm>
58470 <option>delay_delivery</option>: A log entry is written whenever a delivery process is not
58471 started for an incoming message because the load is too high or too many
58472 messages were received on one connection. Logging does not occur if no delivery
58473 process is started because <option>queue_only</option> is set or <option>-odq</option> was used.
58474 </para>
58475 </listitem>
58476 <listitem>
58477 <para>
58478 <indexterm role="concept">
58479 <primary>log</primary>
58480 <secondary>delivery duration</secondary>
58481 </indexterm>
58482 <option>deliver_time</option>: For each delivery, the amount of real time it has taken to
58483 perform the actual delivery is logged as DT=&lt;<emphasis>time</emphasis>&gt;, for example, <literal>DT=1s</literal>.
58484 </para>
58485 </listitem>
58486 <listitem>
58487 <para>
58488 <indexterm role="concept">
58489 <primary>log</primary>
58490 <secondary>message size on delivery</secondary>
58491 </indexterm>
58492 <indexterm role="concept">
58493 <primary>size</primary>
58494 <secondary>of message</secondary>
58495 </indexterm>
58496 <option>delivery_size</option>: For each delivery, the size of message delivered is added to
58497 the <quote>=&gt;</quote> line, tagged with S=.
58498 </para>
58499 </listitem>
58500 <listitem>
58501 <para>
58502 <indexterm role="concept">
58503 <primary>log</primary>
58504 <secondary>dnslist defer</secondary>
58505 </indexterm>
58506 <indexterm role="concept">
58507 <primary>DNS list</primary>
58508 <secondary>logging defer</secondary>
58509 </indexterm>
58510 <indexterm role="concept">
58511 <primary>black list (DNS)</primary>
58512 </indexterm>
58513 <option>dnslist_defer</option>: A log entry is written if an attempt to look up a host in a
58514 DNS black list suffers a temporary error.
58515 </para>
58516 </listitem>
58517 <listitem>
58518 <para>
58519 <indexterm role="concept">
58520 <primary>log</primary>
58521 <secondary>ETRN commands</secondary>
58522 </indexterm>
58523 <indexterm role="concept">
58524 <primary>ETRN</primary>
58525 <secondary>logging</secondary>
58526 </indexterm>
58527 <option>etrn</option>: Every valid ETRN command that is received is logged, before the ACL
58528 is run to determine whether or not it is actually accepted. An invalid ETRN
58529 command, or one received within a message transaction is not logged by this
58530 selector (see <option>smtp_syntax_error</option> and <option>smtp_protocol_error</option>).
58531 </para>
58532 </listitem>
58533 <listitem>
58534 <para>
58535 <indexterm role="concept">
58536 <primary>log</primary>
58537 <secondary>host lookup failure</secondary>
58538 </indexterm>
58539 <option>host_lookup_failed</option>: When a lookup of a host&#x2019;s IP addresses fails to find
58540 any addresses, or when a lookup of an IP address fails to find a host name, a
58541 log line is written. This logging does not apply to direct DNS lookups when
58542 routing email addresses, but it does apply to <quote>byname</quote> lookups.
58543 </para>
58544 </listitem>
58545 <listitem>
58546 <para>
58547 <indexterm role="concept">
58548 <primary>log</primary>
58549 <secondary>ident timeout</secondary>
58550 </indexterm>
58551 <indexterm role="concept">
58552 <primary>RFC 1413</primary>
58553 <secondary>logging timeout</secondary>
58554 </indexterm>
58555 <option>ident_timeout</option>: A log line is written whenever an attempt to connect to a
58556 client&#x2019;s ident port times out.
58557 </para>
58558 </listitem>
58559 <listitem>
58560 <para>
58561 <indexterm role="concept">
58562 <primary>log</primary>
58563 <secondary>incoming interface</secondary>
58564 </indexterm>
58565 <indexterm role="concept">
58566 <primary>interface</primary>
58567 <secondary>logging</secondary>
58568 </indexterm>
58569 <option>incoming_interface</option>: The interface on which a message was received is added
58570 to the <quote>&lt;=</quote> line as an IP address in square brackets, tagged by I= and
58571 followed by a colon and the port number. The local interface and port are also
58572 added to other SMTP log lines, for example <quote>SMTP connection from</quote>, and to
58573 rejection lines.
58574 </para>
58575 </listitem>
58576 <listitem>
58577 <para>
58578 <indexterm role="concept">
58579 <primary>log</primary>
58580 <secondary>incoming remote port</secondary>
58581 </indexterm>
58582 <indexterm role="concept">
58583 <primary>port</primary>
58584 <secondary>logging remote</secondary>
58585 </indexterm>
58586 <indexterm role="concept">
58587 <primary>TCP/IP</primary>
58588 <secondary>logging incoming remote port</secondary>
58589 </indexterm>
58590 <indexterm role="variable">
58591 <primary><varname>$sender_fullhost</varname></primary>
58592 </indexterm>
58593 <indexterm role="variable">
58594 <primary><varname>$sender_rcvhost</varname></primary>
58595 </indexterm>
58596 <option>incoming_port</option>: The remote port number from which a message was received is
58597 added to log entries and <emphasis>Received:</emphasis> header lines, following the IP address
58598 in square brackets, and separated from it by a colon. This is implemented by
58599 changing the value that is put in the <varname>$sender_fullhost</varname> and
58600 <varname>$sender_rcvhost</varname> variables. Recording the remote port number has become more
58601 important with the widening use of NAT (see RFC 2505).
58602 </para>
58603 </listitem>
58604 <listitem>
58605 <para>
58606 <indexterm role="concept">
58607 <primary>log</primary>
58608 <secondary>dropped connection</secondary>
58609 </indexterm>
58610 <option>lost_incoming_connection</option>: A log line is written when an incoming SMTP
58611 connection is unexpectedly dropped.
58612 </para>
58613 </listitem>
58614 <listitem>
58615 <para>
58616 <indexterm role="concept">
58617 <primary>log</primary>
58618 <secondary>outgoing remote port</secondary>
58619 </indexterm>
58620 <indexterm role="concept">
58621 <primary>port</primary>
58622 <secondary>logging outgoint remote</secondary>
58623 </indexterm>
58624 <indexterm role="concept">
58625 <primary>TCP/IP</primary>
58626 <secondary>logging ougtoing remote port</secondary>
58627 </indexterm>
58628 <option>outgoing_port</option>: The remote port number is added to delivery log lines (those
58629 containing =&gt; tags) following the IP address. This option is not included in
58630 the default setting, because for most ordinary configurations, the remote port
58631 number is always 25 (the SMTP port).
58632 </para>
58633 </listitem>
58634 <listitem>
58635 <para>
58636 <indexterm role="concept">
58637 <primary>log</primary>
58638 <secondary>process ids in</secondary>
58639 </indexterm>
58640 <indexterm role="concept">
58641 <primary>pid (process id)</primary>
58642 <secondary>in log lines</secondary>
58643 </indexterm>
58644 <option>pid</option>: The current process id is added to every log line, in square brackets,
58645 immediately after the time and date.
58646 </para>
58647 </listitem>
58648 <listitem>
58649 <para>
58650 <indexterm role="concept">
58651 <primary>log</primary>
58652 <secondary>queue run</secondary>
58653 </indexterm>
58654 <indexterm role="concept">
58655 <primary>queue runner</primary>
58656 <secondary>logging</secondary>
58657 </indexterm>
58658 <option>queue_run</option>: The start and end of every queue run are logged.
58659 </para>
58660 </listitem>
58661 <listitem>
58662 <para>
58663 <indexterm role="concept">
58664 <primary>log</primary>
58665 <secondary>queue time</secondary>
58666 </indexterm>
58667 <option>queue_time</option>: The amount of time the message has been in the queue on the
58668 local host is logged as QT=&lt;<emphasis>time</emphasis>&gt; on delivery (<literal>=&gt;</literal>) lines, for example,
58669 <literal>QT=3m45s</literal>. The clock starts when Exim starts to receive the message, so it
58670 includes reception time as well as the delivery time for the current address.
58671 This means that it may be longer than the difference between the arrival and
58672 delivery log line times, because the arrival log line is not written until the
58673 message has been successfully received.
58674 </para>
58675 </listitem>
58676 <listitem>
58677 <para>
58678 <option>queue_time_overall</option>: The amount of time the message has been in the queue on
58679 the local host is logged as QT=&lt;<emphasis>time</emphasis>&gt; on <quote>Completed</quote> lines, for
58680 example, <literal>QT=3m45s</literal>. The clock starts when Exim starts to receive the
58681 message, so it includes reception time as well as the total delivery time.
58682 </para>
58683 </listitem>
58684 <listitem>
58685 <para>
58686 <indexterm role="concept">
58687 <primary>log</primary>
58688 <secondary>recipients</secondary>
58689 </indexterm>
58690 <option>received_recipients</option>: The recipients of a message are listed in the main log
58691 as soon as the message is received. The list appears at the end of the log line
58692 that is written when a message is received, preceded by the word <quote>for</quote>. The
58693 addresses are listed after they have been qualified, but before any rewriting
58694 has taken place.
58695 Recipients that were discarded by an ACL for MAIL or RCPT do not appear
58696 in the list.
58697 </para>
58698 </listitem>
58699 <listitem>
58700 <para>
58701 <indexterm role="concept">
58702 <primary>log</primary>
58703 <secondary>sender reception</secondary>
58704 </indexterm>
58705 <option>received_sender</option>: The unrewritten original sender of a message is added to
58706 the end of the log line that records the message&#x2019;s arrival, after the word
58707 <quote>from</quote> (before the recipients if <option>received_recipients</option> is also set).
58708 </para>
58709 </listitem>
58710 <listitem>
58711 <para>
58712 <indexterm role="concept">
58713 <primary>log</primary>
58714 <secondary>header lines for rejection</secondary>
58715 </indexterm>
58716 <option>rejected_header</option>: If a message&#x2019;s header has been received at the time a
58717 rejection is written to the reject log, the complete header is added to the
58718 log. Header logging can be turned off individually for messages that are
58719 rejected by the <function>local_scan()</function> function (see section <xref linkend="SECTapiforloc"/>).
58720 </para>
58721 </listitem>
58722 <listitem>
58723 <para>
58724 <indexterm role="concept">
58725 <primary>log</primary>
58726 <secondary>retry defer</secondary>
58727 </indexterm>
58728 <option>retry_defer</option>: A log line is written if a delivery is deferred because a
58729 retry time has not yet been reached. However, this <quote>retry time not reached</quote>
58730 message is always omitted from individual message logs after the first delivery
58731 attempt.
58732 </para>
58733 </listitem>
58734 <listitem>
58735 <para>
58736 <indexterm role="concept">
58737 <primary>log</primary>
58738 <secondary>return path</secondary>
58739 </indexterm>
58740 <option>return_path_on_delivery</option>: The return path that is being transmitted with
58741 the message is included in delivery and bounce lines, using the tag P=.
58742 This is omitted if no delivery actually happens, for example, if routing fails,
58743 or if delivery is to <filename>/dev/null</filename> or to <literal>:blackhole:</literal>.
58744 </para>
58745 </listitem>
58746 <listitem>
58747 <para>
58748 <indexterm role="concept">
58749 <primary>log</primary>
58750 <secondary>sender on delivery</secondary>
58751 </indexterm>
58752 <option>sender_on_delivery</option>: The message&#x2019;s sender address is added to every delivery
58753 and bounce line, tagged by F= (for <quote>from</quote>).
58754 This is the original sender that was received with the message; it is not
58755 necessarily the same as the outgoing return path.
58756 </para>
58757 </listitem>
58758 <listitem>
58759 <para>
58760 <indexterm role="concept">
58761 <primary>log</primary>
58762 <secondary>sender verify failure</secondary>
58763 </indexterm>
58764 <option>sender_verify_fail</option>: If this selector is unset, the separate log line that
58765 gives details of a sender verification failure is not written. Log lines for
58766 the rejection of SMTP commands contain just <quote>sender verify failed</quote>, so some
58767 detail is lost.
58768 </para>
58769 </listitem>
58770 <listitem>
58771 <para>
58772 <indexterm role="concept">
58773 <primary>log</primary>
58774 <secondary>size rejection</secondary>
58775 </indexterm>
58776 <option>size_reject</option>: A log line is written whenever a message is rejected because
58777 it is too big.
58778 </para>
58779 </listitem>
58780 <listitem>
58781 <para>
58782 <indexterm role="concept">
58783 <primary>log</primary>
58784 <secondary>frozen messages; skipped</secondary>
58785 </indexterm>
58786 <indexterm role="concept">
58787 <primary>frozen messages</primary>
58788 <secondary>logging skipping</secondary>
58789 </indexterm>
58790 <option>skip_delivery</option>: A log line is written whenever a message is skipped during a
58791 queue run because it is frozen or because another process is already delivering
58792 it.
58793 <indexterm role="concept">
58794 <primary><quote>spool file is locked</quote></primary>
58795 </indexterm>
58796 The message that is written is <quote>spool file is locked</quote>.
58797 </para>
58798 </listitem>
58799 <listitem>
58800 <para>
58801 <indexterm role="concept">
58802 <primary>log</primary>
58803 <secondary>smtp confirmation</secondary>
58804 </indexterm>
58805 <indexterm role="concept">
58806 <primary>SMTP</primary>
58807 <secondary>logging confirmation</secondary>
58808 </indexterm>
58809 <option>smtp_confirmation</option>: The response to the final <quote>.</quote> in the SMTP dialogue for
58810 outgoing messages is added to delivery log lines in the form <literal>C=</literal>&lt;<emphasis>text</emphasis>&gt;.
58811 A number of MTAs (including Exim) return an identifying string in this
58812 response.
58813 </para>
58814 </listitem>
58815 <listitem>
58816 <para>
58817 <indexterm role="concept">
58818 <primary>log</primary>
58819 <secondary>SMTP connections</secondary>
58820 </indexterm>
58821 <indexterm role="concept">
58822 <primary>SMTP</primary>
58823 <secondary>logging connections</secondary>
58824 </indexterm>
58825 <option>smtp_connection</option>: A log line is written whenever an SMTP connection is
58826 established or closed, unless the connection is from a host that matches
58827 <option>hosts_connection_nolog</option>. (In contrast, <option>lost_incoming_connection</option> applies
58828 only when the closure is unexpected.) This applies to connections from local
58829 processes that use <option>-bs</option> as well as to TCP/IP connections. If a connection is
58830 dropped in the middle of a message, a log line is always written, whether or
58831 not this selector is set, but otherwise nothing is written at the start and end
58832 of connections unless this selector is enabled.
58833 </para>
58834 <para>
58835 For TCP/IP connections to an Exim daemon, the current number of connections is
58836 included in the log message for each new connection, but note that the count is
58837 reset if the daemon is restarted.
58838 Also, because connections are closed (and the closure is logged) in
58839 subprocesses, the count may not include connections that have been closed but
58840 whose termination the daemon has not yet noticed. Thus, while it is possible to
58841 match up the opening and closing of connections in the log, the value of the
58842 logged counts may not be entirely accurate.
58843 </para>
58844 </listitem>
58845 <listitem>
58846 <para>
58847 <indexterm role="concept">
58848 <primary>log</primary>
58849 <secondary>SMTP transaction; incomplete</secondary>
58850 </indexterm>
58851 <indexterm role="concept">
58852 <primary>SMTP</primary>
58853 <secondary>logging incomplete transactions</secondary>
58854 </indexterm>
58855 <option>smtp_incomplete_transaction</option>: When a mail transaction is aborted by
58856 RSET, QUIT, loss of connection, or otherwise, the incident is logged,
58857 and the message sender plus any accepted recipients are included in the log
58858 line. This can provide evidence of dictionary attacks.
58859 </para>
58860 </listitem>
58861 <listitem>
58862 <para>
58863 <indexterm role="concept">
58864 <primary>log</primary>
58865 <secondary>non-MAIL SMTP sessions</secondary>
58866 </indexterm>
58867 <indexterm role="concept">
58868 <primary>MAIL</primary>
58869 <secondary>logging session without</secondary>
58870 </indexterm>
58871 <option>smtp_no_mail</option>: A line is written to the main log whenever an accepted SMTP
58872 connection terminates without having issued a MAIL command. This includes both
58873 the case when the connection is dropped, and the case when QUIT is used. It
58874 does not include cases where the connection is rejected right at the start (by
58875 an ACL, or because there are too many connections, or whatever). These cases
58876 already have their own log lines.
58877 </para>
58878 <para>
58879 The log line that is written contains the identity of the client in the usual
58880 way, followed by D= and a time, which records the duration of the connection.
58881 If the connection was authenticated, this fact is logged exactly as it is for
58882 an incoming message, with an A= item. If the connection was encrypted, CV=,
58883 DN=, and X= items may appear as they do for an incoming message, controlled by
58884 the same logging options.
58885 </para>
58886 <para>
58887 Finally, if any SMTP commands were issued during the connection, a C= item
58888 is added to the line, listing the commands that were used. For example,
58889 </para>
58890 <literallayout class="monospaced">
58891 C=EHLO,QUIT
58892 </literallayout>
58893 <para>
58894 shows that the client issued QUIT straight after EHLO. If there were fewer
58895 than 20 commands, they are all listed. If there were more than 20 commands,
58896 the last 20 are listed, preceded by <quote>...</quote>. However, with the default
58897 setting of 10 for <option>smtp_accep_max_nonmail</option>, the connection will in any case
58898 have been aborted before 20 non-mail commands are processed.
58899 </para>
58900 </listitem>
58901 <listitem>
58902 <para>
58903 <indexterm role="concept">
58904 <primary>log</primary>
58905 <secondary>SMTP protocol error</secondary>
58906 </indexterm>
58907 <indexterm role="concept">
58908 <primary>SMTP</primary>
58909 <secondary>logging protocol error</secondary>
58910 </indexterm>
58911 <option>smtp_protocol_error</option>: A log line is written for every SMTP protocol error
58912 encountered. Exim does not have perfect detection of all protocol errors
58913 because of transmission delays and the use of pipelining. If PIPELINING has
58914 been advertised to a client, an Exim server assumes that the client will use
58915 it, and therefore it does not count <quote>expected</quote> errors (for example, RCPT
58916 received after rejecting MAIL) as protocol errors.
58917 </para>
58918 </listitem>
58919 <listitem>
58920 <para>
58921 <indexterm role="concept">
58922 <primary>SMTP</primary>
58923 <secondary>logging syntax errors</secondary>
58924 </indexterm>
58925 <indexterm role="concept">
58926 <primary>SMTP</primary>
58927 <secondary>syntax errors; logging</secondary>
58928 </indexterm>
58929 <indexterm role="concept">
58930 <primary>SMTP</primary>
58931 <secondary>unknown command; logging</secondary>
58932 </indexterm>
58933 <indexterm role="concept">
58934 <primary>log</primary>
58935 <secondary>unknown SMTP command</secondary>
58936 </indexterm>
58937 <indexterm role="concept">
58938 <primary>log</primary>
58939 <secondary>SMTP syntax error</secondary>
58940 </indexterm>
58941 <option>smtp_syntax_error</option>: A log line is written for every SMTP syntax error
58942 encountered. An unrecognized command is treated as a syntax error. For an
58943 external connection, the host identity is given; for an internal connection
58944 using <option>-bs</option> the sender identification (normally the calling user) is given.
58945 </para>
58946 </listitem>
58947 <listitem>
58948 <para>
58949 <indexterm role="concept">
58950 <primary>log</primary>
58951 <secondary>subject</secondary>
58952 </indexterm>
58953 <indexterm role="concept">
58954 <primary>subject, logging</primary>
58955 </indexterm>
58956 <option>subject</option>: The subject of the message is added to the arrival log line,
58957 preceded by <quote>T=</quote> (T for <quote>topic</quote>, since S is already used for <quote>size</quote>).
58958 Any MIME <quote>words</quote> in the subject are decoded. The <option>print_topbitchars</option> option
58959 specifies whether characters with values greater than 127 should be logged
58960 unchanged, or whether they should be rendered as escape sequences.
58961 </para>
58962 </listitem>
58963 <listitem>
58964 <para>
58965 <indexterm role="concept">
58966 <primary>log</primary>
58967 <secondary>certificate verification</secondary>
58968 </indexterm>
58969 <option>tls_certificate_verified</option>: An extra item is added to &lt;= and =&gt; log lines
58970 when TLS is in use. The item is <literal>CV=yes</literal> if the peer&#x2019;s certificate was
58971 verified, and <literal>CV=no</literal> if not.
58972 </para>
58973 </listitem>
58974 <listitem>
58975 <para>
58976 <indexterm role="concept">
58977 <primary>log</primary>
58978 <secondary>TLS cipher</secondary>
58979 </indexterm>
58980 <indexterm role="concept">
58981 <primary>TLS</primary>
58982 <secondary>logging cipher</secondary>
58983 </indexterm>
58984 <option>tls_cipher</option>: When a message is sent or received over an encrypted
58985 connection, the cipher suite used is added to the log line, preceded by X=.
58986 </para>
58987 </listitem>
58988 <listitem>
58989 <para>
58990 <indexterm role="concept">
58991 <primary>log</primary>
58992 <secondary>TLS peer DN</secondary>
58993 </indexterm>
58994 <indexterm role="concept">
58995 <primary>TLS</primary>
58996 <secondary>logging peer DN</secondary>
58997 </indexterm>
58998 <option>tls_peerdn</option>: When a message is sent or received over an encrypted
58999 connection, and a certificate is supplied by the remote host, the peer DN is
59000 added to the log line, preceded by DN=.
59001 </para>
59002 </listitem>
59003 <listitem>
59004 <para>
59005 <indexterm role="concept">
59006 <primary>log</primary>
59007 <secondary>DNS failure in list</secondary>
59008 </indexterm>
59009 <option>unknown_in_list</option>: This setting causes a log entry to be written when the
59010 result of a list match is failure because a DNS lookup failed.
59011 </para>
59012 </listitem>
59013 </itemizedlist>
59014 </section>
59015 <section id="SECID260">
59016 <title>Message log</title>
59017 <para>
59018 <indexterm role="concept">
59019 <primary>message</primary>
59020 <secondary>log file for</secondary>
59021 </indexterm>
59022 <indexterm role="concept">
59023 <primary>log</primary>
59024 <secondary>message log; description of</secondary>
59025 </indexterm>
59026 <indexterm role="concept">
59027 <primary><filename>msglog</filename> directory</primary>
59028 </indexterm>
59029 <indexterm role="option">
59030 <primary><option>preserve_message_logs</option></primary>
59031 </indexterm>
59032 In addition to the general log files, Exim writes a log file for each message
59033 that it handles. The names of these per-message logs are the message ids, and
59034 they are kept in the <filename>msglog</filename> sub-directory of the spool directory. Each
59035 message log contains copies of the log lines that apply to the message. This
59036 makes it easier to inspect the status of an individual message without having
59037 to search the main log. A message log is deleted when processing of the message
59038 is complete, unless <option>preserve_message_logs</option> is set, but this should be used
59039 only with great care because they can fill up your disk very quickly.
59040 </para>
59041 <para>
59042 On a heavily loaded system, it may be desirable to disable the use of
59043 per-message logs, in order to reduce disk I/O. This can be done by setting the
59044 <option>message_logs</option> option false.
59045 <indexterm role="concept" startref="IIDloggen" class="endofrange"/>
59046 </para>
59047 </section>
59048 </chapter>
59049
59050 <chapter id="CHAPutils">
59051 <title>Exim utilities</title>
59052 <para>
59053 <indexterm role="concept" id="IIDutils" class="startofrange">
59054 <primary>utilities</primary>
59055 </indexterm>
59056 A number of utility scripts and programs are supplied with Exim and are
59057 described in this chapter. There is also the Exim Monitor, which is covered in
59058 the next chapter. The utilities described here are:
59059 </para>
59060 <informaltable frame="none">
59061 <tgroup cols="3" colsep="0" rowsep="0">
59062 <colspec colwidth="7*" align="left"/>
59063 <colspec colwidth="15*" align="left"/>
59064 <colspec colwidth="40*" align="left"/>
59065 <tbody>
59066 <row>
59067 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTfinoutwha"/></entry>
59068 <entry><emphasis>exiwhat</emphasis></entry>
59069 <entry>list what Exim processes are doing</entry>
59070 </row>
59071 <row>
59072 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTgreptheque"/></entry>
59073 <entry><emphasis>exiqgrep</emphasis></entry>
59074 <entry>grep the queue</entry>
59075 </row>
59076 <row>
59077 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTsumtheque"/></entry>
59078 <entry><emphasis>exiqsumm</emphasis></entry>
59079 <entry>summarize the queue</entry>
59080 </row>
59081 <row>
59082 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTextspeinf"/></entry>
59083 <entry><emphasis>exigrep</emphasis></entry>
59084 <entry>search the main log</entry>
59085 </row>
59086 <row>
59087 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTexipick"/></entry>
59088 <entry><emphasis>exipick</emphasis></entry>
59089 <entry>select messages on various criteria</entry>
59090 </row>
59091 <row>
59092 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTcyclogfil"/></entry>
59093 <entry><emphasis>exicyclog</emphasis></entry>
59094 <entry>cycle (rotate) log files</entry>
59095 </row>
59096 <row>
59097 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTmailstat"/></entry>
59098 <entry><emphasis>eximstats</emphasis></entry>
59099 <entry>extract statistics from the log</entry>
59100 </row>
59101 <row>
59102 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTcheckaccess"/></entry>
59103 <entry><emphasis>exim_checkaccess</emphasis></entry>
59104 <entry>check address acceptance from given IP</entry>
59105 </row>
59106 <row>
59107 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTdbmbuild"/></entry>
59108 <entry><emphasis>exim_dbmbuild</emphasis></entry>
59109 <entry>build a DBM file</entry>
59110 </row>
59111 <row>
59112 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTfinindret"/></entry>
59113 <entry><emphasis>exinext</emphasis></entry>
59114 <entry>extract retry information</entry>
59115 </row>
59116 <row>
59117 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
59118 <entry><emphasis>exim_dumpdb</emphasis></entry>
59119 <entry>dump a hints database</entry>
59120 </row>
59121 <row>
59122 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
59123 <entry><emphasis>exim_tidydb</emphasis></entry>
59124 <entry>clean up a hints database</entry>
59125 </row>
59126 <row>
59127 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
59128 <entry><emphasis>exim_fixdb</emphasis></entry>
59129 <entry>patch a hints database</entry>
59130 </row>
59131 <row>
59132 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTmailboxmaint"/></entry>
59133 <entry><emphasis>exim_lock</emphasis></entry>
59134 <entry>lock a mailbox file</entry>
59135 </row>
59136 </tbody>
59137 </tgroup>
59138 </informaltable>
59139 <para>
59140 Another utility that might be of use to sites with many MTAs is Tom Kistner&#x2019;s
59141 <emphasis>exilog</emphasis>. It provides log visualizations across multiple Exim servers. See
59142 <emphasis role="bold"><ulink url="http://duncanthrax.net/exilog/">http://duncanthrax.net/exilog/</ulink></emphasis> for details.
59143 </para>
59144 <section id="SECTfinoutwha">
59145 <title>Finding out what Exim processes are doing (exiwhat)</title>
59146 <para>
59147 <indexterm role="concept">
59148 <primary><emphasis>exiwhat</emphasis></primary>
59149 </indexterm>
59150 <indexterm role="concept">
59151 <primary>process, querying</primary>
59152 </indexterm>
59153 <indexterm role="concept">
59154 <primary>SIGUSR1</primary>
59155 </indexterm>
59156 On operating systems that can restart a system call after receiving a signal
59157 (most modern OS), an Exim process responds to the SIGUSR1 signal by writing
59158 a line describing what it is doing to the file <filename>exim-process.info</filename> in the
59159 Exim spool directory. The <emphasis>exiwhat</emphasis> script sends the signal to all Exim
59160 processes it can find, having first emptied the file. It then waits for one
59161 second to allow the Exim processes to react before displaying the results. In
59162 order to run <emphasis>exiwhat</emphasis> successfully you have to have sufficient privilege to
59163 send the signal to the Exim processes, so it is normally run as root.
59164 </para>
59165 <para>
59166 <emphasis role="bold">Warning</emphasis>: This is not an efficient process. It is intended for occasional
59167 use by system administrators. It is not sensible, for example, to set up a
59168 script that sends SIGUSR1 signals to Exim processes at short intervals.
59169 </para>
59170 <para>
59171 Unfortunately, the <emphasis>ps</emphasis> command that <emphasis>exiwhat</emphasis> uses to find Exim processes
59172 varies in different operating systems. Not only are different options used,
59173 but the format of the output is different. For this reason, there are some
59174 system configuration options that configure exactly how <emphasis>exiwhat</emphasis> works. If
59175 it doesn&#x2019;t seem to be working for you, check the following compile-time
59176 options:
59177 </para>
59178 <literallayout>
59179 <literal>EXIWHAT_PS_CMD    </literal> the command for running <emphasis>ps</emphasis>
59180 <literal>EXIWHAT_PS_ARG    </literal> the argument for <emphasis>ps</emphasis>
59181 <literal>EXIWHAT_EGREP_ARG </literal> the argument for <emphasis>egrep</emphasis> to select from <emphasis>ps</emphasis> output
59182 <literal>EXIWHAT_KILL_ARG  </literal> the argument for the <emphasis>kill</emphasis> command
59183 </literallayout>
59184 <para>
59185 An example of typical output from <emphasis>exiwhat</emphasis> is
59186 </para>
59187 <literallayout class="monospaced">
59188 164 daemon: -q1h, listening on port 25
59189 10483 running queue: waiting for 0tAycK-0002ij-00 (10492)
59190 10492 delivering 0tAycK-0002ij-00 to mail.ref.example
59191   [10.19.42.42] (editor@ref.example)
59192 10592 handling incoming call from [192.168.243.242]
59193 10628 accepting a local non-SMTP message
59194 </literallayout>
59195 <para>
59196 The first number in the output line is the process number. The third line has
59197 been split here, in order to fit it on the page.
59198 </para>
59199 </section>
59200 <section id="SECTgreptheque">
59201 <title>Selective queue listing (exiqgrep)</title>
59202 <para>
59203 <indexterm role="concept">
59204 <primary><emphasis>exiqgrep</emphasis></primary>
59205 </indexterm>
59206 <indexterm role="concept">
59207 <primary>queue</primary>
59208 <secondary>grepping</secondary>
59209 </indexterm>
59210 This utility is a Perl script contributed by Matt Hubbard. It runs
59211 </para>
59212 <literallayout class="monospaced">
59213 exim -bpu
59214 </literallayout>
59215 <para>
59216 to obtain a queue listing with undelivered recipients only, and then greps the
59217 output to select messages that match given criteria. The following selection
59218 options are available:
59219 </para>
59220 <variablelist>
59221 <varlistentry>
59222 <term><emphasis role="bold">-f</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
59223 <listitem>
59224 <para>
59225 Match the sender address. The field that is tested is enclosed in angle
59226 brackets, so you can test for bounce messages with
59227 </para>
59228 <literallayout class="monospaced">
59229 exiqgrep -f '^&lt;&gt;$'
59230 </literallayout>
59231 </listitem></varlistentry>
59232 <varlistentry>
59233 <term><emphasis role="bold">-r</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
59234 <listitem>
59235 <para>
59236 Match a recipient address. The field that is tested is not enclosed in angle
59237 brackets.
59238 </para>
59239 </listitem></varlistentry>
59240 <varlistentry>
59241 <term><emphasis role="bold">-s</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
59242 <listitem>
59243 <para>
59244 Match against the size field.
59245 </para>
59246 </listitem></varlistentry>
59247 <varlistentry>
59248 <term><emphasis role="bold">-y</emphasis>&nbsp;&lt;<emphasis>seconds</emphasis>&gt;</term>
59249 <listitem>
59250 <para>
59251 Match messages that are younger than the given time.
59252 </para>
59253 </listitem></varlistentry>
59254 <varlistentry>
59255 <term><emphasis role="bold">-o</emphasis>&nbsp;&lt;<emphasis>seconds</emphasis>&gt;</term>
59256 <listitem>
59257 <para>
59258 Match messages that are older than the given time.
59259 </para>
59260 </listitem></varlistentry>
59261 <varlistentry>
59262 <term><emphasis role="bold">-z</emphasis></term>
59263 <listitem>
59264 <para>
59265 Match only frozen messages.
59266 </para>
59267 </listitem></varlistentry>
59268 <varlistentry>
59269 <term><emphasis role="bold">-x</emphasis></term>
59270 <listitem>
59271 <para>
59272 Match only non-frozen messages.
59273 </para>
59274 </listitem></varlistentry>
59275 </variablelist>
59276 <para>
59277 The following options control the format of the output:
59278 </para>
59279 <variablelist>
59280 <varlistentry>
59281 <term><emphasis role="bold">-c</emphasis></term>
59282 <listitem>
59283 <para>
59284 Display only the count of matching messages.
59285 </para>
59286 </listitem></varlistentry>
59287 <varlistentry>
59288 <term><emphasis role="bold">-l</emphasis></term>
59289 <listitem>
59290 <para>
59291 Long format &ndash; display the full message information as output by Exim. This is
59292 the default.
59293 </para>
59294 </listitem></varlistentry>
59295 <varlistentry>
59296 <term><emphasis role="bold">-i</emphasis></term>
59297 <listitem>
59298 <para>
59299 Display message ids only.
59300 </para>
59301 </listitem></varlistentry>
59302 <varlistentry>
59303 <term><emphasis role="bold">-b</emphasis></term>
59304 <listitem>
59305 <para>
59306 Brief format &ndash; one line per message.
59307 </para>
59308 </listitem></varlistentry>
59309 <varlistentry>
59310 <term><emphasis role="bold">-R</emphasis></term>
59311 <listitem>
59312 <para>
59313 Display messages in reverse order.
59314 </para>
59315 </listitem></varlistentry>
59316 </variablelist>
59317 <para>
59318 There is one more option, <option>-h</option>, which outputs a list of options.
59319 </para>
59320 </section>
59321 <section id="SECTsumtheque">
59322 <title>Summarizing the queue (exiqsumm)</title>
59323 <para>
59324 <indexterm role="concept">
59325 <primary><emphasis>exiqsumm</emphasis></primary>
59326 </indexterm>
59327 <indexterm role="concept">
59328 <primary>queue</primary>
59329 <secondary>summary</secondary>
59330 </indexterm>
59331 The <emphasis>exiqsumm</emphasis> utility is a Perl script which reads the output of <literal>exim
59332 -bp</literal> and produces a summary of the messages on the queue. Thus, you use it by
59333 running a command such as
59334 </para>
59335 <literallayout class="monospaced">
59336 exim -bp | exiqsumm
59337 </literallayout>
59338 <para>
59339 The output consists of one line for each domain that has messages waiting for
59340 it, as in the following example:
59341 </para>
59342 <literallayout class="monospaced">
59343 3   2322   74m   66m  msn.com.example
59344 </literallayout>
59345 <para>
59346 Each line lists the number of pending deliveries for a domain, their total
59347 volume, and the length of time that the oldest and the newest messages have
59348 been waiting. Note that the number of pending deliveries is greater than the
59349 number of messages when messages have more than one recipient.
59350 </para>
59351 <para>
59352 A summary line is output at the end. By default the output is sorted on the
59353 domain name, but <emphasis>exiqsumm</emphasis> has the options <option>-a</option> and <option>-c</option>, which cause
59354 the output to be sorted by oldest message and by count of messages,
59355 respectively. There are also three options that split the messages for each
59356 domain into two or more subcounts: <option>-b</option> separates bounce messages, <option>-f</option>
59357 separates frozen messages, and <option>-s</option> separates messages according to their
59358 sender.
59359 </para>
59360 <para>
59361 The output of <emphasis>exim -bp</emphasis> contains the original addresses in the message, so
59362 this also applies to the output from <emphasis>exiqsumm</emphasis>. No domains from addresses
59363 generated by aliasing or forwarding are included (unless the <option>one_time</option>
59364 option of the <command>redirect</command> router has been used to convert them into <quote>top
59365 level</quote> addresses).
59366 </para>
59367 </section>
59368 <section id="SECTextspeinf">
59369 <title>Extracting specific information from the log (exigrep)</title>
59370 <para>
59371 <indexterm role="concept">
59372 <primary><emphasis>exigrep</emphasis></primary>
59373 </indexterm>
59374 <indexterm role="concept">
59375 <primary>log</primary>
59376 <secondary>extracts; grepping for</secondary>
59377 </indexterm>
59378 The <emphasis>exigrep</emphasis> utility is a Perl script that searches one or more main log
59379 files for entries that match a given pattern. When it finds a match, it
59380 extracts all the log entries for the relevant message, not just those that
59381 match the pattern. Thus, <emphasis>exigrep</emphasis> can extract complete log entries for a
59382 given message, or all mail for a given user, or for a given host, for example.
59383 The input files can be in Exim log format or syslog format.
59384 If a matching log line is not associated with a specific message, it is
59385 included in <emphasis>exigrep</emphasis>&#x2019;s output without any additional lines. The usage is:
59386 </para>
59387 <literallayout>
59388 <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>
59389 </literallayout>
59390 <para>
59391 If no log file names are given on the command line, the standard input is read.
59392 </para>
59393 <para>
59394 The <option>-t</option> argument specifies a number of seconds. It adds an additional
59395 condition for message selection. Messages that are complete are shown only if
59396 they spent more than &lt;<emphasis>n</emphasis>&gt; seconds on the queue.
59397 </para>
59398 <para>
59399 By default, <emphasis>exigrep</emphasis> does case-insensitive matching. The <option>-I</option> option
59400 makes it case-sensitive. This may give a performance improvement when searching
59401 large log files. Without <option>-I</option>, the Perl pattern matches use Perl&#x2019;s <literal>/i</literal>
59402 option; with <option>-I</option> they do not. In both cases it is possible to change the
59403 case sensitivity within the pattern by using <literal>(?i)</literal> or <literal>(?-i)</literal>.
59404 </para>
59405 <para>
59406 The <option>-l</option> option means <quote>literal</quote>, that is, treat all characters in the
59407 pattern as standing for themselves. Otherwise the pattern must be a Perl
59408 regular expression.
59409 </para>
59410 <para>
59411 The <option>-v</option> option inverts the matching condition. That is, a line is selected
59412 if it does <emphasis>not</emphasis> match the pattern.
59413 </para>
59414 <para>
59415 If the location of a <emphasis>zcat</emphasis> command is known from the definition of
59416 ZCAT_COMMAND in <filename>Local/Makefile</filename>, <emphasis>exigrep</emphasis> automatically passes any file
59417 whose name ends in COMPRESS_SUFFIX through <emphasis>zcat</emphasis> as it searches it.
59418 </para>
59419 </section>
59420 <section id="SECTexipick">
59421 <title>Selecting messages by various criteria (exipick)</title>
59422 <para>
59423 <indexterm role="concept">
59424 <primary><emphasis>exipick</emphasis></primary>
59425 </indexterm>
59426 John Jetmore&#x2019;s <emphasis>exipick</emphasis> utility is included in the Exim distribution. It
59427 lists messages from the queue according to a variety of criteria. For details
59428 of <emphasis>exipick</emphasis>&#x2019;s facilities, visit the web page at
59429 <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
59430 the <option>--help</option> option.
59431 </para>
59432 </section>
59433 <section id="SECTcyclogfil">
59434 <title>Cycling log files (exicyclog)</title>
59435 <para>
59436 <indexterm role="concept">
59437 <primary>log</primary>
59438 <secondary>cycling local files</secondary>
59439 </indexterm>
59440 <indexterm role="concept">
59441 <primary>cycling logs</primary>
59442 </indexterm>
59443 <indexterm role="concept">
59444 <primary><emphasis>exicyclog</emphasis></primary>
59445 </indexterm>
59446 The <emphasis>exicyclog</emphasis> script can be used to cycle (rotate) <emphasis>mainlog</emphasis> and
59447 <emphasis>rejectlog</emphasis> files. This is not necessary if only syslog is being used, or if
59448 you are using log files with datestamps in their names (see section
59449 <xref linkend="SECTdatlogfil"/>). Some operating systems have their own standard mechanisms
59450 for log cycling, and these can be used instead of <emphasis>exicyclog</emphasis> if preferred.
59451 There are two command line options for <emphasis>exicyclog</emphasis>:
59452 </para>
59453 <itemizedlist>
59454 <listitem>
59455 <para>
59456 <option>-k</option> &lt;<emphasis>count</emphasis>&gt; specifies the number of log files to keep, overriding the
59457 default that is set when Exim is built. The default default is 10.
59458 </para>
59459 </listitem>
59460 <listitem>
59461 <para>
59462 <option>-l</option> &lt;<emphasis>path</emphasis>&gt; specifies the log file path, in the same format as Exim&#x2019;s
59463 <option>log_file_path</option> option (for example, <literal>/var/log/exim_%slog</literal>), again
59464 overriding the script&#x2019;s default, which is to find the setting from Exim&#x2019;s
59465 configuration.
59466 </para>
59467 </listitem>
59468 </itemizedlist>
59469 <para>
59470 Each time <emphasis>exicyclog</emphasis> is run the file names get <quote>shuffled down</quote> by one. If
59471 the main log file name is <filename>mainlog</filename> (the default) then when <emphasis>exicyclog</emphasis> is
59472 run <filename>mainlog</filename> becomes <filename>mainlog.01</filename>, the previous <filename>mainlog.01</filename> becomes
59473 <filename>mainlog.02</filename> and so on, up to the limit that is set in the script or by the
59474 <option>-k</option> option. Log files whose numbers exceed the limit are discarded. Reject
59475 logs are handled similarly.
59476 </para>
59477 <para>
59478 If the limit is greater than 99, the script uses 3-digit numbers such as
59479 <filename>mainlog.001</filename>, <filename>mainlog.002</filename>, etc. If you change from a number less than 99
59480 to one that is greater, or <emphasis>vice versa</emphasis>, you will have to fix the names of
59481 any existing log files.
59482 </para>
59483 <para>
59484 If no <filename>mainlog</filename> file exists, the script does nothing. Files that <quote>drop off</quote>
59485 the end are deleted. All files with numbers greater than 01 are compressed,
59486 using a compression command which is configured by the COMPRESS_COMMAND
59487 setting in <filename>Local/Makefile</filename>. It is usual to run <emphasis>exicyclog</emphasis> daily from a
59488 root <option>crontab</option> entry of the form
59489 </para>
59490 <literallayout class="monospaced">
59491 1 0 * * * su exim -c /usr/exim/bin/exicyclog
59492 </literallayout>
59493 <para>
59494 assuming you have used the name <quote>exim</quote> for the Exim user. You can run
59495 <emphasis>exicyclog</emphasis> as root if you wish, but there is no need.
59496 </para>
59497 </section>
59498 <section id="SECTmailstat">
59499 <title>Mail statistics (eximstats)</title>
59500 <para>
59501 <indexterm role="concept">
59502 <primary>statistics</primary>
59503 </indexterm>
59504 <indexterm role="concept">
59505 <primary><emphasis>eximstats</emphasis></primary>
59506 </indexterm>
59507 A Perl script called <emphasis>eximstats</emphasis> is provided for extracting statistical
59508 information from log files. The output is either plain text, or HTML.
59509 Exim log files are also supported by the <emphasis>Lire</emphasis> system produced by the
59510 LogReport Foundation <emphasis role="bold"><ulink url="http://www.logreport.org">http://www.logreport.org</ulink></emphasis>.
59511 </para>
59512 <para>
59513 The <emphasis>eximstats</emphasis> script has been hacked about quite a bit over time. The
59514 latest version is the result of some extensive revision by Steve Campbell. A
59515 lot of information is given by default, but there are options for suppressing
59516 various parts of it. Following any options, the arguments to the script are a
59517 list of files, which should be main log files. For example:
59518 </para>
59519 <literallayout class="monospaced">
59520 eximstats -nr /var/spool/exim/log/mainlog.01
59521 </literallayout>
59522 <para>
59523 By default, <emphasis>eximstats</emphasis> extracts information about the number and volume of
59524 messages received from or delivered to various hosts. The information is sorted
59525 both by message count and by volume, and the top fifty hosts in each category
59526 are listed on the standard output. Similar information, based on email
59527 addresses or domains instead of hosts can be requested by means of various
59528 options. For messages delivered and received locally, similar statistics are
59529 also produced per user.
59530 </para>
59531 <para>
59532 The output also includes total counts and statistics about delivery errors, and
59533 histograms showing the number of messages received and deliveries made in each
59534 hour of the day. A delivery with more than one address in its envelope (for
59535 example, an SMTP transaction with more than one RCPT command) is counted
59536 as a single delivery by <emphasis>eximstats</emphasis>.
59537 </para>
59538 <para>
59539 Though normally more deliveries than receipts are reported (as messages may
59540 have multiple recipients), it is possible for <emphasis>eximstats</emphasis> to report more
59541 messages received than delivered, even though the queue is empty at the start
59542 and end of the period in question. If an incoming message contains no valid
59543 recipients, no deliveries are recorded for it. A bounce message is handled as
59544 an entirely separate message.
59545 </para>
59546 <para>
59547 <emphasis>eximstats</emphasis> always outputs a grand total summary giving the volume and number
59548 of messages received and deliveries made, and the number of hosts involved in
59549 each case. It also outputs the number of messages that were delayed (that is,
59550 not completely delivered at the first attempt), and the number that had at
59551 least one address that failed.
59552 </para>
59553 <para>
59554 The remainder of the output is in sections that can be independently disabled
59555 or modified by various options. It consists of a summary of deliveries by
59556 transport, histograms of messages received and delivered per time interval
59557 (default per hour), information about the time messages spent on the queue,
59558 a list of relayed messages, lists of the top fifty sending hosts, local
59559 senders, destination hosts, and destination local users by count and by volume,
59560 and a list of delivery errors that occurred.
59561 </para>
59562 <para>
59563 The relay information lists messages that were actually relayed, that is, they
59564 came from a remote host and were directly delivered to some other remote host,
59565 without being processed (for example, for aliasing or forwarding) locally.
59566 </para>
59567 <para>
59568 There are quite a few options for <emphasis>eximstats</emphasis> to control exactly what it
59569 outputs. These are documented in the Perl script itself, and can be extracted
59570 by running the command <command>perldoc</command> on the script. For example:
59571 </para>
59572 <literallayout class="monospaced">
59573 perldoc /usr/exim/bin/eximstats
59574 </literallayout>
59575 </section>
59576 <section id="SECTcheckaccess">
59577 <title>Checking access policy (exim_checkaccess)</title>
59578 <para>
59579 <indexterm role="concept">
59580 <primary><emphasis>exim_checkaccess</emphasis></primary>
59581 </indexterm>
59582 <indexterm role="concept">
59583 <primary>policy control</primary>
59584 <secondary>checking access</secondary>
59585 </indexterm>
59586 <indexterm role="concept">
59587 <primary>checking access</primary>
59588 </indexterm>
59589 The <option>-bh</option> command line argument allows you to run a fake SMTP session with
59590 debugging output, in order to check what Exim is doing when it is applying
59591 policy controls to incoming SMTP mail. However, not everybody is sufficiently
59592 familiar with the SMTP protocol to be able to make full use of <option>-bh</option>, and
59593 sometimes you just want to answer the question <quote>Does this address have
59594 access?</quote> without bothering with any further details.
59595 </para>
59596 <para>
59597 The <emphasis>exim_checkaccess</emphasis> utility is a <quote>packaged</quote> version of <option>-bh</option>. It takes
59598 two arguments, an IP address and an email address:
59599 </para>
59600 <literallayout class="monospaced">
59601 exim_checkaccess 10.9.8.7 A.User@a.domain.example
59602 </literallayout>
59603 <para>
59604 The utility runs a call to Exim with the <option>-bh</option> option, to test whether the
59605 given email address would be accepted in a RCPT command in a TCP/IP
59606 connection from the host with the given IP address. The output of the utility
59607 is either the word <quote>accepted</quote>, or the SMTP error response, for example:
59608 </para>
59609 <literallayout class="monospaced">
59610 Rejected:
59611 550 Relay not permitted
59612 </literallayout>
59613 <para>
59614 When running this test, the utility uses <literal>&lt;&gt;</literal> as the envelope sender address
59615 for the MAIL command, but you can change this by providing additional
59616 options. These are passed directly to the Exim command. For example, to specify
59617 that the test is to be run with the sender address <emphasis>himself@there.example</emphasis>
59618 you can use:
59619 </para>
59620 <literallayout class="monospaced">
59621 exim_checkaccess 10.9.8.7 A.User@a.domain.example \
59622                  -f himself@there.example
59623 </literallayout>
59624 <para>
59625 Note that these additional Exim command line items must be given after the two
59626 mandatory arguments.
59627 </para>
59628 <para>
59629 Because the <option>exim_checkaccess</option> uses <option>-bh</option>, it does not perform callouts
59630 while running its checks. You can run checks that include callouts by using
59631 <option>-bhc</option>, but this is not yet available in a <quote>packaged</quote> form.
59632 </para>
59633 </section>
59634 <section id="SECTdbmbuild">
59635 <title>Making DBM files (exim_dbmbuild)</title>
59636 <para>
59637 <indexterm role="concept">
59638 <primary>DBM</primary>
59639 <secondary>building dbm files</secondary>
59640 </indexterm>
59641 <indexterm role="concept">
59642 <primary>building DBM files</primary>
59643 </indexterm>
59644 <indexterm role="concept">
59645 <primary><emphasis>exim_dbmbuild</emphasis></primary>
59646 </indexterm>
59647 <indexterm role="concept">
59648 <primary>lower casing</primary>
59649 </indexterm>
59650 <indexterm role="concept">
59651 <primary>binary zero</primary>
59652 <secondary>in lookup key</secondary>
59653 </indexterm>
59654 The <emphasis>exim_dbmbuild</emphasis> program reads an input file containing keys and data in
59655 the format used by the <command>lsearch</command> lookup (see section
59656 <xref linkend="SECTsinglekeylookups"/>). It writes a DBM file using the lower-cased alias
59657 names as keys and the remainder of the information as data. The lower-casing
59658 can be prevented by calling the program with the <option>-nolc</option> option.
59659 </para>
59660 <para>
59661 A terminating zero is included as part of the key string. This is expected by
59662 the <command>dbm</command> lookup type. However, if the option <option>-nozero</option> is given,
59663 <emphasis>exim_dbmbuild</emphasis> creates files without terminating zeroes in either the key
59664 strings or the data strings. The <command>dbmnz</command> lookup type can be used with such
59665 files.
59666 </para>
59667 <para>
59668 The program requires two arguments: the name of the input file (which can be a
59669 single hyphen to indicate the standard input), and the name of the output file.
59670 It creates the output under a temporary name, and then renames it if all went
59671 well.
59672 </para>
59673 <para>
59674 <indexterm role="concept">
59675 <primary>USE_DB</primary>
59676 </indexterm>
59677 If the native DB interface is in use (USE_DB is set in a compile-time
59678 configuration file &ndash; this is common in free versions of Unix) the two file
59679 names must be different, because in this mode the Berkeley DB functions create
59680 a single output file using exactly the name given. For example,
59681 </para>
59682 <literallayout class="monospaced">
59683 exim_dbmbuild /etc/aliases /etc/aliases.db
59684 </literallayout>
59685 <para>
59686 reads the system alias file and creates a DBM version of it in
59687 <filename>/etc/aliases.db</filename>.
59688 </para>
59689 <para>
59690 In systems that use the <emphasis>ndbm</emphasis> routines (mostly proprietary versions of
59691 Unix), two files are used, with the suffixes <filename>.dir</filename> and <filename>.pag</filename>. In this
59692 environment, the suffixes are added to the second argument of
59693 <emphasis>exim_dbmbuild</emphasis>, so it can be the same as the first. This is also the case
59694 when the Berkeley functions are used in compatibility mode (though this is not
59695 recommended), because in that case it adds a <filename>.db</filename> suffix to the file name.
59696 </para>
59697 <para>
59698 If a duplicate key is encountered, the program outputs a warning, and when it
59699 finishes, its return code is 1 rather than zero, unless the <option>-noduperr</option>
59700 option is used. By default, only the first of a set of duplicates is used &ndash;
59701 this makes it compatible with <command>lsearch</command> lookups. There is an option
59702 <option>-lastdup</option> which causes it to use the data for the last duplicate instead.
59703 There is also an option <option>-nowarn</option>, which stops it listing duplicate keys to
59704 <option>stderr</option>. For other errors, where it doesn&#x2019;t actually make a new file, the
59705 return code is 2.
59706 </para>
59707 </section>
59708 <section id="SECTfinindret">
59709 <title>Finding individual retry times (exinext)</title>
59710 <para>
59711 <indexterm role="concept">
59712 <primary>retry</primary>
59713 <secondary>times</secondary>
59714 </indexterm>
59715 <indexterm role="concept">
59716 <primary><emphasis>exinext</emphasis></primary>
59717 </indexterm>
59718 A utility called <emphasis>exinext</emphasis> (mostly a Perl script) provides the ability to
59719 fish specific information out of the retry database. Given a mail domain (or a
59720 complete address), it looks up the hosts for that domain, and outputs any retry
59721 information for the hosts or for the domain. At present, the retry information
59722 is obtained by running <emphasis>exim_dumpdb</emphasis> (see below) and post-processing the
59723 output. For example:
59724 </para>
59725 <literallayout class="monospaced">
59726 $ exinext piglet@milne.fict.example
59727 kanga.milne.example:192.168.8.1 error 146: Connection refused
59728   first failed: 21-Feb-1996 14:57:34
59729   last tried:   21-Feb-1996 14:57:34
59730   next try at:  21-Feb-1996 15:02:34
59731 roo.milne.example:192.168.8.3 error 146: Connection refused
59732   first failed: 20-Jan-1996 13:12:08
59733   last tried:   21-Feb-1996 11:42:03
59734   next try at:  21-Feb-1996 19:42:03
59735   past final cutoff time
59736 </literallayout>
59737 <para>
59738 You can also give <emphasis>exinext</emphasis> a local part, without a domain, and it
59739 will give any retry information for that local part in your default domain.
59740 A message id can be used to obtain retry information pertaining to a specific
59741 message. This exists only when an attempt to deliver a message to a remote host
59742 suffers a message-specific error (see section <xref linkend="SECToutSMTPerr"/>).
59743 <emphasis>exinext</emphasis> is not particularly efficient, but then it is not expected to be
59744 run very often.
59745 </para>
59746 <para>
59747 The <emphasis>exinext</emphasis> utility calls Exim to find out information such as the location
59748 of the spool directory. The utility has <option>-C</option> and <option>-D</option> options, which are
59749 passed on to the <emphasis>exim</emphasis> commands. The first specifies an alternate Exim
59750 configuration file, and the second sets macros for use within the configuration
59751 file. These features are mainly to help in testing, but might also be useful in
59752 environments where more than one configuration file is in use.
59753 </para>
59754 </section>
59755 <section id="SECThindatmai">
59756 <title>Hints database maintenance</title>
59757 <para>
59758 <indexterm role="concept">
59759 <primary>hints database</primary>
59760 <secondary>maintenance</secondary>
59761 </indexterm>
59762 <indexterm role="concept">
59763 <primary>maintaining Exim&#x2019;s hints database</primary>
59764 </indexterm>
59765 Three utility programs are provided for maintaining the DBM files that Exim
59766 uses to contain its delivery hint information. Each program requires two
59767 arguments. The first specifies the name of Exim&#x2019;s spool directory, and the
59768 second is the name of the database it is to operate on. These are as follows:
59769 </para>
59770 <itemizedlist>
59771 <listitem>
59772 <para>
59773 <emphasis>retry</emphasis>: the database of retry information
59774 </para>
59775 </listitem>
59776 <listitem>
59777 <para>
59778 <emphasis>wait-</emphasis>&lt;<emphasis>transport name</emphasis>&gt;: databases of information about messages waiting
59779 for remote hosts
59780 </para>
59781 </listitem>
59782 <listitem>
59783 <para>
59784 <emphasis>callout</emphasis>: the callout cache
59785 </para>
59786 </listitem>
59787 <listitem>
59788 <para>
59789 <emphasis>ratelimit</emphasis>: the data for implementing the ratelimit ACL condition
59790 </para>
59791 </listitem>
59792 <listitem>
59793 <para>
59794 <emphasis>misc</emphasis>: other hints data
59795 </para>
59796 </listitem>
59797 </itemizedlist>
59798 <para>
59799 The <emphasis>misc</emphasis> database is used for
59800 </para>
59801 <itemizedlist>
59802 <listitem>
59803 <para>
59804 Serializing ETRN runs (when <option>smtp_etrn_serialize</option> is set)
59805 </para>
59806 </listitem>
59807 <listitem>
59808 <para>
59809 Serializing delivery to a specific host (when <option>serialize_hosts</option> is set in an
59810 <command>smtp</command> transport)
59811 </para>
59812 </listitem>
59813 </itemizedlist>
59814 </section>
59815 <section id="SECID261">
59816 <title>exim_dumpdb</title>
59817 <para>
59818 <indexterm role="concept">
59819 <primary><emphasis>exim_dumpdb</emphasis></primary>
59820 </indexterm>
59821 The entire contents of a database are written to the standard output by the
59822 <emphasis>exim_dumpdb</emphasis> program, which has no options or arguments other than the
59823 spool and database names. For example, to dump the retry database:
59824 </para>
59825 <literallayout class="monospaced">
59826 exim_dumpdb /var/spool/exim retry
59827 </literallayout>
59828 <para>
59829 Two lines of output are produced for each entry:
59830 </para>
59831 <literallayout class="monospaced">
59832 T:mail.ref.example:192.168.242.242 146 77 Connection refused
59833 31-Oct-1995 12:00:12 02-Nov-1995 12:21:39 02-Nov-1995 20:21:39 *
59834 </literallayout>
59835 <para>
59836 The first item on the first line is the key of the record. It starts with one
59837 of the letters R, or T, depending on whether it refers to a routing or
59838 transport retry. For a local delivery, the next part is the local address; for
59839 a remote delivery it is the name of the remote host, followed by its failing IP
59840 address (unless <option>retry_include_ip_address</option> is set false on the <command>smtp</command>
59841 transport). If the remote port is not the standard one (port 25), it is added
59842 to the IP address. Then there follows an error code, an additional error code,
59843 and a textual description of the error.
59844 </para>
59845 <para>
59846 The three times on the second line are the time of first failure, the time of
59847 the last delivery attempt, and the computed time for the next attempt. The line
59848 ends with an asterisk if the cutoff time for the last retry rule has been
59849 exceeded.
59850 </para>
59851 <para>
59852 Each output line from <emphasis>exim_dumpdb</emphasis> for the <emphasis>wait-xxx</emphasis> databases
59853 consists of a host name followed by a list of ids for messages that are or were
59854 waiting to be delivered to that host. If there are a very large number for any
59855 one host, continuation records, with a sequence number added to the host name,
59856 may be seen. The data in these records is often out of date, because a message
59857 may be routed to several alternative hosts, and Exim makes no effort to keep
59858 cross-references.
59859 </para>
59860 </section>
59861 <section id="SECID262">
59862 <title>exim_tidydb</title>
59863 <para>
59864 <indexterm role="concept">
59865 <primary><emphasis>exim_tidydb</emphasis></primary>
59866 </indexterm>
59867 The <emphasis>exim_tidydb</emphasis> utility program is used to tidy up the contents of a hints
59868 database. If run with no options, it removes all records that are more than 30
59869 days old. The age is calculated from the date and time that the record was last
59870 updated. Note that, in the case of the retry database, it is <emphasis>not</emphasis> the time
59871 since the first delivery failure. Information about a host that has been down
59872 for more than 30 days will remain in the database, provided that the record is
59873 updated sufficiently often.
59874 </para>
59875 <para>
59876 The cutoff date can be altered by means of the <option>-t</option> option, which must be
59877 followed by a time. For example, to remove all records older than a week from
59878 the retry database:
59879 </para>
59880 <literallayout class="monospaced">
59881 exim_tidydb -t 7d /var/spool/exim retry
59882 </literallayout>
59883 <para>
59884 Both the <emphasis>wait-xxx</emphasis> and <emphasis>retry</emphasis> databases contain items that involve
59885 message ids. In the former these appear as data in records keyed by host &ndash;
59886 they were messages that were waiting for that host &ndash; and in the latter they
59887 are the keys for retry information for messages that have suffered certain
59888 types of error. When <emphasis>exim_tidydb</emphasis> is run, a check is made to ensure that
59889 message ids in database records are those of messages that are still on the
59890 queue. Message ids for messages that no longer exist are removed from
59891 <emphasis>wait-xxx</emphasis> records, and if this leaves any records empty, they are deleted.
59892 For the <emphasis>retry</emphasis> database, records whose keys are non-existent message ids are
59893 removed. The <emphasis>exim_tidydb</emphasis> utility outputs comments on the standard output
59894 whenever it removes information from the database.
59895 </para>
59896 <para>
59897 Certain records are automatically removed by Exim when they are no longer
59898 needed, but others are not. For example, if all the MX hosts for a domain are
59899 down, a retry record is created for each one. If the primary MX host comes back
59900 first, its record is removed when Exim successfully delivers to it, but the
59901 records for the others remain because Exim has not tried to use those hosts.
59902 </para>
59903 <para>
59904 It is important, therefore, to run <emphasis>exim_tidydb</emphasis> periodically on all the
59905 hints databases. You should do this at a quiet time of day, because it requires
59906 a database to be locked (and therefore inaccessible to Exim) while it does its
59907 work. Removing records from a DBM file does not normally make the file smaller,
59908 but all the common DBM libraries are able to re-use the space that is released.
59909 After an initial phase of increasing in size, the databases normally reach a
59910 point at which they no longer get any bigger, as long as they are regularly
59911 tidied.
59912 </para>
59913 <para>
59914 <emphasis role="bold">Warning</emphasis>: If you never run <emphasis>exim_tidydb</emphasis>, the space used by the hints
59915 databases is likely to keep on increasing.
59916 </para>
59917 </section>
59918 <section id="SECID263">
59919 <title>exim_fixdb</title>
59920 <para>
59921 <indexterm role="concept">
59922 <primary><emphasis>exim_fixdb</emphasis></primary>
59923 </indexterm>
59924 The <emphasis>exim_fixdb</emphasis> program is a utility for interactively modifying databases.
59925 Its main use is for testing Exim, but it might also be occasionally useful for
59926 getting round problems in a live system. It has no options, and its interface
59927 is somewhat crude. On entry, it prompts for input with a right angle-bracket. A
59928 key of a database record can then be entered, and the data for that record is
59929 displayed.
59930 </para>
59931 <para>
59932 If <quote>d</quote> is typed at the next prompt, the entire record is deleted. For all
59933 except the <emphasis>retry</emphasis> database, that is the only operation that can be carried
59934 out. For the <emphasis>retry</emphasis> database, each field is output preceded by a number, and
59935 data for individual fields can be changed by typing the field number followed
59936 by new data, for example:
59937 </para>
59938 <literallayout class="monospaced">
59939 &gt; 4 951102:1000
59940 </literallayout>
59941 <para>
59942 resets the time of the next delivery attempt. Time values are given as a
59943 sequence of digit pairs for year, month, day, hour, and minute. Colons can be
59944 used as optional separators.
59945 </para>
59946 </section>
59947 <section id="SECTmailboxmaint">
59948 <title>Mailbox maintenance (exim_lock)</title>
59949 <para>
59950 <indexterm role="concept">
59951 <primary>mailbox</primary>
59952 <secondary>maintenance</secondary>
59953 </indexterm>
59954 <indexterm role="concept">
59955 <primary><emphasis>exim_lock</emphasis></primary>
59956 </indexterm>
59957 <indexterm role="concept">
59958 <primary>locking mailboxes</primary>
59959 </indexterm>
59960 The <emphasis>exim_lock</emphasis> utility locks a mailbox file using the same algorithm as
59961 Exim. For a discussion of locking issues, see section <xref linkend="SECTopappend"/>.
59962 <emphasis>Exim_lock</emphasis> can be used to prevent any modification of a mailbox by Exim or
59963 a user agent while investigating a problem. The utility requires the name of
59964 the file as its first argument. If the locking is successful, the second
59965 argument is run as a command (using C&#x2019;s <function>system()</function> function); if there is no
59966 second argument, the value of the SHELL environment variable is used; if this
59967 is unset or empty, <filename>/bin/sh</filename> is run. When the command finishes, the mailbox
59968 is unlocked and the utility ends. The following options are available:
59969 </para>
59970 <variablelist>
59971 <varlistentry>
59972 <term><option>-fcntl</option></term>
59973 <listitem>
59974 <para>
59975 Use <function>fcntl()</function> locking on the open mailbox.
59976 </para>
59977 </listitem></varlistentry>
59978 <varlistentry>
59979 <term><option>-flock</option></term>
59980 <listitem>
59981 <para>
59982 Use <function>flock()</function> locking on the open mailbox, provided the operating system
59983 supports it.
59984 </para>
59985 </listitem></varlistentry>
59986 <varlistentry>
59987 <term><option>-interval</option></term>
59988 <listitem>
59989 <para>
59990 This must be followed by a number, which is a number of seconds; it sets the
59991 interval to sleep between retries (default 3).
59992 </para>
59993 </listitem></varlistentry>
59994 <varlistentry>
59995 <term><option>-lockfile</option></term>
59996 <listitem>
59997 <para>
59998 Create a lock file before opening the mailbox.
59999 </para>
60000 </listitem></varlistentry>
60001 <varlistentry>
60002 <term><option>-mbx</option></term>
60003 <listitem>
60004 <para>
60005 Lock the mailbox using MBX rules.
60006 </para>
60007 </listitem></varlistentry>
60008 <varlistentry>
60009 <term><option>-q</option></term>
60010 <listitem>
60011 <para>
60012 Suppress verification output.
60013 </para>
60014 </listitem></varlistentry>
60015 <varlistentry>
60016 <term><option>-retries</option></term>
60017 <listitem>
60018 <para>
60019 This must be followed by a number; it sets the number of times to try to get
60020 the lock (default 10).
60021 </para>
60022 </listitem></varlistentry>
60023 <varlistentry>
60024 <term><option>-restore_time</option></term>
60025 <listitem>
60026 <para>
60027 This option causes <option>exim_lock</option> to restore the modified and read times to the
60028 locked file before exiting. This allows you to access a locked mailbox (for
60029 example, to take a backup copy) without disturbing the times that the user
60030 subsequently sees.
60031 </para>
60032 </listitem></varlistentry>
60033 <varlistentry>
60034 <term><option>-timeout</option></term>
60035 <listitem>
60036 <para>
60037 This must be followed by a number, which is a number of seconds; it sets a
60038 timeout to be used with a blocking <function>fcntl()</function> lock. If it is not set (the
60039 default), a non-blocking call is used.
60040 </para>
60041 </listitem></varlistentry>
60042 <varlistentry>
60043 <term><option>-v</option></term>
60044 <listitem>
60045 <para>
60046 Generate verbose output.
60047 </para>
60048 </listitem></varlistentry>
60049 </variablelist>
60050 <para>
60051 If none of <option>-fcntl</option>, <option>-flock</option>, <option>-lockfile</option> or <option>-mbx</option> are given, the
60052 default is to create a lock file and also to use <function>fcntl()</function> locking on the
60053 mailbox, which is the same as Exim&#x2019;s default. The use of <option>-flock</option> or
60054 <option>-fcntl</option> requires that the file be writeable; the use of <option>-lockfile</option>
60055 requires that the directory containing the file be writeable. Locking by lock
60056 file does not last for ever; Exim assumes that a lock file is expired if it is
60057 more than 30 minutes old.
60058 </para>
60059 <para>
60060 The <option>-mbx</option> option can be used with either or both of <option>-fcntl</option> or
60061 <option>-flock</option>. It assumes <option>-fcntl</option> by default. MBX locking causes a shared lock
60062 to be taken out on the open mailbox, and an exclusive lock on the file
60063 <filename>/tmp/.n.m</filename> where <emphasis>n</emphasis> and <emphasis>m</emphasis> are the device number and inode
60064 number of the mailbox file. When the locking is released, if an exclusive lock
60065 can be obtained for the mailbox, the file in <filename>/tmp</filename> is deleted.
60066 </para>
60067 <para>
60068 The default output contains verification of the locking that takes place. The
60069 <option>-v</option> option causes some additional information to be given. The <option>-q</option> option
60070 suppresses all output except error messages.
60071 </para>
60072 <para>
60073 A command such as
60074 </para>
60075 <literallayout class="monospaced">
60076 exim_lock /var/spool/mail/spqr
60077 </literallayout>
60078 <para>
60079 runs an interactive shell while the file is locked, whereas
60080 </para>
60081 <literallayout>
60082 <literal>exim_lock -q /var/spool/mail/spqr &lt;&lt;End</literal>
60083 &lt;<emphasis>some commands</emphasis>&gt;
60084 <literal>End</literal>
60085 </literallayout>
60086 <para>
60087 runs a specific non-interactive sequence of commands while the file is locked,
60088 suppressing all verification output. A single command can be run by a command
60089 such as
60090 </para>
60091 <literallayout class="monospaced">
60092 exim_lock -q /var/spool/mail/spqr \
60093   "cp /var/spool/mail/spqr /some/where"
60094 </literallayout>
60095 <para>
60096 Note that if a command is supplied, it must be entirely contained within the
60097 second argument &ndash; hence the quotes.
60098 <indexterm role="concept" startref="IIDutils" class="endofrange"/>
60099 </para>
60100 </section>
60101 </chapter>
60102
60103 <chapter id="CHAPeximon">
60104 <title>The Exim monitor</title>
60105 <para>
60106 <indexterm role="concept" id="IIDeximon" class="startofrange">
60107 <primary>Exim monitor</primary>
60108 <secondary>description</secondary>
60109 </indexterm>
60110 <indexterm role="concept">
60111 <primary>X-windows</primary>
60112 </indexterm>
60113 <indexterm role="concept">
60114 <primary><emphasis>eximon</emphasis></primary>
60115 </indexterm>
60116 <indexterm role="concept">
60117 <primary>Local/eximon.conf</primary>
60118 </indexterm>
60119 <indexterm role="concept">
60120 <primary><filename>exim_monitor/EDITME</filename></primary>
60121 </indexterm>
60122 The Exim monitor is an application which displays in an X window information
60123 about the state of Exim&#x2019;s queue and what Exim is doing. An admin user can
60124 perform certain operations on messages from this GUI interface; however all
60125 such facilities are also available from the command line, and indeed, the
60126 monitor itself makes use of the command line to perform any actions requested.
60127 </para>
60128 <section id="SECID264">
60129 <title>Running the monitor</title>
60130 <para>
60131 The monitor is started by running the script called <emphasis>eximon</emphasis>. This is a shell
60132 script that sets up a number of environment variables, and then runs the
60133 binary called <filename>eximon.bin</filename>. The default appearance of the monitor window can
60134 be changed by editing the <filename>Local/eximon.conf</filename> file created by editing
60135 <filename>exim_monitor/EDITME</filename>. Comments in that file describe what the various
60136 parameters are for.
60137 </para>
60138 <para>
60139 The parameters that get built into the <emphasis>eximon</emphasis> script can be overridden for
60140 a particular invocation by setting up environment variables of the same names,
60141 preceded by <literal>EXIMON_</literal>. For example, a shell command such as
60142 </para>
60143 <literallayout class="monospaced">
60144 EXIMON_LOG_DEPTH=400 eximon
60145 </literallayout>
60146 <para>
60147 (in a Bourne-compatible shell) runs <emphasis>eximon</emphasis> with an overriding setting of
60148 the LOG_DEPTH parameter. If EXIMON_LOG_FILE_PATH is set in the environment, it
60149 overrides the Exim log file configuration. This makes it possible to have
60150 <emphasis>eximon</emphasis> tailing log data that is written to syslog, provided that MAIL.INFO
60151 syslog messages are routed to a file on the local host.
60152 </para>
60153 <para>
60154 X resources can be used to change the appearance of the window in the normal
60155 way. For example, a resource setting of the form
60156 </para>
60157 <literallayout class="monospaced">
60158 Eximon*background: gray94
60159 </literallayout>
60160 <para>
60161 changes the colour of the background to light grey rather than white. The
60162 stripcharts are drawn with both the data lines and the reference lines in
60163 black. This means that the reference lines are not visible when on top of the
60164 data. However, their colour can be changed by setting a resource called
60165 <quote>highlight</quote> (an odd name, but that&#x2019;s what the Athena stripchart widget uses).
60166 For example, if your X server is running Unix, you could set up lighter
60167 reference lines in the stripcharts by obeying
60168 </para>
60169 <literallayout class="monospaced">
60170 xrdb -merge &lt;&lt;End
60171 Eximon*highlight: gray
60172 End
60173 </literallayout>
60174 <para>
60175 <indexterm role="concept">
60176 <primary>admin user</primary>
60177 </indexterm>
60178 In order to see the contents of messages on the queue, and to operate on them,
60179 <emphasis>eximon</emphasis> must either be run as root or by an admin user.
60180 </para>
60181 <para>
60182 The monitor&#x2019;s window is divided into three parts. The first contains one or
60183 more stripcharts and two action buttons, the second contains a <quote>tail</quote> of the
60184 main log file, and the third is a display of the queue of messages awaiting
60185 delivery, with two more action buttons. The following sections describe these
60186 different parts of the display.
60187 </para>
60188 </section>
60189 <section id="SECID265">
60190 <title>The stripcharts</title>
60191 <para>
60192 <indexterm role="concept">
60193 <primary>stripchart</primary>
60194 </indexterm>
60195 The first stripchart is always a count of messages on the queue. Its name can
60196 be configured by setting QUEUE_STRIPCHART_NAME in the
60197 <filename>Local/eximon.conf</filename> file. The remaining stripcharts are defined in the
60198 configuration script by regular expression matches on log file entries, making
60199 it possible to display, for example, counts of messages delivered to certain
60200 hosts or using certain transports. The supplied defaults display counts of
60201 received and delivered messages, and of local and SMTP deliveries. The default
60202 period between stripchart updates is one minute; this can be adjusted by a
60203 parameter in the <filename>Local/eximon.conf</filename> file.
60204 </para>
60205 <para>
60206 The stripchart displays rescale themselves automatically as the value they are
60207 displaying changes. There are always 10 horizontal lines in each chart; the
60208 title string indicates the value of each division when it is greater than one.
60209 For example, <quote>x2</quote> means that each division represents a value of 2.
60210 </para>
60211 <para>
60212 It is also possible to have a stripchart which shows the percentage fullness of
60213 a particular disk partition, which is useful when local deliveries are confined
60214 to a single partition.
60215 </para>
60216 <para>
60217 <indexterm role="concept">
60218 <primary><option>statvfs</option> function</primary>
60219 </indexterm>
60220 This relies on the availability of the <function>statvfs()</function> function or equivalent in
60221 the operating system. Most, but not all versions of Unix that support Exim have
60222 this. For this particular stripchart, the top of the chart always represents
60223 100%, and the scale is given as <quote>x10%</quote>. This chart is configured by setting
60224 SIZE_STRIPCHART and (optionally) SIZE_STRIPCHART_NAME in the
60225 <filename>Local/eximon.conf</filename> file.
60226 </para>
60227 </section>
60228 <section id="SECID266">
60229 <title>Main action buttons</title>
60230 <para>
60231 <indexterm role="concept">
60232 <primary>size</primary>
60233 <secondary>of monitor window</secondary>
60234 </indexterm>
60235 <indexterm role="concept">
60236 <primary>Exim monitor</primary>
60237 <secondary>window size</secondary>
60238 </indexterm>
60239 <indexterm role="concept">
60240 <primary>window size</primary>
60241 </indexterm>
60242 Below the stripcharts there is an action button for quitting the monitor. Next
60243 to this is another button marked <quote>Size</quote>. They are placed here so that
60244 shrinking the window to its default minimum size leaves just the queue count
60245 stripchart and these two buttons visible. Pressing the <quote>Size</quote> button causes
60246 the window to expand to its maximum size, unless it is already at the maximum,
60247 in which case it is reduced to its minimum.
60248 </para>
60249 <para>
60250 When expanding to the maximum, if the window cannot be fully seen where it
60251 currently is, it is moved back to where it was the last time it was at full
60252 size. When it is expanding from its minimum size, the old position is
60253 remembered, and next time it is reduced to the minimum it is moved back there.
60254 </para>
60255 <para>
60256 The idea is that you can keep a reduced window just showing one or two
60257 stripcharts at a convenient place on your screen, easily expand it to show
60258 the full window when required, and just as easily put it back to what it was.
60259 The idea is copied from what the <emphasis>twm</emphasis> window manager does for its
60260 <emphasis>f.fullzoom</emphasis> action. The minimum size of the window can be changed by setting
60261 the MIN_HEIGHT and MIN_WIDTH values in <filename>Local/eximon.conf</filename>.
60262 </para>
60263 <para>
60264 Normally, the monitor starts up with the window at its full size, but it can be
60265 built so that it starts up with the window at its smallest size, by setting
60266 START_SMALL=yes in <filename>Local/eximon.conf</filename>.
60267 </para>
60268 </section>
60269 <section id="SECID267">
60270 <title>The log display</title>
60271 <para>
60272 <indexterm role="concept">
60273 <primary>log</primary>
60274 <secondary>tail of; in monitor</secondary>
60275 </indexterm>
60276 The second section of the window is an area in which a display of the tail of
60277 the main log is maintained.
60278 To save space on the screen, the timestamp on each log line is shortened by
60279 removing the date and, if <option>log_timezone</option> is set, the timezone.
60280 The log tail is not available when the only destination for logging data is
60281 syslog, unless the syslog lines are routed to a local file whose name is passed
60282 to <emphasis>eximon</emphasis> via the EXIMON_LOG_FILE_PATH environment variable.
60283 </para>
60284 <para>
60285 The log sub-window has a scroll bar at its lefthand side which can be used to
60286 move back to look at earlier text, and the up and down arrow keys also have a
60287 scrolling effect. The amount of log that is kept depends on the setting of
60288 LOG_BUFFER in <filename>Local/eximon.conf</filename>, which specifies the amount of memory
60289 to use. When this is full, the earlier 50% of data is discarded &ndash; this is
60290 much more efficient than throwing it away line by line. The sub-window also has
60291 a horizontal scroll bar for accessing the ends of long log lines. This is the
60292 only means of horizontal scrolling; the right and left arrow keys are not
60293 available. Text can be cut from this part of the window using the mouse in the
60294 normal way. The size of this subwindow is controlled by parameters in the
60295 configuration file <filename>Local/eximon.conf</filename>.
60296 </para>
60297 <para>
60298 Searches of the text in the log window can be carried out by means of the ^R
60299 and ^S keystrokes, which default to a reverse and a forward search,
60300 respectively. The search covers only the text that is displayed in the window.
60301 It cannot go further back up the log.
60302 </para>
60303 <para>
60304 The point from which the search starts is indicated by a caret marker. This is
60305 normally at the end of the text in the window, but can be positioned explicitly
60306 by pointing and clicking with the left mouse button, and is moved automatically
60307 by a successful search. If new text arrives in the window when it is scrolled
60308 back, the caret remains where it is, but if the window is not scrolled back,
60309 the caret is moved to the end of the new text.
60310 </para>
60311 <para>
60312 Pressing ^R or ^S pops up a window into which the search text can be typed.
60313 There are buttons for selecting forward or reverse searching, for carrying out
60314 the search, and for cancelling. If the <quote>Search</quote> button is pressed, the search
60315 happens and the window remains so that further searches can be done. If the
60316 <quote>Return</quote> key is pressed, a single search is done and the window is closed. If
60317 ^C is typed the search is cancelled.
60318 </para>
60319 <para>
60320 The searching facility is implemented using the facilities of the Athena text
60321 widget. By default this pops up a window containing both <quote>search</quote> and
60322 <quote>replace</quote> options. In order to suppress the unwanted <quote>replace</quote> portion for
60323 eximon, a modified version of the <option>TextPop</option> widget is distributed with Exim.
60324 However, the linkers in BSDI and HP-UX seem unable to handle an externally
60325 provided version of <option>TextPop</option> when the remaining parts of the text widget
60326 come from the standard libraries. The compile-time option EXIMON_TEXTPOP can be
60327 unset to cut out the modified <option>TextPop</option>, making it possible to build Eximon
60328 on these systems, at the expense of having unwanted items in the search popup
60329 window.
60330 </para>
60331 </section>
60332 <section id="SECID268">
60333 <title>The queue display</title>
60334 <para>
60335 <indexterm role="concept">
60336 <primary>queue</primary>
60337 <secondary>display in monitor</secondary>
60338 </indexterm>
60339 The bottom section of the monitor window contains a list of all messages that
60340 are on the queue, which includes those currently being received or delivered,
60341 as well as those awaiting delivery. The size of this subwindow is controlled by
60342 parameters in the configuration file <filename>Local/eximon.conf</filename>, and the frequency
60343 at which it is updated is controlled by another parameter in the same file &ndash;
60344 the default is 5 minutes, since queue scans can be quite expensive. However,
60345 there is an <quote>Update</quote> action button just above the display which can be used
60346 to force an update of the queue display at any time.
60347 </para>
60348 <para>
60349 When a host is down for some time, a lot of pending mail can build up for it,
60350 and this can make it hard to deal with other messages on the queue. To help
60351 with this situation there is a button next to <quote>Update</quote> called <quote>Hide</quote>. If
60352 pressed, a dialogue box called <quote>Hide addresses ending with</quote> is put up. If you
60353 type anything in here and press <quote>Return</quote>, the text is added to a chain of
60354 such texts, and if every undelivered address in a message matches at least one
60355 of the texts, the message is not displayed.
60356 </para>
60357 <para>
60358 If there is an address that does not match any of the texts, all the addresses
60359 are displayed as normal. The matching happens on the ends of addresses so, for
60360 example, <emphasis>cam.ac.uk</emphasis> specifies all addresses in Cambridge, while
60361 <emphasis>xxx@foo.com.example</emphasis> specifies just one specific address. When any hiding
60362 has been set up, a button called <quote>Unhide</quote> is displayed. If pressed, it
60363 cancels all hiding. Also, to ensure that hidden messages do not get forgotten,
60364 a hide request is automatically cancelled after one hour.
60365 </para>
60366 <para>
60367 While the dialogue box is displayed, you can&#x2019;t press any buttons or do anything
60368 else to the monitor window. For this reason, if you want to cut text from the
60369 queue display to use in the dialogue box, you have to do the cutting before
60370 pressing the <quote>Hide</quote> button.
60371 </para>
60372 <para>
60373 The queue display contains, for each unhidden queued message, the length of
60374 time it has been on the queue, the size of the message, the message id, the
60375 message sender, and the first undelivered recipient, all on one line. If it is
60376 a bounce message, the sender is shown as <quote>&lt;&gt;</quote>. If there is more than one
60377 recipient to which the message has not yet been delivered, subsequent ones are
60378 listed on additional lines, up to a maximum configured number, following which
60379 an ellipsis is displayed. Recipients that have already received the message are
60380 not shown.
60381 </para>
60382 <para>
60383 <indexterm role="concept">
60384 <primary>frozen messages</primary>
60385 <secondary>display</secondary>
60386 </indexterm>
60387 If a message is frozen, an asterisk is displayed at the left-hand side.
60388 </para>
60389 <para>
60390 The queue display has a vertical scroll bar, and can also be scrolled by means
60391 of the arrow keys. Text can be cut from it using the mouse in the normal way.
60392 The text searching facilities, as described above for the log window, are also
60393 available, but the caret is always moved to the end of the text when the queue
60394 display is updated.
60395 </para>
60396 </section>
60397 <section id="SECID269">
60398 <title>The queue menu</title>
60399 <para>
60400 <indexterm role="concept">
60401 <primary>queue</primary>
60402 <secondary>menu in monitor</secondary>
60403 </indexterm>
60404 If the <option>shift</option> key is held down and the left button is clicked when the mouse
60405 pointer is over the text for any message, an action menu pops up, and the first
60406 line of the queue display for the message is highlighted. This does not affect
60407 any selected text.
60408 </para>
60409 <para>
60410 If you want to use some other event for popping up the menu, you can set the
60411 MENU_EVENT parameter in <filename>Local/eximon.conf</filename> to change the default, or
60412 set EXIMON_MENU_EVENT in the environment before starting the monitor. The
60413 value set in this parameter is a standard X event description. For example, to
60414 run eximon using <option>ctrl</option> rather than <option>shift</option> you could use
60415 </para>
60416 <literallayout class="monospaced">
60417 EXIMON_MENU_EVENT='Ctrl&lt;Btn1Down&gt;' eximon
60418 </literallayout>
60419 <para>
60420 The title of the menu is the message id, and it contains entries which act as
60421 follows:
60422 </para>
60423 <itemizedlist>
60424 <listitem>
60425 <para>
60426 <emphasis>message log</emphasis>: The contents of the message log for the message are displayed
60427 in a new text window.
60428 </para>
60429 </listitem>
60430 <listitem>
60431 <para>
60432 <emphasis>headers</emphasis>: Information from the spool file that contains the envelope
60433 information and headers is displayed in a new text window. See chapter
60434 <xref linkend="CHAPspool"/> for a description of the format of spool files.
60435 </para>
60436 </listitem>
60437 <listitem>
60438 <para>
60439 <emphasis>body</emphasis>: The contents of the spool file containing the body of the message are
60440 displayed in a new text window. There is a default limit of 20,000 bytes to the
60441 amount of data displayed. This can be changed by setting the BODY_MAX
60442 option at compile time, or the EXIMON_BODY_MAX option at run time.
60443 </para>
60444 </listitem>
60445 <listitem>
60446 <para>
60447 <emphasis>deliver message</emphasis>: A call to Exim is made using the <option>-M</option> option to request
60448 delivery of the message. This causes an automatic thaw if the message is
60449 frozen. The <option>-v</option> option is also set, and the output from Exim is displayed in
60450 a new text window. The delivery is run in a separate process, to avoid holding
60451 up the monitor while the delivery proceeds.
60452 </para>
60453 </listitem>
60454 <listitem>
60455 <para>
60456 <emphasis>freeze message</emphasis>: A call to Exim is made using the <option>-Mf</option> option to request
60457 that the message be frozen.
60458 </para>
60459 </listitem>
60460 <listitem>
60461 <para>
60462 <indexterm role="concept">
60463 <primary>thawing messages</primary>
60464 </indexterm>
60465 <indexterm role="concept">
60466 <primary>unfreezing messages</primary>
60467 </indexterm>
60468 <indexterm role="concept">
60469 <primary>frozen messages</primary>
60470 <secondary>thawing</secondary>
60471 </indexterm>
60472 <emphasis>thaw message</emphasis>: A call to Exim is made using the <option>-Mt</option> option to request
60473 that the message be thawed.
60474 </para>
60475 </listitem>
60476 <listitem>
60477 <para>
60478 <indexterm role="concept">
60479 <primary>delivery</primary>
60480 <secondary>forcing failure</secondary>
60481 </indexterm>
60482 <emphasis>give up on msg</emphasis>: A call to Exim is made using the <option>-Mg</option> option to request
60483 that Exim gives up trying to deliver the message. A bounce message is generated
60484 for any remaining undelivered addresses.
60485 </para>
60486 </listitem>
60487 <listitem>
60488 <para>
60489 <emphasis>remove message</emphasis>: A call to Exim is made using the <option>-Mrm</option> option to request
60490 that the message be deleted from the system without generating a bounce
60491 message.
60492 </para>
60493 </listitem>
60494 <listitem>
60495 <para>
60496 <emphasis>add recipient</emphasis>: A dialog box is displayed into which a recipient address can
60497 be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
60498 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
60499 Otherwise it must be entered as a fully qualified address. Pressing RETURN
60500 causes a call to Exim to be made using the <option>-Mar</option> option to request that an
60501 additional recipient be added to the message, unless the entry box is empty, in
60502 which case no action is taken.
60503 </para>
60504 </listitem>
60505 <listitem>
60506 <para>
60507 <emphasis>mark delivered</emphasis>: A dialog box is displayed into which a recipient address
60508 can be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
60509 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
60510 Otherwise it must be entered as a fully qualified address. Pressing RETURN
60511 causes a call to Exim to be made using the <option>-Mmd</option> option to mark the given
60512 recipient address as already delivered, unless the entry box is empty, in which
60513 case no action is taken.
60514 </para>
60515 </listitem>
60516 <listitem>
60517 <para>
60518 <emphasis>mark all delivered</emphasis>: A call to Exim is made using the <option>-Mmad</option> option to
60519 mark all recipient addresses as already delivered.
60520 </para>
60521 </listitem>
60522 <listitem>
60523 <para>
60524 <emphasis>edit sender</emphasis>: A dialog box is displayed initialized with the current
60525 sender&#x2019;s address. Pressing RETURN causes a call to Exim to be made using the
60526 <option>-Mes</option> option to replace the sender address, unless the entry box is empty,
60527 in which case no action is taken. If you want to set an empty sender (as in
60528 bounce messages), you must specify it as <quote>&lt;&gt;</quote>. Otherwise, if the address is
60529 not qualified and the QUALIFY_DOMAIN parameter is set in <filename>Local/eximon.conf</filename>,
60530 the address is qualified with that domain.
60531 </para>
60532 </listitem>
60533 </itemizedlist>
60534 <para>
60535 When a delivery is forced, a window showing the <option>-v</option> output is displayed. In
60536 other cases when a call to Exim is made, if there is any output from Exim (in
60537 particular, if the command fails) a window containing the command and the
60538 output is displayed. Otherwise, the results of the action are normally apparent
60539 from the log and queue displays. However, if you set ACTION_OUTPUT=yes in
60540 <filename>Local/eximon.conf</filename>, a window showing the Exim command is always opened, even
60541 if no output is generated.
60542 </para>
60543 <para>
60544 The queue display is automatically updated for actions such as freezing and
60545 thawing, unless ACTION_QUEUE_UPDATE=no has been set in
60546 <filename>Local/eximon.conf</filename>. In this case the <quote>Update</quote> button has to be used to
60547 force an update of the display after one of these actions.
60548 </para>
60549 <para>
60550 In any text window that is displayed as result of a menu action, the normal
60551 cut-and-paste facility is available, and searching can be carried out using ^R
60552 and ^S, as described above for the log tail window.
60553 <indexterm role="concept" startref="IIDeximon" class="endofrange"/>
60554 </para>
60555 </section>
60556 </chapter>
60557
60558 <chapter id="CHAPsecurity">
60559 <title>Security considerations</title>
60560 <para>
60561 <indexterm role="concept" id="IIDsecurcon" class="startofrange">
60562 <primary>security</primary>
60563 <secondary>discussion of</secondary>
60564 </indexterm>
60565 This chapter discusses a number of issues concerned with security, some of
60566 which are also covered in other parts of this manual.
60567 </para>
60568 <para>
60569 For reasons that this author does not understand, some people have promoted
60570 Exim as a <quote>particularly secure</quote> mailer. Perhaps it is because of the
60571 existence of this chapter in the documentation. However, the intent of the
60572 chapter is simply to describe the way Exim works in relation to certain
60573 security concerns, not to make any specific claims about the effectiveness of
60574 its security as compared with other MTAs.
60575 </para>
60576 <para>
60577 What follows is a description of the way Exim is supposed to be. Best efforts
60578 have been made to try to ensure that the code agrees with the theory, but an
60579 absence of bugs can never be guaranteed. Any that are reported will get fixed
60580 as soon as possible.
60581 </para>
60582 <section id="SECID286">
60583 <title>Building a more <quote>hardened</quote> Exim</title>
60584 <para>
60585 <indexterm role="concept">
60586 <primary>security</primary>
60587 <secondary>build-time features</secondary>
60588 </indexterm>
60589 There are a number of build-time options that can be set in <filename>Local/Makefile</filename>
60590 to create Exim binaries that are <quote>harder</quote> to attack, in particular by a rogue
60591 Exim administrator who does not have the root password, or by someone who has
60592 penetrated the Exim (but not the root) account. These options are as follows:
60593 </para>
60594 <itemizedlist>
60595 <listitem>
60596 <para>
60597 ALT_CONFIG_PREFIX can be set to a string that is required to match the
60598 start of any file names used with the <option>-C</option> option. When it is set, these file
60599 names are also not allowed to contain the sequence <quote>/../</quote>. (However, if the
60600 value of the <option>-C</option> option is identical to the value of CONFIGURE_FILE in
60601 <filename>Local/Makefile</filename>, Exim ignores <option>-C</option> and proceeds as usual.) There is no
60602 default setting for <option>ALT_CONFIG_PREFIX</option>.
60603 </para>
60604 <para>
60605 If the permitted configuration files are confined to a directory to
60606 which only root has access, this guards against someone who has broken
60607 into the Exim account from running a privileged Exim with an arbitrary
60608 configuration file, and using it to break into other accounts.
60609 </para>
60610 </listitem>
60611 <listitem>
60612 <para>
60613 If ALT_CONFIG_ROOT_ONLY is defined, root privilege is retained for <option>-C</option>
60614 and <option>-D</option> only if the caller of Exim is root. Without it, the Exim user may
60615 also use <option>-C</option> and <option>-D</option> and retain privilege. Setting this option locks out
60616 the possibility of testing a configuration using <option>-C</option> right through message
60617 reception and delivery, even if the caller is root. The reception works, but by
60618 that time, Exim is running as the Exim user, so when it re-execs to regain
60619 privilege for the delivery, the use of <option>-C</option> causes privilege to be lost.
60620 However, root can test reception and delivery using two separate commands.
60621 ALT_CONFIG_ROOT_ONLY is not set by default.
60622 </para>
60623 </listitem>
60624 <listitem>
60625 <para>
60626 If DISABLE_D_OPTION is defined, the use of the <option>-D</option> command line option
60627 is disabled.
60628 </para>
60629 </listitem>
60630 <listitem>
60631 <para>
60632 FIXED_NEVER_USERS can be set to a colon-separated list of users that are
60633 never to be used for any deliveries. This is like the <option>never_users</option> runtime
60634 option, but it cannot be overridden; the runtime option adds additional users
60635 to the list. The default setting is <quote>root</quote>; this prevents a non-root user who
60636 is permitted to modify the runtime file from using Exim as a way to get root.
60637 </para>
60638 </listitem>
60639 </itemizedlist>
60640 </section>
60641 <section id="SECID270">
60642 <title>Root privilege</title>
60643 <para>
60644 <indexterm role="concept">
60645 <primary>setuid</primary>
60646 </indexterm>
60647 <indexterm role="concept">
60648 <primary>root privilege</primary>
60649 </indexterm>
60650 The Exim binary is normally setuid to root, which means that it gains root
60651 privilege (runs as root) when it starts execution. In some special cases (for
60652 example, when the daemon is not in use and there are no local deliveries), it
60653 may be possible to run Exim setuid to some user other than root. This is
60654 discussed in the next section. However, in most installations, root privilege
60655 is required for two things:
60656 </para>
60657 <itemizedlist>
60658 <listitem>
60659 <para>
60660 To set up a socket connected to the standard SMTP port (25) when initialising
60661 the listening daemon. If Exim is run from <emphasis>inetd</emphasis>, this privileged action is
60662 not required.
60663 </para>
60664 </listitem>
60665 <listitem>
60666 <para>
60667 To be able to change uid and gid in order to read users&#x2019; <filename>.forward</filename> files and
60668 perform local deliveries as the receiving user or as specified in the
60669 configuration.
60670 </para>
60671 </listitem>
60672 </itemizedlist>
60673 <para>
60674 It is not necessary to be root to do any of the other things Exim does, such as
60675 receiving messages and delivering them externally over SMTP, and it is
60676 obviously more secure if Exim does not run as root except when necessary.
60677 For this reason, a user and group for Exim to use must be defined in
60678 <filename>Local/Makefile</filename>. These are known as <quote>the Exim user</quote> and <quote>the Exim
60679 group</quote>. Their values can be changed by the run time configuration, though this
60680 is not recommended. Often a user called <emphasis>exim</emphasis> is used, but some sites use
60681 <emphasis>mail</emphasis> or another user name altogether.
60682 </para>
60683 <para>
60684 Exim uses <function>setuid()</function> whenever it gives up root privilege. This is a permanent
60685 abdication; the process cannot regain root afterwards. Prior to release 4.00,
60686 <function>seteuid()</function> was used in some circumstances, but this is no longer the case.
60687 </para>
60688 <para>
60689 After a new Exim process has interpreted its command line options, it changes
60690 uid and gid in the following cases:
60691 </para>
60692 <itemizedlist>
60693 <listitem>
60694 <para>
60695 <indexterm role="option">
60696 <primary><option>-C</option></primary>
60697 </indexterm>
60698 <indexterm role="option">
60699 <primary><option>-D</option></primary>
60700 </indexterm>
60701 If the <option>-C</option> option is used to specify an alternate configuration file, or if
60702 the <option>-D</option> option is used to define macro values for the configuration, and the
60703 calling process is not running as root or the Exim user, the uid and gid are
60704 changed to those of the calling process.
60705 However, if ALT_CONFIG_ROOT_ONLY is defined in <filename>Local/Makefile</filename>, only
60706 root callers may use <option>-C</option> and <option>-D</option> without losing privilege, and if
60707 DISABLE_D_OPTION is set, the <option>-D</option> option may not be used at all.
60708 </para>
60709 </listitem>
60710 <listitem>
60711 <para>
60712 <indexterm role="option">
60713 <primary><option>-be</option></primary>
60714 </indexterm>
60715 <indexterm role="option">
60716 <primary><option>-bf</option></primary>
60717 </indexterm>
60718 <indexterm role="option">
60719 <primary><option>-bF</option></primary>
60720 </indexterm>
60721 If the expansion test option (<option>-be</option>) or one of the filter testing options
60722 (<option>-bf</option> or <option>-bF</option>) are used, the uid and gid are changed to those of the
60723 calling process.
60724 </para>
60725 </listitem>
60726 <listitem>
60727 <para>
60728 If the process is not a daemon process or a queue runner process or a delivery
60729 process or a process for testing address routing (started with <option>-bt</option>), the
60730 uid and gid are changed to the Exim user and group. This means that Exim always
60731 runs under its own uid and gid when receiving messages. This also applies when
60732 testing address verification
60733 <indexterm role="option">
60734 <primary><option>-bv</option></primary>
60735 </indexterm>
60736 <indexterm role="option">
60737 <primary><option>-bh</option></primary>
60738 </indexterm>
60739 (the <option>-bv</option> option) and testing incoming message policy controls (the <option>-bh</option>
60740 option).
60741 </para>
60742 </listitem>
60743 <listitem>
60744 <para>
60745 For a daemon, queue runner, delivery, or address testing process, the uid
60746 remains as root at this stage, but the gid is changed to the Exim group.
60747 </para>
60748 </listitem>
60749 </itemizedlist>
60750 <para>
60751 The processes that initially retain root privilege behave as follows:
60752 </para>
60753 <itemizedlist>
60754 <listitem>
60755 <para>
60756 A daemon process changes the gid to the Exim group and the uid to the Exim
60757 user after setting up one or more listening sockets. The <function>initgroups()</function>
60758 function is called, so that if the Exim user is in any additional groups, they
60759 will be used during message reception.
60760 </para>
60761 </listitem>
60762 <listitem>
60763 <para>
60764 A queue runner process retains root privilege throughout its execution. Its
60765 job is to fork a controlled sequence of delivery processes.
60766 </para>
60767 </listitem>
60768 <listitem>
60769 <para>
60770 A delivery process retains root privilege throughout most of its execution,
60771 but any actual deliveries (that is, the transports themselves) are run in
60772 subprocesses which always change to a non-root uid and gid. For local
60773 deliveries this is typically the uid and gid of the owner of the mailbox; for
60774 remote deliveries, the Exim uid and gid are used. Once all the delivery
60775 subprocesses have been run, a delivery process changes to the Exim uid and gid
60776 while doing post-delivery tidying up such as updating the retry database and
60777 generating bounce and warning messages.
60778 </para>
60779 <para>
60780 While the recipient addresses in a message are being routed, the delivery
60781 process runs as root. However, if a user&#x2019;s filter file has to be processed,
60782 this is done in a subprocess that runs under the individual user&#x2019;s uid and
60783 gid. A system filter is run as root unless <option>system_filter_user</option> is set.
60784 </para>
60785 </listitem>
60786 <listitem>
60787 <para>
60788 A process that is testing addresses (the <option>-bt</option> option) runs as root so that
60789 the routing is done in the same environment as a message delivery.
60790 </para>
60791 </listitem>
60792 </itemizedlist>
60793 </section>
60794 <section id="SECTrunexiwitpri">
60795 <title>Running Exim without privilege</title>
60796 <para>
60797 <indexterm role="concept">
60798 <primary>privilege, running without</primary>
60799 </indexterm>
60800 <indexterm role="concept">
60801 <primary>unprivileged running</primary>
60802 </indexterm>
60803 <indexterm role="concept">
60804 <primary>root privilege</primary>
60805 <secondary>running without</secondary>
60806 </indexterm>
60807 Some installations like to run Exim in an unprivileged state for more of its
60808 operation, for added security. Support for this mode of operation is provided
60809 by the global option <option>deliver_drop_privilege</option>. When this is set, the uid and
60810 gid are changed to the Exim user and group at the start of a delivery process
60811 (and also queue runner and address testing processes). This means that address
60812 routing is no longer run as root, and the deliveries themselves cannot change
60813 to any other uid.
60814 </para>
60815 <para>
60816 <indexterm role="concept">
60817 <primary>SIGHUP</primary>
60818 </indexterm>
60819 <indexterm role="concept">
60820 <primary>daemon</primary>
60821 <secondary>restarting</secondary>
60822 </indexterm>
60823 Leaving the binary setuid to root, but setting <option>deliver_drop_privilege</option> means
60824 that the daemon can still be started in the usual way, and it can respond
60825 correctly to SIGHUP because the re-invocation regains root privilege.
60826 </para>
60827 <para>
60828 An alternative approach is to make Exim setuid to the Exim user and also setgid
60829 to the Exim group. If you do this, the daemon must be started from a root
60830 process. (Calling Exim from a root process makes it behave in the way it does
60831 when it is setuid root.) However, the daemon cannot restart itself after a
60832 SIGHUP signal because it cannot regain privilege.
60833 </para>
60834 <para>
60835 It is still useful to set <option>deliver_drop_privilege</option> in this case, because it
60836 stops Exim from trying to re-invoke itself to do a delivery after a message has
60837 been received. Such a re-invocation is a waste of resources because it has no
60838 effect.
60839 </para>
60840 <para>
60841 If restarting the daemon is not an issue (for example, if <option>mua_wrapper</option> is
60842 set, or <emphasis>inetd</emphasis> is being used instead of a daemon), having the binary setuid
60843 to the Exim user seems a clean approach, but there is one complication:
60844 </para>
60845 <para>
60846 In this style of operation, Exim is running with the real uid and gid set to
60847 those of the calling process, and the effective uid/gid set to Exim&#x2019;s values.
60848 Ideally, any association with the calling process&#x2019; uid/gid should be dropped,
60849 that is, the real uid/gid should be reset to the effective values so as to
60850 discard any privileges that the caller may have. While some operating systems
60851 have a function that permits this action for a non-root effective uid, quite a
60852 number of them do not. Because of this lack of standardization, Exim does not
60853 address this problem at this time.
60854 </para>
60855 <para>
60856 For this reason, the recommended approach for <quote>mostly unprivileged</quote> running
60857 is to keep the Exim binary setuid to root, and to set
60858 <option>deliver_drop_privilege</option>. This also has the advantage of allowing a daemon to
60859 be used in the most straightforward way.
60860 </para>
60861 <para>
60862 If you configure Exim not to run delivery processes as root, there are a
60863 number of restrictions on what you can do:
60864 </para>
60865 <itemizedlist>
60866 <listitem>
60867 <para>
60868 You can deliver only as the Exim user/group. You should  explicitly use the
60869 <option>user</option> and <option>group</option> options to override routers or local transports that
60870 normally deliver as the recipient. This makes sure that configurations that
60871 work in this mode function the same way in normal mode. Any implicit or
60872 explicit specification of another user causes an error.
60873 </para>
60874 </listitem>
60875 <listitem>
60876 <para>
60877 Use of <filename>.forward</filename> files is severely restricted, such that it is usually
60878 not worthwhile to include them in the configuration.
60879 </para>
60880 </listitem>
60881 <listitem>
60882 <para>
60883 Users who wish to use <filename>.forward</filename> would have to make their home directory and
60884 the file itself accessible to the Exim user. Pipe and append-to-file entries,
60885 and their equivalents in Exim filters, cannot be used. While they could be
60886 enabled in the Exim user&#x2019;s name, that would be insecure and not very useful.
60887 </para>
60888 </listitem>
60889 <listitem>
60890 <para>
60891 Unless the local user mailboxes are all owned by the Exim user (possible in
60892 some POP3 or IMAP-only environments):
60893 </para>
60894 <orderedlist numeration="arabic">
60895 <listitem>
60896 <para>
60897 They must be owned by the Exim group and be writeable by that group. This
60898 implies you must set <option>mode</option> in the appendfile configuration, as well as the
60899 mode of the mailbox files themselves.
60900 </para>
60901 </listitem>
60902 <listitem>
60903 <para>
60904 You must set <option>no_check_owner</option>, since most or all of the files will not be
60905 owned by the Exim user.
60906 </para>
60907 </listitem>
60908 <listitem>
60909 <para>
60910 You must set <option>file_must_exist</option>, because Exim cannot set the owner correctly
60911 on a newly created mailbox when unprivileged. This also implies that new
60912 mailboxes need to be created manually.
60913 </para>
60914 </listitem>
60915 </orderedlist>
60916 </listitem>
60917 </itemizedlist>
60918 <para>
60919 These restrictions severely restrict what can be done in local deliveries.
60920 However, there are no restrictions on remote deliveries. If you are running a
60921 gateway host that does no local deliveries, setting <option>deliver_drop_privilege</option>
60922 gives more security at essentially no cost.
60923 </para>
60924 <para>
60925 If you are using the <option>mua_wrapper</option> facility (see chapter
60926 <xref linkend="CHAPnonqueueing"/>), <option>deliver_drop_privilege</option> is forced to be true.
60927 </para>
60928 </section>
60929 <section id="SECID271">
60930 <title>Delivering to local files</title>
60931 <para>
60932 Full details of the checks applied by <command>appendfile</command> before it writes to a file
60933 are given in chapter <xref linkend="CHAPappendfile"/>.
60934 </para>
60935 </section>
60936 <section id="SECID272">
60937 <title>IPv4 source routing</title>
60938 <para>
60939 <indexterm role="concept">
60940 <primary>source routing</primary>
60941 <secondary>in IP packets</secondary>
60942 </indexterm>
60943 <indexterm role="concept">
60944 <primary>IP source routing</primary>
60945 </indexterm>
60946 Many operating systems suppress IP source-routed packets in the kernel, but
60947 some cannot be made to do this, so Exim does its own check. It logs incoming
60948 IPv4 source-routed TCP calls, and then drops them. Things are all different in
60949 IPv6. No special checking is currently done.
60950 </para>
60951 </section>
60952 <section id="SECID273">
60953 <title>The VRFY, EXPN, and ETRN commands in SMTP</title>
60954 <para>
60955 Support for these SMTP commands is disabled by default. If required, they can
60956 be enabled by defining suitable ACLs.
60957 </para>
60958 </section>
60959 <section id="SECID274">
60960 <title>Privileged users</title>
60961 <para>
60962 <indexterm role="concept">
60963 <primary>trusted users</primary>
60964 </indexterm>
60965 <indexterm role="concept">
60966 <primary>admin user</primary>
60967 </indexterm>
60968 <indexterm role="concept">
60969 <primary>privileged user</primary>
60970 </indexterm>
60971 <indexterm role="concept">
60972 <primary>user</primary>
60973 <secondary>trusted</secondary>
60974 </indexterm>
60975 <indexterm role="concept">
60976 <primary>user</primary>
60977 <secondary>admin</secondary>
60978 </indexterm>
60979 Exim recognizes two sets of users with special privileges. Trusted users are
60980 able to submit new messages to Exim locally, but supply their own sender
60981 addresses and information about a sending host. For other users submitting
60982 local messages, Exim sets up the sender address from the uid, and doesn&#x2019;t
60983 permit a remote host to be specified.
60984 </para>
60985 <para>
60986 <indexterm role="option">
60987 <primary><option>-f</option></primary>
60988 </indexterm>
60989 However, an untrusted user is permitted to use the <option>-f</option> command line option
60990 in the special form <option>-f &lt;&gt;</option> to indicate that a delivery failure for the
60991 message should not cause an error report. This affects the message&#x2019;s envelope,
60992 but it does not affect the <emphasis>Sender:</emphasis> header. Untrusted users may also be
60993 permitted to use specific forms of address with the <option>-f</option> option by setting
60994 the <option>untrusted_set_sender</option> option.
60995 </para>
60996 <para>
60997 Trusted users are used to run processes that receive mail messages from some
60998 other mail domain and pass them on to Exim for delivery either locally, or over
60999 the Internet. Exim trusts a caller that is running as root, as the Exim user,
61000 as any user listed in the <option>trusted_users</option> configuration option, or under any
61001 group listed in the <option>trusted_groups</option> option.
61002 </para>
61003 <para>
61004 Admin users are permitted to do things to the messages on Exim&#x2019;s queue. They
61005 can freeze or thaw messages, cause them to be returned to their senders, remove
61006 them entirely, or modify them in various ways. In addition, admin users can run
61007 the Exim monitor and see all the information it is capable of providing, which
61008 includes the contents of files on the spool.
61009 </para>
61010 <para>
61011 <indexterm role="option">
61012 <primary><option>-M</option></primary>
61013 </indexterm>
61014 <indexterm role="option">
61015 <primary><option>-q</option></primary>
61016 </indexterm>
61017 By default, the use of the <option>-M</option> and <option>-q</option> options to cause Exim to attempt
61018 delivery of messages on its queue is restricted to admin users. This
61019 restriction can be relaxed by setting the <option>no_prod_requires_admin</option> option.
61020 Similarly, the use of <option>-bp</option> (and its variants) to list the contents of the
61021 queue is also restricted to admin users. This restriction can be relaxed by
61022 setting <option>no_queue_list_requires_admin</option>.
61023 </para>
61024 <para>
61025 Exim recognizes an admin user if the calling process is running as root or as
61026 the Exim user or if any of the groups associated with the calling process is
61027 the Exim group. It is not necessary actually to be running under the Exim
61028 group. However, if admin users who are not root or the Exim user are to access
61029 the contents of files on the spool via the Exim monitor (which runs
61030 unprivileged), Exim must be built to allow group read access to its spool
61031 files.
61032 </para>
61033 </section>
61034 <section id="SECID275">
61035 <title>Spool files</title>
61036 <para>
61037 <indexterm role="concept">
61038 <primary>spool directory</primary>
61039 <secondary>files</secondary>
61040 </indexterm>
61041 Exim&#x2019;s spool directory and everything it contains is owned by the Exim user and
61042 set to the Exim group. The mode for spool files is defined in the
61043 <filename>Local/Makefile</filename> configuration file, and defaults to 0640. This means that
61044 any user who is a member of the Exim group can access these files.
61045 </para>
61046 </section>
61047 <section id="SECID276">
61048 <title>Use of argv[0]</title>
61049 <para>
61050 Exim examines the last component of <option>argv[0]</option>, and if it matches one of a set
61051 of specific strings, Exim assumes certain options. For example, calling Exim
61052 with the last component of <option>argv[0]</option> set to <quote>rsmtp</quote> is exactly equivalent
61053 to calling it with the option <option>-bS</option>. There are no security implications in
61054 this.
61055 </para>
61056 </section>
61057 <section id="SECID277">
61058 <title>Use of %f formatting</title>
61059 <para>
61060 The only use made of <quote>%f</quote> by Exim is in formatting load average values. These
61061 are actually stored in integer variables as 1000 times the load average.
61062 Consequently, their range is limited and so therefore is the length of the
61063 converted output.
61064 </para>
61065 </section>
61066 <section id="SECID278">
61067 <title>Embedded Exim path</title>
61068 <para>
61069 Exim uses its own path name, which is embedded in the code, only when it needs
61070 to re-exec in order to regain root privilege. Therefore, it is not root when it
61071 does so. If some bug allowed the path to get overwritten, it would lead to an
61072 arbitrary program&#x2019;s being run as exim, not as root.
61073 </para>
61074 </section>
61075 <section id="SECID279">
61076 <title>Use of sprintf()</title>
61077 <para>
61078 <indexterm role="concept">
61079 <primary><function>sprintf()</function></primary>
61080 </indexterm>
61081 A large number of occurrences of <quote>sprintf</quote> in the code are actually calls to
61082 <emphasis>string_sprintf()</emphasis>, a function that returns the result in malloc&#x2019;d store.
61083 The intermediate formatting is done into a large fixed buffer by a function
61084 that runs through the format string itself, and checks the length of each
61085 conversion before performing it, thus preventing buffer overruns.
61086 </para>
61087 <para>
61088 The remaining uses of <function>sprintf()</function> happen in controlled circumstances where
61089 the output buffer is known to be sufficiently long to contain the converted
61090 string.
61091 </para>
61092 </section>
61093 <section id="SECID280">
61094 <title>Use of debug_printf() and log_write()</title>
61095 <para>
61096 Arbitrary strings are passed to both these functions, but they do their
61097 formatting by calling the function <emphasis>string_vformat()</emphasis>, which runs through
61098 the format string itself, and checks the length of each conversion.
61099 </para>
61100 </section>
61101 <section id="SECID281">
61102 <title>Use of strcat() and strcpy()</title>
61103 <para>
61104 These are used only in cases where the output buffer is known to be large
61105 enough to hold the result.
61106 <indexterm role="concept" startref="IIDsecurcon" class="endofrange"/>
61107 </para>
61108 </section>
61109 </chapter>
61110
61111 <chapter id="CHAPspool">
61112 <title>Format of spool files</title>
61113 <para>
61114 <indexterm role="concept" id="IIDforspo1" class="startofrange">
61115 <primary>format</primary>
61116 <secondary>spool files</secondary>
61117 </indexterm>
61118 <indexterm role="concept" id="IIDforspo2" class="startofrange">
61119 <primary>spool directory</primary>
61120 <secondary>format of files</secondary>
61121 </indexterm>
61122 <indexterm role="concept" id="IIDforspo3" class="startofrange">
61123 <primary>spool files</primary>
61124 <secondary>format of</secondary>
61125 </indexterm>
61126 <indexterm role="concept">
61127 <primary>spool files</primary>
61128 <secondary>editing</secondary>
61129 </indexterm>
61130 A message on Exim&#x2019;s queue consists of two files, whose names are the message id
61131 followed by -D and -H, respectively. The data portion of the message is kept in
61132 the -D file on its own. The message&#x2019;s envelope, status, and headers are all
61133 kept in the -H file, whose format is described in this chapter. Each of these
61134 two files contains the final component of its own name as its first line. This
61135 is insurance against disk crashes where the directory is lost but the files
61136 themselves are recoverable.
61137 </para>
61138 <para>
61139 Some people are tempted into editing -D files in order to modify messages. You
61140 need to be extremely careful if you do this; it is not recommended and you are
61141 on your own if you do it. Here are some of the pitfalls:
61142 </para>
61143 <itemizedlist>
61144 <listitem>
61145 <para>
61146 You must ensure that Exim does not try to deliver the message while you are
61147 fiddling with it. The safest way is to take out a write lock on the -D file,
61148 which is what Exim itself does, using <function>fcntl()</function>. If you update the file in
61149 place, the lock will be retained. If you write a new file and rename it, the
61150 lock will be lost at the instant of rename.
61151 </para>
61152 </listitem>
61153 <listitem>
61154 <para>
61155 <indexterm role="variable">
61156 <primary><varname>$body_linecount</varname></primary>
61157 </indexterm>
61158 If you change the number of lines in the file, the value of
61159 <varname>$body_linecount</varname>, which is stored in the -H file, will be incorrect. At
61160 present, this value is not used by Exim, but there is no guarantee that this
61161 will always be the case.
61162 </para>
61163 </listitem>
61164 <listitem>
61165 <para>
61166 If the message is in MIME format, you must take care not to break it.
61167 </para>
61168 </listitem>
61169 <listitem>
61170 <para>
61171 If the message is cryptographically signed, any change will invalidate the
61172 signature.
61173 </para>
61174 </listitem>
61175 </itemizedlist>
61176 <para>
61177 All in all, modifying -D files is fraught with danger.
61178 </para>
61179 <para>
61180 Files whose names end with -J may also be seen in the <filename>input</filename> directory (or
61181 its subdirectories when <option>split_spool_directory</option> is set). These are journal
61182 files, used to record addresses to which the message has been delivered during
61183 the course of a delivery attempt. If there are still undelivered recipients at
61184 the end, the -H file is updated, and the -J file is deleted. If, however, there
61185 is some kind of crash (for example, a power outage) before this happens, the -J
61186 file remains in existence. When Exim next processes the message, it notices the
61187 -J file and uses it to update the -H file before starting the next delivery
61188 attempt.
61189 </para>
61190 <section id="SECID282">
61191 <title>Format of the -H file</title>
61192 <para>
61193 <indexterm role="concept">
61194 <primary>uid (user id)</primary>
61195 <secondary>in spool file</secondary>
61196 </indexterm>
61197 <indexterm role="concept">
61198 <primary>gid (group id)</primary>
61199 <secondary>in spool file</secondary>
61200 </indexterm>
61201 The second line of the -H file contains the login name for the uid of the
61202 process that called Exim to read the message, followed by the numerical uid and
61203 gid. For a locally generated message, this is normally the user who sent the
61204 message. For a message received over TCP/IP via the daemon, it is
61205 normally the Exim user.
61206 </para>
61207 <para>
61208 The third line of the file contains the address of the message&#x2019;s sender as
61209 transmitted in the envelope, contained in angle brackets. The sender address is
61210 empty for bounce messages. For incoming SMTP mail, the sender address is given
61211 in the MAIL command. For locally generated mail, the sender address is
61212 created by Exim from the login name of the current user and the configured
61213 <option>qualify_domain</option>. However, this can be overridden by the <option>-f</option> option or a
61214 leading <quote>From&nbsp;</quote> line if the caller is trusted, or if the supplied address is
61215 <quote>&lt;&gt;</quote> or an address that matches <option>untrusted_set_senders</option>.
61216 </para>
61217 <para>
61218 The fourth line contains two numbers. The first is the time that the message
61219 was received, in the conventional Unix form &ndash; the number of seconds since the
61220 start of the epoch. The second number is a count of the number of messages
61221 warning of delayed delivery that have been sent to the sender.
61222 </para>
61223 <para>
61224 There follow a number of lines starting with a hyphen. These can appear in any
61225 order, and are omitted when not relevant:
61226 </para>
61227 <variablelist>
61228 <varlistentry>
61229 <term><option>-acl</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
61230 <listitem>
61231 <para>
61232 This item is obsolete, and is not generated from Exim release 4.61 onwards;
61233 <option>-aclc</option> and <option>-aclm</option> are used instead. However, <option>-acl</option> is still
61234 recognized, to provide backward compatibility. In the old format, a line of
61235 this form is present for every ACL variable that is not empty. The number
61236 identifies the variable; the <option>acl_c</option><emphasis role="bold">x</emphasis> variables are numbered 0&ndash;9 and
61237 the <option>acl_m</option><emphasis role="bold">x</emphasis> variables are numbered 10&ndash;19. The length is the length of
61238 the data string for the variable. The string itself starts at the beginning of
61239 the next line, and is followed by a newline character. It may contain internal
61240 newlines.
61241 </para>
61242 </listitem></varlistentry>
61243 <varlistentry>
61244 <term><option>-aclc</option>&nbsp;&lt;<emphasis>rest-of-name</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
61245 <listitem>
61246 <para>
61247 A line of this form is present for every ACL connection variable that is
61248 defined. Note that there is a space between <option>-aclc</option> and the rest of the name.
61249 The length is the length of the data string for the variable. The string itself
61250 starts at the beginning of the next line, and is followed by a newline
61251 character. It may contain internal newlines.
61252 </para>
61253 </listitem></varlistentry>
61254 <varlistentry>
61255 <term><option>-aclm</option>&nbsp;&lt;<emphasis>rest-of-name</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
61256 <listitem>
61257 <para>
61258 A line of this form is present for every ACL message variable that is defined.
61259 Note that there is a space between <option>-aclm</option> and the rest of the name. The
61260 length is the length of the data string for the variable. The string itself
61261 starts at the beginning of the next line, and is followed by a newline
61262 character. It may contain internal newlines.
61263 </para>
61264 </listitem></varlistentry>
61265 <varlistentry>
61266 <term><option>-active_hostname</option>&nbsp;&lt;<emphasis>hostname</emphasis>&gt;</term>
61267 <listitem>
61268 <para>
61269 This is present if, when the message was received over SMTP, the value of
61270 <varname>$smtp_active_hostname</varname> was different to the value of <varname>$primary_hostname</varname>.
61271 </para>
61272 </listitem></varlistentry>
61273 <varlistentry>
61274 <term><option>-allow_unqualified_recipient</option></term>
61275 <listitem>
61276 <para>
61277 This is present if unqualified recipient addresses are permitted in header
61278 lines (to stop such addresses from being qualified if rewriting occurs at
61279 transport time). Local messages that were input using <option>-bnq</option> and remote
61280 messages from hosts that match <option>recipient_unqualified_hosts</option> set this flag.
61281 </para>
61282 </listitem></varlistentry>
61283 <varlistentry>
61284 <term><option>-allow_unqualified_sender</option></term>
61285 <listitem>
61286 <para>
61287 This is present if unqualified sender addresses are permitted in header lines
61288 (to stop such addresses from being qualified if rewriting occurs at transport
61289 time). Local messages that were input using <option>-bnq</option> and remote messages from
61290 hosts that match <option>sender_unqualified_hosts</option> set this flag.
61291 </para>
61292 </listitem></varlistentry>
61293 <varlistentry>
61294 <term><option>-auth_id</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
61295 <listitem>
61296 <para>
61297 The id information for a message received on an authenticated SMTP connection
61298 &ndash; the value of the <varname>$authenticated_id</varname> variable.
61299 </para>
61300 </listitem></varlistentry>
61301 <varlistentry>
61302 <term><option>-auth_sender</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
61303 <listitem>
61304 <para>
61305 The address of an authenticated sender &ndash; the value of the
61306 <varname>$authenticated_sender</varname> variable.
61307 </para>
61308 </listitem></varlistentry>
61309 <varlistentry>
61310 <term><option>-body_linecount</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
61311 <listitem>
61312 <para>
61313 This records the number of lines in the body of the message, and is always
61314 present.
61315 </para>
61316 </listitem></varlistentry>
61317 <varlistentry>
61318 <term><option>-body_zerocount</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
61319 <listitem>
61320 <para>
61321 This records the number of binary zero bytes in the body of the message, and is
61322 present if the number is greater than zero.
61323 </para>
61324 </listitem></varlistentry>
61325 <varlistentry>
61326 <term><option>-deliver_firsttime</option></term>
61327 <listitem>
61328 <para>
61329 This is written when a new message is first added to the spool. When the spool
61330 file is updated after a deferral, it is omitted.
61331 </para>
61332 </listitem></varlistentry>
61333 <varlistentry>
61334 <term><option>-frozen</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
61335 <listitem>
61336 <para>
61337 <indexterm role="concept">
61338 <primary>frozen messages</primary>
61339 <secondary>spool data</secondary>
61340 </indexterm>
61341 The message is frozen, and the freezing happened at &lt;<emphasis>time</emphasis>&gt;.
61342 </para>
61343 </listitem></varlistentry>
61344 <varlistentry>
61345 <term><option>-helo_name</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
61346 <listitem>
61347 <para>
61348 This records the host name as specified by a remote host in a HELO or EHLO
61349 command.
61350 </para>
61351 </listitem></varlistentry>
61352 <varlistentry>
61353 <term><option>-host_address</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;.&lt;<emphasis>port</emphasis>&gt;</term>
61354 <listitem>
61355 <para>
61356 This records the IP address of the host from which the message was received and
61357 the remote port number that was used. It is omitted for locally generated
61358 messages.
61359 </para>
61360 </listitem></varlistentry>
61361 <varlistentry>
61362 <term><option>-host_auth</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
61363 <listitem>
61364 <para>
61365 If the message was received on an authenticated SMTP connection, this records
61366 the name of the authenticator &ndash; the value of the
61367 <varname>$sender_host_authenticated</varname> variable.
61368 </para>
61369 </listitem></varlistentry>
61370 <varlistentry>
61371 <term><option>-host_lookup_failed</option></term>
61372 <listitem>
61373 <para>
61374 This is present if an attempt to look up the sending host&#x2019;s name from its IP
61375 address failed. It corresponds to the <varname>$host_lookup_failed</varname> variable.
61376 </para>
61377 </listitem></varlistentry>
61378 <varlistentry>
61379 <term><option>-host_name</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
61380 <listitem>
61381 <para>
61382 <indexterm role="concept">
61383 <primary>reverse DNS lookup</primary>
61384 </indexterm>
61385 <indexterm role="concept">
61386 <primary>DNS</primary>
61387 <secondary>reverse lookup</secondary>
61388 </indexterm>
61389 This records the name of the remote host from which the message was received,
61390 if the host name was looked up from the IP address when the message was being
61391 received. It is not present if no reverse lookup was done.
61392 </para>
61393 </listitem></varlistentry>
61394 <varlistentry>
61395 <term><option>-ident</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
61396 <listitem>
61397 <para>
61398 For locally submitted messages, this records the login of the originating user,
61399 unless it was a trusted user and the <option>-oMt</option> option was used to specify an
61400 ident value. For messages received over TCP/IP, this records the ident string
61401 supplied by the remote host, if any.
61402 </para>
61403 </listitem></varlistentry>
61404 <varlistentry>
61405 <term><option>-interface_address</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;.&lt;<emphasis>port</emphasis>&gt;</term>
61406 <listitem>
61407 <para>
61408 This records the IP address of the local interface and the port number through
61409 which a message was received from a remote host. It is omitted for locally
61410 generated messages.
61411 </para>
61412 </listitem></varlistentry>
61413 <varlistentry>
61414 <term><option>-local</option></term>
61415 <listitem>
61416 <para>
61417 The message is from a local sender.
61418 </para>
61419 </listitem></varlistentry>
61420 <varlistentry>
61421 <term><option>-localerror</option></term>
61422 <listitem>
61423 <para>
61424 The message is a locally-generated bounce message.
61425 </para>
61426 </listitem></varlistentry>
61427 <varlistentry>
61428 <term><option>-local_scan</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
61429 <listitem>
61430 <para>
61431 This records the data string that was returned by the <function>local_scan()</function> function
61432 when the message was received &ndash; the value of the <varname>$local_scan_data</varname>
61433 variable. It is omitted if no data was returned.
61434 </para>
61435 </listitem></varlistentry>
61436 <varlistentry>
61437 <term><option>-manual_thaw</option></term>
61438 <listitem>
61439 <para>
61440 The message was frozen but has been thawed manually, that is, by an explicit
61441 Exim command rather than via the auto-thaw process.
61442 </para>
61443 </listitem></varlistentry>
61444 <varlistentry>
61445 <term><option>-N</option></term>
61446 <listitem>
61447 <para>
61448 A testing delivery process was started using the <option>-N</option> option to suppress any
61449 actual deliveries, but delivery was deferred. At any further delivery attempts,
61450 <option>-N</option> is assumed.
61451 </para>
61452 </listitem></varlistentry>
61453 <varlistentry>
61454 <term><option>-received_protocol</option></term>
61455 <listitem>
61456 <para>
61457 This records the value of the <varname>$received_protocol</varname> variable, which contains
61458 the name of the protocol by which the message was received.
61459 </para>
61460 </listitem></varlistentry>
61461 <varlistentry>
61462 <term><option>-sender_set_untrusted</option></term>
61463 <listitem>
61464 <para>
61465 The envelope sender of this message was set by an untrusted local caller (used
61466 to ensure that the caller is displayed in queue listings).
61467 </para>
61468 </listitem></varlistentry>
61469 <varlistentry>
61470 <term><option>-spam_score_int</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
61471 <listitem>
61472 <para>
61473 If a message was scanned by SpamAssassin, this is present. It records the value
61474 of <varname>$spam_score_int</varname>.
61475 </para>
61476 </listitem></varlistentry>
61477 <varlistentry>
61478 <term><option>-tls_certificate_verified</option></term>
61479 <listitem>
61480 <para>
61481 A TLS certificate was received from the client that sent this message, and the
61482 certificate was verified by the server.
61483 </para>
61484 </listitem></varlistentry>
61485 <varlistentry>
61486 <term><option>-tls_cipher</option>&nbsp;&lt;<emphasis>cipher name</emphasis>&gt;</term>
61487 <listitem>
61488 <para>
61489 When the message was received over an encrypted connection, this records the
61490 name of the cipher suite that was used.
61491 </para>
61492 </listitem></varlistentry>
61493 <varlistentry>
61494 <term><option>-tls_peerdn</option>&nbsp;&lt;<emphasis>peer DN</emphasis>&gt;</term>
61495 <listitem>
61496 <para>
61497 When the message was received over an encrypted connection, and a certificate
61498 was received from the client, this records the Distinguished Name from that
61499 certificate.
61500 </para>
61501 </listitem></varlistentry>
61502 </variablelist>
61503 <para>
61504 Following the options there is a list of those addresses to which the message
61505 is not to be delivered. This set of addresses is initialized from the command
61506 line when the <option>-t</option> option is used and <option>extract_addresses_remove_arguments</option>
61507 is set; otherwise it starts out empty. Whenever a successful delivery is made,
61508 the address is added to this set. The addresses are kept internally as a
61509 balanced binary tree, and it is a representation of that tree which is written
61510 to the spool file. If an address is expanded via an alias or forward file, the
61511 original address is added to the tree when deliveries to all its child
61512 addresses are complete.
61513 </para>
61514 <para>
61515 If the tree is empty, there is a single line in the spool file containing just
61516 the text <quote>XX</quote>. Otherwise, each line consists of two letters, which are either
61517 Y or N, followed by an address. The address is the value for the node of the
61518 tree, and the letters indicate whether the node has a left branch and/or a
61519 right branch attached to it, respectively. If branches exist, they immediately
61520 follow. Here is an example of a three-node tree:
61521 </para>
61522 <literallayout class="monospaced">
61523 YY darcy@austen.fict.example
61524 NN alice@wonderland.fict.example
61525 NN editor@thesaurus.ref.example
61526 </literallayout>
61527 <para>
61528 After the non-recipients tree, there is a list of the message&#x2019;s recipients.
61529 This is a simple list, preceded by a count. It includes all the original
61530 recipients of the message, including those to whom the message has already been
61531 delivered. In the simplest case, the list contains one address per line. For
61532 example:
61533 </para>
61534 <literallayout class="monospaced">
61535 4
61536 editor@thesaurus.ref.example
61537 darcy@austen.fict.example
61538 rdo@foundation
61539 alice@wonderland.fict.example
61540 </literallayout>
61541 <para>
61542 However, when a child address has been added to the top-level addresses as a
61543 result of the use of the <option>one_time</option> option on a <command>redirect</command> router, each
61544 line is of the following form:
61545 </para>
61546 <literallayout>
61547 &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;
61548 </literallayout>
61549 <para>
61550 The 01 flag bit indicates the presence of the three other fields that follow
61551 the top-level address. Other bits may be used in future to support additional
61552 fields. The &lt;<emphasis>parent number</emphasis>&gt; is the offset in the recipients list of the
61553 original parent of the <quote>one time</quote> address. The first two fields are the
61554 envelope sender that is associated with this address and its length. If the
61555 length is zero, there is no special envelope sender (there are then two space
61556 characters in the line). A non-empty field can arise from a <command>redirect</command> router
61557 that has an <option>errors_to</option> setting.
61558 </para>
61559 <para>
61560 A blank line separates the envelope and status information from the headers
61561 which follow. A header may occupy several lines of the file, and to save effort
61562 when reading it in, each header is preceded by a number and an identifying
61563 character. The number is the number of characters in the header, including any
61564 embedded newlines and the terminating newline. The character is one of the
61565 following:
61566 </para>
61567 <informaltable frame="none">
61568 <tgroup cols="2" colsep="0" rowsep="0">
61569 <colspec colwidth="50pt" align="left"/>
61570 <colspec colwidth="254pt" align="left"/>
61571 <tbody>
61572 <row>
61573 <entry>&lt;<emphasis>blank</emphasis>&gt;</entry>
61574 <entry>header in which Exim has no special interest</entry>
61575 </row>
61576 <row>
61577 <entry><literal>B</literal></entry>
61578 <entry><emphasis>Bcc:</emphasis> header</entry>
61579 </row>
61580 <row>
61581 <entry><literal>C</literal></entry>
61582 <entry><emphasis>Cc:</emphasis> header</entry>
61583 </row>
61584 <row>
61585 <entry><literal>F</literal></entry>
61586 <entry><emphasis>From:</emphasis> header</entry>
61587 </row>
61588 <row>
61589 <entry><literal>I</literal></entry>
61590 <entry><emphasis>Message-id:</emphasis> header</entry>
61591 </row>
61592 <row>
61593 <entry><literal>P</literal></entry>
61594 <entry><emphasis>Received:</emphasis> header &ndash; P for <quote>postmark</quote></entry>
61595 </row>
61596 <row>
61597 <entry><literal>R</literal></entry>
61598 <entry><emphasis>Reply-To:</emphasis> header</entry>
61599 </row>
61600 <row>
61601 <entry><literal>S</literal></entry>
61602 <entry><emphasis>Sender:</emphasis> header</entry>
61603 </row>
61604 <row>
61605 <entry><literal>T</literal></entry>
61606 <entry><emphasis>To:</emphasis> header</entry>
61607 </row>
61608 <row>
61609 <entry><literal>*</literal></entry>
61610 <entry>replaced or deleted header</entry>
61611 </row>
61612 </tbody>
61613 </tgroup>
61614 </informaltable>
61615 <para>
61616 Deleted or replaced (rewritten) headers remain in the spool file for debugging
61617 purposes. They are not transmitted when the message is delivered. Here is a
61618 typical set of headers:
61619 </para>
61620 <literallayout class="monospaced">
61621 111P Received: by hobbit.fict.example with local (Exim 4.00)
61622 id 14y9EI-00026G-00; Fri, 11 May 2001 10:28:59 +0100
61623 049  Message-Id: &lt;E14y9EI-00026G-00@hobbit.fict.example&gt;
61624 038* X-rewrote-sender: bb@hobbit.fict.example
61625 042* From: Bilbo Baggins &lt;bb@hobbit.fict.example&gt;
61626 049F From: Bilbo Baggins &lt;B.Baggins@hobbit.fict.example&gt;
61627 099* To: alice@wonderland.fict.example, rdo@foundation,
61628 darcy@austen.fict.example, editor@thesaurus.ref.example
61629 104T To: alice@wonderland.fict.example, rdo@foundation.example,
61630 darcy@austen.fict.example, editor@thesaurus.ref.example
61631 038  Date: Fri, 11 May 2001 10:28:59 +0100
61632 </literallayout>
61633 <para>
61634 The asterisked headers indicate that the envelope sender, <emphasis>From:</emphasis> header, and
61635 <emphasis>To:</emphasis> header have been rewritten, the last one because routing expanded the
61636 unqualified domain <emphasis>foundation</emphasis>.
61637 <indexterm role="concept" startref="IIDforspo1" class="endofrange"/>
61638 <indexterm role="concept" startref="IIDforspo2" class="endofrange"/>
61639 <indexterm role="concept" startref="IIDforspo3" class="endofrange"/>
61640 </para>
61641 </section>
61642 </chapter>
61643
61644 <chapter id="CHID12">
61645 <title>Support for DKIM (DomainKeys Identified Mail) - RFC4871</title>
61646 <titleabbrev>DKIM Support</titleabbrev>
61647 <para>
61648 <indexterm role="concept">
61649 <primary>DKIM</primary>
61650 </indexterm>
61651 </para>
61652 <para>
61653 Since version 4.70, DKIM support is compiled into Exim by default. It can be
61654 disabled by setting DISABLE_DKIM=yes in Local/Makefile.
61655 </para>
61656 <para>
61657 Exim&#x2019;s DKIM implementation allows to
61658 </para>
61659 <orderedlist numeration="arabic">
61660 <listitem>
61661 <para>
61662 Sign outgoing messages: This function is implemented in the SMTP transport.
61663 It can co-exist with all other Exim features, including transport filters.
61664 </para>
61665 </listitem>
61666 <listitem>
61667 <para>
61668 Verify signatures in incoming messages: This is implemented by an additional
61669 ACL (acl_smtp_dkim), which can be called several times per message, with
61670 different signature context.
61671 </para>
61672 </listitem>
61673 </orderedlist>
61674 <para>
61675 In typical Exim style, the verification implementation does not include any
61676 default "policy". Instead it enables you to build your own policy using
61677 Exim&#x2019;s standard controls.
61678 </para>
61679 <para>
61680 Please note that verification of DKIM signatures in incoming mail is turned
61681 on by default for logging purposes. For each signature in incoming email,
61682 exim will log a line displaying the most important signature details, and the
61683 signature status. Here is an example:
61684 </para>
61685 <literallayout class="monospaced">
61686 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]
61687 </literallayout>
61688 <para>
61689 You might want to turn off DKIM verification processing entirely for internal
61690 or relay mail sources. To do that, set the <option>dkim_disable_verify</option> ACL
61691 control modifier. This should typically be done in the RCPT ACL, at points
61692 where you accept mail from relay sources (internal hosts or authenticated
61693 senders).
61694 </para>
61695 <section id="SECID513">
61696 <title>Signing outgoing messages</title>
61697 <para>
61698 <indexterm role="concept">
61699 <primary>DKIM</primary>
61700 <secondary>signing</secondary>
61701 </indexterm>
61702 </para>
61703 <para>
61704 Signing is implemented by setting private options on the SMTP transport.
61705 These options take (expandable) strings as arguments.
61706 </para>
61707 <para>
61708 <indexterm role="option">
61709 <primary><option>dkim_domain</option></primary>
61710 </indexterm>
61711 </para>
61712 <informaltable frame="all">
61713 <tgroup cols="4" colsep="0" rowsep="0">
61714 <colspec colwidth="8*" align="left"/>
61715 <colspec colwidth="6*" align="center"/>
61716 <colspec colwidth="6*" align="center"/>
61717 <colspec colwidth="6*" align="right"/>
61718 <tbody>
61719 <row>
61720 <entry><option>dkim_domain</option></entry>
61721 <entry>Use: <emphasis>smtp</emphasis></entry>
61722 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
61723 <entry>Default: <emphasis>unset</emphasis></entry>
61724 </row>
61725 </tbody>
61726 </tgroup>
61727 </informaltable>
61728 <para>
61729 MANDATORY
61730 The domain you want to sign with. The result of this expanded
61731 option is put into the <option>$dkim_domain</option> expansion variable.
61732 </para>
61733 <para>
61734 <indexterm role="option">
61735 <primary><option>dkim_selector</option></primary>
61736 </indexterm>
61737 </para>
61738 <informaltable frame="all">
61739 <tgroup cols="4" colsep="0" rowsep="0">
61740 <colspec colwidth="8*" align="left"/>
61741 <colspec colwidth="6*" align="center"/>
61742 <colspec colwidth="6*" align="center"/>
61743 <colspec colwidth="6*" align="right"/>
61744 <tbody>
61745 <row>
61746 <entry><option>dkim_selector</option></entry>
61747 <entry>Use: <emphasis>smtp</emphasis></entry>
61748 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
61749 <entry>Default: <emphasis>unset</emphasis></entry>
61750 </row>
61751 </tbody>
61752 </tgroup>
61753 </informaltable>
61754 <para>
61755 MANDATORY
61756 This sets the key selector string. You can use the <option>$dkim_domain</option> expansion
61757 variable to look up a matching selector. The result is put in the expansion
61758 variable <option>$dkim_selector</option> which should be used in the <option>dkim_private_key</option>
61759 option along with <option>$dkim_domain</option>.
61760 </para>
61761 <para>
61762 <indexterm role="option">
61763 <primary><option>dkim_private_key</option></primary>
61764 </indexterm>
61765 </para>
61766 <informaltable frame="all">
61767 <tgroup cols="4" colsep="0" rowsep="0">
61768 <colspec colwidth="8*" align="left"/>
61769 <colspec colwidth="6*" align="center"/>
61770 <colspec colwidth="6*" align="center"/>
61771 <colspec colwidth="6*" align="right"/>
61772 <tbody>
61773 <row>
61774 <entry><option>dkim_private_key</option></entry>
61775 <entry>Use: <emphasis>smtp</emphasis></entry>
61776 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
61777 <entry>Default: <emphasis>unset</emphasis></entry>
61778 </row>
61779 </tbody>
61780 </tgroup>
61781 </informaltable>
61782 <para>
61783 MANDATORY
61784 This sets the private key to use. You can use the <option>$dkim_domain</option> and
61785 <option>$dkim_selector</option> expansion variables to determine the private key to use.
61786 The result can either
61787 </para>
61788 <itemizedlist>
61789 <listitem>
61790 <para>
61791 be a valid RSA private key in ASCII armor, including line breaks.
61792 </para>
61793 </listitem>
61794 <listitem>
61795 <para>
61796 start with a slash, in which case it is treated as a file that contains
61797 the private key.
61798 </para>
61799 </listitem>
61800 <listitem>
61801 <para>
61802 be "0", "false" or the empty string, in which case the message will not
61803 be signed. This case will not result in an error, even if <option>dkim_strict</option>
61804 is set.
61805 </para>
61806 </listitem>
61807 </itemizedlist>
61808 <para>
61809 <indexterm role="option">
61810 <primary><option>dkim_canon</option></primary>
61811 </indexterm>
61812 </para>
61813 <informaltable frame="all">
61814 <tgroup cols="4" colsep="0" rowsep="0">
61815 <colspec colwidth="8*" align="left"/>
61816 <colspec colwidth="6*" align="center"/>
61817 <colspec colwidth="6*" align="center"/>
61818 <colspec colwidth="6*" align="right"/>
61819 <tbody>
61820 <row>
61821 <entry><option>dkim_canon</option></entry>
61822 <entry>Use: <emphasis>smtp</emphasis></entry>
61823 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
61824 <entry>Default: <emphasis>unset</emphasis></entry>
61825 </row>
61826 </tbody>
61827 </tgroup>
61828 </informaltable>
61829 <para>
61830 OPTIONAL
61831 This option sets the canonicalization method used when signing a message.
61832 The DKIM RFC currently supports two methods: "simple" and "relaxed".
61833 The option defaults to "relaxed" when unset. Note: the current implementation
61834 only supports using the same canonicalization method for both headers and body.
61835 </para>
61836 <para>
61837 <indexterm role="option">
61838 <primary><option>dkim_strict</option></primary>
61839 </indexterm>
61840 </para>
61841 <informaltable frame="all">
61842 <tgroup cols="4" colsep="0" rowsep="0">
61843 <colspec colwidth="8*" align="left"/>
61844 <colspec colwidth="6*" align="center"/>
61845 <colspec colwidth="6*" align="center"/>
61846 <colspec colwidth="6*" align="right"/>
61847 <tbody>
61848 <row>
61849 <entry><option>dkim_strict</option></entry>
61850 <entry>Use: <emphasis>smtp</emphasis></entry>
61851 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
61852 <entry>Default: <emphasis>unset</emphasis></entry>
61853 </row>
61854 </tbody>
61855 </tgroup>
61856 </informaltable>
61857 <para>
61858 OPTIONAL
61859 This  option  defines  how  Exim  behaves  when  signing a message that
61860 should be signed fails for some reason.  When the expansion evaluates to
61861 either "1" or "true", Exim will defer. Otherwise Exim will send the message
61862 unsigned. You can use the <option>$dkim_domain</option> and <option>$dkim_selector</option> expansion
61863 variables here.
61864 </para>
61865 <para>
61866 <indexterm role="option">
61867 <primary><option>dkim_sign_headers</option></primary>
61868 </indexterm>
61869 </para>
61870 <informaltable frame="all">
61871 <tgroup cols="4" colsep="0" rowsep="0">
61872 <colspec colwidth="8*" align="left"/>
61873 <colspec colwidth="6*" align="center"/>
61874 <colspec colwidth="6*" align="center"/>
61875 <colspec colwidth="6*" align="right"/>
61876 <tbody>
61877 <row>
61878 <entry><option>dkim_sign_headers</option></entry>
61879 <entry>Use: <emphasis>smtp</emphasis></entry>
61880 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
61881 <entry>Default: <emphasis>unset</emphasis></entry>
61882 </row>
61883 </tbody>
61884 </tgroup>
61885 </informaltable>
61886 <para>
61887 OPTIONAL
61888 When set, this option must expand to (or be specified as) a colon-separated
61889 list of header names. Headers with these names will be included in the message
61890 signature. When unspecified, the header names recommended in RFC4871 will be
61891 used.
61892 </para>
61893 </section>
61894 <section id="SECID514">
61895 <title>Verifying DKIM signatures in incoming mail</title>
61896 <para>
61897 <indexterm role="concept">
61898 <primary>DKIM</primary>
61899 <secondary>verification</secondary>
61900 </indexterm>
61901 </para>
61902 <para>
61903 Verification of DKIM signatures in incoming email is implemented via the
61904 <option>acl_smtp_dkim</option> ACL. By default, this ACL is called once for each
61905 syntactically(!) correct signature in the incoming message.
61906 </para>
61907 <para>
61908 To evaluate the signature in the ACL a large number of expansion variables
61909 containing the signature status and its details are set up during the
61910 runtime of the ACL.
61911 </para>
61912 <para>
61913 Calling the ACL only for existing signatures is not sufficient to build
61914 more advanced policies. For that reason, the global option
61915 <option>dkim_verify_signers</option>, and a global expansion variable
61916 <option>$dkim_signers</option> exist.
61917 </para>
61918 <para>
61919 The global option <option>dkim_verify_signers</option> can be set to a colon-separated
61920 list of DKIM domains or identities for which the ACL <option>acl_smtp_dkim</option> is
61921 called. It is expanded when the message has been received. At this point,
61922 the expansion variable <option>$dkim_signers</option> already contains a colon-
61923 separated list of signer domains and identities for the message. When
61924 <option>dkim_verify_signers</option> is not specified in the main configuration,
61925 it defaults as:
61926 </para>
61927 <literallayout class="monospaced">
61928 dkim_verify_signers = $dkim_signers
61929 </literallayout>
61930 <para>
61931 This leads to the default behaviour of calling <option>acl_smtp_dkim</option> for each
61932 DKIM signature in the message. Current DKIM verifiers may want to explicitly
61933 call the ACL for known domains or identities. This would be achieved as follows:
61934 </para>
61935 <literallayout class="monospaced">
61936 dkim_verify_signers = paypal.com:ebay.com:$dkim_signers
61937 </literallayout>
61938 <para>
61939 This would result in <option>acl_smtp_dkim</option> always being called for "paypal.com"
61940 and "ebay.com", plus all domains and identities that have signatures in the message.
61941 You can also be more creative in constructing your policy. Example:
61942 </para>
61943 <literallayout class="monospaced">
61944 dkim_verify_signers = $sender_address_domain:$dkim_signers
61945 </literallayout>
61946 <para>
61947 If a domain or identity is listed several times in the (expanded) value of
61948 <option>dkim_verify_signers</option>, the ACL is only called once for that domain or identity.
61949 </para>
61950 <para>
61951 Inside the <option>acl_smtp_dkim</option>, the following expansion variables are
61952 available (from most to least important):
61953 </para>
61954 <variablelist>
61955 <varlistentry>
61956 <term><option>$dkim_cur_signer</option></term>
61957 <listitem>
61958 <para>
61959 The signer that is being evaluated in this ACL run. This can be domain or
61960 an identity. This is one of the list items from the expanded main option
61961 <option>dkim_verify_signers</option> (see above).
61962 </para>
61963 </listitem></varlistentry>
61964 <varlistentry>
61965 <term><option>$dkim_verify_status</option></term>
61966 <listitem>
61967 <para>
61968 A string describing the general status of the signature. One of
61969 </para>
61970 <itemizedlist>
61971 <listitem>
61972 <para>
61973 <option>none</option>: There is no signature in the message for the current domain or
61974 identity (as reflected by <option>$dkim_cur_signer</option>).
61975 </para>
61976 </listitem>
61977 <listitem>
61978 <para>
61979 <option>invalid</option>: The signature could not be verified due to a processing error.
61980 More detail is available in <option>$dkim_verify_reason</option>.
61981 </para>
61982 </listitem>
61983 <listitem>
61984 <para>
61985 <option>fail</option>: Verification of the signature failed.  More detail is
61986 available in <option>$dkim_verify_reason</option>.
61987 </para>
61988 </listitem>
61989 <listitem>
61990 <para>
61991 <option>pass</option>: The signature passed verification. It is valid.
61992 </para>
61993 </listitem>
61994 </itemizedlist>
61995 </listitem></varlistentry>
61996 <varlistentry>
61997 <term><option>$dkim_verify_reason</option></term>
61998 <listitem>
61999 <para>
62000 A string giving a litte bit more detail when <option>$dkim_verify_status</option> is either
62001 "fail" or "invalid". One of
62002 </para>
62003 <itemizedlist>
62004 <listitem>
62005 <para>
62006 <option>pubkey_unavailable</option> (when <option>$dkim_verify_status</option>="invalid"): The public
62007 key for the domain could not be retrieved. This may be a temporary problem.
62008 </para>
62009 </listitem>
62010 <listitem>
62011 <para>
62012 <option>pubkey_syntax</option> (when <option>$dkim_verify_status</option>="invalid"): The public key
62013 record for the domain is syntactically invalid.
62014 </para>
62015 </listitem>
62016 <listitem>
62017 <para>
62018 <option>bodyhash_mismatch</option> (when <option>$dkim_verify_status</option>="fail"): The calculated
62019 body hash does not match the one specified in the signature header. This
62020 means that the message body was modified in transit.
62021 </para>
62022 </listitem>
62023 <listitem>
62024 <para>
62025 <option>signature_incorrect</option> (when <option>$dkim_verify_status</option>="fail"): The signature
62026 could not be verified. This may mean that headers were modified,
62027 re-written or otherwise changed in a way which is incompatible with
62028 DKIM verification. It may of course also mean that the signature is forged.
62029 </para>
62030 </listitem>
62031 </itemizedlist>
62032 </listitem></varlistentry>
62033 <varlistentry>
62034 <term><option>$dkim_domain</option></term>
62035 <listitem>
62036 <para>
62037 The signing domain. IMPORTANT: This variable is only populated if there is
62038 an actual signature in the message for the current domain or identity (as
62039 reflected by <option>$dkim_cur_signer</option>).
62040 </para>
62041 </listitem></varlistentry>
62042 <varlistentry>
62043 <term><option>$dkim_identity</option></term>
62044 <listitem>
62045 <para>
62046 The signing identity, if present. IMPORTANT: This variable is only populated
62047 if there is an actual signature in the message for the current domain or
62048 identity (as reflected by <option>$dkim_cur_signer</option>).
62049 </para>
62050 </listitem></varlistentry>
62051 <varlistentry>
62052 <term><option>$dkim_selector</option></term>
62053 <listitem>
62054 <para>
62055 The key record selector string
62056 </para>
62057 </listitem></varlistentry>
62058 <varlistentry>
62059 <term><option>$dkim_algo</option></term>
62060 <listitem>
62061 <para>
62062 The algorithm used. One of &#x2019;rsa-sha1&#x2019; or &#x2019;rsa-sha256&#x2019;.
62063 </para>
62064 </listitem></varlistentry>
62065 <varlistentry>
62066 <term><option>$dkim_canon_body</option></term>
62067 <listitem>
62068 <para>
62069 The body canonicalization method. One of &#x2019;relaxed&#x2019; or &#x2019;simple&#x2019;.
62070 </para>
62071 </listitem></varlistentry>
62072 <varlistentry>
62073 <term><option>dkim_canon_headers</option></term>
62074 <listitem>
62075 <para>
62076 The header canonicalization method. One of &#x2019;relaxed&#x2019; or &#x2019;simple&#x2019;.
62077 </para>
62078 </listitem></varlistentry>
62079 <varlistentry>
62080 <term><option>$dkim_copiedheaders</option></term>
62081 <listitem>
62082 <para>
62083 A transcript of headers and their values which are included in the signature
62084 (copied from the &#x2019;z=&#x2019; tag of the signature).
62085 </para>
62086 </listitem></varlistentry>
62087 <varlistentry>
62088 <term><option>$dkim_bodylength</option></term>
62089 <listitem>
62090 <para>
62091 The number of signed body bytes. If zero ("0"), the body is unsigned. If no
62092 limit was set by the signer, "9999999999999" is returned. This makes sure
62093 that this variable always expands to an integer value.
62094 </para>
62095 </listitem></varlistentry>
62096 <varlistentry>
62097 <term><option>$dkim_created</option></term>
62098 <listitem>
62099 <para>
62100 UNIX timestamp reflecting the date and time when the signature was created.
62101 When this was not specified by the signer, "0" is returned.
62102 </para>
62103 </listitem></varlistentry>
62104 <varlistentry>
62105 <term><option>$dkim_expires</option></term>
62106 <listitem>
62107 <para>
62108 UNIX timestamp reflecting the date and time when the signer wants the
62109 signature to be treated as "expired". When this was not specified by the
62110 signer, "9999999999999" is returned. This makes it possible to do useful
62111 integer size comparisons against this value.
62112 </para>
62113 </listitem></varlistentry>
62114 <varlistentry>
62115 <term><option>$dkim_headernames</option></term>
62116 <listitem>
62117 <para>
62118 A colon-separated list of names of headers included in the signature.
62119 </para>
62120 </listitem></varlistentry>
62121 <varlistentry>
62122 <term><option>$dkim_key_testing</option></term>
62123 <listitem>
62124 <para>
62125 "1" if the key record has the "testing" flag set, "0" if not.
62126 </para>
62127 </listitem></varlistentry>
62128 <varlistentry>
62129 <term><option>$dkim_key_nosubdomaining</option></term>
62130 <listitem>
62131 <para>
62132 "1" if the key record forbids subdomaining, "0" otherwise.
62133 </para>
62134 </listitem></varlistentry>
62135 <varlistentry>
62136 <term><option>$dkim_key_srvtype</option></term>
62137 <listitem>
62138 <para>
62139 Service type (tag s=) from the key record. Defaults to "*" if not specified
62140 in the key record.
62141 </para>
62142 </listitem></varlistentry>
62143 <varlistentry>
62144 <term><option>$dkim_key_granularity</option></term>
62145 <listitem>
62146 <para>
62147 Key granularity (tag g=) from the key record. Defaults to "*" if not specified
62148 in the key record.
62149 </para>
62150 </listitem></varlistentry>
62151 <varlistentry>
62152 <term><option>$dkim_key_notes</option></term>
62153 <listitem>
62154 <para>
62155 Notes from the key record (tag n=)
62156 </para>
62157 </listitem></varlistentry>
62158 </variablelist>
62159 <para>
62160 In addition, two ACL conditions are provided:
62161 </para>
62162 <variablelist>
62163 <varlistentry>
62164 <term><option>dkim_signers</option></term>
62165 <listitem>
62166 <para>
62167 ACL condition that checks a colon-separated list of domains or identities
62168 for a match against the domain or identity that the ACL is currently verifying
62169 (reflected by <option>$dkim_cur_signer</option>). This is typically used to restrict an ACL
62170 verb to a group of domains or identities, like:
62171 </para>
62172 <literallayout class="monospaced">
62173 # Warn when message apparently from GMail has no signature at all
62174 warn log_message = GMail sender without DKIM signature
62175      sender_domains = gmail.com
62176      dkim_signers = gmail.com
62177      dkim_status = none
62178 </literallayout>
62179 </listitem></varlistentry>
62180 <varlistentry>
62181 <term><option>dkim_status</option></term>
62182 <listitem>
62183 <para>
62184 ACL condition that checks a colon-separated list of possible DKIM verification
62185 results agains the actual result of verification. This is typically used
62186 to restrict an ACL verb to a list of verification outcomes, like:
62187 </para>
62188 <literallayout class="monospaced">
62189 deny message = Message from Paypal with invalid or missing signature
62190      sender_domains = paypal.com:paypal.de
62191      dkim_signers = paypal.com:paypal.de
62192      dkim_status = none:invalid:fail
62193 </literallayout>
62194 <para>
62195 The possible status keywords are: &#x2019;none&#x2019;,&#x2019;invalid&#x2019;,&#x2019;fail&#x2019; and &#x2019;pass&#x2019;. Please
62196 see the documentation of the <option>$dkim_verify_status</option> expansion variable above
62197 for more information of what they mean.
62198 </para>
62199 </listitem></varlistentry>
62200 </variablelist>
62201 </section>
62202 </chapter>
62203
62204 <chapter id="CHID13">
62205 <title>Adding new drivers or lookup types</title>
62206 <titleabbrev>Adding drivers or lookups</titleabbrev>
62207 <para>
62208 <indexterm role="concept">
62209 <primary>adding drivers</primary>
62210 </indexterm>
62211 <indexterm role="concept">
62212 <primary>new drivers, adding</primary>
62213 </indexterm>
62214 <indexterm role="concept">
62215 <primary>drivers</primary>
62216 <secondary>adding new</secondary>
62217 </indexterm>
62218 The following actions have to be taken in order to add a new router, transport,
62219 authenticator, or lookup type to Exim:
62220 </para>
62221 <orderedlist numeration="arabic">
62222 <listitem>
62223 <para>
62224 Choose a name for the driver or lookup type that does not conflict with any
62225 existing name; I will use <quote>newdriver</quote> in what follows.
62226 </para>
62227 </listitem>
62228 <listitem>
62229 <para>
62230 Add to <filename>src/EDITME</filename> the line:
62231 </para>
62232 <literallayout>
62233 &lt;<emphasis>type</emphasis>&gt;<literal>_NEWDRIVER=yes</literal>
62234 </literallayout>
62235 <para>
62236 where &lt;<emphasis>type</emphasis>&gt; is ROUTER, TRANSPORT, AUTH, or LOOKUP. If the
62237 code is not to be included in the binary by default, comment this line out. You
62238 should also add any relevant comments about the driver or lookup type.
62239 </para>
62240 </listitem>
62241 <listitem>
62242 <para>
62243 Add to <filename>src/config.h.defaults</filename> the line:
62244 </para>
62245 <literallayout class="monospaced">
62246 #define &lt;type&gt;_NEWDRIVER
62247 </literallayout>
62248 </listitem>
62249 <listitem>
62250 <para>
62251 Edit <filename>src/drtables.c</filename>, adding conditional code to pull in the private header
62252 and create a table entry as is done for all the other drivers and lookup types.
62253 </para>
62254 </listitem>
62255 <listitem>
62256 <para>
62257 Edit <filename>Makefile</filename> in the appropriate sub-directory (<filename>src/routers</filename>,
62258 <filename>src/transports</filename>, <filename>src/auths</filename>, or <filename>src/lookups</filename>); add a line for the new
62259 driver or lookup type and add it to the definition of OBJ.
62260 </para>
62261 </listitem>
62262 <listitem>
62263 <para>
62264 Create <filename>newdriver.h</filename> and <filename>newdriver.c</filename> in the appropriate sub-directory of
62265 <filename>src</filename>.
62266 </para>
62267 </listitem>
62268 <listitem>
62269 <para>
62270 Edit <filename>scripts/MakeLinks</filename> and add commands to link the <filename>.h</filename> and <filename>.c</filename> files
62271 as for other drivers and lookups.
62272 </para>
62273 </listitem>
62274 </orderedlist>
62275 <para>
62276 Then all you need to do is write the code! A good way to start is to make a
62277 proforma by copying an existing module of the same type, globally changing all
62278 occurrences of the name, and cutting out most of the code. Note that any
62279 options you create must be listed in alphabetical order, because the tables are
62280 searched using a binary chop procedure.
62281 </para>
62282 <para>
62283 There is a <filename>README</filename> file in each of the sub-directories of <filename>src</filename> describing
62284 the interface that is expected.
62285 </para>
62286 <?sdop
62287   format="newpage"
62288   foot_right_recto="&chaptertitle;"
62289   foot_right_verso="&chaptertitle;"
62290 ?>
62291 </chapter>
62292
62293 <index role="option">
62294 <title>Options index</title>
62295 </index>
62296
62297 <index role="variable">
62298 <title>Variables index</title>
62299 </index>
62300
62301 <index role="concept">
62302 <title>Concept index</title>
62303 </index>
62304
62305 </book>