<?xml version="1.0" encoding="US-ASCII"?>

<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
<!-- Getting references from the online citation library.
     There has to be one entity for each item to be referenced. -->
<!ENTITY rfc2119 PUBLIC '' "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml">
<!ENTITY rfc1846 PUBLIC '' "http://xml.resource.org/public/rfc/bibxml/reference.RFC.1846.xml">
<!ENTITY rfc5321 PUBLIC '' "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5321.xml">

<!-- Outline of entity definition for citations to Internet Drafts
     &lt;!ENTITY I-D.mrose-writing-rfcs SYSTEM 
     "http://xml.resource.org/public/rfc/bibxml3/reference.I-D.mrose-writing-rfcs">
     corresponding to a draft filename draft-mrose-writing-rfcs-nn.txt.
     Naming convention for draft-ietf-xx-yy is that
       ietf-xx-yy  is latest version
       draft-ietf-xx-yy-NN is that version.  Similarly for draft-foo
       rather than draft-ietf: foo-xx-yy and draft-foo-xx-yy-NN
   -->
<!-- Fudge for XMLmind which doesn't have this built in -->
<!ENTITY nbsp "&#160;">

]>
<!-- Extra statement used by XSLT processors to control the output style. -->
<?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>
<!-- Processing Instructions- PIs (for a complete list and description,
     see file http://xml.resource.org/authoring/README.html.
     You may find that some sphisticated editors are not able to edit PIs when palced here.
     An alternative position is just inside the rfc elelment as noted below. -->
<!-- Some of the more generally applicable PIs that most I-Ds might want to use -->
<!-- Try to enforce the ID-nits conventions and DTD validity -->
<?rfc strict="yes" ?>
<!-- Items used when reviewing the document -->
<!-- Controls display of <cref> elements -->
<?rfc comments="yes" ?>
<!-- When no, put comments at end in comments section,
     otherwise, put inline -->
<?rfc inline="yes" ?>
<!-- When yes, insert editing marks: editing marks consist of a 
     string such as <29> printed in the blank line at the 
     beginning of each paragraph of text. -->
<?rfc editing="no" ?>
<!-- Create Table of Contents (ToC) and set some options for it.  
     Note the ToC may be omitted for very short documents,but idnits insists on a ToC 
     if the document has more than 15 pages. -->
<?rfc toc="yes"?>
<?rfc tocompact="yes"?>
<!-- If "yes" eliminates blank lines before main section entries. -->
<?rfc tocdepth="3"?>
<!-- Sets the number of levels of sections/subsections... in ToC.
   Can be overridden by 'toc="include"/"exclude"' on the section
   element-->
<!-- Choose the options for the references. 
     Some like symbolic tags in the references (and citations) and others prefer 
     numbers. The RFC Editor always uses symbolic tags.
     The tags used are the anchor attributes of the references. -->
<?rfc symrefs="no"?>
<?rfc sortrefs="yes" ?>
<!-- If "yes", causes the references to be sorted in order of tags.
			 This doesn't have any effect unless symrefs is "yes"
          also. --> 
<!-- These two save paper: Just setting compact to "yes" makes savings by not starting each 
     main section on a new page but does not omit the blank lines between list items. 
     If subcompact is also "yes" the blank lines between list items are also omitted. -->
<?rfc compact="yes" ?>
<?rfc subcompact="no" ?>
<!-- end of list of popular I-D processing instructions -->

<!-- Information about the document.
     category values: std, bcp, info, exp, and historic
     For Internet-Drafts, specify attribute "ipr".
     (ipr values are: full3978, noModification3978, noDerivatives3978), 
     (2008 IETF Trust versions: trust200811, noModificationTrust200811, noDerivativeTrust200811
     Also for Internet-Drafts, you must specify a value for attributes "docName" which is 
     typically the file name under which it is filed - but need not be - and,if relevant, 
     "iprExtract".  
     Note that the value for iprExtract is the anchor attribute value of a section (such as 
     a MIB specification) that can be extracted for separate publication, and is only useful 
     when the value of "ipr" is not "full3978".
     "updates" and "obsoletes" attributes can also be specified here,
     their arguments are comma-separated lists of RFC numbers (just
	 the numbers) -->
<!-- Per Marshall Rose, 20090225 add trust200811,
    noModificationTrust200811, noDerivativesTrust200811, trust200902,
    noModificationTrust200902, noDerivativesTrust200902,
	pre5378Trust200902 -->

<rfc  docName="draft-klensin-rfc1846bis-00.txt"
     ipr="pre5378Trust200902"  category="std"
	  obsoletes="1846" updates="5321">
     <!-- obsoletes='2821, 821' updates='1123' category='std' -->   
<!-- Note that -00b was posted as -00 -->

  <!-- ***** FRONT MATTER ***** -->

  <front>

    <title>SMTP 521 Reply Code</title>

	<!-- 
    <author fullname="Alain Durand" initials="A." surname="Durand">
      <organization>Juniper Networks
		 ?? Institut de Mathematiques Appliquees de Grenoble (IMAG)
		 ??
      </organization>
      <address>
         <postal>
          <street>BP 53 38041</street>
          <city>Grenoble</city>
          <code>CEDEX 9</code>
          <country>France</country>
        </postal>
        <phone>+33 76 63 57 03</phone>
		  Fax   : +33 76 44 66 75 
        <email>Alain.Durand@imag.fr</email> 
		<postal>
		   <street>1194 North Mathilda Avenue</street>
		   <city>Sunnyvale</city>
		   <region>CA</region>
		   <code>94089-1206</code>
		   <country>USA</country>
		</postal>
		<email>adurand@juniper.net</email>
      </address>
    </author>  -->

 <!--   <author fullname="Francis Dupont" initials="F." surname="Dupont">
  ??       <organization abbrev="INRIA">Institut National de Recherche en Informatique et en Automatique
      </organization>  ??
      <address>
       ??  <postal>
          <street>B.P. 105</street>
          <city>78153 Le Chesnay CEDEX</city>
          <country>France</country>
        </postal>
        <phone>+33 1 39 63 52 13</phone>
         Fax   : +33 1 39 63 53 30
        <email>Francis.Dupont@inria.fr</email>  ??
	    <email>fdupont@isc.org</email>
      </address>
    </author>  -->


    <author fullname="John C Klensin" initials="J.C." surname="Klensin" role="editor">
      <organization/>
      <address>
        <postal>
          <street>1770 Massachusetts Ave, Ste 322</street>
          <city>Cambridge</city> <region>MA</region>
          <code>02140</code>
          <country>USA</country>
        </postal>
        <phone>+1 617 245 1457</phone>
        <email>john-ietf@jck.com</email>
      </address>
    </author>  

    <date month="August" day="11" year="2014" />

    <!-- Meta-data Declarations -->
    <area>Applications</area>   

    <!-- WG name at the upper left corner of the doc,
         IETF fine for individual submissions.  You can also
         omit this element in which case it defaults to "Network Working Group" -
         a hangover from the ancient history of the IETF!
    <workgroup>Network Working Group</workgroup>   -->

	<!-- You can add <keyword/> elements here.  They will be incorporated into HTML output
         files in a meta tag but they have no effect on text or nroff output. -->
	<!-- <keyword>Text</keyword> (as many of those elements as needed
	-->
	<keyword>Reply code</keyword>
	<keyword>Email</keyword>
	<keyword>Server</keyword>

	
    <abstract>
      <t>   This memo defines a new Simple Mail Transfer Protocol (SMTP)
	   reply code, 521, which one may use to indicate that an Internet host
	   does not accept incoming mail.  It is a standards track replacement
	   for the earlier, experimental, RFC 1846 without any substantive
	   changes.</t> 
    </abstract>
	
  </front>

  <middle>
	 <section title="Introduction" anchor="intro">
		<t>The SMTP specification <xref target="RFC5321"/> contains a
		   list and discussion of error codes.  This document updates
		   that list with a new code, 521, for use primarily, ideally
		   exclusively, in
		   response to an initial connection.  In that context, it
		   specifically denotes a
		   system that does not receive email or otherwise handle
		   SMTP mail or inquiry transactions.  That code differs from
		   the use of reply code 554, recommended by RFC 5321, because
		   that code can be used in a larger variety of
		   situations.</t>
		<t>This document supersedes and is a standards track
		   replacement for <xref target="RFC1846">RFC 1846</xref>.
		   Formally RFC 1846 was an experiment about the use of the
		   521 code, one that has run for about 19 years.  During that
		   time, reply code 521 has been supported in multiple
		   implementations as an alternative to other connect-time
		   codes.  This specification updates RFC 5321 by adding the
		   521 code to the recommended code list in preference to the
		   use of other connection-time codes to indicate the
		   intentional absence of SMTP service on that host.  Because
		   RFC 5321 requires that clients take their primary actions
		   on the basis of the first digit of the reply code, the
		   addition of this code can provide additional information
		   but its use, or the use of alternative 5yz codes, cannot
		   have significant negative operational effects with
		   conforming implementations of SMTP.</t>
		<t>The reader of this document is expected to have reasonable
		   familiarity with the SMTP specification in RFC 5321,
		   particularly the discussions of reply codes and their use
		   and theory.</t>
        <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>
		
	 <section title="Motivations">
	   <t>Hosts on the Internet have shifted from large, general-purpose hosts
	   to smaller, more specialized hosts.  An increasing number of
	   hosts are dedicated to specific tasks, such as serving NTP or
	   DNS.  These dedicated hosts frequently do not provide mail
	   service.</t>

	   <t>Usually, these mailless hosts do not run an SMTP server.
	   Unfortunately, users will occasionally misaddress mail to these
	   hosts.  Regular SMTP clients attempting to deliver this misaddressed
	   mail see the absence of an SMTP server on a host only through a
	   timeout in trying to make a connection and must treat that
	   state as a temporary
	   error.  They must queue the mail for later delivery in case the
	   problem was actually temporary of in case an SMTP
	   server is started at a later time.</t>

	   <t>This causes the mail to remain queued for days, until it is returned
	   with what is usually a confusing error message.</t>
	</section>

	<section title="Two complementary solutions">
	   <t>   Two complementary solutions MAY be implemented to deal with this
		   issue.  The first one is to use MX relays to bounce misaddressed
		   mails.  The second one is to implement a minimal SMTP server on the
		   mailless host to bounce all mails.</t>

       <t> The choice between the two solutions is site dependent.</t>
	</section>

	<section title="The MX relays solution">
	   <t>MX relays may be used to indicate SMTP clients that an
		  Internet host does not accept mail.</t>
	   <t>During the SMTP dialog, these MX relays MAY bounce any
		  message destined to this particular host with an SMTP 521
		  reply code. </t>
	   <figure>
		  <preamble>SMTP dialog example:</preamble>
	   <artwork>
		  <![CDATA[
   ---> 220 relay.imag.fr ready
   <--- HELO client.inria.fr
   ---> 250 relay.imag.fr Hello client.inria.fr
   <--- MAIL FROM: <user1@client.inria.fr>
   ---> 250 <user1@client.inria.fr>... Sender Ok
   <--- RCPT TO: <user2@nomail.imag.fr>
   ---> 521 nomail.imag.fr does not accept mail
   <--- QUIT
   ---> 221 relay.imag.fr closing connection ]]>
	   </artwork>
	   <postamble>[[Note in draft: to be acceptable for the standards
		  track at the time of posting, the examples above and below will
		  probably have to be retooled to use "example.com" or
		  equivalent]]</postamble>
	   </figure>
       <t> If an MX relay of precedence n for a mailless host bounces mails on
		   its behalf, then any other MX relay of precedence lower than n for
		   this mailless host SHOULD do the same.</t>
	</section>

	<section title="The SMTP server solution">
	   <section title="521 greeting">
		  <t>A host may indicate that it does not accept mail by sending an
			   initial 521 "Host does not accept mail" reply to an incoming SMTP
			   connection.  The official name of the server host or its IP address
			   MUST be sent as the first word following the reply
			   code.</t>
		  <t>For example: 521 canon.inria.fr does not accept mail.</t>
	   </section>
	   <section title="SMTP dialog">
		  <t>After issuing the initial 521 reply, the server host
			 MUST do one of the following two options:
			 <list style="letters">
				<t>Close the SMTP connection.</t>
				<t>Read commands, issuing 521 replies to all commands
				   except QUIT. If the SMTP client does not issue the
				   QUIT command after a 
				  reasonable time, the SMTP server MUST time out and close the
				  connection.  A suggested time-out value is 5
				  minutes.</t>
			 </list></t>
		     <t>   DISCUSSION:
				<vspace blankLines="1"/>
				   When an SMTP server closes the connection immediately after issuing
				   the initial 521 reply, some existing SMTP clients treat the
				   condition as a transient error and requeue the mail for later
				   delivery.  If the SMTP server leaves the connection open, those
				   clients immediately SHOULD send the QUIT command and
				   return the mail.</t>
	   </section>
	   <section title="MX">
		  <t>A host which sends a 521 greeting message MUST NOT be
			 listed as an MX record for any domain except as specified
			 above.
		  <vspace blankLines="0"/><cref>Note in draft: this seemed a
			 tad contradictory to the text above and the instructions below.
			 --JcK</cref></t>
	   </section>
	   <section title="Postmaster">
		  <t>An SMTP server that sends a reply message using a 521
			 code in response to an initial connection is not
			 subject to the postmaster requirement of Section 4.5.1 of
			 RFC 5321.</t>
		  <t>DISCUSSION:
			 <vspace blankLines="1"/>
			 Postmaster exists so you can report mail errors.  A host
			 that doesn't support mail doesn't need a Postmaster.</t>
	   </section>
	   </section>

	   <section title="SMTP client behavior">
		  <t> If an SMTP client encounters a host in an MX record that issues a 521
			 greeting message, it MUST do one of the following, but
			 the choice is left to the implementation:
			 <list style="letters">
				<t>Attempt to deliver it to a different MX host for
				   that domain.</t>
				<t>Return the mail with an appropriate non-delivery
				   report.</t>
		     </list></t>
		  <t>If an SMTP client encounters a 521 reply code in any other part of
			   the SMTP dialog, it MUST return the mail with an appropriate non-
			   delivery report.</t>
	   </section>

	   <section title="Context and other approaches" anchor="Context">
		  <t>This specification, and the 521 code, are intended to
			 address situations in which an SMTP connection is
			 attempted to a host that does not support SMTP.  An
			 alternate approach is to provide information about SMTP
			 non-support in the hope of discouraging such connection
			 attempts.  One way to do that using the DNS is specified
			 as the "null MX" approach <xref target="nullMX"/>.  Even
			 when that approach is used, it is desirable to support a
			 server that will 
			 return this code if a connection is attempted on the
			 SMTP port because client recognition of the special
			 DNS records for null MX is not universal.</t>
	   </section>

	   <section title="Security Considerations">
		  <t>Not running any SMTP server, or running an SMTP server which simply
		   emits fixed strings in response to incoming connection should provide
		   significantly fewer opportunities for security problems than running
		   a complete SMTP implementation.</t>
	   </section>

	   <section title="Contributors">
		  <t>Alain Durand and Francis Dupont created RFC 1846,
			 and, because this document copied large amounts of text
			 from it, most of the text here.  They have not been
			 listed as co-authors only before they could not be
			 contacted before this specification was posted.</t>
	   </section>

	   <!-- <section title="Acknowledgments"?
	       <t>...</t>
	   </section>  -->

  </middle>

  <!--  *****BACK MATTER ***** -->

  <back>
    <!-- References split to informative and normative -->

    <references title="Normative References">

	  &rfc2119;
	  &rfc5321;
    </references>

    <references title="Informative References">

	   &rfc1846;
	   
     <reference anchor="nullMX"
                 target="https://datatracker.ietf.org/doc/draft-ietf-appsawg-nullmx/">
        <front>
          <title>A "Null MX" No Service Resource Record for Domains
			 that Accept No Mail</title>
          <author initials="J." surname="Levine">
            <organization/>
          </author>
          <author initials="M." surname="Delany">
            <organization/>
          </author>
          <date year="2014" month="August" day="5" />
        </front>
      </reference>
	   
    </references>


<!--   Sections below here become  Appendices.  -->
	
	<section title="Change Log" anchor="ChangeLog">
	    <t>RFC Editor: Please remove this appendix before
	publication.</t>
	   <section title="Changes from RFC 1846">
		  <t><list style="symbols">
			 <t>Updated boilerplate and editorial material for a
				standards track document.  As part of this, added
				new <xref target="intro"/> and
				<xref target="Context"/>.</t>
			 <t>Removed "experimental" material</t>
			 <t>Updated references and improved ties to RFC 5321.</t>
			 <t>Mentioned the "nullMX" relationship.</t>
		  </list></t>
	   </section>
	</section>

  </back>
</rfc>
