<!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>25. Address batching in local transports</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/ch25.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="ch24.html"><-previous</a><a class="next_page" href="ch26.html">next-></a><div id="chapter" class="chapter"> <h2 id="CHAPbatching" class="">Chapter 25 - Address batching in local transports</h2> <p> The only remote transport (<span class="docbook_command">smtp</span>) is normally configured to handle more than one address at a time, so that when several addresses are routed to the same remote host, just one copy of the message is sent. Local transports, however, normally handle one address at a time. That is, a separate instance of the transport is run for each address that is routed to the transport. A separate copy of the message is delivered each time. </p> <p> In special cases, it may be desirable to handle several addresses at once in a local transport, for example: </p> <ul> <li> <p> In an <span class="docbook_command">appendfile</span> transport, when storing messages in files for later delivery by some other means, a single copy of the message with multiple recipients saves space. </p> </li> <li> <p> In an <span class="docbook_command">lmtp</span> transport, when delivering over “local SMTP” to some process, a single copy saves time, and is the normal way LMTP is expected to work. </p> </li> <li> <p> In a <span class="docbook_command">pipe</span> transport, when passing the message to a scanner program or to some other delivery mechanism such as UUCP, multiple recipients may be acceptable. </p> </li> </ul> <p> These three local transports all have the same options for controlling multiple (“batched”) deliveries, namely <span class="docbook_option">batch_max</span> and <span class="docbook_option">batch_id</span>. To save repeating the information for each transport, these options are described here. </p> <p> The <span class="docbook_option">batch_max</span> option specifies the maximum number of addresses that can be delivered together in a single run of the transport. Its default value is one (no batching). When more than one address is routed to a transport that has a <span class="docbook_option">batch_max</span> value greater than one, the addresses are delivered in a batch (that is, in a single run of the transport with multiple recipients), subject to certain conditions: </p> <ul> <li> <p> If any of the transport’s options contain a reference to $local_part, no batching is possible. </p> </li> <li> <p> If any of the transport’s options contain a reference to $domain, only addresses with the same domain are batched. </p> </li> <li> <p> If <span class="docbook_option">batch_id</span> is set, it is expanded for each address, and only those addresses with the same expanded value are batched. This allows you to specify customized batching conditions. Failure of the expansion for any reason, including forced failure, disables batching, but it does not stop the delivery from taking place. </p> </li> <li> <p> Batched addresses must also have the same errors address (where to send delivery errors), the same header additions and removals, the same user and group for the transport, and if a host list is present, the first host must be the same. </p> </li> </ul> <p> In the case of the <span class="docbook_command">appendfile</span> and <span class="docbook_command">pipe</span> transports, batching applies both when the file or pipe command is specified in the transport, and when it is specified by a <span class="docbook_command">redirect</span> router, but all the batched addresses must of course be routed to the same file or pipe command. These two transports have an option called <span class="docbook_option">use_bsmtp</span>, which causes them to deliver the message in “batched SMTP” format, with the envelope represented as SMTP commands. The <span class="docbook_option">check_string</span> and <span class="docbook_option">escape_string</span> options are forced to the values </p> <div class="docbook_literallayout"><pre> check_string = "." escape_string = ".." </pre></div> <p> when batched SMTP is in use. A full description of the batch SMTP mechanism is given in section <a href="ch45.html#SECTbatchSMTP" title="45. SMTP processing">45.10</a>. The <span class="docbook_command">lmtp</span> transport does not have a <span class="docbook_option">use_bsmtp</span> option, because it always delivers using the SMTP protocol. </p> <p> If the generic <span class="docbook_option">envelope_to_add</span> option is set for a batching transport, the <span class="docbook_emphasis">Envelope-to:</span> header that is added to the message contains all the addresses that are being processed together. If you are using a batching <span class="docbook_command">appendfile</span> transport without <span class="docbook_option">use_bsmtp</span>, the only way to preserve the recipient addresses is to set the <span class="docbook_option">envelope_to_add</span> option. </p> <p> If you are using a <span class="docbook_command">pipe</span> transport without BSMTP, and setting the transport’s <span class="docbook_option">command</span> option, you can include $pipe_addresses as part of the command. This is not a true variable; it is a bit of magic that causes each of the recipient addresses to be inserted into the command as a separate argument. This provides a way of accessing all the addresses that are being delivered in the batch. <span class="docbook_emphasis">Note:</span> This is not possible for pipe commands that are specified by a <span class="docbook_command">redirect</span> router. </p> </div> <a class="previous_page" href="ch24.html"><-previous</a><a class="next_page" href="ch26.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>