<?xml version="1.0"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd">
<?rfc toc="yes"?>

<!--
     ASCII to XML transformation by Invisible Worlds, Inc.
     http://invisible.net/
     Last transformation: 03-Feb-1999, 02:08:21

     Cannonical version of this document is at:
     http://info.internet.isi.edu/in-notes/rfc/files/rfc2034.txt

     Implementors should verify all content with
     cannonical version.  Failure to do so may result in
     protocol failures.
-->

<rfc number="2034"
     category="std">
<front>
<title abbrev="SMTP Enhanced Error Codes">SMTP Service Extension for Returning Enhanced Error Codes</title>
<author initials="N." surname="Freed" fullname="Ned Freed">
<organization>Innosoft International, Inc.</organization>
<address>
<postal>
<street>1050 East Garvey Avenue South</street>
<street>West Covina</street>
<street>CA 91790</street>
<country>USA</country>
</postal>
<phone>+1 818 919 3600           fax: +1 818 919 3614</phone>
<email>ned@innosoft.com</email>
</address>
</author>
<date month="October" year="1996"/>
<area>Applications</area>
<keyword>SMTP</keyword>
<keyword>point-to-point protocol</keyword>
<keyword>simple mail transfer protocol</keyword>
</front>
<middle>
<!-- RFC original section: (1.) -->
<section title="Abstract">
<t>
   This memo defines an extension to the SMTP service [RFC-821, RFC-
   1869] whereby an SMTP server augments its responses with the enhanced
   mail system status codes defined in RFC 1893.  These codes can then
   be used to provide more informative explanations of error conditions,
   especially in the context of the delivery status notifications format
   defined in RFC 1894.
</t>
</section>
<!-- RFC original section: (2.) -->
<section title="Introduction">
<t>
   Although SMTP is widely and robustly deployed, various extensions
   have been requested by parts of the Internet community. In
   particular, in the modern, international, and multilingual Internet a
   need exists to assign codes to specific error conditions that can be
   translated into different languages. RFC 1893 defines such a set of
   status codes and RFC 1894 defines a mechanism to send such coded
   material to users. However, in many cases the agent creating the RFC
   1894 delivery status notification is doing so in response to errors
   it received from a remote SMTP server.
</t>
<t>
   As such, remote servers need a mechanism for embedding enhanced
   status codes in their responses as well as a way to indicate to a
   client when they are in fact doing this. This memo uses the SMTP
   extension mechanism described in RFC 1869 to define such a mechanism.
</t>
</section>
<!-- RFC original section: (3.) -->
<section title="Framework for the Enhanced Error Statuses Extension">
<t>
   The enhanced error statuses transport extension is laid out as
   follows:
<list>
<t>
   (1)   the name of the SMTP service extension defined here is
         Enhanced-Status-Codes;
</t>
<t>
   (2)   the EHLO keyword value associated with the extension is
         ENHANCEDSTATUSCODES;
</t>
<t>
   (3)   no parameter is used with the ENHANCEDSTATUSCODES EHLO
         keyword;
</t>
<t>
   (4)   the text part of all 2xx, 4xx, and 5xx SMTP responses
         other than the initial greeting and any response to
         HELO or EHLO are prefaced with a status code as defined
         in RFC 1893. This status code is always followed by one
         or more spaces.
</t>
<t>
   (5)   no additional SMTP verbs are defined by this extension;
         and,
</t>
<t>
   (6)   the next section specifies how support for the
         extension affects the behavior of a server and client
         SMTP.
</t></list>
</t>
</section>
<!-- RFC original section: (4.) -->
<section title="The Enhanced-Status-Codes service extension">
<t>
   Servers supporting the Enhanced-Status-Codes extension must preface
   the text part of almost all response lines with a status code. As in
   RFC 1893, the syntax of these status codes is given by the ABNF:
</t>
<figure><artwork>
        status-code ::= class &quot;.&quot; subject &quot;.&quot; detail
        class       ::= &quot;2&quot; / &quot;4&quot; / &quot;5&quot;
        subject     ::= 1*3digit
        detail      ::= 1*3digit
</artwork></figure>
<t>
   These codes must appear in all 2xx, 4xx, and 5xx response lines other
   than initial greeting and any response to HELO or EHLO. Note that 3xx
   responses are NOT included in this list.
</t>
<t>
   All status codes returned by the server must agree with the primary
   response code, that is, a 2xx response must incorporate a 2.X.X code,
   a 4xx response must incorporate a 4.X.X code, and a 5xx response must
   incorporate a 5.X.X code.
   When responses are continued across multiple lines the same status
   code must appear at the beginning of the text in each line of the
   response.
</t>
<t>
   Servers supporting this extension must attach enhanced status codes
   to their responses regardless of whether or not EHLO is employed by
   the client.
</t>
</section>
<!-- RFC original section: (5.) -->
<section title="Status Codes and Negotiation">
<t>
   This specification does not provide a means for clients to request
   that status codes be returned or that they not be returned; a
   compliant server includes these codes in the responses it sends
   regardless of whether or not the client expects them.  This is
   somewhat different from most other SMTP extensions, where generally
   speaking a client must specifically make a request before the
   extended server behaves any differently than an unextended server.
   The omission of client negotiation in this case is entirely
   intentional: Given the generally poor state of SMTP server error code
   implementation it is felt that any step taken towards more
   comprehensible error codes is something that all clients, extended or
   not, should benefit from.
