idnits 2.17.00 (12 Aug 2021) /tmp/idnits41979/draft-klensin-rfc5321bis-00.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- ** The abstract seems to contain references ([2821], [5321bis], [2821bis]), which it shouldn't. Please replace those with straight textual mentions of the documents in question. == There are 2 instances of lines with non-RFC2606-compliant FQDNs in the document. -- The draft header indicates that this document obsoletes RFC5321, but the abstract doesn't seem to directly say this. It does mention RFC5321 though, so this could be OK. -- The draft header indicates that this document obsoletes RFC7504, but the abstract doesn't seem to mention this, which it should. -- The draft header indicates that this document obsoletes RFC1846, but the abstract doesn't seem to mention this, which it should. -- The draft header indicates that this document updates RFC1123, but the abstract doesn't seem to mention this, which it should. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year == Using lowercase 'not' together with uppercase 'MUST', 'SHALL', 'SHOULD', or 'RECOMMENDED' is not an accepted usage according to RFC 2119. Please use uppercase 'NOT' together with RFC 2119 keywords (if that is what you mean). Found 'SHOULD not' in this paragraph: When an SMTP server returns a permanent error status (5yz) code after the DATA command is completed [[CREF151: [2821]20050619 Bruce Lilly, 20010712]] with ., it MUST NOT make any subsequent attempt to deliver the message. As with temporary error status codes, the SMTP client retains responsibility for the message, but SHOULD not again attempt delivery to the same server without user review of the message and response and appropriate intervention. -- The document date (December 2, 2019) is 900 days in the past. Is this intentional? -- Found something which looks like a code comment -- if you have code sections in the document, please surround them with '' and '' lines. Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) == Missing Reference: '2821' is mentioned on line 4541, but not defined -- Looks like a reference, but probably isn't: '5321bis' on line 4730 -- Possible downref: Non-RFC (?) normative reference: ref. '2' ** Obsolete normative reference: RFC 821 (ref. '8') (Obsoleted by RFC 2821) -- Obsolete informational reference (is this intentional?): RFC 822 (ref. '16') (Obsoleted by RFC 2822) -- Obsolete informational reference (is this intentional?): RFC 974 (ref. '19') (Obsoleted by RFC 2821) -- Obsolete informational reference (is this intentional?): RFC 1652 (ref. '23') (Obsoleted by RFC 6152) -- Obsolete informational reference (is this intentional?): RFC 1869 (ref. '26') (Obsoleted by RFC 2821) -- Obsolete informational reference (is this intentional?): RFC 2821 (ref. '34') (Obsoleted by RFC 5321) -- Obsolete informational reference (is this intentional?): RFC 3501 (ref. '39') (Obsoleted by RFC 9051) -- Obsolete informational reference (is this intentional?): RFC 3798 (ref. '40') (Obsoleted by RFC 8098) -- Obsolete informational reference (is this intentional?): RFC 3851 (ref. '41') (Obsoleted by RFC 5751) -- Obsolete informational reference (is this intentional?): RFC 4408 (ref. '42') (Obsoleted by RFC 7208) -- Obsolete informational reference (is this intentional?): RFC 4409 (ref. '43') (Obsoleted by RFC 6409) -- Obsolete informational reference (is this intentional?): RFC 4871 (ref. '45') (Obsoleted by RFC 6376) Summary: 2 errors (**), 0 flaws (~~), 4 warnings (==), 19 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Network Working Group J. Klensin 3 Internet-Draft December 2, 2019 4 Obsoletes: 5321, 1846, 7504 (if 5 approved) 6 Updates: 1123 (if approved) 7 Intended status: Standards Track 8 Expires: June 4, 2020 10 Simple Mail Transfer Protocol 11 draft-klensin-rfc5321bis-00 13 Abstract 15 This document is a specification of the basic protocol for Internet 16 electronic mail transport. It consolidates, updates, and clarifies 17 several previous documents, making all or parts of most of them 18 obsolete. It covers the SMTP extension mechanisms and best practices 19 for the contemporary Internet, but does not provide details about 20 particular extensions. Although SMTP was designed as a mail 21 transport and delivery protocol, this specification also contains 22 information that is important to its use as a "mail submission" 23 protocol for "split-UA" (User Agent) mail reading systems and mobile 24 environments. 26 Note on Reading This Working Draft 28 This working draft contains a relatively complete trace of 29 significant changes since RFC 2821. CREF comments marked "[2821]" or 30 "[2821bis]" are pre-RFC 5321 and can be safely ignored unless there 31 is some reason to reopen the related issues. Those notes on 2821 32 will be removed (and this note modified) in the -01 draft, which will 33 be posted with a 3 December date. It otherwise not expected to 34 differ from this one -- readers should take their pick. Anything 35 marked "[5321bis]" is current. In general, unless those are marked 36 with "[[Note in Draft", in the contents of an "Editor's note", or are 37 in the "Errata Summary" appendix, they are just notes on changes that 38 have already been made and where the changes originated. Comments 39 identified as "2821ter" arose after the Last Call on what became 40 RFC5321, sometimes before AUTH48 on that document or a bit later. 41 Those, of course, should still be reviewed. Surviving comments about 42 rfc5321bis-00 followed by a letter indicate intermediate working 43 versions of this draft and can be ignored unless the origin of 44 changes is important. As one can tell from the dates (when they are 45 given), this document has been periodically updated over a very long 46 period of time. 48 Status of This Memo 50 This Internet-Draft is submitted in full conformance with the 51 provisions of BCP 78 and BCP 79. 53 Internet-Drafts are working documents of the Internet Engineering 54 Task Force (IETF). Note that other groups may also distribute 55 working documents as Internet-Drafts. The list of current Internet- 56 Drafts is at https://datatracker.ietf.org/drafts/current/. 58 Internet-Drafts are draft documents valid for a maximum of six months 59 and may be updated, replaced, or obsoleted by other documents at any 60 time. It is inappropriate to use Internet-Drafts as reference 61 material or to cite them other than as "work in progress." 63 This Internet-Draft will expire on June 4, 2020. 65 Copyright Notice 67 Copyright (c) 2019 IETF Trust and the persons identified as the 68 document authors. All rights reserved. 70 This document is subject to BCP 78 and the IETF Trust's Legal 71 Provisions Relating to IETF Documents 72 (https://trustee.ietf.org/license-info) in effect on the date of 73 publication of this document. Please review these documents 74 carefully, as they describe your rights and restrictions with respect 75 to this document. Code Components extracted from this document must 76 include Simplified BSD License text as described in Section 4.e of 77 the Trust Legal Provisions and are provided without warranty as 78 described in the Simplified BSD License. 80 Table of Contents 82 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 5 83 1.1. Transport of Electronic Mail . . . . . . . . . . . . . . 5 84 1.2. History and Context for This Document . . . . . . . . . . 5 85 1.3. Document Conventions . . . . . . . . . . . . . . . . . . 7 86 2. The SMTP Model . . . . . . . . . . . . . . . . . . . . . . . 7 87 2.1. Basic Structure . . . . . . . . . . . . . . . . . . . . . 7 88 2.2. The Extension Model . . . . . . . . . . . . . . . . . . . 10 89 2.2.1. Background . . . . . . . . . . . . . . . . . . . . . 10 90 2.2.2. Definition and Registration of Extensions . . . . . . 11 91 2.2.3. Special Issues with Extensions . . . . . . . . . . . 12 92 2.3. SMTP Terminology . . . . . . . . . . . . . . . . . . . . 12 93 2.3.1. Mail Objects . . . . . . . . . . . . . . . . . . . . 12 94 2.3.2. Senders and Receivers . . . . . . . . . . . . . . . . 13 95 2.3.3. Mail Agents and Message Stores . . . . . . . . . . . 13 96 2.3.4. Host . . . . . . . . . . . . . . . . . . . . . . . . 13 97 2.3.5. Domain Names . . . . . . . . . . . . . . . . . . . . 14 98 2.3.6. Buffer and State Table . . . . . . . . . . . . . . . 15 99 2.3.7. Commands and Replies . . . . . . . . . . . . . . . . 15 100 2.3.8. Lines . . . . . . . . . . . . . . . . . . . . . . . . 16 101 2.3.9. Message Content and Mail Data . . . . . . . . . . . . 16 102 2.3.10. Originator, Delivery, Relay, and Gateway Systems . . 16 103 2.3.11. Mailbox and Address . . . . . . . . . . . . . . . . . 17 104 2.4. General Syntax Principles and Transaction Model . . . . . 17 105 3. The SMTP Procedures: An Overview . . . . . . . . . . . . . . 19 106 3.1. Session Initiation . . . . . . . . . . . . . . . . . . . 19 107 3.2. Client Initiation . . . . . . . . . . . . . . . . . . . . 20 108 3.3. Mail Transactions . . . . . . . . . . . . . . . . . . . . 20 109 3.4. Forwarding for Address Correction or Updating . . . . . . 23 110 3.5. Commands for Debugging Addresses . . . . . . . . . . . . 24 111 3.5.1. Overview . . . . . . . . . . . . . . . . . . . . . . 24 112 3.5.2. VRFY Normal Response . . . . . . . . . . . . . . . . 26 113 3.5.3. Meaning of VRFY or EXPN Success Response . . . . . . 27 114 3.5.4. Semantics and Applications of EXPN . . . . . . . . . 28 115 3.6. Relaying and Mail Routing . . . . . . . . . . . . . . . . 28 116 3.6.1. Source Routes and Relaying . . . . . . . . . . . . . 28 117 3.6.2. Mail eXchange Records and Relaying . . . . . . . . . 28 118 3.6.3. Message Submission Servers as Relays . . . . . . . . 29 119 3.7. Mail Gatewaying . . . . . . . . . . . . . . . . . . . . . 30 120 3.7.1. Header Fields in Gatewaying . . . . . . . . . . . . . 30 121 3.7.2. Received Lines in Gatewaying . . . . . . . . . . . . 31 122 3.7.3. Addresses in Gatewaying . . . . . . . . . . . . . . . 31 123 3.7.4. Other Header Fields in Gatewaying . . . . . . . . . . 31 124 3.7.5. Envelopes in Gatewaying . . . . . . . . . . . . . . . 32 125 3.8. Terminating Sessions and Connections . . . . . . . . . . 32 126 3.9. Mailing Lists and Aliases . . . . . . . . . . . . . . . . 33 127 3.9.1. Alias . . . . . . . . . . . . . . . . . . . . . . . . 33 128 3.9.2. List . . . . . . . . . . . . . . . . . . . . . . . . 34 129 4. The SMTP Specifications . . . . . . . . . . . . . . . . . . . 34 130 4.1. SMTP Commands . . . . . . . . . . . . . . . . . . . . . . 34 131 4.1.1. Command Semantics and Syntax . . . . . . . . . . . . 34 132 4.1.2. Command Argument Syntax . . . . . . . . . . . . . . . 44 133 4.1.3. Address Literals . . . . . . . . . . . . . . . . . . 46 134 4.1.4. Order of Commands . . . . . . . . . . . . . . . . . . 48 135 4.1.5. Private-Use Commands . . . . . . . . . . . . . . . . 50 136 4.2. SMTP Replies . . . . . . . . . . . . . . . . . . . . . . 50 137 4.2.1. Reply Code Severities and Theory . . . . . . . . . . 52 138 4.2.2. Reply Codes by Function Groups . . . . . . . . . . . 55 139 4.2.3. Reply Codes in Numeric Order . . . . . . . . . . . . 56 140 4.2.4. Some specific code situations and relationships . . . 58 141 4.3. Sequencing of Commands and Replies . . . . . . . . . . . 59 142 4.3.1. Sequencing Overview . . . . . . . . . . . . . . . . . 59 143 4.3.2. Command-Reply Sequences . . . . . . . . . . . . . . . 60 145 4.4. Trace Information . . . . . . . . . . . . . . . . . . . . 63 146 4.5. Additional Implementation Issues . . . . . . . . . . . . 67 147 4.5.1. Minimum Implementation . . . . . . . . . . . . . . . 67 148 4.5.2. Transparency . . . . . . . . . . . . . . . . . . . . 68 149 4.5.3. Sizes and Timeouts . . . . . . . . . . . . . . . . . 69 150 4.5.4. Retry Strategies . . . . . . . . . . . . . . . . . . 73 151 4.5.5. Messages with a Null Reverse-Path . . . . . . . . . . 75 152 5. Address Resolution and Mail Handling . . . . . . . . . . . . 76 153 5.1. Locating the Target Host . . . . . . . . . . . . . . . . 76 154 5.2. IPv6 and MX Records . . . . . . . . . . . . . . . . . . . 78 155 6. Problem Detection and Handling . . . . . . . . . . . . . . . 79 156 6.1. Reliable Delivery and Replies by Email . . . . . . . . . 79 157 6.2. Unwanted, Unsolicited, and "Attack" Messages . . . . . . 80 158 6.3. Loop Detection . . . . . . . . . . . . . . . . . . . . . 81 159 6.4. Compensating for Irregularities . . . . . . . . . . . . . 81 160 7. Security Considerations . . . . . . . . . . . . . . . . . . . 82 161 7.1. Mail Security and Spoofing . . . . . . . . . . . . . . . 82 162 7.2. "Blind" Copies . . . . . . . . . . . . . . . . . . . . . 83 163 7.3. VRFY, EXPN, and Security . . . . . . . . . . . . . . . . 84 164 7.4. Mail Rerouting Based on the 251 and 551 Response 165 Codes . . . . . . . . . . . . . . . . . . . . . . . . . . 85 166 7.5. Information Disclosure in Announcements . . . . . . . . . 85 167 7.6. Information Disclosure in Trace Fields . . . . . . . . . 85 168 7.7. Information Disclosure in Message Forwarding . . . . . . 86 169 7.8. Resistance to Attacks . . . . . . . . . . . . . . . . . . 86 170 7.9. Scope of Operation of SMTP Servers . . . . . . . . . . . 86 171 8. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 87 172 9. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 88 173 10. References . . . . . . . . . . . . . . . . . . . . . . . . . 88 174 10.1. Normative References . . . . . . . . . . . . . . . . . . 88 175 10.2. Informative References . . . . . . . . . . . . . . . . . 89 176 Appendix A. TCP Transport Service . . . . . . . . . . . . . . . 94 177 Appendix B. Generating SMTP Commands from RFC 822 Header Fields 94 178 Appendix C. Source Routes . . . . . . . . . . . . . . . . . . . 95 179 Appendix D. Scenarios . . . . . . . . . . . . . . . . . . . . . 96 180 D.1. A Typical SMTP Transaction Scenario . . . . . . . . . . . 97 181 D.2. Aborted SMTP Transaction Scenario . . . . . . . . . . . . 97 182 D.3. Relayed Mail Scenario . . . . . . . . . . . . . . . . . . 98 183 D.4. Verifying and Sending Scenario . . . . . . . . . . . . . 99 184 Appendix E. Other Gateway Issues . . . . . . . . . . . . . . . . 100 185 Appendix F. Deprecated Features of RFC 821 . . . . . . . . . . . 100 186 F.1. TURN . . . . . . . . . . . . . . . . . . . . . . . . . . 100 187 F.2. Source Routing . . . . . . . . . . . . . . . . . . . . . 101 188 F.3. HELO . . . . . . . . . . . . . . . . . . . . . . . . . . 101 189 F.4. #-literals . . . . . . . . . . . . . . . . . . . . . . . 101 190 F.5. Dates and Years . . . . . . . . . . . . . . . . . . . . . 102 191 F.6. Sending versus Mailing . . . . . . . . . . . . . . . . . 102 192 Appendix G. Change log for RFC 5321bis . . . . . . . . . . . . . 102 193 G.1. RFC 5321 Errata Summary . . . . . . . . . . . . . . . . . 102 194 G.2. Changes from RFC 5321 (published October 2008) to the 195 initial (-00) version of this draft . . . . . . . . . . . 103 196 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 197 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 106 199 1. Introduction 201 1.1. Transport of Electronic Mail 203 The objective of the Simple Mail Transfer Protocol (SMTP) is to 204 transfer mail reliably and efficiently. 206 SMTP is independent of the particular transmission subsystem and 207 requires only a reliable ordered data stream channel. While this 208 document specifically discusses transport over TCP, other transports 209 are possible. Appendices to RFC 821 [8] describe some of them. 211 An important feature of SMTP is its capability to transport mail 212 across multiple networks, usually referred to as "SMTP mail relaying" 213 (see Section 3.6). A network consists of the mutually-TCP-accessible 214 hosts on the public Internet, the mutually-TCP-accessible hosts on a 215 firewall-isolated TCP/IP Intranet, or hosts in some other LAN or WAN 216 environment utilizing a non-TCP transport-level protocol. Using 217 SMTP, a process can transfer mail to another process on the same 218 network or to some other network via a relay or gateway process 219 accessible to both networks. 221 In this way, a mail message may pass through a number of intermediate 222 relay or gateway hosts on its path from sender to ultimate recipient. 223 The Mail eXchanger mechanisms of the domain name system (RFC 1035 224 [7], RFC 974 [19], and Section 5 of this document) are used to 225 identify the appropriate next-hop destination for a message being 226 transported. 228 1.2. History and Context for This Document 230 This document is a [[CREF1: [2821] "self-contained" removed, JcK 231 20080225 -- it can't be with a reference list that long.]] 232 specification of the basic protocol for the Internet electronic mail 233 transport. It consolidates, updates and clarifies, but does not add 234 new or change existing functionality of the following: 236 o the original SMTP (Simple Mail Transfer Protocol) specification of 237 RFC 821 [8], 239 o domain name system requirements and implications for mail 240 transport from RFC 1035 [7] and RFC 974 [19], 242 o the clarifications and applicability statements in RFC 1123 [3], 244 o the new error codes added by RFC 1846 [24] and later by RFC 7504> 245 [48], obsoleting both of those documents, and 247 o material drawn from the SMTP Extension mechanisms in RFC 1869 248 [26]. 250 o Editorial and clarification changes to RFC 2821 [34] to bring that 251 specification to Draft Standard. [[CREF2: [2821]Editorial, JcK 252 20070422.]] 254 It obsoletes RFC 821, RFC 974, RFC 1869, and RFC 2821 [[CREF3: 255 [2821]Tony 20080214 #14]] and updates RFC 1123 (replacing the mail 256 transport materials of RFC 1123). However, RFC 821 specifies some 257 features that were not in significant use in the Internet by the mid- 258 1990s and (in appendices) some additional transport models. Those 259 sections are omitted here in the interest of clarity and brevity; 260 readers needing them should refer to RFC 821. 262 It also includes some additional material from RFC 1123 that required 263 amplification. This material has been identified in multiple ways, 264 mostly by tracking flaming on various lists and newsgroups and 265 problems of unusual readings or interpretations that have appeared as 266 the SMTP extensions have been deployed. Where this specification 267 moves beyond consolidation and actually differs from earlier 268 documents, it supersedes them technically as well as textually. 270 Although SMTP was designed as a mail transport and delivery protocol, 271 this specification also contains information that is important to its 272 use as a "mail submission" protocol, as recommended for Post Office 273 Protocol (POP) (RFC 937 [17], RFC 1939 [27]) and IMAP (RFC 3501 274 [39]). [[CREF4: [2821] Changed 2060 to 3501]] In general, the 275 separate mail submission protocol specified in RFC 4409 [43] [[CREF5: 276 [2821]Replaced 2476 reference with 4409, changed recommendation JcK 277 20080225]] is now preferred to direct use of SMTP; more discussion of 278 that subject appears in that document. 280 Section 2.3 provides definitions of terms specific to this document. 281 Except when the historical terminology is necessary for clarity, this 282 document uses the current 'client' and 'server' terminology to 283 identify the sending and receiving SMTP processes, respectively. 285 A companion document, RFC 5322 [11], discusses message header 286 sections [[CREF6: [2821]Issue 27, 20070423]] and bodies and specifies 287 formats and structures for them. 289 1.3. Document Conventions 291 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 292 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 293 document are to be interpreted as described in RFC 2119 [1]. As each 294 of these terms was intentionally and carefully chosen to improve the 295 interoperability of email, each use of these terms is to be treated 296 as a conformance requirement. [[CREF7: [2821] Tony 20080212 #1, 297 20080213 00:43]] 299 Because this document has a long history and to avoid the risk of 300 various errors and of confusing readers and documents that point to 301 this one, most examples and the domain names they contain are 302 preserved from RFC 2821. Readers are cautioned that these are 303 illustrative examples that should not actually be used in either code 304 or configuration files. 305 [[CREF8: [2821]This subsection and the associated rearrangement of 306 the 2119 text are a result of the proposed compromise with the IESG 307 to avoid either changing the examples or introducing an IETF Note. 308 JcK 20080717 - 20080721]] 310 2. The SMTP Model 312 [[CREF9: [5321bis] [[Editor's Note: There have been extensive and 313 repeated discussions on the SMTP and IETF lists about whether this 314 document should say something about hop-by-hop (MTA-to-MTA) SMTP 315 authentication and, if so, what?? Note that end to end message 316 authentication is almost certainly out of scope for SMTP.]]]] 318 2.1. Basic Structure 320 The SMTP design can be pictured as: 322 +----------+ +----------+ 323 +------+ | | | | 324 | User |<-->| | SMTP | | 325 +------+ | Client- |Commands/Replies| Server- | 326 +------+ | SMTP |<-------------->| SMTP | +------+ 327 | File |<-->| | and Mail | |<-->| File | 328 |System| | | | | |System| 329 +------+ +----------+ +----------+ +------+ 330 SMTP client SMTP server 332 When an SMTP client has a message to transmit, it establishes a two- 333 way transmission channel to an SMTP server. The responsibility of an 334 SMTP client is to transfer mail messages to one or more SMTP servers, 335 or report its failure to do so. 337 The means by which a mail message is presented to an SMTP client, and 338 how that client determines the identifier(s) ("names") of the 339 domain(s) to which mail messages are to be transferred, are local 340 matters. They are not addressed by this document. In some cases, 341 the designated domain(s), or those determined by an SMTP client, will 342 identify the final destination(s) of the mail message. In other 343 cases, common with SMTP clients associated with implementations of 344 the POP (RFC 937 [17], RFC 1939 [27]) or IMAP (RFC 3501 [39]) 345 protocols, or when the SMTP client is inside an isolated transport 346 service environment, the domain determined will identify an 347 intermediate destination through which all mail messages are to be 348 relayed. SMTP clients that transfer all traffic regardless of the 349 target domains associated with the individual messages, or that do 350 not maintain queues for retrying message transmissions that initially 351 cannot be completed, may otherwise conform to this specification but 352 are not considered fully-capable. [[CREF10: [2821] Changes from 353 "domain name" to "domain" or equivalent per Mark E Mallett note 354 20070418, 20070422]] Fully-capable SMTP implementations, including 355 the relays used by these less capable ones, and their destinations, 356 are expected to support all of the queuing, retrying, and alternate 357 address functions discussed in this specification. In many 358 situations and configurations, the less-capable clients discussed 359 above SHOULD be using the message submission protocol (RFC 4409 [43]) 360 rather than SMTP. [[CREF11: [2821] Klensin 20070422]] 362 The means by which an SMTP client, once it has determined a target 363 domain, determines the identity of an SMTP server to which a copy of 364 a message is to be transferred, and then performs that transfer, are 365 covered by this document. To effect a mail transfer to an SMTP 366 server, an SMTP client establishes a two-way transmission channel to 367 that SMTP server. An SMTP client determines the address of an 368 appropriate host running an SMTP server by resolving a destination 369 domain name to either an intermediate Mail eXchanger host or a final 370 target host. 372 An SMTP server may be either the ultimate destination or an 373 intermediate "relay" (that is, it may assume the role of an SMTP 374 client after receiving the message) or "gateway" (that is, it may 375 transport the message further using some protocol other than SMTP). 376 SMTP commands are generated by the SMTP client and sent to the SMTP 377 server. SMTP replies are sent from the SMTP server to the SMTP 378 client in response to the commands. 380 In other words, message transfer can occur in a single connection 381 between the original SMTP-sender and the final SMTP-recipient, or can 382 occur in a series of hops through intermediary systems. In either 383 case, once the server has issued a success response at the end of the 384 mail data, a formal handoff of responsibility for the message occurs: 386 the protocol requires that a server MUST accept responsibility for 387 either delivering the message or properly reporting the failure to do 388 so (see Sections 6.1, 6.2, and 7.8, below). [[CREF12: 389 [2821]Preferred->Should, etc. Issue 16 20070421. Handoff issues and 390 NDNs, Issue 32b per Tony Hansen 20070503]] 392 Once the transmission channel is established and initial handshaking 393 is completed, the SMTP client normally initiates a mail transaction. 394 Such a transaction consists of a series of commands to specify the 395 originator and destination of the mail and transmission of the 396 message content (including any lines in the header section [[CREF13: 397 [2821]Issue 27 20070423]] or other structure) itself. When the same 398 message is sent to multiple recipients, this protocol encourages the 399 transmission of only one copy of the data for all recipients at the 400 same destination (or intermediate relay) host. 402 The server responds to each command with a reply; replies may 403 indicate that the command was accepted, that additional commands are 404 expected, or that a temporary or permanent error condition exists. 405 Commands specifying the sender or recipients may include server- 406 permitted SMTP service extension requests, as discussed in 407 Section 2.2. The dialog is purposely lock-step, one-at-a-time, 408 although this can be modified by mutually agreed upon extension 409 requests such as command pipelining (RFC 2920 [35]). 411 Once a given mail message has been transmitted, the client may either 412 request that the connection be shut down or may initiate other mail 413 transactions. In addition, an SMTP client may use a connection to an 414 SMTP server for ancillary services such as verification of email 415 addresses or retrieval of mailing list subscriber addresses. 417 As suggested above, this protocol provides mechanisms for the 418 transmission of mail. Historically, this transmission normally 419 occurred directly from the sending user's host to the receiving 420 user's host when the two hosts are connected to the same transport 421 service. When they are not connected to the same transport service, 422 transmission occurs via one or more relay SMTP servers. A very 423 common case in the Internet today involves submission of the original 424 message to an intermediate, "message submission" server, which is 425 similar to a relay but has some additional properties; such servers 426 are discussed in Section 2.3.10 and at some length in RFC 4409 [43] 427 [[CREF14: [2821] 6/19/2005: Per note from Vint Cerf, 20040417]]. An 428 intermediate host that acts as either an SMTP relay or as a gateway 429 into some other transmission environment is usually selected through 430 the use of the domain name service (DNS) Mail eXchanger mechanism. 431 Explicit "source" routing (see Section 5 and Appendix C and 432 Appendix F.2) SHOULD NOT be used. [[CREF15: [5321bis] JcK 20090123 - 433 redundant sentence removed.]] 435 2.2. The Extension Model 437 2.2.1. Background 439 In an effort that started in 1990, approximately a decade after RFC 440 821 was completed, the protocol was modified with a "service 441 extensions" model that permits the client and server to agree to 442 utilize shared functionality beyond the original SMTP requirements. 443 The SMTP extension mechanism defines a means whereby an extended SMTP 444 client and server may recognize each other, and the server can inform 445 the client as to the service extensions that it supports. 447 Contemporary SMTP implementations MUST support the basic extension 448 mechanisms. For instance, servers MUST support the EHLO command even 449 if they do not implement any specific extensions and clients SHOULD 450 preferentially utilize EHLO rather than HELO. (However, for 451 compatibility with older conforming implementations, SMTP clients and 452 servers MUST support the original HELO mechanisms as a fallback.) 453 Unless the different characteristics of HELO must be identified for 454 interoperability purposes, this document discusses only EHLO. 456 SMTP is widely deployed and high-quality implementations have proven 457 to be very robust. However, the Internet community now considers 458 some services to be important that were not anticipated when the 459 protocol was first designed. If support for those services is to be 460 added, it must be done in a way that permits older implementations to 461 continue working acceptably. The extension framework consists of: 463 o The SMTP command EHLO, superseding the earlier HELO, 465 o a registry of SMTP service extensions, 467 o additional parameters to the SMTP MAIL and RCPT commands, and 469 o optional replacements for commands defined in this protocol, such 470 as for DATA in non-ASCII transmissions (RFC 3030 [37]). 472 SMTP's strength comes primarily from its simplicity. Experience with 473 many protocols has shown that protocols with few options tend towards 474 ubiquity, whereas protocols with many options tend towards obscurity. 476 Each and every extension, regardless of its benefits, must be 477 carefully scrutinized with respect to its implementation, deployment, 478 and interoperability costs. In many cases, the cost of extending the 479 SMTP service will likely outweigh the benefit. 481 2.2.2. Definition and Registration of Extensions 483 The IANA maintains a registry of SMTP service extensions. A 484 corresponding EHLO keyword value is associated with each extension. 485 Each service extension registered with the IANA must be defined in a 486 formal Standards-Track or IESG-approved Experimental protocol 487 document. The definition must include: 489 o the textual name of the SMTP service extension; 491 o the EHLO keyword value associated with the extension; 493 o the syntax and possible values of parameters associated with the 494 EHLO keyword value; 496 o any additional SMTP verbs associated with the extension 497 (additional verbs will usually be, but are not required to be, the 498 same as the EHLO keyword value); 500 o any new parameters the extension associates with the MAIL or RCPT 501 verbs; 503 o a description of how support for the extension affects the 504 behavior of a server and client SMTP; and 506 o the increment by which the extension is increasing the maximum 507 length of the commands MAIL and/or RCPT, over that specified in 508 this Standard. 510 In addition, any EHLO keyword value starting with an upper or lower 511 case "X" refers to a local SMTP service extension used exclusively 512 through bilateral agreement. Keywords beginning with "X" MUST NOT be 513 used in a registered service extension. Conversely, keyword values 514 presented in the EHLO response that do not begin with "X" MUST 515 correspond to a Standard, Standards-Track, or IESG-approved 516 Experimental SMTP service extension registered with IANA. A 517 conforming server MUST NOT offer non-"X"-prefixed keyword values that 518 are not described in a registered extension. 520 Additional verbs and parameter names are bound by the same rules as 521 EHLO keywords; specifically, verbs beginning with "X" are local 522 extensions that may not be registered or standardized. Conversely, 523 verbs not beginning with "X" must always be registered. 525 2.2.3. Special Issues with Extensions 527 [[CREF16: [2821]Material in this subsection motivated by 528 correspondence with Randy Gellens around 20070128. Email i18n issues 529 were the specific motivation, but the issues are more general. It is 530 not clear whether this should be placed here or on some other 531 section.]] 532 Extensions that change fairly basic properties of SMTP operation are 533 permitted. [[CREF17: [2821]Wording change per SM note 20071017]] The 534 text in other sections of this document must be understood in that 535 context. In particular, extensions can change the minimum limits 536 specified in Section 4.5.3, can change the ASCII character set 537 requirement as mentioned above, or can introduce some optional modes 538 of message handling. 540 In particular, if an extension implies that the delivery path 541 normally supports special features of that extension, and an 542 intermediate SMTP system finds a next hop that does not support the 543 required extension, it MAY choose, based on the specific extension 544 and circumstances, to requeue the message and try later and/or try an 545 alternate MX host. If this strategy is employed, the timeout to fall 546 back to an unextended format (if one is available) SHOULD be less 547 than the normal timeout for bouncing as undeliverable (e.g., if 548 normal timeout is three days, the requeue timeout before attempting 549 to transmit the mail without the extension might be one day). 551 2.3. SMTP Terminology 553 2.3.1. Mail Objects 555 SMTP transports a mail object. A mail object contains an envelope 556 and content. 558 The SMTP envelope is sent as a series of SMTP protocol units 559 (described in Section 3). It consists of an originator address (to 560 which error reports should be directed), one or more recipient 561 addresses, and optional protocol extension material. Historically, 562 variations on the reverse-path (originator) address specification 563 command (MAIL) could be used to specify alternate delivery modes, 564 such as immediate display; those variations have now been deprecated 565 (see Appendix F and Appendix F.6). 567 [[CREF18: [2821]??? See note from Mark E. Mallett 20070418 on the 568 use of "header" in the next paragraph.???]] The SMTP content is sent 569 in the SMTP DATA protocol unit and has two parts: the header section 570 [[CREF19: [2821]Issue 27 20070423]] and the body. If the content 571 conforms to other contemporary standards, the header section consists 572 of a collection of header fields, each consisting of a header name, a 573 colon, and data, [[CREF20: [2821]Issue 27 20070423]] structured as in 574 the message format specification (RFC 5322 [11]); the body, if 575 structured, is defined according to MIME (RFC 2045 [29]). The 576 content is textual in nature, expressed using the US-ASCII repertoire 577 [2]. Although SMTP extensions (such as "8BITMIME", RFC 1652 [23]) 578 may relax this restriction for the content body, the content header 579 fields [[CREF21: [2821]Issue 27 20070423]] are always encoded using 580 the US-ASCII repertoire. Two MIME extensions (RFC 2047 [30] and RFC 581 2231 [33]) define an algorithm for representing header values outside 582 the US-ASCII repertoire, while still encoding them using the US-ASCII 583 repertoire. [[CREF22: [2821]Ref to 2231 added per note from Frank 584 Ellerman, 20070426]] 586 2.3.2. Senders and Receivers 588 In RFC 821, the two hosts participating in an SMTP transaction were 589 described as the "SMTP-sender" and "SMTP-receiver". This document 590 has been changed to reflect current industry terminology and hence 591 refers to them as the "SMTP client" (or sometimes just "the client") 592 and "SMTP server" (or just "the server"), respectively. Since a 593 given host may act both as server and client in a relay situation, 594 "receiver" and "sender" terminology is still used where needed for 595 clarity. 597 2.3.3. Mail Agents and Message Stores 599 Additional mail system terminology became common after RFC 821 was 600 published and, where convenient, is used in this specification. In 601 particular, SMTP servers and clients provide a mail transport service 602 and therefore act as "Mail Transfer Agents" (MTAs). "Mail User 603 Agents" (MUAs or UAs) are normally thought of as the sources and 604 targets of mail. At the source, an MUA might collect mail to be 605 transmitted from a user and hand it off to an MTA; the final 606 ("delivery") MTA would be thought of as handing the mail off to an 607 MUA (or at least transferring responsibility to it, e.g., by 608 depositing the message in a "message store"). However, while these 609 terms are used with at least the appearance of great precision in 610 other environments, the implied boundaries between MUAs and MTAs 611 often do not accurately match common, and conforming, practices with 612 Internet mail. Hence, the reader should be cautious about inferring 613 the strong relationships and responsibilities that might be implied 614 if these terms were used elsewhere. 616 2.3.4. Host 618 For the purposes of this specification, a host is a computer system 619 attached to the Internet (or, in some cases, to a private TCP/IP 620 network) and supporting the SMTP protocol. Hosts are known by names 621 (see the next section); they SHOULD NOT be [[CREF23: [2821] 6/19/2005 622 Editorial change - in line with IETF norms to get rid of IP address 623 references in applications.]] identified by numerical addresses, 624 i.e., by address literals as described in Section 4.1.2. [[CREF24: 625 [2821] additional clarification per Frank Ellerman, 20050901 ]] 627 2.3.5. Domain Names 629 [[CREF25: [2821] 6/19/2005 Material from the former 3.6 moved here - 630 stupid to have two "domains" sections. ]] [[CREF26: [2821] First 631 paragraph below modified to reflect the TLD email address case, 632 20060422]] A domain name (or often just a "domain") consists of one 633 or more components, separated by dots if more than one appears. 634 [[CREF27: [2821] Discussion with Chris Wright 635 20071125]] In the case of a top-level 636 domain used by itself in an email address, a single string is used 637 without any dots. This makes the requirement, described in more 638 detail below, that only fully-qualified domain names appear in SMTP 639 transactions on the public Internet, particularly important where 640 top-level domains are involved. [[CREF28: [2821] Trailing dot text 641 removed and new text added 20070413, per list discussion and -01 642 issue 1.]] These components ("labels" in DNS terminology, RFC 1035 643 [7]) are restricted for SMTP purposes to consist of a sequence of 644 letters, digits, and hyphens drawn from the ASCII character set [2] 645 and conforming to what RFC 1035 Section 2.3.1 calls the "preferred 646 name syntax". Domain names are used as names of hosts and of other 647 entities in the domain name hierarchy. For example, a domain may 648 refer to an alias (label of a CNAME RR) or the label of Mail 649 eXchanger records to be used to deliver mail instead of representing 650 a host name. See RFC 1035 [7] and Section 5 of this specification. 652 The domain name, as described in this document and in RFC 1035 [7], 653 is the entire, fully-qualified name (often referred to as an "FQDN"). 654 A domain name that is not in FQDN form is no more than a local alias. 655 Local aliases MUST NOT appear in any SMTP transaction. 657 Only resolvable, fully-qualified domain names (FQDNs) are permitted 658 when domain names are used in SMTP. 659 [[CREF29: [[5321bis Editor's Note: does "in the public DNS" or 660 equivalent need to be added to "resolvable"???]]]] 661 In other words, names that can be resolved to MX RRs or address 662 (i.e., A or AAAA) RRs (as discussed in Section 5) are permitted, as 663 are CNAME RRs whose targets can be resolved, in turn, to MX or 664 address RRs. 665 [[CREF30: [[5321bis Editor's Note: it is not clear whether "In other 666 words" really meant "for example" or it is was intended that the only 667 labels permitted are those that own records in one of the above RR 668 types]]]] 670 [[CREF31: [[5321bis Editor's Note: More generally, does this section 671 need work to clarify the relationship to private domain names 672 (discussed on SMTP list starting 2013-03-26)]]]] 673 [[CREF32: [2821]Changed "A RR" to "address RR" with the definition 674 above to accommodate IPv6. Per discussion with SM, sm@resistor.net, 675 20070329.]] Local nicknames or unqualified names MUST NOT be used. 676 There are two exceptions to the rule requiring FQDNs: 678 o The domain name given in the EHLO command MUST be either a primary 679 host name (a domain name that resolves to an address RR) or, if 680 the host has no name, an address literal, as described in 681 Section 4.1.3 and discussed further in the EHLO discussion of 682 Section 4.1.4. 684 o The reserved mailbox name "postmaster" may be used in a RCPT 685 command without domain qualification (see Section 4.1.1.3) and 686 MUST be accepted if so used. 688 2.3.6. Buffer and State Table 690 SMTP sessions are stateful, with both parties carefully maintaining a 691 common view of the current state. In this document, we model this 692 state by a virtual "buffer" and a "state table" on the server that 693 may be used by the client to, for example, "clear the buffer" or 694 "reset the state table", causing the information in the buffer to be 695 discarded and the state to be returned to some previous state. 697 2.3.7. Commands and Replies 699 [[CREF33: [2821]New title, text changes below, and subsequent 700 subsection, Tony, 20070504, Issue 23]] SMTP commands and, unless 701 altered by a service extension, message data, are transmitted from 702 the sender to the receiver via the transmission channel in "lines". 704 An SMTP reply is an acknowledgment (positive or negative) sent in 705 "lines" from receiver to sender via the transmission channel in 706 response to a command. The general form of a reply is a numeric 707 completion code (indicating failure or success) usually followed by a 708 text string. The codes are for use by programs and the text is 709 usually intended for human users. RFC 3463 [38], specifies further 710 structuring of the reply strings, including the use of supplemental 711 and more specific completion codes (see also RFC 5248 [46]). 712 [[CREF34: [2821]Ref added 20080711, Ellerman/Klensin]] 714 2.3.8. Lines 716 Lines consist of zero or more data characters terminated by the 717 sequence ASCII character "CR" (hex value 0D) followed immediately by 718 ASCII character "LF" (hex value 0A). This termination sequence is 719 denoted as in this document. Conforming implementations MUST 720 NOT recognize or generate any other character or character sequence 721 as a line terminator. Limits MAY be imposed on line lengths by 722 servers (see Section 4). 724 In addition, the appearance of "bare" "CR" or "LF" characters in text 725 (i.e., either without the other) has a long history of causing 726 problems in mail implementations and applications that use the mail 727 system as a tool. SMTP client implementations MUST NOT transmit 728 these characters except when they are intended as line terminators 729 and then MUST, as indicated above, transmit them only as a 730 sequence. 732 2.3.9. Message Content and Mail Data 734 The terms "message content" and "mail data" are used interchangeably 735 in this document to describe the material transmitted after the DATA 736 command is accepted and before the end of data indication is 737 transmitted. Message content includes the message header section 738 [[CREF35: [2821]Issue 27 20070423]] and the possibly structured 739 message body. The MIME specification (RFC 2045 [29]) [[CREF36: 740 [2821] Reference corrected Ellerman, 20050901 ]] provides the 741 standard mechanisms for structured message bodies. 743 2.3.10. Originator, Delivery, Relay, and Gateway Systems 745 This specification makes a distinction among four types of SMTP 746 systems, based on the role those systems play in transmitting 747 electronic mail. An "originating" system (sometimes called an SMTP 748 originator) introduces mail into the Internet or, more generally, 749 into a transport service environment. A "delivery" SMTP system is 750 one that receives mail from a transport service environment and 751 passes it to a mail user agent or deposits it in a message store that 752 a mail user agent is expected to subsequently access. A "relay" SMTP 753 system (usually referred to just as a "relay") receives mail from an 754 SMTP client and transmits it, without modification to the message 755 data other than adding trace information, to another SMTP server for 756 further relaying or for delivery. 758 A "gateway" SMTP system (usually referred to just as a "gateway") 759 receives mail from a client system in one transport environment and 760 transmits it to a server system in another transport environment. 761 Differences in protocols or message semantics between the transport 762 environments on either side of a gateway may require that the gateway 763 system perform transformations to the message that are not permitted 764 to SMTP relay systems. For the purposes of this specification, 765 firewalls that rewrite addresses should be considered as gateways, 766 even if SMTP is used on both sides of them (see RFC 2979 [36]). 767 [[CREF37: [2821] The placeholder for a general email model that 768 appeared in -00 has been removed. ]] [[CREF38: [5321bis] [[Note in 769 draft/Placeholder: There has been a request to expand this section, 770 possibly into a more extensive model of Internet mail. Comments from 771 others solicited. In particular, does RFC 5598 make that suggestion 772 OBE?]] ]] 774 2.3.11. Mailbox and Address 776 [[CREF39: [2821]sections rearranged, per Tony, 20070503]] As used in 777 this specification, an "address" is a character string that 778 identifies a user to whom mail will be sent or a location into which 779 mail will be deposited. The term "mailbox" refers to that 780 depository. The two terms are typically used interchangeably unless 781 the distinction between the location in which mail is placed (the 782 mailbox) and a reference to it (the address) is important. An 783 address normally consists of user and domain specifications. The 784 standard mailbox naming convention is defined to be "local- 785 part@domain"; contemporary usage permits a much broader set of 786 applications than simple "user names". Consequently, and due to a 787 long history of problems when intermediate hosts have attempted to 788 optimize transport by modifying them, the local-part MUST be 789 interpreted and assigned semantics only by the host specified in the 790 domain part of the address. [[CREF40: [2821]Former 'Reply' section, 791 2.3.10, which followed, folded into text above, per Tony following 792 suggestions from Mark Mallett and SM 20070503, issue 23]] 794 2.4. General Syntax Principles and Transaction Model 796 SMTP commands and replies have a rigid syntax. All commands begin 797 with a command verb. All replies begin with a three digit numeric 798 code. In some commands and replies, arguments are required following 799 the verb [[CREF41: [2821] rephrased slightly, Ellerman 20050901 ]] or 800 reply code. Some commands do not accept arguments (after the verb), 801 and some reply codes are followed, sometimes optionally, by free form 802 text. In both cases, where text appears, it is separated from the 803 verb or reply code by a space character. Complete definitions of 804 commands and replies appear in Section 4. 806 Verbs and argument values (e.g., "TO:" or "to:" in the RCPT command 807 and extension name keywords) are not case sensitive, with the sole 808 exception in this specification of a mailbox local-part (SMTP 809 Extensions may explicitly specify case-sensitive elements). That is, 810 a command verb, an argument value other than a mailbox local-part, 811 and free form text MAY be encoded in upper case, lower case, or any 812 mixture of upper and lower case with no impact on its meaning. 813 [[CREF42: [2821] sentence removed: This is NOT true of a mailbox 814 local-part. Ellerman 20050901 ]] The local-part of a mailbox MUST BE 815 treated as case sensitive. Therefore, SMTP implementations MUST take 816 care to preserve the case of mailbox local-parts. In particular, for 817 some hosts, the user "smith" is different from the user "Smith". 818 However, exploiting the case sensitivity of mailbox local-parts 819 impedes interoperability and is discouraged. Mailbox domains follow 820 normal DNS rules and are hence not case sensitive. 822 A few SMTP servers, in violation of this specification (and RFC 821) 823 require that command verbs be encoded by clients in upper case. 824 Implementations MAY wish to employ this encoding to accommodate those 825 servers. 827 The argument clause consists of a variable-length character string 828 ending with the end of the line, i.e., with the character sequence 829 . The receiver will take no action until this sequence is 830 received. 832 The syntax for each command is shown with the discussion of that 833 command. Common elements and parameters are shown in Section 4.1.2. 835 Commands and replies are composed of characters from the ASCII 836 character set [2]. When the transport service provides an 8-bit byte 837 (octet) transmission channel, each 7-bit character is transmitted, 838 right justified, in an octet with the high-order bit cleared to zero. 839 More specifically, the unextended SMTP service provides 7-bit 840 transport only. An originating SMTP client that has not successfully 841 negotiated an appropriate extension with a particular server (see the 842 next paragraph) MUST NOT transmit messages with information in the 843 high-order bit of octets. If such messages are transmitted in 844 violation of this rule, receiving SMTP servers MAY clear the high- 845 order bit or reject the message as invalid. In general, a relay SMTP 846 SHOULD assume that the message content it has received is valid and, 847 assuming that the envelope permits doing so, relay it without 848 inspecting that content. Of course, if the content is mislabeled and 849 the data path cannot accept the actual content, this may result in 850 the ultimate delivery of a severely garbled message to the recipient. 851 Delivery SMTP systems MAY reject such messages, or return them as 852 undeliverable, [[CREF43: [2821] Got rid of "bounce" to make Ellerman 853 happy, 20070401]] rather than deliver them. In the absence of a 854 server-offered extension explicitly permitting it, a sending SMTP 855 system is not permitted to send envelope commands in any character 856 set other than US-ASCII. Receiving systems SHOULD reject such 857 commands, normally using "500 syntax error - invalid character" 858 replies. [[CREF44: [2821] reworded per SM note 20071017]] 860 8-bit message content transmission MAY be requested of the server by 861 a client using extended SMTP facilities, notably the "8BITMIME" 862 extension, RFC 1652 [23]. 8BITMIME SHOULD be supported by SMTP 863 servers. However, it MUST NOT be construed as authorization to 864 transmit unrestricted 8-bit material, nor does 8BITMIME authorize 865 transmission of any envelope material in other than ASCII. 8BITMIME 866 MUST NOT be requested by senders for material with the high bit on 867 that is not in MIME format with an appropriate content-transfer 868 encoding; servers MAY reject such messages. 870 The metalinguistic notation used in this document corresponds to the 871 "Augmented BNF" used in other Internet mail system documents. The 872 reader who is not familiar with that syntax should consult the ABNF 873 specification in RFC 5234 [5]. Metalanguage terms used in running 874 text are surrounded by pointed brackets (e.g., ) for clarity. 875 [[CREF45: [2821]Following inserted per email 20080104, Tony 20080213 876 #7b]] The reader is cautioned that the grammar expressed in the 877 metalanguage is not comprehensive. There are many instances in which 878 provisions in the text constrain or otherwise modify the syntax or 879 semantics implied by the grammar. 881 3. The SMTP Procedures: An Overview 883 This section contains descriptions of the procedures used in SMTP: 884 session initiation, mail transaction, forwarding mail, verifying 885 mailbox names and expanding mailing lists, and opening and closing 886 exchanges. Comments on relaying, a note on mail domains, and a 887 discussion of changing roles are included at the end of this section. 888 Several complete scenarios are presented in Appendix D. 890 3.1. Session Initiation 892 An SMTP session is initiated when a client opens a connection to a 893 server and the server responds with an opening message. 895 SMTP server implementations MAY include identification of their 896 software and version information in the connection greeting reply 897 after the 220 code, a practice that permits more efficient isolation 898 and repair of any problems. Implementations MAY make provision for 899 SMTP servers to disable the software and version announcement where 900 it causes security concerns. While some systems also identify their 901 contact point for mail problems, this is not a substitute for 902 maintaining the required "postmaster" address (see Section 4). 904 The SMTP protocol allows a server to formally reject a mail session 905 [[CREF46: [2821]Tony 20080320]] while still allowing the initial 906 connection as follows: a 554 response MAY be given in the initial 907 connection opening message instead of the 220. A server taking this 908 approach MUST still wait for the client to send a QUIT (see 909 Section 4.1.1.10) before closing the connection and SHOULD respond to 910 any intervening commands with "503 bad sequence of commands". Since 911 an attempt to make an SMTP connection to such a system is probably in 912 error, a server returning a 554 response on connection opening SHOULD 913 provide enough information in the reply text to facilitate debugging 914 of the sending system. 916 3.2. Client Initiation 918 Once the server has sent the greeting (welcoming) message and the 919 client has received it, the client normally sends the EHLO command to 920 the server, indicating the client's identity. In addition to opening 921 the session, use of EHLO indicates that the client is able to process 922 service extensions and requests that the server provide a list of the 923 extensions it supports. Older SMTP systems that are unable to 924 support service extensions, and contemporary clients that do not 925 require service extensions in the mail session being initiated, MAY 926 use HELO instead of EHLO. Servers MUST NOT return the extended EHLO- 927 style response to a HELO command. For a particular connection 928 attempt, if the server returns a "command not recognized" response to 929 EHLO, the client SHOULD be able to fall back and send HELO. 931 In the EHLO command, the host sending the command identifies itself; 932 the command may be interpreted as saying "Hello, I am " (and, 933 in the case of EHLO, "and I support service extension requests"). 935 3.3. Mail Transactions 937 There are three steps to SMTP mail transactions. The transaction 938 starts with a MAIL command that gives the sender identification. (In 939 general, the MAIL command may be sent only when no mail transaction 940 is in progress; see Section 4.1.4.) A series of one or more RCPT 941 commands follows, giving the receiver information. Then, a DATA 942 command initiates transfer of the mail data and is terminated by the 943 "end of mail" data indicator, which also confirms the transaction. 945 The first step in the procedure is the MAIL command. 947 MAIL FROM: [SP ] 949 This command tells the SMTP-receiver that a new mail transaction is 950 starting and to reset all its state tables and buffers, including any 951 recipients or mail data. The portion of the first or 952 only argument contains the source mailbox (between "<" and ">" 953 brackets), which can be used to report errors (see Section 4.2 for a 954 discussion of error reporting). If accepted, the SMTP server returns 955 a "250 OK" reply. If the mailbox specification is not acceptable for 956 some reason, the server MUST return a reply indicating whether the 957 failure is permanent (i.e., will occur again if the client tries to 958 send the same address again) or temporary (i.e., the address might be 959 accepted if the client tries again later). Despite the apparent 960 scope of this requirement, there are circumstances in which the 961 acceptability of the reverse-path may not be determined until one or 962 more forward-paths (in RCPT commands) can be examined. In those 963 cases, the server MAY reasonably accept the reverse-path (with a 250 964 reply) and then report problems after the forward-paths are received 965 and examined. Normally, failures produce 550 or 553 replies. 967 Historically, the was permitted to contain more than 968 just a mailbox; however, contemporary systems SHOULD NOT use source 969 routing (see Appendix C). 971 The optional are associated with negotiated SMTP 972 service extensions (see Section 2.2). 974 The second step in the procedure is the RCPT command. This step of 975 the procedure can be repeated any number of times. [[CREF47: 976 [2821]Tony 20080213#16]] 978 RCPT TO: [ SP ] 980 The first or only argument to this command includes a forward-path 981 (normally a mailbox and domain, always surrounded by "<" and ">" 982 brackets) identifying one recipient. If accepted, the SMTP server 983 returns a "250 OK" reply and stores the forward-path. If the 984 recipient is known not to be a deliverable address, the SMTP server 985 returns a 550 reply, typically with a string such as "no such user - 986 " and the mailbox name (other circumstances and reply codes are 987 possible). 989 The can contain more than just a mailbox. 990 Historically, the was permitted to contain a source 991 routing list of hosts and the destination mailbox; however, 992 contemporary SMTP clients SHOULD NOT utilize source routes (see 993 Appendix C). Servers MUST be prepared to encounter a list of source 994 routes in the forward-path, but they SHOULD ignore the routes or MAY 995 decline to support the relaying they imply. Similarly, servers MAY 996 decline to accept mail that is destined for other hosts or systems. 997 These restrictions make a server useless as a relay for clients that 998 do not support full SMTP functionality. Consequently, restricted- 999 capability clients MUST NOT assume that any SMTP server on the 1000 Internet can be used as their mail processing (relaying) site. If a 1001 RCPT command appears without a previous MAIL command, the server MUST 1002 return a 503 "Bad sequence of commands" response. The optional 1003 are associated with negotiated SMTP service 1004 extensions (see Section 2.2). [[CREF48: [5321bis] JcK Note for 1005 2821ter (5321bis): this section would be improved by being more 1006 specific about where mail transactions begin and end and then talking 1007 about "transaction state" here, rather than specific prior commands. 1008 --JcK]] 1010 Since it has been a common source of errors, it is worth noting that 1011 spaces are not permitted on either side of the colon following FROM 1012 in the MAIL command or TO in the RCPT command. The syntax is exactly 1013 as given above. [[CREF49: [2821] many comments on ietf-smtp list, 1014 July 2005. Substituted "common" for "popular" per SM note 20071017, 1015 but did not make the rest of his changes.]] 1017 The third step in the procedure is the DATA command (or some 1018 alternative specified in a service extension). 1020 DATA 1022 If accepted, the SMTP server returns a 354 Intermediate reply and 1023 considers all succeeding lines up to but not including the end of 1024 mail data indicator to be the message text. When the end of text is 1025 successfully received and stored, the SMTP-receiver sends a "250 OK" 1026 reply. 1028 Since the mail data is sent on the transmission channel, the end of 1029 mail data must be indicated so that the command and reply dialog can 1030 be resumed. SMTP indicates the end of the mail data by sending a 1031 line containing only a "." (period or full stop). A transparency 1032 procedure is used to prevent this from interfering with the user's 1033 text (see Section 4.5.2). 1035 The end of mail data indicator also confirms the mail transaction and 1036 tells the SMTP server to now process the stored recipients and mail 1037 data. If accepted, the SMTP server returns a "250 OK" reply. The 1038 DATA command can fail at only two points in the protocol exchange: 1040 If there was no MAIL, or no RCPT, command, or all such commands were 1041 rejected, the server MAY return a "command out of sequence" (503) or 1042 "no valid recipients" (554) reply in response to the DATA command. 1043 If one of those replies (or any other 5yz reply) is received, the 1044 client MUST NOT send the message data; more generally, message data 1045 MUST NOT be sent unless a 354 reply is received. 1047 If the verb is initially accepted and the 354 reply issued, the DATA 1048 command should fail only if the mail transaction was incomplete (for 1049 example, no recipients), if resources were unavailable (including, of 1050 course, the server unexpectedly becoming unavailable), or if the 1051 server determines that the message should be rejected for policy or 1052 other reasons. 1054 However, in practice, some servers do not perform recipient 1055 verification until after the message text is received. These servers 1056 SHOULD treat a failure for one or more recipients as a "subsequent 1057 failure" and return a mail message as discussed in Section 6 and, in 1058 particular, in Section 6.1. [[CREF50: [2821]editorial]] Using a "550 1059 mailbox not found" (or equivalent) reply code after the data are 1060 accepted makes it difficult or impossible for the client to determine 1061 which recipients failed. 1063 When the RFC 822 format ([16], [11]) is being used, the mail data 1064 include the header fields such as those named [[CREF51: [2821]Issue 1065 27 20070423]] Date, Subject, To, Cc, and From. Server SMTP systems 1066 SHOULD NOT reject messages based on perceived defects in the RFC 822 1067 or MIME (RFC 2045 [29]) message header section [[CREF52: [2821]Issue 1068 27 20070423]] or message body. In particular, they MUST NOT reject 1069 messages in which the numbers of Resent-header fields do not match or 1070 Resent-to appears without Resent-from and/or Resent-date. 1072 Mail transaction commands MUST be used in the order discussed above. 1074 3.4. Forwarding for Address Correction or Updating 1076 Forwarding support is most often required to consolidate and simplify 1077 addresses within, or relative to, some enterprise and less frequently 1078 to establish addresses to link a person's prior address with a 1079 current one. Silent forwarding of messages (without server 1080 notification to the sender), for security or non-disclosure purposes, 1081 is common in the contemporary Internet. 1083 In both the enterprise and the "new address" cases, information 1084 hiding (and sometimes security) considerations argue against exposure 1085 of the "final" address through the SMTP protocol as a side effect of 1086 the forwarding activity. This may be especially important when the 1087 final address may not even be reachable by the sender. Consequently, 1088 the "forwarding" mechanisms described in Section 3.2 of RFC 821, and 1089 especially the 251 (corrected destination) and 551 reply codes from 1090 RCPT must be evaluated carefully by implementers and, when they are 1091 available, by those configuring systems (see also Section 7.4). 1092 [[CREF53: [2821]Ref added per Tony Hansen 20070503, Issue 2]] 1094 In particular: 1096 o Servers MAY forward messages when they are aware of an address 1097 change. When they do so, they MAY either provide address-updating 1098 information with a 251 code, or may forward "silently" and return 1099 a 250 code. However, if a 251 code is used, they MUST NOT assume 1100 that the client will actually update address information or even 1101 return that information to the user. 1103 Alternately, 1105 o Servers MAY reject messages or return them as non-deliverable 1106 [[CREF54: [2821] "bounce" removed, see Ellerman 20070401 ]] when 1107 they cannot be delivered precisely as addressed. When they do so, 1108 they MAY either provide address-updating information with a 551 1109 code, or may reject the message as undeliverable with a 550 code 1110 and no address-specific information. However, if a 551 code is 1111 used, they MUST NOT assume that the client will actually update 1112 address information or even return that information to the user. 1114 SMTP server implementations that support the 251 and/or 551 reply 1115 codes SHOULD provide configuration mechanisms so that sites that 1116 conclude that they would undesirably disclose information can disable 1117 or restrict their use. [[CREF55: [2821]Preferred->Should, etc. 1118 Issue 16 20070421]] 1120 3.5. Commands for Debugging Addresses 1122 3.5.1. Overview 1124 SMTP provides commands to verify a user name or obtain the content of 1125 a mailing list. This is done with the VRFY and EXPN commands, which 1126 have character string arguments. Implementations SHOULD support VRFY 1127 and EXPN (however, see Section 3.5.2 and Section 7.3). 1129 For the VRFY command, the string is a user name or a user name and 1130 domain (see below). If a normal (i.e., 250) response is returned, 1131 the response MAY include the full name of the user and MUST include 1132 the mailbox of the user. It MUST be in either of the following 1133 forms: 1135 User Name 1136 local-part@domain 1138 When a name that is the argument to VRFY could identify more than one 1139 mailbox, the server MAY either note the ambiguity or identify the 1140 alternatives. In other words, any of the following are legitimate 1141 responses to VRFY: 1143 553 User ambiguous 1145 or 1147 553- Ambiguous; Possibilities are 1148 553-Joe Smith 1149 553-Harry Smith 1150 553 Melvin Smith 1152 or 1154 553-Ambiguous; Possibilities 1155 553- 1156 553- 1157 553 1159 Under normal circumstances, a client receiving a 553 reply would be 1160 expected to expose the result to the user. Use of exactly the forms 1161 given, and the "user ambiguous" or "ambiguous" keywords, possibly 1162 supplemented by extended reply codes, such as those described in RFC 1163 3463 [38], will facilitate automated translation into other languages 1164 as needed. Of course, a client that was highly automated or that was 1165 operating in another language than English might choose to try to 1166 translate the response to return some other indication to the user 1167 than the literal text of the reply, or to take some automated action 1168 such as consulting a directory service for additional information 1169 before reporting to the user. 1171 For the EXPN command, the string identifies a mailing list, and the 1172 successful (i.e., 250) multiline response MAY include the full name 1173 of the users and MUST give the mailboxes on the mailing list. 1175 In some hosts, the distinction between a mailing list and an alias 1176 for a single mailbox is a bit fuzzy, since a common data structure 1177 may hold both types of entries, and it is possible to have mailing 1178 lists containing only one mailbox. If a request is made to apply 1179 VRFY to a mailing list, a positive response MAY be given if a message 1180 so addressed would be delivered to everyone on the list, otherwise an 1181 error SHOULD be reported (e.g., "550 That is a mailing list, not a 1182 user" or "252 Unable to verify members of mailing list"). If a 1183 request is made to expand a user name, the server MAY return a 1184 positive response consisting of a list containing one name, or an 1185 error MAY be reported (e.g., "550 That is a user name, not a mailing 1186 list"). 1188 In the case of a successful multiline reply (normal for EXPN), 1189 exactly one mailbox is to be specified on each line of the reply. 1190 The case of an ambiguous request is discussed above. 1192 "User name" is a fuzzy term and has been used deliberately. An 1193 implementation of the VRFY or EXPN commands MUST include at least 1194 recognition of local mailboxes as "user names". However, since 1195 current Internet practice often results in a single host handling 1196 mail for multiple domains, hosts, especially hosts that provide this 1197 functionality, SHOULD accept the "local-part@domain" form as a "user 1198 name"; hosts MAY also choose to recognize other strings as "user 1199 names". 1201 The case of expanding a mailbox list requires a multiline reply, such 1202 as: 1204 C: EXPN Example-People 1205 S: 250-Jon Postel 1206 S: 250-Fred Fonebone 1207 S: 250 Sam Q. Smith 1209 or 1211 C: EXPN Executive-Washroom-List 1212 S: 550 Access Denied to You. 1214 The character string arguments of the VRFY and EXPN commands cannot 1215 be further restricted due to the variety of implementations of the 1216 user name and mailbox list concepts. On some systems, it may be 1217 appropriate for the argument of the EXPN command to be a file name 1218 for a file containing a mailing list, but again there are a variety 1219 of file naming conventions in the Internet. Similarly, historical 1220 variations in what is returned by these commands are such that the 1221 response SHOULD be interpreted very carefully, if at all, and SHOULD 1222 generally only be used for diagnostic purposes. 1224 3.5.2. VRFY Normal Response 1226 When normal (2yz or 551) responses are returned from a VRFY or EXPN 1227 request, the reply MUST include the name using a "" construction, where "domain" is a fully-qualified 1229 domain name.[[CREF56: [2821]Tony 20080320]] In circumstances 1230 exceptional enough to justify violating the intent of this 1231 specification, free-form text MAY be returned. In order to 1232 facilitate parsing by both computers and people, addresses SHOULD 1233 appear in pointed brackets. When addresses, rather than free-form 1234 debugging information, are returned, EXPN and VRFY MUST return only 1235 valid domain addresses that are usable in SMTP RCPT commands. 1236 Consequently, if an address implies delivery to a program or other 1237 system, the mailbox name used to reach that target MUST be given. 1238 Paths (explicit source routes) MUST NOT be returned by VRFY or EXPN. 1240 Server implementations SHOULD support both VRFY and EXPN. For 1241 security reasons, implementations MAY provide local installations a 1242 way to disable either or both of these commands through configuration 1243 options or the equivalent (see Section 7.3). When these commands are 1244 supported, they are not required to work across relays when relaying 1245 is supported. Since they were both optional in RFC 821, but VRFY was 1246 made mandatory in RFC 1123 [3], if EXPN is supported, it MUST be 1247 listed as a service extension in an EHLO response. [[CREF57: 1248 [2821]Ref added, Tony Hansen, 20070503 Issue 2]] VRFY MAY be listed 1249 as a convenience but, since support for it is required, SMTP clients 1250 are not required to check for its presence on the extension list 1251 before using it. [[CREF58: [2821]20050619: Discussion with Bruce 1252 Lilly 20010721]] 1254 3.5.3. Meaning of VRFY or EXPN Success Response 1256 A server MUST NOT return a 250 code in response to a VRFY or EXPN 1257 command unless it has actually verified the address. In particular, 1258 a server MUST NOT return 250 if all it has done is to verify that the 1259 syntax given is valid. In that case, 502 (Command not implemented) 1260 or 500 (Syntax error, command unrecognized) SHOULD be returned. As 1261 stated elsewhere, implementation (in the sense of actually validating 1262 addresses and returning information) of VRFY and EXPN are strongly 1263 recommended. Hence, implementations that return 500 or 502 for VRFY 1264 are not in full compliance with this specification. 1266 There may be circumstances where an address appears to be valid but 1267 cannot reasonably be verified in real time, particularly when a 1268 server is acting as a mail exchanger for another server or domain. 1269 "Apparent validity", in this case, would normally involve at least 1270 syntax checking and might involve verification that any domains 1271 specified were ones to which the host expected to be able to relay 1272 mail. In these situations, reply code 252 SHOULD be returned. These 1273 cases parallel the discussion of RCPT verification in Section 2.1. 1274 [[CREF59: [2821]2005619 Is this right??? ]] Similarly, the discussion 1275 in Section 3.4 applies to the use of reply codes 251 and 551 with 1276 VRFY (and EXPN) to indicate addresses that are recognized but that 1277 would be forwarded or rejected [[CREF60: [2821] See Ellerman, 1278 20070401]] were mail received for them. Implementations generally 1279 SHOULD be more aggressive about address verification in the case of 1280 VRFY than in the case of RCPT, even if it takes a little longer to do 1281 so. [[CREF61: [2821]2821bis-01 Issue 2. Was waiting for additional 1282 text from Ned Freed expected for this section but substituted text 1283 from Tony in -04 and got no further on-list comments.]] 1285 3.5.4. Semantics and Applications of EXPN 1287 EXPN is often very useful in debugging and understanding problems 1288 with mailing lists and multiple-target-address aliases. Some systems 1289 have attempted to use source expansion of mailing lists as a means of 1290 eliminating duplicates. The propagation of aliasing systems with 1291 mail on the Internet for hosts (typically with MX and CNAME DNS 1292 records), for mailboxes (various types of local host aliases), and in 1293 various proxying arrangements has made it nearly impossible for these 1294 strategies to work consistently, and mail systems SHOULD NOT attempt 1295 them. 1297 3.6. Relaying and Mail Routing 1299 3.6.1. Source Routes and Relaying 1301 In general, the availability of Mail eXchanger records in the domain 1302 name system (RFC 1035 [7], RFC 974 [19]) makes the use of explicit 1303 source routes in the Internet mail system unnecessary. Many 1304 historical problems with the interpretation of explicit source routes 1305 have made their use undesirable. SMTP clients SHOULD NOT generate 1306 explicit source routes except under unusual circumstances. SMTP 1307 servers MAY decline to act as mail relays or to accept addresses that 1308 specify source routes. When route information is encountered, SMTP 1309 servers MAY ignore the route information and simply send to the final 1310 destination specified as the last element in the route and SHOULD do 1311 so. There has been an invalid practice of using names that do not 1312 appear in the DNS as destination names, with the senders counting on 1313 the intermediate hosts specified in source routing to resolve any 1314 problems. If source routes are stripped, this practice will cause 1315 failures. This is one of several reasons why SMTP clients MUST NOT 1316 generate invalid source routes or depend on serial resolution of 1317 names in such routes. [[CREF62: [5321bis] Jck 20091023: "of 1318 names..." added for clarity"]] 1320 When source routes are not used, the process described in RFC 821 for 1321 constructing a reverse-path from the forward-path is not applicable 1322 and the reverse-path at the time of delivery will simply be the 1323 address that appeared in the MAIL command. 1325 3.6.2. Mail eXchange Records and Relaying 1327 A relay SMTP server is usually the target of a DNS MX record that 1328 designates it, rather than the final delivery system. The relay 1329 server may accept or reject the task of relaying the mail in the same 1330 way it accepts or rejects mail for a local user. If it accepts the 1331 task, it then becomes an SMTP client, establishes a transmission 1332 channel to the next SMTP server specified in the DNS (according to 1333 the rules in Section 5), and sends it the mail. If it declines to 1334 relay mail to a particular address for policy reasons, a 550 response 1335 SHOULD be returned. 1337 This specification does not deal with the verification of return 1338 paths for use in delivery notifications. Recent work, such as that 1339 on SPF [42] and DKIM [44] [45], has been done to provide ways to 1340 ascertain that an address is valid or belongs to the person who 1341 actually sent the message. 1342 [[5321bis Editor's Note: Proposed erratum (4055) suggests that DKIM 1343 and SPF have nothing to do with this and that everything after the 1344 first sentence should be dropped. An alternative would be to tune 1345 the texts. ???]] 1346 A server MAY attempt to verify the return path before using its 1347 address for delivery notifications, but methods of doing so are not 1348 defined here nor is any particular method recommended at this time. 1350 3.6.3. Message Submission Servers as Relays 1352 Many mail-sending clients exist, especially in conjunction with 1353 facilities that receive mail via POP3 or IMAP, that have limited 1354 capability to support some of the requirements of this specification, 1355 such as the ability to queue messages for subsequent delivery 1356 attempts. For these clients, it is common practice to make private 1357 arrangements to send all messages to a single server for processing 1358 and subsequent distribution. SMTP, as specified here, is not ideally 1359 suited for this role. A standardized mail submission protocol has 1360 been developed that is gradually superseding practices based on SMTP 1361 (see RFC 4409 [43]). [[CREF63: [2821]Since Submit is now a Draft 1362 Standard, the vague language in 2821 no longer seems appropriate 1363 20070331 ]] In any event, because these arrangements are private and 1364 fall outside the scope of this specification, they are not described 1365 here. 1367 It is important to note that MX records can point to SMTP servers 1368 that act as gateways into other environments, not just SMTP relays 1369 and final delivery systems; see Sections 3.7 and 5. 1371 If an SMTP server has accepted the task of relaying the mail and 1372 later finds that the destination is incorrect or that the mail cannot 1373 be delivered for some other reason, then it MUST construct an 1374 "undeliverable mail" notification message and send it to the 1375 originator of the undeliverable mail (as indicated by the reverse- 1376 path). Formats specified for non-delivery reports by other standards 1377 (see, for example, RFC 3461 [12] and RFC 3464 [13]) SHOULD be used if 1378 possible. 1380 This notification message must be from the SMTP server at the relay 1381 host or the host that first determines that delivery cannot be 1382 accomplished. Of course, SMTP servers MUST NOT send notification 1383 messages about problems transporting notification messages. One way 1384 to prevent loops in error reporting is to specify a null reverse-path 1385 in the MAIL command of a notification message. When such a message 1386 is transmitted, the reverse-path MUST be set to null (see 1387 Section 4.5.5 for additional discussion). A MAIL command with a null 1388 reverse-path appears as follows: 1390 MAIL FROM:<> 1392 As discussed in Section 6.4, a relay SMTP has no need to inspect or 1393 act upon the header section [[CREF64: [2821]Issue 27 20070423]] or 1394 body of the message data and MUST NOT do so except to add its own 1395 "Received:" header field (Section 4.4) and, optionally, to attempt to 1396 detect looping in the mail system (see Section 6.3). Of course, this 1397 prohibition also applies to any modifications of these header fields 1398 or text (see also Section 7.9). 1400 3.7. Mail Gatewaying 1402 While the relay function discussed above operates within the Internet 1403 SMTP transport service environment, MX records or various forms of 1404 explicit routing may require that an intermediate SMTP server perform 1405 a translation function between one transport service and another. As 1406 discussed in Section 2.3.10, when such a system is at the boundary 1407 between two transport service environments, we refer to it as a 1408 "gateway" or "gateway SMTP". 1410 Gatewaying mail between different mail environments, such as 1411 different mail formats and protocols, is complex and does not easily 1412 yield to standardization. However, some general requirements may be 1413 given for a gateway between the Internet and another mail 1414 environment. 1416 3.7.1. Header Fields in Gatewaying 1418 Header fields MAY be rewritten when necessary as messages are 1419 gatewayed across mail environment boundaries. This may involve 1420 inspecting the message body or interpreting the local-part of the 1421 destination address in spite of the prohibitions in Section 6.4. 1423 Other mail systems gatewayed to the Internet often use a subset of 1424 the RFC 822 header section [[CREF65: [2821]Issue 27 20070423]] or 1425 provide similar functionality with a different syntax, but some of 1426 these mail systems do not have an equivalent to the SMTP envelope. 1427 Therefore, when a message leaves the Internet environment, it may be 1428 necessary to fold the SMTP envelope information into the message 1429 header section. [[CREF66: [2821]Issue 27 20070423]] A possible 1430 solution would be to create new header fields to carry the envelope 1431 information (e.g., "X-SMTP-MAIL:" and "X-SMTP-RCPT:"); however, this 1432 would require changes in mail programs in foreign environments and 1433 might risk disclosure of private information (see Section 7.2). 1435 3.7.2. Received Lines in Gatewaying 1437 When forwarding a message into or out of the Internet environment, a 1438 gateway MUST prepend a Received: line, but it MUST NOT alter in any 1439 way a Received: line that is already in the header section. 1440 [[CREF67: [2821]Issue 27 20070423]] 1442 "Received:" header fields of messages originating from other 1443 environments may not conform exactly to this specification. However, 1444 the most important use of Received: lines is for debugging mail 1445 faults, and this debugging can be severely hampered by well-meaning 1446 gateways that try to "fix" a Received: line. As another consequence 1447 of trace header fields arising in non-SMTP environments, receiving 1448 systems MUST NOT reject mail based on the format of a trace header 1449 field and SHOULD be extremely robust in the light of unexpected 1450 information or formats in those header fields. 1452 The gateway SHOULD indicate the environment and protocol in the "via" 1453 clauses of Received header field(s) that it supplies. 1455 3.7.3. Addresses in Gatewaying 1457 From the Internet side, the gateway SHOULD accept all valid address 1458 formats in SMTP commands and in the RFC 822 header section, [[CREF68: 1459 [2821]Issue 27 20070423]] and all valid RFC 822 messages. Addresses 1460 and header fields generated by gateways MUST conform to applicable 1461 standards (including this one and RFC 5322 [11]). Gateways are, of 1462 course, subject to the same rules for handling source routes as those 1463 described for other SMTP systems in Section 3.3. 1465 3.7.4. Other Header Fields in Gatewaying 1467 The gateway MUST ensure that all header fields of a message that it 1468 forwards into the Internet mail environment meet the requirements for 1469 Internet mail. In particular, all addresses in "From:", "To:", 1470 "Cc:", etc., header fields MUST be transformed (if necessary) to 1471 satisfy the standard header syntax of RFC 5322 [11], [[CREF69: 1472 [2821]JcK 20050901: changed for consistency, 2821 referenced 822]] 1473 MUST reference only fully-qualified domain names, and MUST be 1474 effective and useful for sending replies. The translation algorithm 1475 used to convert mail from the Internet protocols to another 1476 environment's protocol SHOULD ensure that error messages from the 1477 foreign mail environment are delivered to the reverse-path from the 1478 SMTP envelope, not to an address in the "From:", "Sender:", or 1479 similar header fields of the message. [[CREF70: [2821] Per Frank 1480 Ellerman 20070426]] 1482 3.7.5. Envelopes in Gatewaying 1484 Similarly, when forwarding a message from another environment into 1485 the Internet, the gateway SHOULD set the envelope return path in 1486 accordance with an error message return address, if supplied by the 1487 foreign environment. If the foreign environment has no equivalent 1488 concept, the gateway must select and use a best approximation, with 1489 the message originator's address as the default of last resort. 1491 3.8. Terminating Sessions and Connections 1493 An SMTP connection is terminated when the client sends a QUIT 1494 command. The server responds with a positive reply code, after which 1495 it closes the connection. 1497 An SMTP server MUST NOT intentionally close the connection under 1498 normal operational circumstances (see Section 7.8) except: 1500 o After receiving a QUIT command and responding with a 221 reply. 1502 o After detecting the need to shut down the SMTP service and 1503 returning a 421 reply code. This reply code can be issued after 1504 the server receives any command or, if necessary, asynchronously 1505 from command receipt (on the assumption that the client will 1506 receive it after the next command is issued). 1508 o After a timeout, as specified in Section 4.5.3.2, occurs waiting 1509 for the client to send a command or data. [[CREF71: 1510 [2821]20050619 The previous text caused considerable controversy 1511 in a thread initiated by Paul Smith around 1512 20040107. The issue turns less on the question of whether a 1513 server closing a connection on timeout is an intentional act or 1514 not, but whether it is wise to break the SMTP command-response 1515 model by encouraging unsolicited replies in this case. The text 1516 reflects the 'no unsolicited/ asynchronous replies' model]] 1517 [[CREF72: [2821] 20050619 Per discussion with Jutta Degener, 1518 20030730. Without this, the text is clearly wrong. ]] 1520 In particular, a server that closes connections in response to 1521 commands that are not understood is in violation of this 1522 specification. Servers are expected to be tolerant of unknown 1523 commands, issuing a 500 reply and awaiting further instructions from 1524 the client. 1526 An SMTP server that is forcibly shut down via external means SHOULD 1527 attempt to send a line containing a 421 reply code to the SMTP client 1528 before exiting. The SMTP client will normally read the 421 reply 1529 code after sending its next command. 1531 SMTP clients that experience a connection close, reset, or other 1532 communications failure due to circumstances not under their control 1533 (in violation of the intent of this specification but sometimes 1534 unavoidable) SHOULD, to maintain the robustness of the mail system, 1535 treat the mail transaction as if a 421 response had been received and 1536 act accordingly. 1538 3.9. Mailing Lists and Aliases 1540 [[CREF73: [5321bis] If "alias and list models" are explained 1541 elsewhere, cross reference". Also note that this section appears to 1542 prohibit an exploder from adding List-* headers. That needs to be 1543 finessed.]] 1544 An SMTP-capable host SHOULD support both the alias and the list 1545 models of address expansion for multiple delivery. When a message is 1546 delivered or forwarded to each address of an expanded list form, the 1547 return address in the envelope ("MAIL FROM:") MUST be changed to be 1548 the address of a person or other entity who administers the list. 1549 However, in this case, the message header section (RFC 5322 [11]) 1550 [[CREF74: [2821]Issue 27 20070423]] MUST be left unchanged; in 1551 particular, the "From" field of the header section is unaffected. 1553 An important mail facility is a mechanism for multi-destination 1554 delivery of a single message, by transforming (or "expanding" or 1555 "exploding") a pseudo-mailbox address into a list of destination 1556 mailbox addresses. When a message is sent to such a pseudo-mailbox 1557 (sometimes called an "exploder"), copies are forwarded or 1558 redistributed to each mailbox in the expanded list. Servers SHOULD 1559 simply utilize the addresses on the list; application of heuristics 1560 or other matching rules to eliminate some addresses, such as that of 1561 the originator, is strongly discouraged. We classify such a pseudo- 1562 mailbox as an "alias" or a "list", depending upon the expansion 1563 rules. 1565 3.9.1. Alias 1567 To expand an alias, the recipient mailer simply replaces the pseudo- 1568 mailbox address in the envelope with each of the expanded addresses 1569 in turn; the rest of the envelope and the message body are left 1570 unchanged. The message is then delivered or forwarded to each 1571 expanded address. 1573 3.9.2. List 1575 A mailing list may be said to operate by "redistribution" rather than 1576 by "forwarding". To expand a list, the recipient mailer replaces the 1577 pseudo-mailbox address in the envelope with each of the expanded 1578 addresses in turn. The return (backward-pointing) address in the 1579 envelope is changed so that all error messages generated by the final 1580 deliveries will be returned to a list administrator, not to the 1581 message originator, who generally has no control over the contents of 1582 the list and will typically find error messages annoying. Note that 1583 the key difference between handling aliases (Section 3.9.1) and 1584 forwarding (this subsection) is the change to the backward-pointing 1585 address in this case. [[CREF75: [2821]Mark E Mallet note 20070418, 1586 JcK 20070422]] When a list constrains its processing to the very 1587 limited set of modifications and actions described here, it is 1588 attempting to emulate an MTA; such lists can be treated as a 1589 continuation in email transit. [[CREF76: [2821]Tony 20080213 #11]] 1591 There exist mailing lists that perform additional, sometimes 1592 extensive, modifications to a message and its envelope. Such mailing 1593 lists need to be viewed as full MUAs, which accept a delivery and 1594 post a new message. [[CREF77: [2821]SM 20080220]] 1596 4. The SMTP Specifications 1598 4.1. SMTP Commands 1600 4.1.1. Command Semantics and Syntax 1602 The SMTP commands define the mail transfer or the mail system 1603 function requested by the user. SMTP commands are character strings 1604 terminated by . The commands themselves are alphabetic 1605 characters terminated by if parameters follow and 1606 otherwise. (In the interest of improved interoperability, SMTP 1607 receivers SHOULD tolerate trailing white space before the terminating 1608 .) [[CREF78: [2821]Preferred->Should, etc. Issue 16 1609 20070421]] The syntax of the local part of a mailbox MUST conform to 1610 receiver site conventions and the syntax specified in Section 4.1.2. 1611 The SMTP commands are discussed below. The SMTP replies are 1612 discussed in Section 4.2. 1614 A mail transaction involves several data objects that are 1615 communicated as arguments to different commands. The reverse-path is 1616 the argument of the MAIL command, the forward-path is the argument of 1617 the RCPT command, and the mail data is the argument of the DATA 1618 command. These arguments or data objects must be transmitted and 1619 held, pending the confirmation communicated by the end of mail data 1620 indication that finalizes the transaction. The model for this is 1621 that distinct buffers are provided to hold the types of data objects; 1622 that is, there is a reverse-path buffer, a forward-path buffer, and a 1623 mail data buffer. Specific commands cause information to be appended 1624 to a specific buffer, or cause one or more buffers to be cleared. 1626 Several commands (RSET, DATA, QUIT) are specified as not permitting 1627 parameters. In the absence of specific extensions offered by the 1628 server and accepted by the client, clients MUST NOT send such 1629 parameters and servers SHOULD reject commands containing them as 1630 having invalid syntax. 1632 4.1.1.1. Extended HELLO (EHLO) or HELLO (HELO) 1634 These commands are used to identify the SMTP client to the SMTP 1635 server. The argument clause contains the fully-qualified domain name 1636 of the SMTP client, if one is available. In situations in which the 1637 SMTP client system does not have a meaningful domain name (e.g., when 1638 its address is dynamically allocated and no reverse mapping record is 1639 available), the client SHOULD send an address literal (see 1640 Section 4.1.3). 1642 RFC 2821, and some earlier informal practices, encouraged following 1643 the literal by information that would help to identify the client 1644 system. That convention was not widely supported, and many SMTP 1645 servers considered it an error. In the interest of interoperability, 1646 it is probably wise for servers to be prepared for this string to 1647 occur, but SMTP clients SHOULD NOT send it. [[CREF79: 1648 [2821]Suggestion that the explanation be included dropped and 1649 replaced by the explanation above, 20070511, Issue 19.]] 1651 The SMTP server identifies itself to the SMTP client in the 1652 connection greeting reply and in the response to this command. 1654 A client SMTP SHOULD start an SMTP session by issuing the EHLO 1655 command. If the SMTP server supports the SMTP service extensions, it 1656 will give a successful response, a failure response, or an error 1657 response. If the SMTP server, in violation of this specification, 1658 does not support any SMTP service extensions, it will generate an 1659 error response. Older client SMTP systems MAY, as discussed above, 1660 use HELO (as specified in RFC 821) instead of EHLO, and servers MUST 1661 support the HELO command and reply properly to it. In any event, a 1662 client MUST issue HELO or EHLO before starting a mail transaction. 1664 These commands, and a "250 OK" reply to one of them, confirm that 1665 both the SMTP client and the SMTP server are in the initial state, 1666 that is, there is no transaction in progress and all state tables and 1667 buffers are cleared. 1669 Syntax: 1671 ehlo = "EHLO" SP ( Domain / address-literal ) CRLF 1672 [[CREF80: [2821]Explained literal removed, here and 1673 below, in 04d, 20070511, Issue 19 ]] 1675 helo = "HELO" SP Domain CRLF 1677 Normally, the response to EHLO will be a multiline reply. Each line 1678 of the response contains a keyword and, optionally, one or more 1679 parameters. Following the normal syntax for multiline replies, these 1680 keywords follow the code (250) and a hyphen for all but the last 1681 line, and the code and a space for the last line. The syntax for a 1682 positive response, using the ABNF notation and terminal symbols of 1683 RFC 5234 [5], is: 1685 ehlo-ok-rsp = ( "250" SP Domain [ SP ehlo-greet ] CRLF ) 1686 [[CREF81: [2821]20050619 Mail from "Richard O. 1687 Hammer" 20031223.]] 1688 [[CREF82: [2821]20080222 Tony Hansen -- remove extra 1689 blank line]] / ( "250-" Domain [ SP ehlo-greet ] 1690 CRLF 1691 *( "250-" ehlo-line CRLF ) 1692 "250" SP ehlo-line CRLF ) 1694 ehlo-greet = 1*(%d0-9 / %d11-12 / %d14-127) 1695 [[CREF83: [2821]20080222 Tony Hansen -- remove extra 1696 blank line]] ; string of any characters other than 1697 CR or LF 1699 ehlo-line = ehlo-keyword *( SP ehlo-param ) 1701 ehlo-keyword = (ALPHA / DIGIT) *(ALPHA / DIGIT / "-") 1702 [[CREF84: [2821]20080222 Tony Hansen -- remove extra 1703 blank line]] ; additional syntax of ehlo-params 1704 depends on 1705 ; ehlo-keyword 1707 ehlo-param = 1*(%d33-126) 1708 [[CREF85: [2821]20080222 Tony Hansen -- remove extra 1709 blank line]] ; any CHAR excluding and all 1710 ; control characters (US-ASCII 0-31 and 127 1711 ; inclusive) 1713 Although EHLO keywords may be specified in upper, lower, or mixed 1714 case, they MUST always be recognized and processed in a case- 1715 insensitive manner. This is simply an extension of practices 1716 specified in RFC 821 and [[CREF86: [2821] 20050619 Bortzmeyer/ 1717 Kletnieks, 20050513 ]] Section 2.4. 1719 The EHLO response MUST contain keywords (and associated parameters if 1720 required) for all commands not listed as "required" in Section 4.5.1 1721 excepting only private-use commands as described in Section 4.1.5. 1722 Private-use commands MAY be listed. [[CREF87: [2821]20050619 This 1723 clarifies a long-term ambiguity. See note to IETF list from 1724 Sabahattin Gucukoglu , 20040119]] 1726 4.1.1.2. MAIL (MAIL) 1728 This command is used to initiate a mail transaction in which the mail 1729 data is delivered to an SMTP server that may, in turn, deliver it to 1730 one or more mailboxes or pass it on to another system (possibly using 1731 SMTP). The argument clause contains a reverse-path and may contain 1732 optional parameters. In general, the MAIL command may be sent only 1733 when no mail transaction is in progress, see Section 4.1.4. 1735 The reverse-path consists of the sender mailbox. Historically, that 1736 mailbox might optionally have been preceded by a list of hosts, but 1737 that behavior is now deprecated (see Appendix C). In some types of 1738 reporting messages for which a reply is likely to cause a mail loop 1739 (for example, mail delivery and non-delivery notifications), the 1740 reverse-path may be null (see Section 3.6). 1742 This command clears the reverse-path buffer, the forward-path buffer, 1743 and the mail data buffer, and it inserts the reverse-path information 1744 from its argument clause into the reverse-path buffer. 1746 If service extensions were negotiated, the MAIL command may also 1747 carry parameters associated with a particular service extension. 1749 Syntax: 1751 mail = "MAIL FROM:" Reverse-path [[CREF88: [2821]20050619 Per 1752 Bruce Lilly, 20050228 - move the empty path 1753 construction to the Reverse-path production.]] 1754 [[CREF89: [2821]20080222 Tony Hansen -- add production 1755 token]] 1756 [SP Mail-parameters] CRLF 1758 4.1.1.3. RECIPIENT (RCPT) 1760 This command is used to identify an individual recipient of the mail 1761 data; multiple recipients are specified by multiple uses of this 1762 command. The argument clause contains a forward-path and may contain 1763 optional parameters. 1765 The forward-path normally consists of the required destination 1766 mailbox. Sending systems SHOULD NOT generate the optional list of 1767 hosts known as a source route. Receiving systems MUST recognize 1768 source route syntax but SHOULD strip off the source route 1769 specification and utilize the domain name associated with the mailbox 1770 as if the source route had not been provided. 1772 Similarly, relay hosts SHOULD strip or ignore source routes, and 1773 names MUST NOT be copied into the reverse-path. When mail reaches 1774 its ultimate destination (the forward-path contains only a 1775 destination mailbox), the SMTP server inserts it into the destination 1776 mailbox in accordance with its host mail conventions. 1778 This command appends its forward-path argument to the forward-path 1779 buffer; it does not change the reverse-path buffer nor the mail data 1780 buffer. 1782 For example, mail received at relay host xyz.com with envelope 1783 commands 1785 MAIL FROM: 1786 RCPT TO:<@hosta.int,@jkl.org:userc@d.bar.org> 1788 will normally be sent directly on to host d.bar.org with envelope 1789 commands 1791 MAIL FROM: 1792 RCPT TO: 1794 As provided in Appendix C, xyz.com MAY also choose to relay the 1795 message to hosta.int, using the envelope commands 1797 MAIL FROM: 1798 RCPT TO:<@hosta.int,@jkl.org:userc@d.bar.org> 1800 or to jkl.org, using the envelope commands 1802 MAIL FROM: 1803 RCPT TO:<@jkl.org:userc@d.bar.org> 1805 Attempting to use relaying this way is now strongly discouraged. 1806 [[CREF90: [2821]Klensin 20070414 in response to comments from SM -- 1807 we really should not be encouraging this any more, even at the MAY 1808 level.]] Since hosts are not required to relay mail at all, xyz.com 1809 MAY also reject the message entirely when the RCPT command is 1810 received, using a 550 code (since this is a "policy reason"). 1812 If service extensions were negotiated, the RCPT command may also 1813 carry parameters associated with a particular service extension 1814 offered by the server. The client MUST NOT transmit parameters other 1815 than those associated with a service extension offered by the server 1816 in its EHLO response. 1818 Syntax: 1820 rcpt = "RCPT TO:" ( "" / "" / 1821 Forward-path ) [SP Rcpt-parameters] CRLF [[CREF91: 1822 [2821]20080222 Tony Hansen -- add production token]] 1824 Note that, in a departure from the usual rules for 1825 local-parts, the "Postmaster" string shown above is 1826 treated as case-insensitive. 1828 4.1.1.4. DATA (DATA) 1830 The receiver normally sends a 354 response to DATA, and then treats 1831 the lines (strings ending in sequences, as described in 1832 Section 2.3.7) following the command as mail data from the sender. 1833 This command causes the mail data to be appended to the mail data 1834 buffer. The mail data may contain any of the 128 ASCII character 1835 codes, although experience has indicated that use of control 1836 characters other than SP, HT, CR, and LF may cause problems and 1837 SHOULD be avoided when possible. 1839 The mail data are terminated by a line containing only a period, that 1840 is, the character sequence ".", where the first is 1841 actually the terminator of the previous line (see Section 4.5.2). 1842 This is the end of mail data indication. The first of this 1843 terminating sequence is also the that ends the final line of 1844 the data (message text) or, if there was no mail data, ends the DATA 1845 command itself (the "no mail data" case does not conform to this 1846 specification since it would require that neither the trace header 1847 fields required by this specification nor the message header section 1848 [[CREF92: [2821]Issue 27 20070423]] required by RFC 5322 [11] be 1849 transmitted). [[CREF93: [2821]20050619 Text clarified in response to 1850 a thread initiated by "Richard O. Hammer" , 1851 20030620. The original seems clear to me - "that is..." does not 1852 make the character sequence into the definition of a line - but this 1853 may confuse fewer readers.]] An extra MUST NOT be added, as 1854 that would cause an empty line to be added to the message. The only 1855 exception to this rule would arise if the message body were passed to 1856 the originating SMTP-sender with a final "line" that did not end in 1857 ; in that case, the originating SMTP system MUST either reject 1858 the message as invalid or add in order to have the receiving 1859 SMTP server recognize the "end of data" condition. 1861 The custom of accepting lines ending only in , as a concession to 1862 non-conforming behavior on the part of some UNIX systems, has proven 1863 to cause more interoperability problems than it solves, and SMTP 1864 server systems MUST NOT do this, even in the name of improved 1865 robustness. In particular, the sequence "." (bare line 1866 feeds, without carriage returns) MUST NOT be treated as equivalent to 1867 . as the end of mail data indication. 1869 Receipt of the end of mail data indication requires the server to 1870 process the stored mail transaction information. This processing 1871 consumes the information in the reverse-path buffer, the forward-path 1872 buffer, and the mail data buffer, and on the completion of this 1873 command these buffers are cleared. If the processing is successful, 1874 the receiver MUST send an OK reply. If the processing fails, the 1875 receiver MUST send a failure reply. The SMTP model does not allow 1876 for partial failures at this point: either the message is accepted by 1877 the server for delivery and a positive response is returned or it is 1878 not accepted and a failure reply is returned. In sending a positive 1879 "250 OK" [[CREF94: [2821]Tony 20080212#3]] completion reply to the 1880 end of data indication, the receiver takes full responsibility for 1881 the message (see Section 6.1). Errors that are diagnosed 1882 subsequently MUST be reported in a mail message, as discussed in 1883 Section 4.4. 1885 When the SMTP server accepts a message either for relaying or for 1886 final delivery, it inserts a trace record (also referred to 1887 interchangeably as a "time stamp line" or "Received" line) at the top 1888 of the mail data. This trace record indicates the identity of the 1889 host that sent the message, the identity of the host that received 1890 the message (and is inserting this time stamp), and the date and time 1891 the message was received. Relayed messages will have multiple time 1892 stamp lines. Details for formation of these lines, including their 1893 syntax, is specified in Section 4.4. 1895 Additional discussion about the operation of the DATA command appears 1896 in Section 3.3. 1898 Syntax: 1900 data = "DATA" CRLF 1902 [[CREF95: [2821]20080222 Tony Hansen -- add production token]] 1904 4.1.1.5. RESET (RSET) 1906 This command specifies that the current mail transaction will be 1907 aborted. Any stored sender, recipients, and mail data MUST be 1908 discarded, and all buffers and state tables cleared. The receiver 1909 MUST send a "250 OK" reply to a RSET command with no arguments. A 1910 reset command may be issued by the client at any time. It is 1911 effectively equivalent to a NOOP (i.e., it has no effect) if issued 1912 immediately after EHLO, before EHLO is issued in the session, after 1913 an end of data indicator has been sent and acknowledged, or 1914 immediately before a QUIT. An SMTP server MUST NOT close the 1915 connection as the result of receiving a RSET; that action is reserved 1916 for QUIT (see Section 4.1.1.10). 1918 Since EHLO implies some additional processing and response by the 1919 server, RSET will normally be more efficient than reissuing that 1920 command, even though the formal semantics are the same. 1922 There are circumstances, contrary to the intent of this 1923 specification, in which an SMTP server may receive an indication that 1924 the underlying TCP connection has been closed or reset. To preserve 1925 the robustness of the mail system, SMTP servers SHOULD be prepared 1926 for this condition and SHOULD treat it as if a QUIT had been received 1927 before the connection disappeared. 1929 Syntax: [[CREF96: [2821]20080222 Tony Hansen -- add production 1930 token]] 1932 rset = "RSET" CRLF 1934 4.1.1.6. VERIFY (VRFY) 1936 This command asks the receiver to confirm that the argument 1937 identifies a user or mailbox. If it is a user name, information is 1938 returned as specified in Section 3.5. 1940 This command has no effect on the reverse-path buffer, the forward- 1941 path buffer, or the mail data buffer. 1943 Syntax: 1945 vrfy = "VRFY" SP String CRLF [[CREF97: [2821]20080222 Tony Hansen 1946 -- add production token]] 1948 4.1.1.7. EXPAND (EXPN) 1950 This command asks the receiver to confirm that the argument 1951 identifies a mailing list, and if so, to return the membership of 1952 that list. If the command is successful, a reply is returned 1953 containing information as described in Section 3.5. This reply will 1954 have multiple lines except in the trivial case of a one-member list. 1956 This command has no effect on the reverse-path buffer, the forward- 1957 path buffer, or the mail data buffer, and it may be issued at any 1958 time. 1960 Syntax: 1962 expn = "EXPN" SP String CRLF [[CREF98: [2821]20080222 Tony Hansen 1963 -- add production token]] 1965 4.1.1.8. HELP (HELP) 1967 This command causes the server to send helpful information to the 1968 client. The command MAY take an argument (e.g., any command name) 1969 and return more specific information as a response. 1971 This command has no effect on the reverse-path buffer, the forward- 1972 path buffer, or the mail data buffer, and it may be issued at any 1973 time. 1975 SMTP servers SHOULD support HELP without arguments and MAY support it 1976 with arguments. 1978 Syntax: 1980 help = "HELP" [ SP String ] CRLF [[CREF99: [2821]20080222 Tony 1981 Hansen -- add production token]] 1983 4.1.1.9. NOOP (NOOP) 1985 This command does not affect any parameters or previously entered 1986 commands. It specifies no action other than that the receiver send a 1987 "250 OK" [[CREF100: [2821]Tony 20080212#3]] reply. 1989 This command has no effect on the reverse-path buffer, the forward- 1990 path buffer, or the mail data buffer, and it may be issued at any 1991 time. If a parameter string is specified, servers SHOULD ignore it. 1993 Syntax: 1995 noop = "NOOP" [ SP String ] CRLF [[CREF101: [2821]20080222 Tony 1996 Hansen -- add production token]] 1998 4.1.1.10. QUIT (QUIT) 2000 This command specifies that the receiver MUST send a "221 OK" 2001 [[CREF102: [2821]Tony 20080212#3, correction 20080214 13:14]] reply, 2002 and then close the transmission channel. 2004 The receiver MUST NOT intentionally close the transmission channel 2005 until it receives and replies to a QUIT command (even if there was an 2006 error). The sender MUST NOT intentionally close the transmission 2007 channel until it sends a QUIT command, and it SHOULD wait until it 2008 receives the reply (even if there was an error response to a previous 2009 command). If the connection is closed prematurely due to violations 2010 of the above or system or network failure, the server MUST cancel any 2011 pending transaction, but not undo any previously completed 2012 transaction, and generally MUST act as if the command or transaction 2013 in progress had received a temporary error (i.e., a 4yz response). 2015 The QUIT command may be issued at any time. Any current uncompleted 2016 mail transaction will be aborted. [[CREF103: [2821]Tony 2017 20081213#26]] 2019 Syntax: 2021 quit = "QUIT" CRLF [[CREF104: [2821]20080222 Tony Hansen -- add 2022 production token]] 2024 4.1.1.11. Mail-Parameter and Rcpt-Parameter Error Responses 2026 [[CREF105: [2821]Tony 20080212 #6]] If the server SMTP does not 2027 recognize or cannot implement one or more of the parameters 2028 associated with a particular MAIL FROM or RCPT TO command, it will 2029 return code 555. 2031 If, for some reason, the server is temporarily unable to accommodate 2032 one or more of the parameters associated with a MAIL FROM or RCPT TO 2033 command, and if the definition of the specific parameter does not 2034 mandate the use of another code, it should return code 455. 2036 Errors specific to particular parameters and their values will be 2037 specified in the parameter's defining RFC. 2039 4.1.2. Command Argument Syntax 2041 The syntax of the argument clauses of the above commands (using the 2042 syntax specified in RFC 5234 [5] where applicable) is given below. 2043 Some of the productions given below are used only in conjunction with 2044 source routes as described in Appendix C. Terminals not defined in 2045 this document, such as ALPHA, DIGIT, SP, CR, LF, CRLF, are as defined 2046 in the "core" syntax in Appendix B of RFC 5234 [5] or in the message 2047 format syntax in RFC 5322 [11]. 2049 Reverse-path = Path / "<>" [[CREF106: [2821]20050619 Per Bruce 2050 Lilly, 20050228, to move the empty construction here. 2051 Note that this fix is a bit different from the one he 2052 suggested which would have removed "path" from the 2053 reverse path construction.]] 2055 Forward-path = Path 2057 Path = "<" [ A-d-l ":" ] Mailbox ">" 2059 A-d-l = At-domain *( "," At-domain ) 2060 ; Note that this form, the so-called "source 2061 ; route", MUST BE accepted, SHOULD NOT be 2062 ; generated, and SHOULD be ignored. [[CREF107: 2063 [2821]Tony 20080213 #23]] 2065 At-domain = "@" Domain 2067 Mail-parameters = esmtp-param *(SP esmtp-param) 2069 Rcpt-parameters = esmtp-param *(SP esmtp-param) 2071 esmtp-param = esmtp-keyword ["=" esmtp-value] 2073 esmtp-keyword = (ALPHA / DIGIT) *(ALPHA / DIGIT / "-") 2075 esmtp-value = 1*(%d33-60 / %d62-126) 2076 ; any CHAR excluding "=", SP, and control 2077 ; characters. If this string is an email address, 2078 ; i.e., a Mailbox, then the "xtext" syntax [12] 2079 ; SHOULD be used. [[CREF108: [2821]20070413: -01 2080 Issue 13. Note use of reference here will require 2081 some action if 2821ter is moved to full standard 2082 before 3461 advances]] 2084 Keyword = Ldh-str 2086 Argument = Atom 2087 Domain = sub-domain *("." sub-domain) [[CREF109: [2821] 2088 20050619 Email conversation w/ Frank Ellerman 2089 2004.11.12. Permit trailing period in domain names 2090 (required by DNS spec) and mail to TLDs. ( ( sub- 2091 domain 1*("." sub-domain) ["."] ) / sub-domain "." ) 2092 Change pulled back out per messages from Ned Freed and 2093 Yuri Inglikov 20060422]] [[CREF110: [2821]Syntax 2094 simplified Tony 20080213 #23]] 2096 sub-domain = Let-dig [Ldh-str] 2098 Let-dig = ALPHA / DIGIT 2100 Ldh-str = *( ALPHA / DIGIT / "-" ) Let-dig 2102 address-literal = "[" ( IPv4-address-literal / 2103 IPv6-address-literal / 2104 General-address-literal ) "]" 2105 ; See Section 4.1.3 2107 Mailbox = Local-part "@" ( Domain / address-literal ) 2109 Local-part = Dot-string / Quoted-string 2110 ; MAY be case-sensitive 2112 Dot-string = Atom *("." Atom) 2114 Atom = 1*atext 2116 Quoted-string = DQUOTE 1*QcontentSMTP DQUOTE [[CREF111: [2821] 2117 ...SMTP constructions added per email 20080104, Tony 2118 20080213 #7a]] 2120 QcontentSMTP = qtextSMTP / quoted-pairSMTP 2122 quoted-pairSMTP = %d92 %d32-126 2123 ; i.e., backslash followed by any ASCII 2124 ; graphic (including itself) or SPace 2126 qtextSMTP = %d32-33 / %d35-91 / %d93-126 2127 ; i.e., within a quoted string, any 2128 ; ASCII graphic or space is permitted 2129 ; without blackslash-quoting except 2130 ; double-quote and the backslash itself. 2132 String = Atom / Quoted-string 2133 While the above definition for Local-part is relatively permissive, 2134 for maximum interoperability, a host that expects to receive mail 2135 SHOULD avoid defining mailboxes where the Local-part requires (or 2136 uses) the Quoted-string form or where the Local-part is case- 2137 sensitive. For any purposes that require generating or comparing 2138 Local-parts (e.g., to specific mailbox names), all quoted forms MUST 2139 be treated as equivalent, and the sending system SHOULD transmit the 2140 form that uses the minimum quoting possible. 2142 Systems MUST NOT define mailboxes in such a way as to require the use 2143 in SMTP of non-ASCII characters (octets with the high order bit set 2144 to one) or ASCII "control characters" (decimal value 0-31 and 127). 2145 These characters MUST NOT be used in MAIL or RCPT commands or other 2146 commands that require mailbox names. 2148 Note that the backslash, "\", is a quote character, which is used to 2149 indicate that the next character is to be used literally (instead of 2150 its normal interpretation). For example, "Joe\,Smith" indicates a 2151 single nine-character user name string with the comma being the 2152 fourth character of that string. 2154 To promote interoperability and consistent with long-standing 2155 guidance about conservative use of the DNS in naming and applications 2156 (e.g., see Section 2.3.1 of the base DNS document, RFC 1035 [7]), 2157 characters outside the set of alphabetic characters, digits, and 2158 hyphen MUST NOT appear in domain name labels for SMTP clients or 2159 servers. In particular, the underscore character is not permitted. 2160 SMTP servers that receive a command in which invalid character codes 2161 have been employed, and for which there are no other reasons for 2162 rejection, MUST reject that command with a 501 response (this rule, 2163 like others, could be overridden by appropriate SMTP extensions). 2165 4.1.3. Address Literals 2167 Sometimes a host is not known to the domain name system and 2168 communication (and, in particular, communication to report and repair 2169 the error) is blocked. To bypass this barrier, a special literal 2170 form of the address is allowed as an alternative to a domain name. 2171 For IPv4 addresses, this form uses four small decimal integers 2172 separated by dots and enclosed by brackets such as [123.255.37.2], 2173 which indicates an (IPv4) Internet Address in sequence-of-octets 2174 form. For IPv6 and other forms of addressing that might eventually 2175 be standardized, the form consists of a standardized "tag" that 2176 identifies the address syntax, a colon, and the address itself, in a 2177 format specified as part of the relevant standards (i.e., RFC 4291 2178 [6] for IPv6). [[CREF112: [2821]changed from RFC 2373, 20050706; 2179 changed from 3515, 20070301]] 2181 [[CREF113: [5321bis] Proposed erratum 4315 (2015-03-27) suggests yet 2182 another modification to the IPv6 address literal syntax, based on 2183 part on RFC 5952. We should consider whether those, or other, 2184 modifications are appropriate and/or whether, given both the issues 2185 of spam/malware and servers supporting multiple domains, it it time 2186 to deprecate mailboxes containing address literals entirely (EHLO 2187 fields may be a different issue). If we are going to allow IPv6 2188 address literals, it may be time to incorporate something by 2189 reference rather than including specific syntax here (RFC 5952 is 14 2190 pages long and does not contain any ABNF).]] 2192 Specifically: 2194 IPv4-address-literal = Snum 3("." Snum) 2196 IPv6-address-literal = "IPv6:" IPv6-addr 2198 General-address-literal = Standardized-tag ":" 1*dcontent 2200 Standardized-tag = Ldh-str 2201 ; Standardized-tag MUST be specified in a 2202 ; Standards-Track RFC and registered with IANA 2203 [[CREF114: [2821]reverted to 2821 form 20080707]] 2205 dcontent = %d33-90 / ; Printable US-ASCII 2206 %d94-126 ; excl. "[", "\", "]" 2208 Snum = 1*3DIGIT 2209 ; representing a decimal integer 2210 ; value in the range 0 through 255 2212 IPv6-addr = 6( h16 ":" ) ls32 2213 / "::" 5( h16 ":" ) ls32 2214 / [ h16 ] "::" 4( h16 ":" ) ls32 2215 / [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32 2216 / [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32 2217 / [ *3( h16 ":" ) h16 ] "::" h16 ":" ls32 2218 / [ *4( h16 ":" ) h16 ] "::" ls32 2219 / [ *5( h16 ":" ) h16 ] "::" h16 2220 / [ *6( h16 ":" ) h16 ] "::" 2221 ; This definition is consistent with the one for 2222 ; URIs [47]. 2224 ls32 = ( h16 ":" h16 ) / IPv4address 2225 ; least-significant 32 bits of address 2227 h16 = 1*4HEXDIG 2228 ; 16 bits of address represented in hexadecimal 2230 [[CREF115: [5321bis](2821ter) 2821bis Last Call 2231 comment]] 2233 4.1.4. Order of Commands 2235 There are restrictions on the order in which these commands may be 2236 used. 2238 A session that will contain mail transactions MUST first be 2239 initialized by the use of the EHLO command. An SMTP server SHOULD 2240 accept commands for non-mail transactions (e.g., VRFY or EXPN) 2241 without this initialization. 2243 An EHLO command MAY be issued by a client later in the session. If 2244 it is issued after the session begins and the EHLO command is 2245 acceptable to the SMTP server, [[CREF116: [2821]Tony 20080213#25]] 2246 the SMTP server MUST clear all buffers and reset the state exactly as 2247 if a RSET command had been issued. In other words, the sequence of 2248 RSET followed immediately by EHLO is redundant, but not harmful other 2249 than in the performance cost of executing unnecessary commands. 2251 If the EHLO command is not acceptable to the SMTP server, 501, 500, 2252 502, or 550 failure replies MUST be returned as appropriate. The 2253 SMTP server MUST stay in the same state after transmitting these 2254 replies that it was in before the EHLO was received. 2256 The SMTP client MUST, if possible, ensure that the domain parameter 2257 to the EHLO command is a primary host name as specified for this 2258 command in Section 2.3.5. [[CREF117: [2821] Note to SM, 2259 sm@resistor.net, 20070329, -01 issue 3]] If this is not possible 2260 (e.g., when the client's address is dynamically assigned and the 2261 client does not have an obvious name), an address literal SHOULD be 2262 substituted for the domain name. [[CREF118: [2821]Tony 20080214]] 2264 An SMTP server MAY verify that the domain name argument [[CREF119: 2265 [2821]20050619 Eric Hall, 20020818. Eric wants to go further, 2266 binding this to reasons for rejection in section 7 (Security 2267 Considerations). Ask WG ???/]] in the EHLO command actually 2268 corresponds to the IP address of the client. [[CREF120: [5321bis] 2269 [[Note in draft -- proposed change to "An SMTP server MAY verify that 2270 the domain name argument in the EHLO command has an address record 2271 matching the IP address of the client." --David MacQuigg, 2272 david_macquigg@yahoo.com, Friday, 20090130 0637 -0700]]]] However, if 2273 the verification fails, the server MUST NOT refuse to accept a 2274 message on that basis. Information captured in the verification 2275 attempt is for logging and tracing purposes. Note that this 2276 prohibition applies to the matching of the parameter to its IP 2277 address only; see Section 7.9 for a more extensive discussion of 2278 rejecting incoming connections or mail messages. 2280 The NOOP, HELP, EXPN, VRFY, and RSET commands can be used at any time 2281 during a session, or without previously initializing a session. SMTP 2282 servers SHOULD process these normally (that is, not return a 503 2283 code) even if no EHLO command has yet been received; clients SHOULD 2284 open a session with EHLO before sending these commands. 2286 If these rules are followed, the example in RFC 821 that shows "550 2287 access denied to you" in response to an EXPN command is incorrect 2288 unless an EHLO command precedes the EXPN or the denial of access is 2289 based on the client's IP address or other authentication or 2290 authorization-determining mechanisms. 2292 The MAIL command (or the obsolete SEND, SOML, or SAML commands) 2293 [[5321bis Editor's Note: is there any reason to not clean those 2294 commands out of this entirely, replacing them with, e.g., a strong 2295 reference to Appendix F.6]] 2296 begins a mail transaction. Once started, a mail transaction consists 2297 of a transaction beginning command, one or more RCPT commands, and a 2298 DATA command, in that order. A mail transaction may be aborted by 2299 the RSET, a new EHLO, or the QUIT command. [[CREF121: [2821]Tony 2300 20080213#26]] There may be zero or more transactions in a session. 2301 MAIL (or SEND, SOML, or SAML) MUST NOT be sent if a mail transaction 2302 is already open, i.e., it should be sent only if no mail transaction 2303 had been started in the session, or if the previous one successfully 2304 concluded with a successful DATA command, or if the previous one was 2305 aborted, e.g., with a RSET or new EHLO.[[CREF122: [2821]Tony 2306 20080320]] [[CREF123: [5321bis] 2821ter note: see comment about 2307 changing this convoluted discussion to talk about 'mail transaction' 2308 above. --Jck]] 2310 If the transaction beginning command argument is not acceptable, a 2311 501 failure reply MUST be returned and the SMTP server MUST stay in 2312 the same state. If the commands in a transaction are out of order to 2313 the degree that they cannot be processed by the server, a 503 failure 2314 reply MUST be returned and the SMTP server MUST stay in the same 2315 state. 2317 The last command in a session MUST be the QUIT command. The QUIT 2318 command SHOULD [[CREF124: [2821]Tony 20080213#27]] be used by the 2319 client SMTP to request connection closure, even when no session 2320 opening command was sent and accepted. 2322 4.1.5. Private-Use Commands 2324 As specified in Section 2.2.2, commands starting in "X" may be used 2325 by bilateral agreement between the client (sending) and server 2326 (receiving) SMTP agents. An SMTP server that does not recognize such 2327 a command is expected to reply with "500 Command not recognized". An 2328 extended SMTP server MAY list the feature names associated with these 2329 private commands in the response to the EHLO command. 2331 Commands sent or accepted by SMTP systems that do not start with "X" 2332 MUST conform to the requirements of Section 2.2.2. 2334 4.2. SMTP Replies 2336 Replies to SMTP commands serve to ensure the synchronization of 2337 requests and actions in the process of mail transfer and to guarantee 2338 that the SMTP client always knows the state of the SMTP server. 2339 Every command MUST generate exactly one reply. 2341 The details of the command-reply sequence are described in 2342 Section 4.3. 2344 An SMTP reply consists of a three digit number (transmitted as three 2345 numeric characters) followed by some text unless specified otherwise 2346 in this document. The number is for use by automata to determine 2347 what state to enter next; the text is for the human user. The three 2348 digits contain enough encoded information that the SMTP client need 2349 not examine the text and may either discard it or pass it on to the 2350 user, as appropriate. Exceptions are as noted elsewhere in this 2351 document. In particular, the 220, 221, 251, 421, and 551 reply codes 2352 are associated with message text that must be parsed and interpreted 2353 by machines. In the general case, the text may be receiver dependent 2354 and context dependent, so there are likely to be varying texts for 2355 each reply code. A discussion of the theory of reply codes is given 2356 in Section 4.2.1. Formally, a reply is defined to be the sequence: a 2357 three-digit code, , one line of text, and , or a multiline 2358 reply (as defined in the same section). Since, in violation of this 2359 specification, the text is sometimes not sent, clients that do not 2360 receive it SHOULD be prepared to process the code alone (with or 2361 without a trailing space character). Only the EHLO, EXPN, and HELP 2362 commands are expected to result in multiline replies in normal 2363 circumstances; however, multiline replies are allowed for any 2364 command. 2366 In ABNF, server responses are: 2368 Greeting = ( "220 " (Domain / address-literal) 2369 [ SP textstring ] CRLF ) / 2370 ( "220-" (Domain / address-literal) 2371 [ SP textstring ] CRLF 2372 *( "220-" [ textstring ] CRLF ) 2373 "220" [ SP textstring ] CRLF ) [[CREF125: [2821]Tony 2374 Finch 20050415, Issue 15, continuation of Greeting]] 2375 [[CREF126: [2821]Changed 'text' to 'textstring' and 2376 added production for the latter, JcK 20080504]] 2378 textstring = 1*(%d09 / %d32-126) ; HT, SP, Printable US-ASCII 2380 Reply-line = *( Reply-code "-" [ textstring ] CRLF ) 2381 Reply-code [ SP textstring ] CRLF [[CREF127: 2382 [2821]Tony Finch 20050405, Issue 15, allow for 2383 continuation and add production for Reply-code]] 2385 Reply-code = %x32-35 %x30-35 %x30-39 [[CREF128: [2821]??? Frank 2386 Ellerman suggests inserting changing "text" above to 2387 "Reply-text" and inserting something like Reply-text = 2388 1*VCHAR *( 1*WSP 1*VCHAR ) here. 20070405, but need 2389 to define VCHAR if going to do so.]] [[CREF129: 2390 [2821]Reply-code changed to %32... from %31... as 2391 part of 1yz removal, JcK 20070424]] 2393 where "Greeting" appears only in the 220 response that announces that 2394 the server is opening its part of the connection. [[CREF130: [2821] 2395 20050619 Note that the "Domain" change prohibits an address literal 2396 here. That seems reasonable since the host must know its domain 2397 name(s) to handle MXs properly. ]] (Other possible server responses 2398 upon connection follow the syntax of Reply-line.) [[CREF131: 2399 [2821]Tony, 20080320]] 2401 An SMTP server SHOULD send only the reply codes listed in this 2402 document or additions to the list as discussed below. 2403 [[CREF132: [5321bis] 20140804: New text to clear up ambiguity.]] 2404 An SMTP server SHOULD use the text shown in the examples whenever 2405 appropriate. 2407 An SMTP client MUST determine its actions only by the reply code, not 2408 by the text (except for the "change of address" 251 and 551 and, if 2409 necessary, 220, 221, and 421 replies); in the general case, any text, 2410 including no text at all (although senders SHOULD NOT send bare 2411 codes), MUST be acceptable. The space (blank) following the reply 2412 code is considered part of the text. Whenever possible, a sender- 2413 SMTP SHOULD test the first digit (severity indication) of a reply 2414 code it receives. 2415 [[CREF133: [5321bis] 20141209 [[Note in Draft: What is that sentence 2416 supposed to be tell us? Test the first digit and examine the others 2417 only if necessary? Note the interaction between this and various 2418 flaps about adding new codes.]]]] 2420 The list of codes that appears below MUST NOT be construed as 2421 permanent. While the addition of new codes should be a rare and 2422 significant activity, with supplemental information in the textual 2423 part of the response (including enhanced status codes [38] and the 2424 successors to that specification) 2425 [[CREF134: [5321bis] 20140802: New text for clarity]] 2426 being preferred, new codes may be added as the result of new 2427 Standards or Standards-Track specifications. Consequently, a sender- 2428 SMTP MUST be prepared to handle codes not specified in this document 2429 and MUST do so by interpreting the first digit only. 2431 In the absence of extensions negotiated with the client, SMTP servers 2432 MUST NOT send reply codes whose first digits are other than 2, 3, 4, 2433 or 5. Clients that receive such out-of-range codes SHOULD normally 2434 treat them as fatal errors and terminate the mail transaction. 2436 4.2.1. Reply Code Severities and Theory 2438 The three digits of the reply each have a special significance. The 2439 first digit denotes whether the response is good, bad, or incomplete. 2440 An unsophisticated SMTP client, or one that receives an unexpected 2441 code, will be able to determine its next action (proceed as planned, 2442 redo, retrench, etc.) by examining this first digit. An SMTP client 2443 that wants to know approximately what kind of error occurred (e.g., 2444 mail system error, command syntax error) may examine the second 2445 digit. The third digit and any supplemental information that may be 2446 present is reserved for the finest gradation of information. 2448 There are four values for the first digit of the reply code: 2449 [[CREF135: [2821]1yz discussion eliminated and replaced with a 2450 pointer to FTP. See comment and new text after list - seems to be 2451 list consensus, JcK 20070424]] 2453 2yz Positive Completion reply 2454 The requested action has been successfully completed. A new 2455 request may be initiated. 2457 3yz Positive Intermediate reply 2458 The command has been accepted, but the requested action is being 2459 held in abeyance, pending receipt of further information. The 2460 SMTP client should send another command specifying this 2461 information. This reply is used in command sequence groups (i.e., 2462 in DATA). 2464 4yz Transient Negative Completion reply 2465 The command was not accepted, and the requested action did not 2466 occur. However, the error condition is temporary, and the action 2467 may be requested again. The sender should return to the beginning 2468 of the command sequence (if any). It is difficult to assign a 2469 meaning to "transient" when two different sites (receiver- and 2470 sender-SMTP agents) must agree on the interpretation. Each reply 2471 in this category might have a different time value, but the SMTP 2472 client SHOULD [[CREF136: [2821]Was "is encouraged to". Changed 2473 per S. Moonesamy 20050714 ]] try again. A rule 2474 of thumb to determine whether a reply fits into the 4yz or the 5yz 2475 category (see below) is that replies are 4yz if they can be 2476 successful if repeated without any change in command form or in 2477 properties of the sender or receiver (that is, the command is 2478 repeated identically and the receiver does not put up a new 2479 implementation). 2481 5yz Permanent Negative Completion reply 2482 The command was not accepted and the requested action did not 2483 occur. The SMTP client SHOULD NOT [[CREF137: [2821]S. Moonesamy 2484 20050714 suggests changing to SHOULD NOT. 2485 Changed, issue 16, 20070417.]] repeat the exact request (in the 2486 same sequence). Even some "permanent" error conditions can be 2487 corrected, so the human user may want to direct the SMTP client to 2488 reinitiate the command sequence by direct action at some point in 2489 the future (e.g., after the spelling has been changed, or the user 2490 has altered the account status). 2492 It is worth noting that the file transfer protocol (FTP) [18] uses a 2493 very similar code architecture and that the SMTP codes are based on 2494 the FTP model. However, SMTP uses a one-command, one-response model 2495 (while FTP is asynchronous) and FTP's 1yz codes are not part of the 2496 SMTP model. [[CREF138: [2821]New text, JcK 20070424, see above.]] 2498 The second digit encodes responses in specific categories: 2500 x0z Syntax: These replies refer to syntax errors, syntactically 2501 correct commands that do not fit any functional category, and 2502 unimplemented or superfluous commands. 2504 x1z Information: These are replies to requests for information, such 2505 as status or help. 2507 x2z Connections: These are replies referring to the transmission 2508 channel. 2510 x3z Unspecified. 2512 x4z Unspecified. 2514 x5z Mail system: These replies indicate the status of the receiver 2515 mail system vis-a-vis the requested transfer or other mail system 2516 action. 2518 The third digit gives a finer gradation of meaning in each category 2519 specified by the second digit. The list of replies illustrates this. 2520 Each reply text is recommended rather than mandatory, and may even 2521 change according to the command with which it is associated. On the 2522 other hand, the reply codes must strictly follow the specifications 2523 in this section. Receiver implementations should not invent new 2524 codes for slightly different situations from the ones described here, 2525 but rather adapt codes already defined. 2527 For example, a command such as NOOP, whose successful execution does 2528 not offer the SMTP client any new information, will return a 250 2529 reply. The reply is 502 when the command requests an unimplemented 2530 non-site-specific action. A refinement of that is the 504 reply for 2531 a command that is implemented, but that requests an unimplemented 2532 parameter. 2534 The reply text may be longer than a single line; in these cases the 2535 complete text must be marked so the SMTP client knows when it can 2536 stop reading the reply. This requires a special format to indicate a 2537 multiple line reply. 2539 The format for multiline replies requires that every line, except the 2540 last, begin with the reply code, followed immediately by a hyphen, 2541 "-" (also known as minus), followed by text. The last line will 2542 begin with the reply code, followed immediately by , optionally 2543 some text, and . As noted above, servers SHOULD send the 2544 if subsequent text is not sent, but clients MUST be prepared for it 2545 to be omitted. 2547 For example: 2549 250-First line 2550 250-Second line 2551 250-234 Text beginning with numbers 2552 250 The last line 2554 In a multiline reply, the reply code on each of the lines MUST be the 2555 same. It is reasonable for the client to rely on this, so it can 2556 make processing decisions based on the code in any line, assuming 2557 that all others will be the same. [[CREF139: [2821] Added after list 2558 discussion, 20070413. This is obviously the strongest form of the 2559 prohibition/specification and makes the former next sentence about 2560 the last line useless. Affirmed as consensus, Tony Hansen, 2561 20070423]] In a few cases, there is important data for the client in 2562 the reply "text". The client will be able to identify these cases 2563 from the current context. 2565 4.2.2. Reply Codes by Function Groups 2567 500 Syntax error, command unrecognized (This may include errors such 2568 as command line too long) 2570 501 Syntax error in parameters or arguments 2572 502 Command not implemented (see Section 4.2.4.1) 2574 503 Bad sequence of commands 2576 504 Command parameter not implemented 2578 211 System status, or system help reply 2580 214 Help message (Information on how to use the receiver or the 2581 meaning of a particular non-standard command; this reply is useful 2582 only to the human user) 2584 220 Service ready 2586 221 Service closing transmission channel 2588 421 Service not available, closing transmission channel 2589 (This may be a reply to any command if the service knows it must 2590 shut down) 2592 hangText="521"> No mail service here. [[CREF140: 2593 [5321bis]20140804: Specific code introduced with RFC 1846, updated 2594 and specified in draft-klensin-smtp-521code.]] 2596 556 No mail service at this domain. [[CREF141: [5321bis] 20140912: 2597 Specific code introduced in draft-klensin-smtp-521code-02, largely 2598 for nullMX]] 2600 250 Requested mail action okay, completed 2602 251 User not local; will forward to (See Section 3.4) 2604 252 Cannot VRFY user, but will accept message and attempt delivery 2605 (See Section 3.5.3) 2607 455 Server unable to accommodate parameters [[CREF142: [2821]Tony 2608 20080212#6]] 2610 555 MAIL FROM/RCPT TO parameters not recognized or not implemented 2611 [[CREF143: [2821]Tony 20080212#6]] 2613 450 Requested mail action not taken: mailbox unavailable (e.g., 2614 mailbox busy or temporarily blocked for policy reasons)[[CREF144: 2615 [2821]Note from Lisa, 20070426]] 2617 550 Requested action not taken: mailbox unavailable (e.g., mailbox 2618 not found, no access, or command rejected for policy reasons) 2620 451 Requested action aborted: error in processing 2622 551 User not local; please try (See Section 3.4) 2624 452 Requested action not taken: insufficient system storage 2626 552 Requested mail action aborted: exceeded storage allocation 2628 553 Requested action not taken: mailbox name not allowed (e.g., 2629 mailbox syntax incorrect) 2631 354 Start mail input; end with . 2633 554 Transaction failed (Or, in the case of a connection-opening 2634 response, "No SMTP service here") 2635 [[CREF145: [5321bis] [[Note in Draft: Revise above statement in 2636 the light of new 521 code??]] ]] 2638 4.2.3. Reply Codes in Numeric Order 2640 211 System status, or system help reply 2642 214 Help message (Information on how to use the receiver or the 2643 meaning of a particular non-standard command; this reply is useful 2644 only to the human user) 2646 220 Service ready 2648 221 Service closing transmission channel 2650 250 Requested mail action okay, completed 2652 251 User not local; will forward to (See Section 3.4) 2653 252 Cannot VRFY user, but will accept message and attempt delivery 2654 (See Section 3.5.3) 2656 354 Start mail input; end with . 2658 421 Service not available, closing transmission channel 2659 (This may be a reply to any command if the service knows it must 2660 shut down) 2662 450 Requested mail action not taken: mailbox unavailable (e.g., 2663 mailbox busy or temporarily blocked for policy reasons)[[CREF146: 2664 [2821]Note from Lisa, 20070426]]) 2666 451 Requested action aborted: local error in processing 2668 452 Requested action not taken: insufficient system storage 2670 455 Server unable to accommodate parameters [[CREF147: [2821]Tony 2671 20080212#6]] 2673 500 Syntax error, command unrecognized (This may include errors such 2674 as command line too long) 2676 501 Syntax error in parameters or arguments 2678 502 Command not implemented (see Section 4.2.4.1) 2680 503 Bad sequence of commands 2682 504 Command parameter not implemented 2684 521 No mail service 2686 550 Requested action not taken: mailbox unavailable (e.g., mailbox 2687 not found, no access, or command rejected for policy reasons) 2689 551 User not local; please try (See Section 3.4) 2691 552 Requested mail action aborted: exceeded storage allocation 2693 553 Requested action not taken: mailbox name not allowed (e.g., 2694 mailbox syntax incorrect) 2696 554 Transaction failed (Or, in the case of a connection-opening 2697 response, "No SMTP service here") 2699 555 MAIL FROM/RCPT TO parameters not recognized or not implemented 2700 [[CREF148: [2821]Tony 20080212#6]] 2702 556 No mail service at this domain. 2704 4.2.4. Some specific code situations and relationships 2706 4.2.4.1. Reply Code 502 2708 Questions have been raised as to when reply code 502 (Command not 2709 implemented) SHOULD be returned in preference to other codes. 502 2710 SHOULD be used when the command is actually recognized by the SMTP 2711 server, but not implemented. If the command is not recognized, code 2712 500 SHOULD be returned. Extended SMTP systems MUST NOT list 2713 capabilities in response to EHLO for which they will return 502 (or 2714 500) replies. 2716 4.2.4.2. "No mail accepted" situations and the 521, 554, and 556 codes 2718 [[CREF149: [5321bis] This section is new with 5321bis. ]] 2720 Codes 521, 554, and 556 are all used to report different types of "no 2721 mail accepted" situations. They differ as follows. 521 is an 2722 indication from a system answering on the SMTP port that it does not 2723 support SMTP service (a so-called "dummy server" as discussed in RFC 2724 1846 [24] and elsewhere). Obviously, it requires that system exist 2725 and that a connection can be made successfully to it. Because a 2726 system that does not accept any mail cannot meaningfully accept a 2727 RCPT command, any commands (other than QUIT) issued after an SMTP 2728 server has issued a 521 reply are client (sender) errors. 556 is 2729 used by a message submission or intermediate SMTP system (see 2730 Section 1.1) to report that it cannot forward the message further 2731 because it knows (e.g., from a DNS entry [51]) that the recipient 2732 domain does not accept mail. It would normally be used in response 2733 to a RCPT or similar (extension) command when the SMTP system 2734 identifies a domain that it can (or has) determined never accepts 2735 mail. Other codes, including 554 and the temporary 450, are used for 2736 more transient situations and situations in which an SMTP server 2737 cannot or will not deliver to (or accept mail for) a particular 2738 system or mailbox for policy reasons rather than ones directly 2739 related to SMTP processing. 2741 4.2.4.3. Reply Codes after DATA and the Subsequent . 2743 When an SMTP server returns a positive completion status (2yz code) 2744 after the DATA command is completed with ., it accepts 2745 responsibility for: 2747 o delivering the message (if the recipient mailbox exists), or 2749 o if attempts to deliver the message fail due to transient 2750 conditions, retrying delivery some reasonable number of times at 2751 intervals as specified in Section 4.5.4. 2753 o if attempts to deliver the message fail due to permanent 2754 conditions, or if repeated attempts to deliver the message fail 2755 due to transient conditions, returning appropriate notification to 2756 the sender of the original message (using the address in the SMTP 2757 MAIL command). 2759 When an SMTP server returns a temporary error status (4yz) [[CREF150: 2760 [2821] 20050619 Per note from Bryon Roche Kain 2761 20011119. Also spotted by Mathias Koerber 20061011.]] code after the 2762 DATA command is completed with ., it MUST NOT make a 2763 subsequent attempt to deliver that message. The SMTP client retains 2764 responsibility for the delivery of that message and may either return 2765 it to the user or requeue it for a subsequent attempt (see 2766 Section 4.5.4.1). 2768 The user who originated the message SHOULD be able to interpret the 2769 return of a transient failure status (by mail message or otherwise) 2770 as a non-delivery indication, just as a permanent failure would be 2771 interpreted. If the client SMTP successfully handles these 2772 conditions, the user will not receive such a reply. 2774 When an SMTP server returns a permanent error status (5yz) code after 2775 the DATA command is completed [[CREF151: [2821]20050619 Bruce Lilly, 2776 20010712]] with ., it MUST NOT make any subsequent 2777 attempt to deliver the message. As with temporary error status 2778 codes, the SMTP client retains responsibility for the message, but 2779 SHOULD not again attempt delivery to the same server without user 2780 review of the message and response and appropriate intervention. 2782 4.3. Sequencing of Commands and Replies 2784 4.3.1. Sequencing Overview 2786 The communication between the sender and receiver is an alternating 2787 dialogue, controlled by the sender. As such, the sender issues a 2788 command and the receiver responds with a reply. Unless other 2789 arrangements are negotiated through service extensions, the sender 2790 MUST wait for this response before sending further commands. One 2791 important reply is the connection greeting. Normally, a receiver 2792 will send a 220 "Service ready" reply when the connection is 2793 completed. The sender SHOULD wait for this greeting message before 2794 sending any commands. 2796 Note: all the greeting-type replies have the official name (the 2797 fully-qualified primary domain name) of the server host as the first 2798 word following the reply code. Sometimes the host will have no 2799 meaningful name. See Section 4.1.3 for a discussion of alternatives 2800 in these situations. 2802 For example, 2804 220 ISIF.USC.EDU Service ready 2806 or 2808 220 mail.example.com SuperSMTP v 6.1.2 Service ready [[CREF152: 2809 [2821]S. Moonesamy 20050714]] 2811 or 2813 220 [10.0.0.1] Clueless host service ready 2815 The table below lists alternative success and failure replies for 2816 each command. These SHOULD be strictly adhered to. A receiver MAY 2817 substitute text in the replies, but the meanings and actions implied 2818 by the code numbers and by the specific command reply sequence MUST 2819 be preserved. [[CREF153: [2821]Note from SM 20070414]] 2820 However, in order to provide robustness as SMTP is extended and 2821 evolves, the discussion in Section 4.2.1 still applies: all SMTP 2822 clients MUST be prepared to accept any code that conforms to the 2823 discussion in that section and MUST be prepared to interpret it on 2824 the basis of its first digit only. [[CREF154: [5321bis] 20140914: 2825 Above sentence is new text based on yet another round of discussions 2826 about "invalid codes".]] 2828 4.3.2. Command-Reply Sequences 2830 Each command is listed with its usual possible replies. The prefixes 2831 used before the possible replies are "I" for intermediate, "S" for 2832 success, and "E" for error. Since some servers may generate other 2833 replies under special circumstances, and to allow for future 2834 extension, SMTP clients SHOULD, when possible, interpret only the 2835 first digit of the reply and MUST be prepared to deal with 2836 unrecognized reply codes by interpreting the first digit only. 2838 Unless extended using the mechanisms described in Section 2.2, SMTP 2839 servers MUST NOT transmit reply codes to an SMTP client that are 2840 other than three digits or that do not start in a digit between 2 and 2841 5 inclusive. 2843 These sequencing rules and, in principle, the codes themselves, can 2844 be extended or modified by SMTP extensions offered by the server and 2845 accepted (requested) by the client. However, if the target is more 2846 precise granularity in the codes, rather than codes for completely 2847 new purposes, the system described in RFC 3463 [38] SHOULD be used in 2848 preference to the [[CREF155: [2821]Preferred->Should, etc. Issue 16 2849 20070421]] invention of new codes. [[CREF156: [2821] Clarification, 2850 20050706 ]] 2852 In addition to the codes listed below, any SMTP command can return 2853 any of the following codes if the corresponding unusual circumstances 2854 are encountered: 2856 500 For the "command line too long" case or if the command name was 2857 not recognized. Note that producing a "command not recognized" 2858 error in response to the required subset of these commands is a 2859 violation of this specification. Similarly, producing a "command 2860 too long" message for a command line shorter than 512 characters 2861 would violate the provisions of Section 4.5.3.1.4. [[CREF157: 2862 [2821]Tony 20080212 #2]] 2864 501 Syntax error in command or arguments. In order to provide for 2865 future extensions, commands that are specified in this document as 2866 not accepting arguments (DATA, RSET, QUIT) SHOULD return a 501 2867 message if arguments are supplied in the absence of EHLO- 2868 advertised extensions. 2870 421 Service shutting down and closing transmission channel 2872 Specific sequences are: 2874 CONNECTION ESTABLISHMENT 2876 S: 220 2877 E: 521, 554 2879 EHLO or HELO 2881 S: 250 2882 E: 504 (a conforming implementation could return this code only 2883 in fairly obscure cases), 550, 502 (permitted only with an old- 2884 style server that does not support EHLO) 2886 MAIL 2888 S: 250 2889 E: 552, 451, 452, 550, 553, 503, 455, 555 2891 RCPT 2893 S: 250, 251 (but see Section 3.4 for discussion of 251 and 551) 2894 E: 550, 551, 552, 553, 450, 451, 452, 503, 455, 555 2896 DATA 2898 I: 354 -> data -> S: 250 2900 E: 552, 554, 451, 452 2902 E: 450, 550 (rejections for policy reasons) [[CREF158: 2903 [2821]S. Moonesamy 20050714]] 2905 E: 503, 554[[CREF159: [2821]Tony 20080320]] 2907 RSET 2909 S: 250 2911 VRFY 2913 S: 250, 251, 252 2914 E: 550, 551, 553, 502, 504 2916 EXPN 2918 S: 250, 252 2919 E: 550, 500, 502, 504 2921 HELP 2923 S: 211, 214 2924 E: 502, 504 2926 NOOP 2928 S: 250 2930 QUIT 2932 S: 221 2934 4.4. Trace Information 2936 When an SMTP server receives a message for delivery or further 2937 processing, it MUST insert trace (often referred to as "time stamp" 2938 or "Received" information) [[CREF160: [5321bis] See note on 2939 rfc5321bis-00c above]] information at the beginning of the message 2940 content, as discussed in Section 4.1.1.4. 2942 This line MUST be structured as follows: 2944 o The FROM clause, which MUST be supplied in an SMTP environment, 2945 SHOULD contain both (1) the name of the source host as presented 2946 in the EHLO command and (2) an address literal containing the IP 2947 address of the source, determined from the TCP connection. 2949 o The ID clause MAY contain an "@" as suggested in RFC 822, but this 2950 is not required. 2952 o If the FOR clause appears, it MUST contain exactly one 2953 entry, even when multiple RCPT commands have been given. Multiple 2954 s raise some security issues and have been deprecated, see 2955 Section 7.2. [[CREF161: [2821]Note to Alfred Hoenes, 20080212]] 2957 An Internet mail program MUST NOT change or delete [[CREF162: 2958 [2821]Tony 20080213 #10]] a Received: line that was previously added 2959 to the message header section. [[CREF163: [2821]Issue 27 20070423]] 2960 SMTP servers MUST prepend Received lines to messages; they MUST NOT 2961 change the order of existing lines or insert Received lines in any 2962 other location. 2964 As the Internet grows, comparability of Received header fields is 2965 important for detecting problems, especially slow relays. SMTP 2966 servers that create Received header fields SHOULD use explicit 2967 offsets in the dates (e.g., -0800), rather than time zone names of 2968 any type. Local time (with an offset) SHOULD be used rather than UT 2969 when feasible. [[CREF164: [2821]Preferred->Should, etc. Issue 16 2970 20070421]] This formulation allows slightly more information about 2971 local circumstances to be specified. If UT is needed, the receiver 2972 need merely do some simple arithmetic to convert the values. Use of 2973 UT loses information about the time zone-location of the server. If 2974 it is desired to supply a time zone name, it SHOULD be included in a 2975 comment. 2977 When the delivery SMTP server makes the "final delivery" of a 2978 message, it inserts a return-path line at the beginning of the mail 2979 data. This use of return-path is required; mail systems MUST support 2980 it. The return-path line preserves the information in the from the MAIL command. Here, final delivery means the message 2982 has left the SMTP environment. Normally, this would mean it had been 2983 delivered to the destination user or an associated mail drop, but in 2984 some cases it may be further processed and transmitted by another 2985 mail system. 2987 It is possible for the mailbox in the return path to be different 2988 from the actual sender's mailbox, for example, if error responses are 2989 to be delivered to a special error handling mailbox rather than to 2990 the message sender. When mailing lists are involved, this 2991 arrangement is common and useful as a means of directing errors to 2992 the list maintainer rather than the message originator. 2994 The text above implies that the final mail data will begin with a 2995 return path line, followed by one or more time stamp lines. These 2996 lines will be followed by the rest of the mail data: first the 2997 balance of the mail header section [[CREF165: [2821]Issue 27 2998 20070423]] and then the body (RFC 5322 [11]). 3000 It is sometimes difficult for an SMTP server to determine whether or 3001 not it is making final delivery since forwarding or other operations 3002 may occur after the message is accepted for delivery. Consequently, 3003 any further (forwarding, gateway, or relay) systems MAY remove the 3004 return path and rebuild the MAIL command as needed to ensure that 3005 exactly one such line appears in a delivered message. [[CREF166: 3006 [2821]??? This, and subsequent paragraph, need harmonizing -Jck ??? 3007 ]] 3009 A message-originating SMTP system SHOULD NOT send a message that 3010 already contains a Return-path header field. SMTP servers performing 3011 a relay function MUST NOT inspect the message data, and especially 3012 not to the extent needed to determine if Return-path header fields 3013 are present. SMTP servers making final delivery MAY remove Return- 3014 path header fields [[CREF167: [2821]Issue 27 20070423]] before adding 3015 their own. 3017 The primary purpose of the Return-path is to designate the address to 3018 which messages indicating non-delivery or other mail system failures 3019 are to be sent. For this to be unambiguous, exactly one return path 3020 SHOULD be present when the message is delivered. Systems using RFC 3021 822 syntax with non-SMTP transports SHOULD designate an unambiguous 3022 address, associated with the transport envelope, to which error 3023 reports (e.g., non-delivery messages) should be sent. 3025 Historical note: Text in RFC 822 that appears to contradict the use 3026 of the Return-path header field (or the envelope reverse-path address 3027 from the MAIL command) as the destination for error messages is not 3028 applicable on the Internet. The reverse-path address (as copied into 3029 the Return-path) MUST be used as the target of any mail containing 3030 delivery error messages. 3032 In particular: 3034 o a gateway from SMTP -> elsewhere SHOULD insert a return-path 3035 header field, unless it is known that the "elsewhere" transport 3036 also uses Internet domain addresses and maintains the envelope 3037 sender address separately. 3039 o a gateway from elsewhere -> SMTP SHOULD delete any return-path 3040 header field present in the message, and either copy that 3041 information to the SMTP envelope or combine it with information 3042 present in the envelope of the other transport system to construct 3043 the reverse-path argument to the MAIL command in the SMTP 3044 envelope. 3046 The server must give special treatment to cases in which the 3047 processing following the end of mail data indication is only 3048 partially successful. This could happen if, after accepting several 3049 recipients and the mail data, the SMTP server finds that the mail 3050 data could be successfully delivered to some, but not all, of the 3051 recipients. In such cases, the response to the DATA command MUST be 3052 an OK reply. However, the SMTP server MUST compose and send an 3053 "undeliverable mail" notification message to the originator of the 3054 message. 3056 A single notification listing all of the failed recipients or 3057 separate notification messages MUST be sent for each failed 3058 recipient. For economy of processing by the sender, the former 3059 SHOULD be used when possible. Note that the key difference between 3060 handling aliases (Section 3.9.1) and forwarding (this subsection) is 3061 the change to the backward-pointing address in this case. [[CREF168: 3062 [2821]Preferred->Should, etc. here and below. Issue 16 20070421]] 3063 All notification messages about undeliverable mail MUST be sent using 3064 the MAIL command (even if they result from processing the obsolete 3065 SEND, SOML, or SAML commands) and MUST use a null return path as 3066 discussed in Section 3.6. 3068 The time stamp line and the return path line are formally defined as 3069 follows (the definitions for "FWS" and "CFWS" appear in RFC 5322 3070 [11]): 3072 Return-path-line = "Return-Path:" FWS Reverse-path 3074 Time-stamp-line = "Received:" FWS Stamp 3075 Stamp = From-domain By-domain Opt-info [CFWS] [[CREF169: 3076 [2821]20050619 Pete Resnick/ "Richard O. Hammer" 3077 , 20040222, here and below]] 3078 ";" 3079 FWS date-time 3080 ; where "date-time" is as defined in RFC 5322 [11] 3081 ; but the "obs-" forms, especially two-digit 3082 ; years, are prohibited in SMTP and MUST NOT be used. 3084 From-domain = "FROM" FWS Extended-Domain 3086 By-domain = CFWS "BY" FWS Extended-Domain 3088 Extended-Domain = Domain / 3089 ( Domain FWS "(" TCP-info ")" ) / 3090 ( address-literal FWS "(" TCP-info ")" ) 3092 TCP-info = address-literal / ( Domain FWS address-literal ) 3093 ; Information derived by server from TCP connection 3094 ; not client EHLO. 3096 Opt-info = [Via] [With] [ID] [For] 3097 [Additional-Registered-Clauses] 3098 [[CREF170: [2821] JcK:20071015 - the additional-... 3099 stuff, here and below, added per issue 37 and 3100 discussion with Tony.]] 3102 Via = CFWS "VIA" FWS Link 3104 With = CFWS "WITH" FWS Protocol 3106 ID = CFWS "ID" FWS ( Atom / msg-id ) 3107 ; msg-id is defined in RFC 5322 [11] [[CREF171: 3108 [2821]20050619: Should "string" be removed here, 3109 leaving only "msg-id", which would be consistent with 3110 5322? Or is the additional flexibility needed for, 3111 e.g., gateways ??? See Klensin/ Resnick/ Lilly 3112 correspondence of 20010625]] [[CREF172: [2821]Decision 3113 20070403, per note from Tony Hansen ("issue 5"): 3114 changed "string" to "atom" in -02c ]] 3116 For = CFWS "FOR" FWS ( Path / Mailbox ) [[CREF173: 3117 [2821]If more than one path or mailbox is really 3118 permitted, be sure they are separated. Per Brett 3119 Watson 20040304. Syntax fixed 3120 per Hari Hurtta 20070428. JcK: Reduced to one path, 3121 20071012, -05)]] 3123 Additional-Registered-Clauses = 1* (CFWS Atom FWS String) 3124 [[CREF174: [5321bis] 5321 errata #1683, 20090215, 3125 Roberto Javier Godoy, rjgodoy@fich.unl.edu.ar]] 3126 [[CREF175: [2821] Tony 20071016: We *may* be asked to 3127 change String to read something like: ( String / Path 3128 / Mailbox / msg-id ) but I'll let people bring it up 3129 on the list. In particular, we can't really support a 3130 modified uFor from smtp-ext without Path / Mailbox.]] 3131 ; Additional standard clauses may be added in this 3132 ; location by future standards and registration with 3133 ; IANA. SMTP servers SHOULD NOT use unregistered 3134 ; names. See Section 8. 3136 Link = "TCP" / Addtl-Link 3138 Addtl-Link = Atom 3139 ; Additional standard names for links are 3140 ; registered with the Internet Assigned Numbers 3141 ; Authority (IANA). "Via" is primarily of value 3142 ; with non-Internet transports. SMTP servers 3143 ; SHOULD NOT use unregistered names. 3145 Protocol = "ESMTP" / "SMTP" / Attdl-Protocol 3147 Addtl-Protocol = Atom 3148 ; Additional standard names for protocols are 3149 ; registered with the Internet Assigned Numbers 3150 ; Authority (IANA) in the "mail parameters" 3151 ; registry [9]. SMTP servers SHOULD NOT 3152 ; use unregistered names. [[CREF176: [2821] 6/19/2005 3153 Indication of the parameter registry added after RFC 3154 3848 was approved, but its keywords have not been 3155 added here. Explicit reference to 3848 added 3156 20070401. ]] 3158 [[CREF177: [2821] JcK: Text about additional trace fields removed, 3159 20071015 - redundant. ]] 3161 4.5. Additional Implementation Issues 3163 4.5.1. Minimum Implementation 3165 In order to make SMTP workable, the following minimum implementation 3166 MUST be provided by all receivers. [[CREF178: 3167 [2821]Preferred->Should, etc. Issue 16 20070421]] The following 3168 commands MUST be supported to conform to this specification: 3170 EHLO 3171 HELO 3172 MAIL 3173 RCPT 3174 DATA 3175 RSET 3176 NOOP 3177 QUIT 3178 VRFY 3180 Any system that includes an SMTP server supporting mail relaying or 3181 delivery MUST support the reserved mailbox "postmaster" as a case- 3182 insensitive local name. This postmaster address is not strictly 3183 necessary if the server always returns 554 on connection opening (as 3184 described in Section 3.1). The requirement to accept mail for 3185 postmaster implies that RCPT commands that specify a mailbox for 3186 postmaster at any of the domains for which the SMTP server provides 3187 mail service, as well as the special case of "RCPT TO:" 3188 (with no domain specification), MUST be supported. 3190 SMTP systems are expected to make every reasonable effort to accept 3191 mail directed to Postmaster from any other system on the Internet. 3192 In extreme cases -- such as to contain a denial of service attack or 3193 other breach of security -- an SMTP server may block mail directed to 3194 Postmaster. However, such arrangements SHOULD be narrowly tailored 3195 so as to avoid blocking messages that are not part of such attacks. 3197 4.5.2. Transparency 3199 Without some provision for data transparency, the character sequence 3200 "." ends the mail text and cannot be sent by the user. 3201 In general, users are not aware of such "forbidden" sequences. To 3202 allow all user composed text to be transmitted transparently, the 3203 following procedures are used: 3205 o Before sending a line of mail text, the SMTP client checks the 3206 first character of the line. If it is a period, one additional 3207 period is inserted at the beginning of the line. 3209 o When a line of mail text is received by the SMTP server, it checks 3210 the line. If the line is composed of a single period, it is 3211 treated as the end of mail indicator. If the first character is a 3212 period and there are other characters on the line, the first 3213 character is deleted. 3215 The mail data may contain any of the 128 ASCII characters. All 3216 characters are to be delivered to the recipient's mailbox, including 3217 spaces, vertical and horizontal tabs, and other control characters. 3218 If the transmission channel provides an 8-bit byte (octet) data 3219 stream, the 7-bit ASCII codes are transmitted, right justified, in 3220 the octets, with the high-order bits cleared to zero. See 3221 Section 3.6 for special treatment of these conditions in SMTP systems 3222 serving a relay function. 3224 In some systems, it may be necessary to transform the data as it is 3225 received and stored. This may be necessary for hosts that use a 3226 different character set than ASCII as their local character set, that 3227 store data in records rather than strings, or which use special 3228 character sequences as delimiters inside mailboxes. If such 3229 transformations are necessary, they MUST be reversible, especially if 3230 they are applied to mail being relayed. 3232 4.5.3. Sizes and Timeouts 3234 4.5.3.1. Size Limits and Minimums 3236 There are several objects that have required minimum/maximum sizes. 3237 Every implementation MUST be able to receive objects of at least 3238 these sizes. Objects larger than these sizes SHOULD be avoided when 3239 possible. However, some Internet mail constructs such as encoded 3240 X.400 addresses (RFC 2156 [31]) will often require larger objects. 3241 Clients MAY attempt to transmit these, but MUST be prepared for a 3242 server to reject them if they cannot be handled by it. To the 3243 maximum extent possible, implementation techniques that impose no 3244 limits on the length of these objects should be used. 3246 Extensions to SMTP may involve the use of characters that occupy more 3247 than a single octet each. This section therefore specifies lengths 3248 in octets where absolute lengths, rather than character counts, are 3249 intended. 3251 [[CREF179: [5321bis] [[Note in Draft: Klensin 20191126: Given the 3252 controversy on the SMTP mailing list between 20191123 and now about 3253 maximum lengths, is the above adequate or is further tuning of the 3254 limit text below needed? ]]]] 3256 4.5.3.1.1. Local-part 3258 The maximum total length of a user name or other local-part is 64 3259 octets. 3261 4.5.3.1.2. Domain 3263 The maximum total length of a domain name or number is 255 octets. 3265 4.5.3.1.3. Path 3267 The maximum total length of a reverse-path or forward-path is 256 3268 octets (including the punctuation and element separators). 3270 4.5.3.1.4. Command Line 3272 The maximum total length of a command line including the command word 3273 and the is 512 octets. SMTP extensions may be used to 3274 increase this limit. 3276 4.5.3.1.5. Reply Line 3278 The maximum total length of a reply line including the reply code and 3279 the is 512 octets. More information may be conveyed through 3280 multiple-line replies. 3282 4.5.3.1.6. Text Line 3284 The maximum total length of a text line including the is 1000 3285 octets (not counting the leading dot duplicated for transparency). 3286 This number may be increased by the use of SMTP Service Extensions. 3288 4.5.3.1.7. Message Content 3290 The maximum total length of a message content (including any message 3291 header section [[CREF180: [2821]Issue 27 20070423]] as well as the 3292 message body) MUST BE at least 64K octets. Since the introduction of 3293 Internet Standards for multimedia mail (RFC 2045 [29]), message 3294 lengths on the Internet have grown dramatically, and message size 3295 restrictions should be avoided if at all possible. SMTP server 3296 systems that must impose restrictions SHOULD implement the "SIZE" 3297 service extension of RFC 1870 [4], and SMTP client systems that will 3298 send large messages SHOULD utilize it when possible. 3300 4.5.3.1.8. Recipient Buffer 3302 The minimum total number of recipients that MUST be buffered is 100 3303 recipients. Rejection of messages (for excessive recipients) with 3304 fewer than 100 RCPT commands is a violation of this specification. 3305 [[CREF181: [2821]20050619 See note from "Derek J. Balling" 3306 , 20020307, recommending a change to "should" 3307 here for spam control. Rejected--- too unpredictable and the escapes 3308 of the security considerations section give the needed flexibility.]] 3309 The general principle that relaying SMTP server MUST NOT, and 3310 delivery SMTP servers SHOULD NOT, perform validation tests on message 3311 header fields [[CREF182: [2821]Issue 27 20070423]] suggests that 3312 messages SHOULD NOT be rejected based on the total number of 3313 recipients shown in header fields. [[CREF183: 3314 [2821]Preferred->Should, etc. Issue 16 20070421]] A server that 3315 imposes a limit on the number of recipients MUST behave in an orderly 3316 fashion, such as rejecting additional addresses over its limit rather 3317 than silently discarding addresses previously accepted. A client 3318 that needs to deliver a message containing over 100 RCPT commands 3319 SHOULD be prepared to transmit in 100-recipient "chunks" if the 3320 server declines to accept more than 100 recipients in a single 3321 message. 3323 4.5.3.1.9. Treatment When Limits Exceeded 3325 Errors due to exceeding these limits may be reported by using the 3326 reply codes. Some examples of reply codes are: 3328 500 Line too long. 3330 or 3332 501 Path too long 3334 or 3336 452 Too many recipients (see below) 3338 or 3340 552 Too much mail data. 3342 4.5.3.1.10. Too Many Recipients Code 3344 RFC 821 [8] incorrectly listed the error where an SMTP server 3345 exhausts its implementation limit on the number of RCPT commands 3346 ("too many recipients") as having reply code 552. The correct reply 3347 code for this condition is 452. Clients SHOULD treat a 552 code in 3348 this case as a temporary, rather than permanent, failure so the logic 3349 below works. 3351 When a conforming SMTP server encounters this condition, it has at 3352 least 100 successful RCPT commands in its recipient buffer. If the 3353 server is able to accept the message, then at least these 100 3354 addresses will be removed from the SMTP client's queue. When the 3355 client attempts retransmission of those addresses that received 452 3356 responses, at least 100 of these will be able to fit in the SMTP 3357 server's recipient buffer. Each retransmission attempt that is able 3358 to deliver anything will be able to dispose of at least 100 of these 3359 recipients. 3361 If an SMTP server has an implementation limit on the number of RCPT 3362 commands and this limit is exhausted, it MUST use a response code of 3363 452 (but the client SHOULD also be prepared for a 552, as noted 3364 above). If the server has a configured site-policy limitation on the 3365 number of RCPT commands, it MAY instead use a 5yz response code. In 3366 particular, if the intent is to prohibit messages with more than a 3367 site-specified number of recipients, rather than merely limit the 3368 number of recipients in a given mail transaction, it would be 3369 reasonable to return a 503 response to any DATA command received 3370 subsequent to the 452 (or 552) code or to simply return the 503 after 3371 DATA without returning any previous negative response. [[CREF184: 3372 [2821]20050619 Interaction with Steve Dorner and Pete Resnick, 3373 20021206]] 3375 4.5.3.2. Timeouts 3377 An SMTP client MUST provide a timeout mechanism. It MUST use per- 3378 command timeouts rather than somehow trying to time the entire mail 3379 transaction. Timeouts SHOULD be easily reconfigurable, preferably 3380 without recompiling the SMTP code. To implement this, a timer is set 3381 for each SMTP command and for each buffer of the data transfer. The 3382 latter means that the overall timeout is inherently proportional to 3383 the size of the message. 3385 Based on extensive experience with busy mail-relay hosts, the minimum 3386 per-command timeout values SHOULD be as follows: 3388 4.5.3.2.1. Initial 220 Message: 5 Minutes 3390 An SMTP client process needs to distinguish between a failed TCP 3391 connection and a delay in receiving the initial 220 greeting message. 3392 Many SMTP servers accept a TCP connection but delay delivery of the 3393 220 message until their system load permits more mail to be 3394 processed. 3396 4.5.3.2.2. MAIL Command: 5 Minutes 3398 4.5.3.2.3. RCPT Command: 5 Minutes 3400 A longer timeout is required if processing of mailing lists and 3401 aliases is not deferred until after the message was accepted. 3403 4.5.3.2.4. DATA Initiation: 2 Minutes 3405 This is while awaiting the "354 Start Input" reply to a DATA command. 3407 4.5.3.2.5. Data Block: 3 Minutes 3409 This is while awaiting the completion of each TCP SEND call 3410 transmitting a chunk of data. 3412 4.5.3.2.6. DATA Termination: 10 Minutes. 3414 This is while awaiting the "250 OK" reply. When the receiver gets 3415 the final period terminating the message data, it typically performs 3416 processing to deliver the message to a user mailbox. A spurious 3417 timeout at this point would be very wasteful and would typically 3418 result in delivery of multiple copies of the message, since it has 3419 been successfully sent and the server has accepted responsibility for 3420 delivery. See Section 6.1 for additional discussion. 3422 4.5.3.2.7. Server Timeout: 5 Minutes. 3424 An SMTP server SHOULD have a timeout of at least 5 minutes while it 3425 is awaiting the next command from the sender. [[CREF185: [2821]Tony 3426 20080213#29]] 3428 4.5.4. Retry Strategies 3430 The common structure of a host SMTP implementation includes user 3431 mailboxes, one or more areas for queuing messages in transit, and one 3432 or more daemon processes for sending and receiving mail. The exact 3433 structure will vary depending on the needs of the users on the host 3434 and the number and size of mailing lists supported by the host. We 3435 describe several optimizations that have proved helpful, particularly 3436 for mailers supporting high traffic levels. 3438 Any queuing strategy MUST include timeouts on all activities on a 3439 per-command basis. A queuing strategy MUST NOT send error messages 3440 in response to error messages under any circumstances. 3442 4.5.4.1. Sending Strategy 3444 The general model for an SMTP client is one or more processes that 3445 periodically attempt to transmit outgoing mail. In a typical system, 3446 the program that composes a message has some method for requesting 3447 immediate attention for a new piece of outgoing mail, while mail that 3448 cannot be transmitted immediately MUST be queued and periodically 3449 retried by the sender. A mail queue entry will include not only the 3450 message itself but also the envelope information. 3452 The sender MUST delay retrying a particular destination after one 3453 attempt has failed. In general, the retry interval SHOULD be at 3454 least 30 minutes; however, more sophisticated and variable strategies 3455 will be beneficial when the SMTP client can determine the reason for 3456 non-delivery. 3458 Retries continue until the message is transmitted or the sender gives 3459 up; the give-up time generally needs to be at least 4-5 days. It MAY 3460 be appropriate to set a shorter maximum number of retries for non- 3461 delivery notifications and equivalent error messages than for 3462 standard messages. [[CREF186: [2821]20050619 Part of the "bound" 3463 discussion, cf section 6.]] The parameters to the retry algorithm 3464 MUST be configurable. 3466 A client SHOULD keep a list of hosts it cannot reach and 3467 corresponding connection timeouts, rather than just retrying queued 3468 mail items. 3470 Experience suggests that failures are typically transient (the target 3471 system or its connection has crashed), favoring a policy of two 3472 connection attempts in the first hour the message is in the queue, 3473 and then backing off to one every two or three hours. 3475 The SMTP client can shorten the queuing delay in cooperation with the 3476 SMTP server. For example, if mail is received from a particular 3477 address, it is likely that mail queued for that host can now be sent. 3478 Application of this principle may, in many cases, eliminate the 3479 requirement for an explicit "send queues now" function such as ETRN, 3480 RFC 1985 [28]. 3482 The strategy may be further modified as a result of multiple 3483 addresses per host (see below) to optimize delivery time versus 3484 resource usage. 3486 An SMTP client may have a large queue of messages for each 3487 unavailable destination host. If all of these messages were retried 3488 in every retry cycle, there would be excessive Internet overhead and 3489 the sending system would be blocked for a long period. Note that an 3490 SMTP client can generally determine that a delivery attempt has 3491 failed only after a timeout of several minutes, and even a one-minute 3492 timeout per connection will result in a very large delay if retries 3493 are repeated for dozens, or even hundreds, of queued messages to the 3494 same host. 3496 At the same time, SMTP clients SHOULD use great care in caching 3497 negative responses from servers. In an extreme case, if EHLO is 3498 issued multiple times during the same SMTP connection, different 3499 answers may be returned by the server. More significantly, 5yz 3500 responses to the MAIL command MUST NOT be cached. 3502 When a mail message is to be delivered to multiple recipients, and 3503 the SMTP server to which a copy of the message is to be sent is the 3504 same for multiple recipients, then only one copy of the message 3505 SHOULD be transmitted. That is, the SMTP client SHOULD use the 3506 command sequence: MAIL, RCPT, RCPT, ..., RCPT, DATA instead of the 3507 sequence: MAIL, RCPT, DATA, ..., MAIL, RCPT, DATA. However, if there 3508 are very many addresses, a limit on the number of RCPT commands per 3509 MAIL command MAY be imposed. This efficiency feature SHOULD be 3510 implemented. [[CREF187: [2821]Preferred->Should, etc. Issue 16 3511 20070421]] 3513 Similarly, to achieve timely delivery, the SMTP client MAY support 3514 multiple concurrent outgoing mail transactions. However, some limit 3515 may be appropriate to protect the host from devoting all its 3516 resources to mail. 3518 4.5.4.2. Receiving Strategy 3520 The SMTP server SHOULD attempt to keep a pending listen on the SMTP 3521 port (specified by IANA as port 25) [[CREF188: [2821]20050619 Eric 3522 Hall, 20050216]] at all times. This requires the support of multiple 3523 incoming TCP connections for SMTP. Some limit MAY be imposed, but 3524 servers that cannot handle more than one SMTP transaction at a time 3525 are not in conformance with the intent of this specification. 3527 As discussed above, when the SMTP server receives mail from a 3528 particular host address, it could activate its own SMTP queuing 3529 mechanisms to retry any mail pending for that host address. 3531 4.5.5. Messages with a Null Reverse-Path 3533 There are several types of notification messages that are required by 3534 existing and proposed Standards to be sent with a null reverse-path, 3535 namely non-delivery notifications as discussed in Section 3.7, other 3536 kinds of Delivery Status Notifications (DSNs, RFC 3461 [12]), and 3537 Message Disposition Notifications (MDNs, RFC 3798 [40]). All of 3538 these kinds of messages are notifications about a previous message, 3539 and they are sent to the reverse-path of the previous mail message. 3540 (If the delivery of such a notification message fails, that usually 3541 indicates a problem with the mail system of the host to which the 3542 notification message is addressed. For this reason, at some hosts 3543 the MTA is set up to forward such failed notification messages to 3544 someone who is able to fix problems with the mail system, e.g., via 3545 the postmaster alias.) 3547 All other types of messages (i.e., any message which is not required 3548 by a Standards-Track RFC to have a null reverse-path) SHOULD be sent 3549 with a valid, non-null reverse-path. 3551 Implementers of automated email processors should be careful to make 3552 sure that the various kinds of messages with a null reverse-path are 3553 handled correctly. In particular, such systems SHOULD NOT reply to 3554 messages with a null reverse-path, and they SHOULD NOT add a non-null 3555 reverse-path, or change a null reverse-path to a non-null one, to 3556 such messages when forwarding. [[CREF189: [2821] New text and slight 3557 modifications per Ned and SM, 20071117]] 3559 5. Address Resolution and Mail Handling 3561 5.1. Locating the Target Host 3563 Once an SMTP client lexically identifies a domain to which mail will 3564 be delivered for processing (as described in Sections 2.3.5 and 3.6), 3565 a DNS lookup MUST be performed to resolve the domain name (RFC 1035 3566 [7]). The names are expected to be fully-qualified domain names 3567 (FQDNs): mechanisms for inferring FQDNs from partial names or local 3568 aliases are outside of this specification. Due to a history of 3569 problems, SMTP servers used for initial submission of messages SHOULD 3570 NOT make such inferences (Message Submission Servers [43] have 3571 somewhat more flexibility) and intermediate (relay) SMTP servers MUST 3572 NOT make them. [[CREF190: [2821]Preferred->Should, etc. Issue 16 3573 20070421]] [[CREF191: [2821] Needed to complete the "single component 3574 domain" fix-ups. 20070413 JcK]] 3576 The lookup first attempts to locate an MX record associated with the 3577 name. If a CNAME record is found, the resulting name is processed as 3578 if it were the initial name. If a non-existent domain error is 3579 returned, this situation MUST be reported as an error. If a 3580 temporary error is returned, the message MUST be queued and retried 3581 later (see Section 4.5.4.1). If an empty list of MXs is returned, 3582 the address is treated as if it was associated with an implicit MX 3583 RR, with a preference of 0, pointing to that host. If MX records are 3584 present, but none of them are usable, or the implicit MX is unusable, 3585 this situation MUST be reported as an error. [[CREF192: [2821]Group 3586 decision reported in Tony's note 20080414, text from Glenn Anderson 3587 20080408]] 3589 If one or more MX RRs are found for a given name, SMTP systems MUST 3590 NOT utilize any address RRs associated with that name unless they are 3591 located using the MX RRs; the "implicit MX" rule above applies only 3592 if there are no MX records present. If MX records are present, but 3593 none of them are usable, this situation MUST be reported as an error. 3595 When a domain name associated with an MX RR is looked up and the 3596 associated data field obtained, the data field of that response MUST 3597 contain a domain name that conforms to the specifications of 3598 Section 2.3.5. 3600 [[5321bis Editor's Note: Depending on how the "null MX" discussion 3601 unfolds, some additional text may be in order here (20140718)]] 3602 That domain name, when queried, MUST return at least one address 3603 record (e.g., A or AAAA RR) that gives the IP address of the SMTP 3604 server to which the message should be directed. Any other response, 3605 specifically including a value that will return a CNAME record when 3606 queried, lies outside the scope of this Standard. The prohibition on 3607 labels in the data that resolve to CNAMEs is discussed in more detail 3608 in RFC 2181, Section 10.3 [32]. [[CREF193: [2821]Tony 20080212 #4, 3609 New paragraph structure, Tony, 20080221, correspondence with John 3610 Leslie 20080223 and 20080225]] 3612 When the lookup succeeds, the mapping can result in a list of 3613 alternative delivery addresses rather than a single address, because 3614 of multiple MX records, multihoming, or both. To provide reliable 3615 mail transmission, the SMTP client MUST be able to try (and retry) 3616 each of the relevant addresses in this list in order, until a 3617 delivery attempt succeeds. However, there MAY also be a configurable 3618 limit on the number of alternate addresses that can be tried. In any 3619 case, the SMTP client SHOULD try at least two addresses. 3621 Two types of information are used to rank the host addresses: 3622 multiple MX records, and multihomed hosts. 3624 MX records contain a preference indication that MUST be used in 3625 sorting if more than one such record appears (see below). Lower 3626 numbers are more preferred than higher ones. If there are multiple 3627 destinations with the same preference and there is no clear reason to 3628 favor one (e.g., by recognition of an easily reached address), then 3629 the sender-SMTP MUST randomize them to spread the load across 3630 multiple mail exchangers for a specific organization. [[CREF194: 3631 [2821]20050619 There was a long thread about this section, initiated 3632 by Hector Santos, 20040104, and raising the question of a slight 3633 inconsistency between this text and the text of RFC 1123. The 3634 difference was discussed in DRUMS and the text here is believed to 3635 reflect that discussion.]] 3637 The destination host (perhaps taken from the preferred MX record) may 3638 be multihomed, in which case the domain name resolver will return a 3639 list of alternative IP addresses. It is the responsibility of the 3640 domain name resolver interface to have ordered this list by 3641 decreasing preference if necessary, and the SMTP sender MUST try them 3642 in the order presented. 3644 Although the capability to try multiple alternative addresses is 3645 required, specific installations may want to limit or disable the use 3646 of alternative addresses. The question of whether a sender should 3647 attempt retries using the different addresses of a multihomed host 3648 has been controversial. The main argument for using the multiple 3649 addresses is that it maximizes the probability of timely delivery, 3650 and indeed sometimes the probability of any delivery; the counter- 3651 argument is that it may result in unnecessary resource use. Note 3652 that resource use is also strongly determined by the sending strategy 3653 discussed in Section 4.5.4.1. 3655 If an SMTP server receives a message with a destination for which it 3656 is a designated Mail eXchanger, it MAY relay the message (potentially 3657 after having rewritten the MAIL FROM and/or RCPT TO addresses), make 3658 final delivery of the message, or hand it off using some mechanism 3659 outside the SMTP-provided transport environment. Of course, neither 3660 of the latter require that the list of MX records be examined 3661 further. 3663 If it determines that it should relay the message without rewriting 3664 the address, it MUST sort the MX records to determine candidates for 3665 delivery. The records are first ordered by preference, with the 3666 lowest-numbered records being most preferred. The relay host MUST 3667 then inspect the list for any of the names or addresses by which it 3668 might be known in mail transactions. If a matching record is found, 3669 all records at that preference level and higher-numbered ones MUST be 3670 discarded from consideration. If there are no records left at that 3671 point, it is an error condition, and the message MUST be returned as 3672 undeliverable. If records do remain, they SHOULD be tried, best 3673 preference first, as described above. 3675 5.2. IPv6 and MX Records 3677 In the contemporary Internet, SMTP clients and servers may be hosted 3678 on IPv4 systems, IPv6 systems, or dual-stack systems that are 3679 compatible with either version of the Internet Protocol. The host 3680 domains to which MX records point may, consequently, contain "A RR"s 3681 (IPv4), "AAAA RR"s (IPv6), or any combination of them. While RFC 3682 3974 [14] discusses some operational experience in mixed 3683 environments, it was not comprehensive enough to justify 3684 standardization, and some of its recommendations appear to be 3685 inconsistent with this specification. The appropriate actions to be 3686 taken either will depend on local circumstances, such as performance 3687 of the relevant networks and any conversions that might be necessary, 3688 or will be obvious (e.g., an IPv6-only client need not attempt to 3689 look up A RRs or attempt to reach IPv4-only servers). Designers of 3690 SMTP implementations that might run in IPv6 or dual-stack 3691 environments should study the procedures above, especially the 3692 comments about multihomed hosts, and, preferably, provide mechanisms 3693 to facilitate operational tuning and mail interoperability between 3694 IPv4 and IPv6 systems while considering local circumstances. 3695 [[CREF195: [2821]Per mailing list discussion and discussion with ADs, 3696 20070410. Further modified per comments from Ned Freed and offlist 3697 editorial suggestions from SM 20070411. ]] 3699 6. Problem Detection and Handling 3701 6.1. Reliable Delivery and Replies by Email 3703 When the receiver-SMTP accepts a piece of mail (by sending a "250 OK" 3704 message in response to DATA), it is accepting responsibility for 3705 delivering or relaying the message. It must take this responsibility 3706 seriously. It MUST NOT lose the message for frivolous reasons, such 3707 as because the host later crashes or because of a predictable 3708 resource shortage. Some reasons that are not considered frivolous 3709 are discussed in the next subsection and in Section 7.8. 3711 If there is a delivery failure after acceptance of a message, the 3712 receiver-SMTP MUST formulate and mail a notification message. This 3713 notification MUST be sent using a null ("<>") reverse-path in the 3714 envelope. The recipient of this notification MUST be the address 3715 from the envelope return path (or the Return-Path: line). However, 3716 if this address is null ("<>"), the receiver-SMTP MUST NOT send a 3717 notification. Obviously, nothing in this section can or should 3718 prohibit local decisions (i.e., as part of the same system 3719 environment as the receiver-SMTP) to log or otherwise transmit 3720 information about null address events locally if that is desired. If 3721 the address is an explicit source route, it MUST be stripped down to 3722 its final hop. 3724 For example, suppose that an error notification must be sent for a 3725 message that arrived with: 3727 MAIL FROM:<@a,@b:user@d> 3729 The notification message MUST be sent using: 3731 RCPT TO: 3733 Some delivery failures after the message is accepted by SMTP will be 3734 unavoidable. For example, it may be impossible for the receiving 3735 SMTP server to validate all the delivery addresses in RCPT command(s) 3736 due to a "soft" domain system error, because the target is a mailing 3737 list (see earlier discussion of RCPT), or because the server is 3738 acting as a relay and has no immediate access to the delivering 3739 system. 3741 To avoid receiving duplicate messages as the result of timeouts, a 3742 receiver-SMTP MUST seek to minimize the time required to respond to 3743 the final . end of data indicator. See RFC 1047 [20] for 3744 a discussion of this problem. 3746 6.2. Unwanted, Unsolicited, and "Attack" Messages 3748 [[CREF196: [2821] 20050619 This section added following a discussion 3749 of "bounce rules" in late March 2004. ]] Utility and predictability 3750 of the Internet mail system requires that messages that can be 3751 delivered should be delivered, regardless of any syntax or other 3752 faults associated with those messages and regardless of their 3753 content. If they cannot be delivered, and cannot be rejected by the 3754 SMTP server during the SMTP transaction, they should be "bounced" 3755 (returned with non-delivery notification messages) [[CREF197: [2821] 3756 Klensin 20070422]] as described above. In today's world, in which 3757 many SMTP server operators have discovered that the quantity of 3758 undesirable bulk email vastly exceeds the quantity of desired mail 3759 and in which accepting a message may trigger additional undesirable 3760 traffic by providing verification of the address, those principles 3761 may not be practical. 3763 As discussed in Section 7.8 and Section 7.9 below, dropping mail 3764 without notification of the sender is [[CREF198: [2821]SM 20070411, 3765 "must be" -> "is" (JcK 20040717) ]] permitted in practice. However, 3766 it is extremely dangerous and violates a long tradition and community 3767 expectations that mail is either delivered or returned. If silent 3768 message-dropping is misused, it could easily undermine confidence in 3769 the reliability of the Internet's mail systems. So silent dropping 3770 of messages should be considered only in those cases where there is 3771 very high confidence that the messages are seriously fraudulent or 3772 otherwise inappropriate. 3774 To stretch the principle of delivery if possible even further, it may 3775 be a rational policy to not deliver mail that has an invalid return 3776 address, although the history of the network is that users are 3777 typically better served by delivering any message that can be 3778 delivered. Reliably determining that a return address is invalid can 3779 be a difficult and time-consuming process, especially if the putative 3780 sending system is not directly accessible or does not fully and 3781 accurately support VRFY and, even if a "drop messages with invalid 3782 return addresses" policy is adopted, it SHOULD [[CREF199: 3783 [2821]Upper-case per SM 20070411]] be applied only when there is 3784 near-certainty that the return addresses are, in fact, invalid. 3786 Conversely, if a message is rejected because it is found to contain 3787 hostile content (a decision that is outside the scope of an SMTP 3788 server as defined in this document), rejection ("bounce") messages 3789 SHOULD NOT be sent unless the receiving site is confident that those 3790 messages will be usefully delivered. The preference and default in 3791 these cases is to avoid sending non-delivery messages when the 3792 incoming message is determined to contain hostile content. 3794 6.3. Loop Detection 3796 Simple counting of the number of "Received:" header fields [[CREF200: 3797 [2821]Issue 27 20070423]] in a message has proven to be an effective, 3798 although rarely optimal, method of detecting loops in mail systems. 3799 SMTP servers using this technique SHOULD use a large rejection 3800 threshold, normally at least 100 Received entries. Whatever 3801 mechanisms are used, servers MUST contain provisions for detecting 3802 and stopping trivial loops. 3804 6.4. Compensating for Irregularities 3806 Unfortunately, variations, creative interpretations, and outright 3807 violations of Internet mail protocols do occur; some would suggest 3808 that they occur quite frequently. The debate as to whether a well- 3809 behaved SMTP receiver or relay should reject a malformed message, 3810 attempt to pass it on unchanged, or attempt to repair it to increase 3811 the odds of successful delivery (or subsequent reply) began almost 3812 with the dawn of structured network mail and shows no signs of 3813 abating. Advocates of rejection claim that attempted repairs are 3814 rarely completely adequate and that rejection of bad messages is the 3815 only way to get the offending software repaired. Advocates of 3816 "repair" or "deliver no matter what" argue that users prefer that 3817 mail go through it if at all possible and that there are significant 3818 market pressures in that direction. In practice, these market 3819 pressures may be more important to particular vendors than strict 3820 conformance to the standards, regardless of the preference of the 3821 actual developers. 3823 The problems associated with ill-formed messages were exacerbated by 3824 the introduction of the split-UA mail reading protocols (Post Office 3825 Protocol (POP) version 2 [17], Post Office Protocol (POP) version 3 3826 [27], IMAP version 2 [22], and PCMAIL [21]). These protocols 3827 encouraged the use of SMTP as a posting (message submission) 3828 protocol, and SMTP servers as relay systems for these client hosts 3829 (which are often only intermittently connected to the Internet). 3830 Historically, many of those client machines lacked some of the 3831 mechanisms and information assumed by SMTP (and indeed, by the mail 3832 format protocol, RFC 822 [16]). Some could not keep adequate track 3833 of time; others had no concept of time zones; still others could not 3834 identify their own names or addresses; and, of course, none could 3835 satisfy the assumptions that underlay RFC 822's conception of 3836 authenticated addresses. 3838 In response to these weak SMTP clients, many SMTP systems now 3839 complete messages that are delivered to them in incomplete or 3840 incorrect form. This strategy is generally considered appropriate 3841 when the server can identify or authenticate the client, and there 3842 are prior agreements between them. By contrast, there is at best 3843 great concern about fixes applied by a relay or delivery SMTP server 3844 that has little or no knowledge of the user or client machine. Many 3845 of these issues are addressed by using a separate protocol, such as 3846 that defined in RFC 4409 [43], for message submission, rather than 3847 using originating SMTP servers for that purpose. [[CREF201: 3848 [2821]Klensin 20070422]] 3850 The following changes to a message being processed MAY be applied 3851 when necessary by an originating SMTP server, or one used as the 3852 target of SMTP as an initial posting (message submission) protocol: 3854 o Addition of a message-id field when none appears 3856 o Addition of a date, time, or time zone when none appears 3858 o Correction of addresses to proper FQDN format 3860 The less information the server has about the client, the less likely 3861 these changes are to be correct and the more caution and conservatism 3862 should be applied when considering whether or not to perform fixes 3863 and how. These changes MUST NOT be applied by an SMTP server that 3864 provides an intermediate relay function. 3866 In all cases, properly operating clients supplying correct 3867 information are preferred to corrections by the SMTP server. In all 3868 cases, documentation SHOULD be provided in trace header fields and/or 3869 header field [[CREF202: [2821]Issue 27 20070423]] comments for 3870 actions performed by the servers. [[CREF203: 3871 [2821]Preferred->Should, etc. Issue 16 20070421]] 3873 7. Security Considerations 3875 7.1. Mail Security and Spoofing 3877 SMTP mail is inherently insecure in that it is feasible for even 3878 fairly casual users to negotiate directly with receiving and relaying 3879 SMTP servers and create messages that will trick a naive recipient 3880 into believing that they came from somewhere else. Constructing such 3881 a message so that the "spoofed" behavior cannot be detected by an 3882 expert is somewhat more difficult, but not sufficiently so as to be a 3883 deterrent to someone who is determined and knowledgeable. 3884 Consequently, as knowledge of Internet mail increases, so does the 3885 knowledge that SMTP mail inherently cannot be authenticated, or 3886 integrity checks provided, at the transport level. Real mail 3887 security lies only in end-to-end methods involving the message 3888 bodies, such as those that use digital signatures (see RFC 1847 [25] 3889 and, e.g., Pretty Good Privacy (PGP) in RFC 4880 [15] or Secure/ 3890 Multipurpose Internet Mail Extensions (S/MIME) in RFC 3851 [41]). 3892 Various protocol extensions and configuration options that provide 3893 authentication at the transport level (e.g., from an SMTP client to 3894 an SMTP server) improve somewhat on the traditional situation 3895 described above. However, in general, they only authenticate one 3896 server to another rather than a chain of relays and servers, much 3897 less authenticating users or user machines. Consequently, unless 3898 they are accompanied by careful handoffs of responsibility in a 3899 carefully designed trust environment, they remain inherently weaker 3900 than end-to-end mechanisms that use digitally signed messages rather 3901 than depending on the integrity of the transport system. 3903 Efforts to make it more difficult for users to set envelope return 3904 path and header "From" fields to point to valid addresses other than 3905 their own are largely misguided: they frustrate legitimate 3906 applications in which mail is sent by one user on behalf of another, 3907 in which error (or normal) replies should be directed to a special 3908 address, or in which a single message is sent to multiple recipients 3909 on different hosts. (Systems that provide convenient ways for users 3910 to alter these header fields on a per-message basis should attempt to 3911 establish a primary and permanent mailbox address for the user so 3912 that Sender header fields within the message data can be generated 3913 sensibly.) 3915 This specification does not further address the authentication issues 3916 associated with SMTP other than to advocate that useful functionality 3917 not be disabled in the hope of providing some small margin of 3918 protection against a user who is trying to fake mail. 3920 7.2. "Blind" Copies 3922 Addresses that do not appear in the message header section [[CREF204: 3923 [2821]Issue 27 20070423]] may appear in the RCPT commands to an SMTP 3924 server for a number of reasons. The two most common involve the use 3925 of a mailing address as a "list exploder" (a single address that 3926 resolves into multiple addresses) and the appearance of "blind 3927 copies". Especially when more than one RCPT command is present, and 3928 in order to avoid defeating some of the purpose of these mechanisms, 3929 SMTP clients and servers SHOULD NOT copy the full set of RCPT command 3930 arguments into the header section, [[CREF205: [2821]Issue 27 3931 20070423]] either as part of trace header fields or as informational 3932 or private-extension header fields. [[CREF206: [rfc5321bis] [[Note 3933 in draft - Suggestion from 20070124 that got lost: delete 3934 "especially" and "the full set of" -- copying the first one can be as 3935 harmful as copying all of them, at least without verifying that the 3936 addresses do appear in the headers.]] Arnt Gulbrandsen, 3937 arnt@oryx.com, 2007.01.24 1121+0100]] Since this rule is often 3938 violated in practice, and cannot be enforced, sending SMTP systems 3939 that are aware of "bcc" use MAY find it helpful to send each blind 3940 copy as a separate message transaction containing only a single RCPT 3941 command. 3943 There is no inherent relationship between either "reverse" (from 3944 MAIL, SAML, etc., commands) or "forward" (RCPT) addresses in the SMTP 3945 transaction ("envelope") and the addresses in the header section. 3946 [[CREF207: [2821]Issue 27 20070423]] Receiving systems SHOULD NOT 3947 attempt to deduce such relationships and use them to alter the header 3948 section [[CREF208: [2821]Issue 27 20070423]] of the message for 3949 delivery. The popular "Apparently-to" header field is a violation of 3950 this principle as well as a common source of unintended information 3951 disclosure and SHOULD NOT be used. 3953 7.3. VRFY, EXPN, and Security 3955 As discussed in Section 3.5, individual sites may want to disable 3956 either or both of VRFY or EXPN for security reasons (see below). As 3957 a corollary to the above, implementations that permit this MUST NOT 3958 appear to have verified addresses that are not, in fact, verified. 3959 If a site disables these commands for security reasons, the SMTP 3960 server MUST return a 252 response, rather than a code that could be 3961 confused with successful or unsuccessful verification. 3963 Returning a 250 reply code with the address listed in the VRFY 3964 command after having checked it only for syntax violates this rule. 3965 Of course, an implementation that "supports" VRFY by always returning 3966 550 whether or not the address is valid is equally not in 3967 conformance. 3969 On the public Internet, the contents of mailing lists have become 3970 popular as an address information source for so-called "spammers." 3971 The use of EXPN to "harvest" addresses has increased as list 3972 administrators have installed protections against inappropriate uses 3973 of the lists themselves. However, VRFY and EXPN are still useful for 3974 authenticated users and within an administrative domain. For 3975 example, VRFY and EXPN are useful for performing internal audits of 3976 how email gets routed to check and to make sure no one is 3977 automatically forwarding sensitive mail outside the organization. 3978 Sites implementing SMTP authentication may choose to make VRFY and 3979 EXPN available only to authenticated requestors. Implementations 3980 SHOULD still provide support for EXPN, but sites SHOULD carefully 3981 evaluate the tradeoffs. [[CREF209: [2821]New text per Tony Hansen, 3982 20070503, Issue 2]] 3984 [[CREF210: [2821]inserted in response to RFC 3552 suggestion]] 3985 Whether disabling VRFY provides any real marginal security depends on 3986 a series of other conditions. In many cases, RCPT commands can be 3987 used to obtain the same information about address validity. On the 3988 other hand, especially in situations where determination of address 3989 validity for RCPT commands is deferred until after the DATA command 3990 is received, RCPT may return no information at all, while VRFY is 3991 expected to make a serious attempt to determine validity before 3992 generating a response code (see discussion above). 3994 7.4. Mail Rerouting Based on the 251 and 551 Response Codes 3996 Before a client uses the 251 or 551 reply codes from a RCPT command 3997 to automatically update its future behavior (e.g., updating the 3998 user's address book), it should be certain of the server's 3999 authenticity. If it does not, it may be subject to a man in the 4000 middle attack. [[CREF211: [2821] 2821bis-01 issue 10. Text per Tony 4001 Hansen, 20070503]] 4003 7.5. Information Disclosure in Announcements 4005 There has been an ongoing debate about the tradeoffs between the 4006 debugging advantages of announcing server type and version (and, 4007 sometimes, even server domain name) in the greeting response or in 4008 response to the HELP command and the disadvantages of exposing 4009 information that might be useful in a potential hostile attack. The 4010 utility of the debugging information is beyond doubt. Those who 4011 argue for making it available point out that it is far better to 4012 actually secure an SMTP server rather than hope that trying to 4013 conceal known vulnerabilities by hiding the server's precise identity 4014 will provide more protection. Sites are encouraged to evaluate the 4015 tradeoff with that issue in mind; implementations SHOULD minimally 4016 provide for making type and version information available in some way 4017 to other network hosts. [[CREF212: [2821]Preferred->Should, etc. 4018 Issue 16 20070421]] 4020 7.6. Information Disclosure in Trace Fields 4022 In some circumstances, such as when mail originates from within a LAN 4023 whose hosts are not directly on the public Internet, trace 4024 ("Received") header fields produced in conformance with this 4025 specification may disclose host names and similar information that 4026 would not normally be available. This ordinarily does not pose a 4027 problem, but sites with special concerns about name disclosure should 4028 be aware of it. Also, the optional FOR clause should be supplied 4029 with caution or not at all when multiple recipients are involved lest 4030 it inadvertently disclose the identities of "blind copy" recipients 4031 to others. 4033 7.7. Information Disclosure in Message Forwarding 4035 As discussed in Section 3.4, use of the 251 or 551 reply codes to 4036 identify the replacement address associated with a mailbox may 4037 inadvertently disclose sensitive information. Sites that are 4038 concerned about those issues should ensure that they select and 4039 configure servers appropriately. 4041 7.8. Resistance to Attacks 4043 In recent years, there has been an increase of attacks on SMTP 4044 [[CREF213: [2821]20050619 Discussion with Jutta Degener, 20030730. 4045 Needs to be cleared with WG - see section 3.9.]] servers, either in 4046 conjunction with attempts to discover addresses for sending 4047 unsolicited messages or simply to make the servers inaccessible to 4048 others (i.e., as an application-level denial of service attack). 4049 While the means of doing so are beyond the scope of this Standard, 4050 rational operational behavior requires that servers be permitted to 4051 detect such attacks and take action to defend themselves. For 4052 example, if a server determines that a large number of RCPT TO 4053 commands are being sent, most or all with invalid addresses, as part 4054 of such an attack, it would be reasonable for the server to close the 4055 connection after generating an appropriate number of 5yz (normally 4056 550) replies. 4058 7.9. Scope of Operation of SMTP Servers 4060 It is a well-established principle that an SMTP server may refuse to 4061 accept mail for any operational or technical reason that makes sense 4062 to the site providing the server. However, cooperation among sites 4063 and installations makes the Internet possible. If sites take 4064 excessive advantage of the right to reject traffic, the ubiquity of 4065 email availability (one of the strengths of the Internet) will be 4066 threatened; considerable care should be taken and balance maintained 4067 if a site decides to be selective about the traffic it will accept 4068 and process. 4070 In recent years, use of the relay function through arbitrary sites 4071 has been used as part of hostile efforts to hide the actual origins 4072 of mail. Some sites have decided to limit the use of the relay 4073 function to known or identifiable sources, and implementations SHOULD 4074 provide the capability to perform this type of filtering. When mail 4075 is rejected for these or other policy reasons, a 550 code SHOULD be 4076 used in response to EHLO (or HELO), [[CREF214: [2821]20050619 4077 Response to Vince Sabio note 20050302.]] MAIL, or RCPT as 4078 appropriate. 4080 8. IANA Considerations 4082 IANA maintains three registries in support of this specification, all 4083 of which were created for RFC 2821 or earlier. This document expands 4084 the third one as specified below. The registry references listed are 4085 as of the time of publication; IANA does not guarantee the locations 4086 associated with the URLs. The registries are as follows: 4088 o The first, "Simple Mail Transfer Protocol (SMTP) Service 4089 Extensions" [49], consists of SMTP service extensions with the 4090 associated keywords, and, as needed, parameters and verbs. As 4091 specified in Section 2.2.2, no entry may be made in this registry 4092 that starts in an "X". Entries may be made only for service 4093 extensions (and associated keywords, parameters, or verbs) that 4094 are defined in Standards-Track or Experimental RFCs specifically 4095 approved by the IESG for this purpose. 4097 o The second registry, "Address Literal Tags" [50], consists of 4098 "tags" that identify forms of domain literals other than those for 4099 IPv4 addresses (specified in RFC 821 and in this document). The 4100 initial entry in that registry is for IPv6 addresses (specified in 4101 this document). Additional literal types require standardization 4102 before being used; none are anticipated at this time. 4104 o The third, "Mail Transmission Types" [49], established by RFC 821 4105 and renewed by this specification, is a registry of link and 4106 protocol identifiers to be used with the "via" and "with" 4107 subclauses of the time stamp ("Received:" header field) described 4108 in Section 4.4. Link and protocol identifiers in addition to 4109 those specified in this document may be registered only by 4110 standardization or by way of an RFC-documented, IESG-approved, 4111 Experimental protocol extension. This name space is for 4112 identification and not limited in size: the IESG is encouraged to 4113 approve on the basis of clear documentation and a distinct method 4114 rather than preferences about the properties of the method itself. 4115 [[CREF215: [2821]Added 20050707 after IETF list discussion about 4116 registration policy]] 4118 An additional subsection has been added to the "VIA link types" 4119 and "WITH protocol types" subsections of this registry to contain 4120 registrations of "Additional-registered-clauses" as described 4121 above. The registry will contain clause names, a description, a 4122 summary of the syntax of the associated String, and a reference. 4123 As new clauses are defined, they may, in principle, specify 4124 creation of their own registries if the Strings consist of 4125 reserved terms or keywords rather than less restricted strings. 4126 As with link and protocol identifiers, additional clauses may be 4127 registered only by standardization or by way of an RFC-documented, 4128 IESG-approved, Experimental protocol extension. The additional 4129 clause name space is for identification and is not limited in 4130 size: the IESG is encouraged to approve on the basis of clear 4131 documentation, actual use or strong signs that the clause will be 4132 used, and a distinct requirement rather than preferences about the 4133 properties of the clause itself. 4135 In addition, if additional trace header fields (i.e., in addition to 4136 Return-path and Received) are ever created, those trace fields MUST 4137 be added to the IANA registry established by BCP 90 (RFC 3864) [10] 4138 for use with RFC 5322 [11]. 4140 9. Acknowledgments 4142 Many people contributed to the development of RFCs 2821 and 5321. 4143 Those documents should be consulted for those acknowledgments. 4145 Neither this document nor RFCs 2821 or 5321 would have been possible 4146 without the many contribution and insights of the late Jon Postel. 4147 Those contributions of course include the original specification of 4148 SMTP in RFC 821. A considerable quantity of text from RFC 821 still 4149 appears in this document as do several of Jon's original examples 4150 that have been updated only as needed to reflect other changes in the 4151 specification. 4153 The following filed errata against RFC 5321 that were not rejected at 4154 the time of submission: Jasen Betts, Adrien de Croy Guillaume Fortin- 4155 Debigare Roberto Javier Godoy, David Romerstein, Dominic Sayers, 4156 Rodrigo Speller, Alessandro Vesely, and Brett Watson. In addition, 4157 specific suggestions that led to corrections and improvements in this 4158 version were received from Ned Freed, Barry Leiba, Ivar Lumi, Pete 4159 Resnick, and others. 4161 10. References 4163 10.1. Normative References 4165 [1] Bradner, S., "Key words for use in RFCs to Indicate 4166 Requirement Levels", BCP 14, RFC 2119, 4167 DOI 10.17487/RFC2119, March 1997, 4168 . 4170 [2] American National Standards Institute (formerly United 4171 States of America Standards Institute), "USA Code for 4172 Information Interchange", ANSI X3.4-1968, 1968. 4174 ANSI X3.4-1968 has been replaced by newer versions with 4175 slight modifications, but the 1968 version remains 4176 definitive for the Internet. 4178 [3] Braden, R., Ed., "Requirements for Internet Hosts - 4179 Application and Support", STD 3, RFC 1123, 4180 DOI 10.17487/RFC1123, October 1989, 4181 . 4183 [4] Klensin, J., Freed, N., and K. Moore, "SMTP Service 4184 Extension for Message Size Declaration", STD 10, RFC 1870, 4185 DOI 10.17487/RFC1870, November 1995, 4186 . 4188 [5] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax 4189 Specifications: ABNF", STD 68, RFC 5234, 4190 DOI 10.17487/RFC5234, January 2008, 4191 . 4193 [6] Hinden, R. and S. Deering, "IP Version 6 Addressing 4194 Architecture", RFC 4291, DOI 10.17487/RFC4291, February 4195 2006, . 4197 [7] Mockapetris, P., "Domain names - implementation and 4198 specification", STD 13, RFC 1035, DOI 10.17487/RFC1035, 4199 November 1987, . 4201 [8] Postel, J., "Simple Mail Transfer Protocol", STD 10, 4202 RFC 821, DOI 10.17487/RFC0821, August 1982, 4203 . 4205 [9] Newman, C., "ESMTP and LMTP Transmission Types 4206 Registration", RFC 3848, DOI 10.17487/RFC3848, July 2004, 4207 . 4209 [10] Klyne, G., Nottingham, M., and J. Mogul, "Registration 4210 Procedures for Message Header Fields", BCP 90, RFC 3864, 4211 DOI 10.17487/RFC3864, September 2004, 4212 . 4214 [11] Resnick, P., "Internet Message Format", RFC 5322, 4215 September 2008. 4217 10.2. Informative References 4219 [12] Moore, K., "Simple Mail Transfer Protocol (SMTP) Service 4220 Extension for Delivery Status Notifications (DSNs)", 4221 RFC 3461, DOI 10.17487/RFC3461, January 2003, 4222 . 4224 [13] Moore, K. and G. Vaudreuil, "An Extensible Message Format 4225 for Delivery Status Notifications", RFC 3464, 4226 DOI 10.17487/RFC3464, January 2003, 4227 . 4229 [14] Nakamura, M. and J. Hagino, "SMTP Operational Experience 4230 in Mixed IPv4/v6 Environments", RFC 3974, 4231 DOI 10.17487/RFC3974, January 2005, 4232 . 4234 [15] Callas, J., Donnerhacke, L., Finney, H., Shaw, D., and R. 4235 Thayer, "OpenPGP Message Format", RFC 4880, 4236 DOI 10.17487/RFC4880, November 2007, 4237 . 4239 [16] Crocker, D., "STANDARD FOR THE FORMAT OF ARPA INTERNET 4240 TEXT MESSAGES", STD 11, RFC 822, DOI 10.17487/RFC0822, 4241 August 1982, . 4243 [17] Butler, M., Postel, J., Chase, D., Goldberger, J., and J. 4244 Reynolds, "Post Office Protocol: Version 2", RFC 937, 4245 DOI 10.17487/RFC0937, February 1985, 4246 . 4248 [18] Postel, J. and J. Reynolds, "File Transfer Protocol", 4249 STD 9, RFC 959, DOI 10.17487/RFC0959, October 1985, 4250 . 4252 [19] Partridge, C., "Mail routing and the domain system", 4253 STD 10, RFC 974, DOI 10.17487/RFC0974, January 1986, 4254 . 4256 [20] Partridge, C., "Duplicate messages and SMTP", RFC 1047, 4257 DOI 10.17487/RFC1047, February 1988, 4258 . 4260 [21] Lambert, M., "PCMAIL: A distributed mail system for 4261 personal computers", RFC 1056, DOI 10.17487/RFC1056, June 4262 1988, . 4264 [22] Crispin, M., "Interactive Mail Access Protocol: Version 4265 2", RFC 1176, DOI 10.17487/RFC1176, August 1990, 4266 . 4268 [23] Klensin, J., Freed, N., Rose, M., Stefferud, E., and D. 4269 Crocker, "SMTP Service Extension for 8bit-MIMEtransport", 4270 RFC 1652, DOI 10.17487/RFC1652, July 1994, 4271 . 4273 [24] Durand, A. and F. Dupont, "SMTP 521 Reply Code", RFC 1846, 4274 DOI 10.17487/RFC1846, September 1995, 4275 . 4277 [25] Galvin, J., Murphy, S., Crocker, S., and N. Freed, 4278 "Security Multiparts for MIME: Multipart/Signed and 4279 Multipart/Encrypted", RFC 1847, DOI 10.17487/RFC1847, 4280 October 1995, . 4282 [26] Klensin, J., Freed, N., Rose, M., Stefferud, E., and D. 4283 Crocker, "SMTP Service Extensions", STD 10, RFC 1869, 4284 DOI 10.17487/RFC1869, November 1995, 4285 . 4287 [27] Myers, J. and M. Rose, "Post Office Protocol - Version 3", 4288 STD 53, RFC 1939, DOI 10.17487/RFC1939, May 1996, 4289 . 4291 [28] De Winter, J., "SMTP Service Extension for Remote Message 4292 Queue Starting", RFC 1985, DOI 10.17487/RFC1985, August 4293 1996, . 4295 [29] Freed, N. and N. Borenstein, "Multipurpose Internet Mail 4296 Extensions (MIME) Part One: Format of Internet Message 4297 Bodies", RFC 2045, DOI 10.17487/RFC2045, November 1996, 4298 . 4300 [30] Moore, K., "MIME (Multipurpose Internet Mail Extensions) 4301 Part Three: Message Header Extensions for Non-ASCII Text", 4302 RFC 2047, DOI 10.17487/RFC2047, November 1996, 4303 . 4305 [31] Kille, S., "MIXER (Mime Internet X.400 Enhanced Relay): 4306 Mapping between X.400 and RFC 822/MIME", RFC 2156, 4307 DOI 10.17487/RFC2156, January 1998, 4308 . 4310 [32] Elz, R. and R. Bush, "Clarifications to the DNS 4311 Specification", RFC 2181, DOI 10.17487/RFC2181, July 1997, 4312 . 4314 [33] Freed, N. and K. Moore, "MIME Parameter Value and Encoded 4315 Word Extensions: Character Sets, Languages, and 4316 Continuations", RFC 2231, DOI 10.17487/RFC2231, November 4317 1997, . 4319 [34] Klensin, J., Ed., "Simple Mail Transfer Protocol", 4320 RFC 2821, DOI 10.17487/RFC2821, April 2001, 4321 . 4323 [35] Freed, N., "SMTP Service Extension for Command 4324 Pipelining", STD 60, RFC 2920, DOI 10.17487/RFC2920, 4325 September 2000, . 4327 [36] Freed, N., "Behavior of and Requirements for Internet 4328 Firewalls", RFC 2979, DOI 10.17487/RFC2979, October 2000, 4329 . 4331 [37] Vaudreuil, G., "SMTP Service Extensions for Transmission 4332 of Large and Binary MIME Messages", RFC 3030, 4333 DOI 10.17487/RFC3030, December 2000, 4334 . 4336 [38] Vaudreuil, G., "Enhanced Mail System Status Codes", 4337 RFC 3463, DOI 10.17487/RFC3463, January 2003, 4338 . 4340 [39] Crispin, M., "INTERNET MESSAGE ACCESS PROTOCOL - VERSION 4341 4rev1", RFC 3501, DOI 10.17487/RFC3501, March 2003, 4342 . 4344 [40] Hansen, T., Ed. and G. Vaudreuil, Ed., "Message 4345 Disposition Notification", RFC 3798, DOI 10.17487/RFC3798, 4346 May 2004, . 4348 [41] Ramsdell, B., Ed., "Secure/Multipurpose Internet Mail 4349 Extensions (S/MIME) Version 3.1 Message Specification", 4350 RFC 3851, DOI 10.17487/RFC3851, July 2004, 4351 . 4353 [42] Wong, M. and W. Schlitt, "Sender Policy Framework (SPF) 4354 for Authorizing Use of Domains in E-Mail, Version 1", 4355 RFC 4408, DOI 10.17487/RFC4408, April 2006, 4356 . 4358 [43] Gellens, R. and J. Klensin, "Message Submission for Mail", 4359 RFC 4409, DOI 10.17487/RFC4409, April 2006, 4360 . 4362 [44] Fenton, J., "Analysis of Threats Motivating DomainKeys 4363 Identified Mail (DKIM)", RFC 4686, DOI 10.17487/RFC4686, 4364 September 2006, . 4366 [45] Allman, E., Callas, J., Delany, M., Libbey, M., Fenton, 4367 J., and M. Thomas, "DomainKeys Identified Mail (DKIM) 4368 Signatures", RFC 4871, DOI 10.17487/RFC4871, May 2007, 4369 . 4371 [46] Hansen, T. and J. Klensin, "A Registry for SMTP Enhanced 4372 Mail System Status Codes", BCP 138, RFC 5248, 4373 DOI 10.17487/RFC5248, June 2008, 4374 . 4376 [47] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 4377 Resource Identifier (URI): Generic Syntax", STD 66, 4378 RFC 3986, DOI 10.17487/RFC3986, January 2005, 4379 . 4381 [48] Klensin, J., "SMTP 521 and 556 Reply Codes", RFC 7504, 4382 DOI 10.17487/RFC7504, June 2015, 4383 . 4385 [49] Internet Assigned Number Authority (IANA), "IANA Mail 4386 Parameters", 2007, 4387 . 4389 [50] Internet Assigned Number Authority (IANA), "Address 4390 Literal Tags", 2007, 4391 . 4393 [51] Levine, J. and M. Delany, "A "Null MX" No Service Resource 4394 Record for Domains that Accept No Mail", September 2014, 4395 . 4398 [52] RFC Editor, "RFC Errata - RFC 5321", 2019, 4399 . 4401 Captured 2019-11-19 4403 Appendix A. TCP Transport Service 4405 The TCP connection supports the transmission of 8-bit bytes. The 4406 SMTP data is 7-bit ASCII characters. Each character is transmitted 4407 as an 8-bit byte with the high-order bit cleared to zero. Service 4408 extensions may modify this rule to permit transmission of full 8-bit 4409 data bytes as part of the message body, or, if specifically designed 4410 to do so, in [[CREF216: [2821] JcK 20080406, remove double 'in', JcK 4411 20080504 ]] SMTP commands or responses. 4413 Appendix B. Generating SMTP Commands from RFC 822 Header Fields 4415 Some systems use an RFC 822 header section (only) in a mail 4416 submission protocol, or otherwise generate SMTP commands from RFC 822 4417 header fields [[CREF217: [2821]Issue 27 20070423]] when such a 4418 message is handed to an MTA from a UA. While the MTA-UA protocol is 4419 a private matter, not covered by any Internet Standard, there are 4420 problems with this approach. For example, there have been repeated 4421 problems with proper handling of "bcc" copies and redistribution 4422 lists when information that conceptually belongs to the mail envelope 4423 is not separated early in processing from header field information 4424 (and kept separate). 4426 It is recommended that the UA provide its initial ("submission 4427 client") MTA with an envelope separate from the message itself. 4428 However, if the envelope is not supplied, SMTP commands SHOULD be 4429 generated as follows: 4431 1. Each recipient address from a TO, CC, or BCC header field SHOULD 4432 be copied to a RCPT command (generating multiple message copies 4433 if that is required for queuing or delivery). This includes any 4434 addresses listed in a RFC 822 "group". Any BCC header fields 4435 SHOULD then be removed from the header section. Once this 4436 process is completed, the remaining header fields SHOULD be 4437 checked to verify that at least one TO, CC, or BCC header field 4438 remains. If none do, then a BCC header field with no additional 4439 information SHOULD be inserted as specified in [11]. 4441 2. The return address in the MAIL command SHOULD, if possible, be 4442 derived from the system's identity for the submitting (local) 4443 user, and the "From:" header field otherwise. If there is a 4444 system identity available, it SHOULD also be copied to the Sender 4445 header field if it is different from the address in the From 4446 header field. (Any Sender header field that was already there 4447 SHOULD be removed.) Systems may provide a way for submitters to 4448 override the envelope return address, but may want to restrict 4449 its use to privileged users. This will not prevent mail forgery, 4450 but may lessen its incidence; see Section 7.1. 4452 When an MTA is being used in this way, it bears responsibility for 4453 ensuring that the message being transmitted is valid. The mechanisms 4454 for checking that validity, and for handling (or returning) messages 4455 that are not valid at the time of arrival, are part of the MUA-MTA 4456 interface and not covered by this specification. 4458 A submission protocol based on Standard RFC 822 information alone 4459 MUST NOT be used to gateway a message from a foreign (non-SMTP) mail 4460 system into an SMTP environment. Additional information to construct 4461 an envelope must come from some source in the other environment, 4462 whether supplemental header fields or the foreign system's envelope. 4464 Attempts to gateway messages using only their header "To" and "Cc" 4465 fields have repeatedly caused mail loops and other behavior adverse 4466 to the proper functioning of the Internet mail environment. These 4467 problems have been especially common when the message originates from 4468 an Internet mailing list and is distributed into the foreign 4469 environment using envelope information. When these messages are then 4470 processed by a header-section-only remailer, loops back to the 4471 Internet environment (and the mailing list) are almost inevitable. 4473 Appendix C. Source Routes 4475 Historically, the was a reverse source routing list of 4476 hosts and a source mailbox. The first host in the was 4477 historically the host sending the MAIL command; today, source routes 4478 SHOULD NOT appear in the reverse-path. [[CREF218: [2821]Klensin- 4479 Ellerman 20040422]] Similarly, the may be a source 4480 routing lists of hosts and a destination mailbox. However, in 4481 general, the SHOULD contain only a mailbox and domain 4482 name, relying on the domain name system to supply routing information 4483 if required. The use of source routes is deprecated (see 4484 Appendix F.2); while servers MUST be prepared to receive and handle 4485 them as discussed in Section 3.3 and Appendix F.2, clients SHOULD NOT 4486 transmit them and this section is included in the current 4487 specification only to provide context. It has been modified somewhat 4488 from the material in RFC 821 to prevent server actions that might 4489 confuse clients or subsequent servers that do not expect a full 4490 source route implementation. [[CREF219: [2821] JcK 20040222 after 4491 repeated comments from Frank Ellermann, see below. ]] 4493 Historically, for relay purposes, the forward-path may have been a 4494 source route of the form "@ONE,@TWO:JOE@THREE", where ONE, TWO, and 4495 THREE MUST be fully-qualified domain names. This form was used to 4496 emphasize the distinction between an address and a route. The 4497 mailbox (here, JOE@THREE) is an absolute address, and the route is 4498 information about how to get there. The two concepts should not be 4499 confused.[[CREF220: [5321bis]JcK 20090123: Tightened this and the 4500 next paragraph to be clear that this doesn't authorize source route 4501 use.]] 4503 If source routes are used contrary to requirements and 4504 recommendations elsewhere in this specfiication, RFC 821 and the text 4505 below should be consulted for the mechanisms for constructing and 4506 updating the forward-path. A server that is reached by means of a 4507 source route (e.g., its domain name appears first in the list in the 4508 forward-path) MUST remove its domain name from any forward-paths in 4509 which that domain name appears before forwarding the message and MAY 4510 remove all other source routing information. The reverse-path SHOULD 4511 NOT be updated by servers conforming to this specification. 4513 [[CREF221: [2821] Modified the previous sentence and deleted the 4514 "SMTP server transforms... by moving..." paragraph as it makes no 4515 sense in the context of deprecated source-paths. JcK 20040222 after 4516 repeated comments from Frank Ellermann.]] 4518 Notice that the forward-path and reverse-path appear in the SMTP 4519 commands and replies, but not necessarily in the message. That is, 4520 there is no need for these paths and especially this syntax to appear 4521 in the "To:" , "From:", "CC:", etc. fields of the message header 4522 section. Conversely, SMTP servers MUST NOT derive final message 4523 routing information from message header fields.[[CREF222: 4524 [2821]"delivery" -> "routing", JcK 20070422]] 4526 When the list of hosts is present despite the recommendations and 4527 requirements [[CREF223: [5321bis]JcK 20090123 "and requrements" 4528 added]] above, it is a "reverse" source route and indicates that the 4529 mail was relayed through each host on the list (the first host in the 4530 list was the most recent relay). This list is used as a source route 4531 to return non-delivery notices to the sender. If, contrary to the 4532 recommendations here, a relay host adds itself to the beginning of 4533 the list, it MUST use its name as known in the transport environment 4534 to which it is relaying the mail rather than that of the transport 4535 environment from which the mail came (if they are different). Note 4536 that a situation could easily arise in which some relay hosts add 4537 their names to the reverse source route and others do not, generating 4538 discontinuities in the routing list. This is another reason why 4539 servers needing to return a message SHOULD ignore the source route 4540 entirely and simply use the domain as specified in the Mailbox. 4541 [[CREF224: [2821] JcK 20070422]] 4543 Appendix D. Scenarios 4545 This section presents complete scenarios of several types of SMTP 4546 sessions. In the examples, "C:" indicates what is said by the SMTP 4547 client, and "S:" indicates what is said by the SMTP server. 4549 D.1. A Typical SMTP Transaction Scenario 4551 This SMTP example shows mail sent by Smith at host bar.com, and to 4552 Jones, Green, and Brown at host foo.com. Here we assume that host 4553 bar.com contacts host foo.com directly. The mail is accepted for 4554 Jones and Brown. Green does not have a mailbox at host foo.com. 4556 S: 220 foo.com Simple Mail Transfer Service Ready 4557 C: EHLO bar.com 4558 S: 250-foo.com greets bar.com 4559 S: 250-8BITMIME 4560 S: 250-SIZE 4561 S: 250-DSN 4562 S: 250 HELP 4563 C: MAIL FROM: 4564 S: 250 OK 4565 C: RCPT TO: 4566 S: 250 OK 4567 C: RCPT TO: 4568 S: 550 No such user here 4569 C: RCPT TO: 4570 S: 250 OK 4571 C: DATA 4572 S: 354 Start mail input; end with . 4573 C: Blah blah blah... 4574 C: ...etc. etc. etc. 4575 C: . 4576 S: 250 OK 4577 C: QUIT 4578 S: 221 foo.com Service closing transmission channel 4580 D.2. Aborted SMTP Transaction Scenario 4582 S: 220 foo.com Simple Mail Transfer Service Ready 4583 C: EHLO bar.com 4584 S: 250-foo.com greets bar.com 4585 S: 250-8BITMIME 4586 S: 250-SIZE 4587 S: 250-DSN 4588 S: 250 HELP 4589 C: MAIL FROM: 4590 S: 250 OK 4591 C: RCPT TO: 4592 S: 250 OK 4593 C: RCPT TO: 4594 S: 550 No such user here 4595 C: RSET 4596 S: 250 OK 4597 C: QUIT 4598 S: 221 foo.com Service closing transmission channel 4600 D.3. Relayed Mail Scenario 4602 Step 1 -- Source Host to Relay Host 4604 [[CREF225: [2821]New intro paragraphs inserted and source routes 4605 removed, Klensin/ Gulbrandsen 20070430, per Tony 20070503]] The 4606 source host performs a DNS lookup on XYZ.COM (the destination 4607 address) and finds DNS MX records specifying xyz.com as the best 4608 preference and foo.com as a lower preference. It attempts to open a 4609 connection to xyz.com and fails. It then opens a connection to 4610 foo.com, with the following dialogue: 4612 S: 220 foo.com Simple Mail Transfer Service Ready 4613 C: EHLO bar.com 4614 S: 250-foo.com greets bar.com 4615 S: 250-8BITMIME 4616 S: 250-SIZE 4617 S: 250-DSN 4618 S: 250 HELP 4619 C: MAIL FROM: 4620 S: 250 OK 4621 C: RCPT TO: 4622 S: 250 OK 4623 C: DATA 4624 S: 354 Start mail input; end with . 4625 C: Date: Thu, 21 May 1998 05:33:29 -0700 4626 C: From: John Q. Public 4627 C: Subject: The Next Meeting of the Board 4628 C: To: Jones@xyz.com 4629 C: 4630 C: Bill: 4631 C: The next meeting of the board of directors will be 4632 C: on Tuesday. 4633 C: John. 4634 C: . 4635 S: 250 OK 4636 C: QUIT 4637 S: 221 foo.com Service closing transmission channel 4639 [[CREF226: [2821]Arnt suggests (20070430) addressing the Issue 25 NDN 4640 issue by adding something, probably in the middle of the above: 'I'd 4641 try to skirt the issue by saying "foo.com, having received the 4642 message, verifies delivery to jones@xyz.com is permissible and 4643 possible. foo.com now does a DNS lookup on xyz.com."' But it is wrong 4644 -- by the time the 250 reply goes back after RCPT, it is all over. 4645 And the only way to do a verification at that stage requires either 4646 local tables of complete info about foo.com or keeping the connection 4647 open in a rather different model than this example. I consider that 4648 a showstopper. -JcK 20070504]] 4650 Step 2 -- Relay Host to Destination Host 4652 foo.com, having received the message, now does a DNS lookup on 4653 xyz.com. It finds the same set of MX records, but cannot use the one 4654 that points to itself (or to any other host as a worse preference). 4655 It tries to open a connection to xyz.com itself and succeeds. Then 4656 we have: 4658 S: 220 xyz.com Simple Mail Transfer Service Ready 4659 C: EHLO foo.com 4660 S: 250 xyz.com is on the air 4661 C: MAIL FROM: 4662 S: 250 OK 4663 C: RCPT TO: 4664 S: 250 OK 4665 C: DATA 4666 S: 354 Start mail input; end with . 4667 C: Received: from bar.com by foo.com ; Thu, 21 May 1998 4668 C: 05:33:29 -0700 4669 C: Date: Thu, 21 May 1998 05:33:29 -0700 4670 C: From: John Q. Public 4671 C: Subject: The Next Meeting of the Board 4672 C: To: Jones@xyz.com 4673 C: 4674 C: Bill: 4675 C: The next meeting of the board of directors will be 4676 C: on Tuesday. 4677 C: John. 4678 C: . 4679 S: 250 OK 4680 C: QUIT 4681 S: 221 xyz.com Service closing transmission channel 4683 D.4. Verifying and Sending Scenario 4685 S: 220 foo.com Simple Mail Transfer Service Ready 4686 C: EHLO bar.com 4687 S: 250-foo.com greets bar.com 4688 S: 250-8BITMIME 4689 S: 250-SIZE 4690 S: 250-DSN 4691 S: 250-VRFY 4692 S: 250 HELP 4693 C: VRFY Crispin 4694 S: 250 Mark Crispin 4695 C: MAIL FROM: 4696 [[CREF227: [2821]Tony 20080320]] S: 250 OK 4697 C: RCPT TO: 4698 S: 250 OK 4699 C: DATA 4700 S: 354 Start mail input; end with . 4701 C: Blah blah blah... 4702 C: ...etc. etc. etc. 4703 C: . 4704 S: 250 OK 4705 C: QUIT 4706 S: 221 foo.com Service closing transmission channel 4708 Appendix E. Other Gateway Issues 4710 In general, gateways between the Internet and other mail systems 4711 SHOULD attempt to preserve any layering semantics across the 4712 boundaries between the two mail systems involved. Gateway- 4713 translation approaches that attempt to take shortcuts by mapping 4714 (such as mapping envelope information from one system to the message 4715 header section or body of another) have generally proven to be 4716 inadequate in important ways. Systems translating between 4717 environments that do not support both envelopes and a header section 4718 and Internet mail must be written with the understanding that some 4719 information loss is almost inevitable. 4721 Appendix F. Deprecated Features of RFC 821 4723 A few features of RFC 821 have proven to be problematic and SHOULD 4724 NOT be used in Internet mail. Some of these features were deprecated 4725 in RFC 2821 in 2001; source routing and two-digit years in dates were 4726 deprecated by RFC 1123 in 1989. Of the domain literal forms, RFC 4727 1123 required support only for the dotted decimal form. With the 4728 possible exception of old, hardware-embedded, applications, there is 4729 no longer any excuse for these features to appear on the contemporary 4730 Internet. [[CREF228: [5321bis] (2821ter) 2821bis Last Call Comment]] 4732 F.1. TURN 4734 This command, described in RFC 821, raises important security issues 4735 since, in the absence of strong authentication of the host requesting 4736 that the client and server switch roles, it can easily be used to 4737 divert mail from its correct destination. Its use is deprecated; 4738 SMTP systems SHOULD NOT use it unless the server can authenticate the 4739 client. 4741 F.2. Source Routing 4743 RFC 821 utilized the concept of explicit source routing to get mail 4744 from one host to another via a series of relays. The requirement to 4745 utilize source routes in regular mail traffic was eliminated by the 4746 introduction of the domain name system "MX" record and the last 4747 significant justification for them was eliminated by the 4748 introduction, in RFC 1123, of a clear requirement that addresses 4749 following an "@" must all be fully-qualified domain names. 4750 Consequently, the only remaining justifications for the use of source 4751 routes are support for very old SMTP clients or MUAs and in mail 4752 system debugging. They can, however, still be useful in the latter 4753 circumstance and for routing mail around serious, but temporary, 4754 problems such as problems with the relevant DNS records. 4756 SMTP servers MUST continue to accept source route syntax as specified 4757 in the main body of this document and in RFC 1123. They MAY, if 4758 necessary, ignore the routes and utilize only the target domain in 4759 the address. If they do utilize the source route, the message MUST 4760 be sent to the first domain shown in the address. In particular, a 4761 server MUST NOT guess at shortcuts within the source route. 4763 Clients SHOULD NOT utilize explicit source routing except under 4764 unusual circumstances, such as debugging or potentially relaying 4765 around firewall or mail system configuration errors. 4767 F.3. HELO 4769 As discussed in Sections 3.1 and 4.1.1, EHLO SHOULD be used rather 4770 than HELO when the server will accept the former. Servers MUST 4771 continue to accept and process HELO in order to support older 4772 clients. [[CREF229: [2821]Preferred->Should, etc. Issue 16 4773 20070421]] 4775 F.4. #-literals 4777 RFC 821 provided for specifying an Internet address as a decimal 4778 integer host number prefixed by a pound sign, "#". In practice, that 4779 form has been obsolete since the introduction of TCP/IP. It is 4780 deprecated and MUST NOT be used. 4782 F.5. Dates and Years 4784 When dates are inserted into messages by SMTP clients or servers 4785 (e.g., in trace header fields), four-digit years MUST BE used. Two- 4786 digit years are deprecated; three-digit years were never permitted in 4787 the Internet mail system. 4789 F.6. Sending versus Mailing 4791 In addition to specifying a mechanism for delivering messages to 4792 user's mailboxes, RFC 821 provided additional, optional, commands to 4793 deliver messages directly to the user's terminal screen. These 4794 commands (SEND, SAML, SOML) were rarely implemented, and changes in 4795 workstation technology and the introduction of other protocols may 4796 have rendered them obsolete even where they are implemented. 4797 [[5321bis Editor's Note: does this need a stronger reference to 821, 4798 2821, and/or 5321?]] 4800 Clients SHOULD NOT provide SEND, SAML, or SOML as services. Servers 4801 MAY implement them. If they are implemented by servers, the 4802 implementation model specified in RFC 821 MUST be used and the 4803 command names MUST be published in the response to the EHLO command. 4805 Appendix G. Change log for RFC 5321bis 4807 [[RFC Editor: Please remove this section before publication.]] 4809 G.1. RFC 5321 Errata Summary 4811 This document addresses the following errata filed against RFC 5321 4812 since its publication in October 2008 [52]. [[CREF230: [[Note in 4813 Draft: Items with comments below have not yet been resolved.]]]] 4815 1683 ABNF error. Section 4.4 4817 4198 Description error. Section 4.2 4819 2578 Syntax description error. Section 4.1.2 4821 1543 Wrong code in description Section 3.8 4823 4315 ABNF - IPv6 Section 4.1.3. [[CREF231: [5321bis]The IPv6 syntax 4824 has been adjusted since 5321 was published. See the rewritten 4825 form and the comment in the section cited in the previous 4826 sentence. The editor awaits instructions. See https://www.rfc- 4827 editor.org/errata/eid4315]] 4829 5414 ABNF for Quoted-string Section 4.1.2 4830 1851 Location of text on unexpected close Section 4.1.1.5. 4831 [[CREF232: [5321bis]Matter of taste, editor seeks advice.]] 4833 3447 Use of normative language (e.g., more "MUST"s), possible 4834 confusion in some sections Section 4.4. [[CREF233: [5321bis]As 4835 Barry notes in his verifier comments on the erratum (see 4836 https://www.rfc-editor.org/errata/eid3447), the comments and 4837 suggestions here raise a number of interesting (and difficult) 4838 issues. One of the issues is that the core of RFCs 5321 (and 4839 2821) is text carried over from Jon Postel's RFC 821, a document 4840 that was not only written in a different style than the IETF uses 4841 today but that was written at a time when no one had dreamt of RFC 4842 2119 or even the IETF itself. It appears to me that trying to 4843 patch that style might easily result in a document that is harder 4844 to read as well as being error prone. If we want to get the 4845 document entirely into contemporary style, we really should bite 4846 the bullet and do a complete rewrite. To respond to a different 4847 point in Barry's discussion, I think an explicit statement that 4848 5321/5322 and their predecessors differ in places and why would be 4849 helpful. Text, and suggestions about where to put it, are 4850 solicited. A list of differences might be a good idea too, but 4851 getting it right might be more work than there is available energy 4852 to do correctly. ]] 4854 5711 Missing leading spaces in example Appendix D.3. [[CREF234: 4855 [5321bis]Well, this is interesting because the XML is correct and 4856 the spaces are there, embedded in artwork. So either the XML2RFC 4857 processor at the time took those leading spaces out or the RFC 4858 Editor improved on the document and the change was not caught in 4859 AUTH48, perhaps because rfcdiff ignores white space. We just need 4860 to watch for future iterations. ]] 4862 [[CREF235: [5321bis]Note that rejected errata have _not_ been 4863 reviewed to see if they contain anything useful that should be 4864 discussed again with the possibility of rethinking and changing text. 4865 Volunteers sought.]] 4867 G.2. Changes from RFC 5321 (published October 2008) to the initial 4868 (-00) version of this draft 4870 o Acknowledgments section (Section 9) trimmed back for new document. 4872 o Introductory paragraph to Appendix F extended to make it clear 4873 that these features were deprecated a long time ago and really 4874 should not be in use any more. 4876 o Adjusted some language to clarify that source routes really, 4877 really, should not be used or depended upon. 4879 o IPv6 address syntax replaced by a copy of the IPv6 URI syntax and 4880 a note added. 4882 o Production index added as a first step in tying all productions to 4883 their sources. As part of the effort to make the document more 4884 easily navigable, table of contents entries have been created for 4885 the individual command descriptions. 4887 o Clarified the relationship between the SMTP "letters, digits, and 4888 hyphens" and DNS "preferred name syntax" (Section 2.3.5). 4890 o Revised the reply code sections to add new 521 and 556 codes, 4891 clarify relationships, and be explicit about the requirement for 4892 clients to rely on first digits rather than the sequences in 4893 Section 4.3.2. 4895 o In conjunction with the above, explicitly obsolete RFCs 1846 and 4896 7504. 4898 o Incorporated a correction reflecting Errata ID 2578. 4900 o Some small editorial changes made to eliminate redundant 4901 statements that were very close together. Other, equally small, 4902 editorial changes have been made to improve grammar or clarity. 4904 o A few questions, marked "[[5321bis Editor's Note:", or "[[Note in 4905 Draft" have been added for the group to resolve. Other questions, 4906 especially those in the errata summary, are simply included in 4907 narrative comments in CREFs. 4909 o Checked and rationalized "response" (to a command) and "reply 4910 code" terminology. One can talk about a "999 response" but only a 4911 "999 reply code". There is no such thing as a "response code". 4913 o Added note about length limit on mailbox names ("email 4914 addresses"). 4916 o Added an "errata summary" subsection to this change log/ 4917 comparison to 5321 in this Appendix. The entire Appendix will, of 4918 course, disappear at the time of RFC publication unless someone 4919 wants to make a strong case for retaining it. 4921 o Rationalized CREFs to 2821, 5321, 5321bis etc.; added note to 4922 readers below the Abstract. 4924 o Temporarily added a "Note on Reading This Working Draft" after the 4925 Abstract. 4927 Index 4929 A 4930 Argument Syntax 4931 A-d-l 44 4932 Additional-Registered-Clauses 67 4933 address-literal 45 4934 Addtl-Link 67 4935 Addtl-Protocol 67 4936 Argument 44 4937 At-domain 44 4938 Atom 45 4939 By-domain 66 4940 dcontent 47 4941 Domain 45 4942 Dot-string 45 4943 esmtp-keyword 44 4944 esmtp-param 44 4945 esmtp-value 44 4946 Extended-Domain 66 4947 For 66 4948 Forward-Path 44 4949 From-domain 66 4950 General-address-literal 47 4951 Greeting 51 4952 h16 48 4953 ID 66 4954 IPv4-address-literal 47 4955 IPv6-addr 47 4956 IPv6-address-literal 47 4957 Keyword 44 4958 Ldh-str 45 4959 Let-dig 45 4960 Link 67 4961 Local-part 45 4962 ls32 47 4963 Mail-parameters 44 4964 Mailbox 45 4965 Opt-info 66 4966 Path 44 4967 Protocol 67 4968 QcontentSMTP 45 4969 qtextSMTP 45 4970 quoted-pairSMTP 45 4971 Quoted-string 45 4972 Rcpt-parameters 44 4973 Reply-code 51 4974 Reply-line 51 4975 Return-path-line 65 4976 Reverse-Path 44 4977 Snum 47 4978 Stamp 66 4979 Standardized-tag 47 4980 String 45 4981 sub-domain 45 4982 TCP-info 66 4983 textstring 51 4984 Time-stamp-line 65 4985 Via 66 4986 With 66 4988 C 4989 Command Syntax 4990 data 40 4991 expn 42 4992 help 42 4993 mail 37 4994 noop 43 4995 quit 43 4996 rcpt 39 4997 rset 41 4998 vrfy 41 5000 Author's Address 5002 John C. Klensin 5003 1770 Massachusetts Ave, Suite 322 5004 Cambridge, MA 02140 5005 USA 5007 EMail: john-ietf@jck.com