<?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><style xmlns="" type="text/css"> div.added { background-color: #ffff99; } div.deleted { text-decoration: line-through; background-color: #FF7F7F; } div.changed { background-color: #99ff99; } div.off { } span.added { background-color: #ffff99; } span.deleted { text-decoration: line-through; background-color: #FF7F7F; } span.changed { background-color: #99ff99; } span.off { } pre.literallayout { background-color: #E8E8D0; padding-left: 0.5cm; padding-top: 5px; padding-bottom: 5px; } div[class=changed] pre.literallayout { background-color: #99ff99; padding-left: 0.5cm; padding-top: 5px; padding-bottom: 5px; } div.literallayout { background-color: #E8E8D0; padding-left: 0.5cm; padding-top: 5px; padding-bottom: 5px; } div[class=changed] div.literallayout { background-color: #99ff99; padding-left: 0.5cm; padding-top: 5px; padding-bottom: 5px; } </style><title>25. Address batching in local transports</title><meta name="generator" content="DocBook XSL Stylesheets V1.72.0" /><link rel="start" href="index.html" title="Specification of the Exim Mail Transfer Agent" /><link rel="up" href="index.html" title="Specification of the Exim Mail Transfer Agent" /><link rel="prev" href="ch24.html" title="24. Generic options for transports" /><link rel="next" href="ch26.html" title="26. The appendfile transport" /></head><body><div class="navheader"> <table width="100%" summary="Navigation header"><tr><td width="20%" align="left"><a accesskey="p" href="ch24.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="ch26.html">Next</a></td></tr></table></div> <div class="chapter" lang="en" xml:lang="en"> <div class="titlepage"> <div> <div> <h2 class="title"><a href="index.html#toc0221" id="CHAPbatching">25. Address batching in local transports</a></h2></div></div> </div> <p> <a id="id585749" class="indexterm"></a> The only remote transport (<span><strong class="command">smtp</strong></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> <a id="id585773" class="indexterm"></a> <a id="id585784" class="indexterm"></a> <a id="id585796" class="indexterm"></a> In special cases, it may be desirable to handle several addresses at once in a local transport, for example: </p> <div class="itemizedlist"> <ul type="disc"><li><p> In an <span><strong class="command">appendfile</strong></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><strong class="command">lmtp</strong></span> transport, when delivering over “<span class="quote">local SMTP</span>” 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><strong class="command">pipe</strong></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></div> <p> These three local transports all have the same options for controlling multiple (“<span class="quote">batched</span>”) deliveries, namely <span><strong class="option">batch_max</strong></span> and <span><strong class="option">batch_id</strong></span>. To save repeating the information for each transport, these options are described here. </p> <p> The <span><strong class="option">batch_max</strong></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><strong class="option">batch_max</strong></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> <div class="itemizedlist"> <ul type="disc"><li><p> <a id="id585903" class="indexterm"></a> If any of the transport’s options contain a reference to <em class="varname">$local_part</em>, no batching is possible. </p> </li><li><p> <a id="id585929" class="indexterm"></a> If any of the transport’s options contain a reference to <em class="varname">$domain</em>, only addresses with the same domain are batched. </p> </li><li><p> <a id="id585955" class="indexterm"></a> If <span><strong class="option">batch_id</strong></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></div> <p> In the case of the <span><strong class="command">appendfile</strong></span> and <span><strong class="command">pipe</strong></span> transports, batching applies both when the file or pipe command is specified in the transport, and when it is specified by a <span><strong class="command">redirect</strong></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><strong class="option">use_bsmtp</strong></span>, which causes them to deliver the message in “<span class="quote">batched SMTP</span>” format, with the envelope represented as SMTP commands. The <span><strong class="option">check_string</strong></span> and <span><strong class="option">escape_string</strong></span> options are forced to the values </p> <pre class="literallayout">check_string = "." escape_string = ".." </pre><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.10 Outgoing batched SMTP">45.10</a>. The <span><strong class="command">lmtp</strong></span> transport does not have a <span><strong class="option">use_bsmtp</strong></span> option, because it always delivers using the SMTP protocol. </p> <p> <a id="id586066" class="indexterm"></a> If the generic <span><strong class="option">envelope_to_add</strong></span> option is set for a batching transport, the <span class="emphasis"><em>Envelope-to:</em></span> header that is added to the message contains all the addresses that are being processed together. If you are using a batching <span><strong class="command">appendfile</strong></span> transport without <span><strong class="option">use_bsmtp</strong></span>, the only way to preserve the recipient addresses is to set the <span><strong class="option">envelope_to_add</strong></span> option. </p> <p> <a id="id586108" class="indexterm"></a> <a id="id586127" class="indexterm"></a> If you are using a <span><strong class="command">pipe</strong></span> transport without BSMTP, and setting the transport’s <span><strong class="option">command</strong></span> option, you can include <em class="varname">$pipe_addresses</em> 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="bold"><strong>Note:</strong></span> This is not possible for pipe commands that are specified by a <span><strong class="command">redirect</strong></span> router. </p> </div> <div class="navfooter"> <table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch24.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="ch26.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> </td></tr></table></div> </body></html>