</t>
<t>
   IMPORTANT NOTE:  The use of this approach in this extension should be
   seen as a very special case.  It MUST NOT be taken as a license for
   future SMTP extensions to dramatically change the nature of SMTP
   client-server interaction without proper announcement from the server
   and a corresponding enabling command from the client.
</t>
</section>
<!-- RFC original section: (6.) -->
<section title="Usage Example">
<t>
   The following dialogue illustrates the use of enhanced status codes
   by a server:
</t>
<figure><artwork>
   S: &lt;wait for connection on TCP port 25&gt;
   C: &lt;open connection to server&gt;
   S: 220 dbc.mtview.ca.us SMTP service ready
   C: EHLO ymir.claremont.edu
   S: 250-dbc.mtview.ca.us says hello
   S: 250 ENHANCEDSTATUSCODES
   C: MAIL FROM:&lt;ned@ymir.claremont.edu&gt;
   S: 250 2.1.0 Originator &lt;ned@ymir.claremont.edu&gt; ok
   C: RCPT TO:&lt;mrose@dbc.mtview.ca.us&gt;
   S: 250 2.1.5 Recipient &lt;mrose@dbc.mtview.ca.us&gt; ok
   C: RCPT TO:&lt;nosuchuser@dbc.mtview.ca.us&gt;
   S: 550 5.1.1 Mailbox &quot;nosuchuser&quot; does not exist
   C: RCPT TO:&lt;remoteuser@isi.edu&gt;
   S: 551-5.7.1 Forwarding to remote hosts disabled
   S: 551 5.7.1 Select another host to act as your forwarder
   C: DATA
   S: 354 Send message, ending in CRLF.CRLF.
    ...
   C: .
   S: 250 2.6.0 Message accepted
   C: QUIT
   S: 221 2.0.0 Goodbye
</artwork></figure>
<t>
   The client that receives these responses might then send a
   nondelivery notification of the general form:
</t>
<figure><artwork>
      Date: Mon, 11 Mar 1996 09:21:47 -0400
      From: Mail Delivery Subsystem &lt;mailer-daemon@ymir.claremont.edu&gt;
      Subject: Returned mail
      To: &lt;ned@ymir.claremont.edu&gt;
      MIME-Version: 1.0
      Content-Type: multipart/report; report-type=delivery-status;
            boundary=&quot;JAA13167.773673707/YMIR.CLAREMONT.EDU&quot;

      --JAA13167.773673707/YMIR.CLAREMONT.EDU
      content-type: text/plain; charset=us-ascii

         ----- Mail was successfully relayed to
               the following addresses -----

      &lt;mrose@dbc.mtview.ca.us&gt;

         ----- The following addresses had delivery problems -----
      &lt;nosuchuser@dbc.mtview.ca.us&gt;
        (Mailbox &quot;nosuchuser&quot; does not exist)
      &lt;remoteuser@isi.edu&gt;
        (Forwarding to remote hosts disabled)

      --JAA13167.773673707/YMIR.CLAREMONT.EDU
      content-type: message/delivery-status

      Reporting-MTA: dns; ymir.claremont.edu

      Original-Recipient: rfc822;mrose@dbc.mtview.ca.us
      Final-Recipient: rfc822;mrose@dbc.mtview.ca.us
      Action: relayed
      Status: 2.1.5 (Destination address valid)
      Diagnostic-Code: smtp;
       250 Recipient &lt;mrose@dbc.mtview.ca.us&gt; ok
      Remote-MTA: dns; dbc.mtview.ca.us
      Original-Recipient: rfc822;nosuchuser@dbc.mtview.ca.us
      Final-Recipient: rfc822;nosuchuser@dbc.mtview.ca.us
      Action: failed
      Status: 5.1.1 (Bad destination mailbox address)
      Diagnostic-Code: smtp;
       550 Mailbox &quot;nosuchuser&quot; does not exist
      Remote-MTA: dns; dbc.mtview.ca.us

      Original-Recipient: rfc822;remoteuser@isi.edu
      Final-Recipient: rfc822;remoteuser@isi.edu
      Action: failed
      Status: 5.7.1 (Delivery not authorized, message refused)
      Diagnostic-Code: smtp;
        551 Forwarding to remote hosts disabled
        Select another host to act as your forwarder
      Remote-MTA: dns; dbc.mtview.ca.us

      --JAA13167.773673707/YMIR.CLAREMONT.EDU
      content-type: message/rfc822

      [original message goes here]
      --JAA13167.773673707/YMIR.CLAREMONT.EDU--
</artwork></figure>
<t>
   Note that in order to reduce clutter the reporting MTA has omitted
   enhanced status code information from the diagnostic-code fields it
   has generated.
</t>
</section>
<!-- RFC original section: (7.) -->
<section title="Security Considerations">
<t>
   Additional detail in server responses axiomatically provides
   additional information about the server.  It is conceivable that
   additional information of this sort may be of assistance in
   circumventing server security.  The advantages of provides additional
   information must always be weighed against the security implications
   of doing so.
</t>
</section>
<!-- RFC original section: (8.) -->
<section title="References (BOILERPLATE)">
<t>
This RFC contained boilerplate in this section which has been moved
to the RFC2223-compliant unnumbered section &quot;References.&quot;
</t>
</section>
<!-- RFC original section: (9.) -->
<section title="Author Address (BOILERPLATE)">
<t>
This RFC contained boilerplate in this section which has been moved
to the RFC2223-compliant unnumbered section &quot;Author&apos;s Address.&quot;
</t>
</section>
</middle>
<back>
</back>
</rfc>
