html,body,div,span,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,code,del,dfn,em,img,q,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;font-weight:inherit;font-style:inherit;font-size:100%;font-family:inherit;vertical-align:baseline}body{font-size:62.5%;font-family:Verdana,Arial,Helvetica,Sans-Serif}h1,h2,h3,h4,h5,h6{font-family:serif;line-height:1.7;font-weight:bold}h1{font-size:3.0em;text-align:center}h2{font-size:2.2em;text-align:center}h3{font-size:1.7em}h4{font-size:1.5em}h5{font-size:1.3em}h6{font-size:1.1em}@media all and (max-width:640px){h1{font-size:2.4em}h2{font-size:1.4em}h3{font-size:1.25em}h4{font-size:1.2em}h5{font-size:1.15em}h6{font-size:1.1em}}a{color:#037094}a:visited{color:#335024}a:hover,a:visited:hover{color:#000}html,body{height:100%;background-color:#fff}.hidden{display:none}#inner ul,#inner ol{padding:0 0 1em 4em}#inner p,#inner pre{margin-bottom:1em}#inner pre{font-family:monospace;white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;word-wrap:break-word}#content{padding:0 1em}@media all and (max-width:640px){#content{padding:0}}#header{position:absolute;top:0;left:0;height:2em;width:100%;line-height:2;background-color:#000;z-index:1000;background-color:#1f3c5a;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#032044',endColorstr='#1f3c5a');background:-webkit-gradient(linear,left top,left bottom,from(#032044),to(#1f3c5a));background:-moz-linear-gradient(top,#032044,#1f3c5a)}@media all and (max-width:640px){#header{height:2.5em;line-height:2.5}}body > #header.fixed{position:fixed}#header a{color:#fff;white-space:nowrap}#header a:hover{color:#aaf}#header,.nav{opacity:0.925}#outer{position:absolute;top:0;left:0;width:100%;min-height:100%;height:auto !important;height:100%;background-color:#fff}#outer .left_bar,#outer .right_bar{display:none}#outer > .left_bar.display,#outer > .right_bar.display{display:block;position:absolute;top:0;width:10%;height:100%;background-color:#ddd}#outer > .left_bar{left:0}#outer > .right_bar{right:0}@media all and (max-width:640px){#outer > .left_bar.display,#outer > .right_bar.display{display:none}}.nav{position:relative;top:0;left:0;margin-top:6em;padding:0 0 0.5em 0;width:100%;text-align:center;list-style:none;background-color:#1f3c5a;z-index:1000}.nav li{display:inline;font-size:1.2em;padding:0 0.3em}.nav li a{color:#fff}.nav li a:hover{color:#aaf}.nav li a:visited{color:#aaf}.nav li a:visited:hover{color:#fff}#outer > #nav_float{position:fixed;top:0;left:0;width:100%;display:none;margin-top:0}.nav li.search,.nav form{display:inline;padding-top:4px}.nav .search_field_container.roundit .search_field{border:0;padding:0;margin:0}.nav .search_field_container.roundit{background-color:#fff;-moz-border-radius:1em;-webkit-border-radius:1em;padding:0.1em 1em;font-size:1.2em}.nav .search_field_container{cursor:text}#inner{z-index:1000;width:80%;min-width:50%;max-width:65em;padding:0.71429em 0 1.42857em 0;margin:0 auto;font-size:1.4em;line-height:2;background-color:#fff}@media all and (max-width:640px){#inner{width:auto}}#branding{display:block;visibility:hidden;width:80%;margin:-1.42857em auto 1.42857em auto;overflow:hidden;border:0;outline:0}#footer{position:absolute;bottom:0;left:0;height:1.4em;width:100%;z-index:1000;line-height:1.4;text-align:center;text-align:center}#footer,#footer a{color:#999}#footer:hover,#footer:hover a{color:#444}#footer a:hover{color:#000}.docbook_filename,.docbook_emphasis,.docbook_function{font-style:italic}.docbook_option,.docbook_command{font-weight:bold}.docbook_literal{font-family:monospace}.docbook_literallayout{background-color:#e8e8d0}.docbook_literallayout pre{padding:1em;margin-bottom:1em}(function($){var $nav_float=$('#nav_flow').clone().attr('id','nav_float').appendTo('#outer');var floating=false;$(window).bind('load resize scroll',function(){var header_height=$('#header').height();var top=$(this).scrollTop();if(top>header_height){if(!floating){$nav_float.show();$('#nav_flow').css('visibility','hidden');floating=true;}}else{if(floating){$nav_float.hide();$('#nav_flow').css('visibility','visible');floating=false;}}});$('#outer > .right_bar, #outer > .left_bar').addClass('display');})(jQuery);if(document.location.href.match(/^https?:\/\/([^\/]+\.)*exim\.org\//)){$('#branding').remove();}else{$('#branding').ready(function(){try{var doc=$('#branding')[0].contentWindow.document;if(doc.title.match(/\b(found|404)\b/i)){$('#branding').remove();}else{$(doc).find('a').each(function(){if($(this).attr('title')=='')$(this).attr('title','Sponsor of this mirror');$(this).css('opacity',0.8).mouseover(function(){$(this).css('opacity',1)}).mouseout(function(){$(this).css('opacity',0.8)});});$('#branding').height($(doc).find('img').height()?$(doc).find('img').height()+16+'px':'auto').hide().css('visibility','visible').fadeIn(2000);}}catch(e){$('#branding').remove();}});} (function(){$('#footer').hide();setTimeout(function(){$('#footer').fadeIn('slow')},2000);})();(function(){if(!('placeholder' in document.createElement('input')))$('.nav li.search input.search_field').focus(function(e){if($(this).val()===' '+$(this).attr('placeholder'))$(this).val('').css('color','#000');}).blur(function(e){if($(this).val()===' '+$(this).attr('placeholder')||$(this).val()==='')$(this).css('color','#666').val(' '+$(this).attr('placeholder'));}).blur();if(document.body.style.MozBorderRadius!==undefined)$('.search_field_container').addClass('roundit').click(function(){$(this).find('input').focus()});})();(function($){var jump=function(id){if($('#'+id).length==0)return false;document.location.href=document.location.href.replace(/#.+/,'')+'#'+id;$('html,body').animate({scrollTop:$('#'+id).position()['top']-$('.nav').height()-5},100);return true;};var uri=document.location.pathname;var uri_end=uri.replace(/^.*\//,'');if(document.location.href.match(/#./))jump(document.location.href.replace(/^.*#(.+)$/,'$1'));$('a').live('click',function(e){var href=$(this).attr('href');if(!href.match(/^.*#.+$/))return true;var href_uri=href
The first part of the run time configuration file contains three types of item:
Macro definitions: These lines start with an upper case letter. See section 6.4 for details of macro processing.
Named list definitions: These lines start with one of the words ``domainlist'', ``hostlist'', ``addresslist'', or ``localpartlist''. Their use is described in section 10.5.
Main configuration settings: Each setting occupies one line of the file (including possible continuations). If any setting is preceded by the word ``hide'', the -bP option displays its value to admin users only (see section 6.5).
This chapter lists all the main configuration options, along with their types and default values, in alphabetical order.
This option causes Exim to send 8BITMIME in its response to an SMTP EHLO command, and to accept the BODY= parameter on MAIL commands. However, though Exim is 8-bit clean, it is not a protocol converter, and it takes no steps to do anything special with messages received by this route. Consequently, this option is turned off by default.
This option defines the ACL that is run when an SMTP AUTH command is received. See chapter 37 for further details.
This option defines the ACL that is run after an SMTP DATA command has been processed and the message itself has been received, but before the final acknowledgement is sent. See chapter 37 for further details.
This option defines the ACL that is run when an SMTP ETRN command is received. See chapter 37 for further details.
This option defines the ACL that is run when an SMTP EXPN command is received. See chapter 37 for further details.
This option defines the ACL that is run when an SMTP RCPT command is received. See chapter 37 for further details.
This option defines the ACL that is run when an SMTP VRFY command is received. See chapter 37 for further details.
If the current group or any of the supplementary groups of the caller is in this colon-separated list, the caller has admin privileges. If all your system programmers are in a specific group, for example, you can give them all Exim admin privileges by putting that group in admin_groups. However, this does not permit them to read Exim's spool files (whose group owner is the Exim gid). To permit this, you have to add individuals to the Exim group.
Exim's command line takes the standard Unix form of a sequence of options, each starting with a hyphen character, followed by a number of arguments. The options are compatible with the main options of Sendmail, and there are also some additional options, some of which are compatible with Smail 3. Certain combinations of options do not make sense, and provoke an error if used. The form of the arguments depends on which options are set.
If Exim is called under the name mailq, it behaves as if the option -bp were present before any other options. The -bp option requests a listing of the contents of the mail queue on the standard output. This feature is for compatibility with some systems that contain a command of that name in one of the standard libraries, symbolically linked to /usr/sbin/sendmail or /usr/lib/sendmail.
If Exim is called under the name rsmtp it behaves as if the option -bS were present before any other options, for compatibility with Smail. The -bS option is used for reading in a number of messages in batched SMTP format.
If Exim is called under the name rmail it behaves as if the -i and -oee options were present before any other options, for compatibility with Smail. The name rmail is used as an interface by some UUCP systems.
If Exim is called under the name runq it behaves as if the option -q were present before any other options, for compatibility with Smail. The -q option causes a single queue runner process to be started.
If Exim is called under the name newaliases it behaves as if the option -bi were present before any other options, for compatibility with Sendmail. This option is used for rebuilding Sendmail's alias file. Exim does not have the concept of a single alias file, but can be configured to run a given command if called with the -bi option.
Some Exim options are available only to trusted users and others are available only to admin users. In the description below, the phrases ``Exim user'' and ``Exim group'' mean the user and group defined by EXIM_USER and EXIM_GROUP in Local/Makefile or set by the exim_user and exim_group options. These do not necessarily have to use the name ``exim''.
The trusted users are root, the Exim user, any user listed in the trusted_users configuration option, and any user whose current group or any supplementary group is one of those listed in the trusted_groups configuration option. Note that the Exim group is not automatically trusted.
Trusted users are always permitted to use the -f option or a leading ``From '' line to specify the envelope sender of a message that is passed to Exim through the local interface (see the -bm and -f options below). See the untrusted_set_sender option for a way of permitting non-trusted users to set envelope senders. For a trusted user, there is never any check on the contents of the From: header line, and a Sender: line is never added. Furthermore, any existing Sender: line in incoming local (non-TCP/IP) messages is not removed.
Trusted users may also specify a host name, host address, interface address, protocol name, ident value, and authentication data when submitting a message locally. Thus, they are able to insert messages into Exim's queue locally that have the characteristics of messages received from a remote host. Untrusted users may in some circumstances use -f, but can never set the other values that are available to trusted users.
The admin users are root, the Exim user, and any user that is a member of the Exim group or of any group listed in the admin_groups configuration option. The current group does not have to be one of these groups.
Admin users are permitted to list the queue, and to carry out certain operations on messages, for example, to force delivery failures. It is also necessary to be an admin user in order to see the full information provided by the Exim monitor, and full debugging output.
By default, the use of the -M, -q, -R, and -S options to cause Exim to attempt delivery of messages on its queue is restricted to admin users. However, this restriction can be relaxed by setting the prod_requires_admin option false (that is, specifying no_prod_requires_admin).
Similarly, the use of the -bp option to list all the messages in the queue is restricted to admin users unless queue_list_requires_admin is set false.
Warning: If you configure your system so that admin users are able to edit Exim's configuration file, you are giving those users an easy way of getting root. There is further discussion of this issue at the start of chapter 6.
The command options are described in alphabetical order below.
This is a pseudo-option whose only purpose is to terminate the options and therefore to cause subsequent command line items to be treated as arguments rather than options, even if they begin with hyphens.
This option causes Exim to output a few sentences stating what it is. The same output is generated if the Exim binary is called with no options and no arguments.
This is a Sendmail option for selecting 7 or 8 bit processing. Exim is 8-bit clean; it ignores this option.
This option runs Exim as a daemon, awaiting incoming SMTP connections. Usually the -bd option is combined with the -q<time> option, to specify that the daemon should also initiate periodic queue runs.
The -bd option can be used only by an admin user. If either of the -d (debugging) or -v (verifying) options are set, the daemon does not disconnect from the controlling terminal. When running this way, it can be stopped by pressing ctrl-C.
By default, Exim listens for incoming connections to the standard SMTP port on all the host's interfaces. The port can be varied by means of the daemon_smtp_port option. The daemon can also be restricted to specific interfaces by setting the local_interfaces option in the configuration file. This option is also able to specify a different port for each interface it lists, making it possible to listen on multiple ports. The -oX command line option can be used to override local_interfaces.
When a listening daemon is started without the use of -oX (that is, without overriding the normal configuration), it writes its process id to a file called exim-daemon.pid in Exim's spool directory. This location can be overridden by setting PID_FILE_PATH in Local/Makefile. The file is written while Exim is still running as root.
When -oX is used on the command line to start a listening daemon, the process id is not written to the normal pid file path. However, -oP can be used to specify a path on the command line if a pid file is required.
The SIGHUP signal can be used to cause the daemon to re-exec itself. This should be done whenever Exim's configuration file, or any file that is incorporated into it by means of the .include facility, is changed, and also whenever a new version of Exim is installed. It is not necessary to do this when other files that are referenced from the configuration (for example, alias files) are changed, because these are reread each time they are used.
This option has the same effect as -bd except that it never disconnects from the controlling terminal, even when no debugging is specified.
Run Exim in expansion testing mode. Exim discards its root privilege, to prevent ordinary users from using this mode to read otherwise inaccessible files. If no arguments are given, Exim runs interactively, prompting for lines of data. Long expressions can be split over several lines by using backslash continuations. As in Exim's run time configuration, whitespace at the start of continuation lines is ignored.
Each argument or data line is passed through the string expansion mechanism, and the result is output. Variable values from the configuration file (for example, $qualify_domain) are available, but no message-specific values (such as $domain) are set, because no message is being processed.
This option is the same as -bf except that it assumes that the filter being tested is a system filter. The additional commands that are available only in system filters are recognized.
This option runs Exim in filter testing mode; the file is the filter file to be tested, and a test message must be supplied on the standard input. If there are no message-dependent tests in the filter, an empty file can be supplied. If a system filter file is being tested, -bF should be used instead of -bf. If the test file does not begin with the special line
# Exim filter
it is taken to be a normal .forward file, and is tested for validity under that interpretation. The result of this command, provided no errors are detected, is a list of the actions that Exim would try to take if presented with the message for real. More details of filter testing are given in the separate document entitled Exim's interface to mail filtering.
When testing a filter file, the envelope sender can be set by the -f option, or by a ``From '' line at the start of the test message. Various parameters that would normally be taken from the envelope recipient address of the message can be set by means of additional command line options. These are:
| -bfd | <domain> | default is the qualify domain |
| -bfl | <local_part> | default is the logged in user |
| -bfp | <local_part_prefix> | default is null |
| -bfs | <local_part_suffix> | default is null |
The local part should always be set to the incoming address with any prefix or suffix stripped, because that is how it appears to the filter when a message is actually being delivered.
This option runs a fake SMTP session as if from the given IP address, using the standard input and output. The IP address may include a port number at the end, after a full stop. For example:
exim -bh 10.9.8.7.1234 exim -bh fe80::a00:20ff:fe86:a061.5678
Comments as to what is going on are written to the standard error file. These include lines beginning with ``LOG'' for anything that would have been logged. This facility is for testing configuration options for blocking hosts and/or senders and for checking on relaying control.
Warning: You canno
A B C D E F G H I J K L M N O P Q R S T U V W X
$header_
$host [2]
$host_address [2]
$value [2] [3]
*@ with single-key lookup
+caseful
+defer_unknown
+exclude_unknown
+include_unknown [2]
-be option [2]
-bF option
-bf option
-bh option
-bi option
-bp option
-bt option
-bv option [2]
Many strings in Exim's run time configuration are expanded before use. Some of them are expanded every time they are used; others are expanded only once.
When a string is being expanded it is copied verbatim from left to right except when a dollar or backslash character is encountered. A dollar specifies the start of a portion of the string which is interpreted and replaced as described below in section 11.4 onwards. Backslash is used as an escape character, as described in the following section.
An uninterpreted dollar can be included in an expanded string by putting a backslash in front of it. A backslash can be used to prevent any special character being treated specially in an expansion, including itself. If the string appears in quotes in the configuration file, two backslashes are required because the quotes themselves cause interpretation of backslashes when the string is read in (see section 6.12).
A portion of the string can specified as non-expandable by placing it between two occurrences of \N. This is particularly useful for protecting regular expressions, which often contain backslashes and dollar signs. For example:
deny senders = \N^\d{8}[a-z]@some\.site\.example$\N
On encountering the first \N, the expander copies subsequent characters without interpretation until it reaches the next \N or the end of the string.
A backslash followed by one of the letters n, r, or t in an expanded string is recognized as an escape sequence for the character newline, carriage return, or tab, respectively. A backslash followed by up to three octal digits is recognized as an octal encoding for a single character, and a backslash followed by x and up to two hexadecimal digits is a hexadecimal encoding.
These escape sequences are also recognized in quoted strings when they are read in. Their interpretation in expansions as well is useful for unquoted strings, and for other cases such as looked-up strings that are then expanded.
Many expansions can be tested by calling Exim with the -be option. This takes the command arguments, or lines from the standard input if there are no arguments, runs them through the string expansion code, and writes the results to the standard output. Variables based on configuration values are set up, but since no message is being processed, variables such as $local_part have no value. Nevertheless the -be option can be useful for checking out file and database lookups, and the use of expansion operators such as sg, substr and nhash.
Exim gives up its root privilege when it is called with the -be option, and instead runs under the uid and gid it was called with, to prevent users from using -be for reading files to which they do not have access.
The following items are recognized in expanded strings. White space may be used between sub-items that are keywords or substrings enclosed in braces inside an outer set of braces, to improve readability. Warning: Within braces, white space is significant.
$<variable name> or ${<variable name>}
Substitute the contents of the named variable, for example
$local_part
${domain}
The second form can be used to separate the name from subsequent alphanumeric characters. This form (using curly brackets) is available only for variables; it does not apply to message headers. The names of the variables are given in section 11.8 below. If the name of a non-existent variable is given, the expansion fails.
The string is first itself expanded, and then the operation specified by <op> is applied to it. For example,
${lc:$local_part}
The string starts with the first character after the colon, which may be leading white space. A list of operators is given in section 11.5 below. The operator notation is used for simple expansion items that have just one argument, because it reduces the number of braces and therefore makes the string easier to understand.
${extract{<key>}{<string1>}{<string2>}{<string3>}}
The key and <string1> are first expanded separately. Leading and trailing whitespace is removed from the key (but not from any of the strings). The key must not consist entirely of digits. The expanded <string1> must be of the form:
<key1> = <value1> <key2> = <value2> ...
where the equals signs and spaces (but not both) are optional. If any of the values contain white space, they must be enclosed in double quotes, and any values that are enclosed in double quotes are subject to escape processing as described in section 6.12. The expanded <string1> is searched for the value that corresponds to the key. The search is case-insensitive. If the key is found, <string2> is expanded, and replaces the whole item; otherwise <string3> is used. During the expansion of <string2> the variable $value contains the value that has been extracted. Afterwards, it is restored to any previous value it might have had.
If {<string3>} is omitted, the item is replaced by an empty string if the key is not found. If {<string2>} is also omitted, the value that was extracted is used. Thus, for example, these two expansions are identical, and yield 2001:
${extract{gid}{uid=1984 gid=2001}}
${extract{gid}{uid=1984 gid=2001}{$value}}
Instead of {<string3>} the word fail (not in curly brackets) can appear, for example:
${extract{Z}{A=... B=...}{$value} fail }
{<string2>} must be present for fail to be recognized. When this syntax is used, if the extraction fails, the entire string expansion fails in a way that can be detected by the code in Exim which requested the expansion. This is called forced expansion failure, and its consequences depend on the circumstances. In some cases it is no different from any other expansion failure, but in others a different action may be taken. Such variations are mentioned in the documentation of the option which is expanded.
${extract{<number>}{<separators>}{<string1>}{<string2>}{<string3>}}
The <number> argument must consist entirely of decimal digits, apart from leading and trailing whitespace, which is ignored. This is what distinguishes this form of extract from the previous kind. It behaves in the same way, except that, instead of extracting a named field, it extracts from <string1> the field whose number is given as the first argument. You can use $value in <string2> or fail instead of <string3> as before.
The fields in the string are separated by any one of the characters in the separator string. These may include space or tab characters. The first field is numbered one. If the number is negative, the fields are counted from the end of the string, with the rightmost one numbered -1. If the number given is zero, the entire string is returned. If the modulus of the number is greater than the number of fields in the string, the result is the expansion of <string3>, or the empty string if <string3> is not provided. For example:
${extract{2}{:}{x:42:99:& Mailer::/bin/bash}}
yields 42, and
${extract{-4}{:}{x:42:99:& Mailer::/bin/bash}}
yields 99. Two successive separators mean that the field between them is empty (for example, the fifth field above).
${hash{<string1>}{<string2>}{<string3>}}
This is a textual hashing function, and was the first to be implemented in early versions of Exim. In current releases, there are other hashing functions (numeric, MD5, and SHA-1), which are described below.
The first two strings, after expansion, must be numbers. Call them <m> and <n>. If you are using fixed values for these numbers, that is, if <string1> and <string2> do not change when they are expanded, you can use the simpler operator notation that avoids some of the braces:
${hash_<n>_<m>:<string>}
The second number is optional (in both notations).
If <n> is greater than or equal to the length of the string, the expansion item returns the string. Otherwise it computes a new string of length <n> by applying a hashing function to the string. The new string consists of characters taken from the first <m> characters of the string
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQWRSTUVWXYZ0123456789
If <m> is not present the value 26 is used, so that only lower case letters appear. For example:
${hash{3}{monty}} yields jmg
${hash{5}{monty}} yields monty
${hash{4}{62}{monty python}} yields fbWx
$header_<header name>: or $h_<header name>:
$bheader_<header name>: or $bh_<header name>:
$rheader_<header name>: or $rh_<header name>:
Substitute the contents of the named message header line, for example
$header_reply-to:
The newline that terminates a header line is not included in the expansion, but internal newlines (caused by splitting the header line over several physical lines) may be present.
The difference between rheader, bheader, and header is in the way the data in the header line is interpreted.
rheader gives the original raw content of the header line, with no processing at all, and without the removal of leading and trailing whitespace.
bheader removes leading and trailing whitespace, and then decodes base64 or quoted-printable MIME words within the header text, but does no character set translation. If decoding of what looks superficially like a MIME word fails, the raw string is returned. If decoding produces a binary zero character, it is replaced by a question mark this is what Exim does for binary zeros that are actually received in header lines.
header tries to translate the string as decoded by bheader to a standard character set. This is an attempt to produce the same string as would be displayed on a user's MUA. If translation fails, the bheader string is returned. Translation is attempted only on operating systems that support the iconv() function. This is indicated by the compile-time macro HAVE_ICONV in a system Makefile or in Local/Makefile.
In a filter file, the target character set for header can be specified by a command of the following form:
headers charset "UTF-8"
This command affects all references to $h_ (or $header_) expansions in subsequently obeyed filter commands. In the absence of this command, the target character set in a filter is taken from the setting of the headers_charset option in the runtime configuration. The value of this option defaults to the value of HEADERS_CHARSET in Local/Makefile. The ultimate default is ISO-8859-1.
Header names follow the syntax of RFC 2822, which states that they may contain any printing characters except space and colon. Consequently, curly brackets do not terminate header names, and should not be used to enclose them as if they were variables. Attempting to do so causes a syntax error.
Only header lines that are common to all copies of a message are visible to this mechanism. These are the original header lines that are received with the message, and any that are added by an ACL warn statement or by a system filter. Header lines that are added to a particular copy of a message by a router or transport are not accessible.
For incoming SMTP messages, no header lines are visible in ACLs that are obeyed before the DATA ACL, because the header structure is not set up until the message is received. Header lines that are added by warn statements in a RCPT ACL (for example) are saved until the message's incoming header lines are available, at which point they are added. When a DATA ACL is running, however, header lines added by earlier ACLs are visible.
Upper case and lower case letters are synonymous in header names. If the following character is white space, the terminating colon may be omitted, but this is not recommended, because you may then forget it when it is needed. When white space terminates the header name, it is included in the expanded string. If the message does not contain the given header, the expansion item is replaced by an empty string. (See the def condition in section 11.6 for a means of testing for the existence of a header.)
If there is more than one header with the same name, they are all concatenated to form the substitution string, up to a maximum length of 64K. A newline character is inserted between each line. For the header expansion, for those headers that contain lists of addresses, a comma is also inserted at the junctions between lines. This does not happen for the rheader expansion.
${hmac{<hashname>}{<secret>}{<string>}}
This function uses cryptographic hashing (either MD5 or SHA-1) to convert a shared secret and some text into a message authentication code, as specified in RFC 2104. This differs from ${md5:secret_text...} or ${sha1:secret_text...} in that the hmac step adds a signature to the cryptographic hash, allowing for authentication that is not possible with MD5 or SHA-1 alone. The hash name must expand to either md5 or sha1 at present. For example:
${hmac{md5}{somesecret}{$primary_hostname $tod_log}}
For the hostname mail.example.com and time 2002-10-17 11:30:59, this produces:
dd97e3ba5d1a61b5006108f8c8252953
As an example of how this might be used, you might put in the main part of an Exim configuration:
SPAMSCAN_SECRET=cohgheeLei2thahw
In a router or a transport you could then have:
headers_add = \
X-Spam-Scanned: ${primary_hostname} ${message_id} \
${hmac{md5}{SPAMSCAN_SECRET}\
{${primary_hostname},${message_id},$h_message-id:}}
Then given a message, you can check where it was scanned by looking at the X-Spam-Scanned: header line. If you know the secret, you can check that this header line is authentic by recomputing the authentication code from the host name, message ID and the Message-id: header line. This can be done using Exim's -be option, or by other means, for example by using the hmac_md5_hex() function in Perl.
${if <condition> {<string1>}{<string2>}}
If <condition> is true, <string1> is expanded and replaces the whole item; otherwise <string2> is used. For example,
${if eq {$local_part}{postmaster} {yes}{no} }
The second string need not be present; if it is not and the condition is not true, the item is replaced with nothing. Alternatively, the word fail may be present instead of the second string (without any curly brackets). In this case, the expansion is forced to fail if the condition is not true. The available conditions are described in section 11.6 below.
${length{<string1>}{<string2>}}
The length item is used to extract the initial portion of a string. Both strings are expanded, and the first one must yield a number, <n>, say. If you are using a fixed value for the number, that is, if <string1> does not change when expanded, you can use the simpler operator notation that avoids some of the braces:
${length_<n>:<string>}
The result of this item is either the first <n> characters or the whole of <string2>, whichever is the shorter. Do not confuse length with strlen, which gives the length of a string.
${lookup{<key>} <search type> {<file>} {<string1>} {<string2>}}
${lookup <search type> {<query>} {<string1>} {<string2>}}
These items specify data lookups in files and databases, as discussed in chapter 9. The first form is used for single-key lookups, and the second is used for query-style lookups. The <key>, <file>, and <query> strings are expanded before use.
If there is any white space in a lookup item which is part of a filter command, a retry or rewrite rule, a routing rule for the manualroute router, or any other place where white space is significant, the lookup item must be enclosed in double quotes. The use of data lookups in users' filter files may be locked out by the system administrator.
If the lookup succeeds, <string1> is expanded and replaces the entire item. During its expansion, the variable $value contains the data returned by the lookup. Afterwards it reverts to the value it had previously (at the outer level it is empty). If the lookup fails, <string2> is expanded and replaces the entire item. If {<string2>} is omitted, the replacement is null on failure. Alternatively, <string2> can itself be a nested lookup, thus providing a mechanism for looking up a default value when the original lookup fails.
If a nested lookup is used as part of <string1>, $value contains the data for the outer lookup while the parameters of the second lookup are expanded, and also while <string2> of the second lookup is expanded, should the second lookup fail.
Instead of {<string2>} the word fail can appear, and in this case, if the lookup fails, the entire expansion is forced to fail. If both {<string1>} and {<string2>} are omitted, the result is the looked up value in the case of a successful lookup, and nothing in the case of failure.
For single-key lookups, the string partial is permitted to precede the search type in order to do partial matching, and * or *@ may follow a search type to request default lookups if the key does not match (see sections 9.5 and 9.6 for details).
If a partial search is used, the variables $1 and $2 contain the wild and non-wild parts of the key during the expansion of the replacement text. They return to their previous values at the end of the lookup item.
This example looks up the postmaster alias in the conventional alias file:
${lookup {postmaster} lsearch {/etc/aliases} {$value}}
This example uses NIS+ to look up the full name of the user corresponding to the local part of an address, forcing the expansion to fail if it is not found:
${lookup nisplus {[name=$local_part],passwd.org_dir:gcos} \
{$value}fail}
${nhash{<string1>}{<string2>}{<string3>}}
The three strings are expanded; the first two must yield numbers. Call them <n> and <m>. If you are using fixed values for these numbers, that is, if <string1> and <string2> do not change when they are expanded, you can use the simpler operator notation that avoids some of the braces:
${nhash_<n>_<m>:<string>}
The second number is optional (in both notations). If there is only one number, the result is a number in the range 0--<n>-1. Otherwise, the string is processed by a div/mod hash function that returns two numbers, separated by a slash, in the ranges 0 to <n>-1 and 0 to <m>-1, respectively. For example,
${nhash{8}{64}{supercalifragilisticexpialidocious}}
returns the string 6/33.