<?xml version="1.0" encoding="US-ASCII"?>
<!-- This template is for creating an Internet Draft using xml2rfc,
     which is available here: http://xml.resource.org. -->
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
<!-- One method to get references from the online citation libraries.
     There has to be one entity for each item to be referenced. 
     An alternate method (rfc include) is described in the references. -->

<!ENTITY RFC5321 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5321.xml">
<!ENTITY RFC2119 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml">
]>
<?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>
<!-- used by XSLT processors -->
<!-- For a complete list and description of processing instructions (PIs), 
     please see http://xml.resource.org/authoring/README.html. -->
<!-- Below are generally applicable Processing Instructions (PIs) that most I-Ds might want to use.
     (Here they are set differently than their defaults in xml2rfc v1.32) -->
<?rfc strict="yes" ?>
<!-- give errors regarding ID-nits and DTD validation -->
<!-- control the table of contents (ToC) -->
<?rfc toc="yes"?>
<!-- generate a ToC -->
<?rfc tocdepth="4"?>
<!-- the number of levels of subsections in ToC. default: 3 -->
<!-- control references -->
<?rfc symrefs="yes"?>
<!-- use symbolic references tags, i.e, [RFC2119] instead of [1] -->
<?rfc sortrefs="yes" ?>
<!-- sort the reference entries alphabetically -->
<!-- control vertical white space 
     (using these PIs as follows is recommended by the RFC Editor) -->
<?rfc compact="yes" ?>
<!-- do not start each main section on a new page -->
<?rfc subcompact="no" ?>
<!-- keep one blank line between list items -->
<!-- end of list of popular I-D processing instructions -->
<rfc category="exp" docName="draft-atkins-smtp-traffic-control-00" ipr="trust200902">
  <!-- category values: std, bcp, info, exp, and historic
     ipr values: trust200902, noModificationTrust200902, noDerivativesTrust200902,
        or pre5378Trust200902
     you can add the attributes updates="NNNN" and obsoletes="NNNN" 
     they will automatically be output with "(if approved)" -->

  <!-- ***** FRONT MATTER ***** -->

  <front>
    <!-- The abbreviated title is used in the page header - it is only necessary if the 
         full title is longer than 39 characters -->

    <title>Next-Hop SMTP Traffic Control</title>

    <!-- add 'role="editor"' below for the editors if appropriate -->

    <!-- Another author who claims to be an editor -->

    <author fullname="Steve Atkins" initials="S.R.A." surname="Atkins">
      <organization>Word to the Wise</organization>

      <address>
        <postal>
          <street></street>

          <!-- Reorder these if your country does things differently -->

          <city>Palo Alto</city>

          <region>CA</region>

          <code></code>

          <country>US</country>
        </postal>


        <email>steve@wordtothewise.com</email>

        <!-- uri and facsimile elements may also be added -->
      </address>
    </author>

    <date year="2011" />

    <!-- If the month and year are both specified and are the current ones, xml2rfc will fill 
         in the current day for you. If only the current year is specified, xml2rfc will fill 
	 in the current day and month for you. If the year is not the current one, it is 
	 necessary to specify at least a month (xml2rfc assumes day="1" if not specified for the 
	 purpose of calculating the expiry date).  With drafts it is normally sufficient to 
	 specify just the year. -->

    <!-- Meta-data Declarations -->

    <area>General</area>

    <workgroup>Internet Engineering Task Force</workgroup>

    <!-- WG name at the upperleft corner of the doc,
         IETF is fine for individual submissions.  
	 If this element is not present, the default is "Network Working Group",
         which is used by the RFC Editor as a nod to the history of the IETF. -->

    <keyword></keyword>

    <!-- Keywords will be incorporated into HTML output
         files in a meta tag but they have no effect on text or nroff
         output. If you submit your draft to the RFC Editor, the
         keywords will be used for the search engine. -->

    <abstract>
      <t>This document defines an extended SMTP response for mail servers to assist clients in adjusting
