<!DOCTYPE html PUBLIC "XSLT-compat"> <html lang="en-GB"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel="stylesheet" type="text/css" href="../../../../common.css"> <meta name="author" content="The Exim Project. <http://www.exim.org/>"> <meta name="copyright" content="Copyright ©2010 The Exim Project. All rights reserved"> <meta name="description" content="Exim is a message transfer agent (MTA) developed at the University of Cambridge for use on Unix systems connected to the Internet."> <meta name="keywords" content="exim,smtp,mta,email"> <meta name="robots" content="noodp,noydir,index,follow"> <meta name="viewport" content="width=device-width"> <title>44. Message processing</title> <link rel="stylesheet" type="text/css" href="../../../../doc/chapter.css"> <link rel="canonical" href="http://www.exim.org/exim-html-current/doc/html/spec_html/ch44.html"> </head> <body> <h1 id="header"><a href="../../../..">Exim Internet Mailer</a></h1> <div id="outer"> <ul id="nav_flow" class="nav"> <li><a href="../../../../index.html">Home</a></li> <li><a href="../../../../mirrors.html">Download</a></li> <li><a href="../../../../docs.html">Documentation</a></li> <li><a href="../../../../maillist.html">Mailing Lists</a></li> <li><a href="http://wiki.exim.org/">Wiki</a></li> <li><a href="http://www.exim.org/bugzilla/">Bugs</a></li> <li><a href="../../../../credits.html">Credits</a></li> <li class="search"><form action="http://www.google.com/search" method="get"> <span class="search_field_container"><input type="search" name="q" placeholder="Search Docs" class="search_field"></span><input type="hidden" name="hl" value="en"><input type="hidden" name="ie" value="UTF-8"><input type="hidden" name="as_qdr" value="all"><input type="hidden" name="q" value="site:www.exim.org"><input type="hidden" name="q" value="inurl:exim-html-current"> </form></li> </ul> <div id="inner"><div id="content"> <a class="previous_page" href="ch43.html"><-previous</a><a class="next_page" href="ch45.html">next-></a><div id="chapter" class="chapter"> <h2 id="CHAPmsgproc" class="">Chapter 44 - Message processing</h2> <p> Exim performs various transformations on the sender and recipient addresses of all messages that it handles, and also on the messages’ header lines. Some of these are optional and configurable, while others always take place. All of this processing, except rewriting as a result of routing, and the addition or removal of header lines while delivering, happens when a message is received, before it is placed on Exim’s queue. </p> <p> Some of the automatic processing takes place by default only for “locally-originated” messages. This adjective is used to describe messages that are not received over TCP/IP, but instead are passed to an Exim process on its standard input. This includes the interactive “local SMTP” case that is set up by the <span class="docbook_option">-bs</span> command line option. </p> <p> <span class="docbook_emphasis">Note</span>: Messages received over TCP/IP on the loopback interface (127.0.0.1 or ::1) are not considered to be locally-originated. Exim does not treat the loopback interface specially in any way. </p> <p> If you want the loopback interface to be treated specially, you must ensure that there are appropriate entries in your ACLs. </p> <div class="section"> <h3 id="SECTsubmodnon" class="">1. Submission mode for non-local messages</h3> <p> Processing that happens automatically for locally-originated messages (unless <span class="docbook_option">suppress_local_fixups</span> is set) can also be requested for messages that are received over TCP/IP. The term “submission mode” is used to describe this state. Submission mode is set by the modifier </p> <div class="docbook_literallayout"><pre> control = submission </pre></div> <p> in a MAIL, RCPT, or pre-data ACL for an incoming message (see sections <a href="ch40.html#SECTACLmodi" title="40. Access control lists">40.20</a> and <a href="ch40.html#SECTcontrols" title="40. Access control lists">40.21</a>). This makes Exim treat the message as a local submission, and is normally used when the source of the message is known to be an MUA running on a client host (as opposed to an MTA). For example, to set submission mode for messages originating on the IPv4 loopback interface, you could include the following in the MAIL ACL: </p> <div class="docbook_literallayout"><pre> warn hosts = 127.0.0.1 control = submission </pre></div> <p> There are some options that can be used when setting submission mode. A slash is used to separate options. For example: </p> <div class="docbook_literallayout"><pre> control = submission/sender_retain </pre></div> <p> Specifying <span class="docbook_option">sender_retain</span> has the effect of setting <span class="docbook_option">local_sender_retain</span> true and <span class="docbook_option">local_from_check</span> false for the current incoming message. The first of these allows an existing <span class="docbook_emphasis">Sender:</span> header in the message to remain, and the second suppresses the check to ensure that <span class="docbook_emphasis">From:</span> matches the authenticated sender. With this setting, Exim still fixes up messages by adding <span class="docbook_emphasis">Date:</span> and <span class="docbook_emphasis">Message-ID:</span> header lines if they are missing, but makes no attempt to check sender authenticity in header lines. </p> <p> When <span class="docbook_option">sender_retain</span> is not set, a submission mode setting may specify a domain to be used when generating a <span class="docbook_emphasis">From:</span> or <span class="docbook_emphasis">Sender:</span> header line. For example: </p> <div class="docbook_literallayout"><pre> control = submission/domain=some.domain </pre></div> <p> The domain may be empty. How this value is used is described in sections <a href="ch44.html#SECTthefrohea" title="44. Message processing">44.11</a> and <a href="ch44.html#SECTthesenhea" title="44. Message processing">44.16</a>. There is also a <span class="docbook_option">name</span> option that allows you to specify the user’s full name for inclusion in a created <span class="docbook_emphasis">Sender:</span> or <span class="docbook_emphasis">From:</span> header line. For example: </p> <div class="docbook_literallayout"><pre> accept authenticated = * control = submission/domain=wonderland.example/\ name=${lookup {$authenticated_id} \ lsearch {/etc/exim/namelist}} </pre></div> <p> Because the name may contain any characters, including slashes, the <span class="docbook_option">name</span> option must be given last. The remainder of the string is used as the name. For the example above, if <span class="docbook_filename">/etc/exim/namelist</span> contains: </p> <div class="docbook_literallayout"><pre> bigegg: Humpty Dumpty </pre></div> <p> then when the sender has authenticated as <span class="docbook_emphasis">bigegg</span>, the generated <span class="docbook_emphasis">Sender:</span> line would be: </p> <div class="docbook_literallayout"><pre> Sender: Humpty Dumpty <bigegg@wonderland.example> </pre></div> <p> By default, submission mode forces the return path to the same address as is used to create the <span class="docbook_emphasis">Sender:</span> header. However, if <span class="docbook_option">sender_retain</span> is specified, the return path is also left unchanged. </p> <p> <span class="docbook_emphasis">Note</span>: The changes caused by submission mode take effect after the predata ACL. This means that any sender checks performed before the fix-ups use the untrusted sender address specified by the user, not the trusted sender address specified by submission mode. Although this might be slightly unexpected, it does mean that you can configure ACL checks to spot that a user is trying to spoof another’s address. </p> </div> <div class="section"> <h3 id="SECTlineendings" class="">2. Line endings</h3> <p> RFC 2821 specifies that CRLF (two characters: carriage-return, followed by linefeed) is the line ending for messages transmitted over the Internet using SMTP over TCP/IP. However, within individual operating systems, different conventions are used. For example, Unix-like systems use just LF, but others use CRLF or just CR. </p> <p> Exim was designed for Unix-like systems, and internally, it stores messages using the system’s convention of a single LF as a line terminator. When receiving a message, all line endings are translated to this standard format. Originally, it was thought that programs that passed messages directly to an MTA within an operating system would use that system’s convention. Experience has shown that this is not the case; for example, there are Unix applications that use CRLF in this circumstance. For this reason, and for compatibility with other MTAs, the way Exim handles line endings for all messages is now as follows: </p> <ul> <li> <p> LF not preceded by CR is treated as a line ending. </p> </li> <li> <p> CR is treated as a line ending; if it is immediately followed by LF, the LF is ignored. </p> </li> <li> <p> The sequence “CR, dot, CR” does not terminate an incoming SMTP message, nor a local message in the state where a line containing only a dot is a terminator. </p> </li> <li> <p> If a bare CR is encountered within a header line, an extra space is added after the line terminator so as not to end the header line. The reasoning behind this is that bare CRs in header lines are most likely either to be mistakes, or people trying to play silly games. </p> </li> <li> <p> If the first header line received in a message ends with CRLF, a subsequent bare LF in a header line is treated in the same way as a bare CR in a header line. </p> </li> </ul> </div> <div class="section"> <h3 id="SECID218" class="">3. Unqualified addresses</h3> <p> By default, Exim expects every envelope address it receives from an external host to be fully qualified. Unqualified addresses cause negative responses to SMTP commands. However, because SMTP is used as a means of transporting messages from MUAs running on personal workstations, there is sometimes a requirement to accept unqualified addresses from specific hosts or IP networks. </p> <p> Exim has two options that separately control which hosts may send unqualified sender or recipient addresses in SMTP commands, namely <span class="docbook_option">sender_unqualified_hosts</span> and <span class="docbook_option">recipient_unqualified_hosts</span>. In both cases, if an unqualified address is accepted, it is qualified by adding the value of <span class="docbook_option">qualify_domain</span> or <span class="docbook_option">qualify_recipient</span>, as appropriate. </p> <p> Unqualified addresses in header lines are automatically qualified for messages that are locally originated, unless the <span class="docbook_option">-bnq</span> option is given on the command line. For messages received over SMTP, unqualified addresses in header lines are qualified only if unqualified addresses are permitted in SMTP commands. In other words, such qualification is also controlled by <span class="docbook_option">sender_unqualified_hosts</span> and <span class="docbook_option">recipient_unqualified_hosts</span>, </p> </div> <div class="section"> <h3 id="SECID219" class="">4. The UUCP From line</h3> <p> Messages that have come from UUCP (and some other applications) often begin with a line containing the envelope sender and a timestamp, following the word “From”. Examples of two common formats are: </p> <div class="docbook_literallayout"><pre> From a.oakley@berlin.mus Fri Jan 5 12:35 GMT 1996 From f.butler@berlin.mus Fri, 7 Jan 97 14:00:00 GMT </pre></div> <p> This line precedes the RFC 2822 header lines. For compatibility with Sendmail, Exim recognizes such lines at the start of messages that are submitted to it via the command line (that is, on the standard input). It does not recognize such lines in incoming SMTP messages, unless the sending host matches <span class="docbook_option">ignore_fromline_hosts</span> or the <span class="docbook_option">-bs</span> option was used for a local message and <span class="docbook_option">ignore_fromline_local</span> is set. The recognition is controlled by a regular expression that is defined by the <span class="docbook_option">uucp_from_pattern</span> option, whose default value matches the two common cases shown above and puts the address that follows “From” into $1. </p> <p> When the caller of Exim for a non-SMTP message that contains a “From” line is a trusted user, the message’s sender address is constructed by expanding the contents of <span class="docbook_option">uucp_sender_address</span>, whose default value is “$1”. This is then parsed as an RFC 2822 address. If there is no domain, the local part is qualified with <span class="docbook_option">qualify_domain</span> unless it is the empty string. However, if the command line <span class="docbook_option">-f</span> option is used, it overrides the “From” line. </p> <p> If the caller of Exim is not trusted, the “From” line is recognized, but the sender address is not changed. This is also the case for incoming SMTP messages that are permitted to contain “From” lines. </p> <p> Only one “From” line is recognized. If there is more than one, the second is treated as a data line that starts the body of the message, as it is not valid as a header line. This also happens if a “From” line is present in an incoming SMTP message from a source that is not permitted to send them. </p> </div> <div class="section"> <h3 id="SECID220" class="">5. Resent- header lines</h3> <p> RFC 2822 makes provision for sets of header lines starting with the string <code class="docbook_literal">Resent-</code> to be added to a message when it is resent by the original recipient to somebody else. These headers are <span class="docbook_emphasis">Resent-Date:</span>, <span class="docbook_emphasis">Resent-From:</span>, <span class="docbook_emphasis">Resent-Sender:</span>, <span class="docbook_emphasis">Resent-To:</span>, <span class="docbook_emphasis">Resent-Cc:</span>, <span class="docbook_emphasis">Resent-Bcc:</span> and <span class="docbook_emphasis">Resent-Message-ID:</span>. The RFC says: </p> <p> <span class="docbook_emphasis">Resent fields are strictly informational. They MUST NOT be used in the normal processing of replies or other such automatic actions on messages.</span> </p> <p> This leaves things a bit vague as far as other processing actions such as address rewriting are concerned. Exim treats <span class="docbook_option">Resent-</span> header lines as follows: </p> <ul> <li> <p> A <span class="docbook_emphasis">Resent-From:</span> line that just contains the login id of the submitting user is automatically rewritten in the same way as <span class="docbook_emphasis">From:</span> (see below). </p> </li> <li> <p> If there’s a rewriting rule for a particular header line, it is also applied to <span class="docbook_option">Resent-</span> header lines of the same type. For example, a rule that rewrites <span class="docbook_emphasis">From:</span> also rewrites <span class="docbook_emphasis">Resent-From:</span>. </p> </li> <li> <p> For local messages, if <span class="docbook_emphasis">Sender:</span> is removed on input, <span class="docbook_emphasis">Resent-Sender:</span> is also removed. </p> </li> <li> <p> For a locally-submitted message, if there are any <span class="docbook_option">Resent-</span> header lines but no <span class="docbook_emphasis">Resent-Date:</span>, <span class="docbook_emphasis">Resent-From:</span>, or <span class="docbook_emphasis">Resent-Message-Id:</span>, they are added as necessary. It is the contents of <span class="docbook_emphasis">Resent-Message-Id:</span> (rather than <span class="docbook_emphasis">Message-Id:</span>) which are included in log lines in this case. </p> </li> <li> <p> The logic for adding <span class="docbook_emphasis">Sender:</span> is duplicated for <span class="docbook_emphasis">Resent-Sender:</span> when any <span class="docbook_option">Resent-</span> header lines are present. </p> </li> </ul> </div> <div class="section"> <h3 id="SECID221" class="">6. The Auto-Submitted: header line</h3> <p> Whenever Exim generates an autoreply, a bounce, or a delay warning message, it includes the header line: </p> <div class="docbook_literallayout"><pre> Auto-Submitted: auto-replied </pre></div> </div> <div class="section"> <h3 id="SECID222" class="">7. The Bcc: header line</h3> <p> If Exim is called with the <span class="docbook_option">-t</span> option, to take recipient addresses from a message’s header, it removes any <span class="docbook_emphasis">Bcc:</span> header line that may exist (after extracting its addresses). If <span class="docbook_option">-t</span> is not present on the command line, any existing <span class="docbook_emphasis">Bcc:</span> is not removed. </p> </div> <div class="section"> <h3 id="SECID223" class="">8. The Date: header line</h3> <p> If a locally-generated or submission-mode message has no <span class="docbook_emphasis">Date:</span> header line, Exim adds one, using the current date and time, unless the <span class="docbook_option">suppress_local_fixups</span> control has been specified. </p> </div> <div class="section"> <h3 id="SECID224" class="">9. The Delivery-date: header line</h3> <p> <span class="docbook_emphasis">Delivery-date:</span> header lines are not part of the standard RFC 2822 header set. Exim can be configured to add them to the final delivery of messages. (See the generic <span class="docbook_option">delivery_date_add</span> transport option.) They should not be present in messages in transit. If the <span class="docbook_option">delivery_date_remove</span> configuration option is set (the default), Exim removes <span class="docbook_emphasis">Delivery-date:</span> header lines from incoming messages. </p> </div> <div class="section"> <h3 id="SECID225" class="">10. The Envelope-to: header line</h3> <p> <span class="docbook_emphasis">Envelope-to:</span> header lines are not part of the standard RFC 2822 header set. Exim can be configured to add them to the final delivery of messages. (See the generic <span class="docbook_option">envelope_to_add</span> transport option.) They should not be present in messages in transit. If the <span class="docbook_option">envelope_to_remove</span> configuration option is set (the default), Exim removes <span class="docbook_emphasis">Envelope-to:</span> header lines from incoming messages. </p> </div> <div class="section"> <h3 id="SECTthefrohea" class="">11. The From: header line</h3> <p> If a submission-mode message does not contain a <span class="docbook_emphasis">From:</span> header line, Exim adds one if either of the following conditions is true: </p> <ul> <li> <p> The envelope sender address is not empty (that is, this is not a bounce message). The added header line copies the envelope sender address. </p> </li> <li> <p> The SMTP session is authenticated and $authenticated_id is not empty. </p> <ol> <li> <p> If no domain is specified by the submission control, the local part is $authenticated_id and the domain is $qualify_domain. </p> </li> <li> <p> If a non-empty domain is specified by the submission control, the local part is $authenticated_id, and the domain is the specified domain. </p> </li> <li> <p> If an empty domain is specified by the submission control, $authenticated_id is assumed to be the complete address. </p> </li> </ol> </li> </ul> <p> A non-empty envelope sender takes precedence. </p> <p> If a locally-generated incoming message does not contain a <span class="docbook_emphasis">From:</span> header line, and the <span class="docbook_option">suppress_local_fixups</span> control is not set, Exim adds one containing the sender’s address. The calling user’s login name and full name are used to construct the address, as described in section <a href="ch44.html#SECTconstr" title="44. Message processing">44.18</a>. They are obtained from the password data by calling <span class="docbook_function">getpwuid()</span> (but see the <span class="docbook_option">unknown_login</span> configuration option). The address is qualified with <span class="docbook_option">qualify_domain</span>. </p> <p> For compatibility with Sendmail, if an incoming, non-SMTP message has a <span class="docbook_emphasis">From:</span> header line containing just the unqualified login name of the calling user, this is replaced by an address containing the user’s login name and full name as described in section <a href="ch44.html#SECTconstr" title="44. Message processing">44.18</a>. </p> </div> <div class="section"> <h3 id="SECID226" class="">12. The Message-ID: header line</h3> <p> If a locally-generated or submission-mode incoming message does not contain a <span class="docbook_emphasis">Message-ID:</span> or <span class="docbook_emphasis">Resent-Message-ID:</span> header line, and the <span class="docbook_option">suppress_local_fixups</span> control is not set, Exim adds a suitable header line to the message. If there are any <span class="docbook_emphasis">Resent-:</span> headers in the message, it creates <span class="docbook_emphasis">Resent-Message-ID:</span>. The id is constructed from Exim’s internal message id, preceded by the letter E to ensure it starts with a letter, and followed by @ and the primary host name. Additional information can be included in this header line by setting the <span class="docbook_option">message_id_header_text</span> and/or <span class="docbook_option">message_id_header_domain</span> options. </p> </div> <div class="section"> <h3 id="SECID227" class="">13. The Received: header line</h3> <p> A <span class="docbook_emphasis">Received:</span> header line is added at the start of every message. The contents are defined by the <span class="docbook_option">received_header_text</span> configuration option, and Exim automatically adds a semicolon and a timestamp to the configured string. </p> <p> The <span class="docbook_emphasis">Received:</span> header is generated as soon as the message’s header lines have been received. At this stage, the timestamp in the <span class="docbook_emphasis">Received:</span> header line is the time that the message started to be received. This is the value that is seen by the DATA ACL and by the <span class="docbook_function">local_scan()</span> function. </p> <p> Once a message is accepted, the timestamp in the <span class="docbook_emphasis">Received:</span> header line is changed to the time of acceptance, which is (apart from a small delay while the -H spool file is written) the earliest time at which delivery could start. </p> </div> <div class="section"> <h3 id="SECID228" class="">14. The References: header line</h3> <p> Messages created by the <span class="docbook_command">autoreply</span> transport include a <span class="docbook_emphasis">References:</span> header line. This is constructed according to the rules that are described in section 3.64 of RFC 2822 (which states that replies should contain such a header line), and section 3.14 of RFC 3834 (which states that automatic responses are not different in this respect). However, because some mail processing software does not cope well with very long header lines, no more than 12 message IDs are copied from the <span class="docbook_emphasis">References:</span> header line in the incoming message. If there are more than 12, the first one and then the final 11 are copied, before adding the message ID of the incoming message. </p> </div> <div class="section"> <h3 id="SECID229" class="">15. The Return-path: header line</h3> <p> <span class="docbook_emphasis">Return-path:</span> header lines are defined as something an MTA may insert when it does the final delivery of messages. (See the generic <span class="docbook_option">return_path_add</span> transport option.) Therefore, they should not be present in messages in transit. If the <span class="docbook_option">return_path_remove</span> configuration option is set (the default), Exim removes <span class="docbook_emphasis">Return-path:</span> header lines from incoming messages. </p> </div> <div class="section"> <h3 id="SECTthesenhea" class="">16. The Sender: header line</h3> <p> For a locally-originated message from an untrusted user, Exim may remove an existing <span class="docbook_emphasis">Sender:</span> header line, and it may add a new one. You can modify these actions by setting the <span class="docbook_option">local_sender_retain</span> option true, the <span class="docbook_option">local_from_check</span> option false, or by using the <span class="docbook_option">suppress_local_fixups</span> control setting. </p> <p> When a local message is received from an untrusted user and <span class="docbook_option">local_from_check</span> is true (the default), and the <span class="docbook_option">suppress_local_fixups</span> control has not been set, a check is made to see if the address given in the <span class="docbook_emphasis">From:</span> header line is the correct (local) sender of the message. The address that is expected has the login name as the local part and the value of <span class="docbook_option">qualify_domain</span> as the domain. Prefixes and suffixes for the local part can be permitted by setting <span class="docbook_option">local_from_prefix</span> and <span class="docbook_option">local_from_suffix</span> appropriately. If <span class="docbook_emphasis">From:</span> does not contain the correct sender, a <span class="docbook_emphasis">Sender:</span> line is added to the message. </p> <p> If you set <span class="docbook_option">local_from_check</span> false, this checking does not occur. However, the removal of an existing <span class="docbook_emphasis">Sender:</span> line still happens, unless you also set <span class="docbook_option">local_sender_retain</span> to be true. It is not possible to set both of these options true at the same time. </p> <p> By default, no processing of <span class="docbook_emphasis">Sender:</span> header lines is done for messages received over TCP/IP or for messages submitted by trusted users. However, when a message is received over TCP/IP in submission mode, and <span class="docbook_option">sender_retain</span> is not specified on the submission control, the following processing takes place: </p> <p> First, any existing <span class="docbook_emphasis">Sender:</span> lines are removed. Then, if the SMTP session is authenticated, and $authenticated_id is not empty, a sender address is created as follows: </p> <ul> <li> <p> If no domain is specified by the submission control, the local part is $authenticated_id and the domain is $qualify_domain. </p> </li> <li> <p> If a non-empty domain is specified by the submission control, the local part is $authenticated_id, and the domain is the specified domain. </p> </li> <li> <p> If an empty domain is specified by the submission control, $authenticated_id is assumed to be the complete address. </p> </li> </ul> <p> This address is compared with the address in the <span class="docbook_emphasis">From:</span> header line. If they are different, a <span class="docbook_emphasis">Sender:</span> header line containing the created address is added. Prefixes and suffixes for the local part in <span class="docbook_emphasis">From:</span> can be permitted by setting <span class="docbook_option">local_from_prefix</span> and <span class="docbook_option">local_from_suffix</span> appropriately. </p> <p> <span class="docbook_emphasis">Note</span>: Whenever a <span class="docbook_emphasis">Sender:</span> header line is created, the return path for the message (the envelope sender address) is changed to be the same address, except in the case of submission mode when <span class="docbook_option">sender_retain</span> is specified. </p> </div> <div class="section"> <h3 id="SECTheadersaddrem" class="">17. Adding and removing header lines in routers and transports</h3> <p> When a message is delivered, the addition and removal of header lines can be specified in a system filter, or on any of the routers and transports that process the message. Section <a href="ch43.html#SECTaddremheasys" title="43. System-wide message filtering">43.6</a> contains details about modifying headers in a system filter. Header lines can also be added in an ACL as a message is received (see section <a href="ch40.html#SECTaddheadacl" title="40. Access control lists">40.23</a>). </p> <p> In contrast to what happens in a system filter, header modifications that are specified on routers and transports apply only to the particular recipient addresses that are being processed by those routers and transports. These changes do not actually take place until a copy of the message is being transported. Therefore, they do not affect the basic set of header lines, and they do not affect the values of the variables that refer to header lines. </p> <p> <span class="docbook_emphasis">Note</span>: In particular, this means that any expansions in the configuration of the transport cannot refer to the modified header lines, because such expansions all occur before the message is actually transported. </p> <p> For both routers and transports, the result of expanding a <span class="docbook_option">headers_add</span> option must be in the form of one or more RFC 2822 header lines, separated by newlines (coded as “\n”). For example: </p> <div class="docbook_literallayout"><pre> headers_add = X-added-header: added by $primary_hostname\n\ X-added-second: another added header line </pre></div> <p> Exim does not check the syntax of these added header lines. </p> <p> The result of expanding <span class="docbook_option">headers_remove</span> must consist of a colon-separated list of header names. This is confusing, because header names themselves are often terminated by colons. In this case, the colons are the list separators, not part of the names. For example: </p> <div class="docbook_literallayout"><pre> headers_remove = return-receipt-to:acknowledge-to </pre></div> <p> When <span class="docbook_option">headers_add</span> or <span class="docbook_option">headers_remove</span> is specified on a router, its value is expanded at routing time, and then associated with all addresses that are accepted by that router, and also with any new addresses that it generates. If an address passes through several routers as a result of aliasing or forwarding, the changes are cumulative. </p> <p> However, this does not apply to multiple routers that result from the use of the <span class="docbook_option">unseen</span> option. Any header modifications that were specified by the “unseen” router or its predecessors apply only to the “unseen” delivery. </p> <p> Addresses that end up with different <span class="docbook_option">headers_add</span> or <span class="docbook_option">headers_remove</span> settings cannot be delivered together in a batch, so a transport is always dealing with a set of addresses that have the same header-processing requirements. </p> <p> The transport starts by writing the original set of header lines that arrived with the message, possibly modified by the system filter. As it writes out these lines, it consults the list of header names that were attached to the recipient address(es) by <span class="docbook_option">headers_remove</span> options in routers, and it also consults the transport’s own <span class="docbook_option">headers_remove</span> option. Header lines whose names are on either of these lists are not written out. If there are multiple instances of any listed header, they are all skipped. </p> <p> After the remaining original header lines have been written, new header lines that were specified by routers’ <span class="docbook_option">headers_add</span> options are written, in the order in which they were attached to the address. These are followed by any header lines specified by the transport’s <span class="docbook_option">headers_add</span> option. </p> <p> This way of handling header line modifications in routers and transports has the following consequences: </p> <ul> <li> <p> The original set of header lines, possibly modified by the system filter, remains “visible”, in the sense that the $header_<span class="docbook_emphasis">xxx</span> variables refer to it, at all times. </p> </li> <li> <p> Header lines that are added by a router’s <span class="docbook_option">headers_add</span> option are not accessible by means of the $header_<span class="docbook_emphasis">xxx</span> expansion syntax in subsequent routers or the transport. </p> </li> <li> <p> Conversely, header lines that are specified for removal by <span class="docbook_option">headers_remove</span> in a router remain visible to subsequent routers and the transport. </p> </li> <li> <p> Headers added to an address by <span class="docbook_option">headers_add</span> in a router cannot be removed by a later router or by a transport. </p> </li> <li> <p> An added header can refer to the contents of an original header that is to be removed, even it has the same name as the added header. For example: </p> <div class="docbook_literallayout"><pre> headers_remove = subject headers_add = Subject: new subject (was: $h_subject:) </pre></div> </li> </ul> <p> <span class="docbook_emphasis">Warning</span>: The <span class="docbook_option">headers_add</span> and <span class="docbook_option">headers_remove</span> options cannot be used for a <span class="docbook_command">redirect</span> router that has the <span class="docbook_option">one_time</span> option set. </p> </div> <div class="section"> <h3 id="SECTconstr" class="">18. Constructed addresses</h3> <p> When Exim constructs a sender address for a locally-generated message, it uses the form </p> <div class="docbook_literallayout"><pre> <<span class="docbook_emphasis">user name</span>> <<span class="docbook_emphasis">login</span><code class="docbook_literal">@</code><span class="docbook_emphasis">qualify_domain</span>> </pre></div> <p> For example: </p> <div class="docbook_literallayout"><pre> Zaphod Beeblebrox <zaphod@end.univ.example> </pre></div> <p> The user name is obtained from the <span class="docbook_option">-F</span> command line option if set, or otherwise by looking up the calling user by <span class="docbook_function">getpwuid()</span> and extracting the “gecos” field from the password entry. If the “gecos” field contains an ampersand character, this is replaced by the login name with the first letter upper cased, as is conventional in a number of operating systems. See the <span class="docbook_option">gecos_name</span> option for a way to tailor the handling of the “gecos” field. The <span class="docbook_option">unknown_username</span> option can be used to specify user names in cases when there is no password file entry. </p> <p> In all cases, the user name is made to conform to RFC 2822 by quoting all or parts of it if necessary. In addition, if it contains any non-printing characters, it is encoded as described in RFC 2047, which defines a way of including non-ASCII characters in header lines. The value of the <span class="docbook_option">headers_charset</span> option specifies the name of the encoding that is used (the characters are assumed to be in this encoding). The setting of <span class="docbook_option">print_topbitchars</span> controls whether characters with the top bit set (that is, with codes greater than 127) count as printing characters or not. </p> </div> <div class="section"> <h3 id="SECID230" class="">19. Case of local parts</h3> <p> RFC 2822 states that the case of letters in the local parts of addresses cannot be assumed to be non-significant. Exim preserves the case of local parts of addresses, but by default it uses a lower-cased form when it is routing, because on most Unix systems, usernames are in lower case and case-insensitive routing is required. However, any particular router can be made to use the original case for local parts by setting the <span class="docbook_option">caseful_local_part</span> generic router option. </p> <p> If you must have mixed-case user names on your system, the best way to proceed, assuming you want case-independent handling of incoming email, is to set up your first router to convert incoming local parts in your domains to the correct case by means of a file lookup. For example: </p> <div class="docbook_literallayout"><pre> correct_case: driver = redirect domains = +local_domains data = ${lookup{$local_part}cdb\ {/etc/usercased.cdb}{$value}fail}\ @$domain </pre></div> <p> For this router, the local part is forced to lower case by the default action (<span class="docbook_option">caseful_local_part</span> is not set). The lower-cased local part is used to look up a new local part in the correct case. If you then set <span class="docbook_option">caseful_local_part</span> on any subsequent routers which process your domains, they will operate on local parts with the correct case in a case-sensitive manner. </p> </div> <div class="section"> <h3 id="SECID231" class="">20. Dots in local parts</h3> <p> RFC 2822 forbids empty components in local parts. That is, an unquoted local part may not begin or end with a dot, nor have two consecutive dots in the middle. However, it seems that many MTAs do not enforce this, so Exim permits empty components for compatibility. </p> </div> <div class="section"> <h3 id="SECID232" class="">21. Rewriting addresses</h3> <p> Rewriting of sender and recipient addresses, and addresses in headers, can happen automatically, or as the result of configuration options, as described in chapter <a href="ch31.html" title="31. Address rewriting">31</a>. The headers that may be affected by this are <span class="docbook_emphasis">Bcc:</span>, <span class="docbook_emphasis">Cc:</span>, <span class="docbook_emphasis">From:</span>, <span class="docbook_emphasis">Reply-To:</span>, <span class="docbook_emphasis">Sender:</span>, and <span class="docbook_emphasis">To:</span>. </p> <p> Automatic rewriting includes qualification, as mentioned above. The other case in which it can happen is when an incomplete non-local domain is given. The routing process may cause this to be expanded into the full domain name. For example, a header such as </p> <div class="docbook_literallayout"><pre> To: hare@teaparty </pre></div> <p> might get rewritten as </p> <div class="docbook_literallayout"><pre> To: hare@teaparty.wonderland.fict.example </pre></div> <p> Rewriting as a result of routing is the one kind of message processing that does not happen at input time, as it cannot be done until the address has been routed. </p> <p> Strictly, one should not do <span class="docbook_emphasis">any</span> deliveries of a message until all its addresses have been routed, in case any of the headers get changed as a result of routing. However, doing this in practice would hold up many deliveries for unreasonable amounts of time, just because one address could not immediately be routed. Exim therefore does not delay other deliveries when routing of one or more addresses is deferred. </p> </div> </div> <a class="previous_page" href="ch43.html"><-previous</a><a class="next_page" href="ch45.html">next-></a> </div></div> <iframe id="branding" name="branding" src="../../../../branding/branding.html" height="0" frameborder="no" scrolling="no"></iframe><div id="footer">Website design by <a href="https://secure.grepular.com/">Mike Cardwell</a>, of <a href="http://cardwellit.com/">Cardwell IT Ltd.</a> </div> <div class="left_bar"></div> <div class="right_bar"></div> <div id="toc"> <ul class="hidden"></ul> <img src="../../../../doc/contents.png" width="16" height="155"> </div> </div> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script><script type="text/javascript" src="../../../../common.js"></script><script type="text/javascript" src="../../../../doc/chapter.js"></script> </body> </html>