the rate at which they send mail. Use of this mechanism can reduce wasteful SMTP connections and reduce
mail delivery delays; at scale the aggregate benefit to clients and servers can be significant.</t>
    </abstract>
  </front>

  <middle>
    <section title="Introduction">
      <t>Ideally a mail server would deliver all mails to recipients' mailboxes immediately,
      but that is not always possible due to limited system resources.</t>

      <t>For active sites, mail volume can be very high. Clients sometimes attempt to deliver
      large quantities of mail in a very short time period, often mail which has low perceived
      value to the recipient. Those spikes in mail volume can exceed server capacity for short
      periods and delay processing of other mail with a higher perceived value. Such servers
      therefore attempt to throttle traffic from clients with a lower perceived value.</t>

      <t>Servers will also throttle or defer mail from senders for other reasons, including
      reputation or behaviour based spam filters that prefer to wait for more data before
      they make a delivery decision.</t>

      <t>There are two approaches currently used to throttle mail traffic. One is to limit the
      bandwidth of the transport the SMTP session is running over. By delaying the delivery of
      each message while keeping the SMTP session open it causes each connection to be held
      open for longer, significantly increasing resource usage at both ends of the connection.</t>


      <t>The other approach is to defer accepting a message with an
      <xref target="RFC5321">RFC&nbsp;5321</xref> transient negative completion reply,
      typically "421", relying on the client to resend the message later. 
      This can cause
      many repeated, failed delivery attempts when the client retries delivery of the same
      message rapidly, or attempted delivery of many (thousands) of messages, all of which
      are deferred. That pattern of high volumes of deferred connections can have an aggregate
      effect that is expensive and wasteful for both the client and server.</t>

      <t>Many clients will retry delivery only after a fairly long period
      (<xref target="RFC5321">RFC&nbsp;5321</xref> suggests 30 minutes) which can cause mail
      delivery to be significantly delayed. Long delivery delays are an obvious problem for time-sensitive
      messages, bit they can also cause problems indirectly by causing messages to be delivered out of
      chronological order.</t>
      <t>If the server is only temporarily overloaded, and so
      needs to reduce traffic for just a short period (seconds to minutes), then a shorter
      retry delay reduces those problems.</t>

    </section>
    <section title="Response Structure">
      <t>This specification defines a new extended response that SMTP server can include in the text
      section of any SMTP response - separated by white space from the rest of the text section.
      It's intended use is to refine the second mechanism described above, to guide future
      transfer attempts by the client.</t>
      <figure>
        <artwork type="abnf"><![CDATA[
    response = "wait:" delay

    delay = 1*5DIGIT          ; an integer in the range 0 to 99999

    DIGIT = 0x30-0x39
        ]]></artwork>
      </figure>
      
      <t>The delay value is the length of time, in seconds, that the server is asking
      the client to wait before sending further mail. A value of "0" is valid, with
      the meaning that the client SHOULD gracefully terminate the current connection,
      but need not wait before attempting future connections. Disconnecting in this
      way, rather than keeping the connection open for further messages, moves the
      client to the back of the connection queue and gives competing clients an opportunity
      to connect.</t>
      
      <t>If a client sees this additional response in any SMTP response from a server
      then it SHOULD gracefully close the SMTP connection by sending a QUIT command
      as soon as possible. It SHOULD NOT make any new connection to the same server for
      the duration of the delay. If possible it SHOULD gracefully close any other
      connections to the same server. If the implementation of the client makes it
      difficult to implement some of these behaviours, it can still usefully implement
      the other requirements.</t>
      <t>Other than this, it makes no changes in the semantics of the SMTP transaction.</t>
    </section>
    
    <section title="Server Recommendations">
      <t>A server can add a wait: additional response to any permanent or transient negative
      completion reply ("5xx or 4xx error") to ask the client to disconnect and wait before
      reconnecting.</t>
      <t>A server can also usefully add a wait: additional response to a 250 positive
      completion response at the end of the DATA section to ask the server to disconnect
      and wait before reconnecting. At that point in the transaction a "250 wait:" asks
      the client to disconnect rather than attempting to send further messages in the same
      transaction.</t>
    </section>
    
    <section title="Examples">
      <t>"421 4.3.2 wait:15 example.com Service not available" means the client should retry delivery of the mail, after
      at least 15 seconds and not attempt any other deliveries for at least 15 seconds.</t>
      <t>"554 wait:60 Transaction failed" means the client should not retry delivery of this message, and
      should not attempt any other deliveries for at least 60 seconds.</t>
      <t>"250 OK wait:90" in response to end of data means that the mail has been accepted
      for delivery and that the client should send a QUIT command, and not attempt delivery
      of any other messages for 90 seconds.</t>
    </section>
    
    <section title="Requirements Language">
      <t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
      "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
      document are to be interpreted as described in <xref
      target="RFC2119">RFC 2119</xref>.</t>
    </section>
    
    <!-- Possibly a 'Contributors' section ... -->
    
    <section anchor="IANA" title="IANA Considerations">
      <t>This memo includes no request to IANA.</t>
    </section>
    
    <section anchor="Security" title="Security Considerations">
      <t>This document describes an additional response code. Use of this
      response code may disclose additional information about how a mail system is
      implemented beyond that currently available.</t>
    </section>
  </middle>
  
  <!--  *****BACK MATTER ***** -->
  
  <back>
    <!-- References split into informative and normative -->
    
    <!-- There are 2 ways to insert reference entries from the citation libraries:
     1. define an ENTITY at the top, and use "ampersand character"RFC2629; here (as shown)
     2. simply use a PI "less than character"?rfc include="reference.RFC.2119.xml"?> here
        (for I-Ds: include="reference.I-D.narten-iana-considerations-rfc2434bis.xml")

     Both are cited textually in the same manner: by using xref elements.
     If you use the PI option, xml2rfc will, by default, try to find included files in the same
     directory as the including file. You can also define the XML_LIBRARY environment variable
     with a value containing a set of directories to search.  These can be either in the local
     filing system or remote ones accessed by http (http://domain/dir/... ).-->

    <references title="Normative References">
      <!--?rfc include="http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml"?-->
      &RFC2119;

    </references>

    <references title="Informative References">
      <!-- Here we use entities that we defined at the beginning. -->

      &RFC5321;

    </references>

  </back>
</rfc>

